From 50c8343b04f292c0a35263d754fe666364e12dde Mon Sep 17 00:00:00 2001 From: MiiBond Date: Mon, 27 Mar 2017 14:34:36 -0700 Subject: [PATCH] Fix: Guard against unsupported lose_context extension on IE11 and Edge (#21) --- .../model3d/0.112.0/box3d-runtime.min.js | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/third-party/model3d/0.112.0/box3d-runtime.min.js b/src/third-party/model3d/0.112.0/box3d-runtime.min.js index 38eb8c879..6171456a8 100644 --- a/src/third-party/model3d/0.112.0/box3d-runtime.min.js +++ b/src/third-party/model3d/0.112.0/box3d-runtime.min.js @@ -1,18 +1,18 @@ -(function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("THREE")):"function"==typeof define&&define.amd?define("Box3D",["THREE"],t):"object"==typeof exports?exports.Box3D=t(require("THREE")):e.Box3D=t(e.THREE)})(this,function(e){return function(e){function t(i){if(r[i])return r[i].exports;var n=r[i]={i:i,l:!1,exports:{}};return e[i].call(n.exports,n,n.exports,t),n.l=!0,n.exports}var r={};return t.m=e,t.c=r,t.i=function(e){return e},t.d=function(e,r,i){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:i})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=265)}([function(e,t,r){"use strict";function i(e,t){function r(){this.constructor=e}g(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function n(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var n=0,i=Object.getOwnPropertySymbols(e);n=0;s--)(n=e[s])&&(o=(a<3?n(o):a>3?n(t,r,o):n(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o}function o(e,t){return function(r,i){t(r,i,e)}}function s(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function u(e,t,r,i){return new(r||(r=Promise))(function(n,a){function o(e){try{u(i.next(e))}catch(e){a(e)}}function s(e){try{u(i.throw(e))}catch(e){a(e)}}function u(e){e.done?n(e.value):new r(function(t){t(e.value)}).then(o,s)}u((i=i.apply(e,t||[])).next())})}function p(e,t){function r(e){return function(t){return i([e,t])}}function i(r){if(n)throw new TypeError("Generator is already executing.");for(;u;)try{if(n=1,a&&(o=a[2&r[0]?"return":r[0]?"throw":"next"])&&!(o=o.call(a,r[1])).done)return o;switch(a=0,o&&(r=[0,o.value]),r[0]){case 0:case 1:o=r;break;case 4:return u.label++,{value:r[1],done:!1};case 5:u.label++,a=r[1],r=[0];continue;case 7:r=u.ops.pop(),u.trys.pop();continue;default:if(o=u.trys,!(o=o.length>0&&o[o.length-1])&&(6===r[0]||2===r[0])){u=0;continue}if(3===r[0]&&(!o||r[1]>o[0]&&r[1]=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}}function h(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var i,n,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(i=a.next()).done;)o.push(i.value)}catch(e){n={error:e}}finally{try{i&&!i.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}return o}function d(){for(var e=[],t=0;t=e&&(t.engine.off("update",i,t),t.trigger("endTimer"))};this.engine.on("update",i,this)},t}(t.baseEntityMixins);f.events={load:{params:[],action:!1,category:"Loading"},loadBase:{params:[],action:!1,category:"Loading"},loadDependencies:{params:[],action:!1,category:"Loading"},startTimer:{params:[{name:"time",description:"The time (in seconds) that will elapse before the 'endTimer' event will be fired.",type:"f",default:5}],action:!0,category:"General"},endTimer:{params:[],action:!1,category:"General"}},f.validators={},f.defaults={},t.default=f},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i,n=r(0),a=r(1),o=r(6),s=r(3);(function(e){e[e.Normal=101]="Normal",e[e.Stereo2dOverUnder=102]="Stereo2dOverUnder",e[e.Stereo2dUnderOver=103]="Stereo2dUnderOver",e[e.Stereo2dLeftRight=104]="Stereo2dLeftRight",e[e.Stereo2dRightLeft=105]="Stereo2dRightLeft",e[e.StereoCubeHorizontal=106]="StereoCubeHorizontal"})(i=t.ImageLayout||(t.ImageLayout={}));var u=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.loadedBytes=0,t}return n.__extends(t,e),t.getThreeImageFormat=function(e){switch(e){case"alpha":return a.AlphaFormat;case"rgb":return a.RGBFormat;case"rgba":return a.RGBAFormat;case"luminance":return a.LuminanceFormat;case"luminanceAlpha":return a.LuminanceAlphaFormat;default:return s.default.warn("Unexpected format: "+e+", defaulting to THREE.RGBFormat"),a.RGBFormat}},t.getThreeImageEncoding=function(e){switch(e){case"linear":return a.LinearEncoding;case"srgb":return a.sRGBEncoding;case"gamma":return a.GammaEncoding;case"rgbe":return a.RGBEEncoding;case"logLuv":return a.LogLuvEncoding;case"rgbm7":return a.RGBM7Encoding;case"rgbm16":return a.RGBM16Encoding;case"rgbd":return a.RGBDEncoding;case"depth":return a.BasicDepthPacking;case"rgbaDepth":return a.RGBADepthPacking;default:return s.default.warn("Unexpected format: "+e+", defaulting to THREE.sRGBEncoding"),a.sRGBEncoding}},t.getThreeImageType=function(e){switch(e){case"uByte":return a.UnsignedByteType;case"byte":return a.ByteType;case"short":return a.ShortType;case"uShort":return a.UnsignedShortType;case"int":return a.IntType;case"uInt":return a.UnsignedIntType;case"float":return a.FloatType;case"halfFloat":return a.HalfFloatType;case"uShort4444":return a.UnsignedShort4444Type;case"uShort5551":return a.UnsignedShort5551Type;case"uShort565":return a.UnsignedShort565Type;default:return s.default.warn("Unexpected format: "+e+", defaulting to THREE.UnsignedByteType"),a.UnsignedByteType}},t.getBytesPerPixel=function(e,r){var i=0;switch(r){case"float":case"uInt":case"int":i=4;break;case"halfFloat":case"short":case"uShort":i=2;break;case"uByte":case"byte":i=1;break;case"uShort4444":case"uShort5551":case"uShort565":return 2}return t.getChannelCount(e)*i},t.getChannelCount=function(e){switch(e){case"alpha":case"luminance":return 1;case"luminanceAlpha":return 2;case"rgb":return 3;case"rgba":return 4;default:return 0}},t.prototype.unload=function(){this.loadedBytes=0,e.prototype.unload.call(this)},t.prototype.getChosenRepresentation=function(){return this.chosenRepresentation},t.prototype.getEncoding=function(){var e=this.getProperty("encoding");if(e)return e;var t=this.getChosenRepresentation();if(t)switch(t.colorspace){case"rgb":case"gray":return"linear";default:return"srgb"}return"srgb"},t.prototype.getDataSizeLoadedSelf=function(){return this.loadedBytes},t.prototype.applyPropertiesUnloaded=function(t){void 0===t&&(t={}),e.prototype.applyPropertiesUnloaded.call(this,t),this.engine.trigger("imageChanged",this.id,t)},t.prototype.getChannelCount=function(e){var r=e||this.getFormat();return t.getChannelCount(r)},t.prototype.getBytesPerPixel=function(){return t.getBytesPerPixel(this.getFormat(),this.getDataType())},t.prototype.getFormat=function(){return this.getProperty("format")},t.prototype.getDataType=function(){return this.getSupportedType(this.getProperty("type"))},t.prototype.getDataSizeDownloadSelf=function(){return this.chosenRepresentation?this.chosenRepresentation.contentLength:1},t.prototype.getSupportedType=function(e){var t=e,r=this.engine.getThreeRenderer(),i=r.extensions;switch(e){case"float":if(i.get("OES_texture_float")){t="float";break}case"halfFloat":t=i.get("OES_texture_half_float")?"halfFloat":"uByte";break;default:t=e}return t},t.prototype.getMipCount=function(){var e=this.getWidth(),t=this.getHeight(),r=Math.max(e,t);return Math.floor(Math.log2(Math.max(r,1)))+1},t.prototype.isPowerOfTwo=function(){var e=this.getWidth(),t=this.getHeight();return a.Math.isPowerOfTwo(e)&&a.Math.isPowerOfTwo(t)},t.prototype.getWidth=function(){var e=this.getMaxRepresentationWidth(),t=this.getMaxTextureSize();return Math.max(1,Math.min(t,e))},t.prototype.getHeight=function(){var e=this.getMaxRepresentationHeight(),t=this.getMaxTextureSize();return Math.max(1,Math.min(t,e))},t.prototype.getMaxRepresentationWidth=function(){return 0},t.prototype.getMaxRepresentationHeight=function(){return 0},t.prototype.getOriginalWidth=function(){return 0},t.prototype.getOriginalHeight=function(){return 0},t.prototype.getMaxTextureSize=function(){return Number.MAX_VALUE},t}(o.default);t.default=u},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(3),a=r(1),o=r(9),s=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i.__extends(t,e),t.prototype.initialize=function(){e.prototype.initialize.call(this),this.on("setVisible",this.setVisible,this),this.on("setInvisible",this.setInvisible,this),this.on("toggleVisibility",this.toggleVisibility,this),this.on("change:children",this.onChildrenChanged,this)},t.prototype.uninitialize=function(){this.off("setVisible",this.setVisible,this),this.off("setInvisible",this.setInvisible,this),this.off("toggleVisibility",this.toggleVisibility,this),this.off("change:children",this.onChildrenChanged,this),this.uninitPrefabBindings(),e.prototype.uninitialize.call(this)},t.prototype.getRootObject=function(){var e=this.getParentObject();return e?e.getRootObject():this},t.prototype.reset=function(){this.runtimeData&&(this.runtimeData.position.copy(this.getPosition()),this.runtimeData.quaternion.copy(this.getQuaternion()),this.runtimeData.scale.copy(this.getScale()))},t.prototype.createRuntimeData=function(e){this.runtimeData=new a.Object3D,this.runtimeData.name=this.getRuntimeName(),e()},t.prototype.clone=function(t,r){void 0===r&&(r=!0);var i=e.prototype.clone.call(this);if(i.set("parentId",null),i.set("prefabAssetId",this.get("prefabAssetId")),i.set("prefabObjectId",this.get("prefabObjectId")),r){var n=this.getChildren();n.forEach(function(e){var t=e.clone(void 0,r);i.addChild(t)}),this.isInstanceTop()&&(i.set("prefabInstanceId",i.id),i.traverse(function(e){e.set("prefabInstanceId",i.id)}))}return i},t.prototype.alignToPosition=function(e,t){var r=new a.Vector3(e.x||0,e.y||0,e.z||0),n=this.getQuaternion(),o=this.getScale(),s=this.getCenter(),u=new a.Quaternion(n.x,n.y,n.z,n.w),p=this.getBounds(),c={}; -c.min=new a.Vector3(p.min.x,p.min.y,p.min.z),c.max=new a.Vector3(p.max.x,p.max.y,p.max.z),c.min.applyQuaternion(u),c.max.applyQuaternion(u);var l=new a.Vector3(s.x,s.y,s.z);l.applyQuaternion(u),c.min.multiply(o),c.max.multiply(o),l.multiply(o),t&&Object.keys(t).forEach(function(e){var i=Math.min(c.min[e],c.max[e]),n=Math.max(c.min[e],c.max[e]),a=.5*t[e]+.5;r[e]-=(1-a)*i+a*n}),this.setProperty("position",i.__assign({},r))},t.prototype.getPosition=function(e){var t=e||new a.Vector3;return t.copy(this.getProperty("position")),t},t.prototype.setPosition=function(e,t,r){if(void 0===r)throw new Error("Calling setPosition with invalid arguments. Expected setPosition( x, y, z ).");this.setProperty("position",{x:e,y:t,z:r})},t.prototype.getQuaternion=function(e){var t=e||new a.Quaternion;return t.copy(this.getProperty("quaternion")),t},t.prototype.setQuaternion=function(e,t,r,i){if(void 0===i)throw new Error("Calling setQuaternion with invalid arguments. Expected setQuaternion( x, y, z, w ).");this.setProperty("quaternion",{x:e,y:t,z:r,w:i})},t.prototype.getScale=function(e){var t=e||new a.Vector3;return t.copy(this.getProperty("scale")),t},t.prototype.setScale=function(e,t,r){if(void 0===r)throw new Error("Calling setScale with invalid arguments. Expected setScale( x, y, z ).");this.setProperty("scale",{x:e,y:t,z:r})},t.prototype.getCenter=function(e){var t=e||new a.Vector3,r=this.getBounds();return t.copy(r.min),t.add(r.max),t.multiplyScalar(.5),t},t.prototype.setVisible=function(){this.setProperty("visible",!0),this.engine.needsRender=!0},t.prototype.setInvisible=function(){this.setProperty("visible",!1),this.engine.needsRender=!0},t.prototype.toggleVisibility=function(){var e=!this.getProperty("visible");this.setProperty("visible",e),this.engine.needsRender=!0},t.prototype.loadBase=function(t){e.prototype.loadBase.call(this,t),this.isInstance()&&this.initPrefabBindings()},t.prototype.reloadBase=function(t){var r=this;this.isInstance()&&this.uninitPrefabBindings();var i=this.runtimeData&&this.runtimeData.parent;i&&i.remove(this.runtimeData);var n=this.runtimeData&&this.runtimeData.children;e.prototype.reloadBase.call(this,function(){i&&i.add(r.runtimeData),n&&n.forEach(function(e){return r.runtimeData.add(e)}),"function"==typeof t&&t()})},t.prototype.unload=function(t){var r=this;if(void 0===t&&(t=!1),this.runtimeData&&this.runtimeData.parent&&this.runtimeData.parent.remove(this.runtimeData),t){var i=this.getChildIds();i.forEach(function(e){var i=r.engine.getObjectById(e);i&&i.unload(t)})}e.prototype.unload.call(this)},t.prototype.destroy=function(){this.engine.destroyObjectById(this.id)},t.prototype.traverse=function(e){var t=this,r=this.getChildren();r.forEach(function(r){e(r,t),r.traverse(e)})},t.prototype.traverseWhile=function(e){var t=this,r=this.getChildren();return r.some(function(r){return e(r,t)||r.traverseWhile(e)})},t.prototype.traverseSome=function(e){var t=this,r=this.getChildren();r.forEach(function(r){e(r,t)||r.traverseSome(e)})},t.prototype.getAncestors=function(e){var t=this.getParentObject();return t?e&&!e(t)?t.getAncestors(e):[t].concat(t.getAncestors(e)):[]},t.prototype.getDescendants=function(e){var t=[],r="function"!=typeof e;return this.traverse(function(i){(r||e(i))&&t.push(i)}),t},t.prototype.getDescendant=function(e){var t,r="function"!=typeof e;return this.traverseWhile(function(i){if(!t&&(r||e(i)))return t=i,!0}),t},t.prototype.getDescendantById=function(e){return this.getDescendant(function(t){return t.id===e})},t.prototype.getDescendantByName=function(e){return this.getDescendant(function(t){return t.getName()===e})},t.prototype.getDescendantByType=function(e){return this.getDescendant(function(t){return t.type===e})},t.prototype.getDescendantByClass=function(e){return this.getDescendant(function(t){return t instanceof e})},t.prototype.getDescendantsByType=function(e){return this.getDescendants(function(t){return t.type===e})},t.prototype.getDescendantsByClass=function(e){return this.getDescendants(function(t){return t instanceof e})},t.prototype.getDescendantsByName=function(e){return this.getDescendants(function(t){return t.getName()===e})},t.prototype.getChildById=function(e){return this.sharedData.children.indexOf(e)!==-1?this.engine.getObjectById(e):null},t.prototype.getChild=function(e){var t=this.getChildren(e);return t.length?t[0]:null},t.prototype.getChildren=function(e){var t=this,r=this.getChildIds(),i="function"!=typeof e;return r.filter(function(r){var n=t.getChildById(r);return n&&(i||e(n))}).map(function(e){return t.engine.getObjectById(e)})},t.prototype.getChildrenMap=function(e){var t={},r=this.getChildren(e);return r.forEach(function(e){e&&(t[e.id]=e)}),t},t.prototype.getParentObject=function(){return this.engine.getObjectById(this.get("parentId"))},t.prototype.addChild=function(e,t){this.addChildById(e.id,t)},t.prototype.addChildById=function(e,t){var r=this.engine.getObjectById(e);if(!r)throw new Error("Can't find child object with id, "+e);this.engine.entityDispatcher.dispatchChildAdded(this.id,e,t)},t.prototype.removeChild=function(e,t){this.removeChildById(e.id,t)},t.prototype.removeChildById=function(e,t){var r=this.getChildById(e);if(!r)throw new Error("Object, "+e+", is not a child of this object");this.engine.entityDispatcher.dispatchChildRemoved(this.id,e,t)},t.prototype.getChildIds=function(e){var t="function"!=typeof e;return t?this.sharedData.children.slice():this.sharedData.children.filter(function(t){return e(t)})},t.prototype.setChildIds=function(e,t){void 0===t&&(t=!1),this.engine.entityDispatcher.dispatchChildChanged(this.id,e,t)},t.prototype.scaleToSize=function(e){var t={},r=this.getBounds();t.min=new a.Vector3(r.min.x,r.min.y,r.min.z),t.max=new a.Vector3(r.max.x,r.max.y,r.max.z);var i=t.min.distanceTo(t.max),n=e/i;n<=0&&(n=1),this.setProperty("scale",{x:n,y:n,z:n})},t.prototype.getBounds=function(e){var t=this.getProperty("bounds"),r=e||new a.Box3;return t?r.set(t.min,t.max):this.computeBounds(r)},t.prototype.getSphericalBounds=function(e){var t=e||new a.Sphere,r=this.getBounds();return t.radius=t.center.subVectors(r.max,r.min).multiplyScalar(.5).length(),t.center.addVectors(r.max,r.min).multiplyScalar(.5),t},t.prototype.getLocalBounds=function(e){var t=e||new a.Box3;return t.min.set(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),t.max.set(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE),t},t.prototype.computeBounds=function(e){var t=this.getChildren(),r=this.getLocalBounds(e||new a.Box3),i=new a.Matrix4;return t.forEach(function(e){var t=e.computeBounds();t.isEmpty()||(i.compose(e.getPosition(),e.getQuaternion(),e.getScale()),t.applyMatrix4(i),r.union(t))}),this.setProperty("bounds",{min:{x:r.min.x,y:r.min.y,z:r.min.z},max:{x:r.max.x,y:r.max.y,z:r.max.z}}),r},t.prototype.getPreviousProperty=function(e){var t=this.sharedData.previousProperties[e];if(void 0!==t)return t;var r=this.getPrefabObject();return r?r.getProperty(e):this.getDefaultProperty(e)},t.prototype.getProperty=function(e){var t=this.getOwnProperty(e);if(void 0!==t)return t;var r=this.getPrefabProperty(e);return r?r:this.getDefaultProperty(e)},t.prototype.getProperties=function(){var e=this.getOwnProperties(),t=this.getPrefabObject(),r=this.getDefaultProperties();if(t){var i=t.getOwnProperties();return Object.assign(r,i,e)}return Object.assign(r,e)},t.prototype.getInstanceTop=function(){var e=this.get("prefabInstanceId");return e?this.engine.getObjectById(e):null},t.prototype.getPrefabObject=function(){return this.engine.getObjectById(this.get("prefabObjectId"))},t.prototype.getPrefabProperty=function(e){var t=this.getPrefabObject();if(t)return t.getProperty(e)},t.prototype.isInstance=function(){return!!this.get("prefabObjectId")},t.prototype.isInstanceTop=function(){return this.get("prefabInstanceId")===this.id},t.prototype.breakPrefabLink=function(e){if(void 0===e&&(e=!0),!this.isInstance())throw new Error("breakPrefabLink: Can't call this on an entity that isn't an instance.");e&&this.getChildren().forEach(function(t){t.breakPrefabLink(e)}),this.uninitPrefabBindings(),this.mergeProperties(this.getPrefabObject());var t={};t.prefabInstanceId=void 0,t.prefabObjectId=void 0,t.prefabAssetId=void 0},t.prototype.applyPropertiesLoaded=function(t,r){if(e.prototype.applyPropertiesLoaded.call(this,t,r),t.hasOwnProperty("static")){var i=this.getProperty("static");this.runtimeData.matrixAutoUpdate=!i,this.runtimeData.rotationAutoUpdate=!i,i&&(this.runtimeData.matrixWorldNeedsUpdate=!0,this.runtimeData.updateMatrix())}if(t.hasOwnProperty("visible")&&(this.runtimeData.visible=this.getProperty("visible")),t.hasOwnProperty("castShadow")&&(this.runtimeData.castShadow=this.getProperty("castShadow")),t.hasOwnProperty("receiveShadow")&&(this.runtimeData.receiveShadow=this.getProperty("receiveShadow")),t.hasOwnProperty("frustumCulled")&&(this.runtimeData.frustumCulled=this.getProperty("frustumCulled")),t.hasOwnProperty("position")){var n=this.getPosition();this.runtimeData.position.set(n.x,n.y,n.z)}if(t.hasOwnProperty("quaternion")){var a=this.getQuaternion();this.runtimeData.quaternion.set(a.x,a.y,a.z,a.w)}if(t.hasOwnProperty("scale")){var o=this.getScale();this.runtimeData.scale.set(o.x,o.y,o.z)}},t.prototype.getRuntimeName=function(){return this.engine.getRuntimeName(this.getSid())},t.prototype.initPrefabBindings=function(){var e=this.getPrefabObject();e&&e.on("propertyChanges",this.onPrefabEntityChanged,this)},t.prototype.uninitPrefabBindings=function(){var e=this.getPrefabObject();e&&e.off("propertyChanges",this.onPrefabEntityChanged,this)},t.prototype.onPrefabEntityChanged=function(){n.default.warn("TODO - re-implement updating from prefab changes")},t.prototype.onChildLoaded=function(e){var t=this;this.when("loadBase",function(){t.runtimeData.add(e.runtimeData),t.engine.needsRender=!0})},t.prototype.onChildrenChanged=function(e,t){var r=this;t.forEach(function(e){e&&(e.set("parentId",null),r.unregisterDependency(e),r.stopListening(e,"loadBase",r.onChildLoaded),r.isBaseLoaded()&&e.isBaseLoaded()&&(r.runtimeData.remove(e.runtimeData),r.engine.needsRender=!0))}),e.forEach(function(e){var t=e.getParentObject();t&&t.id!==r.id&&t.removeChildById(e.id,!0),e.set("parentId",r.id),r.listenTo(e,"loadBase",r.onChildLoaded),e.isBaseLoaded()&&(r.isBaseLoaded()?(r.runtimeData.add(e.runtimeData),r.engine.needsRender=!0):r.when("loadBase",function(){r.runtimeData.add(e.runtimeData),r.engine.needsRender=!0})),r.registerDependency(e)})},t}(o.default);s.events={toggleVisibility:{params:[],action:!0,category:"Rendering"},setVisible:{params:[],action:!0,category:"Rendering"},setInvisible:{params:[],action:!0,category:"Rendering"}},t.default=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i={LOAD:"load",STATE_CHANGE:"state_change",CANCEL:"cancel",ERROR:"error",PROGRESS:"progress",DONE:"done"};t.default=i},function(e,t,r){"use strict";function i(e,t){if(void 0!==e&&null!==e)return Array.isArray(e)?e.forEach(t):void Object.keys(e).forEach(function(r){t(e[r],r)})}function n(e){return Array.isArray(e)?[].concat.apply([],e.map(function(e){return n(e)})):e}function a(e,t){return e.reduce(function(e,r){return e[r[t]]=r,e},{})}function o(e,t){return n(u(e,t))}function s(e){return e}function u(e,t){var r;return void 0===e||null===e?e:Array.isArray(e)?e.map(t):(r={},Object.keys(e).forEach(function(i){r[i]=t(e[i],i)}),r)}function p(e,t){return Object.keys(e).reduce(function(r,i){return t.indexOf(i)===-1&&(r[i]=e[i]),r},{})}e.exports={each:i,flatMap:o,flatten:n,identity:s,indexBy:a,map:u,omit:p}},function(e,t,r){"use strict";function i(e,t){var r=Math.floor(e),i=t?t:{r:(r>>16&255)/255,g:(r>>8&255)/255,b:(255&r)/255};return i}Object.defineProperty(t,"__esModule",{value:!0});var n,a=r(0),o=r(3),s=r(1),u=r(6),p=r(5),c=r(4),l=r(222);(function(e){e[e.STANDIN_TEXTURE_WHITE=0]="STANDIN_TEXTURE_WHITE",e[e.STANDIN_TEXTURE_WHITE_CUBE=1]="STANDIN_TEXTURE_WHITE_CUBE",e[e.STANDIN_TEXTURE_BLACK=2]="STANDIN_TEXTURE_BLACK",e[e.STANDIN_TEXTURE_BLACK_CUBE=3]="STANDIN_TEXTURE_BLACK_CUBE",e[e.STANDIN_TEXTURE_NORMAL=4]="STANDIN_TEXTURE_NORMAL"})(n=t.StandInTexture||(t.StandInTexture={}));var h=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return a.__extends(t,e),t.prototype.initialize=function(){e.prototype.initialize.call(this),this.listenTo(this.engine,"textureDeleted",this.onTextureDeleted)},t.prototype.uninitialize=function(){e.prototype.uninitialize.call(this),this.stopListening(this.engine,"textureDeleted",this.onTextureDeleted)},t.prototype.getProperty=function(t){var r=e.prototype.getProperty.call(this,t);if(void 0===r){var i=this.getShader().getProperty("parameters");i[t]&&(r=i[t].default)}return r},t.prototype.getDefaultProperties=function(){var t=e.prototype.getDefaultProperties.call(this),r=this.getShader().getProperty("parameters");return Object.keys(r).forEach(function(e){t[e]=r[e].default}),t},t.prototype.verifyProperty=function(t,r){return"shader"!==t&&"enabledFeatures"!==t||e.prototype.verifyProperty.call(this,t,r)},t.prototype.setProperty=function(t,r,n){if("shader"===t||"enabledFeatures"===t)return e.prototype.setProperty.call(this,t,r,n);var a=this.getShader(),s=a.getProperty("parameters");if(s[t]){var u=s[t].type,p=void 0;if("t"===u&&("string"==typeof r||null===r)||"f"===u&&"number"==typeof r||"b"===u&&"boolean"==typeof r||"i"===u&&"number"==typeof r&&Math.round(r)===r||"opt"===u&&s[t].options.hasOwnProperty(r))p=r;else if("c"===u){if(p=this.sharedData.properties.hasOwnProperty(t)&&"object"==typeof this.sharedData.properties[t]?this.sharedData.properties[t]:{r:0,g:0,b:0},"string"==typeof r){var c=r;"0x"!==c.slice(0,2)&&(c=String(parseInt(c,10)),c="0x"+c.toString()),i(parseInt(c,16),p)}else if("number"==typeof r){var l=Math.max(0,Math.max(16777215,r));i(l,p)}else if(r&&"number"==typeof r.r&&"number"==typeof r.g&&"number"==typeof r.b){p.r=r.r,p.g=r.g,p.b=r.b;var h=s[t].min,d=s[t].max;void 0!==h&&(p.r=Math.max(p.r,h),p.g=Math.max(p.g,h),p.b=Math.max(p.b,h)),void 0!==d&&(p.r=Math.min(p.r,d),p.g=Math.min(p.g,d),p.b=Math.min(p.b,d))}}else"v"===u.charAt(0)&&"number"==typeof r.x&&"number"==typeof r.y?(p=this.sharedData.properties.hasOwnProperty(t)?this.sharedData.properties[t]:{},p.x=r.x,p.y=r.y,"v3"===u&&"number"==typeof r.z?p.z=r.z:"v4"===u&&"number"==typeof r.z&&"number"==typeof r.w&&(p.z=r.z,p.w=r.w)):"undefined"==typeof r?p=void 0:o.default.error("Wrong type specified for "+t);this.engine.entityDispatcher.dispatchPropertyChanged(this.id,t,p,n)}},t.prototype.getReferencedAssetsList=function(e){var t=this,r=[],i={},n=this.getShader(),a=n.getProperty("parameters"),o=n.getProperty("uniforms"),s=n.getProperty("features");return p.forEach(s,function(n,o){t.isFeatureEnabled(o)&&p.forEach(n.parameters,function(n){var o,s;"t"===a[n].type&&(t.isParameterUsed(n)&&(o=t.getProperty(n)),o&&(s=t.engine.getAssetById(o),i[o]?e&&r.push(s):(i[o]=s,r.push(s))))})}),p.forEach(o,function(n){"t"===n.type&&n.default&&t.getAssetById(n.default)&&(i[n.default]?e&&r.push(t.engine.getAssetById(n.default)):(i[n.default]=t.engine.getAssetById(n.default),r.push(t.engine.getAssetById(n.default))))}),r},t.prototype.getShader=function(){var t=e.prototype.getProperty.call(this,"shader");return this.engine.getAssetById(t)||(t=this.getDefaultProperty("shader")),this.engine.getAssetById(t)},t.prototype.isParameterEditable=function(e){var t=this,r=this.getShader(),i=!1;if(r){var n=r.getProperty("parameters"),a=r.getProperty("features");n[e]&&p.forEach(a,function(r,a){r.parameters.indexOf(e)!==-1&&t.isFeatureEnabled(a)&&(i=!n[e].displayWhen||t.testParameterConditions(n[e].displayWhen))})}return i},t.prototype.getStandInTexture=function(e,t){var r=this.engine.getAssetById(this.getProperty(e));if(r){var i;return t?"normal"===t?i=n.STANDIN_TEXTURE_NORMAL:"bump"===t&&(i=r.isCubeMap()?n.STANDIN_TEXTURE_BLACK:n.STANDIN_TEXTURE_BLACK_CUBE):i=r.isCubeMap()?n.STANDIN_TEXTURE_WHITE_CUBE:n.STANDIN_TEXTURE_WHITE,this.engine.materialUtilities.getStandInTexture(i)}},t.prototype.enableFeature=function(e,t){void 0===t&&(t=!1);var r=this.getShader(),i=this.getProperty("enabledFeatures"),n=r.getProperty("features"),o=a.__assign({},i);"undefined"!=typeof n[e]&&(o[e]=t,this.setProperty("enabledFeatures",o))},t.prototype.unload=function(){var t=this;if(this.getDependencies().forEach(function(e){return t.stopListening(e,"load")}),this.runtimeData){this.engine.trigger("materialUnloaded",this.id),o.default.info(this.engine.getName()+" - Unloading material, "+this.getName());for(var r in this.runtimeData)this.runtimeData.hasOwnProperty(r)&&(this.runtimeData[r].dispose(),delete this.runtimeData[r]);this.runtimeData=null,e.prototype.unload.call(this)}},t.prototype.isFeatureEnabled=function(e){var t=this.getShader(),r=this.getProperty("enabledFeatures"),i=t.getProperty("features");return"undefined"!=typeof i[e]&&(r&&void 0!==r[e]?r[e]:i[e].defaultEnabled||i[e].alwaysEnabled)},t.prototype.applyPropertiesLoaded=function(r,i){var n=this;if(e.prototype.applyPropertiesLoaded.call(this,r,i),r.hasOwnProperty("shader")){var a=this.getShader();a.when("load",function(){for(var e in t.materialObjectTypes)if(n.runtimeData.hasOwnProperty(e)){var r=n.runtimeData[e];r.fragmentShader=a.runtimeData.fragmentShader,r.vertexShader=a.runtimeData.vertexShader,r.uniforms=s.UniformsUtils.clone(a.runtimeData.uniforms),n.addSharedUniforms(r.uniforms);for(var i in a.runtimeData.renderParams)n.runtimeData[e].hasOwnProperty(i)&&(n.isParameterUsed(i)?n.runtimeData[e][i]=a.runtimeData.renderParams[i]:delete n.runtimeData[e][i]);n.runtimeData[e].needsUpdate=!0,n.updateMaterialDefines(),n.updateShaderParameters(n.getProperties()),n.updateTransparency(),n.updateDerivatives(),n.engine.needsRender=!0}}),a.isUnloaded()&&a.load()}else if(r.hasOwnProperty("enabledFeatures"))this.updateMaterialDefines(),this.updateShaderParameters(this.getProperties()),this.updateTransparency(),this.updateDerivatives(),this.engine.needsRender=!0;else{var o=this.getShader(),u=o.getProperty("parameters"),p=!1,c=!1,l=!1;for(var h in r)if(r.hasOwnProperty(h)&&u[h]){if(u[h].transparency&&(p=!0),"undefined"!=typeof u[h].derivatives&&(c=!0),o.getDependentParameters(h).length||u[h].forceUpdate){l=!0;break}this.updateShaderParameter(h)}l&&(this.updateMaterialDefines(),this.updateShaderParameters(this.getProperties()),p=!0,c=!0),p&&this.updateTransparency(),c&&this.updateDerivatives(),this.engine.needsRender=!0}},t.prototype.applyPropertiesUnloaded=function(t){var r=this;void 0===t&&(t={}),e.prototype.applyPropertiesUnloaded.call(this,t);var i,n,a=this.getShader(),o=a.getProperty("parameters"),s=!1;t&&(p.forEach(t,function(e,t){o[t]&&("t"===o[t].type&&(i=r.getProperty(t),n=r.getPreviousProperty(t),r.isParameterUsed(t)?n!==i&&(r.registerDependencyById(i),r.unregisterDependencyById(n)):n!==i&&(s=!0)),(a.getDependentParameters(t).length||o[t].forceUpdate)&&(s=!0))}),(t.enabledFeatures||s)&&this.resetDependencies())},t.prototype.createRuntimeData=function(e){var r=this,i=this.getShader();i.when("load",function(){r.runtimeData={},Object.keys(t.materialObjectTypes).forEach(function(e){var n={};n.vertexShader=i.runtimeData.vertexShader,n.fragmentShader=i.runtimeData.fragmentShader,n.uniforms=s.UniformsUtils.clone(i.runtimeData.uniforms),r.addSharedUniforms(n.uniforms),r.runtimeData[e]=new s.ShaderMaterial(n),r.runtimeData[e].name=r.getName();for(var a in i.runtimeData.renderParams)r.runtimeData[e].hasOwnProperty(a)&&(r.isParameterUsed(a)?r.runtimeData[e][a]=i.runtimeData.renderParams[a]:delete r.runtimeData[e][a]);var o=t.materialObjectTypes[e];p.forEach(o,function(t,i){r.runtimeData[e].hasOwnProperty(i)&&(r.runtimeData[e][i]=t)})}),r.updateMaterialDefines(),e()},this),i.load()},t.prototype.testParameterCondition=function(e,t){var r=this.getShader(),i=r.getProperty("parameters");if(!i[e])return!1;var n=this.getProperty(e);"t"===i[e].type&&(this.engine.getAssetById(n)||(n=null));for(var a in t)if(t.hasOwnProperty(a))switch(a){case"equals":if(n!==t[a])return!1;break;case"notEquals":if(n===t[a])return!1;break;case"equalsDefault":if(n!==i[e].default)return!1;break;case"notEqualsDefault":if(n===i[e].default)return!1;break;default:return!1}return!0},t.prototype.testParameterConditions=function(e){var t=!0;for(var r in e)if(e.hasOwnProperty(r))if("or"===r){if(!this.testParameterConditionsOr(e[r])){t=!1;break}}else if(!this.testParameterCondition(r,e[r])){t=!1;break}return t},t.prototype.testParameterConditionsOr=function(e){for(var t=!1,r=0,i=e;r1)return!0;return!1},t.prototype.isParameterUsed=function(e){var t,r,i=this,n=this.getShader(),a=!1;return n&&(t=n.getProperty("parameters"),r=n.getProperty("features"),t[e]&&p.forEach(r,function(r,n){r.parameters.indexOf(e)!==-1&&i.isFeatureEnabled(n)&&(a=!t[e].enabledWhen||i.testParameterConditions(t[e].enabledWhen))})),a},t.prototype.onTextureLoaded=function(e){var r=this;if(!e.isLoadFailed()){var i=e.getThreeTexture();if(i){var n=this.getShader(),a=n.getProperty("parameters"),o=Object.keys(a).filter(function(t){return"t"===a[t].type&&r.isParameterUsed(t)&&r.getProperty(t)===e.id});o.forEach(function(e){r.setThreeValue(e,i)});var s=o.some(function(e){return a[e].forceUpdate});s&&Object.keys(t.materialObjectTypes).forEach(function(e){r.runtimeData[e].needsUpdate=!0}),this.engine.needsRender=!0}}},t.prototype.updateShaderParameter=function(e){var r=this,i=this.getShader(),n=i.getProperty("parameters"),a=n[e];if(a){var o=!0,s=this.getProperty(e);switch(a.type.charAt(0)){case"t":var u=this.engine.getAssetById(s);if(u&&this.isParameterUsed(e)){var p=this.getPreviousProperty(e);if(p!==this.getProperty(e)){var c=this.engine.getEntityById(p);c&&this.stopListening(c,"load",this.onTextureLoaded)}this.stopListening(u,"load",this.onTextureLoaded),this.listenTo(u,"load",this.onTextureLoaded),s=this.getStandInTexture(e,a.textureUsage),this.engine.needsRender=!0,u.isUnloaded()?u.load():u.isLoaded()&&this.onTextureLoaded.call(this,u),u.isLoaded()&&(o=!1)}else s=null;break;case"b":a.animation&&s&&(t.timeValueInUse=!0),s=s?1:0;break;case"v":a.animation&&(s.x||s.y||s.z||s.w)&&(t.timeValueInUse=!0);break;case"o":s=a.options[s]}o&&this.setThreeValue(e,s),a.forceUpdate&&Object.keys(t.materialObjectTypes).forEach(function(e){r.runtimeData[e].needsUpdate=!0})}},t.prototype.getThreeValue=function(e,t){var r,i=this.getShader(),n=i.getProperty("parameters"),a=n[e],o=a.uniformName||e;if(a.isRenderParam)r=this.runtimeData[t][o];else if(a.isUniform){var u=this.runtimeData[t].uniforms[o];r=u?u.value:null}if("c"===a.type)r||(r=new s.Color(a.default.r,a.default.g,a.default.b));else if("v"===a.type.charAt(0)&&!r){var p=a.default;switch(a.type.charAt(1)){case"4":r=new s.Vector4(p.x,p.y,p.z,p.w);break;case"3":r=new s.Vector3(p.x,p.y,p.z);break;case"2":r=new s.Vector2(p.x,p.y)}}return r},t.prototype.setThreeValue=function(e,r){var i=this;if(this.runtimeData){var n=this.getShader(),a=n.getProperty("parameters"),o=a[e],s=o.uniformName||e;Object.keys(t.materialObjectTypes).forEach(function(t){var n=i.getThreeValue(e,t);if("c"===o.type)n.setRGB(r.r,r.g,r.b);else if("v"===o.type.charAt(0))switch(o.type.charAt(1)){case"4":n.w=r.w;case"3":n.z=r.z;case"2":n.x=r.x,n.y=r.y}else"t"===o.type?(n&&r&&n.encoding===r.encoding&&n.mapping===r.mapping||(i.runtimeData[t].needsUpdate=!0),n=r):n=r;if(o.isUniform){var a=i.runtimeData[t].uniforms[s];if(!a)throw new Error("Trying to set non-existent uniform "+s);a.value=n}o.isRenderParam&&(i.runtimeData[t][s]=n)})}},t.prototype.setExtension=function(e,r){var i=this;this.runtimeData&&Object.keys(t.materialObjectTypes).forEach(function(t){i.runtimeData[t].extensions.hasOwnProperty(e)&&(i.runtimeData[t].extensions[e]=r)})},t.prototype.onTextureDeleted=function(e){var t=this,r=this.getOwnProperties(),i=Object.keys(r).filter(function(t){return r[t]===e});i.forEach(function(e){t.setProperty(e,null)})},t}(u.default);h.builtInAssetDescriptors={missingMaterial:{id:"missingMaterial",type:"material",properties:{name:"Missing Material",albedoColor:{r:.8275,g:.8275,b:.8275}}}},h.materialObjectTypes={static:{lights:!0,fog:!0,skinning:!1},skinned:{lights:!0,fog:!0,skinning:!0},staticTangents:{lights:!0,fog:!0,skinning:!1,defines:{USE_TANGENTS:!0}},skinnedTangents:{lights:!0,fog:!0,skinning:!0,defines:{USE_TANGENTS:!0}},depthStatic:{lights:!1,fog:!1,vertexColors:s.NoColors,skinning:!1,defines:{DEPTH_PASS:!0}},depthSkinned:{lights:!1,fog:!1,vertexColors:s.NoColors,skinning:!0,defines:{DEPTH_PASS:!0}}},h.sharedUniforms={time:{type:"f",value:0},screenDimensions:{type:"v4",value:new s.Vector4}},h.timeValueInUse=!1,c.addSchemas("MaterialAsset",h),t.default=h},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(41),a=i.__assign({},n.default,{id:"baseObject",title:"BaseObjectDef",properties:i.__assign({},n.default.properties,{parentId:{type:"string",description:"The ID of the entity's parent."},prefabAssetId:{type:"string"},prefabObjectId:{type:"string"},prefabInstanceId:{type:"string"},children:{type:"array",items:{type:"string"},default:[],description:"The IDs of this entity's children."},properties:{$ref:"baseObjectProperties.json"}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(e){if("node"===e)return e;var t,r=e.match(/(edge(?=\/))\/?\s*(\d+)/i)||[],i=e.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i)||[];return r.length&&(i=r),/trident/i.test(i[1])?(t=/\brv[ :]+(\d+)/g.exec(e)||[],"IE "+(t[1]||"")):"Chrome"===i[1]&&(t=e.match(/\bOPR\/(\d+)/),null!=t)?"Opera "+t[1]:(i=i[2]?[i[1],i[2]]:[navigator.appName,navigator.appVersion,"-?"],t=e.match(/version\/(\d+)/i),null!=t&&i.splice(1,1,t[1]),i.join(" "))},n={isMobile:void 0,isIOS:void 0,isAndroid:void 0,isMac:void 0,isLinux:void 0,isUnix:void 0,isWindows:void 0,isChrome:void 0,isFirefox:void 0,isSafari:void 0,isOpera:void 0,isEdge:void 0,isIpad:void 0,isNode:void 0,isIE:void 0,isIE11:void 0,isAndroidTablet:void 0,isTablet:void 0},a="undefined"!=typeof navigator?navigator.userAgent:"node",o=function(){var e=i(a),t={isMobile:/iphone|ipad|ipod|android|blackberry|bb10|mini|windows\sce|palm/i.test(a),isIOS:/iphone|ipad|ipod/i.test(a),isAndroid:/android/i.test(a),isMac:/mac/i.test(a),isLinux:/linux/i.test(a),isUnix:/x11/i.test(a),isWindows:/windows/i.test(a),isChrome:/chrome/i.test(a),isFirefox:/firefox/i.test(a),isSafari:/safari/i.test(a),isOpera:/opera/i.test(a),isEdge:/edge/i.test(a),isIpad:/ipad/i.test(a),isNode:"node"===a,isIE:/ie/i.test(e),isIE11:/ie 11/i.test(e)};t.isAndroidTablet=t.isAndroid&&!/mobile/i.test(a),t.isTablet=t.isIpad||t.isAndroidTablet,Object.keys(t).forEach(function(e){n[e]=t[e]})};o(),t.setUserAgent=function(e){a=e,o()},t.isMobile=function(){return n.isMobile},t.isIOS=function(){return n.isIOS},t.isAndroid=function(){return n.isAndroid},t.isMac=function(){return n.isMac},t.isLinux=function(){return n.isLinux},t.isUnix=function(){return n.isUnix},t.isWindows=function(){return n.isWindows},t.isChrome=function(){return n.isChrome},t.isFirefox=function(){return n.isFirefox},t.isSafari=function(){return n.isSafari},t.isOpera=function(){return n.isOpera},t.isEdge=function(){return n.isEdge},t.isAndroidTablet=function(){return n.isAndroidTablet},t.isIpad=function(){return n.isIpad},t.isTablet=function(){return n.isTablet},t.isIE=function(){return n.isIE},t.isIE11=function(){return n.isIE11},t.isNode=function(){return n.isNode}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i;(function(e){e[e.BUFFER=1]="BUFFER",e[e.IMAGE=2]="IMAGE",e[e.VIDEO=3]="VIDEO",e[e.ENTITIES=4]="ENTITIES"})(i||(i={})),t.default=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(72),a=i.__assign({},n.default,{id:"nodeObjectProperties",title:"NodeObjectPropertiesDef",properties:i.__assign({},n.default.properties),required:["position","scale","quaternion"]});t.default=a},function(e,t,r){var i=r(263),n=r(264),a=n;a.v1=i,a.v4=n,e.exports=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(3),a=r(1),o=r(9),s=r(6),u=r(10),p=r(24),c=r(10),l=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i.__extends(t,e),t.createColorTexture=function(e,t,r,i){void 0===e&&(e=255),void 0===t&&(t=255),void 0===r&&(r=255);var n=a.RGBFormat,o=void 0!==i?4:3,s=new Uint8Array(o);s[0]=e,s[1]=t,s[2]=r,4===o&&(s[3]=i,n=a.RGBAFormat);var u=new a.DataTexture(s,1,1,n,void 0,void 0,void 0,void 0,void 0,void 0);return u.needsUpdate=!0,u},t.createColorTextureCube=function(e,r,i,n){void 0===e&&(e=255),void 0===r&&(r=255),void 0===i&&(i=255);var o=[0,1,2,3,4,5].map(function(a){return t.createColorTexture(e,r,i,n)}),s=new a.CubeTexture(o);return s.generateMipmaps=!1,s.format=o[0].format,s.minFilter=a.NearestFilter,s.magFilter=a.NearestFilter,s.needsUpdate=!0,s},t.getMissingTexture=function(){return t.missingTexture2d||(t.missingTexture2d=t.createColorTexture()),t.missingTexture2d},t.getMissingTextureCube=function(){return t.missingTextureCube||(t.missingTextureCube=t.createColorTextureCube()),t.missingTextureCube},t.prototype.initialize=function(){var t=this;e.prototype.initialize.call(this),this.listenTo(this.engine,"imageUnloaded",function(e){t.getProperty("imageId")===e&&t.unload()})},t.prototype.createRuntimeData=function(e){var r=this,i=function(){r.runtimeData=t.getMissingTexture(),r.setState(o.StateType.Base,o.State.Failed),r.trigger("loadProgress",r),"function"==typeof e&&e.call(r)},n=this.getImage();if(n){var a=function(t){return t.runtimeData?(r.createTextureData(t.runtimeData), -void("function"==typeof e&&e.call(r))):void i()};this.listenTo(n,"load",a),n.isLoaded()&&a.call(this,n),n.isUnloaded()&&n.load()}else i()},t.prototype.createTextureData=function(e){n.default.warn("Need to implement createTextureData in derrived class.")},t.prototype.unload=function(){var t=this.getImage();t&&this.stopListening(t,"load"),this.runtimeData&&(this.engine.trigger("textureUnloaded",this.id),n.default.info(this.engine.getName()+" - Unloading texture, "+this.getName()),this.runtimeData.dispose()),e.prototype.unload.call(this)},t.prototype.applyPropertiesLoaded=function(t,r){e.prototype.applyPropertiesLoaded.call(this,t,r);var i=this.runtimeData instanceof a.WebGLRenderTarget?this.runtimeData.texture:this.runtimeData;i.flipY=!1,t.hasOwnProperty("uMapping")&&(i.wrapS=this.getThreeAddressMode(this.getAddressModeU())),t.hasOwnProperty("vMapping")&&(i.wrapT=this.getThreeAddressMode(this.getAddressModeV())),t.hasOwnProperty("anisotropy")&&(i.anisotropy=this.getProperty("anisotropy")),t.hasOwnProperty("minFilter")&&(i.minFilter=this.getThreeFilter(this.getMinFilter())),t.hasOwnProperty("magFilter")&&(i.magFilter=this.getThreeFilter(this.getMagFilter())),t.hasOwnProperty("generateMipmaps")&&(i.generateMipmaps=this.isMipmapsEnabled()),this.engine.needsRender=!0},t.prototype.applyPropertiesUnloaded=function(t){if(void 0===t&&(t={}),e.prototype.applyPropertiesUnloaded.call(this,t),t.hasOwnProperty("imageId")){var r=this.getPreviousProperty("imageId");r&&this.unregisterDependencyById(r),t.imageId&&this.registerDependencyById(this.getProperty("imageId"))}this.engine.trigger("textureChanged",this.id,t)},t.prototype.getAddressModeU=function(){return this.getSupportedAddressMode(this.getProperty("uMapping"))},t.prototype.getAddressModeV=function(){return this.getSupportedAddressMode(this.getProperty("vMapping"))},t.prototype.getSupportedAddressMode=function(e){var t=this.getImage();return t&&!t.isPowerOfTwo()?"clamp":e},t.prototype.getLayout=function(){var e=this.getProperty("layout");if(e)return e;var t=this.getImage();return t?t.getProperty("layout"):c.ImageLayout.Normal},t.prototype.getWidth=function(){var e=this.getImage();return e?e.getWidth():1},t.prototype.getHeight=function(){var e=this.getImage();return e?e.getHeight():1},t.prototype.getMinFilter=function(){return this.getSupportedFilter(this.getProperty("minFilter"))},t.prototype.getMagFilter=function(){return this.getSupportedFilter(this.getProperty("magFilter"))},t.prototype.getSupportedFilter=function(e){var t=this.getDataType();if(!this.isLinearFilterAvailableForType(t))return"nearest";if(!this.isMipmapsEnabled())switch(e){default:case"nearest":case"nearestWithNearestMipmap":case"nearestWithLinearMipmap":return"nearest";case"linear":case"linearWithNearestMipmap":case"linearWithLinearMipmap":return"linear"}return e},t.prototype.getDataType=function(){var e=this.getProperty("type");if(!e){var t=this.getImage();return t?t.getDataType():"uByte"}var r=e,i=this.engine.getThreeRenderer(),n=i.extensions;switch(e){case"float":if(n.get("OES_texture_float")){r="float";break}case"halfFloat":r=n.get("OES_texture_half_float")?"halfFloat":"uByte";break;default:r=e}return r},t.prototype.getFormat=function(){var e=this.getProperty("format");if(!e){var t=this.getImage();return t?t.getFormat():"rgb"}return e},t.prototype.getMipCount=function(){if(!this.getProperty("generateMipmaps"))return 1;var e=this.getImage();return e?e.getMipCount():1},t.prototype.getImage=function(){return this.engine.getAssetById(this.getProperty("imageId"))},t.prototype.getDataSizeInMemorySelf=function(){var e=this.getImage();if(e instanceof p.default){var t=e.getChosenRepresentation();if(!t)return e.getDataSizeInMemory();if(t.compression&&"zip"!==t.compression&&"jpeg"!==t.compression)return this.getDataSizeDownloadSelf();if(this.getHdrPackingType(t.channels))return this.getWidth()*this.getHeight()*u.default.getBytesPerPixel("rgb",this.getDataType())}return this.getWidth()*this.getHeight()*u.default.getBytesPerPixel(this.getFormat(),this.getDataType())},t.prototype.isCubeMap=function(){return"textureCube"===this.type||"renderTextureCube"===this.type},t.prototype.isLinearFilterAvailableForType=function(e){var t=this.engine.getThreeRenderer(),r=t.extensions;switch(e){case"halfFloat":return!!r.get("OES_texture_half_float_linear");case"float":return!!r.get("OES_texture_float_linear");default:return!0}},t.prototype.isMipmapsEnabled=function(){if(!this.isLinearFilterAvailableForType(this.getDataType()))return!1;var e=this.getImage();return!(e&&!e.isPowerOfTwo())&&this.getProperty("generateMipmaps")},t.prototype.getHdrPackingType=function(e){return e&&4===e.length&&"exponent"===e[3]?"rgbe":null},t.prototype.createDxtTextureData=function(e){var t,r,i,n=new a.CompressedTexture(null,0,0),o=this.parseDDS(e,!0);if(n.format=o.format,n.generateMipmaps=!1,o.isCubemap){n.flipY=!1;var s=n.image=[];for(i=o.mipmaps.length/o.mipmapCount,t=0;t>8&255,e>>16&255,e>>24&255)}function o(e,t,r,i){var n,a,o,s,u,p,c=r*i*4,l=new Uint8Array(e,t,c),h=new Uint8Array(c),d=0,f=0;for(a=0;ae?t.width:e},0):0},t.prototype.getMaxRepresentationHeight=function(){var e=this.get("representations");return e?e.reduce(function(e,t){return t.height>e?t.height:e},0):0},t.prototype.getMaxTextureSize=function(){var t=this.engine.getRenderer();return t?t.getMaxTextureSize2d():e.prototype.getMaxTextureSize.call(this)},t.prototype.getImageResponseType=function(e){switch(e){case"dxt":case"dxt1":case"dxt5":return"arraybuffer";default:return"blob"}},t.prototype.applyPropertiesUnloaded=function(e){var t={maxSize:Math.max(this.getWidth(),this.getHeight()),compression:this.getCompressionFormat()};this.chosenRepresentation=this.findRepresentation(t)},t.prototype.createRuntimeData=function(e){var t=this;if(!this.chosenRepresentation)throw new Error("No suitable representation found to load");this.loadLowResImage(e).then(function(){return t.loadHighResImage(e)}).catch(this.onImageLoadError.bind(this))},t.prototype.loadLowResImage=function(e){var t=this;if(this.loadPriority=2,!this.getProperty("stream"))return Promise.resolve();var r={maxSize:64,compression:this.getCompressionFormat()},i=this.findRepresentation(r);return i?new Promise(function(r,n){var a=t.loadResource(i.src,u.default.IMAGE,e,{priority:t.loadPriority,responseType:t.getImageResponseType(i.compression),isExternal:i.isExternal});a.once(s.default.LOAD,function(e){t.onImageLoad(e,i),t.loadPriority=8,r()}),a.once(s.default.CANCEL,function(){n(new Error("Failed to load low res texture"))}),a.once(s.default.ERROR,n)}):Promise.resolve()},t.prototype.loadHighResImage=function(e){var t=this;if(!this.isDestroyed())return new Promise(function(r,i){var n=function(e){t.isDestroyed()||(t.loadedBytes=t.getDataSizeDownload()*e.loaded/e.total,t.trigger("loadProgress",t))};t.setState(a.StateType.Base,a.State.InProgress);var o=t.chosenRepresentation,p=t.loadResource(o.src,u.default.IMAGE,e,{responseType:t.getImageResponseType(o.compression),isExternal:o.isExternal,priority:t.loadPriority});p.once(s.default.PROGRESS,n),p.once(s.default.LOAD,function(e){t.onImageLoad(e,o)}),p.once(s.default.ERROR,i)})},t.prototype.onImageLoad=function(e,t){if(this.runtimeData||(this.runtimeData={}),this.runtimeData.compression=t.compression,this.runtimeData.colorspace=t.colorspace,this.runtimeData.channels=t.channels||c,this.runtimeData.width=t.width,this.runtimeData.height=t.height,!(e instanceof ArrayBuffer||e instanceof Image))throw new Error("Uknown container type for image data!");this.runtimeData.imageData=e,this.loadedBytes=this.getDataSizeDownload(),this.trigger("loadProgress",this)},t.prototype.onImageLoadError=function(e){this.isDestroyed()||(n.default.error("There was an error loading the image, "+this.getName(),e),this.setState(a.StateType.Base,a.State.Failed),this.loadedBytes=this.getDataSizeDownload(),this.trigger("loadProgress",this))},t.prototype.findRepresentation=function(e){void 0===e&&(e={});var t=this.get("representations");if(!t||0===t.length)return null;var r=Object.assign({maxSize:l},e),i=t.filter(function(e){if(e.compression===r.compression)return!0;switch(e.compression){case"zip":case"jpeg":return!r.compression;case"dxt":case"dxt1":case"dxt5":return"dxt"===r.compression}return!1});0===i.length&&(i=t.filter(function(e){return"zip"===e.compression||"jpeg"===e.compression}));var n=i.filter(function(e){var t=e.channels||c;return!r.channels||t.toString()===r.channels.toString()});0===n.length&&(n=i);var a=n.map(function(e){return r.maxSize-Math.max(e.width||1,e.height||1)}),o=a.reduce(function(e,t,r){var i=e>=0?a[e]:Number.MAX_VALUE;return t>=0&&t=0?n[o]:null},t}(o.default);p.addSchemas("ImageAsset",h),t.default=h},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(10),a=r(17),o=r(12),s=r(4),u=1080,p=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i.__extends(t,e),t.prototype.initialize=function(){e.prototype.initialize.call(this),this.engine.on("update",this.onUpdate,this),this.on("pause",this.pause,this),this.on("play",this.play,this),this.on("stop",this.stop,this),this.on("toggle",this.toggle,this)},t.prototype.uninitialize=function(){this.engine.off("update",this.onUpdate,this),this.off("pause",this.pause,this),this.off("play",this.play,this),this.off("stop",this.stop,this),this.off("toggle",this.toggle,this),this.runtimeData&&this.runtimeData.image&&this.runtimeData.image.pause(),e.prototype.uninitialize.call(this)},t.prototype.createRuntimeData=function(e){var t=this,r=function(e){e&&(e.style.display="none",e.loop=t.getProperty("loop"),e.autoplay=t.getProperty("autoPlay"),e.muted=t.getProperty("muted"),t.runtimeData||(t.runtimeData={}),t.runtimeData.imageData=e,t.runtimeData.width=e.width,t.runtimeData.height=e.height,t.loadedBytes=t.getDataSizeDownload(),t.trigger("loadProgress",t))},i=this.engine.getRenderer().getCanvas().parentElement,n=this.getProperty("querySelector");if(n){var s=i.querySelector(n);r(s),e()}else{var u=this.findRepresentation();if(u){var p=this.loadResource(u.src,a.default.VIDEO,e);p.on(o.default.PROGRESS,function(e){t.loadedBytes=t.getDataSizeDownload()*e.loaded/e.total,t.trigger("loadProgress",t)}),p.once(o.default.LOAD,function(e){i.appendChild(e),r(e)})}}},t.prototype.applyPropertiesUnloaded=function(e){var t=this.findRepresentation();this.chosenRepresentation=t},t.prototype.applyPropertiesLoaded=function(t,r){if(e.prototype.applyPropertiesLoaded.call(this,t,r),this.runtimeData&&this.runtimeData.imageData){var i=this.runtimeData.imageData;t.hasOwnProperty("loop")&&(i.loop=this.getProperty("loop")),t.hasOwnProperty("muted")&&(i.muted=this.getProperty("muted")),t.hasOwnProperty("autoPlay")&&(i.autoplay=this.getProperty("autoPlay"))}},t.prototype.getMaxRepresentationWidth=function(){var e=this.get("representations");return e?e.reduce(function(e,t){return t.video&&t.video.width>e?t.video.width:e},0):0},t.prototype.getMaxRepresentationHeight=function(){var e=this.get("representations");return e?e.reduce(function(e,t){return t.video&&t.video.height>e?t.video.height:e},0):0},t.prototype.onUpdate=function(){if(this.runtimeData){var e=this.runtimeData.imageData;e&&!e.paused&&!e.error&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.engine.needsRender=!0)}},t.prototype.pause=function(){this.runtimeData&&this.runtimeData.image.pause()},t.prototype.play=function(e,t){this.runtimeData&&(e&&(this.runtimeData.imageData.currentTime=t),this.runtimeData.imageData.play())},t.prototype.stop=function(){this.runtimeData&&(this.runtimeData.imageData.pause(),this.runtimeData.imageData.currentTime=0)},t.prototype.toggle=function(){this.runtimeData&&(this.runtimeData.imageData.paused?this.play():this.pause())},t.prototype.getOriginalWidth=function(){var e=this.getProperty("streams")||[];return e.reduce(function(e,t){return Math.max(t.width||0,e)},0)},t.prototype.getOriginalHeight=function(){var e=this.getProperty("streams")||[];return e.reduce(function(e,t){return Math.max(t.height||0,e)},0)},t.prototype.getMaxTextureSize=function(){var t=this.engine.getRenderer();return t?t.getMaxTextureSize2d():e.prototype.getMaxTextureSize.call(this)},t.prototype.findRepresentation=function(e){void 0===e&&(e={});var t=this.get("representations");if(!t||0===t.length)return null;var r=Object.assign({maxHeight:u},e),i=t.map(function(e){return r.maxHeight-(e.video||{}).height||0}),n=i.reduce(function(e,t,r){var n=e>=0?i[e]:Number.MAX_VALUE;return t>=0&&t=0?t[n]:null},t}(n.default);p.events={pause:{params:[],action:!0,category:""},play:{params:[{name:"seek",type:"b",description:"",default:!1},{name:"seekTime",type:"f",description:"",default:0}],action:!0,category:""},stop:{params:[],action:!0,category:""},toggle:{params:[],action:!0,category:""}},s.addSchemas("VideoAsset",p),t.default=p},function(e,t,r){"use strict";function i(e,t){return Math.abs(e.x-t.x)this.pitchAngleBoundsMax?this.targetEuler.x=this.pitchAngleBoundsMax:this.targetEuler.x=this.getMaterialCount())throw new Error("Invalid index parameter");var r=this.getMaterialIds()[e];if(r){var i=this.engine.getAssetById(r);if(i)return i}return t?this.engine.materialUtilities.getMissingMaterial():null},t.prototype.getPreviousMaterial=function(e,t){if(void 0===e&&(e=0),void 0===t&&(t=!0),e<0||e>=this.getMaterialCount())throw new Error("Invalid index parameter");var r=this.getPreviousMaterialIds()[e];if(r){var i=this.engine.getAssetById(r);if(i)return i}return t?this.engine.materialUtilities.getMissingMaterial():null},t.prototype.getMaterialCount=function(){return this.getMaterialIds().length},t.prototype.getMaterials=function(e){void 0===e&&(e=!0);for(var t=[],r=this.getMaterialCount(),i=0;i=this.getMaterialCount())throw new Error("Invalid index parameter");var r=e instanceof s.default?e.id:e,i=(this.getOwnProperty("materials")||[]).slice();i[t]!==r&&(i[t]=r,this.setProperty("materials",i))},t.prototype.getMaterialIds=function(){for(var e=this.getProperty("materials"),t=this.getPrefabObject(),r=t?t.getProperty("materials"):[],i=[],n=Math.max(e.length,r.length),a=0;at)p.engine.off("update",l,p),p.setProperty("color",e);else{var h=Math.min(c/t,1),d=(1-h)*a+h*r,f=(1-h)*o+h*i,m=(1-h)*s+h*n;p.runtimeData.color.setRGB(d,f,m)}};t?(u=this.getProperty("color"),a=(u>>16&255)/255,o=(u>>8&255)/255,s=(255&u)/255,r=(e>>16&255)/255,i=(e>>8&255)/255,n=(255&e)/255,this.engine.on("update",l,this)):this.setProperty("color",e)},t.prototype.setIntensity=function(e,t){var r,i=this,n=0,a=function(o){if(n+=o,n>t)i.engine.off("update",a,i),i.setProperty("intensity",e);else{var s=Math.min(n/t,1),u=(1-s)*r+s*e;i.runtimeData.intensity=u}};t?(r=this.getProperty("intensity"),this.engine.on("update",a,this)):this.setProperty("intensity",e)},t}(o.default);u.events={setColor:{scope:"local",action:!0,category:"Materials",params:[{name:"value",type:"c",description:"The colour to set.",default:16711680},{name:"animationTime",type:"f",description:"The length of time that the change will take. i.e. this lets you animate the change.",default:0,min:0}]},setIntensity:{scope:"local",action:!0,category:"Materials",params:[{name:"value",type:"f",description:"The intensity to set.",default:1},{name:"animationTime",type:"f",description:"The length of time that the change will take. i.e. this lets you animate the change.",default:0,min:0}]}},s.addSchemas("LightObject",u),t.default=u},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(12);t.makeXhr=function(e){return function(t){return e(t.path,t.params).then(function(e){return t.loaderData.xhr=e,Promise.resolve(t)})}},t.loadXhr=function(e){return new Promise(function(t,r){e.setLoading();var n=function(e){return parseInt(e.getResponseHeader("Content-Length"),10)},a=function(e){return{total:e.lengthComputable&&e.target?n(e.target):0,loaded:e.loaded}},o=function(){e.loaderData.xhr.abort(),t(e),e.off(i.default.CANCEL,o)},s=function(){e.off(i.default.CANCEL,o),t(e)},u=function(t){e.off(i.default.CANCEL,o),r(t)};e.on(i.default.CANCEL,o),e.loaderData.xhr.send(),e.loaderData.xhr.addEventListener("load",s),e.loaderData.xhr.addEventListener("error",u),e.loaderData.xhr.addEventListener("progress",function(t){return e.trigger(i.default.PROGRESS,a(t))})})},t.requireStatus=function(e){return function(t){return e(t.loaderData.xhr.status)?Promise.resolve(t):Promise.reject(new Error("Failed to load: "+t.path+" status: "+t.loaderData.xhr.status))}},t.setResponseType=function(e){return function(t){return t.loaderData.xhr.responseType=t.params.responseType||e,Promise.resolve(t)}},t.handleError=function(e){return function(t){return e.setError(t),Promise.reject(t)}},t.unlessCancelled=function(e){return function(t){return t.isCancelled()?Promise.resolve(t):e(t)}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i={$schema:"http://json-schema.org/draft-04/schema",id:"baseEntity",title:"BaseEntityDef",type:"object",description:"Base hierarchical type for assets and objects.",properties:{type:{type:"string",description:"The entity's type."},sid:{type:"string",description:"The entity's scoped ID."},id:{type:"string",description:"The entity's unique ID."},properties:{$ref:"baseEntityProperties.json"},previousProperties:{$ref:"baseEntityProperties.json"},components:{type:"array",items:{$ref:"component.json"},default:[]},previousComponents:{type:"array",items:{$ref:"component.json"},default:[]}},additionalProperties:!1,required:["id"]};t.default=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i={$schema:"http://json-schema.org/draft-04/schema",id:"baseEntityProperties",title:"BaseEntityPropertiesDef",type:"object",description:"Holds type-specific properties.",properties:{name:{type:"string",description:"The entity's name.",default:"unnamed"}},additionalProperties:!1};t.default=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(32),a=i.__assign({},n.default,{id:"baseRenderTextureAsset",title:"BaseRenderTextureAssetDef",properties:i.__assign({},n.default.properties,{properties:{$ref:"baseRenderTextureAssetProperties.json"}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(22),a=i.__assign({},n.default,{id:"baseRenderTextureAssetProperties",title:"BaseRenderTextureAssetPropertiesDef",properties:i.__assign({},n.default.properties,{stencilBuffer:{type:"boolean",default:!1},depthBuffer:{type:"boolean",default:!1},encoding:{type:"string",description:"The encoding of the image (e.g. 'srgb', 'linear', etc.).",default:"srgb"}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i={$schema:"http://json-schema.org/draft-04/schema",id:"commonImageProperties",title:"CommonImagePropertiesDef",type:"object",properties:{width:{type:"integer",description:"The width, in pixels, of the original image file."},height:{type:"integer",description:"The height, in pixels, of the original image file."},format:{type:"string",default:"rgb"},type:{type:"string",default:"uByte"},encoding:{type:"string",description:"The encoding of the image (e.g. 'srgb', 'linear', etc.). If undefined, the encoding will be inferred.",default:void 0},layout:{type:"string",default:"normal"}},additionalProperties:!1};t.default=i},function(e,t,r){"use strict";function i(e,t){Object.getOwnPropertyNames(t).forEach(function(r){"constructor"===r||e.hasOwnProperty(r)||Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}function n(e,t){var r=function(r){var n=this,a={};r&&i(a,r),e&&i(a,e),t.forEach(function(e){e.call(n,a)})};return t.forEach(function(e){i(r.prototype,e.prototype)}),r}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(29);t.default=new i.default},function(e,t){e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(3),a=r(1),o=r(6),s=r(21),u=r(5),p=r(4),c=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.clips={},t}return i.__extends(t,e),t.prototype.getAnimationClip=function(e){return this.clips[e]},t.prototype.getChannel=function(e){return this.getProperty("channels")[e]},t.prototype.getChannelIds=function(){return Object.keys(this.getProperty("channels"))},t.prototype.getChannels=function(){return u.values(this.getProperty("channels"))},t.prototype.getClip=function(e){return this.getProperty("clips")[e]},t.prototype.getClipIds=function(){return Object.keys(this.getProperty("clips"))},t.prototype.getClips=function(){return u.values(this.getProperty("clips"))},t.prototype.getLayer=function(e){return this.getProperty("layers")[e]},t.prototype.getLayerIds=function(){return Object.keys(this.getProperty("layers"))},t.prototype.getLayers=function(){return u.values(this.getProperty("layers"))},t.prototype.createRuntimeData=function(e){var t=this;this.when("loadDependencies",function(){if(!t.isDestroyed()){var r=t.getDependencies(),i=r.some(function(e){return e.isLoadFailed()});i||t.createClips(),e()}},this)},t.prototype.applyPropertiesUnloaded=function(t){void 0===t&&(t={}),e.prototype.applyPropertiesUnloaded.call(this,t),t.hasOwnProperty("channels")&&this.registerBufferDependency()},t.prototype.registerBufferDependency=function(){var e=this,t=this.getChannels(),r=[];t.forEach(function(e){r.push(e.times),r.push(e.values)}),r.forEach(function(t){var r=t.split("#");if(2!==r.length)throw new Error(e.engine.getName()+" - AnimationAsset: Invalid accessorId, "+t);e.registerDependencyById(r[0])})},t.prototype.createClips=function(){var e=this,t=this.getClipIds();t.forEach(function(t){e.clips[t]=e.createClip(t)})},t.prototype.createClip=function(e){var t=this,r=this.getClip(e);if(!r)throw new Error('Invalid argument: clip "'+e+'" not found');r.layers.length>1&&n.default.warn('Clip "'+e+'" contains multiple layers, but AnimationAsset.prototype.createAnimation() only supports a single layer.');var i=this.getLayer(r.layers[0]),o=i?i.channels.map(function(e){return t.getChannel(e)}):[],s=o.map(function(e){return t.createKeyframeTrack(e,r.start,r.stop)});return new a.AnimationClip(r.name,r.stop-r.start,s)},t.prototype.createKeyframeTrack=function(e,t,r){var i=this,n=e.times.split("#"),o=n[0],u=n[1],p=this.engine.getEntityById(o);if(!p)throw new Error(this.engine.getName()+" - AnimationAsset: BufferAsset not found, "+o);var c=p.getAccessor(u),l=p.getArray(u);if(!c||!l)throw new Error(this.engine.getName()+" - AnimationAsset: Accessor not found, "+u);var h=e.values.split("#"),d=h[0],f=h[1],m=this.engine.getEntityById(d);if(!m)throw new Error(this.engine.getName()+" - AnimationAsset: BufferAsset not found, "+d);var y=m.getAccessor(f),g=m.getArray(f);if(!y||!g)throw new Error(this.engine.getName()+" - AnimationAsset: Accessor not found, "+f);var v,b=e.targetObject.map(function(e){return i.engine.getRuntimeName(e)}),P=b.join("/")+"."+e.targetProperty,x="quaternion"===e.targetProperty?a.QuaternionKeyframeTrack:a.VectorKeyframeTrack,E=-1;for(v=0;v=t){E=v;break}var w=-1;for(v=l.length;v-- >0;)if(l[v]<=r){w=v;break}var S=E>=0?E:0,D=w>=0?w+1:l.length,_=s.default.getTypeSize(y.type),M=l.subarray(S,D),A=g.subarray(S*_,D*_),T=0===t?M:M.slice().map(function(e){return e-t});return new x(P,T,A,null)},t}(o.default);p.addSchemas("AnimationAsset",c),t.default=c},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(6),a=r(4),o=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i.__extends(t,e),t.prototype.uninitialize=function(){this.runtimeData&&this.runtimeData.pause(),e.prototype.uninitialize.call(this)},t.prototype.applyPropertiesLoaded=function(t,r){if(e.prototype.applyPropertiesLoaded.call(this,t,r),this.runtimeData&&(t.hasOwnProperty("loop")&&(this.runtimeData.loop=this.getProperty("loop")),t.hasOwnProperty("state")))switch(this.getProperty("state")){case"pause":this.runtimeData.pause();break;case"play":this.runtimeData.play()}},t}(n.default);a.addSchemas("AudioAsset",o),t.default=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(20),a=r(24),o=r(10),s=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i.__extends(t,e),t.prototype.createRuntimeData=function(e){this.createRTImageData(),this.trigger("loadProgress",this),e()},t.prototype.getLayout=function(){return this.getProperty("layout")},t.prototype.getWidth=function(){return this.getProperty("width")},t.prototype.getHeight=function(){return this.getProperty("height")},t.prototype.getMipCount=function(){return a.default.prototype.getMipCount.call(this)},t.prototype.applyPropertiesLoaded=function(t,r){e.prototype.applyPropertiesLoaded.call(this,t,r),(t.hasOwnProperty("format")||t.hasOwnProperty("type")||t.hasOwnProperty("width")||t.hasOwnProperty("height"))&&(this.runtimeData.__webglFramebuffer&&(this.runtimeData.dispose(),delete this.runtimeData.__webglFramebuffer),this.runtimeData.texture.format=o.default.getThreeImageFormat(this.getProperty("format")),this.runtimeData.texture.type=o.default.getThreeImageType(this.getDataType()),this.runtimeData.texture.height=this.getHeight(),this.runtimeData.texture.width=this.getWidth()),this.runtimeData.texture.encoding=o.default.getThreeImageEncoding(this.getProperty("encoding"))},t}(n.default);t.default=s},function(e,t,r){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(3),a=r(1),o=r(23),s=r(9),u=r(21),p=r(5),c=r(4),l=function(t){ -function r(){return null!==t&&t.apply(this,arguments)||this}return i.__extends(r,t),r.prototype.getBounds=function(e){var t=this.getProperty("bounds"),r=e||new a.Box3;return r.set(t.min,t.max)},r.prototype.getDataSizeInMemorySelf=function(){return 0},r.prototype.applyPropertiesUnloaded=function(e){t.prototype.applyPropertiesUnloaded.call(this,e),e.accessorId&&this.registerBufferDependency()},r.prototype.createRuntimeData=function(e){var t=this;this.when("loadDependencies",function(){if(!t.isDestroyed()){var r=t.getDependencies(),i=r.some(function(e){return e.isLoadFailed()});if(i)t.setState(s.StateType.Base,s.State.Failed);else try{t.decode()}catch(e){n.default.error(e.toString()),t.setState(s.StateType.Base,s.State.Failed)}e()}})},r.prototype.createBufferAttribute=function(e,t,r,i){var n=r.num_points(),o=i.components_count(),s=n*o,u=new e.DracoFloat32Array;t.GetAttributeFloatForAllPoints(r,i,u);for(var p=new Float32Array(s),c=0;c0&&(f.addGroup(v,x,g),v+=x),g=P}}var E=3*c-v;E>0&&f.addGroup(v,E,g),e.destroy(y)}else f.addGroup(0,3*c,-1);var w=this.getProperty("bounds"),S=new a.Vector3(w.min.x,w.min.y,w.min.z),D=new a.Vector3(w.max.x,w.max.y,w.max.z);f.boundingBox=new a.Box3(S,D),f.computeBoundingSphere(),this.addMissingAttributes(f),this.setGeometry(o.default.primitiveType.TRIANGLES,f)},r.prototype.decode=function(){var t=e.Module;if(!t)throw new Error("Draco module not found");var r=u.default.getBufferArray(this.engine,this.getProperty("accessorId")),i=new t.DecoderBuffer;i.Init(r,r.byteLength),i.Init(r,r.byteLength);var a=new t.WebIDLWrapper,o=a.GetEncodedGeometryType(i);if(o===t.TRIANGULAR_MESH){var s=a.DecodeMeshFromBuffer(i);this.createBufferGeometry(t,a,s),t.destroy(s)}else n.default.warn(this.engine.getName()+(" - DracoGeometryAsset: Unrecognized geometry type '"+o+"'"));t.destroy(a),t.destroy(i)},r.prototype.registerBufferDependency=function(){var e=this.getProperty("accessorId"),t=e.split("#");if(2!==t.length)throw new Error(this.engine.getName()+" - DracoGeometryAsset: Invalid accessorId, "+e);this.registerDependencyById(t[0])},r}(o.default);c.addSchemas("DracoGeometryAsset",l),t.default=l}).call(t,r(76))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(3),a=r(1),o=r(23),s=r(9),u=r(21),p=r(5),c=r(4),l=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i.__extends(t,e),t.prototype.getBounds=function(e){var t=this.getProperty("bounds"),r=e||new a.Box3;return r.set(t.min,t.max)},t.prototype.getDataSizeInMemorySelf=function(){var e=this,t=this.getProperty("attributes");return Object.keys(t).map(function(r){var i=t[r],n=u.default.getBufferAccessor(e.engine,i.accessorId);return u.default.getComponentTypeSize(n.componentType)*u.default.getTypeSize(n.type)*n.count}).reduce(function(e,t){return t+e},0)},t.prototype.applyPropertiesUnloaded=function(t){e.prototype.applyPropertiesUnloaded.call(this,t),(t.attributes||t.indices)&&this.registerBufferDependency()},t.prototype.createRuntimeData=function(e){var t=this;this.when("loadDependencies",function(){if(!t.isDestroyed()){var r=t.getDependencies(),i=r.some(function(e){return e.isLoadFailed()});if(i)t.setState(s.StateType.Base,s.State.Failed);else try{t.createBufferGeometry()}catch(e){n.default.error(e.toString()),t.setState(s.StateType.Base,s.State.Failed)}e()}})},t.prototype.createAttributes=function(e){var t=this,r={indices:"index",positions:"position",normals:"normal",tangents:"tangent",colors:"color",uvs1:"uv",uvs2:"uv2",skinIndices:"skinIndex",skinWeights:"skinWeight"},i=Object.assign({indices:{accessorId:this.getProperty("indices")}},this.getProperty("attributes")),n={};return p.forEach(r,function(r,a){if(i.hasOwnProperty(a)){var o=i[a].accessorId;n[r]=t.createBufferAttribute(o,e[r])}}),n},t.prototype.createBufferAttribute=function(e,t){var r=u.default.getBufferAccessor(this.engine,e),i=u.default.getBufferArray(this.engine,e),n=u.default.getTypeSize(r.type);if(void 0===t||n===t)return new a.BufferAttribute(i,n);for(var o=new i.constructor(r.count*t),s=Math.min(n,t),p=0;p1&&(this.opacity=1,this.fadeInTime=0,this.opacityTime=0)):this.fadeOutTime&&(this.getEngine().needsRender=!0,this.opacityTime===-1?(this.disable(),this.opacity=0,this.fadeOutTime=0,this.opacityTime=0,this.disable()):(this.opacityTime-=e,this.opacityTime<=0?(this.opacity=1e-4,this.opacityTime=-1):this.opacity=this.opacityTime/this.fadeOutTime)),this.animationTotalTime>0){this.getEngine().needsRender=!0,this.animationTime+=e;var r=this.animationTime/this.animationTotalTime;r>=1&&(this.animationTotalTime=0,r=1),this.x=(1-r)*this.oldX+r*this.targetX,this.y=(1-r)*this.oldY+r*this.targetY,this.width=(1-r)*this.oldWidth+r*this.targetWidth,this.height=(1-r)*this.oldHeight+r*this.targetHeight,this.updateCameraProjection()}this.getRuntimeData().layers.set(this.renderLayer),this.getRenderer().renderView(t.runtimeData,this.getRuntimeData(),{viewPort:{x:this.x,y:this.y,width:this.width,height:this.height},enablePreRenderFunctions:this.enablePreRenderFunctions,enableShadows:this.enableShadows,clearColor:this.clearColor,clearDepth:this.clearDepth,delta:e,opacity:this.opacity,renderTarget:this.renderTarget,effect:this.effect})}}},t.prototype.setViewport=function(e,t,r,i,n){this.viewportLeft=e.toString(),this.viewportBottom=t.toString(),this.viewportWidth=r.toString(),this.viewportHeight=i.toString(),n?(this.animationTotalTime=n,this.animationTime=0,this.oldX=this.x,this.oldY=this.y,this.oldWidth=this.width,this.oldHeight=this.height,this.updateViewport(),this.targetX=this.x,this.targetY=this.y,this.targetWidth=this.width,this.targetHeight=this.height,this.x=this.oldX,this.y=this.oldY,this.width=this.oldWidth,this.height=this.oldHeight):(this.resize(),this.animationTotalTime=0)},t.prototype.updateViewport=function(){var e,t=this.getEngine().getRenderer().getWidth(),r=this.getEngine().getRenderer().getHeight();"%"===this.viewportBottom.slice(-1)?(e=.01*parseFloat(this.viewportBottom.slice(0,-1)),this.y=e*r):this.y=parseInt(this.viewportBottom,10),"%"===this.viewportLeft.slice(-1)?(e=.01*parseFloat(this.viewportLeft.slice(0,-1)),this.x=e*t):this.x=parseInt(this.viewportLeft,10),"%"===this.viewportWidth.slice(-1)?(e=.01*parseFloat(this.viewportWidth.slice(0,-1)),this.width=e*t):this.width=parseInt(this.viewportWidth,10),this.width=Math.min(this.width,t-this.x),"%"===this.viewportHeight.slice(-1)?(e=.01*parseFloat(this.viewportHeight.slice(0,-1)),this.height=e*r):this.height=parseInt(this.viewportHeight,10),this.height=Math.min(this.height,r-this.y),this.x<0&&(this.x+=t),this.y<0&&(this.y+=r)},t.prototype.enableRenderView=function(e){this.enable(),e?(this.fadeOutTime=0,this.fadeInTime=e,this.opacityTime=0,this.opacity=0):this.opacity=1},t.prototype.disableRenderView=function(e){e?(this.fadeInTime=0,this.opacityTime=e,this.fadeOutTime=e,this.opacity=1):(this.disable(),this.opacity=0)},t.prototype.toggleRenderView=function(e){this.isEnabled()?this.disableRenderView(e):this.enableRenderView(e)},t.prototype.updateCameraProjection=function(){var e,t=this.getRuntimeData();t&&(e=this.width/this.height,t instanceof n.PerspectiveCamera?t.aspect=e:(t.left=t.bottom*e,t.right=t.top*e),t.updateProjectionMatrix())},t.prototype.resize=function(){this.updateViewport(),this.updateCameraProjection()},t}(a.default);t.default=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(1),a=r(11),o=r(4),s=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i.__extends(t,e),t.prototype.createRuntimeData=function(e){this.runtimeData=new n.Bone(null),this.runtimeData.name=this.getRuntimeName(),e(this)},t}(a.default);o.addSchemas("BoneObject",s),t.default=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(1),a=r(11),o=r(4),s=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i.__extends(t,e),t.prototype.createRuntimeData=function(e){var t=this.getProperty("cameraType");"orthographic"===t?this.runtimeData=new n.OrthographicCamera(this.getProperty("left")||0,this.getProperty("right")||0,this.getProperty("top")||0,this.getProperty("bottom")||0):this.runtimeData=new n.PerspectiveCamera,this.runtimeData.name=this.getRuntimeName(),e(this)},t.prototype.reset=function(){if(e.prototype.reset.call(this),this.runtimeData){var t=this.getProperty("cameraType");"orthographic"===t?this.resetOrthographicRTData():this.resetPerspectiveRTData()}},t.prototype.applyPropertiesLoaded=function(t,r){if(e.prototype.applyPropertiesLoaded.call(this,t,r),t.hasOwnProperty("cameraType")&&this.getProperty("cameraType")!==this.getPreviousProperty("cameraType")&&"init"!==r)return void this.reloadBase();var i=this.getProperty("cameraType");"perspective"===i?(t.hasOwnProperty("fov")||t.hasOwnProperty("aspect")||t.hasOwnProperty("near")||t.hasOwnProperty("far"))&&this.resetPerspectiveRTData():"orthographic"===i&&(t.hasOwnProperty("left")||t.hasOwnProperty("right")||t.hasOwnProperty("top")||t.hasOwnProperty("bottom")||t.hasOwnProperty("near")||t.hasOwnProperty("far"))&&this.resetOrthographicRTData()},t.prototype.resetOrthographicRTData=function(){this.runtimeData.left=this.getProperty("left"),this.runtimeData.right=this.getProperty("right"),this.runtimeData.top=this.getProperty("top"),this.runtimeData.bottom=this.getProperty("bottom"),this.runtimeData.near=this.getProperty("near"),this.runtimeData.far=this.getProperty("far"),this.runtimeData.updateProjectionMatrix()},t.prototype.resetPerspectiveRTData=function(){this.runtimeData.fov=this.getProperty("fov"),this.runtimeData.aspect=this.getProperty("aspect"),this.runtimeData.near=this.getProperty("near"),this.runtimeData.far=this.getProperty("far"),this.runtimeData.updateProjectionMatrix()},t}(a.default);o.addSchemas("CameraObject",s),t.default=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(11),a=r(4),o=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i.__extends(t,e),t}(n.default);a.addSchemas("NodeObject",o),t.default=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i;(function(e){e[e.STARTING=0]="STARTING",e[e.LOADING=1]="LOADING",e[e.PROCESSING=2]="PROCESSING",e[e.COMPLETE=3]="COMPLETE",e[e.CANCELLED=4]="CANCELLED",e[e.ERROR=5]="ERROR"})(i||(i={})),t.default=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(7),a=i.__assign({},n.default,{id:"baseImageAsset",title:"BaseImageAssetDef",properties:i.__assign({},n.default.properties,{properties:{$ref:"baseImageAssetProperties.json"}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(8),a=r(45),o=i.__assign({},n.default,a.default,{id:"baseImageAssetProperties",title:"BaseImageAssetPropertiesDef",properties:i.__assign({},n.default.properties,a.default.properties,{premultiplyAlpha:{type:"boolean",default:!1},stream:{type:"boolean",description:"True if a low-resolution image should be loaded before the full-size image.",default:!0},filename:{type:"string",description:"The filename of the original image.",default:""},compression:{type:"string",description:"The type of compression used for the original image file.",default:"zip"},depth:{type:"integer",description:"The bit-depth of each channel in the original image file.",default:8},sequenceLength:{type:"integer",description:"The number of images contained in the original image file.",default:1},channels:{type:"array",item:{type:"string"},description:"The distinct channels found in the original image file.",default:["red","green","blue"]}})});t.default=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(42),a=i.__assign({},n.default,{id:"baseObjectProperties",title:"BaseObjectPropertiesDef",properties:i.__assign({},n.default.properties,{position:{$ref:"vector3.json",default:{x:0,y:0,z:0}},quaternion:{$ref:"vector4.json",default:{x:0,y:0,z:0,w:1}},scale:{$ref:"vector3.json",default:{x:1,y:1,z:1}},castShadow:{type:"boolean",default:!0},receiveShadow:{type:"boolean",default:!0},visible:{type:"boolean",default:!0},bounds:{$ref:"box3.json"}}),required:["position","scale","quaternion"]});t.default=a},function(e,t,r){e.exports=!r(190)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(e,t,r){var i=r(36),n=r(35),a=r(75),o=r(252),s=r(189),u="prototype",p=function(e,t,r){var c,l,h,d,f=e&p.F,m=e&p.G,y=e&p.S,g=e&p.P,v=e&p.B,b=m?i:y?i[t]||(i[t]={}):(i[t]||{})[u],P=m?n:n[t]||(n[t]={}),x=P[u]||(P[u]={});m&&(r=t);for(c in r)l=!f&&b&&void 0!==b[c],h=(l?b:r)[c],d=v&&l?s(h,i):g&&"function"==typeof h?s(Function.call,h):h,b&&o(b,c,h,e&p.U),P[c]!=h&&a(P,c,d),g&&x[c]!=h&&(x[c]=h)};i.core=n,p.F=1,p.G=2,p.S=4,p.P=8,p.B=16,p.W=32,p.U=64,p.R=128,e.exports=p},function(e,t,r){var i=r(250),n=r(251);e.exports=r(73)?function(e,t,r){return i.f(e,t,n(1,r))}:function(e,t,r){return e[t]=r,e}},function(e,t){var r;r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(6),a=r(4),o=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i.__extends(t,e),t.prototype.createRuntimeData=function(e){return e()},t.prototype.getEntityId=function(e){return this.runtimeData?this.runtimeData.entityIds[e]:void 0},t}(n.default);a.addSchemas("DocumentAsset",o),t.default=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(225),a=!1,o={},s=function(){function e(t){this.engine=t,a||(a=!0,e.registerScripts(n.default)),this.initBuiltInScripts()}return e.registerScript=function(e,t){if(!e.id)throw new Error("Component definition is lacking an id attribute!");if(!t)throw new Error("A constructor must be provided!");o[e.id]={def:e,constructor:t}},e.registerScripts=function(t){t.forEach(function(t){var r=t[0],i=t[1];return e.registerScript(r,i)})},e.prototype.initBuiltInScripts=function(){var e=this;Object.keys(o).forEach(function(t){var r=o[t],n=e.engine.createEntity(i.__assign({},r.def,{type:"script"})),a=r.constructor;n.sharedData.classConstructor=a})},e}();t.default=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(3),a=r(1),o=r(2),s=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.dirty=!0,t.paused=!1,t.needsReset=!1,t.ended=!1,t}return i.__extends(t,e),t.prototype.onEntityLoaded=function(){var e=this;this.mixer&&this.mixer._root===this.getRuntimeData()||(this.mixer=new a.AnimationMixer(this.getRuntimeData()),this.mixer.addEventListener("finished",function(t){return e.onMixerEvent(t)}))},t.prototype.getTime=function(){return this.action?this.action.time:0},t.prototype.onStartup=function(){this.asset&&this.listenTo(this.asset,"propertyChanges",this.onAssetChanged),this.getEntity().on("playAnimation",this.playAnimation,this),this.getEntity().on("pauseAnimation",this.pause,this),this.getEntity().on("stopAnimation",this.stop,this),this.getEntity().on("toggleAnimation",this.toggle,this)},t.prototype.isPlaying=function(){return this.action&&this.action.isScheduled()&&!this.paused},t.prototype.load=function(e){var t=this;return this.mixer?(this.release(),this.asset?(this.asset.when("load",function(){var r=t.asset.getAnimationClip(t.clipId);return r?(t.action=t.mixer.clipAction(r),t.action?(t.action.setLoop(t.loop?a.LoopRepeat:a.LoopOnce,1/0),t.action.timeScale=t.speed,t.action.time=t.startTime,t.action.weight=t.weight,t.action.clampWhenFinished=!0,t.action.paused=t.paused,t.dirty=!1,t.getEntity().trigger("animationLoaded"),void(e&&e(null,t))):void(e&&e(new Error("Failed to create THREE.AnimationAction")))):void(e&&e(new Error('Failed to get animation clip "'+t.clipId+'"')))}),void(this.asset.isUnloaded()&&this.asset.load())):void(e&&e(new Error("No asset assigned")))):void(e&&e(new Error("Mixer is not initialized")))},t.prototype.pause=function(){this.paused=!0,this.action&&(this.action.paused=this.paused)},t.prototype.play=function(){var e=this;return this.paused=!1,this.dirty?void this.load(function(t){return t?void n.default.error("Error playing animation: ",t.toString()):void e.play()}):void(this.action&&(this.needsReset&&(this.action.reset(),this.action.time=this.startTime,this.needsReset=!1),this.action.play(),this.action.paused=this.paused))},t.prototype.playAnimation=function(e,t,r,i,n){void 0!==e&&this.setAsset(this.getEngine().getEntityById(e)),void 0!==t&&this.setClipId(t),this.loop=void 0!==r?r:this.loop,this.speed=void 0!==i?i:this.speed,this.startTime=void 0!==n?n:this.startTime,this.play()},t.prototype.release=function(){this.stop(),this.action&&(this.action.stop(),this.action=void 0)},t.prototype.setAsset=function(e){this.asset!==e&&(this.asset&&(this.stopListening(this.asset,"propertyChanges",this.onAssetChanged),this.unregisterDependency(this.asset)),this.asset=e,this.dirty=!0,this.asset&&(this.listenTo(this.asset,"propertyChanges",this.onAssetChanged),this.registerDependency(this.asset)))},t.prototype.setClipId=function(e){this.clipId!==e&&(this.clipId=e,this.dirty=!0)},t.prototype.setLoop=function(e){this.loop=e,this.action&&this.action.setLoop.apply(this.action,[this.loop?a.LoopRepeat:a.LoopOnce,1/0])},t.prototype.setSpeed=function(e){this.speed=e,this.action&&(this.action.timeScale=e)},t.prototype.setTime=function(e){this.action&&(this.action.time=e)},t.prototype.setWeight=function(e){this.weight=e,this.action&&(this.action.weight=this.weight)},t.prototype.onShutdown=function(){this.asset&&this.stopListening(this.asset,"stopListening",this.onAssetChanged),this.release(),this.getEntity().off("playAnimation",this.playAnimation,this),this.getEntity().off("pauseAnimation",this.pause,this),this.getEntity().off("stopAnimation",this.stop,this),this.getEntity().off("toggleAnimation",this.toggle,this)},t.prototype.stop=function(){this.action&&this.action.stop()},t.prototype.toggle=function(){this.isPlaying()?this.pause():this.play()},t.prototype.onUpdate=function(e){this.mixer&&(this.mixer.update(e),this.getEngine().needsRender=!0,this.ended&&(this.getEntity().trigger("endAnimation"),this.ended=!1))},t.prototype.onAssetChanged=function(){this.dirty=!0},t.prototype.onMixerEvent=function(e){e.action===this.action&&"finished"===e.type&&(this.needsReset=!0,this.ended=!0)},t}(o.default);t.default=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(3),a=r(1),o=r(2),s=function(e){function t(){var t=e.call(this)||this;return t.context=null,t}return i.__extends(t,e),t.prototype.onStartup=function(){if(this.context=this.getEntity().engine.getAudioContext(),!this.context)return void n.default.warn("Failed to create Web Audio context.")},t.prototype.onUpdate=function(){if(this.hasRuntimeData()&&this.context){var e=this.getRuntimeData().matrixWorld,t=new a.Vector3(0,0,0).applyMatrix4(e),r=new a.Vector3(0,0,-1).applyMatrix4(e).sub(t).normalize(),i=new a.Vector3(0,1,0).applyMatrix4(e).sub(t).normalize();this.context.listener.setPosition(t.x,t.y,t.z),this.context.listener.setOrientation(r.x,r.y,r.z,i.x,i.y,i.z)}},t}(o.default);t.default=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(3),a=r(1),o=r(25),s=r(2),u=r(17),p=r(12),c=function(e){function t(){var t=e.call(this)||this;return t.gainNode=null,t.sourceNode=null,t.pannerNode=null,t.context=null,t.buffer=null,t.startTime=0,t.playOffset=0,t.state="stopped",t.element=null,t.isVideo=!1,t}return i.__extends(t,e),t.prototype.getGain=function(){return this.gain},t.prototype.getState=function(){return this.state},t.prototype.isLoop=function(){return this.loop},t.prototype.isPaused=function(){return"paused"===this.state},t.prototype.isPlaying=function(){return"playing"===this.state},t.prototype.isStopped=function(){return"stopped"===this.state},t.prototype.pause=function(){"playing"===this.state&&(this.playOffset=this.getCurrentTime(),this.state="paused",this.freeAudioGraph())},t.prototype.play=function(e){var t=this;void 0===e&&(e=0),"paused"!==this.state&&"stopped"!==this.state||(this.playOffset+=e,this.initAudioGraph(function(e){return e?void n.default.warn("Error playing audio: "+e):(t.setGain(t.gain),t.setLoop(t.loop),t.stream?(t.element.currentTime=t.playOffset,t.element.play()):t.context?(t.startTime=t.context.currentTime,t.sourceNode.start(0,t.playOffset)):n.default.warn("No Web Audio context."),void(t.state="playing"))}))},t.prototype.setGain=function(e){this.gain=e,this.gainNode?this.gainNode.gain.value=this.gain:this.element&&(this.element.volume=this.gain)},t.prototype.setLoop=function(e){this.loop=e,this.element?this.element.loop=this.loop:this.sourceNode&&(this.sourceNode.loop=this.loop)},t.prototype.stop=function(){"playing"!==this.state&&"paused"!==this.state||(this.playOffset=0,this.state="stopped",this.freeAudioGraph())},t.prototype.toggle=function(){"playing"===this.state?this.pause():this.play()},t.prototype.onStartup=function(){this.context=this.getEntity().engine.getAudioContext(),this.context?(this.gainNode=this.context.createGain(),this.pannerNode=this.context.createPanner()):(n.default.warn("No audio context, using fallback."),this.stream=!0,this.positional=!1),this.isVideo=this.asset instanceof o.default,this.isVideo&&(this.stream=!0),this.autoPlay?this.play():this.preload&&this.load(function(e,t){e&&n.default.warn(e)}),this.listenTo(this.getEntity(),"playAudio",this.play),this.listenTo(this.getEntity(),"pauseAudio",this.pause),this.listenTo(this.getEntity(),"stopAudio",this.stop),this.listenTo(this.getEntity(),"toggleAudio",this.toggle)},t.prototype.onUpdate=function(){if(this.hasRuntimeData()&&this.positional){var e=this.getRuntimeData().matrixWorld,t=new a.Vector3(0,0,0).applyMatrix4(e),r=new a.Vector3(0,0,1).applyMatrix4(e).sub(t).normalize();this.pannerNode.setPosition(t.x,t.y,t.z),this.pannerNode.setOrientation(r.x,r.y,r.z)}},t.prototype.initAudioGraph=function(e){var t=this;this.load(function(r,i){if(r)return e(r);if(!t.context)return e(null,null);var n=[];t.stream?t.sourceNode=t.context.createMediaElementSource(i):(t.sourceNode=t.context.createBufferSource(),t.sourceNode.buffer=i),n.push(t.sourceNode),n.push(t.gainNode),t.positional&&n.push(t.pannerNode),n.push(t.context.destination);for(var a=1;a=0;s--)(n=e[s])&&(o=(a<3?n(o):a>3?n(t,r,o):n(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o}function o(e,t){return function(r,i){t(r,i,e)}}function s(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function u(e,t,r,i){return new(r||(r=Promise))(function(n,a){function o(e){try{u(i.next(e))}catch(e){a(e)}}function s(e){try{u(i.throw(e))}catch(e){a(e)}}function u(e){e.done?n(e.value):new r(function(t){t(e.value)}).then(o,s)}u((i=i.apply(e,t||[])).next())})}function p(e,t){function r(e){return function(t){return i([e,t])}}function i(r){if(n)throw new TypeError("Generator is already executing.");for(;u;)try{if(n=1,a&&(o=a[2&r[0]?"return":r[0]?"throw":"next"])&&!(o=o.call(a,r[1])).done)return o;switch(a=0,o&&(r=[0,o.value]),r[0]){case 0:case 1:o=r;break;case 4:return u.label++,{value:r[1],done:!1};case 5:u.label++,a=r[1],r=[0];continue;case 7:r=u.ops.pop(),u.trys.pop();continue;default:if(o=u.trys,!(o=o.length>0&&o[o.length-1])&&(6===r[0]||2===r[0])){u=0;continue}if(3===r[0]&&(!o||r[1]>o[0]&&r[1]=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}}function h(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var i,n,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(i=a.next()).done;)o.push(i.value)}catch(e){n={error:e}}finally{try{i&&!i.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}return o}function d(){for(var e=[],t=0;t=e&&(t.engine.off("update",i,t),t.trigger("endTimer"))};this.engine.on("update",i,this)},t}(t.baseEntityMixins);f.events={load:{params:[],action:!1,category:"Loading"},loadBase:{params:[],action:!1,category:"Loading"},loadDependencies:{params:[],action:!1,category:"Loading"},startTimer:{params:[{name:"time",description:"The time (in seconds) that will elapse before the 'endTimer' event will be fired.",type:"f",default:5}],action:!0,category:"General"},endTimer:{params:[],action:!1,category:"General"}},f.validators={},f.defaults={},t.default=f},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(3),a=r(1),o=r(9),s=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i.__extends(t,e),t.prototype.initialize=function(){e.prototype.initialize.call(this),this.on("setVisible",this.setVisible,this),this.on("setInvisible",this.setInvisible,this),this.on("toggleVisibility",this.toggleVisibility,this),this.on("change:children",this.onChildrenChanged,this)},t.prototype.uninitialize=function(){this.off("setVisible",this.setVisible,this),this.off("setInvisible",this.setInvisible,this),this.off("toggleVisibility",this.toggleVisibility,this),this.off("change:children",this.onChildrenChanged,this),this.uninitPrefabBindings(),e.prototype.uninitialize.call(this)},t.prototype.getRootObject=function(){var e=this.getParentObject();return e?e.getRootObject():this},t.prototype.reset=function(){this.runtimeData&&(this.runtimeData.position.copy(this.getPosition()),this.runtimeData.quaternion.copy(this.getQuaternion()),this.runtimeData.scale.copy(this.getScale()))},t.prototype.createRuntimeData=function(e){this.runtimeData=new a.Object3D,this.runtimeData.name=this.getRuntimeName(),e()},t.prototype.clone=function(t,r){void 0===r&&(r=!0);var i=e.prototype.clone.call(this);if(i.set("parentId",null),i.set("prefabAssetId",this.get("prefabAssetId")),i.set("prefabObjectId",this.get("prefabObjectId")),r){var n=this.getChildren();n.forEach(function(e){var t=e.clone(void 0,r);i.addChild(t)}),this.isInstanceTop()&&(i.set("prefabInstanceId",i.id),i.traverse(function(e){e.set("prefabInstanceId",i.id)}))}return i},t.prototype.alignToPosition=function(e,t){var r=new a.Vector3(e.x||0,e.y||0,e.z||0),n=this.getQuaternion(),o=this.getScale(),s=this.getCenter(),u=new a.Quaternion(n.x,n.y,n.z,n.w),p=this.getBounds(),c={};c.min=new a.Vector3(p.min.x,p.min.y,p.min.z),c.max=new a.Vector3(p.max.x,p.max.y,p.max.z),c.min.applyQuaternion(u),c.max.applyQuaternion(u);var l=new a.Vector3(s.x,s.y,s.z);l.applyQuaternion(u),c.min.multiply(o),c.max.multiply(o),l.multiply(o),t&&Object.keys(t).forEach(function(e){var i=Math.min(c.min[e],c.max[e]),n=Math.max(c.min[e],c.max[e]),a=.5*t[e]+.5;r[e]-=(1-a)*i+a*n}),this.setProperty("position",i.__assign({},r))},t.prototype.getPosition=function(e){var t=e||new a.Vector3;return t.copy(this.getProperty("position")),t},t.prototype.setPosition=function(e,t,r){if(void 0===r)throw new Error("Calling setPosition with invalid arguments. Expected setPosition( x, y, z ).");this.setProperty("position",{x:e,y:t,z:r})},t.prototype.getQuaternion=function(e){var t=e||new a.Quaternion;return t.copy(this.getProperty("quaternion")),t},t.prototype.setQuaternion=function(e,t,r,i){if(void 0===i)throw new Error("Calling setQuaternion with invalid arguments. Expected setQuaternion( x, y, z, w ).");this.setProperty("quaternion",{x:e,y:t,z:r,w:i})},t.prototype.getScale=function(e){var t=e||new a.Vector3;return t.copy(this.getProperty("scale")),t},t.prototype.setScale=function(e,t,r){if(void 0===r)throw new Error("Calling setScale with invalid arguments. Expected setScale( x, y, z ).");this.setProperty("scale",{x:e,y:t,z:r})},t.prototype.getCenter=function(e){var t=e||new a.Vector3,r=this.getBounds();return t.copy(r.min),t.add(r.max),t.multiplyScalar(.5),t},t.prototype.setVisible=function(){this.setProperty("visible",!0),this.engine.needsRender=!0},t.prototype.setInvisible=function(){this.setProperty("visible",!1),this.engine.needsRender=!0},t.prototype.toggleVisibility=function(){var e=!this.getProperty("visible");this.setProperty("visible",e),this.engine.needsRender=!0},t.prototype.loadBase=function(t){e.prototype.loadBase.call(this,t),this.isInstance()&&this.initPrefabBindings()},t.prototype.reloadBase=function(t){var r=this;this.isInstance()&&this.uninitPrefabBindings();var i=this.runtimeData&&this.runtimeData.parent;i&&i.remove(this.runtimeData);var n=this.runtimeData&&this.runtimeData.children;e.prototype.reloadBase.call(this,function(){i&&i.add(r.runtimeData),n&&n.forEach(function(e){return r.runtimeData.add(e)}),"function"==typeof t&&t()})},t.prototype.unload=function(t){var r=this;if(void 0===t&&(t=!1),this.runtimeData&&this.runtimeData.parent&&this.runtimeData.parent.remove(this.runtimeData),t){var i=this.getChildIds();i.forEach(function(e){var i=r.engine.getObjectById(e);i&&i.unload(t)})}e.prototype.unload.call(this)},t.prototype.destroy=function(){this.engine.destroyObjectById(this.id)},t.prototype.traverse=function(e){var t=this,r=this.getChildren();r.forEach(function(r){e(r,t),r.traverse(e)})},t.prototype.traverseWhile=function(e){var t=this,r=this.getChildren();return r.some(function(r){return e(r,t)||r.traverseWhile(e)})},t.prototype.traverseSome=function(e){var t=this,r=this.getChildren();r.forEach(function(r){e(r,t)||r.traverseSome(e)})},t.prototype.getAncestors=function(e){var t=this.getParentObject();return t?e&&!e(t)?t.getAncestors(e):[t].concat(t.getAncestors(e)):[]},t.prototype.getDescendants=function(e){var t=[],r="function"!=typeof e;return this.traverse(function(i){(r||e(i))&&t.push(i)}),t},t.prototype.getDescendant=function(e){var t,r="function"!=typeof e;return this.traverseWhile(function(i){if(!t&&(r||e(i)))return t=i,!0}),t},t.prototype.getDescendantById=function(e){return this.getDescendant(function(t){return t.id===e})},t.prototype.getDescendantByName=function(e){return this.getDescendant(function(t){return t.getName()===e})},t.prototype.getDescendantByType=function(e){return this.getDescendant(function(t){return t.type===e})},t.prototype.getDescendantByClass=function(e){return this.getDescendant(function(t){return t instanceof e})},t.prototype.getDescendantsByType=function(e){return this.getDescendants(function(t){return t.type===e})},t.prototype.getDescendantsByClass=function(e){return this.getDescendants(function(t){return t instanceof e})},t.prototype.getDescendantsByName=function(e){return this.getDescendants(function(t){return t.getName()===e})},t.prototype.getChildById=function(e){return this.sharedData.children.indexOf(e)!==-1?this.engine.getObjectById(e):null},t.prototype.getChild=function(e){var t=this.getChildren(e);return t.length?t[0]:null},t.prototype.getChildren=function(e){var t=this,r=this.getChildIds(),i="function"!=typeof e;return r.filter(function(r){ +var n=t.getChildById(r);return n&&(i||e(n))}).map(function(e){return t.engine.getObjectById(e)})},t.prototype.getChildrenMap=function(e){var t={},r=this.getChildren(e);return r.forEach(function(e){e&&(t[e.id]=e)}),t},t.prototype.getParentObject=function(){return this.engine.getObjectById(this.get("parentId"))},t.prototype.addChild=function(e,t){this.addChildById(e.id,t)},t.prototype.addChildById=function(e,t){var r=this.engine.getObjectById(e);if(!r)throw new Error("Can't find child object with id, "+e);this.engine.entityDispatcher.dispatchChildAdded(this.id,e,t)},t.prototype.removeChild=function(e,t){this.removeChildById(e.id,t)},t.prototype.removeChildById=function(e,t){var r=this.getChildById(e);if(!r)throw new Error("Object, "+e+", is not a child of this object");this.engine.entityDispatcher.dispatchChildRemoved(this.id,e,t)},t.prototype.getChildIds=function(e){var t="function"!=typeof e;return t?this.sharedData.children.slice():this.sharedData.children.filter(function(t){return e(t)})},t.prototype.setChildIds=function(e,t){void 0===t&&(t=!1),this.engine.entityDispatcher.dispatchChildChanged(this.id,e,t)},t.prototype.scaleToSize=function(e){var t={},r=this.getBounds();t.min=new a.Vector3(r.min.x,r.min.y,r.min.z),t.max=new a.Vector3(r.max.x,r.max.y,r.max.z);var i=t.min.distanceTo(t.max),n=e/i;n<=0&&(n=1),this.setProperty("scale",{x:n,y:n,z:n})},t.prototype.getBounds=function(e){var t=this.getProperty("bounds"),r=e||new a.Box3;return t?r.set(t.min,t.max):this.computeBounds(r)},t.prototype.getSphericalBounds=function(e){var t=e||new a.Sphere,r=this.getBounds();return t.radius=t.center.subVectors(r.max,r.min).multiplyScalar(.5).length(),t.center.addVectors(r.max,r.min).multiplyScalar(.5),t},t.prototype.getLocalBounds=function(e){var t=e||new a.Box3;return t.min.set(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),t.max.set(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE),t},t.prototype.computeBounds=function(e){var t=this.getChildren(),r=this.getLocalBounds(e||new a.Box3),i=new a.Matrix4;return t.forEach(function(e){var t=e.computeBounds();t.isEmpty()||(i.compose(e.getPosition(),e.getQuaternion(),e.getScale()),t.applyMatrix4(i),r.union(t))}),this.setProperty("bounds",{min:{x:r.min.x,y:r.min.y,z:r.min.z},max:{x:r.max.x,y:r.max.y,z:r.max.z}}),r},t.prototype.getPreviousProperty=function(e){var t=this.sharedData.previousProperties[e];if(void 0!==t)return t;var r=this.getPrefabObject();return r?r.getProperty(e):this.getDefaultProperty(e)},t.prototype.getProperty=function(e){var t=this.getOwnProperty(e);if(void 0!==t)return t;var r=this.getPrefabProperty(e);return r?r:this.getDefaultProperty(e)},t.prototype.getProperties=function(){var e=this.getOwnProperties(),t=this.getPrefabObject(),r=this.getDefaultProperties();if(t){var i=t.getOwnProperties();return Object.assign(r,i,e)}return Object.assign(r,e)},t.prototype.getInstanceTop=function(){var e=this.get("prefabInstanceId");return e?this.engine.getObjectById(e):null},t.prototype.getPrefabObject=function(){return this.engine.getObjectById(this.get("prefabObjectId"))},t.prototype.getPrefabProperty=function(e){var t=this.getPrefabObject();if(t)return t.getProperty(e)},t.prototype.isInstance=function(){return!!this.get("prefabObjectId")},t.prototype.isInstanceTop=function(){return this.get("prefabInstanceId")===this.id},t.prototype.breakPrefabLink=function(e){if(void 0===e&&(e=!0),!this.isInstance())throw new Error("breakPrefabLink: Can't call this on an entity that isn't an instance.");e&&this.getChildren().forEach(function(t){t.breakPrefabLink(e)}),this.uninitPrefabBindings(),this.mergeProperties(this.getPrefabObject());var t={};t.prefabInstanceId=void 0,t.prefabObjectId=void 0,t.prefabAssetId=void 0},t.prototype.applyPropertiesLoaded=function(t,r){if(e.prototype.applyPropertiesLoaded.call(this,t,r),t.hasOwnProperty("static")){var i=this.getProperty("static");this.runtimeData.matrixAutoUpdate=!i,this.runtimeData.rotationAutoUpdate=!i,i&&(this.runtimeData.matrixWorldNeedsUpdate=!0,this.runtimeData.updateMatrix())}if(t.hasOwnProperty("visible")&&(this.runtimeData.visible=this.getProperty("visible")),t.hasOwnProperty("castShadow")&&(this.runtimeData.castShadow=this.getProperty("castShadow")),t.hasOwnProperty("receiveShadow")&&(this.runtimeData.receiveShadow=this.getProperty("receiveShadow")),t.hasOwnProperty("frustumCulled")&&(this.runtimeData.frustumCulled=this.getProperty("frustumCulled")),t.hasOwnProperty("position")){var n=this.getPosition();this.runtimeData.position.set(n.x,n.y,n.z)}if(t.hasOwnProperty("quaternion")){var a=this.getQuaternion();this.runtimeData.quaternion.set(a.x,a.y,a.z,a.w)}if(t.hasOwnProperty("scale")){var o=this.getScale();this.runtimeData.scale.set(o.x,o.y,o.z)}},t.prototype.getRuntimeName=function(){return this.engine.getRuntimeName(this.getSid())},t.prototype.initPrefabBindings=function(){var e=this.getPrefabObject();e&&e.on("propertyChanges",this.onPrefabEntityChanged,this)},t.prototype.uninitPrefabBindings=function(){var e=this.getPrefabObject();e&&e.off("propertyChanges",this.onPrefabEntityChanged,this)},t.prototype.onPrefabEntityChanged=function(){n.default.warn("TODO - re-implement updating from prefab changes")},t.prototype.onChildLoaded=function(e){var t=this;this.when("loadBase",function(){t.runtimeData.add(e.runtimeData),t.engine.needsRender=!0})},t.prototype.onChildrenChanged=function(e,t){var r=this;t.forEach(function(e){e&&(e.set("parentId",null),r.unregisterDependency(e),r.stopListening(e,"loadBase",r.onChildLoaded),r.isBaseLoaded()&&e.isBaseLoaded()&&(r.runtimeData.remove(e.runtimeData),r.engine.needsRender=!0))}),e.forEach(function(e){var t=e.getParentObject();t&&t.id!==r.id&&t.removeChildById(e.id,!0),e.set("parentId",r.id),r.listenTo(e,"loadBase",r.onChildLoaded),e.isBaseLoaded()&&(r.isBaseLoaded()?(r.runtimeData.add(e.runtimeData),r.engine.needsRender=!0):r.when("loadBase",function(){r.runtimeData.add(e.runtimeData),r.engine.needsRender=!0})),r.registerDependency(e)})},t}(o.default);s.events={toggleVisibility:{params:[],action:!0,category:"Rendering"},setVisible:{params:[],action:!0,category:"Rendering"},setInvisible:{params:[],action:!0,category:"Rendering"}},t.default=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i,n=r(0),a=r(1),o=r(6),s=r(3);(function(e){e[e.Normal=101]="Normal",e[e.Stereo2dOverUnder=102]="Stereo2dOverUnder",e[e.Stereo2dUnderOver=103]="Stereo2dUnderOver",e[e.Stereo2dLeftRight=104]="Stereo2dLeftRight",e[e.Stereo2dRightLeft=105]="Stereo2dRightLeft",e[e.StereoCubeHorizontal=106]="StereoCubeHorizontal"})(i=t.ImageLayout||(t.ImageLayout={}));var u=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.loadedBytes=0,t}return n.__extends(t,e),t.getThreeImageFormat=function(e){switch(e){case"alpha":return a.AlphaFormat;case"rgb":return a.RGBFormat;case"rgba":return a.RGBAFormat;case"luminance":return a.LuminanceFormat;case"luminanceAlpha":return a.LuminanceAlphaFormat;default:return s.default.warn("Unexpected format: "+e+", defaulting to THREE.RGBFormat"),a.RGBFormat}},t.getThreeImageEncoding=function(e){switch(e){case"linear":return a.LinearEncoding;case"srgb":return a.sRGBEncoding;case"gamma":return a.GammaEncoding;case"rgbe":return a.RGBEEncoding;case"logLuv":return a.LogLuvEncoding;case"rgbm7":return a.RGBM7Encoding;case"rgbm16":return a.RGBM16Encoding;case"rgbd":return a.RGBDEncoding;case"depth":return a.BasicDepthPacking;case"rgbaDepth":return a.RGBADepthPacking;default:return s.default.warn("Unexpected format: "+e+", defaulting to THREE.sRGBEncoding"),a.sRGBEncoding}},t.getThreeImageType=function(e){switch(e){case"uByte":return a.UnsignedByteType;case"byte":return a.ByteType;case"short":return a.ShortType;case"uShort":return a.UnsignedShortType;case"int":return a.IntType;case"uInt":return a.UnsignedIntType;case"float":return a.FloatType;case"halfFloat":return a.HalfFloatType;case"uShort4444":return a.UnsignedShort4444Type;case"uShort5551":return a.UnsignedShort5551Type;case"uShort565":return a.UnsignedShort565Type;default:return s.default.warn("Unexpected format: "+e+", defaulting to THREE.UnsignedByteType"),a.UnsignedByteType}},t.getBytesPerPixel=function(e,r){var i=0;switch(r){case"float":case"uInt":case"int":i=4;break;case"halfFloat":case"short":case"uShort":i=2;break;case"uByte":case"byte":i=1;break;case"uShort4444":case"uShort5551":case"uShort565":return 2}return t.getChannelCount(e)*i},t.getChannelCount=function(e){switch(e){case"alpha":case"luminance":return 1;case"luminanceAlpha":return 2;case"rgb":return 3;case"rgba":return 4;default:return 0}},t.prototype.unload=function(){this.loadedBytes=0,e.prototype.unload.call(this)},t.prototype.getChosenRepresentation=function(){return this.chosenRepresentation},t.prototype.getEncoding=function(){var e=this.getProperty("encoding");if(e)return e;var t=this.getChosenRepresentation();if(t)switch(t.colorspace){case"rgb":case"gray":return"linear";default:return"srgb"}return"srgb"},t.prototype.getDataSizeLoadedSelf=function(){return this.loadedBytes},t.prototype.applyPropertiesUnloaded=function(t){void 0===t&&(t={}),e.prototype.applyPropertiesUnloaded.call(this,t),this.engine.trigger("imageChanged",this.id,t)},t.prototype.getChannelCount=function(e){var r=e||this.getFormat();return t.getChannelCount(r)},t.prototype.getBytesPerPixel=function(){return t.getBytesPerPixel(this.getFormat(),this.getDataType())},t.prototype.getFormat=function(){return this.getProperty("format")},t.prototype.getDataType=function(){return this.getSupportedType(this.getProperty("type"))},t.prototype.getDataSizeDownloadSelf=function(){return this.chosenRepresentation?this.chosenRepresentation.contentLength:1},t.prototype.getSupportedType=function(e){var t=e,r=this.engine.getThreeRenderer(),i=r.extensions;switch(e){case"float":if(i.get("OES_texture_float")){t="float";break}case"halfFloat":t=i.get("OES_texture_half_float")?"halfFloat":"uByte";break;default:t=e}return t},t.prototype.getMipCount=function(){var e=this.getWidth(),t=this.getHeight(),r=Math.max(e,t);return Math.floor(Math.log2(Math.max(r,1)))+1},t.prototype.isPowerOfTwo=function(){var e=this.getWidth(),t=this.getHeight();return a.Math.isPowerOfTwo(e)&&a.Math.isPowerOfTwo(t)},t.prototype.getWidth=function(){var e=this.getMaxRepresentationWidth(),t=this.getMaxTextureSize();return Math.max(1,Math.min(t,e))},t.prototype.getHeight=function(){var e=this.getMaxRepresentationHeight(),t=this.getMaxTextureSize();return Math.max(1,Math.min(t,e))},t.prototype.getMaxRepresentationWidth=function(){return 0},t.prototype.getMaxRepresentationHeight=function(){return 0},t.prototype.getOriginalWidth=function(){return 0},t.prototype.getOriginalHeight=function(){return 0},t.prototype.getMaxTextureSize=function(){return Number.MAX_VALUE},t}(o.default);t.default=u},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i={LOAD:"load",STATE_CHANGE:"state_change",CANCEL:"cancel",ERROR:"error",PROGRESS:"progress",DONE:"done"};t.default=i},function(e,t,r){"use strict";function i(e,t){if(void 0!==e&&null!==e)return Array.isArray(e)?e.forEach(t):void Object.keys(e).forEach(function(r){t(e[r],r)})}function n(e){return Array.isArray(e)?[].concat.apply([],e.map(function(e){return n(e)})):e}function a(e,t){return e.reduce(function(e,r){return e[r[t]]=r,e},{})}function o(e,t){return n(u(e,t))}function s(e){return e}function u(e,t){var r;return void 0===e||null===e?e:Array.isArray(e)?e.map(t):(r={},Object.keys(e).forEach(function(i){r[i]=t(e[i],i)}),r)}function p(e,t){return Object.keys(e).reduce(function(r,i){return t.indexOf(i)===-1&&(r[i]=e[i]),r},{})}e.exports={each:i,flatMap:o,flatten:n,identity:s,indexBy:a,map:u,omit:p}},function(e,t,r){"use strict";function i(e,t){var r=Math.floor(e),i=t?t:{r:(r>>16&255)/255,g:(r>>8&255)/255,b:(255&r)/255};return i}Object.defineProperty(t,"__esModule",{value:!0});var n,a=r(0),o=r(3),s=r(1),u=r(6),p=r(5),c=r(4),l=r(222);(function(e){e[e.STANDIN_TEXTURE_WHITE=0]="STANDIN_TEXTURE_WHITE",e[e.STANDIN_TEXTURE_WHITE_CUBE=1]="STANDIN_TEXTURE_WHITE_CUBE",e[e.STANDIN_TEXTURE_BLACK=2]="STANDIN_TEXTURE_BLACK",e[e.STANDIN_TEXTURE_BLACK_CUBE=3]="STANDIN_TEXTURE_BLACK_CUBE",e[e.STANDIN_TEXTURE_NORMAL=4]="STANDIN_TEXTURE_NORMAL"})(n=t.StandInTexture||(t.StandInTexture={}));var h=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return a.__extends(t,e),t.prototype.initialize=function(){e.prototype.initialize.call(this),this.listenTo(this.engine,"textureDeleted",this.onTextureDeleted)},t.prototype.uninitialize=function(){e.prototype.uninitialize.call(this),this.stopListening(this.engine,"textureDeleted",this.onTextureDeleted)},t.prototype.getProperty=function(t){var r=e.prototype.getProperty.call(this,t);if(void 0===r){var i=this.getShader().getProperty("parameters");i[t]&&(r=i[t].default)}return r},t.prototype.getDefaultProperties=function(){var t=e.prototype.getDefaultProperties.call(this),r=this.getShader().getProperty("parameters");return Object.keys(r).forEach(function(e){t[e]=r[e].default}),t},t.prototype.verifyProperty=function(t,r){return"shader"!==t&&"enabledFeatures"!==t||e.prototype.verifyProperty.call(this,t,r)},t.prototype.setProperty=function(t,r,n){if("shader"===t||"enabledFeatures"===t)return e.prototype.setProperty.call(this,t,r,n);var a=this.getShader(),s=a.getProperty("parameters");if(s[t]){var u=s[t].type,p=void 0;if("t"===u&&("string"==typeof r||null===r)||"f"===u&&"number"==typeof r||"b"===u&&"boolean"==typeof r||"i"===u&&"number"==typeof r&&Math.round(r)===r||"opt"===u&&s[t].options.hasOwnProperty(r))p=r;else if("c"===u){if(p=this.sharedData.properties.hasOwnProperty(t)&&"object"==typeof this.sharedData.properties[t]?this.sharedData.properties[t]:{r:0,g:0,b:0},"string"==typeof r){var c=r;"0x"!==c.slice(0,2)&&(c=String(parseInt(c,10)),c="0x"+c.toString()),i(parseInt(c,16),p)}else if("number"==typeof r){var l=Math.max(0,Math.max(16777215,r));i(l,p)}else if(r&&"number"==typeof r.r&&"number"==typeof r.g&&"number"==typeof r.b){p.r=r.r,p.g=r.g,p.b=r.b;var h=s[t].min,d=s[t].max;void 0!==h&&(p.r=Math.max(p.r,h),p.g=Math.max(p.g,h),p.b=Math.max(p.b,h)),void 0!==d&&(p.r=Math.min(p.r,d),p.g=Math.min(p.g,d),p.b=Math.min(p.b,d))}}else"v"===u.charAt(0)&&"number"==typeof r.x&&"number"==typeof r.y?(p=this.sharedData.properties.hasOwnProperty(t)?this.sharedData.properties[t]:{},p.x=r.x,p.y=r.y,"v3"===u&&"number"==typeof r.z?p.z=r.z:"v4"===u&&"number"==typeof r.z&&"number"==typeof r.w&&(p.z=r.z,p.w=r.w)):"undefined"==typeof r?p=void 0:o.default.error("Wrong type specified for "+t);this.engine.entityDispatcher.dispatchPropertyChanged(this.id,t,p,n)}},t.prototype.getReferencedAssetsList=function(e){var t=this,r=[],i={},n=this.getShader(),a=n.getProperty("parameters"),o=n.getProperty("uniforms"),s=n.getProperty("features");return p.forEach(s,function(n,o){t.isFeatureEnabled(o)&&p.forEach(n.parameters,function(n){var o,s;"t"===a[n].type&&(t.isParameterUsed(n)&&(o=t.getProperty(n)),o&&(s=t.engine.getAssetById(o),i[o]?e&&r.push(s):(i[o]=s,r.push(s))))})}),p.forEach(o,function(n){"t"===n.type&&n.default&&t.getAssetById(n.default)&&(i[n.default]?e&&r.push(t.engine.getAssetById(n.default)):(i[n.default]=t.engine.getAssetById(n.default),r.push(t.engine.getAssetById(n.default))))}),r},t.prototype.getShader=function(){var t=e.prototype.getProperty.call(this,"shader");return this.engine.getAssetById(t)||(t=this.getDefaultProperty("shader")),this.engine.getAssetById(t)},t.prototype.isParameterEditable=function(e){var t=this,r=this.getShader(),i=!1;if(r){var n=r.getProperty("parameters"),a=r.getProperty("features");n[e]&&p.forEach(a,function(r,a){r.parameters.indexOf(e)!==-1&&t.isFeatureEnabled(a)&&(i=!n[e].displayWhen||t.testParameterConditions(n[e].displayWhen))})}return i},t.prototype.getStandInTexture=function(e,t){var r=this.engine.getAssetById(this.getProperty(e));if(r){var i;return t?"normal"===t?i=n.STANDIN_TEXTURE_NORMAL:"bump"===t&&(i=r.isCubeMap()?n.STANDIN_TEXTURE_BLACK:n.STANDIN_TEXTURE_BLACK_CUBE):i=r.isCubeMap()?n.STANDIN_TEXTURE_WHITE_CUBE:n.STANDIN_TEXTURE_WHITE,this.engine.materialUtilities.getStandInTexture(i)}},t.prototype.enableFeature=function(e,t){void 0===t&&(t=!1);var r=this.getShader(),i=this.getProperty("enabledFeatures"),n=r.getProperty("features"),o=a.__assign({},i);"undefined"!=typeof n[e]&&(o[e]=t,this.setProperty("enabledFeatures",o))},t.prototype.unload=function(){var t=this;if(this.getDependencies().forEach(function(e){return t.stopListening(e,"load")}),this.runtimeData){this.engine.trigger("materialUnloaded",this.id),o.default.info(this.engine.getName()+" - Unloading material, "+this.getName());for(var r in this.runtimeData)this.runtimeData.hasOwnProperty(r)&&(this.runtimeData[r].dispose(),delete this.runtimeData[r]);this.runtimeData=null,e.prototype.unload.call(this)}},t.prototype.isFeatureEnabled=function(e){var t=this.getShader(),r=this.getProperty("enabledFeatures"),i=t.getProperty("features");return"undefined"!=typeof i[e]&&(r&&void 0!==r[e]?r[e]:i[e].defaultEnabled||i[e].alwaysEnabled)},t.prototype.applyPropertiesLoaded=function(r,i){var n=this;if(e.prototype.applyPropertiesLoaded.call(this,r,i),r.hasOwnProperty("shader")){var a=this.getShader();a.when("load",function(){for(var e in t.materialObjectTypes)if(n.runtimeData.hasOwnProperty(e)){var r=n.runtimeData[e];r.fragmentShader=a.runtimeData.fragmentShader,r.vertexShader=a.runtimeData.vertexShader,r.uniforms=s.UniformsUtils.clone(a.runtimeData.uniforms),n.addSharedUniforms(r.uniforms);for(var i in a.runtimeData.renderParams)n.runtimeData[e].hasOwnProperty(i)&&(n.isParameterUsed(i)?n.runtimeData[e][i]=a.runtimeData.renderParams[i]:delete n.runtimeData[e][i]);n.runtimeData[e].needsUpdate=!0,n.updateMaterialDefines(),n.updateShaderParameters(n.getProperties()),n.updateTransparency(),n.updateDerivatives(),n.engine.needsRender=!0}}),a.isUnloaded()&&a.load()}else if(r.hasOwnProperty("enabledFeatures"))this.updateMaterialDefines(),this.updateShaderParameters(this.getProperties()),this.updateTransparency(),this.updateDerivatives(),this.engine.needsRender=!0;else{var o=this.getShader(),u=o.getProperty("parameters"),p=!1,c=!1,l=!1;for(var h in r)if(r.hasOwnProperty(h)&&u[h]){if(u[h].transparency&&(p=!0),"undefined"!=typeof u[h].derivatives&&(c=!0),o.getDependentParameters(h).length||u[h].forceUpdate){l=!0;break}this.updateShaderParameter(h)}l&&(this.updateMaterialDefines(),this.updateShaderParameters(this.getProperties()),p=!0,c=!0),p&&this.updateTransparency(),c&&this.updateDerivatives(),this.engine.needsRender=!0}},t.prototype.applyPropertiesUnloaded=function(t){var r=this;void 0===t&&(t={}),e.prototype.applyPropertiesUnloaded.call(this,t);var i,n,a=this.getShader(),o=a.getProperty("parameters"),s=!1;t&&(p.forEach(t,function(e,t){o[t]&&("t"===o[t].type&&(i=r.getProperty(t),n=r.getPreviousProperty(t),r.isParameterUsed(t)?n!==i&&(r.registerDependencyById(i),r.unregisterDependencyById(n)):n!==i&&(s=!0)),(a.getDependentParameters(t).length||o[t].forceUpdate)&&(s=!0))}),(t.enabledFeatures||s)&&this.resetDependencies())},t.prototype.createRuntimeData=function(e){var r=this,i=this.getShader();i.when("load",function(){r.runtimeData={},Object.keys(t.materialObjectTypes).forEach(function(e){var n={};n.vertexShader=i.runtimeData.vertexShader,n.fragmentShader=i.runtimeData.fragmentShader,n.uniforms=s.UniformsUtils.clone(i.runtimeData.uniforms),r.addSharedUniforms(n.uniforms),r.runtimeData[e]=new s.ShaderMaterial(n),r.runtimeData[e].name=r.getName();for(var a in i.runtimeData.renderParams)r.runtimeData[e].hasOwnProperty(a)&&(r.isParameterUsed(a)?r.runtimeData[e][a]=i.runtimeData.renderParams[a]:delete r.runtimeData[e][a]);var o=t.materialObjectTypes[e];p.forEach(o,function(t,i){r.runtimeData[e].hasOwnProperty(i)&&(r.runtimeData[e][i]=t)})}),r.updateMaterialDefines(),e()},this),i.load()},t.prototype.testParameterCondition=function(e,t){var r=this.getShader(),i=r.getProperty("parameters");if(!i[e])return!1;var n=this.getProperty(e);"t"===i[e].type&&(this.engine.getAssetById(n)||(n=null));for(var a in t)if(t.hasOwnProperty(a))switch(a){case"equals":if(n!==t[a])return!1;break;case"notEquals":if(n===t[a])return!1;break;case"equalsDefault":if(n!==i[e].default)return!1;break;case"notEqualsDefault":if(n===i[e].default)return!1;break;default:return!1}return!0},t.prototype.testParameterConditions=function(e){var t=!0;for(var r in e)if(e.hasOwnProperty(r))if("or"===r){if(!this.testParameterConditionsOr(e[r])){t=!1;break}}else if(!this.testParameterCondition(r,e[r])){t=!1;break}return t},t.prototype.testParameterConditionsOr=function(e){for(var t=!1,r=0,i=e;r1)return!0;return!1},t.prototype.isParameterUsed=function(e){var t,r,i=this,n=this.getShader(),a=!1;return n&&(t=n.getProperty("parameters"),r=n.getProperty("features"),t[e]&&p.forEach(r,function(r,n){r.parameters.indexOf(e)!==-1&&i.isFeatureEnabled(n)&&(a=!t[e].enabledWhen||i.testParameterConditions(t[e].enabledWhen))})),a},t.prototype.onTextureLoaded=function(e){var r=this;if(!e.isLoadFailed()){var i=e.getThreeTexture();if(i){var n=this.getShader(),a=n.getProperty("parameters"),o=Object.keys(a).filter(function(t){return"t"===a[t].type&&r.isParameterUsed(t)&&r.getProperty(t)===e.id});o.forEach(function(e){r.setThreeValue(e,i)});var s=o.some(function(e){return a[e].forceUpdate});s&&Object.keys(t.materialObjectTypes).forEach(function(e){r.runtimeData[e].needsUpdate=!0}),this.engine.needsRender=!0}}},t.prototype.updateShaderParameter=function(e){var r=this,i=this.getShader(),n=i.getProperty("parameters"),a=n[e];if(a){var o=!0,s=this.getProperty(e);switch(a.type.charAt(0)){case"t":var u=this.engine.getAssetById(s);if(u&&this.isParameterUsed(e)){var p=this.getPreviousProperty(e);if(p!==this.getProperty(e)){var c=this.engine.getEntityById(p);c&&this.stopListening(c,"load",this.onTextureLoaded)}this.stopListening(u,"load",this.onTextureLoaded),this.listenTo(u,"load",this.onTextureLoaded),s=this.getStandInTexture(e,a.textureUsage),this.engine.needsRender=!0,u.isUnloaded()?u.load():u.isLoaded()&&this.onTextureLoaded.call(this,u),u.isLoaded()&&(o=!1)}else s=null;break;case"b":a.animation&&s&&(t.timeValueInUse=!0),s=s?1:0;break;case"v":a.animation&&(s.x||s.y||s.z||s.w)&&(t.timeValueInUse=!0);break;case"o":s=a.options[s]}o&&this.setThreeValue(e,s),a.forceUpdate&&Object.keys(t.materialObjectTypes).forEach(function(e){r.runtimeData[e].needsUpdate=!0})}},t.prototype.getThreeValue=function(e,t){var r,i=this.getShader(),n=i.getProperty("parameters"),a=n[e],o=a.uniformName||e;if(a.isRenderParam)r=this.runtimeData[t][o];else if(a.isUniform){var u=this.runtimeData[t].uniforms[o];r=u?u.value:null}if("c"===a.type)r||(r=new s.Color(a.default.r,a.default.g,a.default.b));else if("v"===a.type.charAt(0)&&!r){var p=a.default;switch(a.type.charAt(1)){case"4":r=new s.Vector4(p.x,p.y,p.z,p.w);break;case"3":r=new s.Vector3(p.x,p.y,p.z);break;case"2":r=new s.Vector2(p.x,p.y)}}return r},t.prototype.setThreeValue=function(e,r){var i=this;if(this.runtimeData){var n=this.getShader(),a=n.getProperty("parameters"),o=a[e],s=o.uniformName||e;Object.keys(t.materialObjectTypes).forEach(function(t){var n=i.getThreeValue(e,t);if("c"===o.type)n.setRGB(r.r,r.g,r.b);else if("v"===o.type.charAt(0))switch(o.type.charAt(1)){case"4":n.w=r.w;case"3":n.z=r.z;case"2":n.x=r.x,n.y=r.y}else"t"===o.type?(n&&r&&n.encoding===r.encoding&&n.mapping===r.mapping||(i.runtimeData[t].needsUpdate=!0),n=r):n=r;if(o.isUniform){var a=i.runtimeData[t].uniforms[s];if(!a)throw new Error("Trying to set non-existent uniform "+s);a.value=n}o.isRenderParam&&(i.runtimeData[t][s]=n)})}},t.prototype.setExtension=function(e,r){var i=this;this.runtimeData&&Object.keys(t.materialObjectTypes).forEach(function(t){i.runtimeData[t].extensions.hasOwnProperty(e)&&(i.runtimeData[t].extensions[e]=r)})},t.prototype.onTextureDeleted=function(e){var t=this,r=this.getOwnProperties(),i=Object.keys(r).filter(function(t){return r[t]===e});i.forEach(function(e){t.setProperty(e,null)})},t}(u.default);h.builtInAssetDescriptors={missingMaterial:{id:"missingMaterial",type:"material",properties:{name:"Missing Material",albedoColor:{r:.8275,g:.8275,b:.8275}}}},h.materialObjectTypes={static:{lights:!0,fog:!0,skinning:!1},skinned:{lights:!0,fog:!0,skinning:!0},staticTangents:{lights:!0,fog:!0,skinning:!1,defines:{USE_TANGENTS:!0}},skinnedTangents:{lights:!0,fog:!0,skinning:!0,defines:{USE_TANGENTS:!0}},depthStatic:{lights:!1,fog:!1,vertexColors:s.NoColors,skinning:!1,defines:{DEPTH_PASS:!0}},depthSkinned:{lights:!1,fog:!1,vertexColors:s.NoColors,skinning:!0,defines:{DEPTH_PASS:!0}}},h.sharedUniforms={time:{type:"f",value:0},screenDimensions:{type:"v4",value:new s.Vector4}},h.timeValueInUse=!1,c.addSchemas("MaterialAsset",h),t.default=h},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(41),a=i.__assign({},n.default,{id:"baseObject",title:"BaseObjectDef",properties:i.__assign({},n.default.properties,{parentId:{type:"string",description:"The ID of the entity's parent."},prefabAssetId:{type:"string"},prefabObjectId:{type:"string"},prefabInstanceId:{type:"string"},children:{type:"array",items:{type:"string"},default:[],description:"The IDs of this entity's children."},properties:{$ref:"baseObjectProperties.json"}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(e){if("node"===e)return e;var t,r=e.match(/(edge(?=\/))\/?\s*(\d+)/i)||[],i=e.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i)||[];return r.length&&(i=r),/trident/i.test(i[1])?(t=/\brv[ :]+(\d+)/g.exec(e)||[],"IE "+(t[1]||"")):"Chrome"===i[1]&&(t=e.match(/\bOPR\/(\d+)/),null!=t)?"Opera "+t[1]:(i=i[2]?[i[1],i[2]]:[navigator.appName,navigator.appVersion,"-?"],t=e.match(/version\/(\d+)/i),null!=t&&i.splice(1,1,t[1]),i.join(" "))},n={isMobile:void 0,isIOS:void 0,isAndroid:void 0,isMac:void 0,isLinux:void 0,isUnix:void 0,isWindows:void 0,isChrome:void 0,isFirefox:void 0,isSafari:void 0,isOpera:void 0,isEdge:void 0,isIpad:void 0,isNode:void 0,isIE:void 0,isIE11:void 0,isAndroidTablet:void 0,isTablet:void 0},a="undefined"!=typeof navigator?navigator.userAgent:"node",o=function(){var e=i(a),t={isMobile:/iphone|ipad|ipod|android|blackberry|bb10|mini|windows\sce|palm/i.test(a),isIOS:/iphone|ipad|ipod/i.test(a),isAndroid:/android/i.test(a),isMac:/mac/i.test(a),isLinux:/linux/i.test(a),isUnix:/x11/i.test(a),isWindows:/windows/i.test(a),isChrome:/chrome/i.test(a),isFirefox:/firefox/i.test(a),isSafari:/safari/i.test(a),isOpera:/opera/i.test(a),isEdge:/edge/i.test(a),isIpad:/ipad/i.test(a),isNode:"node"===a,isIE:/ie/i.test(e),isIE11:/ie 11/i.test(e)};t.isAndroidTablet=t.isAndroid&&!/mobile/i.test(a),t.isTablet=t.isIpad||t.isAndroidTablet,Object.keys(t).forEach(function(e){n[e]=t[e]})};o(),t.setUserAgent=function(e){a=e,o()},t.isMobile=function(){return n.isMobile},t.isIOS=function(){return n.isIOS},t.isAndroid=function(){return n.isAndroid},t.isMac=function(){return n.isMac},t.isLinux=function(){return n.isLinux},t.isUnix=function(){return n.isUnix},t.isWindows=function(){return n.isWindows},t.isChrome=function(){return n.isChrome},t.isFirefox=function(){return n.isFirefox},t.isSafari=function(){return n.isSafari},t.isOpera=function(){return n.isOpera},t.isEdge=function(){return n.isEdge},t.isAndroidTablet=function(){return n.isAndroidTablet},t.isIpad=function(){return n.isIpad},t.isTablet=function(){return n.isTablet},t.isIE=function(){return n.isIE},t.isIE11=function(){return n.isIE11},t.isNode=function(){return n.isNode}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i;(function(e){e[e.BUFFER=1]="BUFFER",e[e.IMAGE=2]="IMAGE",e[e.VIDEO=3]="VIDEO",e[e.ENTITIES=4]="ENTITIES"})(i||(i={})),t.default=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(72),a=i.__assign({},n.default,{id:"nodeObjectProperties",title:"NodeObjectPropertiesDef",properties:i.__assign({},n.default.properties),required:["position","scale","quaternion"]});t.default=a},function(e,t,r){var i=r(263),n=r(264),a=n;a.v1=i,a.v4=n,e.exports=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(3),a=r(1),o=r(9),s=r(6),u=r(11),p=r(24),c=r(11),l=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i.__extends(t,e),t.createColorTexture=function(e,t,r,i){void 0===e&&(e=255),void 0===t&&(t=255),void 0===r&&(r=255);var n=a.RGBFormat,o=void 0!==i?4:3,s=new Uint8Array(o);s[0]=e,s[1]=t,s[2]=r,4===o&&(s[3]=i,n=a.RGBAFormat);var u=new a.DataTexture(s,1,1,n,void 0,void 0,void 0,void 0,void 0,void 0);return u.needsUpdate=!0,u},t.createColorTextureCube=function(e,r,i,n){void 0===e&&(e=255),void 0===r&&(r=255),void 0===i&&(i=255);var o=[0,1,2,3,4,5].map(function(a){return t.createColorTexture(e,r,i,n)}),s=new a.CubeTexture(o);return s.generateMipmaps=!1,s.format=o[0].format,s.minFilter=a.NearestFilter,s.magFilter=a.NearestFilter,s.needsUpdate=!0,s},t.getMissingTexture=function(){return t.missingTexture2d||(t.missingTexture2d=t.createColorTexture()),t.missingTexture2d},t.getMissingTextureCube=function(){return t.missingTextureCube||(t.missingTextureCube=t.createColorTextureCube()),t.missingTextureCube},t.prototype.initialize=function(){var t=this;e.prototype.initialize.call(this),this.listenTo(this.engine,"imageUnloaded",function(e){t.getProperty("imageId")===e&&t.unload()})},t.prototype.createRuntimeData=function(e){var r=this,i=function(){r.runtimeData=t.getMissingTexture(),r.setState(o.StateType.Base,o.State.Failed), +r.trigger("loadProgress",r),"function"==typeof e&&e.call(r)},n=this.getImage();if(n){var a=function(t){return t.runtimeData?(r.createTextureData(t.runtimeData),void("function"==typeof e&&e.call(r))):void i()};this.listenTo(n,"load",a),n.isLoaded()&&a.call(this,n),n.isUnloaded()&&n.load()}else i()},t.prototype.createTextureData=function(e){n.default.warn("Need to implement createTextureData in derrived class.")},t.prototype.unload=function(){var t=this.getImage();t&&this.stopListening(t,"load"),this.runtimeData&&(this.engine.trigger("textureUnloaded",this.id),n.default.info(this.engine.getName()+" - Unloading texture, "+this.getName()),this.runtimeData.dispose()),e.prototype.unload.call(this)},t.prototype.applyPropertiesLoaded=function(t,r){e.prototype.applyPropertiesLoaded.call(this,t,r);var i=this.runtimeData instanceof a.WebGLRenderTarget?this.runtimeData.texture:this.runtimeData;i.flipY=!1,t.hasOwnProperty("uMapping")&&(i.wrapS=this.getThreeAddressMode(this.getAddressModeU())),t.hasOwnProperty("vMapping")&&(i.wrapT=this.getThreeAddressMode(this.getAddressModeV())),t.hasOwnProperty("anisotropy")&&(i.anisotropy=this.getProperty("anisotropy")),t.hasOwnProperty("minFilter")&&(i.minFilter=this.getThreeFilter(this.getMinFilter())),t.hasOwnProperty("magFilter")&&(i.magFilter=this.getThreeFilter(this.getMagFilter())),t.hasOwnProperty("generateMipmaps")&&(i.generateMipmaps=this.isMipmapsEnabled()),this.engine.needsRender=!0},t.prototype.applyPropertiesUnloaded=function(t){if(void 0===t&&(t={}),e.prototype.applyPropertiesUnloaded.call(this,t),t.hasOwnProperty("imageId")){var r=this.getPreviousProperty("imageId");r&&this.unregisterDependencyById(r),t.imageId&&this.registerDependencyById(this.getProperty("imageId"))}this.engine.trigger("textureChanged",this.id,t)},t.prototype.getAddressModeU=function(){return this.getSupportedAddressMode(this.getProperty("uMapping"))},t.prototype.getAddressModeV=function(){return this.getSupportedAddressMode(this.getProperty("vMapping"))},t.prototype.getSupportedAddressMode=function(e){var t=this.getImage();return t&&!t.isPowerOfTwo()?"clamp":e},t.prototype.getLayout=function(){var e=this.getProperty("layout");if(e)return e;var t=this.getImage();return t?t.getProperty("layout"):c.ImageLayout.Normal},t.prototype.getWidth=function(){var e=this.getImage();return e?e.getWidth():1},t.prototype.getHeight=function(){var e=this.getImage();return e?e.getHeight():1},t.prototype.getMinFilter=function(){return this.getSupportedFilter(this.getProperty("minFilter"))},t.prototype.getMagFilter=function(){return this.getSupportedFilter(this.getProperty("magFilter"))},t.prototype.getSupportedFilter=function(e){var t=this.getDataType();if(!this.isLinearFilterAvailableForType(t))return"nearest";if(!this.isMipmapsEnabled())switch(e){default:case"nearest":case"nearestWithNearestMipmap":case"nearestWithLinearMipmap":return"nearest";case"linear":case"linearWithNearestMipmap":case"linearWithLinearMipmap":return"linear"}return e},t.prototype.getDataType=function(){var e=this.getProperty("type");if(!e){var t=this.getImage();return t?t.getDataType():"uByte"}var r=e,i=this.engine.getThreeRenderer(),n=i.extensions;switch(e){case"float":if(n.get("OES_texture_float")){r="float";break}case"halfFloat":r=n.get("OES_texture_half_float")?"halfFloat":"uByte";break;default:r=e}return r},t.prototype.getFormat=function(){var e=this.getProperty("format");if(!e){var t=this.getImage();return t?t.getFormat():"rgb"}return e},t.prototype.getMipCount=function(){if(!this.getProperty("generateMipmaps"))return 1;var e=this.getImage();return e?e.getMipCount():1},t.prototype.getImage=function(){return this.engine.getAssetById(this.getProperty("imageId"))},t.prototype.getDataSizeInMemorySelf=function(){var e=this.getImage();if(e instanceof p.default){var t=e.getChosenRepresentation();if(!t)return e.getDataSizeInMemory();if(t.compression&&"zip"!==t.compression&&"jpeg"!==t.compression)return this.getDataSizeDownloadSelf();if(this.getHdrPackingType(t.channels))return this.getWidth()*this.getHeight()*u.default.getBytesPerPixel("rgb",this.getDataType())}return this.getWidth()*this.getHeight()*u.default.getBytesPerPixel(this.getFormat(),this.getDataType())},t.prototype.isCubeMap=function(){return"textureCube"===this.type||"renderTextureCube"===this.type},t.prototype.isLinearFilterAvailableForType=function(e){var t=this.engine.getThreeRenderer(),r=t.extensions;switch(e){case"halfFloat":return!!r.get("OES_texture_half_float_linear");case"float":return!!r.get("OES_texture_float_linear");default:return!0}},t.prototype.isMipmapsEnabled=function(){if(!this.isLinearFilterAvailableForType(this.getDataType()))return!1;var e=this.getImage();return!(e&&!e.isPowerOfTwo())&&this.getProperty("generateMipmaps")},t.prototype.getHdrPackingType=function(e){return e&&4===e.length&&"exponent"===e[3]?"rgbe":null},t.prototype.createDxtTextureData=function(e){var t,r,i,n=new a.CompressedTexture(null,0,0),o=this.parseDDS(e,!0);if(n.format=o.format,n.generateMipmaps=!1,o.isCubemap){n.flipY=!1;var s=n.image=[];for(i=o.mipmaps.length/o.mipmapCount,t=0;t>8&255,e>>16&255,e>>24&255)}function o(e,t,r,i){var n,a,o,s,u,p,c=r*i*4,l=new Uint8Array(e,t,c),h=new Uint8Array(c),d=0,f=0;for(a=0;ae?t.width:e},0):0},t.prototype.getMaxRepresentationHeight=function(){var e=this.get("representations");return e?e.reduce(function(e,t){return t.height>e?t.height:e},0):0},t.prototype.getMaxTextureSize=function(){var t=this.engine.getRenderer();return t?t.getMaxTextureSize2d():e.prototype.getMaxTextureSize.call(this)},t.prototype.getImageResponseType=function(e){switch(e){case"dxt":case"dxt1":case"dxt5":return"arraybuffer";default:return"blob"}},t.prototype.applyPropertiesUnloaded=function(e){var t={maxSize:Math.max(this.getWidth(),this.getHeight()),compression:this.getCompressionFormat()};this.chosenRepresentation=this.findRepresentation(t)},t.prototype.createRuntimeData=function(e){var t=this;if(!this.chosenRepresentation)throw new Error("No suitable representation found to load");this.loadLowResImage(e).then(function(){return t.loadHighResImage(e)}).catch(this.onImageLoadError.bind(this))},t.prototype.loadLowResImage=function(e){var t=this;if(this.loadPriority=2,!this.getProperty("stream"))return Promise.resolve();var r={maxSize:64,compression:this.getCompressionFormat()},i=this.findRepresentation(r);return i?new Promise(function(r,n){var a=t.loadResource(i.src,u.default.IMAGE,e,{priority:t.loadPriority,responseType:t.getImageResponseType(i.compression),isExternal:i.isExternal});a.once(s.default.LOAD,function(e){t.onImageLoad(e,i),t.loadPriority=8,r()}),a.once(s.default.CANCEL,function(){n(new Error("Failed to load low res texture"))}),a.once(s.default.ERROR,n)}):Promise.resolve()},t.prototype.loadHighResImage=function(e){var t=this;if(!this.isDestroyed())return new Promise(function(r,i){var n=function(e){t.isDestroyed()||(t.loadedBytes=t.getDataSizeDownload()*e.loaded/e.total,t.trigger("loadProgress",t))};t.setState(a.StateType.Base,a.State.InProgress);var o=t.chosenRepresentation,p=t.loadResource(o.src,u.default.IMAGE,e,{responseType:t.getImageResponseType(o.compression),isExternal:o.isExternal,priority:t.loadPriority});p.once(s.default.PROGRESS,n),p.once(s.default.LOAD,function(e){t.onImageLoad(e,o)}),p.once(s.default.ERROR,i)})},t.prototype.onImageLoad=function(e,t){if(this.runtimeData||(this.runtimeData={}),this.runtimeData.compression=t.compression,this.runtimeData.colorspace=t.colorspace,this.runtimeData.channels=t.channels||c,this.runtimeData.width=t.width,this.runtimeData.height=t.height,!(e instanceof ArrayBuffer||e instanceof Image))throw new Error("Uknown container type for image data!");this.runtimeData.imageData=e,this.loadedBytes=this.getDataSizeDownload(),this.trigger("loadProgress",this)},t.prototype.onImageLoadError=function(e){this.isDestroyed()||(n.default.error("There was an error loading the image, "+this.getName(),e),this.setState(a.StateType.Base,a.State.Failed),this.loadedBytes=this.getDataSizeDownload(),this.trigger("loadProgress",this))},t.prototype.findRepresentation=function(e){void 0===e&&(e={});var t=this.get("representations");if(!t||0===t.length)return null;var r=Object.assign({maxSize:l},e),i=t.filter(function(e){if(e.compression===r.compression)return!0;switch(e.compression){case"zip":case"jpeg":return!r.compression;case"dxt":case"dxt1":case"dxt5":return"dxt"===r.compression}return!1});0===i.length&&(i=t.filter(function(e){return"zip"===e.compression||"jpeg"===e.compression}));var n=i.filter(function(e){var t=e.channels||c;return!r.channels||t.toString()===r.channels.toString()});0===n.length&&(n=i);var a=n.map(function(e){return r.maxSize-Math.max(e.width||1,e.height||1)}),o=a.reduce(function(e,t,r){var i=e>=0?a[e]:Number.MAX_VALUE;return t>=0&&t=0?n[o]:null},t}(o.default);p.addSchemas("ImageAsset",h),t.default=h},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(11),a=r(17),o=r(12),s=r(4),u=1080,p=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i.__extends(t,e),t.prototype.initialize=function(){e.prototype.initialize.call(this),this.engine.on("update",this.onUpdate,this),this.on("pause",this.pause,this),this.on("play",this.play,this),this.on("stop",this.stop,this),this.on("toggle",this.toggle,this)},t.prototype.uninitialize=function(){this.engine.off("update",this.onUpdate,this),this.off("pause",this.pause,this),this.off("play",this.play,this),this.off("stop",this.stop,this),this.off("toggle",this.toggle,this),this.runtimeData&&this.runtimeData.image&&this.runtimeData.image.pause(),e.prototype.uninitialize.call(this)},t.prototype.createRuntimeData=function(e){var t=this,r=function(e){e&&(e.style.display="none",e.loop=t.getProperty("loop"),e.autoplay=t.getProperty("autoPlay"),e.muted=t.getProperty("muted"),t.runtimeData||(t.runtimeData={}),t.runtimeData.imageData=e,t.runtimeData.width=e.width,t.runtimeData.height=e.height,t.loadedBytes=t.getDataSizeDownload(),t.trigger("loadProgress",t))},i=this.engine.getRenderer().getCanvas().parentElement,n=this.getProperty("querySelector");if(n){var s=i.querySelector(n);r(s),e()}else{var u=this.findRepresentation();if(u){var p=this.loadResource(u.src,a.default.VIDEO,e);p.on(o.default.PROGRESS,function(e){t.loadedBytes=t.getDataSizeDownload()*e.loaded/e.total,t.trigger("loadProgress",t)}),p.once(o.default.LOAD,function(e){i.appendChild(e),r(e)})}}},t.prototype.applyPropertiesUnloaded=function(e){var t=this.findRepresentation();this.chosenRepresentation=t},t.prototype.applyPropertiesLoaded=function(t,r){if(e.prototype.applyPropertiesLoaded.call(this,t,r),this.runtimeData&&this.runtimeData.imageData){var i=this.runtimeData.imageData;t.hasOwnProperty("loop")&&(i.loop=this.getProperty("loop")),t.hasOwnProperty("muted")&&(i.muted=this.getProperty("muted")),t.hasOwnProperty("autoPlay")&&(i.autoplay=this.getProperty("autoPlay"))}},t.prototype.getMaxRepresentationWidth=function(){var e=this.get("representations");return e?e.reduce(function(e,t){return t.video&&t.video.width>e?t.video.width:e},0):0},t.prototype.getMaxRepresentationHeight=function(){var e=this.get("representations");return e?e.reduce(function(e,t){return t.video&&t.video.height>e?t.video.height:e},0):0},t.prototype.onUpdate=function(){if(this.runtimeData){var e=this.runtimeData.imageData;e&&!e.paused&&!e.error&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.engine.needsRender=!0)}},t.prototype.pause=function(){this.runtimeData&&this.runtimeData.image.pause()},t.prototype.play=function(e,t){this.runtimeData&&(e&&(this.runtimeData.imageData.currentTime=t),this.runtimeData.imageData.play())},t.prototype.stop=function(){this.runtimeData&&(this.runtimeData.imageData.pause(),this.runtimeData.imageData.currentTime=0)},t.prototype.toggle=function(){this.runtimeData&&(this.runtimeData.imageData.paused?this.play():this.pause())},t.prototype.getOriginalWidth=function(){var e=this.getProperty("streams")||[];return e.reduce(function(e,t){return Math.max(t.width||0,e)},0)},t.prototype.getOriginalHeight=function(){var e=this.getProperty("streams")||[];return e.reduce(function(e,t){return Math.max(t.height||0,e)},0)},t.prototype.getMaxTextureSize=function(){var t=this.engine.getRenderer();return t?t.getMaxTextureSize2d():e.prototype.getMaxTextureSize.call(this)},t.prototype.findRepresentation=function(e){void 0===e&&(e={});var t=this.get("representations");if(!t||0===t.length)return null;var r=Object.assign({maxHeight:u},e),i=t.map(function(e){return r.maxHeight-(e.video||{}).height||0}),n=i.reduce(function(e,t,r){var n=e>=0?i[e]:Number.MAX_VALUE;return t>=0&&t=0?t[n]:null},t}(n.default);p.events={pause:{params:[],action:!0,category:""},play:{params:[{name:"seek",type:"b",description:"",default:!1},{name:"seekTime",type:"f",description:"",default:0}],action:!0,category:""},stop:{params:[],action:!0,category:""},toggle:{params:[],action:!0,category:""}},s.addSchemas("VideoAsset",p),t.default=p},function(e,t,r){"use strict";function i(e,t){return Math.abs(e.x-t.x)this.pitchAngleBoundsMax?this.targetEuler.x=this.pitchAngleBoundsMax:this.targetEuler.x=this.getMaterialCount())throw new Error("Invalid index parameter");var r=this.getMaterialIds()[e];if(r){var i=this.engine.getAssetById(r);if(i)return i}return t?this.engine.materialUtilities.getMissingMaterial():null},t.prototype.getPreviousMaterial=function(e,t){if(void 0===e&&(e=0),void 0===t&&(t=!0),e<0||e>=this.getMaterialCount())throw new Error("Invalid index parameter");var r=this.getPreviousMaterialIds()[e];if(r){var i=this.engine.getAssetById(r);if(i)return i}return t?this.engine.materialUtilities.getMissingMaterial():null},t.prototype.getMaterialCount=function(){return this.getMaterialIds().length},t.prototype.getMaterials=function(e){void 0===e&&(e=!0);for(var t=[],r=this.getMaterialCount(),i=0;i=this.getMaterialCount())throw new Error("Invalid index parameter");var r=e instanceof s.default?e.id:e,i=(this.getOwnProperty("materials")||[]).slice();i[t]!==r&&(i[t]=r,this.setProperty("materials",i))},t.prototype.getMaterialIds=function(){for(var e=this.getProperty("materials"),t=this.getPrefabObject(),r=t?t.getProperty("materials"):[],i=[],n=Math.max(e.length,r.length),a=0;at)p.engine.off("update",l,p),p.setProperty("color",e);else{var h=Math.min(c/t,1),d=(1-h)*a+h*r,f=(1-h)*o+h*i,m=(1-h)*s+h*n;p.runtimeData.color.setRGB(d,f,m)}};t?(u=this.getProperty("color"),a=(u>>16&255)/255,o=(u>>8&255)/255,s=(255&u)/255,r=(e>>16&255)/255,i=(e>>8&255)/255,n=(255&e)/255,this.engine.on("update",l,this)):this.setProperty("color",e)},t.prototype.setIntensity=function(e,t){var r,i=this,n=0,a=function(o){if(n+=o,n>t)i.engine.off("update",a,i),i.setProperty("intensity",e);else{var s=Math.min(n/t,1),u=(1-s)*r+s*e;i.runtimeData.intensity=u}};t?(r=this.getProperty("intensity"),this.engine.on("update",a,this)):this.setProperty("intensity",e)},t}(o.default);u.events={setColor:{scope:"local",action:!0,category:"Materials",params:[{name:"value",type:"c",description:"The colour to set.",default:16711680},{name:"animationTime",type:"f",description:"The length of time that the change will take. i.e. this lets you animate the change.",default:0,min:0}]},setIntensity:{scope:"local",action:!0,category:"Materials",params:[{name:"value",type:"f",description:"The intensity to set.",default:1},{name:"animationTime",type:"f",description:"The length of time that the change will take. i.e. this lets you animate the change.",default:0,min:0}]}},s.addSchemas("LightObject",u),t.default=u},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(12);t.makeXhr=function(e){return function(t){return e(t.path,t.params).then(function(e){return t.loaderData.xhr=e,Promise.resolve(t)})}},t.loadXhr=function(e){return new Promise(function(t,r){e.setLoading();var n=function(e){return parseInt(e.getResponseHeader("Content-Length"),10)},a=function(e){return{total:e.lengthComputable&&e.target?n(e.target):0,loaded:e.loaded}},o=function(){e.loaderData.xhr.abort(),t(e),e.off(i.default.CANCEL,o)},s=function(){e.off(i.default.CANCEL,o),t(e)},u=function(t){e.off(i.default.CANCEL,o),r(t)};e.on(i.default.CANCEL,o),e.loaderData.xhr.send(),e.loaderData.xhr.addEventListener("load",s),e.loaderData.xhr.addEventListener("error",u),e.loaderData.xhr.addEventListener("progress",function(t){return e.trigger(i.default.PROGRESS,a(t))})})},t.requireStatus=function(e){return function(t){return e(t.loaderData.xhr.status)?Promise.resolve(t):Promise.reject(new Error("Failed to load: "+t.path+" status: "+t.loaderData.xhr.status))}},t.setResponseType=function(e){return function(t){return t.loaderData.xhr.responseType=t.params.responseType||e,Promise.resolve(t)}},t.handleError=function(e){return function(t){return e.setError(t),Promise.reject(t)}},t.unlessCancelled=function(e){return function(t){return t.isCancelled()?Promise.resolve(t):e(t)}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i={$schema:"http://json-schema.org/draft-04/schema",id:"baseEntity",title:"BaseEntityDef",type:"object",description:"Base hierarchical type for assets and objects.",properties:{type:{type:"string",description:"The entity's type."},sid:{type:"string",description:"The entity's scoped ID."},id:{type:"string",description:"The entity's unique ID."},properties:{$ref:"baseEntityProperties.json"},previousProperties:{$ref:"baseEntityProperties.json"},components:{type:"array",items:{$ref:"component.json"},default:[]},previousComponents:{type:"array",items:{$ref:"component.json"},default:[]}},additionalProperties:!1,required:["id"]};t.default=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i={$schema:"http://json-schema.org/draft-04/schema",id:"baseEntityProperties",title:"BaseEntityPropertiesDef",type:"object",description:"Holds type-specific properties.",properties:{name:{type:"string",description:"The entity's name.",default:"unnamed"}},additionalProperties:!1};t.default=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(32),a=i.__assign({},n.default,{id:"baseRenderTextureAsset",title:"BaseRenderTextureAssetDef",properties:i.__assign({},n.default.properties,{properties:{$ref:"baseRenderTextureAssetProperties.json"}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(22),a=i.__assign({},n.default,{id:"baseRenderTextureAssetProperties",title:"BaseRenderTextureAssetPropertiesDef",properties:i.__assign({},n.default.properties,{stencilBuffer:{type:"boolean",default:!1},depthBuffer:{type:"boolean",default:!1},encoding:{type:"string",description:"The encoding of the image (e.g. 'srgb', 'linear', etc.).",default:"srgb"}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i={$schema:"http://json-schema.org/draft-04/schema",id:"commonImageProperties",title:"CommonImagePropertiesDef",type:"object",properties:{width:{type:"integer",description:"The width, in pixels, of the original image file."},height:{type:"integer",description:"The height, in pixels, of the original image file."},format:{type:"string",default:"rgb"},type:{type:"string",default:"uByte"},encoding:{type:"string",description:"The encoding of the image (e.g. 'srgb', 'linear', etc.). If undefined, the encoding will be inferred.",default:void 0},layout:{type:"string",default:"normal"}},additionalProperties:!1};t.default=i},function(e,t,r){"use strict";function i(e,t){Object.getOwnPropertyNames(t).forEach(function(r){"constructor"===r||e.hasOwnProperty(r)||Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}function n(e,t){var r=function(r){var n=this,a={};r&&i(a,r),e&&i(a,e),t.forEach(function(e){e.call(n,a)})};return t.forEach(function(e){i(r.prototype,e.prototype)}),r}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(29);t.default=new i.default},function(e,t){e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(3),a=r(1),o=r(6),s=r(21),u=r(5),p=r(4),c=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.clips={},t}return i.__extends(t,e),t.prototype.getAnimationClip=function(e){return this.clips[e]},t.prototype.getChannel=function(e){return this.getProperty("channels")[e]},t.prototype.getChannelIds=function(){return Object.keys(this.getProperty("channels"))},t.prototype.getChannels=function(){return u.values(this.getProperty("channels"))},t.prototype.getClip=function(e){return this.getProperty("clips")[e]},t.prototype.getClipIds=function(){return Object.keys(this.getProperty("clips"))},t.prototype.getClips=function(){return u.values(this.getProperty("clips"))},t.prototype.getLayer=function(e){return this.getProperty("layers")[e]},t.prototype.getLayerIds=function(){return Object.keys(this.getProperty("layers"))},t.prototype.getLayers=function(){return u.values(this.getProperty("layers"))},t.prototype.createRuntimeData=function(e){var t=this;this.when("loadDependencies",function(){if(!t.isDestroyed()){var r=t.getDependencies(),i=r.some(function(e){return e.isLoadFailed()});i||t.createClips(),e()}},this)},t.prototype.applyPropertiesUnloaded=function(t){void 0===t&&(t={}),e.prototype.applyPropertiesUnloaded.call(this,t),t.hasOwnProperty("channels")&&this.registerBufferDependency()},t.prototype.registerBufferDependency=function(){var e=this,t=this.getChannels(),r=[];t.forEach(function(e){r.push(e.times),r.push(e.values)}),r.forEach(function(t){var r=t.split("#");if(2!==r.length)throw new Error(e.engine.getName()+" - AnimationAsset: Invalid accessorId, "+t);e.registerDependencyById(r[0])})},t.prototype.createClips=function(){var e=this,t=this.getClipIds();t.forEach(function(t){e.clips[t]=e.createClip(t)})},t.prototype.createClip=function(e){var t=this,r=this.getClip(e);if(!r)throw new Error('Invalid argument: clip "'+e+'" not found');r.layers.length>1&&n.default.warn('Clip "'+e+'" contains multiple layers, but AnimationAsset.prototype.createAnimation() only supports a single layer.');var i=this.getLayer(r.layers[0]),o=i?i.channels.map(function(e){return t.getChannel(e)}):[],s=o.map(function(e){return t.createKeyframeTrack(e,r.start,r.stop)});return new a.AnimationClip(r.name,r.stop-r.start,s)},t.prototype.createKeyframeTrack=function(e,t,r){var i=this,n=e.times.split("#"),o=n[0],u=n[1],p=this.engine.getEntityById(o);if(!p)throw new Error(this.engine.getName()+" - AnimationAsset: BufferAsset not found, "+o);var c=p.getAccessor(u),l=p.getArray(u);if(!c||!l)throw new Error(this.engine.getName()+" - AnimationAsset: Accessor not found, "+u);var h=e.values.split("#"),d=h[0],f=h[1],m=this.engine.getEntityById(d);if(!m)throw new Error(this.engine.getName()+" - AnimationAsset: BufferAsset not found, "+d);var y=m.getAccessor(f),g=m.getArray(f);if(!y||!g)throw new Error(this.engine.getName()+" - AnimationAsset: Accessor not found, "+f);var v,b=e.targetObject.map(function(e){return i.engine.getRuntimeName(e)}),P=b.join("/")+"."+e.targetProperty,x="quaternion"===e.targetProperty?a.QuaternionKeyframeTrack:a.VectorKeyframeTrack,E=-1;for(v=0;v=t){E=v;break}var w=-1;for(v=l.length;v-- >0;)if(l[v]<=r){w=v;break}var S=E>=0?E:0,D=w>=0?w+1:l.length,_=s.default.getTypeSize(y.type),M=l.subarray(S,D),A=g.subarray(S*_,D*_),T=0===t?M:M.slice().map(function(e){return e-t});return new x(P,T,A,null)},t}(o.default);p.addSchemas("AnimationAsset",c),t.default=c},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(6),a=r(4),o=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i.__extends(t,e),t.prototype.uninitialize=function(){this.runtimeData&&this.runtimeData.pause(),e.prototype.uninitialize.call(this)},t.prototype.applyPropertiesLoaded=function(t,r){if(e.prototype.applyPropertiesLoaded.call(this,t,r),this.runtimeData&&(t.hasOwnProperty("loop")&&(this.runtimeData.loop=this.getProperty("loop")),t.hasOwnProperty("state")))switch(this.getProperty("state")){case"pause":this.runtimeData.pause();break;case"play":this.runtimeData.play()}},t}(n.default);a.addSchemas("AudioAsset",o),t.default=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(20),a=r(24),o=r(11),s=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i.__extends(t,e),t.prototype.createRuntimeData=function(e){this.createRTImageData(),this.trigger("loadProgress",this),e()},t.prototype.getLayout=function(){return this.getProperty("layout")},t.prototype.getWidth=function(){return this.getProperty("width")},t.prototype.getHeight=function(){return this.getProperty("height")},t.prototype.getMipCount=function(){return a.default.prototype.getMipCount.call(this)},t.prototype.applyPropertiesLoaded=function(t,r){e.prototype.applyPropertiesLoaded.call(this,t,r),(t.hasOwnProperty("format")||t.hasOwnProperty("type")||t.hasOwnProperty("width")||t.hasOwnProperty("height"))&&(this.runtimeData.__webglFramebuffer&&(this.runtimeData.dispose(),delete this.runtimeData.__webglFramebuffer),this.runtimeData.texture.format=o.default.getThreeImageFormat(this.getProperty("format")),this.runtimeData.texture.type=o.default.getThreeImageType(this.getDataType()),this.runtimeData.texture.height=this.getHeight(),this.runtimeData.texture.width=this.getWidth()),this.runtimeData.texture.encoding=o.default.getThreeImageEncoding(this.getProperty("encoding"))},t}(n.default);t.default=s},function(e,t,r){ +"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(3),a=r(1),o=r(23),s=r(9),u=r(21),p=r(5),c=r(4),l=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return i.__extends(r,t),r.prototype.getBounds=function(e){var t=this.getProperty("bounds"),r=e||new a.Box3;return r.set(t.min,t.max)},r.prototype.getDataSizeInMemorySelf=function(){return 0},r.prototype.applyPropertiesUnloaded=function(e){t.prototype.applyPropertiesUnloaded.call(this,e),e.accessorId&&this.registerBufferDependency()},r.prototype.createRuntimeData=function(e){var t=this;this.when("loadDependencies",function(){if(!t.isDestroyed()){var r=t.getDependencies(),i=r.some(function(e){return e.isLoadFailed()});if(i)t.setState(s.StateType.Base,s.State.Failed);else try{t.decode()}catch(e){n.default.error(e.toString()),t.setState(s.StateType.Base,s.State.Failed)}e()}})},r.prototype.createBufferAttribute=function(e,t,r,i){var n=r.num_points(),o=i.components_count(),s=n*o,u=new e.DracoFloat32Array;t.GetAttributeFloatForAllPoints(r,i,u);for(var p=new Float32Array(s),c=0;c0&&(f.addGroup(v,x,g),v+=x),g=P}}var E=3*c-v;E>0&&f.addGroup(v,E,g),e.destroy(y)}else f.addGroup(0,3*c,-1);var w=this.getProperty("bounds"),S=new a.Vector3(w.min.x,w.min.y,w.min.z),D=new a.Vector3(w.max.x,w.max.y,w.max.z);f.boundingBox=new a.Box3(S,D),f.computeBoundingSphere(),this.addMissingAttributes(f),this.setGeometry(o.default.primitiveType.TRIANGLES,f)},r.prototype.decode=function(){var t=e.Module;if(!t)throw new Error("Draco module not found");var r=u.default.getBufferArray(this.engine,this.getProperty("accessorId")),i=new t.DecoderBuffer;i.Init(r,r.byteLength),i.Init(r,r.byteLength);var a=new t.WebIDLWrapper,o=a.GetEncodedGeometryType(i);if(o===t.TRIANGULAR_MESH){var s=a.DecodeMeshFromBuffer(i);this.createBufferGeometry(t,a,s),t.destroy(s)}else n.default.warn(this.engine.getName()+(" - DracoGeometryAsset: Unrecognized geometry type '"+o+"'"));t.destroy(a),t.destroy(i)},r.prototype.registerBufferDependency=function(){var e=this.getProperty("accessorId"),t=e.split("#");if(2!==t.length)throw new Error(this.engine.getName()+" - DracoGeometryAsset: Invalid accessorId, "+e);this.registerDependencyById(t[0])},r}(o.default);c.addSchemas("DracoGeometryAsset",l),t.default=l}).call(t,r(76))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(3),a=r(1),o=r(23),s=r(9),u=r(21),p=r(5),c=r(4),l=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i.__extends(t,e),t.prototype.getBounds=function(e){var t=this.getProperty("bounds"),r=e||new a.Box3;return r.set(t.min,t.max)},t.prototype.getDataSizeInMemorySelf=function(){var e=this,t=this.getProperty("attributes");return Object.keys(t).map(function(r){var i=t[r],n=u.default.getBufferAccessor(e.engine,i.accessorId);return u.default.getComponentTypeSize(n.componentType)*u.default.getTypeSize(n.type)*n.count}).reduce(function(e,t){return t+e},0)},t.prototype.applyPropertiesUnloaded=function(t){e.prototype.applyPropertiesUnloaded.call(this,t),(t.attributes||t.indices)&&this.registerBufferDependency()},t.prototype.createRuntimeData=function(e){var t=this;this.when("loadDependencies",function(){if(!t.isDestroyed()){var r=t.getDependencies(),i=r.some(function(e){return e.isLoadFailed()});if(i)t.setState(s.StateType.Base,s.State.Failed);else try{t.createBufferGeometry()}catch(e){n.default.error(e.toString()),t.setState(s.StateType.Base,s.State.Failed)}e()}})},t.prototype.createAttributes=function(e){var t=this,r={indices:"index",positions:"position",normals:"normal",tangents:"tangent",colors:"color",uvs1:"uv",uvs2:"uv2",skinIndices:"skinIndex",skinWeights:"skinWeight"},i=Object.assign({indices:{accessorId:this.getProperty("indices")}},this.getProperty("attributes")),n={};return p.forEach(r,function(r,a){if(i.hasOwnProperty(a)){var o=i[a].accessorId;n[r]=t.createBufferAttribute(o,e[r])}}),n},t.prototype.createBufferAttribute=function(e,t){var r=u.default.getBufferAccessor(this.engine,e),i=u.default.getBufferArray(this.engine,e),n=u.default.getTypeSize(r.type);if(void 0===t||n===t)return new a.BufferAttribute(i,n);for(var o=new i.constructor(r.count*t),s=Math.min(n,t),p=0;p1&&(this.opacity=1,this.fadeInTime=0,this.opacityTime=0)):this.fadeOutTime&&(this.getEngine().needsRender=!0,this.opacityTime===-1?(this.disable(),this.opacity=0,this.fadeOutTime=0,this.opacityTime=0,this.disable()):(this.opacityTime-=e,this.opacityTime<=0?(this.opacity=1e-4,this.opacityTime=-1):this.opacity=this.opacityTime/this.fadeOutTime)),this.animationTotalTime>0){this.getEngine().needsRender=!0,this.animationTime+=e;var r=this.animationTime/this.animationTotalTime;r>=1&&(this.animationTotalTime=0,r=1),this.x=(1-r)*this.oldX+r*this.targetX,this.y=(1-r)*this.oldY+r*this.targetY,this.width=(1-r)*this.oldWidth+r*this.targetWidth,this.height=(1-r)*this.oldHeight+r*this.targetHeight,this.updateCameraProjection()}this.getRuntimeData().layers.set(this.renderLayer),this.getRenderer().renderView(t.runtimeData,this.getRuntimeData(),{viewPort:{x:this.x,y:this.y,width:this.width,height:this.height},enablePreRenderFunctions:this.enablePreRenderFunctions,enableShadows:this.enableShadows,clearColor:this.clearColor,clearDepth:this.clearDepth,delta:e,opacity:this.opacity,renderTarget:this.renderTarget,effect:this.effect})}}},t.prototype.setViewport=function(e,t,r,i,n){this.viewportLeft=e.toString(),this.viewportBottom=t.toString(),this.viewportWidth=r.toString(),this.viewportHeight=i.toString(),n?(this.animationTotalTime=n,this.animationTime=0,this.oldX=this.x,this.oldY=this.y,this.oldWidth=this.width,this.oldHeight=this.height,this.updateViewport(),this.targetX=this.x,this.targetY=this.y,this.targetWidth=this.width,this.targetHeight=this.height,this.x=this.oldX,this.y=this.oldY,this.width=this.oldWidth,this.height=this.oldHeight):(this.resize(),this.animationTotalTime=0)},t.prototype.updateViewport=function(){var e,t=this.getEngine().getRenderer().getWidth(),r=this.getEngine().getRenderer().getHeight();"%"===this.viewportBottom.slice(-1)?(e=.01*parseFloat(this.viewportBottom.slice(0,-1)),this.y=e*r):this.y=parseInt(this.viewportBottom,10),"%"===this.viewportLeft.slice(-1)?(e=.01*parseFloat(this.viewportLeft.slice(0,-1)),this.x=e*t):this.x=parseInt(this.viewportLeft,10),"%"===this.viewportWidth.slice(-1)?(e=.01*parseFloat(this.viewportWidth.slice(0,-1)),this.width=e*t):this.width=parseInt(this.viewportWidth,10),this.width=Math.min(this.width,t-this.x),"%"===this.viewportHeight.slice(-1)?(e=.01*parseFloat(this.viewportHeight.slice(0,-1)),this.height=e*r):this.height=parseInt(this.viewportHeight,10),this.height=Math.min(this.height,r-this.y),this.x<0&&(this.x+=t),this.y<0&&(this.y+=r)},t.prototype.enableRenderView=function(e){this.enable(),e?(this.fadeOutTime=0,this.fadeInTime=e,this.opacityTime=0,this.opacity=0):this.opacity=1},t.prototype.disableRenderView=function(e){e?(this.fadeInTime=0,this.opacityTime=e,this.fadeOutTime=e,this.opacity=1):(this.disable(),this.opacity=0)},t.prototype.toggleRenderView=function(e){this.isEnabled()?this.disableRenderView(e):this.enableRenderView(e)},t.prototype.updateCameraProjection=function(){var e,t=this.getRuntimeData();t&&(e=this.width/this.height,t instanceof n.PerspectiveCamera?t.aspect=e:(t.left=t.bottom*e,t.right=t.top*e),t.updateProjectionMatrix())},t.prototype.resize=function(){this.updateViewport(),this.updateCameraProjection()},t}(a.default);t.default=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(1),a=r(10),o=r(4),s=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i.__extends(t,e),t.prototype.createRuntimeData=function(e){this.runtimeData=new n.Bone(null),this.runtimeData.name=this.getRuntimeName(),e(this)},t}(a.default);o.addSchemas("BoneObject",s),t.default=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(1),a=r(10),o=r(4),s=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i.__extends(t,e),t.prototype.createRuntimeData=function(e){var t=this.getProperty("cameraType");"orthographic"===t?this.runtimeData=new n.OrthographicCamera(this.getProperty("left")||0,this.getProperty("right")||0,this.getProperty("top")||0,this.getProperty("bottom")||0):this.runtimeData=new n.PerspectiveCamera,this.runtimeData.name=this.getRuntimeName(),e(this)},t.prototype.reset=function(){if(e.prototype.reset.call(this),this.runtimeData){var t=this.getProperty("cameraType");"orthographic"===t?this.resetOrthographicRTData():this.resetPerspectiveRTData()}},t.prototype.applyPropertiesLoaded=function(t,r){if(e.prototype.applyPropertiesLoaded.call(this,t,r),t.hasOwnProperty("cameraType")&&this.getProperty("cameraType")!==this.getPreviousProperty("cameraType")&&"init"!==r)return void this.reloadBase();var i=this.getProperty("cameraType");"perspective"===i?(t.hasOwnProperty("fov")||t.hasOwnProperty("aspect")||t.hasOwnProperty("near")||t.hasOwnProperty("far"))&&this.resetPerspectiveRTData():"orthographic"===i&&(t.hasOwnProperty("left")||t.hasOwnProperty("right")||t.hasOwnProperty("top")||t.hasOwnProperty("bottom")||t.hasOwnProperty("near")||t.hasOwnProperty("far"))&&this.resetOrthographicRTData()},t.prototype.resetOrthographicRTData=function(){this.runtimeData.left=this.getProperty("left"),this.runtimeData.right=this.getProperty("right"),this.runtimeData.top=this.getProperty("top"),this.runtimeData.bottom=this.getProperty("bottom"),this.runtimeData.near=this.getProperty("near"),this.runtimeData.far=this.getProperty("far"),this.runtimeData.updateProjectionMatrix()},t.prototype.resetPerspectiveRTData=function(){this.runtimeData.fov=this.getProperty("fov"),this.runtimeData.aspect=this.getProperty("aspect"),this.runtimeData.near=this.getProperty("near"),this.runtimeData.far=this.getProperty("far"),this.runtimeData.updateProjectionMatrix()},t}(a.default);o.addSchemas("CameraObject",s),t.default=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(10),a=r(4),o=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i.__extends(t,e),t}(n.default);a.addSchemas("NodeObject",o),t.default=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i;(function(e){e[e.STARTING=0]="STARTING",e[e.LOADING=1]="LOADING",e[e.PROCESSING=2]="PROCESSING",e[e.COMPLETE=3]="COMPLETE",e[e.CANCELLED=4]="CANCELLED",e[e.ERROR=5]="ERROR"})(i||(i={})),t.default=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(7),a=i.__assign({},n.default,{id:"baseImageAsset",title:"BaseImageAssetDef",properties:i.__assign({},n.default.properties,{properties:{$ref:"baseImageAssetProperties.json"}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(8),a=r(45),o=i.__assign({},n.default,a.default,{id:"baseImageAssetProperties",title:"BaseImageAssetPropertiesDef",properties:i.__assign({},n.default.properties,a.default.properties,{premultiplyAlpha:{type:"boolean",default:!1},stream:{type:"boolean",description:"True if a low-resolution image should be loaded before the full-size image.",default:!0},filename:{type:"string",description:"The filename of the original image.",default:""},compression:{type:"string",description:"The type of compression used for the original image file.",default:"zip"},depth:{type:"integer",description:"The bit-depth of each channel in the original image file.",default:8},sequenceLength:{type:"integer",description:"The number of images contained in the original image file.",default:1},channels:{type:"array",item:{type:"string"},description:"The distinct channels found in the original image file.",default:["red","green","blue"]}})});t.default=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(42),a=i.__assign({},n.default,{id:"baseObjectProperties",title:"BaseObjectPropertiesDef",properties:i.__assign({},n.default.properties,{position:{$ref:"vector3.json",default:{x:0,y:0,z:0}},quaternion:{$ref:"vector4.json",default:{x:0,y:0,z:0,w:1}},scale:{$ref:"vector3.json",default:{x:1,y:1,z:1}},castShadow:{type:"boolean",default:!0},receiveShadow:{type:"boolean",default:!0},visible:{type:"boolean",default:!0},bounds:{$ref:"box3.json"}}),required:["position","scale","quaternion"]});t.default=a},function(e,t,r){e.exports=!r(190)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(e,t,r){var i=r(36),n=r(35),a=r(75),o=r(252),s=r(189),u="prototype",p=function(e,t,r){var c,l,h,d,f=e&p.F,m=e&p.G,y=e&p.S,g=e&p.P,v=e&p.B,b=m?i:y?i[t]||(i[t]={}):(i[t]||{})[u],P=m?n:n[t]||(n[t]={}),x=P[u]||(P[u]={});m&&(r=t);for(c in r)l=!f&&b&&void 0!==b[c],h=(l?b:r)[c],d=v&&l?s(h,i):g&&"function"==typeof h?s(Function.call,h):h,b&&o(b,c,h,e&p.U),P[c]!=h&&a(P,c,d),g&&x[c]!=h&&(x[c]=h)};i.core=n,p.F=1,p.G=2,p.S=4,p.P=8,p.B=16,p.W=32,p.U=64,p.R=128,e.exports=p},function(e,t,r){var i=r(250),n=r(251);e.exports=r(73)?function(e,t,r){return i.f(e,t,n(1,r))}:function(e,t,r){return e[t]=r,e}},function(e,t){var r;r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(6),a=r(4),o=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i.__extends(t,e),t.prototype.createRuntimeData=function(e){return e()},t.prototype.getEntityId=function(e){return this.runtimeData?this.runtimeData.entityIds[e]:void 0},t}(n.default);a.addSchemas("DocumentAsset",o),t.default=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(225),a=!1,o={},s=function(){function e(t){this.engine=t,a||(a=!0,e.registerScripts(n.default)),this.initBuiltInScripts()}return e.registerScript=function(e,t){if(!e.id)throw new Error("Component definition is lacking an id attribute!");if(!t)throw new Error("A constructor must be provided!");o[e.id]={def:e,constructor:t}},e.registerScripts=function(t){t.forEach(function(t){var r=t[0],i=t[1];return e.registerScript(r,i)})},e.prototype.initBuiltInScripts=function(){var e=this;Object.keys(o).forEach(function(t){var r=o[t],n=e.engine.createEntity(i.__assign({},r.def,{type:"script"})),a=r.constructor;n.sharedData.classConstructor=a})},e}();t.default=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(3),a=r(1),o=r(2),s=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.dirty=!0,t.paused=!1,t.needsReset=!1,t.ended=!1,t}return i.__extends(t,e),t.prototype.onEntityLoaded=function(){var e=this;this.mixer&&this.mixer._root===this.getRuntimeData()||(this.mixer=new a.AnimationMixer(this.getRuntimeData()),this.mixer.addEventListener("finished",function(t){return e.onMixerEvent(t)}))},t.prototype.getTime=function(){return this.action?this.action.time:0},t.prototype.onStartup=function(){this.asset&&this.listenTo(this.asset,"propertyChanges",this.onAssetChanged),this.getEntity().on("playAnimation",this.playAnimation,this),this.getEntity().on("pauseAnimation",this.pause,this),this.getEntity().on("stopAnimation",this.stop,this),this.getEntity().on("toggleAnimation",this.toggle,this)},t.prototype.isPlaying=function(){return this.action&&this.action.isScheduled()&&!this.paused},t.prototype.load=function(e){var t=this;return this.mixer?(this.release(),this.asset?(this.asset.when("load",function(){var r=t.asset.getAnimationClip(t.clipId);return r?(t.action=t.mixer.clipAction(r),t.action?(t.action.setLoop(t.loop?a.LoopRepeat:a.LoopOnce,1/0),t.action.timeScale=t.speed,t.action.time=t.startTime,t.action.weight=t.weight,t.action.clampWhenFinished=!0,t.action.paused=t.paused,t.dirty=!1,t.getEntity().trigger("animationLoaded"),void(e&&e(null,t))):void(e&&e(new Error("Failed to create THREE.AnimationAction")))):void(e&&e(new Error('Failed to get animation clip "'+t.clipId+'"')))}),void(this.asset.isUnloaded()&&this.asset.load())):void(e&&e(new Error("No asset assigned")))):void(e&&e(new Error("Mixer is not initialized")))},t.prototype.pause=function(){this.paused=!0,this.action&&(this.action.paused=this.paused)},t.prototype.play=function(){var e=this;return this.paused=!1,this.dirty?void this.load(function(t){return t?void n.default.error("Error playing animation: ",t.toString()):void e.play()}):void(this.action&&(this.needsReset&&(this.action.reset(),this.action.time=this.startTime,this.needsReset=!1),this.action.play(),this.action.paused=this.paused))},t.prototype.playAnimation=function(e,t,r,i,n){void 0!==e&&this.setAsset(this.getEngine().getEntityById(e)),void 0!==t&&this.setClipId(t),this.loop=void 0!==r?r:this.loop,this.speed=void 0!==i?i:this.speed,this.startTime=void 0!==n?n:this.startTime,this.play()},t.prototype.release=function(){this.stop(),this.action&&(this.action.stop(),this.action=void 0)},t.prototype.setAsset=function(e){this.asset!==e&&(this.asset&&(this.stopListening(this.asset,"propertyChanges",this.onAssetChanged),this.unregisterDependency(this.asset)),this.asset=e,this.dirty=!0,this.asset&&(this.listenTo(this.asset,"propertyChanges",this.onAssetChanged),this.registerDependency(this.asset)))},t.prototype.setClipId=function(e){this.clipId!==e&&(this.clipId=e,this.dirty=!0)},t.prototype.setLoop=function(e){this.loop=e,this.action&&this.action.setLoop.apply(this.action,[this.loop?a.LoopRepeat:a.LoopOnce,1/0])},t.prototype.setSpeed=function(e){this.speed=e,this.action&&(this.action.timeScale=e)},t.prototype.setTime=function(e){this.action&&(this.action.time=e)},t.prototype.setWeight=function(e){this.weight=e,this.action&&(this.action.weight=this.weight)},t.prototype.onShutdown=function(){this.asset&&this.stopListening(this.asset,"stopListening",this.onAssetChanged),this.release(),this.getEntity().off("playAnimation",this.playAnimation,this),this.getEntity().off("pauseAnimation",this.pause,this),this.getEntity().off("stopAnimation",this.stop,this),this.getEntity().off("toggleAnimation",this.toggle,this)},t.prototype.stop=function(){this.action&&this.action.stop()},t.prototype.toggle=function(){this.isPlaying()?this.pause():this.play()},t.prototype.onUpdate=function(e){this.mixer&&(this.mixer.update(e),this.getEngine().needsRender=!0,this.ended&&(this.getEntity().trigger("endAnimation"),this.ended=!1))},t.prototype.onAssetChanged=function(){this.dirty=!0},t.prototype.onMixerEvent=function(e){e.action===this.action&&"finished"===e.type&&(this.needsReset=!0,this.ended=!0)},t}(o.default);t.default=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(3),a=r(1),o=r(2),s=function(e){function t(){var t=e.call(this)||this;return t.context=null,t}return i.__extends(t,e),t.prototype.onStartup=function(){if(this.context=this.getEntity().engine.getAudioContext(),!this.context)return void n.default.warn("Failed to create Web Audio context.")},t.prototype.onUpdate=function(){if(this.hasRuntimeData()&&this.context){var e=this.getRuntimeData().matrixWorld,t=new a.Vector3(0,0,0).applyMatrix4(e),r=new a.Vector3(0,0,-1).applyMatrix4(e).sub(t).normalize(),i=new a.Vector3(0,1,0).applyMatrix4(e).sub(t).normalize();this.context.listener.setPosition(t.x,t.y,t.z),this.context.listener.setOrientation(r.x,r.y,r.z,i.x,i.y,i.z)}},t}(o.default);t.default=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(3),a=r(1),o=r(25),s=r(2),u=r(17),p=r(12),c=function(e){function t(){var t=e.call(this)||this;return t.gainNode=null,t.sourceNode=null,t.pannerNode=null,t.context=null,t.buffer=null,t.startTime=0,t.playOffset=0,t.state="stopped",t.element=null,t.isVideo=!1,t}return i.__extends(t,e),t.prototype.getGain=function(){return this.gain},t.prototype.getState=function(){return this.state},t.prototype.isLoop=function(){return this.loop},t.prototype.isPaused=function(){return"paused"===this.state},t.prototype.isPlaying=function(){return"playing"===this.state},t.prototype.isStopped=function(){return"stopped"===this.state},t.prototype.pause=function(){"playing"===this.state&&(this.playOffset=this.getCurrentTime(),this.state="paused",this.freeAudioGraph())},t.prototype.play=function(e){var t=this;void 0===e&&(e=0),"paused"!==this.state&&"stopped"!==this.state||(this.playOffset+=e,this.initAudioGraph(function(e){return e?void n.default.warn("Error playing audio: "+e):(t.setGain(t.gain),t.setLoop(t.loop),t.stream?(t.element.currentTime=t.playOffset,t.element.play()):t.context?(t.startTime=t.context.currentTime,t.sourceNode.start(0,t.playOffset)):n.default.warn("No Web Audio context."),void(t.state="playing"))}))},t.prototype.setGain=function(e){this.gain=e,this.gainNode?this.gainNode.gain.value=this.gain:this.element&&(this.element.volume=this.gain)},t.prototype.setLoop=function(e){this.loop=e,this.element?this.element.loop=this.loop:this.sourceNode&&(this.sourceNode.loop=this.loop)},t.prototype.stop=function(){"playing"!==this.state&&"paused"!==this.state||(this.playOffset=0,this.state="stopped",this.freeAudioGraph())},t.prototype.toggle=function(){"playing"===this.state?this.pause():this.play()},t.prototype.onStartup=function(){this.context=this.getEntity().engine.getAudioContext(),this.context?(this.gainNode=this.context.createGain(),this.pannerNode=this.context.createPanner()):(n.default.warn("No audio context, using fallback."),this.stream=!0,this.positional=!1),this.isVideo=this.asset instanceof o.default,this.isVideo&&(this.stream=!0),this.autoPlay?this.play():this.preload&&this.load(function(e,t){e&&n.default.warn(e)}),this.listenTo(this.getEntity(),"playAudio",this.play),this.listenTo(this.getEntity(),"pauseAudio",this.pause),this.listenTo(this.getEntity(),"stopAudio",this.stop),this.listenTo(this.getEntity(),"toggleAudio",this.toggle)},t.prototype.onUpdate=function(){if(this.hasRuntimeData()&&this.positional){var e=this.getRuntimeData().matrixWorld,t=new a.Vector3(0,0,0).applyMatrix4(e),r=new a.Vector3(0,0,1).applyMatrix4(e).sub(t).normalize();this.pannerNode.setPosition(t.x,t.y,t.z),this.pannerNode.setOrientation(r.x,r.y,r.z)}},t.prototype.initAudioGraph=function(e){var t=this;this.load(function(r,i){if(r)return e(r);if(!t.context)return e(null,null);var n=[];t.stream?t.sourceNode=t.context.createMediaElementSource(i):(t.sourceNode=t.context.createBufferSource(),t.sourceNode.buffer=i),n.push(t.sourceNode),n.push(t.gainNode),t.positional&&n.push(t.pannerNode),n.push(t.context.destination);for(var a=1;a=this.updateFrameInterval&&this.isEnabled()&&(this.framesElapsed=0,this.captureScene()))},t.prototype.getCubeCamera=function(){return this.cubeCamera},t.prototype.createTempRenderTexture=function(){this.tempRenderTexture=this.getEngine().createRenderTextureCube({width:512,height:512,format:"rgba",type:"uByte"},"render_tex_cube"),this.tempRenderTexture.load()},t.prototype.initCameras=function(){this.cubeCamera=new n.Object3D;var e=90,t=1;this.cameraPX=new n.PerspectiveCamera(e,t,this.near,this.far),this.cameraPX.up.set(0,-1,0),this.cameraPX.lookAt(new n.Vector3(1,0,0)),this.cubeCamera.add(this.cameraPX),this.cameraNX=new n.PerspectiveCamera(e,t,this.near,this.far),this.cameraNX.up.set(0,-1,0),this.cameraNX.lookAt(new n.Vector3(-1,0,0)),this.cubeCamera.add(this.cameraNX),this.cameraPY=new n.PerspectiveCamera(e,t,this.near,this.far),this.cameraPY.up.set(0,0,1),this.cameraPY.lookAt(new n.Vector3(0,1,0)),this.cubeCamera.add(this.cameraPY),this.cameraNY=new n.PerspectiveCamera(e,t,this.near,this.far),this.cameraNY.up.set(0,0,-1),this.cameraNY.lookAt(new n.Vector3(0,-1,0)),this.cubeCamera.add(this.cameraNY),this.cameraPZ=new n.PerspectiveCamera(e,t,this.near,this.far),this.cameraPZ.up.set(0,-1,0),this.cameraPZ.lookAt(new n.Vector3(0,0,1)),this.cubeCamera.add(this.cameraPZ),this.cameraNZ=new n.PerspectiveCamera(e,t,this.near,this.far),this.cameraNZ.up.set(0,-1,0),this.cameraNZ.lookAt(new n.Vector3(0,0,-1)),this.cubeCamera.add(this.cameraNZ)},t}(a.default);t.default=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(3),a=r(5),o=r(1),s=r(2),u=function(e){function t(){var t=e.call(this)||this;return t.controlPoints=void 0,t.prevControlPointsLength=0,t.closed=!1,t.tempVector=new o.Vector3,t.tempVector4=new o.Vector4,t.tempMatrix=new o.Matrix4,t.visualizationCurveColor=2236962,t.visualizationSelectedCurveColor=874150,t.orientationHelpers=[],t.canTryUpdateAgain=!0,t.curveMaterial=void 0,t.curveGeometry=void 0,t.curveMesh=void 0,t.curveTessellation=200,t.selected=!1,t.updateStarted=!1,t}return i.__extends(t,e),t.prototype.onSelected=function(){this.selected=!0,this.curveMaterial&&this.curveMaterial.color.setHex(this.visualizationSelectedCurveColor),this.orientationHelpers.forEach(function(e){return e.traverse(function(e){e.visible=!0})})},t.prototype.onUnselected=function(){this.selected=!1,this.curveMaterial&&this.curveMaterial.color.setHex(this.visualizationCurveColor),this.orientationHelpers.forEach(function(e){return e.traverse(function(e){e.visible=!1})})},t.prototype.isCurveInit=function(){return this.curve.points.length>0},t.prototype.onStartup=function(){this.initCurve()},t.prototype.onAttributesChanged=function(){this.initCurve()},t.prototype.onShutdown=function(){this.cleanupCurveMesh(),this.cleanupOrientationHelpers(),this.cleanupCurveMaterial()},t.prototype.initCurve=function(){!this.updateStarted&&this.controlPoints&&this.controlPoints.length&&(this.updateStarted=!0,this.cleanupCurveMesh(),this.cleanupOrientationHelpers(),this.prevControlPointsLength=this.controlPoints.length,this.createCurve(),this.enableVisualizations&&(this.cleanupCurveMesh(),this.createCurveMesh(),this.updateOrientationHelpers()))},t.prototype.createCurve=function(){var e=this;this.controlPoints.forEach(function(t){return t.off("change:properties",e.updateCurve,e)}),this.curve=new o.CatmullRomCurve3,this.closed&&(this.curve.closed=!0);var t=this.getEntity().getRootObject();t.when("loadDependencies",function(r){t.runtimeData.updateMatrixWorld(!0),a.forEach(e.controlPoints,function(t){if(t){var r=t.getPosition().clone();e.curve.points.push(r),e.tempMatrix.makeRotationFromQuaternion(t.runtimeData.quaternion);var i=e.tempMatrix.toArray();e.tempVector.set(i[0],i[1],i[2]),e.orientationHelpers.push(new o.ArrowHelper(e.tempVector,r,.25,16711680)),e.tempVector.set(i[4],i[5],i[6]),e.orientationHelpers.push(new o.ArrowHelper(e.tempVector,r,.25,65280)),e.tempVector.set(i[8],i[9],i[10]),e.orientationHelpers.push(new o.ArrowHelper(e.tempVector,r,.25,255)),t.on("change:properties",e.updateCurve,e)}else e.tempVector.set(0,0,0),e.orientationHelpers.push(new o.ArrowHelper(e.tempVector,e.tempVector,.25,16711680)),e.orientationHelpers.push(new o.ArrowHelper(e.tempVector,e.tempVector,.25,16711680)),e.orientationHelpers.push(new o.ArrowHelper(e.tempVector,e.tempVector,.25,16711680))}),e.updateCurve({}),e.updateStarted=!1,e.selected||e.onUnselected(),e.trigger("curveInit")},this)},t.prototype.updateCurve=function(e){var t=this,r=0;e.hasOwnProperty("position")&&(a.forEach(this.controlPoints,function(e){e&&(e.runtimeData.parent?(e.getPosition(t.tempVector),t.tempVector4.set(t.tempVector.x,t.tempVector.y,t.tempVector.z,1),t.tempVector4.applyMatrix4(e.runtimeData.parent.matrixWorld),t.curve.points[r].set(t.tempVector4.x,t.tempVector4.y,t.tempVector4.z),r++):t.canTryUpdateAgain&&(t.canTryUpdateAgain=!1,setTimeout(function(){n.default.info("Trying again"),t.updateCurve({})},10)))}),this.enableVisualizations&&(this.cleanupCurveMesh(),this.createCurveMesh()),this.canTryUpdateAgain=!0),e.hasOwnProperty("quaternion")&&this.updateOrientationHelpers()},t.prototype.cleanupCurveMaterial=function(){this.curveMaterial&&(this.curveMaterial.dispose(),this.curveMaterial=void 0)},t.prototype.cleanupOrientationHelpers=function(){var e=this;this.orientationHelpers.forEach(function(t){e.getRootThreeObject().remove(t)}),this.orientationHelpers=[]},t.prototype.cleanupCurveMesh=function(){this.enableVisualizations&&this.curveMesh&&(this.getRootThreeObject().remove(this.curveMesh),this.curveGeometry.dispose(),this.curveMesh.material=void 0)},t.prototype.createCurveMesh=function(){var e=this;this.curveMaterial||(this.curveMaterial=new o.MeshPhongMaterial({color:this.visualizationCurveColor,transparent:!1,opacity:.75,blending:o.AdditiveBlending})),this.curve.points.length&&(this.curveGeometry=new o.TubeGeometry(this.curve,this.curveTessellation,.1,8,this.closed),this.curveMesh=new o.Mesh(this.curveGeometry,this.curveMaterial),this.getRootObject().when("loadBase",function(){e.getRootThreeObject().add(e.curveMesh),a.forEach(e.orientationHelpers,function(t){e.getRootThreeObject().add(t)})},this),this.updateOrientationHelpers())},t.prototype.updateOrientationHelpers=function(){var e=this;this.controlPoints.forEach(function(t,r){var i=t.runtimeData;e.orientationHelpers[3*r].position.copy(e.curve.points[r]),e.orientationHelpers[3*r+1].position.copy(e.curve.points[r]),e.orientationHelpers[3*r+2].position.copy(e.curve.points[r]),e.tempMatrix.makeRotationFromQuaternion(i.quaternion);var n=e.tempMatrix.toArray();e.tempVector.set(n[0],n[1],n[2]),e.orientationHelpers[3*r].setDirection(e.tempVector),e.tempVector.set(n[4],n[5],n[6]),e.orientationHelpers[3*r+1].setDirection(e.tempVector),e.tempVector.set(n[8],n[9],n[10]),e.orientationHelpers[3*r+2].setDirection(e.tempVector)})},t}(s.default);t.default=u},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(2),a=function(e){function t(){return e.call(this)||this}return i.__extends(t,e),t.prototype.onStartup=function(){var e=document.createElement("div");e.id="consoleLogger",e.style.position="absolute",e.style.top="0",e.style.left="0",e.style.width="100%",e.style.height="100%",e.style.margin="0",e.style.padding="0",e.style.color="#000",e.style.background="rgba(0,0,0,0.5)",e.style.fontWeight="bold",e.style.textAlign="left",e.style.overflow="scroll",e.style["pointer-events"]="none",e.style["z-index"]="1",window.document.body.appendChild(e),window.console.log=window.console.error=window.console.warn=function(t){e.innerHTML+=t+"
"}},t}(n.default);t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(2),a=r(262),o=function(e){function t(){var t=e.call(this)||this;return t.stats=new a,t.initialized=!1,t}return i.__extends(t,e),t.prototype.onStartup=function(){this.stats.showPanel(0)},t.prototype.onPreUpdate=function(){this.isEnabled()&&this.stats.begin()},t.prototype.onPostRender=function(){this.isEnabled()&&this.stats.end()},t.prototype.onEnable=function(){document.body.appendChild(this.stats.dom),this.initialized=!0},t.prototype.onDisable=function(){this.initialized&&(document.body.removeChild(this.stats.dom),this.initialized=!1)},t}(n.default);t.default=o},function(e,t,r){"use strict";function i(e,t){if(e&&e.style)for(var r in t)t.hasOwnProperty(r)&&(e.style[r]=t[r])}function n(e,t){e.classList?e.classList.add(t):e.className+=" "+t}Object.defineProperty(t,"__esModule",{value:!0});var a=r(0),o=r(1),s=r(2),u=r(5),p=r(20),c=r(211),l={position:"absolute",left:"0",top:"0",padding:"8px","border-radius":"5px","font-family":"proxima_nova_regular,Helvetica,Arial,sans-serif","max-width":"25%","min-width":"25px",transition:"opacity 0.1s ease-in-out, background 0.1s ease-in-out",cursor:"pointer"},h=function(e){function t(){var t=e.call(this)||this;return t.renderEventName="render",t.textureRegistryById={},t}return a.__extends(t,e),t.prototype.onAwake=function(){this.getEngine().on("assetLoaded",this.registerTexture,this),this.getEngine().on("assetUnloaded",this.unregisterTexture,this)},t.prototype.onStartup=function(){var e=this;this.init2dScene(),this.initCubeScene(),this.renderEventName+="Group"+this.renderGroup,this.getEngine().on(this.renderEventName,this.renderView,this),this.getEngine().on("resize",this.resize,this),this.getEngine().getAssetsByClass(p.default).forEach(function(t){return e.registerTexture(t)}),this.resize()},t.prototype.onShutdown=function(){this.getEngine().off("assetLoaded",this.registerTexture,this),this.getEngine().off("assetUnloaded",this.unregisterTexture,this),this.getEngine().off(this.renderEventName,this.renderView,this),this.getEngine().off("resize",this.resize,this)},t.prototype.init2dScene=function(){this.camera2D=new o.OrthographicCamera(-1,1,1,-1,0,1),this.scene2D=new o.Scene,this.material2D=new o.ShaderMaterial(c.default),this.mesh2D=new o.Mesh(new o.PlaneGeometry(2,2),this.material2D),this.scene2D.add(this.mesh2D)},t.prototype.initCubeScene=function(){var e=90,t=1,r=o.ShaderLib.cube;this.sceneCube=new o.Scene,this.geoCube=new o.BoxGeometry(100,100,100),this.materialCube=new o.ShaderMaterial({fragmentShader:r.fragmentShader,vertexShader:r.vertexShader,uniforms:r.uniforms,depthWrite:!1,depthTest:!1,side:o.BackSide}),this.meshCube=new o.Mesh(this.geoCube,this.materialCube),this.cameraPX=new o.PerspectiveCamera(e,t,1,1e3),this.cameraPX.up.set(0,1,0),this.cameraPX.lookAt(new o.Vector3(1,0,0)),this.sceneCube.add(this.cameraPX),this.cameraNX=new o.PerspectiveCamera(e,t,1,1e3),this.cameraNX.up.set(0,1,0),this.cameraNX.lookAt(new o.Vector3(-1,0,0)),this.sceneCube.add(this.cameraNX),this.cameraPY=new o.PerspectiveCamera(e,t,1,1e3),this.cameraPY.up.set(0,0,-1),this.cameraPY.lookAt(new o.Vector3(0,1,0)),this.sceneCube.add(this.cameraPY),this.cameraNY=new o.PerspectiveCamera(e,t,1,1e3),this.cameraNY.up.set(0,0,1),this.cameraNY.lookAt(new o.Vector3(0,-1,0)),this.sceneCube.add(this.cameraNY),this.cameraPZ=new o.PerspectiveCamera(e,t,1,1e3),this.cameraPZ.up.set(0,1,0),this.cameraPZ.lookAt(new o.Vector3(0,0,1)),this.sceneCube.add(this.cameraPZ),this.cameraNZ=new o.PerspectiveCamera(e,t,1,1e3),this.cameraNZ.up.set(0,1,0),this.cameraNZ.lookAt(new o.Vector3(0,0,-1)),this.sceneCube.add(this.cameraNZ),this.sceneCube.add(this.meshCube)},t.prototype.setTexture=function(e){var t=this;this.currentTexture=this.textureRegistryById[e],this.currentTexture?this.currentTexture.load(function(){switch(t.currentTexture.type){case"renderTextureCube":case"textureCube":t.materialCube.uniforms.tCube.value=t.currentTexture.getThreeTexture();break;case"texture2D":case"renderTexture2D":t.material2D.uniforms.tDiffuse.value=t.currentTexture.getThreeTexture()}t.mesh2D.visible=!0,t.meshCube.visible=!0}):(this.mesh2D.visible=!1,this.meshCube.visible=!1)},t.prototype.updateViewport=function(){var e,t=this.getEngine().getRenderer().getWidth(),r=this.getEngine().getRenderer().getHeight();"%"===this.viewportBottom.slice(-1)?(e=.01*parseFloat(this.viewportBottom.slice(0,-1)),this.y=e*r):this.y=parseInt(this.viewportBottom,10),"%"===this.viewportLeft.slice(-1)?(e=.01*parseFloat(this.viewportLeft.slice(0,-1)),this.x=e*t):this.x=parseInt(this.viewportLeft,10),"%"===this.viewportWidth.slice(-1)?(e=.01*parseFloat(this.viewportWidth.slice(0,-1)),this.width=e*t):this.width=parseInt(this.viewportWidth,10),"%"===this.viewportHeight.slice(-1)?(e=.01*parseFloat(this.viewportHeight.slice(0,-1)),this.height=e*r):this.height=parseInt(this.viewportHeight,10),this.x<0&&(this.x+=t),this.y<0&&(this.y+=r)},t.prototype.updateTextureDropdown=function(){var e=this;this.isEnabled()&&setTimeout(function(){var t;if(!e.textureDropDown){e.textureDropDown=document.createElement("select"),e.textureDropDown.name="Poop",e.textureDropDown.id="Poop",n(e.textureDropDown,"debugger-dropdown"),i(e.textureDropDown,l);var r=e.getThreeRenderer().domElement;r.parentElement?r.parentElement.appendChild(e.textureDropDown):r.appendChild(e.textureDropDown),e.textureDropDown.onchange=function(){e.setTexture(e.textureDropDown.value)}}e.textureDropDown.options.length=0,t=document.createElement("option"),t.value=0,t.text="None",e.textureDropDown.appendChild(t),u.forEach(e.textureRegistryById,function(r,i){t=document.createElement("option"),t.value=i,t.text=""!==r.name?r.getName():i,e.textureDropDown.appendChild(t)}),e.textureDropDown.style.top=e.getEngine().getRenderer().getHeight()-e.y-e.height+"px",e.textureDropDown.style.left=e.x+"px",e.textureDropDown.style.zIndex="200"},0)},t.prototype.resize=function(){this.isEnabled()&&(this.updateTextureDropdown(),this.updateViewport())},t.prototype.renderView=function(){var e=this.getThreeRenderer();if(this.isEnabled()&&this.currentTexture)switch(e.setRenderTarget(null),this.currentTexture.type){case"texture2D":case"renderTexture2D":e.setViewport(this.x,this.y,this.width,this.height),e.render(this.scene2D,this.camera2D);break;case"textureCube":case"renderTextureCube":var t=.25*this.width,r=.3333*this.height;e.setViewport(this.x,this.y+r,t,r),e.render(this.sceneCube,this.cameraPX,null,!1),e.setViewport(this.x+1.999*t,this.y+r,t,r),e.render(this.sceneCube,this.cameraNX,null,!1),e.setViewport(this.x+t,this.y+1.99*r,t,r),e.render(this.sceneCube,this.cameraPY,null,!1),e.setViewport(this.x+t,this.y,t,r),e.render(this.sceneCube,this.cameraNY,null,!1),e.setViewport(this.x+t,this.y+r,t,r),e.render(this.sceneCube,this.cameraPZ,null,!1),e.setViewport(this.x+2.99*t,this.y+r,t,r),e.render(this.sceneCube,this.cameraNZ,null,!1)}},t.prototype.registerTexture=function(e){if(e)switch(e.type){case"renderTextureCube":case"textureCube":case"texture2D":case"renderTexture2D":this.textureRegistryById[e.id]=e}},t.prototype.unregisterTexture=function(e){e&&this.textureRegistryById[e.id]&&delete this.textureRegistryById[e.id]},t}(s.default);t.default=h},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(2),a=function(){function e(e,t,r,i){this.targetEntityType=e,this.targetComponentName=t,this.propertyName=r,this.targetValue=i,this.previousValues={},this.lastTimeSavings=0,this.targetEntityType=e,this.targetComponentName=t,this.propertyName=r,this.targetValue=i}return e}();t.QualityChangeLevel=a;var o=.9,s=function(e){function t(){var t=e.call(this)||this;return t.QualityChangeLevel=a,t.frameTimeThreshold=33.333333333,t.testInterval=2e3,t.qualityChangeLevels=[],t.currentLevel=t.qualityChangeLevels.length,t.elapsedRenderTime=0,t.framesRecorded=0,t.justStarted=!0,t.justAutoSteppedDown=!1,t.autoOptimize=!0,t}return i.__extends(t,e),t.prototype.setQualityChangeLevels=function(e){this.setMaxQuality(),this.qualityChangeLevels=e,this.currentLevel=this.qualityChangeLevels.length,this.isEnabled()&&(this.autoOptimize=!0)},t.prototype.setFrameTimeThreshold=function(e){this.frameTimeThreshold=e},t.prototype.setTestInterval=function(e){this.testInterval=e,this.elapsedRenderTime=0,this.framesRecorded=0},t.prototype.onPreUpdate=function(e){if(this.isEnabled()&&(this.elapsedRenderTime+=1e3*e,this.framesRecorded++,!(this.elapsedRenderTimethis.frameTimeThreshold?(this.stepRenderingQualityDown(),this.justAutoSteppedDown=!0):this.qualityChangeLevels[this.currentLevel]&&this.lastAvgFrameTime0;)this.currentLevel=this.currentLevel>1?this.currentLevel-1:0,e=!this.stepRenderingQuality(!1);e||(this.qualityChangeLevels[this.currentLevel].frameTimeAtDrop=this.lastAvgFrameTime)},t.prototype.stepRenderingQualityUp=function(){for(var e=!0;e&&this.currentLevelthis.time?1:n(Math.max(0,Math.min(1,this.currentTime/this.time)));this.objects.forEach(function(e,i){var n=e.runtimeData.parent.worldToLocal(l.copy(t.destinations[i])).clone(),a=t.direction>0?t.sources[i]:n,o=t.direction>0?n:t.sources[i];l.lerpVectors(a,o,r),e.alignToPosition(l,{x:0,y:0,z:0})}),this.currentTime>this.time&&this.getEntity().trigger(this.direction>0?"endExplode":"endContract")}},t.prototype.reset=function(){var e=this;this.objects.forEach(function(t,r){t.alignToPosition(e.sources[r],{x:0,y:0,z:0})}),this.objects.length=0,this.sources.length=0,this.destinations.length=0,this.currentTime=this.time},t.prototype.contract=function(){this.isEnabled()&&(this.direction=-1,this.currentTime=0,this.getEntity().trigger("beginContract"))},t.prototype.explode=function(e,t){var r=this;if(this.isEnabled()){this.reset();var i=this.getEntity().getDescendantsByType("mesh"),n=new p.Vector3;n.setFromMatrixPosition(this.getRuntimeData().matrixWorld);var a=new p.Quaternion;a.setFromRotationMatrix(this.getRuntimeData().matrixWorld);var o=this.getFormationFunc(e||this.formation,i.length,n,a,t||this.scale).bind(this);i.forEach(function(e,t){o(t,l,e),r.objects.push(e);var i=new p.Vector3,n=e.getRuntimeData();h.getInverse(n.parent.matrixWorld).multiply(n.matrixWorld),i.setFromMatrixPosition(h),r.sources.push(i),r.destinations.push(l.clone())}),this.currentTime=0,this.direction=1,this.getEntity().trigger("beginExplode")}},t.prototype.toggle=function(){this.direction>0?this.contract():this.explode()},t.prototype.getFormationFunc=function(e,t,r,i,n){switch(e){case"Grid":return a(t,r,n,i);case"Scale":return o(r,n);default:case"Circle":return s(t,r,n,i)}},t}(c.default);t.default=d},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(1),a=r(2),o=r(16),s=function(e){function t(){var t=e.call(this)||this;return t._moveVector=new n.Vector3,t._tempVector=new n.Vector3,t._tempVector2=new n.Vector3,t.tempCamera=new n.PerspectiveCamera,t.tempEuler=new n.Euler,t.tempQuaternion=new n.Quaternion,t._currentMoveSpeed=new n.Vector3,t.ellapsedTimeSinceInput=0,t.enablePan=void 0,t.enableZoom=void 0,t.invertX=!1,t.invertY=!1,t.invertZoom=!1,t.touchState="none",t.touchLast=new n.Vector2,t.touchLastPinchDist=0,t.touchYStart=0,t.lookDelta=new n.Vector2,t.moveDelta=new n.Vector3,t.zoomDelta=0,t.currentLookSpeed=new n.Vector2,t.currentMoveSpeed=new n.Vector3,t.currentZoomSpeed=0,t.lookDeltaLength=0,t.moveDeltaLength=0,t.pitchAngleBoundsRadians={max:0,min:0},t.onMouseDown_PointerLock=t.onMouseDown_PointerLock.bind(t),t.onMouseUp_PointerLock=t.onMouseUp_PointerLock.bind(t),t}return i.__extends(t,e),t.prototype.onStartup=function(){this.usePointerLock&&this.togglePointerLock(!0);var e=this.getEngine();this.pitchAngleBoundsRadians.max=Math.PI*this.pitchAngleBounds.max/180,this.pitchAngleBoundsRadians.min=Math.PI*this.pitchAngleBounds.min/180,o.isMobile()?(e.on("touchStart",this.onTouchStart,this),e.on("touchMove",this.onTouchMove,this),e.on("touchEnd",this.onTouchEnd,this)):(e.on("mouseMove",this.onMouseMove,this),e.on("mouseScroll",this.onMouseScroll,this)),this.getEntity().on("enableFreeCameraController",this.freeCameraEnable,this),this.getEntity().on("disableFreeCameraController",this.freeCameraDisable,this),this.getEntity().on("toggleFreeCameraController",this.freeCameraToggle,this)},t.prototype.onShutdown=function(){var e=this.getEngine();o.isMobile()?(e.off("touchStart",this.onTouchStart,this),e.off("touchMove",this.onTouchMove,this),e.off("touchEnd",this.onTouchEnd,this)):(e.off("mouseMove",this.onMouseMove,this),e.off("mouseScroll",this.onMouseScroll,this)),this.getEntity().off("enableFreeCameraController",this.freeCameraEnable,this),this.getEntity().off("disableFreeCameraController",this.freeCameraDisable,this),this.getEntity().off("toggleFreeCameraController",this.freeCameraToggle,this),this.togglePointerLock(!1)},t.prototype.setTargetByID=function(e,t){var r=this.getEngine().getObjectById(e);this.setTarget(r)},t.prototype.setTarget=function(e){var t=this;if(e){var r=new n.Vector3;this.getRootObject().once("loadDependencies",function(){e.getCenterInWorldSpace(r);var i,a=e.getBounds();a?i=t.adjustDistanceForObject(e):e.traverse(function(e){var r=e.getBounds();if(r)return i=t.adjustDistanceForObject(e),!0});var o=t.getRuntimeData();o.lookAt(r);var s=new n.Vector3(0,0,i);s.applyQuaternion(o.quaternion),r.add(s),o.position.copy(r)},this),this.getRootObject().loadDependencies()}},t.prototype.adjustDistanceForObject=function(e){var t=e.getBounds();if(t){var r=new n.Vector3;r.set(t.max.x-t.min.x,t.max.y-t.min.y,t.max.z-t.min.z);var i=new n.Vector3;i.setFromMatrixScale(e.runtimeData.matrixWorld),r.multiply(i);var a=r.length(),o=Math.abs(a/(2*Math.tan(this.getRuntimeData().fov*Math.PI/360)));return o}},t.prototype.onPreUpdate=function(e){if(this.hasRuntimeData()&&this.isEnabled()){var t=this.getInput(),r=t.keyDown("ctrl")||t.keyDown("cmd"),i=t.keyDown("upArrow")||t.keyDown("W"),n=t.keyDown("downArrow")||t.keyDown("S"),a=t.keyDown("leftArrow")||t.keyDown("A"),o=t.keyDown("rightArrow")||t.keyDown("D");!r&&(i||n||a||o)&&(this.enableZoom&&(i?this.moveDelta.z=-e:n&&(this.moveDelta.z=e)),this.enablePan&&(o?this.moveDelta.x=-e:a&&(this.moveDelta.x=e))),this.updateCamera(e)}},t.prototype.onPostUpdate=function(){this.hasChanged=!1},t.prototype.updateCamera=function(e){this.invertX&&(this.lookDelta.x*=-1,this.moveDelta.x*=-1),this.invertY&&(this.lookDelta.y*=-1,this.moveDelta.y*=-1),this.invertZoom&&(this.zoomDelta*=-1);var t=1;this.getInput().keyDown("shift")&&(t=5);var r=Math.min(33.3*(e-.017)+this.inertialDamping,1),i=1-r;this.currentLookSpeed.x=i*this.currentLookSpeed.x+6*r*t*this.lookSpeed*this.lookDelta.x,this.currentLookSpeed.y=i*this.currentLookSpeed.y+6*r*t*this.lookSpeed*this.lookDelta.y,this.currentMoveSpeed.x=i*this.currentMoveSpeed.x+r*t*this.movementSpeed*this.moveDelta.x,this.currentMoveSpeed.y=i*this.currentMoveSpeed.y+r*t*this.movementSpeed*this.moveDelta.y,this.currentMoveSpeed.z=i*this.currentMoveSpeed.z+r*t*this.movementSpeed*this.moveDelta.z,this.currentMoveSpeed.z+=i*this.currentZoomSpeed+r*t*this.movementSpeed*this.zoomDelta;var n=this.getRuntimeData();this.tempEuler.set(this.currentLookSpeed.y,this.currentLookSpeed.x,0),this.tempQuaternion.setFromEuler(this.tempEuler),n.quaternion.multiply(this.tempQuaternion),this.tempEuler.setFromQuaternion(n.quaternion,"YXZ"),-this.tempEuler.x>this.pitchAngleBoundsRadians.max?(this.tempEuler.x=-this.pitchAngleBoundsRadians.max,n.quaternion.setFromEuler(this.tempEuler),this.currentLookSpeed.y=0):-this.tempEuler.x=0?(r=-.5*(this.touchLast.x-t[0].scenePercentX),i=-.5*(this.touchLast.y-t[0].scenePercentY)):(r=0,i=0),this.touchLast.x=t[0].scenePercentX,this.touchLast.y=t[0].scenePercentY,this.ellapsedTimeSinceInput=0,this.lookDelta.set(r,i);break;case 2:r=t[0].scenePercentX-t[1].scenePercentX,i=t[0].scenePercentY-t[1].scenePercentY;var n=Math.sqrt(r*r+i*i);if(this.touchLast.x>=0){var a=this.touchLastPinchDist-n,o=this.touchLast.y-t[0].scenePercentY;Math.abs(a)>Math.abs(o)?this.zoomDelta=20*a:this.zoomDelta=20*o}this.touchLastPinchDist=n,this.touchLast.x=t[0].scenePercentX,this.touchLast.y=t[0].scenePercentY;break;case 3:r=t[0].scenePercentX-this.touchLast.x,i=t[0].scenePercentY-this.touchLast.y,this.touchLast.x>=0&&this.moveDelta.set(r,i,0),this.touchLast.x=t[0].scenePercentX,this.touchLast.y=t[0].scenePercentY}}},t.prototype.onTouchEnd=function(){this.touchLast.set(-1,-1),this.touchLastPinchDist=-1,this.touchState="none"},t}(a.default);t.default=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(2),a=function(e){function t(){var t=e.call(this)||this;return t.el=void 0,t.fsEnabled=!1,t}return i.__extends(t,e),t.prototype.onStartup=function(){this.toggle=this.toggle.bind(this),this.getEntity().on("toggleFullscreen",this.toggle,this),this.listenTo(this.getGlobalEvents(),"fullscreen::toggle",this.toggle),this.listenTo(this.getGlobalEvents(),"fullscreen::enable",this.enableFullscreen),this.listenTo(this.getGlobalEvents(),"fullscreen::disable",this.disableFullscreen)},t.prototype.toggle=function(){this.fsEnabled?this.disableFullscreen():this.enableFullscreen()},t.prototype.enableFullscreen=function(){this.el||this.attachFullscreenAPI(),this.el.requestFullscreen(),this.fsEnabled=!0},t.prototype.disableFullscreen=function(){this.el||this.attachFullscreenAPI(),this.fsEnabled&&document.exitFullscreen(),this.fsEnabled=!1},t.prototype.attachFullscreenAPI=function(){this.el=this.getEngine().container,this.el.requestFullscreen=this.el.requestFullscreen||this.el.requestFullScreen||this.el.mozRequestFullscreen||this.el.mozRequestFullScreen||this.el.webkitRequestFullscreen||this.el.webkitRequestFullScreen||this.el.msRequestFullscreen||this.el.msRequestFullScreen,document.exitFullscreen=document.exitFullscreen||document.exitFullScreen||document.mozCancelFullscreen||document.mozCancelFullScreen||document.webkitExitFullscreen||document.webkitExitFullScreen||document.msExitFullscreen||document.msExitFullScreen,document.addEventListener("fullscreenchange",this.onFullscreenChange.bind(this),!1),document.addEventListener("mozfullscreenchange",this.onFullscreenChange.bind(this),!1),document.addEventListener("webkitfullscreenchange",this.onFullscreenChange.bind(this),!1),document.addEventListener("msfullscreenchange",this.onFullscreenChange.bind(this),!1)},t.prototype.onFullscreenChange=function(e){this.getGlobalEvents().trigger("fullscreen::change",e)},t}(n.default);t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(1),a=r(2),o=r(5),s=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.buttons=[],t.axes=[],t.workVector1=new n.Vector3,t.workVector2=new n.Vector3,t.workQuaternion1=new n.Quaternion,t.workQuaternion2=new n.Quaternion,t.workEuler=new n.Euler,t.meshControlMap={},t.updateAxes=!1,t.updateButtons=[],t.gamepadDevice=null,t}return i.__extends(t,e),t.prototype.onUpdate=function(e){var t=this;this.gamepadDevice||(this.gamepadDevice=this.getGamepadDevice(),this.gamepadDevice&&(this.listenTo(this.gamepadDevice,"gamepadButtonChanged",this.onGamepadButtonEvent),this.listenTo(this.gamepadDevice,"gamepadButtonTouched",this.onGamepadButtonEvent),this.listenTo(this.gamepadDevice,"gamepadButtonReleased",this.onGamepadButtonEvent),this.listenTo(this.gamepadDevice,"gamepadAxisChanged",this.onGamepadAxisEvent))),this.updateButtons.forEach(function(e,r){e&&t.updateButtonTransform(r)}),this.updateAxes&&(this.updateAxes=!1,this.updateAxesTransforms())},t.prototype.getAxisMeshes=function(e){return this.axes[e].map(function(e){return e.mesh})},t.prototype.getButtonMeshes=function(e){return this.buttons[e].map(function(e){return e.mesh})},t.prototype.onAttributesChanged=function(e){var t=this;e.indexOf("axes")===-1&&e.indexOf("buttons")===-1||(this.meshControlMap={},this.axes.forEach(function(e,r){e.forEach(function(e,i){var n=e.mesh;n&&(t.meshControlMap[n.id]||(t.meshControlMap[n.id]={axes:[],axesMeshIdx:[],buttons:[],buttonMeshIdx:[]}),t.meshControlMap[n.id].axes.push(r),t.meshControlMap[n.id].axesMeshIdx.push(i))})}),this.buttons.forEach(function(e,r){e.forEach(function(e,i){var n=e.mesh;n&&t.meshControlMap[n.id]&&(t.meshControlMap[n.id].buttons.push(r),t.meshControlMap[n.id].buttonMeshIdx.push(i))})}))},t.prototype.getGamepadDevice=function(){if(this.gamepadDevice)return this.gamepadDevice;var e=this.getEntity().getAncestors(),t=e.find(function(e){return!!e.getComponentByScriptId("motion_gamepad_device")});return t?(this.gamepadDevice=t.getComponentByScriptId("motion_gamepad_device"),this.gamepadDevice):(this.gamepadDevice=null,null)},t.prototype.onGamepadButtonEvent=function(e,t){this.currentGamepadState=e,this.updateButtons[t]=!0},t.prototype.updateButtonTransform=function(e){var t=this,r=this.currentGamepadState.buttons[e].value,i=this.buttons[e];i.forEach(function(i){if(i.mesh){switch(i.movementType){case"translate":t.workVector1.copy(i.offset).multiplyScalar(r),i.mesh.setPosition(t.workVector1.x,t.workVector1.y,t.workVector1.z);break;case"rotate":t.workVector2.copy(i.rotation).multiplyScalar(r),t.workEuler.setFromVector3(t.workVector2),t.workQuaternion1.setFromEuler(t.workEuler),t.workVector1.copy(i.pivot),t.workVector2.copy(t.workVector1).multiplyScalar(-1),t.workVector2.applyQuaternion(t.workQuaternion1),t.workVector2.add(t.workVector1),i.mesh.setQuaternion(t.workQuaternion1.x,t.workQuaternion1.y,t.workQuaternion1.z,t.workQuaternion1.w),i.mesh.setPosition(t.workVector2.x,t.workVector2.y,t.workVector2.z)}i.renderOnTouchOnly&&t.currentGamepadState.buttons[e].hasOwnProperty("touched")&&i.mesh.setProperty("visible",t.currentGamepadState.buttons[e].touched)}})},t.prototype.onGamepadAxisEvent=function(e,t){this.currentGamepadState=e,this.updateAxes=!0},t.prototype.updateAxesTransforms=function(){var e=this;o.forEach(this.meshControlMap,function(t,r){var i=e.getEngine().getObjectById(r);if(i){var n=e.axes[0][t.axesMeshIdx[0]].movementType;if(e.workVector1.set(0,0,0),t.axes.reduce(function(r,i,a){var o=e.axes[i][t.axesMeshIdx[a]];if(o.movementType!==n)return log.error("Can't perform multiple types of axis transformations on same mesh."),r;if("translate"===n){var s=e.currentGamepadState.axes[i];e.workVector2.copy(o.offset).multiplyScalar(s)}else"rotate"===n&&e.workVector2.copy(o.pivot).multiplyScalar(-1);return r.lerp(e.workVector2,0===a?1:.5)},e.workVector1),e.workQuaternion1.set(0,0,0,1),"rotate"===n&&(t.axes.reduce(function(r,i,n){var a=e.axes[i][t.axesMeshIdx[n]],o=e.currentGamepadState.axes[i];return e.workVector2.copy(a.rotation).multiplyScalar(o),e.workEuler.setFromVector3(e.workVector2),e.workQuaternion2.setFromEuler(e.workEuler),r.slerp(e.workQuaternion2,0===n?1:.5)},e.workQuaternion1),e.workVector2.copy(e.workVector1),e.workVector1.applyQuaternion(e.workQuaternion1),e.workVector2.multiplyScalar(-1),e.workVector1.add(e.workVector2)),i.setQuaternion(e.workQuaternion1.x,e.workQuaternion1.y,e.workQuaternion1.z,e.workQuaternion1.w),i.setPosition(e.workVector1.x,e.workVector1.y,e.workVector1.z),t.buttons.length){var a=t.buttons[0],o=e.currentGamepadState.buttons[a].value,s=e.buttons[a][0].offset;e.workVector2.copy(s).multiplyScalar(o),e.workVector2.applyQuaternion(e.workQuaternion1),e.workVector2.add(e.workVector1),i.setPosition(e.workVector2.x,e.workVector2.y,e.workVector2.z)}}})},t}(a.default);t.default=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(2),a=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.gamepadStates=[],t}return i.__extends(t,e),t.prototype.onPreUpdate=function(e){if(this.isEnabled()&&navigator.getGamepads)for(var t=navigator.getGamepads(),r=0;r":187,"<":188,_:189,".":190,"/":191,"[":219,"]":221};var h=function(e){function r(){var t=e.call(this)||this;return t.mouseButtons={left:0,middle:1,right:2},t.inputQueue=[],t.inputPool=[],t.mouseButtonState=new Array(3),t.mouseButtonStatePrevious=new Array(3),t.mousePosition=new u.Vector2,t.mousePositionPercent=new u.Vector2,t.mousePreviousPosition=new u.Vector2,t.mouseDragState=new Array(3),t.mouseDragStatePrevious=new Array(3),t.mouseDragDistance=[new u.Vector2,new u.Vector2,new u.Vector2],t.touchPosition=new u.Vector2,t.touchPositionPercent=new u.Vector2,t.touchPreviousPosition=new u.Vector2,t.touchDragState=!1,t.touchDragStatePrevious=!1,t.doubleTapHandle=null,t.doubleTapPosition=new u.Vector2,t.listenForTouchStart=!1,t.listenForTouchEnd=!1,t.touchesStart=[],t.keyState=new Array(256),t.keyStatePrevious=new Array(256),t.canvas=null,t.pointerLockEnabled=!1,t}return i.__extends(r,e),r.prototype.mouseButtonDown=function(e){if("any"===e){for(var t in this.mouseButtons)if(this.mouseButtonState[this.mouseButtons[t]])return!0;return!1}return this.mouseButtonState[this.mouseButtons[e]]},r.prototype.mouseButtonUp=function(e){return!this.mouseButtonState[this.mouseButtons[e]]},r.prototype.mouseButtonPressed=function(e){return!(!this.mouseButtonState[this.mouseButtons[e]]||this.mouseButtonStatePrevious[this.mouseButtons[e]])},r.prototype.mouseButtonReleased=function(e){return!(this.mouseButtonState[this.mouseButtons[e]]||!this.mouseButtonStatePrevious[this.mouseButtons[e]])},r.prototype.keyPressed=function(e){return!(!this.keyState[t.keyCodes[e]]||this.keyStatePrevious[t.keyCodes[e]])},r.prototype.keyReleased=function(e){return!(this.keyState[t.keyCodes[e]]||!this.keyStatePrevious[t.keyCodes[e]])},r.prototype.keyDown=function(e){return!!this.keyState[t.keyCodes[e]]},r.prototype.keyUp=function(e){return!this.keyState[t.keyCodes[e]]},r.prototype.getMouseDragState=function(e){return this.mouseDragState[this.mouseButtons[e||"left"]]},r.prototype.getPreviousMouseDragState=function(e){return this.mouseDragStatePrevious[this.mouseButtons[e||"left"]]},r.prototype.getTouchDragState=function(){return this.touchDragState},r.prototype.getPreviousTouchDragState=function(){return this.touchDragStatePrevious},r.prototype.enablePointerLock=function(){this.pointerLockEnabled=!0,this.canvas.requestPointerLock()},r.prototype.disablePointerLock=function(){this.pointerLockEnabled=!1,document.exitPointerLock()},r.prototype.togglePointerLock=function(){this.pointerLockEnabled?this.enablePointerLock():this.disablePointerLock()},r.prototype.onStartup=function(){this.canvas=this.getEngine().canvas,this.canvas.requestPointerLock=this.canvas.requestPointerLock||this.canvas.mozRequestPointerLock||this.canvas.webkitRequestPointerLock,document.exitPointerLock=document.exitPointerLock||document.mozExitPointerLock||document.webkitExitPointerLock,this.clearKeyStates=this.clearKeyStates.bind(this),this.onMouseMove=this.onMouseMove.bind(this),this.onMouseDown=this.onMouseDown.bind(this),this.onMouseUp=this.onMouseUp.bind(this),this.onMouseWheel=this.onMouseWheel.bind(this),this.onMouseLeave=this.onMouseLeave.bind(this),this.onContextMenu=this.onContextMenu.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this.onKeyUp=this.onKeyUp.bind(this),this.onTouchStart=this.onTouchStart.bind(this),this.onTouchEnd=this.onTouchEnd.bind(this),this.onTouchCancel=this.onTouchCancel.bind(this),this.onTouchLeave=this.onTouchLeave.bind(this),this.onTouchMove=this.onTouchMove.bind(this),this.onDoubleClick=this.onDoubleClick.bind(this),this.onDoubleTap=this.onDoubleTap.bind(this),window.addEventListener("blur",this.clearKeyStates,!1),this.isEnabled()&&(this.mouseEvents.enable&&this.enableMouseEvents(),this.keyEvents.enable&&this.enableKeyEvents(),this.touchEvents.enable&&this.enableTouchEvents())},r.prototype.onPreUpdate=function(){if(this.isEnabled())for(;this.inputQueue.length>0;)this.getEngine().trigger(this.inputQueue[0].name,this.inputQueue[0].event),this.recycleInputEvent(this.inputQueue.splice(0,1)[0])},r.prototype.onPostUpdate=function(){if(this.isEnabled()){if(this.keyEvents.enable)for(var e=0;ethis.mouseEvents.dragBufferDistance&&(this.mouseDragState[t]=!0)}else this.mouseDragState[t]=!1;this.inputQueue.push(this.getInputEvent(e,"mouseMove"))},r.prototype.onMouseDown=function(e){if(this.getScenePercent(e,e),this.mouseUpBound||(this.mouseUpBound=!0,document.addEventListener("mouseup",this.onMouseUp)),Array.prototype.forEach.call(document.querySelectorAll("input, textarea, select, option"),function(e){e.blur()}),this.mouseEvents.preventDownDefault&&e.preventDefault(),this.mouseButtonState[e.button]=!0,this.inputQueue.push(this.getInputEvent(e,"mouseDown")),this.mouseEvents.eventHandler){var t=this.getKeyByValue(this.mouseButtons,e.button);t&&this.getGlobalEvents().trigger("mouse_down_"+t)}},r.prototype.onMouseUp=function(e){if(this.getScenePercent(e,e),this.mouseButtonState[e.button]=!1,this.mouseDragState[e.button]=!1,this.mouseDragDistance[e.button].x=0,this.mouseDragDistance[e.button].y=0,this.mouseButtonUp("left")&&this.mouseButtonUp("right")&&this.mouseButtonUp("middle")&&(this.mouseUpBound=!1,document.removeEventListener("mouseup",this.onMouseUp)),this.inputQueue.push(this.getInputEvent(e,"mouseUp")),this.mouseEvents.eventHandler){var t=this.getKeyByValue(this.mouseButtons,e.button);t&&this.getGlobalEvents().trigger("mouse_up_"+t)}},r.prototype.onDoubleClick=function(e){this.getScenePercent(e,e),Array.prototype.forEach.call(document.querySelectorAll("input, textarea, select, option"),function(e){e.blur()}),this.inputQueue.push(this.getInputEvent(e,"doubleClick"))},r.prototype.onMouseWheel=function(e){this.mouseEvents.preventScrollDefault&&e.preventDefault();var t;t=void 0!==e.wheelDeltaY?.025*e.wheelDeltaY:s.isIE()?-e.deltaY/40:-e.deltaY,this.inputQueue.push(this.getInputEvent(t,"mouseScroll"))},r.prototype.onMouseLeave=function(e){for(var t=0,r=this.mouseButtonState;tthis.touchEvents.dragBufferDistance?void this.clearDoubleTapState():(this.listenForTouchStart||this.listenForTouchEnd?!this.listenForTouchStart&&this.listenForTouchEnd?(this.clearDoubleTapState(),this.listenForTouchStart=!0):this.listenForTouchStart&&!this.listenForTouchEnd?(this.clearDoubleTapState(),this.listenForTouchStart=!0,this.listenForTouchEnd=!0,this.canvas.addEventListener("touchend",this.onDoubleTap)):(this.clearDoubleTapState(),this.onTouchEvent(e,"doubleTap")):(this.doubleTapPosition.copy(this.touchPosition),this.clearDoubleTapState(),this.canvas.addEventListener("touchend",this.onDoubleTap),this.listenForTouchEnd=!0),void(this.doubleTapHandle=setTimeout(this.clearDoubleTapState.bind(this),p)))},r.prototype.clearDoubleTapState=function(){clearTimeout(this.doubleTapHandle),this.doubleTapHandle=null,this.listenForTouchStart=!1,this.listenForTouchEnd=!1,this.canvas.removeEventListener("touchend",this.onDoubleTap)},r.prototype.onTouchCancel=function(e){this.touchEvents.preventCancelDefault&&e.preventDefault(),this.touchDragState=!1;var t={};t.originalEvent=e,t.touches=[],this.inputQueue.push(this.getInputEvent(t,"touchCancel"))},r.prototype.onTouchLeave=function(e){this.touchEvents.preventLeaveDefault&&e.preventDefault(),this.touchDragState=!1,this.onTouchEvent(e,"touchLeave")},r.prototype.onTouchMove=function(e){this.touchEvents.preventMoveDefault&&e.preventDefault();var t={};t.originalEvent=e,t.touches=[];for(var r=0;rthis.touchEvents.dragBufferDistance&&(this.touchDragState=!0),t.touches.push(i)}t.touches.length&&(this.touchPosition.x=t.touches[t.touches.length-1].sceneX,this.touchPosition.y=t.touches[t.touches.length-1].sceneY,this.touchPositionPercent.x=t.touches[t.touches.length-1].scenePercentX,this.touchPositionPercent.y=t.touches[t.touches.length-1].scenePercentY),this.inputQueue.push(this.getInputEvent(t,"touchMove"))},r.prototype.onTouchEvent=function(e,t){var r={};r.originalEvent=e,r.touches=[];for(var i=0;i=0&&(this.sourceBoundingSphere.radius=this.boundingSphereOverrideRadius)),this.sceneRoot.isBaseLoaded()&&this.sphereMesh&&(this.sphereMesh.position.copy(this.sourceBoundingSphere.center),this.sphereMesh.scale.set(this.sourceBoundingSphere.radius,this.sourceBoundingSphere.radius,this.sourceBoundingSphere.radius)),this.previousIntersections=this.currentIntersections,this.currentIntersections={},this.firstIntersectionOnly){var i=t.find(this.intersectObject.bind(this));i&&(this.previousIntersections[i.id]||(this.trigger("beginIntersection",i),this.getEntity().trigger("beginIntersection",i)),this.currentIntersections[i.id]=i)}else{var n=t.filter(this.intersectObject.bind(this));n.forEach(function(t){e.previousIntersections[t.id]||(e.trigger("beginIntersection",t),e.getEntity().trigger("beginIntersection",t)),e.currentIntersections[t.id]=t})}return o.forEach(this.previousIntersections,function(t){e.currentIntersections[t.id]||(e.trigger("endIntersection",t),e.getEntity().trigger("endIntersection",t))}),this.currentIntersections}},t.prototype.onAttributesChanged=function(e){e.indexOf("debugVisualization")!==-1&&(this.sphereMesh.visible=this.debugVisualization)},t.prototype.onPreUpdate=function(){this.checkIntersectionAlways&&this.checkIntersection()},t.prototype.generateObjectList=function(){var e=this;if(this.objectFilter.length)return this.objectFilter;var t=[];return this.sceneRoot.traverseSome(function(r){return r===e.getEntity()||!(e.objectTypeFilter.length&&!e.objectTypeFilter.some(function(e){return r.type===e}))&&void t.push(r)}),t},t.prototype.intersectObject=function(e){var t=e.runtimeData;return!!t&&(this.workMatrix.getInverse(t.matrixWorld),this.workBoundsSphere.copy(this.sourceBoundingSphere),this.workBoundsSphere.applyMatrix4(this.workMatrix),e.getBounds(this.workBoundingBox),this.workBoundingBox.intersectsSphere(this.workBoundsSphere))},t}(a.default);t.default=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(2),a=r(14),o=function(e){function t(){var t=e.call(this)||this;return t.setupMaterial=t.setupMaterial.bind(t),t}return i.__extends(t,e),t.prototype.onAwake=function(){var e=this;this.listenTo(this.getEngine(),"entityCreated",function(t){t instanceof a.default&&e.setupMaterial(t)})},t.prototype.onAttributesChanged=function(e){this.setupAllMaterials()},t.prototype.onDisable=function(){this.getEngine().getAssetsByClass(a.default).forEach(function(e){e.setProperty("envMapIrradiance",null),e.setProperty("envMapRadianceHalfGloss",null),e.setProperty("envMapRadiance",null)})},t.prototype.onEnable=function(){this.setupAllMaterials()},t.prototype.setupAllMaterials=function(){this.getEngine().getAssetsByClass(a.default).forEach(this.setupMaterial)},t.prototype.setupMaterial=function(e){e&&this.isEnabled()&&(e.setProperty("envMapIrradiance",this.getAttribute("irradianceMap")),e.setProperty("envMapRadiance",this.getAttribute("radianceMap")),e.setProperty("envMapRadianceHalfGloss",this.getAttribute("radianceMapHalfGloss")))},t}(n.default);t.default=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(1),a=r(2),o=r(11),s=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.playing=!0,t}return i.__extends(t,e),t.prototype.onStartup=function(){this.tempVec=new n.Vector3,this.tempMatrix=new n.Matrix4,this.tempQuaternion=new n.Quaternion},t.prototype.onAttributesChanged=function(e){if(!this.playing){var t=this.getEntity();t instanceof o.default&&(this.getRuntimeData().position.copy(t.getPosition()),this.getRuntimeData().quaternion.copy(t.getQuaternion()))}},t.prototype.onEnable=function(){this.playing=!0},t.prototype.onDisable=function(){this.playing=!1;var e=this.getEntity();e instanceof o.default&&(this.getRuntimeData().position.copy(e.getPosition()),this.getRuntimeData().quaternion.copy(e.getQuaternion()))},t.prototype.onPostUpdate=function(){var e;if(this.hasRuntimeData()&&this.playing&&this.isEnabled()&&(e=this.getRuntimeData(),this.target&&this.target.runtimeData)){this.getEngine().needsRender=!0;var t=this.target.runtimeData;if(this.tempVec.setFromMatrixPosition(t.matrixWorld),e.parent?this.tempMatrix.getInverse(e.parent.matrixWorld):this.tempMatrix.identity(),this.tempVec.applyMatrix4(this.tempMatrix),this.local){e.lookAt(this.tempVec);var r=this.getEntity();r instanceof o.default&&e.quaternion.multiply(r.getQuaternion())}else e.lookAt(this.tempVec)}},t.prototype.onShutdown=function(){},t}(a.default);t.default=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(1),a=r(2),o=r(39),s=.5,u=36,p=1,c=80,l=function(e){function t(){var t=e.call(this)||this;return t.createScene(),t}return i.__extends(t,e),t.prototype.setLightingFromThreeScene=function(e){var t=this;this.resetSceneLighting(),e.traverse(function(e){e instanceof n.Light&&t.scene.add(e.clone())}),this.captureScene()},t.prototype.setLightingFromScene=function(e){var t=this;this.resetSceneLighting(),e.getDescendantsByClass(o.default).forEach(function(e){e.isUnloaded()&&e.loadBase(),t.scene.add(e.getRuntimeData().clone())}),this.captureScene()},t.prototype.onAwake=function(){this.listenTo(this.getEntity(),"change:properties",this.onMaterialChanges)},t.prototype.onEnable=function(){this.captureScene()},t.prototype.onAttributesChanged=function(e){var t=this;e.indexOf("captureTexture")!==-1&&(this.getEntity().on("load",function(){t.captureScene()}),this.getEntity().isLoaded()&&this.captureScene())},t.prototype.onMaterialChanges=function(e){this.captureScene()},t.prototype.createScene=function(){this.camera=new n.OrthographicCamera(-s,s,s,-s,p,c),this.scene=new n.Scene,this.createGeometry(),this.scene.add(this.sphereMesh),this.scene.add(this.planeMesh),this.scene.add(this.camera),this.camera.position.z=.5*c, +case 1:this.touchLast.x>=0?(r=-.5*(this.touchLast.x-t[0].scenePercentX),i=-.5*(this.touchLast.y-t[0].scenePercentY)):(r=0,i=0),this.touchLast.x=t[0].scenePercentX,this.touchLast.y=t[0].scenePercentY,this.ellapsedTimeSinceInput=0,this.lookDelta.set(r,i);break;case 2:r=t[0].scenePercentX-t[1].scenePercentX,i=t[0].scenePercentY-t[1].scenePercentY;var n=Math.sqrt(r*r+i*i);if(this.touchLast.x>=0){var a=this.touchLastPinchDist-n,o=this.touchLast.y-t[0].scenePercentY;Math.abs(a)>Math.abs(o)?this.zoomDelta=20*a:this.zoomDelta=20*o}this.touchLastPinchDist=n,this.touchLast.x=t[0].scenePercentX,this.touchLast.y=t[0].scenePercentY;break;case 3:r=t[0].scenePercentX-this.touchLast.x,i=t[0].scenePercentY-this.touchLast.y,this.touchLast.x>=0&&this.moveDelta.set(r,i,0),this.touchLast.x=t[0].scenePercentX,this.touchLast.y=t[0].scenePercentY}}},t.prototype.onTouchEnd=function(){this.touchLast.set(-1,-1),this.touchLastPinchDist=-1,this.touchState="none"},t}(a.default);t.default=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(2),a=function(e){function t(){var t=e.call(this)||this;return t.el=void 0,t.fsEnabled=!1,t}return i.__extends(t,e),t.prototype.onStartup=function(){this.toggle=this.toggle.bind(this),this.getEntity().on("toggleFullscreen",this.toggle,this),this.listenTo(this.getGlobalEvents(),"fullscreen::toggle",this.toggle),this.listenTo(this.getGlobalEvents(),"fullscreen::enable",this.enableFullscreen),this.listenTo(this.getGlobalEvents(),"fullscreen::disable",this.disableFullscreen)},t.prototype.toggle=function(){this.fsEnabled?this.disableFullscreen():this.enableFullscreen()},t.prototype.enableFullscreen=function(){this.el||this.attachFullscreenAPI(),this.el.requestFullscreen(),this.fsEnabled=!0},t.prototype.disableFullscreen=function(){this.el||this.attachFullscreenAPI(),this.fsEnabled&&document.exitFullscreen(),this.fsEnabled=!1},t.prototype.attachFullscreenAPI=function(){this.el=this.getEngine().container,this.el.requestFullscreen=this.el.requestFullscreen||this.el.requestFullScreen||this.el.mozRequestFullscreen||this.el.mozRequestFullScreen||this.el.webkitRequestFullscreen||this.el.webkitRequestFullScreen||this.el.msRequestFullscreen||this.el.msRequestFullScreen,document.exitFullscreen=document.exitFullscreen||document.exitFullScreen||document.mozCancelFullscreen||document.mozCancelFullScreen||document.webkitExitFullscreen||document.webkitExitFullScreen||document.msExitFullscreen||document.msExitFullScreen,document.addEventListener("fullscreenchange",this.onFullscreenChange.bind(this),!1),document.addEventListener("mozfullscreenchange",this.onFullscreenChange.bind(this),!1),document.addEventListener("webkitfullscreenchange",this.onFullscreenChange.bind(this),!1),document.addEventListener("msfullscreenchange",this.onFullscreenChange.bind(this),!1)},t.prototype.onFullscreenChange=function(e){this.getGlobalEvents().trigger("fullscreen::change",e)},t}(n.default);t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(1),a=r(2),o=r(5),s=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.buttons=[],t.axes=[],t.workVector1=new n.Vector3,t.workVector2=new n.Vector3,t.workQuaternion1=new n.Quaternion,t.workQuaternion2=new n.Quaternion,t.workEuler=new n.Euler,t.meshControlMap={},t.updateAxes=!1,t.updateButtons=[],t.gamepadDevice=null,t}return i.__extends(t,e),t.prototype.onUpdate=function(e){var t=this;this.gamepadDevice||(this.gamepadDevice=this.getGamepadDevice(),this.gamepadDevice&&(this.listenTo(this.gamepadDevice,"gamepadButtonChanged",this.onGamepadButtonEvent),this.listenTo(this.gamepadDevice,"gamepadButtonTouched",this.onGamepadButtonEvent),this.listenTo(this.gamepadDevice,"gamepadButtonReleased",this.onGamepadButtonEvent),this.listenTo(this.gamepadDevice,"gamepadAxisChanged",this.onGamepadAxisEvent))),this.updateButtons.forEach(function(e,r){e&&t.updateButtonTransform(r)}),this.updateAxes&&(this.updateAxes=!1,this.updateAxesTransforms())},t.prototype.getAxisMeshes=function(e){return this.axes[e].map(function(e){return e.mesh})},t.prototype.getButtonMeshes=function(e){return this.buttons[e].map(function(e){return e.mesh})},t.prototype.onAttributesChanged=function(e){var t=this;e.indexOf("axes")===-1&&e.indexOf("buttons")===-1||(this.meshControlMap={},this.axes.forEach(function(e,r){e.forEach(function(e,i){var n=e.mesh;n&&(t.meshControlMap[n.id]||(t.meshControlMap[n.id]={axes:[],axesMeshIdx:[],buttons:[],buttonMeshIdx:[]}),t.meshControlMap[n.id].axes.push(r),t.meshControlMap[n.id].axesMeshIdx.push(i))})}),this.buttons.forEach(function(e,r){e.forEach(function(e,i){var n=e.mesh;n&&t.meshControlMap[n.id]&&(t.meshControlMap[n.id].buttons.push(r),t.meshControlMap[n.id].buttonMeshIdx.push(i))})}))},t.prototype.getGamepadDevice=function(){if(this.gamepadDevice)return this.gamepadDevice;var e=this.getEntity().getAncestors(),t=e.find(function(e){return!!e.getComponentByScriptId("motion_gamepad_device")});return t?(this.gamepadDevice=t.getComponentByScriptId("motion_gamepad_device"),this.gamepadDevice):(this.gamepadDevice=null,null)},t.prototype.onGamepadButtonEvent=function(e,t){this.currentGamepadState=e,this.updateButtons[t]=!0},t.prototype.updateButtonTransform=function(e){var t=this,r=this.currentGamepadState.buttons[e].value,i=this.buttons[e];i.forEach(function(i){if(i.mesh){switch(i.movementType){case"translate":t.workVector1.copy(i.offset).multiplyScalar(r),i.mesh.setPosition(t.workVector1.x,t.workVector1.y,t.workVector1.z);break;case"rotate":t.workVector2.copy(i.rotation).multiplyScalar(r),t.workEuler.setFromVector3(t.workVector2),t.workQuaternion1.setFromEuler(t.workEuler),t.workVector1.copy(i.pivot),t.workVector2.copy(t.workVector1).multiplyScalar(-1),t.workVector2.applyQuaternion(t.workQuaternion1),t.workVector2.add(t.workVector1),i.mesh.setQuaternion(t.workQuaternion1.x,t.workQuaternion1.y,t.workQuaternion1.z,t.workQuaternion1.w),i.mesh.setPosition(t.workVector2.x,t.workVector2.y,t.workVector2.z)}i.renderOnTouchOnly&&t.currentGamepadState.buttons[e].hasOwnProperty("touched")&&i.mesh.setProperty("visible",t.currentGamepadState.buttons[e].touched)}})},t.prototype.onGamepadAxisEvent=function(e,t){this.currentGamepadState=e,this.updateAxes=!0},t.prototype.updateAxesTransforms=function(){var e=this;o.forEach(this.meshControlMap,function(t,r){var i=e.getEngine().getObjectById(r);if(i){var n=e.axes[0][t.axesMeshIdx[0]].movementType;if(e.workVector1.set(0,0,0),t.axes.reduce(function(r,i,a){var o=e.axes[i][t.axesMeshIdx[a]];if(o.movementType!==n)return log.error("Can't perform multiple types of axis transformations on same mesh."),r;if("translate"===n){var s=e.currentGamepadState.axes[i];e.workVector2.copy(o.offset).multiplyScalar(s)}else"rotate"===n&&e.workVector2.copy(o.pivot).multiplyScalar(-1);return r.lerp(e.workVector2,0===a?1:.5)},e.workVector1),e.workQuaternion1.set(0,0,0,1),"rotate"===n&&(t.axes.reduce(function(r,i,n){var a=e.axes[i][t.axesMeshIdx[n]],o=e.currentGamepadState.axes[i];return e.workVector2.copy(a.rotation).multiplyScalar(o),e.workEuler.setFromVector3(e.workVector2),e.workQuaternion2.setFromEuler(e.workEuler),r.slerp(e.workQuaternion2,0===n?1:.5)},e.workQuaternion1),e.workVector2.copy(e.workVector1),e.workVector1.applyQuaternion(e.workQuaternion1),e.workVector2.multiplyScalar(-1),e.workVector1.add(e.workVector2)),i.setQuaternion(e.workQuaternion1.x,e.workQuaternion1.y,e.workQuaternion1.z,e.workQuaternion1.w),i.setPosition(e.workVector1.x,e.workVector1.y,e.workVector1.z),t.buttons.length){var a=t.buttons[0],o=e.currentGamepadState.buttons[a].value,s=e.buttons[a][0].offset;e.workVector2.copy(s).multiplyScalar(o),e.workVector2.applyQuaternion(e.workQuaternion1),e.workVector2.add(e.workVector1),i.setPosition(e.workVector2.x,e.workVector2.y,e.workVector2.z)}}})},t}(a.default);t.default=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(2),a=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.gamepadStates=[],t}return i.__extends(t,e),t.prototype.onPreUpdate=function(e){if(this.isEnabled()&&navigator.getGamepads)for(var t=navigator.getGamepads(),r=0;r":187,"<":188,_:189,".":190,"/":191,"[":219,"]":221};var h=function(e){function r(){var t=e.call(this)||this;return t.mouseButtons={left:0,middle:1,right:2},t.inputQueue=[],t.inputPool=[],t.mouseButtonState=new Array(3),t.mouseButtonStatePrevious=new Array(3),t.mousePosition=new u.Vector2,t.mousePositionPercent=new u.Vector2,t.mousePreviousPosition=new u.Vector2,t.mouseDragState=new Array(3),t.mouseDragStatePrevious=new Array(3),t.mouseDragDistance=[new u.Vector2,new u.Vector2,new u.Vector2],t.touchPosition=new u.Vector2,t.touchPositionPercent=new u.Vector2,t.touchPreviousPosition=new u.Vector2,t.touchDragState=!1,t.touchDragStatePrevious=!1,t.doubleTapHandle=null,t.doubleTapPosition=new u.Vector2,t.listenForTouchStart=!1,t.listenForTouchEnd=!1,t.touchesStart=[],t.keyState=new Array(256),t.keyStatePrevious=new Array(256),t.canvas=null,t.pointerLockEnabled=!1,t}return i.__extends(r,e),r.prototype.mouseButtonDown=function(e){if("any"===e){for(var t in this.mouseButtons)if(this.mouseButtonState[this.mouseButtons[t]])return!0;return!1}return this.mouseButtonState[this.mouseButtons[e]]},r.prototype.mouseButtonUp=function(e){return!this.mouseButtonState[this.mouseButtons[e]]},r.prototype.mouseButtonPressed=function(e){return!(!this.mouseButtonState[this.mouseButtons[e]]||this.mouseButtonStatePrevious[this.mouseButtons[e]])},r.prototype.mouseButtonReleased=function(e){return!(this.mouseButtonState[this.mouseButtons[e]]||!this.mouseButtonStatePrevious[this.mouseButtons[e]])},r.prototype.keyPressed=function(e){return!(!this.keyState[t.keyCodes[e]]||this.keyStatePrevious[t.keyCodes[e]])},r.prototype.keyReleased=function(e){return!(this.keyState[t.keyCodes[e]]||!this.keyStatePrevious[t.keyCodes[e]])},r.prototype.keyDown=function(e){return!!this.keyState[t.keyCodes[e]]},r.prototype.keyUp=function(e){return!this.keyState[t.keyCodes[e]]},r.prototype.getMouseDragState=function(e){return this.mouseDragState[this.mouseButtons[e||"left"]]},r.prototype.getPreviousMouseDragState=function(e){return this.mouseDragStatePrevious[this.mouseButtons[e||"left"]]},r.prototype.getTouchDragState=function(){return this.touchDragState},r.prototype.getPreviousTouchDragState=function(){return this.touchDragStatePrevious},r.prototype.enablePointerLock=function(){this.pointerLockEnabled=!0,this.canvas.requestPointerLock()},r.prototype.disablePointerLock=function(){this.pointerLockEnabled=!1,document.exitPointerLock()},r.prototype.togglePointerLock=function(){this.pointerLockEnabled?this.enablePointerLock():this.disablePointerLock()},r.prototype.onStartup=function(){this.canvas=this.getEngine().canvas,this.canvas.requestPointerLock=this.canvas.requestPointerLock||this.canvas.mozRequestPointerLock||this.canvas.webkitRequestPointerLock,document.exitPointerLock=document.exitPointerLock||document.mozExitPointerLock||document.webkitExitPointerLock,this.clearKeyStates=this.clearKeyStates.bind(this),this.onMouseMove=this.onMouseMove.bind(this),this.onMouseDown=this.onMouseDown.bind(this),this.onMouseUp=this.onMouseUp.bind(this),this.onMouseWheel=this.onMouseWheel.bind(this),this.onMouseLeave=this.onMouseLeave.bind(this),this.onContextMenu=this.onContextMenu.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this.onKeyUp=this.onKeyUp.bind(this),this.onTouchStart=this.onTouchStart.bind(this),this.onTouchEnd=this.onTouchEnd.bind(this),this.onTouchCancel=this.onTouchCancel.bind(this),this.onTouchLeave=this.onTouchLeave.bind(this),this.onTouchMove=this.onTouchMove.bind(this),this.onDoubleClick=this.onDoubleClick.bind(this),this.onDoubleTap=this.onDoubleTap.bind(this),window.addEventListener("blur",this.clearKeyStates,!1),this.isEnabled()&&(this.mouseEvents.enable&&this.enableMouseEvents(),this.keyEvents.enable&&this.enableKeyEvents(),this.touchEvents.enable&&this.enableTouchEvents())},r.prototype.onPreUpdate=function(){if(this.isEnabled())for(;this.inputQueue.length>0;)this.getEngine().trigger(this.inputQueue[0].name,this.inputQueue[0].event),this.recycleInputEvent(this.inputQueue.splice(0,1)[0])},r.prototype.onPostUpdate=function(){if(this.isEnabled()){if(this.keyEvents.enable)for(var e=0;ethis.mouseEvents.dragBufferDistance&&(this.mouseDragState[t]=!0)}else this.mouseDragState[t]=!1;this.inputQueue.push(this.getInputEvent(e,"mouseMove"))},r.prototype.onMouseDown=function(e){if(this.getScenePercent(e,e),this.mouseUpBound||(this.mouseUpBound=!0,document.addEventListener("mouseup",this.onMouseUp)),Array.prototype.forEach.call(document.querySelectorAll("input, textarea, select, option"),function(e){e.blur()}),this.mouseEvents.preventDownDefault&&e.preventDefault(),this.mouseButtonState[e.button]=!0,this.inputQueue.push(this.getInputEvent(e,"mouseDown")),this.mouseEvents.eventHandler){var t=this.getKeyByValue(this.mouseButtons,e.button);t&&this.getGlobalEvents().trigger("mouse_down_"+t)}},r.prototype.onMouseUp=function(e){if(this.getScenePercent(e,e),this.mouseButtonState[e.button]=!1,this.mouseDragState[e.button]=!1,this.mouseDragDistance[e.button].x=0,this.mouseDragDistance[e.button].y=0,this.mouseButtonUp("left")&&this.mouseButtonUp("right")&&this.mouseButtonUp("middle")&&(this.mouseUpBound=!1,document.removeEventListener("mouseup",this.onMouseUp)),this.inputQueue.push(this.getInputEvent(e,"mouseUp")),this.mouseEvents.eventHandler){var t=this.getKeyByValue(this.mouseButtons,e.button);t&&this.getGlobalEvents().trigger("mouse_up_"+t)}},r.prototype.onDoubleClick=function(e){this.getScenePercent(e,e),Array.prototype.forEach.call(document.querySelectorAll("input, textarea, select, option"),function(e){e.blur()}),this.inputQueue.push(this.getInputEvent(e,"doubleClick"))},r.prototype.onMouseWheel=function(e){this.mouseEvents.preventScrollDefault&&e.preventDefault();var t;t=void 0!==e.wheelDeltaY?.025*e.wheelDeltaY:s.isIE()?-e.deltaY/40:-e.deltaY,this.inputQueue.push(this.getInputEvent(t,"mouseScroll"))},r.prototype.onMouseLeave=function(e){for(var t=0,r=this.mouseButtonState;tthis.touchEvents.dragBufferDistance?void this.clearDoubleTapState():(this.listenForTouchStart||this.listenForTouchEnd?!this.listenForTouchStart&&this.listenForTouchEnd?(this.clearDoubleTapState(),this.listenForTouchStart=!0):this.listenForTouchStart&&!this.listenForTouchEnd?(this.clearDoubleTapState(),this.listenForTouchStart=!0,this.listenForTouchEnd=!0,this.canvas.addEventListener("touchend",this.onDoubleTap)):(this.clearDoubleTapState(),this.onTouchEvent(e,"doubleTap")):(this.doubleTapPosition.copy(this.touchPosition),this.clearDoubleTapState(),this.canvas.addEventListener("touchend",this.onDoubleTap),this.listenForTouchEnd=!0),void(this.doubleTapHandle=setTimeout(this.clearDoubleTapState.bind(this),p)))},r.prototype.clearDoubleTapState=function(){clearTimeout(this.doubleTapHandle),this.doubleTapHandle=null,this.listenForTouchStart=!1,this.listenForTouchEnd=!1,this.canvas.removeEventListener("touchend",this.onDoubleTap)},r.prototype.onTouchCancel=function(e){this.touchEvents.preventCancelDefault&&e.preventDefault(),this.touchDragState=!1;var t={};t.originalEvent=e,t.touches=[],this.inputQueue.push(this.getInputEvent(t,"touchCancel"))},r.prototype.onTouchLeave=function(e){this.touchEvents.preventLeaveDefault&&e.preventDefault(),this.touchDragState=!1,this.onTouchEvent(e,"touchLeave")},r.prototype.onTouchMove=function(e){this.touchEvents.preventMoveDefault&&e.preventDefault();var t={};t.originalEvent=e,t.touches=[];for(var r=0;rthis.touchEvents.dragBufferDistance&&(this.touchDragState=!0),t.touches.push(i)}t.touches.length&&(this.touchPosition.x=t.touches[t.touches.length-1].sceneX,this.touchPosition.y=t.touches[t.touches.length-1].sceneY,this.touchPositionPercent.x=t.touches[t.touches.length-1].scenePercentX,this.touchPositionPercent.y=t.touches[t.touches.length-1].scenePercentY),this.inputQueue.push(this.getInputEvent(t,"touchMove"))},r.prototype.onTouchEvent=function(e,t){var r={};r.originalEvent=e,r.touches=[];for(var i=0;i=0&&(this.sourceBoundingSphere.radius=this.boundingSphereOverrideRadius)),this.sceneRoot.isBaseLoaded()&&this.sphereMesh&&(this.sphereMesh.position.copy(this.sourceBoundingSphere.center),this.sphereMesh.scale.set(this.sourceBoundingSphere.radius,this.sourceBoundingSphere.radius,this.sourceBoundingSphere.radius)),this.previousIntersections=this.currentIntersections,this.currentIntersections={},this.firstIntersectionOnly){var i=t.find(this.intersectObject.bind(this));i&&(this.previousIntersections[i.id]||(this.trigger("beginIntersection",i),this.getEntity().trigger("beginIntersection",i)),this.currentIntersections[i.id]=i)}else{var n=t.filter(this.intersectObject.bind(this));n.forEach(function(t){e.previousIntersections[t.id]||(e.trigger("beginIntersection",t),e.getEntity().trigger("beginIntersection",t)),e.currentIntersections[t.id]=t})}return o.forEach(this.previousIntersections,function(t){e.currentIntersections[t.id]||(e.trigger("endIntersection",t),e.getEntity().trigger("endIntersection",t))}),this.currentIntersections}},t.prototype.onAttributesChanged=function(e){e.indexOf("debugVisualization")!==-1&&(this.sphereMesh.visible=this.debugVisualization)},t.prototype.onPreUpdate=function(){this.checkIntersectionAlways&&this.checkIntersection()},t.prototype.generateObjectList=function(){var e=this;if(this.objectFilter.length)return this.objectFilter;var t=[];return this.sceneRoot.traverseSome(function(r){return r===e.getEntity()||!(e.objectTypeFilter.length&&!e.objectTypeFilter.some(function(e){return r.type===e}))&&void t.push(r)}),t},t.prototype.intersectObject=function(e){var t=e.runtimeData;return!!t&&(this.workMatrix.getInverse(t.matrixWorld),this.workBoundsSphere.copy(this.sourceBoundingSphere),this.workBoundsSphere.applyMatrix4(this.workMatrix),e.getBounds(this.workBoundingBox),this.workBoundingBox.intersectsSphere(this.workBoundsSphere))},t}(a.default);t.default=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(2),a=r(14),o=function(e){function t(){var t=e.call(this)||this;return t.setupMaterial=t.setupMaterial.bind(t),t}return i.__extends(t,e),t.prototype.onAwake=function(){var e=this;this.listenTo(this.getEngine(),"entityCreated",function(t){t instanceof a.default&&e.setupMaterial(t)})},t.prototype.onAttributesChanged=function(e){this.setupAllMaterials()},t.prototype.onDisable=function(){this.getEngine().getAssetsByClass(a.default).forEach(function(e){e.setProperty("envMapIrradiance",null),e.setProperty("envMapRadianceHalfGloss",null),e.setProperty("envMapRadiance",null)})},t.prototype.onEnable=function(){this.setupAllMaterials()},t.prototype.setupAllMaterials=function(){this.getEngine().getAssetsByClass(a.default).forEach(this.setupMaterial)},t.prototype.setupMaterial=function(e){e&&this.isEnabled()&&(e.setProperty("envMapIrradiance",this.getAttribute("irradianceMap")),e.setProperty("envMapRadiance",this.getAttribute("radianceMap")),e.setProperty("envMapRadianceHalfGloss",this.getAttribute("radianceMapHalfGloss")))},t}(n.default);t.default=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(1),a=r(2),o=r(10),s=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.playing=!0,t}return i.__extends(t,e),t.prototype.onStartup=function(){this.tempVec=new n.Vector3,this.tempMatrix=new n.Matrix4,this.tempQuaternion=new n.Quaternion},t.prototype.onAttributesChanged=function(e){if(!this.playing){var t=this.getEntity();t instanceof o.default&&(this.getRuntimeData().position.copy(t.getPosition()),this.getRuntimeData().quaternion.copy(t.getQuaternion()))}},t.prototype.onEnable=function(){this.playing=!0},t.prototype.onDisable=function(){this.playing=!1;var e=this.getEntity();e instanceof o.default&&(this.getRuntimeData().position.copy(e.getPosition()),this.getRuntimeData().quaternion.copy(e.getQuaternion()))},t.prototype.onPostUpdate=function(){var e;if(this.hasRuntimeData()&&this.playing&&this.isEnabled()&&(e=this.getRuntimeData(),this.target&&this.target.runtimeData)){this.getEngine().needsRender=!0;var t=this.target.runtimeData;if(this.tempVec.setFromMatrixPosition(t.matrixWorld),e.parent?this.tempMatrix.getInverse(e.parent.matrixWorld):this.tempMatrix.identity(),this.tempVec.applyMatrix4(this.tempMatrix),this.local){e.lookAt(this.tempVec);var r=this.getEntity();r instanceof o.default&&e.quaternion.multiply(r.getQuaternion())}else e.lookAt(this.tempVec)}},t.prototype.onShutdown=function(){},t}(a.default);t.default=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(1),a=r(2),o=r(39),s=.5,u=36,p=1,c=80,l=function(e){function t(){var t=e.call(this)||this;return t.createScene(),t}return i.__extends(t,e),t.prototype.setLightingFromThreeScene=function(e){var t=this;this.resetSceneLighting(),e.traverse(function(e){e instanceof n.Light&&t.scene.add(e.clone())}),this.captureScene()},t.prototype.setLightingFromScene=function(e){var t=this;this.resetSceneLighting(),e.getDescendantsByClass(o.default).forEach(function(e){e.isUnloaded()&&e.loadBase(),t.scene.add(e.getRuntimeData().clone())}),this.captureScene()},t.prototype.onAwake=function(){this.listenTo(this.getEntity(),"change:properties",this.onMaterialChanges)},t.prototype.onEnable=function(){this.captureScene()},t.prototype.onAttributesChanged=function(e){var t=this;e.indexOf("captureTexture")!==-1&&(this.getEntity().on("load",function(){t.captureScene()}),this.getEntity().isLoaded()&&this.captureScene())},t.prototype.onMaterialChanges=function(e){this.captureScene()},t.prototype.createScene=function(){this.camera=new n.OrthographicCamera(-s,s,s,-s,p,c),this.scene=new n.Scene,this.createGeometry(),this.scene.add(this.sphereMesh),this.scene.add(this.planeMesh),this.scene.add(this.camera),this.camera.position.z=.5*c, this.camera.position.y=.25*c,this.camera.position.x=.25*c,this.camera.lookAt(new n.Vector3(0,0,0)),this.planeMesh.lookAt(this.camera.position)},t.prototype.createGeometry=function(){this.geometry=new n.SphereBufferGeometry(s,u,u),this.planeGeometry=new n.PlaneBufferGeometry(2*s,2);var e=Math.sqrt(.5),t=this.planeGeometry.attributes.normal;t.array=new Float32Array([-1,1,0,1,1,0,-1,-1,0,1,-1,0]);for(var r=0;r=1&&(n-=1);var a=1-i;if(r&&na){var x=1-(n-a)/i;f+=e*E/t*Math.max(.5*Math.cos(x*Math.PI+Math.PI)+.5,0)}else f+=e*E/t;(f>=1||f<0)&&(f%=1,d=0,s||(f=.99999999,c.playingCurveAnimation=!1,c.getEngine().off("update",c.curveAnim,c),c.curveAnim=void 0),c.getEntity().trigger("endAnimateAlongCurve"));var D=u.curve,_=D.getUtoTmapping(f);if(h.position.copy(D.getPoint(_)),"toCurve"===o){var M=D.getTangent(_);m.set(0,-1,0),y.crossVectors(M,m),g.crossVectors(M,y),m.copy(h.position),m.add(M),v.lookAt(h.position,m,g),h.quaternion.setFromRotationMatrix(v)}else if("toNode"===o){var A=u.closed?D.points.length:D.points.length-1,T=Math.floor(_*A),C=Math.ceil(_*A)%D.points.length;T!==w&&(T>0?u.controlPoints[T].getQuaternionInWorldSpace(b):u.controlPoints[0].getQuaternionInWorldSpace(b)),C!==S&&(C>0?u.controlPoints[C].getQuaternionInWorldSpace(P):u.controlPoints[0].getQuaternionInWorldSpace(P));var R=_*A-T;h.quaternion.copy(b),h.quaternion.slerp(P,R)}}};r+i>1&&(n.default.warn("Ease-In and Ease-Out value can't total more than 1.0."),r=.5,i=.5),t>0&&(this.playingCurveAnimation=!0,u.isCurveInit()?(this.curveAnim=D,this.getEngine().on("update",this.curveAnim,this)):u.on("curveInit",function(){c.curveAnim=D,c.getEngine().on("update",c.curveAnim,c)},this))}},t.prototype.onPauseCurveAnimation=function(){this.playingCurveAnimation=!1},t.prototype.onUnpauseCurveAnimation=function(){this.playingCurveAnimation=!0},t.prototype.animateToObject=function(e,t,r,i,o){var s=this,u=this.getEngine(),p=function(e){var p=s.getRuntimeData(),c=new a.Matrix4,l=0,h=0;r+i>1&&(n.default.warn("Ease-In and Ease-Out value can't total more than 1.0."),r=.5,i=.5);var d,f=1-r-i,m=1/(r/2+i/2+f),y=new a.Vector3;y.copy(p.position);var g=e.position,v=e.quaternion;if(v&&o&&(d=new a.Quaternion,d.copy(p.quaternion)),e.updateMatrixWorld(!0),g.setFromMatrixPosition(e.matrixWorld),c.extractRotation(e.matrixWorld),v.setFromRotationMatrix(c),t>0){var b=function(e){if(!s.getEntity()||!s.isEnabled())return void u.off("update",b,s);s.getEngine().needsRender=!0,l+=e;var n=l/t,a=1-i;if(r&&na){var f=1-(n-a)/i;h+=e*m/t*Math.max(.5*Math.cos(f*Math.PI+Math.PI)+.5,0)}else h+=e*m/t;h=Math.min(h,1),(h>=1||h<0)&&(s.getEngine().off("update",b,s),s.getEntity().trigger("endAnimateToObject")),p.position.copy(y),p.position.lerp(g,h),v&&o&&(p.quaternion.copy(d),p.quaternion.slerp(v,h))};s.getEngine().on("update",b,s)}else p.position.copy(g),v&&p.quaternion.copy(v),s.getEntity().trigger("endAnimateToObject")},c=this.getEngine().getEntityById(e);c.runtimeData?p(c.runtimeData):(c.once("loadBase",function(){p(c.runtimeData)},this),c.load())},t.prototype.animateTranslation=function(e,t,r,i,o){var s=this,u=this.getRuntimeData();u.position.copy(this.getEntity().getPosition()),u.quaternion.copy(this.getEntity().getQuaternion()),u.scale.copy(this.getEntity().getScale());var p=0,c=this.getEngine();t+r>1&&(n.default.warn("Ease-In and Ease-Out value can't total more than 1.0."),t=.5,r=.5);var l=e*t,h=new a.Vector3,d=new a.Vector3;d.copy(i);var f=d.length();if(u.updateMatrixWorld(),d.applyQuaternion(u.quaternion),d.normalize(),o){var m=(1-t-r)*e,y=.5*(t+r)*e;"middle"===o?(h.copy(i),h.multiplyScalar(-.5*(m+y)),u.position.add(h)):"end"===o&&(h.copy(i),h.multiplyScalar(-1*(m+y)),u.position.add(h))}if(e>0){var g=function(i){if(!s.getEntity()||!s.isEnabled())return void c.off("update",g,s);h.copy(d),s.getEngine().needsRender=!0,p+=i;var n=Math.min(p/e,1),a=1-r,o=e*a;if(t&&po){var y=1-(n-a)/r;h.multiplyScalar(i*f*Math.max(.5*Math.cos(y*Math.PI+Math.PI)+.5,0))}else h.multiplyScalar(i*f);p>=e&&(s.getEngine().off("update",g,s),s.getEntity().trigger("endAnimateTranslation")),u.position.add(h)};this.getEngine().on("update",g,this)}},t.prototype.animateRotation=function(e,t,r,i,o,s){var u=this,p=this.getRuntimeData();p.position.copy(this.getEntity().getPosition()),p.quaternion.copy(this.getEntity().getQuaternion()),p.scale.copy(this.getEntity().getScale());var c=0,l=this.getEngine();t+r>1&&(n.default.warn("Ease-In and Ease-Out value can't total more than 1.0."),t=.5,r=.5);var h=e*t,d=new a.Quaternion,f=new a.Quaternion,m=new a.Vector3,y=new a.Euler(i.x,i.y,i.z,s);if(d.setFromEuler(y),f.copy(d),p.updateMatrixWorld(),o){var g=(1-t-r)*e,v=.5*(t+r)*e;"middle"===o?(m.copy(i),m.multiplyScalar(-.5*(g+v)),y.set(m.x,m.y,m.z),d.setFromEuler(y),p.quaternion.multiply(d)):"end"===o&&(m.copy(i),m.multiplyScalar(-1*(g+v)),y.set(m.x,m.y,m.z),d.setFromEuler(y),p.quaternion.multiply(d))}if(e>0){var b=function(i){if(!u.getEntity()||!u.isEnabled())return void l.off("update",b,u);var n=1;u.getEngine().needsRender=!0,c+=i;var a=Math.min(c/e,1),o=1-r,s=e*o;if(t&&cs){var y=1-(a-o)/r;n*=i*Math.max(.5*Math.cos(y*Math.PI+Math.PI)+.5,0)}else n*=i;c>=e&&(u.getEngine().off("update",b,u),u.getEntity().trigger("endAnimateTranslation")),d.set(0,0,0,1),d.slerp(f,n),p.quaternion.multiply(d)};this.getEngine().on("update",b,this)}},t.prototype.animateScale=function(e,t,r,i,o){var s=this,u=this.getRuntimeData();u.position.copy(this.getEntity().getPosition()),u.quaternion.copy(this.getEntity().getQuaternion()),u.scale.copy(this.getEntity().getScale());var p=0,c=this.getEngine();t+r>1&&(n.default.warn("Ease-In and Ease-Out value can't total more than 1.0."),t=.5,r=.5);var l=e*t,h=new a.Vector3;if(u.updateMatrixWorld(),o){var d=(1-t-r)*e,f=.5*(t+r)*e;"middle"===o?(h.copy(i),h.multiplyScalar(-.5*(d+f)),u.scale.add(h)):"end"===o&&(h.copy(i),h.multiplyScalar(-1*(d+f)),u.scale.add(h))}if(e>0){var m=function(n){if(!s.getEntity()||!s.isEnabled())return void c.off("update",m,s);h.copy(i),s.getEngine().needsRender=!0,p+=n;var a=Math.min(p/e,1),o=1-r,d=e*o;if(t&&pd){var y=1-(a-o)/r;h.multiplyScalar(n*Math.max(.5*Math.cos(y*Math.PI+Math.PI)+.5,0))}else h.multiplyScalar(n);p>=e&&(s.getEngine().off("update",m,s),s.getEntity().trigger("endAnimateTranslation")),u.scale.add(h)};this.getEngine().on("update",m,this)}},t}(o.default);t.default=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(1),a=r(2),o=r(16),s=r(5),u=r(28),p=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.pickTrigger=null,t.enableHoverByDefault=!1,t.pickingMaterialDef=void 0,t.meshRegistry={},t.meshList=[],t.pickingTexture=void 0,t.currentHoverObject=void 0,t.currentFrame=0,t.hoverEnabled=!1,t}return i.__extends(t,e),t.prototype.registerMesh=function(e){var t=this;e.when("loadBase",function(r){t.registerObject(e,e.runtimeData)},this)},t.prototype.unregisterMesh=function(e){e&&this.unregisterObject(e,e.runtimeData)},t.prototype.onAwake=function(){this.getEngine().once("endHover:bound",this.enableHover,this),this.getEngine().once("beginHover:bound",this.enableHover,this)},t.prototype.onStartup=function(){this.getEngine().on("resize",this.resize,this),this.addPickingEvents(),this.initPickingMaterial(),this.initMeshRegistry(),this.getGlobalEvents().on("registerPickingObject",this.registerObject,this),this.getGlobalEvents().on("unregisterPickingObject",this.unregisterObject,this),this.resize()},t.prototype.onShutdown=function(){this.removePickingEvents(),this.getEngine().off("resize",this.resize,this),this.getGlobalEvents().off("registerPickingObject",this.registerObject,this),this.getGlobalEvents().off("unregisterPickingObject",this.unregisterObject,this),this.pickingTexture&&(this.pickingTexture.dispose(),this.pickingTexture=void 0);for(var e in this.meshRegistry)this.meshRegistry[e].pickingMaterial&&this.meshRegistry[e].pickingMaterial.dispose();this.meshRegistry={},this.meshList=[]},t.prototype.onPostRender=function(){this.enableHoverByDefault&&!o.isMobile()&&this.hoverUpdate()},t.prototype.addPickingEvents=function(){"Up"===this.pickTrigger.substr(-2)?o.isMobile()?this.getEngine().on("touchEnd",this.touchPick,this):this.getEngine().on("mouseUp",this.pick,this):"Down"===this.pickTrigger.substr(-4)?o.isMobile()?this.getEngine().on("touchStart",this.touchPick,this):this.getEngine().on("mouseDown",this.pick,this):"Click"===this.pickTrigger.substr(-5)&&(o.isMobile()?this.getEngine().on("touchEnd",this.touchPickNoDrag,this):this.getEngine().on("mouseUp",this.pickNoDrag,this)),this.enableHoverByDefault&&!o.isMobile()&&this.enableHover()},t.prototype.removePickingEvents=function(){"Up"===this.pickTrigger.substr(-2)?o.isMobile()?this.getEngine().off("touchEnd",this.touchPick,this):this.getEngine().off("mouseUp",this.pick,this):o.isMobile()?this.getEngine().off("touchStart",this.touchPick,this):this.getEngine().off("mouseDown",this.pick,this)},t.prototype.initPickingMaterial=function(){this.pickingMaterialDef={depthTest:!0,depthWrite:!0,transparent:!1,side:n.DoubleSide,uniforms:{color:{type:"c",value:16711680}},vertexShader:[n.ShaderChunk.skinning_pars_vertex,n.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",n.ShaderChunk.skinbase_vertex,n.ShaderChunk.skinnormal_vertex,n.ShaderChunk.defaultnormal_vertex,n.ShaderChunk.skinning_vertex,n.ShaderChunk.project_vertex,n.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 color;",n.ShaderChunk.logdepthbuf_pars_fragment,"void main() {",n.ShaderChunk.logdepthbuf_fragment,"gl_FragColor = vec4( color, 1.0 );","}"].join("\n")}},t.prototype.initMeshRegistry=function(){var e=this;this.getEntity().traverse(function(t){"mesh"===t.type&&e.registerMesh(t)})},t.prototype.enableHover=function(){this.hoverEnabled||o.isMobile()||(this.hoverEnabled=!0)},t.prototype.resize=function(){var e=this.pickingTexture,t=this.getRenderer().getWidth(),r=this.getRenderer().getHeight();this.pickingTexture=new n.WebGLRenderTarget(Math.floor(t/4),Math.floor(r/4),{minFilter:n.LinearFilter}),this.pickingTexture.texture.generateMipmaps=!1,e&&e.dispose()},t.prototype.registerObject=function(e,t){if(!this.meshRegistry[t.id]){this.meshRegistry[t.id]={entity:e,runtimeData:t,prevMaterial:null,pickingMaterial:new n.ShaderMaterial(this.pickingMaterialDef),index:this.meshList.length},this.meshList.push(this.meshRegistry[t.id]);var r=this.meshRegistry[t.id].pickingMaterial;r.uniforms=n.UniformsUtils.clone(this.pickingMaterialDef.uniforms),r.uniforms.color.value=new n.Color(t.id),t instanceof n.SkinnedMesh&&(r.skinning=!0)}},t.prototype.unregisterObject=function(e,t){t&&this.meshRegistry[t.id]&&(this.meshRegistry[t.id].entity=null,this.meshRegistry[t.id].pickingMaterial.dispose(),this.meshList.splice(this.meshRegistry[t.id].index,1),delete this.meshRegistry[t.id])},t.prototype.getThreeObjects=function(e){return e.reduce(function(e,t){return t.getRuntimeData()&&e.push(t.runtimeData),e},[])},t.prototype.touchPickNoDrag=function(e,t){this.getInput().getPreviousTouchDragState()||this.touchPick(e,t)},t.prototype.touchPick=function(e,t){if(this.isEnabled()){var r=this.getInput().touchPosition.x,i=this.getInput().touchPosition.y,n=this.pickMesh(r,i);if(n){n.trigger("pick");for(var a=n.getParentObject();a;)a.trigger("pick"),a=a.getParentObject();"function"==typeof t&&t(n)}}},t.prototype.pickNoDrag=function(e,t){this.getInput().getPreviousMouseDragState(this.getInput().mouseButtons[e.button])||this.pick(e,t)},t.prototype.pick=function(e,t){if(this.isEnabled()){if("left"===this.pickTrigger.substr(0,4)){if(0!==e.button)return}else if("right"===this.pickTrigger.substr(0,4)){if(2!==e.button)return}else if(1!==e.button)return;var r=e.clientX,i=e.clientY,n=this.pickMesh(r,i);if(n){n.trigger("pick");for(var a=n.getParentObject();a;)a.trigger("pick"),a=a.getParentObject();"function"==typeof t&&t(n)}}},t.prototype.hoverUpdate=function(){if(this.isEnabled()){if(this.currentFrame0)for(r=0;r=t.renderGroup){u.splice(r,0,e);break}}else u.push(e)})}),r=0;r0)for(var l=0;l1||i>1)return null;var n,a=0;for(a=0;a0?this.currentLook:this.orbitCam.pivotPoint.position;this.srcLook.copy(n),i?this.lookAtPoint(i.point):this.resetToOrigin(),this.time=this.speed,this.srcZoom=this.zoomComponent.getZoomLevel()}},t.prototype.lookAtPoint=function(e){this.orbitCam.disable(),this.targetLook.copy(e),this.lastFocusPosition.x===-1&&this.lastFocusPosition.copy(this.targetLook),this.targetLook.distanceTo(this.lastFocusPosition)0&&this.onEnd()},t.prototype.onEnd=function(){this.time=-1,this.orbitCam.enable(),this.orbitCam.setPivotPosition(this.currentLook),this.orbitCam.setOrbitDistance(this.getRuntimeData().position.distanceTo(this.currentLook)),this.orbitCam.resetOrbitRotation()},t.prototype.getIntersection=function(e){this.raycaster.far=this.orbitCam.getOrbitDistance()+1,this.raycaster.setFromCamera(e,this.getRuntimeData());var t=this.raycaster.intersectObjects(this.getRootThreeObject().children,!0).filter(a);return t.length>0?t[0]:void 0},t}(u.default);t.default=c},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(1),a=r(2),o=r(26),s=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.position=new n.Vector2,t}return i.__extends(t,e),t.prototype.onStartup=function(){var e=this.getEngine();this.listenTo(e,"mouseDown",this.onMouseDown),this.listenTo(e,"mouseMove",this.onMouseMove),this.listenTo(e,"mouseScroll",this.onMouseScroll)},t.prototype.onMouseDown=function(e){if(this.isEnabled()){var t=this.getInput().mouseButtonDown("left");this.position.x=e.scenePercentX,this.position.y=e.scenePercentY;var r=t?o.orbitEvents.startOrbit:void 0;r&&this.trigger(r,this.position)}},t.prototype.onMouseMove=function(e){if(this.isEnabled()){var t=this.getInput().mouseButtonDown("left");this.position.x=t?e.scenePercentX:e.scenePercentDeltaX,this.position.y=t?e.scenePercentY:e.scenePercentDeltaY;var r=this.getInput().mouseButtonDown("right"),i=r?o.orbitEvents.pan:t?o.orbitEvents.orbit:void 0;i&&this.trigger(i,this.position)}},t.prototype.onMouseScroll=function(e){this.isEnabled()&&this.trigger(o.orbitEvents.zoom,e)},t}(a.default);t.default=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(1),a=r(2),o=r(26),s=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.position=new n.Vector2,t}return i.__extends(t,e),t.prototype.onStartup=function(){var e=this.getEngine();this.listenTo(e,"mouseDown",this.onMouseDown),this.listenTo(e,"mouseMove",this.onMouseMove),this.listenTo(e,"mouseScroll",this.onMouseScroll)},t.prototype.onMouseDown=function(e){if(this.isEnabled()){var t=this.getInput().mouseButtonDown("left");this.position.x=e.scenePercentX,this.position.y=e.scenePercentY;var r=t?o.orbitEvents.startOrbit:void 0;r&&this.trigger(r,this.position)}},t.prototype.onMouseMove=function(e){if(this.isEnabled()){var t=this.getInput().mouseButtonDown("left");this.position.x=t?e.scenePercentX:e.scenePercentDeltaX,this.position.y=t?e.scenePercentY:e.scenePercentDeltaY;var r=this.getInput().mouseButtonDown("right"),i=r?o.orbitEvents.pan:t?o.orbitEvents.orbit:void 0;i&&this.trigger(i,this.position)}},t.prototype.onMouseScroll=function(e){this.isEnabled()&&this.trigger(o.orbitEvents.zoom,e)},t}(a.default);t.default=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(1),a=r(2),o=r(26),s=20,u=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.isOrbiting=!1,t.isPanning=!1,t.isZooming=!1,t.panMidpoint=new n.Vector2,t.lastPanMidpoint=new n.Vector2,t.panDelta=new n.Vector2,t.lastZoomDistance=0,t}return i.__extends(t,e),t.prototype.onStartup=function(){var e=this.getEngine();this.listenTo(e,"touchStart",this.cancelActions),this.listenTo(e,"touchCancel",this.cancelActions),this.listenTo(e,"touchLeave",this.cancelActions),this.listenTo(e,"touchEnd",this.cancelActions),this.listenTo(e,"touchMove",this.onTouchMove)},t.prototype.cancelActions=function(){this.isOrbiting=!1,this.isPanning=!1,this.isZooming=!1,this.panMidpoint.set(0,0),this.lastPanMidpoint.set(0,0),this.panDelta.set(0,0),this.lastZoomDistance=0},t.prototype.onTouchMove=function(e){this.isEnabled()&&e.touches.length&&(1===e.touches.length?this.onSingleTouchMove(e.touches[0]):this.onMultiTouchMove(e.touches[0],e.touches[1]))},t.prototype.onSingleTouchMove=function(e){var t=new n.Vector2(e.scenePercentX,e.scenePercentY);this.isOrbiting?this.orbit(t):(this.isOrbiting=!0,this.startOrbit(t))},t.prototype.onMultiTouchMove=function(e,t){var r=new n.Vector2(e.scenePercentX,e.scenePercentY),i=new n.Vector2(t.scenePercentX,t.scenePercentY);this.pan(r,i),this.zoom(r,i)},t.prototype.startOrbit=function(e){this.trigger(o.orbitEvents.startOrbit,e)},t.prototype.orbit=function(e){this.trigger(o.orbitEvents.orbit,e)},t.prototype.pan=function(e,t){this.panMidpoint.addVectors(e,t),this.panMidpoint.multiplyScalar(.5),this.isPanning||(this.isPanning=!0,this.lastPanMidpoint.copy(this.panMidpoint)),this.panDelta.subVectors(this.panMidpoint,this.lastPanMidpoint),this.panDelta.length()&&this.trigger(o.orbitEvents.pan,this.panDelta),this.lastPanMidpoint.copy(this.panMidpoint),this.panDelta.set(0,0)},t.prototype.zoom=function(e,t){var r=e.distanceTo(t);if(r){this.isZooming||(this.isZooming=!0,this.lastZoomDistance=r);var i=r-this.lastZoomDistance;i&&this.trigger(o.orbitEvents.zoom,i*s),this.lastZoomDistance=r}},t}(a.default);t.default=u},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(1),a=r(2),o=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.skyboxScene=void 0,t.cameras=[null,null,null,null,null,null],t}return i.__extends(t,e),t.prototype.onAttributesChanged=function(e){if(e.indexOf("inputTexture")!==-1){var t=this.getPreviousAttribute("inputTexture");this.unregisterDependency(t),this.registerDependency(this.inputTexture),this.updateTexture()}},t.prototype.onStartup=function(){this.skyboxScene=new n.Scene,this.registerDependency(this.inputTexture),this.initCameras(),this.createSkybox()},t.prototype.onEntityReady=function(){this.updateTexture()},t.prototype.onShutdown=function(){this.inputTexture&&(this.unregisterDependency(this.inputTexture),this.inputTexture.off("load",this.renderToCube,this)),this.skyboxGeometry&&this.skyboxGeometry.dispose(),this.equirectMaterial&&this.equirectMaterial.dispose(),this.skyboxScene=void 0,this.skyboxMesh=void 0,this.inputTexture=void 0},t.prototype.updateTexture=function(){this.inputTexture&&!this.getEntity().isUnloaded()&&(this.inputTexture.off("load",this.renderToCube,this),this.inputTexture.when("load",this.renderToCube,this),this.inputTexture.isBaseUnloaded()&&this.inputTexture.load())},t.prototype.createSkybox=function(){var e=n.ShaderLib.equirect;e.uniforms.tFlip.value=1,this.equirectMaterial=new n.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:e.uniforms,depthWrite:!1,side:n.BackSide}),this.skyboxGeometry=new n.BoxGeometry(100,100,100,1,1,1),this.skyboxMesh=new n.Mesh(this.skyboxGeometry,this.equirectMaterial),this.skyboxMesh.frustumCulled=!1,this.skyboxMesh.castShadow=!1,this.skyboxMesh.receiveShadow=!1,this.isEnabled()&&this.skyboxScene.add(this.skyboxMesh)},t.prototype.initCameras=function(){var e=90,t=1;this.cameras[0]=new n.PerspectiveCamera(e,t,1,1e3),this.cameras[0].up.set(0,-1,0),this.cameras[0].lookAt(new n.Vector3(1,0,0)),this.skyboxScene.add(this.cameras[0]),this.cameras[1]=new n.PerspectiveCamera(e,t,1,1e3),this.cameras[1].up.set(0,-1,0),this.cameras[1].lookAt(new n.Vector3(-1,0,0)),this.skyboxScene.add(this.cameras[1]),this.cameras[2]=new n.PerspectiveCamera(e,t,1,1e3),this.cameras[2].up.set(0,0,1),this.cameras[2].lookAt(new n.Vector3(0,1,0)),this.skyboxScene.add(this.cameras[2]),this.cameras[3]=new n.PerspectiveCamera(e,t,1,1e3),this.cameras[3].up.set(0,0,-1),this.cameras[3].lookAt(new n.Vector3(0,-1,0)),this.skyboxScene.add(this.cameras[3]),this.cameras[4]=new n.PerspectiveCamera(e,t,1,1e3),this.cameras[4].up.set(0,-1,0),this.cameras[4].lookAt(new n.Vector3(0,0,1)),this.skyboxScene.add(this.cameras[4]),this.cameras[5]=new n.PerspectiveCamera(e,t,1,1e3),this.cameras[5].up.set(0,-1,0),this.cameras[5].lookAt(new n.Vector3(0,0,-1)),this.skyboxScene.add(this.cameras[5])},t.prototype.renderToCube=function(){if(this.hasRuntimeData()){this.equirectMaterial.uniforms.tEquirect.value=this.inputTexture.getThreeTexture();var e=this.getRuntimeData(),t=this.getThreeRenderer();e.texture.generateMipmaps=!1, -t.setViewport(0,0,e.width,e.height);for(var r=0;r<5;r++)e.activeCubeFace=r,t.render(this.skyboxScene,this.cameras[r],e);e.texture.generateMipmaps=this.getEntity().getProperty("generateMipmaps"),e.activeCubeFace=5,t.render(this.skyboxScene,this.cameras[5],e)}},t}(a.default);t.default=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(3),a=r(1),o=r(2),s=.0174532925,u={"+X":new a.Vector3(1,0,0),"-X":new a.Vector3(-1,0,0),"+Y":new a.Vector3(0,1,0),"-Y":new a.Vector3(0,-1,0),"+Z":new a.Vector3(0,0,1),"-Z":new a.Vector3(0,0,-1)},p=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.time=0,t.target=new a.Quaternion,t.tempQuat=new a.Quaternion,t}return i.__extends(t,e),t.prototype.getRightVector=function(e){return new a.Vector3(e.elements[0],e.elements[1],e.elements[2])},t.prototype.getUpVector=function(e){return new a.Vector3(e.elements[4],e.elements[5],e.elements[6])},t.prototype.getForwardVector=function(e){return new a.Vector3(e.elements[8],e.elements[9],e.elements[10])},t.prototype.setRightVector=function(e,t){e.elements[0]=t.x,e.elements[1]=t.y,e.elements[2]=t.z},t.prototype.setUpVector=function(e,t){e.elements[4]=t.x,e.elements[5]=t.y,e.elements[6]=t.z},t.prototype.setForwardVector=function(e,t){e.elements[8]=t.x,e.elements[9]=t.y,e.elements[10]=t.z},t.prototype.setAxes=function(e,t,r){var i=u[e],o=u[t];if(!i)return n.default.error("No Up Axis available For ",e);if(!o)return n.default.error("No Forward Axis available For ",t);var s=new a.Vector3,p=new a.Matrix4;this.setUpVector(p,i),this.setForwardVector(p,o),s.crossVectors(i,o),this.setRightVector(p,s),this.target.setFromRotationMatrix(p),r?this.time=this.speed:(this.setRotation(this.target),this.getEntity().trigger("axis_transition_complete"))},t.prototype.eulerFromObject=function(e){var t=isNaN(e.x)?0:e.x*s,r=isNaN(e.y)?0:e.y*s,i=isNaN(e.z)?0:e.z*s,n=new a.Euler(t,r,i);return n.order="YXZ",n},t.prototype.rotateOnWorldAxis=function(e,t,r){if(!(this.time>0)){var i=this.getRuntimeData(),n=new a.Vector3,o=new a.Vector3;n.copy(i.position),o.copy(i.scale),i.position.set(0,0,0),i.scale.set(1,1,1),i.updateMatrix();var u=(new a.Matrix4).makeRotationX((e.x||0)*s),p=(new a.Matrix4).makeRotationY((e.y||0)*s),c=(new a.Matrix4).makeRotationZ((e.z||0)*s);c.multiply(p),c.multiply(u),t&&c.multiply(i.matrix),this.target.setFromRotationMatrix(c),r?(this.setRotation(this.target),this.getEngine().needsRender=!0):this.time=this.speed,i.position.copy(n),i.scale.copy(o)}},t.prototype.rotateToEuler=function(e){this.target.setFromEuler(this.eulerFromObject(e)),this.time=this.speed},t.prototype.setLocalRotation=function(e){this.time=0,this.target.setFromEuler(this.eulerFromObject(e)),this.setRotation(this.target)},t.prototype.setRotation=function(e){this.getEntity().setQuaternion(e.x,e.y,e.z,e.w),this.hasRuntimeData()&&!this.getRuntimeData().quaternion.equals(e)&&this.getRuntimeData().quaternion.copy(e),this.getEngine().needsRender=!0},t.prototype.getSign=function(e){return e>0?"+":"-"},t.prototype.getAxes=function(e){var t=this.getRuntimeData().matrix,r=this.getUpVector(t).normalize(),i=this.getForwardVector(t).normalize(),n=Math.abs(r.x),a=Math.abs(r.y),o=Math.abs(r.z),s=n=0&&this.hasRuntimeData()&&(this.time-=e,this.tempQuat.copy(this.getRuntimeData().quaternion),this.tempQuat.slerp(this.target,Math.min(1,Math.max(0,1-1/(this.speed/this.time)))),this.getEntity().setQuaternion(this.tempQuat.x,this.tempQuat.y,this.tempQuat.z,this.tempQuat.w),this.getEngine().needsRender=!0,this.time<0&&(this.setRotation(this.target),this.getEntity().trigger("axis_transition_complete")))},t}(o.default);t.default=p},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(1),a=r(2),o=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.framesElapsed=0,t.reflectionNormal=new n.Vector3(0,1,0),t.reflectionPlane=new n.Plane,t.clipPlane=new n.Vector4,t.reflectionPosition=new n.Vector3,t.cameraWorldPosition=new n.Vector3,t.rotationMatrix=new n.Matrix4,t.lookAtPosition=new n.Vector3(0,0,-1),t.up=new n.Vector3(0,1,0),t.perspectiveCamera=null,t.orthoCamera=null,t}return i.__extends(t,e),t.prototype.captureScene=function(e,t){if(!t)throw new Error("Call to ReflectionCapture.captureScene without specifying a camera.");this.updateReflection(t);var r=this.captureTexture?this.captureTexture.runtimeData:null,i=r?r:this.tempRenderTexture.runtimeData;this.getRenderer().renderView(e,this.reflectionCamera,{renderTarget:i,clearDepth:!0,enableShadows:!1,enablePreRenderFunctions:!1})},t.prototype.onEntityReady=function(){this.initCameras(),this.initTexture()},t.prototype.onAttributesChanged=function(e){e.indexOf("captureTexture")!==-1&&this.initTexture()},t.prototype.onPreRenderView=function(e,t){this.isEnabled()&&(this.framesElapsed>=this.updateFrameInterval?(this.captureScene(e,t),this.framesElapsed=0):this.framesElapsed++)},t.prototype.createTempRenderTexture=function(){this.tempRenderTexture=this.getEngine().createRenderTexture2d({width:512,height:512,format:"rgba",type:"uByte"},"render_tex_reflection"),this.tempRenderTexture.load()},t.prototype.initTexture=function(){var e=this;this.captureTexture?(this.captureTexture.when("load",function(){e.tempRenderTexture&&e.tempRenderTexture.unload()}),this.captureTexture.isBaseUnloaded()&&this.captureTexture.load()):this.createTempRenderTexture()},t.prototype.initCameras=function(){this.captureTexture&&this.captureTexture.load(),this.perspectiveCamera=new n.PerspectiveCamera,this.orthoCamera=new n.OrthographicCamera(-1,1,-1,1)},t.prototype.updateReflection=function(e){if(this.isEnabled()){var t=function(e){return e<0?-1:1};this.getEntity().runtimeData.updateMatrixWorld(),e.updateMatrixWorld(!1),this.reflectionPosition.setFromMatrixPosition(this.getEntity().runtimeData.matrixWorld),this.cameraWorldPosition.setFromMatrixPosition(e.matrixWorld),this.rotationMatrix.extractRotation(this.getEntity().runtimeData.matrixWorld),this.reflectionNormal.set(0,1,0),this.reflectionNormal.applyMatrix4(this.rotationMatrix);var r=this.reflectionPosition.clone().sub(this.cameraWorldPosition),i=r.reflect(this.reflectionNormal).negate();i.add(this.reflectionPosition),this.rotationMatrix.extractRotation(e.matrixWorld),this.lookAtPosition.set(0,0,-1),this.lookAtPosition.applyMatrix4(this.rotationMatrix),this.lookAtPosition.add(this.cameraWorldPosition);var a=this.reflectionPosition.clone().sub(this.lookAtPosition),o=a.reflect(this.reflectionNormal).negate();o.add(this.reflectionPosition),this.up.set(0,-1,0),this.up.applyMatrix4(this.rotationMatrix);var s=this.up.reflect(this.reflectionNormal).negate();if(e instanceof n.PerspectiveCamera&&this.perspectiveCamera)this.perspectiveCamera.aspect=e.aspect,this.perspectiveCamera.fov=e.fov,this.perspectiveCamera.near=e.near,this.perspectiveCamera.far=e.far,this.reflectionCamera=this.perspectiveCamera;else{if(!(e instanceof n.OrthographicCamera&&this.orthoCamera))return;this.orthoCamera.left=e.left,this.orthoCamera.right=e.right,this.orthoCamera.top=e.top,this.orthoCamera.bottom=e.bottom,this.orthoCamera.near=e.near,this.orthoCamera.far=e.far,this.reflectionCamera=this.orthoCamera}this.reflectionCamera.position.copy(i),this.reflectionCamera.up=s,this.reflectionCamera.lookAt(o),this.reflectionCamera.updateProjectionMatrix(),this.reflectionCamera.updateMatrixWorld(!1),this.reflectionCamera.matrixWorldInverse.getInverse(this.reflectionCamera.matrixWorld),this.reflectionPlane.setFromNormalAndCoplanarPoint(this.reflectionNormal,this.reflectionPosition),this.reflectionPlane.applyMatrix4(this.reflectionCamera.matrixWorldInverse),this.clipPlane.set(this.reflectionPlane.normal.x,this.reflectionPlane.normal.y,this.reflectionPlane.normal.z,this.reflectionPlane.constant);var u=new n.Vector4,p=this.reflectionCamera.projectionMatrix;p.copy(e.projectionMatrix),p.elements[8]*=-1,u.x=(t(this.clipPlane.x)+p.elements[8])/p.elements[0],u.y=(t(this.clipPlane.y)+p.elements[9])/p.elements[5],u.z=-1,u.w=(1+p.elements[10])/p.elements[14];var c=this.clipPlane.multiplyScalar(2/this.clipPlane.dot(u));p.elements[2]=c.x,p.elements[6]=c.y,p.elements[10]=c.z+1-this.clipBias,p.elements[14]=c.w}},t}(a.default);t.default=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(1),a=r(3),o=r(2),s=r(16),u=r(5),p=r(186),c=r(14),l=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.threeRenderer=null,t.caps={},t.antialias=!1,t.preserveDrawingBuffer=!0,t.precision="highp",t.autoClear=!1,t.devicePixelRatio=1,t.shadowsEnabled=!0,t.shadowsEnabledMobile=!1,t.shadowType=n.PCFSoftShadowMap,t.shadowReverseSided=!1,t.maxTextureSize2d=Number.MAX_SAFE_INTEGER,t.maxTextureSizeCube=Number.MAX_SAFE_INTEGER,t.clearColor=new n.Color,t.clearAlpha=0,t.renderOnDemand=!0,t}return i.__extends(t,e),t.prototype.onAwake=function(){this.canvas=this.getEngine().canvas,this.initDefaultRenderer(),this.getEngine().setRenderer(this);var e=this.getThreeRenderer();e.gammaInput=!1,e.gammaOutput=!0},t.prototype.onStartup=function(){this.getEngine().on("resize",this.resize,this),this.getEngine().renderOnDemand=this.renderOnDemand,this.shadowsEnabledMobile||(this.shadowsEnabled=s.isMobile()?this.shadowsEnabledMobile&&this.shadowsEnabled:this.shadowsEnabled),this.applyRenderSettings()},t.prototype.onShutdown=function(){this.getEngine().off("resize",this.resize,this),this.threeRenderer&&(this.threeRenderer.context=null),this.threeRenderer=null,this.canvas=void 0},t.prototype.onEntityReady=function(){this.getEngine().trigger("resize")},t.prototype.onAttributesChanged=function(e){var t=!1;e.indexOf("shadowsEnabledMobile")!==-1&&(t=!0),this.shadowsEnabled=s.isMobile()?this.shadowsEnabledMobile&&this.shadowsEnabled:this.shadowsEnabled,this.applyRenderSettings(),this.getEngine().renderOnDemand=this.renderOnDemand,e.indexOf("clearAlpha")!==-1&&this.threeRenderer.setClearColor(this.clearColor,this.clearAlpha),e.indexOf("clearColor")!==-1&&this.threeRenderer.setClearColor(this.clearColor,this.clearAlpha),e.indexOf("gammaOutput")!==-1&&(t=!0),e.indexOf("gammaInput")!==-1&&(t=!0),e.indexOf("shadowsEnabled")!==-1&&(t=!0),e.indexOf("shadowType")!==-1&&(this.shadowType=parseInt(String(this.shadowType),10),t=!0),e.indexOf("devicePixelRatio")!==-1&&this.getEngine().trigger("resize"),t&&(a.default.info("Rebuilding materials!!!"),this.getEngine().trigger("rebuildMaterials"))},t.prototype.getGPUCapability=function(e){return this.caps[e]},t.prototype.getMaxTextureSize2d=function(){return this.maxTextureSize2d?Math.min(this.maxTextureSize2d,this.getGPUCapability("MAX_TEXTURE_SIZE")):this.getGPUCapability("MAX_TEXTURE_SIZE")},t.prototype.getMaxTextureSizeCube=function(){return this.maxTextureSizeCube?Math.min(this.maxTextureSizeCube,this.getGPUCapability("MAX_CUBE_MAP_TEXTURE_SIZE")):this.getGPUCapability("MAX_CUBE_MAP_TEXTURE_SIZE")},t.prototype.onPreRender=function(){this.threeRenderer.setRenderTarget(null),this.threeRenderer.clear(!0,!0,!0),this.threeRenderer.setViewport(0,0,this.getWidth(),this.getHeight())},t.prototype.renderView=function(e,t,r){void 0===r&&(r={});var i;if(t){r.enablePreRenderFunctions&&this.getEngine().trigger("preRenderView",e,t,r);var n=this.getCanvas().style;void 0===r.opacity||r.viewPort&&(r.viewPort.width!==this.getWidth()||r.viewPort.height!==this.getHeight())?1!==parseFloat(n.opacity)&&(n.opacity="1.0"):parseFloat(n.opacity)!==r.opacity&&(n.opacity=""+r.opacity),r.renderTarget?this.threeRenderer.setRenderTarget(r.renderTarget):this.threeRenderer.setRenderTarget(null),this.threeRenderer.clear(r.clearColor,r.clearDepth,r.clearStencil),r.viewPort&&(i=c.default.sharedUniforms.screenDimensions,i.value.x=r.viewPort.x,i.value.y=r.viewPort.y,i.value.z=r.viewPort.width*this.devicePixelRatio,i.value.w=r.viewPort.height*this.devicePixelRatio,this.threeRenderer.setViewport(r.viewPort.x,r.viewPort.y,r.viewPort.width,r.viewPort.height));var a=r.effect?r.effect:this.threeRenderer;r.renderTarget?a.render(e,t,r.renderTarget,!1):a.render(e,t),this.getEngine().trigger("postRenderView",e,t,r)}},t.prototype.getWidth=function(){return this.canvas.clientWidth},t.prototype.getHeight=function(){return this.canvas.clientHeight},t.prototype.getCanvasWidth=function(){return this.canvas.width},t.prototype.getCanvasHeight=function(){return this.canvas.height},t.prototype.getCanvas=function(){return this.threeRenderer.domElement},t.prototype.resize=function(){if(this.canvas.parentElement){var e=this.canvas.parentElement.clientWidth,t=this.canvas.parentElement.clientHeight;if(this.threeRenderer.setPixelRatio(this.devicePixelRatio),s.isIOS()){var r=this.canvas;this.threeRenderer.setSize(e,t,!1),r.style.width=e+1+"px",r.style.height=t+1+"px",setTimeout(function(){r.style.width=e+"px",r.style.height=t+"px"},100)}else this.threeRenderer.setSize(e,t,!0)}},t.prototype.storeGpuCaps=function(){var e=this.threeRenderer.getContext();a.default.info("WebGL VENDOR is "+e.getParameter(e.VENDOR)),a.default.info("WebGL SHADING_LANGUAGE_VERSION is "+e.getParameter(e.SHADING_LANGUAGE_VERSION)),a.default.info("WebGL RENDERER is "+e.getParameter(e.RENDERER));var t=e.FRAGMENT_SHADER,r=e.LOW_FLOAT,i=e.MEDIUM_FLOAT,n=e.HIGH_FLOAT,o=e.getShaderPrecisionFormat(t,r);if(a.default.info("Fragment Shader lowp is "+o.precision),o=e.getShaderPrecisionFormat(t,i),a.default.info("Fragment Shader mediump is "+o.precision),o=e.getShaderPrecisionFormat(t,n),a.default.info("Fragment Shader highp is "+o.precision),!navigator.isCocoonJS){this.caps.MAX_COMBINED_TEXTURE_IMAGE_UNITS=0,this.caps.MAX_CUBE_MAP_TEXTURE_SIZE=0,this.caps.MAX_FRAGMENT_UNIFORM_VECTORS=0,this.caps.MAX_RENDERBUFFER_SIZE=0,this.caps.MAX_TEXTURE_IMAGE_UNITS=0,this.caps.MAX_TEXTURE_SIZE=0,this.caps.MAX_VARYING_VECTORS=0,this.caps.MAX_VERTEX_ATTRIBS=0,this.caps.MAX_VERTEX_TEXTURE_IMAGE_UNITS=0,this.caps.MAX_VERTEX_UNIFORM_VECTORS=0,this.caps.MAX_VIEWPORT_DIMS=0,this.caps.ALIASED_POINT_SIZE_RANGE=0,this.caps.ALIASED_LINE_WIDTH_RANGE=0,this.caps.SAMPLES=0,this.caps.SAMPLE_BUFFERS=0,this.caps.RED_BITS=0,this.caps.GREEN_BITS=0,this.caps.BLUE_BITS=0,this.caps.ALPHA_BITS=0,this.caps.DEPTH_BITS=0,this.caps.STENCIL_BITS=0,this.caps.SUBPIXEL_BITS=0,this.caps.COMPRESSED_TEXTURE_FORMATS=0,this.caps=u.map(this.caps,function(t,r){return e.getParameter(e[r])}),this.caps.EXTENSIONS=e.getSupportedExtensions();var s=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");this.caps.maxAnisotropy=s?e.getParameter(s.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,a.default.info("GPU Capabilities:",this.caps)}},t.prototype.initDefaultRenderer=function(){if(!p.default.isWebGLEnabled())throw new Error("WebGL is not supported, no fallbacks available.");this.threeRenderer=new n.WebGLRenderer({canvas:this.canvas,antialias:this.antialias,preserveDrawingBuffer:this.preserveDrawingBuffer,alpha:!0,precision:this.precision,logarithmicDepthBuffer:this.logarithmicDepthBuffer}),this.threeRenderer.physicallyCorrectLights=!0,this.threeRenderer.setPixelRatio(this.devicePixelRatio>0?this.devicePixelRatio:window.devicePixelRatio),this.storeGpuCaps()},t.prototype.applyRenderSettings=function(){var e=this;this.threeRenderer&&(u.forEach(this,function(t,r){void 0!==e.threeRenderer[r]&&(e.threeRenderer[r]=t)}),this.devicePixelRatio>0||(this.devicePixelRatio=window.devicePixelRatio),this.threeRenderer.setClearColor(this.clearColor,this.clearAlpha),this.shadowsEnabled&&(this.threeRenderer.shadowMap.enabled=!0,this.threeRenderer.shadowMap.type=this.shadowType,this.threeRenderer.shadowMap.renderReverseSided=this.shadowReverseSided))},t}(o.default);t.default=l},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(1),a=r(2),o=r(11),s=new n.Vector3,u=new n.Euler,p=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.quaternion=new n.Quaternion,t.currentGlobalQuaternion=new n.Quaternion,t}return i.__extends(t,e),t.prototype.onStartup=function(){this.rotate=this.autoRotate,this.getEntity().on("startRotate",this.onStartRotate,this),this.getEntity().on("stopRotate",this.onStopRotate,this),this.getEntity().on("toggleRotate",this.onToggleRotate,this)},t.prototype.onShutdown=function(){this.getEntity().off("startRotate",this.onStartRotate,this),this.getEntity().off("stopRotate",this.onStopRotate,this),this.getEntity().off("toggleRotate",this.onToggleRotate,this)},t.prototype.onEnable=function(){this.rotate=this.autoRotate,this.initRotation()},t.prototype.onDisable=function(){var e=this.getEntity();e instanceof o.default&&(this.getRuntimeData().position.copy(e.getPosition()),this.getRuntimeData().quaternion.copy(e.getQuaternion()),this.rotate=!1)},t.prototype.onAttributesChanged=function(e){e.indexOf("rotation")&&this.rotation&&this.initRotation()},t.prototype.onEntityReady=function(){this.initialQuaternion=new n.Quaternion,this.initialQuaternion.copy(this.getRuntimeData().quaternion),this.initRotation()},t.prototype.onUpdate=function(e){this.rotate&&this.isEnabled()&&(this.getEngine().needsRender=!0,this.getRuntimeData()&&this.rotation&&(s.copy(this.rotation).multiplyScalar(e),u.set(s.x,s.y,s.z),this.quaternion.setFromEuler(u),this.local?this.getRuntimeData().quaternion.multiply(this.quaternion):(this.currentGlobalQuaternion.multiply(this.quaternion),this.getRuntimeData().quaternion.multiplyQuaternions(this.currentGlobalQuaternion,this.initialQuaternion))))},t.prototype.initRotation=function(){u.set(this.rotation.x,this.rotation.y,this.rotation.z),this.local?this.getRuntimeData().quaternion.copy(this.initialQuaternion):this.currentGlobalQuaternion.set(0,0,0,1)},t.prototype.onStartRotate=function(){this.rotate=!0},t.prototype.onStopRotate=function(){this.rotate=!1},t.prototype.onToggleRotate=function(){this.rotate=!this.rotate},t}(a.default);t.default=p},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(1),a=r(2),o=r(229),s=r(228),u=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.uniforms=null,t.noiseMat=null,t.initialized=!1,t}return i.__extends(t,e),t.prototype.onStartup=function(){this.getEntity().on("changeNoiseValues",this.changeNoiseValues,this),this.getEntity().on("renderNoise",this.renderNoise,this),this.uniforms={time:{type:"f",value:1},scale:{type:"v2",value:this.scale},offset:{type:"v2",value:this.offset},layerAmplitude:{type:"v4",value:this.layerAmplitude},layerScale:{type:"v4",value:this.layerScale}},this.noiseMat=new n.ShaderMaterial({uniforms:this.uniforms,vertexShader:o,fragmentShader:s}),this.cameraRTT=new n.OrthographicCamera(-.5,.5,.5,-.5,-10,10),this.cameraRTT.position.z=1,this.sceneRTT=new n.Scene,this.sceneRTT.add(this.cameraRTT),this.quadGeo=new n.PlaneGeometry(1,1),this.quadRTT=new n.Mesh(this.quadGeo,this.noiseMat),this.quadRTT.position.z=-5,this.sceneRTT.add(this.quadRTT),this.initialized=!0},t.prototype.onShutdown=function(){this.getEntity().off("changeNoiseValues",this.changeNoiseValues,this),this.getEntity().off("renderNoise",this.renderNoise,this),this.sceneRTT.remove(this.cameraRTT),this.sceneRTT.remove(this.quadRTT),this.sceneRTT=void 0,this.quadRTT=void 0,this.quadGeo.dispose(),this.noiseMat.dispose(),this.uniforms=void 0},t.prototype.onEntityReady=function(){this.autoLoad&&this.renderNoise()},t.prototype.onAttributesChanged=function(e){this.initialized&&(e.indexOf("scale")!==-1&&void 0!==this.scale.x&&(this.uniforms.scale.value.x=this.scale.x,this.uniforms.scale.value.y=this.scale.y),e.indexOf("offset")!==-1&&void 0!==this.offset.x&&(this.uniforms.offset.value.x=this.offset.x,this.uniforms.offset.value.y=this.offset.y),e.indexOf("layerScale")!==-1&&void 0!==this.layerScale.x&&(this.uniforms.layerScale.value.x=this.layerScale.x,this.uniforms.layerScale.value.y=this.layerScale.y,this.uniforms.layerScale.value.z=this.layerScale.z,this.uniforms.layerScale.value.w=this.layerScale.w),e.indexOf("layerAmplitude")!==-1&&void 0!==this.layerAmplitude.x&&(this.uniforms.layerAmplitude.value.x=this.layerAmplitude.x,this.uniforms.layerAmplitude.value.y=this.layerAmplitude.y,this.uniforms.layerAmplitude.value.z=this.layerAmplitude.z,this.uniforms.layerAmplitude.value.w=this.layerAmplitude.w),this.renderNoise())},t.prototype.renderNoise=function(){this.getThreeRenderer().render(this.sceneRTT,this.cameraRTT,this.getRuntimeData(),!0),this.getThreeRenderer().setRenderTarget(null)},t.prototype.changeNoiseValues=function(e,t,r,i){this.layerAmplitude=e,this.layerScale=t,this.scale=r,this.offset=i,this.onAttributesChanged(["layerAmplitude","layerScale","scale","offset"])},t}(a.default);t.default=u},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(1),a=r(2),o=r(10),s=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.skyboxTexture=null,t.stereoEnabled=!1,t.size=100,t.skyboxMesh=null,t.skyboxMeshRightEye=null,t.skyboxGeometry=null,t.skyboxGeometryRightEye=null,t.skyboxMaterialCube=null,t.skyboxUniforms=null,t.skyboxVShader=null,t.skyboxPShader=null,t.skyboxMaterial2D=null,t}return i.__extends(t,e),t.prototype.onStartup=function(){this.initMaterials()},t.prototype.onShutdown=function(){this.skyboxGeometry&&this.skyboxGeometry.dispose(),this.skyboxGeometryRightEye&&this.skyboxGeometryRightEye.dispose(),this.skyboxMaterialCube&&this.skyboxMaterialCube.dispose(),this.skyboxMaterial2D&&this.skyboxMaterial2D.dispose(),this.skyboxMesh=null,this.skyboxGeometry=null,this.skyboxGeometryRightEye=null,this.skyboxMaterialCube=null,this.skyboxMaterial2D=null,this.skyboxUniforms=null,this.skyboxTexture=null},t.prototype.getMesh=function(e){return void 0===e&&(e="left"),"left"===e?this.skyboxMesh:this.skyboxMeshRightEye},t.prototype.onAttributesChanged=function(e){if(e.indexOf("skyboxTexture")!==-1){var t=this.getPreviousAttribute("skyboxTexture");if(t){var r=this.getEngine().getEntityById(t);this.stopListening(r)}this.getEntity().unregisterDependencyById(this.getPreviousAttribute("skyboxTexture"));var i=this.getEntity().getOwnDependencyInfo(),n=this.getAttribute("skyboxTexture");i[n]||this.getEntity().registerDependencyById(this.getAttribute("skyboxTexture"))}this.getEntity().isBaseLoaded()&&(e.indexOf("skyboxTexture")===-1&&e.indexOf("stereoEnabled")===-1||this.initSkybox(),e.indexOf("size")!==-1&&this.skyboxMesh&&(this.skyboxMesh.scale.set(this.size,this.size,this.size),this.skyboxMeshRightEye.scale.set(this.size,this.size,this.size)))},t.prototype.onEnable=function(){this.getRuntimeData()&&(this.getRuntimeData().add(this.skyboxMesh),this.isStereo()&&this.getRuntimeData().add(this.skyboxMeshRightEye),this.skyboxTexture&&this.skyboxTexture.isUnloaded()&&this.skyboxTexture.load())},t.prototype.onDisable=function(){this.getRuntimeData()&&(this.getRuntimeData().remove(this.skyboxMesh),this.isStereo()&&this.getRuntimeData().remove(this.skyboxMeshRightEye))},t.prototype.onEntityReady=function(){this.initSkybox()},t.prototype.isStereo=function(){if(!this.skyboxTexture||!this.stereoEnabled)return!1;switch(this.skyboxTexture.getLayout()){case o.ImageLayout.Stereo2dOverUnder:case o.ImageLayout.Stereo2dUnderOver:case o.ImageLayout.Stereo2dLeftRight:case o.ImageLayout.Stereo2dRightLeft:return this.stereoEnabled;default:return!1}},t.prototype.initGeometry=function(){this.skyboxGeometry&&(this.skyboxGeometry.dispose(),this.skyboxGeometryRightEye.dispose()),this.skyboxGeometry=new n.SphereBufferGeometry(1,64,64),this.skyboxGeometryRightEye=this.skyboxGeometry.clone()},t.prototype.initStereoUvs=function(){if(this.skyboxTexture){var e=new n.Vector2,t=new n.Vector2,r=new n.Vector2,i=new n.Vector2;switch(this.skyboxTexture.getLayout()){case o.ImageLayout.Stereo2dOverUnder:e.set(1,.5),t.set(0,0),r.set(1,.5),i.set(0,.5);break;case o.ImageLayout.Stereo2dUnderOver:e.set(1,.5),t.set(0,.5),r.set(1,.5),i.set(0,0);break;case o.ImageLayout.Stereo2dLeftRight:e.set(.5,1),t.set(0,0),r.set(.5,1),i.set(.5,0);break;case o.ImageLayout.Stereo2dRightLeft:e.set(.5,1),t.set(.5,0),r.set(.5,1),i.set(0,0);break;default:return}for(var a=this.skyboxGeometry.getAttribute("uv").array,s=this.skyboxGeometryRightEye.getAttribute("uv").array,u=0;un&&i>0?(e.fillText(s,r,u),s=t+" ",u+=a):s=o}),e.fillText(s,r,u)},t}(a.default);t.default=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(1),a=r(2),o=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.standing=!0,t.userHeight=6,t.frameData=window.hasOwnProperty("VRFrameData")?new VRFrameData:{},t.standingMatrix=new n.Matrix4,t.workVector=new n.Vector3,t.scale=1,t}return i.__extends(t,e),t.prototype.onPreUpdate=function(e){if(this.isEnabled()&&this.hasRuntimeData()){var t=this.getEngine(),r=t.getVrDisplay();if(r){t.needsRender=!0,r.getFrameData(this.frameData);var i=this.frameData.pose,n=this.getRuntimeData(),a=this.getEntity();null!==i.orientation&&(a.setQuaternion(i.orientation[0],i.orientation[1],i.orientation[2],i.orientation[3]),r.capabilities.hasPosition&&i.position&&a.setPosition(i.position[0],i.position[1],i.position[2]),this.standing&&r.stageParameters?(n.updateMatrix(),this.standingMatrix.fromArray(r.stageParameters.sittingToStandingTransform),n.applyMatrix(this.standingMatrix),a.setQuaternion(n.quaternion.x,n.quaternion.y,n.quaternion.z,n.quaternion.w),n.position.multiplyScalar(this.scale),a.setPosition(n.position.x,n.position.y,n.position.z)):(a.getPosition(this.workVector),this.workVector.multiplyScalar(this.scale),a.setPosition(this.workVector.x,this.workVector.y,this.workVector.z)))}}},t}(a.default);t.default=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(2),a=r(16),o=r(3),s=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.scale=1,t.isPresenting=!1,t.wasPresenting=!1,t.vrDisplays=null,t.previousPixelRatio=1,t}return i.__extends(t,e),t.prototype.getScale=function(){ +t.setViewport(0,0,e.width,e.height);for(var r=0;r<5;r++)e.activeCubeFace=r,t.render(this.skyboxScene,this.cameras[r],e);e.texture.generateMipmaps=this.getEntity().getProperty("generateMipmaps"),e.activeCubeFace=5,t.render(this.skyboxScene,this.cameras[5],e)}},t}(a.default);t.default=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(3),a=r(1),o=r(2),s=.0174532925,u={"+X":new a.Vector3(1,0,0),"-X":new a.Vector3(-1,0,0),"+Y":new a.Vector3(0,1,0),"-Y":new a.Vector3(0,-1,0),"+Z":new a.Vector3(0,0,1),"-Z":new a.Vector3(0,0,-1)},p=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.time=0,t.target=new a.Quaternion,t.tempQuat=new a.Quaternion,t}return i.__extends(t,e),t.prototype.getRightVector=function(e){return new a.Vector3(e.elements[0],e.elements[1],e.elements[2])},t.prototype.getUpVector=function(e){return new a.Vector3(e.elements[4],e.elements[5],e.elements[6])},t.prototype.getForwardVector=function(e){return new a.Vector3(e.elements[8],e.elements[9],e.elements[10])},t.prototype.setRightVector=function(e,t){e.elements[0]=t.x,e.elements[1]=t.y,e.elements[2]=t.z},t.prototype.setUpVector=function(e,t){e.elements[4]=t.x,e.elements[5]=t.y,e.elements[6]=t.z},t.prototype.setForwardVector=function(e,t){e.elements[8]=t.x,e.elements[9]=t.y,e.elements[10]=t.z},t.prototype.setAxes=function(e,t,r){var i=u[e],o=u[t];if(!i)return n.default.error("No Up Axis available For ",e);if(!o)return n.default.error("No Forward Axis available For ",t);var s=new a.Vector3,p=new a.Matrix4;this.setUpVector(p,i),this.setForwardVector(p,o),s.crossVectors(i,o),this.setRightVector(p,s),this.target.setFromRotationMatrix(p),r?this.time=this.speed:(this.setRotation(this.target),this.getEntity().trigger("axis_transition_complete"))},t.prototype.eulerFromObject=function(e){var t=isNaN(e.x)?0:e.x*s,r=isNaN(e.y)?0:e.y*s,i=isNaN(e.z)?0:e.z*s,n=new a.Euler(t,r,i);return n.order="YXZ",n},t.prototype.rotateOnWorldAxis=function(e,t,r){if(!(this.time>0)){var i=this.getRuntimeData(),n=new a.Vector3,o=new a.Vector3;n.copy(i.position),o.copy(i.scale),i.position.set(0,0,0),i.scale.set(1,1,1),i.updateMatrix();var u=(new a.Matrix4).makeRotationX((e.x||0)*s),p=(new a.Matrix4).makeRotationY((e.y||0)*s),c=(new a.Matrix4).makeRotationZ((e.z||0)*s);c.multiply(p),c.multiply(u),t&&c.multiply(i.matrix),this.target.setFromRotationMatrix(c),r?(this.setRotation(this.target),this.getEngine().needsRender=!0):this.time=this.speed,i.position.copy(n),i.scale.copy(o)}},t.prototype.rotateToEuler=function(e){this.target.setFromEuler(this.eulerFromObject(e)),this.time=this.speed},t.prototype.setLocalRotation=function(e){this.time=0,this.target.setFromEuler(this.eulerFromObject(e)),this.setRotation(this.target)},t.prototype.setRotation=function(e){this.getEntity().setQuaternion(e.x,e.y,e.z,e.w),this.hasRuntimeData()&&!this.getRuntimeData().quaternion.equals(e)&&this.getRuntimeData().quaternion.copy(e),this.getEngine().needsRender=!0},t.prototype.getSign=function(e){return e>0?"+":"-"},t.prototype.getAxes=function(e){var t=this.getRuntimeData().matrix,r=this.getUpVector(t).normalize(),i=this.getForwardVector(t).normalize(),n=Math.abs(r.x),a=Math.abs(r.y),o=Math.abs(r.z),s=n=0&&this.hasRuntimeData()&&(this.time-=e,this.tempQuat.copy(this.getRuntimeData().quaternion),this.tempQuat.slerp(this.target,Math.min(1,Math.max(0,1-1/(this.speed/this.time)))),this.getEntity().setQuaternion(this.tempQuat.x,this.tempQuat.y,this.tempQuat.z,this.tempQuat.w),this.getEngine().needsRender=!0,this.time<0&&(this.setRotation(this.target),this.getEntity().trigger("axis_transition_complete")))},t}(o.default);t.default=p},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(1),a=r(2),o=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.framesElapsed=0,t.reflectionNormal=new n.Vector3(0,1,0),t.reflectionPlane=new n.Plane,t.clipPlane=new n.Vector4,t.reflectionPosition=new n.Vector3,t.cameraWorldPosition=new n.Vector3,t.rotationMatrix=new n.Matrix4,t.lookAtPosition=new n.Vector3(0,0,-1),t.up=new n.Vector3(0,1,0),t.perspectiveCamera=null,t.orthoCamera=null,t}return i.__extends(t,e),t.prototype.captureScene=function(e,t){if(!t)throw new Error("Call to ReflectionCapture.captureScene without specifying a camera.");this.updateReflection(t);var r=this.captureTexture?this.captureTexture.runtimeData:null,i=r?r:this.tempRenderTexture.runtimeData;this.getRenderer().renderView(e,this.reflectionCamera,{renderTarget:i,clearDepth:!0,enableShadows:!1,enablePreRenderFunctions:!1})},t.prototype.onEntityReady=function(){this.initCameras(),this.initTexture()},t.prototype.onAttributesChanged=function(e){e.indexOf("captureTexture")!==-1&&this.initTexture()},t.prototype.onPreRenderView=function(e,t){this.isEnabled()&&(this.framesElapsed>=this.updateFrameInterval?(this.captureScene(e,t),this.framesElapsed=0):this.framesElapsed++)},t.prototype.createTempRenderTexture=function(){this.tempRenderTexture=this.getEngine().createRenderTexture2d({width:512,height:512,format:"rgba",type:"uByte"},"render_tex_reflection"),this.tempRenderTexture.load()},t.prototype.initTexture=function(){var e=this;this.captureTexture?(this.captureTexture.when("load",function(){e.tempRenderTexture&&e.tempRenderTexture.unload()}),this.captureTexture.isBaseUnloaded()&&this.captureTexture.load()):this.createTempRenderTexture()},t.prototype.initCameras=function(){this.captureTexture&&this.captureTexture.load(),this.perspectiveCamera=new n.PerspectiveCamera,this.orthoCamera=new n.OrthographicCamera(-1,1,-1,1)},t.prototype.updateReflection=function(e){if(this.isEnabled()){var t=function(e){return e<0?-1:1};this.getEntity().runtimeData.updateMatrixWorld(),e.updateMatrixWorld(!1),this.reflectionPosition.setFromMatrixPosition(this.getEntity().runtimeData.matrixWorld),this.cameraWorldPosition.setFromMatrixPosition(e.matrixWorld),this.rotationMatrix.extractRotation(this.getEntity().runtimeData.matrixWorld),this.reflectionNormal.set(0,1,0),this.reflectionNormal.applyMatrix4(this.rotationMatrix);var r=this.reflectionPosition.clone().sub(this.cameraWorldPosition),i=r.reflect(this.reflectionNormal).negate();i.add(this.reflectionPosition),this.rotationMatrix.extractRotation(e.matrixWorld),this.lookAtPosition.set(0,0,-1),this.lookAtPosition.applyMatrix4(this.rotationMatrix),this.lookAtPosition.add(this.cameraWorldPosition);var a=this.reflectionPosition.clone().sub(this.lookAtPosition),o=a.reflect(this.reflectionNormal).negate();o.add(this.reflectionPosition),this.up.set(0,-1,0),this.up.applyMatrix4(this.rotationMatrix);var s=this.up.reflect(this.reflectionNormal).negate();if(e instanceof n.PerspectiveCamera&&this.perspectiveCamera)this.perspectiveCamera.aspect=e.aspect,this.perspectiveCamera.fov=e.fov,this.perspectiveCamera.near=e.near,this.perspectiveCamera.far=e.far,this.reflectionCamera=this.perspectiveCamera;else{if(!(e instanceof n.OrthographicCamera&&this.orthoCamera))return;this.orthoCamera.left=e.left,this.orthoCamera.right=e.right,this.orthoCamera.top=e.top,this.orthoCamera.bottom=e.bottom,this.orthoCamera.near=e.near,this.orthoCamera.far=e.far,this.reflectionCamera=this.orthoCamera}this.reflectionCamera.position.copy(i),this.reflectionCamera.up=s,this.reflectionCamera.lookAt(o),this.reflectionCamera.updateProjectionMatrix(),this.reflectionCamera.updateMatrixWorld(!1),this.reflectionCamera.matrixWorldInverse.getInverse(this.reflectionCamera.matrixWorld),this.reflectionPlane.setFromNormalAndCoplanarPoint(this.reflectionNormal,this.reflectionPosition),this.reflectionPlane.applyMatrix4(this.reflectionCamera.matrixWorldInverse),this.clipPlane.set(this.reflectionPlane.normal.x,this.reflectionPlane.normal.y,this.reflectionPlane.normal.z,this.reflectionPlane.constant);var u=new n.Vector4,p=this.reflectionCamera.projectionMatrix;p.copy(e.projectionMatrix),p.elements[8]*=-1,u.x=(t(this.clipPlane.x)+p.elements[8])/p.elements[0],u.y=(t(this.clipPlane.y)+p.elements[9])/p.elements[5],u.z=-1,u.w=(1+p.elements[10])/p.elements[14];var c=this.clipPlane.multiplyScalar(2/this.clipPlane.dot(u));p.elements[2]=c.x,p.elements[6]=c.y,p.elements[10]=c.z+1-this.clipBias,p.elements[14]=c.w}},t}(a.default);t.default=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(1),a=r(3),o=r(2),s=r(16),u=r(5),p=r(186),c=r(14),l=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.threeRenderer=null,t.caps={},t.antialias=!1,t.preserveDrawingBuffer=!0,t.precision="highp",t.autoClear=!1,t.devicePixelRatio=1,t.shadowsEnabled=!0,t.shadowsEnabledMobile=!1,t.shadowType=n.PCFSoftShadowMap,t.shadowReverseSided=!1,t.maxTextureSize2d=Number.MAX_SAFE_INTEGER,t.maxTextureSizeCube=Number.MAX_SAFE_INTEGER,t.clearColor=new n.Color,t.clearAlpha=0,t.renderOnDemand=!0,t}return i.__extends(t,e),t.prototype.onAwake=function(){this.canvas=this.getEngine().canvas,this.initDefaultRenderer(),this.getEngine().setRenderer(this);var e=this.getThreeRenderer();e.gammaInput=!1,e.gammaOutput=!0},t.prototype.onStartup=function(){this.getEngine().on("resize",this.resize,this),this.getEngine().renderOnDemand=this.renderOnDemand,this.shadowsEnabledMobile||(this.shadowsEnabled=s.isMobile()?this.shadowsEnabledMobile&&this.shadowsEnabled:this.shadowsEnabled),this.applyRenderSettings()},t.prototype.onShutdown=function(){this.getEngine().off("resize",this.resize,this),this.threeRenderer&&(this.threeRenderer.context=null),this.threeRenderer=null,this.canvas=void 0},t.prototype.onEntityReady=function(){this.getEngine().trigger("resize")},t.prototype.onAttributesChanged=function(e){var t=!1;e.indexOf("shadowsEnabledMobile")!==-1&&(t=!0),this.shadowsEnabled=s.isMobile()?this.shadowsEnabledMobile&&this.shadowsEnabled:this.shadowsEnabled,this.applyRenderSettings(),this.getEngine().renderOnDemand=this.renderOnDemand,e.indexOf("clearAlpha")!==-1&&this.threeRenderer.setClearColor(this.clearColor,this.clearAlpha),e.indexOf("clearColor")!==-1&&this.threeRenderer.setClearColor(this.clearColor,this.clearAlpha),e.indexOf("gammaOutput")!==-1&&(t=!0),e.indexOf("gammaInput")!==-1&&(t=!0),e.indexOf("shadowsEnabled")!==-1&&(t=!0),e.indexOf("shadowType")!==-1&&(this.shadowType=parseInt(String(this.shadowType),10),t=!0),e.indexOf("devicePixelRatio")!==-1&&this.getEngine().trigger("resize"),t&&(a.default.info("Rebuilding materials!!!"),this.getEngine().trigger("rebuildMaterials"))},t.prototype.getGPUCapability=function(e){return this.caps[e]},t.prototype.getMaxTextureSize2d=function(){return this.maxTextureSize2d?Math.min(this.maxTextureSize2d,this.getGPUCapability("MAX_TEXTURE_SIZE")):this.getGPUCapability("MAX_TEXTURE_SIZE")},t.prototype.getMaxTextureSizeCube=function(){return this.maxTextureSizeCube?Math.min(this.maxTextureSizeCube,this.getGPUCapability("MAX_CUBE_MAP_TEXTURE_SIZE")):this.getGPUCapability("MAX_CUBE_MAP_TEXTURE_SIZE")},t.prototype.onPreRender=function(){this.threeRenderer.setRenderTarget(null),this.threeRenderer.clear(!0,!0,!0),this.threeRenderer.setViewport(0,0,this.getWidth(),this.getHeight())},t.prototype.renderView=function(e,t,r){void 0===r&&(r={});var i;if(t){r.enablePreRenderFunctions&&this.getEngine().trigger("preRenderView",e,t,r);var n=this.getCanvas().style;void 0===r.opacity||r.viewPort&&(r.viewPort.width!==this.getWidth()||r.viewPort.height!==this.getHeight())?1!==parseFloat(n.opacity)&&(n.opacity="1.0"):parseFloat(n.opacity)!==r.opacity&&(n.opacity=""+r.opacity),r.renderTarget?this.threeRenderer.setRenderTarget(r.renderTarget):this.threeRenderer.setRenderTarget(null),this.threeRenderer.clear(r.clearColor,r.clearDepth,r.clearStencil),r.viewPort&&(i=c.default.sharedUniforms.screenDimensions,i.value.x=r.viewPort.x,i.value.y=r.viewPort.y,i.value.z=r.viewPort.width*this.devicePixelRatio,i.value.w=r.viewPort.height*this.devicePixelRatio,this.threeRenderer.setViewport(r.viewPort.x,r.viewPort.y,r.viewPort.width,r.viewPort.height));var a=r.effect?r.effect:this.threeRenderer;r.renderTarget?a.render(e,t,r.renderTarget,!1):a.render(e,t),this.getEngine().trigger("postRenderView",e,t,r)}},t.prototype.getWidth=function(){return this.canvas.clientWidth},t.prototype.getHeight=function(){return this.canvas.clientHeight},t.prototype.getCanvasWidth=function(){return this.canvas.width},t.prototype.getCanvasHeight=function(){return this.canvas.height},t.prototype.getCanvas=function(){return this.threeRenderer.domElement},t.prototype.resize=function(){if(this.canvas.parentElement){var e=this.canvas.parentElement.clientWidth,t=this.canvas.parentElement.clientHeight;if(this.threeRenderer.setPixelRatio(this.devicePixelRatio),s.isIOS()){var r=this.canvas;this.threeRenderer.setSize(e,t,!1),r.style.width=e+1+"px",r.style.height=t+1+"px",setTimeout(function(){r.style.width=e+"px",r.style.height=t+"px"},100)}else this.threeRenderer.setSize(e,t,!0)}},t.prototype.storeGpuCaps=function(){var e=this.threeRenderer.getContext();a.default.info("WebGL VENDOR is "+e.getParameter(e.VENDOR)),a.default.info("WebGL SHADING_LANGUAGE_VERSION is "+e.getParameter(e.SHADING_LANGUAGE_VERSION)),a.default.info("WebGL RENDERER is "+e.getParameter(e.RENDERER));var t=e.FRAGMENT_SHADER,r=e.LOW_FLOAT,i=e.MEDIUM_FLOAT,n=e.HIGH_FLOAT,o=e.getShaderPrecisionFormat(t,r);if(a.default.info("Fragment Shader lowp is "+o.precision),o=e.getShaderPrecisionFormat(t,i),a.default.info("Fragment Shader mediump is "+o.precision),o=e.getShaderPrecisionFormat(t,n),a.default.info("Fragment Shader highp is "+o.precision),!navigator.isCocoonJS){this.caps.MAX_COMBINED_TEXTURE_IMAGE_UNITS=0,this.caps.MAX_CUBE_MAP_TEXTURE_SIZE=0,this.caps.MAX_FRAGMENT_UNIFORM_VECTORS=0,this.caps.MAX_RENDERBUFFER_SIZE=0,this.caps.MAX_TEXTURE_IMAGE_UNITS=0,this.caps.MAX_TEXTURE_SIZE=0,this.caps.MAX_VARYING_VECTORS=0,this.caps.MAX_VERTEX_ATTRIBS=0,this.caps.MAX_VERTEX_TEXTURE_IMAGE_UNITS=0,this.caps.MAX_VERTEX_UNIFORM_VECTORS=0,this.caps.MAX_VIEWPORT_DIMS=0,this.caps.ALIASED_POINT_SIZE_RANGE=0,this.caps.ALIASED_LINE_WIDTH_RANGE=0,this.caps.SAMPLES=0,this.caps.SAMPLE_BUFFERS=0,this.caps.RED_BITS=0,this.caps.GREEN_BITS=0,this.caps.BLUE_BITS=0,this.caps.ALPHA_BITS=0,this.caps.DEPTH_BITS=0,this.caps.STENCIL_BITS=0,this.caps.SUBPIXEL_BITS=0,this.caps.COMPRESSED_TEXTURE_FORMATS=0,this.caps=u.map(this.caps,function(t,r){return e.getParameter(e[r])}),this.caps.EXTENSIONS=e.getSupportedExtensions();var s=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");this.caps.maxAnisotropy=s?e.getParameter(s.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,a.default.info("GPU Capabilities:",this.caps)}},t.prototype.initDefaultRenderer=function(){if(!p.default.isWebGLEnabled())throw new Error("WebGL is not supported, no fallbacks available.");this.threeRenderer=new n.WebGLRenderer({canvas:this.canvas,antialias:this.antialias,preserveDrawingBuffer:this.preserveDrawingBuffer,alpha:!0,precision:this.precision,logarithmicDepthBuffer:this.logarithmicDepthBuffer}),this.threeRenderer.physicallyCorrectLights=!0,this.threeRenderer.setPixelRatio(this.devicePixelRatio>0?this.devicePixelRatio:window.devicePixelRatio),this.storeGpuCaps()},t.prototype.applyRenderSettings=function(){var e=this;this.threeRenderer&&(u.forEach(this,function(t,r){void 0!==e.threeRenderer[r]&&(e.threeRenderer[r]=t)}),this.devicePixelRatio>0||(this.devicePixelRatio=window.devicePixelRatio),this.threeRenderer.setClearColor(this.clearColor,this.clearAlpha),this.shadowsEnabled&&(this.threeRenderer.shadowMap.enabled=!0,this.threeRenderer.shadowMap.type=this.shadowType,this.threeRenderer.shadowMap.renderReverseSided=this.shadowReverseSided))},t}(o.default);t.default=l},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(1),a=r(2),o=r(10),s=new n.Vector3,u=new n.Euler,p=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.quaternion=new n.Quaternion,t.currentGlobalQuaternion=new n.Quaternion,t}return i.__extends(t,e),t.prototype.onStartup=function(){this.rotate=this.autoRotate,this.getEntity().on("startRotate",this.onStartRotate,this),this.getEntity().on("stopRotate",this.onStopRotate,this),this.getEntity().on("toggleRotate",this.onToggleRotate,this)},t.prototype.onShutdown=function(){this.getEntity().off("startRotate",this.onStartRotate,this),this.getEntity().off("stopRotate",this.onStopRotate,this),this.getEntity().off("toggleRotate",this.onToggleRotate,this)},t.prototype.onEnable=function(){this.rotate=this.autoRotate,this.initRotation()},t.prototype.onDisable=function(){var e=this.getEntity();e instanceof o.default&&(this.getRuntimeData().position.copy(e.getPosition()),this.getRuntimeData().quaternion.copy(e.getQuaternion()),this.rotate=!1)},t.prototype.onAttributesChanged=function(e){e.indexOf("rotation")&&this.rotation&&this.initRotation()},t.prototype.onEntityReady=function(){this.initialQuaternion=new n.Quaternion,this.initialQuaternion.copy(this.getRuntimeData().quaternion),this.initRotation()},t.prototype.onUpdate=function(e){this.rotate&&this.isEnabled()&&(this.getEngine().needsRender=!0,this.getRuntimeData()&&this.rotation&&(s.copy(this.rotation).multiplyScalar(e),u.set(s.x,s.y,s.z),this.quaternion.setFromEuler(u),this.local?this.getRuntimeData().quaternion.multiply(this.quaternion):(this.currentGlobalQuaternion.multiply(this.quaternion),this.getRuntimeData().quaternion.multiplyQuaternions(this.currentGlobalQuaternion,this.initialQuaternion))))},t.prototype.initRotation=function(){u.set(this.rotation.x,this.rotation.y,this.rotation.z),this.local?this.getRuntimeData().quaternion.copy(this.initialQuaternion):this.currentGlobalQuaternion.set(0,0,0,1)},t.prototype.onStartRotate=function(){this.rotate=!0},t.prototype.onStopRotate=function(){this.rotate=!1},t.prototype.onToggleRotate=function(){this.rotate=!this.rotate},t}(a.default);t.default=p},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(1),a=r(2),o=r(229),s=r(228),u=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.uniforms=null,t.noiseMat=null,t.initialized=!1,t}return i.__extends(t,e),t.prototype.onStartup=function(){this.getEntity().on("changeNoiseValues",this.changeNoiseValues,this),this.getEntity().on("renderNoise",this.renderNoise,this),this.uniforms={time:{type:"f",value:1},scale:{type:"v2",value:this.scale},offset:{type:"v2",value:this.offset},layerAmplitude:{type:"v4",value:this.layerAmplitude},layerScale:{type:"v4",value:this.layerScale}},this.noiseMat=new n.ShaderMaterial({uniforms:this.uniforms,vertexShader:o,fragmentShader:s}),this.cameraRTT=new n.OrthographicCamera(-.5,.5,.5,-.5,-10,10),this.cameraRTT.position.z=1,this.sceneRTT=new n.Scene,this.sceneRTT.add(this.cameraRTT),this.quadGeo=new n.PlaneGeometry(1,1),this.quadRTT=new n.Mesh(this.quadGeo,this.noiseMat),this.quadRTT.position.z=-5,this.sceneRTT.add(this.quadRTT),this.initialized=!0},t.prototype.onShutdown=function(){this.getEntity().off("changeNoiseValues",this.changeNoiseValues,this),this.getEntity().off("renderNoise",this.renderNoise,this),this.sceneRTT.remove(this.cameraRTT),this.sceneRTT.remove(this.quadRTT),this.sceneRTT=void 0,this.quadRTT=void 0,this.quadGeo.dispose(),this.noiseMat.dispose(),this.uniforms=void 0},t.prototype.onEntityReady=function(){this.autoLoad&&this.renderNoise()},t.prototype.onAttributesChanged=function(e){this.initialized&&(e.indexOf("scale")!==-1&&void 0!==this.scale.x&&(this.uniforms.scale.value.x=this.scale.x,this.uniforms.scale.value.y=this.scale.y),e.indexOf("offset")!==-1&&void 0!==this.offset.x&&(this.uniforms.offset.value.x=this.offset.x,this.uniforms.offset.value.y=this.offset.y),e.indexOf("layerScale")!==-1&&void 0!==this.layerScale.x&&(this.uniforms.layerScale.value.x=this.layerScale.x,this.uniforms.layerScale.value.y=this.layerScale.y,this.uniforms.layerScale.value.z=this.layerScale.z,this.uniforms.layerScale.value.w=this.layerScale.w),e.indexOf("layerAmplitude")!==-1&&void 0!==this.layerAmplitude.x&&(this.uniforms.layerAmplitude.value.x=this.layerAmplitude.x,this.uniforms.layerAmplitude.value.y=this.layerAmplitude.y,this.uniforms.layerAmplitude.value.z=this.layerAmplitude.z,this.uniforms.layerAmplitude.value.w=this.layerAmplitude.w),this.renderNoise())},t.prototype.renderNoise=function(){this.getThreeRenderer().render(this.sceneRTT,this.cameraRTT,this.getRuntimeData(),!0),this.getThreeRenderer().setRenderTarget(null)},t.prototype.changeNoiseValues=function(e,t,r,i){this.layerAmplitude=e,this.layerScale=t,this.scale=r,this.offset=i,this.onAttributesChanged(["layerAmplitude","layerScale","scale","offset"])},t}(a.default);t.default=u},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(1),a=r(2),o=r(11),s=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.skyboxTexture=null,t.stereoEnabled=!1,t.size=100,t.skyboxMesh=null,t.skyboxMeshRightEye=null,t.skyboxGeometry=null,t.skyboxGeometryRightEye=null,t.skyboxMaterialCube=null,t.skyboxUniforms=null,t.skyboxVShader=null,t.skyboxPShader=null,t.skyboxMaterial2D=null,t}return i.__extends(t,e),t.prototype.onStartup=function(){this.initMaterials()},t.prototype.onShutdown=function(){this.skyboxGeometry&&this.skyboxGeometry.dispose(),this.skyboxGeometryRightEye&&this.skyboxGeometryRightEye.dispose(),this.skyboxMaterialCube&&this.skyboxMaterialCube.dispose(),this.skyboxMaterial2D&&this.skyboxMaterial2D.dispose(),this.skyboxMesh=null,this.skyboxGeometry=null,this.skyboxGeometryRightEye=null,this.skyboxMaterialCube=null,this.skyboxMaterial2D=null,this.skyboxUniforms=null,this.skyboxTexture=null},t.prototype.getMesh=function(e){return void 0===e&&(e="left"),"left"===e?this.skyboxMesh:this.skyboxMeshRightEye},t.prototype.onAttributesChanged=function(e){if(e.indexOf("skyboxTexture")!==-1){var t=this.getPreviousAttribute("skyboxTexture");if(t){var r=this.getEngine().getEntityById(t);this.stopListening(r)}this.getEntity().unregisterDependencyById(this.getPreviousAttribute("skyboxTexture"));var i=this.getEntity().getOwnDependencyInfo(),n=this.getAttribute("skyboxTexture");i[n]||this.getEntity().registerDependencyById(this.getAttribute("skyboxTexture"))}this.getEntity().isBaseLoaded()&&(e.indexOf("skyboxTexture")===-1&&e.indexOf("stereoEnabled")===-1||this.initSkybox(),e.indexOf("size")!==-1&&this.skyboxMesh&&(this.skyboxMesh.scale.set(this.size,this.size,this.size),this.skyboxMeshRightEye.scale.set(this.size,this.size,this.size)))},t.prototype.onEnable=function(){this.getRuntimeData()&&(this.getRuntimeData().add(this.skyboxMesh),this.isStereo()&&this.getRuntimeData().add(this.skyboxMeshRightEye),this.skyboxTexture&&this.skyboxTexture.isUnloaded()&&this.skyboxTexture.load())},t.prototype.onDisable=function(){this.getRuntimeData()&&(this.getRuntimeData().remove(this.skyboxMesh),this.isStereo()&&this.getRuntimeData().remove(this.skyboxMeshRightEye))},t.prototype.onEntityReady=function(){this.initSkybox()},t.prototype.isStereo=function(){if(!this.skyboxTexture||!this.stereoEnabled)return!1;switch(this.skyboxTexture.getLayout()){case o.ImageLayout.Stereo2dOverUnder:case o.ImageLayout.Stereo2dUnderOver:case o.ImageLayout.Stereo2dLeftRight:case o.ImageLayout.Stereo2dRightLeft:return this.stereoEnabled;default:return!1}},t.prototype.initGeometry=function(){this.skyboxGeometry&&(this.skyboxGeometry.dispose(),this.skyboxGeometryRightEye.dispose()),this.skyboxGeometry=new n.SphereBufferGeometry(1,64,64),this.skyboxGeometryRightEye=this.skyboxGeometry.clone()},t.prototype.initStereoUvs=function(){if(this.skyboxTexture){var e=new n.Vector2,t=new n.Vector2,r=new n.Vector2,i=new n.Vector2;switch(this.skyboxTexture.getLayout()){case o.ImageLayout.Stereo2dOverUnder:e.set(1,.5),t.set(0,0),r.set(1,.5),i.set(0,.5);break;case o.ImageLayout.Stereo2dUnderOver:e.set(1,.5),t.set(0,.5),r.set(1,.5),i.set(0,0);break;case o.ImageLayout.Stereo2dLeftRight:e.set(.5,1),t.set(0,0),r.set(.5,1),i.set(.5,0);break;case o.ImageLayout.Stereo2dRightLeft:e.set(.5,1),t.set(.5,0),r.set(.5,1),i.set(0,0);break;default:return}for(var a=this.skyboxGeometry.getAttribute("uv").array,s=this.skyboxGeometryRightEye.getAttribute("uv").array,u=0;un&&i>0?(e.fillText(s,r,u),s=t+" ",u+=a):s=o}),e.fillText(s,r,u)},t}(a.default);t.default=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(1),a=r(2),o=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.standing=!0,t.userHeight=6,t.frameData=window.hasOwnProperty("VRFrameData")?new VRFrameData:{},t.standingMatrix=new n.Matrix4,t.workVector=new n.Vector3,t.scale=1,t}return i.__extends(t,e),t.prototype.onPreUpdate=function(e){if(this.isEnabled()&&this.hasRuntimeData()){var t=this.getEngine(),r=t.getVrDisplay();if(r){t.needsRender=!0,r.getFrameData(this.frameData);var i=this.frameData.pose,n=this.getRuntimeData(),a=this.getEntity();null!==i.orientation&&(a.setQuaternion(i.orientation[0],i.orientation[1],i.orientation[2],i.orientation[3]),r.capabilities.hasPosition&&i.position&&a.setPosition(i.position[0],i.position[1],i.position[2]),this.standing&&r.stageParameters?(n.updateMatrix(),this.standingMatrix.fromArray(r.stageParameters.sittingToStandingTransform),n.applyMatrix(this.standingMatrix),a.setQuaternion(n.quaternion.x,n.quaternion.y,n.quaternion.z,n.quaternion.w),n.position.multiplyScalar(this.scale),a.setPosition(n.position.x,n.position.y,n.position.z)):(a.getPosition(this.workVector),this.workVector.multiplyScalar(this.scale),a.setPosition(this.workVector.x,this.workVector.y,this.workVector.z)))}}},t}(a.default);t.default=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(2),a=r(16),o=r(3),s=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.scale=1,t.isPresenting=!1,t.wasPresenting=!1,t.vrDisplays=null,t.previousPixelRatio=1,t}return i.__extends(t,e),t.prototype.getScale=function(){ return this.scale},t.prototype.setScale=function(e){this.scale=e},t.prototype.getDisplays=function(){return this.vrDisplays},t.prototype.onAwake=function(){var e=this;this.listenTo(this.getEngine(),"enableVrRendering",this.onEnableVr),this.listenTo(this.getEngine(),"disableVrRendering",this.onDisableVr),this.listenTo(this.getEngine(),"toggleVrRendering",this.onToggleVr),this.onVrDisplayPresentChange=this.onVrDisplayPresentChange.bind(this),window.addEventListener("vrdisplaypresentchange",this.onVrDisplayPresentChange,!1),navigator.getVRDisplays?navigator.getVRDisplays().then(function(t){e.vrDisplays=t,e.trigger("displaysInitialized")}):this.vrDisplays=[]},t.prototype.onShutdown=function(){e.prototype.onShutdown.call(this),window.removeEventListener("vrdisplaypresentchange",this.onVrDisplayPresentChange,!1)},t.prototype.onDisable=function(){this.isPresenting&&this.onDisableVr()},t.prototype.whenDisplaysAvailable=function(e){var t=this;this.vrDisplays?e.call(this,this.vrDisplays):this.listenToOnce(this,"displaysInitialized",function(){e.call(t,t.vrDisplays)})},t.prototype.onPostRender=function(e){var t=this.getEngine().getVrDisplay();t&&this.isPresenting&&t.submitFrame()},t.prototype.onEnableVr=function(){if(this.isEnabled()){if(!this.vrDisplays)return void this.listenToOnce(this,"displaysInitialized",this.onEnableVr.bind(this));if(this.vrDisplays.length){var e=this.vrDisplays[0];this.getEngine().setVrDisplay(e);var t=this.getRenderer().getCanvas();e.requestPresent([{source:t}]).catch(function(e){o.default.error("Failed to present to VR display",e.message)})}}},t.prototype.onDisableVr=function(){if(this.isPresenting){var e=this.getEngine().getVrDisplay();e&&(e.exitPresent(),this.getEngine().setVrDisplay(null))}},t.prototype.onToggleVr=function(){this.isPresenting?this.onDisableVr():this.onEnableVr()},t.prototype.onVrDisplayPresentChange=function(){this.wasPresenting=this.isPresenting;var e=this.getEngine().getVrDisplay();this.isPresenting=e&&e.isPresenting;var t=this.getThreeRenderer();if(this.isPresenting){var r=e.getEyeParameters("left"),i=r.renderWidth,n=r.renderHeight;if(!this.wasPresenting){if(this.previousPixelRatio=t.getPixelRatio(),a.isMobile()){var o=t.capabilities.maxTextureSize,s=2*i;s*this.previousPixelRatio>o&&(this.previousPixelRatio=Math.floor(o/s)),t.setPixelRatio(this.previousPixelRatio)}else t.setPixelRatio(1);t.setSize(2*i,n,!1),this.getEngine().trigger("vrRenderingEnabled")}}else this.wasPresenting&&(t.setPixelRatio(this.previousPixelRatio),this.getEngine().setVrDisplay(null),this.getEngine().trigger("resize"),this.getEngine().trigger("vrRenderingDisabled"))},t}(n.default);t.default=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(1),a=r(65),o=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.enablePreRenderFunctions=!0,t.enableShadows=!0,t.eyeTranslationL=new n.Vector3,t.eyeTranslationR=new n.Vector3,t.defaultLeftBounds=[0,0,.5,1],t.defaultRightBounds=[.5,0,.5,1],t.renderRectL={x:0,y:0,width:256,height:256},t.renderRectR={x:128,y:0,width:256,height:256},t.cameraL=new n.PerspectiveCamera,t.cameraR=new n.PerspectiveCamera,t.frameData=window.hasOwnProperty("VRFrameData")?new VRFrameData:{},t.scale=1,t}return i.__extends(t,e),t.prototype.renderView=function(t){if(this.isEnabled()&&this.hasRuntimeData()){var r=this.getRootObject();if(r.isBaseLoaded()){var i=r.getRuntimeData(),n=this.getEngine().getVrDisplay();if(!n)return e.prototype.renderView.call(this,t);var a=i.autoUpdate;a&&(i.updateMatrixWorld(),i.autoUpdate=!1);var o=n.getEyeParameters("left"),s=n.getEyeParameters("right");this.eyeTranslationL.fromArray(o.offset),this.eyeTranslationR.fromArray(s.offset);var u,p,c=this.getThreeRenderer(),l=c.getSize(),h=n.getLayers();if(h.length){var d=h[0];u=null!==d.leftBounds&&4===d.leftBounds.length?d.leftBounds:this.defaultLeftBounds,p=null!==d.rightBounds&&4===d.rightBounds.length?d.rightBounds:this.defaultRightBounds}else u=this.defaultLeftBounds,p=this.defaultRightBounds;this.renderRectL={x:Math.round(l.width*u[0]),y:Math.round(l.height*u[1]),width:Math.round(l.width*u[2]),height:Math.round(l.height*u[3])},this.renderRectR={x:Math.round(l.width*p[0]),y:Math.round(l.height*p[1]),width:Math.round(l.width*p[2]),height:Math.round(l.height*p[3])};var f=this.getRuntimeData();null===f.parent&&f.updateMatrixWorld(),f.matrixWorld.decompose(this.cameraL.position,this.cameraL.quaternion,this.cameraL.scale),f.matrixWorld.decompose(this.cameraR.position,this.cameraR.quaternion,this.cameraR.scale),this.cameraL.translateOnAxis(this.eyeTranslationL,this.scale),this.cameraR.translateOnAxis(this.eyeTranslationR,this.scale),n.depthNear=f.near,n.depthFar=f.far,n.getFrameData(this.frameData),this.cameraL.projectionMatrix.elements=this.frameData.leftProjectionMatrix,this.cameraR.projectionMatrix.elements=this.frameData.rightProjectionMatrix,c.setScissor(this.renderRectL.x,this.renderRectL.y,this.renderRectL.width,this.renderRectL.height),this.getRenderer().renderView(i,this.cameraL,{renderTarget:this.renderTarget,clearDepth:!0,clearColor:!0,viewPort:this.renderRectL,enablePreRenderFunctions:!0}),c.setScissor(this.renderRectR.x,this.renderRectR.y,this.renderRectR.width,this.renderRectR.height),this.getRenderer().renderView(i,this.cameraR,{renderTarget:this.renderTarget,clearDepth:!1,clearColor:!1,viewPort:this.renderRectR,enablePreRenderFunctions:!0}),a&&(i.autoUpdate=!0)}}},t}(a.default);t.default=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(1),a=r(3),o=r(204),s=r(203),u=r(205),p=r(200),c=r(210),l=r(29),h=r(78),d=r(38),f=r(14),m=r(47),y=r(46),g=r(9),v=r(37),b=r(17),P=r(12),x=function(e){var t;return e&&e.jquery?e.get(0):"string"==typeof e?(t=document.querySelectorAll(e),t.length&&t[0]):e};t.engineMixins=y.default({},[u.default,s.default,l.default]);var E=function(e){function t(t){var r=e.call(this)||this;r.renderOnDemand=!1,r.needsRender=!0,r.container=void 0,r.globalEvents=void 0,r.engineName="Unnamed Instance of Box3D Engine",r.audioContext=void 0,r.paused=!1,r.runtimeNames={},r.nextRuntimeName=1,a.default.info("Engine Initialization"),r.globalScope=t.globalScope||window;var i=function(){if(r.globalEvents=t&&t.globalEvents||m.default,!r.globalEvents)throw new Error("No global event system supplied or found")},s=function(){r.container=r.container||x(t.container),!t.canvas&&r.container&&(t.canvas=document.createElement("canvas"),r.container.appendChild(t.canvas),r.canvasCreatedByEngine=!0)},u=function(){if(r.canvas=x(t.canvas),!(r.canvas instanceof HTMLCanvasElement))throw new Error("Failed to create canvas element")},l=function(){if(r.resourceLoader=t.resourceLoader,!r.resourceLoader)throw new Error("No resource loader passed to Engine")},y=function(){r.engineName=t.engineName||r.engineName,r.clock=new n.Clock(!0),r.frameDelta=0,r.frameDeltaAggregate=0,r.frameCount=0,r.lastFrameDelta=r.getTimeNow(),r.avgFrameTime=0,r.paused=!1,r.documentVisible=!0,r.state="initializing",r.entityDispatcher=t.entityDispatcher||new o.default,r.entityDispatcher.addEngine(r)},g=function(){r.scriptRegistry=new h.default(r),Object.keys(d.default.builtInAssetDescriptors).forEach(function(e){r.createEntity(d.default.builtInAssetDescriptors[e])}),Object.keys(f.default.builtInAssetDescriptors).forEach(function(e){r.createEntity(f.default.builtInAssetDescriptors[e])})},v=function(){r.materialUtilities=new c.default(r)},b=function(){r.geometryUtilities=new p.default},P=function(){r.onResize=function(){r.needsRender=!0},r.onBlur=function(){r.trigger("blur")},r.onFocus=function(){r.trigger("focus")},r.onVisibilityChange=function(){var e=document.hidden||document.mozHidden||document.msHidden||document.webkitHidden;r.documentVisible&&e?r.documentVisible=!1:r.documentVisible||(r.frameDelta=0,r.lastFrameDelta=r.getTimeNow(),r.documentVisible=!0)},window.addEventListener("blur",r.onBlur),window.addEventListener("focus",r.onFocus),r.listenTo(r,"resize",r.onResize),document.addEventListener("visibilitychange",r.onVisibilityChange)},E=function(){r.globalScope[r.engineName]=r,r.update(),r.state="initialized",r.trigger("resize")};return i(),s(),u(),l(),y(),g(),v(),b(),P(),E(),r}return i.__extends(t,e),t.prototype.destroy=function(){e.prototype.destroy.call(this),a.default.info(this.engineName+" - Destroying engine."),window[this.engineName]&&delete window[this.engineName],this.baseRenderer=void 0,this.resourceLoader.destroy(),this.materialUtilities.destroy(),this.geometryUtilities.destroy(),window.removeEventListener("blur",this.onBlur),window.removeEventListener("focus",this.onFocus),this.stopListening(this,"resize",this.onResize),document.removeEventListener("visibilitychange",this.onVisibilityChange),this.onBlur=void 0,this.onFocus=void 0,this.onResize=void 0,this.onVisibilityChange=void 0,this.trigger("shutdown"),this.state="uninitializing",this.cancelAnimationFrame(this.animationRequestID),this.canvas&&this.canvas.parentNode&&this.canvasCreatedByEngine&&this.canvas.parentNode.removeChild(this.canvas),this.entityDispatcher&&this.entityDispatcher.removeEngine(this),this.clock=void 0,this.canvas=void 0,this.container=void 0,this.threeRenderer=void 0,this.baseRenderer=void 0,this.engineName=void 0,this.entityDispatcher=void 0,this.state="uninitialized"},t.prototype.getName=function(){return this.engineName},t.prototype.addEntities=function(e){return this.entityDispatcher.addEntities(e)},t.prototype.addRemoteEntities=function(e,t){var r=this;return void 0===t&&(t={}),new Promise(function(i,n){r.resourceLoader.load(e,b.default.ENTITIES,t).on(P.default.LOAD,function(e){i(r.addEntities(e))}).on(P.default.ERROR,function(e){return n(e)})})},t.prototype.loadEntities=function(e,t,r){var i=this;void 0===r&&(r="load"),Promise.all(e.map(function(e){var t=e instanceof g.default?e.id:e;return new Promise(function(e,n){var a=i.getEntityById(t);a?(a.when(r,function(){e()}),a.isUnloaded()&&a.load()):n(new Error("Entity can't be found."))})})).then(function(){"function"==typeof t&&t.call(i)}).catch(function(e){"function"==typeof t&&(a.default.error("loadEntities error: "+e),t.call(i,e))})},t.prototype.setVrDisplay=function(e){var t=this;this.cancelAnimationFrame(this.animationRequestID),this.vrDevice=e,this.animationRequestID=this.requestAnimationFrame(function(){t.needsRender=!0,t.update()})},t.prototype.getVrDisplay=function(){return this.vrDevice},t.prototype.getApplication=function(){var e=this.getAssetsByClass(v.default);return e.find(function(e){return e.isBaseLoaded()})},t.prototype.getRenderer=function(){return this.baseRenderer},t.prototype.setRenderer=function(e){this.baseRenderer&&(this.baseRenderer.onShutdown(),this.baseRenderer.stopListening()),this.baseRenderer=e,this.threeRenderer=e.threeRenderer},t.prototype.getThreeRenderer=function(){return this.threeRenderer},t.prototype.getGPUCapability=function(e){return this.baseRenderer.caps[e]},t.prototype.getAudioContext=function(){if(!this.audioContext){var e=this.globalScope.AudioContext||this.globalScope.webkitAudioContext;e&&(this.audioContext=new e,this.audioContext||a.default.warn(this.engineName+" - Failed to create Web Audio API context"))}return this.audioContext},t.prototype.getRuntimeName=function(e){return this.runtimeNames.hasOwnProperty(e)||(this.runtimeNames[e]=this.nextRuntimeName.toString(),this.nextRuntimeName++),this.runtimeNames[e]},t.prototype.pause=function(){this.paused||(this.paused=!0,this.clock.stop(),this.cancelAnimationFrame(this.animationRequestID),a.default.info(this.engineName+" engine has been paused."))},t.prototype.unpause=function(){this.paused&&(this.paused=!1,this.frameDelta=0,this.lastFrameDelta=this.getTimeNow(),this.clock.start(),a.default.info(this.engineName+" engine has been unpaused."),this.update())},t.prototype.setCurrentApp=function(e){var t=this.getAssetById(e);t&&(this.currentApplication&&(a.default.warn("Already an application running in this engine. Stop it before starting the "+t.getName()+" application."),this.currentApplication.unload()),this.currentApplication=t)},t.prototype.getTimeNow=function(){return.001*(window.performance&&window.performance.now?window.performance.now():Date.now())},t.prototype.update=function(){var e=this;this.paused||(this.animationRequestID=this.requestAnimationFrame(function(){e.update()}),this.documentVisible&&(this.frameCount++,this.frameDelta=this.getTimeNow()-this.lastFrameDelta,this.lastFrameDelta=this.getTimeNow(),this.frameDeltaAggregate+=this.frameDelta,this.avgFrameTime=this.frameDeltaAggregate/this.frameCount,this.trigger("preUpdate",this.frameDelta),this.trigger("update",this.frameDelta),this.trigger("postUpdate",this.frameDelta),this.renderOnDemand&&!this.needsRender||(this.needsRender=!1,this.trigger("preRender",this.frameDelta),this.trigger("render",this.frameDelta),this.trigger("renderGroup1",this.frameDelta),this.trigger("renderGroup2",this.frameDelta),this.trigger("renderGroup3",this.frameDelta),this.trigger("renderGroup4",this.frameDelta),this.trigger("renderGroup5",this.frameDelta),this.trigger("renderGroup6",this.frameDelta),this.trigger("renderGroup7",this.frameDelta),this.trigger("renderGroup8",this.frameDelta),this.trigger("renderGroup9",this.frameDelta),this.trigger("renderGroup10",this.frameDelta),this.trigger("postRender",this.frameDelta))))},t.prototype.requestAnimationFrame=function(e){return this.vrDevice?this.vrDevice.requestAnimationFrame(e):requestAnimationFrame(e)},t.prototype.cancelAnimationFrame=function(e){return this.vrDevice?this.vrDevice.cancelAnimationFrame(e):cancelAnimationFrame(e)},t}(t.engineMixins);t.default=E},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i={$schema:"http://json-schema.org/draft-04/schema",id:"accessor",title:"AccessorDef",type:"object",description:"A typed-view into raw binary data.",properties:{componentType:{type:"string",enum:["int8","uint8","int16","int32","uint32","float32","float64"],description:"These correspond to typed arrays: Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array."},type:{type:"string",enum:["scalar","vec2","vec3","vec4","mat2","mat3","mat4"],description:"Specifies if elements are scalars, vectors or matrices."},byteOffset:{type:"integer",description:"Byte offset into the binary data."},byteStride:{type:"integer",description:"The number of bytes between successive elements (0 indicates that the elements are tightly packed)."},count:{type:"integer",description:"The number of elements, not to be confused with the number of components or bytes. For example, the number of positions, not the number of floats."}},additionalProperties:!1};t.default=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(7),a=i.__assign({},n.default,{id:"animationAsset",title:"AnimationAssetDef",type:"object",properties:i.__assign({},n.default.properties,{type:{enum:["animation"]},properties:{$ref:"animationAssetProperties.json"}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(8),a=i.__assign({},n.default,{id:"animationAssetProperties",title:"AnimationAssetPropertiesDef",type:"object",properties:i.__assign({},n.default.properties,{clips:{type:"object",properties:{},additionalProperties:{$ref:"animationClip.json"},default:{}},layers:{type:"object",properties:{},additionalProperties:{$ref:"animationLayer.json"},defualt:{}},channels:{type:"object",properties:{},additionalProperties:{$ref:"animationChannel.json"},default:{}}}),required:["clips","layers","channels"]});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i={$schema:"http://json-schema.org/draft-04/schema",id:"animationChannel",title:"AnimationChannelDef",type:"object",description:"An animation channel.",properties:{name:{type:"string",description:"The channel's name."},targetObject:{type:"array",description:"The path of the object to animate.",items:{type:"string"},default:[]},targetProperty:{type:"string",description:"The path of the property to animate."},values:{type:"string",description:"The ID of the accessor for the channel values."},times:{type:"string",description:"The ID of the accessor for the channel times."},interpolation:{type:"string",enum:["linear"],description:"The interpolation type for the channel."}},required:["name","targetObject","targetProperty","values","times","interpolation"],additionalProperties:!1};t.default=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i={$schema:"http://json-schema.org/draft-04/schema",id:"animationClip",title:"AnimationClipDef",type:"object",description:"An animation clip.",properties:{name:{type:"string",description:"The clip's name."},start:{type:"number",description:"The take's start time, in seconds.",default:0},stop:{type:"number",description:"The take's stop time, in seconds.",default:0},layers:{type:"array",items:{type:"string"},default:[]}},required:["name","start","stop","layers"],additionalProperties:!1};t.default=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i={$schema:"http://json-schema.org/draft-04/schema",id:"animationLayer",title:"AnimationLayerDef",type:"object",description:"An animation layer.",properties:{name:{type:"string",description:"The layer's name."},blendMode:{enum:["additive"],description:"The layer's blend mode.",default:"additive"},blendWeight:{type:"number",description:"The layer's blend weight.",default:1},channels:{type:"array",items:{type:"string"},default:[]}},required:["name","blendMode","blendWeight","channels"],additionalProperties:!1};t.default=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(7),a=i.__assign({},n.default,{id:"applicationAsset",title:"ApplicationAssetDef",type:"object",properties:i.__assign({},n.default.properties,{type:{enum:["application"]},properties:{$ref:"applicationAssetProperties.json"}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(8),a=i.__assign({},n.default,{id:"applicationAssetProperties",title:"ApplicationAssetPropertiesDef",type:"object",properties:i.__assign({},n.default.properties,{startupSceneId:{type:"string"}}),required:["startupSceneId"]});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(7),a=i.__assign({},n.default,{id:"audioAsset",title:"AudioAssetDef",type:"object",properties:i.__assign({},n.default.properties,{type:{enum:["audio"]},representations:i.__assign({},n.default.properties.representations,{type:{$ref:"audioRepresentation.json"}}),properties:{$ref:"audioAssetProperties.json"}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(8),a=i.__assign({},n.default,{id:"audioAssetProperties",title:"AudioAssetPropertiesDef"});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(33),a=i.__assign({},n.default,{id:"audioRepresentation",title:"AudioRepresentationDef",properties:i.__assign({},n.default.properties,{bitRate:{type:"number"},sampleRate:{type:"number"},stereo:{type:"boolean"},startTime:{type:"number"},duration:{type:"number"}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(15),a=i.__assign({},n.default,{id:"boneObject",title:"BoneObjectDef",properties:i.__assign({},n.default.properties,{type:{enum:["bone"]},properties:{$ref:"boneObjectProperties.json"}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(18),a=i.__assign({},n.default,{id:"boneObjectProperties",title:"BoneObjectPropertiesDef"});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i={$schema:"http://json-schema.org/draft-04/schema",id:"box3",title:"Box3Def",type:"object",properties:{min:{$ref:"vector3.json"},max:{$ref:"vector3.json"}},required:["min","max"],additionalProperties:!1};t.default=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(7),a=i.__assign({},n.default,{id:"bufferAsset",title:"BufferAssetDef",properties:i.__assign({},n.default.properties,{type:{enum:["buffer"]},properties:{$ref:"bufferAssetProperties.json"}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(8),a=i.__assign({},n.default,{id:"bufferAssetProperties",title:"BufferAssetPropertiesDef",properties:i.__assign({},n.default.properties,{src:{type:"string",description:"The URL of the binary file."},isExternal:{type:"boolean",description:"True is the asset should be loaded from outside of the base data provider/content provider.",default:!1},contentLength:{type:"number",description:"The HTTP Content-Length."},accessors:{type:"object",properties:{},additionalProperties:{$ref:"accessor.json"},description:"Typed-views into the binary file."}}),required:["src","contentLength"]});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(15),a=i.__assign({},n.default,{id:"cameraObject",title:"CameraObjectDef",properties:i.__assign({},n.default.properties,{type:{enum:["camera"]},properties:{$ref:"cameraObjectProperties.json"}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(18),a=i.__assign({},n.default,{id:"cameraObjectProperties",title:"CameraObjectPropertiesDef",properties:i.__assign({},n.default.properties,{cameraType:{type:"string",description:"",default:"perspective"},fov:{type:"number",default:50},aspect:{type:"number",default:1.7777777777777777},near:{type:"number",default:.1},far:{type:"number",default:12e3},right:{type:"number",default:10},left:{type:"number",default:-10},top:{type:"number",default:10},bottom:{type:"number",default:-10}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i={$schema:"http://json-schema.org/draft-04/schema",id:"component",title:"ComponentDef",type:"object",properties:{id:{type:"string"},scriptId:{type:"string"},name:{type:"string"},enabled:{type:"boolean"},attributes:{type:"object",properties:{},additionalProperties:{$ref:"componentAttribute.json"}}},additionalProperties:!1};t.default=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i={$schema:"http://json-schema.org/draft-04/schema",id:"componentAttribute",title:"ComponentAttributeDef",type:"object",properties:{type:{type:"string"},subType:{type:"object",properties:{type:{type:"string"},attributes:{}},additionalProperties:!1},attributes:{type:"array",items:{type:"object",properties:{type:{type:"string"},attributes:{}},additionalProperties:!1}}},additionalProperties:!1};t.default=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(7),a=i.__assign({},n.default,{id:"documentAsset",title:"DocumentAssetDef",properties:i.__assign({},n.default.properties,{type:{enum:["document"]},properties:{$ref:"documentAssetProperties.json"}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(8),a=i.__assign({},n.default,{id:"documentAssetProperties",title:"DocumentAssetPropertiesDef"});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i={$schema:"http://json-schema.org/draft-04/schema",id:"dracoAttribute",title:"DracoAttributeDef",type:"object",description:"Specifies the name and ID of a Draco attribute.",properties:{name:{type:"string",description:"The name of the this attribute. For example, texture's have a uvSet property that contains the name of a UV attribute."},id:{type:"string",description:"The ID of the Draco attribute."}},required:["name","id"],additionalProperties:!1};t.default=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(30),a=i.__assign({},n.default,{id:"dracoGeometryAsset",title:"DracoGeometryAssetDef",properties:i.__assign({},n.default.properties,{type:{enum:["dracoGeometry"]},properties:{$ref:"dracoGeometryAssetProperties.json"}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(31),a=i.__assign({},n.default,{id:"dracoGeometryAssetProperties",title:"DracoGeometryAssetPropertiesDef",properties:i.__assign({},n.default.properties,{accessorId:{type:["string","null"],description:"The ID of the accessor containing the draco geometry: #."},attributes:{type:"object",properties:{},additionalProperties:{$ref:"dracoAttribute.json"},description:"A collection of vertex attributes. All attributes must have the same number of elements."}}),required:["accessorId"]});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(70),a=i.__assign({},n.default,{id:"imageAsset",title:"ImageAssetDef",properties:i.__assign({},n.default.properties,{type:{enum:["image"]},representations:i.__assign({},n.default.properties.representations,{type:{$ref:"imageRepresentation.json"}}),properties:{$ref:"imageAssetProperties.json"}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(71),a=i.__assign({},n.default,{id:"imageAssetProperties",title:"ImageAssetPropertiesDef",properties:i.__assign({},n.default.properties,{useCompression:{type:"boolean",description:"True if we will try to use a hardware-compressed version of the image 'instead of a regular one. This depends on the hardware capabilities of the user and the data formats available.",default:!1}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(33),a={id:"imageRepresentation",title:"ImageRepresentationDef",properties:i.__assign({},n.default.properties,{src:{type:"string",description:"The URL of the representation."},channels:{type:"array",items:{type:"string"}},compression:{type:"string",enum:["dxt","dxt1","dxt5","jpeg","zip"]},isExternal:{type:"boolean"},width:{type:"integer",description:"The width, in pixels, of the representation."},height:{type:"integer",description:"The height, in pixels, of the representation."}}),required:["src"],additionalProperties:!1};t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(15),a=i.__assign({},n.default,{id:"lightObject",title:"LightObjectDef",properties:i.__assign({},n.default.properties,{type:{enum:["light"]},properties:{$ref:"lightObjectProperties.json"}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(18),a=i.__assign({},n.default,{id:"lightObjectProperties",title:"LightObjectPropertiesDef",properties:i.__assign({},n.default.properties,{lightType:{type:"string",default:"directional"},color:{type:["object","string","number"],properties:{r:{type:"number"},g:{type:"number"},b:{type:"number"}},default:{r:.7333,g:.7333,b:.7333}},intensity:{type:"number",default:1},distance:{type:"number",default:100},castShadow:{type:"boolean",default:!1},shadowCameraNear:{type:"number",default:.1},shadowCameraFar:{type:"number",default:20},shadowCameraLeft:{type:"number",default:-10},shadowCameraRight:{type:"number",default:10},shadowCameraTop:{type:"number",default:10},shadowCameraBottom:{type:"number",default:-10},shadowBias:{type:"number",default:-.0015},shadowMapWidth:{type:"integer",default:1024},shadowMapHeight:{type:"integer",default:1024}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(7),a=i.__assign({},n.default,{id:"materialAsset",title:"MaterialAssetDef",properties:i.__assign({},n.default.properties,{type:{enum:["material"]},properties:{$ref:"materialAssetProperties.json"}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(8),a=i.__assign({},n.default,{id:"materialAssetProperties",title:"MaterialAssetPropertiesDef",properties:i.__assign({},n.default.properties,{shader:{type:"string",default:"box3d_pbr_shader"},enabledFeatures:{type:["object","null"],default:null,properties:{},additionalProperties:{type:"boolean"}}}),additionalProperties:!0});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i={$schema:"http://json-schema.org/draft-04/schema",id:"meshAttribute",title:"MeshAttributeDef",type:"object",description:"Specifies a range of attribute data for the vertices of a mesh.",properties:{name:{type:"string",description:"The name of the this attribute. For example, texture's have a uvSet property that contains the name of a UV attribute."},accessorId:{type:"string",description:"The ID of the buffer asset and accessor: #."}},required:["name","accessorId"],additionalProperties:!1};t.default=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(30),a=i.__assign({},n.default,{id:"meshGeometryAsset",title:"MeshGeometryAssetDef",properties:i.__assign({},n.default.properties,{type:{enum:["meshGeometry"]},properties:{$ref:"meshGeometryAssetProperties.json"}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(31),a=i.__assign({},n.default,{id:"meshGeometryAssetProperties",title:"MeshGeometryAssetPropertiesDef",properties:i.__assign({},n.default.properties,{attributes:{type:"object",properties:{},additionalProperties:{$ref:"meshAttribute.json"},description:"A collection of vertex attributes. All attributes must have the same number of elements."},indices:{type:["string","null"],description:"The ID of the accessor containing the vertex indices: #."},primitives:{type:"array",items:{$ref:"meshPrimitive.json"},description:"The primitives (points, lines, triangles) that make up the mesh."}}),required:["attributes","indices","primitives"]});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(15),a=i.__assign({},n.default,{id:"meshObject",title:"MeshObjectDef",properties:i.__assign({},n.default.properties,{type:{enum:["mesh"]},properties:{$ref:"meshObjectProperties.json"}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(18),a=i.__assign({},n.default,{id:"meshObjectProperties",title:"MeshObjectPropertiesDef",properties:i.__assign({},n.default.properties,{customDepthMaterial:{type:["string","null"],default:null},materials:{type:"array",default:["missingMaterial"]},geometryId:{type:["string","null"],default:null},skinId:{type:["string","null"],default:null}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={$schema:"http://json-schema.org/draft-04/schema",id:"meshPrimitve",title:"meshPrimitiveDef",type:"object",description:"A mesh primitive with an optional material assignment.",properties:{primitive:{enum:["points","lines","triangles"],description:"The type of primitive to render.",default:"triangles"},count:{type:"integer",description:"The number of vertices to draw.",default:0},start:{type:"integer",description:"The index of the first vertex to draw.",default:0},offset:{type:"integer",description:"An offset to apply to each index. This can be used to overcome the 16-bit index limit imposed by WebGL. For example, the first component of a vertex attribute with a value size of 3 would be referenced as follows: values[3 * (offset + indices[start + i])].",default:0},materialIndex:{type:"integer",description:"The index of the material to apply to the primitive being rendered.",default:0}},required:["primitve","count"],additionalProperties:!1}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(15),a=i.__assign({},n.default,{ -id:"nodeObject",title:"NodeObjectDef",properties:i.__assign({},n.default.properties,{type:{enum:["node"]}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(7),a=i.__assign({},n.default,{id:"prefabAsset",title:"PrefabAssetDef",properties:i.__assign({},n.default.properties,{type:{enum:["prefab"]},properties:{$ref:"prefabAssetProperties.json"}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(8),a=i.__assign({},n.default,{id:"prefabAssetProperties",title:"PrefabAssetPropertiesDef",properties:i.__assign({},n.default.properties,{rootObjectId:{type:["string","null"],default:null,description:"The ID of the BaseObject that serves as the root node of a hierarchy."}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(30),a=i.__assign({},n.default,{id:"primitiveGeometryAsset",title:"PrimitiveGeometryAssetDef",properties:i.__assign({},n.default.properties,{type:{enum:["primitiveGeometry"]},properties:{$ref:"primitiveGeometryAssetProperties.json"}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(31),a=i.__assign({},n.default,{id:"primitiveGeometryAssetProperties",title:"PrimitiveGeometryAssetPropertiesDef",properties:i.__assign({},n.default.properties,{type:{type:"string",default:"sphere"},radius:{type:"number",default:100},segmentsU:{type:"integer",default:12},segmentsV:{type:"integer",default:12},sizeX:{type:"number",default:100},sizeY:{type:"number",default:100},sizeZ:{type:"number",default:100},segmentsX:{type:"integer",default:1},segmentsY:{type:"integer",default:1},segmentsZ:{type:"integer",default:1},radiusTop:{type:"number",default:50},radiusBottom:{type:"number",default:50},height:{type:"number",default:100},open:{type:"boolean",default:!1},tubeRadius:{type:"number",default:20},arcAngle:{type:"number",default:6.283185307179586}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(43),a=i.__assign({},n.default,{id:"renderTexture2DAsset",title:"RenderTexture2DAssetDef",properties:i.__assign({},n.default.properties,{type:{enum:["renderTexture2D"]},properties:{$ref:"renderTexture2DAssetProperties.json"}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(44),a=i.__assign({},n.default,{id:"renderTexture2DAssetProperties",title:"RenderTexture2DAssetPropertiesDef"});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(43),a=i.__assign({},n.default,{id:"renderTextureCubeAsset",title:"RenderTextureCubeAssetDef",properties:i.__assign({},n.default.properties,{type:{enum:["renderTextureCube"]},properties:{$ref:"renderTextureCubeAssetProperties.json"}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(44),a=i.__assign({},n.default,{id:"renderTextureCubeAssetProperties",title:"RenderTextureCubeAssetPropertiesDef",properties:i.__assign({},n.default.properties,{mappingType:{type:"string",description:"his value is temporarily here for compatibility with three.js. Remove it when adding a separate transform object to textures.",default:"cube"}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(15),a=i.__assign({},n.default,{id:"sceneObject",title:"SceneObjectDef",properties:i.__assign({},n.default.properties,{type:{enum:["scene"]},properties:{$ref:"sceneObjectProperties.json"}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(18),a=i.__assign({},n.default,{id:"sceneObjectProperties",title:"SceneObjectPropertiesDef",properties:i.__assign({},n.default.properties,{fogEnabled:{type:"boolean",default:!1},fogType:{type:"string",default:"FogExp2"},fogColor:{type:["number","string"],default:12303291},fogDensity:{type:"number",default:4e-4}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(7),a=i.__assign({},n.default,{id:"scriptAsset",title:"ScriptAssetDef",properties:i.__assign({},n.default.properties,{type:{enum:["script"]},properties:{$ref:"scriptAssetProperties.json"}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(8),a=i.__assign({},n.default,{id:"scriptAssetProperties",title:"ScriptAssetPropertiesDef",properties:i.__assign({},n.default.properties,{attributes:{type:"object",default:{}},description:{type:"string",default:""},events:{type:"object",default:{}},externalDependencies:{type:"array",default:[]},filter:{type:"array",default:[]},category:{type:"string",default:""}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(7),a=i.__assign({},n.default,{id:"shaderAsset",title:"ShaderAssetDef",properties:i.__assign({},n.default.properties,{type:{enum:["shader"]},properties:{$ref:"shaderAssetProperties.json"}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(8),a=i.__assign({},n.default,{id:"shaderAssetProperties",title:"ShaderAssetPropertiesDef",properties:i.__assign({},n.default.properties,{features:{type:"object",default:{}},parameters:{type:"object",default:{},additionalProperties:{$ref:"shaderParameter.json"}},uniforms:{type:"object",default:{}},vertexShader:{type:"string",default:""},fragmentShader:{type:"string",default:""}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i={type:"object",id:"shaderConditions",title:"ShaderConditionsDef",properties:{or:{type:"array",items:{type:"object",properties:{},additionalProperties:!0}},equals:{oneOf:[{type:"string"},{type:"number"},{type:"integer"},{type:"boolean"}]},notEquals:{oneOf:[{type:"string"},{type:"number"},{type:"integer"},{type:"boolean"}]},equalsDefault:{type:"boolean"},notEqualsDefault:{type:"boolean"}},additionalProperties:!1};t.default=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i={id:"shaderParameter",title:"ShaderParameterDef",properties:{displayName:{type:"string"},description:{type:"string"},isRenderParam:{type:"boolean"},isUniform:{type:"boolean"},uniformName:{type:"string"},type:{type:"string",enum:["b","c","f","t","opt","v2"]},min:{type:"number"},max:{type:"number"},options:{type:"object",properties:{},additionalProperties:!0},displayWhen:{properties:{},additionalProperties:{$ref:"shaderConditions.json"}},enabledWhen:{properties:{},additionalProperties:{$ref:"shaderConditions.json"}},defines:{properties:{},additionalProperties:{oneOf:[{type:"string"},{type:"number"},{type:"integer"},{type:"boolean"}]}},derivatives:{type:"boolean"},default:{anyOf:[{type:"null"},{type:"string"},{type:"number"},{type:"integer"},{type:"boolean"},{type:"object",properties:{},additionalProperties:!0}]},transparency:{enum:["LessThanOne","GreaterThanOne"]},textureUsage:{enum:["bump","normal"]},forceUpdate:{type:"boolean"},textureType:{enum:["Cube"]},step:{type:"number"}},additionalProperties:!1};t.default=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(7),a=i.__assign({},n.default,{id:"skinAsset",title:"SkinAssetDef",properties:i.__assign({},n.default.properties,{type:{enum:["skin"]},properties:{$ref:"skinAssetProperties.json"}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(8),a=i.__assign({},n.default,{id:"skinAssetProperties",title:"SkinAssetPropertiesDef",properties:i.__assign({},n.default.properties,{bindShapeMatrix:{type:"array",description:"Bind shape matrix specifying how the mesh should be transformed into the right coordinate system for use with the joints.",items:{type:"number"},minItems:16,maxItems:16,default:[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]},inverseBindMatrices:{type:"string",description:"The ID of the accessor containing the inverse bind matrices: #."},jointNames:{type:"array",description:"Names of the joints in this skin.",items:{type:"string"},uniqueItems:!0,default:[]}}),required:["bindShapeMatrix","inverseBindMatrices","jointNames"]});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(32),a=i.__assign({},n.default,{id:"texture2DAsset",title:"Texture2DAssetDef",properties:i.__assign({},n.default.properties,{type:{enum:["texture2D"]},properties:{$ref:"texture2DAssetProperties.json"}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(22),a=i.__assign({},n.default,{id:"texture2DAssetProperties",title:"Texture2DAssetPropertiesDef"});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(32),a=i.__assign({},n.default,{id:"textureCubeAsset",title:"TextureCubeAssetDef",properties:i.__assign({},n.default.properties,{type:{enum:["textureCube"]},properties:{$ref:"textureCubeAssetProperties.json"}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(22),a=i.__assign({},n.default,{id:"textureCubeAssetProperties",title:"TextureCubeAssetPropertiesDef",properties:i.__assign({},n.default.properties,{mappingType:{type:"string",default:"cube"}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i={$schema:"http://json-schema.org/draft-04/schema",id:"vector3",title:"Vector3Def",type:"object",properties:{x:{type:"number"},y:{type:"number"},z:{type:"number"}},required:["x","y","z"],additionalProperties:!1};t.default=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i={$schema:"http://json-schema.org/draft-04/schema",id:"vector4",title:"Vector4Def",type:"object",properties:{x:{type:"number"},y:{type:"number"},z:{type:"number"},w:{type:"number"}},required:["x","y","z","w"],additionalProperties:!1};t.default=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(7),a=i.__assign({},n.default,{id:"videoAsset",title:"VideoAssetDef",type:"object",properties:i.__assign({},n.default.properties,{type:{enum:["video"]},representations:i.__assign({},n.default.properties.representations,{type:{$ref:"videoRepresentation.json"}}),properties:{$ref:"videoAssetProperties.json"}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(22),a=i.__assign({},n.default,{id:"videoAssetProperties",title:"VideoAssetPropertiesDef",properties:i.__assign({},n.default.properties,{autoPlay:{type:"boolean",default:!0},muted:{type:"boolean",default:!0},state:{type:"string",default:"play"},loop:{type:"boolean",default:!0},querySelector:{type:"string"}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(33),a=i.__assign({},n.default,{id:"videoRepresentation",title:"VideoRepresentationDef",properties:i.__assign({},n.default.properties,{video:{type:"object",properties:{height:{type:"integer"},width:{type:"integer"}}}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){var e;try{e=window.WebGLRenderingContext?document.createElement("canvas").getContext("experimental-webgl"):void 0}catch(e){}var t=!!e,r=!!t&&!!e.getExtension("OES_texture_float"),i=!!t&&!(0===e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS));return e=void 0,{isWebGLEnabled:function(){return t},isFloatingPointTexturesEnabeled:function(){return r},isVertexTexturesEnabeled:function(){return i}}}()},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isObject=function(e){return"node"===e.type||"camera"===e.type||"scene"===e.type||"light"===e.type||"mesh"===e.type||"bone"===e.type},t.isAsset=function(e){return!t.isObject(e)}},function(e,t){var r={}.toString;e.exports=function(e){return r.call(e).slice(8,-1)}},function(e,t,r){var i=r(238);e.exports=function(e,t,r){if(i(e),void 0===t)return e;switch(r){case 1:return function(r){return e.call(t,r)};case 2:return function(r,i){return e.call(t,r,i)};case 3:return function(r,i,n){return e.call(t,r,i,n)}}return function(){return e.apply(t,arguments)}}},function(e,t){e.exports=function(e){try{return!!e()}catch(e){return!0}}},function(e,t){var r=0,i=Math.random();e.exports=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++r+i).toString(36))}},function(e,t,r){var i=r(253)("wks"),n=r(191),a=r(36).Symbol,o="function"==typeof a,s=e.exports=function(e){return i[e]||(i[e]=o&&a[e]||(o?a:n)("Symbol."+e))};s.store=i},function(e,t){function r(e,t){var r=t||0,n=i;return n[e[r++]]+n[e[r++]]+n[e[r++]]+n[e[r++]]+"-"+n[e[r++]]+n[e[r++]]+"-"+n[e[r++]]+n[e[r++]]+"-"+n[e[r++]]+n[e[r++]]+"-"+n[e[r++]]+n[e[r++]]+n[e[r++]]+n[e[r++]]+n[e[r++]]+n[e[r++]]}for(var i=[],n=0;n<256;++n)i[n]=(n+256).toString(16).substr(1);e.exports=r},function(e,t,r){(function(t){var r,i=t.crypto||t.msCrypto;if(i&&i.getRandomValues){var n=new Uint8Array(16);r=function(){return i.getRandomValues(n),n}}if(!r){var a=new Array(16);r=function(){for(var e,t=0;t<16;t++)0===(3&t)&&(e=4294967296*Math.random()),a[t]=e>>>((3&t)<<3)&255;return a}}e.exports=r}).call(t,r(76))},function(e,t,r){function i(e){return r(n(e))}function n(e){var t=a[e];if(!(t+1))throw new Error("Cannot find module '"+e+"'.");return t}var a={"./accessor":120,"./accessor.ts":120,"./animationAsset":121,"./animationAsset.ts":121,"./animationAssetProperties":122,"./animationAssetProperties.ts":122,"./animationChannel":123,"./animationChannel.ts":123,"./animationClip":124,"./animationClip.ts":124,"./animationLayer":125,"./animationLayer.ts":125,"./applicationAsset":126,"./applicationAsset.ts":126,"./applicationAssetProperties":127,"./applicationAssetProperties.ts":127,"./audioAsset":128,"./audioAsset.ts":128,"./audioAssetProperties":129,"./audioAssetProperties.ts":129,"./audioRepresentation":130,"./audioRepresentation.ts":130,"./baseAsset":7,"./baseAsset.ts":7,"./baseAssetProperties":8,"./baseAssetProperties.ts":8,"./baseEntity":41,"./baseEntity.ts":41,"./baseEntityProperties":42,"./baseEntityProperties.ts":42,"./baseGeometryAsset":30,"./baseGeometryAsset.ts":30,"./baseGeometryAssetProperties":31,"./baseGeometryAssetProperties.ts":31,"./baseImageAsset":70,"./baseImageAsset.ts":70,"./baseImageAssetProperties":71,"./baseImageAssetProperties.ts":71,"./baseObject":15,"./baseObject.ts":15,"./baseObjectProperties":72,"./baseObjectProperties.ts":72,"./baseRenderTextureAsset":43,"./baseRenderTextureAsset.ts":43,"./baseRenderTextureAssetProperties":44,"./baseRenderTextureAssetProperties.ts":44,"./baseTextureAsset":32,"./baseTextureAsset.ts":32,"./baseTextureAssetProperties":22,"./baseTextureAssetProperties.ts":22,"./boneObject":131,"./boneObject.ts":131,"./boneObjectProperties":132,"./boneObjectProperties.ts":132,"./box3":133,"./box3.ts":133,"./bufferAsset":134,"./bufferAsset.ts":134,"./bufferAssetProperties":135,"./bufferAssetProperties.ts":135,"./cameraObject":136,"./cameraObject.ts":136,"./cameraObjectProperties":137,"./cameraObjectProperties.ts":137,"./commonImageProperties":45,"./commonImageProperties.ts":45,"./component":138,"./component.ts":138,"./componentAttribute":139,"./componentAttribute.ts":139,"./documentAsset":140,"./documentAsset.ts":140,"./documentAssetProperties":141,"./documentAssetProperties.ts":141,"./dracoAttribute":142,"./dracoAttribute.ts":142,"./dracoGeometryAsset":143,"./dracoGeometryAsset.ts":143,"./dracoGeometryAssetProperties":144,"./dracoGeometryAssetProperties.ts":144,"./imageAsset":145,"./imageAsset.ts":145,"./imageAssetProperties":146,"./imageAssetProperties.ts":146,"./imageRepresentation":147,"./imageRepresentation.ts":147,"./index":4,"./index.ts":4,"./lightObject":148,"./lightObject.ts":148,"./lightObjectProperties":149,"./lightObjectProperties.ts":149,"./materialAsset":150,"./materialAsset.ts":150,"./materialAssetProperties":151,"./materialAssetProperties.ts":151,"./meshAttribute":152,"./meshAttribute.ts":152,"./meshGeometryAsset":153,"./meshGeometryAsset.ts":153,"./meshGeometryAssetProperties":154,"./meshGeometryAssetProperties.ts":154,"./meshObject":155,"./meshObject.ts":155,"./meshObjectProperties":156,"./meshObjectProperties.ts":156,"./meshPrimitive":157,"./meshPrimitive.ts":157,"./nodeObject":158,"./nodeObject.ts":158,"./nodeObjectProperties":18,"./nodeObjectProperties.ts":18,"./prefabAsset":159,"./prefabAsset.ts":159,"./prefabAssetProperties":160,"./prefabAssetProperties.ts":160,"./primitiveGeometryAsset":161,"./primitiveGeometryAsset.ts":161,"./primitiveGeometryAssetProperties":162,"./primitiveGeometryAssetProperties.ts":162,"./renderTexture2DAsset":163,"./renderTexture2DAsset.ts":163,"./renderTexture2DAssetProperties":164,"./renderTexture2DAssetProperties.ts":164,"./renderTextureCubeAsset":165,"./renderTextureCubeAsset.ts":165,"./renderTextureCubeAssetProperties":166,"./renderTextureCubeAssetProperties.ts":166,"./representation":33,"./representation.ts":33,"./sceneObject":167,"./sceneObject.ts":167,"./sceneObjectProperties":168,"./sceneObjectProperties.ts":168,"./scriptAsset":169,"./scriptAsset.ts":169,"./scriptAssetProperties":170,"./scriptAssetProperties.ts":170,"./shaderAsset":171,"./shaderAsset.ts":171,"./shaderAssetProperties":172,"./shaderAssetProperties.ts":172,"./shaderConditions":173,"./shaderConditions.ts":173,"./shaderParameter":174,"./shaderParameter.ts":174,"./skinAsset":175,"./skinAsset.ts":175,"./skinAssetProperties":176,"./skinAssetProperties.ts":176,"./texture2DAsset":177,"./texture2DAsset.ts":177,"./texture2DAssetProperties":178,"./texture2DAssetProperties.ts":178,"./textureCubeAsset":179,"./textureCubeAsset.ts":179,"./textureCubeAssetProperties":180,"./textureCubeAssetProperties.ts":180,"./vector3":181,"./vector3.ts":181,"./vector4":182,"./vector4.ts":182,"./videoAsset":183,"./videoAsset.ts":183,"./videoAssetProperties":184,"./videoAssetProperties.ts":184,"./videoRepresentation":185,"./videoRepresentation.ts":185};i.keys=function(){return Object.keys(a)},i.resolve=n,e.exports=i,i.id=195},function(e,t,r){"use strict";function i(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}Object.defineProperty(t,"__esModule",{value:!0});var n=r(1);t.THREE=n;var a=r(224);t.Components=a;var o=r(4);t.Schemas=o.default;var s=r(119);t.Engine=s.default;var u=r(78);t.ScriptRegistry=u.default;var p=r(9);t.BaseEntity=p.default;var c=r(49);t.AnimationAsset=c.default;var l=r(37);t.ApplicationAsset=l.default;var h=r(50);t.AudioAsset=h.default;var d=r(6);t.BaseAsset=d.default;var f=r(23);t.BaseGeometryAsset=f.default;var m=r(10);t.BaseImageAsset=m.default;var y=r(51);t.BaseRenderTextureAsset=y.default;var g=r(20);t.BaseTextureAsset=g.default;var v=r(21);t.BufferAsset=v.default;var b=r(77);t.DocumentAsset=b.default;var P=r(52);t.DracoGeometryAsset=P.default;var x=r(24);t.ImageAsset=x.default;var E=r(14);t.MaterialAsset=E.default;var w=r(53);t.MeshGeometryAsset=w.default;var S=r(54);t.PrefabAsset=S.default;var D=r(55);t.PrimitiveGeometryAsset=D.default;var _=r(56);t.RenderTexture2DAsset=_.default;var M=r(57);t.RenderTextureCubeAsset=M.default;var A=r(58);t.ScriptAsset=A.default;var T=r(38);t.ShaderAsset=T.default;var C=r(59);t.SkinAsset=C.default;var R=r(60);t.Texture2DAsset=R.default;var O=r(61);t.TextureCubeAsset=O.default;var I=r(25);t.VideoAsset=I.default;var k=r(68);t.NodeObject=k.default;var j=r(66);t.BoneObject=j.default;var L=r(67);t.CameraObject=L.default;var B=r(39);t.LightObject=B.default;var N=r(27);t.MeshObject=N.default;var V=r(28);t.SceneObject=V.default;var U=r(17);t.LoadingType=U.default;var z=r(12);t.LoadingEvent=z.default;var F=r(69);t.LoadingState=F.default;var G=r(2);t.BaseComponent=G.default;var q=r(63);t.Handedness=q.Handedness;var H=r(64);t.RenderMode=H.RenderMode;var $=r(3);t.log=$.default;var W=r(221);t.XhrResourceLoader=W.default,i(r(16));var X=r(47);t.globalEvents=X.default;var Q=r(186);t.browserCaps=Q.default},function(e,t,r){r(258),e.exports=r(35).Array.find},function(e,t,r){r(259),e.exports=r(35).Math.log10},function(e,t,r){r(260),e.exports=r(35).Math.log2},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(1),n=function(){function e(){var e=this;this.defaultGeometry=new i.BufferGeometry,this.defaultGeometry.setIndex(new i.BufferAttribute(new Uint16Array(0),1));var t={position:new i.BufferAttribute(new Float32Array(0),3),normal:new i.BufferAttribute(new Float32Array(0),3,!0),skinWeight:new i.BufferAttribute(new Float32Array(0),4,!0),skinIndex:new i.BufferAttribute(new Uint16Array(0),4,!0)};Object.keys(t).forEach(function(r){var i=t[r];e.defaultGeometry.addAttribute(r,i)})}return e.prototype.destroy=function(){this.defaultGeometry&&(this.defaultGeometry.dispose(),this.defaultGeometry=void 0)},e.prototype.getDefaultGeometry=function(){return this.defaultGeometry},e}();t.default=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(1),n=r(34),a=function(){function e(){this.components=[]}return e.prototype.initializeComponents=function(){this.listenTo(this.engine,"scriptDeleted",this.onScriptDeleted),this.listenTo(this,"change:component",this.onComponentChanged),this.listenTo(this,"remove:component",this.onComponentRemoved),this.listenTo(this,"add:component",this.onComponentAdded)},e.prototype.getComponentDescriptor=function(e){var t="function"!=typeof e,r=this.sharedData.components;return n.default(r.find(function(r){return t||e(r)}))},e.prototype.getPreviousComponentDescriptor=function(e){var t="function"!=typeof e,r=this.sharedData.previousComponents;return n.default(r.find(function(r){return t||e(r)}))},e.prototype.getComponentDescriptors=function(e){var t="function"!=typeof e,r=this.sharedData.components;return r.filter(function(r){return t||e(r)}).map(function(e){return n.default(e)})},e.prototype.getComponentDescriptorById=function(e){return this.getComponentDescriptor(function(t){return t.id===e})},e.prototype.getPreviousComponentDescriptorById=function(e){return this.getPreviousComponentDescriptor(function(t){return t.id===e})},e.prototype.addComponent=function(e,t,r){void 0===t&&(t={}),void 0===r&&(r="");var i={scriptId:"string"==typeof e?e:e.id,attributes:t,enabled:!0,name:r},n=this.engine.entityDispatcher;return n.dispatchComponentAdded(this.id,i),this.components[this.components.length-1]},e.prototype.removeComponent=function(e){var t=e.getIndex();return t>=0&&(this.engine.entityDispatcher.dispatchComponentRemoved(this.id,t),!0)},e.prototype.getComponentByIndex=function(e){return this.components[e]||null},e.prototype.getComponentByName=function(e){return this.getComponent(function(t){return t.getName()===e})},e.prototype.getComponentsByName=function(e){return this.getComponents(function(t){return t.getName()===e})},e.prototype.getComponentByScriptId=function(e){return this.getComponent(function(t){return t.getScriptId()===e})},e.prototype.getComponentsByScriptId=function(e){return this.getComponents(function(t){return t.getScriptId()===e})},e.prototype.getComponentByScriptName=function(e){return this.getComponent(function(t){return t.getScriptName()===e})},e.prototype.getComponentsByScriptName=function(e){return this.getComponents(function(t){return t.getScriptName()===e})},e.prototype.getComponent=function(e){var t="function"!=typeof e;return this.components.find(function(r){return t||e(r)})},e.prototype.getComponentById=function(e){return this.getComponent(function(t){return t.getId()===e})},e.prototype.getComponents=function(e){var t="function"!=typeof e;return this.components.filter(function(r){return t||e(r)})},e.prototype.setComponents=function(e,t){var r=this;void 0===t&&(t=!1);for(var i=this.engine.entityDispatcher,n=this.sharedData.components.length;n>=0;n--)i.dispatchComponentRemoved(this.id,n);e.forEach(function(e){i.dispatchComponentAdded(r.id,e)})},e.prototype.startComponents=function(){var e=this;this.components.forEach(function(t){return e.startComponent(t)})},e.prototype.stopComponents=function(){var e=this;this.components.forEach(function(t){return e.stopComponent(t)})},e.prototype.onScriptDeleted=function(e){var t=this,r=this.getComponentsByScriptId(e);r.forEach(function(e){t.removeComponent(e)})},e.prototype.onComponentChanged=function(e,t){var r=this.getComponentByIndex(e);if(!r)throw new Error("Don't have a component at index "+e);if(t.attributes){this.assignAttributeValues(r,t.attributes);var i=Object.keys(t.attributes);r.trigger("attributesChanged",i)}},e.prototype.onComponentAdded=function(e){var t=this.createComponentObject(e);t.trigger("awake"),this.assignAttributeValues(t);var r=t.getScriptAsset(),i=Object.keys(r.getProperty("attributes"));t.trigger("attributesChanged",i),this.isBaseUnloaded()||this.startComponent(t,!1)},e.prototype.onComponentRemoved=function(e){var t=this.components[e];if(!t)throw new Error("Can't find component at index "+e+" to remove.");this.stopComponent(t),this.components.splice(e,1)},e.prototype.translateAttributeValue=function(e,t,r,n){var a=this,o=this.engine;if(!r)throw new Error("Attribute "+t+" does not exist for this component.");switch(r.type){case"asset":e[t]=o.getAssetById(n);break;case"object":e[t]=o.getObjectById(n);break;case"custom":e[t]=e[t]||{},Object.keys(n).forEach(function(i){a.translateAttributeValue(e[t],i,r.attributes[i],n[i])});break;case"c":e[t]=e[t]||new i.Color,e[t].setRGB(n.r,n.g,n.b);break;case"a":e[t]=e[t]||[];var s;switch(r.subType.type){case"asset":n.forEach(function(r,i){e[t][i]=o.getAssetById(r)});break;case"object":n.forEach(function(r,i){e[t][i]=o.getObjectById(r)});break;case"custom":n.forEach(function(i,o){e[t][o]=e[t][o]||{},Object.keys(i).forEach(function(i){a.translateAttributeValue(e[t][o],i,r.subType.attributes[i],n[o][i])})});break;case"a":n.forEach(function(i,o){e[t][o]=e[t][o]||[],i.forEach(function(i,s){a.translateAttributeValue(e[t][o],s.toString(10),r.subType.subType,n[o][s])})});break;case"v2":s=i.Vector2;case"v3":s=s?s:i.Vector3;case"v4":s=s?s:i.Vector4;case"q":s=s?s:i.Quaternion,n.forEach(function(r,i){e[t][i]=e[t][i]||new s,e[t][i].copy(r)});break;default:n.forEach(function(r,i){e[t][i]=r})}break;case"v2":s=i.Vector2;case"v3":s=s?s:i.Vector3;case"v4":s=s?s:i.Vector4;case"q":s=s?s:i.Quaternion,e[t]=e[t]||new s,e[t].copy(n);break;default:e[t]=n}},e.prototype.assignAttributeValues=function(e,t){var r=this,i="object"!=typeof t,n=e.getScriptAsset(),a=n.getProperty("attributes")||{};Object.keys(a).forEach(function(n){if(i||t.hasOwnProperty(n)){var o=a[n],s=e.getAttribute(o.name);r.translateAttributeValue(e,o.name,o,s)}})},e.prototype.createComponentObject=function(e){var t=e.scriptId,r=this.engine.getAssetById(t);if(!r)throw new Error("Unable to find script asset for "+t);r.isUnloaded()&&r.load();var i=new r.sharedData.classConstructor;return this.components.push(i),Object.assign(i,{id:e.id,name:e.name,scriptName:r.getName(),scriptId:t,enabled:!!e.enabled,entity:this}),i},e.prototype.startComponent=function(e,t){if(void 0===t&&(t=!0),t){var r=e.getScriptAsset(),i=Object.keys(r.getProperty("attributes"));this.assignAttributeValues(e),e.trigger("attributesChanged",i)}e.trigger("startup")},e.prototype.stopComponent=function(e){e.trigger("shutdown")},e}();t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(9),n=r(3),a=function(){function e(){this.ownDependencies={},this.dependencies={}}return e.prototype.getOwnDependencies=function(){var e=this;return Object.keys(this.ownDependencies).map(function(t){return e.engine.getEntityById(t)}).filter(function(e){return e})},e.prototype.getOwnDependencyInfo=function(){return this.ownDependencies},e.prototype.getDependencies=function(e){var t=this,r="function"!=typeof e;return Object.keys(this.dependencies).map(function(e){return t.engine.getEntityById(e)}).filter(function(t){return r||e(t)})},e.prototype.getDependenciesByClass=function(e){return this.getDependencies(function(t){return t instanceof e})},e.prototype.getDependenciesByType=function(e){return this.getDependencies(function(t){return t.type===e})},e.prototype.getDependencyInfo=function(){return this.dependencies},e.prototype.registerDependencyById=function(e){this.registerDependency(this.engine.getEntityById(e))},e.prototype.registerDependency=function(e){var t=this;if(!e)return void n.default.warn("Trying to register invalid entity as a dependency.");var r=this.getOwnDependencyInfo(),a=e.id;r[a]?r[a].count++:(r[a]={count:1},r[a].onSubDependencyChange=function(e,i){if(r[a])for(var n=0;n=r.components.length-1)){var i=Math.min(Math.max(t,0),r.components.length-1);i<0||(r.previousComponents=r.components?r.components.slice():[],r.components.splice(i,1),this.fireExternalUpdate(e,{components:r.components}),this.engines.forEach(function(t){var r=t.getEntityById(e);r.trigger("remove:component",i)}))}},e.prototype.dispatchComponentAdded=function(e,t){var r=this.entities[e];if(r){r.previousComponents=r.components?r.components.slice():[];var i=a.default(t);i.id=i.id||n.v4(),i.name=i.name||"unnamed component",i.attributes=i.attributes||{},i.enabled=i.enabled!==!1,r.components.push(i),this.fireExternalUpdate(e,{components:r.components}),this.engines.forEach(function(t){var r=t.getEntityById(e);r.trigger("add:component",i)})}},e.prototype.fireExternalUpdate=function(e,t,r){var i=new u.default;i.type=r?r:"updateEntity",i.entityId=e,i.entityData=t,o.default.trigger("EntityUpdates",i)},e}();t.default=p},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(49),n=r(37),a=r(50),o=r(6),s=r(66),u=r(21),p=r(67),c=r(77),l=r(52),h=r(24),d=r(39),f=r(14),m=r(27),y=r(53),g=r(68),v=r(54),b=r(55),P=r(56),x=r(57),E=r(28),w=r(58),S=r(38),D=r(59),_=r(60),M=r(61),A=r(25),T=function(){function e(){this.objects={},this.assets={}}return e.prototype.destroy=function(){var e=this;this.getAssets().forEach(function(t){return e.unregisterEntity(t)}),this.getObjects().forEach(function(t){return e.unregisterEntity(t)})},e.prototype.getAsset=function(e){return this.getEntity(e,this.assets)},e.prototype.getAssets=function(e){return this.getEntities(e,this.assets)},e.prototype.getAssetById=function(e){return this.assets[e]||null},e.prototype.getAssetByName=function(e){return this.getAsset(function(t){return t.getName()===e})},e.prototype.getAssetsByName=function(e){return this.getAssets(function(t){return t.getName()===e})},e.prototype.getAssetByClass=function(e){return this.getAsset(function(t){return t instanceof e})},e.prototype.getAssetByType=function(e){return this.getAsset(function(t){return t.type===e})},e.prototype.getAssetsByClass=function(e){return this.getAssets(function(t){return t instanceof e})},e.prototype.getAssetsByType=function(e){return this.getAssets(function(t){return t.type===e})},e.prototype.getObject=function(e){return this.getEntity(e,this.objects)},e.prototype.getObjects=function(e){return this.getEntities(e,this.objects)},e.prototype.getObjectById=function(e){return this.objects[e]||null},e.prototype.getObjectByName=function(e){return this.getObject(function(t){return t.getName()===e})},e.prototype.getObjectsByName=function(e){return this.getObjects(function(t){return t.getName()===e})},e.prototype.getObjectByClass=function(e){return this.getObject(function(t){return t instanceof e})},e.prototype.getObjectByType=function(e){return this.getObject(function(t){return t.type===e})},e.prototype.getObjectsByType=function(e){return this.getObjects(function(t){return t.type===e})},e.prototype.getObjectsByClass=function(e){return this.getObjects(function(t){return t instanceof e})},e.prototype.getEntity=function(e,t){if(!t)return this.getAsset(e)||this.getObject(e);var r=Object.keys(t).find(function(r){return e(t[r])});return t[r]},e.prototype.getEntities=function(e,t){if(!t)return this.getObjects(e).concat(this.getAssets(e));var r="function"!=typeof e;return Object.keys(t).filter(function(i){return r||e(t[i])}).map(function(e){return t[e]})},e.prototype.getEntityById=function(e){return this.assets[e]||this.objects[e]||null},e.prototype.getEntityByClass=function(e){return this.getEntity(function(t){return t instanceof e})},e.prototype.getEntityByType=function(e){return this.getEntity(function(t){return t.type===e})},e.prototype.getEntitiesByClass=function(e){return this.getEntities(function(t){return t instanceof e})},e.prototype.getEntitiesByType=function(e){return this.getEntities(function(t){return t.type===e})},e.prototype.getEntityByName=function(e){return this.getEntity(function(t){return t.getName()===e})},e.prototype.getEntitiesByName=function(e){return this.getEntities(function(t){return t.getName()===e})},e.prototype.unregisterEntityById=function(e){this.unregisterEntity(this.getEntityById(e))},e.prototype.unregisterEntity=function(e){e&&(e.uninitialize(),this.objects[e.id]?delete this.objects[e.id]:(e.off("load",this.onAssetLoaded,this),e.off("unload",this.onAssetUnloaded,this),delete this.assets[e.id]))},e.prototype.getClassType=function(e){switch(e){case i.default:return"animation";case n.default:return"application";case a.default:return"audio";case s.default:return"bone";case u.default:return"buffer";case p.default:return"camera";case c.default:return"document";case l.default:return"dracoGeometry";case h.default:return"image";case d.default:return"light";case f.default:return"material";case m.default:return"mesh";case y.default:return"meshGeometry";case g.default:return"node";case v.default:return"prefab";case b.default:return"primitiveGeometry";case P.default:return"renderTexture2D";case x.default:return"renderTextureCube";case E.default:return"scene";case w.default:return"script";case S.default:return"shader";case D.default:return"skin";case _.default:return"texture2D";case M.default:return"textureCube";case A.default:return"video";default:return null}},e.prototype.getEntityClass=function(t){return e.entityNameTypeMap[t]?e.entityNameTypeMap[t]:null},e.prototype.registerEntity=function(e){var t=new(this.getEntityClass(e.type))(e);t.engine=this,t instanceof o.default?(this.assets[t.id]=t,t.on("load",this.onAssetLoaded,this),t.on("unload",this.onAssetUnloaded,this)):this.objects[t.id]=t},e.prototype.onAssetLoaded=function(e){this.trigger("assetLoaded",e)},e.prototype.onAssetUnloaded=function(e){this.trigger("assetUnloaded",e)},e}();T.entityNameTypeMap={animation:i.default,application:n.default,audio:a.default,bone:s.default,buffer:u.default,camera:p.default,document:c.default,dracoGeometry:l.default,image:h.default,light:d.default,material:f.default,mesh:m.default,meshGeometry:y.default,node:g.default,prefab:v.default,primitiveGeometry:b.default,renderTexture2D:P.default,renderTextureCube:x.default,scene:E.default,script:w.default,shader:S.default,skin:D.default,texture2D:_.default,textureCube:M.default,video:A.default},t.default=T},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(){this.type="updateEntity",this.entityId="",this.entityData={}}return e}();t.default=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(){}return e}();t.default=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(1),n=r(209),a=r(231),o=r(230),s={id:"box3d_pbr_shader",type:"shader",properties:{name:"PBR Shader",vertexShader:a,fragmentShader:o,features:{albedo:{displayName:"Albedo",defaultEnabled:!0,parameters:["albedoColor","albedoMap","aoMap","envMapIrradiance"]},transparency:{displayName:"Transparency",defaultEnabled:!1,parameters:["opacity","alphaMap","blending","blendEquation","blendSrc","blendDst","useSeparateAlphaBlend","blendEquationAlpha","blendSrcAlpha","blendDstAlpha"]},specular:{displayName:"Specular",defaultEnabled:!1,parameters:["specularColor","specularMap","glossMap","roughness","roughnessMap","reflectivity","envMapGlossVariance","envMapRadiance","envMapRadianceHalfGloss"]},clearCoat:{displayName:"Clear Coat",defaultEnabled:!1,parameters:["clearCoat","clearCoatRoughness"]},metalness:{displayName:"Metalness",defaultEnabled:!1,parameters:["metalness","metalnessMap"]},normals:{displayName:"Bump/Normals",defaultEnabled:!1,parameters:["normalMap","normalScale","bumpMap","bumpScale"]},emissive:{displayName:"Emissive",defaultEnabled:!1,parameters:["emissiveColor","emissiveMap"]},rendering:{displayName:"Render Parameters",alwaysEnabled:!0,parameters:["fog","side","depthWrite","depthTest","depthFunc","alphaTest","polygonOffset","polygonOffsetFactor","polygonOffsetUnits"]}},parameters:n.default,uniforms:i.UniformsUtils.merge([i.UniformsLib.common,i.UniformsLib.emissivemap,i.UniformsLib.bumpmap,i.UniformsLib.normalmap,i.UniformsLib.roughnessmap,i.UniformsLib.metalnessmap,i.UniformsLib.displacementmap,i.UniformsLib.fog,i.UniformsLib.lights,{time:{value:1},emissive:{value:new i.Color(0)},specular:{value:new i.Color(1118481)},roughness:{value:0},metalness:{value:0},clearCoat:{value:0},clearCoatRoughness:{value:0},envMapIntensity:{value:1}}])}};t.default=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(1),n={albedoColor:{displayName:"Base Albedo",description:"A color to tint the material with.",type:"c",default:{r:1,g:1,b:1},min:0,max:1,isUniform:!0,uniformName:"diffuse"},albedoMap:{displayName:"Albedo Map",description:"A texture that modifies the diffuse color of the material.",type:"t",default:null,isUniform:!0,isRenderParam:!0,uniformName:"map",enabledWhen:{albedoMap:{notEqualsDefault:!0}}},opacity:{displayName:"Opacity",description:"This option controls the total opacity of the material.",type:"f",default:1,min:0,max:1,isUniform:!0,isRenderParam:!0,transparency:"LessThanOne"},alphaMap:{displayName:"Alpha Map",description:"A texture that stores the transparency info of the material.",type:"t",default:null,isUniform:!0,isRenderParam:!0,enabledWhen:{alphaMap:{notEqualsDefault:!0}}},specularColor:{displayName:"Specular Color",description:"A color to tint the material with.",type:"c",default:{r:1,g:1,b:1},min:0,max:1,isUniform:!0,uniformName:"specular"},specularMap:{displayName:"Specular Map",description:"A texture that contains the specular color of the material.",type:"t",default:null,isUniform:!0,isRenderParam:!0,enabledWhen:{specularMap:{notEqualsDefault:!0}}},metalness:{displayName:"Metalness",description:"How metallic the surface appears (multiplied by the metalness texture).",type:"f",min:0,max:1,default:0,isUniform:!0},metalnessMap:{displayName:"Metalness Map",description:"A texture that contains the metalness of the material.",type:"t",default:null,isUniform:!0,isRenderParam:!0,enabledWhen:{metalnessMap:{notEqualsDefault:!0}}},glossMap:{displayName:"Gloss Map",description:"A texture that stores the gloss info of the material.",type:"t",default:null,isUniform:!0,enabledWhen:{glossMap:{notEqualsDefault:!0},roughnessMap:{equalsDefault:!0}}},roughness:{displayName:"Roughness",description:"How rough the surface appears.",type:"f",min:0,max:1,default:0,isUniform:!0,isRenderParam:!0},roughnessMap:{displayName:"Roughness Map",description:"A texture that stores the roughness info of the material.",type:"t",default:null,isUniform:!0,isRenderParam:!0,enabledWhen:{roughnessMap:{notEqualsDefault:!0}}},reflectivity:{displayName:"Reflectivity",description:"Reflectivity at normal incidence. i.e. when viewing the surface directly.",type:"f",min:0,max:1,default:.02,isUniform:!0,isRenderParam:!0,uniformName:"reflectivity"},normalMap:{displayName:"Normal Map",description:"",type:"t",default:null,isUniform:!0,isRenderParam:!0,derivatives:!0,textureUsage:"normal",enabledWhen:{normalMap:{notEqualsDefault:!0}}},normalScale:{displayName:"Normal Scale",description:"blah",type:"v2",default:{x:1,y:1},isUniform:!0,isRenderParam:!0},bumpMap:{displayName:"Bump Map",description:"",type:"t",default:null,isUniform:!0,isRenderParam:!0,derivatives:!0,textureUsage:"bump",enabledWhen:{normalMap:{equalsDefault:!0},bumpMap:{notEqualsDefault:!0}}},bumpScale:{displayName:"Bump Scale",description:"blah",type:"f",min:0,max:20,default:1,isUniform:!0,isRenderParam:!0,enabledWhen:{normalMap:{equalsDefault:!0},bumpMap:{notEqualsDefault:!0}},displayWhen:{useBump:{equals:!0}}},clearCoat:{displayName:"Clear Coat",type:"f",min:0,max:1,isUniform:!0,isRenderParam:!0,default:0},clearCoatRoughness:{displayName:"Clear Coat",type:"f",min:0,max:1,isUniform:!0,isRenderParam:!0,default:0},envMapRadiance:{displayName:"Specular Light Map",description:"A map that represents the surrounding environment. Used for reflections.",type:"t",default:null,isUniform:!0,forceUpdate:!0,enabledWhen:{envMapRadiance:{notEqualsDefault:!0}}},envMapRadianceHalfGloss:{displayName:"Specular Light Map",description:"A cube-map that represents the surrounding environment. Used for reflections.",type:"t",textureType:"Cube",default:null,isUniform:!0,enabledWhen:{envMapIrradiance:{notEqualsDefault:!0},envMapRadiance:{notEqualsDefault:!0},envMapRadianceHalfGloss:{notEqualsDefault:!0}}},envMapIrradiance:{displayName:"Specular Light Map",description:"A cube-map that represents the surrounding environment. Used for reflections.",type:"t",textureType:"Cube",default:null,isUniform:!0,enabledWhen:{envMapIrradiance:{notEqualsDefault:!0}},displayWhen:{envMapIrradiance:{notEqualsDefault:!0}}},envMapGlossVariance:{displayName:"Environment Map Gloss Variance",description:"Turn on multi-sampling of environment map based on varying glossiness of surface.",type:"b",default:!0,forceUpdate:!0,enabledWhen:{envMapGlossVariance:{equals:!0}}},emissiveColor:{displayName:"Emissive Color",description:"A color that represents the light emitted by the material.",type:"c",default:{r:0,g:0,b:0},isUniform:!0,isRenderParam:!0,uniformName:"emissive"},emissiveMap:{displayName:"Emissive Map",description:"A texture that modifies the emissive color of the material.",type:"t",default:null,isUniform:!0,isRenderParam:!0,enabledWhen:{emissiveMap:{notEqualsDefault:!0}}},aoMap:{displayName:"AO Map",description:"The ambient occlusion of the material.",type:"t",default:null,isUniform:!0,enabledWhen:{aoMap:{notEqualsDefault:!0}}},side:{displayName:"Cull Mode",description:"This controls which side of the geometry will be visible.",type:"opt",isRenderParam:!0,options:{frontOnly:i.FrontSide,backOnly:i.BackSide,doubleSided:i.DoubleSide},default:"doubleSided"},fog:{displayName:"Enable Fog",description:"This controls whether this material is affected by fog or not.",isRenderParam:!0,forceUpdate:!0,type:"b",default:!0},depthFunc:{displayName:"Depth Function",description:"",isRenderParam:!0,type:"opt",options:{never:i.NeverDepth,always:i.AlwaysDepth,lessThan:i.LessDepth,lessThanOrEqual:i.LessEqualDepth,equal:i.EqualDepth,greaterThanOrEqual:i.GreaterEqualDepth,greaterThan:i.GreaterDepth,notEqual:i.NotEqualDepth},default:"lessThanOrEqual"},depthWrite:{displayName:"Enable Depth Write",description:"This controls whether the depth values of a mesh rendered with this material are recorded.",isRenderParam:!0,type:"b",default:!0},depthTest:{displayName:"Enable Depth Test",description:"This controls whether a depth check is done before this material is rendered so that it can be occluded.",isRenderParam:!0,type:"b",default:!0},blending:{displayName:"Blending Mode",description:"This controls how the material will be blended with the color behind it.",isRenderParam:!0,type:"opt",options:{none:i.NoBlending,normal:i.NormalBlending,additive:i.AdditiveBlending,subtractive:i.SubtractiveBlending,multiplicative:i.MultiplyBlending,custom:i.CustomBlending},default:"normal",transparency:"GreaterThanOne"},blendEquation:{displayName:"Blending Equation",description:"TODO.",isRenderParam:!0,type:"opt",options:{add:i.AddEquation,subtract:i.SubtractEquation,reverseSubtract:i.ReverseSubtractEquation,minimum:i.MinEquation,maximum:i.MaxEquation},default:"add",displayWhen:{blending:{equals:"custom"}}},blendSrc:{displayName:"Blend Source",description:"TODO.",isRenderParam:!0,type:"opt",options:{zero:i.ZeroFactor,one:i.OneFactor,sourceColor:i.SrcColorFactor,oneMinusSourceColor:i.OneMinusSrcColorFactor,sourceAlpha:i.SrcAlphaFactor,oneMinusSourceAlpha:i.OneMinusSrcAlphaFactor,destinationAlpha:i.DstAlphaFactor,oneMinusDestinationAlpha:i.OneMinusDstAlphaFactor},default:"sourceAlpha",displayWhen:{blending:{equals:"custom"}}},blendDst:{displayName:"Blend Destination",description:"TODO.",isRenderParam:!0,type:"opt",options:{zero:i.ZeroFactor,one:i.OneFactor,sourceColor:i.SrcColorFactor,oneMinusSourceColor:i.OneMinusSrcColorFactor,sourceAlpha:i.SrcAlphaFactor,oneMinusSourceAlpha:i.OneMinusSrcAlphaFactor,destinationAlpha:i.DstAlphaFactor,oneMinusDestinationAlpha:i.OneMinusDstAlphaFactor,destinationColor:i.DstColorFactor,oneMinusDestinationColor:i.OneMinusDstColorFactor,sourceAlphaSaturate:i.SrcAlphaSaturateFactor},default:"one",displayWhen:{blending:{equals:"custom"}}},useSeparateAlphaBlend:{displayName:"Separate Blend for Alpha",description:"TODO",type:"b",default:!1,displayWhen:{blending:{equals:"custom"}}},blendEquationAlpha:{displayName:"Alpha Blend Equation",description:"TODO",isRenderParam:!0,type:"opt",options:{add:i.AddEquation,subtract:i.SubtractEquation,reverseSubtract:i.ReverseSubtractEquation,minimum:i.MinEquation,maximum:i.MaxEquation},default:"add",displayWhen:{blending:{equals:"custom"},useSeparateAlphaBlend:{equals:!0}},enabledWhen:{useSeparateAlphaBlend:{equals:!0}}},blendSrcAlpha:{displayName:"Alpha Blend Source",description:"TODO.",isRenderParam:!0,type:"opt",options:{zero:i.ZeroFactor,one:i.OneFactor,sourceColor:i.SrcColorFactor,oneMinusSourceColor:i.OneMinusSrcColorFactor,sourceAlpha:i.SrcAlphaFactor,oneMinusSourceAlpha:i.OneMinusSrcAlphaFactor,destinationAlpha:i.DstAlphaFactor,oneMinusDestinationAlpha:i.OneMinusDstAlphaFactor},default:"sourceAlpha",displayWhen:{blending:{equals:"custom"},useSeparateAlphaBlend:{equals:!0}},enabledWhen:{useSeparateAlphaBlend:{equals:!0}}},blendDstAlpha:{displayName:"Alpha Blend Destination",description:"TODO.",isRenderParam:!0,type:"opt",options:{zero:i.ZeroFactor,one:i.OneFactor,sourceColor:i.SrcColorFactor,oneMinusSourceColor:i.OneMinusSrcColorFactor,sourceAlpha:i.SrcAlphaFactor,oneMinusSourceAlpha:i.OneMinusSrcAlphaFactor,destinationAlpha:i.DstAlphaFactor,oneMinusDestinationAlpha:i.OneMinusDstAlphaFactor,destinationColor:i.DstColorFactor,oneMinusDestinationColor:i.OneMinusDstColorFactor,sourceAlphaSaturate:i.SrcAlphaSaturateFactor},default:"one",displayWhen:{blending:{equals:"custom"},useSeparateAlphaBlend:{equals:!0}},enabledWhen:{useSeparateAlphaBlend:{equals:!0}}},polygonOffset:{displayName:"Polygon Offset",description:"Turns on rendering with polygon offsets. This can be used to work around z-fighting.",isRenderParam:!0,type:"b",default:!1},polygonOffsetFactor:{displayName:"Polygon Offset Factor",description:"Scales the maximum Z slope, with respect to X or Y of the polygon.",isRenderParam:!0,type:"f",default:1},polygonOffsetUnits:{displayName:"Polygon Offset Units",description:"Scales the minimum resolvable depth buffer value.",isRenderParam:!0,type:"f",default:1},alphaTest:{displayName:"Alpha Test",description:'Pixels with an alpha value below the given value will not be rendered. This value will only be used when this material\'s Transparency blending mode is set to "Masked"',isRenderParam:!0,forceUpdate:!0,type:"f",default:.2,min:0,max:1,step:.001}};t.default=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(14),n=r(20),a=function(){function e(e){this.engine=e,this.standInTextures=[],this.engine=e,this.engine.on("rebuildMaterials",this.rebuildAll,this),this.engine.on("resize",this.onResize,this),this.engine.on("update",this.update,this),this.standInTextures[i.StandInTexture.STANDIN_TEXTURE_WHITE]={texture:null,color:[255,255,255]},this.standInTextures[i.StandInTexture.STANDIN_TEXTURE_WHITE_CUBE]={texture:null,color:[255,255,255],type:"Cube"},this.standInTextures[i.StandInTexture.STANDIN_TEXTURE_BLACK]={texture:null,color:[0,0,0]},this.standInTextures[i.StandInTexture.STANDIN_TEXTURE_BLACK_CUBE]={texture:null,color:[0,0,0],type:"Cube"},this.standInTextures[i.StandInTexture.STANDIN_TEXTURE_NORMAL]={texture:null,color:[127,127,255]}}return e.prototype.destroy=function(){this.engine.off("rebuildMaterials",this.rebuildAll,this),this.engine.off("resize",this.onResize,this),this.engine.off("update",this.update,this),this.standInTextures.forEach(function(e){e.texture&&e.texture.dispose()})},e.prototype.getMissingMaterial=function(){return this.engine.getAssetById("missingMaterial")},e.prototype.getStandInTexture=function(e){if(!this.standInTextures[e])return null;if(!this.standInTextures[e].texture){var t=this.standInTextures[e].color;"Cube"===this.standInTextures[e].type?this.standInTextures[e].texture=n.default.createColorTextureCube(t[0],t[1],t[2]):this.standInTextures[e].texture=n.default.createColorTexture(t[0],t[1],t[2])}return this.standInTextures[e].texture},e.prototype.update=function(e){i.default.timeValueInUse&&(this.engine.needsRender=!0),i.default.sharedUniforms.time.value=e},e.prototype.rebuildAll=function(){var e=this.engine.getAssetsByClass(i.default);e.forEach(function(e){e.runtimeData&&Object.keys(i.default.materialObjectTypes).forEach(function(t){e.runtimeData[t].needsUpdate=!0})})},e.prototype.onResize=function(){var e=i.default.sharedUniforms.screenDimensions;e.value.x=0,e.value.y=0;var t=this.engine.getRenderer();t?(e.value.z=t.getCanvasWidth(),e.value.w=t.getCanvasHeight()):(e.value.z=128,e.value.w=128)},e}();t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={ -uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:["varying vec2 vUv;","void main() {","vUv = uv;","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform float opacity;","uniform sampler2D tDiffuse;","varying vec2 vUv;","void main() {","vec4 texel = texture2D( tDiffuse, vUv );","gl_FragColor = opacity * texel;","}"].join("\n")}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(1),n=function(){function e(e,t){void 0===t&&(t="tDiffuse"),this.enabled=!0,this.needsSwap=!0,this.renderToScreen=!1,this.clear=!1,this.textureId=t,this.uniforms=i.UniformsUtils.clone(e.uniforms),this.material=new i.ShaderMaterial({blending:i.NormalBlending,transparent:!0,uniforms:this.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader}),this.camera=new i.OrthographicCamera(-1,1,1,-1,0,1),this.scene=new i.Scene,this.quad=new i.Mesh(new i.PlaneGeometry(2,2),null),this.scene.add(this.quad),this.prevViewPort=new i.Vector4}return e.prototype.render=function(e,t,r,i){this.uniforms[this.textureId]&&(this.uniforms[this.textureId].value=r),this.quad.material=this.material,this.renderToScreen?(this.viewPort&&e.setViewport(this.viewPort.x,this.viewPort.y,this.viewPort.width,this.viewPort.height),(this.clearColor||this.clearDepth)&&e.clear(!!this.clearColor,!!this.clearDepth,!1),e.render(this.scene,this.camera)):this.renderToTexture?((this.clearColor||this.clearDepth)&&e.clear(this.clearColor,this.clearDepth,!1),e.render(this.scene,this.camera,this.renderToTexture)):e.render(this.scene,this.camera,t,this.clear)},e.prototype.dispose=function(){this.quad.geometry.dispose(),this.quad=void 0,this.camera=void 0,this.scene=void 0,this.material.dispose(),this.material=void 0,this.uniforms=void 0},e}();t.default=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={uniforms:{tDiffuse:{type:"t",value:null},rgbmMultiplier:{type:"f",value:9}},vertexShader:["varying vec2 vUv;","void main() {","vUv = uv;","#ifdef FLIP_Y","vUv.y = 1.0 - vUv.y;","#endif","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform sampler2D tDiffuse;","uniform float rgbmMultiplier;","const mat3 InverseLogLuvMatrix = mat3(","6.0014, -2.7008, -1.7996,","-1.3320, 3.1029, -5.7721,","0.3008, -1.0882, 5.6268);","vec3 HDRDecodeLOGLUV(in vec4 vLogLuv)","{","float Le = vLogLuv.z * 255.0 + vLogLuv.w;","vec3 Xp_Y_XYZp;","Xp_Y_XYZp.y = exp2((Le - 127.0) / 2.0);","Xp_Y_XYZp.z = Xp_Y_XYZp.y / vLogLuv.y;","Xp_Y_XYZp.x = vLogLuv.x * Xp_Y_XYZp.z;","vec3 vRGB = InverseLogLuvMatrix * Xp_Y_XYZp;","return vRGB;","}","vec3 HDRDecodeRGBM( vec4 rgbm ) {","return rgbmMultiplier * rgbm.rgb * rgbm.a;","}","vec3 HDRDecodeRGBD( vec4 rgbd ) {","return rgbd.rgb / max(rgbd.a, 0.003);","}","vec3 HDRDecodeRGBE( vec4 rgbe ) {","float f = exp2( rgbe.w * 255.0 - (128.0 + 0.0) );","return rgbe.rgb * f;","}","varying vec2 vUv;","void main() {","vec3 hdrColour;","#ifdef HDR_RGBM","hdrColour = HDRDecodeRGBM( texture2D( tDiffuse, vUv ) );","#elif defined(HDR_RGBD)","hdrColour = HDRDecodeRGBD( texture2D( tDiffuse, vUv ) );","#elif defined(HDR_RGBE)","hdrColour = HDRDecodeRGBE( texture2D( tDiffuse, vUv ) );","#elif defined(HDR_LOGLUV)","hdrColour = HDRDecodeLOGLUV( texture2D( tDiffuse, vUv ) );","#else","hdrColour = texture2D( tDiffuse, vUv ).xyz;","#endif","gl_FragColor = vec4( hdrColour, 1.0 );","}"].join("\n")}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(29),a=r(69),o=r(12),s=r(220),u=r(46);t.loadableResourceMixins=u.default({},[n.default]);var p=function(e){function t(t,r,i){void 0===i&&(i={});var n=e.call(this)||this;if(n.path=t,n.type=r,n.params=i,n.state=a.default.STARTING,n.error=void 0,n.data=void 0,n.loaderData={},!t)throw new Error("Missing required `path` argument");if(!r)throw new Error("Missing required `type` argument");return n}return i.__extends(t,e),t.prototype.setState=function(e){switch(e){case a.default.STARTING:throw new s.default(this.state,e);case a.default.LOADING:if(this.state!==a.default.STARTING)throw new s.default(this.state,e);break;case a.default.PROCESSING:if(this.state!==a.default.LOADING)throw new s.default(this.state,e);break;case a.default.COMPLETE:if(this.state!==a.default.PROCESSING)throw new s.default(this.state,e);break;case a.default.CANCELLED:if(this.state!==a.default.STARTING&&this.state!==a.default.LOADING&&this.state!==a.default.PROCESSING)throw new s.default(this.state,e);break;case a.default.ERROR:break;default:throw new Error("Unknown state: "+e)}return this.state=e,this.trigger(o.default.STATE_CHANGE,e),e},t.prototype.setLoading=function(){this.setState(a.default.LOADING)},t.prototype.setProcessing=function(){this.setState(a.default.PROCESSING)},t.prototype.setComplete=function(e){this.setState(a.default.COMPLETE),this.data=e,this.trigger(o.default.LOAD,e),this.done()},t.prototype.setError=function(e){this.setState(a.default.ERROR),this.error=e,this.trigger(o.default.ERROR,e),this.done()},t.prototype.setCancelled=function(){this.setState(a.default.CANCELLED),this.trigger(o.default.CANCEL),this.done()},t.prototype.isCancelled=function(){return this.state===a.default.CANCELLED},t.prototype.done=function(){this.trigger(o.default.DONE,this.state),this.off()},t}(t.loadableResourceMixins);t.default=p},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(40),n=function(e){return e.setProcessing(),e.setComplete(e.loaderData.xhr.response),Promise.resolve(e)};t.default=function(e,t){return i.makeXhr(t)(e).then(i.unlessCancelled(i.setResponseType("arraybuffer"))).then(i.unlessCancelled(i.loadXhr)).then(i.unlessCancelled(i.requireStatus(function(e){return 200===e}))).then(i.unlessCancelled(n)).catch(i.handleError(e))}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(233),n=r(187),a=r(40),o=function(e){e.setProcessing();var t="string"==typeof e.loaderData.xhr.response?JSON.parse(e.loaderData.xhr.response):e.loaderData.xhr.response,r=e.path.indexOf("?"),a=r>=0?r:e.path.length,o=e.path.slice(0,e.path.lastIndexOf("/",a)+1);if(void 0===t||void 0===t.version||t.version.major>4)return Promise.reject(new Error("Unsupported data version"));var s=new RegExp(/^(?:[a-z]+:)?\/\//i),u=new RegExp(/^\//),p=function(e){return!e.match(s)&&!e.match(u)},c=i.mapEntities(t.entities,t.version);return c.forEach(function(e){if(n.isAsset(e)&&e.representations&&e.representations.forEach(function(e){e.src&&p(e.src)&&(e.src=o+e.src)}),"buffer"===e.type){var t=e.properties;t.src&&p(t.src)&&(t.src=o+t.src)}}),e.setComplete(c),Promise.resolve(e)};t.default=function(e,t){return a.makeXhr(t)(e).then(a.unlessCancelled(a.setResponseType("json"))).then(a.unlessCancelled(a.loadXhr)).then(a.unlessCancelled(a.requireStatus(function(e){return 200===e}))).then(a.unlessCancelled(o)).catch(a.handleError(e))}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(40),n=function(e){return new Promise(function(t){if(e.setProcessing(),e.loaderData.xhr.response instanceof Blob){var r=URL.createObjectURL(e.loaderData.xhr.response),i=new Image;i.onload=function(){e.setComplete(i),t(e)},i.src=r}else e.setComplete(e.loaderData.xhr.response),t(e)})};t.default=function(e,t){return i.makeXhr(t)(e).then(i.unlessCancelled(i.setResponseType("blob"))).then(i.unlessCancelled(i.loadXhr)).then(i.unlessCancelled(i.requireStatus(function(e){return 200===e}))).then(i.unlessCancelled(n)).catch(i.handleError(e))}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(40),n=function(e){return new Promise(function(t,r){e.setProcessing();var i=URL.createObjectURL(e.loaderData.xhr.response),n=document.createElement("video");n.addEventListener("loadeddata",function(){e.setComplete(n),t(e)}),n.addEventListener("error",function(){return r(new Error("Failed to load video"))}),n.src=i,n.load()})};t.default=function(e,t){return i.makeXhr(t)(e).then(i.unlessCancelled(i.setResponseType("blob"))).then(i.unlessCancelled(i.loadXhr)).then(i.unlessCancelled(i.requireStatus(function(e){return 200===e}))).then(i.unlessCancelled(n)).catch(i.handleError(e))}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(3),n=r(12),a=r(9),o=function(){function e(){this.loadingResources=[]}return e.prototype.loadResource=function(e,t,r,o){var s=this;void 0===o&&(o={});var u=this.engine.resourceLoader.load(e,t,o);return this.loadingResources.push(u),u.on(n.default.ERROR,function(e){i.default.error(s.engine.getName()+(" - ResourceLifecycle: Error loading "+s.type+",")+(s.getName()+", "+e.toString())),s.setState(a.StateType.Base,a.State.Failed)}),u.on(n.default.DONE,function(){s.loadingResources=s.loadingResources.filter(function(e){return e!==u}),"function"==typeof r&&r()}),u},e.prototype.abortRequests=function(){this.loadingResources.forEach(function(e){return e.setCancelled()})},e}();t.default=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(69),a=function(e){function t(t,r){var i=e.call(this,'Illegal state transition "'+n.default[t]+'" -> "'+n.default[r]+'"')||this;return i.from=t,i.to=r,i}return i.__extends(t,e),t}(Error);t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(214),n=r(223),a=r(215),o=r(217),s=r(218),u=r(216),p=r(12),c=r(17),l=4,h=function(e,t){var r=new XMLHttpRequest;return r.open("GET",e),Promise.resolve(r)},d=[];d[c.default.BUFFER]=a.default,d[c.default.IMAGE]=o.default,d[c.default.VIDEO]=s.default,d[c.default.ENTITIES]=u.default;var f=function(){function e(e,t){if(void 0===e&&(e=h),void 0===t&&(t=d),this.xhrPromise=e,this.strategies=t,this.resources={},!e)throw new Error("Must provide argument `xhrPromise`!");if(!t)throw new Error("Must provide argument `strategies`!");this.queue=n.default(l)}return e.prototype.destroy=function(){this.queue.destroy()},e.prototype.load=function(e,t,r){var n=this;if(!this.strategies[t])throw new Error("Unsupported type: "+t);if(this.resources[e])return this.resources[e];var a=this.resources[e]=new i.default(e,t,r);return this.queue.add(function(){return new Promise(function(r){var i=function(){delete n.resources[e],a.off(p.default.LOAD,i),a.off(p.default.ERROR,i),a.off(p.default.CANCEL,i),r(a)};a.once(p.default.LOAD,i),a.once(p.default.ERROR,i),a.once(p.default.CANCEL,i),n.strategies[t](a,n.xhrPromise)})},r.priority),a},e}();t.default=f},function(e,t,r){"use strict";function i(e){return e.replace(/([a-z])([A-Z])/g,"$1_$2").replace(/([A-Z]+)([A-Z])([a-z])/,"$1_$2$3").toUpperCase()}Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t="string"==typeof e?e:"";return t=t.replace(/_([a-z])/gi,function(e,t){return"_"+t.toUpperCase()}),t=t.replace(/\s+/g,"_"),t=t.replace(/([a-z])([0-9])/g,"$1_$2"),t=i(t)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=4,n=5,a=function(e,t){void 0===e&&(e=i),void 0===t&&(t=n);var r=[],a=[],o=!0,s=function(){for(var t=function(){var e=r.pop();a.push(e),e.fn().then(function(){var t=a.indexOf(e);t>=0&&(a.splice(t,1),s())})};r.length>0&&a.length#."},jointNames:{type:"array",description:"Names of the joints in this skin.",items:{type:"string"},uniqueItems:!0,default:[]}}),required:["bindShapeMatrix","inverseBindMatrices","jointNames"]});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(32),a=i.__assign({},n.default,{id:"texture2DAsset",title:"Texture2DAssetDef",properties:i.__assign({},n.default.properties,{type:{enum:["texture2D"]},properties:{$ref:"texture2DAssetProperties.json"}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(22),a=i.__assign({},n.default,{id:"texture2DAssetProperties",title:"Texture2DAssetPropertiesDef"});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(32),a=i.__assign({},n.default,{id:"textureCubeAsset",title:"TextureCubeAssetDef",properties:i.__assign({},n.default.properties,{type:{enum:["textureCube"]},properties:{$ref:"textureCubeAssetProperties.json"}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(22),a=i.__assign({},n.default,{id:"textureCubeAssetProperties",title:"TextureCubeAssetPropertiesDef",properties:i.__assign({},n.default.properties,{mappingType:{type:"string",default:"cube"}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i={$schema:"http://json-schema.org/draft-04/schema",id:"vector3",title:"Vector3Def",type:"object",properties:{x:{type:"number"},y:{type:"number"},z:{type:"number"}},required:["x","y","z"],additionalProperties:!1};t.default=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i={$schema:"http://json-schema.org/draft-04/schema",id:"vector4",title:"Vector4Def",type:"object",properties:{x:{type:"number"},y:{type:"number"},z:{type:"number"},w:{type:"number"}},required:["x","y","z","w"],additionalProperties:!1};t.default=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(7),a=i.__assign({},n.default,{id:"videoAsset",title:"VideoAssetDef",type:"object",properties:i.__assign({},n.default.properties,{type:{enum:["video"]},representations:i.__assign({},n.default.properties.representations,{type:{$ref:"videoRepresentation.json"}}),properties:{$ref:"videoAssetProperties.json"}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(22),a=i.__assign({},n.default,{id:"videoAssetProperties",title:"VideoAssetPropertiesDef",properties:i.__assign({},n.default.properties,{autoPlay:{type:"boolean",default:!0},muted:{type:"boolean",default:!0},state:{type:"string",default:"play"},loop:{type:"boolean",default:!0},querySelector:{type:"string"}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(33),a=i.__assign({},n.default,{id:"videoRepresentation",title:"VideoRepresentationDef",properties:i.__assign({},n.default.properties,{video:{type:"object",properties:{height:{type:"integer"},width:{type:"integer"}}}})});t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){var e;try{e=window.WebGLRenderingContext?document.createElement("canvas").getContext("experimental-webgl"):void 0}catch(e){}var t=!!e,r=!!t&&!!e.getExtension("OES_texture_float"),i=!!t&&!(0===e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS));return e=void 0,{isWebGLEnabled:function(){return t},isFloatingPointTexturesEnabeled:function(){return r},isVertexTexturesEnabeled:function(){return i}}}()},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isObject=function(e){return"node"===e.type||"camera"===e.type||"scene"===e.type||"light"===e.type||"mesh"===e.type||"bone"===e.type},t.isAsset=function(e){return!t.isObject(e)}},function(e,t){var r={}.toString;e.exports=function(e){return r.call(e).slice(8,-1)}},function(e,t,r){var i=r(238);e.exports=function(e,t,r){if(i(e),void 0===t)return e;switch(r){case 1:return function(r){return e.call(t,r)};case 2:return function(r,i){return e.call(t,r,i)};case 3:return function(r,i,n){return e.call(t,r,i,n)}}return function(){return e.apply(t,arguments)}}},function(e,t){e.exports=function(e){try{return!!e()}catch(e){return!0}}},function(e,t){var r=0,i=Math.random();e.exports=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++r+i).toString(36))}},function(e,t,r){var i=r(253)("wks"),n=r(191),a=r(36).Symbol,o="function"==typeof a,s=e.exports=function(e){return i[e]||(i[e]=o&&a[e]||(o?a:n)("Symbol."+e))};s.store=i},function(e,t){function r(e,t){var r=t||0,n=i;return n[e[r++]]+n[e[r++]]+n[e[r++]]+n[e[r++]]+"-"+n[e[r++]]+n[e[r++]]+"-"+n[e[r++]]+n[e[r++]]+"-"+n[e[r++]]+n[e[r++]]+"-"+n[e[r++]]+n[e[r++]]+n[e[r++]]+n[e[r++]]+n[e[r++]]+n[e[r++]]}for(var i=[],n=0;n<256;++n)i[n]=(n+256).toString(16).substr(1);e.exports=r},function(e,t,r){(function(t){var r,i=t.crypto||t.msCrypto;if(i&&i.getRandomValues){var n=new Uint8Array(16);r=function(){return i.getRandomValues(n),n}}if(!r){var a=new Array(16);r=function(){for(var e,t=0;t<16;t++)0===(3&t)&&(e=4294967296*Math.random()),a[t]=e>>>((3&t)<<3)&255;return a}}e.exports=r}).call(t,r(76))},function(e,t,r){function i(e){return r(n(e))}function n(e){var t=a[e];if(!(t+1))throw new Error("Cannot find module '"+e+"'.");return t}var a={"./accessor":120,"./accessor.ts":120,"./animationAsset":121,"./animationAsset.ts":121,"./animationAssetProperties":122,"./animationAssetProperties.ts":122,"./animationChannel":123,"./animationChannel.ts":123,"./animationClip":124,"./animationClip.ts":124,"./animationLayer":125,"./animationLayer.ts":125,"./applicationAsset":126,"./applicationAsset.ts":126,"./applicationAssetProperties":127,"./applicationAssetProperties.ts":127,"./audioAsset":128,"./audioAsset.ts":128,"./audioAssetProperties":129,"./audioAssetProperties.ts":129,"./audioRepresentation":130,"./audioRepresentation.ts":130,"./baseAsset":7,"./baseAsset.ts":7,"./baseAssetProperties":8,"./baseAssetProperties.ts":8,"./baseEntity":41,"./baseEntity.ts":41,"./baseEntityProperties":42,"./baseEntityProperties.ts":42,"./baseGeometryAsset":30,"./baseGeometryAsset.ts":30,"./baseGeometryAssetProperties":31,"./baseGeometryAssetProperties.ts":31,"./baseImageAsset":70,"./baseImageAsset.ts":70,"./baseImageAssetProperties":71,"./baseImageAssetProperties.ts":71,"./baseObject":15,"./baseObject.ts":15,"./baseObjectProperties":72,"./baseObjectProperties.ts":72,"./baseRenderTextureAsset":43,"./baseRenderTextureAsset.ts":43,"./baseRenderTextureAssetProperties":44,"./baseRenderTextureAssetProperties.ts":44,"./baseTextureAsset":32,"./baseTextureAsset.ts":32,"./baseTextureAssetProperties":22,"./baseTextureAssetProperties.ts":22,"./boneObject":131,"./boneObject.ts":131,"./boneObjectProperties":132,"./boneObjectProperties.ts":132,"./box3":133,"./box3.ts":133,"./bufferAsset":134,"./bufferAsset.ts":134,"./bufferAssetProperties":135,"./bufferAssetProperties.ts":135,"./cameraObject":136,"./cameraObject.ts":136,"./cameraObjectProperties":137,"./cameraObjectProperties.ts":137,"./commonImageProperties":45,"./commonImageProperties.ts":45,"./component":138,"./component.ts":138,"./componentAttribute":139,"./componentAttribute.ts":139,"./documentAsset":140,"./documentAsset.ts":140,"./documentAssetProperties":141,"./documentAssetProperties.ts":141,"./dracoAttribute":142,"./dracoAttribute.ts":142,"./dracoGeometryAsset":143,"./dracoGeometryAsset.ts":143,"./dracoGeometryAssetProperties":144,"./dracoGeometryAssetProperties.ts":144,"./imageAsset":145,"./imageAsset.ts":145,"./imageAssetProperties":146,"./imageAssetProperties.ts":146,"./imageRepresentation":147,"./imageRepresentation.ts":147,"./index":4,"./index.ts":4,"./lightObject":148,"./lightObject.ts":148,"./lightObjectProperties":149,"./lightObjectProperties.ts":149,"./materialAsset":150,"./materialAsset.ts":150,"./materialAssetProperties":151,"./materialAssetProperties.ts":151,"./meshAttribute":152,"./meshAttribute.ts":152,"./meshGeometryAsset":153,"./meshGeometryAsset.ts":153,"./meshGeometryAssetProperties":154,"./meshGeometryAssetProperties.ts":154,"./meshObject":155,"./meshObject.ts":155,"./meshObjectProperties":156,"./meshObjectProperties.ts":156,"./meshPrimitive":157,"./meshPrimitive.ts":157,"./nodeObject":158,"./nodeObject.ts":158,"./nodeObjectProperties":18,"./nodeObjectProperties.ts":18,"./prefabAsset":159,"./prefabAsset.ts":159,"./prefabAssetProperties":160,"./prefabAssetProperties.ts":160,"./primitiveGeometryAsset":161,"./primitiveGeometryAsset.ts":161,"./primitiveGeometryAssetProperties":162,"./primitiveGeometryAssetProperties.ts":162,"./renderTexture2DAsset":163,"./renderTexture2DAsset.ts":163,"./renderTexture2DAssetProperties":164,"./renderTexture2DAssetProperties.ts":164,"./renderTextureCubeAsset":165,"./renderTextureCubeAsset.ts":165,"./renderTextureCubeAssetProperties":166,"./renderTextureCubeAssetProperties.ts":166,"./representation":33,"./representation.ts":33,"./sceneObject":167,"./sceneObject.ts":167,"./sceneObjectProperties":168,"./sceneObjectProperties.ts":168,"./scriptAsset":169,"./scriptAsset.ts":169,"./scriptAssetProperties":170,"./scriptAssetProperties.ts":170,"./shaderAsset":171,"./shaderAsset.ts":171,"./shaderAssetProperties":172,"./shaderAssetProperties.ts":172,"./shaderConditions":173,"./shaderConditions.ts":173,"./shaderParameter":174,"./shaderParameter.ts":174,"./skinAsset":175,"./skinAsset.ts":175,"./skinAssetProperties":176,"./skinAssetProperties.ts":176,"./texture2DAsset":177,"./texture2DAsset.ts":177,"./texture2DAssetProperties":178,"./texture2DAssetProperties.ts":178,"./textureCubeAsset":179,"./textureCubeAsset.ts":179,"./textureCubeAssetProperties":180,"./textureCubeAssetProperties.ts":180,"./vector3":181,"./vector3.ts":181,"./vector4":182,"./vector4.ts":182,"./videoAsset":183,"./videoAsset.ts":183,"./videoAssetProperties":184,"./videoAssetProperties.ts":184,"./videoRepresentation":185,"./videoRepresentation.ts":185};i.keys=function(){return Object.keys(a)},i.resolve=n,e.exports=i,i.id=195},function(e,t,r){"use strict";function i(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}Object.defineProperty(t,"__esModule",{value:!0});var n=r(1);t.THREE=n;var a=r(224);t.Components=a;var o=r(4);t.Schemas=o.default;var s=r(119);t.Engine=s.default;var u=r(78);t.ScriptRegistry=u.default;var p=r(9);t.BaseEntity=p.default;var c=r(49);t.AnimationAsset=c.default;var l=r(37);t.ApplicationAsset=l.default;var h=r(50);t.AudioAsset=h.default;var d=r(6);t.BaseAsset=d.default;var f=r(23);t.BaseGeometryAsset=f.default;var m=r(11);t.BaseImageAsset=m.default;var y=r(51);t.BaseRenderTextureAsset=y.default;var g=r(20);t.BaseTextureAsset=g.default;var v=r(21);t.BufferAsset=v.default;var b=r(77);t.DocumentAsset=b.default;var P=r(52);t.DracoGeometryAsset=P.default;var x=r(24);t.ImageAsset=x.default;var E=r(14);t.MaterialAsset=E.default;var w=r(53);t.MeshGeometryAsset=w.default;var S=r(54);t.PrefabAsset=S.default;var D=r(55);t.PrimitiveGeometryAsset=D.default;var _=r(56);t.RenderTexture2DAsset=_.default;var M=r(57);t.RenderTextureCubeAsset=M.default;var A=r(58);t.ScriptAsset=A.default;var T=r(38);t.ShaderAsset=T.default;var C=r(59);t.SkinAsset=C.default;var R=r(60);t.Texture2DAsset=R.default;var O=r(61);t.TextureCubeAsset=O.default;var I=r(25);t.VideoAsset=I.default;var k=r(10);t.BaseObject=k.default;var j=r(68);t.NodeObject=j.default;var L=r(66);t.BoneObject=L.default;var B=r(67);t.CameraObject=B.default;var N=r(39);t.LightObject=N.default;var V=r(27);t.MeshObject=V.default;var U=r(28);t.SceneObject=U.default;var z=r(17);t.LoadingType=z.default;var F=r(12);t.LoadingEvent=F.default;var G=r(69);t.LoadingState=G.default;var q=r(2);t.BaseComponent=q.default;var H=r(63);t.Handedness=H.Handedness;var $=r(64);t.RenderMode=$.RenderMode;var W=r(3);t.log=W.default;var X=r(221);t.XhrResourceLoader=X.default,i(r(16));var Q=r(47);t.globalEvents=Q.default;var Z=r(186);t.browserCaps=Z.default},function(e,t,r){r(258),e.exports=r(35).Array.find},function(e,t,r){r(259),e.exports=r(35).Math.log10},function(e,t,r){r(260),e.exports=r(35).Math.log2},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(1),n=function(){function e(){var e=this;this.defaultGeometry=new i.BufferGeometry,this.defaultGeometry.setIndex(new i.BufferAttribute(new Uint16Array(0),1));var t={position:new i.BufferAttribute(new Float32Array(0),3),normal:new i.BufferAttribute(new Float32Array(0),3,!0),skinWeight:new i.BufferAttribute(new Float32Array(0),4,!0),skinIndex:new i.BufferAttribute(new Uint16Array(0),4,!0)};Object.keys(t).forEach(function(r){var i=t[r];e.defaultGeometry.addAttribute(r,i)})}return e.prototype.destroy=function(){this.defaultGeometry&&(this.defaultGeometry.dispose(),this.defaultGeometry=void 0)},e.prototype.getDefaultGeometry=function(){return this.defaultGeometry},e}();t.default=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(1),n=r(34),a=function(){function e(){this.components=[]}return e.prototype.initializeComponents=function(){this.listenTo(this.engine,"scriptDeleted",this.onScriptDeleted),this.listenTo(this,"change:component",this.onComponentChanged),this.listenTo(this,"remove:component",this.onComponentRemoved),this.listenTo(this,"add:component",this.onComponentAdded)},e.prototype.getComponentDescriptor=function(e){var t="function"!=typeof e,r=this.sharedData.components;return n.default(r.find(function(r){return t||e(r)}))},e.prototype.getPreviousComponentDescriptor=function(e){var t="function"!=typeof e,r=this.sharedData.previousComponents;return n.default(r.find(function(r){return t||e(r)}))},e.prototype.getComponentDescriptors=function(e){var t="function"!=typeof e,r=this.sharedData.components;return r.filter(function(r){return t||e(r)}).map(function(e){return n.default(e)})},e.prototype.getComponentDescriptorById=function(e){return this.getComponentDescriptor(function(t){return t.id===e})},e.prototype.getPreviousComponentDescriptorById=function(e){return this.getPreviousComponentDescriptor(function(t){return t.id===e})},e.prototype.addComponent=function(e,t,r){void 0===t&&(t={}),void 0===r&&(r="");var i={scriptId:"string"==typeof e?e:e.id,attributes:t,enabled:!0,name:r},n=this.engine.entityDispatcher;return n.dispatchComponentAdded(this.id,i),this.components[this.components.length-1]},e.prototype.removeComponent=function(e){var t=e.getIndex();return t>=0&&(this.engine.entityDispatcher.dispatchComponentRemoved(this.id,t),!0)},e.prototype.getComponentByIndex=function(e){return this.components[e]||null},e.prototype.getComponentByName=function(e){return this.getComponent(function(t){return t.getName()===e})},e.prototype.getComponentsByName=function(e){return this.getComponents(function(t){return t.getName()===e})},e.prototype.getComponentByScriptId=function(e){return this.getComponent(function(t){return t.getScriptId()===e})},e.prototype.getComponentsByScriptId=function(e){return this.getComponents(function(t){return t.getScriptId()===e})},e.prototype.getComponentByScriptName=function(e){return this.getComponent(function(t){return t.getScriptName()===e})},e.prototype.getComponentsByScriptName=function(e){return this.getComponents(function(t){return t.getScriptName()===e})},e.prototype.getComponent=function(e){var t="function"!=typeof e;return this.components.find(function(r){return t||e(r)})},e.prototype.getComponentById=function(e){return this.getComponent(function(t){return t.getId()===e})},e.prototype.getComponents=function(e){var t="function"!=typeof e;return this.components.filter(function(r){return t||e(r)})},e.prototype.setComponents=function(e,t){var r=this;void 0===t&&(t=!1);for(var i=this.engine.entityDispatcher,n=this.sharedData.components.length;n>=0;n--)i.dispatchComponentRemoved(this.id,n);e.forEach(function(e){i.dispatchComponentAdded(r.id,e)})},e.prototype.startComponents=function(){var e=this;this.components.forEach(function(t){return e.startComponent(t)})},e.prototype.stopComponents=function(){var e=this;this.components.forEach(function(t){return e.stopComponent(t)})},e.prototype.onScriptDeleted=function(e){var t=this,r=this.getComponentsByScriptId(e);r.forEach(function(e){t.removeComponent(e)})},e.prototype.onComponentChanged=function(e,t){var r=this.getComponentByIndex(e);if(!r)throw new Error("Don't have a component at index "+e);if(t.attributes){this.assignAttributeValues(r,t.attributes);var i=Object.keys(t.attributes);r.trigger("attributesChanged",i)}},e.prototype.onComponentAdded=function(e){var t=this.createComponentObject(e);t.trigger("awake"),this.assignAttributeValues(t);var r=t.getScriptAsset(),i=Object.keys(r.getProperty("attributes"));t.trigger("attributesChanged",i),this.isBaseUnloaded()||this.startComponent(t,!1)},e.prototype.onComponentRemoved=function(e){var t=this.components[e];if(!t)throw new Error("Can't find component at index "+e+" to remove.");this.stopComponent(t),this.components.splice(e,1)},e.prototype.translateAttributeValue=function(e,t,r,n){var a=this,o=this.engine;if(!r)throw new Error("Attribute "+t+" does not exist for this component.");switch(r.type){case"asset":e[t]=o.getAssetById(n);break;case"object":e[t]=o.getObjectById(n);break;case"custom":e[t]=e[t]||{},Object.keys(n).forEach(function(i){a.translateAttributeValue(e[t],i,r.attributes[i],n[i])});break;case"c":e[t]=e[t]||new i.Color,e[t].setRGB(n.r,n.g,n.b);break;case"a":e[t]=e[t]||[];var s;switch(r.subType.type){case"asset":n.forEach(function(r,i){e[t][i]=o.getAssetById(r)});break;case"object":n.forEach(function(r,i){e[t][i]=o.getObjectById(r)});break;case"custom":n.forEach(function(i,o){e[t][o]=e[t][o]||{},Object.keys(i).forEach(function(i){a.translateAttributeValue(e[t][o],i,r.subType.attributes[i],n[o][i])})});break;case"a":n.forEach(function(i,o){e[t][o]=e[t][o]||[],i.forEach(function(i,s){a.translateAttributeValue(e[t][o],s.toString(10),r.subType.subType,n[o][s])})});break;case"v2":s=i.Vector2;case"v3":s=s?s:i.Vector3;case"v4":s=s?s:i.Vector4;case"q":s=s?s:i.Quaternion,n.forEach(function(r,i){e[t][i]=e[t][i]||new s,e[t][i].copy(r)});break;default:n.forEach(function(r,i){e[t][i]=r})}break;case"v2":s=i.Vector2;case"v3":s=s?s:i.Vector3;case"v4":s=s?s:i.Vector4;case"q":s=s?s:i.Quaternion,e[t]=e[t]||new s,e[t].copy(n);break;default:e[t]=n}},e.prototype.assignAttributeValues=function(e,t){var r=this,i="object"!=typeof t,n=e.getScriptAsset(),a=n.getProperty("attributes")||{};Object.keys(a).forEach(function(n){if(i||t.hasOwnProperty(n)){var o=a[n],s=e.getAttribute(o.name);r.translateAttributeValue(e,o.name,o,s)}})},e.prototype.createComponentObject=function(e){var t=e.scriptId,r=this.engine.getAssetById(t);if(!r)throw new Error("Unable to find script asset for "+t);r.isUnloaded()&&r.load();var i=new r.sharedData.classConstructor;return this.components.push(i),Object.assign(i,{id:e.id,name:e.name,scriptName:r.getName(),scriptId:t,enabled:!!e.enabled,entity:this}),i},e.prototype.startComponent=function(e,t){if(void 0===t&&(t=!0),t){var r=e.getScriptAsset(),i=Object.keys(r.getProperty("attributes"));this.assignAttributeValues(e),e.trigger("attributesChanged",i)}e.trigger("startup")},e.prototype.stopComponent=function(e){e.trigger("shutdown")},e}();t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(9),n=r(3),a=function(){function e(){this.ownDependencies={},this.dependencies={}}return e.prototype.getOwnDependencies=function(){var e=this;return Object.keys(this.ownDependencies).map(function(t){return e.engine.getEntityById(t)}).filter(function(e){return e})},e.prototype.getOwnDependencyInfo=function(){return this.ownDependencies},e.prototype.getDependencies=function(e){var t=this,r="function"!=typeof e;return Object.keys(this.dependencies).map(function(e){return t.engine.getEntityById(e)}).filter(function(t){return r||e(t)})},e.prototype.getDependenciesByClass=function(e){return this.getDependencies(function(t){return t instanceof e})},e.prototype.getDependenciesByType=function(e){return this.getDependencies(function(t){return t.type===e})},e.prototype.getDependencyInfo=function(){return this.dependencies},e.prototype.registerDependencyById=function(e){this.registerDependency(this.engine.getEntityById(e))},e.prototype.registerDependency=function(e){var t=this;if(!e)return void n.default.warn("Trying to register invalid entity as a dependency.");var r=this.getOwnDependencyInfo(),a=e.id;r[a]?r[a].count++:(r[a]={count:1},r[a].onSubDependencyChange=function(e,i){if(r[a])for(var n=0;n=r.components.length-1)){var i=Math.min(Math.max(t,0),r.components.length-1);i<0||(r.previousComponents=r.components?r.components.slice():[],r.components.splice(i,1),this.fireExternalUpdate(e,{components:r.components}),this.engines.forEach(function(t){var r=t.getEntityById(e);r.trigger("remove:component",i)}))}},e.prototype.dispatchComponentAdded=function(e,t){var r=this.entities[e];if(r){r.previousComponents=r.components?r.components.slice():[];var i=a.default(t);i.id=i.id||n.v4(),i.name=i.name||"unnamed component",i.attributes=i.attributes||{},i.enabled=i.enabled!==!1,r.components.push(i),this.fireExternalUpdate(e,{components:r.components}),this.engines.forEach(function(t){var r=t.getEntityById(e);r.trigger("add:component",i)})}},e.prototype.fireExternalUpdate=function(e,t,r){var i=new u.default;i.type=r?r:"updateEntity",i.entityId=e,i.entityData=t,o.default.trigger("EntityUpdates",i)},e}();t.default=p},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(49),n=r(37),a=r(50),o=r(6),s=r(66),u=r(21),p=r(67),c=r(77),l=r(52),h=r(24),d=r(39),f=r(14),m=r(27),y=r(53),g=r(68),v=r(54),b=r(55),P=r(56),x=r(57),E=r(28),w=r(58),S=r(38),D=r(59),_=r(60),M=r(61),A=r(25),T=function(){function e(){this.objects={},this.assets={}}return e.prototype.destroy=function(){var e=this;this.getAssets().forEach(function(t){return e.unregisterEntity(t)}),this.getObjects().forEach(function(t){return e.unregisterEntity(t)})},e.prototype.getAsset=function(e){return this.getEntity(e,this.assets)},e.prototype.getAssets=function(e){return this.getEntities(e,this.assets)},e.prototype.getAssetById=function(e){return this.assets[e]||null},e.prototype.getAssetByName=function(e){return this.getAsset(function(t){return t.getName()===e})},e.prototype.getAssetsByName=function(e){return this.getAssets(function(t){return t.getName()===e})},e.prototype.getAssetByClass=function(e){return this.getAsset(function(t){return t instanceof e})},e.prototype.getAssetByType=function(e){return this.getAsset(function(t){return t.type===e})},e.prototype.getAssetsByClass=function(e){return this.getAssets(function(t){return t instanceof e})},e.prototype.getAssetsByType=function(e){return this.getAssets(function(t){return t.type===e})},e.prototype.getObject=function(e){return this.getEntity(e,this.objects)},e.prototype.getObjects=function(e){return this.getEntities(e,this.objects)},e.prototype.getObjectById=function(e){return this.objects[e]||null},e.prototype.getObjectByName=function(e){return this.getObject(function(t){return t.getName()===e})},e.prototype.getObjectsByName=function(e){return this.getObjects(function(t){return t.getName()===e})},e.prototype.getObjectByClass=function(e){return this.getObject(function(t){return t instanceof e})},e.prototype.getObjectByType=function(e){return this.getObject(function(t){return t.type===e})},e.prototype.getObjectsByType=function(e){return this.getObjects(function(t){return t.type===e})},e.prototype.getObjectsByClass=function(e){return this.getObjects(function(t){return t instanceof e})},e.prototype.getEntity=function(e,t){if(!t)return this.getAsset(e)||this.getObject(e);var r=Object.keys(t).find(function(r){return e(t[r])});return t[r]},e.prototype.getEntities=function(e,t){if(!t)return this.getObjects(e).concat(this.getAssets(e));var r="function"!=typeof e;return Object.keys(t).filter(function(i){return r||e(t[i])}).map(function(e){return t[e]})},e.prototype.getEntityById=function(e){return this.assets[e]||this.objects[e]||null},e.prototype.getEntityByClass=function(e){return this.getEntity(function(t){return t instanceof e})},e.prototype.getEntityByType=function(e){return this.getEntity(function(t){return t.type===e})},e.prototype.getEntitiesByClass=function(e){return this.getEntities(function(t){return t instanceof e})},e.prototype.getEntitiesByType=function(e){return this.getEntities(function(t){return t.type===e})},e.prototype.getEntityByName=function(e){return this.getEntity(function(t){return t.getName()===e})},e.prototype.getEntitiesByName=function(e){return this.getEntities(function(t){return t.getName()===e})},e.prototype.unregisterEntityById=function(e){this.unregisterEntity(this.getEntityById(e))},e.prototype.unregisterEntity=function(e){e&&(e.uninitialize(),this.objects[e.id]?delete this.objects[e.id]:(e.off("load",this.onAssetLoaded,this),e.off("unload",this.onAssetUnloaded,this),delete this.assets[e.id]))},e.prototype.getClassType=function(e){switch(e){case i.default:return"animation";case n.default:return"application";case a.default:return"audio";case s.default:return"bone";case u.default:return"buffer";case p.default:return"camera";case c.default:return"document";case l.default:return"dracoGeometry";case h.default:return"image";case d.default:return"light";case f.default:return"material";case m.default:return"mesh";case y.default:return"meshGeometry";case g.default:return"node";case v.default:return"prefab";case b.default:return"primitiveGeometry";case P.default:return"renderTexture2D";case x.default:return"renderTextureCube";case E.default:return"scene";case w.default:return"script";case S.default:return"shader";case D.default:return"skin";case _.default:return"texture2D";case M.default:return"textureCube";case A.default:return"video";default:return null}},e.prototype.getEntityClass=function(t){return e.entityNameTypeMap[t]?e.entityNameTypeMap[t]:null},e.prototype.registerEntity=function(e){var t=new(this.getEntityClass(e.type))(e);t.engine=this,t instanceof o.default?(this.assets[t.id]=t,t.on("load",this.onAssetLoaded,this),t.on("unload",this.onAssetUnloaded,this)):this.objects[t.id]=t},e.prototype.onAssetLoaded=function(e){this.trigger("assetLoaded",e)},e.prototype.onAssetUnloaded=function(e){this.trigger("assetUnloaded",e)},e}();T.entityNameTypeMap={animation:i.default,application:n.default,audio:a.default,bone:s.default,buffer:u.default,camera:p.default,document:c.default,dracoGeometry:l.default,image:h.default,light:d.default,material:f.default,mesh:m.default,meshGeometry:y.default,node:g.default,prefab:v.default,primitiveGeometry:b.default,renderTexture2D:P.default,renderTextureCube:x.default,scene:E.default,script:w.default,shader:S.default,skin:D.default,texture2D:_.default,textureCube:M.default,video:A.default},t.default=T},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(){this.type="updateEntity",this.entityId="",this.entityData={}}return e}();t.default=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(){}return e}();t.default=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(1),n=r(209),a=r(231),o=r(230),s={id:"box3d_pbr_shader",type:"shader",properties:{name:"PBR Shader",vertexShader:a,fragmentShader:o,features:{albedo:{displayName:"Albedo",defaultEnabled:!0,parameters:["albedoColor","albedoMap","aoMap","envMapIrradiance"]},transparency:{displayName:"Transparency",defaultEnabled:!1,parameters:["opacity","alphaMap","blending","blendEquation","blendSrc","blendDst","useSeparateAlphaBlend","blendEquationAlpha","blendSrcAlpha","blendDstAlpha"]},specular:{displayName:"Specular",defaultEnabled:!1,parameters:["specularColor","specularMap","glossMap","roughness","roughnessMap","reflectivity","envMapGlossVariance","envMapRadiance","envMapRadianceHalfGloss"]},clearCoat:{displayName:"Clear Coat",defaultEnabled:!1,parameters:["clearCoat","clearCoatRoughness"]},metalness:{displayName:"Metalness",defaultEnabled:!1,parameters:["metalness","metalnessMap"]},normals:{displayName:"Bump/Normals",defaultEnabled:!1,parameters:["normalMap","normalScale","bumpMap","bumpScale"]},emissive:{displayName:"Emissive",defaultEnabled:!1,parameters:["emissiveColor","emissiveMap"]},rendering:{displayName:"Render Parameters",alwaysEnabled:!0,parameters:["fog","side","depthWrite","depthTest","depthFunc","alphaTest","polygonOffset","polygonOffsetFactor","polygonOffsetUnits"]}},parameters:n.default,uniforms:i.UniformsUtils.merge([i.UniformsLib.common,i.UniformsLib.emissivemap,i.UniformsLib.bumpmap,i.UniformsLib.normalmap,i.UniformsLib.roughnessmap,i.UniformsLib.metalnessmap,i.UniformsLib.displacementmap,i.UniformsLib.fog,i.UniformsLib.lights,{time:{value:1},emissive:{value:new i.Color(0)},specular:{value:new i.Color(1118481)},roughness:{value:0},metalness:{value:0},clearCoat:{value:0},clearCoatRoughness:{value:0},envMapIntensity:{value:1}}])}};t.default=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(1),n={albedoColor:{displayName:"Base Albedo",description:"A color to tint the material with.",type:"c",default:{r:1,g:1,b:1},min:0,max:1,isUniform:!0,uniformName:"diffuse"},albedoMap:{displayName:"Albedo Map",description:"A texture that modifies the diffuse color of the material.",type:"t",default:null,isUniform:!0,isRenderParam:!0,uniformName:"map",enabledWhen:{albedoMap:{notEqualsDefault:!0}}},opacity:{displayName:"Opacity",description:"This option controls the total opacity of the material.",type:"f",default:1,min:0,max:1,isUniform:!0,isRenderParam:!0,transparency:"LessThanOne"},alphaMap:{displayName:"Alpha Map",description:"A texture that stores the transparency info of the material.",type:"t",default:null,isUniform:!0,isRenderParam:!0,enabledWhen:{alphaMap:{notEqualsDefault:!0}}},specularColor:{displayName:"Specular Color",description:"A color to tint the material with.",type:"c",default:{r:1,g:1,b:1},min:0,max:1,isUniform:!0,uniformName:"specular"},specularMap:{displayName:"Specular Map",description:"A texture that contains the specular color of the material.",type:"t",default:null,isUniform:!0,isRenderParam:!0,enabledWhen:{specularMap:{notEqualsDefault:!0}}},metalness:{displayName:"Metalness",description:"How metallic the surface appears (multiplied by the metalness texture).",type:"f",min:0,max:1,default:0,isUniform:!0},metalnessMap:{displayName:"Metalness Map",description:"A texture that contains the metalness of the material.",type:"t",default:null,isUniform:!0,isRenderParam:!0,enabledWhen:{metalnessMap:{notEqualsDefault:!0}}},glossMap:{displayName:"Gloss Map",description:"A texture that stores the gloss info of the material.",type:"t",default:null,isUniform:!0,enabledWhen:{glossMap:{notEqualsDefault:!0},roughnessMap:{equalsDefault:!0}}},roughness:{displayName:"Roughness",description:"How rough the surface appears.",type:"f",min:0,max:1,default:0,isUniform:!0,isRenderParam:!0},roughnessMap:{displayName:"Roughness Map",description:"A texture that stores the roughness info of the material.",type:"t",default:null,isUniform:!0,isRenderParam:!0,enabledWhen:{roughnessMap:{notEqualsDefault:!0}}},reflectivity:{displayName:"Reflectivity",description:"Reflectivity at normal incidence. i.e. when viewing the surface directly.",type:"f",min:0,max:1,default:.02,isUniform:!0,isRenderParam:!0,uniformName:"reflectivity"},normalMap:{displayName:"Normal Map",description:"",type:"t",default:null,isUniform:!0,isRenderParam:!0,derivatives:!0,textureUsage:"normal",enabledWhen:{normalMap:{notEqualsDefault:!0}}},normalScale:{displayName:"Normal Scale",description:"blah",type:"v2",default:{x:1,y:1},isUniform:!0,isRenderParam:!0},bumpMap:{displayName:"Bump Map",description:"",type:"t",default:null,isUniform:!0,isRenderParam:!0,derivatives:!0,textureUsage:"bump",enabledWhen:{normalMap:{equalsDefault:!0},bumpMap:{notEqualsDefault:!0}}},bumpScale:{displayName:"Bump Scale",description:"blah",type:"f",min:0,max:20,default:1,isUniform:!0,isRenderParam:!0,enabledWhen:{normalMap:{equalsDefault:!0},bumpMap:{notEqualsDefault:!0}},displayWhen:{useBump:{equals:!0}}},clearCoat:{displayName:"Clear Coat",type:"f",min:0,max:1,isUniform:!0,isRenderParam:!0,default:0},clearCoatRoughness:{displayName:"Clear Coat",type:"f",min:0,max:1,isUniform:!0,isRenderParam:!0,default:0},envMapRadiance:{displayName:"Specular Light Map",description:"A map that represents the surrounding environment. Used for reflections.",type:"t",default:null,isUniform:!0,forceUpdate:!0,enabledWhen:{envMapRadiance:{notEqualsDefault:!0}}},envMapRadianceHalfGloss:{displayName:"Specular Light Map",description:"A cube-map that represents the surrounding environment. Used for reflections.",type:"t",textureType:"Cube",default:null,isUniform:!0,enabledWhen:{envMapIrradiance:{notEqualsDefault:!0},envMapRadiance:{notEqualsDefault:!0},envMapRadianceHalfGloss:{notEqualsDefault:!0}}},envMapIrradiance:{displayName:"Specular Light Map",description:"A cube-map that represents the surrounding environment. Used for reflections.",type:"t",textureType:"Cube",default:null,isUniform:!0,enabledWhen:{envMapIrradiance:{notEqualsDefault:!0}},displayWhen:{envMapIrradiance:{notEqualsDefault:!0}}},envMapGlossVariance:{displayName:"Environment Map Gloss Variance",description:"Turn on multi-sampling of environment map based on varying glossiness of surface.",type:"b",default:!0,forceUpdate:!0,enabledWhen:{envMapGlossVariance:{equals:!0}}},emissiveColor:{displayName:"Emissive Color",description:"A color that represents the light emitted by the material.",type:"c",default:{r:0,g:0,b:0},isUniform:!0,isRenderParam:!0,uniformName:"emissive"},emissiveMap:{displayName:"Emissive Map",description:"A texture that modifies the emissive color of the material.",type:"t",default:null,isUniform:!0,isRenderParam:!0,enabledWhen:{emissiveMap:{notEqualsDefault:!0}}},aoMap:{displayName:"AO Map",description:"The ambient occlusion of the material.",type:"t",default:null,isUniform:!0,enabledWhen:{aoMap:{notEqualsDefault:!0}}},side:{displayName:"Cull Mode",description:"This controls which side of the geometry will be visible.",type:"opt",isRenderParam:!0,options:{frontOnly:i.FrontSide,backOnly:i.BackSide,doubleSided:i.DoubleSide},default:"doubleSided"},fog:{displayName:"Enable Fog",description:"This controls whether this material is affected by fog or not.",isRenderParam:!0,forceUpdate:!0,type:"b",default:!0},depthFunc:{displayName:"Depth Function",description:"",isRenderParam:!0,type:"opt",options:{never:i.NeverDepth,always:i.AlwaysDepth,lessThan:i.LessDepth,lessThanOrEqual:i.LessEqualDepth,equal:i.EqualDepth,greaterThanOrEqual:i.GreaterEqualDepth,greaterThan:i.GreaterDepth,notEqual:i.NotEqualDepth},default:"lessThanOrEqual"},depthWrite:{displayName:"Enable Depth Write",description:"This controls whether the depth values of a mesh rendered with this material are recorded.",isRenderParam:!0,type:"b",default:!0},depthTest:{displayName:"Enable Depth Test",description:"This controls whether a depth check is done before this material is rendered so that it can be occluded.",isRenderParam:!0,type:"b",default:!0},blending:{displayName:"Blending Mode",description:"This controls how the material will be blended with the color behind it.",isRenderParam:!0,type:"opt",options:{none:i.NoBlending,normal:i.NormalBlending,additive:i.AdditiveBlending,subtractive:i.SubtractiveBlending,multiplicative:i.MultiplyBlending,custom:i.CustomBlending},default:"normal",transparency:"GreaterThanOne"},blendEquation:{displayName:"Blending Equation",description:"TODO.",isRenderParam:!0,type:"opt",options:{add:i.AddEquation,subtract:i.SubtractEquation,reverseSubtract:i.ReverseSubtractEquation,minimum:i.MinEquation,maximum:i.MaxEquation},default:"add",displayWhen:{blending:{equals:"custom"}}},blendSrc:{displayName:"Blend Source",description:"TODO.",isRenderParam:!0,type:"opt",options:{zero:i.ZeroFactor,one:i.OneFactor,sourceColor:i.SrcColorFactor,oneMinusSourceColor:i.OneMinusSrcColorFactor,sourceAlpha:i.SrcAlphaFactor,oneMinusSourceAlpha:i.OneMinusSrcAlphaFactor,destinationAlpha:i.DstAlphaFactor,oneMinusDestinationAlpha:i.OneMinusDstAlphaFactor},default:"sourceAlpha",displayWhen:{blending:{equals:"custom"}}},blendDst:{displayName:"Blend Destination",description:"TODO.",isRenderParam:!0,type:"opt",options:{zero:i.ZeroFactor,one:i.OneFactor,sourceColor:i.SrcColorFactor,oneMinusSourceColor:i.OneMinusSrcColorFactor,sourceAlpha:i.SrcAlphaFactor,oneMinusSourceAlpha:i.OneMinusSrcAlphaFactor,destinationAlpha:i.DstAlphaFactor,oneMinusDestinationAlpha:i.OneMinusDstAlphaFactor,destinationColor:i.DstColorFactor,oneMinusDestinationColor:i.OneMinusDstColorFactor,sourceAlphaSaturate:i.SrcAlphaSaturateFactor},default:"one",displayWhen:{blending:{equals:"custom"}}},useSeparateAlphaBlend:{displayName:"Separate Blend for Alpha",description:"TODO",type:"b",default:!1,displayWhen:{blending:{equals:"custom"}}},blendEquationAlpha:{displayName:"Alpha Blend Equation",description:"TODO",isRenderParam:!0,type:"opt",options:{add:i.AddEquation,subtract:i.SubtractEquation,reverseSubtract:i.ReverseSubtractEquation,minimum:i.MinEquation,maximum:i.MaxEquation},default:"add",displayWhen:{blending:{equals:"custom"},useSeparateAlphaBlend:{equals:!0}},enabledWhen:{useSeparateAlphaBlend:{equals:!0}}},blendSrcAlpha:{displayName:"Alpha Blend Source",description:"TODO.",isRenderParam:!0,type:"opt",options:{zero:i.ZeroFactor,one:i.OneFactor,sourceColor:i.SrcColorFactor,oneMinusSourceColor:i.OneMinusSrcColorFactor,sourceAlpha:i.SrcAlphaFactor,oneMinusSourceAlpha:i.OneMinusSrcAlphaFactor,destinationAlpha:i.DstAlphaFactor,oneMinusDestinationAlpha:i.OneMinusDstAlphaFactor},default:"sourceAlpha",displayWhen:{blending:{equals:"custom"},useSeparateAlphaBlend:{equals:!0}},enabledWhen:{useSeparateAlphaBlend:{equals:!0}}},blendDstAlpha:{displayName:"Alpha Blend Destination",description:"TODO.",isRenderParam:!0,type:"opt",options:{zero:i.ZeroFactor,one:i.OneFactor,sourceColor:i.SrcColorFactor,oneMinusSourceColor:i.OneMinusSrcColorFactor,sourceAlpha:i.SrcAlphaFactor,oneMinusSourceAlpha:i.OneMinusSrcAlphaFactor,destinationAlpha:i.DstAlphaFactor,oneMinusDestinationAlpha:i.OneMinusDstAlphaFactor,destinationColor:i.DstColorFactor,oneMinusDestinationColor:i.OneMinusDstColorFactor,sourceAlphaSaturate:i.SrcAlphaSaturateFactor},default:"one",displayWhen:{blending:{equals:"custom"},useSeparateAlphaBlend:{equals:!0}},enabledWhen:{useSeparateAlphaBlend:{equals:!0}}},polygonOffset:{displayName:"Polygon Offset",description:"Turns on rendering with polygon offsets. This can be used to work around z-fighting.",isRenderParam:!0,type:"b",default:!1},polygonOffsetFactor:{displayName:"Polygon Offset Factor",description:"Scales the maximum Z slope, with respect to X or Y of the polygon.",isRenderParam:!0,type:"f",default:1},polygonOffsetUnits:{displayName:"Polygon Offset Units",description:"Scales the minimum resolvable depth buffer value.",isRenderParam:!0,type:"f",default:1},alphaTest:{displayName:"Alpha Test",description:'Pixels with an alpha value below the given value will not be rendered. This value will only be used when this material\'s Transparency blending mode is set to "Masked"',isRenderParam:!0,forceUpdate:!0,type:"f",default:.2,min:0,max:1,step:.001}};t.default=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(14),n=r(20),a=function(){function e(e){this.engine=e,this.standInTextures=[],this.engine=e,this.engine.on("rebuildMaterials",this.rebuildAll,this),this.engine.on("resize",this.onResize,this),this.engine.on("update",this.update,this),this.standInTextures[i.StandInTexture.STANDIN_TEXTURE_WHITE]={texture:null,color:[255,255,255]},this.standInTextures[i.StandInTexture.STANDIN_TEXTURE_WHITE_CUBE]={texture:null,color:[255,255,255],type:"Cube"},this.standInTextures[i.StandInTexture.STANDIN_TEXTURE_BLACK]={texture:null,color:[0,0,0]},this.standInTextures[i.StandInTexture.STANDIN_TEXTURE_BLACK_CUBE]={texture:null,color:[0,0,0],type:"Cube"},this.standInTextures[i.StandInTexture.STANDIN_TEXTURE_NORMAL]={texture:null,color:[127,127,255]}}return e.prototype.destroy=function(){this.engine.off("rebuildMaterials",this.rebuildAll,this),this.engine.off("resize",this.onResize,this),this.engine.off("update",this.update,this),this.standInTextures.forEach(function(e){e.texture&&e.texture.dispose()})},e.prototype.getMissingMaterial=function(){return this.engine.getAssetById("missingMaterial")},e.prototype.getStandInTexture=function(e){if(!this.standInTextures[e])return null;if(!this.standInTextures[e].texture){var t=this.standInTextures[e].color;"Cube"===this.standInTextures[e].type?this.standInTextures[e].texture=n.default.createColorTextureCube(t[0],t[1],t[2]):this.standInTextures[e].texture=n.default.createColorTexture(t[0],t[1],t[2])}return this.standInTextures[e].texture},e.prototype.update=function(e){i.default.timeValueInUse&&(this.engine.needsRender=!0),i.default.sharedUniforms.time.value=e},e.prototype.rebuildAll=function(){var e=this.engine.getAssetsByClass(i.default);e.forEach(function(e){e.runtimeData&&Object.keys(i.default.materialObjectTypes).forEach(function(t){e.runtimeData[t].needsUpdate=!0})})},e.prototype.onResize=function(){var e=i.default.sharedUniforms.screenDimensions;e.value.x=0,e.value.y=0;var t=this.engine.getRenderer();t?(e.value.z=t.getCanvasWidth(),e.value.w=t.getCanvasHeight()):(e.value.z=128,e.value.w=128); +},e}();t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:["varying vec2 vUv;","void main() {","vUv = uv;","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform float opacity;","uniform sampler2D tDiffuse;","varying vec2 vUv;","void main() {","vec4 texel = texture2D( tDiffuse, vUv );","gl_FragColor = opacity * texel;","}"].join("\n")}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(1),n=function(){function e(e,t){void 0===t&&(t="tDiffuse"),this.enabled=!0,this.needsSwap=!0,this.renderToScreen=!1,this.clear=!1,this.textureId=t,this.uniforms=i.UniformsUtils.clone(e.uniforms),this.material=new i.ShaderMaterial({blending:i.NormalBlending,transparent:!0,uniforms:this.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader}),this.camera=new i.OrthographicCamera(-1,1,1,-1,0,1),this.scene=new i.Scene,this.quad=new i.Mesh(new i.PlaneGeometry(2,2),null),this.scene.add(this.quad),this.prevViewPort=new i.Vector4}return e.prototype.render=function(e,t,r,i){this.uniforms[this.textureId]&&(this.uniforms[this.textureId].value=r),this.quad.material=this.material,this.renderToScreen?(this.viewPort&&e.setViewport(this.viewPort.x,this.viewPort.y,this.viewPort.width,this.viewPort.height),(this.clearColor||this.clearDepth)&&e.clear(!!this.clearColor,!!this.clearDepth,!1),e.render(this.scene,this.camera)):this.renderToTexture?((this.clearColor||this.clearDepth)&&e.clear(this.clearColor,this.clearDepth,!1),e.render(this.scene,this.camera,this.renderToTexture)):e.render(this.scene,this.camera,t,this.clear)},e.prototype.dispose=function(){this.quad.geometry.dispose(),this.quad=void 0,this.camera=void 0,this.scene=void 0,this.material.dispose(),this.material=void 0,this.uniforms=void 0},e}();t.default=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={uniforms:{tDiffuse:{type:"t",value:null},rgbmMultiplier:{type:"f",value:9}},vertexShader:["varying vec2 vUv;","void main() {","vUv = uv;","#ifdef FLIP_Y","vUv.y = 1.0 - vUv.y;","#endif","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform sampler2D tDiffuse;","uniform float rgbmMultiplier;","const mat3 InverseLogLuvMatrix = mat3(","6.0014, -2.7008, -1.7996,","-1.3320, 3.1029, -5.7721,","0.3008, -1.0882, 5.6268);","vec3 HDRDecodeLOGLUV(in vec4 vLogLuv)","{","float Le = vLogLuv.z * 255.0 + vLogLuv.w;","vec3 Xp_Y_XYZp;","Xp_Y_XYZp.y = exp2((Le - 127.0) / 2.0);","Xp_Y_XYZp.z = Xp_Y_XYZp.y / vLogLuv.y;","Xp_Y_XYZp.x = vLogLuv.x * Xp_Y_XYZp.z;","vec3 vRGB = InverseLogLuvMatrix * Xp_Y_XYZp;","return vRGB;","}","vec3 HDRDecodeRGBM( vec4 rgbm ) {","return rgbmMultiplier * rgbm.rgb * rgbm.a;","}","vec3 HDRDecodeRGBD( vec4 rgbd ) {","return rgbd.rgb / max(rgbd.a, 0.003);","}","vec3 HDRDecodeRGBE( vec4 rgbe ) {","float f = exp2( rgbe.w * 255.0 - (128.0 + 0.0) );","return rgbe.rgb * f;","}","varying vec2 vUv;","void main() {","vec3 hdrColour;","#ifdef HDR_RGBM","hdrColour = HDRDecodeRGBM( texture2D( tDiffuse, vUv ) );","#elif defined(HDR_RGBD)","hdrColour = HDRDecodeRGBD( texture2D( tDiffuse, vUv ) );","#elif defined(HDR_RGBE)","hdrColour = HDRDecodeRGBE( texture2D( tDiffuse, vUv ) );","#elif defined(HDR_LOGLUV)","hdrColour = HDRDecodeLOGLUV( texture2D( tDiffuse, vUv ) );","#else","hdrColour = texture2D( tDiffuse, vUv ).xyz;","#endif","gl_FragColor = vec4( hdrColour, 1.0 );","}"].join("\n")}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(29),a=r(69),o=r(12),s=r(220),u=r(46);t.loadableResourceMixins=u.default({},[n.default]);var p=function(e){function t(t,r,i){void 0===i&&(i={});var n=e.call(this)||this;if(n.path=t,n.type=r,n.params=i,n.state=a.default.STARTING,n.error=void 0,n.data=void 0,n.loaderData={},!t)throw new Error("Missing required `path` argument");if(!r)throw new Error("Missing required `type` argument");return n}return i.__extends(t,e),t.prototype.setState=function(e){switch(e){case a.default.STARTING:throw new s.default(this.state,e);case a.default.LOADING:if(this.state!==a.default.STARTING)throw new s.default(this.state,e);break;case a.default.PROCESSING:if(this.state!==a.default.LOADING)throw new s.default(this.state,e);break;case a.default.COMPLETE:if(this.state!==a.default.PROCESSING)throw new s.default(this.state,e);break;case a.default.CANCELLED:if(this.state!==a.default.STARTING&&this.state!==a.default.LOADING&&this.state!==a.default.PROCESSING)throw new s.default(this.state,e);break;case a.default.ERROR:break;default:throw new Error("Unknown state: "+e)}return this.state=e,this.trigger(o.default.STATE_CHANGE,e),e},t.prototype.setLoading=function(){this.setState(a.default.LOADING)},t.prototype.setProcessing=function(){this.setState(a.default.PROCESSING)},t.prototype.setComplete=function(e){this.setState(a.default.COMPLETE),this.data=e,this.trigger(o.default.LOAD,e),this.done()},t.prototype.setError=function(e){this.setState(a.default.ERROR),this.error=e,this.trigger(o.default.ERROR,e),this.done()},t.prototype.setCancelled=function(){this.setState(a.default.CANCELLED),this.trigger(o.default.CANCEL),this.done()},t.prototype.isCancelled=function(){return this.state===a.default.CANCELLED},t.prototype.done=function(){this.trigger(o.default.DONE,this.state),this.off()},t}(t.loadableResourceMixins);t.default=p},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(40),n=function(e){return e.setProcessing(),e.setComplete(e.loaderData.xhr.response),Promise.resolve(e)};t.default=function(e,t){return i.makeXhr(t)(e).then(i.unlessCancelled(i.setResponseType("arraybuffer"))).then(i.unlessCancelled(i.loadXhr)).then(i.unlessCancelled(i.requireStatus(function(e){return 200===e}))).then(i.unlessCancelled(n)).catch(i.handleError(e))}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(233),n=r(187),a=r(40),o=function(e){e.setProcessing();var t="string"==typeof e.loaderData.xhr.response?JSON.parse(e.loaderData.xhr.response):e.loaderData.xhr.response,r=e.path.indexOf("?"),a=r>=0?r:e.path.length,o=e.path.slice(0,e.path.lastIndexOf("/",a)+1);if(void 0===t||void 0===t.version||t.version.major>4)return Promise.reject(new Error("Unsupported data version"));var s=new RegExp(/^(?:[a-z]+:)?\/\//i),u=new RegExp(/^\//),p=function(e){return!e.match(s)&&!e.match(u)},c=i.mapEntities(t.entities,t.version);return c.forEach(function(e){if(n.isAsset(e)&&e.representations&&e.representations.forEach(function(e){e.src&&p(e.src)&&(e.src=o+e.src)}),"buffer"===e.type){var t=e.properties;t.src&&p(t.src)&&(t.src=o+t.src)}}),e.setComplete(c),Promise.resolve(e)};t.default=function(e,t){return a.makeXhr(t)(e).then(a.unlessCancelled(a.setResponseType("json"))).then(a.unlessCancelled(a.loadXhr)).then(a.unlessCancelled(a.requireStatus(function(e){return 200===e}))).then(a.unlessCancelled(o)).catch(a.handleError(e))}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(40),n=function(e){return new Promise(function(t){if(e.setProcessing(),e.loaderData.xhr.response instanceof Blob){var r=URL.createObjectURL(e.loaderData.xhr.response),i=new Image;i.onload=function(){e.setComplete(i),t(e)},i.src=r}else e.setComplete(e.loaderData.xhr.response),t(e)})};t.default=function(e,t){return i.makeXhr(t)(e).then(i.unlessCancelled(i.setResponseType("blob"))).then(i.unlessCancelled(i.loadXhr)).then(i.unlessCancelled(i.requireStatus(function(e){return 200===e}))).then(i.unlessCancelled(n)).catch(i.handleError(e))}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(40),n=function(e){return new Promise(function(t,r){e.setProcessing();var i=URL.createObjectURL(e.loaderData.xhr.response),n=document.createElement("video");n.addEventListener("loadeddata",function(){e.setComplete(n),t(e)}),n.addEventListener("error",function(){return r(new Error("Failed to load video"))}),n.src=i,n.load()})};t.default=function(e,t){return i.makeXhr(t)(e).then(i.unlessCancelled(i.setResponseType("blob"))).then(i.unlessCancelled(i.loadXhr)).then(i.unlessCancelled(i.requireStatus(function(e){return 200===e}))).then(i.unlessCancelled(n)).catch(i.handleError(e))}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(3),n=r(12),a=r(9),o=function(){function e(){this.loadingResources=[]}return e.prototype.loadResource=function(e,t,r,o){var s=this;void 0===o&&(o={});var u=this.engine.resourceLoader.load(e,t,o);return this.loadingResources.push(u),u.on(n.default.ERROR,function(e){i.default.error(s.engine.getName()+(" - ResourceLifecycle: Error loading "+s.type+",")+(s.getName()+", "+e.toString())),s.setState(a.StateType.Base,a.State.Failed)}),u.on(n.default.DONE,function(){s.loadingResources=s.loadingResources.filter(function(e){return e!==u}),"function"==typeof r&&r()}),u},e.prototype.abortRequests=function(){this.loadingResources.forEach(function(e){return e.setCancelled()})},e}();t.default=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(69),a=function(e){function t(t,r){var i=e.call(this,'Illegal state transition "'+n.default[t]+'" -> "'+n.default[r]+'"')||this;return i.from=t,i.to=r,i}return i.__extends(t,e),t}(Error);t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(214),n=r(223),a=r(215),o=r(217),s=r(218),u=r(216),p=r(12),c=r(17),l=4,h=function(e,t){var r=new XMLHttpRequest;return r.open("GET",e),Promise.resolve(r)},d=[];d[c.default.BUFFER]=a.default,d[c.default.IMAGE]=o.default,d[c.default.VIDEO]=s.default,d[c.default.ENTITIES]=u.default;var f=function(){function e(e,t){if(void 0===e&&(e=h),void 0===t&&(t=d),this.xhrPromise=e,this.strategies=t,this.resources={},!e)throw new Error("Must provide argument `xhrPromise`!");if(!t)throw new Error("Must provide argument `strategies`!");this.queue=n.default(l)}return e.prototype.destroy=function(){this.queue.destroy()},e.prototype.load=function(e,t,r){var n=this;if(!this.strategies[t])throw new Error("Unsupported type: "+t);if(this.resources[e])return this.resources[e];var a=this.resources[e]=new i.default(e,t,r);return this.queue.add(function(){return new Promise(function(r){var i=function(){delete n.resources[e],a.off(p.default.LOAD,i),a.off(p.default.ERROR,i),a.off(p.default.CANCEL,i),r(a)};a.once(p.default.LOAD,i),a.once(p.default.ERROR,i),a.once(p.default.CANCEL,i),n.strategies[t](a,n.xhrPromise)})},r.priority),a},e}();t.default=f},function(e,t,r){"use strict";function i(e){return e.replace(/([a-z])([A-Z])/g,"$1_$2").replace(/([A-Z]+)([A-Z])([a-z])/,"$1_$2$3").toUpperCase()}Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t="string"==typeof e?e:"";return t=t.replace(/_([a-z])/gi,function(e,t){return"_"+t.toUpperCase()}),t=t.replace(/\s+/g,"_"),t=t.replace(/([a-z])([0-9])/g,"$1_$2"),t=i(t)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=4,n=5,a=function(e,t){void 0===e&&(e=i),void 0===t&&(t=n);var r=[],a=[],o=!0,s=function(){for(var t=function(){var e=r.pop();a.push(e),e.fn().then(function(){var t=a.indexOf(e);t>=0&&(a.splice(t,1),s())})};r.length>0&&a.length=1&&r<=12&&i>=1&&i<=m[r]}function a(e,t){var r=e.match(y);if(!r)return!1;var i=r[1],n=r[2],a=r[3],o=r[5];return i<=23&&n<=59&&a<=59&&(!t||o)}function o(e){var t=e.split(E);return 2==t.length&&n(t[0])&&a(t[1],!0)}function s(e){return e.length<=255&&g.test(e)}function u(e){return w.test(e)&&v.test(e)}function p(e){try{return new RegExp(e),!0}catch(e){return!1}}function c(e,t){if(e&&t)return e>t?1:et?1:e=0?{index:i,compiling:!0}:(i=this._compilations.length,this._compilations[i]={schema:e,root:t,baseId:r},{index:i,compiling:!1})}function o(e,t,r){var i=s.call(this,e,t,r);i>=0&&this._compilations.splice(i,1)}function s(e,t,r){for(var i=0;i=55296&&t<=56319&&n=t)throw new Error("Cannot access property/index "+i+" levels up, current level is "+t);return r[t-i]}if(i>t)throw new Error("Cannot access data "+i+" levels up, current level is "+t);if(a="data"+(t-i||""),!n)return a}for(var s=a,p=n.split("/"),c=0;c",S="result"+n,D=e.opts.v5&&o&&o.$data;if(D?(i+=" var schema"+n+" = "+e.util.getData(o.$data,a,e.dataPathArr)+"; ",v="schema"+n):v=o,E){var _=e.util.getData(x.$data,a,e.dataPathArr),M="exclusive"+n,A="op"+n,T="' + "+A+" + '";i+=" var schemaExcl"+n+" = "+_+"; ",_="schemaExcl"+n,i+=" if (typeof "+_+" != 'boolean' && "+_+" !== undefined) { "+l+" = false; ";var r=P,C=C||[];C.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '"+(r||"_formatExclusiveLimit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: {} ",e.opts.messages!==!1&&(i+=" , message: '"+P+" should be boolean' "),e.opts.verbose&&(i+=" , schema: validate.schema"+s+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+c+" "),i+=" } "):i+=" {} ";var R=i;i=C.pop(),i+=!e.compositeRule&&p?e.async?" throw new ValidationError(["+R+"]); ":" validate.errors = ["+R+"]; return false; ":" var err = "+R+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } ",p&&(f+="}",i+=" else { "),D&&(i+=" if ("+v+" === undefined) "+l+" = true; else if (typeof "+v+" != 'string') "+l+" = false; else { ",f+="}"),d&&(i+=" if (!"+g+") "+l+" = true; else { ",f+="}"),i+=" var "+S+" = "+g+"("+c+", ",i+=D?""+v:""+e.util.toQuotedString(o),i+=" ); if ("+S+" === undefined) "+l+" = false; var "+M+" = "+_+" === true; if ("+l+" === undefined) { "+l+" = "+M+" ? "+S+" "+w+" 0 : "+S+" "+w+"= 0; } if (!"+l+") var op"+n+" = "+M+" ? '"+w+"' : '"+w+"=';"}else{var M=x===!0,T=w;M||(T+="=");var A="'"+T+"'";D&&(i+=" if ("+v+" === undefined) "+l+" = true; else if (typeof "+v+" != 'string') "+l+" = false; else { ",f+="}"),d&&(i+=" if (!"+g+") "+l+" = true; else { ",f+="}"),i+=" var "+S+" = "+g+"("+c+", ",i+=D?""+v:""+e.util.toQuotedString(o),i+=" ); if ("+S+" === undefined) "+l+" = false; if ("+l+" === undefined) "+l+" = "+S+" "+w,M||(i+="="),i+=" 0;"}i+=""+f+"if (!"+l+") { ";var r=t,C=C||[];C.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '"+(r||"_formatLimit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { comparison: "+A+", limit: ",i+=D?""+v:""+e.util.toQuotedString(o),i+=" , exclusive: "+M+" } ",e.opts.messages!==!1&&(i+=" , message: 'should be "+T+' "',i+=D?"' + "+v+" + '":""+e.util.escapeQuotes(o),i+="\"' "),e.opts.verbose&&(i+=" , schema: ",i+=D?"validate.schema"+s:""+e.util.toQuotedString(o),i+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+c+" "),i+=" } "):i+=" {} ";var R=i;return i=C.pop(),i+=!e.compositeRule&&p?e.async?" throw new ValidationError(["+R+"]); ":" validate.errors = ["+R+"]; return false; ":" var err = "+R+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+="}"}},{}],14:[function(e,t,r){"use strict";t.exports=function(e,t){var r,i,n=" ",a=e.level,o=e.dataLevel,s=e.schema[t],u=e.schemaPath+e.util.getProperty(t),p=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,l="data"+(o||""),h=e.opts.v5&&s&&s.$data;h?(n+=" var schema"+a+" = "+e.util.getData(s.$data,o,e.dataPathArr)+"; ",i="schema"+a):i=s;var d="maximum"==t,f=d?"exclusiveMaximum":"exclusiveMinimum",m=e.schema[f],y=e.opts.v5&&m&&m.$data,g=d?"<":">",v=d?">":"<";if(y){var b=e.util.getData(m.$data,o,e.dataPathArr),P="exclusive"+a,x="op"+a,E="' + "+x+" + '";n+=" var schemaExcl"+a+" = "+b+"; ",b="schemaExcl"+a,n+=" var exclusive"+a+"; if (typeof "+b+" != 'boolean' && typeof "+b+" != 'undefined') { ";var r=f,w=w||[];w.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(r||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(p)+" , params: {} ",e.opts.messages!==!1&&(n+=" , message: '"+f+" should be boolean' "),e.opts.verbose&&(n+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+l+" "),n+=" } "):n+=" {} ";var S=n;n=w.pop(),n+=!e.compositeRule&&c?e.async?" throw new ValidationError(["+S+"]); ":" validate.errors = ["+S+"]; return false; ":" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } else if( ",h&&(n+=" ("+i+" !== undefined && typeof "+i+" != 'number') || "),n+=" ((exclusive"+a+" = "+b+" === true) ? "+l+" "+v+"= "+i+" : "+l+" "+v+" "+i+") || "+l+" !== "+l+") { var op"+a+" = exclusive"+a+" ? '"+g+"' : '"+g+"=';"}else{var P=m===!0,E=g;P||(E+="=");var x="'"+E+"'";n+=" if ( ",h&&(n+=" ("+i+" !== undefined && typeof "+i+" != 'number') || "),n+=" "+l+" "+v,P&&(n+="="),n+=" "+i+" || "+l+" !== "+l+") {"}var r=t,w=w||[];w.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(r||"_limit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(p)+" , params: { comparison: "+x+", limit: "+i+", exclusive: "+P+" } ",e.opts.messages!==!1&&(n+=" , message: 'should be "+E+" ",n+=h?"' + "+i:""+s+"'"),e.opts.verbose&&(n+=" , schema: ",n+=h?"validate.schema"+u:""+s,n+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+l+" "),n+=" } "):n+=" {} ";var S=n;return n=w.pop(),n+=!e.compositeRule&&c?e.async?" throw new ValidationError(["+S+"]); ":" validate.errors = ["+S+"]; return false; ":" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } ",c&&(n+=" else { "),n}},{}],15:[function(e,t,r){"use strict";t.exports=function(e,t){var r,i,n=" ",a=e.level,o=e.dataLevel,s=e.schema[t],u=e.schemaPath+e.util.getProperty(t),p=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,l="data"+(o||""),h=e.opts.v5&&s&&s.$data;h?(n+=" var schema"+a+" = "+e.util.getData(s.$data,o,e.dataPathArr)+"; ",i="schema"+a):i=s;var d="maxItems"==t?">":"<";n+="if ( ",h&&(n+=" ("+i+" !== undefined && typeof "+i+" != 'number') || "), n+=" "+l+".length "+d+" "+i+") { ";var r=t,f=f||[];f.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(r||"_limitItems")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(p)+" , params: { limit: "+i+" } ",e.opts.messages!==!1&&(n+=" , message: 'should NOT have ",n+="maxItems"==t?"more":"less",n+=" than ",n+=h?"' + "+i+" + '":""+s,n+=" items' "),e.opts.verbose&&(n+=" , schema: ",n+=h?"validate.schema"+u:""+s,n+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+l+" "),n+=" } "):n+=" {} ";var m=n;return n=f.pop(),n+=!e.compositeRule&&c?e.async?" throw new ValidationError(["+m+"]); ":" validate.errors = ["+m+"]; return false; ":" var err = "+m+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+="} ",c&&(n+=" else { "),n}},{}],16:[function(e,t,r){"use strict";t.exports=function(e,t){var r,i,n=" ",a=e.level,o=e.dataLevel,s=e.schema[t],u=e.schemaPath+e.util.getProperty(t),p=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,l="data"+(o||""),h=e.opts.v5&&s&&s.$data;h?(n+=" var schema"+a+" = "+e.util.getData(s.$data,o,e.dataPathArr)+"; ",i="schema"+a):i=s;var d="maxLength"==t?">":"<";n+="if ( ",h&&(n+=" ("+i+" !== undefined && typeof "+i+" != 'number') || "),n+=e.opts.unicode===!1?" "+l+".length ":" ucs2length("+l+") ",n+=" "+d+" "+i+") { ";var r=t,f=f||[];f.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(r||"_limitLength")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(p)+" , params: { limit: "+i+" } ",e.opts.messages!==!1&&(n+=" , message: 'should NOT be ",n+="maxLength"==t?"longer":"shorter",n+=" than ",n+=h?"' + "+i+" + '":""+s,n+=" characters' "),e.opts.verbose&&(n+=" , schema: ",n+=h?"validate.schema"+u:""+s,n+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+l+" "),n+=" } "):n+=" {} ";var m=n;return n=f.pop(),n+=!e.compositeRule&&c?e.async?" throw new ValidationError(["+m+"]); ":" validate.errors = ["+m+"]; return false; ":" var err = "+m+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+="} ",c&&(n+=" else { "),n}},{}],17:[function(e,t,r){"use strict";t.exports=function(e,t){var r,i,n=" ",a=e.level,o=e.dataLevel,s=e.schema[t],u=e.schemaPath+e.util.getProperty(t),p=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,l="data"+(o||""),h=e.opts.v5&&s&&s.$data;h?(n+=" var schema"+a+" = "+e.util.getData(s.$data,o,e.dataPathArr)+"; ",i="schema"+a):i=s;var d="maxProperties"==t?">":"<";n+="if ( ",h&&(n+=" ("+i+" !== undefined && typeof "+i+" != 'number') || "),n+=" Object.keys("+l+").length "+d+" "+i+") { ";var r=t,f=f||[];f.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(r||"_limitProperties")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(p)+" , params: { limit: "+i+" } ",e.opts.messages!==!1&&(n+=" , message: 'should NOT have ",n+="maxProperties"==t?"more":"less",n+=" than ",n+=h?"' + "+i+" + '":""+s,n+=" properties' "),e.opts.verbose&&(n+=" , schema: ",n+=h?"validate.schema"+u:""+s,n+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+l+" "),n+=" } "):n+=" {} ";var m=n;return n=f.pop(),n+=!e.compositeRule&&c?e.async?" throw new ValidationError(["+m+"]); ":" validate.errors = ["+m+"]; return false; ":" var err = "+m+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+="} ",c&&(n+=" else { "),n}},{}],18:[function(e,t,r){"use strict";t.exports=function(e,t){var r=" ",i=e.schema[t],n=e.schemaPath+e.util.getProperty(t),a=e.errSchemaPath+"/"+t,o=!e.opts.allErrors,s=e.util.copy(e),u="";s.level++;var p="valid"+s.level,c=s.baseId,l=!0,h=i;if(h)for(var d,f=-1,m=h.length-1;f "+_+") { ";var A=c+"["+_+"]";d.schema=D,d.schemaPath=s+"["+_+"]",d.errSchemaPath=u+"/"+_,d.errorPath=e.util.getPathExpr(e.errorPath,_,e.opts.jsonPointers,!0),d.dataPathArr[g]=_;var T=e.validate(d);d.baseId=b,i+=e.util.varOccurences(T,v)<2?" "+e.util.varReplace(T,v,A)+" ":" var "+v+" = "+A+"; "+T+" ",i+=" } ",p&&(i+=" if ("+m+") { ",f+="}")}if("object"==typeof P&&e.util.schemaHasRules(P,e.RULES.all)){d.schema=P,d.schemaPath=e.schemaPath+".additionalItems",d.errSchemaPath=e.errSchemaPath+"/additionalItems",i+=" "+m+" = true; if ("+c+".length > "+o.length+") { for (var "+y+" = "+o.length+"; "+y+" < "+c+".length; "+y+"++) { ",d.errorPath=e.util.getPathExpr(e.errorPath,y,e.opts.jsonPointers,!0);var A=c+"["+y+"]";d.dataPathArr[g]=y;var T=e.validate(d);d.baseId=b,i+=e.util.varOccurences(T,v)<2?" "+e.util.varReplace(T,v,A)+" ":" var "+v+" = "+A+"; "+T+" ",p&&(i+=" if (!"+m+") break; "),i+=" } } ",p&&(i+=" if ("+m+") { ",f+="}")}}else if(e.util.schemaHasRules(o,e.RULES.all)){d.schema=o,d.schemaPath=s,d.errSchemaPath=u,i+=" for (var "+y+" = 0; "+y+" < "+c+".length; "+y+"++) { ",d.errorPath=e.util.getPathExpr(e.errorPath,y,e.opts.jsonPointers,!0);var A=c+"["+y+"]";d.dataPathArr[g]=y;var T=e.validate(d);d.baseId=b,i+=e.util.varOccurences(T,v)<2?" "+e.util.varReplace(T,v,A)+" ":" var "+v+" = "+A+"; "+T+" ",p&&(i+=" if (!"+m+") break; "),i+=" } ",p&&(i+=" if ("+m+") { ",f+="}")}return p&&(i+=" "+f+" if ("+h+" == errors) {"),i=e.util.cleanUpCode(i)}},{}],26:[function(e,t,r){"use strict";t.exports=function(e,t){var r,i,n=" ",a=e.level,o=e.dataLevel,s=e.schema[t],u=e.schemaPath+e.util.getProperty(t),p=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,l="data"+(o||""),h=e.opts.v5&&s&&s.$data;h?(n+=" var schema"+a+" = "+e.util.getData(s.$data,o,e.dataPathArr)+"; ",i="schema"+a):i=s,n+="var division"+a+";if (",h&&(n+=" "+i+" !== undefined && ( typeof "+i+" != 'number' || "),n+=" (division"+a+" = "+l+" / "+i+", ",n+=e.opts.multipleOfPrecision?" Math.abs(Math.round(division"+a+") - division"+a+") > 1e-"+e.opts.multipleOfPrecision+" ":" division"+a+" !== parseInt(division"+a+") ",n+=" ) ",h&&(n+=" ) "),n+=" ) { ";var d=d||[];d.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(r||"multipleOf")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(p)+" , params: { multipleOf: "+i+" } ",e.opts.messages!==!1&&(n+=" , message: 'should be multiple of ",n+=h?"' + "+i:""+s+"'"),e.opts.verbose&&(n+=" , schema: ",n+=h?"validate.schema"+u:""+s,n+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+l+" "),n+=" } "):n+=" {} ";var f=n;return n=d.pop(),n+=!e.compositeRule&&c?e.async?" throw new ValidationError(["+f+"]); ":" validate.errors = ["+f+"]; return false; ":" var err = "+f+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+="} ",c&&(n+=" else { "),n}},{}],27:[function(e,t,r){"use strict";t.exports=function(e,t){var r,i=" ",n=e.level,a=e.dataLevel,o=e.schema[t],s=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,c="data"+(a||""),l="errs__"+n,h=e.util.copy(e);h.level++;var d="valid"+h.level;if(e.util.schemaHasRules(o,e.RULES.all)){h.schema=o,h.schemaPath=s,h.errSchemaPath=u,i+=" var "+l+" = errors; ";var f=e.compositeRule;e.compositeRule=h.compositeRule=!0,h.createErrors=!1;var m;h.opts.allErrors&&(m=h.opts.allErrors,h.opts.allErrors=!1),i+=" "+e.validate(h)+" ",h.createErrors=!0,m&&(h.opts.allErrors=m),e.compositeRule=h.compositeRule=f,i+=" if ("+d+") { ";var y=y||[];y.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '"+(r||"not")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: {} ",e.opts.messages!==!1&&(i+=" , message: 'should NOT be valid' "),e.opts.verbose&&(i+=" , schema: validate.schema"+s+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+c+" "),i+=" } "):i+=" {} ";var g=i;i=y.pop(),i+=!e.compositeRule&&p?e.async?" throw new ValidationError(["+g+"]); ":" validate.errors = ["+g+"]; return false; ":" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } else { errors = "+l+"; if (vErrors !== null) { if ("+l+") vErrors.length = "+l+"; else vErrors = null; } ",e.opts.allErrors&&(i+=" } ")}else i+=" var err = ",e.createErrors!==!1?(i+=" { keyword: '"+(r||"not")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: {} ",e.opts.messages!==!1&&(i+=" , message: 'should NOT be valid' "),e.opts.verbose&&(i+=" , schema: validate.schema"+s+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+c+" "),i+=" } "):i+=" {} ",i+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",p&&(i+=" if (false) { ");return i}},{}],28:[function(e,t,r){"use strict";t.exports=function(e,t){var r,i=" ",n=e.level,a=e.dataLevel,o=e.schema[t],s=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,c="data"+(a||""),l="valid"+n,h="errs__"+n,d=e.util.copy(e),f="";d.level++;var m="valid"+d.level;i+="var "+h+" = errors;var prevValid"+n+" = false;var "+l+" = false;";var y=d.baseId,g=e.compositeRule;e.compositeRule=d.compositeRule=!0;var v=o;if(v)for(var b,P=-1,x=v.length-1;P5)i+=" || validate.schema"+s+"["+y+"] ";else{var k=b;if(k)for(var j,L=-1,B=k.length-1;L= "+me+"; ",u=e.errSchemaPath+"/patternGroups/minimum",i+=" if (!"+l+") { ";var X=X||[];X.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '"+(r||"patternGroups")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { reason: '"+ve+"', limit: "+ge+", pattern: '"+e.util.escapeQuotes(G)+"' } ",e.opts.messages!==!1&&(i+=" , message: 'should NOT have "+be+" than "+ge+' properties matching pattern "'+e.util.escapeQuotes(G)+"\"' "),e.opts.verbose&&(i+=" , schema: validate.schema"+s+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+c+" "),i+=" } "):i+=" {} ";var Q=i;i=X.pop(),i+=!e.compositeRule&&p?e.async?" throw new ValidationError(["+Q+"]); ":" validate.errors = ["+Q+"]; return false; ":" var err = "+Q+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } ",void 0!==ye&&(i+=" else ")}if(void 0!==ye){var ge=ye,ve="maximum",be="more";i+=" "+l+" = pgPropCount"+n+" <= "+ye+"; ",u=e.errSchemaPath+"/patternGroups/maximum",i+=" if (!"+l+") { ";var X=X||[];X.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '"+(r||"patternGroups")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { reason: '"+ve+"', limit: "+ge+", pattern: '"+e.util.escapeQuotes(G)+"' } ",e.opts.messages!==!1&&(i+=" , message: 'should NOT have "+be+" than "+ge+' properties matching pattern "'+e.util.escapeQuotes(G)+"\"' "),e.opts.verbose&&(i+=" , schema: validate.schema"+s+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+c+" "),i+=" } "):i+=" {} ";var Q=i;i=X.pop(),i+=!e.compositeRule&&p?e.async?" throw new ValidationError(["+Q+"]); ":" validate.errors = ["+Q+"]; return false; ":" var err = "+Q+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } "}u=W,p&&(i+=" if ("+l+") { ",f+="}")}}}}return p&&(i+=" "+f+" if ("+h+" == errors) {"),i=e.util.cleanUpCode(i)}},{}],32:[function(e,t,r){"use strict";t.exports=function(e,t){var r,i,n,a=" ",o=e.level,s=e.dataLevel,u=e.schema[t],p=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,l="data"+(s||""),h="valid"+o;if("#"==u||"#/"==u)e.isRoot?(i=e.async,n="validate"):(i=e.root.schema.$async===!0,n="root.refVal[0]");else{var d=e.resolveRef(e.baseId,u,e.isRoot);if(void 0===d){var f="can't resolve reference "+u+" from id "+e.baseId;if("fail"==e.opts.missingRefs){console.log(f);var m=m||[];m.push(a),a="",e.createErrors!==!1?(a+=" { keyword: '"+(r||"$ref")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(p)+" , params: { ref: '"+e.util.escapeQuotes(u)+"' } ",e.opts.messages!==!1&&(a+=" , message: 'can\\'t resolve reference "+e.util.escapeQuotes(u)+"' "),e.opts.verbose&&(a+=" , schema: "+e.util.toQuotedString(u)+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+l+" "),a+=" } "):a+=" {} ";var y=a;a=m.pop(),a+=!e.compositeRule&&c?e.async?" throw new ValidationError(["+y+"]); ":" validate.errors = ["+y+"]; return false; ":" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",c&&(a+=" if (false) { ")}else{if("ignore"!=e.opts.missingRefs){var g=new Error(f);throw g.missingRef=e.resolve.url(e.baseId,u),g.missingSchema=e.resolve.normalizeId(e.resolve.fullPath(g.missingRef)),g}console.log(f),c&&(a+=" if (true) { ")}}else if(d.inline){var v=e.util.copy(e);v.level++;var b="valid"+v.level;v.schema=d.schema,v.schemaPath="",v.errSchemaPath=u;var P=e.validate(v).replace(/validate\.schema/g,d.code);a+=" "+P+" ",c&&(a+=" if ("+b+") { ")}else i=d.$async===!0,n=d.code}if(n){var m=m||[];m.push(a),a="",a+=e.opts.passContext?" "+n+".call(this, ":" "+n+"( ",a+=" "+l+", (dataPath || '')",'""'!=e.errorPath&&(a+=" + "+e.errorPath);var x=s?"data"+(s-1||""):"parentData",E=s?e.dataPathArr[s]:"parentDataProperty";a+=" , "+x+" , "+E+", rootData) ";var w=a;if(a=m.pop(),i){if(!e.async)throw new Error("async schema referenced by sync schema");a+=" try { ",c&&(a+="var "+h+" ="),a+=" "+e.yieldAwait+" "+w+"; } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; } ",c&&(a+=" if ("+h+") { ")}else a+=" if (!"+w+") { if (vErrors === null) vErrors = "+n+".errors; else vErrors = vErrors.concat("+n+".errors); errors = vErrors.length; } ",c&&(a+=" else { ")}return a}},{}],33:[function(e,t,r){"use strict";t.exports=function(e,t){var r,i,n=" ",a=e.level,o=e.dataLevel,s=e.schema[t],u=e.schemaPath+e.util.getProperty(t),p=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,l="data"+(o||""),h="valid"+a,d=e.opts.v5&&s&&s.$data;d?(n+=" var schema"+a+" = "+e.util.getData(s.$data,o,e.dataPathArr)+"; ",i="schema"+a):i=s;var f="schema"+a;if(!d)if(s.length=e.opts.loopRequired;if(c)if(n+=" var missing"+a+"; ",E){d||(n+=" var "+f+" = validate.schema"+u+"; ");var w="i"+a,S="schema"+a+"["+w+"]",D="' + "+S+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(x,S,e.opts.jsonPointers)),n+=" var "+h+" = true; ",d&&(n+=" if (schema"+a+" === undefined) "+h+" = true; else if (!Array.isArray(schema"+a+")) "+h+" = false; else {"),n+=" for (var "+w+" = 0; "+w+" < "+f+".length; "+w+"++) { "+h+" = "+l+"["+f+"["+w+"]] !== undefined; if (!"+h+") break; } ",d&&(n+=" } "),n+=" if (!"+h+") { ";var _=_||[];_.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(r||"required")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(p)+" , params: { missingProperty: '"+D+"' } ",e.opts.messages!==!1&&(n+=" , message: '",n+=e.opts._errorDataPathProperty?"is a required property":"should have required property \\'"+D+"\\'",n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+l+" "),n+=" } "):n+=" {} ";var M=n;n=_.pop(),n+=!e.compositeRule&&c?e.async?" throw new ValidationError(["+M+"]); ":" validate.errors = ["+M+"]; return false; ":" var err = "+M+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } else { "}else{n+=" if ( ";var A=m;if(A)for(var T,w=-1,C=A.length-1;w 1) { var i = "+l+".length, j; outer: for (;i--;) { for (j = i; j--;) { if (equal("+l+"[i], "+l+"[j])) { "+h+" = false; break outer; } } } } ",d&&(n+=" } "),n+=" if (!"+h+") { ";var f=f||[];f.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(r||"uniqueItems")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(p)+" , params: { i: i, j: j } ",e.opts.messages!==!1&&(n+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' "),e.opts.verbose&&(n+=" , schema: ",n+=d?"validate.schema"+u:""+s,n+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+l+" "),n+=" } "):n+=" {} ";var m=n;n=f.pop(),n+=!e.compositeRule&&c?e.async?" throw new ValidationError(["+m+"]); ":" validate.errors = ["+m+"]; return false; ":" var err = "+m+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } ",c&&(n+=" else { ")}else c&&(n+=" if (true) { ");return n}},{}],36:[function(e,t,r){"use strict";t.exports=function(e,t){function r(e){for(var t=0;t