extensionsUsed
+ if (defined(gltf.allExtensions)) {
+ gltf.extensionsUsed = gltf.allExtensions;
+ gltf.allExtensions = undefined;
+ }
+ }
+
+ function stripWebGLRevisionNumber(gltf) {
+ var asset = gltf.asset;
+ var profile = asset.profile;
+ if (defined(profile)) {
+ var version = profile.version;
+ if (defined(version)) {
+ profile.version = version[0] + '.' + version[2];
+ }
+ }
+ }
+
+ var knownExtensions = {
+ CESIUM_RTC : true,
+ KHR_binary_glTF : true,
+ KHR_materials_common : true,
+ WEB3D_quantized_attributes : true
+ };
+
+ function requireKnownExtensions(gltf) {
+ var extensionsUsed = gltf.extensionsUsed;
+ gltf.extensionsRequired = defaultValue(gltf.extensionsRequired, []);
+ if (defined(extensionsUsed)) {
+ var extensionsUsedLength = extensionsUsed.length;
+ for (var i = 0; i < extensionsUsedLength; i++) {
+ var extension = extensionsUsed[i];
+ if (defined(knownExtensions[extension])) {
+ gltf.extensionsRequired.push(extension);
+ extensionsUsed.splice(i, 1);
+ i--;
+ }
+ }
+ }
+ }
+
+ function addGlExtensionsUsed(gltf) {
+ var accessors = gltf.accessors;
+ var meshes = gltf.meshes;
+ for (var meshId in meshes) {
+ if (meshes.hasOwnProperty(meshId)) {
+ var mesh = meshes[meshId];
+ var primitives = mesh.primitives;
+ if (defined(primitives)) {
+ var primitivesLength = primitives.length;
+ for (var i = 0; i < primitivesLength; i++) {
+ var primitive = primitives[i];
+ var indicesAccessorId = primitive.indices;
+ if (defined(indicesAccessorId)) {
+ var indicesAccessor = accessors[indicesAccessorId];
+ if (indicesAccessor.componentType === WebGLConstants.UNSIGNED_INT) {
+ gltf.glExtensionsUsed = ['OES_element_index_uint'];
+ return;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ function removeAnimationSamplersIndirection(gltf) {
+ var animations = gltf.animations;
+ for (var animationId in animations) {
+ if (animations.hasOwnProperty(animationId)) {
+ var animation = animations[animationId];
+ var parameters = animation.parameters;
+ var samplers = animation.samplers;
+ for (var samplerId in samplers) {
+ if (samplers.hasOwnProperty(samplerId)) {
+ var sampler = samplers[samplerId];
+ sampler.input = parameters[sampler.input];
+ sampler.output = parameters[sampler.output];
+ }
+ }
+ delete animation.parameters;
+ }
+ }
+ }
+
+ function removeBufferType(gltf) {
+ var buffers = gltf.buffers;
+ for (var bufferId in buffers) {
+ if (buffers.hasOwnProperty(bufferId)) {
+ var buffer = buffers[bufferId];
+ delete buffer.type;
+ }
+ }
+ }
+
+ function makeMaterialValuesArray(gltf) {
+ var materials = gltf.materials;
+ for (var materialId in materials) {
+ if (materials.hasOwnProperty(materialId)) {
+ var material = materials[materialId];
+ var materialValues = material.values;
+ for (var materialValueId in materialValues) {
+ if (materialValues.hasOwnProperty(materialValueId)) {
+ var materialValue = materialValues[materialValueId];
+ if (!Array.isArray(materialValue)) {
+ materialValues[materialValueId] = [materialValue];
+ }
+ }
+ }
+ }
+ }
+ }
+
+ function requireAttributeSetIndex(gltf) {
+ var meshes = gltf.meshes;
+ for (var meshId in meshes) {
+ if (meshes.hasOwnProperty(meshId)) {
+ var mesh = meshes[meshId];
+ var primitives = mesh.primitives;
+ if (defined(primitives)) {
+ var primitivesLength = primitives.length;
+ for (var i = 0; i < primitivesLength; i++) {
+ var primitive = primitives[i];
+ var attributes = primitive.attributes;
+ if (defined(attributes)) {
+ var semantics = Object.keys(attributes);
+ var semanticsLength = semantics.length;
+ for (var j = 0; j < semanticsLength; j++) {
+ var semantic = semantics[j];
+ if (semantic === 'TEXCOORD') {
+ attributes.TEXCOORD_0 = attributes[semantic];
+ delete attributes[semantic];
+ }
+ if (semantic === 'COLOR') {
+ attributes.COLOR_0 = attributes[semantic];
+ delete attributes[semantic];
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ var techniques = gltf.techniques;
+ for (var techniqueId in techniques) {
+ if (techniques.hasOwnProperty(techniqueId)) {
+ var technique = techniques[techniqueId];
+ var techniqueParameters = technique.parameters;
+ for (var techniqueParameterId in techniqueParameters) {
+ if (techniqueParameters.hasOwnProperty(techniqueParameterId)) {
+ var techniqueParameter = techniqueParameters[techniqueParameterId];
+ var techniqueParameterSemantic = techniqueParameter.semantic;
+ if (defined(techniqueParameterSemantic)) {
+ if (techniqueParameterSemantic === 'TEXCOORD') {
+ techniqueParameter.semantic = 'TEXCOORD_0';
+ } else if (techniqueParameterSemantic === 'COLOR') {
+ techniqueParameter.semantic = 'COLOR_0';
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ var knownSemantics = {
+ POSITION : true,
+ NORMAL : true,
+ TEXCOORD : true,
+ COLOR : true,
+ JOINT : true,
+ WEIGHT : true,
+ BATCHID : true
+ };
+
+ function underscoreApplicationSpecificSemantics(gltf) {
+ var mappedSemantics = {};
+ var meshes = gltf.meshes;
+ var techniques = gltf.techniques;
+ for (var meshId in meshes) {
+ if (meshes.hasOwnProperty(meshId)) {
+ var mesh = meshes[meshId];
+ var primitives = mesh.primitives;
+ if (defined(primitives)) {
+ var primitivesLength = primitives.length;
+ for (var i = 0; i < primitivesLength; i++) {
+ var primitive = primitives[i];
+ var attributes = primitive.attributes;
+ if (defined(attributes)) {
+ var semantics = Object.keys(attributes);
+ var semanticsLength = semantics.length;
+ for (var j = 0; j < semanticsLength; j++) {
+ var semantic = semantics[j];
+ if (semantic.charAt(0) !== '_') {
+ var setIndex = semantic.search(/_[0-9]+/g);
+ var strippedSemantic = semantic;
+ if (setIndex >= 0) {
+ strippedSemantic = semantic.substring(0, setIndex);
+ }
+ if (!defined(knownSemantics[strippedSemantic])) {
+ var attributeValue = attributes[semantic];
+ delete attributes[semantic];
+ var newSemantic = '_' + semantic;
+ attributes[newSemantic] = attributeValue;
+ mappedSemantics[semantic] = newSemantic;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ for (var techniqueId in techniques) {
+ if (techniques.hasOwnProperty(techniqueId)) {
+ var technique = techniques[techniqueId];
+ var techniqueParameters = technique.parameters;
+ for (var techniqueParameterId in techniqueParameters) {
+ if (techniqueParameters.hasOwnProperty(techniqueParameterId)) {
+ var techniqueParameter = techniqueParameters[techniqueParameterId];
+ var mappedSemantic = mappedSemantics[techniqueParameter.semantic];
+ if (defined(mappedSemantic)) {
+ techniqueParameter.semantic = mappedSemantic;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ function makeTechniqueValuesArrays(gltf) {
+ var techniques = gltf.techniques;
+ for (var techniqueId in techniques) {
+ if (techniques.hasOwnProperty(techniqueId)) {
+ var technique = techniques[techniqueId];
+ var techniqueParameters = technique.parameters;
+ for (var techniqueParameterId in techniqueParameters) {
+ if (techniqueParameters.hasOwnProperty(techniqueParameterId)) {
+ var techniqueParameter = techniqueParameters[techniqueParameterId];
+ var techniqueParameterValue = techniqueParameter.value;
+ if (defined(techniqueParameterValue) && !Array.isArray(techniqueParameterValue)) {
+ techniqueParameter.value = [techniqueParameterValue];
+ }
+ }
+ }
+ }
+ }
+ }
+
+ function removeScissorFromTechniques(gltf) {
+ var techniques = gltf.techniques;
+ for (var techniqueId in techniques) {
+ if (techniques.hasOwnProperty(techniqueId)) {
+ var technique = techniques[techniqueId];
+ var techniqueStates = technique.states;
+ if (defined(techniqueStates)) {
+ var techniqueFunctions = techniqueStates.functions;
+ if (defined(techniqueFunctions)) {
+ delete techniqueFunctions.scissor;
+ }
+ var enableStates = techniqueStates.enable;
+ if (defined(enableStates)) {
+ var scissorIndex = enableStates.indexOf(WebGLConstants.SCISSOR_TEST);
+ if (scissorIndex >= 0) {
+ enableStates.splice(scissorIndex, 1);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ function clampTechniqueFunctionStates(gltf) {
+ var i;
+ var techniques = gltf.techniques;
+ for (var techniqueId in techniques) {
+ if (techniques.hasOwnProperty(techniqueId)) {
+ var technique = techniques[techniqueId];
+ var techniqueStates = technique.states;
+ if (defined(techniqueStates)) {
+ var functions = techniqueStates.functions;
+ if (defined(functions)) {
+ var blendColor = functions.blendColor;
+ if (defined(blendColor)) {
+ for (i = 0; i < 4; i++) {
+ blendColor[i] = CesiumMath.clamp(blendColor[i], 0.0, 1.0);
+ }
+ }
+ var depthRange = functions.depthRange;
+ if (defined(depthRange)) {
+ depthRange[1] = CesiumMath.clamp(depthRange[1], 0.0, 1.0);
+ depthRange[0] = CesiumMath.clamp(depthRange[0], 0.0, depthRange[1]);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ function clampCameraParameters(gltf) {
+ var cameras = gltf.cameras;
+ for (var cameraId in cameras) {
+ if (cameras.hasOwnProperty(cameraId)) {
+ var camera = cameras[cameraId];
+ var perspective = camera.perspective;
+ if (defined(perspective)) {
+ var aspectRatio = perspective.aspectRatio;
+ if (defined(aspectRatio) && aspectRatio === 0.0) {
+ delete perspective.aspectRatio;
+ }
+ var yfov = perspective.yfov;
+ if (defined(yfov) && yfov === 0.0) {
+ perspective.yfov = 1.0;
+ }
+ }
+ }
+ }
+ }
+
+ function requireByteLength(gltf) {
+ var buffers = gltf.buffers;
+ for (var bufferId in buffers) {
+ if (buffers.hasOwnProperty(bufferId)) {
+ var buffer = buffers[bufferId];
+ if (!defined(buffer.byteLength)) {
+ buffer.byteLength = buffer.extras._pipeline.source.length;
+ }
+ }
+ }
+ var bufferViews = gltf.bufferViews;
+ for (var bufferViewId in bufferViews) {
+ if (bufferViews.hasOwnProperty(bufferViewId)) {
+ var bufferView = bufferViews[bufferViewId];
+ if (!defined(bufferView.byteLength)) {
+ var bufferViewBufferId = bufferView.buffer;
+ var bufferViewBuffer = buffers[bufferViewBufferId];
+ bufferView.byteLength = bufferViewBuffer.byteLength;
+ }
+ }
+ }
+ }
+
+ function requireAccessorMinMax(gltf) {
+ var accessors = gltf.accessors;
+ for (var accessorId in accessors) {
+ if (accessors.hasOwnProperty(accessorId)) {
+ var accessor = accessors[accessorId];
+ if (!defined(accessor.min) || !defined(accessor.max)) {
+ var minMax = findAccessorMinMax(gltf, accessor);
+ accessor.min = minMax.min;
+ accessor.max = minMax.max;
+ }
+ }
+ }
+ }
+
+ function separateSkeletonHierarchy(gltf) {
+ var nodes = gltf.nodes;
+ var node;
+ var nodeId;
+ var nodeStack = [];
+ var mappedSkeletonNodes = {};
+ var parentNodes = {};
+ for (nodeId in nodes) {
+ if (nodes.hasOwnProperty(nodeId)) {
+ nodeStack.push(nodeId);
+ node = nodes[nodeId];
+ var children = node.children;
+ if (defined(children)) {
+ var childrenLength = children.length;
+ for (var i = 0; i < childrenLength; i++) {
+ var childNodeId = children[i];
+ parentNodes[childNodeId] = nodeId;
+ }
+ }
+ }
+ }
+ while (nodeStack.length > 0) {
+ nodeId = nodeStack.pop();
+ node = nodes[nodeId];
+ var jointName = node.jointName;
+ if (defined(jointName)) {
+ // this node is a joint; clone the hierarchy
+ if (!defined(node.camera) && !defined(node.skeletons) && !defined(node.skins) && !defined(node.meshes) && !defined(node.children)) {
+ // the original node can be removed since it is only a skeleton node
+ var parentId = parentNodes[nodeId];
+ if (defined(parentId)) {
+ var parentChildren = nodes[parentId].children;
+ parentChildren.splice(parentChildren.indexOf(nodeId), 1);
+ }
+ delete nodes[nodeId];
+ }
+ var lastNodeId;
+ var skeletonNode;
+ var end = false;
+ while (defined(nodeId)) {
+ var skeletonNodeId = mappedSkeletonNodes[nodeId];
+ if (!defined(skeletonNodeId)) {
+ skeletonNodeId = getUniqueId(gltf, nodeId + '-skeleton');
+ skeletonNode = {
+ jointName : jointName
+ };
+ if (defined(node.translation) || defined(node.rotation) || defined(node.scale)) {
+ skeletonNode.translation = defaultValue(node.translation, [0.0, 0.0, 0.0]);
+ skeletonNode.rotation = defaultValue(node.rotation, [0.0, 0.0, 0.0, 1.0]);
+ skeletonNode.scale = defaultValue(node.scale, [1.0, 1.0, 1.0]);
+ } else {
+ skeletonNode.matrix = defaultValue(node.matrix, [
+ 1.0, 0.0, 0.0, 0.0,
+ 0.0, 1.0, 0.0, 0.0,
+ 0.0, 0.0, 1.0, 0.0,
+ 0.0, 0.0, 0.0, 1.0]);
+ }
+ delete node.jointName;
+ nodes[skeletonNodeId] = skeletonNode;
+ mappedSkeletonNodes[nodeId] = skeletonNodeId;
+ } else {
+ end = true;
+ }
+ if (defined(lastNodeId)) {
+ skeletonNode = nodes[skeletonNodeId];
+ var skeletonChildren = skeletonNode.children;
+ if (!defined(skeletonChildren)) {
+ skeletonNode.children = [lastNodeId];
+ } else {
+ skeletonChildren.push(lastNodeId);
+ }
+ }
+ if (end) {
+ break;
+ }
+ lastNodeId = skeletonNodeId;
+ nodeId = parentNodes[nodeId];
+ node = nodes[nodeId];
+ }
+ }
+ }
+ }
+
+ function glTF10to11(gltf) {
+ var asset = gltf.asset;
+ asset.version = '1.1';
+ // glTF uris need to be loaded if they haven't been
+ // loadGltfUris(gltf);
+ // profile.version does not include revision number ("1.0.3" -> "1.0")
+ stripWebGLRevisionNumber(gltf);
+ // move known extensions from extensionsUsed to extensionsRequired
+ requireKnownExtensions(gltf);
+ // if any index accessors have UNSIGNED_INT componentType, add the WebGL extension OES_element_index_uint
+ addGlExtensionsUsed(gltf);
+ // animation.samplers now refers directly to accessors and animation.parameters should be removed
+ removeAnimationSamplersIndirection(gltf);
+ // bufferView.byteLength and buffer.byteLength are required
+ requireByteLength(gltf);
+ // accessor.min and accessor.max must be defined
+ requireAccessorMinMax(gltf);
+ // buffer.type is unnecessary and should be removed
+ removeBufferType(gltf);
+ // material.values should be arrays
+ makeMaterialValuesArray(gltf);
+ // TEXCOORD and COLOR attributes must be written with a set index (TEXCOORD_#)
+ requireAttributeSetIndex(gltf);
+ // Add underscores to application-specific parameters
+ underscoreApplicationSpecificSemantics(gltf);
+ // technique.parameters.value should be arrays
+ makeTechniqueValuesArrays(gltf);
+ // remove scissor from techniques
+ removeScissorFromTechniques(gltf);
+ // clamp technique function states to min/max
+ clampTechniqueFunctionStates(gltf);
+ // clamp camera parameters
+ clampCameraParameters(gltf);
+ // skeleton hierarchy must be separate from the node hierarchy (a node with jointName cannot contain camera, skeletons, skins, or meshes)
+ separateSkeletonHierarchy(gltf);
+ }
+
+ return updateVersion;
+});
diff --git a/ThirdParty/gltf-pipeline-0.1.0-alpha8/GltfPipeline.js b/ThirdParty/gltf-pipeline-0.1.0-alpha8/GltfPipeline.js
deleted file mode 100644
index 0548a8ba0d79..000000000000
--- a/ThirdParty/gltf-pipeline-0.1.0-alpha8/GltfPipeline.js
+++ /dev/null
@@ -1,80 +0,0 @@
-!function(e){function t(n){if(r[n])return r[n].exports;var i=r[n]={exports:{},id:n,loaded:!1};return e[n].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){"use strict";function n(e,t){t=s(t,{}),t.doubleSided=s(t.doubleSided,!1),t.technique=s(t.technique,"PHONG"),a(e,"KHR_materials_common");var r,n=e.materials,o=e.nodes,l=e.techniques,c=i(e),h=e.extensions;u(h)||(h={},e.extensions=h),r={},h.KHR_materials_common=r;var f={};r.lights=f;for(var d in n)if(n.hasOwnProperty(d)){var p=n[d],m=l[p.technique],g=m.parameters;u(g.ambient)&&!u(f.defaultAmbient)&&(f.defaultAmbient={ambient:{color:[1,1,1]},name:"defaultAmbient",type:"ambient"});for(var w in g)if(g.hasOwnProperty(w)&&0===w.indexOf("light")&&w.indexOf("Transform")>=0){var v=w.substring(0,w.indexOf("Transform")),y=g[w],_=y.node,E=o[_],b=E.extensions;u(b)||(b={},E.extensions=b),r={},b.KHR_materials_common=r,r.light=v;var T=g[v+"Color"],x={name:v,type:"directional",directional:{color:s(T.value,[1,1,1])}};f[v]=x}delete p.technique;var A=p.extensions;u(A)||(A={},p.extensions=A),r={},A.KHR_materials_common=r;for(var S in t)t.hasOwnProperty(S)&&"enable"!==S&&(r[S]=t[S]);var O=c[d];u(O)&&(r.jointCount=O),r.values=p.values,delete p.values}return delete e.techniques,delete e.programs,delete e.shaders,e}function i(e){var t=e.accessors,r=e.meshes,n=e.nodes,i=e.skins,o={},a={};for(var s in n)if(n.hasOwnProperty(s)){var l=n[s];u(l.skin)&&(u(a[l.skin])||(a[l.skin]=[]),a[l.skin].push(l))}for(var c in i)if(i.hasOwnProperty(c)){var h=i[c],f=1;u(h.inverseBindMatrices)&&(f=t[h.inverseBindMatrices].count);for(var d=a[c],p=d.length,m=0;m0?1:e<0?-1:0},s.signNotZero=function(e){return e<0?-1:1},s.toSNorm=function(e,t){return t=i(t,255),Math.round((.5*s.clamp(e,-1,1)+.5)*t)},s.fromSNorm=function(e,t){return t=i(t,255),s.clamp(e,0,t)/t*2-1},s.sinh=function(e){var t=Math.pow(Math.E,e),r=Math.pow(Math.E,-1*e);return.5*(t-r)},s.cosh=function(e){var t=Math.pow(Math.E,e),r=Math.pow(Math.E,-1*e);return.5*(t+r)},s.lerp=function(e,t,r){return(1-r)*e+r*t},s.PI=Math.PI,s.ONE_OVER_PI=1/Math.PI,s.PI_OVER_TWO=.5*Math.PI,s.PI_OVER_THREE=Math.PI/3,s.PI_OVER_FOUR=Math.PI/4,s.PI_OVER_SIX=Math.PI/6,s.THREE_PI_OVER_TWO=3*Math.PI*.5,s.TWO_PI=2*Math.PI,s.ONE_OVER_TWO_PI=1/(2*Math.PI),s.RADIANS_PER_DEGREE=Math.PI/180,s.DEGREES_PER_RADIAN=180/Math.PI,s.RADIANS_PER_ARCSECOND=s.RADIANS_PER_DEGREE/3600,s.toRadians=function(e){if(!o(e))throw new a("degrees is required.");return e*s.RADIANS_PER_DEGREE},s.toDegrees=function(e){if(!o(e))throw new a("radians is required.");return e*s.DEGREES_PER_RADIAN},s.convertLongitudeRange=function(e){if(!o(e))throw new a("angle is required.");var t=s.TWO_PI,r=e-Math.floor(e/t)*t;return r<-Math.PI?r+t:r>=Math.PI?r-t:r},s.clampToLatitudeRange=function(e){if(!o(e))throw new a("angle is required.");return s.clamp(e,-1*s.PI_OVER_TWO,s.PI_OVER_TWO)},s.negativePiToPi=function(e){if(!o(e))throw new a("x is required.");return s.zeroToTwoPi(e+s.PI)-s.PI},s.zeroToTwoPi=function(e){if(!o(e))throw new a("x is required.");var t=s.mod(e,s.TWO_PI);return Math.abs(t)s.EPSILON14?s.TWO_PI:t},s.mod=function(e,t){if(!o(e))throw new a("m is required.");if(!o(t))throw new a("n is required.");return(e%t+t)%t},s.equalsEpsilon=function(e,t,r,n){if(!o(e))throw new a("left is required.");if(!o(t))throw new a("right is required.");if(!o(r))throw new a("relativeEpsilon is required.");n=i(n,r);var s=Math.abs(e-t);return s<=n||s<=r*Math.max(Math.abs(e),Math.abs(t))};var u=[1];s.factorial=function(e){if("number"!=typeof e||e<0)throw new a("A number greater than or equal to 0 is required.");var t=u.length;if(e>=t)for(var r=u[t-1],n=t;n<=e;n++)u.push(r*n);return u[e]},s.incrementWrap=function(e,t,r){if(r=i(r,0),!o(e))throw new a("n is required.");if(t<=r)throw new a("maximumValue must be greater than minimumValue.");return++e,e>t&&(e=r),e},s.isPowerOfTwo=function(e){if("number"!=typeof e||e<0)throw new a("A number greater than or equal to 0 is required.");return 0!==e&&0===(e&e-1)},s.nextPowerOfTwo=function(e){if("number"!=typeof e||e<0)throw new a("A number greater than or equal to 0 is required.");return--e,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,++e,e},s.clamp=function(e,t,r){if(!o(e))throw new a("value is required");if(!o(t))throw new a("min is required.");if(!o(r))throw new a("max is required.");return er?r:e};var l=new n;s.setRandomNumberSeed=function(e){if(!o(e))throw new a("seed is required.");l=new n(e)},s.nextRandomNumber=function(){return l.random()},s.acosClamped=function(e){if(!o(e))throw new a("value is required.");return Math.acos(s.clamp(e,-1,1))},s.asinClamped=function(e){if(!o(e))throw new a("value is required.");return Math.asin(s.clamp(e,-1,1))},s.chordLength=function(e,t){if(!o(e))throw new a("angle is required.");if(!o(t))throw new a("radius is required.");return 2*t*Math.sin(.5*e)},s.logBase=function(e,t){if(!o(e))throw new a("number is required.");if(!o(t))throw new a("base is required.");return Math.log(e)/Math.log(t)},s.fog=function(e,t){var r=e*t;return 1-Math.exp(-(r*r))},e.exports=s},function(e,t,r){"use strict";function n(e,t,r,n){if(t=s(t,0),r=s(r,0),n=s(n,0),t<0||r<0||n<0)throw new l("All radii components must be greater than or equal to zero.");e._radii=new o(t,r,n),e._radiiSquared=new o(t*t,r*r,n*n),e._radiiToTheFourth=new o(t*t*t*t,r*r*r*r,n*n*n*n),e._oneOverRadii=new o(0===t?0:1/t,0===r?0:1/r,0===n?0:1/n),e._oneOverRadiiSquared=new o(0===t?0:1/(t*t),0===r?0:1/(r*r),0===n?0:1/(n*n)),e._minimumRadius=Math.min(t,r,n),e._maximumRadius=Math.max(t,r,n),e._centerToleranceSquared=c.EPSILON1}function i(e,t,r){this._radii=void 0,this._radiiSquared=void 0,this._radiiToTheFourth=void 0,this._oneOverRadii=void 0,this._oneOverRadiiSquared=void 0,this._minimumRadius=void 0,this._maximumRadius=void 0,this._centerToleranceSquared=void 0,n(this,e,t,r)}var o=r(4),a=r(15),s=r(3),u=r(1),l=r(2),c=r(5),h=r(124);Object.defineProperties(i.prototype,{radii:{get:function(){return this._radii}},radiiSquared:{get:function(){return this._radiiSquared}},radiiToTheFourth:{get:function(){return this._radiiToTheFourth}},oneOverRadii:{get:function(){return this._oneOverRadii}},oneOverRadiiSquared:{get:function(){return this._oneOverRadiiSquared}},minimumRadius:{get:function(){return this._minimumRadius}},maximumRadius:{get:function(){return this._maximumRadius}}}),i.clone=function(e,t){if(u(e)){var r=e._radii;return u(t)?(o.clone(r,t._radii),o.clone(e._radiiSquared,t._radiiSquared),o.clone(e._radiiToTheFourth,t._radiiToTheFourth),o.clone(e._oneOverRadii,t._oneOverRadii),o.clone(e._oneOverRadiiSquared,t._oneOverRadiiSquared),t._minimumRadius=e._minimumRadius,t._maximumRadius=e._maximumRadius,t._centerToleranceSquared=e._centerToleranceSquared,t):new i(r.x,r.y,r.z)}},i.fromCartesian3=function(e,t){return u(t)||(t=new i),u(e)?(n(t,e.x,e.y,e.z),t):t},i.WGS84=Object.freeze(new i(6378137,6378137,6356752.314245179)),i.UNIT_SPHERE=Object.freeze(new i(1,1,1)),i.MOON=Object.freeze(new i(c.LUNAR_RADIUS,c.LUNAR_RADIUS,c.LUNAR_RADIUS)),i.prototype.clone=function(e){return i.clone(this,e)},i.packedLength=o.packedLength,i.pack=function(e,t,r){if(!u(e))throw new l("value is required");if(!u(t))throw new l("array is required");return r=s(r,0),o.pack(e._radii,t,r),t},i.unpack=function(e,t,r){if(!u(e))throw new l("array is required");t=s(t,0);var n=o.unpack(e,t);return i.fromCartesian3(n,r)},i.prototype.geocentricSurfaceNormal=o.normalize,i.prototype.geodeticSurfaceNormalCartographic=function(e,t){if(!u(e))throw new l("cartographic is required.");var r=e.longitude,n=e.latitude,i=Math.cos(n),a=i*Math.cos(r),s=i*Math.sin(r),c=Math.sin(n);return u(t)||(t=new o),t.x=a,t.y=s,t.z=c,o.normalize(t,t)},i.prototype.geodeticSurfaceNormal=function(e,t){return u(t)||(t=new o),t=o.multiplyComponents(e,this._oneOverRadiiSquared,t),o.normalize(t,t)};var f=new o,d=new o;i.prototype.cartographicToCartesian=function(e,t){var r=f,n=d;this.geodeticSurfaceNormalCartographic(e,r),o.multiplyComponents(this._radiiSquared,r,n);var i=Math.sqrt(o.dot(r,n));return o.divideByScalar(n,i,n),o.multiplyByScalar(r,e.height,r),u(t)||(t=new o),o.add(n,r,t)},i.prototype.cartographicArrayToCartesianArray=function(e,t){if(!u(e))throw new l("cartographics is required.");var r=e.length;u(t)?t.length=r:t=new Array(r);for(var n=0;nl.x&&i.clone(r,l),mc.y&&i.clone(r,c),Ih.z&&i.clone(r,h)}var R=i.magnitudeSquared(i.subtract(l,o,T)),P=i.magnitudeSquared(i.subtract(c,a,T)),C=i.magnitudeSquared(i.subtract(h,u,T)),M=o,N=l,q=R;P>q&&(q=P,M=a,N=c),C>q&&(q=C,M=u,N=h);var L=x;L.x=.5*(M.x+N.x),L.y=.5*(M.y+N.y),L.z=.5*(M.z+N.z);var F=i.magnitudeSquared(i.subtract(N,L,T)),D=Math.sqrt(F),z=A;z.x=o.x,z.y=a.y,z.z=u.z;var k=S;k.x=l.x,k.y=c.y,k.z=h.z;var U=i.multiplyByScalar(i.add(z,k,T),.5,O),B=0;for(d=0;dB&&(B=j);var G=i.magnitudeSquared(i.subtract(r,L,T));if(G>F){var H=Math.sqrt(G);D=.5*(D+H),F=D*D;var V=H-D;L.x=(D*L.x+V*r.x)/H,L.y=(D*L.y+V*r.y)/H,L.z=(D*L.z+V*r.z)/H}}return Dd.x&&i.clone(l,d),Cp.y&&i.clone(l,p),Mm.z&&i.clone(l,m)}var N=i.magnitudeSquared(i.subtract(d,c,T)),q=i.magnitudeSquared(i.subtract(p,h,T)),L=i.magnitudeSquared(i.subtract(m,f,T)),F=c,D=d,z=N;q>z&&(z=q,F=h,D=p),L>z&&(z=L,F=f,D=m);var k=x;k.x=.5*(F.x+D.x),k.y=.5*(F.y+D.y),k.z=.5*(F.z+D.z);var U=i.magnitudeSquared(i.subtract(D,k,T)),B=Math.sqrt(U),j=A;j.x=c.x,j.y=h.y,j.z=f.z;var G=S;G.x=d.x,G.y=p.y,G.z=m.z;var H=i.multiplyByScalar(i.add(j,G,T),.5,O),V=0;for(R=0;RV&&(V=W);var Y=i.magnitudeSquared(i.subtract(l,k,T));if(Y>U){var X=Math.sqrt(Y);B=.5*(B+X),U=B*B;var Q=X-B;k.x=(B*k.x+Q*l.x)/X,k.y=(B*k.y+Q*l.y)/X,k.z=(B*k.z+Q*l.z)/X}}return Bc.x&&i.clone(o,c),Ih.y&&i.clone(o,h),Rf.z&&i.clone(o,f)}var P=i.magnitudeSquared(i.subtract(c,a,T)),C=i.magnitudeSquared(i.subtract(h,u,T)),M=i.magnitudeSquared(i.subtract(f,l,T)),N=a,q=c,L=P;C>L&&(L=C,N=u,q=h),M>L&&(L=M,N=l,q=f);var F=x;F.x=.5*(N.x+q.x),F.y=.5*(N.y+q.y),F.z=.5*(N.z+q.z);var D=i.magnitudeSquared(i.subtract(q,F,T)),z=Math.sqrt(D),k=A;k.x=a.x,k.y=u.y,k.z=l.z;var U=S;U.x=c.x,U.y=h.y,U.z=f.z;var B=i.multiplyByScalar(i.add(k,U,T),.5,O),j=0;for(p=0;pj&&(j=G);var H=i.magnitudeSquared(i.subtract(o,F,T));if(H>D){var V=Math.sqrt(H);z=.5*(z+V),D=z*z;var W=V-z;F.x=(z*F.x+W*o.x)/V,F.y=(z*F.y+W*o.y)/V,F.z=(z*F.z+W*o.z)/V}}return z=f+c)return e.clone(r),r;if(c>=f+a)return t.clone(r),r;var d=.5*(a+f+c),p=i.multiplyByScalar(h,(-a+d)/f,k);return i.add(p,o,p),i.clone(p,r.center),r.radius=d,r};var U=new i;n.expand=function(e,t,r){if(!s(e))throw new u("sphere is required.");if(!s(t))throw new u("point is required.");r=n.clone(e,r);var o=i.magnitude(i.subtract(t,r.center,U));return o>r.radius&&(r.radius=o),r},n.intersectPlane=function(e,t){if(!s(e))throw new u("sphere is required.");if(!s(t))throw new u("plane is required.");var r=e.center,n=e.radius,o=t.normal,a=i.dot(o,r)+t.distance;return a<-n?h.OUTSIDE:a4)throw new a("options.componentsPerAttribute must be between 1 and 4.");if(!o(e.values))throw new a("options.values is required.");this.componentDatatype=e.componentDatatype,this.componentsPerAttribute=e.componentsPerAttribute,this.normalize=i(e.normalize,!1),this.values=e.values}var i=r(3),o=r(1),a=r(2);e.exports=n},function(e,t,r){"use strict";var n=r(47),i={POINTS:n.POINTS,LINES:n.LINES,LINE_LOOP:n.LINE_LOOP,LINE_STRIP:n.LINE_STRIP,TRIANGLES:n.TRIANGLES,TRIANGLE_STRIP:n.TRIANGLE_STRIP,TRIANGLE_FAN:n.TRIANGLE_FAN,validate:function(e){return e===i.POINTS||e===i.LINES||e===i.LINE_LOOP||e===i.LINE_STRIP||e===i.TRIANGLES||e===i.TRIANGLE_STRIP||e===i.TRIANGLE_FAN}};e.exports=Object.freeze(i)},function(e,t,r){"use strict";function n(e){e=i(e,i.EMPTY_OBJECT),this.position=e.position,this.normal=e.normal,this.st=e.st,this.binormal=e.binormal,this.tangent=e.tangent,this.color=e.color}var i=r(3);e.exports=n},function(e,t,r){"use strict";var n=r(1),i=r(2),o=r(5),a=r(47),s={UNSIGNED_BYTE:a.UNSIGNED_BYTE,UNSIGNED_SHORT:a.UNSIGNED_SHORT,UNSIGNED_INT:a.UNSIGNED_INT};s.getSizeInBytes=function(e){switch(e){case s.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case s.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case s.UNSIGNED_INT:return Uint32Array.BYTES_PER_ELEMENT}throw new i("indexDatatype is required and must be a valid IndexDatatype constant.")},s.validate=function(e){return n(e)&&(e===s.UNSIGNED_BYTE||e===s.UNSIGNED_SHORT||e===s.UNSIGNED_INT)},s.createTypedArray=function(e,t){if(!n(e))throw new i("numberOfVertices is required.");return e>=o.SIXTY_FOUR_KILOBYTES?new Uint32Array(t):new Uint16Array(t)},s.createTypedArrayFromArrayBuffer=function(e,t,r,a){if(!n(e))throw new i("numberOfVertices is required.");if(!n(t))throw new i("sourceArray is required.");if(!n(r))throw new i("byteOffset is required.");return e>=o.SIXTY_FOUR_KILOBYTES?new Uint32Array(t,r,a):new Uint16Array(t,r,a)},e.exports=Object.freeze(s)},function(e,t,r){"use strict";function n(e,t,r){this.longitude=o(e,0),this.latitude=o(t,0),this.height=o(r,0)}var i=r(4),o=r(3),a=r(1),s=r(2),u=r(5),l=r(124);n.fromRadians=function(e,t,r,i){if(!a(e))throw new s("longitude is required.");if(!a(t))throw new s("latitude is required.");return r=o(r,0),a(i)?(i.longitude=e,i.latitude=t,i.height=r,i):new n(e,t,r)},n.fromDegrees=function(e,t,r,i){if(!a(e))throw new s("longitude is required.");if(!a(t))throw new s("latitude is required.");return e=u.toRadians(e),t=u.toRadians(t),n.fromRadians(e,t,r,i)};var c=new i,h=new i,f=new i,d=new i(1/6378137,1/6378137,1/6356752.314245179),p=new i(1/40680631590769,1/40680631590769,1/40408299984661.445),m=u.EPSILON1;n.fromCartesian=function(e,t,r){var o=a(t)?t.oneOverRadii:d,s=a(t)?t.oneOverRadiiSquared:p,g=a(t)?t._centerToleranceSquared:m,w=l(e,o,s,g,h);if(a(w)){var v=i.multiplyComponents(w,s,c);v=i.normalize(v,v);var y=i.subtract(e,w,f),_=Math.atan2(v.y,v.x),E=Math.asin(v.z),b=u.sign(i.dot(y,e))*i.magnitude(y);return a(r)?(r.longitude=_,r.latitude=E,r.height=b,r):new n(_,E,b)}},n.clone=function(e,t){if(a(e))return a(t)?(t.longitude=e.longitude,t.latitude=e.latitude,t.height=e.height,t):new n(e.longitude,e.latitude,e.height)},n.equals=function(e,t){return e===t||a(e)&&a(t)&&e.longitude===t.longitude&&e.latitude===t.latitude&&e.height===t.height},n.equalsEpsilon=function(e,t,r){if("number"!=typeof r)throw new s("epsilon is required and must be a number.");return e===t||a(e)&&a(t)&&Math.abs(e.longitude-t.longitude)<=r&&Math.abs(e.latitude-t.latitude)<=r&&Math.abs(e.height-t.height)<=r},n.ZERO=Object.freeze(new n(0,0,0)),n.prototype.clone=function(e){return n.clone(this,e)},n.prototype.equals=function(e){return n.equals(this,e)},n.prototype.equalsEpsilon=function(e,t){return n.equalsEpsilon(this,e,t)},n.prototype.toString=function(){return"("+this.longitude+", "+this.latitude+", "+this.height+")"},e.exports=n},function(e,t,r){"use strict";function n(e,t,r,n){this.west=o(e,0),this.south=o(t,0),this.east=o(r,0),this.north=o(n,0)}var i=r(15),o=r(3),a=r(1),s=r(2),u=r(6),l=r(5);Object.defineProperties(n.prototype,{width:{get:function(){return n.computeWidth(this)}},height:{get:function(){return n.computeHeight(this)}}}),n.packedLength=4,n.pack=function(e,t,r){if(!a(e))throw new s("value is required");if(!a(t))throw new s("array is required");return r=o(r,0),t[r++]=e.west,t[r++]=e.south,t[r++]=e.east,t[r]=e.north,t},n.unpack=function(e,t,r){if(!a(e))throw new s("array is required");return t=o(t,0),a(r)||(r=new n),r.west=e[t++],r.south=e[t++],r.east=e[t++],r.north=e[t],r},n.computeWidth=function(e){if(!a(e))throw new s("rectangle is required.");var t=e.east,r=e.west;return t=0?p.longitude:p.longitude+l.TWO_PI;o=Math.min(o,m),u=Math.max(u,m)}return i-r>u-o&&(r=o,i=u,i>l.PI&&(i-=l.TWO_PI),r>l.PI&&(r-=l.TWO_PI)),a(t)?(t.west=r,t.south=c,t.east=i,t.north=h,t):new n(r,c,i,h)},n.fromCartesianArray=function(e,t,r){if(!a(e))throw new s("cartesians is required.");for(var i=Number.MAX_VALUE,o=-Number.MAX_VALUE,u=Number.MAX_VALUE,c=-Number.MAX_VALUE,h=Number.MAX_VALUE,f=-Number.MAX_VALUE,d=0,p=e.length;d=0?m.longitude:m.longitude+l.TWO_PI;u=Math.min(u,g),c=Math.max(c,g)}return o-i>c-u&&(i=u,o=c,o>l.PI&&(o-=l.TWO_PI),i>l.PI&&(i-=l.TWO_PI)),a(r)?(r.west=i,r.south=h,r.east=o,r.north=f,r):new n(i,h,o,f)},n.clone=function(e,t){if(a(e))return a(t)?(t.west=e.west,t.south=e.south,t.east=e.east,t.north=e.north,t):new n(e.west,e.south,e.east,e.north)},n.prototype.clone=function(e){return n.clone(this,e)},n.prototype.equals=function(e){return n.equals(this,e)},n.equals=function(e,t){return e===t||a(e)&&a(t)&&e.west===t.west&&e.south===t.south&&e.east===t.east&&e.north===t.north},n.prototype.equalsEpsilon=function(e,t){if("number"!=typeof t)throw new s("epsilon is required and must be a number.");return a(e)&&Math.abs(this.west-e.west)<=t&&Math.abs(this.south-e.south)<=t&&Math.abs(this.east-e.east)<=t&&Math.abs(this.north-e.north)<=t},n.validate=function(e){if(!a(e))throw new s("rectangle is required");var t=e.north;if("number"!=typeof t)throw new s("north is required to be a number.");if(t<-l.PI_OVER_TWO||t>l.PI_OVER_TWO)throw new s("north must be in the interval [-Pi/2, Pi/2].");var r=e.south;if("number"!=typeof r)throw new s("south is required to be a number.");if(r<-l.PI_OVER_TWO||r>l.PI_OVER_TWO)throw new s("south must be in the interval [-Pi/2, Pi/2].");var n=e.west;if("number"!=typeof n)throw new s("west is required to be a number.");if(n<-Math.PI||n>Math.PI)throw new s("west must be in the interval [-Pi, Pi].");var i=e.east;if("number"!=typeof i)throw new s("east is required to be a number.");if(i<-Math.PI||i>Math.PI)throw new s("east must be in the interval [-Pi, Pi].")},n.southwest=function(e,t){if(!a(e))throw new s("rectangle is required");return a(t)?(t.longitude=e.west,t.latitude=e.south,t.height=0,t):new i(e.west,e.south)},n.northwest=function(e,t){if(!a(e))throw new s("rectangle is required");return a(t)?(t.longitude=e.west,t.latitude=e.north,t.height=0,t):new i(e.west,e.north)},n.northeast=function(e,t){if(!a(e))throw new s("rectangle is required");return a(t)?(t.longitude=e.east,t.latitude=e.north,t.height=0,t):new i(e.east,e.north)},n.southeast=function(e,t){if(!a(e))throw new s("rectangle is required");return a(t)?(t.longitude=e.east,t.latitude=e.south,t.height=0,t):new i(e.east,e.south)},n.center=function(e,t){if(!a(e))throw new s("rectangle is required");var r=e.east,n=e.west;r0?i+=l.TWO_PI:u0&&(u+=l.TWO_PI),i=p))return a(r)?(r.west=h,r.south=d,r.east=f,r.north=p,r):new n(h,d,f,p)}},n.simpleIntersection=function(e,t,r){if(!a(e))throw new s("rectangle is required");if(!a(t))throw new s("otherRectangle is required.");var i=Math.max(e.west,t.west),o=Math.max(e.south,t.south),u=Math.min(e.east,t.east),l=Math.min(e.north,t.north);if(!(o>=l||i>=u))return a(r)?(r.west=i,r.south=o,r.east=u,r.north=l,r):new n(i,o,u,l)},n.union=function(e,t,r){if(!a(e))throw new s("rectangle is required");if(!a(t))throw new s("otherRectangle is required.");a(r)||(r=new n);var i=e.east,o=e.west,u=t.east,c=t.west;i0?i+=l.TWO_PI:u0&&(u+=l.TWO_PI),ii||l.equalsEpsilon(r,i,l.EPSILON14))&&(r=e.south&&n<=e.north};var c=new i;n.subsample=function(e,t,r,i){if(!a(e))throw new s("rectangle is required");t=o(t,u.WGS84),r=o(r,0),a(i)||(i=[]);var h=0,f=e.north,d=e.south,p=e.east,m=e.west,g=c;g.height=r,g.longitude=m,g.latitude=f,i[h]=t.cartographicToCartesian(g,i[h]),h++,g.longitude=p,i[h]=t.cartographicToCartesian(g,i[h]),h++,g.latitude=d,i[h]=t.cartographicToCartesian(g,i[h]),h++,g.longitude=m,i[h]=t.cartographicToCartesian(g,i[h]),h++,f<0?g.latitude=f:d>0?g.latitude=d:g.latitude=0;for(var w=1;w<8;++w)g.longitude=-Math.PI+w*l.PI_OVER_TWO,n.contains(e,g)&&(i[h]=t.cartographicToCartesian(g,i[h]),h++);return 0===g.latitude&&(g.longitude=m,i[h]=t.cartographicToCartesian(g,i[h]),h++,g.longitude=p,i[h]=t.cartographicToCartesian(g,i[h]),h++),i.length=h,i},n.MAX_VALUE=Object.freeze(new n(-Math.PI,-l.PI_OVER_TWO,Math.PI,l.PI_OVER_TWO)),e.exports=n},function(e,t,r){"use strict";function n(e,t,r,n,i,o,a,s,l){this[0]=u(e,0),this[1]=u(n,0),this[2]=u(a,0),this[3]=u(t,0),this[4]=u(i,0),this[5]=u(s,0),this[6]=u(r,0),this[7]=u(o,0),this[8]=u(l,0)}function i(e){for(var t=0,r=0;r<9;++r){var n=e[r];t+=n*n}return Math.sqrt(t)}function o(e){for(var t=0,r=0;r<3;++r){var i=e[n.getElementIndex(m[r],p[r])];t+=2*i*i}return Math.sqrt(t)}function a(e,t){for(var r=h.EPSILON15,i=0,o=1,a=0;a<3;++a){var s=Math.abs(e[n.getElementIndex(m[a],p[a])]);s>i&&(o=a,i=s)}var u=1,l=0,c=p[o],f=m[o];if(Math.abs(e[n.getElementIndex(f,c)])>r){var d,g=e[n.getElementIndex(f,f)],w=e[n.getElementIndex(c,c)],v=e[n.getElementIndex(f,c)],y=(g-w)/2/v;d=y<0?-1/(-y+Math.sqrt(1+y*y)):1/(y+Math.sqrt(1+y*y)),u=1/Math.sqrt(1+d*d),l=d*u}return t=n.clone(n.IDENTITY,t),t[n.getElementIndex(c,c)]=t[n.getElementIndex(f,f)]=u,t[n.getElementIndex(f,c)]=l,t[n.getElementIndex(c,f)]=-l,t}var s=r(4),u=r(3),l=r(1),c=r(2),h=r(5);n.packedLength=9,n.pack=function(e,t,r){if(!l(e))throw new c("value is required");if(!l(t))throw new c("array is required");return r=u(r,0),t[r++]=e[0],t[r++]=e[1],t[r++]=e[2],t[r++]=e[3],t[r++]=e[4],t[r++]=e[5],t[r++]=e[6],t[r++]=e[7],t[r++]=e[8],t},n.unpack=function(e,t,r){if(!l(e))throw new c("array is required");return t=u(t,0),l(r)||(r=new n),r[0]=e[t++],r[1]=e[t++],r[2]=e[t++],r[3]=e[t++],r[4]=e[t++],r[5]=e[t++],r[6]=e[t++],r[7]=e[t++],r[8]=e[t++],r},n.clone=function(e,t){if(l(e))return l(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t):new n(e[0],e[3],e[6],e[1],e[4],e[7],e[2],e[5],e[8])},n.fromArray=function(e,t,r){if(!l(e))throw new c("array is required");return t=u(t,0),l(r)||(r=new n),r[0]=e[t],r[1]=e[t+1],r[2]=e[t+2],r[3]=e[t+3],r[4]=e[t+4],r[5]=e[t+5],r[6]=e[t+6],r[7]=e[t+7],r[8]=e[t+8],r},n.fromColumnMajorArray=function(e,t){if(!l(e))throw new c("values parameter is required");return n.clone(e,t)},n.fromRowMajorArray=function(e,t){if(!l(e))throw new c("values is required.");return l(t)?(t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],t):new n(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])},n.fromQuaternion=function(e,t){if(!l(e))throw new c("quaternion is required");var r=e.x*e.x,i=e.x*e.y,o=e.x*e.z,a=e.x*e.w,s=e.y*e.y,u=e.y*e.z,h=e.y*e.w,f=e.z*e.z,d=e.z*e.w,p=e.w*e.w,m=r-s-f+p,g=2*(i-d),w=2*(o+h),v=2*(i+d),y=-r+s-f+p,_=2*(u-a),E=2*(o-h),b=2*(u+a),T=-r-s+f+p;return l(t)?(t[0]=m,t[1]=v,t[2]=E,t[3]=g,t[4]=y,t[5]=b,t[6]=w,t[7]=_,t[8]=T,t):new n(m,g,w,v,y,_,E,b,T)},n.fromHeadingPitchRoll=function(e,t){if(!l(e))throw new c("headingPitchRoll is required");var r=Math.cos(-e.pitch),i=Math.cos(-e.heading),o=Math.cos(e.roll),a=Math.sin(-e.pitch),s=Math.sin(-e.heading),u=Math.sin(e.roll),h=r*i,f=-o*s+u*a*i,d=u*s+o*a*i,p=r*s,m=o*i+u*a*s,g=-a*o+o*a*s,w=-a,v=u*r,y=o*r;return l(t)?(t[0]=h,t[1]=p,t[2]=w,t[3]=f,t[4]=m,t[5]=v,t[6]=d,t[7]=g,t[8]=y,t):new n(h,f,d,p,m,g,w,v,y)},n.fromScale=function(e,t){if(!l(e))throw new c("scale is required.");return l(t)?(t[0]=e.x,t[1]=0,t[2]=0,t[3]=0,t[4]=e.y,t[5]=0,t[6]=0,t[7]=0,t[8]=e.z,t):new n(e.x,0,0,0,e.y,0,0,0,e.z)},n.fromUniformScale=function(e,t){if("number"!=typeof e)throw new c("scale is required.");return l(t)?(t[0]=e,t[1]=0,t[2]=0,t[3]=0,t[4]=e,t[5]=0,t[6]=0,t[7]=0,t[8]=e,t):new n(e,0,0,0,e,0,0,0,e)},n.fromCrossProduct=function(e,t){if(!l(e))throw new c("vector is required.");return l(t)?(t[0]=0,t[1]=e.z,t[2]=-e.y,t[3]=-e.z,t[4]=0,t[5]=e.x,t[6]=e.y,t[7]=-e.x,t[8]=0,t):new n(0,-e.z,e.y,e.z,0,-e.x,-e.y,e.x,0)},n.fromRotationX=function(e,t){if(!l(e))throw new c("angle is required.");var r=Math.cos(e),i=Math.sin(e);return l(t)?(t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=r,t[5]=i,t[6]=0,t[7]=-i,t[8]=r,t):new n(1,0,0,0,r,-i,0,i,r)},n.fromRotationY=function(e,t){if(!l(e))throw new c("angle is required.");var r=Math.cos(e),i=Math.sin(e);return l(t)?(t[0]=r,t[1]=0,t[2]=-i,t[3]=0,t[4]=1,t[5]=0,t[6]=i,t[7]=0,t[8]=r,t):new n(r,0,i,0,1,0,-i,0,r)},n.fromRotationZ=function(e,t){if(!l(e))throw new c("angle is required.");var r=Math.cos(e),i=Math.sin(e);return l(t)?(t[0]=r,t[1]=i,t[2]=0,t[3]=-i,t[4]=r,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t):new n(r,-i,0,i,r,0,0,0,1)},n.toArray=function(e,t){if(!l(e))throw new c("matrix is required");return l(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t):[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8]]},n.getElementIndex=function(e,t){if("number"!=typeof t||t<0||t>2)throw new c("row must be 0, 1, or 2.");if("number"!=typeof e||e<0||e>2)throw new c("column must be 0, 1, or 2.");return 3*e+t},n.getColumn=function(e,t,r){if(!l(e))throw new c("matrix is required.");if("number"!=typeof t||t<0||t>2)throw new c("index must be 0, 1, or 2.");if(!l(r))throw new c("result is required");var n=3*t,i=e[n],o=e[n+1],a=e[n+2];return r.x=i,r.y=o,r.z=a,r},n.setColumn=function(e,t,r,i){if(!l(e))throw new c("matrix is required");if(!l(r))throw new c("cartesian is required");if("number"!=typeof t||t<0||t>2)throw new c("index must be 0, 1, or 2.");if(!l(i))throw new c("result is required");i=n.clone(e,i);var o=3*t;return i[o]=r.x,i[o+1]=r.y,i[o+2]=r.z,i},n.getRow=function(e,t,r){if(!l(e))throw new c("matrix is required.");if("number"!=typeof t||t<0||t>2)throw new c("index must be 0, 1, or 2.");if(!l(r))throw new c("result is required");var n=e[t],i=e[t+3],o=e[t+6];return r.x=n,r.y=i,r.z=o,r},n.setRow=function(e,t,r,i){if(!l(e))throw new c("matrix is required");if(!l(r))throw new c("cartesian is required");if("number"!=typeof t||t<0||t>2)throw new c("index must be 0, 1, or 2.");if(!l(i))throw new c("result is required");return i=n.clone(e,i),i[t]=r.x,i[t+3]=r.y,i[t+6]=r.z,i};var f=new s;n.getScale=function(e,t){if(!l(e))throw new c("matrix is required.");if(!l(t))throw new c("result is required");return t.x=s.magnitude(s.fromElements(e[0],e[1],e[2],f)),t.y=s.magnitude(s.fromElements(e[3],e[4],e[5],f)),t.z=s.magnitude(s.fromElements(e[6],e[7],e[8],f)),t};var d=new s;n.getMaximumScale=function(e){return n.getScale(e,d),s.maximumComponent(d)},n.multiply=function(e,t,r){if(!l(e))throw new c("left is required");if(!l(t))throw new c("right is required");if(!l(r))throw new c("result is required");var n=e[0]*t[0]+e[3]*t[1]+e[6]*t[2],i=e[1]*t[0]+e[4]*t[1]+e[7]*t[2],o=e[2]*t[0]+e[5]*t[1]+e[8]*t[2],a=e[0]*t[3]+e[3]*t[4]+e[6]*t[5],s=e[1]*t[3]+e[4]*t[4]+e[7]*t[5],u=e[2]*t[3]+e[5]*t[4]+e[8]*t[5],h=e[0]*t[6]+e[3]*t[7]+e[6]*t[8],f=e[1]*t[6]+e[4]*t[7]+e[7]*t[8],d=e[2]*t[6]+e[5]*t[7]+e[8]*t[8];return r[0]=n,r[1]=i,r[2]=o,r[3]=a,r[4]=s,r[5]=u,r[6]=h,r[7]=f,r[8]=d,r},n.add=function(e,t,r){if(!l(e))throw new c("left is required");if(!l(t))throw new c("right is required");if(!l(r))throw new c("result is required");return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r[2]=e[2]+t[2],r[3]=e[3]+t[3],r[4]=e[4]+t[4],r[5]=e[5]+t[5],r[6]=e[6]+t[6],r[7]=e[7]+t[7],r[8]=e[8]+t[8],r},n.subtract=function(e,t,r){if(!l(e))throw new c("left is required");if(!l(t))throw new c("right is required");if(!l(r))throw new c("result is required");return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r[2]=e[2]-t[2],r[3]=e[3]-t[3],r[4]=e[4]-t[4],r[5]=e[5]-t[5],r[6]=e[6]-t[6],r[7]=e[7]-t[7],r[8]=e[8]-t[8],r},n.multiplyByVector=function(e,t,r){if(!l(e))throw new c("matrix is required");if(!l(t))throw new c("cartesian is required");if(!l(r))throw new c("result is required");var n=t.x,i=t.y,o=t.z,a=e[0]*n+e[3]*i+e[6]*o,s=e[1]*n+e[4]*i+e[7]*o,u=e[2]*n+e[5]*i+e[8]*o;return r.x=a,r.y=s,r.z=u,r},n.multiplyByScalar=function(e,t,r){if(!l(e))throw new c("matrix is required");if("number"!=typeof t)throw new c("scalar must be a number");if(!l(r))throw new c("result is required");return r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t,r[3]=e[3]*t,r[4]=e[4]*t,r[5]=e[5]*t,r[6]=e[6]*t,r[7]=e[7]*t,r[8]=e[8]*t,r},n.multiplyByScale=function(e,t,r){if(!l(e))throw new c("matrix is required");if(!l(t))throw new c("scale is required");if(!l(r))throw new c("result is required");return r[0]=e[0]*t.x,r[1]=e[1]*t.x,r[2]=e[2]*t.x,r[3]=e[3]*t.y,r[4]=e[4]*t.y,r[5]=e[5]*t.y,r[6]=e[6]*t.z,r[7]=e[7]*t.z,r[8]=e[8]*t.z,r},n.negate=function(e,t){if(!l(e))throw new c("matrix is required");if(!l(t))throw new c("result is required");return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t[4]=-e[4],t[5]=-e[5],t[6]=-e[6],t[7]=-e[7],t[8]=-e[8],t},n.transpose=function(e,t){if(!l(e))throw new c("matrix is required");if(!l(t))throw new c("result is required");var r=e[0],n=e[3],i=e[6],o=e[1],a=e[4],s=e[7],u=e[2],h=e[5],f=e[8];return t[0]=r,t[1]=n,t[2]=i,t[3]=o,t[4]=a,t[5]=s,t[6]=u,t[7]=h,t[8]=f,t};var p=[1,0,0],m=[2,2,1],g=new n,w=new n;n.computeEigenDecomposition=function(e,t){if(!l(e))throw new c("matrix is required.");var r=h.EPSILON20,s=10,u=0,f=0;l(t)||(t={});for(var d=t.unitary=n.clone(n.IDENTITY,t.unitary),p=t.diagonal=n.clone(e,t.diagonal),m=r*i(p);fm;)a(p,g),n.transpose(g,w),n.multiply(p,g,p),n.multiply(w,p,p),n.multiply(d,g,d),++u>2&&(++f,u=0);return t},n.abs=function(e,t){if(!l(e))throw new c("matrix is required");if(!l(t))throw new c("result is required");return t[0]=Math.abs(e[0]),t[1]=Math.abs(e[1]),t[2]=Math.abs(e[2]),t[3]=Math.abs(e[3]),t[4]=Math.abs(e[4]),t[5]=Math.abs(e[5]),t[6]=Math.abs(e[6]),t[7]=Math.abs(e[7]),t[8]=Math.abs(e[8]),t},n.determinant=function(e){if(!l(e))throw new c("matrix is required");var t=e[0],r=e[3],n=e[6],i=e[1],o=e[4],a=e[7],s=e[2],u=e[5],h=e[8];return t*(o*h-u*a)+i*(u*n-r*h)+s*(r*a-o*n)},n.inverse=function(e,t){if(!l(e))throw new c("matrix is required");if(!l(t))throw new c("result is required");var r=e[0],i=e[1],o=e[2],a=e[3],s=e[4],u=e[5],f=e[6],d=e[7],p=e[8],m=n.determinant(e);if(Math.abs(m)<=h.EPSILON15)throw new c("matrix is not invertible");t[0]=s*p-d*u,t[1]=d*o-i*p,t[2]=i*u-s*o,t[3]=f*u-a*p,t[4]=r*p-f*o,t[5]=a*o-r*u,t[6]=a*d-f*s,t[7]=f*i-r*d,t[8]=r*s-a*i;var g=1/m;return n.multiplyByScalar(t,g,t)},n.equals=function(e,t){return e===t||l(e)&&l(t)&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]},n.equalsEpsilon=function(e,t,r){if("number"!=typeof r)throw new c("epsilon must be a number");return e===t||l(e)&&l(t)&&Math.abs(e[0]-t[0])<=r&&Math.abs(e[1]-t[1])<=r&&Math.abs(e[2]-t[2])<=r&&Math.abs(e[3]-t[3])<=r&&Math.abs(e[4]-t[4])<=r&&Math.abs(e[5]-t[5])<=r&&Math.abs(e[6]-t[6])<=r&&Math.abs(e[7]-t[7])<=r&&Math.abs(e[8]-t[8])<=r},n.IDENTITY=Object.freeze(new n(1,0,0,0,1,0,0,0,1)),n.ZERO=Object.freeze(new n(0,0,0,0,0,0,0,0,0)),n.COLUMN0ROW0=0,n.COLUMN0ROW1=1,n.COLUMN0ROW2=2,n.COLUMN1ROW0=3,n.COLUMN1ROW1=4,n.COLUMN1ROW2=5,n.COLUMN2ROW0=6,n.COLUMN2ROW1=7,n.COLUMN2ROW2=8,Object.defineProperties(n.prototype,{length:{get:function(){return n.packedLength}}}),n.prototype.clone=function(e){return n.clone(this,e)},n.prototype.equals=function(e){return n.equals(this,e)},n.equalsArray=function(e,t,r){return e[0]===t[r]&&e[1]===t[r+1]&&e[2]===t[r+2]&&e[3]===t[r+3]&&e[4]===t[r+4]&&e[5]===t[r+5]&&e[6]===t[r+6]&&e[7]===t[r+7]&&e[8]===t[r+8]},n.prototype.equalsEpsilon=function(e,t){return n.equalsEpsilon(this,e,t)},n.prototype.toString=function(){return"("+this[0]+", "+this[3]+", "+this[6]+")\n("+this[1]+", "+this[4]+", "+this[7]+")\n("+this[2]+", "+this[5]+", "+this[8]+")"},e.exports=n},function(e,t,r){(function(t,r,n){/* @preserve
- * The MIT License (MIT)
- *
- * Copyright (c) 2013-2015 Petka Antonov
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- *
- */
-!function(t){e.exports=t()}(function(){return function e(t,r,n){function i(a,s){if(!r[a]){if(!t[a]){var u="function"==typeof _dereq_&&_dereq_;if(!s&&u)return u(a,!0);if(o)return o(a,!0);var l=new Error("Cannot find module '"+a+"'");throw l.code="MODULE_NOT_FOUND",l}var c=r[a]={exports:{}};t[a][0].call(c.exports,function(e){var r=t[a][1][e];return i(r?r:e)},c,c.exports,e,t,r,n)}return r[a].exports}for(var o="function"==typeof _dereq_&&_dereq_,a=0;a0;){var t=e.shift();if("function"==typeof t){var r=e.shift(),n=e.shift();t.call(r,n)}else t._settlePromises()}},i.prototype._drainQueues=function(){this._drainQueue(this._normalQueue),this._reset(),this._haveDrainedQueues=!0,this._drainQueue(this._lateQueue)},i.prototype._queueTick=function(){this._isTickUsed||(this._isTickUsed=!0,this._schedule(this.drainQueues))},i.prototype._reset=function(){this._isTickUsed=!1},r.exports=i,r.exports.firstLineError=u},{"./queue":26,"./schedule":29,"./util":36}],3:[function(e,t,r){"use strict";t.exports=function(e,t,r,n){var i=!1,o=function(e,t){this._reject(t)},a=function(e,t){t.promiseRejectionQueued=!0,t.bindingPromise._then(o,o,null,this,e)},s=function(e,t){0===(50397184&this._bitField)&&this._resolveCallback(t.target)},u=function(e,t){t.promiseRejectionQueued||this._reject(e)};e.prototype.bind=function(o){i||(i=!0,e.prototype._propagateFrom=n.propagateFromFunction(),e.prototype._boundValue=n.boundValueFunction());var l=r(o),c=new e(t);c._propagateFrom(this,1);var h=this._target();if(c._setBoundTo(l),l instanceof e){var f={promiseRejectionQueued:!1,promise:c,target:h,bindingPromise:l};h._then(t,a,void 0,c,f),l._then(s,u,void 0,c,f),c._setOnCancel(l)}else c._resolveCallback(h);return c},e.prototype._setBoundTo=function(e){void 0!==e?(this._bitField=2097152|this._bitField,this._boundTo=e):this._bitField=this._bitField&-2097153},e.prototype._isBound=function(){return 2097152===(2097152&this._bitField)},e.bind=function(t,r){return e.resolve(r).bind(t)}}},{}],4:[function(e,t,r){"use strict";function n(){try{Promise===o&&(Promise=i)}catch(e){}return o}var i;"undefined"!=typeof Promise&&(i=Promise);var o=e("./promise")();o.noConflict=n,t.exports=o},{"./promise":22}],5:[function(e,t,r){"use strict";var n=Object.create;if(n){var i=n(null),o=n(null);i[" size"]=o[" size"]=0}t.exports=function(t){function r(e,r){var n;if(null!=e&&(n=e[r]),"function"!=typeof n){var i="Object "+s.classString(e)+" has no method '"+s.toString(r)+"'";throw new t.TypeError(i)}return n}function n(e){var t=this.pop(),n=r(e,t);return n.apply(e,this)}function i(e){return e[this]}function o(e){var t=+this;return t<0&&(t=Math.max(0,t+e.length)),e[t]}var a,s=e("./util"),u=s.canEvaluate;s.isIdentifier,t.prototype.call=function(e){var t=[].slice.call(arguments,1);return t.push(e),this._then(n,void 0,void 0,t,void 0)},t.prototype.get=function(e){var t,r="number"==typeof e;if(r)t=o;else if(u){var n=a(e);t=null!==n?n:i}else t=i;return this._then(t,void 0,void 0,e,void 0)}}},{"./util":36}],6:[function(e,t,r){"use strict";t.exports=function(t,r,n,i){var o=e("./util"),a=o.tryCatch,s=o.errorObj,u=t._async;t.prototype.break=t.prototype.cancel=function(){if(!i.cancellation())return this._warn("cancellation is disabled");for(var e=this,t=e;e._isCancellable();){if(!e._cancelBy(t)){t._isFollowing()?t._followee().cancel():t._cancelBranched();break}var r=e._cancellationParent;if(null==r||!r._isCancellable()){e._isFollowing()?e._followee().cancel():e._cancelBranched();break}e._isFollowing()&&e._followee().cancel(),e._setWillBeCancelled(),t=e,e=r}},t.prototype._branchHasCancelled=function(){this._branchesRemainingToCancel--},t.prototype._enoughBranchesHaveCancelled=function(){return void 0===this._branchesRemainingToCancel||this._branchesRemainingToCancel<=0},t.prototype._cancelBy=function(e){return e===this?(this._branchesRemainingToCancel=0,this._invokeOnCancel(),!0):(this._branchHasCancelled(),!!this._enoughBranchesHaveCancelled()&&(this._invokeOnCancel(),!0))},t.prototype._cancelBranched=function(){this._enoughBranchesHaveCancelled()&&this._cancel()},t.prototype._cancel=function(){this._isCancellable()&&(this._setCancelled(),u.invoke(this._cancelPromises,this,void 0))},t.prototype._cancelPromises=function(){this._length()>0&&this._settlePromises()},t.prototype._unsetOnCancel=function(){this._onCancelField=void 0},t.prototype._isCancellable=function(){return this.isPending()&&!this._isCancelled()},t.prototype.isCancellable=function(){return this.isPending()&&!this.isCancelled()},t.prototype._doInvokeOnCancel=function(e,t){if(o.isArray(e))for(var r=0;r=0)return o[e]}var i=!1,o=[];return e.prototype._promiseCreated=function(){},e.prototype._pushContext=function(){},e.prototype._popContext=function(){return null},e._peekContext=e.prototype._peekContext=function(){},t.prototype._pushContext=function(){void 0!==this._trace&&(this._trace._promiseCreated=null,o.push(this._trace))},t.prototype._popContext=function(){if(void 0!==this._trace){var e=o.pop(),t=e._promiseCreated;return e._promiseCreated=null,t}return null},t.CapturedTrace=null,t.create=r,t.deactivateLongStackTraces=function(){},t.activateLongStackTraces=function(){var r=e.prototype._pushContext,o=e.prototype._popContext,a=e._peekContext,s=e.prototype._peekContext,u=e.prototype._promiseCreated;t.deactivateLongStackTraces=function(){e.prototype._pushContext=r,e.prototype._popContext=o,e._peekContext=a,e.prototype._peekContext=s,e.prototype._promiseCreated=u,i=!1},i=!0,e.prototype._pushContext=t.prototype._pushContext,e.prototype._popContext=t.prototype._popContext,e._peekContext=e.prototype._peekContext=n,e.prototype._promiseCreated=function(){var e=this._peekContext();e&&null==e._promiseCreated&&(e._promiseCreated=this)}},t}},{}],9:[function(e,r,n){"use strict";r.exports=function(r,n){function i(e,t){return{promise:t}}function o(){return!1}function a(e,t,r){var n=this;try{e(t,r,function(e){if("function"!=typeof e)throw new TypeError("onCancel must be a function, got: "+k.toString(e));n._attachCancellationCallback(e)})}catch(e){return e}}function s(e){if(!this._isCancellable())return this;var t=this._onCancel();void 0!==t?k.isArray(t)?t.push(e):this._setOnCancel([t,e]):this._setOnCancel(e)}function u(){return this._onCancelField}function l(e){this._onCancelField=e}function c(){this._cancellationParent=void 0,this._onCancelField=void 0}function h(e,t){if(0!==(1&t)){this._cancellationParent=e;var r=e._branchesRemainingToCancel;void 0===r&&(r=0),e._branchesRemainingToCancel=r+1}0!==(2&t)&&e._isBound()&&this._setBoundTo(e._boundTo)}function f(e,t){0!==(2&t)&&e._isBound()&&this._setBoundTo(e._boundTo)}function d(){var e=this._boundTo;return void 0!==e&&e instanceof r?e.isFulfilled()?e.value():void 0:e}function p(){this._trace=new M(this._peekContext())}function m(e,t){if(U(e)){var r=this._trace;if(void 0!==r&&t&&(r=r._parent),void 0!==r)r.attachExtraTrace(e);else if(!e.__stackCleaned__){var n=x(e);k.notEnumerableProp(e,"stack",n.message+"\n"+n.stack.join("\n")),k.notEnumerableProp(e,"__stackCleaned__",!0)}}}function g(e,t,r,n,i){if(void 0===e&&null!==t&&Z){if(void 0!==i&&i._returnedNonUndefined())return;if(0===(65535&n._bitField))return;r&&(r+=" ");var o="",a="";if(t._trace){for(var s=t._trace.stack.split("\n"),u=b(s),l=u.length-1;l>=0;--l){var c=u[l];if(!j.test(c)){var h=c.match(G);h&&(o="at "+h[1]+":"+h[2]+":"+h[3]+" ");break}}if(u.length>0)for(var f=u[0],l=0;l0&&(a="\n"+s[l-1]);break}}var d="a promise was created in a "+r+"handler "+o+"but was not returned from it, see http://goo.gl/rRqMUw"+a;n._warn(d,!0,t)}}function w(e,t){var r=e+" is deprecated and will be removed in a future version.";return t&&(r+=" Use "+t+" instead."),v(r)}function v(e,t,n){if(ae.warnings){var i,o=new z(e);if(t)n._attachExtraTrace(o);else if(ae.longStackTraces&&(i=r._peekContext()))i.attachExtraTrace(o);else{var a=x(o);o.stack=a.message+"\n"+a.stack.join("\n")}te("warning",o)||A(o,"",!0)}}function y(e,t){for(var r=0;r=0;--s)if(n[s]===o){a=s;break}for(var s=a;s>=0;--s){var u=n[s];if(t[i]!==u)break;t.pop(),i--}t=n}}function b(e){for(var t=[],r=0;r0&&(t=t.slice(r)),t}function x(e){var t=e.stack,r=e.toString();return t="string"==typeof t&&t.length>0?T(e):[" (No stack trace)"],{message:r,stack:b(t)}}function A(e,t,r){if("undefined"!=typeof console){var n;if(k.isObject(e)){var i=e.stack;n=t+V(i,e)}else n=t+String(e);"function"==typeof L?L(n,r):"function"!=typeof console.log&&"object"!=typeof console.log||console.log(n)}}function S(e,t,r,n){var i=!1;try{"function"==typeof t&&(i=!0,"rejectionHandled"===e?t(n):t(r,n))}catch(e){D.throwLater(e)}"unhandledRejection"===e?te(e,r,n)||i||A(r,"Unhandled rejection "):te(e,n)}function O(e){var t;if("function"==typeof e)t="[function "+(e.name||"anonymous")+"]";else{t=e&&"function"==typeof e.toString?e.toString():k.toString(e);var r=/\[object [a-zA-Z0-9$_]+\]/;if(r.test(t))try{var n=JSON.stringify(e);t=n}catch(e){}0===t.length&&(t="(empty array)")}return"(<"+I(t)+">, no stack trace)"}function I(e){var t=41;return e.length=s||(ne=function(e){if(B.test(e))return!0;var t=P(e);return!!(t&&t.fileName===r&&a<=t.line&&t.line<=s)})}}function M(e){this._parent=e,this._promisesCreated=0;var t=this._length=1+(void 0===e?0:e._length);oe(this,M),t>32&&this.uncycle()}var N,q,L,F=r._getDomain,D=r._async,z=e("./errors").Warning,k=e("./util"),U=k.canAttachTrace,B=/[\\\/]bluebird[\\\/]js[\\\/](release|debug|instrumented)/,j=/\((?:timers\.js):\d+:\d+\)/,G=/[\/<\(](.+?):(\d+):(\d+)\)?\s*$/,H=null,V=null,W=!1,Y=!(0==k.env("BLUEBIRD_DEBUG")),X=!(0==k.env("BLUEBIRD_WARNINGS")||!Y&&!k.env("BLUEBIRD_WARNINGS")),Q=!(0==k.env("BLUEBIRD_LONG_STACK_TRACES")||!Y&&!k.env("BLUEBIRD_LONG_STACK_TRACES")),Z=0!=k.env("BLUEBIRD_W_FORGOTTEN_RETURN")&&(X||!!k.env("BLUEBIRD_W_FORGOTTEN_RETURN"));r.prototype.suppressUnhandledRejections=function(){var e=this._target();e._bitField=e._bitField&-1048577|524288},r.prototype._ensurePossibleRejectionHandled=function(){0===(524288&this._bitField)&&(this._setRejectionIsUnhandled(),D.invokeLater(this._notifyUnhandledRejection,this,void 0))},r.prototype._notifyUnhandledRejectionIsHandled=function(){S("rejectionHandled",N,void 0,this)},r.prototype._setReturnedNonUndefined=function(){this._bitField=268435456|this._bitField},r.prototype._returnedNonUndefined=function(){return 0!==(268435456&this._bitField)},r.prototype._notifyUnhandledRejection=function(){if(this._isRejectionUnhandled()){var e=this._settledValue();this._setUnhandledRejectionIsNotified(),S("unhandledRejection",q,e,this)}},r.prototype._setUnhandledRejectionIsNotified=function(){this._bitField=262144|this._bitField},r.prototype._unsetUnhandledRejectionIsNotified=function(){this._bitField=this._bitField&-262145},r.prototype._isUnhandledRejectionNotified=function(){return(262144&this._bitField)>0},r.prototype._setRejectionIsUnhandled=function(){this._bitField=1048576|this._bitField},r.prototype._unsetRejectionIsUnhandled=function(){this._bitField=this._bitField&-1048577,this._isUnhandledRejectionNotified()&&(this._unsetUnhandledRejectionIsNotified(),this._notifyUnhandledRejectionIsHandled())},r.prototype._isRejectionUnhandled=function(){return(1048576&this._bitField)>0},r.prototype._warn=function(e,t,r){return v(e,t,r||this)},r.onPossiblyUnhandledRejection=function(e){var t=F();q="function"==typeof e?null===t?e:k.domainBind(t,e):void 0},r.onUnhandledRejectionHandled=function(e){var t=F();N="function"==typeof e?null===t?e:k.domainBind(t,e):void 0};var K=function(){};r.longStackTraces=function(){if(D.haveItemsQueued()&&!ae.longStackTraces)throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/MqrFmX\n");if(!ae.longStackTraces&&R()){var e=r.prototype._captureStackTrace,t=r.prototype._attachExtraTrace;ae.longStackTraces=!0,K=function(){if(D.haveItemsQueued()&&!ae.longStackTraces)throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/MqrFmX\n");r.prototype._captureStackTrace=e,r.prototype._attachExtraTrace=t,n.deactivateLongStackTraces(),D.enableTrampoline(),ae.longStackTraces=!1},r.prototype._captureStackTrace=p,r.prototype._attachExtraTrace=m,n.activateLongStackTraces(),D.disableTrampolineIfNecessary()}},r.hasLongStackTraces=function(){return ae.longStackTraces&&R()};var J=function(){try{if("function"==typeof CustomEvent){var e=new CustomEvent("CustomEvent");return k.global.dispatchEvent(e),function(e,t){var r=new CustomEvent(e.toLowerCase(),{detail:t,cancelable:!0});return!k.global.dispatchEvent(r)}}if("function"==typeof Event){var e=new Event("CustomEvent");return k.global.dispatchEvent(e),function(e,t){var r=new Event(e.toLowerCase(),{cancelable:!0});return r.detail=t,!k.global.dispatchEvent(r)}}var e=document.createEvent("CustomEvent");return e.initCustomEvent("testingtheevent",!1,!0,{}),k.global.dispatchEvent(e),function(e,t){var r=document.createEvent("CustomEvent");return r.initCustomEvent(e.toLowerCase(),!1,!0,t),!k.global.dispatchEvent(r)}}catch(e){}return function(){return!1}}(),$=function(){return k.isNode?function(){return t.emit.apply(t,arguments)}:k.global?function(e){var t="on"+e.toLowerCase(),r=k.global[t];return!!r&&(r.apply(k.global,[].slice.call(arguments,1)),!0)}:function(){return!1}}(),ee={promiseCreated:i,promiseFulfilled:i,promiseRejected:i,promiseResolved:i,promiseCancelled:i,promiseChained:function(e,t,r){return{promise:t,child:r}},warning:function(e,t){return{warning:t}},unhandledRejection:function(e,t,r){return{reason:t,promise:r}},rejectionHandled:i},te=function(e){var t=!1;try{t=$.apply(null,arguments)}catch(e){D.throwLater(e),t=!0}var r=!1;try{r=J(e,ee[e].apply(null,arguments))}catch(e){D.throwLater(e),r=!0}return r||t};r.config=function(e){if(e=Object(e),"longStackTraces"in e&&(e.longStackTraces?r.longStackTraces():!e.longStackTraces&&r.hasLongStackTraces()&&K()),"warnings"in e){var t=e.warnings;ae.warnings=!!t,Z=ae.warnings,k.isObject(t)&&"wForgottenReturn"in t&&(Z=!!t.wForgottenReturn)}if("cancellation"in e&&e.cancellation&&!ae.cancellation){if(D.haveItemsQueued())throw new Error("cannot enable cancellation after promises are in use");r.prototype._clearCancellationData=c,r.prototype._propagateFrom=h,r.prototype._onCancel=u,r.prototype._setOnCancel=l,r.prototype._attachCancellationCallback=s,r.prototype._execute=a,re=h,ae.cancellation=!0}"monitoring"in e&&(e.monitoring&&!ae.monitoring?(ae.monitoring=!0,r.prototype._fireEvent=te):!e.monitoring&&ae.monitoring&&(ae.monitoring=!1,r.prototype._fireEvent=o))},r.prototype._fireEvent=o,r.prototype._execute=function(e,t,r){try{e(t,r)}catch(e){return e}},r.prototype._onCancel=function(){},r.prototype._setOnCancel=function(e){},r.prototype._attachCancellationCallback=function(e){},r.prototype._captureStackTrace=function(){},r.prototype._attachExtraTrace=function(){},r.prototype._clearCancellationData=function(){},r.prototype._propagateFrom=function(e,t){};var re=f,ne=function(){return!1},ie=/[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/;k.inherits(M,Error),n.CapturedTrace=M,M.prototype.uncycle=function(){var e=this._length;if(!(e<2)){for(var t=[],r={},n=0,i=this;void 0!==i;++n)t.push(i),i=i._parent;e=this._length=n;for(var n=e-1;n>=0;--n){var o=t[n].stack;void 0===r[o]&&(r[o]=n)}for(var n=0;n0&&(t[s-1]._parent=void 0,t[s-1]._length=1),t[n]._parent=void 0,t[n]._length=1;var u=n>0?t[n-1]:this;s=0;--c)t[c]._length=l,l++;return}}}},M.prototype.attachExtraTrace=function(e){if(!e.__stackCleaned__){this.uncycle();for(var t=x(e),r=t.message,n=[t.stack],i=this;void 0!==i;)n.push(b(i.stack.split("\n"))),i=i._parent;E(n),_(n),k.notEnumerableProp(e,"stack",y(r,n)),k.notEnumerableProp(e,"__stackCleaned__",!0)}};var oe=function(){var e=/^\s*at\s*/,t=function(e,t){return"string"==typeof e?e:void 0!==t.name&&void 0!==t.message?t.toString():O(t)};if("number"==typeof Error.stackTraceLimit&&"function"==typeof Error.captureStackTrace){Error.stackTraceLimit+=6,H=e,V=t;var r=Error.captureStackTrace;return ne=function(e){return B.test(e)},function(e,t){Error.stackTraceLimit+=6,r(e,t),Error.stackTraceLimit-=6}}var n=new Error;if("string"==typeof n.stack&&n.stack.split("\n")[0].indexOf("stackDetection@")>=0)return H=/@/,V=t,W=!0,function(e){e.stack=(new Error).stack};var i;try{throw new Error}catch(e){i="stack"in e}return"stack"in n||!i||"number"!=typeof Error.stackTraceLimit?(V=function(e,t){return"string"==typeof e?e:"object"!=typeof t&&"function"!=typeof t||void 0===t.name||void 0===t.message?O(t):t.toString()},null):(H=e,V=t,function(e){Error.stackTraceLimit+=6;try{throw new Error}catch(t){e.stack=t.stack}Error.stackTraceLimit-=6})}([]);"undefined"!=typeof console&&"undefined"!=typeof console.warn&&(L=function(e){console.warn(e)},k.isNode&&t.stderr.isTTY?L=function(e,t){var r=t?"[33m":"[31m";console.warn(r+e+"[0m\n")}:k.isNode||"string"!=typeof(new Error).stack||(L=function(e,t){console.warn("%c"+e,t?"color: darkorange":"color: red")}));var ae={warnings:X,longStackTraces:!1,cancellation:!1,monitoring:!1};return Q&&r.longStackTraces(),{longStackTraces:function(){return ae.longStackTraces},warnings:function(){return ae.warnings},cancellation:function(){return ae.cancellation},monitoring:function(){return ae.monitoring},propagateFromFunction:function(){return re},boundValueFunction:function(){return d},checkForgottenReturns:g,setBounds:C,warn:v,deprecated:w,CapturedTrace:M,fireDomEvent:J,fireGlobalEvent:$}}},{"./errors":12,"./util":36}],10:[function(e,t,r){"use strict";t.exports=function(e){function t(){return this.value}function r(){throw this.reason}e.prototype.return=e.prototype.thenReturn=function(r){return r instanceof e&&r.suppressUnhandledRejections(),this._then(t,void 0,void 0,{value:r},void 0)},e.prototype.throw=e.prototype.thenThrow=function(e){return this._then(r,void 0,void 0,{reason:e},void 0)},e.prototype.catchThrow=function(e){if(arguments.length<=1)return this._then(void 0,r,void 0,{reason:e},void 0);var t=arguments[1],n=function(){throw t};return this.caught(e,n)},e.prototype.catchReturn=function(r){if(arguments.length<=1)return r instanceof e&&r.suppressUnhandledRejections(),this._then(void 0,t,void 0,{value:r},void 0);var n=arguments[1];n instanceof e&&n.suppressUnhandledRejections();var i=function(){return n};return this.caught(r,i)}}},{}],11:[function(e,t,r){"use strict";t.exports=function(e,t){function r(){return o(this)}function n(e,r){return i(e,r,t,t)}var i=e.reduce,o=e.all;e.prototype.each=function(e){return i(this,e,t,0)._then(r,void 0,void 0,this,void 0)},e.prototype.mapSeries=function(e){return i(this,e,t,t)},e.each=function(e,n){return i(e,n,t,0)._then(r,void 0,void 0,e,void 0)},e.mapSeries=n}},{}],12:[function(e,t,r){"use strict";function n(e,t){function r(n){return this instanceof r?(h(this,"message","string"==typeof n?n:t),h(this,"name",e),void(Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):Error.call(this))):new r(n)}return c(r,Error),r}function i(e){return this instanceof i?(h(this,"name","OperationalError"),h(this,"message",e),this.cause=e,this.isOperational=!0,void(e instanceof Error?(h(this,"message",e.message),h(this,"stack",e.stack)):Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor))):new i(e)}var o,a,s=e("./es5"),u=s.freeze,l=e("./util"),c=l.inherits,h=l.notEnumerableProp,f=n("Warning","warning"),d=n("CancellationError","cancellation error"),p=n("TimeoutError","timeout error"),m=n("AggregateError","aggregate error");try{o=TypeError,a=RangeError}catch(e){o=n("TypeError","type error"),a=n("RangeError","range error")}for(var g="join pop push shift unshift slice filter forEach some every map indexOf lastIndexOf reduce reduceRight sort reverse".split(" "),w=0;w1?e.cancelPromise._reject(t):e.cancelPromise._cancel(),e.cancelPromise=null,!0)}function a(){return u.call(this,this.promise._target()._settledValue())}function s(e){if(!o(this,e))return h.e=e,h}function u(e){var n=this.promise,u=this.handler;if(!this.called){this.called=!0;var l=this.isFinallyHandler()?u.call(n._boundValue()):u.call(n._boundValue(),e);if(void 0!==l){n._setReturnedNonUndefined();var f=r(l,n);if(f instanceof t){if(null!=this.cancelPromise){if(f._isCancelled()){var d=new c("late cancellation observer");return n._attachExtraTrace(d),h.e=d,h}f.isPending()&&f._attachCancellationCallback(new i(this))}return f._then(a,s,void 0,this,void 0)}}}return n.isRejected()?(o(this),h.e=e,h):(o(this),e)}var l=e("./util"),c=t.CancellationError,h=l.errorObj;return n.prototype.isFinallyHandler=function(){return 0===this.type},i.prototype._resultCancelled=function(){o(this.finallyHandler)},t.prototype._passThrough=function(e,t,r,i){return"function"!=typeof e?this.then():this._then(r,i,void 0,new n(this,t,e),void 0)},t.prototype.lastly=t.prototype.finally=function(e){return this._passThrough(e,0,u,u)},t.prototype.tap=function(e){return this._passThrough(e,1,u)},n}},{"./util":36}],16:[function(e,t,r){"use strict";t.exports=function(t,r,n,i,o,a){function s(e,r,n){for(var o=0;o0&&"function"==typeof arguments[t]){e=arguments[t];var n}var i=[].slice.call(arguments);e&&i.pop();var n=new r(i).promise();return void 0!==e?n.spread(e):n}}},{"./util":36}],18:[function(e,t,r){"use strict";t.exports=function(t,r,n,i,o,a){function s(e,t,r,n){this.constructor$(e),this._promise._captureStackTrace();var i=l();this._callback=null===i?t:c.domainBind(i,t),this._preservedValues=n===o?new Array(this.length()):null,this._limit=r,this._inFlight=0,this._queue=[],d.invoke(this._asyncInit,this,void 0)}function u(e,r,i,o){if("function"!=typeof r)return n("expecting a function but got "+c.classString(r));var a=0;if(void 0!==i){if("object"!=typeof i||null===i)return t.reject(new TypeError("options argument must be an object but it is "+c.classString(i)));if("number"!=typeof i.concurrency)return t.reject(new TypeError("'concurrency' must be a number but it is "+c.classString(i.concurrency)));a=i.concurrency}return a="number"==typeof a&&isFinite(a)&&a>=1?a:0,new s(e,r,a,o).promise()}var l=t._getDomain,c=e("./util"),h=c.tryCatch,f=c.errorObj,d=t._async;c.inherits(s,r),s.prototype._asyncInit=function(){this._init$(void 0,-2)},s.prototype._init=function(){},s.prototype._promiseFulfilled=function(e,r){var n=this._values,o=this.length(),s=this._preservedValues,u=this._limit;if(r<0){if(r=r*-1-1,n[r]=e,u>=1&&(this._inFlight--,this._drainQueue(),this._isResolved()))return!0}else{if(u>=1&&this._inFlight>=u)return n[r]=e,this._queue.push(r),!1;null!==s&&(s[r]=e);var l=this._promise,c=this._callback,d=l._boundValue();l._pushContext();var p=h(c).call(d,e,r,o),m=l._popContext();if(a.checkForgottenReturns(p,m,null!==s?"Promise.filter":"Promise.map",l),p===f)return this._reject(p.e),!0;var g=i(p,this._promise);if(g instanceof t){g=g._target();var w=g._bitField;if(0===(50397184&w))return u>=1&&this._inFlight++,n[r]=g,g._proxy(this,(r+1)*-1),!1;if(0===(33554432&w))return 0!==(16777216&w)?(this._reject(g._reason()),!0):(this._cancel(),!0);p=g._value()}n[r]=p}var v=++this._totalResolved;return v>=o&&(null!==s?this._filter(n,s):this._resolve(n),!0)},s.prototype._drainQueue=function(){for(var e=this._queue,t=this._limit,r=this._values;e.length>0&&this._inFlight1){o.deprecated("calling Promise.try with more than 1 argument");var l=arguments[1],c=arguments[2];u=a.isArray(l)?s(e).apply(c,l):s(e).call(c,l)}else u=s(e)();var h=n._popContext();return o.checkForgottenReturns(u,h,"Promise.try",n),n._resolveFromSyncValue(u),n},t.prototype._resolveFromSyncValue=function(e){e===a.errorObj?this._rejectCallback(e.e,!1):this._resolveCallback(e,!0)}}},{"./util":36}],20:[function(e,t,r){"use strict";function n(e){return e instanceof Error&&c.getPrototypeOf(e)===Error.prototype}function i(e){var t;if(n(e)){t=new l(e),t.name=e.name,t.message=e.message,t.stack=e.stack;for(var r=c.keys(e),i=0;i1){var r,n=new Array(t-1),i=0;for(r=0;r0&&"function"!=typeof e&&"function"!=typeof t){var r=".then() only accepts functions but was passed: "+p.classString(e);arguments.length>1&&(r+=", "+p.classString(t)),this._warn(r)}return this._then(e,t,void 0,void 0,void 0)},o.prototype.done=function(e,t){var r=this._then(e,t,void 0,void 0,void 0);r._setIsFinal()},o.prototype.spread=function(e){return"function"!=typeof e?f("expecting a function but got "+p.classString(e)):this.all()._then(e,void 0,void 0,b,void 0)},o.prototype.toJSON=function(){var e={isFulfilled:!1,isRejected:!1,fulfillmentValue:void 0,rejectionReason:void 0};return this.isFulfilled()?(e.fulfillmentValue=this.value(),e.isFulfilled=!0):this.isRejected()&&(e.rejectionReason=this.reason(),e.isRejected=!0),e},o.prototype.all=function(){return arguments.length>0&&this._warn(".all() was passed arguments but it does not take any"),new A(this).promise()},o.prototype.error=function(e){return this.caught(p.originatesFromRejection,e)},o.getNewLibraryCopy=r.exports,o.is=function(e){return e instanceof o},o.fromNode=o.fromCallback=function(e){var t=new o(E);t._captureStackTrace();var r=arguments.length>1&&!!Object(arguments[1]).multiArgs,n=N(e)(C(t,r));return n===M&&t._rejectCallback(n.e,!0),t._isFateSealed()||t._setAsyncGuaranteed(),t},o.all=function(e){return new A(e).promise()},o.cast=function(e){var t=x(e);return t instanceof o||(t=new o(E),t._captureStackTrace(),t._setFulfilled(),t._rejectionHandler0=e),t},o.resolve=o.fulfilled=o.cast,o.reject=o.rejected=function(e){var t=new o(E);return t._captureStackTrace(),t._rejectCallback(e,!0),t},o.setScheduler=function(e){if("function"!=typeof e)throw new y("expecting a function but got "+p.classString(e));return w.setScheduler(e)},o.prototype._then=function(e,t,r,n,i){var a=void 0!==i,s=a?i:new o(E),u=this._target(),c=u._bitField;a||(s._propagateFrom(this,3),s._captureStackTrace(),void 0===n&&0!==(2097152&this._bitField)&&(n=0!==(50397184&c)?this._boundValue():u===this?void 0:this._boundTo),this._fireEvent("promiseChained",this,s));var h=l();if(0!==(50397184&c)){var f,d,m=u._settlePromiseCtx;0!==(33554432&c)?(d=u._rejectionHandler0,f=e):0!==(16777216&c)?(d=u._fulfillmentHandler0,f=t,u._unsetRejectionIsUnhandled()):(m=u._settlePromiseLateCancellationObserver,d=new _("late cancellation observer"),u._attachExtraTrace(d),f=t),w.invoke(m,u,{handler:null===h?f:"function"==typeof f&&p.domainBind(h,f),promise:s,receiver:n,value:d})}else u._addCallbacks(e,t,s,n,h);return s},o.prototype._length=function(){return 65535&this._bitField},o.prototype._isFateSealed=function(){return 0!==(117506048&this._bitField)},o.prototype._isFollowing=function(){return 67108864===(67108864&this._bitField)},o.prototype._setLength=function(e){this._bitField=this._bitField&-65536|65535&e},o.prototype._setFulfilled=function(){this._bitField=33554432|this._bitField,this._fireEvent("promiseFulfilled",this)},o.prototype._setRejected=function(){this._bitField=16777216|this._bitField,this._fireEvent("promiseRejected",this)},o.prototype._setFollowing=function(){this._bitField=67108864|this._bitField,this._fireEvent("promiseResolved",this)},o.prototype._setIsFinal=function(){this._bitField=4194304|this._bitField},o.prototype._isFinal=function(){return(4194304&this._bitField)>0},o.prototype._unsetCancelled=function(){this._bitField=this._bitField&-65537},o.prototype._setCancelled=function(){this._bitField=65536|this._bitField,this._fireEvent("promiseCancelled",this)},o.prototype._setWillBeCancelled=function(){this._bitField=8388608|this._bitField},o.prototype._setAsyncGuaranteed=function(){w.hasCustomScheduler()||(this._bitField=134217728|this._bitField)},o.prototype._receiverAt=function(e){var t=0===e?this._receiver0:this[4*e-4+3];if(t!==d)return void 0===t&&this._isBound()?this._boundValue():t},o.prototype._promiseAt=function(e){return this[4*e-4+2]},o.prototype._fulfillmentHandlerAt=function(e){return this[4*e-4+0]},o.prototype._rejectionHandlerAt=function(e){return this[4*e-4+1]},o.prototype._boundValue=function(){},o.prototype._migrateCallback0=function(e){var t=(e._bitField,e._fulfillmentHandler0),r=e._rejectionHandler0,n=e._promise0,i=e._receiverAt(0);void 0===i&&(i=d),this._addCallbacks(t,r,n,i,null)},o.prototype._migrateCallbackAt=function(e,t){var r=e._fulfillmentHandlerAt(t),n=e._rejectionHandlerAt(t),i=e._promiseAt(t),o=e._receiverAt(t);void 0===o&&(o=d),this._addCallbacks(r,n,i,o,null)},o.prototype._addCallbacks=function(e,t,r,n,i){var o=this._length();if(o>=65531&&(o=0,this._setLength(0)),0===o)this._promise0=r,this._receiver0=n,"function"==typeof e&&(this._fulfillmentHandler0=null===i?e:p.domainBind(i,e)),"function"==typeof t&&(this._rejectionHandler0=null===i?t:p.domainBind(i,t));else{var a=4*o-4;this[a+2]=r,this[a+3]=n,"function"==typeof e&&(this[a+0]=null===i?e:p.domainBind(i,e)),"function"==typeof t&&(this[a+1]=null===i?t:p.domainBind(i,t))}return this._setLength(o+1),o},o.prototype._proxy=function(e,t){this._addCallbacks(void 0,void 0,t,e,null)},o.prototype._resolveCallback=function(e,t){if(0===(117506048&this._bitField)){if(e===this)return this._rejectCallback(c(),!1);var r=x(e,this);if(!(r instanceof o))return this._fulfill(e);t&&this._propagateFrom(r,2);var n=r._target();if(n===this)return void this._reject(c());var i=n._bitField;if(0===(50397184&i)){var a=this._length();a>0&&n._migrateCallback0(this);for(var s=1;s>>16)){if(e===this){var r=c();return this._attachExtraTrace(r),this._reject(r)}this._setFulfilled(),this._rejectionHandler0=e,(65535&t)>0&&(0!==(134217728&t)?this._settlePromises():w.settlePromises(this))}},o.prototype._reject=function(e){var t=this._bitField;if(!((117506048&t)>>>16))return this._setRejected(),this._fulfillmentHandler0=e,this._isFinal()?w.fatalError(e,p.isNode):void((65535&t)>0?w.settlePromises(this):this._ensurePossibleRejectionHandled())},o.prototype._fulfillPromises=function(e,t){for(var r=1;r0){if(0!==(16842752&e)){var r=this._fulfillmentHandler0;this._settlePromise0(this._rejectionHandler0,r,e),this._rejectPromises(t,r)}else{var n=this._rejectionHandler0;this._settlePromise0(this._fulfillmentHandler0,n,e),this._fulfillPromises(t,n)}this._setLength(0)}this._clearCancellationData()},o.prototype._settledValue=function(){var e=this._bitField;return 0!==(33554432&e)?this._rejectionHandler0:0!==(16777216&e)?this._fulfillmentHandler0:void 0},o.defer=o.pending=function(){I.deprecated("Promise.defer","new Promise");var e=new o(E);return{promise:e,resolve:a,reject:s}},p.notEnumerableProp(o,"_makeSelfResolutionError",c),e("./method")(o,E,x,f,I),e("./bind")(o,E,x,I),e("./cancel")(o,A,f,I),e("./direct_resolve")(o),e("./synchronous_inspection")(o),e("./join")(o,A,x,E,w,l),o.Promise=o,o.version="3.4.6",e("./map.js")(o,A,f,x,E,I),e("./call_get.js")(o),e("./using.js")(o,f,x,O,E,I),e("./timers.js")(o,E,I),e("./generators.js")(o,f,E,x,n,I),e("./nodeify.js")(o),e("./promisify.js")(o,E),e("./props.js")(o,A,x,f),e("./race.js")(o,E,x,f),e("./reduce.js")(o,A,f,x,E,I),e("./settle.js")(o,A,I),e("./some.js")(o,A,f),e("./filter.js")(o,E),e("./each.js")(o,E),e("./any.js")(o),p.toFastProperties(o),p.toFastProperties(o.prototype),u({a:1}),u({b:2}),u({c:3}),u(1),u(function(){}),u(void 0),u(!1),u(new o(E)),I.setBounds(g.firstLineError,p.lastLineError),o}},{"./any.js":1,"./async":2,"./bind":3,"./call_get.js":5,"./cancel":6,"./catch_filter":7,"./context":8,"./debuggability":9,"./direct_resolve":10,"./each.js":11,"./errors":12,"./es5":13,"./filter.js":14,"./finally":15,"./generators.js":16,"./join":17,"./map.js":18,"./method":19,"./nodeback":20,"./nodeify.js":21,"./promise_array":23,"./promisify.js":24,"./props.js":25,"./race.js":27,"./reduce.js":28,"./settle.js":30,"./some.js":31,"./synchronous_inspection":32,"./thenables":33,"./timers.js":34,"./using.js":35,"./util":36}],23:[function(e,t,r){"use strict";t.exports=function(t,r,n,i,o){function a(e){switch(e){case-2:return[];case-3:return{}}}function s(e){var n=this._promise=new t(r);e instanceof t&&n._propagateFrom(e,3),n._setOnCancel(this),this._values=e,this._length=0,this._totalResolved=0,this._init(void 0,-2)}var u=e("./util");return u.isArray,u.inherits(s,o),s.prototype.length=function(){return this._length},s.prototype.promise=function(){return this._promise},s.prototype._init=function e(r,o){var s=n(this._values,this._promise);if(s instanceof t){s=s._target();var l=s._bitField;if(this._values=s,0===(50397184&l))return this._promise._setAsyncGuaranteed(),s._then(e,this._reject,void 0,this,o);if(0===(33554432&l))return 0!==(16777216&l)?this._reject(s._reason()):this._cancel();s=s._value()}if(s=u.asArray(s),null===s){var c=i("expecting an array or an iterable object but got "+u.classString(s)).reason();return void this._promise._rejectCallback(c,!1)}return 0===s.length?void(o===-5?this._resolveEmptyArray():this._resolve(a(o))):void this._iterate(s)},s.prototype._iterate=function(e){var r=this.getActualLength(e.length);this._length=r,this._values=this.shouldCopyValues()?new Array(r):this._values;for(var i=this._promise,o=!1,a=null,s=0;s=this._length&&(this._resolve(this._values),!0)},s.prototype._promiseCancelled=function(){return this._cancel(),!0},s.prototype._promiseRejected=function(e){return this._totalResolved++,this._reject(e),!0},s.prototype._resultCancelled=function(){if(!this._isResolved()){var e=this._values;if(this._cancel(),e instanceof t)e.cancel();else for(var r=0;r=this._length){var n;if(this._isMap)n=f(this._values);else{n={};for(var i=this.length(),o=0,a=this.length();o>1},t.prototype.props=function(){return a(this)},t.props=function(e){return a(e)}}},{"./es5":13,"./util":36}],26:[function(e,t,r){"use strict";function n(e,t,r,n,i){for(var o=0;o=this._length&&(this._resolve(this._values),!0)},i.prototype._promiseFulfilled=function(e,t){var r=new o;return r._bitField=33554432,r._settledValueField=e,this._promiseResolved(t,r)},i.prototype._promiseRejected=function(e,t){var r=new o;return r._bitField=16777216,r._settledValueField=e,this._promiseResolved(t,r)},t.settle=function(e){return n.deprecated(".settle()",".reflect()"),new i(e).promise()},t.prototype.settle=function(){return t.settle(this)}}},{"./util":36}],31:[function(e,t,r){"use strict";t.exports=function(t,r,n){function i(e){this.constructor$(e),this._howMany=0,this._unwrap=!1,this._initialized=!1}function o(e,t){if((0|t)!==t||t<0)return n("expecting a positive integer\n\n See http://goo.gl/MqrFmX\n");var r=new i(e),o=r.promise();return r.setHowMany(t),r.init(),o}var a=e("./util"),s=e("./errors").RangeError,u=e("./errors").AggregateError,l=a.isArray,c={};a.inherits(i,r),i.prototype._init=function(){if(this._initialized){if(0===this._howMany)return void this._resolve([]);this._init$(void 0,-5);var e=l(this._values);!this._isResolved()&&e&&this._howMany>this._canPossiblyFulfill()&&this._reject(this._getRangeError(this.length()));
-}},i.prototype.init=function(){this._initialized=!0,this._init()},i.prototype.setUnwrap=function(){this._unwrap=!0},i.prototype.howMany=function(){return this._howMany},i.prototype.setHowMany=function(e){this._howMany=e},i.prototype._promiseFulfilled=function(e){return this._addFulfilled(e),this._fulfilled()===this.howMany()&&(this._values.length=this.howMany(),1===this.howMany()&&this._unwrap?this._resolve(this._values[0]):this._resolve(this._values),!0)},i.prototype._promiseRejected=function(e){return this._addRejected(e),this._checkOutcome()},i.prototype._promiseCancelled=function(){return this._values instanceof t||null==this._values?this._cancel():(this._addRejected(c),this._checkOutcome())},i.prototype._checkOutcome=function(){if(this.howMany()>this._canPossiblyFulfill()){for(var e=new u,t=this.length();t