text: window.webglviewer=function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=24)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.WebGL2=class{constructor(){}}},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i=r(n(16)),o=n(7);class s{constructor(e){this.values=new Float32Array(3),void 0!==e&&(this.xyz=e)}get x(){return this.values[0]}get y(){return this.values[1]}get z(){return this.values[2]}get xy(){return[this.values[0],this.values[1]]}get xyz(){return[this.values[0],this.values[1],this.values[2]]}set x(e){this.values[0]=e}set y(e){this.values[1]=e}set z(e){this.values[2]=e}set xy(e){this.values[0]=e[0],this.values[1]=e[1]}set xyz(e){this.values[0]=e[0],this.values[1]=e[1],this.values[2]=e[2]}at(e){return this.values[e]}toArray(){return Array.from(this.values)}size(){return 3}reset(){this.x=0,this.y=0,this.z=0}copy(e){return e||(e=new s),e.x=this.x,e.y=this.y,e.z=this.z,e}inverse(e){return e||(e=this),e.x=1/this.x,e.y=1/this.y,e.z=1/this.z,e}negate(e){return e||(e=this),e.x=-this.x,e.y=-this.y,e.z=-this.z,e}equals(e,t=o.epsilon){return!(Math.abs(this.x-e.x)>t)&&(!(Math.abs(this.y-e.y)>t)&&!(Math.abs(this.z-e.z)>t))}length(){return Math.sqrt(this.squaredLength())}squaredLength(){const e=this.x,t=this.y,n=this.z;return e*e+t*t+n*n}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}subtract(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}scale(e,t){return t||(t=this),t.x*=e,t.y*=e,t.z*=e,t}normalize(e){e||(e=this);let t=this.length();return 1===t?this:0===t?(e.x=0,e.y=0,e.z=0,e):(t=1/t,e.x*=t,e.y*=t,e.z*=t,e)}multiplyByMat3(e,t){return t||(t=this),e.multiplyVec3(this,t)}multiplyByQuat(e,t){return t||(t=this),e.multiplyVec3(this,t)}toQuat(e){e||(e=new i.default);const t=new s,n=new s;return t.x=Math.cos(.5*this.x),n.x=Math.sin(.5*this.x),t.y=Math.cos(.5*this.y),n.y=Math.sin(.5*this.y),t.z=Math.cos(.5*this.z),n.z=Math.sin(.5*this.z),e.x=n.x*t.y*t.z-t.x*n.y*n.z,e.y=t.x*n.y*t.z+n.x*t.y*n.z,e.z=t.x*t.y*n.z-n.x*n.y*t.z,e.w=t.x*t.y*t.z+n.x*n.y*n.z,e}static ceil(e,t){return t||(t=new s),t.x=Math.ceil(e.x),t.y=Math.ceil(e.y),t.z=Math.ceil(e.z),t}static floor(e,t){return t||(t=new s),t.x=Math.floor(e.x),t.y=Math.floor(e.y),t.z=Math.floor(e.z),t}static cross(e,t,n){n||(n=new s);const r=e.x,i=e.y,o=e.z,a=t.x,l=t.y,u=t.z;return n.x=i*u-o*l,n.y=o*a-r*u,n.z=r*l-i*a,n}static dot(e,t){const n=e.x,r=e.y,i=e.z;return n*t.x+r*t.y+i*t.z}static dot2(e){return this.dot(e,e)}static distance(e,t){t.x,e.x,t.y,e.y,t.z,e.z;return Math.sqrt(this.squaredDistance(e,t))}static squaredDistance(e,t){const n=t.x-e.x,r=t.y-e.y,i=t.z-e.z;return n*n+r*r+i*i}static direction(e,t,n){n||(n=new s);const r=e.x-t.x,i=e.y-t.y,o=e.z-t.z;let a=Math.sqrt(r*r+i*i+o*o);return 0===a?(n.x=0,n.y=0,n.z=0,n):(a=1/a,n.x=r*a,n.y=i*a,n.z=o*a,n)}static mix(e,t,n,r){return r||(r=new s),r.x=e.x+n*(t.x-e.x),r.y=e.y+n*(t.y-e.y),r.z=e.z+n*(t.z-e.z),r}static sum(e,t,n){return n||(n=new s),n.x=e.x+t.x,n.y=e.y+t.y,n.z=e.z+t.z,n}static difference(e,t,n){return n||(n=new s),n.x=e.x-t.x,n.y=e.y-t.y,n.z=e.z-t.z,n}static product(e,t,n){return n||(n=new s),n.x=e.x*t.x,n.y=e.y*t.y,n.z=e.z*t.z,n}static quotient(e,t,n){return n||(n=new s),n.x=e.x/t.x,n.y=e.y/t.y,n.z=e.z/t.z,n}static min(e,t,n){return n||(n=new s),n.x=Math.min(e.x,t.x),n.y=Math.min(e.y,t.y),n.z=Math.min(e.z,t.z),n}static max(e,t,n){return n||(n=new s),n.x=Math.max(e.x,t.x),n.y=Math.max(e.y,t.y),n.z=Math.max(e.z,t.z),n}static clamp(e,t,n,r){return r||(r=new s),r.x=Math.min(Math.max(e.x,t.x),n.x),r.y=Math.min(Math.max(e.y,t.y),n.y),r.z=Math.min(Math.max(e.z,t.z),n.z),r}}t.default=s,s.zero=new s([0,0,0]),s.one=new s([1,1,1]),s.up=new s([0,1,0]),s.right=new s([1,0,0]),s.forward=new s([0,0,-1])},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(0);class i extends r.WebGL2{static getNextBufferPnt(){return++this.BUFFER_PNT_CNT}static getNextTexPnt(){return++this.TEX_PNT_CNT}static CheckGLError(){const e=r.WebGL2.context.getError();if(e!=r.WebGL2.context.NO_ERROR)throw new Error(i.glErrorMap.get(e))}static finish(){r.WebGL2.context.finish()}}t.GLHelper=i,i.glErrorMap=new Map([[WebGL2RenderingContext.NO_ERROR,"NO_ERROR: No error has been recorded."],[WebGL2RenderingContext.INVALID_ENUM,"INVALID_ENUM: An unacceptable value has been specified for an enumerated argument. The command is ignored and the error flag is set."],[WebGL2RenderingContext.INVALID_VALUE,"INVALID_VALUE: A numeric argument is out of range. The command is ignored and the error flag is set."],[WebGL2RenderingContext.INVALID_OPERATION,"INVALID_OPERATION: The specified command is not allowed for the current state. The command is ignored and the error flag is set."],[WebGL2RenderingContext.OUT_OF_MEMORY,"OUT_OF_MEMORY: Not enough memory is left to execute the command."],[WebGL2RenderingContext.INVALID_FRAMEBUFFER_OPERATION,"INVALID_FRAMEBUFFER_OPERATION: The currently bound framebuffer is not framebuffer complete when trying to render to or to read from it."],[WebGL2RenderingContext.CONTEXT_LOST_WEBGL,"CONTEXT_LOST_WEBGL: If the WebGL context is lost. Until the context is restored, it returns gl.NO_ERROR."]]),i.BUFFER_PNT_CNT=0,i.TEX_PNT_CNT=0},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i=n(5),o=n(19),s=n(36),a=n(37),l=n(38),u=n(4),c=n(0),f=n(39),d=n(22),h=r(n(1)),p=n(40),m=n(41);class v{copy(e){e.type=this.type,e.size=this.size,e.elementType=this.elementType,e.bytesPerElement=this.bytesPerElement,e.info=this.info,e.timestamp=this.timestamp}}t.UniHeader=v;class y extends v{copy(e){super.copy(e),e.gridType=this.gridType,e.sizeT=this.sizeT}}t.UniGridHeader=y;class x extends v{constructor(e){super(),this.mStructBuffer=new u.StructBuffer([new u.StructEntry("type",u.DataTypes.UINT8,4),new u.StructEntry("count",u.DataTypes.INT32),new u.StructEntry("size",u.DataTypes.INT32,3),new u.StructEntry("elementType",u.DataTypes.INT32),new u.StructEntry("bytesPerElement",u.DataTypes.INT32),new u.StructEntry("info",u.DataTypes.UINT8,256),new u.StructEntry("timestamp",u.DataTypes.FLOAT64)]),this.mStructBuffer.setBuffer(e),this.type=String.fromCharCode.apply(null,this.mStructBuffer.get("type")),this.count=this.mStructBuffer.get("count"),this.size=new h.default(this.mStructBuffer.get("size")),this.elementType=this.mStructBuffer.get("elementType"),this.bytesPerElement=this.mStructBuffer.get("bytesPerElement"),this.info=String.fromCharCode.apply(null,this.mStructBuffer.get("info")),this.timestamp=this.mStructBuffer.get("timestamp")}copy(e){super.copy(e),e.count=this.count}}t.UniPartHeader=x,x.BYTE_SIZE=292;class g extends y{constructor(e){super(),this.mStructBuffer=new u.StructBuffer([new u.StructEntry("type",u.DataTypes.UINT8,4),new u.StructEntry("size",u.DataTypes.INT32,3),new u.StructEntry("gridType",u.DataTypes.INT32),new u.StructEntry("elementType",u.DataTypes.INT32),new u.StructEntry("bytesPerElement",u.DataTypes.INT32),new u.StructEntry("info",u.DataTypes.UINT8,256),new u.StructEntry("timestamp",u.DataTypes.FLOAT64),new u.StructEntry("sizeT",u.DataTypes.INT32)]),this.mStructBuffer.setBuffer(e),this.type=String.fromCharCode.apply(null,this.mStructBuffer.get("type")),this.size=new h.default(this.mStructBuffer.get("size")),this.gridType=this.mStructBuffer.get("gridType"),this.elementType=this.mStructBuffer.get("elementType"),this.bytesPerElement=this.mStructBuffer.get("bytesPerElement"),this.info=String.fromCharCode.apply(null,this.mStructBuffer.get("info")),this.timestamp=this.mStructBuffer.get("timestamp"),e.byteLength>g.BYTE_SIZE&&(this.sizeT=this.mStructBuffer.get("sizeT"))}}g.BYTE_SIZE=292;class T extends y{constructor(e){super(),this.mStructBuffer=new u.StructBuffer([new u.StructEntry("type",u.DataTypes.UINT8,4),new u.StructEntry("size",u.DataTypes.INT32,3),new u.StructEntry("gridType",u.DataTypes.INT32),new u.StructEntry("elementType",u.DataTypes.INT32),new u.StructEntry("bytesPerElement",u.DataTypes.INT32),new u.StructEntry("info",u.DataTypes.UINT8,252),new u.StructEntry("sizeT",u.DataTypes.INT32),new u.StructEntry("timestamp",u.DataTypes.FLOAT64)]),this.mStructBuffer.setBuffer(e),this.type=String.fromCharCode.apply(null,this.mStructBuffer.get("type")),this.size=new h.default(this.mStructBuffer.get("size")),this.gridType=this.mStructBuffer.get("gridType"),this.elementType=this.mStructBuffer.get("elementType"),this.bytesPerElement=this.mStructBuffer.get("bytesPerElement"),this.info=String.fromCharCode.apply(null,this.mStructBuffer.get("info")),this.sizeT=this.mStructBuffer.get("sizeT"),this.timestamp=this.mStructBuffer.get("timestamp")}}T.BYTE_SIZE=292;class b extends c.WebGL2{static createGridFromOther(e,t=!1){let n;return n=new i.GridBase(e.getSize(),e.getType(),e.getSizeT(),e.getBoundary(),e.getBoundaryVal()),t&&n.copy(e),n}static createFloatGrid(e,t=1,n=h.default.zero.copy()){return new s.FloatGrid(e,t,n)}static createVec3Grid(e,t=1,n=h.default.zero.copy()){return new a.Vec3Grid(e,t,n)}static createVec4Grid(e,t=1,n=h.default.zero.copy()){return new l.Vec4Grid(e,t,n)}static getUniHeader(e){let t=b.getUniFileType(e);if("PB02"!==t&&"M4T3"!==t&&"M4T2"!==t&&"MNT3"!==t&&"MNT2"!==t)return console.error("'"+t+"' format not supported, have to be PB02, M4T3, M4T2, MNT3 or MNT2!"),null;if("MNT2"===t){let t=new g(e.slice(0,g.BYTE_SIZE));return t.sizeT=1,t}if("M4T2"==t)return new g(e.slice(0,g.BYTE_SIZE+4));if("M4T3"==t||"MNT3"==t){let t=new T(e.slice(0,T.BYTE_SIZE));return 0===t.sizeT&&(t.sizeT=1),t}return new x(e.slice(0,x.BYTE_SIZE))}static getUniFileType(e){return String.fromCharCode.apply(null,Array.from(new Uint8Array(e,0,4)))}static createGridFromUni(e,t=h.default.zero.copy(),n){let r,i,o,u=b.getUniFileType(e);if("M4T3"!==u&&"M4T2"!==u&&"MNT3"!==u&&"MNT2"!==u)return console.error("'"+u+"' format not supported, have to be M4T3, M4T2, MNT3 or MNT2!"),null;switch("MNT2"===u?((i=new g(e.slice(0,g.BYTE_SIZE))).sizeT=1,o=g.BYTE_SIZE):"M4T2"==u?(i=new g(e.slice(0,g.BYTE_SIZE+4)),o=g.BYTE_SIZE+4):(0===(i=new T(e.slice(0,T.BYTE_SIZE))).sizeT&&(i.sizeT=1),o=T.BYTE_SIZE),i.elementType){case 0:return console.error("INT Grid not yet supported!"),null;case 1:(r=new s.FloatGrid(i.size,i.sizeT,t)).load(new Float32Array(e,o));break;case 2:(r=12==i.bytesPerElement?new a.Vec3Grid(i.size,i.sizeT,t):new l.Vec4Grid(i.size,i.sizeT,t)).load(new Float32Array(e,o))}return n&&i.copy(n),r}static createTextureWithConstCol(e){let t=c.WebGL2.context.createTexture();return c.WebGL2.context.bindTexture(WebGL2RenderingContext.TEXTURE_2D,t),c.WebGL2.context.texParameteri(WebGL2RenderingContext.TEXTURE_2D,WebGL2RenderingContext.TEXTURE_MIN_FILTER,c.WebGL2.context.NEAREST),c.WebGL2.context.texParameteri(WebGL2RenderingContext.TEXTURE_2D,WebGL2RenderingContext.TEXTURE_MAG_FILTER,c.WebGL2.context.NEAREST),c.WebGL2.context.texImage2D(WebGL2RenderingContext.TEXTURE_2D,0,WebGL2RenderingContext.RGBA8,1,1,0,WebGL2RenderingContext.RGBA,WebGL2RenderingContext.UNSIGNED_BYTE,new Uint8Array(e.copy().scale(255).toArray())),c.WebGL2.context.bindTexture(c.WebGL2.context.TEXTURE_2D,null),t}static createTextureFromArray(e){let t=c.WebGL2.context.createTexture(),n=Math.sqrt(e.length/4);return c.WebGL2.context.bindTexture(WebGL2RenderingContext.TEXTURE_2D,t),c.WebGL2.context.texParameteri(WebGL2RenderingContext.TEXTURE_2D,WebGL2RenderingContext.TEXTURE_MIN_FILTER,c.WebGL2.context.LINEAR),c.WebGL2.context.texParameteri(WebGL2RenderingContext.TEXTURE_2D,WebGL2RenderingContext.TEXTURE_MAG_FILTER,c.WebGL2.context.LINEAR),c.WebGL2.context.texParameteri(WebGL2RenderingContext.TEXTURE_2D,WebGL2RenderingContext.TEXTURE_WRAP_R,WebGL2RenderingContext.CLAMP_TO_EDGE),c.WebGL2.context.texParameteri(WebGL2RenderingContext.TEXTURE_2D,WebGL2RenderingContext.TEXTURE_WRAP_S,WebGL2RenderingContext.CLAMP_TO_EDGE),c.WebGL2.context.texParameteri(WebGL2RenderingContext.TEXTURE_2D,WebGL2RenderingContext.TEXTURE_WRAP_T,WebGL2RenderingContext.CLAMP_TO_EDGE),c.WebGL2.context.texImage2D(WebGL2RenderingContext.TEXTURE_2D,0,WebGL2RenderingContext.RGBA8,n,n,0,WebGL2RenderingContext.RGBA,WebGL2RenderingContext.UNSIGNED_BYTE,new Uint8Array(e)),c.WebGL2.context.bindTexture(c.WebGL2.context.TEXTURE_2D,null),t}static createTextureFromImage(e){let t=c.WebGL2.context.createTexture();return c.WebGL2.context.bindTexture(WebGL2RenderingContext.TEXTURE_2D,t),c.WebGL2.context.texParameteri(WebGL2RenderingContext.TEXTURE_2D,WebGL2RenderingContext.TEXTURE_MIN_FILTER,c.WebGL2.context.LINEAR),c.WebGL2.context.texParameteri(WebGL2RenderingContext.TEXTURE_2D,WebGL2RenderingContext.TEXTURE_MAG_FILTER,c.WebGL2.context.LINEAR),c.WebGL2.context.texParameteri(WebGL2RenderingContext.TEXTURE_2D,WebGL2RenderingContext.TEXTURE_WRAP_R,WebGL2RenderingContext.CLAMP_TO_EDGE),c.WebGL2.context.texParameteri(WebGL2RenderingContext.TEXTURE_2D,WebGL2RenderingContext.TEXTURE_WRAP_S,WebGL2RenderingContext.CLAMP_TO_EDGE),c.WebGL2.context.texParameteri(WebGL2RenderingContext.TEXTURE_2D,WebGL2RenderingContext.TEXTURE_WRAP_T,WebGL2RenderingContext.CLAMP_TO_EDGE),c.WebGL2.context.texImage2D(WebGL2RenderingContext.TEXTURE_2D,0,WebGL2RenderingContext.RGBA8,WebGL2RenderingContext.RGBA,WebGL2RenderingContext.UNSIGNED_BYTE,e),c.WebGL2.context.bindTexture(c.WebGL2.context.TEXTURE_2D,null),t}static createCubeTextureFromConstCol(e){let t=c.WebGL2.context.createTexture();c.WebGL2.context.bindTexture(WebGL2RenderingContext.TEXTURE_CUBE_MAP,t),c.WebGL2.context.texParameteri(WebGL2RenderingContext.TEXTURE_CUBE_MAP,WebGL2RenderingContext.TEXTURE_MIN_FILTER,c.WebGL2.context.LINEAR),c.WebGL2.context.texParameteri(WebGL2RenderingContext.TEXTURE_CUBE_MAP,WebGL2RenderingContext.TEXTURE_MAG_FILTER,c.WebGL2.context.LINEAR),c.WebGL2.context.texParameteri(WebGL2RenderingContext.TEXTURE_CUBE_MAP,WebGL2RenderingContext.TEXTURE_WRAP_R,WebGL2RenderingContext.CLAMP_TO_EDGE),c.WebGL2.context.texParameteri(WebGL2RenderingContext.TEXTURE_CUBE_MAP,WebGL2RenderingContext.TEXTURE_WRAP_S,WebGL2RenderingContext.CLAMP_TO_EDGE),c.WebGL2.context.texParameteri(WebGL2RenderingContext.TEXTURE_CUBE_MAP,WebGL2RenderingContext.TEXTURE_WRAP_T,WebGL2RenderingContext.CLAMP_TO_EDGE);for(let t=0;t<6;t++)c.WebGL2.context.texImage2D(WebGL2RenderingContext.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,WebGL2RenderingContext.RGBA8,1,1,0,WebGL2RenderingContext.RGBA,WebGL2RenderingContext.UNSIGNED_BYTE,new Uint8Array(e.copy().scale(255).toArray()));return t}static createCubeTextureFromArray(e){let t=c.WebGL2.context.createTexture(),n=Math.sqrt(e[0].length/4);c.WebGL2.context.bindTexture(WebGL2RenderingContext.TEXTURE_CUBE_MAP,t),c.WebGL2.context.texParameteri(WebGL2RenderingContext.TEXTURE_CUBE_MAP,WebGL2RenderingContext.TEXTURE_MIN_FILTER,c.WebGL2.context.LINEAR),c.WebGL2.context.texParameteri(WebGL2RenderingContext.TEXTURE_CUBE_MAP,WebGL2RenderingContext.TEXTURE_MAG_FILTER,c.WebGL2.context.LINEAR),c.WebGL2.context.texParameteri(WebGL2RenderingContext.TEXTURE_CUBE_MAP,WebGL2RenderingContext.TEXTURE_WRAP_R,WebGL2RenderingContext.CLAMP_TO_EDGE),c.WebGL2.context.texParameteri(WebGL2RenderingContext.TEXTURE_CUBE_MAP,WebGL2RenderingContext.TEXTURE_WRAP_S,WebGL2RenderingContext.CLAMP_TO_EDGE),c.WebGL2.context.texParameteri(WebGL2RenderingContext.TEXTURE_CUBE_MAP,WebGL2RenderingContext.TEXTURE_WRAP_T,WebGL2RenderingContext.CLAMP_TO_EDGE);for(let t=0;t<6;t++)c.WebGL2.context.texImage2D(WebGL2RenderingContext.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,WebGL2RenderingContext.RGBA8,n,n,0,WebGL2RenderingContext.RGBA,WebGL2RenderingContext.UNSIGNED_BYTE,new Uint8Array(e[t]));return t}static createCubeTextureFromImages(e){let t=c.WebGL2.context.createTexture();c.WebGL2.context.bindTexture(WebGL2RenderingContext.TEXTURE_CUBE_MAP,t),c.WebGL2.context.texParameteri(WebGL2RenderingContext.TEXTURE_CUBE_MAP,WebGL2RenderingContext.TEXTURE_MIN_FILTER,c.WebGL2.context.LINEAR),c.WebGL2.context.texParameteri(WebGL2RenderingContext.TEXTURE_CUBE_MAP,WebGL2RenderingContext.TEXTURE_MAG_FILTER,c.WebGL2.context.LINEAR),c.WebGL2.context.texParameteri(WebGL2RenderingContext.TEXTURE_CUBE_MAP,WebGL2RenderingContext.TEXTURE_WRAP_R,WebGL2RenderingContext.CLAMP_TO_EDGE),c.WebGL2.context.texParameteri(WebGL2RenderingContext.TEXTURE_CUBE_MAP,WebGL2RenderingContext.TEXTURE_WRAP_S,WebGL2RenderingContext.CLAMP_TO_EDGE),c.WebGL2.context.texParameteri(WebGL2RenderingContext.TEXTURE_CUBE_MAP,WebGL2RenderingContext.TEXTURE_WRAP_T,WebGL2RenderingContext.CLAMP_TO_EDGE);for(let t=0;t<6;t++)c.WebGL2.context.texImage2D(WebGL2RenderingContext.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,WebGL2RenderingContext.RGBA8,WebGL2RenderingContext.RGBA,WebGL2RenderingContext.UNSIGNED_BYTE,e[t]);return t}static createFramebuffer(e,t,n,r){let i=new f.Framebuffer;n=n||c.WebGL2.canvas.width,r=r||c.WebGL2.canvas.height,i.handle=c.WebGL2.context.createFramebuffer(),c.WebGL2.context.bindFramebuffer(WebGL2RenderingContext.FRAMEBUFFER,i.handle);for(var o=0;e&&o<e.length;o++){let t=c.WebGL2.context.createTexture();c.WebGL2.context.bindTexture(WebGL2RenderingContext.TEXTURE_2D,t),c.WebGL2.context.texParameteri(WebGL2RenderingContext.TEXTURE_2D,WebGL2RenderingContext.TEXTURE_MIN_FILTER,c.WebGL2.context.NEAREST),c.WebGL2.context.texParameteri(WebGL2RenderingContext.TEXTURE_2D,WebGL2RenderingContext.TEXTURE_MAG_FILTER,c.WebGL2.context.NEAREST),c.WebGL2.context.texStorage2D(WebGL2RenderingContext.TEXTURE_2D,1,e[o],n,r),c.WebGL2.context.framebufferTexture2D(WebGL2RenderingContext.FRAMEBUFFER,WebGL2RenderingContext.COLOR_ATTACHMENT0+o,WebGL2RenderingContext.TEXTURE_2D,t,0),i.color.push(t)}if(t){let e=c.WebGL2.context.createTexture();c.WebGL2.context.bindTexture(WebGL2RenderingContext.TEXTURE_2D,e),c.WebGL2.context.texParameteri(WebGL2RenderingContext.TEXTURE_2D,WebGL2RenderingContext.TEXTURE_MIN_FILTER,c.WebGL2.context.NEAREST),c.WebGL2.context.texParameteri(WebGL2RenderingContext.TEXTURE_2D,WebGL2RenderingContext.TEXTURE_MAG_FILTER,c.WebGL2.context.NEAREST),c.WebGL2.context.texStorage2D(WebGL2RenderingContext.TEXTURE_2D,1,t,n,r),c.WebGL2.context.framebufferTexture2D(WebGL2RenderingContext.FRAMEBUFFER,WebGL2RenderingContext.DEPTH_ATTACHMENT,WebGL2RenderingContext.TEXTURE_2D,e,0),i.depth=e}return c.WebGL2.context.bindTexture(WebGL2RenderingContext.TEXTURE_2D,null),c.WebGL2.context.bindFramebuffer(WebGL2RenderingContext.FRAMEBUFFER,null),i}static createComputeWrapper(e,t,n,r){let i=this.createFramebuffer(e,t,n,r);return new d.ComputeWrapper(new h.default([n,r,1]),void 0,i)}static createComputeWrapperFromFBO(e,t){return new d.ComputeWrapper(t,void 0,e)}static createComputeWrapperFromTexture(e,t){return new d.ComputeWrapper(t,e)}static parseObjCmd(e,t,n,r,i,o,s){let a=e.split(" ");switch(a[0]){case"v":t.push(parseFloat(a[1])),t.push(parseFloat(a[2])),t.push(parseFloat(a[3]));break;case"vt":n.push(parseFloat(a[1])),n.push(1-parseFloat(a[2]));break;case"vn":r.push(parseFloat(a[1])),r.push(parseFloat(a[2])),r.push(parseFloat(a[3]));break;case"f":let e=[];for(var l=0;l<3;l++){let u=a[1+l];if(s.has(u))o.push(s.get(u));else{let e=u.split("/"),a=parseInt(e[0])-1;i.push(t[3*a]),i.push(t[3*a+1]),i.push(t[3*a+2]),a=parseInt(e[1])-1,isNaN(a)?(i.push(0),i.push(0)):(i.push(n[2*a]),i.push(n[2*a+1])),a=parseInt(e[2])-1,isNaN(a)?(i.push(0),i.push(1),i.push(0)):(i.push(r[3*a]),i.push(r[3*a+1]),i.push(r[3*a+2])),i.push(0),i.push(1),i.push(0),o.push(s.size),s.set(u,s.size)}e[l]=o[o.length-1]}let c=[],f=[];for(l=0;l<3;l++){let t=i[11*e[0]+l],n=i[11*e[1]+l],r=i[11*e[2]+l];c.push(n-t),f.push(r-t)}let d=[],h=[];for(l=0;l<3;l++){let t=i[11*e[0]+l+3],n=i[11*e[1]+l+3],r=i[11*e[2]+l+3];d.push(n-t),h.push(r-t)}for(l=0;l<3;l++){let t=(c[l]*h[1]-f[l]*d[1])/(d[0]*h[1]-d[1]*h[0]);for(var u=0;u<3;u++){i[11*e[u]+l+8]+=t}}}}static parseObj(e,t,n){let r=[],i=[],o=[],s=new Map,a=e.split("\n");for(let e of a)this.parseObjCmd(e,r,i,o,t,n,s)}static generateNewObj(e,t){let n=[],r=[];for(let t of e)n.push(null!=t?t:NaN);for(let e of t)r.push(e);return new o.Mesh(n,r)}static createMeshFromObj(e){let t=[],n=[];return this.parseObj(e,t,n),this.generateNewObj(t,n)}static createMeshesFromObj(e){let t=new Map;var n;let r=[],i=[],o=[],s=[],a=[],l=new Map,u=e.split("\n");for(let e of u){let u=e.split(" ");"o"===u[0]?(""!==n&&(t.set(n,this.generateNewObj(s,a)),s=[],a=[],l.clear()),n=u[1]):this.parseObjCmd(e,r,i,o,s,a,l)}return t.set(n,this.generateNewObj(s,a)),t}static createGridFromMesh(e,t){for(var n=new h.default([100,100,100]),r=new h.default([-100,-100,-100]),i=0;i<e.length;i+=11){const t=new h.default([e[i+0],e[i+1],e[i+2]]);h.default.min(n,t,n),h.default.max(r,t,r)}r.subtract(n);const o=r.copy().scale(100/Math.max(Math.max(r.x,r.y),r.z));for(i=0;i<e.length;i+=11)for(var a=0;a<3;a++)e[i+a]=(e[i+a]-n.at(a))/r.at(a),e[i+a]=(.8*e[i+a]+.1)*o.at(a);h.default.ceil(o,o);let l=new s.FloatGrid(o),u=[];const c=new p.Indexgrid(e,t,o,5);for(var f=0;f<o.z;f++)for(var d=0;d<o.y;d++)for(var m=0;m<o.x;m++)u.push(c.getDistance(new h.default([m+.5,d+.5,f+.5])));return l.load(new Float32Array(u)),l}static createGridFromObj(e){let t=[],n=[],r=[],i=[],o=[],s=new Map,a=e.split("\n");for(let e of a)this.parseObjCmd(e,t,n,r,i,o,s);return this.createGridFromMesh(i,o)}static createParticleSystemFromUni(e,t){let n=this.getUniHeader(e),r=new m.ParticleSystem(3/(n.size.x+n.size.y+n.size.z));t&&n.copy(t);let i=new Float32Array(e,x.BYTE_SIZE),o=new Float32Array(i.length/4*3);for(var s=0;s<i.length/4;s++)o[3*s]=i[4*s]/n.size.x-.5,o[3*s+1]=i[4*s+1]/n.size.y-.5,o[3*s+2]=i[4*s+2]/n.size.z-.5;return r.load(o),r}static createParticleSystemFromArray(e,t=1){let n=new m.ParticleSystem(t);return n.load(new Float32Array(e)),n}static createParticleSystemFromObj(e,t=1){let n=new m.ParticleSystem(t),r=[];return this.parseObj(e,r,[]),n.load(new Float32Array(r)),n}static createShaderFromSource(e){let t=c.WebGL2.context.createProgram();for(const n of e){const e=c.WebGL2.context.createShader(n.type);if(c.WebGL2.context.shaderSource(e,n.code),c.WebGL2.context.compileShader(e),!c.WebGL2.context.getShaderParameter(e,c.WebGL2.context.COMPILE_STATUS))throw new Error("Shader compiling error. "+c.WebGL2.context.getShaderInfoLog(e));c.WebGL2.context.attachShader(t,e)}if(c.WebGL2.context.linkProgram(t),!c.WebGL2.context.getProgramParameter(t,c.WebGL2.context.LINK_STATUS))throw new Error("Program linking error."+c.WebGL2.context.getProgramInfoLog(t));return t}}t.ResourceFactory=b},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});class r{constructor(e,t){this.mByteSize=e,this.mDataViewCreatorCallback=t}getByteSize(){return this.mByteSize}getDataView(e,t,n){return this.mDataViewCreatorCallback(e,t,n)}}t.DataType=r;class i{}t.DataTypes=i,i.INT8=new r(Int8Array.BYTES_PER_ELEMENT,(e,t,n)=>new Int8Array(e,t,n)),i.UINT8=new r(Uint8Array.BYTES_PER_ELEMENT,(e,t,n)=>new Uint8Array(e,t,n)),i.INT16=new r(Int16Array.BYTES_PER_ELEMENT,(e,t,n)=>new Int16Array(e,t,n)),i.UINT16=new r(Uint16Array.BYTES_PER_ELEMENT,(e,t,n)=>new Uint16Array(e,t,n)),i.INT32=new r(Int32Array.BYTES_PER_ELEMENT,(e,t,n)=>new Int32Array(e,t,n)),i.UINT32=new r(Uint32Array.BYTES_PER_ELEMENT,(e,t,n)=>new Uint32Array(e,t,n)),i.UINT8_CLAMP=new r(Uint8ClampedArray.BYTES_PER_ELEMENT,(e,t,n)=>new Uint8ClampedArray(e,t,n)),i.FLOAT32=new r(Float32Array.BYTES_PER_ELEMENT,(e,t,n)=>new Float32Array(e,t,n)),i.FLOAT64=new r(Float64Array.BYTES_PER_ELEMENT,(e,t,n)=>new Float64Array(e.slice(t,t+8*n)));t.StructEntry=class{constructor(e,t,n=1,r){this.name=e,this.type=t,this.size=n,this.def=r}};class o{constructor(e,t,n){this.offset=e,this.length=t,this.dataType=n}}t.StructBuffer=class{constructor(e){this.mDataStructure=new Map;var t=0;for(let n of e)this.mDataStructure.set(n.name,new o(t,n.size,n.type)),t+=n.type.getByteSize()*n.size;this.mArrayBuffer=new ArrayBuffer(t);for(let t of e)t.def&&this.set(t.name,t.def)}set(e,t,n=0){let r=this.mDataStructure.get(e),i=r.dataType.getDataView(this.mArrayBuffer,r.offset,r.length);if("number"==typeof t)r.dataType.getDataView(this.mArrayBuffer,r.offset,r.length)[n]=t;else for(var o=n;o<t.length;o++)i[o]=t[o]}get(e,t=0){let n=this.mDataStructure.get(e),r=n.dataType.getDataView(this.mArrayBuffer,n.offset,n.length);if(1==n.length)return r[t];for(var i=[],o=t;o<n.length;o++)i.push(r[o]);return i}setBuffer(e){this.mArrayBuffer=e}getBuffer(){return this.mArrayBuffer}}},function(e,t,n){"use strict";var r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const o=n(9),s=n(2),a=n(0),l=n(3),u=r(n(20)),c=r(n(30)),f=r(n(31)),d=r(n(32)),h=r(n(33)),p=r(n(34)),m=n(6),v=n(4),y=i(n(10)),x=i(n(1));var g;!function(e){e[e.FLOAT=1]="FLOAT",e[e.INT=2]="INT",e[e.VEC3=4]="VEC3",e[e.VEC4=8]="VEC4"}(g=t.GridType||(t.GridType={})),t.iterateGrid=function(e,t,n=new x.default([0,0,0]),r=1,i=0){for(var o=i;o<r;o++)for(var s=n.z;s<t.z;s++)for(var a=n.y;a<t.y;a++)for(var l=n.x;l<t.x;l++)e(new y.default([l,a,s,o]),o*t.x*t.y*t.z+s*t.x*t.y+a*t.x+l)};class T extends o.Resource{constructor(e,t,n=1,r=new x.default([0,0,0]),i=0){if(super(),this.mBoundaryVal=0,this.mSize=e.copy(),this.mSizeT=n,this.mTexSize=e.copy(),this.mArraySize=new x.default([1,1,1]),this.mDim=n>1?4:e.z>1?3:2,this.mType=t,this.mBoundary=r.copy(),this.mBoundaryVal=i,this.is4D()){let e=x.default.floor(x.default.quotient(new x.default([a.WebGL2.MAX_3D_TEX_SIZE,a.WebGL2.MAX_3D_TEX_SIZE,a.WebGL2.MAX_3D_TEX_SIZE]),this.mSize)),t=x.default.ceil(x.default.quotient(new x.default([this.mSizeT,this.mSizeT,this.mSizeT]),new x.default([1,e.x,e.x*e.y])));this.mArraySize=x.default.min(e,t),this.mTexSize=x.default.product(this.mArraySize,this.mSize)}if(this.is2D()){if(this.mTexSize.x>a.WebGL2.MAX_2D_TEX_SIZE||this.mTexSize.y>a.WebGL2.MAX_2D_TEX_SIZE)return void console.error("2D Grid ("+this.mTexSize.x+"x"+this.mTexSize.y+") too big! Max size: "+a.WebGL2.MAX_2D_TEX_SIZE+"x"+a.WebGL2.MAX_2D_TEX_SIZE)}else if(this.mTexSize.x>a.WebGL2.MAX_3D_TEX_SIZE||this.mTexSize.y>a.WebGL2.MAX_3D_TEX_SIZE||this.mTexSize.z>a.WebGL2.MAX_3D_TEX_SIZE)return void console.error("3D Grid ("+this.mTexSize.x+"x"+this.mTexSize.y+"x"+this.mTexSize.z+") too big! Max size: "+a.WebGL2.MAX_3D_TEX_SIZE+"x"+a.WebGL2.MAX_3D_TEX_SIZE+"x"+a.WebGL2.MAX_2D_TEX_SIZE);this.containsVec()?this.mTextureFormat=this.containsFloat()?WebGL2RenderingContext.RGBA32F:WebGL2RenderingContext.RGBA32I:this.mTextureFormat=this.containsFloat()?WebGL2RenderingContext.R32F:WebGL2RenderingContext.R32I,this.mTextureHandle=a.WebGL2.context.createTexture(),this.mTextureType=this.is2D()?WebGL2RenderingContext.TEXTURE_2D:WebGL2RenderingContext.TEXTURE_3D,this.bindTexture(),a.WebGL2.context.texParameteri(this.mTextureType,a.WebGL2.context.TEXTURE_MIN_FILTER,a.WebGL2.context.LINEAR),a.WebGL2.context.texParameteri(this.mTextureType,a.WebGL2.context.TEXTURE_MAG_FILTER,a.WebGL2.context.LINEAR),a.WebGL2.context.texParameteri(this.mTextureType,a.WebGL2.context.TEXTURE_WRAP_R,a.WebGL2.context.CLAMP_TO_EDGE),a.WebGL2.context.texParameteri(this.mTextureType,a.WebGL2.context.TEXTURE_WRAP_S,a.WebGL2.context.CLAMP_TO_EDGE),a.WebGL2.context.texParameteri(this.mTextureType,a.WebGL2.context.TEXTURE_WRAP_T,a.WebGL2.context.CLAMP_TO_EDGE),this.is2D()?a.WebGL2.context.texStorage2D(WebGL2RenderingContext.TEXTURE_2D,1,this.mTextureFormat,this.mTexSize.x,this.mTexSize.y):a.WebGL2.context.texStorage3D(WebGL2RenderingContext.TEXTURE_3D,1,this.mTextureFormat,this.mTexSize.x,this.mTexSize.y,this.mTexSize.z),this.unbindTexture(),this.mPropBuffer=new m.UniformBuffer([new v.StructEntry("offset",v.DataTypes.FLOAT32,4,[0,0,0]),new v.StructEntry("nextOffset",v.DataTypes.FLOAT32,3,[0,0,0]),new v.StructEntry("frac",v.DataTypes.FLOAT32,1,0),new v.StructEntry("downScale",v.DataTypes.FLOAT32,4,[1,1,1]),new v.StructEntry("boundary",v.DataTypes.FLOAT32,3,x.default.quotient(this.mBoundary,this.mSize).toArray()),new v.StructEntry("boundaryVal",v.DataTypes.FLOAT32,1,this.mBoundaryVal),new v.StructEntry("resolution",v.DataTypes.FLOAT32,3,x.default.quotient(new x.default([1,1,1]),this.mSize).toArray()),new v.StructEntry("timesteps",v.DataTypes.FLOAT32,1,this.mSizeT)]),this.setTimeSlice(0),this.mComputeShader=l.ResourceFactory.createComputeWrapperFromTexture(this.mTextureHandle,this.mTexSize),s.GLHelper.CheckGLError(),0===this.mTextureHandle&&console.error("No texture created!")}static _init(){T.mAdvectProgram=l.ResourceFactory.createShaderFromSource([{type:WebGL2RenderingContext.VERTEX_SHADER,code:u.default},{type:WebGL2RenderingContext.FRAGMENT_SHADER,code:c.default}]),T.mSliceProgram=l.ResourceFactory.createShaderFromSource([{type:WebGL2RenderingContext.VERTEX_SHADER,code:u.default},{type:WebGL2RenderingContext.FRAGMENT_SHADER,code:f.default}]),T.mConstProgram=l.ResourceFactory.createShaderFromSource([{type:WebGL2RenderingContext.VERTEX_SHADER,code:u.default},{type:WebGL2RenderingContext.FRAGMENT_SHADER,code:d.default}]),T.mAddProgram=l.ResourceFactory.createShaderFromSource([{type:WebGL2RenderingContext.VERTEX_SHADER,code:u.default},{type:WebGL2RenderingContext.FRAGMENT_SHADER,code:h.default}]),T.mMulProgram=l.ResourceFactory.createShaderFromSource([{type:WebGL2RenderingContext.VERTEX_SHADER,code:u.default},{type:WebGL2RenderingContext.FRAGMENT_SHADER,code:p.default}]),T.PROP0_UBO_PNT=s.GLHelper.getNextBufferPnt(),T.PROP1_UBO_PNT=s.GLHelper.getNextBufferPnt(),T.CONST_F_UBO_PNT=s.GLHelper.getNextBufferPnt(),T.G0_TEX_PNT=s.GLHelper.getNextTexPnt(),T.G1_TEX_PNT=s.GLHelper.getNextTexPnt()}reloadBoundary(){this.fillGrid(this.mBoundaryVal,new x.default([0,0,0]),new x.default([this.mBoundary.x,this.mSize.y,this.mSize.z])),this.fillGrid(this.mBoundaryVal,new x.default([0,0,0]),new x.default([this.mSize.x,this.mBoundary.y,this.mSize.z])),this.fillGrid(this.mBoundaryVal,new x.default([0,0,0]),new x.default([this.mSize.x,this.mSize.y,this.mBoundary.z])),this.fillGrid(this.mBoundaryVal,new x.default([this.mSize.x-this.mBoundary.x,0,0]),new x.default([this.mSize.x,this.mSize.y,this.mSize.z])),this.fillGrid(this.mBoundaryVal,new x.default([0,this.mSize.y-this.mBoundary.y,0]),new x.default([this.mSize.x,this.mSize.y,this.mSize.z])),this.fillGrid(this.mBoundaryVal,new x.default([0,0,this.mSize.z-this.mBoundary.z]),new x.default([this.mSize.x,this.mSize.y,this.mSize.z]))}inBounds(e){return e.x>=this.mBoundary.x&&e.x<this.mSize.x-this.mBoundary.x&&e.y>=this.mBoundary.y&&e.y<this.mSize.y-this.mBoundary.y&&e.z>=this.mBoundary.z&&e.z<this.mSize.z-this.mBoundary.z}loadTexture(e,t=new x.default([0,0,0]),n=this.mTexSize){this.bindTexture(),this.is2D()?a.WebGL2.context.texSubImage2D(WebGL2RenderingContext.TEXTURE_2D,0,t.x,t.y,n.x-t.x,n.y-t.y,this.containsVec()?WebGL2RenderingContext.RGBA:WebGL2RenderingContext.RED,this.containsFloat()?WebGL2RenderingContext.FLOAT:WebGL2RenderingContext.INT,e):a.WebGL2.context.texSubImage3D(WebGL2RenderingContext.TEXTURE_3D,0,t.x,t.y,t.z,n.x-t.x,n.y-t.y,n.z-t.z,this.containsVec()?WebGL2RenderingContext.RGBA:WebGL2RenderingContext.RED,this.containsFloat()?WebGL2RenderingContext.FLOAT:WebGL2RenderingContext.INT,e),this.unbindTexture(),s.GLHelper.CheckGLError()}load(e,t=new x.default([0,0,0]),n=this.mSize,r=0,i=this.mSizeT){if(this.is4D()){let a=(n.x-t.x)*(n.y-t.y)*(n.z-t.z)*this.getElementCnt();for(var o=r;o<i;o++){var s=this.getArrayIndex(o);this.loadTexture(e.slice(o*a,(o+1)*a),x.default.sum(s,t),x.default.sum(s,n))}}else this.loadTexture(e,t,n);this.mBoundary.x>0&&this.mBoundary.y>0&&this.mBoundary.z>0&&e[0]!=this.mBoundaryVal&&this.reloadBoundary()}fillGrid(e,t=this.mBoundary,n=x.default.difference(this.mSize,this.mBoundary),r=0,i=this.mSizeT){let o=(n.x-t.x)*(n.y-t.y)*(n.z-t.z)*(i-r),s=new ArrayBuffer(o*this.getBytesPerElement()),a=this.containsFloat()?new Float32Array(s):new Int32Array(s);if("number"==typeof e)a.fill(e);else{let t=e.toArray();for(var l=0;l<a.length;l++)a[l]=t[l%t.length]}this.load(a,t,n,r,i)}constFunc(e,t=0,n=1,r=this.mBoundary,i=x.default.difference(this.mSize,this.mBoundary),o=0,s=this.mSizeT){var u=!1;e||(e=l.ResourceFactory.createGridFromOther(this),u=!0),this.mPropBuffer.uploadBuffer(T.PROP0_UBO_PNT),new m.UniformBuffer([new v.StructEntry("add_cnst",v.DataTypes.FLOAT32,1,t),new v.StructEntry("mul_cnst",v.DataTypes.FLOAT32,1,n),new v.StructEntry("_pad",v.DataTypes.INT32,2)]).uploadBuffer(T.CONST_F_UBO_PNT),a.WebGL2.context.activeTexture(WebGL2RenderingContext.TEXTURE0+T.G0_TEX_PNT),this.bindTexture(),a.WebGL2.context.useProgram(T.mConstProgram),a.WebGL2.context.uniformBlockBinding(T.mConstProgram,a.WebGL2.context.getUniformBlockIndex(T.mConstProgram,"properties"),T.PROP0_UBO_PNT),a.WebGL2.context.uniformBlockBinding(T.mConstProgram,a.WebGL2.context.getUniformBlockIndex(T.mConstProgram,"const_func"),T.CONST_F_UBO_PNT),a.WebGL2.context.uniform1i(a.WebGL2.context.getUniformLocation(T.mConstProgram,"g"),T.G0_TEX_PNT),e.mComputeShader.dispatch(T.mConstProgram,new y.default([r.x/this.mSize.x,r.y/this.mSize.y,r.z/this.mSize.z,o]),new y.default([i.x/this.mSize.x,i.y/this.mSize.y,i.z/this.mSize.z,s])),u&&this.copy(e)}multConst(e,t,n=this.mBoundary,r=x.default.difference(this.mSize,this.mBoundary),i=0,o=this.mSizeT){this.constFunc(t,0,e,n,r,i,o)}addConst(e,t,n=this.mBoundary,r=x.default.difference(this.mSize,this.mBoundary),i=0,o=this.mSizeT){this.constFunc(t,e,1,n,r,i,o)}setConst(e,t,n=this.mBoundary,r=x.default.difference(this.mSize,this.mBoundary),i=0,o=this.mSizeT){this.constFunc(t,e,0,n,r,i,o)}copy(e,t=this.mBoundary,n=x.default.difference(this.mSize,this.mBoundary),r=0,i=this.mSizeT){e.constFunc(this,0,1,t,n,r,i)}multiply(e,t,n=this.mBoundary,r=x.default.difference(this.mSize,this.mBoundary),i=0,o=this.mSizeT){var s=!1;t||(t=l.ResourceFactory.createGridFromOther(this),s=!0),this.mPropBuffer.uploadBuffer(T.PROP0_UBO_PNT),e.mPropBuffer.uploadBuffer(T.PROP1_UBO_PNT),a.WebGL2.context.useProgram(T.mMulProgram),a.WebGL2.context.uniformBlockBinding(T.mMulProgram,a.WebGL2.context.getUniformBlockIndex(T.mMulProgram,"properties0"),T.PROP0_UBO_PNT),a.WebGL2.context.uniformBlockBinding(T.mMulProgram,a.WebGL2.context.getUniformBlockIndex(T.mMulProgram,"properties1"),T.PROP1_UBO_PNT),a.WebGL2.context.activeTexture(WebGL2RenderingContext.TEXTURE0+T.G0_TEX_PNT),this.bindTexture(),a.WebGL2.context.activeTexture(WebGL2RenderingContext.TEXTURE0+T.G1_TEX_PNT),e.bindTexture(),a.WebGL2.context.uniform1i(a.WebGL2.context.getUniformLocation(T.mMulProgram,"g0"),T.G0_TEX_PNT),a.WebGL2.context.uniform1i(a.WebGL2.context.getUniformLocation(T.mMulProgram,"g1"),T.G1_TEX_PNT),t.mComputeShader.dispatch(T.mMulProgram,new y.default([n.x/this.mSize.x,n.y/this.mSize.y,n.z/this.mSize.z,i]),new y.default([r.x/this.mSize.x,r.y/this.mSize.y,r.z/this.mSize.z,o])),s&&this.copy(t)}add(e,t,n=this.mBoundary,r=x.default.difference(this.mSize,this.mBoundary),i=0,o=this.mSizeT){var s=!1;t||(t=l.ResourceFactory.createGridFromOther(this),s=!0),this.mPropBuffer.uploadBuffer(T.PROP0_UBO_PNT),e.mPropBuffer.uploadBuffer(T.PROP1_UBO_PNT),a.WebGL2.context.useProgram(T.mAddProgram),a.WebGL2.context.uniformBlockBinding(T.mAddProgram,a.WebGL2.context.getUniformBlockIndex(T.mAddProgram,"properties0"),T.PROP0_UBO_PNT),a.WebGL2.context.uniformBlockBinding(T.mAddProgram,a.WebGL2.context.getUniformBlockIndex(T.mAddProgram,"properties1"),T.PROP1_UBO_PNT),a.WebGL2.context.activeTexture(WebGL2RenderingContext.TEXTURE0+T.G0_TEX_PNT),this.bindTexture(),a.WebGL2.context.activeTexture(WebGL2RenderingContext.TEXTURE0+T.G1_TEX_PNT),e.bindTexture(),a.WebGL2.context.uniform1i(a.WebGL2.context.getUniformLocation(T.mAddProgram,"g0"),T.G0_TEX_PNT),a.WebGL2.context.uniform1i(a.WebGL2.context.getUniformLocation(T.mAddProgram,"g1"),T.G1_TEX_PNT),t.mComputeShader.dispatch(T.mAddProgram,new y.default([n.x/this.mSize.x,n.y/this.mSize.y,n.z/this.mSize.z,i]),new y.default([r.x/this.mSize.x,r.y/this.mSize.y,r.z/this.mSize.z,o])),s&&this.copy(t)}slice(e,t=this.mBoundary,n=x.default.difference(this.mSize,this.mBoundary),r=0,i=this.mSizeT){this.mPropBuffer.uploadBuffer(T.PROP0_UBO_PNT),a.WebGL2.context.useProgram(T.mSliceProgram),a.WebGL2.context.uniformBlockBinding(T.mSliceProgram,a.WebGL2.context.getUniformBlockIndex(T.mSliceProgram,"properties"),T.PROP0_UBO_PNT),a.WebGL2.context.activeTexture(WebGL2RenderingContext.TEXTURE0+T.G0_TEX_PNT),this.bindTexture(),a.WebGL2.context.uniform1i(a.WebGL2.context.getUniformLocation(T.mSliceProgram,"g"),T.G0_TEX_PNT),e.mComputeShader.dispatch(T.mSliceProgram,new y.default([t.x/this.mSize.x,t.y/this.mSize.y,t.z/this.mSize.z,r]),new y.default([n.x/this.mSize.x,n.y/this.mSize.y,n.z/this.mSize.z,i]))}advect(e,t,n=this.mBoundary,r=x.default.difference(this.mSize,this.mBoundary),i=0,o=this.mSizeT){var s=!1;t||(t=l.ResourceFactory.createGridFromOther(this),s=!0),this.mPropBuffer.uploadBuffer(T.PROP0_UBO_PNT),e.mPropBuffer.uploadBuffer(T.PROP1_UBO_PNT),a.WebGL2.context.useProgram(T.mAdvectProgram),a.WebGL2.context.uniformBlockBinding(T.mAdvectProgram,a.WebGL2.context.getUniformBlockIndex(T.mAdvectProgram,"properties0"),T.PROP0_UBO_PNT),a.WebGL2.context.uniformBlockBinding(T.mAdvectProgram,a.WebGL2.context.getUniformBlockIndex(T.mAdvectProgram,"properties1"),T.PROP1_UBO_PNT),a.WebGL2.context.activeTexture(WebGL2RenderingContext.TEXTURE0+T.G0_TEX_PNT),this.bindTexture(),a.WebGL2.context.activeTexture(WebGL2RenderingContext.TEXTURE0+T.G1_TEX_PNT),e.bindTexture(),a.WebGL2.context.uniform1i(a.WebGL2.context.getUniformLocation(T.mAdvectProgram,"g0"),T.G0_TEX_PNT),a.WebGL2.context.uniform1i(a.WebGL2.context.getUniformLocation(T.mAdvectProgram,"g1"),T.G1_TEX_PNT),t.mComputeShader.dispatch(T.mAdvectProgram,new y.default([n.x/this.mSize.x,n.y/this.mSize.y,n.z/this.mSize.z,i]),new y.default([r.x/this.mSize.x,r.y/this.mSize.y,r.z/this.mSize.z,o])),s&&this.copy(t)}is2D(){return 2===this.mDim}is3D(){return 3===this.mDim}is4D(){return 4===this.mDim}containsVec(){return this.mType&(g.VEC3|g.VEC4)}containsFloat(){return this.mType&g.FLOAT}getType(){return this.mType}getSize(){return this.mSize}getSizeT(){return this.mSizeT}getTexSize(){return this.mTexSize}getArraySize(){return this.mArraySize}getSizeFlat(){var e=this.mSizeT;for(let t of this.mSize.toArray())e*=t;return e}getElementCnt(){return this.containsVec()?4:1}getBytesPerElement(){return 4*this.getElementCnt()}getByteSizeFlat(){return this.getSizeFlat()*this.getBytesPerElement()}getArrayIndex(e){let t=new x.default;return t.x=Math.floor(e%this.mArraySize.x)*this.mSize.x,t.y=Math.floor(e/this.mArraySize.x)%this.mArraySize.y*this.mSize.y,t.z=Math.floor(e/(this.mArraySize.x*this.mArraySize.y))%this.mArraySize.z*this.mSize.z,t}getArrayPos(e){return x.default.quotient(this.getArrayIndex(e),this.mTexSize)}setTimeSlice(e){this.setProperty("offset",this.getArrayPos(e).toArray()),this.setProperty("nextOffset",this.getArrayPos(e+1).toArray()),this.setProperty("frac",e-Math.floor(e)),this.setProperty("downScale",x.default.quotient(new x.default([1,1,1]),this.mArraySize).toArray())}setProperty(e,t){this.mPropBuffer.set(e,t)}getPropBuffer(){return this.mPropBuffer}getTextureFormat(){return this.mTextureFormat}getTextureHandle(){return this.mTextureHandle}getBoundary(){return this.mBoundary}getBoundaryVal(){return this.mBoundaryVal}setBoundary(e){this.mBoundary=e,this.setProperty("boundary",x.default.quotient(this.mBoundary,this.mSize).toArray())}setBoundaryVal(e){this.mBoundaryVal,this.setProperty("boundaryVal",e)}bindTexture(){a.WebGL2.context.bindTexture(this.mTextureType,this.mTextureHandle)}unbindTexture(){a.WebGL2.context.bindTexture(this.mTextureType,null)}destroy(){a.WebGL2.context.deleteTexture(this.mTextureHandle),a.WebGL2.context.deleteBuffer(this.mPropBuffer)}}t.GridBase=T},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(4),i=n(0),o=n(9),s=n(2);class a extends o.Resource{constructor(e){super(),this.mStructBuffer=new r.StructBuffer(e),this.mHandle=i.WebGL2.context.createBuffer()}set(e,t,n=0){this.mStructBuffer.set(e,t,n)}get(e,t=0){return this.mStructBuffer.get(e,t)}setBuffer(e){this.mStructBuffer.setBuffer(e)}getBuffer(){return this.mStructBuffer.getBuffer()}uploadBuffer(e){i.WebGL2.context.bindBuffer(WebGL2RenderingContext.UNIFORM_BUFFER,this.mHandle),i.WebGL2.context.bindBufferBase(WebGL2RenderingContext.UNIFORM_BUFFER,e,this.mHandle),i.WebGL2.context.bufferData(WebGL2RenderingContext.UNIFORM_BUFFER,this.mStructBuffer.getBuffer(),WebGL2RenderingContext.DYNAMIC_DRAW),i.WebGL2.context.bindBuffer(WebGL2RenderingContext.UNIFORM_BUFFER,null),s.GLHelper.CheckGLError()}destroy(){i.WebGL2.context.deleteBuffer(this.mHandle)}}t.UniformBuffer=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.epsilon=1e-5},function(e,t,n){"use strict";var r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t};Object.defineProperty(t,"__esModule",{value:!0});const i=n(18),o=n(2),s=n(0),a=r(n(20)),l=r(n(44)),u=r(n(45)),c=r(n(46)),f=n(6),d=n(4),h=n(3),p=n(12),m=n(14),v=n(47),y=n(22),x=n(23);class g extends s.WebGL2{constructor(e,t){super(),this.mCamera=e,s.WebGL2.context.clearColor(0,0,0,0),s.WebGL2.context.enable(s.WebGL2.context.CULL_FACE),s.WebGL2.context.enable(s.WebGL2.context.DEPTH_TEST),this.mSkyTexture=t,this.mCameraBuffer=new f.UniformBuffer([new d.StructEntry("view",d.DataTypes.FLOAT32,16),new d.StructEntry("proj",d.DataTypes.FLOAT32,16),new d.StructEntry("pos",d.DataTypes.FLOAT32,4),new d.StructEntry("lights",d.DataTypes.FLOAT32,8*g.MAX_LIGHT_CNT),new d.StructEntry("lightCount",d.DataTypes.INT32,1),new d.StructEntry("ambientFac",d.DataTypes.FLOAT32,1),new d.StructEntry("_pad",d.DataTypes.INT32,2)])}static _init(){g.mMergerProgram=h.ResourceFactory.createShaderFromSource([{type:WebGL2RenderingContext.VERTEX_SHADER,code:a.default},{type:WebGL2RenderingContext.FRAGMENT_SHADER,code:l.default}]),g.SOLID_COL_LOC=new m.ResourceLocation(s.WebGL2.context.getUniformLocation(g.mMergerProgram,"solidColor")),g.VOL_COL_LOC=new m.ResourceLocation(s.WebGL2.context.getUniformLocation(g.mMergerProgram,"volumeColor")),g.VOL_DISP_LOC=new m.ResourceLocation(s.WebGL2.context.getUniformLocation(g.mMergerProgram,"volumeDisplace")),g.VOL_DEPTH_LOC=new m.ResourceLocation(s.WebGL2.context.getUniformLocation(g.mMergerProgram,"volumeDepth")),g.mSkyProgram=h.ResourceFactory.createShaderFromSource([{type:WebGL2RenderingContext.VERTEX_SHADER,code:u.default},{type:WebGL2RenderingContext.FRAGMENT_SHADER,code:c.default}]),g.mSkybox=p.MeshGenerator.getCubeMesh(),g.CAM_UBO_LOC=s.WebGL2.context.getUniformBlockIndex(g.mSkyProgram,"cam_data"),g.mMergerFramebuffer=h.ResourceFactory.createFramebuffer([WebGL2RenderingContext.RGBA16F,WebGL2RenderingContext.RGBA16F,WebGL2RenderingContext.RGBA16F],WebGL2RenderingContext.DEPTH_COMPONENT24),i.VolumeRenderComponent._init(),v.SolidRenderComponent._init(),x.ParticleRenderComponent._init(),y.ComputeWrapper._init()}setSkyTexture(){}setScene(e){this.mScene=e}resize(){s.WebGL2.context.viewport(0,0,s.WebGL2.context.drawingBufferWidth,s.WebGL2.context.drawingBufferHeight)}updateCamBuffer(){this.mCameraBuffer.set("view",this.mCamera.getEntity().getTransform().getWorldToLocal().toArray()),this.mCameraBuffer.set("proj",this.mCamera.getProjMatrix().toArray()),this.mCameraBuffer.set("pos",this.mCamera.getEntity().getTransform().getPostion().toArray()),this.mCameraBuffer.set("pos",1,3);let e=this.mScene.getLightComponents(),t=new Float32Array(8*e.length);for(var n=0;n<e.length;n++)t.set(e[n].getEntity().getTransform().getPostion().toArray(),8*n),t.set([1],8*n+3),t.set(e[n].getColor().toArray(),8*n+4),t.set([1],8*n+7);this.mCameraBuffer.set("ambientFac",0),this.mCameraBuffer.set("lights",t),this.mCameraBuffer.set("lightCount",e.length),this.mCameraBuffer.uploadBuffer(g.CAM_BUFFER_PNT)}drawAll(e){if(e)for(const t of e)t.draw()}draw(){s.WebGL2.context.clear(s.WebGL2.context.DEPTH_BUFFER_BIT|s.WebGL2.context.COLOR_BUFFER_BIT),s.WebGL2.context.depthFunc(WebGL2RenderingContext.LESS),s.WebGL2.context.enable(WebGL2RenderingContext.CULL_FACE),this.updateCamBuffer(),s.WebGL2.context.activeTexture(WebGL2RenderingContext.TEXTURE0+g.SKY_TEX_PNT),s.WebGL2.context.bindTexture(WebGL2RenderingContext.TEXTURE_CUBE_MAP,this.mSkyTexture),s.WebGL2.context.bindFramebuffer(WebGL2RenderingContext.FRAMEBUFFER,g.mMergerFramebuffer.handle),s.WebGL2.context.drawBuffers([WebGL2RenderingContext.NONE,WebGL2RenderingContext.COLOR_ATTACHMENT1,WebGL2RenderingContext.COLOR_ATTACHMENT2]),s.WebGL2.context.clear(WebGL2RenderingContext.DEPTH_BUFFER_BIT|WebGL2RenderingContext.COLOR_BUFFER_BIT),this.drawAll(this.mScene.getRenderComponents(i.VolumeRenderComponent.name)),s.WebGL2.context.depthFunc(WebGL2RenderingContext.GREATER),s.WebGL2.context.depthMask(!1),s.WebGL2.context.drawBuffers([WebGL2RenderingContext.COLOR_ATTACHMENT0]),s.WebGL2.context.clear(WebGL2RenderingContext.COLOR_BUFFER_BIT),this.drawAll(this.mScene.getRenderComponents(v.SolidRenderComponent.name)),this.drawAll(this.mScene.getRenderComponents(x.ParticleRenderComponent.name)),s.WebGL2.context.bindFramebuffer(WebGL2RenderingContext.FRAMEBUFFER,null),s.WebGL2.context.depthFunc(WebGL2RenderingContext.LESS),s.WebGL2.context.depthMask(!0),s.WebGL2.context.useProgram(g.mMergerProgram),s.WebGL2.context.activeTexture(WebGL2RenderingContext.TEXTURE0+g.SOLID_COL_LOC.pnt),s.WebGL2.context.bindTexture(WebGL2RenderingContext.TEXTURE_2D,g.mMergerFramebuffer.color[0]),s.WebGL2.context.uniform1i(g.SOLID_COL_LOC.loc,g.SOLID_COL_LOC.pnt),s.WebGL2.context.activeTexture(WebGL2RenderingContext.TEXTURE0+g.VOL_COL_LOC.pnt),s.WebGL2.context.bindTexture(WebGL2RenderingContext.TEXTURE_2D,g.mMergerFramebuffer.color[1]),s.WebGL2.context.uniform1i(g.VOL_COL_LOC.loc,g.VOL_COL_LOC.pnt),s.WebGL2.context.activeTexture(WebGL2RenderingContext.TEXTURE0+g.VOL_DISP_LOC.pnt),s.WebGL2.context.bindTexture(WebGL2RenderingContext.TEXTURE_2D,g.mMergerFramebuffer.color[2]),s.WebGL2.context.uniform1i(g.VOL_DISP_LOC.loc,g.VOL_DISP_LOC.pnt),s.WebGL2.context.activeTexture(WebGL2RenderingContext.TEXTURE0+g.VOL_DEPTH_LOC.pnt),s.WebGL2.context.bindTexture(WebGL2RenderingContext.TEXTURE_2D,g.mMergerFramebuffer.depth),s.WebGL2.context.uniform1i(g.VOL_DEPTH_LOC.loc,g.VOL_DEPTH_LOC.pnt),y.ComputeWrapper.screenplane.draw(),this.drawAll(this.mScene.getRenderComponents(v.SolidRenderComponent.name)),this.drawAll(this.mScene.getRenderComponents(x.ParticleRenderComponent.name)),s.WebGL2.context.depthFunc(WebGL2RenderingContext.LEQUAL),s.WebGL2.context.disable(WebGL2RenderingContext.CULL_FACE),s.WebGL2.context.useProgram(g.mSkyProgram),s.WebGL2.context.uniformBlockBinding(g.mSkyProgram,g.CAM_UBO_LOC,g.CAM_BUFFER_PNT),g.mSkybox.draw()}}t.RenderEngine=g,g.CAM_BUFFER_PNT=o.GLHelper.getNextBufferPnt(),g.SKY_TEX_PNT=o.GLHelper.getNextTexPnt(),g.MAX_LIGHT_CNT=16},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(0);class i extends r.WebGL2{}t.Resource=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(7);class i{constructor(e){this.values=new Float32Array(4),void 0!==e&&(this.xyzw=e)}get x(){return this.values[0]}get y(){return this.values[1]}get z(){return this.values[2]}get w(){return this.values[3]}get xy(){return[this.values[0],this.values[1]]}get xyz(){return[this.values[0],this.values[1],this.values[2]]}get xyzw(){return[this.values[0],this.values[1],this.values[2],this.values[3]]}set x(e){this.values[0]=e}set y(e){this.values[1]=e}set z(e){this.values[2]=e}set w(e){this.values[3]=e}set xy(e){this.values[0]=e[0],this.values[1]=e[1]}set xyz(e){this.values[0]=e[0],this.values[1]=e[1],this.values[2]=e[2]}set xyzw(e){this.values[0]=e[0],this.values[1]=e[1],this.values[2]=e[2],this.values[3]=e[3]}get r(){return this.values[0]}get g(){return this.values[1]}get b(){return this.values[2]}get a(){return this.values[3]}get rg(){return[this.values[0],this.values[1]]}get rgb(){return[this.values[0],this.values[1],this.values[2]]}get rgba(){return[this.values[0],this.values[1],this.values[2],this.values[3]]}set r(e){this.values[0]=e}set g(e){this.values[1]=e}set b(e){this.values[2]=e}set a(e){this.values[3]=e}set rg(e){this.values[0]=e[0],this.values[1]=e[1]}set rgb(e){this.values[0]=e[0],this.values[1]=e[1],this.values[2]=e[2]}set rgba(e){this.values[0]=e[0],this.values[1]=e[1],this.values[2]=e[2],this.values[3]=e[3]}at(e){return this.values[e]}toArray(){return Array.from(this.values)}size(){return 4}reset(){this.x=0,this.y=0,this.z=0,this.w=0}copy(e){return e||(e=new i),e.x=this.x,e.y=this.y,e.z=this.z,e.w=this.w,e}inverse(e){return e||(e=this),e.x=1/this.x,e.y=1/this.y,e.z=1/this.z,e.w=1/this.w,e}negate(e){return e||(e=this),e.x=-this.x,e.y=-this.y,e.z=-this.z,e.w=-this.w,e}equals(e,t=r.epsilon){return!(Math.abs(this.x-e.x)>t)&&(!(Math.abs(this.y-e.y)>t)&&(!(Math.abs(this.z-e.z)>t)&&!(Math.abs(this.w-e.w)>t)))}length(){return Math.sqrt(this.squaredLength())}squaredLength(){const e=this.x,t=this.y,n=this.z,r=this.w;return e*e+t*t+n*n+r*r}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}subtract(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}scale(e,t){return t||(t=this),t.x*=e,t.y*=e,t.z*=e,t.w*=e,t}normalize(e){e||(e=this);let t=this.length();return 1===t?this:0===t?(e.x*=0,e.y*=0,e.z*=0,e.w*=0,e):(t=1/t,e.x*=t,e.y*=t,e.z*=t,e.w*=t,e)}multiplyMat4(e,t){return t||(t=this),e.multiplyVec4(this,t)}static ceil(e,t){return t||(t=new i),t.x=Math.ceil(e.x),t.y=Math.ceil(e.y),t.z=Math.ceil(e.z),t.w=Math.ceil(e.w),t}static floor(e,t){return t||(t=new i),t.x=Math.floor(e.x),t.y=Math.floor(e.y),t.z=Math.floor(e.z),t.w=Math.floor(e.w),t}static dot(e,t){const n=e.x,r=e.y,i=e.z,o=e.w;return n*t.x+r*t.y+i*t.z+o*t.w}static dot2(e){return this.dot(e,e)}static mix(e,t,n,r){return r||(r=new i),r.x=e.x+n*(t.x-e.x),r.y=e.y+n*(t.y-e.y),r.z=e.z+n*(t.z-e.z),r.w=e.w+n*(t.w-e.w),r}static sum(e,t,n){return n||(n=new i),n.x=e.x+t.x,n.y=e.y+t.y,n.z=e.z+t.z,n.w=e.w+t.w,n}static difference(e,t,n){return n||(n=new i),n.x=e.x-t.x,n.y=e.y-t.y,n.z=e.z-t.z,n.w=e.w-t.w,n}static product(e,t,n){return n||(n=new i),n.x=e.x*t.x,n.y=e.y*t.y,n.z=e.z*t.z,n.w=e.w*t.w,n}static quotient(e,t,n){return n||(n=new i),n.x=e.x/t.x,n.y=e.y/t.y,n.z=e.z/t.z,n.w=e.w/t.w,n}static min(e,t,n){return n||(n=new i),n.x=Math.min(e.x,t.x),n.y=Math.min(e.y,t.y),n.z=Math.min(e.z,t.z),n.w=Math.min(e.w,t.w),n}static max(e,t,n){return n||(n=new i),n.x=Math.max(e.x,t.x),n.y=Math.max(e.y,t.y),n.z=Math.max(e.z,t.z),n.w=Math.max(e.w,t.w),n}static clamp(e,t,n,r){return r||(r=new i),r.x=Math.min(Math.max(e.x,t.x),n.x),r.y=Math.min(Math.max(e.y,t.y),n.y),r.z=Math.min(Math.max(e.z,t.z),n.z),r.z=Math.min(Math.max(e.w,t.w),n.w),r}}t.default=i,i.zero=new i([0,0,0,1]),i.one=new i([1,1,1,1])},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(0);t.Component=class{setEntity(e){this.mEntity=e}getEntity(){return this.mEntity}};class i extends r.WebGL2{setEntity(e){this.mEntity=e}getEntity(){return this.mEntity}}t.WebGLComponent=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(19),i=n(3);class o{static getCubeMesh(){return new r.Mesh(o.CUBE_VERTICES,o.CUBE_INDICES)}static getPlaneMesh(){return new r.Mesh(o.PLANE_VERTICES,o.PLANE_INDICES)}static getCubeVolume(){return i.ResourceFactory.createGridFromMesh(o.CUBE_VERTICES,o.CUBE_INDICES)}}t.MeshGenerator=o,o.CUBE_VERTICES=[-.5,-.5,-.5,.25,.25,0,0,-1,1,0,0,-.5,.5,-.5,.25,.5,0,0,-1,1,0,0,.5,-.5,-.5,.5,.25,0,0,-1,1,0,0,.5,.5,-.5,.5,.5,0,0,-1,1,0,0,-.5,-.5,.5,1,.25,0,0,1,-1,0,0,.5,-.5,.5,.75,.25,0,0,1,-1,0,0,-.5,.5,.5,1,.5,0,0,1,-1,0,0,.5,.5,.5,.75,.5,0,0,1,-1,0,0,-.5,.5,.5,0,.5,-1,0,0,0,0,-1,-.5,.5,-.5,.25,.5,-1,0,0,0,0,-1,-.5,-.5,.5,0,.25,-1,0,0,0,0,-1,-.5,-.5,-.5,.25,.25,-1,0,0,0,0,-1,.5,.5,.5,.75,.5,1,0,0,0,0,1,.5,-.5,.5,.75,.25,1,0,0,0,0,1,.5,.5,-.5,.5,.5,1,0,0,0,0,1,.5,-.5,-.5,.5,.25,1,0,0,0,0,1,.5,-.5,.5,.5,0,0,-1,0,1,0,0,-.5,-.5,.5,.25,0,0,-1,0,1,0,0,.5,-.5,-.5,.5,.25,0,-1,0,1,0,0,-.5,-.5,-.5,.25,.25,0,-1,0,1,0,0,.5,.5,.5,.5,.75,0,1,0,1,0,0,.5,.5,-.5,.5,.5,0,1,0,1,0,0,-.5,.5,.5,.25,.75,0,1,0,1,0,0,-.5,.5,-.5,.25,.5,0,1,0,1,0,0],o.CUBE_INDICES=[0,1,2,1,3,2,4,5,6,5,7,6,8,9,10,9,11,10,12,13,14,13,15,14,16,17,18,17,19,18,20,21,22,21,23,22],o.PLANE_VERTICES=[.5,0,.5,1,0,0,1,0,1,0,0,.5,0,-.5,1,1,0,1,0,1,0,0,-.5,0,.5,0,0,0,1,0,1,0,0,-.5,0,-.5,0,1,0,1,0,1,0,0],o.PLANE_INDICES=[0,1,2,1,3,2]},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i=r(n(21)),o=r(n(1)),s=r(n(10)),a=n(7);class l{constructor(e){this.values=new Float32Array(16),void 0!==e&&this.init(e)}at(e){return this.values[e]}toArray(){return Array.from(this.values)}size(){return 16}init(e){for(let t=0;t<16;t++)this.values[t]=e[t];return this}reset(){for(let e=0;e<16;e++)this.values[e]=0}copy(e){e||(e=new l);for(let t=0;t<16;t++)e.values[t]=this.values[t];return e}all(){const e=[];for(let t=0;t<16;t++)e[t]=this.values[t];return e}row(e){return[this.values[4*e+0],this.values[4*e+1],this.values[4*e+2],this.values[4*e+3]]}col(e){return[this.values[e],this.values[e+4],this.values[e+8],this.values[e+12]]}equals(e,t=a.epsilon){for(let n=0;n<16;n++)if(Math.abs(this.values[n]-e.at(n))>t)return!1;return!0}determinant(){const e=this.values[0],t=this.values[1],n=this.values[2],r=this.values[3],i=this.values[4],o=this.values[5],s=this.values[6],a=this.values[7],l=this.values[8],u=this.values[9],c=this.values[10],f=this.values[11],d=this.values[12],h=this.values[13],p=this.values[14],m=this.values[15];return(e*o-t*i)*(c*m-f*p)-(e*s-n*i)*(u*m-f*h)+(e*a-r*i)*(u*p-c*h)+(t*s-n*o)*(l*m-f*d)-(t*a-r*o)*(l*p-c*d)+(n*a-r*s)*(l*h-u*d)}setIdentity(){return this.values[0]=1,this.values[1]=0,this.values[2]=0,this.values[3]=0,this.values[4]=0,this.values[5]=1,this.values[6]=0,this.values[7]=0,this.values[8]=0,this.values[9]=0,this.values[10]=1,this.values[11]=0,this.values[12]=0,this.values[13]=0,this.values[14]=0,this.values[15]=1,this}transpose(){const e=this.values[1],t=this.values[2],n=this.values[3],r=this.values[6],i=this.values[7],o=this.values[11];return this.values[1]=this.values[4],this.values[2]=this.values[8],this.values[3]=this.values[12],this.values[4]=e,this.values[6]=this.values[9],this.values[7]=this.values[13],this.values[8]=t,this.values[9]=r,this.values[11]=this.values[14],this.values[12]=n,this.values[13]=i,this.values[14]=o,this}inverse(){const e=this.values[0],t=this.values[1],n=this.values[2],r=this.values[3],i=this.values[4],o=this.values[5],s=this.values[6],a=this.values[7],l=this.values[8],u=this.values[9],c=this.values[10],f=this.values[11],d=this.values[12],h=this.values[13],p=this.values[14],m=this.values[15],v=e*o-t*i,y=e*s-n*i,x=e*a-r*i,g=t*s-n*o,T=t*a-r*o,b=n*a-r*s,_=l*h-u*d,L=l*p-c*d,E=l*m-f*d,C=u*p-c*h,w=u*m-f*h,R=c*m-f*p;let S=v*R-y*w+x*C+g*E-T*L+b*_;return S?(S=1/S,this.values[0]=(o*R-s*w+a*C)*S,this.values[1]=(-t*R+n*w-r*C)*S,this.values[2]=(h*b-p*T+m*g)*S,this.values[3]=(-u*b+c*T-f*g)*S,this.values[4]=(-i*R+s*E-a*L)*S,this.values[5]=(e*R-n*E+r*L)*S,this.values[6]=(-d*b+p*x-m*y)*S,this.values[7]=(l*b-c*x+f*y)*S,this.values[8]=(i*w-o*E+a*_)*S,this.values[9]=(-e*w+t*E-r*_)*S,this.values[10]=(d*T-h*x+m*v)*S,this.values[11]=(-l*T+u*x-f*v)*S,this.values[12]=(-i*C+o*L-s*_)*S,this.values[13]=(e*C-t*L+n*_)*S,this.values[14]=(-d*g+h*y-p*v)*S,this.values[15]=(l*g-u*y+c*v)*S,this):null}multiply(e){const t=this.values[0],n=this.values[1],r=this.values[2],i=this.values[3],o=this.values[4],s=this.values[5],a=this.values[6],l=this.values[7],u=this.values[8],c=this.values[9],f=this.values[10],d=this.values[11],h=this.values[12],p=this.values[13],m=this.values[14],v=this.values[15];let y=e.at(0),x=e.at(1),g=e.at(2),T=e.at(3);return this.values[0]=y*t+x*o+g*u+T*h,this.values[1]=y*n+x*s+g*c+T*p,this.values[2]=y*r+x*a+g*f+T*m,this.values[3]=y*i+x*l+g*d+T*v,y=e.at(4),x=e.at(5),g=e.at(6),T=e.at(7),this.values[4]=y*t+x*o+g*u+T*h,this.values[5]=y*n+x*s+g*c+T*p,this.values[6]=y*r+x*a+g*f+T*m,this.values[7]=y*i+x*l+g*d+T*v,y=e.at(8),x=e.at(9),g=e.at(10),T=e.at(11),this.values[8]=y*t+x*o+g*u+T*h,this.values[9]=y*n+x*s+g*c+T*p,this.values[10]=y*r+x*a+g*f+T*m,this.values[11]=y*i+x*l+g*d+T*v,y=e.at(12),x=e.at(13),g=e.at(14),T=e.at(15),this.values[12]=y*t+x*o+g*u+T*h,this.values[13]=y*n+x*s+g*c+T*p,this.values[14]=y*r+x*a+g*f+T*m,this.values[15]=y*i+x*l+g*d+T*v,this}multiplyVec3(e){const t=e.x,n=e.y,r=e.z;return new o.default([this.values[0]*t+this.values[4]*n+this.values[8]*r+this.values[12],this.values[1]*t+this.values[5]*n+this.values[9]*r+this.values[13],this.values[2]*t+this.values[6]*n+this.values[10]*r+this.values[14]])}multiplyVec4(e,t){t||(t=new s.default);const n=e.x,r=e.y,i=e.z,o=e.w;return t.x=this.values[0]*n+this.values[4]*r+this.values[8]*i+this.values[12]*o,t.y=this.values[1]*n+this.values[5]*r+this.values[9]*i+this.values[13]*o,t.z=this.values[2]*n+this.values[6]*r+this.values[10]*i+this.values[14]*o,t.w=this.values[3]*n+this.values[7]*r+this.values[11]*i+this.values[15]*o,t}toMat3(){return new i.default([this.values[0],this.values[1],this.values[2],this.values[4],this.values[5],this.values[6],this.values[8],this.values[9],this.values[10]])}toInverseMat3(){const e=this.values[0],t=this.values[1],n=this.values[2],r=this.values[4],o=this.values[5],s=this.values[6],a=this.values[8],l=this.values[9],u=this.values[10],c=u*o-s*l,f=-u*r+s*a,d=l*r-o*a;let h=e*c+t*f+n*d;return h?(h=1/h,new i.default([c*h,(-u*t+n*l)*h,(s*t-n*o)*h,f*h,(u*e-n*a)*h,(-s*e+n*r)*h,d*h,(-l*e+t*a)*h,(o*e-t*r)*h])):null}translate(e){const t=e.x,n=e.y,r=e.z;return this.values[12]+=this.values[0]*t+this.values[4]*n+this.values[8]*r,this.values[13]+=this.values[1]*t+this.values[5]*n+this.values[9]*r,this.values[14]+=this.values[2]*t+this.values[6]*n+this.values[10]*r,this.values[15]+=this.values[3]*t+this.values[7]*n+this.values[11]*r,this}scale(e){const t=e.x,n=e.y,r=e.z;return this.values[0]*=t,this.values[1]*=t,this.values[2]*=t,this.values[3]*=t,this.values[4]*=n,this.values[5]*=n,this.values[6]*=n,this.values[7]*=n,this.values[8]*=r,this.values[9]*=r,this.values[10]*=r,this.values[11]*=r,this}rotate(e,t){let n=t.x,r=t.y,i=t.z,o=Math.sqrt(n*n+r*r+i*i);if(!o)return null;1!==o&&(n*=o=1/o,r*=o,i*=o);const s=Math.sin(e),a=Math.cos(e),l=1-a,u=this.values[0],c=this.values[1],f=this.values[2],d=this.values[3],h=this.values[4],p=this.values[5],m=this.values[6],v=this.values[7],y=this.values[8],x=this.values[9],g=this.values[10],T=this.values[11],b=n*n*l+a,_=r*n*l+i*s,L=i*n*l-r*s,E=n*r*l-i*s,C=r*r*l+a,w=i*r*l+n*s,R=n*i*l+r*s,S=r*i*l-n*s,G=i*i*l+a;return this.values[0]=u*b+h*_+y*L,this.values[1]=c*b+p*_+x*L,this.values[2]=f*b+m*_+g*L,this.values[3]=d*b+v*_+T*L,this.values[4]=u*E+h*C+y*w,this.values[5]=c*E+p*C+x*w,this.values[6]=f*E+m*C+g*w,this.values[7]=d*E+v*C+T*w,this.values[8]=u*R+h*S+y*G,this.values[9]=c*R+p*S+x*G,this.values[10]=f*R+m*S+g*G,this.values[11]=d*R+v*S+T*G,this}static fromRotationTranslationScale(e,t,n,r){r||(r=new l);let i=e.x+e.x,o=e.y+e.y,s=e.z+e.z,a=e.x*i,u=e.x*o,c=e.x*s,f=e.y*o,d=e.y*s,h=e.z*s,p=e.w*i,m=e.w*o,v=e.w*s;return r.init([(1-(f+h))*n.x,(u+v)*n.x,(c-m)*n.x,0,(u-v)*n.y,(1-(a+h))*n.y,(d+p)*n.y,0,(c+m)*n.z,(d-p)*n.z,(1-(a+f))*n.z,0,t.x,t.y,t.z,1])}static frustum(e,t,n,r,i,o){const s=t-e,a=r-n,u=o-i;return new l([2*i/s,0,0,0,0,2*i/a,0,0,(t+e)/s,(r+n)/a,-(o+i)/u,-1,0,0,-o*i*2/u,0])}static perspective(e,t,n,r){const i=n*Math.tan(e/2),o=i*t;return l.frustum(-o,o,-i,i,n,r)}static orthographic(e,t,n,r,i,o){const s=t-e,a=r-n,u=o-i;return new l([2/s,0,0,0,0,2/a,0,0,0,0,-2/u,0,-(e+t)/s,-(r+n)/a,-(o+i)/u,1])}static lookAt(e,t,n=o.default.up){if(e.equals(t))return this.identity;const r=o.default.difference(e,t).normalize(),i=o.default.cross(n,r).normalize(),s=o.default.cross(r,i).normalize();return new l([i.x,s.x,r.x,0,i.y,s.y,r.y,0,i.z,s.z,r.z,0,-o.default.dot(i,e),-o.default.dot(s,e),-o.default.dot(r,e),1])}static product(e,t,n){const r=e.at(0),i=e.at(1),o=e.at(2),s=e.at(3),a=e.at(4),u=e.at(5),c=e.at(6),f=e.at(7),d=e.at(8),h=e.at(9),p=e.at(10),m=e.at(11),v=e.at(12),y=e.at(13),x=e.at(14),g=e.at(15),T=t.at(0),b=t.at(1),_=t.at(2),L=t.at(3),E=t.at(4),C=t.at(5),w=t.at(6),R=t.at(7),S=t.at(8),G=t.at(9),A=t.at(10),W=t.at(11),z=t.at(12),P=t.at(13),M=t.at(14),D=t.at(15);return n?(n.init([T*r+b*a+_*d+L*v,T*i+b*u+_*h+L*y,T*o+b*c+_*p+L*x,T*s+b*f+_*m+L*g,E*r+C*a+w*d+R*v,E*i+C*u+w*h+R*y,E*o+C*c+w*p+R*x,E*s+C*f+w*m+R*g,S*r+G*a+A*d+W*v,S*i+G*u+A*h+W*y,S*o+G*c+A*p+W*x,S*s+G*f+A*m+W*g,z*r+P*a+M*d+D*v,z*i+P*u+M*h+D*y,z*o+P*c+M*p+D*x,z*s+P*f+M*m+D*g]),n):new l([T*r+b*a+_*d+L*v,T*i+b*u+_*h+L*y,T*o+b*c+_*p+L*x,T*s+b*f+_*m+L*g,E*r+C*a+w*d+R*v,E*i+C*u+w*h+R*y,E*o+C*c+w*p+R*x,E*s+C*f+w*m+R*g,S*r+G*a+A*d+W*v,S*i+G*u+A*h+W*y,S*o+G*c+A*p+W*x,S*s+G*f+A*m+W*g,z*r+P*a+M*d+D*v,z*i+P*u+M*h+D*y,z*o+P*c+M*p+D*x,z*s+P*f+M*m+D*g])}}t.default=l,l.identity=(new l).setIdentity()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(2);t.ResourceLocation=class{constructor(e,t){this.loc=e,this.pnt=t||r.GLHelper.getNextTexPnt()}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(11);class i extends r.WebGLComponent{}t.RenderComponent=i},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i=r(n(21)),o=r(n(13)),s=r(n(1)),a=n(7);class l{constructor(e){this.values=new Float32Array(4),void 0!==e&&(this.xyzw=e)}get x(){return this.values[0]}get y(){return this.values[1]}get z(){return this.values[2]}get w(){return this.values[3]}get xy(){return[this.values[0],this.values[1]]}get xyz(){return[this.values[0],this.values[1],this.values[2]]}get xyzw(){return[this.values[0],this.values[1],this.values[2],this.values[3]]}set x(e){this.values[0]=e}set y(e){this.values[1]=e}set z(e){this.values[2]=e}set w(e){this.values[3]=e}set xy(e){this.values[0]=e[0],this.values[1]=e[1]}set xyz(e){this.values[0]=e[0],this.values[1]=e[1],this.values[2]=e[2]}set xyzw(e){this.values[0]=e[0],this.values[1]=e[1],this.values[2]=e[2],this.values[3]=e[3]}at(e){return this.values[e]}toArray(){return Array.from(this.values)}size(){return 4}reset(){for(let e=0;e<4;e++)this.values[e]=0}copy(e){e||(e=new l);for(let t=0;t<4;t++)e.values[t]=this.values[t];return e}roll(){const e=this.x,t=this.y,n=this.z,r=this.w;return Math.atan2(2*(e*t+r*n),r*r+e*e-t*t-n*n)}pitch(){const e=this.x,t=this.y,n=this.z,r=this.w;return Math.atan2(2*(t*n+r*e),r*r-e*e-t*t+n*n)}yaw(){return Math.asin(2*(this.x*this.z-this.w*this.y))}equals(e,t=a.epsilon){for(let n=0;n<4;n++)if(Math.abs(this.values[n]-e.at(n))>t)return!1;return!0}setIdentity(){return this.x=0,this.y=0,this.z=0,this.w=1,this}calculateW(){const e=this.x,t=this.y,n=this.z;return this.w=-Math.sqrt(Math.abs(1-e*e-t*t-n*n)),this}inverse(){const e=l.dot(this,this);if(!e)return this.xyzw=[0,0,0,0],this;const t=e?1/e:0;return this.x*=-t,this.y*=-t,this.z*=-t,this.w*=t,this}conjugate(){return this.values[0]*=-1,this.values[1]*=-1,this.values[2]*=-1,this}length(){const e=this.x,t=this.y,n=this.z,r=this.w;return Math.sqrt(e*e+t*t+n*n+r*r)}normalize(e){e||(e=this);const t=this.x,n=this.y,r=this.z,i=this.w;let o=Math.sqrt(t*t+n*n+r*r+i*i);return o?(o=1/o,e.x=t*o,e.y=n*o,e.z=r*o,e.w=i*o,e):(e.x=0,e.y=0,e.z=0,e.w=0,e)}add(e){for(let t=0;t<4;t++)this.values[t]+=e.at(t);return this}multiply(e){const t=this.values[0],n=this.values[1],r=this.values[2],i=this.values[3],o=e.x,s=e.y,a=e.z,l=e.w;return this.x=t*l+i*o+n*a-r*s,this.y=n*l+i*s+r*o-t*a,this.z=r*l+i*a+t*s-n*o,this.w=i*l-t*o-n*s-r*a,this}multiplyVec3(e,t){t||(t=new s.default);const n=e.x,r=e.y,i=e.z,o=this.x,a=this.y,l=this.z,u=this.w,c=u*n+a*i-l*r,f=u*r+l*n-o*i,d=u*i+o*r-a*n,h=-o*n-a*r-l*i;return t.x=c*u+h*-o+f*-l-d*-a,t.y=f*u+h*-a+d*-o-c*-l,t.z=d*u+h*-l+c*-a-f*-o,t}toMat3(e){e||(e=new i.default);const t=this.x,n=this.y,r=this.z,o=this.w,s=t+t,a=n+n,l=r+r,u=t*s,c=t*a,f=t*l,d=n*a,h=n*l,p=r*l,m=o*s,v=o*a,y=o*l;return e.init([1-(d+p),c+y,f-v,c-y,1-(u+p),h+m,f+v,h-m,1-(u+d)]),e}toMat4(e){e||(e=new o.default);const t=this.x,n=this.y,r=this.z,i=this.w,s=t+t,a=n+n,l=r+r,u=t*s,c=t*a,f=t*l,d=n*a,h=n*l,p=r*l,m=i*s,v=i*a,y=i*l;return e.init([1-(d+p),c+y,f-v,0,c-y,1-(u+p),h+m,0,f+v,h-m,1-(u+d),0,0,0,0,1]),e}static rotationTo(e,t,n){n||(n=new l);let r=s.default.dot(e,t);if(r<-.999999){let t=s.default.cross(s.default.right,e);t.length()<1e-6&&(t=s.default.cross(s.default.up,e)),t.normalize(),l.fromAxisAngle(t,Math.PI,n)}else r>.999999?n=l.identity:(n.xyz=s.default.cross(e,t).xyz,n.w=1+r,n.normalize());return n}static dot(e,t){return e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w}static dot2(e){return this.dot(e,e)}static sum(e,t,n){return n||(n=new l),n.x=e.x+t.x,n.y=e.y+t.y,n.z=e.z+t.z,n.w=e.w+t.w,n}static product(e,t,n){n||(n=new l);const r=e.x,i=e.y,o=e.z,s=e.w,a=t.x,u=t.y,c=t.z,f=t.w;return n.x=r*f+s*a+i*c-o*u,n.y=i*f+s*u+o*a-r*c,n.z=o*f+s*c+r*u-i*a,n.w=s*f-r*a-i*u-o*c,n}static cross(e,t,n){n||(n=new l);const r=e.x,i=e.y,o=e.z,s=e.w,a=t.x,u=t.y,c=t.z,f=t.w;return n.x=s*c+o*f+r*u-i*a,n.y=s*f-r*a-i*u-o*c,n.z=s*a+r*f+i*c-o*u,n.w=s*u+i*f+o*a-r*c,n}static shortMix(e,t,n,r){if(r||(r=new l),n<=0)return r.xyzw=e.xyzw,r;if(n>=1)return r.xyzw=t.xyzw,r;let i=l.dot(e,t);const o=t.copy();let s,a;if(i<0&&(o.inverse(),i=-i),i>.9999)s=1-n,a=0+n;else{const e=Math.sqrt(1-i*i),t=Math.atan2(e,i),r=1/e;s=Math.sin((1-n)*t)*r,a=Math.sin((0+n)*t)*r}return r.x=s*e.x+a*o.x,r.y=s*e.y+a*o.y,r.z=s*e.z+a*o.z,r.w=s*e.w+a*o.w,r}static mix(e,t,n,r){r||(r=new l);const i=e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w;if(Math.abs(i)>=1)return r.xyzw=e.xyzw,r;const o=Math.acos(i),s=Math.sqrt(1-i*i);if(Math.abs(s)<.001)return r.x=.5*e.x+.5*t.x,r.y=.5*e.y+.5*t.y,r.z=.5*e.z+.5*t.z,r.w=.5*e.w+.5*t.w,r;const a=Math.sin((1-n)*o)/s,u=Math.sin(n*o)/s;return r.x=e.x*a+t.x*u,r.y=e.y*a+t.y*u,r.z=e.z*a+t.z*u,r.w=e.w*a+t.w*u,r}static fromAxisAngle(e,t,n){n||(n=new l),t*=.5;const r=Math.sin(t);return n.x=e.x*r,n.y=e.y*r,n.z=e.z*r,n.w=Math.cos(t),n}}t.default=l,l.identity=(new l).setIdentity()},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i=n(5),o=r(n(1));class s extends i.GridBase{constructor(e,t,n=1,r=new o.default([0,0,0]),i=0){super(e,t,n,r,i)}fillGrid(e,t=new o.default([0,0,0]),n=this.mSize,r=0,i=this.mSizeT){super.fillGrid(e,t,n,r,i)}destroy(){super.destroy()}}t.Grid=s},function(e,t,n){"use strict";var r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t};Object.defineProperty(t,"__esModule",{value:!0});const i=n(15),o=n(12),s=r(n(42)),a=r(n(43)),l=n(0),u=n(8),c=n(6),f=n(4),d=n(3),h=n(14);class p extends i.RenderComponent{constructor(e){super(),this.mVolumeTexture=e,this.mMaterial=new c.UniformBuffer([new f.StructEntry("reflCol",f.DataTypes.FLOAT32,4,[1,1,1,1]),new f.StructEntry("diffCol",f.DataTypes.FLOAT32,4,[0,0,0,0]),new f.StructEntry("specCol",f.DataTypes.FLOAT32,4,[1,1,1,1]),new f.StructEntry("volCol",f.DataTypes.FLOAT32,4,[0,0,0,0]),new f.StructEntry("shinniness",f.DataTypes.INT32,1,32),new f.StructEntry("dens_fac",f.DataTypes.FLOAT32,1,1),new f.StructEntry("_pad",f.DataTypes.INT32,2)])}static _init(){p.mRaytracerProgram=d.ResourceFactory.createShaderFromSource([{type:l.WebGL2.context.VERTEX_SHADER,code:s.default},{type:l.WebGL2.context.FRAGMENT_SHADER,code:a.default}]),p.M_MATRIX_LOC=l.WebGL2.context.getUniformLocation(p.mRaytracerProgram,"model"),p.INV_M_MATRIX_LOC=l.WebGL2.context.getUniformLocation(p.mRaytracerProgram,"inv_m"),p.CAM_UBO_LOC=l.WebGL2.context.getUniformBlockIndex(p.mRaytracerProgram,"cam_data"),p.MAT_UBO_LOC=new h.ResourceLocation(l.WebGL2.context.getUniformBlockIndex(p.mRaytracerProgram,"material")),p.PROP_UBO_LOC=new h.ResourceLocation(l.WebGL2.context.getUniformBlockIndex(p.mRaytracerProgram,"properties")),p.SKY_TEX_LOC=l.WebGL2.context.getUniformLocation(p.mRaytracerProgram,"sky"),p.PHI_TEX_LOC=new h.ResourceLocation(l.WebGL2.context.getUniformLocation(p.mRaytracerProgram,"phi")),p.mDomain=o.MeshGenerator.getCubeMesh()}setVolumeTexture(e){this.mVolumeTexture=e}getVolumeTexture(){return this.mVolumeTexture}setMaterialEntry(e,t){this.mMaterial.set(e,t)}draw(){this.mVolumeTexture.getPropBuffer().uploadBuffer(p.PROP_UBO_LOC.pnt),this.mMaterial.uploadBuffer(p.MAT_UBO_LOC.pnt),l.WebGL2.context.useProgram(p.mRaytracerProgram),l.WebGL2.context.uniformBlockBinding(p.mRaytracerProgram,p.MAT_UBO_LOC.loc,p.MAT_UBO_LOC.pnt),l.WebGL2.context.uniformBlockBinding(p.mRaytracerProgram,p.PROP_UBO_LOC.loc,p.PROP_UBO_LOC.pnt),l.WebGL2.context.uniformBlockBinding(p.mRaytracerProgram,p.CAM_UBO_LOC,u.RenderEngine.CAM_BUFFER_PNT),l.WebGL2.context.uniformMatrix4fv(p.M_MATRIX_LOC,!1,this.mEntity.getTransform().getLocalToWorld().toArray()),l.WebGL2.context.uniformMatrix4fv(p.INV_M_MATRIX_LOC,!1,this.mEntity.getTransform().getWorldToLocal().toArray()),l.WebGL2.context.activeTexture(WebGL2RenderingContext.TEXTURE0+p.PHI_TEX_LOC.pnt),this.mVolumeTexture.bindTexture(),l.WebGL2.context.uniform1i(p.PHI_TEX_LOC.loc,p.PHI_TEX_LOC.pnt),l.WebGL2.context.uniform1i(p.SKY_TEX_LOC,u.RenderEngine.SKY_TEX_PNT),p.mDomain.draw(),this.mVolumeTexture.unbindTexture()}}t.VolumeRenderComponent=p},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(9),i=n(2),o=n(0);class s extends r.Resource{constructor(e,t){super(),this.mIndexCount=t.length,this.mVertexBuffer=o.WebGL2.context.createBuffer(),o.WebGL2.context.bindBuffer(o.WebGL2.context.ARRAY_BUFFER,this.mVertexBuffer),o.WebGL2.context.bufferData(o.WebGL2.context.ARRAY_BUFFER,new Float32Array(e),o.WebGL2.context.STATIC_DRAW),o.WebGL2.context.bindBuffer(o.WebGL2.context.ARRAY_BUFFER,null),this.mIndexBuffer=o.WebGL2.context.createBuffer(),o.WebGL2.context.bindBuffer(o.WebGL2.context.ELEMENT_ARRAY_BUFFER,this.mIndexBuffer),o.WebGL2.context.bufferData(o.WebGL2.context.ELEMENT_ARRAY_BUFFER,new Int16Array(t),o.WebGL2.context.STATIC_DRAW),o.WebGL2.context.bindBuffer(o.WebGL2.context.ELEMENT_ARRAY_BUFFER,null),i.GLHelper.CheckGLError()}draw(){o.WebGL2.context.bindBuffer(o.WebGL2.context.ARRAY_BUFFER,this.mVertexBuffer),o.WebGL2.context.enableVertexAttribArray(s.POS_ATTR.handle),o.WebGL2.context.vertexAttribPointer(s.POS_ATTR.handle,s.POS_ATTR.elem_size,o.WebGL2.context.FLOAT,!1,s.VERTEX_BYTE_STRIDE,0),o.WebGL2.context.enableVertexAttribArray(s.TEX_COORD_ATTR.handle),o.WebGL2.context.vertexAttribPointer(s.TEX_COORD_ATTR.handle,s.TEX_COORD_ATTR.elem_size,o.WebGL2.context.FLOAT,!1,s.VERTEX_BYTE_STRIDE,4*s.POS_ATTR.elem_size),o.WebGL2.context.enableVertexAttribArray(s.NOR_ATTR.handle),o.WebGL2.context.vertexAttribPointer(s.NOR_ATTR.handle,s.NOR_ATTR.elem_size,o.WebGL2.context.FLOAT,!0,s.VERTEX_BYTE_STRIDE,4*(s.POS_ATTR.elem_size+s.TEX_COORD_ATTR.elem_size)),o.WebGL2.context.enableVertexAttribArray(s.TAN_ATTR.handle),o.WebGL2.context.vertexAttribPointer(s.TAN_ATTR.handle,s.TAN_ATTR.elem_size,o.WebGL2.context.FLOAT,!1,s.VERTEX_BYTE_STRIDE,4*(s.POS_ATTR.elem_size+s.TEX_COORD_ATTR.elem_size+s.NOR_ATTR.elem_size)),o.WebGL2.context.bindBuffer(o.WebGL2.context.ELEMENT_ARRAY_BUFFER,this.mIndexBuffer),o.WebGL2.context.drawElements(o.WebGL2.context.TRIANGLES,this.mIndexCount,o.WebGL2.context.UNSIGNED_SHORT,0),o.WebGL2.context.bindBuffer(o.WebGL2.context.ARRAY_BUFFER,null),o.WebGL2.context.bindBuffer(o.WebGL2.context.ELEMENT_ARRAY_BUFFER,null),i.GLHelper.CheckGLError()}drawInstanced(e){o.WebGL2.context.bindBuffer(o.WebGL2.context.ARRAY_BUFFER,this.mVertexBuffer),o.WebGL2.context.enableVertexAttribArray(s.POS_ATTR.handle),o.WebGL2.context.vertexAttribPointer(s.POS_ATTR.handle,s.POS_ATTR.elem_size,o.WebGL2.context.FLOAT,!1,s.VERTEX_BYTE_STRIDE,0),o.WebGL2.context.enableVertexAttribArray(s.TEX_COORD_ATTR.handle),o.WebGL2.context.vertexAttribPointer(s.TEX_COORD_ATTR.handle,s.TEX_COORD_ATTR.elem_size,o.WebGL2.context.FLOAT,!1,s.VERTEX_BYTE_STRIDE,4*s.POS_ATTR.elem_size),o.WebGL2.context.enableVertexAttribArray(s.NOR_ATTR.handle),o.WebGL2.context.vertexAttribPointer(s.NOR_ATTR.handle,s.NOR_ATTR.elem_size,o.WebGL2.context.FLOAT,!1,s.VERTEX_BYTE_STRIDE,4*(s.POS_ATTR.elem_size+s.TEX_COORD_ATTR.elem_size)),o.WebGL2.context.enableVertexAttribArray(s.TAN_ATTR.handle),o.WebGL2.context.vertexAttribPointer(s.TAN_ATTR.handle,s.TAN_ATTR.elem_size,o.WebGL2.context.FLOAT,!1,s.VERTEX_BYTE_STRIDE,4*(s.POS_ATTR.elem_size+s.TEX_COORD_ATTR.elem_size+s.NOR_ATTR.elem_size)),o.WebGL2.context.bindBuffer(o.WebGL2.context.ELEMENT_ARRAY_BUFFER,this.mIndexBuffer),o.WebGL2.context.drawElementsInstanced(o.WebGL2.context.TRIANGLES,this.mIndexCount,o.WebGL2.context.UNSIGNED_SHORT,0,e),o.WebGL2.context.bindBuffer(o.WebGL2.context.ARRAY_BUFFER,null),o.WebGL2.context.bindBuffer(o.WebGL2.context.ELEMENT_ARRAY_BUFFER,null),i.GLHelper.CheckGLError()}destroy(){o.WebGL2.context.deleteBuffer(this.mVertexBuffer),o.WebGL2.context.deleteBuffer(this.mIndexBuffer)}}t.Mesh=s,s.POS_ATTR={handle:0,elem_size:3},s.TEX_COORD_ATTR={handle:1,elem_size:2},s.NOR_ATTR={handle:2,elem_size:3},s.TAN_ATTR={handle:3,elem_size:3},s.VERTEX_BYTE_STRIDE=4*(s.POS_ATTR.elem_size+s.TEX_COORD_ATTR.elem_size+s.NOR_ATTR.elem_size+s.TAN_ATTR.elem_size)},function(e,t,n){"use strict";n.r(t),t.default="#version 300 es\n\nlayout(location = 0) in vec4 pos;\n\nout vec2 uv;\n\nvoid main() {\n   uv = vec2(pos.x + 0.5, -pos.z + 0.5);\n   gl_Position = vec4(pos.x * 2.0, -pos.z * 2.0, 0.0, 1.0);\n}"},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i=r(n(13)),o=r(n(16)),s=r(n(35)),a=r(n(1)),l=n(7);class u{constructor(e){this.values=new Float32Array(9),void 0!==e&&this.init(e)}at(e){return this.values[e]}toArray(){return Array.from(this.values)}size(){return 9}init(e){for(let t=0;t<9;t++)this.values[t]=e[t];return this}reset(){for(let e=0;e<9;e++)this.values[e]=0}copy(e){e||(e=new u);for(let t=0;t<9;t++)e.values[t]=this.values[t];return e}all(){const e=[];for(let t=0;t<9;t++)e[t]=this.values[t];return e}row(e){return[this.values[3*e+0],this.values[3*e+1],this.values[3*e+2]]}col(e){return[this.values[e],this.values[e+3],this.values[e+6]]}equals(e,t=l.epsilon){for(let n=0;n<9;n++)if(Math.abs(this.values[n]-e.at(n))>t)return!1;return!0}determinant(){const e=this.values[0],t=this.values[1],n=this.values[2],r=this.values[3],i=this.values[4],o=this.values[5],s=this.values[6],a=this.values[7],l=this.values[8];return e*(l*i-o*a)+t*(-l*r+o*s)+n*(a*r-i*s)}setIdentity(){return this.values[0]=1,this.values[1]=0,this.values[2]=0,this.values[3]=0,this.values[4]=1,this.values[5]=0,this.values[6]=0,this.values[7]=0,this.values[8]=1,this}transpose(){const e=this.values[1],t=this.values[2],n=this.values[5];return this.values[1]=this.values[3],this.values[2]=this.values[6],this.values[3]=e,this.values[5]=this.values[7],this.values[6]=t,this.values[7]=n,this}inverse(){const e=this.values[0],t=this.values[1],n=this.values[2],r=this.values[3],i=this.values[4],o=this.values[5],s=this.values[6],a=this.values[7],l=this.values[8],u=l*i-o*a,c=-l*r+o*s,f=a*r-i*s;let d=e*u+t*c+n*f;return d?(d=1/d,this.values[0]=u*d,this.values[1]=(-l*t+n*a)*d,this.values[2]=(o*t-n*i)*d,this.values[3]=c*d,this.values[4]=(l*e-n*s)*d,this.values[5]=(-o*e+n*r)*d,this.values[6]=f*d,this.values[7]=(-a*e+t*s)*d,this.values[8]=(i*e-t*r)*d,this):null}multiply(e){const t=this.values[0],n=this.values[1],r=this.values[2],i=this.values[3],o=this.values[4],s=this.values[5],a=this.values[6],l=this.values[7],u=this.values[8],c=e.at(0),f=e.at(1),d=e.at(2),h=e.at(3),p=e.at(4),m=e.at(5),v=e.at(6),y=e.at(7),x=e.at(8);return this.values[0]=c*t+f*i+d*a,this.values[1]=c*n+f*o+d*l,this.values[2]=c*r+f*s+d*u,this.values[3]=h*t+p*i+m*a,this.values[4]=h*n+p*o+m*l,this.values[5]=h*r+p*s+m*u,this.values[6]=v*t+y*i+x*a,this.values[7]=v*n+y*o+x*l,this.values[8]=v*r+y*s+x*u,this}multiplyVec2(e,t){const n=e.x,r=e.y;return t?(t.xy=[n*this.values[0]+r*this.values[3]+this.values[6],n*this.values[1]+r*this.values[4]+this.values[7]],t):new s.default([n*this.values[0]+r*this.values[3]+this.values[6],n*this.values[1]+r*this.values[4]+this.values[7]])}multiplyVec3(e,t){const n=e.x,r=e.y,i=e.z;return t?(t.xyz=[n*this.values[0]+r*this.values[3]+i*this.values[6],n*this.values[1]+r*this.values[4]+i*this.values[7],n*this.values[2]+r*this.values[5]+i*this.values[8]],t):new a.default([n*this.values[0]+r*this.values[3]+i*this.values[6],n*this.values[1]+r*this.values[4]+i*this.values[7],n*this.values[2]+r*this.values[5]+i*this.values[8]])}toMat4(e){return e?(e.init([this.values[0],this.values[1],this.values[2],0,this.values[3],this.values[4],this.values[5],0,this.values[6],this.values[7],this.values[8],0,0,0,0,1]),e):new i.default([this.values[0],this.values[1],this.values[2],0,this.values[3],this.values[4],this.values[5],0,this.values[6],this.values[7],this.values[8],0,0,0,0,1])}toQuat(){const e=this.values[0],t=this.values[1],n=this.values[2],r=this.values[3],i=this.values[4],s=this.values[5],a=this.values[6],l=this.values[7],u=this.values[8],c=e-i-u,f=i-e-u,d=u-e-i;let h=0,p=e+i+u;c>p&&(p=c,h=1),f>p&&(p=f,h=2),d>p&&(p=d,h=3);const m=.5*Math.sqrt(p+1),v=.25/m,y=new o.default;switch(h){case 0:y.w=m,y.x=(s-l)*v,y.y=(a-n)*v,y.z=(t-r)*v;break;case 1:y.w=(s-l)*v,y.x=m,y.y=(t+r)*v,y.z=(a+n)*v;break;case 2:y.w=(a-n)*v,y.x=(t+r)*v,y.y=m,y.z=(s+l)*v;break;case 3:y.w=(t-r)*v,y.x=(a+n)*v,y.y=(s+l)*v,y.z=m}return y}rotate(e,t){let n=t.x,r=t.y,i=t.z,o=Math.sqrt(n*n+r*r+i*i);if(!o)return null;1!==o&&(n*=o=1/o,r*=o,i*=o);const s=Math.sin(e),a=Math.cos(e),l=1-a,u=this.values[0],c=this.values[1],f=this.values[2],d=this.values[4],h=this.values[5],p=this.values[6],m=this.values[8],v=this.values[9],y=this.values[10],x=n*n*l+a,g=r*n*l+i*s,T=i*n*l-r*s,b=n*r*l-i*s,_=r*r*l+a,L=i*r*l+n*s,E=n*i*l+r*s,C=r*i*l-n*s,w=i*i*l+a;return this.values[0]=u*x+d*g+m*T,this.values[1]=c*x+h*g+v*T,this.values[2]=f*x+p*g+y*T,this.values[3]=u*b+d*_+m*L,this.values[4]=c*b+h*_+v*L,this.values[5]=f*b+p*_+y*L,this.values[6]=u*E+d*C+m*w,this.values[7]=c*E+h*C+v*w,this.values[8]=f*E+p*C+y*w,this}static product(e,t,n){const r=e.at(0),i=e.at(1),o=e.at(2),s=e.at(3),a=e.at(4),l=e.at(5),c=e.at(6),f=e.at(7),d=e.at(8),h=t.at(0),p=t.at(1),m=t.at(2),v=t.at(3),y=t.at(4),x=t.at(5),g=t.at(6),T=t.at(7),b=t.at(8);return n?(n.init([h*r+p*s+m*c,h*i+p*a+m*f,h*o+p*l+m*d,v*r+y*s+x*c,v*i+y*a+x*f,v*o+y*l+x*d,g*r+T*s+b*c,g*i+T*a+b*f,g*o+T*l+b*d]),n):new u([h*r+p*s+m*c,h*i+p*a+m*f,h*o+p*l+m*d,v*r+y*s+x*c,v*i+y*a+x*f,v*o+y*l+x*d,g*r+T*s+b*c,g*i+T*a+b*f,g*o+T*l+b*d])}}t.default=u,u.identity=(new u).setIdentity()},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i=n(9),o=n(3),s=n(0),a=n(12),l=n(2),u=n(6),c=n(4),f=r(n(10));class d extends i.Resource{constructor(e,t,n){super(),this.mTexSize=e,this.mFramebuffer=n||o.ResourceFactory.createFramebuffer(void 0,void 0,this.mTexSize.x,this.mTexSize.y),this.mTextureHandle=t||n.color[0],this.mComputeIt=Math.ceil(this.mTexSize.z/s.WebGL2.MAX_DRAW_BUFFERS)}static _init(){d.screenplane=a.MeshGenerator.getPlaneMesh(),d.COMPUTE_UBO_PNT=l.GLHelper.getNextBufferPnt()}dispatch(e,t=new f.default([0,0,0,0]),n=new f.default([1,1,1,1])){s.WebGL2.context.bindFramebuffer(WebGL2RenderingContext.FRAMEBUFFER,this.mFramebuffer.handle);let r=s.WebGL2.context.getParameter(s.WebGL2.context.VIEWPORT);if(s.WebGL2.context.viewport(0,0,this.mTexSize.x,this.mTexSize.y),new u.UniformBuffer([new c.StructEntry("domain0",c.DataTypes.FLOAT32,4,t.toArray()),new c.StructEntry("domain1",c.DataTypes.FLOAT32,4,n.toArray())]).uploadBuffer(d.COMPUTE_UBO_PNT),s.WebGL2.context.uniformBlockBinding(e,s.WebGL2.context.getUniformBlockIndex(e,"compute_prop"),d.COMPUTE_UBO_PNT),this.mTexSize.z>1){let t=s.WebGL2.context.getUniformLocation(e,"slice");for(var i=0;i<this.mComputeIt;i++){let e=[];for(var o=0;o<s.WebGL2.MAX_DRAW_BUFFERS&&!(i*s.WebGL2.MAX_DRAW_BUFFERS+o>=this.mTexSize.z);o++)e.push(WebGL2RenderingContext.COLOR_ATTACHMENT0+o),s.WebGL2.context.framebufferTextureLayer(WebGL2RenderingContext.FRAMEBUFFER,WebGL2RenderingContext.COLOR_ATTACHMENT0+o,this.mTextureHandle,0,i*s.WebGL2.MAX_DRAW_BUFFERS+o);t&&s.WebGL2.context.uniform1f(t,i),s.WebGL2.context.drawBuffers(e),d.screenplane.draw()}}else{let e=[];for(i=0;i<this.mFramebuffer.color.length;i++)e.push(WebGL2RenderingContext.COLOR_ATTACHMENT0+i);s.WebGL2.context.drawBuffers(e),d.screenplane.draw()}s.WebGL2.context.bindFramebuffer(WebGL2RenderingContext.FRAMEBUFFER,null),s.WebGL2.context.viewport(r[0],r[1],r[2],r[3])}destroy(){}}t.ComputeWrapper=d},function(e,t,n){"use strict";var r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t};Object.defineProperty(t,"__esModule",{value:!0});const i=n(15),o=r(n(50)),s=r(n(51)),a=n(6),l=n(4),u=n(0),c=n(3),f=n(14),d=n(8),h=n(12),p=n(2);class m extends i.RenderComponent{constructor(e){super(),this.mParticleSystem=e,this.mMaterial=new a.UniformBuffer([new l.StructEntry("reflCol",l.DataTypes.FLOAT32,4,[0,0,0,0]),new l.StructEntry("diffCol",l.DataTypes.FLOAT32,4,[1,1,0,1]),new l.StructEntry("specCol",l.DataTypes.FLOAT32,4,[1,1,1,0]),new l.StructEntry("shinniness",l.DataTypes.INT32,1,16),new l.StructEntry("_pad",l.DataTypes.INT32,3)])}static _init(){m.mParticleProgram=c.ResourceFactory.createShaderFromSource([{type:u.WebGL2.context.VERTEX_SHADER,code:o.default},{type:u.WebGL2.context.FRAGMENT_SHADER,code:s.default}]),m.M_MATRIX_LOC=u.WebGL2.context.getUniformLocation(m.mParticleProgram,"model"),m.INV_M_MATRIX_LOC=u.WebGL2.context.getUniformLocation(m.mParticleProgram,"inv_m"),m.PARTICLE_SCALE_LOC=u.WebGL2.context.getUniformLocation(m.mParticleProgram,"radius"),m.CAM_UBO_LOC=u.WebGL2.context.getUniformBlockIndex(m.mParticleProgram,"cam_data"),m.MAT_UBO_LOC=new f.ResourceLocation(u.WebGL2.context.getUniformBlockIndex(m.mParticleProgram,"material")),m.SKY_TEX_LOC=u.WebGL2.context.getUniformLocation(m.mParticleProgram,"sky"),m.mParticleMesh=h.MeshGenerator.getPlaneMesh()}getParticleSystem(){return this.mParticleSystem}setMaterialEntry(e,t){this.mMaterial.set(e,t)}draw(){u.WebGL2.context.useProgram(m.mParticleProgram),this.mMaterial.uploadBuffer(m.MAT_UBO_LOC.pnt),p.GLHelper.CheckGLError(),u.WebGL2.context.uniformBlockBinding(m.mParticleProgram,m.MAT_UBO_LOC.loc,m.MAT_UBO_LOC.pnt),u.WebGL2.context.uniformBlockBinding(m.mParticleProgram,m.CAM_UBO_LOC,d.RenderEngine.CAM_BUFFER_PNT),p.GLHelper.CheckGLError(),u.WebGL2.context.uniformMatrix4fv(m.M_MATRIX_LOC,!1,this.mEntity.getTransform().getLocalToWorld().toArray()),u.WebGL2.context.uniformMatrix4fv(m.INV_M_MATRIX_LOC,!1,this.mEntity.getTransform().getWorldToLocal().toArray()),u.WebGL2.context.uniform1f(m.PARTICLE_SCALE_LOC,this.mParticleSystem.scale()),u.WebGL2.context.uniform1i(m.SKY_TEX_LOC,d.RenderEngine.SKY_TEX_PNT),this.mParticleSystem.bind(),p.GLHelper.CheckGLError(),u.WebGL2.context.enableVertexAttribArray(m.OFF_ATTR.handle),u.WebGL2.context.vertexAttribPointer(m.OFF_ATTR.handle,m.OFF_ATTR.elem_size,WebGL2RenderingContext.FLOAT,!1,4*m.OFF_ATTR.elem_size,0),u.WebGL2.context.vertexAttribDivisor(m.OFF_ATTR.handle,1),p.GLHelper.CheckGLError(),m.mParticleMesh.drawInstanced(this.mParticleSystem.count())}}t.ParticleRenderComponent=m,m.OFF_ATTR={handle:4,elem_size:3}},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i=r(n(25));t.Webglviewer=i.default},function(e,t,n){"use strict";var r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const o=r(n(26)),s=i(n(27)),a=i(n(28));class l extends o.Component{constructor(e){super(e),this.scene=null,this.lastV=null}componentDidMount(){this.scene=new a.default(this.props.id,this.props.sky)}componentDidUpdate(){var e=!1;if(null==this.props.data||null!=this.lastV&&this.lastV.data==this.props.data&&this.lastV.representation_type==this.props.representation_type)null!=this.lastV&&this.lastV.idx==this.props.idx||(this.scene.setIdx(this.props.idx),e=!0),null!=this.lastV&&this.lastV.material_type==this.props.material_type||(this.scene.setMaterial(this.props.material_type),e=!0),null!=this.lastV&&this.lastV.scale==this.props.scale||(this.scene.setScale(this.props.scale),e=!0);else{var t=void 0===this.props.data[0][0][0].length?[this.props.data]:this.props.data;this.scene.setData(t,this.props.representation_type,this.props.material_type,this.props.idx,this.props.scale),e=!0}e&&this.scene.update(.1),this.lastV=this.props}render(){return o.default.createElement("canvas",{id:this.props.id,width:800,height:600,style:{width:"100%",height:"100%"}})}}t.default=l,l.defaultProps={},l.propTypes={id:s.default.string.isRequired,data:s.default.array,idx:s.default.number,sky:s.default.array,material_type:s.default.string,representation_type:s.default.string,scale:s.default.number}},function(e,t){e.exports=window.React},function(e,t){e.exports=window.PropTypes},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i=n(29),o=n(52),s=n(18),a=n(23),l=n(53),u=n(2),c=n(3),f=r(n(1)),d=r(n(10)),h=n(56),p=r(n(57));class m extends l.Scene{constructor(e,t){super(),this.mRenderComps=[],this.mRepresentations=[],this.mAzimut=0,this.mInclination=90,this.mCamDistance=2,this.mouseStateDown=!1,i.EngineInitializer.init(e);const n=this.createEntity();let r;r=t?c.ResourceFactory.createCubeTextureFromArray(t):c.ResourceFactory.createCubeTextureFromConstCol(new d.default([.7,.7,.7,1])),n.setCameraComponent(new o.CameraComponent(r,60,.1,10)),this.updateCam();const s=this.createEntity();s.setLightComponent(new h.LightComponent(new f.default([1,1,1]))),s.getTransform().setPosition(new f.default([1,2,-2])),s.getTransform().setScale(new f.default([.1,.1,.1])),this.mRenderEntity=this.createEntity(),this.mRenderEntity.getTransform().setPosition(new f.default([0,.25,0])),this.init();let a=this,l=p.default("#"+e);l.mousedown((function(e){a.mouseStateDown=!0,a.oldX=null})),document.onmouseup=function(e){a.mouseStateDown=!1},l.mousemove((function(e){a.mouseStateDown&&(a.duringDrag(e.pageX,e.pageY),a.update(.1))})),l.on("wheel",(function(e){e.preventDefault(),a.mCamDistance+=.03*e.originalEvent.deltaY,a.mCamDistance=Math.min(Math.max(a.mCamDistance,1.2),4),a.update(.1)})),this.update(.1)}init(){}duringDrag(e,t){this.oldX||(this.oldX=e,this.oldY=t),this.mAzimut-=e-this.oldX,this.mInclination-=t-this.oldY,this.mAzimut<-180?this.mAzimut+=360:this.mAzimut>180&&(this.mAzimut-=360),this.mInclination<10?this.mInclination=10:this.mInclination>90&&(this.mInclination=90),this.oldX=e,this.oldY=t}updateCam(){let e=this.mAzimut/180*Math.PI,t=this.mInclination/180*Math.PI,n=new f.default([this.mCamDistance*Math.sin(t)*Math.sin(e),this.mCamDistance*Math.cos(t),this.mCamDistance*Math.sin(t)*Math.cos(e)]);this.mCamera.getEntity().getTransform().setPosition(n),this.mCamera.getEntity().getTransform().lookAt(new f.default([0,0,0]))}createRenderComponent(e="DENSITY",t){switch(e){case"DENSITY":case"SDF":return new s.VolumeRenderComponent(c.ResourceFactory.createFloatGrid(new f.default([t[0],t[1],t[2]]),1,new f.default([1,1,1])));case"PARTICLE":return new a.ParticleRenderComponent(c.ResourceFactory.createParticleSystemFromArray(new Float32Array([0,0,0]),.1));default:console.error("Representation type not recognized! Expected one of these: DENSITY, SDF, PARTICLE!")}}flattenDeep(e){return e.reduce((e,t)=>Array.isArray(t)?e.concat(this.flattenDeep(t)):e.concat(t),[])}transposeFlatten(e){let t=[e[0][0].length,e[0].length,e.length],n=[];for(var r=0;r<t[2];r++)for(var i=0;i<t[1];i++)for(var o=0;o<t[0];o++)n.push(e[r][i][o]);return n}setData(e,t,n,r,i){void 0===t&&(t="DENSITY");for(let n=0;n<e.length;n++){let r=e[n],i=t instanceof Array?t[n]:t,o="PARTICLE"!=i?[r[0][0].length,r[0].length,r.length]:void 0;if(this.mRepresentations.length<=n)this.mRepresentations.push(i),this.mRenderComps.push(this.createRenderComponent(i,o));else if(i!=this.mRepresentations[n])this.mRepresentations[n]=i,this.mRenderComps[n]=this.createRenderComponent(i,o);else if(null!=o&&"PARTICLE"!=i){let e=this.mRenderComps[n].getVolumeTexture().getSize();o[0]==e.x&&o[1]==e.y&&o[2]==e.z||(this.mRenderComps[n]=this.createRenderComponent(i,o))}switch(console.log("Load data: "+(n+1)+"/"+e.length+", "+i+" "+o),i){case"DENSITY":this.mRenderComps[n].getVolumeTexture().load(new Float32Array(this.transposeFlatten(r))),this.mRenderComps[n].getVolumeTexture().multConst(-1),this.mRenderComps[n].getVolumeTexture().addConst(.1);break;case"SDF":this.mRenderComps[n].getVolumeTexture().load(new Float32Array(this.transposeFlatten(r)));break;case"PARTICLE":this.mRenderComps[n].getParticleSystem().load(new Float32Array(this.flattenDeep(r)))}}this.mRepresentations=this.mRepresentations.slice(0,e.length),this.mRenderComps=this.mRenderComps.slice(0,e.length),this.setMaterial(n),this.setIdx(r),this.setScale(i)}setIdx(e){void 0===e&&(e=0),e<this.mRenderComps.length&&this.mRenderEntity.setRenderComponent(this.mRenderComps[e])}setMaterial(e){switch(void 0===e&&(e="SOLID"),e){case"SMOKE":case"DARK_SMOKE":for(let e=0;e<this.mRenderComps.length;e++){let t=this.mRenderComps[e];t.setMaterialEntry("diffCol",[0,0,0,0]),t.setMaterialEntry("reflCol",[1,1,1,0]),t.setMaterialEntry("specCol",[1,1,1,0]),"PARTICLE"!=this.mRepresentations[e]&&(t.setMaterialEntry("volCol",[0,0,0,.5]),t.setMaterialEntry("dens_fac",10))}break;case"LIGHT_SMOKE":for(let e=0;e<this.mRenderComps.length;e++){let t=this.mRenderComps[e];t.setMaterialEntry("diffCol",[0,0,0,0]),t.setMaterialEntry("reflCol",[1,1,1,0]),t.setMaterialEntry("specCol",[1,1,1,0]),"PARTICLE"!=this.mRepresentations[e]&&(t.setMaterialEntry("volCol",[1,1,1,.1]),t.setMaterialEntry("dens_fac",10))}break;case"LIQUID":for(let e=0;e<this.mRenderComps.length;e++){let t=this.mRenderComps[e];t.setMaterialEntry("diffCol",[0,0,0,0]),t.setMaterialEntry("reflCol",[1,1,1,1]),t.setMaterialEntry("specCol",[1,1,1,1]),"PARTICLE"!=this.mRepresentations[e]&&(t.setMaterialEntry("volCol",[0,0,0,0]),t.setMaterialEntry("dens_fac",0))}break;case"SOLID":for(let e=0;e<this.mRenderComps.length;e++){let t=this.mRenderComps[e];t.setMaterialEntry("diffCol",[.1,.47,.8,1]),t.setMaterialEntry("reflCol",[1,1,1,0]),t.setMaterialEntry("specCol",[1,1,1,0]),"PARTICLE"!=this.mRepresentations[e]&&(t.setMaterialEntry("volCol",[0,0,0,0]),t.setMaterialEntry("dens_fac",100))}break;default:console.error("Material type not recognized! Expected one of these: SMOKE, DARK_SMOKE, LIGHT_SMOKE, LIQUID, SOLID!")}}setScale(e){void 0===e&&(e=.1);for(let t=0;t<this.mRepresentations.length;t++)"PARTICLE"==this.mRepresentations[t]&&this.mRenderComps[t].getParticleSystem().setScale(e)}update(e){this.updateCam(),this.render(),u.GLHelper.finish()}}t.default=m},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(8),i=n(5),o=n(0);class s extends o.WebGL2{static init(e){o.WebGL2.canvas=document.getElementById(e);let t=o.WebGL2.canvas.getContext("webgl2");if(null===t)return console.error("Error creating WebGL2 context."),!1;o.WebGL2.context=t,o.WebGL2.MAX_2D_TEX_SIZE=o.WebGL2.context.getParameter(WebGL2RenderingContext.MAX_3D_TEXTURE_SIZE),o.WebGL2.MAX_3D_TEX_SIZE=o.WebGL2.context.getParameter(WebGL2RenderingContext.MAX_3D_TEXTURE_SIZE),o.WebGL2.MAX_DRAW_BUFFERS=o.WebGL2.context.getParameter(WebGL2RenderingContext.MAX_DRAW_BUFFERS);for(let e of s.mRequiredExtensions)if(!o.WebGL2.context.getExtension(e))return o.WebGL2.context=null,console.log("Browser/Device doesn't support a required extension!: "+e),!1;return r.RenderEngine._init(),i.GridBase._init(),!0}}t.EngineInitializer=s,s.mRequiredExtensions=["OES_texture_float_linear","EXT_color_buffer_float"]},function(e,t,n){"use strict";n.r(t),t.default="#version 300 es\nprecision mediump float;\nprecision mediump sampler3D;\n\nvec4 texToGrid(vec3 texCoord, vec3 downScale) {\n    vec3 pos = fract(texCoord/downScale.xyz);\n    ivec3 offset = ivec3(texCoord.xyz/downScale.xyz - pos);\n    int t = offset.x + (offset.y + offset.z * int(1.0 / downScale.y)) * int(1.0 / downScale.x);\n    return vec4(pos,float(t));\n}\n\nvec3 gridToTex(vec4 gridCoord, vec3 downScale) {\n    float t = gridCoord.w;\n    ivec3 off;\n    off.z = int(t * downScale.x * downScale.y);\n    t -= float(off.z * int(1.0 / (downScale.x * downScale.y)));\n    off.y = int(t * downScale.x);\n    t -= float(off.y * int(1.0 / downScale.x));\n    off.x = int(t);\n    return (gridCoord.xyz + vec3(off)) * downScale;\n}\n\nvec4 sampleArray(sampler3D tex, vec4 pos, vec3 downScale, vec3 boundary, float boundaryVal, float timesteps) {\n    if(any(lessThan(pos, vec4(boundary, 0.0))) || any(greaterThan(pos, vec4(1,1,1,timesteps) - vec4(boundary, 0.0)))) {\n        return vec4(boundaryVal);\n    }\n    float fr = fract(pos.w);\n    return texture(tex, gridToTex(pos, downScale)) * (1.0 - fr) + texture(tex, gridToTex(pos + vec4(0,0,0,1), downScale)) * fr;\n}\n\n\nuniform sampler3D g0;\nuniform sampler3D g1;\n\nlayout(std140) uniform properties0\n{\n    vec3 offset;\n    vec3 nextOffset;\n    float offsetFrac;\n    vec3 downScale;\n    vec3 boundary;\n    float boundaryVal;\n    vec3 resolution;\n    float timesteps;\n} prop0;\n\nlayout(std140) uniform properties1\n{\n    vec3 offset;\n    vec3 nextOffset;\n    float offsetFrac;\n    vec3 downScale;\n    vec3 boundary;\n    float boundaryVal;\n    vec3 resolution;\n    float timesteps;\n} prop1;\n\nvec4 sampleG0(vec4 pos) {\n    return sampleArray(g0, pos, prop0.downScale, prop0.boundary, prop0.boundaryVal, prop0.timesteps);\n}\n\nvec4 sampleG1(vec4 pos) {\n    return sampleArray(g1, pos, prop1.downScale, prop1.boundary, prop1.boundaryVal, prop1.timesteps);\n}\nlayout(std140) uniform compute_prop\n{\n    vec4 domain0;\n    vec4 domain1;\n} c_prop;\n\nuniform float slice;\n\nin vec2 uv;\n\nlayout(location = 0) out vec4 layer0;\nlayout(location = 1) out vec4 layer1;\nlayout(location = 2) out vec4 layer2;\nlayout(location = 3) out vec4 layer3;\nlayout(location = 4) out vec4 layer4;\nlayout(location = 5) out vec4 layer5;\nlayout(location = 6) out vec4 layer6;\nlayout(location = 7) out vec4 layer7;\n\nvec4 get_pos(float i) {\n    vec3 g0TexSize = vec3(textureSize(g0, 0));\n    vec3 g1TexSize = vec3(textureSize(g1, 0));\n\n    vec4 pos = texToGrid(vec3(uv.x, uv.y, (slice * 8.0 + i + 0.5) / g0TexSize.z), prop0.downScale);\n\n    if(all(greaterThanEqual(pos, c_prop.domain0)) && all(lessThanEqual(pos, c_prop.domain1))) {\n        pos -= sampleG1(vec4(pos.xyz, pos.w*prop1.timesteps/prop0.timesteps)) / vec4(g1TexSize * prop1.downScale, 1.0);\n        pos = clamp(pos, vec4(0), vec4(1,1,1,prop0.timesteps));\n    }\n    return pos;\n}\n\nvoid main() {    \n    layer0 = sampleG0(get_pos(0.0));\n    layer1 = sampleG0(get_pos(1.0));\n    layer2 = sampleG0(get_pos(2.0));\n    layer3 = sampleG0(get_pos(3.0));\n    layer4 = sampleG0(get_pos(4.0));\n    layer5 = sampleG0(get_pos(5.0));\n    layer6 = sampleG0(get_pos(6.0));\n    layer7 = sampleG0(get_pos(7.0));\n}"},function(e,t,n){"use strict";n.r(t),t.default="#version 300 es\nprecision mediump float;\nprecision mediump sampler3D;\n\nvec4 texToGrid(vec3 texCoord, vec3 downScale) {\n    vec3 pos = fract(texCoord/downScale.xyz);\n    ivec3 offset = ivec3(texCoord.xyz/downScale.xyz - pos);\n    int t = offset.x + (offset.y + offset.z * int(1.0 / downScale.y)) * int(1.0 / downScale.x);\n    return vec4(pos,float(t));\n}\n\nvec3 gridToTex(vec4 gridCoord, vec3 downScale) {\n    float t = gridCoord.w;\n    ivec3 off;\n    off.z = int(t * downScale.x * downScale.y);\n    t -= float(off.z * int(1.0 / (downScale.x * downScale.y)));\n    off.y = int(t * downScale.x);\n    t -= float(off.y * int(1.0 / downScale.x));\n    off.x = int(t);\n    return (gridCoord.xyz + vec3(off)) * downScale;\n}\n\nvec4 sampleArray(sampler3D tex, vec4 pos, vec3 downScale, vec3 boundary, float boundaryVal, float timesteps) {\n    if(any(lessThan(pos, vec4(boundary, 0.0))) || any(greaterThan(pos, vec4(1,1,1,timesteps) - vec4(boundary, 0.0)))) {\n        return vec4(boundaryVal);\n    }\n    float fr = fract(pos.w);\n    return texture(tex, gridToTex(pos, downScale)) * (1.0 - fr) + texture(tex, gridToTex(pos + vec4(0,0,0,1), downScale)) * fr;\n}\n\n\nuniform sampler3D g;\n\nlayout(std140) uniform properties\n{\n    vec3 offset;\n    vec3 nextOffset;\n    float offsetFrac;\n    vec3 downScale;\n    vec3 boundary;\n    float boundaryVal;\n    vec3 resolution;\n    float timesteps;\n} prop;\n\nvec4 sampleGrid(vec4 pos) {\n    return sampleArray(g, pos, prop.downScale, prop.boundary, prop.boundaryVal, prop.timesteps);\n}\n\nvec4 sampleGrid(vec3 pos) {\n    if(any(lessThan(pos, prop.boundary)) || any(greaterThan(pos, vec3(1) - prop.boundary))) {\n        return vec4(prop.boundaryVal);\n    }\n    return texture(g, pos*prop.downScale + prop.offset) * (1.0 - prop.offsetFrac) + texture(g, pos*prop.downScale + prop.nextOffset) * prop.offsetFrac;\n}\nlayout(std140) uniform compute_prop\n{\n    vec4 domain0;\n    vec4 domain1;\n} c_prop;\n\nuniform float slice;\n\nin vec2 uv;\n\nlayout(location = 0) out vec4 layer0;\nlayout(location = 1) out vec4 layer1;\nlayout(location = 2) out vec4 layer2;\nlayout(location = 3) out vec4 layer3;\nlayout(location = 4) out vec4 layer4;\nlayout(location = 5) out vec4 layer5;\nlayout(location = 6) out vec4 layer6;\nlayout(location = 7) out vec4 layer7;\n\nvec4 get_mul(float i) {\n    vec3 gridTexSize = vec3(textureSize(g, 0));\n\n    vec3 pos = vec3(uv.x, uv.y, (slice * 8.0 + i + 0.5) / gridTexSize.z);\n\n    return sampleGrid(pos);\n}\n\nvoid main() {    \n    layer0 = get_mul(0.0);\n    layer1 = get_mul(1.0);\n    layer2 = get_mul(2.0);\n    layer3 = get_mul(3.0);\n    layer4 = get_mul(4.0);\n    layer5 = get_mul(5.0);\n    layer6 = get_mul(6.0);\n    layer7 = get_mul(7.0);\n}"},function(e,t,n){"use strict";n.r(t),t.default="#version 300 es\nprecision highp float;\nprecision mediump sampler3D;\n\nvec4 texToGrid(vec3 texCoord, vec3 downScale) {\n    vec3 pos = fract(texCoord/downScale.xyz);\n    ivec3 offset = ivec3(texCoord.xyz/downScale.xyz - pos);\n    int t = offset.x + (offset.y + offset.z * int(1.0 / downScale.y)) * int(1.0 / downScale.x);\n    return vec4(pos,float(t));\n}\n\nvec3 gridToTex(vec4 gridCoord, vec3 downScale) {\n    float t = gridCoord.w;\n    ivec3 off;\n    off.z = int(t * downScale.x * downScale.y);\n    t -= float(off.z * int(1.0 / (downScale.x * downScale.y)));\n    off.y = int(t * downScale.x);\n    t -= float(off.y * int(1.0 / downScale.x));\n    off.x = int(t);\n    return (gridCoord.xyz + vec3(off)) * downScale;\n}\n\nvec4 sampleArray(sampler3D tex, vec4 pos, vec3 downScale, vec3 boundary, float boundaryVal, float timesteps) {\n    if(any(lessThan(pos, vec4(boundary, 0.0))) || any(greaterThan(pos, vec4(1,1,1,timesteps) - vec4(boundary, 0.0)))) {\n        return vec4(boundaryVal);\n    }\n    float fr = fract(pos.w);\n    return texture(tex, gridToTex(pos, downScale)) * (1.0 - fr) + texture(tex, gridToTex(pos + vec4(0,0,0,1), downScale)) * fr;\n}\n\n\nuniform sampler3D g;\n\nlayout(std140) uniform properties\n{\n    vec3 offset;\n    vec3 nextOffset;\n    float offsetFrac;\n    vec3 downScale;\n    vec3 boundary;\n    float boundaryVal;\n    vec3 resolution;\n    float timesteps;\n} prop;\n\nvec4 sampleGrid(vec4 pos) {\n    return sampleArray(g, pos, prop.downScale, prop.boundary, prop.boundaryVal, prop.timesteps);\n}\n\nvec4 sampleGrid(vec3 pos) {\n    if(any(lessThan(pos, prop.boundary)) || any(greaterThan(pos, vec3(1) - prop.boundary))) {\n        return vec4(prop.boundaryVal);\n    }\n    return texture(g, pos*prop.downScale + prop.offset) * (1.0 - prop.offsetFrac) + texture(g, pos*prop.downScale + prop.nextOffset) * prop.offsetFrac;\n}\nlayout(std140) uniform compute_prop\n{\n    vec4 domain0;\n    vec4 domain1;\n} c_prop;\n\nlayout(std140) uniform const_func\n{\n    float add_cnst;\n    float mul_cnst;\n} const_f;\n\n\nuniform float slice;\n\nin vec2 uv;\n\nlayout(location = 0) out vec4 layer0;\nlayout(location = 1) out vec4 layer1;\nlayout(location = 2) out vec4 layer2;\nlayout(location = 3) out vec4 layer3;\nlayout(location = 4) out vec4 layer4;\nlayout(location = 5) out vec4 layer5;\nlayout(location = 6) out vec4 layer6;\nlayout(location = 7) out vec4 layer7;\n\nvec4 get_mul(float i) {\n    vec3 gridTexSize = vec3(textureSize(g, 0));\n\n    vec4 pos = texToGrid(vec3(uv.x, uv.y, (slice * 8.0 + i + 0.5) / gridTexSize.z), prop.downScale);\n\n    if(all(greaterThanEqual(pos, c_prop.domain0)) && all(lessThanEqual(pos, c_prop.domain1))) {\n        return sampleGrid(pos) * const_f.mul_cnst + const_f.add_cnst;\n    } else {\n        return sampleGrid(pos);\n    }\n}\n\nvoid main() {    \n    layer0 = get_mul(0.0);\n    layer1 = get_mul(1.0);\n    layer2 = get_mul(2.0);\n    layer3 = get_mul(3.0);\n    layer4 = get_mul(4.0);\n    layer5 = get_mul(5.0);\n    layer6 = get_mul(6.0);\n    layer7 = get_mul(7.0);\n}"},function(e,t,n){"use strict";n.r(t),t.default="#version 300 es\nprecision mediump float;\nprecision mediump sampler3D;\n\nvec4 texToGrid(vec3 texCoord, vec3 downScale) {\n    vec3 pos = fract(texCoord/downScale.xyz);\n    ivec3 offset = ivec3(texCoord.xyz/downScale.xyz - pos);\n    int t = offset.x + (offset.y + offset.z * int(1.0 / downScale.y)) * int(1.0 / downScale.x);\n    return vec4(pos,float(t));\n}\n\nvec3 gridToTex(vec4 gridCoord, vec3 downScale) {\n    float t = gridCoord.w;\n    ivec3 off;\n    off.z = int(t * downScale.x * downScale.y);\n    t -= float(off.z * int(1.0 / (downScale.x * downScale.y)));\n    off.y = int(t * downScale.x);\n    t -= float(off.y * int(1.0 / downScale.x));\n    off.x = int(t);\n    return (gridCoord.xyz + vec3(off)) * downScale;\n}\n\nvec4 sampleArray(sampler3D tex, vec4 pos, vec3 downScale, vec3 boundary, float boundaryVal, float timesteps) {\n    if(any(lessThan(pos, vec4(boundary, 0.0))) || any(greaterThan(pos, vec4(1,1,1,timesteps) - vec4(boundary, 0.0)))) {\n        return vec4(boundaryVal);\n    }\n    float fr = fract(pos.w);\n    return texture(tex, gridToTex(pos, downScale)) * (1.0 - fr) + texture(tex, gridToTex(pos + vec4(0,0,0,1), downScale)) * fr;\n}\n\n\nuniform sampler3D g0;\nuniform sampler3D g1;\n\nlayout(std140) uniform properties0\n{\n    vec3 offset;\n    vec3 nextOffset;\n    float offsetFrac;\n    vec3 downScale;\n    vec3 boundary;\n    float boundaryVal;\n    vec3 resolution;\n    float timesteps;\n} prop0;\n\nlayout(std140) uniform properties1\n{\n    vec3 offset;\n    vec3 nextOffset;\n    float offsetFrac;\n    vec3 downScale;\n    vec3 boundary;\n    float boundaryVal;\n    vec3 resolution;\n    float timesteps;\n} prop1;\n\nvec4 sampleG0(vec4 pos) {\n    return sampleArray(g0, pos, prop0.downScale, prop0.boundary, prop0.boundaryVal, prop0.timesteps);\n}\n\nvec4 sampleG1(vec4 pos) {\n    return sampleArray(g1, pos, prop1.downScale, prop1.boundary, prop1.boundaryVal, prop1.timesteps);\n}\nlayout(std140) uniform compute_prop\n{\n    vec4 domain0;\n    vec4 domain1;\n} c_prop;\n\nuniform float slice;\n\nin vec2 uv;\n\nlayout(location = 0) out vec4 layer0;\nlayout(location = 1) out vec4 layer1;\nlayout(location = 2) out vec4 layer2;\nlayout(location = 3) out vec4 layer3;\nlayout(location = 4) out vec4 layer4;\nlayout(location = 5) out vec4 layer5;\nlayout(location = 6) out vec4 layer6;\nlayout(location = 7) out vec4 layer7;\n\nvec4 get_sum(float i) {\n    vec3 g0TexSize = vec3(textureSize(g0, 0));\n    vec3 g1TexSize = vec3(textureSize(g1, 0));\n\n    vec4 pos = texToGrid(vec3(uv.x, uv.y, (slice * 8.0 + i + 0.5) / g0TexSize.z), prop0.downScale);\n\n    if(all(greaterThanEqual(pos, c_prop.domain0)) && all(lessThanEqual(pos, c_prop.domain1))) {\n        return sampleG0(pos) + sampleG1(vec4(pos.xyz, pos.w*prop1.timesteps/prop0.timesteps));\n    } else {\n        return sampleG0(pos);\n    }\n}\n\nvoid main() {    \n    layer0 = get_sum(0.0);\n    layer1 = get_sum(1.0);\n    layer2 = get_sum(2.0);\n    layer3 = get_sum(3.0);\n    layer4 = get_sum(4.0);\n    layer5 = get_sum(5.0);\n    layer6 = get_sum(6.0);\n    layer7 = get_sum(7.0);\n}"},function(e,t,n){"use strict";n.r(t),t.default="#version 300 es\nprecision mediump float;\nprecision mediump sampler3D;\n\nvec4 texToGrid(vec3 texCoord, vec3 downScale) {\n    vec3 pos = fract(texCoord/downScale.xyz);\n    ivec3 offset = ivec3(texCoord.xyz/downScale.xyz - pos);\n    int t = offset.x + (offset.y + offset.z * int(1.0 / downScale.y)) * int(1.0 / downScale.x);\n    return vec4(pos,float(t));\n}\n\nvec3 gridToTex(vec4 gridCoord, vec3 downScale) {\n    float t = gridCoord.w;\n    ivec3 off;\n    off.z = int(t * downScale.x * downScale.y);\n    t -= float(off.z * int(1.0 / (downScale.x * downScale.y)));\n    off.y = int(t * downScale.x);\n    t -= float(off.y * int(1.0 / downScale.x));\n    off.x = int(t);\n    return (gridCoord.xyz + vec3(off)) * downScale;\n}\n\nvec4 sampleArray(sampler3D tex, vec4 pos, vec3 downScale, vec3 boundary, float boundaryVal, float timesteps) {\n    if(any(lessThan(pos, vec4(boundary, 0.0))) || any(greaterThan(pos, vec4(1,1,1,timesteps) - vec4(boundary, 0.0)))) {\n        return vec4(boundaryVal);\n    }\n    float fr = fract(pos.w);\n    return texture(tex, gridToTex(pos, downScale)) * (1.0 - fr) + texture(tex, gridToTex(pos + vec4(0,0,0,1), downScale)) * fr;\n}\n\n\nuniform sampler3D g0;\nuniform sampler3D g1;\n\nlayout(std140) uniform properties0\n{\n    vec3 offset;\n    vec3 nextOffset;\n    float offsetFrac;\n    vec3 downScale;\n    vec3 boundary;\n    float boundaryVal;\n    vec3 resolution;\n    float timesteps;\n} prop0;\n\nlayout(std140) uniform properties1\n{\n    vec3 offset;\n    vec3 nextOffset;\n    float offsetFrac;\n    vec3 downScale;\n    vec3 boundary;\n    float boundaryVal;\n    vec3 resolution;\n    float timesteps;\n} prop1;\n\nvec4 sampleG0(vec4 pos) {\n    return sampleArray(g0, pos, prop0.downScale, prop0.boundary, prop0.boundaryVal, prop0.timesteps);\n}\n\nvec4 sampleG1(vec4 pos) {\n    return sampleArray(g1, pos, prop1.downScale, prop1.boundary, prop1.boundaryVal, prop1.timesteps);\n}\nlayout(std140) uniform compute_prop\n{\n    vec4 domain0;\n    vec4 domain1;\n} c_prop;\n\nuniform float slice;\n\nin vec2 uv;\n\nlayout(location = 0) out vec4 layer0;\nlayout(location = 1) out vec4 layer1;\nlayout(location = 2) out vec4 layer2;\nlayout(location = 3) out vec4 layer3;\nlayout(location = 4) out vec4 layer4;\nlayout(location = 5) out vec4 layer5;\nlayout(location = 6) out vec4 layer6;\nlayout(location = 7) out vec4 layer7;\n\nvec4 get_mul(float i) {\n    vec3 g0TexSize = vec3(textureSize(g0, 0));\n    vec3 g1TexSize = vec3(textureSize(g1, 0));\n\n    vec4 pos = texToGrid(vec3(uv.x, uv.y, (slice * 8.0 + i + 0.5) / g0TexSize.z), prop0.downScale);\n\n    if(all(greaterThanEqual(pos, c_prop.domain0)) && all(lessThanEqual(pos, c_prop.domain1))) {\n        return sampleG0(pos) * sampleG1(vec4(pos.xyz, pos.w*prop1.timesteps/prop0.timesteps));\n    } else {\n        return sampleG0(pos);\n    }\n}\n\nvoid main() {    \n    layer0 = get_mul(0.0);\n    layer1 = get_mul(1.0);\n    layer2 = get_mul(2.0);\n    layer3 = get_mul(3.0);\n    layer4 = get_mul(4.0);\n    layer5 = get_mul(5.0);\n    layer6 = get_mul(6.0);\n    layer7 = get_mul(7.0);\n}"},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i=r(n(1)),o=n(7);class s{constructor(e){this.values=new Float32Array(2),void 0!==e&&(this.xy=e)}get x(){return this.values[0]}get y(){return this.values[1]}get xy(){return[this.values[0],this.values[1]]}set x(e){this.values[0]=e}set y(e){this.values[1]=e}set xy(e){this.values[0]=e[0],this.values[1]=e[1]}at(e){return this.values[e]}toArray(){return Array.from(this.values)}size(){return 2}reset(){this.x=0,this.y=0}copy(e){return e||(e=new s),e.x=this.x,e.y=this.y,e}inverse(e){return e||(e=this),e.x=1/this.x,e.y=1/this.y,e}negate(e){return e||(e=this),e.x=-this.x,e.y=-this.y,e}equals(e,t=o.epsilon){return!(Math.abs(this.x-e.x)>t)&&!(Math.abs(this.y-e.y)>t)}length(){return Math.sqrt(this.squaredLength())}squaredLength(){const e=this.x,t=this.y;return e*e+t*t}add(e){return this.x+=e.x,this.y+=e.y,this}subtract(e){return this.x-=e.x,this.y-=e.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}divide(e){return this.x/=e.x,this.y/=e.y,this}scale(e,t){return t||(t=this),t.x*=e,t.y*=e,t}normalize(e){e||(e=this);let t=this.length();return 1===t?this:0===t?(e.x=0,e.y=0,e):(t=1/t,e.x*=t,e.y*=t,e)}multiplyMat2(e,t){return t||(t=this),e.multiplyVec2(this,t)}multiplyMat3(e,t){return t||(t=this),e.multiplyVec2(this,t)}static ceil(e,t){return t||(t=new s),t.x=Math.ceil(e.x),t.y=Math.ceil(e.y),t}static floor(e,t){return t||(t=new s),t.x=Math.floor(e.x),t.y=Math.floor(e.y),t}static cross(e,t,n){n||(n=new i.default);const r=e.x,o=e.y,s=t.x,a=r*t.y-o*s;return n.x=0,n.y=0,n.z=a,n}static dot(e,t){return e.x*t.x+e.y*t.y}static dot2(e){return this.dot(e,e)}static distance(e,t){return Math.sqrt(this.squaredDistance(e,t))}static squaredDistance(e,t){const n=t.x-e.x,r=t.y-e.y;return n*n+r*r}static direction(e,t,n){n||(n=new s);const r=e.x-t.x,i=e.y-t.y;let o=Math.sqrt(r*r+i*i);return 0===o?(n.x=0,n.y=0,n):(o=1/o,n.x=r*o,n.y=i*o,n)}static mix(e,t,n,r){r||(r=new s);const i=e.x,o=e.y,a=t.x,l=t.y;return r.x=i+n*(a-i),r.y=o+n*(l-o),r}static sum(e,t,n){return n||(n=new s),n.x=e.x+t.x,n.y=e.y+t.y,n}static difference(e,t,n){return n||(n=new s),n.x=e.x-t.x,n.y=e.y-t.y,n}static product(e,t,n){return n||(n=new s),n.x=e.x*t.x,n.y=e.y*t.y,n}static quotient(e,t,n){return n||(n=new s),n.x=e.x/t.x,n.y=e.y/t.y,n}static min(e,t,n){return n||(n=new s),n.x=Math.min(e.x,t.x),n.y=Math.min(e.y,t.y),n}static max(e,t,n){return n||(n=new s),n.x=Math.max(e.x,t.x),n.y=Math.max(e.y,t.y),n}static clamp(e,t,n,r){return r||(r=new s),r.x=Math.min(Math.max(e.x,t.x),n.x),r.y=Math.min(Math.max(e.y,t.y),n.y),r}}t.default=s,s.zero=new s([0,0]),s.one=new s([1,1])},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i=n(17),o=n(5),s=r(n(1));class a extends i.Grid{constructor(e,t=1,n=new s.default([0,0,0])){super(e,o.GridType.FLOAT,t,n,1)}}t.FloatGrid=a},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i=n(17),o=n(5),s=r(n(1));class a extends i.Grid{constructor(e,t=1,n=new s.default([0,0,0])){super(e,o.GridType.VEC3|o.GridType.FLOAT,t,n)}}t.Vec3Grid=a},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i=n(17),o=n(5),s=r(n(1));class a extends i.Grid{constructor(e,t=1,n=new s.default([0,0,0])){super(e,o.GridType.VEC4|o.GridType.FLOAT,t,n)}}t.Vec4Grid=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(0);class i extends r.WebGL2{constructor(){super(...arguments),this.color=[]}}t.Framebuffer=i},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i=r(n(1));t.Indexgrid=class{constructor(e,t,n,r=5){this.triangleIdx=[],this.gridSize=n,this.indices=t,this.max=r,this.triangleIdx=new Array(n.x*n.y*n.z);for(var o=0;o<n.z;o++)for(var s=0;s<n.y;s++)for(var a=0;a<n.x;a++)this.triangleIdx[this.gridIdx(a,s,o)]=this.max;console.log(new i.default([.04,.42,.12]).scale(100).add(n.copy().scale(.5)));for(var l=0;l<t.length;l+=3){let n=new i.default([e[11*t[l+0]+0],e[11*t[l+0]+1],e[11*t[l+0]+2]]),r=new i.default([e[11*t[l+1]+0],e[11*t[l+1]+1],e[11*t[l+1]+2]]),o=new i.default([e[11*t[l+2]+0],e[11*t[l+2]+1],e[11*t[l+2]+2]]);this.insert(n,r,o)}}gridIdx(e,t,n){return e+this.gridSize.x*(t+n*this.gridSize.y)}set(e,t=0,n){const r=i.default.floor(i.default.difference(e,new i.default([t+.5,t+.5,t+.5]))),o=i.default.ceil(i.default.sum(e,new i.default([t-.5,t-.5,t-.5])));i.default.clamp(r,i.default.zero,i.default.difference(this.gridSize,i.default.one),r),i.default.clamp(o,i.default.zero,i.default.difference(this.gridSize,i.default.one),o);for(var s=r.z;s<=o.z;s++)for(var a=r.y;a<=o.y;a++)for(var l=r.x;l<=o.x;l++){const t=new i.default([l+.5,a+.5,s+.5]);if(i.default.distance(t,e)<Math.abs(this.triangleIdx[this.gridIdx(l,a,s)])){const r=null==n?1:Math.sign(i.default.dot(i.default.difference(t,e),n));this.triangleIdx[this.gridIdx(l,a,s)]=r*i.default.distance(t,e)}}}insert(e,t,n){const r=i.default.cross(i.default.difference(t,e),i.default.difference(n,e));let o,s,a,l,u;if(i.default.squaredDistance(e,t)>.75)o=e,s=t,a=n,l=2*i.default.distance(n,e),u=2*i.default.distance(e,t);else if(i.default.squaredDistance(t,n)>.75)o=t,s=n,a=e,l=2*i.default.distance(e,t),u=2*i.default.distance(t,n);else{if(!(i.default.squaredDistance(n,e)>.75))return this.set(e,0,r),this.set(t,0,r),void this.set(n,0,r);o=n,s=e,a=t,l=2*i.default.distance(t,n),u=2*i.default.distance(n,e)}for(var c,f,d=0,h=.5;h<l;h++){c=h/l;for(var p=.5;p<u;p++)(d=1-c-(f=p/u))<0||this.set(o.copy().scale(c).add(s.copy().scale(f)).add(a.copy().scale(d)),0,r)}}get(e,t){var n=this.max;const r=i.default.floor(i.default.difference(e,new i.default([t+.5,t+.5,t+.5]))),o=i.default.ceil(i.default.sum(e,new i.default([t-.5,t-.5,t-.5])));i.default.clamp(r,i.default.zero,i.default.difference(this.gridSize,i.default.one),r),i.default.clamp(o,i.default.zero,i.default.difference(this.gridSize,i.default.one),o);const s=Math.sign(this.triangleIdx[this.gridIdx(Math.floor(e.x-.5),Math.floor(e.y-.5),Math.floor(e.z-.5))]);for(var a=r.z;a<=o.z;a++)for(var l=r.y;l<=o.y;l++)for(var u=r.x;u<=o.x;u++){const r=i.default.squaredDistance(e,new i.default([u+.5,l+.5,a+.5]));if(r<=t*t){const e=this.triangleIdx[this.gridIdx(u,l,a)]+Math.sqrt(r)*s;Math.abs(e)<Math.abs(n)&&(n=e)}}return n}isLiquid(e,t=0){const n=i.default.floor(i.default.difference(e,new i.default([t+.5,t+.5,t+.5]))),r=i.default.ceil(i.default.sum(e,new i.default([t-.5,t-.5,t-.5])));i.default.clamp(n,i.default.zero,i.default.difference(this.gridSize,i.default.one),n),i.default.clamp(r,i.default.zero,i.default.difference(this.gridSize,i.default.one),r);Math.sign(this.triangleIdx[this.gridIdx(Math.floor(e.x-.5),Math.floor(e.y-.5),Math.floor(e.z-.5))]);for(var o=n.z;o<=r.z;o++)for(var s=n.y;s<=r.y;s++)for(var a=n.x;a<=r.x;a++){if(i.default.squaredDistance(e,new i.default([a+.5,s+.5,o+.5]))<=t*t){if(this.triangleIdx[this.gridIdx(a,s,o)]<=0)return this.triangleIdx[this.gridIdx(a,s,o)]=1,!0}}return!1}getDistance(e){for(var t=this.max,n=0;n<=this.max;n++){const r=this.get(e,n);r<t&&(t=r)}return t}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(9),i=n(0),o=n(2);class s extends r.Resource{constructor(e=1){super(),this.mParticleScale=e,this.mPositionBuffer=i.WebGL2.context.createBuffer()}setScale(e){this.mParticleScale=this.mParticleScale}load(e){this.mParticleCount=e.length/3,i.WebGL2.context.bindBuffer(WebGL2RenderingContext.ARRAY_BUFFER,this.mPositionBuffer),i.WebGL2.context.bufferData(WebGL2RenderingContext.ARRAY_BUFFER,e,i.WebGL2.context.STATIC_DRAW),i.WebGL2.context.bindBuffer(WebGL2RenderingContext.ARRAY_BUFFER,null),o.GLHelper.CheckGLError()}count(){return this.mParticleCount}scale(){return this.mParticleScale}bind(){i.WebGL2.context.bindBuffer(WebGL2RenderingContext.ARRAY_BUFFER,this.mPositionBuffer)}destroy(){throw new Error("Method not implemented.")}}t.ParticleSystem=s},function(e,t,n){"use strict";n.r(t),t.default="#version 300 es\nprecision mediump int;\n\nlayout(location = 0) in vec4 pos;\nlayout(location = 1) in vec2 tex_coord;\nlayout(location = 2) in vec3 normal;\nlayout(location = 3) in vec3 tangent;\n\nuniform mat4 model;\n\nstruct LightData{\n    vec4 pos;\n    vec4 col;\n};\n\n#define MAX_LIGHT_COUNT 16\n\nlayout(std140) uniform cam_data\n{\n    mat4 view;\n    mat4 proj;\n    vec4 cam_pos;\n    LightData light[MAX_LIGHT_COUNT];\n    int lightCount;\n    float ambientFac;\n};\n\nout vec3 uv;\nout vec3 view_pos;\n\nvoid main() {\n    view_pos = vec3(view * model * pos).xyz;\n    gl_Position = proj * vec4(view_pos, 1);\n\n    uv = pos.xyz + 0.5;\n}"},function(e,t,n){"use strict";n.r(t),t.default="#version 300 es\nprecision highp float;\nprecision mediump sampler3D;\n\nuniform samplerCube sky;\n\nvec4 sampleSkyMap(vec3 dir){\n    return vec4(texture(sky, dir).rgb, 1.0);\n}\n\nfloat fresnel(float refrI0, float refrI1, vec3 dir, vec3 nor){\n    float reflCoeff = pow((refrI0 - refrI1) / (refrI0 + refrI1), 2.0);\n    return reflCoeff + (1.0 - reflCoeff) * (1.0 - pow(dot(nor, -dir), 5.0));\n}\n\nvec4 porter_duff_mix(vec4 fr, vec4 bg) {\n    float res_a = fr.a + (1.0 - fr.a) * bg.a;\n    if (res_a < 1e-5) {\n        return vec4(0);\n    } else {\n        return vec4((fr.a * fr.rgb + (1.0 - fr.a) * bg.a * bg.rgb)/res_a, res_a);\n    }\n}\nuniform sampler3D phi;\n\nlayout(std140) uniform properties\n{\n    vec3 offset;\n    vec3 nextOffset;\n    float offsetFrac;\n    vec3 downScale;\n    vec3 boundary;\n    float boundaryVal;\n    vec3 resolution;\n    float timesteps;\n};\n\nfloat samplePhi(vec3 pos){\n    if(any(lessThan(pos, boundary)) || any(greaterThan(pos, vec3(1) - boundary))) {\n        return boundaryVal;\n    }\n    return texture(phi, pos*downScale + offset).r * (1.0 - offsetFrac) + texture(phi, pos*downScale + nextOffset).r * offsetFrac;\n}\n\nvec3 gradient(vec3 pos){\n    vec3 grad;\n    grad.x = (samplePhi(vec3(pos.x + resolution.x/2.0, pos.y, pos.z)) - samplePhi(vec3(pos.x - resolution.x/2.0, pos.y, pos.z))) / resolution.x;\n    grad.y = (samplePhi(vec3(pos.x, pos.y + resolution.y/2.0, pos.z)) - samplePhi(vec3(pos.x, pos.y - resolution.y/2.0, pos.z))) / resolution.y;\n    grad.z = (samplePhi(vec3(pos.x, pos.y, pos.z + resolution.z/2.0)) - samplePhi(vec3(pos.x, pos.y, pos.z - resolution.z/2.0))) / resolution.z;\n    return grad;\n}\n\nstruct LightData{\n    vec4 pos;\n    vec4 col;\n};\n\n#define MAX_LIGHT_COUNT 16\n\nlayout(std140) uniform cam_data\n{\n    mat4 view;\n    mat4 proj;\n    vec4 cam_pos;\n    LightData light[MAX_LIGHT_COUNT];\n    int lightCount;\n    float ambientFac;\n};\n//\t<https://www.shadertoy.com/view/4dS3Wd>\n//\tBy Morgan McGuire @morgan3d, http://graphicscodex.com\n//\n\nfloat hash(float p) { p = fract(p * 0.011); p *= p + 7.5; p *= p + p; return fract(p); }\nfloat hash(vec2 p) {vec3 p3 = fract(vec3(p.xyx) * 0.13); p3 += dot(p3, p3.yzx + 3.333); return fract((p3.x + p3.y) * p3.z); }\n\nfloat noise(float x) {\n    float i = floor(x);\n    float f = fract(x);\n    float u = f * f * (3.0 - 2.0 * f);\n    return mix(hash(i), hash(i + 1.0), u);\n}\n\n\nfloat noise(vec2 x) {\n    vec2 i = floor(x);\n    vec2 f = fract(x);\n\n\t// Four corners in 2D of a tile\n\tfloat a = hash(i);\n    float b = hash(i + vec2(1.0, 0.0));\n    float c = hash(i + vec2(0.0, 1.0));\n    float d = hash(i + vec2(1.0, 1.0));\n\n    // Simple 2D lerp using smoothstep envelope between the values.\n\t// return vec3(mix(mix(a, b, smoothstep(0.0, 1.0, f.x)),\n\t//\t\t\tmix(c, d, smoothstep(0.0, 1.0, f.x)),\n\t//\t\t\tsmoothstep(0.0, 1.0, f.y)));\n\n\t// Same code, with the clamps in smoothstep and common subexpressions\n\t// optimized away.\n    vec2 u = f * f * (3.0 - 2.0 * f);\n\treturn mix(a, b, u.x) + (c - a) * u.y * (1.0 - u.x) + (d - b) * u.x * u.y;\n}\n\n\nfloat noise(vec3 x) {\n    const vec3 step = vec3(110, 241, 171);\n\n    vec3 i = floor(x);\n    vec3 f = fract(x);\n \n    // For performance, compute the base input to a 1D hash from the integer part of the argument and the \n    // incremental change to the 1D based on the 3D -> 1D wrapping\n    float n = dot(i, step);\n\n    vec3 u = f * f * (3.0 - 2.0 * f);\n    return mix(mix(mix( hash(n + dot(step, vec3(0, 0, 0))), hash(n + dot(step, vec3(1, 0, 0))), u.x),\n                   mix( hash(n + dot(step, vec3(0, 1, 0))), hash(n + dot(step, vec3(1, 1, 0))), u.x), u.y),\n               mix(mix( hash(n + dot(step, vec3(0, 0, 1))), hash(n + dot(step, vec3(1, 0, 1))), u.x),\n                   mix( hash(n + dot(step, vec3(0, 1, 1))), hash(n + dot(step, vec3(1, 1, 1))), u.x), u.y), u.z);\n}\n\n#define M_PI 3.1415926535897932384626433832795\n\nuniform mat4 model;\nuniform mat4 inv_m;\n\nin vec3 uv;\nin vec3 view_pos;\n\nlayout(location = 1) out vec4 outColor;\nlayout(location = 2) out vec4 displace;\n\nlayout(std140) uniform material\n{\n    vec4 reflCol;\n    vec4 diffCol;\n    vec4 specCol;\n    vec4 volCol;\n    int shinniness;\n    float dens_fac;\n};\n\nconst float refrI0 = 1.0; // air\nconst float refrI1 = 1.333; // water\nconst float refrFactor = refrI0 / refrI1;\n\nvec4 lightCol(vec3 pos, int idx) {\n    vec4 col = vec4(0);\n    float res = min(min(resolution.x, resolution.y), resolution.z);\n    vec3 lightDir = normalize(light[idx].pos.xyz - pos);\n    float stepSize = length(lightDir * res);\n    float depth = 0.0;\n    float lDens = 0.0;\n    float actV = 0.0;\n    bool surface = false;\n    for(vec3 s = pos;\n        all(greaterThanEqual(s,vec3(0))) && all(lessThanEqual(s,vec3(1)));\n        s += lightDir * res){\n        actV = samplePhi(s);\n        if(actV < 0.0) {\n            depth++;\n            lDens -= actV;\n            if ((depth * lDens * res) > 5.0) {\n                break;\n            }\n        }\n    }\n    return vec4((1.0/exp(depth*res*lDens*0.1))*light[idx].col.rgb, 1.0);\n}\n\nvec4 blinnPhong(vec3 pos, vec3 vDir, vec3 nor){\n    vec4 col = vec4(0, 0, 0, 0);\n    for(int i = 0; i < lightCount; i++){\n        vec3 lightDir = normalize(light[i].pos.xyz - pos);\n        vec3 refl = reflect(vDir, nor);\n\n        float spec = (float(shinniness) + 2.0) / 6.2831853072 * pow(clamp(dot(refl, lightDir), 0.0, 1.0), float(shinniness));\n        float diff = clamp(dot(nor, lightDir), ambientFac, 1.0);\n\n        vec4 r = vec4(specCol.rgb * light[i].col.rgb, specCol.w * spec);\n        r = mix(reflCol * sampleSkyMap(refl), r, r.w);\n        col += r * fresnel(refrI0, refrI1, vDir, nor) + vec4(diffCol.rgb * diff, diffCol.a) * vec4(light[i].col.rgb, 1.0); \n    }\n\treturn col;\n}\nvec4 volShading(vec3 pos, float dens, float volDepth){\n    vec4 lC = vec4(0);\n    float res = min(min(resolution.x, resolution.y), resolution.z);\n    for(int i = 0; i < lightCount; i++){\n        lC += lightCol(pos, i);\n    }\n\treturn vec4(lC.rgb, 1.0) * vec4(volCol.rgb, volCol.a * (1.0-exp(-dens*res*dens_fac)));//(1.0-1.0/exp(volDepth*res*dens));\n}\n\nfloat subStep(float actV, float oldV, vec3 pos, vec3 dir) {\n    float substep = -0.5;\n    float fac = 0.25;\n    for (float f = 0.25; f > 0.01; f*=0.5) {\n        if (samplePhi(pos + substep * dir) < 0.0) {\n            substep -= f;\n        } else {\n            substep += f;\n        }\n    }\n    /*float len = 1.0;\n    float v = 0.0;\n    float fac = actV / (oldV - actV) * len;\n    for (int i = 0; i < 3; i++) {\n        substep += fac;\n        v = samplePhi(pos + substep * dir);\n        if(v < 0.0) {\n            actV = v;\n            len -= abs(fac);\n            fac = actV / (oldV - actV) * len;\n        } else {\n            oldV = v;\n            len = abs(fac);\n            fac = oldV / (oldV - actV) * len;\n        }\n    }*/\n    return substep;\n}\n\nvoid main() {\n    vec3 dir = normalize(uv - 0.5 - (inv_m * cam_pos).xyz);\n    //vec3 noi = vec3(noise(dir.xyz*1000.0), noise(dir.yzx*1000.0), noise(dir.zxy*1000.0)) * 2.0 - 1.0;\n    //dir = normalize(dir + noi * 0.0001);\n    float cam_dist = -view_pos.z;\n    \n    float res = min(min(resolution.x, resolution.y), resolution.z);\n    float actV = 0.0;\n    float oldV = 0.0;\n\n    vec4 reflColor = vec4(0);\n    float depth = 10.0;\n    outColor = vec4(0.0);\n\n    vec3 pIn = uv;\n\n    bool surface = false;\n    vec3 s;\n\n    float depthInLiquid = 0.0;\n    float density = 0.0;\n\n    for(s = uv;\n        all(greaterThanEqual(s,vec3(0))) && all(lessThanEqual(s,vec3(1)));\n        s += dir * res){\n\n        actV = samplePhi(s);\n        if(actV < 0.0) {\n            if(surface) {\n                depthInLiquid += res;\n                density -= actV;\n                if (volCol.w > 0.0) {\n                    outColor = porter_duff_mix(outColor, volShading(s, density, depthInLiquid));\n                }\n            } else {\n                float substep = subStep(actV, oldV, s, dir*res);\n                \n                surface = true;\n                depthInLiquid += substep * res;\n\n                s += substep * dir * res;\n                vec3 ps = s;\n                vec3 nor = normalize(gradient(ps));\n                if(diffCol.w > 0.0 || specCol.w > 0.0 || reflCol.w > 0.0) {\n                    outColor = porter_duff_mix(outColor, blinnPhong((model * vec4(ps - 0.5, 1)).xyz, normalize(vec4(dir,0) * inv_m).xyz, normalize(vec4(nor,0) * inv_m).xyz));\n                }\n                \n                if(depth == 10.0) {\n                    depth = cam_dist + substep * res;\n                    if (specCol.w > 0.0)\n                        dir = refract(dir, nor, refrFactor);\n                }\n            }\n            if (outColor.w > 0.99) {\n                break;\n            }\n        } else if(surface) {\n            surface = false;\n            depthInLiquid += actV / (oldV - actV) * res;\n            //vec3 ps = s + actV / (oldV - actV) * dir * res;\n            //vec3 nor = normalize(gradient(ps));\n            //dir = refract(dir, nor, 1.0/refrFactor);\n        }\n        oldV = actV;\n        if(depth == 10.0) \n            cam_dist += res;\n    }\n\n    if(depth == 10.0){\n        discard;\n    }\n\n    outColor.rgb *= outColor.w;\n\n    vec4 pDir = proj * view * model * vec4(pIn - 0.5, 1);\n    vec4 pDisp = proj * view * model * vec4(s - 0.5, 1);\n    displace = pDisp / pDisp.w - pDir / pDir.w;\n\n    displace.zw = vec2(acos(dir.z), (atan(dir.y, dir.x) + M_PI) / 2.0) / M_PI;\n\n    /// Calc projected depth (after w divide)\n    float depth_after_w = (-proj[2][2] + proj[3][2] / depth);\n    /// Transfer to [0,1] space -> https://gamedev.stackexchange.com/a/16617\n    gl_FragDepth = ((gl_DepthRange.diff * depth_after_w) + gl_DepthRange.near + gl_DepthRange.far) * 0.5;\n}"},function(e,t,n){"use strict";n.r(t),t.default="#version 300 es\nprecision mediump float;\nprecision mediump sampler2D;\n\nuniform samplerCube sky;\n\nvec4 sampleSkyMap(vec3 dir){\n    return vec4(texture(sky, dir).rgb, 1.0);\n}\n\nfloat fresnel(float refrI0, float refrI1, vec3 dir, vec3 nor){\n    float reflCoeff = pow((refrI0 - refrI1) / (refrI0 + refrI1), 2.0);\n    return reflCoeff + (1.0 - reflCoeff) * (1.0 - pow(dot(nor, -dir), 5.0));\n}\n\nvec4 porter_duff_mix(vec4 fr, vec4 bg) {\n    float res_a = fr.a + (1.0 - fr.a) * bg.a;\n    if (res_a < 1e-5) {\n        return vec4(0);\n    } else {\n        return vec4((fr.a * fr.rgb + (1.0 - fr.a) * bg.a * bg.rgb)/res_a, res_a);\n    }\n}\n\nconst float epsilon = 1e-5;\n#define M_PI 3.1415926535897932384626433832795\n\nuniform sampler2D solidColor;\nuniform sampler2D volumeColor;\nuniform sampler2D volumeDepth;\nuniform sampler2D volumeDisplace;\n\nin vec2 uv;\nout vec4 outColor;\n\nvoid main() {\n    vec4 volumeCol = texture(volumeColor, uv);\n    if(volumeCol.w < epsilon) discard;\n\n    vec4 volDispl = texture(volumeDisplace, uv);\n\n    vec2 displCoord = uv + volDispl.xy;\n\n    if(texture(solidColor, displCoord).w < epsilon){\n        vec3 dir;\n        volDispl.zw *= M_PI;\n        volDispl.w = volDispl.w * 2.0 - M_PI;\n        dir.x = sin(volDispl.z)*cos(volDispl.w);\n        dir.y = sin(volDispl.z)*sin(volDispl.w);\n        dir.z = cos(volDispl.z);\n\n        outColor = vec4(mix(volumeCol.rgb/volumeCol.w, sampleSkyMap(dir).rgb, 1.0 - volumeCol.w), 1.0);\n    } else {\n        outColor = vec4(mix(volumeCol.rgb/volumeCol.w, texture(solidColor, displCoord).rgb, 1.0 - volumeCol.w), 1.0);\n    }\n    \n    gl_FragDepth = texture(volumeDepth, uv).x;\n}"},function(e,t,n){"use strict";n.r(t),t.default="#version 300 es\n\nlayout(location = 0) in vec4 pos;\n\nstruct LightData{\n    vec4 pos;\n    vec4 col;\n};\n\n#define MAX_LIGHT_COUNT 16\n\nlayout(std140) uniform cam_data\n{\n    mat4 view;\n    mat4 proj;\n    vec4 cam_pos;\n    LightData light[MAX_LIGHT_COUNT];\n    int lightCount;\n    float ambientFac;\n};\n\nout vec3 uv;\n\nvoid main() {\n   uv = pos.xyz;\n   gl_Position = (proj * vec4(mat3(view) * pos.xyz, 1)).xyww;\n}\n"},function(e,t,n){"use strict";n.r(t),t.default="#version 300 es\n\nprecision mediump float;\n\nuniform samplerCube sky;\n\nvec4 sampleSkyMap(vec3 dir){\n    return vec4(texture(sky, dir).rgb, 1.0);\n}\n\nfloat fresnel(float refrI0, float refrI1, vec3 dir, vec3 nor){\n    float reflCoeff = pow((refrI0 - refrI1) / (refrI0 + refrI1), 2.0);\n    return reflCoeff + (1.0 - reflCoeff) * (1.0 - pow(dot(nor, -dir), 5.0));\n}\n\nvec4 porter_duff_mix(vec4 fr, vec4 bg) {\n    float res_a = fr.a + (1.0 - fr.a) * bg.a;\n    if (res_a < 1e-5) {\n        return vec4(0);\n    } else {\n        return vec4((fr.a * fr.rgb + (1.0 - fr.a) * bg.a * bg.rgb)/res_a, res_a);\n    }\n}\n\nin vec3 uv;\n\nout vec4 color;\n\nvoid main() {\n    color = sampleSkyMap(uv);\n}\n"},function(e,t,n){"use strict";var r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const o=n(15),s=n(6),a=n(14),l=r(n(48)),u=r(n(49)),c=n(3),f=n(0),d=n(4),h=n(8),p=i(n(10));class m extends o.RenderComponent{constructor(e){super(),this.mMesh=e,this.mMaterial=new s.UniformBuffer([new d.StructEntry("reflCol",d.DataTypes.FLOAT32,4,[0,0,0,1]),new d.StructEntry("diffCol",d.DataTypes.FLOAT32,4,[.5,.5,.5,1]),new d.StructEntry("specCol",d.DataTypes.FLOAT32,4,[.5,.5,.5,1]),new d.StructEntry("shinniness",d.DataTypes.INT32,1,16),new d.StructEntry("_pad",d.DataTypes.INT32,3)]),this.mTexture=c.ResourceFactory.createTextureWithConstCol(new p.default([1,0,.4,1])),this.mNormal=c.ResourceFactory.createTextureWithConstCol(new p.default([.5,.5,1,1]))}static _init(){m.mSolidProgram=c.ResourceFactory.createShaderFromSource([{type:f.WebGL2.context.VERTEX_SHADER,code:l.default},{type:f.WebGL2.context.FRAGMENT_SHADER,code:u.default}]),m.M_MATRIX_LOC=f.WebGL2.context.getUniformLocation(m.mSolidProgram,"model"),m.INV_M_MATRIX_LOC=f.WebGL2.context.getUniformLocation(m.mSolidProgram,"inv_m"),m.CAM_UBO_LOC=f.WebGL2.context.getUniformBlockIndex(m.mSolidProgram,"cam_data"),m.MAT_UBO_LOC=new a.ResourceLocation(f.WebGL2.context.getUniformBlockIndex(m.mSolidProgram,"material")),m.SKY_TEX_LOC=f.WebGL2.context.getUniformLocation(m.mSolidProgram,"sky"),m.TEX_LOC=new a.ResourceLocation(f.WebGL2.context.getUniformLocation(m.mSolidProgram,"tex")),m.NOR_LOC=new a.ResourceLocation(f.WebGL2.context.getUniformLocation(m.mSolidProgram,"normal_tex"))}setTexture(e){this.mTexture=e}setNormal(e){this.mNormal=e}setMaterialEntry(e,t){this.mMaterial.set(e,t)}draw(){f.WebGL2.context.useProgram(m.mSolidProgram),this.mMaterial.uploadBuffer(m.MAT_UBO_LOC.pnt),f.WebGL2.context.uniformBlockBinding(m.mSolidProgram,m.MAT_UBO_LOC.loc,m.MAT_UBO_LOC.pnt),f.WebGL2.context.uniformBlockBinding(m.mSolidProgram,m.CAM_UBO_LOC,h.RenderEngine.CAM_BUFFER_PNT),f.WebGL2.context.uniformMatrix4fv(m.M_MATRIX_LOC,!1,this.mEntity.getTransform().getLocalToWorld().toArray()),f.WebGL2.context.uniformMatrix4fv(m.INV_M_MATRIX_LOC,!1,this.mEntity.getTransform().getWorldToLocal().toArray()),f.WebGL2.context.uniform1i(m.SKY_TEX_LOC,h.RenderEngine.SKY_TEX_PNT),f.WebGL2.context.activeTexture(WebGL2RenderingContext.TEXTURE0+m.TEX_LOC.pnt),f.WebGL2.context.bindTexture(f.WebGL2.context.TEXTURE_2D,this.mTexture),f.WebGL2.context.uniform1i(m.TEX_LOC.loc,m.TEX_LOC.pnt),f.WebGL2.context.activeTexture(WebGL2RenderingContext.TEXTURE0+m.NOR_LOC.pnt),f.WebGL2.context.bindTexture(f.WebGL2.context.TEXTURE_2D,this.mNormal),f.WebGL2.context.uniform1i(m.NOR_LOC.loc,m.NOR_LOC.pnt),this.mMesh.draw()}}t.SolidRenderComponent=m},function(e,t,n){"use strict";n.r(t),t.default="#version 300 es\nprecision mediump int;\nprecision mediump float;\n\nlayout(location = 0) in vec4 pos;\nlayout(location = 1) in vec2 tex_coord;\nlayout(location = 2) in vec3 normal;\nlayout(location = 3) in vec3 tangent;\n\nuniform mat4 model;\nuniform mat4 inv_m;\n\nstruct LightData{\n    vec4 pos;\n    vec4 col;\n};\n\n#define MAX_LIGHT_COUNT 16\n\nlayout(std140) uniform cam_data\n{\n    mat4 view;\n    mat4 proj;\n    vec4 cam_pos;\n    LightData light[MAX_LIGHT_COUNT];\n    int lightCount;\n    float ambientFac;\n};\n\nout vec3 view_pos;\nout vec3 nor;\nout vec2 uv;\nout vec3 tang;\n\nvoid main() {\n   view_pos = (view * model * pos).xyz;\n   gl_Position = proj * vec4(view_pos, 1);\n\n   nor = (vec4(normal, 0) * inv_m).xyz;\n   tang = (vec4(tangent, 0) * inv_m).xyz;\n\n   uv = tex_coord;\n}"},function(e,t,n){"use strict";n.r(t),t.default="#version 300 es\n\nprecision mediump float;\n\n#define EPS 0.1\n\nuniform mat4 model;\nuniform mat4 inv_m;\n\nuniform samplerCube sky;\n\nvec4 sampleSkyMap(vec3 dir){\n    return vec4(texture(sky, dir).rgb, 1.0);\n}\n\nfloat fresnel(float refrI0, float refrI1, vec3 dir, vec3 nor){\n    float reflCoeff = pow((refrI0 - refrI1) / (refrI0 + refrI1), 2.0);\n    return reflCoeff + (1.0 - reflCoeff) * (1.0 - pow(dot(nor, -dir), 5.0));\n}\n\nvec4 porter_duff_mix(vec4 fr, vec4 bg) {\n    float res_a = fr.a + (1.0 - fr.a) * bg.a;\n    if (res_a < 1e-5) {\n        return vec4(0);\n    } else {\n        return vec4((fr.a * fr.rgb + (1.0 - fr.a) * bg.a * bg.rgb)/res_a, res_a);\n    }\n}\nstruct LightData{\n    vec4 pos;\n    vec4 col;\n};\n\n#define MAX_LIGHT_COUNT 16\n\nlayout(std140) uniform cam_data\n{\n    mat4 view;\n    mat4 proj;\n    vec4 cam_pos;\n    LightData light[MAX_LIGHT_COUNT];\n    int lightCount;\n    float ambientFac;\n};\n\nuniform sampler2D tex;\nuniform sampler2D normal_tex;\n\nlayout(std140) uniform material\n{\n    vec4 reflCol;\n    vec4 diffCol;\n    vec4 specCol;\n    int shinniness;\n};\n\nin vec3 view_pos;\nin vec3 nor;\nin vec2 uv;\nin vec3 tang;\n\nout vec4 outColor;\n\nvec3 calcNormal(){\n    vec3 t = normalize(tang);\n    vec3 n = normalize(nor);\n    vec3 b = normalize(cross(t, n));\n\n    return normalize(mat3(t, b, n) * normalize(texture(normal_tex, uv).rgb * 2.0 - 1.0) * mat3(inv_m));\n}\n\nvec4 blinnPhong(){\n    vec4 col = vec4(0, 0, 0, 0);\n    vec4 texCol = texture(tex, uv);\n    vec3 vDir = normalize(view_pos);\n    vec3 vNor = mat3(view) * calcNormal();\n    for(int i = 0; i < lightCount && texCol.w > EPS; i++){\n        vec3 lightDir = normalize((view * light[i].pos).xyz - view_pos);\n\n        vec3 vRefl = reflect(vDir, vNor);\n        vec3 refl = vRefl * mat3(view);\n\n        float spec = (float(shinniness) + 2.0) / 6.2831853072 * pow(clamp(dot(vRefl, lightDir), 0.0, 1.0), float(shinniness));\n        float diff = clamp(dot(vNor, lightDir), ambientFac, 1.0);\n\n        vec4 r = vec4(specCol.rgb * light[i].col.rgb, spec);\n        r = mix(reflCol * sampleSkyMap(refl), r, r.w);\n        col += r + vec4(diffCol.rgb * diff * texCol.rgb, diffCol.a * texCol.a) * vec4(light[i].col.rgb, 1.0); \n    }\n\n\treturn col;\n}\n\nvec4 blinnPhong(vec3 nor){\n    vec4 col = vec4(0, 0, 0, 0);\n    vec3 vDir = normalize(view_pos);\n    for(int i = 0; i < lightCount; i++){\n        vec3 lightDir = normalize((view * light[i].pos).xyz - view_pos);\n\n        vec3 vRefl = reflect(vDir, nor);\n        vec3 refl = vRefl * mat3(view);\n\n        float spec = (float(shinniness) + 2.0) / 6.2831853072 * pow(clamp(dot(vRefl, lightDir), 0.0, 1.0), float(shinniness));\n        float diff = clamp(dot(nor, lightDir), ambientFac, 1.0);\n\n        vec4 r = vec4(specCol.rgb * light[i].col.rgb, spec);\n        r = mix(reflCol * sampleSkyMap(refl), r, r.w);\n        col += r + vec4(diffCol.rgb * diff, diffCol.a) * vec4(light[i].col.rgb, 1.0); \n    }\n\n\treturn col;\n}\n\nvoid main() {\n    outColor = blinnPhong();\n    if(outColor.w < EPS) discard;\n}"},function(e,t,n){"use strict";n.r(t),t.default="#version 300 es\nprecision mediump int;\nprecision mediump float;\n\nlayout(location = 0) in vec4 pos;\nlayout(location = 1) in vec2 tex_coord;\nlayout(location = 2) in vec3 normal;\nlayout(location = 3) in vec3 tangent;\nlayout(location = 4) in vec3 offset;\n\nuniform mat4 model;\nuniform mat4 inv_m;\nuniform float radius;\n\nstruct LightData{\n    vec4 pos;\n    vec4 col;\n};\n\n#define MAX_LIGHT_COUNT 16\n\nlayout(std140) uniform cam_data\n{\n    mat4 view;\n    mat4 proj;\n    vec4 cam_pos;\n    LightData light[MAX_LIGHT_COUNT];\n    int lightCount;\n    float ambientFac;\n};\n\nout vec3 view_pos;\nout vec3 nor;\nout vec2 uv;\nout vec3 tang;\n\nvoid main() {\n   view_pos = (view * model * vec4(offset.xyz, 1.0)).xyz;\n   view_pos += radius * pos.zxy;\n   gl_Position = proj * vec4(view_pos, 1);\n\n   nor = (vec4(normal, 0) * inv_m).xyz;\n   tang = (vec4(tangent, 0) * inv_m).xyz;\n\n   uv = tex_coord;\n}"},function(e,t,n){"use strict";n.r(t),t.default="#version 300 es\n\nprecision mediump float;\n\n#define EPS 0.1\n\nuniform mat4 model;\nuniform mat4 inv_m;\n\nuniform samplerCube sky;\n\nvec4 sampleSkyMap(vec3 dir){\n    return vec4(texture(sky, dir).rgb, 1.0);\n}\n\nfloat fresnel(float refrI0, float refrI1, vec3 dir, vec3 nor){\n    float reflCoeff = pow((refrI0 - refrI1) / (refrI0 + refrI1), 2.0);\n    return reflCoeff + (1.0 - reflCoeff) * (1.0 - pow(dot(nor, -dir), 5.0));\n}\n\nvec4 porter_duff_mix(vec4 fr, vec4 bg) {\n    float res_a = fr.a + (1.0 - fr.a) * bg.a;\n    if (res_a < 1e-5) {\n        return vec4(0);\n    } else {\n        return vec4((fr.a * fr.rgb + (1.0 - fr.a) * bg.a * bg.rgb)/res_a, res_a);\n    }\n}\nstruct LightData{\n    vec4 pos;\n    vec4 col;\n};\n\n#define MAX_LIGHT_COUNT 16\n\nlayout(std140) uniform cam_data\n{\n    mat4 view;\n    mat4 proj;\n    vec4 cam_pos;\n    LightData light[MAX_LIGHT_COUNT];\n    int lightCount;\n    float ambientFac;\n};\n\nuniform sampler2D tex;\nuniform sampler2D normal_tex;\n\nlayout(std140) uniform material\n{\n    vec4 reflCol;\n    vec4 diffCol;\n    vec4 specCol;\n    int shinniness;\n};\n\nin vec3 view_pos;\nin vec3 nor;\nin vec2 uv;\nin vec3 tang;\n\nout vec4 outColor;\n\nvec3 calcNormal(){\n    vec3 t = normalize(tang);\n    vec3 n = normalize(nor);\n    vec3 b = normalize(cross(t, n));\n\n    return normalize(mat3(t, b, n) * normalize(texture(normal_tex, uv).rgb * 2.0 - 1.0) * mat3(inv_m));\n}\n\nvec4 blinnPhong(){\n    vec4 col = vec4(0, 0, 0, 0);\n    vec4 texCol = texture(tex, uv);\n    vec3 vDir = normalize(view_pos);\n    vec3 vNor = mat3(view) * calcNormal();\n    for(int i = 0; i < lightCount && texCol.w > EPS; i++){\n        vec3 lightDir = normalize((view * light[i].pos).xyz - view_pos);\n\n        vec3 vRefl = reflect(vDir, vNor);\n        vec3 refl = vRefl * mat3(view);\n\n        float spec = (float(shinniness) + 2.0) / 6.2831853072 * pow(clamp(dot(vRefl, lightDir), 0.0, 1.0), float(shinniness));\n        float diff = clamp(dot(vNor, lightDir), ambientFac, 1.0);\n\n        vec4 r = vec4(specCol.rgb * light[i].col.rgb, spec);\n        r = mix(reflCol * sampleSkyMap(refl), r, r.w);\n        col += r + vec4(diffCol.rgb * diff * texCol.rgb, diffCol.a * texCol.a) * vec4(light[i].col.rgb, 1.0); \n    }\n\n\treturn col;\n}\n\nvec4 blinnPhong(vec3 nor){\n    vec4 col = vec4(0, 0, 0, 0);\n    vec3 vDir = normalize(view_pos);\n    for(int i = 0; i < lightCount; i++){\n        vec3 lightDir = normalize((view * light[i].pos).xyz - view_pos);\n\n        vec3 vRefl = reflect(vDir, nor);\n        vec3 refl = vRefl * mat3(view);\n\n        float spec = (float(shinniness) + 2.0) / 6.2831853072 * pow(clamp(dot(vRefl, lightDir), 0.0, 1.0), float(shinniness));\n        float diff = clamp(dot(nor, lightDir), ambientFac, 1.0);\n\n        vec4 r = vec4(specCol.rgb * light[i].col.rgb, spec);\n        r = mix(reflCol * sampleSkyMap(refl), r, r.w);\n        col += r + vec4(diffCol.rgb * diff, diffCol.a) * vec4(light[i].col.rgb, 1.0); \n    }\n\n\treturn col;\n}\n\nvoid main() {\n    float l = length(uv-0.5);\n    if(l > 0.5){\n        discard;\n    }\n    float w = sqrt(0.25 - l * l);\n    outColor = blinnPhong(normalize(vec3(uv-0.5,w)));\n    if(outColor.w < EPS) discard;\n}"},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i=n(8),o=n(11),s=r(n(13));class a extends o.WebGLComponent{constructor(e,t=45,n=1,r=100){super(),this.mFovy=t*Math.PI/180,this.mNear=n,this.mFar=r,this.mRenderer=new i.RenderEngine(this,e),this.resize()}setEntity(e){super.setEntity(e),this.mRenderer.setScene(this.mEntity.getScene())}getProjMatrix(){return this.mProjMatrix}resize(){const e=o.WebGLComponent.canvas.clientWidth,t=o.WebGLComponent.canvas.clientHeight;this.mProjMatrix=s.default.perspective(this.mFovy,e/t,this.mNear,this.mFar),this.mRenderer.resize()}render(){this.mRenderer.draw()}}t.CameraComponent=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(54);t.Scene=class{constructor(){this.mRenderComponents=new Map,this.mLightComponents=[]}setCamera(e){this.mCamera=e}setPhysicEngine(e){this.mPhysicEngine=e}addRenderComponent(e){this.mRenderComponents.has(e.constructor.name)?this.mRenderComponents.get(e.constructor.name).push(e):this.mRenderComponents.set(e.constructor.name,[e])}addLightComponent(e){this.mLightComponents.push(e)}removeRenderComponent(e){if(this.mRenderComponents.has(e.constructor.name)){let t=this.mRenderComponents.get(e.constructor.name),n=t.indexOf(e,0);n>-1&&(t.splice(n,1),this.mRenderComponents.set(e.constructor.name,t))}}removeLightComponent(e){let t=this.mLightComponents.indexOf(e,0);t>-1&&this.mLightComponents.splice(t,1)}getRenderComponents(e){return this.mRenderComponents.get(e)}getLightComponents(){return this.mLightComponents}createEntity(){return new r.Entity(this)}removeEntity(e){e.destroy()}render(){this.mCamera.render()}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(55);t.Entity=class{constructor(e){this.mTransform=new r.Transform,this.mTransform.setEntity(this),this.mScene=e}getScene(){return this.mScene}setCameraComponent(e){this.mCameraComponent=e,this.mCameraComponent.setEntity(this),this.mScene.setCamera(e)}getCameraComponent(){return this.mCameraComponent}removeCameraComponent(){this.mCameraComponent&&(this.mScene.mCamera===this.mCameraComponent&&this.mScene.setCamera(null),this.mCameraComponent=null)}setRenderComponent(e){this.mRenderComponent&&this.mScene.removeRenderComponent(this.mRenderComponent),this.mRenderComponent=e,this.mRenderComponent.setEntity(this),this.mScene.addRenderComponent(e)}getRenderComponent(){return this.mRenderComponent}removeRenderComponent(){this.mRenderComponent&&(this.mScene.removeRenderComponent(this.mRenderComponent),this.mRenderComponent=null)}setLightComponent(e){this.mLightComponent&&this.mScene.removeLightComponent(this.mLightComponent),this.mLightComponent=e,this.mLightComponent.setEntity(this),this.mScene.addLightComponent(e)}getLightComponent(){return this.mLightComponent}removeLightComponent(){this.mLightComponent&&(this.mScene.removeLightComponent(this.mLightComponent),this.mLightComponent=null)}getTransform(){return this.mTransform}destroy(){this.mRenderComponent&&this.mScene.removeRenderComponent(this.mRenderComponent),this.mLightComponent&&this.mScene.removeLightComponent(this.mLightComponent),this.mCameraComponent&&this.mScene.setCamera(null)}}},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i=n(11),o=r(n(1)),s=r(n(16)),a=r(n(13));class l extends i.Component{constructor(){super(),this.mPosition=o.default.zero.copy(),this.mRotation=s.default.identity.copy(),this.mScale=o.default.one.copy(),this.mForward=l.FWD,this.mUp=l.UP,this.mRight=l.RIGHT,this.mLocalToWorld=a.default.identity.copy(),this.mWorldToLocal=a.default.identity.copy()}getForward(){return this.mForward}getUp(){return this.mUp}getRight(){return this.mRight}getLocalToWorld(){return this.mLocalToWorld}getWorldToLocal(){return this.mWorldToLocal}getPostion(){return this.mPosition}getScale(){return this.mScale}getRotation(){return this.mRotation}setPosition(e){e.copy(this.mPosition),this.updateMatrices()}setRotation(e){e.copy(this.mRotation),this.updateMatrices()}setScale(e){e.copy(this.mScale),this.updateMatrices()}setRotationEuler(e){e.toQuat(this.mRotation),this.updateMatrices()}lookAt(e){let t=o.default.difference(e,this.mPosition).normalize(),n=s.default.rotationTo(this.mForward,t),r=o.default.cross(t,l.UP),i=o.default.cross(r,t).normalize();t=n.multiplyVec3(this.mUp);let a=s.default.rotationTo(t,i);this.mRotation=s.default.product(a,n),this.updateMatrices()}updateMatrices(){a.default.fromRotationTranslationScale(this.mRotation,this.mPosition,this.mScale,this.mLocalToWorld),this.mWorldToLocal.setIdentity(),this.mWorldToLocal.scale(this.mScale.copy().inverse()),this.mWorldToLocal.multiply(this.mRotation.copy().inverse().toMat4()),this.mWorldToLocal.translate(this.mPosition.copy().negate())}}t.Transform=l,l.FWD=new o.default([0,0,-1]),l.UP=new o.default([0,1,0]),l.RIGHT=new o.default([1,0,0])},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i=n(11),o=r(n(1));class s extends i.Component{constructor(e=new o.default([1,1,1])){super(),this.mColor=e}setColor(e){this.mColor=e}getColor(){return this.mColor}}t.LightComponent=s},function(e,t,n){var r;
  /*!
   * jQuery JavaScript Library v3.4.1
   * https://jquery.com/
   *
   * Includes Sizzle.js
   * https://sizzlejs.com/
   *
   * Copyright JS Foundation and other contributors
   * Released under the MIT license
   * https://jquery.org/license
   *
   * Date: 2019-05-01T21:04Z
   */!function(t,n){"use strict";"object"==typeof e.exports?e.exports=t.document?n(t,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return n(e)}:n(t)}("undefined"!=typeof window?window:this,(function(n,i){"use strict";var o=[],s=n.document,a=Object.getPrototypeOf,l=o.slice,u=o.concat,c=o.push,f=o.indexOf,d={},h=d.toString,p=d.hasOwnProperty,m=p.toString,v=m.call(Object),y={},x=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType},g=function(e){return null!=e&&e===e.window},T={type:!0,src:!0,nonce:!0,noModule:!0};function b(e,t,n){var r,i,o=(n=n||s).createElement("script");if(o.text=e,t)for(r in T)(i=t[r]||t.getAttribute&&t.getAttribute(r))&&o.setAttribute(r,i);n.head.appendChild(o).parentNode.removeChild(o)}function _(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?d[h.call(e)]||"object":typeof e}var L=function(e,t){return new L.fn.init(e,t)},E=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;function C(e){var t=!!e&&"length"in e&&e.length,n=_(e);return!x(e)&&!g(e)&&("array"===n||0===t||"number"==typeof t&&t>0&&t-1 in e)}L.fn=L.prototype={jquery:"3.4.1",constructor:L,length:0,toArray:function(){return l.call(this)},get:function(e){return null==e?l.call(this):e<0?this[e+this.length]:this[e]},pushStack:function(e){var t=L.merge(this.constructor(),e);return t.prevObject=this,t},each:function(e){return L.each(this,e)},map:function(e){return this.pushStack(L.map(this,(function(t,n){return e.call(t,n,t)})))},slice:function(){return this.pushStack(l.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(e<0?t:0);return this.pushStack(n>=0&&n<t?[this[n]]:[])},end:function(){return this.prevObject||this.constructor()},push:c,sort:o.sort,splice:o.splice},L.extend=L.fn.extend=function(){var e,t,n,r,i,o,s=arguments[0]||{},a=1,l=arguments.length,u=!1;for("boolean"==typeof s&&(u=s,s=arguments[a]||{},a++),"object"==typeof s||x(s)||(s={}),a===l&&(s=this,a--);a<l;a++)if(null!=(e=arguments[a]))for(t in e)r=e[t],"__proto__"!==t&&s!==r&&(u&&r&&(L.isPlainObject(r)||(i=Array.isArray(r)))?(n=s[t],o=i&&!Array.isArray(n)?[]:i||L.isPlainObject(n)?n:{},i=!1,s[t]=L.extend(u,o,r)):void 0!==r&&(s[t]=r));return s},L.extend({expando:"jQuery"+("3.4.1"+Math.random()).replace(/\D/g,""),isReady:!0,error:function(e){throw new Error(e)},noop:function(){},isPlainObject:function(e){var t,n;return!(!e||"[object Object]"!==h.call(e))&&(!(t=a(e))||"function"==typeof(n=p.call(t,"constructor")&&t.constructor)&&m.call(n)===v)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},globalEval:function(e,t){b(e,{nonce:t&&t.nonce})},each:function(e,t){var n,r=0;if(C(e))for(n=e.length;r<n&&!1!==t.call(e[r],r,e[r]);r++);else for(r in e)if(!1===t.call(e[r],r,e[r]))break;return e},trim:function(e){return null==e?"":(e+"").replace(E,"")},makeArray:function(e,t){var n=t||[];return null!=e&&(C(Object(e))?L.merge(n,"string"==typeof e?[e]:e):c.call(n,e)),n},inArray:function(e,t,n){return null==t?-1:f.call(t,e,n)},merge:function(e,t){for(var n=+t.length,r=0,i=e.length;r<n;r++)e[i++]=t[r];return e.length=i,e},grep:function(e,t,n){for(var r=[],i=0,o=e.length,s=!n;i<o;i++)!t(e[i],i)!==s&&r.push(e[i]);return r},map:function(e,t,n){var r,i,o=0,s=[];if(C(e))for(r=e.length;o<r;o++)null!=(i=t(e[o],o,n))&&s.push(i);else for(o in e)null!=(i=t(e[o],o,n))&&s.push(i);return u.apply([],s)},guid:1,support:y}),"function"==typeof Symbol&&(L.fn[Symbol.iterator]=o[Symbol.iterator]),L.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),(function(e,t){d["[object "+t+"]"]=t.toLowerCase()}));var w=
  /*!
   * Sizzle CSS Selector Engine v2.3.4
   * https://sizzlejs.com/
   *
   * Copyright JS Foundation and other contributors
   * Released under the MIT license
   * https://js.foundation/
   *
   * Date: 2019-04-08
   */
  function(e){var t,n,r,i,o,s,a,l,u,c,f,d,h,p,m,v,y,x,g,T="sizzle"+1*new Date,b=e.document,_=0,L=0,E=le(),C=le(),w=le(),R=le(),S=function(e,t){return e===t&&(f=!0),0},G={}.hasOwnProperty,A=[],W=A.pop,z=A.push,P=A.push,M=A.slice,D=function(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1},O="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",B="[\\x20\\t\\r\\n\\f]",I="(?:\\\\.|[\\w-]|[^\0-\\xa0])+",N="\\["+B+"*("+I+")(?:"+B+"*([*^$|!~]?=)"+B+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+I+"))|)"+B+"*\\]",F=":("+I+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+N+")*)|.*)\\)|)",U=new RegExp(B+"+","g"),X=new RegExp("^"+B+"+|((?:^|[^\\\\])(?:\\\\.)*)"+B+"+$","g"),k=new RegExp("^"+B+"*,"+B+"*"),j=new RegExp("^"+B+"*([>+~]|"+B+")"+B+"*"),V=new RegExp(B+"|>"),H=new RegExp(F),q=new RegExp("^"+I+"$"),Y={ID:new RegExp("^#("+I+")"),CLASS:new RegExp("^\\.("+I+")"),TAG:new RegExp("^("+I+"|[*])"),ATTR:new RegExp("^"+N),PSEUDO:new RegExp("^"+F),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+B+"*(even|odd|(([+-]|)(\\d*)n|)"+B+"*(?:([+-]|)"+B+"*(\\d+)|))"+B+"*\\)|)","i"),bool:new RegExp("^(?:"+O+")$","i"),needsContext:new RegExp("^"+B+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+B+"*((?:-\\d)?\\d*)"+B+"*\\)|)(?=[^-]|$)","i")},$=/HTML$/i,Z=/^(?:input|select|textarea|button)$/i,K=/^h\d$/i,Q=/^[^{]+\{\s*\[native \w/,J=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ee=/[+~]/,te=new RegExp("\\\\([\\da-f]{1,6}"+B+"?|("+B+")|.)","ig"),ne=function(e,t,n){var r="0x"+t-65536;return r!=r||n?t:r<0?String.fromCharCode(r+65536):String.fromCharCode(r>>10|55296,1023&r|56320)},re=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ie=function(e,t){return t?"\0"===e?"�":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},oe=function(){d()},se=Te((function(e){return!0===e.disabled&&"fieldset"===e.nodeName.toLowerCase()}),{dir:"parentNode",next:"legend"});try{P.apply(A=M.call(b.childNodes),b.childNodes),A[b.childNodes.length].nodeType}catch(e){P={apply:A.length?function(e,t){z.apply(e,M.call(t))}:function(e,t){for(var n=e.length,r=0;e[n++]=t[r++];);e.length=n-1}}}function ae(e,t,r,i){var o,a,u,c,f,p,y,x=t&&t.ownerDocument,_=t?t.nodeType:9;if(r=r||[],"string"!=typeof e||!e||1!==_&&9!==_&&11!==_)return r;if(!i&&((t?t.ownerDocument||t:b)!==h&&d(t),t=t||h,m)){if(11!==_&&(f=J.exec(e)))if(o=f[1]){if(9===_){if(!(u=t.getElementById(o)))return r;if(u.id===o)return r.push(u),r}else if(x&&(u=x.getElementById(o))&&g(t,u)&&u.id===o)return r.push(u),r}else{if(f[2])return P.apply(r,t.getElementsByTagName(e)),r;if((o=f[3])&&n.getElementsByClassName&&t.getElementsByClassName)return P.apply(r,t.getElementsByClassName(o)),r}if(n.qsa&&!R[e+" "]&&(!v||!v.test(e))&&(1!==_||"object"!==t.nodeName.toLowerCase())){if(y=e,x=t,1===_&&V.test(e)){for((c=t.getAttribute("id"))?c=c.replace(re,ie):t.setAttribute("id",c=T),a=(p=s(e)).length;a--;)p[a]="#"+c+" "+ge(p[a]);y=p.join(","),x=ee.test(e)&&ye(t.parentNode)||t}try{return P.apply(r,x.querySelectorAll(y)),r}catch(t){R(e,!0)}finally{c===T&&t.removeAttribute("id")}}}return l(e.replace(X,"$1"),t,r,i)}function le(){var e=[];return function t(n,i){return e.push(n+" ")>r.cacheLength&&delete t[e.shift()],t[n+" "]=i}}function ue(e){return e[T]=!0,e}function ce(e){var t=h.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function fe(e,t){for(var n=e.split("|"),i=n.length;i--;)r.attrHandle[n[i]]=t}function de(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)for(;n=n.nextSibling;)if(n===t)return-1;return e?1:-1}function he(e){return function(t){return"input"===t.nodeName.toLowerCase()&&t.type===e}}function pe(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function me(e){return function(t){return"form"in t?t.parentNode&&!1===t.disabled?"label"in t?"label"in t.parentNode?t.parentNode.disabled===e:t.disabled===e:t.isDisabled===e||t.isDisabled!==!e&&se(t)===e:t.disabled===e:"label"in t&&t.disabled===e}}function ve(e){return ue((function(t){return t=+t,ue((function(n,r){for(var i,o=e([],n.length,t),s=o.length;s--;)n[i=o[s]]&&(n[i]=!(r[i]=n[i]))}))}))}function ye(e){return e&&void 0!==e.getElementsByTagName&&e}for(t in n=ae.support={},o=ae.isXML=function(e){var t=e.namespaceURI,n=(e.ownerDocument||e).documentElement;return!$.test(t||n&&n.nodeName||"HTML")},d=ae.setDocument=function(e){var t,i,s=e?e.ownerDocument||e:b;return s!==h&&9===s.nodeType&&s.documentElement?(p=(h=s).documentElement,m=!o(h),b!==h&&(i=h.defaultView)&&i.top!==i&&(i.addEventListener?i.addEventListener("unload",oe,!1):i.attachEvent&&i.attachEvent("onunload",oe)),n.attributes=ce((function(e){return e.className="i",!e.getAttribute("className")})),n.getElementsByTagName=ce((function(e){return e.appendChild(h.createComment("")),!e.getElementsByTagName("*").length})),n.getElementsByClassName=Q.test(h.getElementsByClassName),n.getById=ce((function(e){return p.appendChild(e).id=T,!h.getElementsByName||!h.getElementsByName(T).length})),n.getById?(r.filter.ID=function(e){var t=e.replace(te,ne);return function(e){return e.getAttribute("id")===t}},r.find.ID=function(e,t){if(void 0!==t.getElementById&&m){var n=t.getElementById(e);return n?[n]:[]}}):(r.filter.ID=function(e){var t=e.replace(te,ne);return function(e){var n=void 0!==e.getAttributeNode&&e.getAttributeNode("id");return n&&n.value===t}},r.find.ID=function(e,t){if(void 0!==t.getElementById&&m){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];for(i=t.getElementsByName(e),r=0;o=i[r++];)if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),r.find.TAG=n.getElementsByTagName?function(e,t){return void 0!==t.getElementsByTagName?t.getElementsByTagName(e):n.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){for(;n=o[i++];)1===n.nodeType&&r.push(n);return r}return o},r.find.CLASS=n.getElementsByClassName&&function(e,t){if(void 0!==t.getElementsByClassName&&m)return t.getElementsByClassName(e)},y=[],v=[],(n.qsa=Q.test(h.querySelectorAll))&&(ce((function(e){p.appendChild(e).innerHTML="<a id='"+T+"'></a><select id='"+T+"-\r\\' msallowcapture=''><option selected=''></option></select>",e.querySelectorAll("[msallowcapture^='']").length&&v.push("[*^$]="+B+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||v.push("\\["+B+"*(?:value|"+O+")"),e.querySelectorAll("[id~="+T+"-]").length||v.push("~="),e.querySelectorAll(":checked").length||v.push(":checked"),e.querySelectorAll("a#"+T+"+*").length||v.push(".#.+[+~]")})),ce((function(e){e.innerHTML="<a href='' disabled='disabled'></a><select disabled='disabled'><option/></select>";var t=h.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&v.push("name"+B+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&v.push(":enabled",":disabled"),p.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&v.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),v.push(",.*:")}))),(n.matchesSelector=Q.test(x=p.matches||p.webkitMatchesSelector||p.mozMatchesSelector||p.oMatchesSelector||p.msMatchesSelector))&&ce((function(e){n.disconnectedMatch=x.call(e,"*"),x.call(e,"[s!='']:x"),y.push("!=",F)})),v=v.length&&new RegExp(v.join("|")),y=y.length&&new RegExp(y.join("|")),t=Q.test(p.compareDocumentPosition),g=t||Q.test(p.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)for(;t=t.parentNode;)if(t===e)return!0;return!1},S=t?function(e,t){if(e===t)return f=!0,0;var r=!e.compareDocumentPosition-!t.compareDocumentPosition;return r||(1&(r=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!n.sortDetached&&t.compareDocumentPosition(e)===r?e===h||e.ownerDocument===b&&g(b,e)?-1:t===h||t.ownerDocument===b&&g(b,t)?1:c?D(c,e)-D(c,t):0:4&r?-1:1)}:function(e,t){if(e===t)return f=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,s=[e],a=[t];if(!i||!o)return e===h?-1:t===h?1:i?-1:o?1:c?D(c,e)-D(c,t):0;if(i===o)return de(e,t);for(n=e;n=n.parentNode;)s.unshift(n);for(n=t;n=n.parentNode;)a.unshift(n);for(;s[r]===a[r];)r++;return r?de(s[r],a[r]):s[r]===b?-1:a[r]===b?1:0},h):h},ae.matches=function(e,t){return ae(e,null,null,t)},ae.matchesSelector=function(e,t){if((e.ownerDocument||e)!==h&&d(e),n.matchesSelector&&m&&!R[t+" "]&&(!y||!y.test(t))&&(!v||!v.test(t)))try{var r=x.call(e,t);if(r||n.disconnectedMatch||e.document&&11!==e.document.nodeType)return r}catch(e){R(t,!0)}return ae(t,h,null,[e]).length>0},ae.contains=function(e,t){return(e.ownerDocument||e)!==h&&d(e),g(e,t)},ae.attr=function(e,t){(e.ownerDocument||e)!==h&&d(e);var i=r.attrHandle[t.toLowerCase()],o=i&&G.call(r.attrHandle,t.toLowerCase())?i(e,t,!m):void 0;return void 0!==o?o:n.attributes||!m?e.getAttribute(t):(o=e.getAttributeNode(t))&&o.specified?o.value:null},ae.escape=function(e){return(e+"").replace(re,ie)},ae.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},ae.uniqueSort=function(e){var t,r=[],i=0,o=0;if(f=!n.detectDuplicates,c=!n.sortStable&&e.slice(0),e.sort(S),f){for(;t=e[o++];)t===e[o]&&(i=r.push(o));for(;i--;)e.splice(r[i],1)}return c=null,e},i=ae.getText=function(e){var t,n="",r=0,o=e.nodeType;if(o){if(1===o||9===o||11===o){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=i(e)}else if(3===o||4===o)return e.nodeValue}else for(;t=e[r++];)n+=i(t);return n},(r=ae.selectors={cacheLength:50,createPseudo:ue,match:Y,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(te,ne),e[3]=(e[3]||e[4]||e[5]||"").replace(te,ne),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||ae.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&ae.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return Y.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&H.test(n)&&(t=s(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(te,ne).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=E[e+" "];return t||(t=new RegExp("(^|"+B+")"+e+"("+B+"|$)"))&&E(e,(function(e){return t.test("string"==typeof e.className&&e.className||void 0!==e.getAttribute&&e.getAttribute("class")||"")}))},ATTR:function(e,t,n){return function(r){var i=ae.attr(r,e);return null==i?"!="===t:!t||(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.slice(-n.length)===n:"~="===t?(" "+i.replace(U," ")+" ").indexOf(n)>-1:"|="===t&&(i===n||i.slice(0,n.length+1)===n+"-"))}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),s="last"!==e.slice(-4),a="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,l){var u,c,f,d,h,p,m=o!==s?"nextSibling":"previousSibling",v=t.parentNode,y=a&&t.nodeName.toLowerCase(),x=!l&&!a,g=!1;if(v){if(o){for(;m;){for(d=t;d=d[m];)if(a?d.nodeName.toLowerCase()===y:1===d.nodeType)return!1;p=m="only"===e&&!p&&"nextSibling"}return!0}if(p=[s?v.firstChild:v.lastChild],s&&x){for(g=(h=(u=(c=(f=(d=v)[T]||(d[T]={}))[d.uniqueID]||(f[d.uniqueID]={}))[e]||[])[0]===_&&u[1])&&u[2],d=h&&v.childNodes[h];d=++h&&d&&d[m]||(g=h=0)||p.pop();)if(1===d.nodeType&&++g&&d===t){c[e]=[_,h,g];break}}else if(x&&(g=h=(u=(c=(f=(d=t)[T]||(d[T]={}))[d.uniqueID]||(f[d.uniqueID]={}))[e]||[])[0]===_&&u[1]),!1===g)for(;(d=++h&&d&&d[m]||(g=h=0)||p.pop())&&((a?d.nodeName.toLowerCase()!==y:1!==d.nodeType)||!++g||(x&&((c=(f=d[T]||(d[T]={}))[d.uniqueID]||(f[d.uniqueID]={}))[e]=[_,g]),d!==t)););return(g-=i)===r||g%r==0&&g/r>=0}}},PSEUDO:function(e,t){var n,i=r.pseudos[e]||r.setFilters[e.toLowerCase()]||ae.error("unsupported pseudo: "+e);return i[T]?i(t):i.length>1?(n=[e,e,"",t],r.setFilters.hasOwnProperty(e.toLowerCase())?ue((function(e,n){for(var r,o=i(e,t),s=o.length;s--;)e[r=D(e,o[s])]=!(n[r]=o[s])})):function(e){return i(e,0,n)}):i}},pseudos:{not:ue((function(e){var t=[],n=[],r=a(e.replace(X,"$1"));return r[T]?ue((function(e,t,n,i){for(var o,s=r(e,null,i,[]),a=e.length;a--;)(o=s[a])&&(e[a]=!(t[a]=o))})):function(e,i,o){return t[0]=e,r(t,null,o,n),t[0]=null,!n.pop()}})),has:ue((function(e){return function(t){return ae(e,t).length>0}})),contains:ue((function(e){return e=e.replace(te,ne),function(t){return(t.textContent||i(t)).indexOf(e)>-1}})),lang:ue((function(e){return q.test(e||"")||ae.error("unsupported lang: "+e),e=e.replace(te,ne).toLowerCase(),function(t){var n;do{if(n=m?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return(n=n.toLowerCase())===e||0===n.indexOf(e+"-")}while((t=t.parentNode)&&1===t.nodeType);return!1}})),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===p},focus:function(e){return e===h.activeElement&&(!h.hasFocus||h.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:me(!1),disabled:me(!0),checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,!0===e.selected},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!r.pseudos.empty(e)},header:function(e){return K.test(e.nodeName)},input:function(e){return Z.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||"text"===t.toLowerCase())},first:ve((function(){return[0]})),last:ve((function(e,t){return[t-1]})),eq:ve((function(e,t,n){return[n<0?n+t:n]})),even:ve((function(e,t){for(var n=0;n<t;n+=2)e.push(n);return e})),odd:ve((function(e,t){for(var n=1;n<t;n+=2)e.push(n);return e})),lt:ve((function(e,t,n){for(var r=n<0?n+t:n>t?t:n;--r>=0;)e.push(r);return e})),gt:ve((function(e,t,n){for(var r=n<0?n+t:n;++r<t;)e.push(r);return e}))}}).pseudos.nth=r.pseudos.eq,{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})r.pseudos[t]=he(t);for(t in{submit:!0,reset:!0})r.pseudos[t]=pe(t);function xe(){}function ge(e){for(var t=0,n=e.length,r="";t<n;t++)r+=e[t].value;return r}function Te(e,t,n){var r=t.dir,i=t.next,o=i||r,s=n&&"parentNode"===o,a=L++;return t.first?function(t,n,i){for(;t=t[r];)if(1===t.nodeType||s)return e(t,n,i);return!1}:function(t,n,l){var u,c,f,d=[_,a];if(l){for(;t=t[r];)if((1===t.nodeType||s)&&e(t,n,l))return!0}else for(;t=t[r];)if(1===t.nodeType||s)if(c=(f=t[T]||(t[T]={}))[t.uniqueID]||(f[t.uniqueID]={}),i&&i===t.nodeName.toLowerCase())t=t[r]||t;else{if((u=c[o])&&u[0]===_&&u[1]===a)return d[2]=u[2];if(c[o]=d,d[2]=e(t,n,l))return!0}return!1}}function be(e){return e.length>1?function(t,n,r){for(var i=e.length;i--;)if(!e[i](t,n,r))return!1;return!0}:e[0]}function _e(e,t,n,r,i){for(var o,s=[],a=0,l=e.length,u=null!=t;a<l;a++)(o=e[a])&&(n&&!n(o,r,i)||(s.push(o),u&&t.push(a)));return s}function Le(e,t,n,r,i,o){return r&&!r[T]&&(r=Le(r)),i&&!i[T]&&(i=Le(i,o)),ue((function(o,s,a,l){var u,c,f,d=[],h=[],p=s.length,m=o||function(e,t,n){for(var r=0,i=t.length;r<i;r++)ae(e,t[r],n);return n}(t||"*",a.nodeType?[a]:a,[]),v=!e||!o&&t?m:_e(m,d,e,a,l),y=n?i||(o?e:p||r)?[]:s:v;if(n&&n(v,y,a,l),r)for(u=_e(y,h),r(u,[],a,l),c=u.length;c--;)(f=u[c])&&(y[h[c]]=!(v[h[c]]=f));if(o){if(i||e){if(i){for(u=[],c=y.length;c--;)(f=y[c])&&u.push(v[c]=f);i(null,y=[],u,l)}for(c=y.length;c--;)(f=y[c])&&(u=i?D(o,f):d[c])>-1&&(o[u]=!(s[u]=f))}}else y=_e(y===s?y.splice(p,y.length):y),i?i(null,s,y,l):P.apply(s,y)}))}function Ee(e){for(var t,n,i,o=e.length,s=r.relative[e[0].type],a=s||r.relative[" "],l=s?1:0,c=Te((function(e){return e===t}),a,!0),f=Te((function(e){return D(t,e)>-1}),a,!0),d=[function(e,n,r){var i=!s&&(r||n!==u)||((t=n).nodeType?c(e,n,r):f(e,n,r));return t=null,i}];l<o;l++)if(n=r.relative[e[l].type])d=[Te(be(d),n)];else{if((n=r.filter[e[l].type].apply(null,e[l].matches))[T]){for(i=++l;i<o&&!r.relative[e[i].type];i++);return Le(l>1&&be(d),l>1&&ge(e.slice(0,l-1).concat({value:" "===e[l-2].type?"*":""})).replace(X,"$1"),n,l<i&&Ee(e.slice(l,i)),i<o&&Ee(e=e.slice(i)),i<o&&ge(e))}d.push(n)}return be(d)}return xe.prototype=r.filters=r.pseudos,r.setFilters=new xe,s=ae.tokenize=function(e,t){var n,i,o,s,a,l,u,c=C[e+" "];if(c)return t?0:c.slice(0);for(a=e,l=[],u=r.preFilter;a;){for(s in n&&!(i=k.exec(a))||(i&&(a=a.slice(i[0].length)||a),l.push(o=[])),n=!1,(i=j.exec(a))&&(n=i.shift(),o.push({value:n,type:i[0].replace(X," ")}),a=a.slice(n.length)),r.filter)!(i=Y[s].exec(a))||u[s]&&!(i=u[s](i))||(n=i.shift(),o.push({value:n,type:s,matches:i}),a=a.slice(n.length));if(!n)break}return t?a.length:a?ae.error(e):C(e,l).slice(0)},a=ae.compile=function(e,t){var n,i=[],o=[],a=w[e+" "];if(!a){for(t||(t=s(e)),n=t.length;n--;)(a=Ee(t[n]))[T]?i.push(a):o.push(a);(a=w(e,function(e,t){var n=t.length>0,i=e.length>0,o=function(o,s,a,l,c){var f,p,v,y=0,x="0",g=o&&[],T=[],b=u,L=o||i&&r.find.TAG("*",c),E=_+=null==b?1:Math.random()||.1,C=L.length;for(c&&(u=s===h||s||c);x!==C&&null!=(f=L[x]);x++){if(i&&f){for(p=0,s||f.ownerDocument===h||(d(f),a=!m);v=e[p++];)if(v(f,s||h,a)){l.push(f);break}c&&(_=E)}n&&((f=!v&&f)&&y--,o&&g.push(f))}if(y+=x,n&&x!==y){for(p=0;v=t[p++];)v(g,T,s,a);if(o){if(y>0)for(;x--;)g[x]||T[x]||(T[x]=W.call(l));T=_e(T)}P.apply(l,T),c&&!o&&T.length>0&&y+t.length>1&&ae.uniqueSort(l)}return c&&(_=E,u=b),g};return n?ue(o):o}(o,i))).selector=e}return a},l=ae.select=function(e,t,n,i){var o,l,u,c,f,d="function"==typeof e&&e,h=!i&&s(e=d.selector||e);if(n=n||[],1===h.length){if((l=h[0]=h[0].slice(0)).length>2&&"ID"===(u=l[0]).type&&9===t.nodeType&&m&&r.relative[l[1].type]){if(!(t=(r.find.ID(u.matches[0].replace(te,ne),t)||[])[0]))return n;d&&(t=t.parentNode),e=e.slice(l.shift().value.length)}for(o=Y.needsContext.test(e)?0:l.length;o--&&(u=l[o],!r.relative[c=u.type]);)if((f=r.find[c])&&(i=f(u.matches[0].replace(te,ne),ee.test(l[0].type)&&ye(t.parentNode)||t))){if(l.splice(o,1),!(e=i.length&&ge(l)))return P.apply(n,i),n;break}}return(d||a(e,h))(i,t,!m,n,!t||ee.test(e)&&ye(t.parentNode)||t),n},n.sortStable=T.split("").sort(S).join("")===T,n.detectDuplicates=!!f,d(),n.sortDetached=ce((function(e){return 1&e.compareDocumentPosition(h.createElement("fieldset"))})),ce((function(e){return e.innerHTML="<a href='#'></a>","#"===e.firstChild.getAttribute("href")}))||fe("type|href|height|width",(function(e,t,n){if(!n)return e.getAttribute(t,"type"===t.toLowerCase()?1:2)})),n.attributes&&ce((function(e){return e.innerHTML="<input/>",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")}))||fe("value",(function(e,t,n){if(!n&&"input"===e.nodeName.toLowerCase())return e.defaultValue})),ce((function(e){return null==e.getAttribute("disabled")}))||fe(O,(function(e,t,n){var r;if(!n)return!0===e[t]?t.toLowerCase():(r=e.getAttributeNode(t))&&r.specified?r.value:null})),ae}(n);L.find=w,L.expr=w.selectors,L.expr[":"]=L.expr.pseudos,L.uniqueSort=L.unique=w.uniqueSort,L.text=w.getText,L.isXMLDoc=w.isXML,L.contains=w.contains,L.escapeSelector=w.escape;var R=function(e,t,n){for(var r=[],i=void 0!==n;(e=e[t])&&9!==e.nodeType;)if(1===e.nodeType){if(i&&L(e).is(n))break;r.push(e)}return r},S=function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n},G=L.expr.match.needsContext;function A(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()}var W=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function z(e,t,n){return x(t)?L.grep(e,(function(e,r){return!!t.call(e,r,e)!==n})):t.nodeType?L.grep(e,(function(e){return e===t!==n})):"string"!=typeof t?L.grep(e,(function(e){return f.call(t,e)>-1!==n})):L.filter(t,e,n)}L.filter=function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?L.find.matchesSelector(r,e)?[r]:[]:L.find.matches(e,L.grep(t,(function(e){return 1===e.nodeType})))},L.fn.extend({find:function(e){var t,n,r=this.length,i=this;if("string"!=typeof e)return this.pushStack(L(e).filter((function(){for(t=0;t<r;t++)if(L.contains(i[t],this))return!0})));for(n=this.pushStack([]),t=0;t<r;t++)L.find(e,i[t],n);return r>1?L.uniqueSort(n):n},filter:function(e){return this.pushStack(z(this,e||[],!1))},not:function(e){return this.pushStack(z(this,e||[],!0))},is:function(e){return!!z(this,"string"==typeof e&&G.test(e)?L(e):e||[],!1).length}});var P,M=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/;(L.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||P,"string"==typeof e){if(!(r="<"===e[0]&&">"===e[e.length-1]&&e.length>=3?[null,e,null]:M.exec(e))||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof L?t[0]:t,L.merge(this,L.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:s,!0)),W.test(r[1])&&L.isPlainObject(t))for(r in t)x(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return(i=s.getElementById(r[2]))&&(this[0]=i,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):x(e)?void 0!==n.ready?n.ready(e):e(L):L.makeArray(e,this)}).prototype=L.fn,P=L(s);var D=/^(?:parents|prev(?:Until|All))/,O={children:!0,contents:!0,next:!0,prev:!0};function B(e,t){for(;(e=e[t])&&1!==e.nodeType;);return e}L.fn.extend({has:function(e){var t=L(e,this),n=t.length;return this.filter((function(){for(var e=0;e<n;e++)if(L.contains(this,t[e]))return!0}))},closest:function(e,t){var n,r=0,i=this.length,o=[],s="string"!=typeof e&&L(e);if(!G.test(e))for(;r<i;r++)for(n=this[r];n&&n!==t;n=n.parentNode)if(n.nodeType<11&&(s?s.index(n)>-1:1===n.nodeType&&L.find.matchesSelector(n,e))){o.push(n);break}return this.pushStack(o.length>1?L.uniqueSort(o):o)},index:function(e){return e?"string"==typeof e?f.call(L(e),this[0]):f.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(L.uniqueSort(L.merge(this.get(),L(e,t))))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),L.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return R(e,"parentNode")},parentsUntil:function(e,t,n){return R(e,"parentNode",n)},next:function(e){return B(e,"nextSibling")},prev:function(e){return B(e,"previousSibling")},nextAll:function(e){return R(e,"nextSibling")},prevAll:function(e){return R(e,"previousSibling")},nextUntil:function(e,t,n){return R(e,"nextSibling",n)},prevUntil:function(e,t,n){return R(e,"previousSibling",n)},siblings:function(e){return S((e.parentNode||{}).firstChild,e)},children:function(e){return S(e.firstChild)},contents:function(e){return void 0!==e.contentDocument?e.contentDocument:(A(e,"template")&&(e=e.content||e),L.merge([],e.childNodes))}},(function(e,t){L.fn[e]=function(n,r){var i=L.map(this,t,n);return"Until"!==e.slice(-5)&&(r=n),r&&"string"==typeof r&&(i=L.filter(r,i)),this.length>1&&(O[e]||L.uniqueSort(i),D.test(e)&&i.reverse()),this.pushStack(i)}}));var I=/[^\x20\t\r\n\f]+/g;function N(e){return e}function F(e){throw e}function U(e,t,n,r){var i;try{e&&x(i=e.promise)?i.call(e).done(t).fail(n):e&&x(i=e.then)?i.call(e,t,n):t.apply(void 0,[e].slice(r))}catch(e){n.apply(void 0,[e])}}L.Callbacks=function(e){e="string"==typeof e?function(e){var t={};return L.each(e.match(I)||[],(function(e,n){t[n]=!0})),t}(e):L.extend({},e);var t,n,r,i,o=[],s=[],a=-1,l=function(){for(i=i||e.once,r=t=!0;s.length;a=-1)for(n=s.shift();++a<o.length;)!1===o[a].apply(n[0],n[1])&&e.stopOnFalse&&(a=o.length,n=!1);e.memory||(n=!1),t=!1,i&&(o=n?[]:"")},u={add:function(){return o&&(n&&!t&&(a=o.length-1,s.push(n)),function t(n){L.each(n,(function(n,r){x(r)?e.unique&&u.has(r)||o.push(r):r&&r.length&&"string"!==_(r)&&t(r)}))}(arguments),n&&!t&&l()),this},remove:function(){return L.each(arguments,(function(e,t){for(var n;(n=L.inArray(t,o,n))>-1;)o.splice(n,1),n<=a&&a--})),this},has:function(e){return e?L.inArray(e,o)>-1:o.length>0},empty:function(){return o&&(o=[]),this},disable:function(){return i=s=[],o=n="",this},disabled:function(){return!o},lock:function(){return i=s=[],n||t||(o=n=""),this},locked:function(){return!!i},fireWith:function(e,n){return i||(n=[e,(n=n||[]).slice?n.slice():n],s.push(n),t||l()),this},fire:function(){return u.fireWith(this,arguments),this},fired:function(){return!!r}};return u},L.extend({Deferred:function(e){var t=[["notify","progress",L.Callbacks("memory"),L.Callbacks("memory"),2],["resolve","done",L.Callbacks("once memory"),L.Callbacks("once memory"),0,"resolved"],["reject","fail",L.Callbacks("once memory"),L.Callbacks("once memory"),1,"rejected"]],r="pending",i={state:function(){return r},always:function(){return o.done(arguments).fail(arguments),this},catch:function(e){return i.then(null,e)},pipe:function(){var e=arguments;return L.Deferred((function(n){L.each(t,(function(t,r){var i=x(e[r[4]])&&e[r[4]];o[r[1]]((function(){var e=i&&i.apply(this,arguments);e&&x(e.promise)?e.promise().progress(n.notify).done(n.resolve).fail(n.reject):n[r[0]+"With"](this,i?[e]:arguments)}))})),e=null})).promise()},then:function(e,r,i){var o=0;function s(e,t,r,i){return function(){var a=this,l=arguments,u=function(){var n,u;if(!(e<o)){if((n=r.apply(a,l))===t.promise())throw new TypeError("Thenable self-resolution");u=n&&("object"==typeof n||"function"==typeof n)&&n.then,x(u)?i?u.call(n,s(o,t,N,i),s(o,t,F,i)):(o++,u.call(n,s(o,t,N,i),s(o,t,F,i),s(o,t,N,t.notifyWith))):(r!==N&&(a=void 0,l=[n]),(i||t.resolveWith)(a,l))}},c=i?u:function(){try{u()}catch(n){L.Deferred.exceptionHook&&L.Deferred.exceptionHook(n,c.stackTrace),e+1>=o&&(r!==F&&(a=void 0,l=[n]),t.rejectWith(a,l))}};e?c():(L.Deferred.getStackHook&&(c.stackTrace=L.Deferred.getStackHook()),n.setTimeout(c))}}return L.Deferred((function(n){t[0][3].add(s(0,n,x(i)?i:N,n.notifyWith)),t[1][3].add(s(0,n,x(e)?e:N)),t[2][3].add(s(0,n,x(r)?r:F))})).promise()},promise:function(e){return null!=e?L.extend(e,i):i}},o={};return L.each(t,(function(e,n){var s=n[2],a=n[5];i[n[1]]=s.add,a&&s.add((function(){r=a}),t[3-e][2].disable,t[3-e][3].disable,t[0][2].lock,t[0][3].lock),s.add(n[3].fire),o[n[0]]=function(){return o[n[0]+"With"](this===o?void 0:this,arguments),this},o[n[0]+"With"]=s.fireWith})),i.promise(o),e&&e.call(o,o),o},when:function(e){var t=arguments.length,n=t,r=Array(n),i=l.call(arguments),o=L.Deferred(),s=function(e){return function(n){r[e]=this,i[e]=arguments.length>1?l.call(arguments):n,--t||o.resolveWith(r,i)}};if(t<=1&&(U(e,o.done(s(n)).resolve,o.reject,!t),"pending"===o.state()||x(i[n]&&i[n].then)))return o.then();for(;n--;)U(i[n],s(n),o.reject);return o.promise()}});var X=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;L.Deferred.exceptionHook=function(e,t){n.console&&n.console.warn&&e&&X.test(e.name)&&n.console.warn("jQuery.Deferred exception: "+e.message,e.stack,t)},L.readyException=function(e){n.setTimeout((function(){throw e}))};var k=L.Deferred();function j(){s.removeEventListener("DOMContentLoaded",j),n.removeEventListener("load",j),L.ready()}L.fn.ready=function(e){return k.then(e).catch((function(e){L.readyException(e)})),this},L.extend({isReady:!1,readyWait:1,ready:function(e){(!0===e?--L.readyWait:L.isReady)||(L.isReady=!0,!0!==e&&--L.readyWait>0||k.resolveWith(s,[L]))}}),L.ready.then=k.then,"complete"===s.readyState||"loading"!==s.readyState&&!s.documentElement.doScroll?n.setTimeout(L.ready):(s.addEventListener("DOMContentLoaded",j),n.addEventListener("load",j));var V=function(e,t,n,r,i,o,s){var a=0,l=e.length,u=null==n;if("object"===_(n))for(a in i=!0,n)V(e,t,a,n[a],!0,o,s);else if(void 0!==r&&(i=!0,x(r)||(s=!0),u&&(s?(t.call(e,r),t=null):(u=t,t=function(e,t,n){return u.call(L(e),n)})),t))for(;a<l;a++)t(e[a],n,s?r:r.call(e[a],a,t(e[a],n)));return i?e:u?t.call(e):l?t(e[0],n):o},H=/^-ms-/,q=/-([a-z])/g;function Y(e,t){return t.toUpperCase()}function $(e){return e.replace(H,"ms-").replace(q,Y)}var Z=function(e){return 1===e.nodeType||9===e.nodeType||!+e.nodeType};function K(){this.expando=L.expando+K.uid++}K.uid=1,K.prototype={cache:function(e){var t=e[this.expando];return t||(t={},Z(e)&&(e.nodeType?e[this.expando]=t:Object.defineProperty(e,this.expando,{value:t,configurable:!0}))),t},set:function(e,t,n){var r,i=this.cache(e);if("string"==typeof t)i[$(t)]=n;else for(r in t)i[$(r)]=t[r];return i},get:function(e,t){return void 0===t?this.cache(e):e[this.expando]&&e[this.expando][$(t)]},access:function(e,t,n){return void 0===t||t&&"string"==typeof t&&void 0===n?this.get(e,t):(this.set(e,t,n),void 0!==n?n:t)},remove:function(e,t){var n,r=e[this.expando];if(void 0!==r){if(void 0!==t){n=(t=Array.isArray(t)?t.map($):(t=$(t))in r?[t]:t.match(I)||[]).length;for(;n--;)delete r[t[n]]}(void 0===t||L.isEmptyObject(r))&&(e.nodeType?e[this.expando]=void 0:delete e[this.expando])}},hasData:function(e){var t=e[this.expando];return void 0!==t&&!L.isEmptyObject(t)}};var Q=new K,J=new K,ee=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,te=/[A-Z]/g;function ne(e,t,n){var r;if(void 0===n&&1===e.nodeType)if(r="data-"+t.replace(te,"-$&").toLowerCase(),"string"==typeof(n=e.getAttribute(r))){try{n=function(e){return"true"===e||"false"!==e&&("null"===e?null:e===+e+""?+e:ee.test(e)?JSON.parse(e):e)}(n)}catch(e){}J.set(e,t,n)}else n=void 0;return n}L.extend({hasData:function(e){return J.hasData(e)||Q.hasData(e)},data:function(e,t,n){return J.access(e,t,n)},removeData:function(e,t){J.remove(e,t)},_data:function(e,t,n){return Q.access(e,t,n)},_removeData:function(e,t){Q.remove(e,t)}}),L.fn.extend({data:function(e,t){var n,r,i,o=this[0],s=o&&o.attributes;if(void 0===e){if(this.length&&(i=J.get(o),1===o.nodeType&&!Q.get(o,"hasDataAttrs"))){for(n=s.length;n--;)s[n]&&0===(r=s[n].name).indexOf("data-")&&(r=$(r.slice(5)),ne(o,r,i[r]));Q.set(o,"hasDataAttrs",!0)}return i}return"object"==typeof e?this.each((function(){J.set(this,e)})):V(this,(function(t){var n;if(o&&void 0===t)return void 0!==(n=J.get(o,e))?n:void 0!==(n=ne(o,e))?n:void 0;this.each((function(){J.set(this,e,t)}))}),null,t,arguments.length>1,null,!0)},removeData:function(e){return this.each((function(){J.remove(this,e)}))}}),L.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=Q.get(e,t),n&&(!r||Array.isArray(n)?r=Q.access(e,t,L.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=L.queue(e,t),r=n.length,i=n.shift(),o=L._queueHooks(e,t);"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,(function(){L.dequeue(e,t)}),o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return Q.get(e,n)||Q.access(e,n,{empty:L.Callbacks("once memory").add((function(){Q.remove(e,[t+"queue",n])}))})}}),L.fn.extend({queue:function(e,t){var n=2;return"string"!=typeof e&&(t=e,e="fx",n--),arguments.length<n?L.queue(this[0],e):void 0===t?this:this.each((function(){var n=L.queue(this,e,t);L._queueHooks(this,e),"fx"===e&&"inprogress"!==n[0]&&L.dequeue(this,e)}))},dequeue:function(e){return this.each((function(){L.dequeue(this,e)}))},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,t){var n,r=1,i=L.Deferred(),o=this,s=this.length,a=function(){--r||i.resolveWith(o,[o])};for("string"!=typeof e&&(t=e,e=void 0),e=e||"fx";s--;)(n=Q.get(o[s],e+"queueHooks"))&&n.empty&&(r++,n.empty.add(a));return a(),i.promise(t)}});var re=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,ie=new RegExp("^(?:([+-])=|)("+re+")([a-z%]*)$","i"),oe=["Top","Right","Bottom","Left"],se=s.documentElement,ae=function(e){return L.contains(e.ownerDocument,e)},le={composed:!0};se.getRootNode&&(ae=function(e){return L.contains(e.ownerDocument,e)||e.getRootNode(le)===e.ownerDocument});var ue=function(e,t){return"none"===(e=t||e).style.display||""===e.style.display&&ae(e)&&"none"===L.css(e,"display")},ce=function(e,t,n,r){var i,o,s={};for(o in t)s[o]=e.style[o],e.style[o]=t[o];for(o in i=n.apply(e,r||[]),t)e.style[o]=s[o];return i};function fe(e,t,n,r){var i,o,s=20,a=r?function(){return r.cur()}:function(){return L.css(e,t,"")},l=a(),u=n&&n[3]||(L.cssNumber[t]?"":"px"),c=e.nodeType&&(L.cssNumber[t]||"px"!==u&&+l)&&ie.exec(L.css(e,t));if(c&&c[3]!==u){for(l/=2,u=u||c[3],c=+l||1;s--;)L.style(e,t,c+u),(1-o)*(1-(o=a()/l||.5))<=0&&(s=0),c/=o;c*=2,L.style(e,t,c+u),n=n||[]}return n&&(c=+c||+l||0,i=n[1]?c+(n[1]+1)*n[2]:+n[2],r&&(r.unit=u,r.start=c,r.end=i)),i}var de={};function he(e){var t,n=e.ownerDocument,r=e.nodeName,i=de[r];return i||(t=n.body.appendChild(n.createElement(r)),i=L.css(t,"display"),t.parentNode.removeChild(t),"none"===i&&(i="block"),de[r]=i,i)}function pe(e,t){for(var n,r,i=[],o=0,s=e.length;o<s;o++)(r=e[o]).style&&(n=r.style.display,t?("none"===n&&(i[o]=Q.get(r,"display")||null,i[o]||(r.style.display="")),""===r.style.display&&ue(r)&&(i[o]=he(r))):"none"!==n&&(i[o]="none",Q.set(r,"display",n)));for(o=0;o<s;o++)null!=i[o]&&(e[o].style.display=i[o]);return e}L.fn.extend({show:function(){return pe(this,!0)},hide:function(){return pe(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each((function(){ue(this)?L(this).show():L(this).hide()}))}});var me=/^(?:checkbox|radio)$/i,ve=/<([a-z][^\/\0>\x20\t\r\n\f]*)/i,ye=/^$|^module$|\/(?:java|ecma)script/i,xe={option:[1,"<select multiple='multiple'>","</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};function ge(e,t){var n;return n=void 0!==e.getElementsByTagName?e.getElementsByTagName(t||"*"):void 0!==e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&A(e,t)?L.merge([e],n):n}function Te(e,t){for(var n=0,r=e.length;n<r;n++)Q.set(e[n],"globalEval",!t||Q.get(t[n],"globalEval"))}xe.optgroup=xe.option,xe.tbody=xe.tfoot=xe.colgroup=xe.caption=xe.thead,xe.th=xe.td;var be,_e,Le=/<|&#?\w+;/;function Ee(e,t,n,r,i){for(var o,s,a,l,u,c,f=t.createDocumentFragment(),d=[],h=0,p=e.length;h<p;h++)if((o=e[h])||0===o)if("object"===_(o))L.merge(d,o.nodeType?[o]:o);else if(Le.test(o)){for(s=s||f.appendChild(t.createElement("div")),a=(ve.exec(o)||["",""])[1].toLowerCase(),l=xe[a]||xe._default,s.innerHTML=l[1]+L.htmlPrefilter(o)+l[2],c=l[0];c--;)s=s.lastChild;L.merge(d,s.childNodes),(s=f.firstChild).textContent=""}else d.push(t.createTextNode(o));for(f.textContent="",h=0;o=d[h++];)if(r&&L.inArray(o,r)>-1)i&&i.push(o);else if(u=ae(o),s=ge(f.appendChild(o),"script"),u&&Te(s),n)for(c=0;o=s[c++];)ye.test(o.type||"")&&n.push(o);return f}be=s.createDocumentFragment().appendChild(s.createElement("div")),(_e=s.createElement("input")).setAttribute("type","radio"),_e.setAttribute("checked","checked"),_e.setAttribute("name","t"),be.appendChild(_e),y.checkClone=be.cloneNode(!0).cloneNode(!0).lastChild.checked,be.innerHTML="<textarea>x</textarea>",y.noCloneChecked=!!be.cloneNode(!0).lastChild.defaultValue;var Ce=/^key/,we=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,Re=/^([^.]*)(?:\.(.+)|)/;function Se(){return!0}function Ge(){return!1}function Ae(e,t){return e===function(){try{return s.activeElement}catch(e){}}()==("focus"===t)}function We(e,t,n,r,i,o){var s,a;if("object"==typeof t){for(a in"string"!=typeof n&&(r=r||n,n=void 0),t)We(e,a,n,r,t[a],o);return e}if(null==r&&null==i?(i=n,r=n=void 0):null==i&&("string"==typeof n?(i=r,r=void 0):(i=r,r=n,n=void 0)),!1===i)i=Ge;else if(!i)return e;return 1===o&&(s=i,(i=function(e){return L().off(e),s.apply(this,arguments)}).guid=s.guid||(s.guid=L.guid++)),e.each((function(){L.event.add(this,t,i,r,n)}))}function ze(e,t,n){n?(Q.set(e,t,!1),L.event.add(e,t,{namespace:!1,handler:function(e){var r,i,o=Q.get(this,t);if(1&e.isTrigger&&this[t]){if(o.length)(L.event.special[t]||{}).delegateType&&e.stopPropagation();else if(o=l.call(arguments),Q.set(this,t,o),r=n(this,t),this[t](),o!==(i=Q.get(this,t))||r?Q.set(this,t,!1):i={},o!==i)return e.stopImmediatePropagation(),e.preventDefault(),i.value}else o.length&&(Q.set(this,t,{value:L.event.trigger(L.extend(o[0],L.Event.prototype),o.slice(1),this)}),e.stopImmediatePropagation())}})):void 0===Q.get(e,t)&&L.event.add(e,t,Se)}L.event={global:{},add:function(e,t,n,r,i){var o,s,a,l,u,c,f,d,h,p,m,v=Q.get(e);if(v)for(n.handler&&(n=(o=n).handler,i=o.selector),i&&L.find.matchesSelector(se,i),n.guid||(n.guid=L.guid++),(l=v.events)||(l=v.events={}),(s=v.handle)||(s=v.handle=function(t){return void 0!==L&&L.event.triggered!==t.type?L.event.dispatch.apply(e,arguments):void 0}),u=(t=(t||"").match(I)||[""]).length;u--;)h=m=(a=Re.exec(t[u])||[])[1],p=(a[2]||"").split(".").sort(),h&&(f=L.event.special[h]||{},h=(i?f.delegateType:f.bindType)||h,f=L.event.special[h]||{},c=L.extend({type:h,origType:m,data:r,handler:n,guid:n.guid,selector:i,needsContext:i&&L.expr.match.needsContext.test(i),namespace:p.join(".")},o),(d=l[h])||((d=l[h]=[]).delegateCount=0,f.setup&&!1!==f.setup.call(e,r,p,s)||e.addEventListener&&e.addEventListener(h,s)),f.add&&(f.add.call(e,c),c.handler.guid||(c.handler.guid=n.guid)),i?d.splice(d.delegateCount++,0,c):d.push(c),L.event.global[h]=!0)},remove:function(e,t,n,r,i){var o,s,a,l,u,c,f,d,h,p,m,v=Q.hasData(e)&&Q.get(e);if(v&&(l=v.events)){for(u=(t=(t||"").match(I)||[""]).length;u--;)if(h=m=(a=Re.exec(t[u])||[])[1],p=(a[2]||"").split(".").sort(),h){for(f=L.event.special[h]||{},d=l[h=(r?f.delegateType:f.bindType)||h]||[],a=a[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),s=o=d.length;o--;)c=d[o],!i&&m!==c.origType||n&&n.guid!==c.guid||a&&!a.test(c.namespace)||r&&r!==c.selector&&("**"!==r||!c.selector)||(d.splice(o,1),c.selector&&d.delegateCount--,f.remove&&f.remove.call(e,c));s&&!d.length&&(f.teardown&&!1!==f.teardown.call(e,p,v.handle)||L.removeEvent(e,h,v.handle),delete l[h])}else for(h in l)L.event.remove(e,h+t[u],n,r,!0);L.isEmptyObject(l)&&Q.remove(e,"handle events")}},dispatch:function(e){var t,n,r,i,o,s,a=L.event.fix(e),l=new Array(arguments.length),u=(Q.get(this,"events")||{})[a.type]||[],c=L.event.special[a.type]||{};for(l[0]=a,t=1;t<arguments.length;t++)l[t]=arguments[t];if(a.delegateTarget=this,!c.preDispatch||!1!==c.preDispatch.call(this,a)){for(s=L.event.handlers.call(this,a,u),t=0;(i=s[t++])&&!a.isPropagationStopped();)for(a.currentTarget=i.elem,n=0;(o=i.handlers[n++])&&!a.isImmediatePropagationStopped();)a.rnamespace&&!1!==o.namespace&&!a.rnamespace.test(o.namespace)||(a.handleObj=o,a.data=o.data,void 0!==(r=((L.event.special[o.origType]||{}).handle||o.handler).apply(i.elem,l))&&!1===(a.result=r)&&(a.preventDefault(),a.stopPropagation()));return c.postDispatch&&c.postDispatch.call(this,a),a.result}},handlers:function(e,t){var n,r,i,o,s,a=[],l=t.delegateCount,u=e.target;if(l&&u.nodeType&&!("click"===e.type&&e.button>=1))for(;u!==this;u=u.parentNode||this)if(1===u.nodeType&&("click"!==e.type||!0!==u.disabled)){for(o=[],s={},n=0;n<l;n++)void 0===s[i=(r=t[n]).selector+" "]&&(s[i]=r.needsContext?L(i,this).index(u)>-1:L.find(i,this,null,[u]).length),s[i]&&o.push(r);o.length&&a.push({elem:u,handlers:o})}return u=this,l<t.length&&a.push({elem:u,handlers:t.slice(l)}),a},addProp:function(e,t){Object.defineProperty(L.Event.prototype,e,{enumerable:!0,configurable:!0,get:x(t)?function(){if(this.originalEvent)return t(this.originalEvent)}:function(){if(this.originalEvent)return this.originalEvent[e]},set:function(t){Object.defineProperty(this,e,{enumerable:!0,configurable:!0,writable:!0,value:t})}})},fix:function(e){return e[L.expando]?e:new L.Event(e)},special:{load:{noBubble:!0},click:{setup:function(e){var t=this||e;return me.test(t.type)&&t.click&&A(t,"input")&&ze(t,"click",Se),!1},trigger:function(e){var t=this||e;return me.test(t.type)&&t.click&&A(t,"input")&&ze(t,"click"),!0},_default:function(e){var t=e.target;return me.test(t.type)&&t.click&&A(t,"input")&&Q.get(t,"click")||A(t,"a")}},beforeunload:{postDispatch:function(e){void 0!==e.result&&e.originalEvent&&(e.originalEvent.returnValue=e.result)}}}},L.removeEvent=function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n)},L.Event=function(e,t){if(!(this instanceof L.Event))return new L.Event(e,t);e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||void 0===e.defaultPrevented&&!1===e.returnValue?Se:Ge,this.target=e.target&&3===e.target.nodeType?e.target.parentNode:e.target,this.currentTarget=e.currentTarget,this.relatedTarget=e.relatedTarget):this.type=e,t&&L.extend(this,t),this.timeStamp=e&&e.timeStamp||Date.now(),this[L.expando]=!0},L.Event.prototype={constructor:L.Event,isDefaultPrevented:Ge,isPropagationStopped:Ge,isImmediatePropagationStopped:Ge,isSimulated:!1,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=Se,e&&!this.isSimulated&&e.preventDefault()},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=Se,e&&!this.isSimulated&&e.stopPropagation()},stopImmediatePropagation:function(){var e=this.originalEvent;this.isImmediatePropagationStopped=Se,e&&!this.isSimulated&&e.stopImmediatePropagation(),this.stopPropagation()}},L.each({altKey:!0,bubbles:!0,cancelable:!0,changedTouches:!0,ctrlKey:!0,detail:!0,eventPhase:!0,metaKey:!0,pageX:!0,pageY:!0,shiftKey:!0,view:!0,char:!0,code:!0,charCode:!0,key:!0,keyCode:!0,button:!0,buttons:!0,clientX:!0,clientY:!0,offsetX:!0,offsetY:!0,pointerId:!0,pointerType:!0,screenX:!0,screenY:!0,targetTouches:!0,toElement:!0,touches:!0,which:function(e){var t=e.button;return null==e.which&&Ce.test(e.type)?null!=e.charCode?e.charCode:e.keyCode:!e.which&&void 0!==t&&we.test(e.type)?1&t?1:2&t?3:4&t?2:0:e.which}},L.event.addProp),L.each({focus:"focusin",blur:"focusout"},(function(e,t){L.event.special[e]={setup:function(){return ze(this,e,Ae),!1},trigger:function(){return ze(this,e),!0},delegateType:t}})),L.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},(function(e,t){L.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,o=e.handleObj;return i&&(i===r||L.contains(r,i))||(e.type=o.origType,n=o.handler.apply(this,arguments),e.type=t),n}}})),L.fn.extend({on:function(e,t,n,r){return We(this,e,t,n,r)},one:function(e,t,n,r){return We(this,e,t,n,r,1)},off:function(e,t,n){var r,i;if(e&&e.preventDefault&&e.handleObj)return r=e.handleObj,L(e.delegateTarget).off(r.namespace?r.origType+"."+r.namespace:r.origType,r.selector,r.handler),this;if("object"==typeof e){for(i in e)this.off(i,t,e[i]);return this}return!1!==t&&"function"!=typeof t||(n=t,t=void 0),!1===n&&(n=Ge),this.each((function(){L.event.remove(this,e,n,t)}))}});var Pe=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,Me=/<script|<style|<link/i,De=/checked\s*(?:[^=]|=\s*.checked.)/i,Oe=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;function Be(e,t){return A(e,"table")&&A(11!==t.nodeType?t:t.firstChild,"tr")&&L(e).children("tbody")[0]||e}function Ie(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function Ne(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Fe(e,t){var n,r,i,o,s,a,l,u;if(1===t.nodeType){if(Q.hasData(e)&&(o=Q.access(e),s=Q.set(t,o),u=o.events))for(i in delete s.handle,s.events={},u)for(n=0,r=u[i].length;n<r;n++)L.event.add(t,i,u[i][n]);J.hasData(e)&&(a=J.access(e),l=L.extend({},a),J.set(t,l))}}function Ue(e,t){var n=t.nodeName.toLowerCase();"input"===n&&me.test(e.type)?t.checked=e.checked:"input"!==n&&"textarea"!==n||(t.defaultValue=e.defaultValue)}function Xe(e,t,n,r){t=u.apply([],t);var i,o,s,a,l,c,f=0,d=e.length,h=d-1,p=t[0],m=x(p);if(m||d>1&&"string"==typeof p&&!y.checkClone&&De.test(p))return e.each((function(i){var o=e.eq(i);m&&(t[0]=p.call(this,i,o.html())),Xe(o,t,n,r)}));if(d&&(o=(i=Ee(t,e[0].ownerDocument,!1,e,r)).firstChild,1===i.childNodes.length&&(i=o),o||r)){for(a=(s=L.map(ge(i,"script"),Ie)).length;f<d;f++)l=i,f!==h&&(l=L.clone(l,!0,!0),a&&L.merge(s,ge(l,"script"))),n.call(e[f],l,f);if(a)for(c=s[s.length-1].ownerDocument,L.map(s,Ne),f=0;f<a;f++)l=s[f],ye.test(l.type||"")&&!Q.access(l,"globalEval")&&L.contains(c,l)&&(l.src&&"module"!==(l.type||"").toLowerCase()?L._evalUrl&&!l.noModule&&L._evalUrl(l.src,{nonce:l.nonce||l.getAttribute("nonce")}):b(l.textContent.replace(Oe,""),l,c))}return e}function ke(e,t,n){for(var r,i=t?L.filter(t,e):e,o=0;null!=(r=i[o]);o++)n||1!==r.nodeType||L.cleanData(ge(r)),r.parentNode&&(n&&ae(r)&&Te(ge(r,"script")),r.parentNode.removeChild(r));return e}L.extend({htmlPrefilter:function(e){return e.replace(Pe,"<$1></$2>")},clone:function(e,t,n){var r,i,o,s,a=e.cloneNode(!0),l=ae(e);if(!(y.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||L.isXMLDoc(e)))for(s=ge(a),r=0,i=(o=ge(e)).length;r<i;r++)Ue(o[r],s[r]);if(t)if(n)for(o=o||ge(e),s=s||ge(a),r=0,i=o.length;r<i;r++)Fe(o[r],s[r]);else Fe(e,a);return(s=ge(a,"script")).length>0&&Te(s,!l&&ge(e,"script")),a},cleanData:function(e){for(var t,n,r,i=L.event.special,o=0;void 0!==(n=e[o]);o++)if(Z(n)){if(t=n[Q.expando]){if(t.events)for(r in t.events)i[r]?L.event.remove(n,r):L.removeEvent(n,r,t.handle);n[Q.expando]=void 0}n[J.expando]&&(n[J.expando]=void 0)}}}),L.fn.extend({detach:function(e){return ke(this,e,!0)},remove:function(e){return ke(this,e)},text:function(e){return V(this,(function(e){return void 0===e?L.text(this):this.empty().each((function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=e)}))}),null,e,arguments.length)},append:function(){return Xe(this,arguments,(function(e){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||Be(this,e).appendChild(e)}))},prepend:function(){return Xe(this,arguments,(function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=Be(this,e);t.insertBefore(e,t.firstChild)}}))},before:function(){return Xe(this,arguments,(function(e){this.parentNode&&this.parentNode.insertBefore(e,this)}))},after:function(){return Xe(this,arguments,(function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)}))},empty:function(){for(var e,t=0;null!=(e=this[t]);t++)1===e.nodeType&&(L.cleanData(ge(e,!1)),e.textContent="");return this},clone:function(e,t){return e=null!=e&&e,t=null==t?e:t,this.map((function(){return L.clone(this,e,t)}))},html:function(e){return V(this,(function(e){var t=this[0]||{},n=0,r=this.length;if(void 0===e&&1===t.nodeType)return t.innerHTML;if("string"==typeof e&&!Me.test(e)&&!xe[(ve.exec(e)||["",""])[1].toLowerCase()]){e=L.htmlPrefilter(e);try{for(;n<r;n++)1===(t=this[n]||{}).nodeType&&(L.cleanData(ge(t,!1)),t.innerHTML=e);t=0}catch(e){}}t&&this.empty().append(e)}),null,e,arguments.length)},replaceWith:function(){var e=[];return Xe(this,arguments,(function(t){var n=this.parentNode;L.inArray(this,e)<0&&(L.cleanData(ge(this)),n&&n.replaceChild(t,this))}),e)}}),L.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},(function(e,t){L.fn[e]=function(e){for(var n,r=[],i=L(e),o=i.length-1,s=0;s<=o;s++)n=s===o?this:this.clone(!0),L(i[s])[t](n),c.apply(r,n.get());return this.pushStack(r)}}));var je=new RegExp("^("+re+")(?!px)[a-z%]+$","i"),Ve=function(e){var t=e.ownerDocument.defaultView;return t&&t.opener||(t=n),t.getComputedStyle(e)},He=new RegExp(oe.join("|"),"i");function qe(e,t,n){var r,i,o,s,a=e.style;return(n=n||Ve(e))&&(""!==(s=n.getPropertyValue(t)||n[t])||ae(e)||(s=L.style(e,t)),!y.pixelBoxStyles()&&je.test(s)&&He.test(t)&&(r=a.width,i=a.minWidth,o=a.maxWidth,a.minWidth=a.maxWidth=a.width=s,s=n.width,a.width=r,a.minWidth=i,a.maxWidth=o)),void 0!==s?s+"":s}function Ye(e,t){return{get:function(){if(!e())return(this.get=t).apply(this,arguments);delete this.get}}}!function(){function e(){if(c){u.style.cssText="position:absolute;left:-11111px;width:60px;margin-top:1px;padding:0;border:0",c.style.cssText="position:relative;display:block;box-sizing:border-box;overflow:scroll;margin:auto;border:1px;padding:1px;width:60%;top:1%",se.appendChild(u).appendChild(c);var e=n.getComputedStyle(c);r="1%"!==e.top,l=12===t(e.marginLeft),c.style.right="60%",a=36===t(e.right),i=36===t(e.width),c.style.position="absolute",o=12===t(c.offsetWidth/3),se.removeChild(u),c=null}}function t(e){return Math.round(parseFloat(e))}var r,i,o,a,l,u=s.createElement("div"),c=s.createElement("div");c.style&&(c.style.backgroundClip="content-box",c.cloneNode(!0).style.backgroundClip="",y.clearCloneStyle="content-box"===c.style.backgroundClip,L.extend(y,{boxSizingReliable:function(){return e(),i},pixelBoxStyles:function(){return e(),a},pixelPosition:function(){return e(),r},reliableMarginLeft:function(){return e(),l},scrollboxSize:function(){return e(),o}}))}();var $e=["Webkit","Moz","ms"],Ze=s.createElement("div").style,Ke={};function Qe(e){var t=L.cssProps[e]||Ke[e];return t||(e in Ze?e:Ke[e]=function(e){for(var t=e[0].toUpperCase()+e.slice(1),n=$e.length;n--;)if((e=$e[n]+t)in Ze)return e}(e)||e)}var Je=/^(none|table(?!-c[ea]).+)/,et=/^--/,tt={position:"absolute",visibility:"hidden",display:"block"},nt={letterSpacing:"0",fontWeight:"400"};function rt(e,t,n){var r=ie.exec(t);return r?Math.max(0,r[2]-(n||0))+(r[3]||"px"):t}function it(e,t,n,r,i,o){var s="width"===t?1:0,a=0,l=0;if(n===(r?"border":"content"))return 0;for(;s<4;s+=2)"margin"===n&&(l+=L.css(e,n+oe[s],!0,i)),r?("content"===n&&(l-=L.css(e,"padding"+oe[s],!0,i)),"margin"!==n&&(l-=L.css(e,"border"+oe[s]+"Width",!0,i))):(l+=L.css(e,"padding"+oe[s],!0,i),"padding"!==n?l+=L.css(e,"border"+oe[s]+"Width",!0,i):a+=L.css(e,"border"+oe[s]+"Width",!0,i));return!r&&o>=0&&(l+=Math.max(0,Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-o-l-a-.5))||0),l}function ot(e,t,n){var r=Ve(e),i=(!y.boxSizingReliable()||n)&&"border-box"===L.css(e,"boxSizing",!1,r),o=i,s=qe(e,t,r),a="offset"+t[0].toUpperCase()+t.slice(1);if(je.test(s)){if(!n)return s;s="auto"}return(!y.boxSizingReliable()&&i||"auto"===s||!parseFloat(s)&&"inline"===L.css(e,"display",!1,r))&&e.getClientRects().length&&(i="border-box"===L.css(e,"boxSizing",!1,r),(o=a in e)&&(s=e[a])),(s=parseFloat(s)||0)+it(e,t,n||(i?"border":"content"),o,r,s)+"px"}function st(e,t,n,r,i){return new st.prototype.init(e,t,n,r,i)}L.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=qe(e,"opacity");return""===n?"1":n}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,gridArea:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnStart:!0,gridRow:!0,gridRowEnd:!0,gridRowStart:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{},style:function(e,t,n,r){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var i,o,s,a=$(t),l=et.test(t),u=e.style;if(l||(t=Qe(a)),s=L.cssHooks[t]||L.cssHooks[a],void 0===n)return s&&"get"in s&&void 0!==(i=s.get(e,!1,r))?i:u[t];"string"===(o=typeof n)&&(i=ie.exec(n))&&i[1]&&(n=fe(e,t,i),o="number"),null!=n&&n==n&&("number"!==o||l||(n+=i&&i[3]||(L.cssNumber[a]?"":"px")),y.clearCloneStyle||""!==n||0!==t.indexOf("background")||(u[t]="inherit"),s&&"set"in s&&void 0===(n=s.set(e,n,r))||(l?u.setProperty(t,n):u[t]=n))}},css:function(e,t,n,r){var i,o,s,a=$(t);return et.test(t)||(t=Qe(a)),(s=L.cssHooks[t]||L.cssHooks[a])&&"get"in s&&(i=s.get(e,!0,n)),void 0===i&&(i=qe(e,t,r)),"normal"===i&&t in nt&&(i=nt[t]),""===n||n?(o=parseFloat(i),!0===n||isFinite(o)?o||0:i):i}}),L.each(["height","width"],(function(e,t){L.cssHooks[t]={get:function(e,n,r){if(n)return!Je.test(L.css(e,"display"))||e.getClientRects().length&&e.getBoundingClientRect().width?ot(e,t,r):ce(e,tt,(function(){return ot(e,t,r)}))},set:function(e,n,r){var i,o=Ve(e),s=!y.scrollboxSize()&&"absolute"===o.position,a=(s||r)&&"border-box"===L.css(e,"boxSizing",!1,o),l=r?it(e,t,r,a,o):0;return a&&s&&(l-=Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-parseFloat(o[t])-it(e,t,"border",!1,o)-.5)),l&&(i=ie.exec(n))&&"px"!==(i[3]||"px")&&(e.style[t]=n,n=L.css(e,t)),rt(0,n,l)}}})),L.cssHooks.marginLeft=Ye(y.reliableMarginLeft,(function(e,t){if(t)return(parseFloat(qe(e,"marginLeft"))||e.getBoundingClientRect().left-ce(e,{marginLeft:0},(function(){return e.getBoundingClientRect().left})))+"px"})),L.each({margin:"",padding:"",border:"Width"},(function(e,t){L.cssHooks[e+t]={expand:function(n){for(var r=0,i={},o="string"==typeof n?n.split(" "):[n];r<4;r++)i[e+oe[r]+t]=o[r]||o[r-2]||o[0];return i}},"margin"!==e&&(L.cssHooks[e+t].set=rt)})),L.fn.extend({css:function(e,t){return V(this,(function(e,t,n){var r,i,o={},s=0;if(Array.isArray(t)){for(r=Ve(e),i=t.length;s<i;s++)o[t[s]]=L.css(e,t[s],!1,r);return o}return void 0!==n?L.style(e,t,n):L.css(e,t)}),e,t,arguments.length>1)}}),L.Tween=st,st.prototype={constructor:st,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||L.easing._default,this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(L.cssNumber[n]?"":"px")},cur:function(){var e=st.propHooks[this.prop];return e&&e.get?e.get(this):st.propHooks._default.get(this)},run:function(e){var t,n=st.propHooks[this.prop];return this.options.duration?this.pos=t=L.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):st.propHooks._default.set(this),this}},st.prototype.init.prototype=st.prototype,st.propHooks={_default:{get:function(e){var t;return 1!==e.elem.nodeType||null!=e.elem[e.prop]&&null==e.elem.style[e.prop]?e.elem[e.prop]:(t=L.css(e.elem,e.prop,""))&&"auto"!==t?t:0},set:function(e){L.fx.step[e.prop]?L.fx.step[e.prop](e):1!==e.elem.nodeType||!L.cssHooks[e.prop]&&null==e.elem.style[Qe(e.prop)]?e.elem[e.prop]=e.now:L.style(e.elem,e.prop,e.now+e.unit)}}},st.propHooks.scrollTop=st.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},L.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2},_default:"swing"},L.fx=st.prototype.init,L.fx.step={};var at,lt,ut=/^(?:toggle|show|hide)$/,ct=/queueHooks$/;function ft(){lt&&(!1===s.hidden&&n.requestAnimationFrame?n.requestAnimationFrame(ft):n.setTimeout(ft,L.fx.interval),L.fx.tick())}function dt(){return n.setTimeout((function(){at=void 0})),at=Date.now()}function ht(e,t){var n,r=0,i={height:e};for(t=t?1:0;r<4;r+=2-t)i["margin"+(n=oe[r])]=i["padding"+n]=e;return t&&(i.opacity=i.width=e),i}function pt(e,t,n){for(var r,i=(mt.tweeners[t]||[]).concat(mt.tweeners["*"]),o=0,s=i.length;o<s;o++)if(r=i[o].call(n,t,e))return r}function mt(e,t,n){var r,i,o=0,s=mt.prefilters.length,a=L.Deferred().always((function(){delete l.elem})),l=function(){if(i)return!1;for(var t=at||dt(),n=Math.max(0,u.startTime+u.duration-t),r=1-(n/u.duration||0),o=0,s=u.tweens.length;o<s;o++)u.tweens[o].run(r);return a.notifyWith(e,[u,r,n]),r<1&&s?n:(s||a.notifyWith(e,[u,1,0]),a.resolveWith(e,[u]),!1)},u=a.promise({elem:e,props:L.extend({},t),opts:L.extend(!0,{specialEasing:{},easing:L.easing._default},n),originalProperties:t,originalOptions:n,startTime:at||dt(),duration:n.duration,tweens:[],createTween:function(t,n){var r=L.Tween(e,u.opts,t,n,u.opts.specialEasing[t]||u.opts.easing);return u.tweens.push(r),r},stop:function(t){var n=0,r=t?u.tweens.length:0;if(i)return this;for(i=!0;n<r;n++)u.tweens[n].run(1);return t?(a.notifyWith(e,[u,1,0]),a.resolveWith(e,[u,t])):a.rejectWith(e,[u,t]),this}}),c=u.props;for(!function(e,t){var n,r,i,o,s;for(n in e)if(i=t[r=$(n)],o=e[n],Array.isArray(o)&&(i=o[1],o=e[n]=o[0]),n!==r&&(e[r]=o,delete e[n]),(s=L.cssHooks[r])&&"expand"in s)for(n in o=s.expand(o),delete e[r],o)n in e||(e[n]=o[n],t[n]=i);else t[r]=i}(c,u.opts.specialEasing);o<s;o++)if(r=mt.prefilters[o].call(u,e,c,u.opts))return x(r.stop)&&(L._queueHooks(u.elem,u.opts.queue).stop=r.stop.bind(r)),r;return L.map(c,pt,u),x(u.opts.start)&&u.opts.start.call(e,u),u.progress(u.opts.progress).done(u.opts.done,u.opts.complete).fail(u.opts.fail).always(u.opts.always),L.fx.timer(L.extend(l,{elem:e,anim:u,queue:u.opts.queue})),u}L.Animation=L.extend(mt,{tweeners:{"*":[function(e,t){var n=this.createTween(e,t);return fe(n.elem,e,ie.exec(t),n),n}]},tweener:function(e,t){x(e)?(t=e,e=["*"]):e=e.match(I);for(var n,r=0,i=e.length;r<i;r++)n=e[r],mt.tweeners[n]=mt.tweeners[n]||[],mt.tweeners[n].unshift(t)},prefilters:[function(e,t,n){var r,i,o,s,a,l,u,c,f="width"in t||"height"in t,d=this,h={},p=e.style,m=e.nodeType&&ue(e),v=Q.get(e,"fxshow");for(r in n.queue||(null==(s=L._queueHooks(e,"fx")).unqueued&&(s.unqueued=0,a=s.empty.fire,s.empty.fire=function(){s.unqueued||a()}),s.unqueued++,d.always((function(){d.always((function(){s.unqueued--,L.queue(e,"fx").length||s.empty.fire()}))}))),t)if(i=t[r],ut.test(i)){if(delete t[r],o=o||"toggle"===i,i===(m?"hide":"show")){if("show"!==i||!v||void 0===v[r])continue;m=!0}h[r]=v&&v[r]||L.style(e,r)}if((l=!L.isEmptyObject(t))||!L.isEmptyObject(h))for(r in f&&1===e.nodeType&&(n.overflow=[p.overflow,p.overflowX,p.overflowY],null==(u=v&&v.display)&&(u=Q.get(e,"display")),"none"===(c=L.css(e,"display"))&&(u?c=u:(pe([e],!0),u=e.style.display||u,c=L.css(e,"display"),pe([e]))),("inline"===c||"inline-block"===c&&null!=u)&&"none"===L.css(e,"float")&&(l||(d.done((function(){p.display=u})),null==u&&(c=p.display,u="none"===c?"":c)),p.display="inline-block")),n.overflow&&(p.overflow="hidden",d.always((function(){p.overflow=n.overflow[0],p.overflowX=n.overflow[1],p.overflowY=n.overflow[2]}))),l=!1,h)l||(v?"hidden"in v&&(m=v.hidden):v=Q.access(e,"fxshow",{display:u}),o&&(v.hidden=!m),m&&pe([e],!0),d.done((function(){for(r in m||pe([e]),Q.remove(e,"fxshow"),h)L.style(e,r,h[r])}))),l=pt(m?v[r]:0,r,d),r in v||(v[r]=l.start,m&&(l.end=l.start,l.start=0))}],prefilter:function(e,t){t?mt.prefilters.unshift(e):mt.prefilters.push(e)}}),L.speed=function(e,t,n){var r=e&&"object"==typeof e?L.extend({},e):{complete:n||!n&&t||x(e)&&e,duration:e,easing:n&&t||t&&!x(t)&&t};return L.fx.off?r.duration=0:"number"!=typeof r.duration&&(r.duration in L.fx.speeds?r.duration=L.fx.speeds[r.duration]:r.duration=L.fx.speeds._default),null!=r.queue&&!0!==r.queue||(r.queue="fx"),r.old=r.complete,r.complete=function(){x(r.old)&&r.old.call(this),r.queue&&L.dequeue(this,r.queue)},r},L.fn.extend({fadeTo:function(e,t,n,r){return this.filter(ue).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=L.isEmptyObject(e),o=L.speed(t,n,r),s=function(){var t=mt(this,L.extend({},e),o);(i||Q.get(this,"finish"))&&t.stop(!0)};return s.finish=s,i||!1===o.queue?this.each(s):this.queue(o.queue,s)},stop:function(e,t,n){var r=function(e){var t=e.stop;delete e.stop,t(n)};return"string"!=typeof e&&(n=t,t=e,e=void 0),t&&!1!==e&&this.queue(e||"fx",[]),this.each((function(){var t=!0,i=null!=e&&e+"queueHooks",o=L.timers,s=Q.get(this);if(i)s[i]&&s[i].stop&&r(s[i]);else for(i in s)s[i]&&s[i].stop&&ct.test(i)&&r(s[i]);for(i=o.length;i--;)o[i].elem!==this||null!=e&&o[i].queue!==e||(o[i].anim.stop(n),t=!1,o.splice(i,1));!t&&n||L.dequeue(this,e)}))},finish:function(e){return!1!==e&&(e=e||"fx"),this.each((function(){var t,n=Q.get(this),r=n[e+"queue"],i=n[e+"queueHooks"],o=L.timers,s=r?r.length:0;for(n.finish=!0,L.queue(this,e,[]),i&&i.stop&&i.stop.call(this,!0),t=o.length;t--;)o[t].elem===this&&o[t].queue===e&&(o[t].anim.stop(!0),o.splice(t,1));for(t=0;t<s;t++)r[t]&&r[t].finish&&r[t].finish.call(this);delete n.finish}))}}),L.each(["toggle","show","hide"],(function(e,t){var n=L.fn[t];L.fn[t]=function(e,r,i){return null==e||"boolean"==typeof e?n.apply(this,arguments):this.animate(ht(t,!0),e,r,i)}})),L.each({slideDown:ht("show"),slideUp:ht("hide"),slideToggle:ht("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},(function(e,t){L.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}})),L.timers=[],L.fx.tick=function(){var e,t=0,n=L.timers;for(at=Date.now();t<n.length;t++)(e=n[t])()||n[t]!==e||n.splice(t--,1);n.length||L.fx.stop(),at=void 0},L.fx.timer=function(e){L.timers.push(e),L.fx.start()},L.fx.interval=13,L.fx.start=function(){lt||(lt=!0,ft())},L.fx.stop=function(){lt=null},L.fx.speeds={slow:600,fast:200,_default:400},L.fn.delay=function(e,t){return e=L.fx&&L.fx.speeds[e]||e,t=t||"fx",this.queue(t,(function(t,r){var i=n.setTimeout(t,e);r.stop=function(){n.clearTimeout(i)}}))},function(){var e=s.createElement("input"),t=s.createElement("select").appendChild(s.createElement("option"));e.type="checkbox",y.checkOn=""!==e.value,y.optSelected=t.selected,(e=s.createElement("input")).value="t",e.type="radio",y.radioValue="t"===e.value}();var vt,yt=L.expr.attrHandle;L.fn.extend({attr:function(e,t){return V(this,L.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each((function(){L.removeAttr(this,e)}))}}),L.extend({attr:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return void 0===e.getAttribute?L.prop(e,t,n):(1===o&&L.isXMLDoc(e)||(i=L.attrHooks[t.toLowerCase()]||(L.expr.match.bool.test(t)?vt:void 0)),void 0!==n?null===n?void L.removeAttr(e,t):i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:(e.setAttribute(t,n+""),n):i&&"get"in i&&null!==(r=i.get(e,t))?r:null==(r=L.find.attr(e,t))?void 0:r)},attrHooks:{type:{set:function(e,t){if(!y.radioValue&&"radio"===t&&A(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},removeAttr:function(e,t){var n,r=0,i=t&&t.match(I);if(i&&1===e.nodeType)for(;n=i[r++];)e.removeAttribute(n)}}),vt={set:function(e,t,n){return!1===t?L.removeAttr(e,n):e.setAttribute(n,n),n}},L.each(L.expr.match.bool.source.match(/\w+/g),(function(e,t){var n=yt[t]||L.find.attr;yt[t]=function(e,t,r){var i,o,s=t.toLowerCase();return r||(o=yt[s],yt[s]=i,i=null!=n(e,t,r)?s:null,yt[s]=o),i}}));var xt=/^(?:input|select|textarea|button)$/i,gt=/^(?:a|area)$/i;function Tt(e){return(e.match(I)||[]).join(" ")}function bt(e){return e.getAttribute&&e.getAttribute("class")||""}function _t(e){return Array.isArray(e)?e:"string"==typeof e&&e.match(I)||[]}L.fn.extend({prop:function(e,t){return V(this,L.prop,e,t,arguments.length>1)},removeProp:function(e){return this.each((function(){delete this[L.propFix[e]||e]}))}}),L.extend({prop:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return 1===o&&L.isXMLDoc(e)||(t=L.propFix[t]||t,i=L.propHooks[t]),void 0!==n?i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:e[t]=n:i&&"get"in i&&null!==(r=i.get(e,t))?r:e[t]},propHooks:{tabIndex:{get:function(e){var t=L.find.attr(e,"tabindex");return t?parseInt(t,10):xt.test(e.nodeName)||gt.test(e.nodeName)&&e.href?0:-1}}},propFix:{for:"htmlFor",class:"className"}}),y.optSelected||(L.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null},set:function(e){var t=e.parentNode;t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex)}}),L.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],(function(){L.propFix[this.toLowerCase()]=this})),L.fn.extend({addClass:function(e){var t,n,r,i,o,s,a,l=0;if(x(e))return this.each((function(t){L(this).addClass(e.call(this,t,bt(this)))}));if((t=_t(e)).length)for(;n=this[l++];)if(i=bt(n),r=1===n.nodeType&&" "+Tt(i)+" "){for(s=0;o=t[s++];)r.indexOf(" "+o+" ")<0&&(r+=o+" ");i!==(a=Tt(r))&&n.setAttribute("class",a)}return this},removeClass:function(e){var t,n,r,i,o,s,a,l=0;if(x(e))return this.each((function(t){L(this).removeClass(e.call(this,t,bt(this)))}));if(!arguments.length)return this.attr("class","");if((t=_t(e)).length)for(;n=this[l++];)if(i=bt(n),r=1===n.nodeType&&" "+Tt(i)+" "){for(s=0;o=t[s++];)for(;r.indexOf(" "+o+" ")>-1;)r=r.replace(" "+o+" "," ");i!==(a=Tt(r))&&n.setAttribute("class",a)}return this},toggleClass:function(e,t){var n=typeof e,r="string"===n||Array.isArray(e);return"boolean"==typeof t&&r?t?this.addClass(e):this.removeClass(e):x(e)?this.each((function(n){L(this).toggleClass(e.call(this,n,bt(this),t),t)})):this.each((function(){var t,i,o,s;if(r)for(i=0,o=L(this),s=_t(e);t=s[i++];)o.hasClass(t)?o.removeClass(t):o.addClass(t);else void 0!==e&&"boolean"!==n||((t=bt(this))&&Q.set(this,"__className__",t),this.setAttribute&&this.setAttribute("class",t||!1===e?"":Q.get(this,"__className__")||""))}))},hasClass:function(e){var t,n,r=0;for(t=" "+e+" ";n=this[r++];)if(1===n.nodeType&&(" "+Tt(bt(n))+" ").indexOf(t)>-1)return!0;return!1}});var Lt=/\r/g;L.fn.extend({val:function(e){var t,n,r,i=this[0];return arguments.length?(r=x(e),this.each((function(n){var i;1===this.nodeType&&(null==(i=r?e.call(this,n,L(this).val()):e)?i="":"number"==typeof i?i+="":Array.isArray(i)&&(i=L.map(i,(function(e){return null==e?"":e+""}))),(t=L.valHooks[this.type]||L.valHooks[this.nodeName.toLowerCase()])&&"set"in t&&void 0!==t.set(this,i,"value")||(this.value=i))}))):i?(t=L.valHooks[i.type]||L.valHooks[i.nodeName.toLowerCase()])&&"get"in t&&void 0!==(n=t.get(i,"value"))?n:"string"==typeof(n=i.value)?n.replace(Lt,""):null==n?"":n:void 0}}),L.extend({valHooks:{option:{get:function(e){var t=L.find.attr(e,"value");return null!=t?t:Tt(L.text(e))}},select:{get:function(e){var t,n,r,i=e.options,o=e.selectedIndex,s="select-one"===e.type,a=s?null:[],l=s?o+1:i.length;for(r=o<0?l:s?o:0;r<l;r++)if(((n=i[r]).selected||r===o)&&!n.disabled&&(!n.parentNode.disabled||!A(n.parentNode,"optgroup"))){if(t=L(n).val(),s)return t;a.push(t)}return a},set:function(e,t){for(var n,r,i=e.options,o=L.makeArray(t),s=i.length;s--;)((r=i[s]).selected=L.inArray(L.valHooks.option.get(r),o)>-1)&&(n=!0);return n||(e.selectedIndex=-1),o}}}}),L.each(["radio","checkbox"],(function(){L.valHooks[this]={set:function(e,t){if(Array.isArray(t))return e.checked=L.inArray(L(e).val(),t)>-1}},y.checkOn||(L.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})})),y.focusin="onfocusin"in n;var Et=/^(?:focusinfocus|focusoutblur)$/,Ct=function(e){e.stopPropagation()};L.extend(L.event,{trigger:function(e,t,r,i){var o,a,l,u,c,f,d,h,m=[r||s],v=p.call(e,"type")?e.type:e,y=p.call(e,"namespace")?e.namespace.split("."):[];if(a=h=l=r=r||s,3!==r.nodeType&&8!==r.nodeType&&!Et.test(v+L.event.triggered)&&(v.indexOf(".")>-1&&(y=v.split("."),v=y.shift(),y.sort()),c=v.indexOf(":")<0&&"on"+v,(e=e[L.expando]?e:new L.Event(v,"object"==typeof e&&e)).isTrigger=i?2:3,e.namespace=y.join("."),e.rnamespace=e.namespace?new RegExp("(^|\\.)"+y.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,e.result=void 0,e.target||(e.target=r),t=null==t?[e]:L.makeArray(t,[e]),d=L.event.special[v]||{},i||!d.trigger||!1!==d.trigger.apply(r,t))){if(!i&&!d.noBubble&&!g(r)){for(u=d.delegateType||v,Et.test(u+v)||(a=a.parentNode);a;a=a.parentNode)m.push(a),l=a;l===(r.ownerDocument||s)&&m.push(l.defaultView||l.parentWindow||n)}for(o=0;(a=m[o++])&&!e.isPropagationStopped();)h=a,e.type=o>1?u:d.bindType||v,(f=(Q.get(a,"events")||{})[e.type]&&Q.get(a,"handle"))&&f.apply(a,t),(f=c&&a[c])&&f.apply&&Z(a)&&(e.result=f.apply(a,t),!1===e.result&&e.preventDefault());return e.type=v,i||e.isDefaultPrevented()||d._default&&!1!==d._default.apply(m.pop(),t)||!Z(r)||c&&x(r[v])&&!g(r)&&((l=r[c])&&(r[c]=null),L.event.triggered=v,e.isPropagationStopped()&&h.addEventListener(v,Ct),r[v](),e.isPropagationStopped()&&h.removeEventListener(v,Ct),L.event.triggered=void 0,l&&(r[c]=l)),e.result}},simulate:function(e,t,n){var r=L.extend(new L.Event,n,{type:e,isSimulated:!0});L.event.trigger(r,null,t)}}),L.fn.extend({trigger:function(e,t){return this.each((function(){L.event.trigger(e,t,this)}))},triggerHandler:function(e,t){var n=this[0];if(n)return L.event.trigger(e,t,n,!0)}}),y.focusin||L.each({focus:"focusin",blur:"focusout"},(function(e,t){var n=function(e){L.event.simulate(t,e.target,L.event.fix(e))};L.event.special[t]={setup:function(){var r=this.ownerDocument||this,i=Q.access(r,t);i||r.addEventListener(e,n,!0),Q.access(r,t,(i||0)+1)},teardown:function(){var r=this.ownerDocument||this,i=Q.access(r,t)-1;i?Q.access(r,t,i):(r.removeEventListener(e,n,!0),Q.remove(r,t))}}}));var wt=n.location,Rt=Date.now(),St=/\?/;L.parseXML=function(e){var t;if(!e||"string"!=typeof e)return null;try{t=(new n.DOMParser).parseFromString(e,"text/xml")}catch(e){t=void 0}return t&&!t.getElementsByTagName("parsererror").length||L.error("Invalid XML: "+e),t};var Gt=/\[\]$/,At=/\r?\n/g,Wt=/^(?:submit|button|image|reset|file)$/i,zt=/^(?:input|select|textarea|keygen)/i;function Pt(e,t,n,r){var i;if(Array.isArray(t))L.each(t,(function(t,i){n||Gt.test(e)?r(e,i):Pt(e+"["+("object"==typeof i&&null!=i?t:"")+"]",i,n,r)}));else if(n||"object"!==_(t))r(e,t);else for(i in t)Pt(e+"["+i+"]",t[i],n,r)}L.param=function(e,t){var n,r=[],i=function(e,t){var n=x(t)?t():t;r[r.length]=encodeURIComponent(e)+"="+encodeURIComponent(null==n?"":n)};if(null==e)return"";if(Array.isArray(e)||e.jquery&&!L.isPlainObject(e))L.each(e,(function(){i(this.name,this.value)}));else for(n in e)Pt(n,e[n],t,i);return r.join("&")},L.fn.extend({serialize:function(){return L.param(this.serializeArray())},serializeArray:function(){return this.map((function(){var e=L.prop(this,"elements");return e?L.makeArray(e):this})).filter((function(){var e=this.type;return this.name&&!L(this).is(":disabled")&&zt.test(this.nodeName)&&!Wt.test(e)&&(this.checked||!me.test(e))})).map((function(e,t){var n=L(this).val();return null==n?null:Array.isArray(n)?L.map(n,(function(e){return{name:t.name,value:e.replace(At,"\r\n")}})):{name:t.name,value:n.replace(At,"\r\n")}})).get()}});var Mt=/%20/g,Dt=/#.*$/,Ot=/([?&])_=[^&]*/,Bt=/^(.*?):[ \t]*([^\r\n]*)$/gm,It=/^(?:GET|HEAD)$/,Nt=/^\/\//,Ft={},Ut={},Xt="*/".concat("*"),kt=s.createElement("a");function jt(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r,i=0,o=t.toLowerCase().match(I)||[];if(x(n))for(;r=o[i++];)"+"===r[0]?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function Vt(e,t,n,r){var i={},o=e===Ut;function s(a){var l;return i[a]=!0,L.each(e[a]||[],(function(e,a){var u=a(t,n,r);return"string"!=typeof u||o||i[u]?o?!(l=u):void 0:(t.dataTypes.unshift(u),s(u),!1)})),l}return s(t.dataTypes[0])||!i["*"]&&s("*")}function Ht(e,t){var n,r,i=L.ajaxSettings.flatOptions||{};for(n in t)void 0!==t[n]&&((i[n]?e:r||(r={}))[n]=t[n]);return r&&L.extend(!0,e,r),e}kt.href=wt.href,L.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:wt.href,type:"GET",isLocal:/^(?:about|app|app-storage|.+-extension|file|res|widget):$/.test(wt.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Xt,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":L.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?Ht(Ht(e,L.ajaxSettings),t):Ht(L.ajaxSettings,e)},ajaxPrefilter:jt(Ft),ajaxTransport:jt(Ut),ajax:function(e,t){"object"==typeof e&&(t=e,e=void 0),t=t||{};var r,i,o,a,l,u,c,f,d,h,p=L.ajaxSetup({},t),m=p.context||p,v=p.context&&(m.nodeType||m.jquery)?L(m):L.event,y=L.Deferred(),x=L.Callbacks("once memory"),g=p.statusCode||{},T={},b={},_="canceled",E={readyState:0,getResponseHeader:function(e){var t;if(c){if(!a)for(a={};t=Bt.exec(o);)a[t[1].toLowerCase()+" "]=(a[t[1].toLowerCase()+" "]||[]).concat(t[2]);t=a[e.toLowerCase()+" "]}return null==t?null:t.join(", ")},getAllResponseHeaders:function(){return c?o:null},setRequestHeader:function(e,t){return null==c&&(e=b[e.toLowerCase()]=b[e.toLowerCase()]||e,T[e]=t),this},overrideMimeType:function(e){return null==c&&(p.mimeType=e),this},statusCode:function(e){var t;if(e)if(c)E.always(e[E.status]);else for(t in e)g[t]=[g[t],e[t]];return this},abort:function(e){var t=e||_;return r&&r.abort(t),C(0,t),this}};if(y.promise(E),p.url=((e||p.url||wt.href)+"").replace(Nt,wt.protocol+"//"),p.type=t.method||t.type||p.method||p.type,p.dataTypes=(p.dataType||"*").toLowerCase().match(I)||[""],null==p.crossDomain){u=s.createElement("a");try{u.href=p.url,u.href=u.href,p.crossDomain=kt.protocol+"//"+kt.host!=u.protocol+"//"+u.host}catch(e){p.crossDomain=!0}}if(p.data&&p.processData&&"string"!=typeof p.data&&(p.data=L.param(p.data,p.traditional)),Vt(Ft,p,t,E),c)return E;for(d in(f=L.event&&p.global)&&0==L.active++&&L.event.trigger("ajaxStart"),p.type=p.type.toUpperCase(),p.hasContent=!It.test(p.type),i=p.url.replace(Dt,""),p.hasContent?p.data&&p.processData&&0===(p.contentType||"").indexOf("application/x-www-form-urlencoded")&&(p.data=p.data.replace(Mt,"+")):(h=p.url.slice(i.length),p.data&&(p.processData||"string"==typeof p.data)&&(i+=(St.test(i)?"&":"?")+p.data,delete p.data),!1===p.cache&&(i=i.replace(Ot,"$1"),h=(St.test(i)?"&":"?")+"_="+Rt+++h),p.url=i+h),p.ifModified&&(L.lastModified[i]&&E.setRequestHeader("If-Modified-Since",L.lastModified[i]),L.etag[i]&&E.setRequestHeader("If-None-Match",L.etag[i])),(p.data&&p.hasContent&&!1!==p.contentType||t.contentType)&&E.setRequestHeader("Content-Type",p.contentType),E.setRequestHeader("Accept",p.dataTypes[0]&&p.accepts[p.dataTypes[0]]?p.accepts[p.dataTypes[0]]+("*"!==p.dataTypes[0]?", "+Xt+"; q=0.01":""):p.accepts["*"]),p.headers)E.setRequestHeader(d,p.headers[d]);if(p.beforeSend&&(!1===p.beforeSend.call(m,E,p)||c))return E.abort();if(_="abort",x.add(p.complete),E.done(p.success),E.fail(p.error),r=Vt(Ut,p,t,E)){if(E.readyState=1,f&&v.trigger("ajaxSend",[E,p]),c)return E;p.async&&p.timeout>0&&(l=n.setTimeout((function(){E.abort("timeout")}),p.timeout));try{c=!1,r.send(T,C)}catch(e){if(c)throw e;C(-1,e)}}else C(-1,"No Transport");function C(e,t,s,a){var u,d,h,T,b,_=t;c||(c=!0,l&&n.clearTimeout(l),r=void 0,o=a||"",E.readyState=e>0?4:0,u=e>=200&&e<300||304===e,s&&(T=function(e,t,n){for(var r,i,o,s,a=e.contents,l=e.dataTypes;"*"===l[0];)l.shift(),void 0===r&&(r=e.mimeType||t.getResponseHeader("Content-Type"));if(r)for(i in a)if(a[i]&&a[i].test(r)){l.unshift(i);break}if(l[0]in n)o=l[0];else{for(i in n){if(!l[0]||e.converters[i+" "+l[0]]){o=i;break}s||(s=i)}o=o||s}if(o)return o!==l[0]&&l.unshift(o),n[o]}(p,E,s)),T=function(e,t,n,r){var i,o,s,a,l,u={},c=e.dataTypes.slice();if(c[1])for(s in e.converters)u[s.toLowerCase()]=e.converters[s];for(o=c.shift();o;)if(e.responseFields[o]&&(n[e.responseFields[o]]=t),!l&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),l=o,o=c.shift())if("*"===o)o=l;else if("*"!==l&&l!==o){if(!(s=u[l+" "+o]||u["* "+o]))for(i in u)if((a=i.split(" "))[1]===o&&(s=u[l+" "+a[0]]||u["* "+a[0]])){!0===s?s=u[i]:!0!==u[i]&&(o=a[0],c.unshift(a[1]));break}if(!0!==s)if(s&&e.throws)t=s(t);else try{t=s(t)}catch(e){return{state:"parsererror",error:s?e:"No conversion from "+l+" to "+o}}}return{state:"success",data:t}}(p,T,E,u),u?(p.ifModified&&((b=E.getResponseHeader("Last-Modified"))&&(L.lastModified[i]=b),(b=E.getResponseHeader("etag"))&&(L.etag[i]=b)),204===e||"HEAD"===p.type?_="nocontent":304===e?_="notmodified":(_=T.state,d=T.data,u=!(h=T.error))):(h=_,!e&&_||(_="error",e<0&&(e=0))),E.status=e,E.statusText=(t||_)+"",u?y.resolveWith(m,[d,_,E]):y.rejectWith(m,[E,_,h]),E.statusCode(g),g=void 0,f&&v.trigger(u?"ajaxSuccess":"ajaxError",[E,p,u?d:h]),x.fireWith(m,[E,_]),f&&(v.trigger("ajaxComplete",[E,p]),--L.active||L.event.trigger("ajaxStop")))}return E},getJSON:function(e,t,n){return L.get(e,t,n,"json")},getScript:function(e,t){return L.get(e,void 0,t,"script")}}),L.each(["get","post"],(function(e,t){L[t]=function(e,n,r,i){return x(n)&&(i=i||r,r=n,n=void 0),L.ajax(L.extend({url:e,type:t,dataType:i,data:n,success:r},L.isPlainObject(e)&&e))}})),L._evalUrl=function(e,t){return L.ajax({url:e,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,converters:{"text script":function(){}},dataFilter:function(e){L.globalEval(e,t)}})},L.fn.extend({wrapAll:function(e){var t;return this[0]&&(x(e)&&(e=e.call(this[0])),t=L(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map((function(){for(var e=this;e.firstElementChild;)e=e.firstElementChild;return e})).append(this)),this},wrapInner:function(e){return x(e)?this.each((function(t){L(this).wrapInner(e.call(this,t))})):this.each((function(){var t=L(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)}))},wrap:function(e){var t=x(e);return this.each((function(n){L(this).wrapAll(t?e.call(this,n):e)}))},unwrap:function(e){return this.parent(e).not("body").each((function(){L(this).replaceWith(this.childNodes)})),this}}),L.expr.pseudos.hidden=function(e){return!L.expr.pseudos.visible(e)},L.expr.pseudos.visible=function(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)},L.ajaxSettings.xhr=function(){try{return new n.XMLHttpRequest}catch(e){}};var qt={0:200,1223:204},Yt=L.ajaxSettings.xhr();y.cors=!!Yt&&"withCredentials"in Yt,y.ajax=Yt=!!Yt,L.ajaxTransport((function(e){var t,r;if(y.cors||Yt&&!e.crossDomain)return{send:function(i,o){var s,a=e.xhr();if(a.open(e.type,e.url,e.async,e.username,e.password),e.xhrFields)for(s in e.xhrFields)a[s]=e.xhrFields[s];for(s in e.mimeType&&a.overrideMimeType&&a.overrideMimeType(e.mimeType),e.crossDomain||i["X-Requested-With"]||(i["X-Requested-With"]="XMLHttpRequest"),i)a.setRequestHeader(s,i[s]);t=function(e){return function(){t&&(t=r=a.onload=a.onerror=a.onabort=a.ontimeout=a.onreadystatechange=null,"abort"===e?a.abort():"error"===e?"number"!=typeof a.status?o(0,"error"):o(a.status,a.statusText):o(qt[a.status]||a.status,a.statusText,"text"!==(a.responseType||"text")||"string"!=typeof a.responseText?{binary:a.response}:{text:a.responseText},a.getAllResponseHeaders()))}},a.onload=t(),r=a.onerror=a.ontimeout=t("error"),void 0!==a.onabort?a.onabort=r:a.onreadystatechange=function(){4===a.readyState&&n.setTimeout((function(){t&&r()}))},t=t("abort");try{a.send(e.hasContent&&e.data||null)}catch(e){if(t)throw e}},abort:function(){t&&t()}}})),L.ajaxPrefilter((function(e){e.crossDomain&&(e.contents.script=!1)})),L.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(e){return L.globalEval(e),e}}}),L.ajaxPrefilter("script",(function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET")})),L.ajaxTransport("script",(function(e){var t,n;if(e.crossDomain||e.scriptAttrs)return{send:function(r,i){t=L("<script>").attr(e.scriptAttrs||{}).prop({charset:e.scriptCharset,src:e.url}).on("load error",n=function(e){t.remove(),n=null,e&&i("error"===e.type?404:200,e.type)}),s.head.appendChild(t[0])},abort:function(){n&&n()}}}));var $t,Zt=[],Kt=/(=)\?(?=&|$)|\?\?/;L.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Zt.pop()||L.expando+"_"+Rt++;return this[e]=!0,e}}),L.ajaxPrefilter("json jsonp",(function(e,t,r){var i,o,s,a=!1!==e.jsonp&&(Kt.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&Kt.test(e.data)&&"data");if(a||"jsonp"===e.dataTypes[0])return i=e.jsonpCallback=x(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(Kt,"$1"+i):!1!==e.jsonp&&(e.url+=(St.test(e.url)?"&":"?")+e.jsonp+"="+i),e.converters["script json"]=function(){return s||L.error(i+" was not called"),s[0]},e.dataTypes[0]="json",o=n[i],n[i]=function(){s=arguments},r.always((function(){void 0===o?L(n).removeProp(i):n[i]=o,e[i]&&(e.jsonpCallback=t.jsonpCallback,Zt.push(i)),s&&x(o)&&o(s[0]),s=o=void 0})),"script"})),y.createHTMLDocument=(($t=s.implementation.createHTMLDocument("").body).innerHTML="<form></form><form></form>",2===$t.childNodes.length),L.parseHTML=function(e,t,n){return"string"!=typeof e?[]:("boolean"==typeof t&&(n=t,t=!1),t||(y.createHTMLDocument?((r=(t=s.implementation.createHTMLDocument("")).createElement("base")).href=s.location.href,t.head.appendChild(r)):t=s),o=!n&&[],(i=W.exec(e))?[t.createElement(i[1])]:(i=Ee([e],t,o),o&&o.length&&L(o).remove(),L.merge([],i.childNodes)));var r,i,o},L.fn.load=function(e,t,n){var r,i,o,s=this,a=e.indexOf(" ");return a>-1&&(r=Tt(e.slice(a)),e=e.slice(0,a)),x(t)?(n=t,t=void 0):t&&"object"==typeof t&&(i="POST"),s.length>0&&L.ajax({url:e,type:i||"GET",dataType:"html",data:t}).done((function(e){o=arguments,s.html(r?L("<div>").append(L.parseHTML(e)).find(r):e)})).always(n&&function(e,t){s.each((function(){n.apply(this,o||[e.responseText,t,e])}))}),this},L.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],(function(e,t){L.fn[t]=function(e){return this.on(t,e)}})),L.expr.pseudos.animated=function(e){return L.grep(L.timers,(function(t){return e===t.elem})).length},L.offset={setOffset:function(e,t,n){var r,i,o,s,a,l,u=L.css(e,"position"),c=L(e),f={};"static"===u&&(e.style.position="relative"),a=c.offset(),o=L.css(e,"top"),l=L.css(e,"left"),("absolute"===u||"fixed"===u)&&(o+l).indexOf("auto")>-1?(s=(r=c.position()).top,i=r.left):(s=parseFloat(o)||0,i=parseFloat(l)||0),x(t)&&(t=t.call(e,n,L.extend({},a))),null!=t.top&&(f.top=t.top-a.top+s),null!=t.left&&(f.left=t.left-a.left+i),"using"in t?t.using.call(e,f):c.css(f)}},L.fn.extend({offset:function(e){if(arguments.length)return void 0===e?this:this.each((function(t){L.offset.setOffset(this,e,t)}));var t,n,r=this[0];return r?r.getClientRects().length?(t=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:t.top+n.pageYOffset,left:t.left+n.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if("fixed"===L.css(r,"position"))t=r.getBoundingClientRect();else{for(t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;e&&(e===n.body||e===n.documentElement)&&"static"===L.css(e,"position");)e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=L(e).offset()).top+=L.css(e,"borderTopWidth",!0),i.left+=L.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-L.css(r,"marginTop",!0),left:t.left-i.left-L.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map((function(){for(var e=this.offsetParent;e&&"static"===L.css(e,"position");)e=e.offsetParent;return e||se}))}}),L.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},(function(e,t){var n="pageYOffset"===t;L.fn[e]=function(r){return V(this,(function(e,r,i){var o;if(g(e)?o=e:9===e.nodeType&&(o=e.defaultView),void 0===i)return o?o[t]:e[r];o?o.scrollTo(n?o.pageXOffset:i,n?i:o.pageYOffset):e[r]=i}),e,r,arguments.length)}})),L.each(["top","left"],(function(e,t){L.cssHooks[t]=Ye(y.pixelPosition,(function(e,n){if(n)return n=qe(e,t),je.test(n)?L(e).position()[t]+"px":n}))})),L.each({Height:"height",Width:"width"},(function(e,t){L.each({padding:"inner"+e,content:t,"":"outer"+e},(function(n,r){L.fn[r]=function(i,o){var s=arguments.length&&(n||"boolean"!=typeof i),a=n||(!0===i||!0===o?"margin":"border");return V(this,(function(t,n,i){var o;return g(t)?0===r.indexOf("outer")?t["inner"+e]:t.document.documentElement["client"+e]:9===t.nodeType?(o=t.documentElement,Math.max(t.body["scroll"+e],o["scroll"+e],t.body["offset"+e],o["offset"+e],o["client"+e])):void 0===i?L.css(t,n,a):L.style(t,n,i,a)}),t,s?i:void 0,s)}}))})),L.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),(function(e,t){L.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}})),L.fn.extend({hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),L.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)}}),L.proxy=function(e,t){var n,r,i;if("string"==typeof t&&(n=e[t],t=e,e=n),x(e))return r=l.call(arguments,2),(i=function(){return e.apply(t||this,r.concat(l.call(arguments)))}).guid=e.guid=e.guid||L.guid++,i},L.holdReady=function(e){e?L.readyWait++:L.ready(!0)},L.isArray=Array.isArray,L.parseJSON=JSON.parse,L.nodeName=A,L.isFunction=x,L.isWindow=g,L.camelCase=$,L.type=_,L.now=Date.now,L.isNumeric=function(e){var t=L.type(e);return("number"===t||"string"===t)&&!isNaN(e-parseFloat(e))},void 0===(r=function(){return L}.apply(t,[]))||(e.exports=r);var Qt=n.jQuery,Jt=n.$;return L.noConflict=function(e){return n.$===L&&(n.$=Jt),e&&n.jQuery===L&&(n.jQuery=Qt),L},i||(n.jQuery=n.$=L),L}))}]);
  //# sourceMappingURL=webglviewer.min.js.map