{"version":3,"file":"3dio.js","sources":["../src/core/runtime/dom-ready.js","../node_modules/rxjs/util/root.js","../node_modules/rxjs/util/isFunction.js","../node_modules/rxjs/util/isArray.js","../node_modules/rxjs/util/isObject.js","../node_modules/rxjs/util/errorObject.js","../node_modules/rxjs/util/tryCatch.js","../node_modules/rxjs/util/UnsubscriptionError.js","../node_modules/rxjs/Subscription.js","../node_modules/rxjs/Observer.js","../node_modules/rxjs/symbol/rxSubscriber.js","../node_modules/rxjs/Subscriber.js","../node_modules/rxjs/util/toSubscriber.js","../node_modules/rxjs/symbol/observable.js","../node_modules/rxjs/util/noop.js","../node_modules/rxjs/util/pipe.js","../node_modules/rxjs/Observable.js","../node_modules/rxjs/util/ObjectUnsubscribedError.js","../node_modules/rxjs/SubjectSubscription.js","../node_modules/rxjs/Subject.js","../node_modules/rxjs/BehaviorSubject.js","../src/core/runtime.js","../node_modules/bluebird/js/browser/bluebird.js","../node_modules/whatwg-fetch/fetch.js","../src/core/polyfills.js","../node_modules/js-logger/src/logger.js","../src/core/bootstrap.js","../src/core/configs.js","../src/aframe/check-dependencies.js","../src/utils/io/fetch.js","../node_modules/bluebird/js/release/es5.js","../node_modules/bluebird/js/release/util.js","../node_modules/bluebird/js/release/schedule.js","../node_modules/bluebird/js/release/queue.js","../node_modules/bluebird/js/release/async.js","../node_modules/bluebird/js/release/errors.js","../node_modules/bluebird/js/release/thenables.js","../node_modules/bluebird/js/release/promise_array.js","../node_modules/bluebird/js/release/context.js","../node_modules/bluebird/js/release/debuggability.js","../node_modules/bluebird/js/release/catch_filter.js","../node_modules/bluebird/js/release/finally.js","../node_modules/bluebird/js/release/nodeback.js","../node_modules/bluebird/js/release/method.js","../node_modules/bluebird/js/release/bind.js","../node_modules/bluebird/js/release/cancel.js","../node_modules/bluebird/js/release/direct_resolve.js","../node_modules/bluebird/js/release/synchronous_inspection.js","../node_modules/bluebird/js/release/join.js","../node_modules/bluebird/js/release/map.js","../node_modules/bluebird/js/release/call_get.js","../node_modules/bluebird/js/release/using.js","../node_modules/bluebird/js/release/timers.js","../node_modules/bluebird/js/release/generators.js","../node_modules/bluebird/js/release/nodeify.js","../node_modules/bluebird/js/release/promisify.js","../node_modules/bluebird/js/release/props.js","../node_modules/bluebird/js/release/race.js","../node_modules/bluebird/js/release/reduce.js","../node_modules/bluebird/js/release/settle.js","../node_modules/bluebird/js/release/some.js","../node_modules/bluebird/js/release/filter.js","../node_modules/bluebird/js/release/each.js","../node_modules/bluebird/js/release/any.js","../node_modules/bluebird/js/release/promise.js","../node_modules/bluebird/js/release/bluebird.js","../src/utils/uuid.js","../src/utils/services/json-rpc2-client.js","../src/utils/services/call.js","../src/aframe/component/data3d.js","../src/utils/data3d/clone.js","../src/aframe/component/furniture.js","../node_modules/lodash/_listCacheClear.js","../node_modules/lodash/eq.js","../node_modules/lodash/_assocIndexOf.js","../node_modules/lodash/_listCacheDelete.js","../node_modules/lodash/_listCacheGet.js","../node_modules/lodash/_listCacheHas.js","../node_modules/lodash/_listCacheSet.js","../node_modules/lodash/_ListCache.js","../node_modules/lodash/_stackClear.js","../node_modules/lodash/_stackDelete.js","../node_modules/lodash/_stackGet.js","../node_modules/lodash/_stackHas.js","../node_modules/lodash/_freeGlobal.js","../node_modules/lodash/_root.js","../node_modules/lodash/_Symbol.js","../node_modules/lodash/_getRawTag.js","../node_modules/lodash/_objectToString.js","../node_modules/lodash/_baseGetTag.js","../node_modules/lodash/isObject.js","../node_modules/lodash/isFunction.js","../node_modules/lodash/_coreJsData.js","../node_modules/lodash/_isMasked.js","../node_modules/lodash/_toSource.js","../node_modules/lodash/_baseIsNative.js","../node_modules/lodash/_getValue.js","../node_modules/lodash/_getNative.js","../node_modules/lodash/_Map.js","../node_modules/lodash/_nativeCreate.js","../node_modules/lodash/_hashClear.js","../node_modules/lodash/_hashDelete.js","../node_modules/lodash/_hashGet.js","../node_modules/lodash/_hashHas.js","../node_modules/lodash/_hashSet.js","../node_modules/lodash/_Hash.js","../node_modules/lodash/_mapCacheClear.js","../node_modules/lodash/_isKeyable.js","../node_modules/lodash/_getMapData.js","../node_modules/lodash/_mapCacheDelete.js","../node_modules/lodash/_mapCacheGet.js","../node_modules/lodash/_mapCacheHas.js","../node_modules/lodash/_mapCacheSet.js","../node_modules/lodash/_MapCache.js","../node_modules/lodash/_stackSet.js","../node_modules/lodash/_Stack.js","../node_modules/lodash/_arrayEach.js","../node_modules/lodash/_defineProperty.js","../node_modules/lodash/_baseAssignValue.js","../node_modules/lodash/_assignValue.js","../node_modules/lodash/_copyObject.js","../node_modules/lodash/_baseTimes.js","../node_modules/lodash/isObjectLike.js","../node_modules/lodash/_baseIsArguments.js","../node_modules/lodash/isArguments.js","../node_modules/lodash/isArray.js","../node_modules/lodash/stubFalse.js","../node_modules/lodash/isBuffer.js","../node_modules/lodash/_isIndex.js","../node_modules/lodash/isLength.js","../node_modules/lodash/_baseIsTypedArray.js","../node_modules/lodash/_baseUnary.js","../node_modules/lodash/_nodeUtil.js","../node_modules/lodash/isTypedArray.js","../node_modules/lodash/_arrayLikeKeys.js","../node_modules/lodash/_isPrototype.js","../node_modules/lodash/_overArg.js","../node_modules/lodash/_nativeKeys.js","../node_modules/lodash/_baseKeys.js","../node_modules/lodash/isArrayLike.js","../node_modules/lodash/keys.js","../node_modules/lodash/_baseAssign.js","../node_modules/lodash/_nativeKeysIn.js","../node_modules/lodash/_baseKeysIn.js","../node_modules/lodash/keysIn.js","../node_modules/lodash/_baseAssignIn.js","../node_modules/lodash/_cloneBuffer.js","../node_modules/lodash/_copyArray.js","../node_modules/lodash/_arrayFilter.js","../node_modules/lodash/stubArray.js","../node_modules/lodash/_getSymbols.js","../node_modules/lodash/_copySymbols.js","../node_modules/lodash/_arrayPush.js","../node_modules/lodash/_getPrototype.js","../node_modules/lodash/_getSymbolsIn.js","../node_modules/lodash/_copySymbolsIn.js","../node_modules/lodash/_baseGetAllKeys.js","../node_modules/lodash/_getAllKeys.js","../node_modules/lodash/_getAllKeysIn.js","../node_modules/lodash/_DataView.js","../node_modules/lodash/_Promise.js","../node_modules/lodash/_Set.js","../node_modules/lodash/_WeakMap.js","../node_modules/lodash/_getTag.js","../node_modules/lodash/_initCloneArray.js","../node_modules/lodash/_Uint8Array.js","../node_modules/lodash/_cloneArrayBuffer.js","../node_modules/lodash/_cloneDataView.js","../node_modules/lodash/_addMapEntry.js","../node_modules/lodash/_arrayReduce.js","../node_modules/lodash/_mapToArray.js","../node_modules/lodash/_cloneMap.js","../node_modules/lodash/_cloneRegExp.js","../node_modules/lodash/_addSetEntry.js","../node_modules/lodash/_setToArray.js","../node_modules/lodash/_cloneSet.js","../node_modules/lodash/_cloneSymbol.js","../node_modules/lodash/_cloneTypedArray.js","../node_modules/lodash/_initCloneByTag.js","../node_modules/lodash/_baseCreate.js","../node_modules/lodash/_initCloneObject.js","../node_modules/lodash/_baseClone.js","../node_modules/lodash/clone.js","../node_modules/lodash/_apply.js","../node_modules/lodash/identity.js","../node_modules/lodash/_overRest.js","../node_modules/lodash/constant.js","../node_modules/lodash/_baseSetToString.js","../node_modules/lodash/_shortOut.js","../node_modules/lodash/_setToString.js","../node_modules/lodash/_baseRest.js","../node_modules/lodash/_isIterateeCall.js","../node_modules/lodash/_createAssigner.js","../node_modules/lodash/assignInWith.js","../node_modules/lodash/_customDefaultsAssignIn.js","../node_modules/lodash/defaults.js","../src/aframe/component/tour.js","../src/utils/array/decode-to-string.js","../node_modules/lodash/_isFlattenable.js","../node_modules/lodash/_baseFlatten.js","../node_modules/lodash/_arrayMap.js","../node_modules/lodash/_setCacheAdd.js","../node_modules/lodash/_setCacheHas.js","../node_modules/lodash/_SetCache.js","../node_modules/lodash/_arraySome.js","../node_modules/lodash/_cacheHas.js","../node_modules/lodash/_equalArrays.js","../node_modules/lodash/_equalByTag.js","../node_modules/lodash/_equalObjects.js","../node_modules/lodash/_baseIsEqualDeep.js","../node_modules/lodash/_baseIsEqual.js","../node_modules/lodash/_baseIsMatch.js","../node_modules/lodash/_isStrictComparable.js","../node_modules/lodash/_getMatchData.js","../node_modules/lodash/_matchesStrictComparable.js","../node_modules/lodash/_baseMatches.js","../node_modules/lodash/isSymbol.js","../node_modules/lodash/_isKey.js","../node_modules/lodash/memoize.js","../node_modules/lodash/_memoizeCapped.js","../node_modules/lodash/_stringToPath.js","../node_modules/lodash/_baseToString.js","../node_modules/lodash/toString.js","../node_modules/lodash/_castPath.js","../node_modules/lodash/_toKey.js","../node_modules/lodash/_baseGet.js","../node_modules/lodash/get.js","../node_modules/lodash/_baseHasIn.js","../node_modules/lodash/_hasPath.js","../node_modules/lodash/hasIn.js","../node_modules/lodash/_baseMatchesProperty.js","../node_modules/lodash/_baseProperty.js","../node_modules/lodash/_basePropertyDeep.js","../node_modules/lodash/property.js","../node_modules/lodash/_baseIteratee.js","../node_modules/lodash/_createBaseFor.js","../node_modules/lodash/_baseFor.js","../node_modules/lodash/_baseForOwn.js","../node_modules/lodash/_createBaseEach.js","../node_modules/lodash/_baseEach.js","../node_modules/lodash/_baseMap.js","../node_modules/lodash/_baseSortBy.js","../node_modules/lodash/_compareAscending.js","../node_modules/lodash/_compareMultiple.js","../node_modules/lodash/_baseOrderBy.js","../node_modules/lodash/sortBy.js","../src/utils/promise-cache.js","../src/utils/io/fetch-script.js","../src/aframe/component/gblock.js","../src/aframe/component/lighting.js","../node_modules/lodash/cloneDeep.js","../src/aframe/component/minimap.js","../src/scene/structure/validate/generic.js","../src/scene/structure/validate/by-type/box.js","../src/scene/structure/validate/by-type/camera-bookmark.js","../src/scene/structure/validate/by-type/closet.js","../src/scene/structure/validate/by-type/column.js","../src/scene/structure/validate/by-type/curtain.js","../src/scene/structure/validate/by-type/door.js","../src/scene/structure/validate/by-type/floor.js","../src/scene/structure/validate/by-type/floorplan.js","../src/scene/structure/validate/by-type/group.js","../src/scene/structure/validate/by-type/interior.js","../src/scene/structure/validate/by-type/kitchen.js","../src/scene/structure/validate/by-type/level.js","../src/scene/structure/validate/by-type/object.js","../src/scene/structure/validate/by-type/plan.js","../src/scene/structure/validate/by-type/polybox.js","../src/scene/structure/validate/by-type/polyfloor.js","../src/scene/structure/validate/by-type/railing.js","../src/scene/structure/validate/by-type/stairs.js","../src/scene/structure/validate/by-type/tag.js","../src/scene/structure/validate/by-type/wall.js","../src/scene/structure/validate/by-type/window.js","../src/scene/structure/validate/get-defaults-by-type.js","../src/aframe/component/architecture-toolkit/common/get-schema.js","../src/aframe/component/architecture-toolkit/common/material-lib.js","../src/aframe/component/architecture-toolkit/common/get-material.js","../src/aframe/component/architecture-toolkit/common/update-schema.js","../src/utils/data3d/buffer/get-normals.js","../src/utils/data3d/buffer/get-uvs.js","../src/aframe/component/architecture-toolkit/closet.js","../src/utils/data3d/buffer/triangulate-2d.js","../src/utils/data3d/buffer/get-polygon.js","../src/utils/data3d/buffer/get-extrusion.js","../src/aframe/component/architecture-toolkit/column.js","../src/aframe/component/architecture-toolkit/door.js","../src/aframe/component/architecture-toolkit/floor.js","../src/utils/path.js","../src/utils/url.js","../src/utils/data3d/decode-binary.js","../src/utils/data3d/load.js","../src/aframe/component/architecture-toolkit/kitchen.js","../src/aframe/component/architecture-toolkit/polyfloor.js","../src/aframe/component/architecture-toolkit/railing.js","../src/aframe/component/architecture-toolkit/stairs.js","../src/aframe/component/architecture-toolkit/wall.js","../src/aframe/component/architecture-toolkit/window.js","../src/aframe/inspector-plugins-launcher.js","../src/aframe/three/data3d-view/set-material/fetch-texture/fetch-dds-texture.js","../src/aframe/three/data3d-view/set-material/fetch-texture/fetch-image-texture.js","../src/utils/io/common/queue-manager.js","../src/aframe/three/data3d-view/set-material/fetch-texture.js","../src/aframe/three/data3d-view/set-material/load-texture-set.js","../src/aframe/three/data3d-view/set-material.js","../src/aframe/three/data3d-view/io3d-material.js","../src/utils/data3d/buffer/get-wireframe.js","../src/utils/math/compare-arrays.js","../src/aframe/three/data3d-view/wireframe.js","../src/aframe/three/data3d-view.js","../src/aframe.js","../src/furniture/common/normalize-furniture-info.js","../src/furniture/search.js","../src/furniture/get-info.js","../src/furniture/get.js","../src/furniture/get-data3d-storage-id.js","../src/furniture.js","../src/scene/structure/validate/get-param-value-type.js","../src/scene/structure/apply-defaults.js","../src/scene/structure/remove-unknown.js","../src/scene/structure/normalize.js","../src/staging/get-furnishings.js","../src/staging/get-furniture-alternatives.js","../src/scene/structure/from-aframe-elements.js","../src/utils/poll.js","../src/storage/get-url-from-id.js","../src/storage/get.js","../src/scene/structure/to-aframe-elements.js","../src/staging/replace-furniture.js","../src/staging.js","../src/utils/io/form-data.js","../src/utils/short-id.js","../src/utils/auth/sign-up.js","../src/utils/auth/common/normalize-session.js","../src/utils/auth/session-stream.js","../src/utils/auth/get-session.js","../src/utils/auth/set-password.js","../src/utils/auth/request-password-reset.js","../src/utils/auth/resend-activation-email.js","../src/utils/auth/log-in.js","../src/utils/auth/log-out.js","../src/utils/auth/regenerate-secret-api-key.js","../src/utils/auth/get-secret-api-key.js","../src/utils/auth/generate-publishable-api-key.js","../src/utils/auth/list-publishable-api-keys.js","../src/utils/auth/update-publishable-api-key-domains.js","../src/utils/auth/revoke-publishable-api-key.js","../src/utils/auth.js","../src/utils/file/get-mime-type-from-filename.js","../src/storage/put.js","../src/storage/get-no-cdn-url-from-id.js","../src/storage/get-id-from-url.js","../src/utils/data3d/traverse.js","../src/utils/color/hex-to-rgb.js","../src/utils/data3d/normalize.js","../src/utils/wait.js","../src/utils/io/fetch-image.js","../src/utils/image/scale-down-image.js","../src/utils/file/get-default-filename.js","../src/utils/image/get-blob-from-canvas.js","../src/utils/file/read.js","../src/utils/image/get-image-from-file.js","../src/utils/data3d/generate-texture-set.js","../src/utils/data3d/from-three.js","../src/utils/file/gzip.js","../src/utils/math/md5.js","../src/utils/data3d/texture-attributes.js","../src/utils/data3d/encode-binary.js","../src/utils/io/common/add-cache-bust-to-query.js","../src/utils/io/check-if-file-exists.js","../src/utils/data3d/get-texture-keys.js","../src/utils/processing/when-hi-res-textures-ready.js","../src/storage/import-three-object.js","../src/storage/import-aframe-element.js","../src/utils/processing/get-convertible-texture-ids.js","../src/storage/model-exporter.js","../src/storage.js","../src/scene/structure/get.js","../src/scene/get-aframe-elements.js","../src/scene/get-viewer-url.js","../src/scene/structure/validate.js","../src/scene/export-svg.js","../src/scene/structure/utils/snap-walls.js","../src/scene.js","../src/floor-plan/convert-to-basic-3d-model.js","../src/floor-plan/get-conversion-status.js","../src/floor-plan/recognize.js","../src/floor-plan.js","../src/utils/processing/when-done.js","../src/light/bake.js","../src/light.js","../src/modify/modify-model.js","../src/modify.js","../src/utils/data3d/get-inspector-url.js","../src/utils/data3d/get-texture-urls.js","../src/utils/data3d/store-in-cache.js","../src/utils/data3d/remove-from-cache.js","../src/utils/ui/common/dom-el.js","../src/utils/ui/create-message-ui.js","../src/utils/ui/create-file-drop-ui/get-files-from-drag-and-drop-event.js","../src/utils/ui/create-file-drop-ui.js","../src/utils/ui/common/create-overlay.js","../src/utils/ui/create-password-reset-request-ui.js","../src/utils/ui/create-log-in-ui.js","../src/utils/ui/create-sign-up-ui.js","../src/utils/ui/create-confirm-ui.js","../src/utils/ui/create-alert-ui.js","../src/utils/ui/create-log-out-ui.js","../src/utils/ui/create-prompt-ui.js","../src/utils/ui/create-publishable-api-keys-ui.js","../src/utils/ui/create-secret-api-key-ui.js","../src/utils/ui/create-dev-dashboard-ui.js","../src/utils/ui.js","../src/utils/math/sha1.js","../src/utils/file/get-md5-hash.js","../src/utils.js","../src/io3d.js"],"sourcesContent":["/**\n * @license RequireJS domReady 2.0.1 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.\n * Available via the MIT or new BSD license.\n * see: http://github.com/requirejs/domReady for details\n */\n\nvar isTop, testDiv, scrollIntervalId,\n isBrowser = typeof window !== \"undefined\" && window.document,\n isPageLoaded = !isBrowser,\n doc = isBrowser ? document : null,\n readyCalls = [];\n\nvar resolve, readyPromise = new Promise(function(resolve_){\n resolve = resolve_\n})\n\nfunction runCallbacks(callbacks) {\n var i;\n for (i = 0; i < callbacks.length; i += 1) {\n callbacks[i](doc);\n }\n}\n\nfunction callReady() {\n var callbacks = readyCalls;\n\n if (isPageLoaded) {\n //Call the DOM ready callbacks\n if (callbacks.length) {\n readyCalls = [];\n runCallbacks(callbacks);\n }\n // resolves promise\n resolve(doc)\n }\n}\n\n/**\n * Sets the page as loaded.\n */\nfunction pageLoaded() {\n if (!isPageLoaded) {\n isPageLoaded = true;\n if (scrollIntervalId) {\n clearInterval(scrollIntervalId);\n }\n\n callReady();\n }\n}\n\nif (isBrowser) {\n if (document.addEventListener) {\n //Standards. Hooray! Assumption here that if standards based,\n //it knows about DOMContentLoaded.\n document.addEventListener(\"DOMContentLoaded\", pageLoaded, false);\n window.addEventListener(\"load\", pageLoaded, false);\n } else if (window.attachEvent) {\n window.attachEvent(\"onload\", pageLoaded);\n\n testDiv = document.createElement('div');\n try {\n isTop = window.frameElement === null;\n } catch (e) {}\n\n //DOMContentLoaded approximation that uses a doScroll, as found by\n //Diego Perini: http://javascript.nwbox.com/IEContentLoaded/,\n //but modified by other contributors, including jdalton\n if (testDiv.doScroll && isTop && window.external) {\n scrollIntervalId = setInterval(function () {\n try {\n testDiv.doScroll();\n pageLoaded();\n } catch (e) {}\n }, 30);\n }\n }\n\n //Check if document already complete, and if so, just trigger page load\n //listeners. Latest webkit browsers also use \"interactive\", and\n //will fire the onDOMContentLoaded before \"interactive\" but not after\n //entering \"interactive\" or \"complete\". More details:\n //http://dev.w3.org/html5/spec/the-end.html#the-end\n //http://stackoverflow.com/questions/3665561/document-readystate-of-interactive-vs-ondomcontentloaded\n //Hmm, this is more complicated on further use, see \"firing too early\"\n //bug: https://github.com/requirejs/domReady/issues/1\n //so removing the || document.readyState === \"interactive\" test.\n //There is still a window.onload binding that should get fired if\n //DOMContentLoaded is missed.\n if (document.readyState === \"complete\") {\n pageLoaded();\n }\n}\n\n/** PUBLIC API **/\n\n/**\n * Registers a callback for DOM ready. If DOM is already ready, the\n * callback is called immediately.\n * @param {Function} callback\n */\nexport default function domReady(callback) {\n if (!isBrowser) {\n console.error('runtime.domReady requires a browser environment and will be ignored.')\n return\n }\n if (isPageLoaded) {\n callback(doc);\n } else {\n readyCalls.push(callback);\n }\n return readyPromise\n}","\"use strict\";\n// CommonJS / Node have global context exposed as \"global\" variable.\n// We don't want to include the whole node.d.ts this this compilation unit so we'll just fake\n// the global \"global\" var for now.\nvar __window = typeof window !== 'undefined' && window;\nvar __self = typeof self !== 'undefined' && typeof WorkerGlobalScope !== 'undefined' &&\n self instanceof WorkerGlobalScope && self;\nvar __global = typeof global !== 'undefined' && global;\nvar _root = __window || __global || __self;\nexports.root = _root;\n// Workaround Closure Compiler restriction: The body of a goog.module cannot use throw.\n// This is needed when used with angular/tsickle which inserts a goog.module statement.\n// Wrap in IIFE\n(function () {\n if (!_root) {\n throw new Error('RxJS could not find any global context (window, self, global)');\n }\n})();\n//# sourceMappingURL=root.js.map","\"use strict\";\nfunction isFunction(x) {\n return typeof x === 'function';\n}\nexports.isFunction = isFunction;\n//# sourceMappingURL=isFunction.js.map","\"use strict\";\nexports.isArray = Array.isArray || (function (x) { return x && typeof x.length === 'number'; });\n//# sourceMappingURL=isArray.js.map","\"use strict\";\nfunction isObject(x) {\n return x != null && typeof x === 'object';\n}\nexports.isObject = isObject;\n//# sourceMappingURL=isObject.js.map","\"use strict\";\n// typeof any so that it we don't have to cast when comparing a result to the error object\nexports.errorObject = { e: {} };\n//# sourceMappingURL=errorObject.js.map","\"use strict\";\nvar errorObject_1 = require('./errorObject');\nvar tryCatchTarget;\nfunction tryCatcher() {\n try {\n return tryCatchTarget.apply(this, arguments);\n }\n catch (e) {\n errorObject_1.errorObject.e = e;\n return errorObject_1.errorObject;\n }\n}\nfunction tryCatch(fn) {\n tryCatchTarget = fn;\n return tryCatcher;\n}\nexports.tryCatch = tryCatch;\n;\n//# sourceMappingURL=tryCatch.js.map","\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\n/**\n * An error thrown when one or more errors have occurred during the\n * `unsubscribe` of a {@link Subscription}.\n */\nvar UnsubscriptionError = (function (_super) {\n __extends(UnsubscriptionError, _super);\n function UnsubscriptionError(errors) {\n _super.call(this);\n this.errors = errors;\n var err = Error.call(this, errors ?\n errors.length + \" errors occurred during unsubscription:\\n \" + errors.map(function (err, i) { return ((i + 1) + \") \" + err.toString()); }).join('\\n ') : '');\n this.name = err.name = 'UnsubscriptionError';\n this.stack = err.stack;\n this.message = err.message;\n }\n return UnsubscriptionError;\n}(Error));\nexports.UnsubscriptionError = UnsubscriptionError;\n//# sourceMappingURL=UnsubscriptionError.js.map","\"use strict\";\nvar isArray_1 = require('./util/isArray');\nvar isObject_1 = require('./util/isObject');\nvar isFunction_1 = require('./util/isFunction');\nvar tryCatch_1 = require('./util/tryCatch');\nvar errorObject_1 = require('./util/errorObject');\nvar UnsubscriptionError_1 = require('./util/UnsubscriptionError');\n/**\n * Represents a disposable resource, such as the execution of an Observable. A\n * Subscription has one important method, `unsubscribe`, that takes no argument\n * and just disposes the resource held by the subscription.\n *\n * Additionally, subscriptions may be grouped together through the `add()`\n * method, which will attach a child Subscription to the current Subscription.\n * When a Subscription is unsubscribed, all its children (and its grandchildren)\n * will be unsubscribed as well.\n *\n * @class Subscription\n */\nvar Subscription = (function () {\n /**\n * @param {function(): void} [unsubscribe] A function describing how to\n * perform the disposal of resources when the `unsubscribe` method is called.\n */\n function Subscription(unsubscribe) {\n /**\n * A flag to indicate whether this Subscription has already been unsubscribed.\n * @type {boolean}\n */\n this.closed = false;\n this._parent = null;\n this._parents = null;\n this._subscriptions = null;\n if (unsubscribe) {\n this._unsubscribe = unsubscribe;\n }\n }\n /**\n * Disposes the resources held by the subscription. May, for instance, cancel\n * an ongoing Observable execution or cancel any other type of work that\n * started when the Subscription was created.\n * @return {void}\n */\n Subscription.prototype.unsubscribe = function () {\n var hasErrors = false;\n var errors;\n if (this.closed) {\n return;\n }\n var _a = this, _parent = _a._parent, _parents = _a._parents, _unsubscribe = _a._unsubscribe, _subscriptions = _a._subscriptions;\n this.closed = true;\n this._parent = null;\n this._parents = null;\n // null out _subscriptions first so any child subscriptions that attempt\n // to remove themselves from this subscription will noop\n this._subscriptions = null;\n var index = -1;\n var len = _parents ? _parents.length : 0;\n // if this._parent is null, then so is this._parents, and we\n // don't have to remove ourselves from any parent subscriptions.\n while (_parent) {\n _parent.remove(this);\n // if this._parents is null or index >= len,\n // then _parent is set to null, and the loop exits\n _parent = ++index < len && _parents[index] || null;\n }\n if (isFunction_1.isFunction(_unsubscribe)) {\n var trial = tryCatch_1.tryCatch(_unsubscribe).call(this);\n if (trial === errorObject_1.errorObject) {\n hasErrors = true;\n errors = errors || (errorObject_1.errorObject.e instanceof UnsubscriptionError_1.UnsubscriptionError ?\n flattenUnsubscriptionErrors(errorObject_1.errorObject.e.errors) : [errorObject_1.errorObject.e]);\n }\n }\n if (isArray_1.isArray(_subscriptions)) {\n index = -1;\n len = _subscriptions.length;\n while (++index < len) {\n var sub = _subscriptions[index];\n if (isObject_1.isObject(sub)) {\n var trial = tryCatch_1.tryCatch(sub.unsubscribe).call(sub);\n if (trial === errorObject_1.errorObject) {\n hasErrors = true;\n errors = errors || [];\n var err = errorObject_1.errorObject.e;\n if (err instanceof UnsubscriptionError_1.UnsubscriptionError) {\n errors = errors.concat(flattenUnsubscriptionErrors(err.errors));\n }\n else {\n errors.push(err);\n }\n }\n }\n }\n }\n if (hasErrors) {\n throw new UnsubscriptionError_1.UnsubscriptionError(errors);\n }\n };\n /**\n * Adds a tear down to be called during the unsubscribe() of this\n * Subscription.\n *\n * If the tear down being added is a subscription that is already\n * unsubscribed, is the same reference `add` is being called on, or is\n * `Subscription.EMPTY`, it will not be added.\n *\n * If this subscription is already in an `closed` state, the passed\n * tear down logic will be executed immediately.\n *\n * @param {TeardownLogic} teardown The additional logic to execute on\n * teardown.\n * @return {Subscription} Returns the Subscription used or created to be\n * added to the inner subscriptions list. This Subscription can be used with\n * `remove()` to remove the passed teardown logic from the inner subscriptions\n * list.\n */\n Subscription.prototype.add = function (teardown) {\n if (!teardown || (teardown === Subscription.EMPTY)) {\n return Subscription.EMPTY;\n }\n if (teardown === this) {\n return this;\n }\n var subscription = teardown;\n switch (typeof teardown) {\n case 'function':\n subscription = new Subscription(teardown);\n case 'object':\n if (subscription.closed || typeof subscription.unsubscribe !== 'function') {\n return subscription;\n }\n else if (this.closed) {\n subscription.unsubscribe();\n return subscription;\n }\n else if (typeof subscription._addParent !== 'function' /* quack quack */) {\n var tmp = subscription;\n subscription = new Subscription();\n subscription._subscriptions = [tmp];\n }\n break;\n default:\n throw new Error('unrecognized teardown ' + teardown + ' added to Subscription.');\n }\n var subscriptions = this._subscriptions || (this._subscriptions = []);\n subscriptions.push(subscription);\n subscription._addParent(this);\n return subscription;\n };\n /**\n * Removes a Subscription from the internal list of subscriptions that will\n * unsubscribe during the unsubscribe process of this Subscription.\n * @param {Subscription} subscription The subscription to remove.\n * @return {void}\n */\n Subscription.prototype.remove = function (subscription) {\n var subscriptions = this._subscriptions;\n if (subscriptions) {\n var subscriptionIndex = subscriptions.indexOf(subscription);\n if (subscriptionIndex !== -1) {\n subscriptions.splice(subscriptionIndex, 1);\n }\n }\n };\n Subscription.prototype._addParent = function (parent) {\n var _a = this, _parent = _a._parent, _parents = _a._parents;\n if (!_parent || _parent === parent) {\n // If we don't have a parent, or the new parent is the same as the\n // current parent, then set this._parent to the new parent.\n this._parent = parent;\n }\n else if (!_parents) {\n // If there's already one parent, but not multiple, allocate an Array to\n // store the rest of the parent Subscriptions.\n this._parents = [parent];\n }\n else if (_parents.indexOf(parent) === -1) {\n // Only add the new parent to the _parents list if it's not already there.\n _parents.push(parent);\n }\n };\n Subscription.EMPTY = (function (empty) {\n empty.closed = true;\n return empty;\n }(new Subscription()));\n return Subscription;\n}());\nexports.Subscription = Subscription;\nfunction flattenUnsubscriptionErrors(errors) {\n return errors.reduce(function (errs, err) { return errs.concat((err instanceof UnsubscriptionError_1.UnsubscriptionError) ? err.errors : err); }, []);\n}\n//# sourceMappingURL=Subscription.js.map","\"use strict\";\nexports.empty = {\n closed: true,\n next: function (value) { },\n error: function (err) { throw err; },\n complete: function () { }\n};\n//# sourceMappingURL=Observer.js.map","\"use strict\";\nvar root_1 = require('../util/root');\nvar Symbol = root_1.root.Symbol;\nexports.rxSubscriber = (typeof Symbol === 'function' && typeof Symbol.for === 'function') ?\n Symbol.for('rxSubscriber') : '@@rxSubscriber';\n/**\n * @deprecated use rxSubscriber instead\n */\nexports.$$rxSubscriber = exports.rxSubscriber;\n//# sourceMappingURL=rxSubscriber.js.map","\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar isFunction_1 = require('./util/isFunction');\nvar Subscription_1 = require('./Subscription');\nvar Observer_1 = require('./Observer');\nvar rxSubscriber_1 = require('./symbol/rxSubscriber');\n/**\n * Implements the {@link Observer} interface and extends the\n * {@link Subscription} class. While the {@link Observer} is the public API for\n * consuming the values of an {@link Observable}, all Observers get converted to\n * a Subscriber, in order to provide Subscription-like capabilities such as\n * `unsubscribe`. Subscriber is a common type in RxJS, and crucial for\n * implementing operators, but it is rarely used as a public API.\n *\n * @class Subscriber\n */\nvar Subscriber = (function (_super) {\n __extends(Subscriber, _super);\n /**\n * @param {Observer|function(value: T): void} [destinationOrNext] A partially\n * defined Observer or a `next` callback function.\n * @param {function(e: ?any): void} [error] The `error` callback of an\n * Observer.\n * @param {function(): void} [complete] The `complete` callback of an\n * Observer.\n */\n function Subscriber(destinationOrNext, error, complete) {\n _super.call(this);\n this.syncErrorValue = null;\n this.syncErrorThrown = false;\n this.syncErrorThrowable = false;\n this.isStopped = false;\n switch (arguments.length) {\n case 0:\n this.destination = Observer_1.empty;\n break;\n case 1:\n if (!destinationOrNext) {\n this.destination = Observer_1.empty;\n break;\n }\n if (typeof destinationOrNext === 'object') {\n if (destinationOrNext instanceof Subscriber) {\n this.destination = destinationOrNext;\n this.destination.add(this);\n }\n else {\n this.syncErrorThrowable = true;\n this.destination = new SafeSubscriber(this, destinationOrNext);\n }\n break;\n }\n default:\n this.syncErrorThrowable = true;\n this.destination = new SafeSubscriber(this, destinationOrNext, error, complete);\n break;\n }\n }\n Subscriber.prototype[rxSubscriber_1.rxSubscriber] = function () { return this; };\n /**\n * A static factory for a Subscriber, given a (potentially partial) definition\n * of an Observer.\n * @param {function(x: ?T): void} [next] The `next` callback of an Observer.\n * @param {function(e: ?any): void} [error] The `error` callback of an\n * Observer.\n * @param {function(): void} [complete] The `complete` callback of an\n * Observer.\n * @return {Subscriber} A Subscriber wrapping the (partially defined)\n * Observer represented by the given arguments.\n */\n Subscriber.create = function (next, error, complete) {\n var subscriber = new Subscriber(next, error, complete);\n subscriber.syncErrorThrowable = false;\n return subscriber;\n };\n /**\n * The {@link Observer} callback to receive notifications of type `next` from\n * the Observable, with a value. The Observable may call this method 0 or more\n * times.\n * @param {T} [value] The `next` value.\n * @return {void}\n */\n Subscriber.prototype.next = function (value) {\n if (!this.isStopped) {\n this._next(value);\n }\n };\n /**\n * The {@link Observer} callback to receive notifications of type `error` from\n * the Observable, with an attached {@link Error}. Notifies the Observer that\n * the Observable has experienced an error condition.\n * @param {any} [err] The `error` exception.\n * @return {void}\n */\n Subscriber.prototype.error = function (err) {\n if (!this.isStopped) {\n this.isStopped = true;\n this._error(err);\n }\n };\n /**\n * The {@link Observer} callback to receive a valueless notification of type\n * `complete` from the Observable. Notifies the Observer that the Observable\n * has finished sending push-based notifications.\n * @return {void}\n */\n Subscriber.prototype.complete = function () {\n if (!this.isStopped) {\n this.isStopped = true;\n this._complete();\n }\n };\n Subscriber.prototype.unsubscribe = function () {\n if (this.closed) {\n return;\n }\n this.isStopped = true;\n _super.prototype.unsubscribe.call(this);\n };\n Subscriber.prototype._next = function (value) {\n this.destination.next(value);\n };\n Subscriber.prototype._error = function (err) {\n this.destination.error(err);\n this.unsubscribe();\n };\n Subscriber.prototype._complete = function () {\n this.destination.complete();\n this.unsubscribe();\n };\n Subscriber.prototype._unsubscribeAndRecycle = function () {\n var _a = this, _parent = _a._parent, _parents = _a._parents;\n this._parent = null;\n this._parents = null;\n this.unsubscribe();\n this.closed = false;\n this.isStopped = false;\n this._parent = _parent;\n this._parents = _parents;\n return this;\n };\n return Subscriber;\n}(Subscription_1.Subscription));\nexports.Subscriber = Subscriber;\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @ignore\n * @extends {Ignored}\n */\nvar SafeSubscriber = (function (_super) {\n __extends(SafeSubscriber, _super);\n function SafeSubscriber(_parentSubscriber, observerOrNext, error, complete) {\n _super.call(this);\n this._parentSubscriber = _parentSubscriber;\n var next;\n var context = this;\n if (isFunction_1.isFunction(observerOrNext)) {\n next = observerOrNext;\n }\n else if (observerOrNext) {\n next = observerOrNext.next;\n error = observerOrNext.error;\n complete = observerOrNext.complete;\n if (observerOrNext !== Observer_1.empty) {\n context = Object.create(observerOrNext);\n if (isFunction_1.isFunction(context.unsubscribe)) {\n this.add(context.unsubscribe.bind(context));\n }\n context.unsubscribe = this.unsubscribe.bind(this);\n }\n }\n this._context = context;\n this._next = next;\n this._error = error;\n this._complete = complete;\n }\n SafeSubscriber.prototype.next = function (value) {\n if (!this.isStopped && this._next) {\n var _parentSubscriber = this._parentSubscriber;\n if (!_parentSubscriber.syncErrorThrowable) {\n this.__tryOrUnsub(this._next, value);\n }\n else if (this.__tryOrSetError(_parentSubscriber, this._next, value)) {\n this.unsubscribe();\n }\n }\n };\n SafeSubscriber.prototype.error = function (err) {\n if (!this.isStopped) {\n var _parentSubscriber = this._parentSubscriber;\n if (this._error) {\n if (!_parentSubscriber.syncErrorThrowable) {\n this.__tryOrUnsub(this._error, err);\n this.unsubscribe();\n }\n else {\n this.__tryOrSetError(_parentSubscriber, this._error, err);\n this.unsubscribe();\n }\n }\n else if (!_parentSubscriber.syncErrorThrowable) {\n this.unsubscribe();\n throw err;\n }\n else {\n _parentSubscriber.syncErrorValue = err;\n _parentSubscriber.syncErrorThrown = true;\n this.unsubscribe();\n }\n }\n };\n SafeSubscriber.prototype.complete = function () {\n var _this = this;\n if (!this.isStopped) {\n var _parentSubscriber = this._parentSubscriber;\n if (this._complete) {\n var wrappedComplete = function () { return _this._complete.call(_this._context); };\n if (!_parentSubscriber.syncErrorThrowable) {\n this.__tryOrUnsub(wrappedComplete);\n this.unsubscribe();\n }\n else {\n this.__tryOrSetError(_parentSubscriber, wrappedComplete);\n this.unsubscribe();\n }\n }\n else {\n this.unsubscribe();\n }\n }\n };\n SafeSubscriber.prototype.__tryOrUnsub = function (fn, value) {\n try {\n fn.call(this._context, value);\n }\n catch (err) {\n this.unsubscribe();\n throw err;\n }\n };\n SafeSubscriber.prototype.__tryOrSetError = function (parent, fn, value) {\n try {\n fn.call(this._context, value);\n }\n catch (err) {\n parent.syncErrorValue = err;\n parent.syncErrorThrown = true;\n return true;\n }\n return false;\n };\n SafeSubscriber.prototype._unsubscribe = function () {\n var _parentSubscriber = this._parentSubscriber;\n this._context = null;\n this._parentSubscriber = null;\n _parentSubscriber.unsubscribe();\n };\n return SafeSubscriber;\n}(Subscriber));\n//# sourceMappingURL=Subscriber.js.map","\"use strict\";\nvar Subscriber_1 = require('../Subscriber');\nvar rxSubscriber_1 = require('../symbol/rxSubscriber');\nvar Observer_1 = require('../Observer');\nfunction toSubscriber(nextOrObserver, error, complete) {\n if (nextOrObserver) {\n if (nextOrObserver instanceof Subscriber_1.Subscriber) {\n return nextOrObserver;\n }\n if (nextOrObserver[rxSubscriber_1.rxSubscriber]) {\n return nextOrObserver[rxSubscriber_1.rxSubscriber]();\n }\n }\n if (!nextOrObserver && !error && !complete) {\n return new Subscriber_1.Subscriber(Observer_1.empty);\n }\n return new Subscriber_1.Subscriber(nextOrObserver, error, complete);\n}\nexports.toSubscriber = toSubscriber;\n//# sourceMappingURL=toSubscriber.js.map","\"use strict\";\nvar root_1 = require('../util/root');\nfunction getSymbolObservable(context) {\n var $$observable;\n var Symbol = context.Symbol;\n if (typeof Symbol === 'function') {\n if (Symbol.observable) {\n $$observable = Symbol.observable;\n }\n else {\n $$observable = Symbol('observable');\n Symbol.observable = $$observable;\n }\n }\n else {\n $$observable = '@@observable';\n }\n return $$observable;\n}\nexports.getSymbolObservable = getSymbolObservable;\nexports.observable = getSymbolObservable(root_1.root);\n/**\n * @deprecated use observable instead\n */\nexports.$$observable = exports.observable;\n//# sourceMappingURL=observable.js.map","\"use strict\";\n/* tslint:disable:no-empty */\nfunction noop() { }\nexports.noop = noop;\n//# sourceMappingURL=noop.js.map","\"use strict\";\nvar noop_1 = require('./noop');\n/* tslint:enable:max-line-length */\nfunction pipe() {\n var fns = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n fns[_i - 0] = arguments[_i];\n }\n return pipeFromArray(fns);\n}\nexports.pipe = pipe;\n/* @internal */\nfunction pipeFromArray(fns) {\n if (!fns) {\n return noop_1.noop;\n }\n if (fns.length === 1) {\n return fns[0];\n }\n return function piped(input) {\n return fns.reduce(function (prev, fn) { return fn(prev); }, input);\n };\n}\nexports.pipeFromArray = pipeFromArray;\n//# sourceMappingURL=pipe.js.map","\"use strict\";\nvar root_1 = require('./util/root');\nvar toSubscriber_1 = require('./util/toSubscriber');\nvar observable_1 = require('./symbol/observable');\nvar pipe_1 = require('./util/pipe');\n/**\n * A representation of any set of values over any amount of time. This is the most basic building block\n * of RxJS.\n *\n * @class Observable\n */\nvar Observable = (function () {\n /**\n * @constructor\n * @param {Function} subscribe the function that is called when the Observable is\n * initially subscribed to. This function is given a Subscriber, to which new values\n * can be `next`ed, or an `error` method can be called to raise an error, or\n * `complete` can be called to notify of a successful completion.\n */\n function Observable(subscribe) {\n this._isScalar = false;\n if (subscribe) {\n this._subscribe = subscribe;\n }\n }\n /**\n * Creates a new Observable, with this Observable as the source, and the passed\n * operator defined as the new observable's operator.\n * @method lift\n * @param {Operator} operator the operator defining the operation to take on the observable\n * @return {Observable} a new observable with the Operator applied\n */\n Observable.prototype.lift = function (operator) {\n var observable = new Observable();\n observable.source = this;\n observable.operator = operator;\n return observable;\n };\n /**\n * Invokes an execution of an Observable and registers Observer handlers for notifications it will emit.\n *\n * Use it when you have all these Observables, but still nothing is happening.\n *\n * `subscribe` is not a regular operator, but a method that calls Observable's internal `subscribe` function. It\n * might be for example a function that you passed to a {@link create} static factory, but most of the time it is\n * a library implementation, which defines what and when will be emitted by an Observable. This means that calling\n * `subscribe` is actually the moment when Observable starts its work, not when it is created, as it is often\n * thought.\n *\n * Apart from starting the execution of an Observable, this method allows you to listen for values\n * that an Observable emits, as well as for when it completes or errors. You can achieve this in two\n * following ways.\n *\n * The first way is creating an object that implements {@link Observer} interface. It should have methods\n * defined by that interface, but note that it should be just a regular JavaScript object, which you can create\n * yourself in any way you want (ES6 class, classic function constructor, object literal etc.). In particular do\n * not attempt to use any RxJS implementation details to create Observers - you don't need them. Remember also\n * that your object does not have to implement all methods. If you find yourself creating a method that doesn't\n * do anything, you can simply omit it. Note however, that if `error` method is not provided, all errors will\n * be left uncaught.\n *\n * The second way is to give up on Observer object altogether and simply provide callback functions in place of its methods.\n * This means you can provide three functions as arguments to `subscribe`, where first function is equivalent\n * of a `next` method, second of an `error` method and third of a `complete` method. Just as in case of Observer,\n * if you do not need to listen for something, you can omit a function, preferably by passing `undefined` or `null`,\n * since `subscribe` recognizes these functions by where they were placed in function call. When it comes\n * to `error` function, just as before, if not provided, errors emitted by an Observable will be thrown.\n *\n * Whatever style of calling `subscribe` you use, in both cases it returns a Subscription object.\n * This object allows you to call `unsubscribe` on it, which in turn will stop work that an Observable does and will clean\n * up all resources that an Observable used. Note that cancelling a subscription will not call `complete` callback\n * provided to `subscribe` function, which is reserved for a regular completion signal that comes from an Observable.\n *\n * Remember that callbacks provided to `subscribe` are not guaranteed to be called asynchronously.\n * It is an Observable itself that decides when these functions will be called. For example {@link of}\n * by default emits all its values synchronously. Always check documentation for how given Observable\n * will behave when subscribed and if its default behavior can be modified with a {@link Scheduler}.\n *\n * @example Subscribe with an Observer\n * const sumObserver = {\n * sum: 0,\n * next(value) {\n * console.log('Adding: ' + value);\n * this.sum = this.sum + value;\n * },\n * error() { // We actually could just remove this method,\n * }, // since we do not really care about errors right now.\n * complete() {\n * console.log('Sum equals: ' + this.sum);\n * }\n * };\n *\n * Rx.Observable.of(1, 2, 3) // Synchronously emits 1, 2, 3 and then completes.\n * .subscribe(sumObserver);\n *\n * // Logs:\n * // \"Adding: 1\"\n * // \"Adding: 2\"\n * // \"Adding: 3\"\n * // \"Sum equals: 6\"\n *\n *\n * @example Subscribe with functions\n * let sum = 0;\n *\n * Rx.Observable.of(1, 2, 3)\n * .subscribe(\n * function(value) {\n * console.log('Adding: ' + value);\n * sum = sum + value;\n * },\n * undefined,\n * function() {\n * console.log('Sum equals: ' + sum);\n * }\n * );\n *\n * // Logs:\n * // \"Adding: 1\"\n * // \"Adding: 2\"\n * // \"Adding: 3\"\n * // \"Sum equals: 6\"\n *\n *\n * @example Cancel a subscription\n * const subscription = Rx.Observable.interval(1000).subscribe(\n * num => console.log(num),\n * undefined,\n * () => console.log('completed!') // Will not be called, even\n * ); // when cancelling subscription\n *\n *\n * setTimeout(() => {\n * subscription.unsubscribe();\n * console.log('unsubscribed!');\n * }, 2500);\n *\n * // Logs:\n * // 0 after 1s\n * // 1 after 2s\n * // \"unsubscribed!\" after 2.5s\n *\n *\n * @param {Observer|Function} observerOrNext (optional) Either an observer with methods to be called,\n * or the first of three possible handlers, which is the handler for each value emitted from the subscribed\n * Observable.\n * @param {Function} error (optional) A handler for a terminal event resulting from an error. If no error handler is provided,\n * the error will be thrown as unhandled.\n * @param {Function} complete (optional) A handler for a terminal event resulting from successful completion.\n * @return {ISubscription} a subscription reference to the registered handlers\n * @method subscribe\n */\n Observable.prototype.subscribe = function (observerOrNext, error, complete) {\n var operator = this.operator;\n var sink = toSubscriber_1.toSubscriber(observerOrNext, error, complete);\n if (operator) {\n operator.call(sink, this.source);\n }\n else {\n sink.add(this.source ? this._subscribe(sink) : this._trySubscribe(sink));\n }\n if (sink.syncErrorThrowable) {\n sink.syncErrorThrowable = false;\n if (sink.syncErrorThrown) {\n throw sink.syncErrorValue;\n }\n }\n return sink;\n };\n Observable.prototype._trySubscribe = function (sink) {\n try {\n return this._subscribe(sink);\n }\n catch (err) {\n sink.syncErrorThrown = true;\n sink.syncErrorValue = err;\n sink.error(err);\n }\n };\n /**\n * @method forEach\n * @param {Function} next a handler for each value emitted by the observable\n * @param {PromiseConstructor} [PromiseCtor] a constructor function used to instantiate the Promise\n * @return {Promise} a promise that either resolves on observable completion or\n * rejects with the handled error\n */\n Observable.prototype.forEach = function (next, PromiseCtor) {\n var _this = this;\n if (!PromiseCtor) {\n if (root_1.root.Rx && root_1.root.Rx.config && root_1.root.Rx.config.Promise) {\n PromiseCtor = root_1.root.Rx.config.Promise;\n }\n else if (root_1.root.Promise) {\n PromiseCtor = root_1.root.Promise;\n }\n }\n if (!PromiseCtor) {\n throw new Error('no Promise impl found');\n }\n return new PromiseCtor(function (resolve, reject) {\n // Must be declared in a separate statement to avoid a RefernceError when\n // accessing subscription below in the closure due to Temporal Dead Zone.\n var subscription;\n subscription = _this.subscribe(function (value) {\n if (subscription) {\n // if there is a subscription, then we can surmise\n // the next handling is asynchronous. Any errors thrown\n // need to be rejected explicitly and unsubscribe must be\n // called manually\n try {\n next(value);\n }\n catch (err) {\n reject(err);\n subscription.unsubscribe();\n }\n }\n else {\n // if there is NO subscription, then we're getting a nexted\n // value synchronously during subscription. We can just call it.\n // If it errors, Observable's `subscribe` will ensure the\n // unsubscription logic is called, then synchronously rethrow the error.\n // After that, Promise will trap the error and send it\n // down the rejection path.\n next(value);\n }\n }, reject, resolve);\n });\n };\n Observable.prototype._subscribe = function (subscriber) {\n return this.source.subscribe(subscriber);\n };\n /**\n * An interop point defined by the es7-observable spec https://github.com/zenparsing/es-observable\n * @method Symbol.observable\n * @return {Observable} this instance of the observable\n */\n Observable.prototype[observable_1.observable] = function () {\n return this;\n };\n /* tslint:enable:max-line-length */\n /**\n * Used to stitch together functional operators into a chain.\n * @method pipe\n * @return {Observable} the Observable result of all of the operators having\n * been called in the order they were passed in.\n *\n * @example\n *\n * import { map, filter, scan } from 'rxjs/operators';\n *\n * Rx.Observable.interval(1000)\n * .pipe(\n * filter(x => x % 2 === 0),\n * map(x => x + x),\n * scan((acc, x) => acc + x)\n * )\n * .subscribe(x => console.log(x))\n */\n Observable.prototype.pipe = function () {\n var operations = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n operations[_i - 0] = arguments[_i];\n }\n if (operations.length === 0) {\n return this;\n }\n return pipe_1.pipeFromArray(operations)(this);\n };\n /* tslint:enable:max-line-length */\n Observable.prototype.toPromise = function (PromiseCtor) {\n var _this = this;\n if (!PromiseCtor) {\n if (root_1.root.Rx && root_1.root.Rx.config && root_1.root.Rx.config.Promise) {\n PromiseCtor = root_1.root.Rx.config.Promise;\n }\n else if (root_1.root.Promise) {\n PromiseCtor = root_1.root.Promise;\n }\n }\n if (!PromiseCtor) {\n throw new Error('no Promise impl found');\n }\n return new PromiseCtor(function (resolve, reject) {\n var value;\n _this.subscribe(function (x) { return value = x; }, function (err) { return reject(err); }, function () { return resolve(value); });\n });\n };\n // HACK: Since TypeScript inherits static properties too, we have to\n // fight against TypeScript here so Subject can have a different static create signature\n /**\n * Creates a new cold Observable by calling the Observable constructor\n * @static true\n * @owner Observable\n * @method create\n * @param {Function} subscribe? the subscriber function to be passed to the Observable constructor\n * @return {Observable} a new cold observable\n */\n Observable.create = function (subscribe) {\n return new Observable(subscribe);\n };\n return Observable;\n}());\nexports.Observable = Observable;\n//# sourceMappingURL=Observable.js.map","\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\n/**\n * An error thrown when an action is invalid because the object has been\n * unsubscribed.\n *\n * @see {@link Subject}\n * @see {@link BehaviorSubject}\n *\n * @class ObjectUnsubscribedError\n */\nvar ObjectUnsubscribedError = (function (_super) {\n __extends(ObjectUnsubscribedError, _super);\n function ObjectUnsubscribedError() {\n var err = _super.call(this, 'object unsubscribed');\n this.name = err.name = 'ObjectUnsubscribedError';\n this.stack = err.stack;\n this.message = err.message;\n }\n return ObjectUnsubscribedError;\n}(Error));\nexports.ObjectUnsubscribedError = ObjectUnsubscribedError;\n//# sourceMappingURL=ObjectUnsubscribedError.js.map","\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar Subscription_1 = require('./Subscription');\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @ignore\n * @extends {Ignored}\n */\nvar SubjectSubscription = (function (_super) {\n __extends(SubjectSubscription, _super);\n function SubjectSubscription(subject, subscriber) {\n _super.call(this);\n this.subject = subject;\n this.subscriber = subscriber;\n this.closed = false;\n }\n SubjectSubscription.prototype.unsubscribe = function () {\n if (this.closed) {\n return;\n }\n this.closed = true;\n var subject = this.subject;\n var observers = subject.observers;\n this.subject = null;\n if (!observers || observers.length === 0 || subject.isStopped || subject.closed) {\n return;\n }\n var subscriberIndex = observers.indexOf(this.subscriber);\n if (subscriberIndex !== -1) {\n observers.splice(subscriberIndex, 1);\n }\n };\n return SubjectSubscription;\n}(Subscription_1.Subscription));\nexports.SubjectSubscription = SubjectSubscription;\n//# sourceMappingURL=SubjectSubscription.js.map","\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar Observable_1 = require('./Observable');\nvar Subscriber_1 = require('./Subscriber');\nvar Subscription_1 = require('./Subscription');\nvar ObjectUnsubscribedError_1 = require('./util/ObjectUnsubscribedError');\nvar SubjectSubscription_1 = require('./SubjectSubscription');\nvar rxSubscriber_1 = require('./symbol/rxSubscriber');\n/**\n * @class SubjectSubscriber\n */\nvar SubjectSubscriber = (function (_super) {\n __extends(SubjectSubscriber, _super);\n function SubjectSubscriber(destination) {\n _super.call(this, destination);\n this.destination = destination;\n }\n return SubjectSubscriber;\n}(Subscriber_1.Subscriber));\nexports.SubjectSubscriber = SubjectSubscriber;\n/**\n * @class Subject\n */\nvar Subject = (function (_super) {\n __extends(Subject, _super);\n function Subject() {\n _super.call(this);\n this.observers = [];\n this.closed = false;\n this.isStopped = false;\n this.hasError = false;\n this.thrownError = null;\n }\n Subject.prototype[rxSubscriber_1.rxSubscriber] = function () {\n return new SubjectSubscriber(this);\n };\n Subject.prototype.lift = function (operator) {\n var subject = new AnonymousSubject(this, this);\n subject.operator = operator;\n return subject;\n };\n Subject.prototype.next = function (value) {\n if (this.closed) {\n throw new ObjectUnsubscribedError_1.ObjectUnsubscribedError();\n }\n if (!this.isStopped) {\n var observers = this.observers;\n var len = observers.length;\n var copy = observers.slice();\n for (var i = 0; i < len; i++) {\n copy[i].next(value);\n }\n }\n };\n Subject.prototype.error = function (err) {\n if (this.closed) {\n throw new ObjectUnsubscribedError_1.ObjectUnsubscribedError();\n }\n this.hasError = true;\n this.thrownError = err;\n this.isStopped = true;\n var observers = this.observers;\n var len = observers.length;\n var copy = observers.slice();\n for (var i = 0; i < len; i++) {\n copy[i].error(err);\n }\n this.observers.length = 0;\n };\n Subject.prototype.complete = function () {\n if (this.closed) {\n throw new ObjectUnsubscribedError_1.ObjectUnsubscribedError();\n }\n this.isStopped = true;\n var observers = this.observers;\n var len = observers.length;\n var copy = observers.slice();\n for (var i = 0; i < len; i++) {\n copy[i].complete();\n }\n this.observers.length = 0;\n };\n Subject.prototype.unsubscribe = function () {\n this.isStopped = true;\n this.closed = true;\n this.observers = null;\n };\n Subject.prototype._trySubscribe = function (subscriber) {\n if (this.closed) {\n throw new ObjectUnsubscribedError_1.ObjectUnsubscribedError();\n }\n else {\n return _super.prototype._trySubscribe.call(this, subscriber);\n }\n };\n Subject.prototype._subscribe = function (subscriber) {\n if (this.closed) {\n throw new ObjectUnsubscribedError_1.ObjectUnsubscribedError();\n }\n else if (this.hasError) {\n subscriber.error(this.thrownError);\n return Subscription_1.Subscription.EMPTY;\n }\n else if (this.isStopped) {\n subscriber.complete();\n return Subscription_1.Subscription.EMPTY;\n }\n else {\n this.observers.push(subscriber);\n return new SubjectSubscription_1.SubjectSubscription(this, subscriber);\n }\n };\n Subject.prototype.asObservable = function () {\n var observable = new Observable_1.Observable();\n observable.source = this;\n return observable;\n };\n Subject.create = function (destination, source) {\n return new AnonymousSubject(destination, source);\n };\n return Subject;\n}(Observable_1.Observable));\nexports.Subject = Subject;\n/**\n * @class AnonymousSubject\n */\nvar AnonymousSubject = (function (_super) {\n __extends(AnonymousSubject, _super);\n function AnonymousSubject(destination, source) {\n _super.call(this);\n this.destination = destination;\n this.source = source;\n }\n AnonymousSubject.prototype.next = function (value) {\n var destination = this.destination;\n if (destination && destination.next) {\n destination.next(value);\n }\n };\n AnonymousSubject.prototype.error = function (err) {\n var destination = this.destination;\n if (destination && destination.error) {\n this.destination.error(err);\n }\n };\n AnonymousSubject.prototype.complete = function () {\n var destination = this.destination;\n if (destination && destination.complete) {\n this.destination.complete();\n }\n };\n AnonymousSubject.prototype._subscribe = function (subscriber) {\n var source = this.source;\n if (source) {\n return this.source.subscribe(subscriber);\n }\n else {\n return Subscription_1.Subscription.EMPTY;\n }\n };\n return AnonymousSubject;\n}(Subject));\nexports.AnonymousSubject = AnonymousSubject;\n//# sourceMappingURL=Subject.js.map","\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar Subject_1 = require('./Subject');\nvar ObjectUnsubscribedError_1 = require('./util/ObjectUnsubscribedError');\n/**\n * @class BehaviorSubject\n */\nvar BehaviorSubject = (function (_super) {\n __extends(BehaviorSubject, _super);\n function BehaviorSubject(_value) {\n _super.call(this);\n this._value = _value;\n }\n Object.defineProperty(BehaviorSubject.prototype, \"value\", {\n get: function () {\n return this.getValue();\n },\n enumerable: true,\n configurable: true\n });\n BehaviorSubject.prototype._subscribe = function (subscriber) {\n var subscription = _super.prototype._subscribe.call(this, subscriber);\n if (subscription && !subscription.closed) {\n subscriber.next(this._value);\n }\n return subscription;\n };\n BehaviorSubject.prototype.getValue = function () {\n if (this.hasError) {\n throw this.thrownError;\n }\n else if (this.closed) {\n throw new ObjectUnsubscribedError_1.ObjectUnsubscribedError();\n }\n else {\n return this._value;\n }\n };\n BehaviorSubject.prototype.next = function (value) {\n _super.prototype.next.call(this, this._value = value);\n };\n return BehaviorSubject;\n}(Subject_1.Subject));\nexports.BehaviorSubject = BehaviorSubject;\n//# sourceMappingURL=BehaviorSubject.js.map","import packageJson from '../../package.json'\nimport domReady from './runtime/dom-ready.js'\nimport Rx from 'rxjs/BehaviorSubject.js'\n\n// detect environment\nvar isNode = !!(\n // detect node environment\n typeof module !== 'undefined'\n && module.exports\n && typeof process !== 'undefined'\n && Object.prototype.toString.call(process) === '[object process]'\n)\nvar isBrowser = !isNode && typeof window !== 'undefined' && Object.prototype.toString.call(window) === '[object Window]'\n// detect whether webgl is available\nvar webGlInfo = getWebGlInfo()\n// detect whether aframe or webgl libs are avilable\nvar aframeReady = !!(isBrowser && window.AFRAME)\nvar threeReady = !!(isBrowser && window.THREE)\n\nvar isVisible$ = new Rx.BehaviorSubject()\nvar isFocused$ = new Rx.BehaviorSubject()\n\n// create runtime object\n\nvar runtime = {\n\n isDebugMode: false,\n isNode: isNode,\n\n // browser specific\n\n isBrowser: isBrowser,\n assertBrowser: assertBrowser,\n isMobile: detectMobile(),\n domReady: domReady,\n isVisible$: isVisible$,\n isFocused$: isFocused$,\n\n has: {\n webGl: !!webGlInfo,\n aframe: aframeReady,\n three: threeReady\n },\n\n webGl: webGlInfo,\n\n libInfo: {\n npmName: packageJson.name,\n version: packageJson.version,\n homepage: packageJson.homepage,\n githubRepository: packageJson.repository,\n gitBranchName: GIT_BRANCH,\n gitCommitHash: GIT_COMMIT.substr(0,7),\n buildDate: BUILD_DATE,\n license: packageJson.license\n }\n\n}\n\nexport default runtime\n\n// helpers\n\nfunction assertBrowser(message) {\n if (!isBrowser) throw (message || 'Sorry this feature requires a browser environment.')\n}\n\nfunction getWebGlInfo () {\n\n var canvas = typeof document !== 'undefined' ? document.createElement('canvas') : null\n if (!canvas) return null\n\n var gl = canvas.getContext('webgl') ||\n canvas.getContext('experimental-webgl') ||\n canvas.getContext('webgl', {antialias: false}) ||\n canvas.getContext('experimental-webgl', {antialias: false})\n if (!gl) return null\n\n var debugInfo = gl.getExtension( 'WEBGL_debug_renderer_info' )\n var supportsDds = gl.getExtension('WEBGL_compressed_texture_s3tc')\n\n return {\n shadingLanguageVersion: gl.getParameter( gl.SHADING_LANGUAGE_VERSION ),\n renderer: gl.getParameter( gl.RENDERER ),\n vendor: gl.getParameter( gl.VENDOR ),\n unmaskedRenderer: debugInfo && gl.getParameter( debugInfo.UNMASKED_RENDERER_WEBGL ),\n unmaskedVendor: debugInfo && gl.getParameter( debugInfo.UNMASKED_VENDOR_WEBGL ),\n maxTextureSize: gl.getParameter( gl.MAX_TEXTURE_SIZE ),\n maxRenderbufferSize: gl.getParameter( gl.MAX_RENDERBUFFER_SIZE ),\n supportsDds: !!supportsDds\n }\n\n}\n\nfunction detectMobile () {\n var hint\n if (typeof navigator !== 'undefined' && (navigator.userAgent || navigator.vendor)) {\n hint = navigator.userAgent || navigator.vendor\n } else if (typeof window !== 'undefined' && window.opera) {\n hint = window.opera\n } else {\n return false\n }\n return /(android|bb\\d+|meego).+mobile|avantgo|bada\\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(hint)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\\-(n|u)|c55\\/|capi|ccwa|cdm\\-|cell|chtm|cldc|cmd\\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\\-s|devi|dica|dmob|do(c|p)o|ds(12|\\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\\-|_)|g1 u|g560|gene|gf\\-5|g\\-mo|go(\\.w|od)|gr(ad|un)|haie|hcit|hd\\-(m|p|t)|hei\\-|hi(pt|ta)|hp( i|ip)|hs\\-c|ht(c(\\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\\-(20|go|ma)|i230|iac( |\\-|\\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\\/)|klon|kpt |kwc\\-|kyo(c|k)|le(no|xi)|lg( g|\\/(k|l|u)|50|54|\\-[a-w])|libw|lynx|m1\\-w|m3ga|m50\\/|ma(te|ui|xo)|mc(01|21|ca)|m\\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\\-2|po(ck|rt|se)|prox|psio|pt\\-g|qa\\-a|qc(07|12|21|32|60|\\-[2-7]|i\\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\\-|oo|p\\-)|sdk\\/|se(c(\\-|0|1)|47|mc|nd|ri)|sgh\\-|shar|sie(\\-|m)|sk\\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\\-|v\\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\\-|tdg\\-|tel(i|m)|tim\\-|t\\-mo|to(pl|sh)|ts(70|m\\-|m3|m5)|tx\\-9|up(\\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\\-|your|zeto|zte\\-/i.test(hint.substr(0,4))\n}\n\n// isVisible\n\nif (isBrowser) {\n domReady(function(doc){\n // get initial tab visible state\n isVisible$.next(getTabVisibleState())\n // bind tab visibility event\n var visibilityEventName\n if (typeof document.hidden !== \"undefined\") {\n visibilityEventName = \"visibilitychange\";\n } else if (typeof document.mozHidden !== \"undefined\") {\n visibilityEventName = \"mozvisibilitychange\";\n } else if (typeof document.msHidden !== \"undefined\") {\n visibilityEventName = \"msvisibilitychange\";\n } else if (typeof document.webkitHidden !== \"undefined\") {\n visibilityEventName = \"webkitvisibilitychange\";\n }\n doc.addEventListener(visibilityEventName, function onTabVisibilityChange () {\n isVisible$.next(getTabVisibleState())\n }, false)\n })\n}\n\nfunction getTabVisibleState () {\n if (document.hidden !== undefined) return !document.hidden\n if (document.webkitHidden !== undefined) return !document.webkitHidden\n if (document.mozHidden !== undefined) return !document.mozHidden\n if (document.msHidden !== undefined) return !document.msHidden\n return undefined\n}\n\n// isFocused\n\nif (isBrowser) {\n domReady(function(){\n // get initial state\n isFocused$.next(document.hasFocus())\n // bind events\n window.onfocus = function () {\n isFocused$.next(true)\n }\n window.onblur = function () {\n isFocused$.next(false)\n }\n })\n\n}","/* @preserve\n * The MIT License (MIT)\n * \n * Copyright (c) 2013-2017 Petka Antonov\n * \n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n * \n */\n/**\n * bluebird build version 3.5.1\n * Features enabled: core, race, call_get, generators, map, nodeify, promisify, props, reduce, settle, some, using, timers, filter, any, each\n*/\n!function(e){if(\"object\"==typeof exports&&\"undefined\"!=typeof module)module.exports=e();else if(\"function\"==typeof define&&define.amd)define([],e);else{var f;\"undefined\"!=typeof window?f=window:\"undefined\"!=typeof global?f=global:\"undefined\"!=typeof self&&(f=self),f.Promise=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof _dereq_==\"function\"&&_dereq_;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\"Cannot find module '\"+o+\"'\");throw f.code=\"MODULE_NOT_FOUND\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof _dereq_==\"function\"&&_dereq_;for(var o=0;o 0) {\n var fn = queue.shift();\n if (typeof fn !== \"function\") {\n fn._settlePromises();\n continue;\n }\n var receiver = queue.shift();\n var arg = queue.shift();\n fn.call(receiver, arg);\n }\n};\n\nAsync.prototype._drainQueues = function () {\n this._drainQueue(this._normalQueue);\n this._reset();\n this._haveDrainedQueues = true;\n this._drainQueue(this._lateQueue);\n};\n\nAsync.prototype._queueTick = function () {\n if (!this._isTickUsed) {\n this._isTickUsed = true;\n this._schedule(this.drainQueues);\n }\n};\n\nAsync.prototype._reset = function () {\n this._isTickUsed = false;\n};\n\nmodule.exports = Async;\nmodule.exports.firstLineError = firstLineError;\n\n},{\"./queue\":26,\"./schedule\":29,\"./util\":36}],3:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function(Promise, INTERNAL, tryConvertToPromise, debug) {\nvar calledBind = false;\nvar rejectThis = function(_, e) {\n this._reject(e);\n};\n\nvar targetRejected = function(e, context) {\n context.promiseRejectionQueued = true;\n context.bindingPromise._then(rejectThis, rejectThis, null, this, e);\n};\n\nvar bindingResolved = function(thisArg, context) {\n if (((this._bitField & 50397184) === 0)) {\n this._resolveCallback(context.target);\n }\n};\n\nvar bindingRejected = function(e, context) {\n if (!context.promiseRejectionQueued) this._reject(e);\n};\n\nPromise.prototype.bind = function (thisArg) {\n if (!calledBind) {\n calledBind = true;\n Promise.prototype._propagateFrom = debug.propagateFromFunction();\n Promise.prototype._boundValue = debug.boundValueFunction();\n }\n var maybePromise = tryConvertToPromise(thisArg);\n var ret = new Promise(INTERNAL);\n ret._propagateFrom(this, 1);\n var target = this._target();\n ret._setBoundTo(maybePromise);\n if (maybePromise instanceof Promise) {\n var context = {\n promiseRejectionQueued: false,\n promise: ret,\n target: target,\n bindingPromise: maybePromise\n };\n target._then(INTERNAL, targetRejected, undefined, ret, context);\n maybePromise._then(\n bindingResolved, bindingRejected, undefined, ret, context);\n ret._setOnCancel(maybePromise);\n } else {\n ret._resolveCallback(target);\n }\n return ret;\n};\n\nPromise.prototype._setBoundTo = function (obj) {\n if (obj !== undefined) {\n this._bitField = this._bitField | 2097152;\n this._boundTo = obj;\n } else {\n this._bitField = this._bitField & (~2097152);\n }\n};\n\nPromise.prototype._isBound = function () {\n return (this._bitField & 2097152) === 2097152;\n};\n\nPromise.bind = function (thisArg, value) {\n return Promise.resolve(value).bind(thisArg);\n};\n};\n\n},{}],4:[function(_dereq_,module,exports){\n\"use strict\";\nvar old;\nif (typeof Promise !== \"undefined\") old = Promise;\nfunction noConflict() {\n try { if (Promise === bluebird) Promise = old; }\n catch (e) {}\n return bluebird;\n}\nvar bluebird = _dereq_(\"./promise\")();\nbluebird.noConflict = noConflict;\nmodule.exports = bluebird;\n\n},{\"./promise\":22}],5:[function(_dereq_,module,exports){\n\"use strict\";\nvar cr = Object.create;\nif (cr) {\n var callerCache = cr(null);\n var getterCache = cr(null);\n callerCache[\" size\"] = getterCache[\" size\"] = 0;\n}\n\nmodule.exports = function(Promise) {\nvar util = _dereq_(\"./util\");\nvar canEvaluate = util.canEvaluate;\nvar isIdentifier = util.isIdentifier;\n\nvar getMethodCaller;\nvar getGetter;\nif (!true) {\nvar makeMethodCaller = function (methodName) {\n return new Function(\"ensureMethod\", \" \\n\\\n return function(obj) { \\n\\\n 'use strict' \\n\\\n var len = this.length; \\n\\\n ensureMethod(obj, 'methodName'); \\n\\\n switch(len) { \\n\\\n case 1: return obj.methodName(this[0]); \\n\\\n case 2: return obj.methodName(this[0], this[1]); \\n\\\n case 3: return obj.methodName(this[0], this[1], this[2]); \\n\\\n case 0: return obj.methodName(); \\n\\\n default: \\n\\\n return obj.methodName.apply(obj, this); \\n\\\n } \\n\\\n }; \\n\\\n \".replace(/methodName/g, methodName))(ensureMethod);\n};\n\nvar makeGetter = function (propertyName) {\n return new Function(\"obj\", \" \\n\\\n 'use strict'; \\n\\\n return obj.propertyName; \\n\\\n \".replace(\"propertyName\", propertyName));\n};\n\nvar getCompiled = function(name, compiler, cache) {\n var ret = cache[name];\n if (typeof ret !== \"function\") {\n if (!isIdentifier(name)) {\n return null;\n }\n ret = compiler(name);\n cache[name] = ret;\n cache[\" size\"]++;\n if (cache[\" size\"] > 512) {\n var keys = Object.keys(cache);\n for (var i = 0; i < 256; ++i) delete cache[keys[i]];\n cache[\" size\"] = keys.length - 256;\n }\n }\n return ret;\n};\n\ngetMethodCaller = function(name) {\n return getCompiled(name, makeMethodCaller, callerCache);\n};\n\ngetGetter = function(name) {\n return getCompiled(name, makeGetter, getterCache);\n};\n}\n\nfunction ensureMethod(obj, methodName) {\n var fn;\n if (obj != null) fn = obj[methodName];\n if (typeof fn !== \"function\") {\n var message = \"Object \" + util.classString(obj) + \" has no method '\" +\n util.toString(methodName) + \"'\";\n throw new Promise.TypeError(message);\n }\n return fn;\n}\n\nfunction caller(obj) {\n var methodName = this.pop();\n var fn = ensureMethod(obj, methodName);\n return fn.apply(obj, this);\n}\nPromise.prototype.call = function (methodName) {\n var args = [].slice.call(arguments, 1);;\n if (!true) {\n if (canEvaluate) {\n var maybeCaller = getMethodCaller(methodName);\n if (maybeCaller !== null) {\n return this._then(\n maybeCaller, undefined, undefined, args, undefined);\n }\n }\n }\n args.push(methodName);\n return this._then(caller, undefined, undefined, args, undefined);\n};\n\nfunction namedGetter(obj) {\n return obj[this];\n}\nfunction indexedGetter(obj) {\n var index = +this;\n if (index < 0) index = Math.max(0, index + obj.length);\n return obj[index];\n}\nPromise.prototype.get = function (propertyName) {\n var isIndex = (typeof propertyName === \"number\");\n var getter;\n if (!isIndex) {\n if (canEvaluate) {\n var maybeGetter = getGetter(propertyName);\n getter = maybeGetter !== null ? maybeGetter : namedGetter;\n } else {\n getter = namedGetter;\n }\n } else {\n getter = indexedGetter;\n }\n return this._then(getter, undefined, undefined, propertyName, undefined);\n};\n};\n\n},{\"./util\":36}],6:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function(Promise, PromiseArray, apiRejection, debug) {\nvar util = _dereq_(\"./util\");\nvar tryCatch = util.tryCatch;\nvar errorObj = util.errorObj;\nvar async = Promise._async;\n\nPromise.prototype[\"break\"] = Promise.prototype.cancel = function() {\n if (!debug.cancellation()) return this._warn(\"cancellation is disabled\");\n\n var promise = this;\n var child = promise;\n while (promise._isCancellable()) {\n if (!promise._cancelBy(child)) {\n if (child._isFollowing()) {\n child._followee().cancel();\n } else {\n child._cancelBranched();\n }\n break;\n }\n\n var parent = promise._cancellationParent;\n if (parent == null || !parent._isCancellable()) {\n if (promise._isFollowing()) {\n promise._followee().cancel();\n } else {\n promise._cancelBranched();\n }\n break;\n } else {\n if (promise._isFollowing()) promise._followee().cancel();\n promise._setWillBeCancelled();\n child = promise;\n promise = parent;\n }\n }\n};\n\nPromise.prototype._branchHasCancelled = function() {\n this._branchesRemainingToCancel--;\n};\n\nPromise.prototype._enoughBranchesHaveCancelled = function() {\n return this._branchesRemainingToCancel === undefined ||\n this._branchesRemainingToCancel <= 0;\n};\n\nPromise.prototype._cancelBy = function(canceller) {\n if (canceller === this) {\n this._branchesRemainingToCancel = 0;\n this._invokeOnCancel();\n return true;\n } else {\n this._branchHasCancelled();\n if (this._enoughBranchesHaveCancelled()) {\n this._invokeOnCancel();\n return true;\n }\n }\n return false;\n};\n\nPromise.prototype._cancelBranched = function() {\n if (this._enoughBranchesHaveCancelled()) {\n this._cancel();\n }\n};\n\nPromise.prototype._cancel = function() {\n if (!this._isCancellable()) return;\n this._setCancelled();\n async.invoke(this._cancelPromises, this, undefined);\n};\n\nPromise.prototype._cancelPromises = function() {\n if (this._length() > 0) this._settlePromises();\n};\n\nPromise.prototype._unsetOnCancel = function() {\n this._onCancelField = undefined;\n};\n\nPromise.prototype._isCancellable = function() {\n return this.isPending() && !this._isCancelled();\n};\n\nPromise.prototype.isCancellable = function() {\n return this.isPending() && !this.isCancelled();\n};\n\nPromise.prototype._doInvokeOnCancel = function(onCancelCallback, internalOnly) {\n if (util.isArray(onCancelCallback)) {\n for (var i = 0; i < onCancelCallback.length; ++i) {\n this._doInvokeOnCancel(onCancelCallback[i], internalOnly);\n }\n } else if (onCancelCallback !== undefined) {\n if (typeof onCancelCallback === \"function\") {\n if (!internalOnly) {\n var e = tryCatch(onCancelCallback).call(this._boundValue());\n if (e === errorObj) {\n this._attachExtraTrace(e.e);\n async.throwLater(e.e);\n }\n }\n } else {\n onCancelCallback._resultCancelled(this);\n }\n }\n};\n\nPromise.prototype._invokeOnCancel = function() {\n var onCancelCallback = this._onCancel();\n this._unsetOnCancel();\n async.invoke(this._doInvokeOnCancel, this, onCancelCallback);\n};\n\nPromise.prototype._invokeInternalOnCancel = function() {\n if (this._isCancellable()) {\n this._doInvokeOnCancel(this._onCancel(), true);\n this._unsetOnCancel();\n }\n};\n\nPromise.prototype._resultCancelled = function() {\n this.cancel();\n};\n\n};\n\n},{\"./util\":36}],7:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function(NEXT_FILTER) {\nvar util = _dereq_(\"./util\");\nvar getKeys = _dereq_(\"./es5\").keys;\nvar tryCatch = util.tryCatch;\nvar errorObj = util.errorObj;\n\nfunction catchFilter(instances, cb, promise) {\n return function(e) {\n var boundTo = promise._boundValue();\n predicateLoop: for (var i = 0; i < instances.length; ++i) {\n var item = instances[i];\n\n if (item === Error ||\n (item != null && item.prototype instanceof Error)) {\n if (e instanceof item) {\n return tryCatch(cb).call(boundTo, e);\n }\n } else if (typeof item === \"function\") {\n var matchesPredicate = tryCatch(item).call(boundTo, e);\n if (matchesPredicate === errorObj) {\n return matchesPredicate;\n } else if (matchesPredicate) {\n return tryCatch(cb).call(boundTo, e);\n }\n } else if (util.isObject(e)) {\n var keys = getKeys(item);\n for (var j = 0; j < keys.length; ++j) {\n var key = keys[j];\n if (item[key] != e[key]) {\n continue predicateLoop;\n }\n }\n return tryCatch(cb).call(boundTo, e);\n }\n }\n return NEXT_FILTER;\n };\n}\n\nreturn catchFilter;\n};\n\n},{\"./es5\":13,\"./util\":36}],8:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function(Promise) {\nvar longStackTraces = false;\nvar contextStack = [];\n\nPromise.prototype._promiseCreated = function() {};\nPromise.prototype._pushContext = function() {};\nPromise.prototype._popContext = function() {return null;};\nPromise._peekContext = Promise.prototype._peekContext = function() {};\n\nfunction Context() {\n this._trace = new Context.CapturedTrace(peekContext());\n}\nContext.prototype._pushContext = function () {\n if (this._trace !== undefined) {\n this._trace._promiseCreated = null;\n contextStack.push(this._trace);\n }\n};\n\nContext.prototype._popContext = function () {\n if (this._trace !== undefined) {\n var trace = contextStack.pop();\n var ret = trace._promiseCreated;\n trace._promiseCreated = null;\n return ret;\n }\n return null;\n};\n\nfunction createContext() {\n if (longStackTraces) return new Context();\n}\n\nfunction peekContext() {\n var lastIndex = contextStack.length - 1;\n if (lastIndex >= 0) {\n return contextStack[lastIndex];\n }\n return undefined;\n}\nContext.CapturedTrace = null;\nContext.create = createContext;\nContext.deactivateLongStackTraces = function() {};\nContext.activateLongStackTraces = function() {\n var Promise_pushContext = Promise.prototype._pushContext;\n var Promise_popContext = Promise.prototype._popContext;\n var Promise_PeekContext = Promise._peekContext;\n var Promise_peekContext = Promise.prototype._peekContext;\n var Promise_promiseCreated = Promise.prototype._promiseCreated;\n Context.deactivateLongStackTraces = function() {\n Promise.prototype._pushContext = Promise_pushContext;\n Promise.prototype._popContext = Promise_popContext;\n Promise._peekContext = Promise_PeekContext;\n Promise.prototype._peekContext = Promise_peekContext;\n Promise.prototype._promiseCreated = Promise_promiseCreated;\n longStackTraces = false;\n };\n longStackTraces = true;\n Promise.prototype._pushContext = Context.prototype._pushContext;\n Promise.prototype._popContext = Context.prototype._popContext;\n Promise._peekContext = Promise.prototype._peekContext = peekContext;\n Promise.prototype._promiseCreated = function() {\n var ctx = this._peekContext();\n if (ctx && ctx._promiseCreated == null) ctx._promiseCreated = this;\n };\n};\nreturn Context;\n};\n\n},{}],9:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function(Promise, Context) {\nvar getDomain = Promise._getDomain;\nvar async = Promise._async;\nvar Warning = _dereq_(\"./errors\").Warning;\nvar util = _dereq_(\"./util\");\nvar canAttachTrace = util.canAttachTrace;\nvar unhandledRejectionHandled;\nvar possiblyUnhandledRejection;\nvar bluebirdFramePattern =\n /[\\\\\\/]bluebird[\\\\\\/]js[\\\\\\/](release|debug|instrumented)/;\nvar nodeFramePattern = /\\((?:timers\\.js):\\d+:\\d+\\)/;\nvar parseLinePattern = /[\\/<\\(](.+?):(\\d+):(\\d+)\\)?\\s*$/;\nvar stackFramePattern = null;\nvar formatStack = null;\nvar indentStackFrames = false;\nvar printWarning;\nvar debugging = !!(util.env(\"BLUEBIRD_DEBUG\") != 0 &&\n (true ||\n util.env(\"BLUEBIRD_DEBUG\") ||\n util.env(\"NODE_ENV\") === \"development\"));\n\nvar warnings = !!(util.env(\"BLUEBIRD_WARNINGS\") != 0 &&\n (debugging || util.env(\"BLUEBIRD_WARNINGS\")));\n\nvar longStackTraces = !!(util.env(\"BLUEBIRD_LONG_STACK_TRACES\") != 0 &&\n (debugging || util.env(\"BLUEBIRD_LONG_STACK_TRACES\")));\n\nvar wForgottenReturn = util.env(\"BLUEBIRD_W_FORGOTTEN_RETURN\") != 0 &&\n (warnings || !!util.env(\"BLUEBIRD_W_FORGOTTEN_RETURN\"));\n\nPromise.prototype.suppressUnhandledRejections = function() {\n var target = this._target();\n target._bitField = ((target._bitField & (~1048576)) |\n 524288);\n};\n\nPromise.prototype._ensurePossibleRejectionHandled = function () {\n if ((this._bitField & 524288) !== 0) return;\n this._setRejectionIsUnhandled();\n var self = this;\n setTimeout(function() {\n self._notifyUnhandledRejection();\n }, 1);\n};\n\nPromise.prototype._notifyUnhandledRejectionIsHandled = function () {\n fireRejectionEvent(\"rejectionHandled\",\n unhandledRejectionHandled, undefined, this);\n};\n\nPromise.prototype._setReturnedNonUndefined = function() {\n this._bitField = this._bitField | 268435456;\n};\n\nPromise.prototype._returnedNonUndefined = function() {\n return (this._bitField & 268435456) !== 0;\n};\n\nPromise.prototype._notifyUnhandledRejection = function () {\n if (this._isRejectionUnhandled()) {\n var reason = this._settledValue();\n this._setUnhandledRejectionIsNotified();\n fireRejectionEvent(\"unhandledRejection\",\n possiblyUnhandledRejection, reason, this);\n }\n};\n\nPromise.prototype._setUnhandledRejectionIsNotified = function () {\n this._bitField = this._bitField | 262144;\n};\n\nPromise.prototype._unsetUnhandledRejectionIsNotified = function () {\n this._bitField = this._bitField & (~262144);\n};\n\nPromise.prototype._isUnhandledRejectionNotified = function () {\n return (this._bitField & 262144) > 0;\n};\n\nPromise.prototype._setRejectionIsUnhandled = function () {\n this._bitField = this._bitField | 1048576;\n};\n\nPromise.prototype._unsetRejectionIsUnhandled = function () {\n this._bitField = this._bitField & (~1048576);\n if (this._isUnhandledRejectionNotified()) {\n this._unsetUnhandledRejectionIsNotified();\n this._notifyUnhandledRejectionIsHandled();\n }\n};\n\nPromise.prototype._isRejectionUnhandled = function () {\n return (this._bitField & 1048576) > 0;\n};\n\nPromise.prototype._warn = function(message, shouldUseOwnTrace, promise) {\n return warn(message, shouldUseOwnTrace, promise || this);\n};\n\nPromise.onPossiblyUnhandledRejection = function (fn) {\n var domain = getDomain();\n possiblyUnhandledRejection =\n typeof fn === \"function\" ? (domain === null ?\n fn : util.domainBind(domain, fn))\n : undefined;\n};\n\nPromise.onUnhandledRejectionHandled = function (fn) {\n var domain = getDomain();\n unhandledRejectionHandled =\n typeof fn === \"function\" ? (domain === null ?\n fn : util.domainBind(domain, fn))\n : undefined;\n};\n\nvar disableLongStackTraces = function() {};\nPromise.longStackTraces = function () {\n if (async.haveItemsQueued() && !config.longStackTraces) {\n throw new Error(\"cannot enable long stack traces after promises have been created\\u000a\\u000a See http://goo.gl/MqrFmX\\u000a\");\n }\n if (!config.longStackTraces && longStackTracesIsSupported()) {\n var Promise_captureStackTrace = Promise.prototype._captureStackTrace;\n var Promise_attachExtraTrace = Promise.prototype._attachExtraTrace;\n config.longStackTraces = true;\n disableLongStackTraces = function() {\n if (async.haveItemsQueued() && !config.longStackTraces) {\n throw new Error(\"cannot enable long stack traces after promises have been created\\u000a\\u000a See http://goo.gl/MqrFmX\\u000a\");\n }\n Promise.prototype._captureStackTrace = Promise_captureStackTrace;\n Promise.prototype._attachExtraTrace = Promise_attachExtraTrace;\n Context.deactivateLongStackTraces();\n async.enableTrampoline();\n config.longStackTraces = false;\n };\n Promise.prototype._captureStackTrace = longStackTracesCaptureStackTrace;\n Promise.prototype._attachExtraTrace = longStackTracesAttachExtraTrace;\n Context.activateLongStackTraces();\n async.disableTrampolineIfNecessary();\n }\n};\n\nPromise.hasLongStackTraces = function () {\n return config.longStackTraces && longStackTracesIsSupported();\n};\n\nvar fireDomEvent = (function() {\n try {\n if (typeof CustomEvent === \"function\") {\n var event = new CustomEvent(\"CustomEvent\");\n util.global.dispatchEvent(event);\n return function(name, event) {\n var domEvent = new CustomEvent(name.toLowerCase(), {\n detail: event,\n cancelable: true\n });\n return !util.global.dispatchEvent(domEvent);\n };\n } else if (typeof Event === \"function\") {\n var event = new Event(\"CustomEvent\");\n util.global.dispatchEvent(event);\n return function(name, event) {\n var domEvent = new Event(name.toLowerCase(), {\n cancelable: true\n });\n domEvent.detail = event;\n return !util.global.dispatchEvent(domEvent);\n };\n } else {\n var event = document.createEvent(\"CustomEvent\");\n event.initCustomEvent(\"testingtheevent\", false, true, {});\n util.global.dispatchEvent(event);\n return function(name, event) {\n var domEvent = document.createEvent(\"CustomEvent\");\n domEvent.initCustomEvent(name.toLowerCase(), false, true,\n event);\n return !util.global.dispatchEvent(domEvent);\n };\n }\n } catch (e) {}\n return function() {\n return false;\n };\n})();\n\nvar fireGlobalEvent = (function() {\n if (util.isNode) {\n return function() {\n return process.emit.apply(process, arguments);\n };\n } else {\n if (!util.global) {\n return function() {\n return false;\n };\n }\n return function(name) {\n var methodName = \"on\" + name.toLowerCase();\n var method = util.global[methodName];\n if (!method) return false;\n method.apply(util.global, [].slice.call(arguments, 1));\n return true;\n };\n }\n})();\n\nfunction generatePromiseLifecycleEventObject(name, promise) {\n return {promise: promise};\n}\n\nvar eventToObjectGenerator = {\n promiseCreated: generatePromiseLifecycleEventObject,\n promiseFulfilled: generatePromiseLifecycleEventObject,\n promiseRejected: generatePromiseLifecycleEventObject,\n promiseResolved: generatePromiseLifecycleEventObject,\n promiseCancelled: generatePromiseLifecycleEventObject,\n promiseChained: function(name, promise, child) {\n return {promise: promise, child: child};\n },\n warning: function(name, warning) {\n return {warning: warning};\n },\n unhandledRejection: function (name, reason, promise) {\n return {reason: reason, promise: promise};\n },\n rejectionHandled: generatePromiseLifecycleEventObject\n};\n\nvar activeFireEvent = function (name) {\n var globalEventFired = false;\n try {\n globalEventFired = fireGlobalEvent.apply(null, arguments);\n } catch (e) {\n async.throwLater(e);\n globalEventFired = true;\n }\n\n var domEventFired = false;\n try {\n domEventFired = fireDomEvent(name,\n eventToObjectGenerator[name].apply(null, arguments));\n } catch (e) {\n async.throwLater(e);\n domEventFired = true;\n }\n\n return domEventFired || globalEventFired;\n};\n\nPromise.config = function(opts) {\n opts = Object(opts);\n if (\"longStackTraces\" in opts) {\n if (opts.longStackTraces) {\n Promise.longStackTraces();\n } else if (!opts.longStackTraces && Promise.hasLongStackTraces()) {\n disableLongStackTraces();\n }\n }\n if (\"warnings\" in opts) {\n var warningsOption = opts.warnings;\n config.warnings = !!warningsOption;\n wForgottenReturn = config.warnings;\n\n if (util.isObject(warningsOption)) {\n if (\"wForgottenReturn\" in warningsOption) {\n wForgottenReturn = !!warningsOption.wForgottenReturn;\n }\n }\n }\n if (\"cancellation\" in opts && opts.cancellation && !config.cancellation) {\n if (async.haveItemsQueued()) {\n throw new Error(\n \"cannot enable cancellation after promises are in use\");\n }\n Promise.prototype._clearCancellationData =\n cancellationClearCancellationData;\n Promise.prototype._propagateFrom = cancellationPropagateFrom;\n Promise.prototype._onCancel = cancellationOnCancel;\n Promise.prototype._setOnCancel = cancellationSetOnCancel;\n Promise.prototype._attachCancellationCallback =\n cancellationAttachCancellationCallback;\n Promise.prototype._execute = cancellationExecute;\n propagateFromFunction = cancellationPropagateFrom;\n config.cancellation = true;\n }\n if (\"monitoring\" in opts) {\n if (opts.monitoring && !config.monitoring) {\n config.monitoring = true;\n Promise.prototype._fireEvent = activeFireEvent;\n } else if (!opts.monitoring && config.monitoring) {\n config.monitoring = false;\n Promise.prototype._fireEvent = defaultFireEvent;\n }\n }\n return Promise;\n};\n\nfunction defaultFireEvent() { return false; }\n\nPromise.prototype._fireEvent = defaultFireEvent;\nPromise.prototype._execute = function(executor, resolve, reject) {\n try {\n executor(resolve, reject);\n } catch (e) {\n return e;\n }\n};\nPromise.prototype._onCancel = function () {};\nPromise.prototype._setOnCancel = function (handler) { ; };\nPromise.prototype._attachCancellationCallback = function(onCancel) {\n ;\n};\nPromise.prototype._captureStackTrace = function () {};\nPromise.prototype._attachExtraTrace = function () {};\nPromise.prototype._clearCancellationData = function() {};\nPromise.prototype._propagateFrom = function (parent, flags) {\n ;\n ;\n};\n\nfunction cancellationExecute(executor, resolve, reject) {\n var promise = this;\n try {\n executor(resolve, reject, function(onCancel) {\n if (typeof onCancel !== \"function\") {\n throw new TypeError(\"onCancel must be a function, got: \" +\n util.toString(onCancel));\n }\n promise._attachCancellationCallback(onCancel);\n });\n } catch (e) {\n return e;\n }\n}\n\nfunction cancellationAttachCancellationCallback(onCancel) {\n if (!this._isCancellable()) return this;\n\n var previousOnCancel = this._onCancel();\n if (previousOnCancel !== undefined) {\n if (util.isArray(previousOnCancel)) {\n previousOnCancel.push(onCancel);\n } else {\n this._setOnCancel([previousOnCancel, onCancel]);\n }\n } else {\n this._setOnCancel(onCancel);\n }\n}\n\nfunction cancellationOnCancel() {\n return this._onCancelField;\n}\n\nfunction cancellationSetOnCancel(onCancel) {\n this._onCancelField = onCancel;\n}\n\nfunction cancellationClearCancellationData() {\n this._cancellationParent = undefined;\n this._onCancelField = undefined;\n}\n\nfunction cancellationPropagateFrom(parent, flags) {\n if ((flags & 1) !== 0) {\n this._cancellationParent = parent;\n var branchesRemainingToCancel = parent._branchesRemainingToCancel;\n if (branchesRemainingToCancel === undefined) {\n branchesRemainingToCancel = 0;\n }\n parent._branchesRemainingToCancel = branchesRemainingToCancel + 1;\n }\n if ((flags & 2) !== 0 && parent._isBound()) {\n this._setBoundTo(parent._boundTo);\n }\n}\n\nfunction bindingPropagateFrom(parent, flags) {\n if ((flags & 2) !== 0 && parent._isBound()) {\n this._setBoundTo(parent._boundTo);\n }\n}\nvar propagateFromFunction = bindingPropagateFrom;\n\nfunction boundValueFunction() {\n var ret = this._boundTo;\n if (ret !== undefined) {\n if (ret instanceof Promise) {\n if (ret.isFulfilled()) {\n return ret.value();\n } else {\n return undefined;\n }\n }\n }\n return ret;\n}\n\nfunction longStackTracesCaptureStackTrace() {\n this._trace = new CapturedTrace(this._peekContext());\n}\n\nfunction longStackTracesAttachExtraTrace(error, ignoreSelf) {\n if (canAttachTrace(error)) {\n var trace = this._trace;\n if (trace !== undefined) {\n if (ignoreSelf) trace = trace._parent;\n }\n if (trace !== undefined) {\n trace.attachExtraTrace(error);\n } else if (!error.__stackCleaned__) {\n var parsed = parseStackAndMessage(error);\n util.notEnumerableProp(error, \"stack\",\n parsed.message + \"\\n\" + parsed.stack.join(\"\\n\"));\n util.notEnumerableProp(error, \"__stackCleaned__\", true);\n }\n }\n}\n\nfunction checkForgottenReturns(returnValue, promiseCreated, name, promise,\n parent) {\n if (returnValue === undefined && promiseCreated !== null &&\n wForgottenReturn) {\n if (parent !== undefined && parent._returnedNonUndefined()) return;\n if ((promise._bitField & 65535) === 0) return;\n\n if (name) name = name + \" \";\n var handlerLine = \"\";\n var creatorLine = \"\";\n if (promiseCreated._trace) {\n var traceLines = promiseCreated._trace.stack.split(\"\\n\");\n var stack = cleanStack(traceLines);\n for (var i = stack.length - 1; i >= 0; --i) {\n var line = stack[i];\n if (!nodeFramePattern.test(line)) {\n var lineMatches = line.match(parseLinePattern);\n if (lineMatches) {\n handlerLine = \"at \" + lineMatches[1] +\n \":\" + lineMatches[2] + \":\" + lineMatches[3] + \" \";\n }\n break;\n }\n }\n\n if (stack.length > 0) {\n var firstUserLine = stack[0];\n for (var i = 0; i < traceLines.length; ++i) {\n\n if (traceLines[i] === firstUserLine) {\n if (i > 0) {\n creatorLine = \"\\n\" + traceLines[i - 1];\n }\n break;\n }\n }\n\n }\n }\n var msg = \"a promise was created in a \" + name +\n \"handler \" + handlerLine + \"but was not returned from it, \" +\n \"see http://goo.gl/rRqMUw\" +\n creatorLine;\n promise._warn(msg, true, promiseCreated);\n }\n}\n\nfunction deprecated(name, replacement) {\n var message = name +\n \" is deprecated and will be removed in a future version.\";\n if (replacement) message += \" Use \" + replacement + \" instead.\";\n return warn(message);\n}\n\nfunction warn(message, shouldUseOwnTrace, promise) {\n if (!config.warnings) return;\n var warning = new Warning(message);\n var ctx;\n if (shouldUseOwnTrace) {\n promise._attachExtraTrace(warning);\n } else if (config.longStackTraces && (ctx = Promise._peekContext())) {\n ctx.attachExtraTrace(warning);\n } else {\n var parsed = parseStackAndMessage(warning);\n warning.stack = parsed.message + \"\\n\" + parsed.stack.join(\"\\n\");\n }\n\n if (!activeFireEvent(\"warning\", warning)) {\n formatAndLogError(warning, \"\", true);\n }\n}\n\nfunction reconstructStack(message, stacks) {\n for (var i = 0; i < stacks.length - 1; ++i) {\n stacks[i].push(\"From previous event:\");\n stacks[i] = stacks[i].join(\"\\n\");\n }\n if (i < stacks.length) {\n stacks[i] = stacks[i].join(\"\\n\");\n }\n return message + \"\\n\" + stacks.join(\"\\n\");\n}\n\nfunction removeDuplicateOrEmptyJumps(stacks) {\n for (var i = 0; i < stacks.length; ++i) {\n if (stacks[i].length === 0 ||\n ((i + 1 < stacks.length) && stacks[i][0] === stacks[i+1][0])) {\n stacks.splice(i, 1);\n i--;\n }\n }\n}\n\nfunction removeCommonRoots(stacks) {\n var current = stacks[0];\n for (var i = 1; i < stacks.length; ++i) {\n var prev = stacks[i];\n var currentLastIndex = current.length - 1;\n var currentLastLine = current[currentLastIndex];\n var commonRootMeetPoint = -1;\n\n for (var j = prev.length - 1; j >= 0; --j) {\n if (prev[j] === currentLastLine) {\n commonRootMeetPoint = j;\n break;\n }\n }\n\n for (var j = commonRootMeetPoint; j >= 0; --j) {\n var line = prev[j];\n if (current[currentLastIndex] === line) {\n current.pop();\n currentLastIndex--;\n } else {\n break;\n }\n }\n current = prev;\n }\n}\n\nfunction cleanStack(stack) {\n var ret = [];\n for (var i = 0; i < stack.length; ++i) {\n var line = stack[i];\n var isTraceLine = \" (No stack trace)\" === line ||\n stackFramePattern.test(line);\n var isInternalFrame = isTraceLine && shouldIgnore(line);\n if (isTraceLine && !isInternalFrame) {\n if (indentStackFrames && line.charAt(0) !== \" \") {\n line = \" \" + line;\n }\n ret.push(line);\n }\n }\n return ret;\n}\n\nfunction stackFramesAsArray(error) {\n var stack = error.stack.replace(/\\s+$/g, \"\").split(\"\\n\");\n for (var i = 0; i < stack.length; ++i) {\n var line = stack[i];\n if (\" (No stack trace)\" === line || stackFramePattern.test(line)) {\n break;\n }\n }\n if (i > 0 && error.name != \"SyntaxError\") {\n stack = stack.slice(i);\n }\n return stack;\n}\n\nfunction parseStackAndMessage(error) {\n var stack = error.stack;\n var message = error.toString();\n stack = typeof stack === \"string\" && stack.length > 0\n ? stackFramesAsArray(error) : [\" (No stack trace)\"];\n return {\n message: message,\n stack: error.name == \"SyntaxError\" ? stack : cleanStack(stack)\n };\n}\n\nfunction formatAndLogError(error, title, isSoft) {\n if (typeof console !== \"undefined\") {\n var message;\n if (util.isObject(error)) {\n var stack = error.stack;\n message = title + formatStack(stack, error);\n } else {\n message = title + String(error);\n }\n if (typeof printWarning === \"function\") {\n printWarning(message, isSoft);\n } else if (typeof console.log === \"function\" ||\n typeof console.log === \"object\") {\n console.log(message);\n }\n }\n}\n\nfunction fireRejectionEvent(name, localHandler, reason, promise) {\n var localEventFired = false;\n try {\n if (typeof localHandler === \"function\") {\n localEventFired = true;\n if (name === \"rejectionHandled\") {\n localHandler(promise);\n } else {\n localHandler(reason, promise);\n }\n }\n } catch (e) {\n async.throwLater(e);\n }\n\n if (name === \"unhandledRejection\") {\n if (!activeFireEvent(name, reason, promise) && !localEventFired) {\n formatAndLogError(reason, \"Unhandled rejection \");\n }\n } else {\n activeFireEvent(name, promise);\n }\n}\n\nfunction formatNonError(obj) {\n var str;\n if (typeof obj === \"function\") {\n str = \"[function \" +\n (obj.name || \"anonymous\") +\n \"]\";\n } else {\n str = obj && typeof obj.toString === \"function\"\n ? obj.toString() : util.toString(obj);\n var ruselessToString = /\\[object [a-zA-Z0-9$_]+\\]/;\n if (ruselessToString.test(str)) {\n try {\n var newStr = JSON.stringify(obj);\n str = newStr;\n }\n catch(e) {\n\n }\n }\n if (str.length === 0) {\n str = \"(empty array)\";\n }\n }\n return (\"(<\" + snip(str) + \">, no stack trace)\");\n}\n\nfunction snip(str) {\n var maxChars = 41;\n if (str.length < maxChars) {\n return str;\n }\n return str.substr(0, maxChars - 3) + \"...\";\n}\n\nfunction longStackTracesIsSupported() {\n return typeof captureStackTrace === \"function\";\n}\n\nvar shouldIgnore = function() { return false; };\nvar parseLineInfoRegex = /[\\/<\\(]([^:\\/]+):(\\d+):(?:\\d+)\\)?\\s*$/;\nfunction parseLineInfo(line) {\n var matches = line.match(parseLineInfoRegex);\n if (matches) {\n return {\n fileName: matches[1],\n line: parseInt(matches[2], 10)\n };\n }\n}\n\nfunction setBounds(firstLineError, lastLineError) {\n if (!longStackTracesIsSupported()) return;\n var firstStackLines = firstLineError.stack.split(\"\\n\");\n var lastStackLines = lastLineError.stack.split(\"\\n\");\n var firstIndex = -1;\n var lastIndex = -1;\n var firstFileName;\n var lastFileName;\n for (var i = 0; i < firstStackLines.length; ++i) {\n var result = parseLineInfo(firstStackLines[i]);\n if (result) {\n firstFileName = result.fileName;\n firstIndex = result.line;\n break;\n }\n }\n for (var i = 0; i < lastStackLines.length; ++i) {\n var result = parseLineInfo(lastStackLines[i]);\n if (result) {\n lastFileName = result.fileName;\n lastIndex = result.line;\n break;\n }\n }\n if (firstIndex < 0 || lastIndex < 0 || !firstFileName || !lastFileName ||\n firstFileName !== lastFileName || firstIndex >= lastIndex) {\n return;\n }\n\n shouldIgnore = function(line) {\n if (bluebirdFramePattern.test(line)) return true;\n var info = parseLineInfo(line);\n if (info) {\n if (info.fileName === firstFileName &&\n (firstIndex <= info.line && info.line <= lastIndex)) {\n return true;\n }\n }\n return false;\n };\n}\n\nfunction CapturedTrace(parent) {\n this._parent = parent;\n this._promisesCreated = 0;\n var length = this._length = 1 + (parent === undefined ? 0 : parent._length);\n captureStackTrace(this, CapturedTrace);\n if (length > 32) this.uncycle();\n}\nutil.inherits(CapturedTrace, Error);\nContext.CapturedTrace = CapturedTrace;\n\nCapturedTrace.prototype.uncycle = function() {\n var length = this._length;\n if (length < 2) return;\n var nodes = [];\n var stackToIndex = {};\n\n for (var i = 0, node = this; node !== undefined; ++i) {\n nodes.push(node);\n node = node._parent;\n }\n length = this._length = i;\n for (var i = length - 1; i >= 0; --i) {\n var stack = nodes[i].stack;\n if (stackToIndex[stack] === undefined) {\n stackToIndex[stack] = i;\n }\n }\n for (var i = 0; i < length; ++i) {\n var currentStack = nodes[i].stack;\n var index = stackToIndex[currentStack];\n if (index !== undefined && index !== i) {\n if (index > 0) {\n nodes[index - 1]._parent = undefined;\n nodes[index - 1]._length = 1;\n }\n nodes[i]._parent = undefined;\n nodes[i]._length = 1;\n var cycleEdgeNode = i > 0 ? nodes[i - 1] : this;\n\n if (index < length - 1) {\n cycleEdgeNode._parent = nodes[index + 1];\n cycleEdgeNode._parent.uncycle();\n cycleEdgeNode._length =\n cycleEdgeNode._parent._length + 1;\n } else {\n cycleEdgeNode._parent = undefined;\n cycleEdgeNode._length = 1;\n }\n var currentChildLength = cycleEdgeNode._length + 1;\n for (var j = i - 2; j >= 0; --j) {\n nodes[j]._length = currentChildLength;\n currentChildLength++;\n }\n return;\n }\n }\n};\n\nCapturedTrace.prototype.attachExtraTrace = function(error) {\n if (error.__stackCleaned__) return;\n this.uncycle();\n var parsed = parseStackAndMessage(error);\n var message = parsed.message;\n var stacks = [parsed.stack];\n\n var trace = this;\n while (trace !== undefined) {\n stacks.push(cleanStack(trace.stack.split(\"\\n\")));\n trace = trace._parent;\n }\n removeCommonRoots(stacks);\n removeDuplicateOrEmptyJumps(stacks);\n util.notEnumerableProp(error, \"stack\", reconstructStack(message, stacks));\n util.notEnumerableProp(error, \"__stackCleaned__\", true);\n};\n\nvar captureStackTrace = (function stackDetection() {\n var v8stackFramePattern = /^\\s*at\\s*/;\n var v8stackFormatter = function(stack, error) {\n if (typeof stack === \"string\") return stack;\n\n if (error.name !== undefined &&\n error.message !== undefined) {\n return error.toString();\n }\n return formatNonError(error);\n };\n\n if (typeof Error.stackTraceLimit === \"number\" &&\n typeof Error.captureStackTrace === \"function\") {\n Error.stackTraceLimit += 6;\n stackFramePattern = v8stackFramePattern;\n formatStack = v8stackFormatter;\n var captureStackTrace = Error.captureStackTrace;\n\n shouldIgnore = function(line) {\n return bluebirdFramePattern.test(line);\n };\n return function(receiver, ignoreUntil) {\n Error.stackTraceLimit += 6;\n captureStackTrace(receiver, ignoreUntil);\n Error.stackTraceLimit -= 6;\n };\n }\n var err = new Error();\n\n if (typeof err.stack === \"string\" &&\n err.stack.split(\"\\n\")[0].indexOf(\"stackDetection@\") >= 0) {\n stackFramePattern = /@/;\n formatStack = v8stackFormatter;\n indentStackFrames = true;\n return function captureStackTrace(o) {\n o.stack = new Error().stack;\n };\n }\n\n var hasStackAfterThrow;\n try { throw new Error(); }\n catch(e) {\n hasStackAfterThrow = (\"stack\" in e);\n }\n if (!(\"stack\" in err) && hasStackAfterThrow &&\n typeof Error.stackTraceLimit === \"number\") {\n stackFramePattern = v8stackFramePattern;\n formatStack = v8stackFormatter;\n return function captureStackTrace(o) {\n Error.stackTraceLimit += 6;\n try { throw new Error(); }\n catch(e) { o.stack = e.stack; }\n Error.stackTraceLimit -= 6;\n };\n }\n\n formatStack = function(stack, error) {\n if (typeof stack === \"string\") return stack;\n\n if ((typeof error === \"object\" ||\n typeof error === \"function\") &&\n error.name !== undefined &&\n error.message !== undefined) {\n return error.toString();\n }\n return formatNonError(error);\n };\n\n return null;\n\n})([]);\n\nif (typeof console !== \"undefined\" && typeof console.warn !== \"undefined\") {\n printWarning = function (message) {\n console.warn(message);\n };\n if (util.isNode && process.stderr.isTTY) {\n printWarning = function(message, isSoft) {\n var color = isSoft ? \"\\u001b[33m\" : \"\\u001b[31m\";\n console.warn(color + message + \"\\u001b[0m\\n\");\n };\n } else if (!util.isNode && typeof (new Error().stack) === \"string\") {\n printWarning = function(message, isSoft) {\n console.warn(\"%c\" + message,\n isSoft ? \"color: darkorange\" : \"color: red\");\n };\n }\n}\n\nvar config = {\n warnings: warnings,\n longStackTraces: false,\n cancellation: false,\n monitoring: false\n};\n\nif (longStackTraces) Promise.longStackTraces();\n\nreturn {\n longStackTraces: function() {\n return config.longStackTraces;\n },\n warnings: function() {\n return config.warnings;\n },\n cancellation: function() {\n return config.cancellation;\n },\n monitoring: function() {\n return config.monitoring;\n },\n propagateFromFunction: function() {\n return propagateFromFunction;\n },\n boundValueFunction: function() {\n return boundValueFunction;\n },\n checkForgottenReturns: checkForgottenReturns,\n setBounds: setBounds,\n warn: warn,\n deprecated: deprecated,\n CapturedTrace: CapturedTrace,\n fireDomEvent: fireDomEvent,\n fireGlobalEvent: fireGlobalEvent\n};\n};\n\n},{\"./errors\":12,\"./util\":36}],10:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function(Promise) {\nfunction returner() {\n return this.value;\n}\nfunction thrower() {\n throw this.reason;\n}\n\nPromise.prototype[\"return\"] =\nPromise.prototype.thenReturn = function (value) {\n if (value instanceof Promise) value.suppressUnhandledRejections();\n return this._then(\n returner, undefined, undefined, {value: value}, undefined);\n};\n\nPromise.prototype[\"throw\"] =\nPromise.prototype.thenThrow = function (reason) {\n return this._then(\n thrower, undefined, undefined, {reason: reason}, undefined);\n};\n\nPromise.prototype.catchThrow = function (reason) {\n if (arguments.length <= 1) {\n return this._then(\n undefined, thrower, undefined, {reason: reason}, undefined);\n } else {\n var _reason = arguments[1];\n var handler = function() {throw _reason;};\n return this.caught(reason, handler);\n }\n};\n\nPromise.prototype.catchReturn = function (value) {\n if (arguments.length <= 1) {\n if (value instanceof Promise) value.suppressUnhandledRejections();\n return this._then(\n undefined, returner, undefined, {value: value}, undefined);\n } else {\n var _value = arguments[1];\n if (_value instanceof Promise) _value.suppressUnhandledRejections();\n var handler = function() {return _value;};\n return this.caught(value, handler);\n }\n};\n};\n\n},{}],11:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function(Promise, INTERNAL) {\nvar PromiseReduce = Promise.reduce;\nvar PromiseAll = Promise.all;\n\nfunction promiseAllThis() {\n return PromiseAll(this);\n}\n\nfunction PromiseMapSeries(promises, fn) {\n return PromiseReduce(promises, fn, INTERNAL, INTERNAL);\n}\n\nPromise.prototype.each = function (fn) {\n return PromiseReduce(this, fn, INTERNAL, 0)\n ._then(promiseAllThis, undefined, undefined, this, undefined);\n};\n\nPromise.prototype.mapSeries = function (fn) {\n return PromiseReduce(this, fn, INTERNAL, INTERNAL);\n};\n\nPromise.each = function (promises, fn) {\n return PromiseReduce(promises, fn, INTERNAL, 0)\n ._then(promiseAllThis, undefined, undefined, promises, undefined);\n};\n\nPromise.mapSeries = PromiseMapSeries;\n};\n\n\n},{}],12:[function(_dereq_,module,exports){\n\"use strict\";\nvar es5 = _dereq_(\"./es5\");\nvar Objectfreeze = es5.freeze;\nvar util = _dereq_(\"./util\");\nvar inherits = util.inherits;\nvar notEnumerableProp = util.notEnumerableProp;\n\nfunction subError(nameProperty, defaultMessage) {\n function SubError(message) {\n if (!(this instanceof SubError)) return new SubError(message);\n notEnumerableProp(this, \"message\",\n typeof message === \"string\" ? message : defaultMessage);\n notEnumerableProp(this, \"name\", nameProperty);\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, this.constructor);\n } else {\n Error.call(this);\n }\n }\n inherits(SubError, Error);\n return SubError;\n}\n\nvar _TypeError, _RangeError;\nvar Warning = subError(\"Warning\", \"warning\");\nvar CancellationError = subError(\"CancellationError\", \"cancellation error\");\nvar TimeoutError = subError(\"TimeoutError\", \"timeout error\");\nvar AggregateError = subError(\"AggregateError\", \"aggregate error\");\ntry {\n _TypeError = TypeError;\n _RangeError = RangeError;\n} catch(e) {\n _TypeError = subError(\"TypeError\", \"type error\");\n _RangeError = subError(\"RangeError\", \"range error\");\n}\n\nvar methods = (\"join pop push shift unshift slice filter forEach some \" +\n \"every map indexOf lastIndexOf reduce reduceRight sort reverse\").split(\" \");\n\nfor (var i = 0; i < methods.length; ++i) {\n if (typeof Array.prototype[methods[i]] === \"function\") {\n AggregateError.prototype[methods[i]] = Array.prototype[methods[i]];\n }\n}\n\nes5.defineProperty(AggregateError.prototype, \"length\", {\n value: 0,\n configurable: false,\n writable: true,\n enumerable: true\n});\nAggregateError.prototype[\"isOperational\"] = true;\nvar level = 0;\nAggregateError.prototype.toString = function() {\n var indent = Array(level * 4 + 1).join(\" \");\n var ret = \"\\n\" + indent + \"AggregateError of:\" + \"\\n\";\n level++;\n indent = Array(level * 4 + 1).join(\" \");\n for (var i = 0; i < this.length; ++i) {\n var str = this[i] === this ? \"[Circular AggregateError]\" : this[i] + \"\";\n var lines = str.split(\"\\n\");\n for (var j = 0; j < lines.length; ++j) {\n lines[j] = indent + lines[j];\n }\n str = lines.join(\"\\n\");\n ret += str + \"\\n\";\n }\n level--;\n return ret;\n};\n\nfunction OperationalError(message) {\n if (!(this instanceof OperationalError))\n return new OperationalError(message);\n notEnumerableProp(this, \"name\", \"OperationalError\");\n notEnumerableProp(this, \"message\", message);\n this.cause = message;\n this[\"isOperational\"] = true;\n\n if (message instanceof Error) {\n notEnumerableProp(this, \"message\", message.message);\n notEnumerableProp(this, \"stack\", message.stack);\n } else if (Error.captureStackTrace) {\n Error.captureStackTrace(this, this.constructor);\n }\n\n}\ninherits(OperationalError, Error);\n\nvar errorTypes = Error[\"__BluebirdErrorTypes__\"];\nif (!errorTypes) {\n errorTypes = Objectfreeze({\n CancellationError: CancellationError,\n TimeoutError: TimeoutError,\n OperationalError: OperationalError,\n RejectionError: OperationalError,\n AggregateError: AggregateError\n });\n es5.defineProperty(Error, \"__BluebirdErrorTypes__\", {\n value: errorTypes,\n writable: false,\n enumerable: false,\n configurable: false\n });\n}\n\nmodule.exports = {\n Error: Error,\n TypeError: _TypeError,\n RangeError: _RangeError,\n CancellationError: errorTypes.CancellationError,\n OperationalError: errorTypes.OperationalError,\n TimeoutError: errorTypes.TimeoutError,\n AggregateError: errorTypes.AggregateError,\n Warning: Warning\n};\n\n},{\"./es5\":13,\"./util\":36}],13:[function(_dereq_,module,exports){\nvar isES5 = (function(){\n \"use strict\";\n return this === undefined;\n})();\n\nif (isES5) {\n module.exports = {\n freeze: Object.freeze,\n defineProperty: Object.defineProperty,\n getDescriptor: Object.getOwnPropertyDescriptor,\n keys: Object.keys,\n names: Object.getOwnPropertyNames,\n getPrototypeOf: Object.getPrototypeOf,\n isArray: Array.isArray,\n isES5: isES5,\n propertyIsWritable: function(obj, prop) {\n var descriptor = Object.getOwnPropertyDescriptor(obj, prop);\n return !!(!descriptor || descriptor.writable || descriptor.set);\n }\n };\n} else {\n var has = {}.hasOwnProperty;\n var str = {}.toString;\n var proto = {}.constructor.prototype;\n\n var ObjectKeys = function (o) {\n var ret = [];\n for (var key in o) {\n if (has.call(o, key)) {\n ret.push(key);\n }\n }\n return ret;\n };\n\n var ObjectGetDescriptor = function(o, key) {\n return {value: o[key]};\n };\n\n var ObjectDefineProperty = function (o, key, desc) {\n o[key] = desc.value;\n return o;\n };\n\n var ObjectFreeze = function (obj) {\n return obj;\n };\n\n var ObjectGetPrototypeOf = function (obj) {\n try {\n return Object(obj).constructor.prototype;\n }\n catch (e) {\n return proto;\n }\n };\n\n var ArrayIsArray = function (obj) {\n try {\n return str.call(obj) === \"[object Array]\";\n }\n catch(e) {\n return false;\n }\n };\n\n module.exports = {\n isArray: ArrayIsArray,\n keys: ObjectKeys,\n names: ObjectKeys,\n defineProperty: ObjectDefineProperty,\n getDescriptor: ObjectGetDescriptor,\n freeze: ObjectFreeze,\n getPrototypeOf: ObjectGetPrototypeOf,\n isES5: isES5,\n propertyIsWritable: function() {\n return true;\n }\n };\n}\n\n},{}],14:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function(Promise, INTERNAL) {\nvar PromiseMap = Promise.map;\n\nPromise.prototype.filter = function (fn, options) {\n return PromiseMap(this, fn, options, INTERNAL);\n};\n\nPromise.filter = function (promises, fn, options) {\n return PromiseMap(promises, fn, options, INTERNAL);\n};\n};\n\n},{}],15:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function(Promise, tryConvertToPromise, NEXT_FILTER) {\nvar util = _dereq_(\"./util\");\nvar CancellationError = Promise.CancellationError;\nvar errorObj = util.errorObj;\nvar catchFilter = _dereq_(\"./catch_filter\")(NEXT_FILTER);\n\nfunction PassThroughHandlerContext(promise, type, handler) {\n this.promise = promise;\n this.type = type;\n this.handler = handler;\n this.called = false;\n this.cancelPromise = null;\n}\n\nPassThroughHandlerContext.prototype.isFinallyHandler = function() {\n return this.type === 0;\n};\n\nfunction FinallyHandlerCancelReaction(finallyHandler) {\n this.finallyHandler = finallyHandler;\n}\n\nFinallyHandlerCancelReaction.prototype._resultCancelled = function() {\n checkCancel(this.finallyHandler);\n};\n\nfunction checkCancel(ctx, reason) {\n if (ctx.cancelPromise != null) {\n if (arguments.length > 1) {\n ctx.cancelPromise._reject(reason);\n } else {\n ctx.cancelPromise._cancel();\n }\n ctx.cancelPromise = null;\n return true;\n }\n return false;\n}\n\nfunction succeed() {\n return finallyHandler.call(this, this.promise._target()._settledValue());\n}\nfunction fail(reason) {\n if (checkCancel(this, reason)) return;\n errorObj.e = reason;\n return errorObj;\n}\nfunction finallyHandler(reasonOrValue) {\n var promise = this.promise;\n var handler = this.handler;\n\n if (!this.called) {\n this.called = true;\n var ret = this.isFinallyHandler()\n ? handler.call(promise._boundValue())\n : handler.call(promise._boundValue(), reasonOrValue);\n if (ret === NEXT_FILTER) {\n return ret;\n } else if (ret !== undefined) {\n promise._setReturnedNonUndefined();\n var maybePromise = tryConvertToPromise(ret, promise);\n if (maybePromise instanceof Promise) {\n if (this.cancelPromise != null) {\n if (maybePromise._isCancelled()) {\n var reason =\n new CancellationError(\"late cancellation observer\");\n promise._attachExtraTrace(reason);\n errorObj.e = reason;\n return errorObj;\n } else if (maybePromise.isPending()) {\n maybePromise._attachCancellationCallback(\n new FinallyHandlerCancelReaction(this));\n }\n }\n return maybePromise._then(\n succeed, fail, undefined, this, undefined);\n }\n }\n }\n\n if (promise.isRejected()) {\n checkCancel(this);\n errorObj.e = reasonOrValue;\n return errorObj;\n } else {\n checkCancel(this);\n return reasonOrValue;\n }\n}\n\nPromise.prototype._passThrough = function(handler, type, success, fail) {\n if (typeof handler !== \"function\") return this.then();\n return this._then(success,\n fail,\n undefined,\n new PassThroughHandlerContext(this, type, handler),\n undefined);\n};\n\nPromise.prototype.lastly =\nPromise.prototype[\"finally\"] = function (handler) {\n return this._passThrough(handler,\n 0,\n finallyHandler,\n finallyHandler);\n};\n\n\nPromise.prototype.tap = function (handler) {\n return this._passThrough(handler, 1, finallyHandler);\n};\n\nPromise.prototype.tapCatch = function (handlerOrPredicate) {\n var len = arguments.length;\n if(len === 1) {\n return this._passThrough(handlerOrPredicate,\n 1,\n undefined,\n finallyHandler);\n } else {\n var catchInstances = new Array(len - 1),\n j = 0, i;\n for (i = 0; i < len - 1; ++i) {\n var item = arguments[i];\n if (util.isObject(item)) {\n catchInstances[j++] = item;\n } else {\n return Promise.reject(new TypeError(\n \"tapCatch statement predicate: \"\n + \"expecting an object but got \" + util.classString(item)\n ));\n }\n }\n catchInstances.length = j;\n var handler = arguments[i];\n return this._passThrough(catchFilter(catchInstances, handler, this),\n 1,\n undefined,\n finallyHandler);\n }\n\n};\n\nreturn PassThroughHandlerContext;\n};\n\n},{\"./catch_filter\":7,\"./util\":36}],16:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function(Promise,\n apiRejection,\n INTERNAL,\n tryConvertToPromise,\n Proxyable,\n debug) {\nvar errors = _dereq_(\"./errors\");\nvar TypeError = errors.TypeError;\nvar util = _dereq_(\"./util\");\nvar errorObj = util.errorObj;\nvar tryCatch = util.tryCatch;\nvar yieldHandlers = [];\n\nfunction promiseFromYieldHandler(value, yieldHandlers, traceParent) {\n for (var i = 0; i < yieldHandlers.length; ++i) {\n traceParent._pushContext();\n var result = tryCatch(yieldHandlers[i])(value);\n traceParent._popContext();\n if (result === errorObj) {\n traceParent._pushContext();\n var ret = Promise.reject(errorObj.e);\n traceParent._popContext();\n return ret;\n }\n var maybePromise = tryConvertToPromise(result, traceParent);\n if (maybePromise instanceof Promise) return maybePromise;\n }\n return null;\n}\n\nfunction PromiseSpawn(generatorFunction, receiver, yieldHandler, stack) {\n if (debug.cancellation()) {\n var internal = new Promise(INTERNAL);\n var _finallyPromise = this._finallyPromise = new Promise(INTERNAL);\n this._promise = internal.lastly(function() {\n return _finallyPromise;\n });\n internal._captureStackTrace();\n internal._setOnCancel(this);\n } else {\n var promise = this._promise = new Promise(INTERNAL);\n promise._captureStackTrace();\n }\n this._stack = stack;\n this._generatorFunction = generatorFunction;\n this._receiver = receiver;\n this._generator = undefined;\n this._yieldHandlers = typeof yieldHandler === \"function\"\n ? [yieldHandler].concat(yieldHandlers)\n : yieldHandlers;\n this._yieldedPromise = null;\n this._cancellationPhase = false;\n}\nutil.inherits(PromiseSpawn, Proxyable);\n\nPromiseSpawn.prototype._isResolved = function() {\n return this._promise === null;\n};\n\nPromiseSpawn.prototype._cleanup = function() {\n this._promise = this._generator = null;\n if (debug.cancellation() && this._finallyPromise !== null) {\n this._finallyPromise._fulfill();\n this._finallyPromise = null;\n }\n};\n\nPromiseSpawn.prototype._promiseCancelled = function() {\n if (this._isResolved()) return;\n var implementsReturn = typeof this._generator[\"return\"] !== \"undefined\";\n\n var result;\n if (!implementsReturn) {\n var reason = new Promise.CancellationError(\n \"generator .return() sentinel\");\n Promise.coroutine.returnSentinel = reason;\n this._promise._attachExtraTrace(reason);\n this._promise._pushContext();\n result = tryCatch(this._generator[\"throw\"]).call(this._generator,\n reason);\n this._promise._popContext();\n } else {\n this._promise._pushContext();\n result = tryCatch(this._generator[\"return\"]).call(this._generator,\n undefined);\n this._promise._popContext();\n }\n this._cancellationPhase = true;\n this._yieldedPromise = null;\n this._continue(result);\n};\n\nPromiseSpawn.prototype._promiseFulfilled = function(value) {\n this._yieldedPromise = null;\n this._promise._pushContext();\n var result = tryCatch(this._generator.next).call(this._generator, value);\n this._promise._popContext();\n this._continue(result);\n};\n\nPromiseSpawn.prototype._promiseRejected = function(reason) {\n this._yieldedPromise = null;\n this._promise._attachExtraTrace(reason);\n this._promise._pushContext();\n var result = tryCatch(this._generator[\"throw\"])\n .call(this._generator, reason);\n this._promise._popContext();\n this._continue(result);\n};\n\nPromiseSpawn.prototype._resultCancelled = function() {\n if (this._yieldedPromise instanceof Promise) {\n var promise = this._yieldedPromise;\n this._yieldedPromise = null;\n promise.cancel();\n }\n};\n\nPromiseSpawn.prototype.promise = function () {\n return this._promise;\n};\n\nPromiseSpawn.prototype._run = function () {\n this._generator = this._generatorFunction.call(this._receiver);\n this._receiver =\n this._generatorFunction = undefined;\n this._promiseFulfilled(undefined);\n};\n\nPromiseSpawn.prototype._continue = function (result) {\n var promise = this._promise;\n if (result === errorObj) {\n this._cleanup();\n if (this._cancellationPhase) {\n return promise.cancel();\n } else {\n return promise._rejectCallback(result.e, false);\n }\n }\n\n var value = result.value;\n if (result.done === true) {\n this._cleanup();\n if (this._cancellationPhase) {\n return promise.cancel();\n } else {\n return promise._resolveCallback(value);\n }\n } else {\n var maybePromise = tryConvertToPromise(value, this._promise);\n if (!(maybePromise instanceof Promise)) {\n maybePromise =\n promiseFromYieldHandler(maybePromise,\n this._yieldHandlers,\n this._promise);\n if (maybePromise === null) {\n this._promiseRejected(\n new TypeError(\n \"A value %s was yielded that could not be treated as a promise\\u000a\\u000a See http://goo.gl/MqrFmX\\u000a\\u000a\".replace(\"%s\", String(value)) +\n \"From coroutine:\\u000a\" +\n this._stack.split(\"\\n\").slice(1, -7).join(\"\\n\")\n )\n );\n return;\n }\n }\n maybePromise = maybePromise._target();\n var bitField = maybePromise._bitField;\n ;\n if (((bitField & 50397184) === 0)) {\n this._yieldedPromise = maybePromise;\n maybePromise._proxy(this, null);\n } else if (((bitField & 33554432) !== 0)) {\n Promise._async.invoke(\n this._promiseFulfilled, this, maybePromise._value()\n );\n } else if (((bitField & 16777216) !== 0)) {\n Promise._async.invoke(\n this._promiseRejected, this, maybePromise._reason()\n );\n } else {\n this._promiseCancelled();\n }\n }\n};\n\nPromise.coroutine = function (generatorFunction, options) {\n if (typeof generatorFunction !== \"function\") {\n throw new TypeError(\"generatorFunction must be a function\\u000a\\u000a See http://goo.gl/MqrFmX\\u000a\");\n }\n var yieldHandler = Object(options).yieldHandler;\n var PromiseSpawn$ = PromiseSpawn;\n var stack = new Error().stack;\n return function () {\n var generator = generatorFunction.apply(this, arguments);\n var spawn = new PromiseSpawn$(undefined, undefined, yieldHandler,\n stack);\n var ret = spawn.promise();\n spawn._generator = generator;\n spawn._promiseFulfilled(undefined);\n return ret;\n };\n};\n\nPromise.coroutine.addYieldHandler = function(fn) {\n if (typeof fn !== \"function\") {\n throw new TypeError(\"expecting a function but got \" + util.classString(fn));\n }\n yieldHandlers.push(fn);\n};\n\nPromise.spawn = function (generatorFunction) {\n debug.deprecated(\"Promise.spawn()\", \"Promise.coroutine()\");\n if (typeof generatorFunction !== \"function\") {\n return apiRejection(\"generatorFunction must be a function\\u000a\\u000a See http://goo.gl/MqrFmX\\u000a\");\n }\n var spawn = new PromiseSpawn(generatorFunction, this);\n var ret = spawn.promise();\n spawn._run(Promise.spawn);\n return ret;\n};\n};\n\n},{\"./errors\":12,\"./util\":36}],17:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports =\nfunction(Promise, PromiseArray, tryConvertToPromise, INTERNAL, async,\n getDomain) {\nvar util = _dereq_(\"./util\");\nvar canEvaluate = util.canEvaluate;\nvar tryCatch = util.tryCatch;\nvar errorObj = util.errorObj;\nvar reject;\n\nif (!true) {\nif (canEvaluate) {\n var thenCallback = function(i) {\n return new Function(\"value\", \"holder\", \" \\n\\\n 'use strict'; \\n\\\n holder.pIndex = value; \\n\\\n holder.checkFulfillment(this); \\n\\\n \".replace(/Index/g, i));\n };\n\n var promiseSetter = function(i) {\n return new Function(\"promise\", \"holder\", \" \\n\\\n 'use strict'; \\n\\\n holder.pIndex = promise; \\n\\\n \".replace(/Index/g, i));\n };\n\n var generateHolderClass = function(total) {\n var props = new Array(total);\n for (var i = 0; i < props.length; ++i) {\n props[i] = \"this.p\" + (i+1);\n }\n var assignment = props.join(\" = \") + \" = null;\";\n var cancellationCode= \"var promise;\\n\" + props.map(function(prop) {\n return \" \\n\\\n promise = \" + prop + \"; \\n\\\n if (promise instanceof Promise) { \\n\\\n promise.cancel(); \\n\\\n } \\n\\\n \";\n }).join(\"\\n\");\n var passedArguments = props.join(\", \");\n var name = \"Holder$\" + total;\n\n\n var code = \"return function(tryCatch, errorObj, Promise, async) { \\n\\\n 'use strict'; \\n\\\n function [TheName](fn) { \\n\\\n [TheProperties] \\n\\\n this.fn = fn; \\n\\\n this.asyncNeeded = true; \\n\\\n this.now = 0; \\n\\\n } \\n\\\n \\n\\\n [TheName].prototype._callFunction = function(promise) { \\n\\\n promise._pushContext(); \\n\\\n var ret = tryCatch(this.fn)([ThePassedArguments]); \\n\\\n promise._popContext(); \\n\\\n if (ret === errorObj) { \\n\\\n promise._rejectCallback(ret.e, false); \\n\\\n } else { \\n\\\n promise._resolveCallback(ret); \\n\\\n } \\n\\\n }; \\n\\\n \\n\\\n [TheName].prototype.checkFulfillment = function(promise) { \\n\\\n var now = ++this.now; \\n\\\n if (now === [TheTotal]) { \\n\\\n if (this.asyncNeeded) { \\n\\\n async.invoke(this._callFunction, this, promise); \\n\\\n } else { \\n\\\n this._callFunction(promise); \\n\\\n } \\n\\\n \\n\\\n } \\n\\\n }; \\n\\\n \\n\\\n [TheName].prototype._resultCancelled = function() { \\n\\\n [CancellationCode] \\n\\\n }; \\n\\\n \\n\\\n return [TheName]; \\n\\\n }(tryCatch, errorObj, Promise, async); \\n\\\n \";\n\n code = code.replace(/\\[TheName\\]/g, name)\n .replace(/\\[TheTotal\\]/g, total)\n .replace(/\\[ThePassedArguments\\]/g, passedArguments)\n .replace(/\\[TheProperties\\]/g, assignment)\n .replace(/\\[CancellationCode\\]/g, cancellationCode);\n\n return new Function(\"tryCatch\", \"errorObj\", \"Promise\", \"async\", code)\n (tryCatch, errorObj, Promise, async);\n };\n\n var holderClasses = [];\n var thenCallbacks = [];\n var promiseSetters = [];\n\n for (var i = 0; i < 8; ++i) {\n holderClasses.push(generateHolderClass(i + 1));\n thenCallbacks.push(thenCallback(i + 1));\n promiseSetters.push(promiseSetter(i + 1));\n }\n\n reject = function (reason) {\n this._reject(reason);\n };\n}}\n\nPromise.join = function () {\n var last = arguments.length - 1;\n var fn;\n if (last > 0 && typeof arguments[last] === \"function\") {\n fn = arguments[last];\n if (!true) {\n if (last <= 8 && canEvaluate) {\n var ret = new Promise(INTERNAL);\n ret._captureStackTrace();\n var HolderClass = holderClasses[last - 1];\n var holder = new HolderClass(fn);\n var callbacks = thenCallbacks;\n\n for (var i = 0; i < last; ++i) {\n var maybePromise = tryConvertToPromise(arguments[i], ret);\n if (maybePromise instanceof Promise) {\n maybePromise = maybePromise._target();\n var bitField = maybePromise._bitField;\n ;\n if (((bitField & 50397184) === 0)) {\n maybePromise._then(callbacks[i], reject,\n undefined, ret, holder);\n promiseSetters[i](maybePromise, holder);\n holder.asyncNeeded = false;\n } else if (((bitField & 33554432) !== 0)) {\n callbacks[i].call(ret,\n maybePromise._value(), holder);\n } else if (((bitField & 16777216) !== 0)) {\n ret._reject(maybePromise._reason());\n } else {\n ret._cancel();\n }\n } else {\n callbacks[i].call(ret, maybePromise, holder);\n }\n }\n\n if (!ret._isFateSealed()) {\n if (holder.asyncNeeded) {\n var domain = getDomain();\n if (domain !== null) {\n holder.fn = util.domainBind(domain, holder.fn);\n }\n }\n ret._setAsyncGuaranteed();\n ret._setOnCancel(holder);\n }\n return ret;\n }\n }\n }\n var args = [].slice.call(arguments);;\n if (fn) args.pop();\n var ret = new PromiseArray(args).promise();\n return fn !== undefined ? ret.spread(fn) : ret;\n};\n\n};\n\n},{\"./util\":36}],18:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function(Promise,\n PromiseArray,\n apiRejection,\n tryConvertToPromise,\n INTERNAL,\n debug) {\nvar getDomain = Promise._getDomain;\nvar util = _dereq_(\"./util\");\nvar tryCatch = util.tryCatch;\nvar errorObj = util.errorObj;\nvar async = Promise._async;\n\nfunction MappingPromiseArray(promises, fn, limit, _filter) {\n this.constructor$(promises);\n this._promise._captureStackTrace();\n var domain = getDomain();\n this._callback = domain === null ? fn : util.domainBind(domain, fn);\n this._preservedValues = _filter === INTERNAL\n ? new Array(this.length())\n : null;\n this._limit = limit;\n this._inFlight = 0;\n this._queue = [];\n async.invoke(this._asyncInit, this, undefined);\n}\nutil.inherits(MappingPromiseArray, PromiseArray);\n\nMappingPromiseArray.prototype._asyncInit = function() {\n this._init$(undefined, -2);\n};\n\nMappingPromiseArray.prototype._init = function () {};\n\nMappingPromiseArray.prototype._promiseFulfilled = function (value, index) {\n var values = this._values;\n var length = this.length();\n var preservedValues = this._preservedValues;\n var limit = this._limit;\n\n if (index < 0) {\n index = (index * -1) - 1;\n values[index] = value;\n if (limit >= 1) {\n this._inFlight--;\n this._drainQueue();\n if (this._isResolved()) return true;\n }\n } else {\n if (limit >= 1 && this._inFlight >= limit) {\n values[index] = value;\n this._queue.push(index);\n return false;\n }\n if (preservedValues !== null) preservedValues[index] = value;\n\n var promise = this._promise;\n var callback = this._callback;\n var receiver = promise._boundValue();\n promise._pushContext();\n var ret = tryCatch(callback).call(receiver, value, index, length);\n var promiseCreated = promise._popContext();\n debug.checkForgottenReturns(\n ret,\n promiseCreated,\n preservedValues !== null ? \"Promise.filter\" : \"Promise.map\",\n promise\n );\n if (ret === errorObj) {\n this._reject(ret.e);\n return true;\n }\n\n var maybePromise = tryConvertToPromise(ret, this._promise);\n if (maybePromise instanceof Promise) {\n maybePromise = maybePromise._target();\n var bitField = maybePromise._bitField;\n ;\n if (((bitField & 50397184) === 0)) {\n if (limit >= 1) this._inFlight++;\n values[index] = maybePromise;\n maybePromise._proxy(this, (index + 1) * -1);\n return false;\n } else if (((bitField & 33554432) !== 0)) {\n ret = maybePromise._value();\n } else if (((bitField & 16777216) !== 0)) {\n this._reject(maybePromise._reason());\n return true;\n } else {\n this._cancel();\n return true;\n }\n }\n values[index] = ret;\n }\n var totalResolved = ++this._totalResolved;\n if (totalResolved >= length) {\n if (preservedValues !== null) {\n this._filter(values, preservedValues);\n } else {\n this._resolve(values);\n }\n return true;\n }\n return false;\n};\n\nMappingPromiseArray.prototype._drainQueue = function () {\n var queue = this._queue;\n var limit = this._limit;\n var values = this._values;\n while (queue.length > 0 && this._inFlight < limit) {\n if (this._isResolved()) return;\n var index = queue.pop();\n this._promiseFulfilled(values[index], index);\n }\n};\n\nMappingPromiseArray.prototype._filter = function (booleans, values) {\n var len = values.length;\n var ret = new Array(len);\n var j = 0;\n for (var i = 0; i < len; ++i) {\n if (booleans[i]) ret[j++] = values[i];\n }\n ret.length = j;\n this._resolve(ret);\n};\n\nMappingPromiseArray.prototype.preservedValues = function () {\n return this._preservedValues;\n};\n\nfunction map(promises, fn, options, _filter) {\n if (typeof fn !== \"function\") {\n return apiRejection(\"expecting a function but got \" + util.classString(fn));\n }\n\n var limit = 0;\n if (options !== undefined) {\n if (typeof options === \"object\" && options !== null) {\n if (typeof options.concurrency !== \"number\") {\n return Promise.reject(\n new TypeError(\"'concurrency' must be a number but it is \" +\n util.classString(options.concurrency)));\n }\n limit = options.concurrency;\n } else {\n return Promise.reject(new TypeError(\n \"options argument must be an object but it is \" +\n util.classString(options)));\n }\n }\n limit = typeof limit === \"number\" &&\n isFinite(limit) && limit >= 1 ? limit : 0;\n return new MappingPromiseArray(promises, fn, limit, _filter).promise();\n}\n\nPromise.prototype.map = function (fn, options) {\n return map(this, fn, options, null);\n};\n\nPromise.map = function (promises, fn, options, _filter) {\n return map(promises, fn, options, _filter);\n};\n\n\n};\n\n},{\"./util\":36}],19:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports =\nfunction(Promise, INTERNAL, tryConvertToPromise, apiRejection, debug) {\nvar util = _dereq_(\"./util\");\nvar tryCatch = util.tryCatch;\n\nPromise.method = function (fn) {\n if (typeof fn !== \"function\") {\n throw new Promise.TypeError(\"expecting a function but got \" + util.classString(fn));\n }\n return function () {\n var ret = new Promise(INTERNAL);\n ret._captureStackTrace();\n ret._pushContext();\n var value = tryCatch(fn).apply(this, arguments);\n var promiseCreated = ret._popContext();\n debug.checkForgottenReturns(\n value, promiseCreated, \"Promise.method\", ret);\n ret._resolveFromSyncValue(value);\n return ret;\n };\n};\n\nPromise.attempt = Promise[\"try\"] = function (fn) {\n if (typeof fn !== \"function\") {\n return apiRejection(\"expecting a function but got \" + util.classString(fn));\n }\n var ret = new Promise(INTERNAL);\n ret._captureStackTrace();\n ret._pushContext();\n var value;\n if (arguments.length > 1) {\n debug.deprecated(\"calling Promise.try with more than 1 argument\");\n var arg = arguments[1];\n var ctx = arguments[2];\n value = util.isArray(arg) ? tryCatch(fn).apply(ctx, arg)\n : tryCatch(fn).call(ctx, arg);\n } else {\n value = tryCatch(fn)();\n }\n var promiseCreated = ret._popContext();\n debug.checkForgottenReturns(\n value, promiseCreated, \"Promise.try\", ret);\n ret._resolveFromSyncValue(value);\n return ret;\n};\n\nPromise.prototype._resolveFromSyncValue = function (value) {\n if (value === util.errorObj) {\n this._rejectCallback(value.e, false);\n } else {\n this._resolveCallback(value, true);\n }\n};\n};\n\n},{\"./util\":36}],20:[function(_dereq_,module,exports){\n\"use strict\";\nvar util = _dereq_(\"./util\");\nvar maybeWrapAsError = util.maybeWrapAsError;\nvar errors = _dereq_(\"./errors\");\nvar OperationalError = errors.OperationalError;\nvar es5 = _dereq_(\"./es5\");\n\nfunction isUntypedError(obj) {\n return obj instanceof Error &&\n es5.getPrototypeOf(obj) === Error.prototype;\n}\n\nvar rErrorKey = /^(?:name|message|stack|cause)$/;\nfunction wrapAsOperationalError(obj) {\n var ret;\n if (isUntypedError(obj)) {\n ret = new OperationalError(obj);\n ret.name = obj.name;\n ret.message = obj.message;\n ret.stack = obj.stack;\n var keys = es5.keys(obj);\n for (var i = 0; i < keys.length; ++i) {\n var key = keys[i];\n if (!rErrorKey.test(key)) {\n ret[key] = obj[key];\n }\n }\n return ret;\n }\n util.markAsOriginatingFromRejection(obj);\n return obj;\n}\n\nfunction nodebackForPromise(promise, multiArgs) {\n return function(err, value) {\n if (promise === null) return;\n if (err) {\n var wrapped = wrapAsOperationalError(maybeWrapAsError(err));\n promise._attachExtraTrace(wrapped);\n promise._reject(wrapped);\n } else if (!multiArgs) {\n promise._fulfill(value);\n } else {\n var args = [].slice.call(arguments, 1);;\n promise._fulfill(args);\n }\n promise = null;\n };\n}\n\nmodule.exports = nodebackForPromise;\n\n},{\"./errors\":12,\"./es5\":13,\"./util\":36}],21:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function(Promise) {\nvar util = _dereq_(\"./util\");\nvar async = Promise._async;\nvar tryCatch = util.tryCatch;\nvar errorObj = util.errorObj;\n\nfunction spreadAdapter(val, nodeback) {\n var promise = this;\n if (!util.isArray(val)) return successAdapter.call(promise, val, nodeback);\n var ret =\n tryCatch(nodeback).apply(promise._boundValue(), [null].concat(val));\n if (ret === errorObj) {\n async.throwLater(ret.e);\n }\n}\n\nfunction successAdapter(val, nodeback) {\n var promise = this;\n var receiver = promise._boundValue();\n var ret = val === undefined\n ? tryCatch(nodeback).call(receiver, null)\n : tryCatch(nodeback).call(receiver, null, val);\n if (ret === errorObj) {\n async.throwLater(ret.e);\n }\n}\nfunction errorAdapter(reason, nodeback) {\n var promise = this;\n if (!reason) {\n var newReason = new Error(reason + \"\");\n newReason.cause = reason;\n reason = newReason;\n }\n var ret = tryCatch(nodeback).call(promise._boundValue(), reason);\n if (ret === errorObj) {\n async.throwLater(ret.e);\n }\n}\n\nPromise.prototype.asCallback = Promise.prototype.nodeify = function (nodeback,\n options) {\n if (typeof nodeback == \"function\") {\n var adapter = successAdapter;\n if (options !== undefined && Object(options).spread) {\n adapter = spreadAdapter;\n }\n this._then(\n adapter,\n errorAdapter,\n undefined,\n this,\n nodeback\n );\n }\n return this;\n};\n};\n\n},{\"./util\":36}],22:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function() {\nvar makeSelfResolutionError = function () {\n return new TypeError(\"circular promise resolution chain\\u000a\\u000a See http://goo.gl/MqrFmX\\u000a\");\n};\nvar reflectHandler = function() {\n return new Promise.PromiseInspection(this._target());\n};\nvar apiRejection = function(msg) {\n return Promise.reject(new TypeError(msg));\n};\nfunction Proxyable() {}\nvar UNDEFINED_BINDING = {};\nvar util = _dereq_(\"./util\");\n\nvar getDomain;\nif (util.isNode) {\n getDomain = function() {\n var ret = process.domain;\n if (ret === undefined) ret = null;\n return ret;\n };\n} else {\n getDomain = function() {\n return null;\n };\n}\nutil.notEnumerableProp(Promise, \"_getDomain\", getDomain);\n\nvar es5 = _dereq_(\"./es5\");\nvar Async = _dereq_(\"./async\");\nvar async = new Async();\nes5.defineProperty(Promise, \"_async\", {value: async});\nvar errors = _dereq_(\"./errors\");\nvar TypeError = Promise.TypeError = errors.TypeError;\nPromise.RangeError = errors.RangeError;\nvar CancellationError = Promise.CancellationError = errors.CancellationError;\nPromise.TimeoutError = errors.TimeoutError;\nPromise.OperationalError = errors.OperationalError;\nPromise.RejectionError = errors.OperationalError;\nPromise.AggregateError = errors.AggregateError;\nvar INTERNAL = function(){};\nvar APPLY = {};\nvar NEXT_FILTER = {};\nvar tryConvertToPromise = _dereq_(\"./thenables\")(Promise, INTERNAL);\nvar PromiseArray =\n _dereq_(\"./promise_array\")(Promise, INTERNAL,\n tryConvertToPromise, apiRejection, Proxyable);\nvar Context = _dereq_(\"./context\")(Promise);\n /*jshint unused:false*/\nvar createContext = Context.create;\nvar debug = _dereq_(\"./debuggability\")(Promise, Context);\nvar CapturedTrace = debug.CapturedTrace;\nvar PassThroughHandlerContext =\n _dereq_(\"./finally\")(Promise, tryConvertToPromise, NEXT_FILTER);\nvar catchFilter = _dereq_(\"./catch_filter\")(NEXT_FILTER);\nvar nodebackForPromise = _dereq_(\"./nodeback\");\nvar errorObj = util.errorObj;\nvar tryCatch = util.tryCatch;\nfunction check(self, executor) {\n if (self == null || self.constructor !== Promise) {\n throw new TypeError(\"the promise constructor cannot be invoked directly\\u000a\\u000a See http://goo.gl/MqrFmX\\u000a\");\n }\n if (typeof executor !== \"function\") {\n throw new TypeError(\"expecting a function but got \" + util.classString(executor));\n }\n\n}\n\nfunction Promise(executor) {\n if (executor !== INTERNAL) {\n check(this, executor);\n }\n this._bitField = 0;\n this._fulfillmentHandler0 = undefined;\n this._rejectionHandler0 = undefined;\n this._promise0 = undefined;\n this._receiver0 = undefined;\n this._resolveFromExecutor(executor);\n this._promiseCreated();\n this._fireEvent(\"promiseCreated\", this);\n}\n\nPromise.prototype.toString = function () {\n return \"[object Promise]\";\n};\n\nPromise.prototype.caught = Promise.prototype[\"catch\"] = function (fn) {\n var len = arguments.length;\n if (len > 1) {\n var catchInstances = new Array(len - 1),\n j = 0, i;\n for (i = 0; i < len - 1; ++i) {\n var item = arguments[i];\n if (util.isObject(item)) {\n catchInstances[j++] = item;\n } else {\n return apiRejection(\"Catch statement predicate: \" +\n \"expecting an object but got \" + util.classString(item));\n }\n }\n catchInstances.length = j;\n fn = arguments[i];\n return this.then(undefined, catchFilter(catchInstances, fn, this));\n }\n return this.then(undefined, fn);\n};\n\nPromise.prototype.reflect = function () {\n return this._then(reflectHandler,\n reflectHandler, undefined, this, undefined);\n};\n\nPromise.prototype.then = function (didFulfill, didReject) {\n if (debug.warnings() && arguments.length > 0 &&\n typeof didFulfill !== \"function\" &&\n typeof didReject !== \"function\") {\n var msg = \".then() only accepts functions but was passed: \" +\n util.classString(didFulfill);\n if (arguments.length > 1) {\n msg += \", \" + util.classString(didReject);\n }\n this._warn(msg);\n }\n return this._then(didFulfill, didReject, undefined, undefined, undefined);\n};\n\nPromise.prototype.done = function (didFulfill, didReject) {\n var promise =\n this._then(didFulfill, didReject, undefined, undefined, undefined);\n promise._setIsFinal();\n};\n\nPromise.prototype.spread = function (fn) {\n if (typeof fn !== \"function\") {\n return apiRejection(\"expecting a function but got \" + util.classString(fn));\n }\n return this.all()._then(fn, undefined, undefined, APPLY, undefined);\n};\n\nPromise.prototype.toJSON = function () {\n var ret = {\n isFulfilled: false,\n isRejected: false,\n fulfillmentValue: undefined,\n rejectionReason: undefined\n };\n if (this.isFulfilled()) {\n ret.fulfillmentValue = this.value();\n ret.isFulfilled = true;\n } else if (this.isRejected()) {\n ret.rejectionReason = this.reason();\n ret.isRejected = true;\n }\n return ret;\n};\n\nPromise.prototype.all = function () {\n if (arguments.length > 0) {\n this._warn(\".all() was passed arguments but it does not take any\");\n }\n return new PromiseArray(this).promise();\n};\n\nPromise.prototype.error = function (fn) {\n return this.caught(util.originatesFromRejection, fn);\n};\n\nPromise.getNewLibraryCopy = module.exports;\n\nPromise.is = function (val) {\n return val instanceof Promise;\n};\n\nPromise.fromNode = Promise.fromCallback = function(fn) {\n var ret = new Promise(INTERNAL);\n ret._captureStackTrace();\n var multiArgs = arguments.length > 1 ? !!Object(arguments[1]).multiArgs\n : false;\n var result = tryCatch(fn)(nodebackForPromise(ret, multiArgs));\n if (result === errorObj) {\n ret._rejectCallback(result.e, true);\n }\n if (!ret._isFateSealed()) ret._setAsyncGuaranteed();\n return ret;\n};\n\nPromise.all = function (promises) {\n return new PromiseArray(promises).promise();\n};\n\nPromise.cast = function (obj) {\n var ret = tryConvertToPromise(obj);\n if (!(ret instanceof Promise)) {\n ret = new Promise(INTERNAL);\n ret._captureStackTrace();\n ret._setFulfilled();\n ret._rejectionHandler0 = obj;\n }\n return ret;\n};\n\nPromise.resolve = Promise.fulfilled = Promise.cast;\n\nPromise.reject = Promise.rejected = function (reason) {\n var ret = new Promise(INTERNAL);\n ret._captureStackTrace();\n ret._rejectCallback(reason, true);\n return ret;\n};\n\nPromise.setScheduler = function(fn) {\n if (typeof fn !== \"function\") {\n throw new TypeError(\"expecting a function but got \" + util.classString(fn));\n }\n return async.setScheduler(fn);\n};\n\nPromise.prototype._then = function (\n didFulfill,\n didReject,\n _, receiver,\n internalData\n) {\n var haveInternalData = internalData !== undefined;\n var promise = haveInternalData ? internalData : new Promise(INTERNAL);\n var target = this._target();\n var bitField = target._bitField;\n\n if (!haveInternalData) {\n promise._propagateFrom(this, 3);\n promise._captureStackTrace();\n if (receiver === undefined &&\n ((this._bitField & 2097152) !== 0)) {\n if (!((bitField & 50397184) === 0)) {\n receiver = this._boundValue();\n } else {\n receiver = target === this ? undefined : this._boundTo;\n }\n }\n this._fireEvent(\"promiseChained\", this, promise);\n }\n\n var domain = getDomain();\n if (!((bitField & 50397184) === 0)) {\n var handler, value, settler = target._settlePromiseCtx;\n if (((bitField & 33554432) !== 0)) {\n value = target._rejectionHandler0;\n handler = didFulfill;\n } else if (((bitField & 16777216) !== 0)) {\n value = target._fulfillmentHandler0;\n handler = didReject;\n target._unsetRejectionIsUnhandled();\n } else {\n settler = target._settlePromiseLateCancellationObserver;\n value = new CancellationError(\"late cancellation observer\");\n target._attachExtraTrace(value);\n handler = didReject;\n }\n\n async.invoke(settler, target, {\n handler: domain === null ? handler\n : (typeof handler === \"function\" &&\n util.domainBind(domain, handler)),\n promise: promise,\n receiver: receiver,\n value: value\n });\n } else {\n target._addCallbacks(didFulfill, didReject, promise, receiver, domain);\n }\n\n return promise;\n};\n\nPromise.prototype._length = function () {\n return this._bitField & 65535;\n};\n\nPromise.prototype._isFateSealed = function () {\n return (this._bitField & 117506048) !== 0;\n};\n\nPromise.prototype._isFollowing = function () {\n return (this._bitField & 67108864) === 67108864;\n};\n\nPromise.prototype._setLength = function (len) {\n this._bitField = (this._bitField & -65536) |\n (len & 65535);\n};\n\nPromise.prototype._setFulfilled = function () {\n this._bitField = this._bitField | 33554432;\n this._fireEvent(\"promiseFulfilled\", this);\n};\n\nPromise.prototype._setRejected = function () {\n this._bitField = this._bitField | 16777216;\n this._fireEvent(\"promiseRejected\", this);\n};\n\nPromise.prototype._setFollowing = function () {\n this._bitField = this._bitField | 67108864;\n this._fireEvent(\"promiseResolved\", this);\n};\n\nPromise.prototype._setIsFinal = function () {\n this._bitField = this._bitField | 4194304;\n};\n\nPromise.prototype._isFinal = function () {\n return (this._bitField & 4194304) > 0;\n};\n\nPromise.prototype._unsetCancelled = function() {\n this._bitField = this._bitField & (~65536);\n};\n\nPromise.prototype._setCancelled = function() {\n this._bitField = this._bitField | 65536;\n this._fireEvent(\"promiseCancelled\", this);\n};\n\nPromise.prototype._setWillBeCancelled = function() {\n this._bitField = this._bitField | 8388608;\n};\n\nPromise.prototype._setAsyncGuaranteed = function() {\n if (async.hasCustomScheduler()) return;\n this._bitField = this._bitField | 134217728;\n};\n\nPromise.prototype._receiverAt = function (index) {\n var ret = index === 0 ? this._receiver0 : this[\n index * 4 - 4 + 3];\n if (ret === UNDEFINED_BINDING) {\n return undefined;\n } else if (ret === undefined && this._isBound()) {\n return this._boundValue();\n }\n return ret;\n};\n\nPromise.prototype._promiseAt = function (index) {\n return this[\n index * 4 - 4 + 2];\n};\n\nPromise.prototype._fulfillmentHandlerAt = function (index) {\n return this[\n index * 4 - 4 + 0];\n};\n\nPromise.prototype._rejectionHandlerAt = function (index) {\n return this[\n index * 4 - 4 + 1];\n};\n\nPromise.prototype._boundValue = function() {};\n\nPromise.prototype._migrateCallback0 = function (follower) {\n var bitField = follower._bitField;\n var fulfill = follower._fulfillmentHandler0;\n var reject = follower._rejectionHandler0;\n var promise = follower._promise0;\n var receiver = follower._receiverAt(0);\n if (receiver === undefined) receiver = UNDEFINED_BINDING;\n this._addCallbacks(fulfill, reject, promise, receiver, null);\n};\n\nPromise.prototype._migrateCallbackAt = function (follower, index) {\n var fulfill = follower._fulfillmentHandlerAt(index);\n var reject = follower._rejectionHandlerAt(index);\n var promise = follower._promiseAt(index);\n var receiver = follower._receiverAt(index);\n if (receiver === undefined) receiver = UNDEFINED_BINDING;\n this._addCallbacks(fulfill, reject, promise, receiver, null);\n};\n\nPromise.prototype._addCallbacks = function (\n fulfill,\n reject,\n promise,\n receiver,\n domain\n) {\n var index = this._length();\n\n if (index >= 65535 - 4) {\n index = 0;\n this._setLength(0);\n }\n\n if (index === 0) {\n this._promise0 = promise;\n this._receiver0 = receiver;\n if (typeof fulfill === \"function\") {\n this._fulfillmentHandler0 =\n domain === null ? fulfill : util.domainBind(domain, fulfill);\n }\n if (typeof reject === \"function\") {\n this._rejectionHandler0 =\n domain === null ? reject : util.domainBind(domain, reject);\n }\n } else {\n var base = index * 4 - 4;\n this[base + 2] = promise;\n this[base + 3] = receiver;\n if (typeof fulfill === \"function\") {\n this[base + 0] =\n domain === null ? fulfill : util.domainBind(domain, fulfill);\n }\n if (typeof reject === \"function\") {\n this[base + 1] =\n domain === null ? reject : util.domainBind(domain, reject);\n }\n }\n this._setLength(index + 1);\n return index;\n};\n\nPromise.prototype._proxy = function (proxyable, arg) {\n this._addCallbacks(undefined, undefined, arg, proxyable, null);\n};\n\nPromise.prototype._resolveCallback = function(value, shouldBind) {\n if (((this._bitField & 117506048) !== 0)) return;\n if (value === this)\n return this._rejectCallback(makeSelfResolutionError(), false);\n var maybePromise = tryConvertToPromise(value, this);\n if (!(maybePromise instanceof Promise)) return this._fulfill(value);\n\n if (shouldBind) this._propagateFrom(maybePromise, 2);\n\n var promise = maybePromise._target();\n\n if (promise === this) {\n this._reject(makeSelfResolutionError());\n return;\n }\n\n var bitField = promise._bitField;\n if (((bitField & 50397184) === 0)) {\n var len = this._length();\n if (len > 0) promise._migrateCallback0(this);\n for (var i = 1; i < len; ++i) {\n promise._migrateCallbackAt(this, i);\n }\n this._setFollowing();\n this._setLength(0);\n this._setFollowee(promise);\n } else if (((bitField & 33554432) !== 0)) {\n this._fulfill(promise._value());\n } else if (((bitField & 16777216) !== 0)) {\n this._reject(promise._reason());\n } else {\n var reason = new CancellationError(\"late cancellation observer\");\n promise._attachExtraTrace(reason);\n this._reject(reason);\n }\n};\n\nPromise.prototype._rejectCallback =\nfunction(reason, synchronous, ignoreNonErrorWarnings) {\n var trace = util.ensureErrorObject(reason);\n var hasStack = trace === reason;\n if (!hasStack && !ignoreNonErrorWarnings && debug.warnings()) {\n var message = \"a promise was rejected with a non-error: \" +\n util.classString(reason);\n this._warn(message, true);\n }\n this._attachExtraTrace(trace, synchronous ? hasStack : false);\n this._reject(reason);\n};\n\nPromise.prototype._resolveFromExecutor = function (executor) {\n if (executor === INTERNAL) return;\n var promise = this;\n this._captureStackTrace();\n this._pushContext();\n var synchronous = true;\n var r = this._execute(executor, function(value) {\n promise._resolveCallback(value);\n }, function (reason) {\n promise._rejectCallback(reason, synchronous);\n });\n synchronous = false;\n this._popContext();\n\n if (r !== undefined) {\n promise._rejectCallback(r, true);\n }\n};\n\nPromise.prototype._settlePromiseFromHandler = function (\n handler, receiver, value, promise\n) {\n var bitField = promise._bitField;\n if (((bitField & 65536) !== 0)) return;\n promise._pushContext();\n var x;\n if (receiver === APPLY) {\n if (!value || typeof value.length !== \"number\") {\n x = errorObj;\n x.e = new TypeError(\"cannot .spread() a non-array: \" +\n util.classString(value));\n } else {\n x = tryCatch(handler).apply(this._boundValue(), value);\n }\n } else {\n x = tryCatch(handler).call(receiver, value);\n }\n var promiseCreated = promise._popContext();\n bitField = promise._bitField;\n if (((bitField & 65536) !== 0)) return;\n\n if (x === NEXT_FILTER) {\n promise._reject(value);\n } else if (x === errorObj) {\n promise._rejectCallback(x.e, false);\n } else {\n debug.checkForgottenReturns(x, promiseCreated, \"\", promise, this);\n promise._resolveCallback(x);\n }\n};\n\nPromise.prototype._target = function() {\n var ret = this;\n while (ret._isFollowing()) ret = ret._followee();\n return ret;\n};\n\nPromise.prototype._followee = function() {\n return this._rejectionHandler0;\n};\n\nPromise.prototype._setFollowee = function(promise) {\n this._rejectionHandler0 = promise;\n};\n\nPromise.prototype._settlePromise = function(promise, handler, receiver, value) {\n var isPromise = promise instanceof Promise;\n var bitField = this._bitField;\n var asyncGuaranteed = ((bitField & 134217728) !== 0);\n if (((bitField & 65536) !== 0)) {\n if (isPromise) promise._invokeInternalOnCancel();\n\n if (receiver instanceof PassThroughHandlerContext &&\n receiver.isFinallyHandler()) {\n receiver.cancelPromise = promise;\n if (tryCatch(handler).call(receiver, value) === errorObj) {\n promise._reject(errorObj.e);\n }\n } else if (handler === reflectHandler) {\n promise._fulfill(reflectHandler.call(receiver));\n } else if (receiver instanceof Proxyable) {\n receiver._promiseCancelled(promise);\n } else if (isPromise || promise instanceof PromiseArray) {\n promise._cancel();\n } else {\n receiver.cancel();\n }\n } else if (typeof handler === \"function\") {\n if (!isPromise) {\n handler.call(receiver, value, promise);\n } else {\n if (asyncGuaranteed) promise._setAsyncGuaranteed();\n this._settlePromiseFromHandler(handler, receiver, value, promise);\n }\n } else if (receiver instanceof Proxyable) {\n if (!receiver._isResolved()) {\n if (((bitField & 33554432) !== 0)) {\n receiver._promiseFulfilled(value, promise);\n } else {\n receiver._promiseRejected(value, promise);\n }\n }\n } else if (isPromise) {\n if (asyncGuaranteed) promise._setAsyncGuaranteed();\n if (((bitField & 33554432) !== 0)) {\n promise._fulfill(value);\n } else {\n promise._reject(value);\n }\n }\n};\n\nPromise.prototype._settlePromiseLateCancellationObserver = function(ctx) {\n var handler = ctx.handler;\n var promise = ctx.promise;\n var receiver = ctx.receiver;\n var value = ctx.value;\n if (typeof handler === \"function\") {\n if (!(promise instanceof Promise)) {\n handler.call(receiver, value, promise);\n } else {\n this._settlePromiseFromHandler(handler, receiver, value, promise);\n }\n } else if (promise instanceof Promise) {\n promise._reject(value);\n }\n};\n\nPromise.prototype._settlePromiseCtx = function(ctx) {\n this._settlePromise(ctx.promise, ctx.handler, ctx.receiver, ctx.value);\n};\n\nPromise.prototype._settlePromise0 = function(handler, value, bitField) {\n var promise = this._promise0;\n var receiver = this._receiverAt(0);\n this._promise0 = undefined;\n this._receiver0 = undefined;\n this._settlePromise(promise, handler, receiver, value);\n};\n\nPromise.prototype._clearCallbackDataAtIndex = function(index) {\n var base = index * 4 - 4;\n this[base + 2] =\n this[base + 3] =\n this[base + 0] =\n this[base + 1] = undefined;\n};\n\nPromise.prototype._fulfill = function (value) {\n var bitField = this._bitField;\n if (((bitField & 117506048) >>> 16)) return;\n if (value === this) {\n var err = makeSelfResolutionError();\n this._attachExtraTrace(err);\n return this._reject(err);\n }\n this._setFulfilled();\n this._rejectionHandler0 = value;\n\n if ((bitField & 65535) > 0) {\n if (((bitField & 134217728) !== 0)) {\n this._settlePromises();\n } else {\n async.settlePromises(this);\n }\n }\n};\n\nPromise.prototype._reject = function (reason) {\n var bitField = this._bitField;\n if (((bitField & 117506048) >>> 16)) return;\n this._setRejected();\n this._fulfillmentHandler0 = reason;\n\n if (this._isFinal()) {\n return async.fatalError(reason, util.isNode);\n }\n\n if ((bitField & 65535) > 0) {\n async.settlePromises(this);\n } else {\n this._ensurePossibleRejectionHandled();\n }\n};\n\nPromise.prototype._fulfillPromises = function (len, value) {\n for (var i = 1; i < len; i++) {\n var handler = this._fulfillmentHandlerAt(i);\n var promise = this._promiseAt(i);\n var receiver = this._receiverAt(i);\n this._clearCallbackDataAtIndex(i);\n this._settlePromise(promise, handler, receiver, value);\n }\n};\n\nPromise.prototype._rejectPromises = function (len, reason) {\n for (var i = 1; i < len; i++) {\n var handler = this._rejectionHandlerAt(i);\n var promise = this._promiseAt(i);\n var receiver = this._receiverAt(i);\n this._clearCallbackDataAtIndex(i);\n this._settlePromise(promise, handler, receiver, reason);\n }\n};\n\nPromise.prototype._settlePromises = function () {\n var bitField = this._bitField;\n var len = (bitField & 65535);\n\n if (len > 0) {\n if (((bitField & 16842752) !== 0)) {\n var reason = this._fulfillmentHandler0;\n this._settlePromise0(this._rejectionHandler0, reason, bitField);\n this._rejectPromises(len, reason);\n } else {\n var value = this._rejectionHandler0;\n this._settlePromise0(this._fulfillmentHandler0, value, bitField);\n this._fulfillPromises(len, value);\n }\n this._setLength(0);\n }\n this._clearCancellationData();\n};\n\nPromise.prototype._settledValue = function() {\n var bitField = this._bitField;\n if (((bitField & 33554432) !== 0)) {\n return this._rejectionHandler0;\n } else if (((bitField & 16777216) !== 0)) {\n return this._fulfillmentHandler0;\n }\n};\n\nfunction deferResolve(v) {this.promise._resolveCallback(v);}\nfunction deferReject(v) {this.promise._rejectCallback(v, false);}\n\nPromise.defer = Promise.pending = function() {\n debug.deprecated(\"Promise.defer\", \"new Promise\");\n var promise = new Promise(INTERNAL);\n return {\n promise: promise,\n resolve: deferResolve,\n reject: deferReject\n };\n};\n\nutil.notEnumerableProp(Promise,\n \"_makeSelfResolutionError\",\n makeSelfResolutionError);\n\n_dereq_(\"./method\")(Promise, INTERNAL, tryConvertToPromise, apiRejection,\n debug);\n_dereq_(\"./bind\")(Promise, INTERNAL, tryConvertToPromise, debug);\n_dereq_(\"./cancel\")(Promise, PromiseArray, apiRejection, debug);\n_dereq_(\"./direct_resolve\")(Promise);\n_dereq_(\"./synchronous_inspection\")(Promise);\n_dereq_(\"./join\")(\n Promise, PromiseArray, tryConvertToPromise, INTERNAL, async, getDomain);\nPromise.Promise = Promise;\nPromise.version = \"3.5.1\";\n_dereq_('./map.js')(Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL, debug);\n_dereq_('./call_get.js')(Promise);\n_dereq_('./using.js')(Promise, apiRejection, tryConvertToPromise, createContext, INTERNAL, debug);\n_dereq_('./timers.js')(Promise, INTERNAL, debug);\n_dereq_('./generators.js')(Promise, apiRejection, INTERNAL, tryConvertToPromise, Proxyable, debug);\n_dereq_('./nodeify.js')(Promise);\n_dereq_('./promisify.js')(Promise, INTERNAL);\n_dereq_('./props.js')(Promise, PromiseArray, tryConvertToPromise, apiRejection);\n_dereq_('./race.js')(Promise, INTERNAL, tryConvertToPromise, apiRejection);\n_dereq_('./reduce.js')(Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL, debug);\n_dereq_('./settle.js')(Promise, PromiseArray, debug);\n_dereq_('./some.js')(Promise, PromiseArray, apiRejection);\n_dereq_('./filter.js')(Promise, INTERNAL);\n_dereq_('./each.js')(Promise, INTERNAL);\n_dereq_('./any.js')(Promise);\n \n util.toFastProperties(Promise); \n util.toFastProperties(Promise.prototype); \n function fillTypes(value) { \n var p = new Promise(INTERNAL); \n p._fulfillmentHandler0 = value; \n p._rejectionHandler0 = value; \n p._promise0 = value; \n p._receiver0 = value; \n } \n // Complete slack tracking, opt out of field-type tracking and \n // stabilize map \n fillTypes({a: 1}); \n fillTypes({b: 2}); \n fillTypes({c: 3}); \n fillTypes(1); \n fillTypes(function(){}); \n fillTypes(undefined); \n fillTypes(false); \n fillTypes(new Promise(INTERNAL)); \n debug.setBounds(Async.firstLineError, util.lastLineError); \n return Promise; \n\n};\n\n},{\"./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(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function(Promise, INTERNAL, tryConvertToPromise,\n apiRejection, Proxyable) {\nvar util = _dereq_(\"./util\");\nvar isArray = util.isArray;\n\nfunction toResolutionValue(val) {\n switch(val) {\n case -2: return [];\n case -3: return {};\n case -6: return new Map();\n }\n}\n\nfunction PromiseArray(values) {\n var promise = this._promise = new Promise(INTERNAL);\n if (values instanceof Promise) {\n promise._propagateFrom(values, 3);\n }\n promise._setOnCancel(this);\n this._values = values;\n this._length = 0;\n this._totalResolved = 0;\n this._init(undefined, -2);\n}\nutil.inherits(PromiseArray, Proxyable);\n\nPromiseArray.prototype.length = function () {\n return this._length;\n};\n\nPromiseArray.prototype.promise = function () {\n return this._promise;\n};\n\nPromiseArray.prototype._init = function init(_, resolveValueIfEmpty) {\n var values = tryConvertToPromise(this._values, this._promise);\n if (values instanceof Promise) {\n values = values._target();\n var bitField = values._bitField;\n ;\n this._values = values;\n\n if (((bitField & 50397184) === 0)) {\n this._promise._setAsyncGuaranteed();\n return values._then(\n init,\n this._reject,\n undefined,\n this,\n resolveValueIfEmpty\n );\n } else if (((bitField & 33554432) !== 0)) {\n values = values._value();\n } else if (((bitField & 16777216) !== 0)) {\n return this._reject(values._reason());\n } else {\n return this._cancel();\n }\n }\n values = util.asArray(values);\n if (values === null) {\n var err = apiRejection(\n \"expecting an array or an iterable object but got \" + util.classString(values)).reason();\n this._promise._rejectCallback(err, false);\n return;\n }\n\n if (values.length === 0) {\n if (resolveValueIfEmpty === -5) {\n this._resolveEmptyArray();\n }\n else {\n this._resolve(toResolutionValue(resolveValueIfEmpty));\n }\n return;\n }\n this._iterate(values);\n};\n\nPromiseArray.prototype._iterate = function(values) {\n var len = this.getActualLength(values.length);\n this._length = len;\n this._values = this.shouldCopyValues() ? new Array(len) : this._values;\n var result = this._promise;\n var isResolved = false;\n var bitField = null;\n for (var i = 0; i < len; ++i) {\n var maybePromise = tryConvertToPromise(values[i], result);\n\n if (maybePromise instanceof Promise) {\n maybePromise = maybePromise._target();\n bitField = maybePromise._bitField;\n } else {\n bitField = null;\n }\n\n if (isResolved) {\n if (bitField !== null) {\n maybePromise.suppressUnhandledRejections();\n }\n } else if (bitField !== null) {\n if (((bitField & 50397184) === 0)) {\n maybePromise._proxy(this, i);\n this._values[i] = maybePromise;\n } else if (((bitField & 33554432) !== 0)) {\n isResolved = this._promiseFulfilled(maybePromise._value(), i);\n } else if (((bitField & 16777216) !== 0)) {\n isResolved = this._promiseRejected(maybePromise._reason(), i);\n } else {\n isResolved = this._promiseCancelled(i);\n }\n } else {\n isResolved = this._promiseFulfilled(maybePromise, i);\n }\n }\n if (!isResolved) result._setAsyncGuaranteed();\n};\n\nPromiseArray.prototype._isResolved = function () {\n return this._values === null;\n};\n\nPromiseArray.prototype._resolve = function (value) {\n this._values = null;\n this._promise._fulfill(value);\n};\n\nPromiseArray.prototype._cancel = function() {\n if (this._isResolved() || !this._promise._isCancellable()) return;\n this._values = null;\n this._promise._cancel();\n};\n\nPromiseArray.prototype._reject = function (reason) {\n this._values = null;\n this._promise._rejectCallback(reason, false);\n};\n\nPromiseArray.prototype._promiseFulfilled = function (value, index) {\n this._values[index] = value;\n var totalResolved = ++this._totalResolved;\n if (totalResolved >= this._length) {\n this._resolve(this._values);\n return true;\n }\n return false;\n};\n\nPromiseArray.prototype._promiseCancelled = function() {\n this._cancel();\n return true;\n};\n\nPromiseArray.prototype._promiseRejected = function (reason) {\n this._totalResolved++;\n this._reject(reason);\n return true;\n};\n\nPromiseArray.prototype._resultCancelled = function() {\n if (this._isResolved()) return;\n var values = this._values;\n this._cancel();\n if (values instanceof Promise) {\n values.cancel();\n } else {\n for (var i = 0; i < values.length; ++i) {\n if (values[i] instanceof Promise) {\n values[i].cancel();\n }\n }\n }\n};\n\nPromiseArray.prototype.shouldCopyValues = function () {\n return true;\n};\n\nPromiseArray.prototype.getActualLength = function (len) {\n return len;\n};\n\nreturn PromiseArray;\n};\n\n},{\"./util\":36}],24:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function(Promise, INTERNAL) {\nvar THIS = {};\nvar util = _dereq_(\"./util\");\nvar nodebackForPromise = _dereq_(\"./nodeback\");\nvar withAppended = util.withAppended;\nvar maybeWrapAsError = util.maybeWrapAsError;\nvar canEvaluate = util.canEvaluate;\nvar TypeError = _dereq_(\"./errors\").TypeError;\nvar defaultSuffix = \"Async\";\nvar defaultPromisified = {__isPromisified__: true};\nvar noCopyProps = [\n \"arity\", \"length\",\n \"name\",\n \"arguments\",\n \"caller\",\n \"callee\",\n \"prototype\",\n \"__isPromisified__\"\n];\nvar noCopyPropsPattern = new RegExp(\"^(?:\" + noCopyProps.join(\"|\") + \")$\");\n\nvar defaultFilter = function(name) {\n return util.isIdentifier(name) &&\n name.charAt(0) !== \"_\" &&\n name !== \"constructor\";\n};\n\nfunction propsFilter(key) {\n return !noCopyPropsPattern.test(key);\n}\n\nfunction isPromisified(fn) {\n try {\n return fn.__isPromisified__ === true;\n }\n catch (e) {\n return false;\n }\n}\n\nfunction hasPromisified(obj, key, suffix) {\n var val = util.getDataPropertyOrDefault(obj, key + suffix,\n defaultPromisified);\n return val ? isPromisified(val) : false;\n}\nfunction checkValid(ret, suffix, suffixRegexp) {\n for (var i = 0; i < ret.length; i += 2) {\n var key = ret[i];\n if (suffixRegexp.test(key)) {\n var keyWithoutAsyncSuffix = key.replace(suffixRegexp, \"\");\n for (var j = 0; j < ret.length; j += 2) {\n if (ret[j] === keyWithoutAsyncSuffix) {\n throw new TypeError(\"Cannot promisify an API that has normal methods with '%s'-suffix\\u000a\\u000a See http://goo.gl/MqrFmX\\u000a\"\n .replace(\"%s\", suffix));\n }\n }\n }\n }\n}\n\nfunction promisifiableMethods(obj, suffix, suffixRegexp, filter) {\n var keys = util.inheritedDataKeys(obj);\n var ret = [];\n for (var i = 0; i < keys.length; ++i) {\n var key = keys[i];\n var value = obj[key];\n var passesDefaultFilter = filter === defaultFilter\n ? true : defaultFilter(key, value, obj);\n if (typeof value === \"function\" &&\n !isPromisified(value) &&\n !hasPromisified(obj, key, suffix) &&\n filter(key, value, obj, passesDefaultFilter)) {\n ret.push(key, value);\n }\n }\n checkValid(ret, suffix, suffixRegexp);\n return ret;\n}\n\nvar escapeIdentRegex = function(str) {\n return str.replace(/([$])/, \"\\\\$\");\n};\n\nvar makeNodePromisifiedEval;\nif (!true) {\nvar switchCaseArgumentOrder = function(likelyArgumentCount) {\n var ret = [likelyArgumentCount];\n var min = Math.max(0, likelyArgumentCount - 1 - 3);\n for(var i = likelyArgumentCount - 1; i >= min; --i) {\n ret.push(i);\n }\n for(var i = likelyArgumentCount + 1; i <= 3; ++i) {\n ret.push(i);\n }\n return ret;\n};\n\nvar argumentSequence = function(argumentCount) {\n return util.filledRange(argumentCount, \"_arg\", \"\");\n};\n\nvar parameterDeclaration = function(parameterCount) {\n return util.filledRange(\n Math.max(parameterCount, 3), \"_arg\", \"\");\n};\n\nvar parameterCount = function(fn) {\n if (typeof fn.length === \"number\") {\n return Math.max(Math.min(fn.length, 1023 + 1), 0);\n }\n return 0;\n};\n\nmakeNodePromisifiedEval =\nfunction(callback, receiver, originalName, fn, _, multiArgs) {\n var newParameterCount = Math.max(0, parameterCount(fn) - 1);\n var argumentOrder = switchCaseArgumentOrder(newParameterCount);\n var shouldProxyThis = typeof callback === \"string\" || receiver === THIS;\n\n function generateCallForArgumentCount(count) {\n var args = argumentSequence(count).join(\", \");\n var comma = count > 0 ? \", \" : \"\";\n var ret;\n if (shouldProxyThis) {\n ret = \"ret = callback.call(this, {{args}}, nodeback); break;\\n\";\n } else {\n ret = receiver === undefined\n ? \"ret = callback({{args}}, nodeback); break;\\n\"\n : \"ret = callback.call(receiver, {{args}}, nodeback); break;\\n\";\n }\n return ret.replace(\"{{args}}\", args).replace(\", \", comma);\n }\n\n function generateArgumentSwitchCase() {\n var ret = \"\";\n for (var i = 0; i < argumentOrder.length; ++i) {\n ret += \"case \" + argumentOrder[i] +\":\" +\n generateCallForArgumentCount(argumentOrder[i]);\n }\n\n ret += \" \\n\\\n default: \\n\\\n var args = new Array(len + 1); \\n\\\n var i = 0; \\n\\\n for (var i = 0; i < len; ++i) { \\n\\\n args[i] = arguments[i]; \\n\\\n } \\n\\\n args[i] = nodeback; \\n\\\n [CodeForCall] \\n\\\n break; \\n\\\n \".replace(\"[CodeForCall]\", (shouldProxyThis\n ? \"ret = callback.apply(this, args);\\n\"\n : \"ret = callback.apply(receiver, args);\\n\"));\n return ret;\n }\n\n var getFunctionCode = typeof callback === \"string\"\n ? (\"this != null ? this['\"+callback+\"'] : fn\")\n : \"fn\";\n var body = \"'use strict'; \\n\\\n var ret = function (Parameters) { \\n\\\n 'use strict'; \\n\\\n var len = arguments.length; \\n\\\n var promise = new Promise(INTERNAL); \\n\\\n promise._captureStackTrace(); \\n\\\n var nodeback = nodebackForPromise(promise, \" + multiArgs + \"); \\n\\\n var ret; \\n\\\n var callback = tryCatch([GetFunctionCode]); \\n\\\n switch(len) { \\n\\\n [CodeForSwitchCase] \\n\\\n } \\n\\\n if (ret === errorObj) { \\n\\\n promise._rejectCallback(maybeWrapAsError(ret.e), true, true);\\n\\\n } \\n\\\n if (!promise._isFateSealed()) promise._setAsyncGuaranteed(); \\n\\\n return promise; \\n\\\n }; \\n\\\n notEnumerableProp(ret, '__isPromisified__', true); \\n\\\n return ret; \\n\\\n \".replace(\"[CodeForSwitchCase]\", generateArgumentSwitchCase())\n .replace(\"[GetFunctionCode]\", getFunctionCode);\n body = body.replace(\"Parameters\", parameterDeclaration(newParameterCount));\n return new Function(\"Promise\",\n \"fn\",\n \"receiver\",\n \"withAppended\",\n \"maybeWrapAsError\",\n \"nodebackForPromise\",\n \"tryCatch\",\n \"errorObj\",\n \"notEnumerableProp\",\n \"INTERNAL\",\n body)(\n Promise,\n fn,\n receiver,\n withAppended,\n maybeWrapAsError,\n nodebackForPromise,\n util.tryCatch,\n util.errorObj,\n util.notEnumerableProp,\n INTERNAL);\n};\n}\n\nfunction makeNodePromisifiedClosure(callback, receiver, _, fn, __, multiArgs) {\n var defaultThis = (function() {return this;})();\n var method = callback;\n if (typeof method === \"string\") {\n callback = fn;\n }\n function promisified() {\n var _receiver = receiver;\n if (receiver === THIS) _receiver = this;\n var promise = new Promise(INTERNAL);\n promise._captureStackTrace();\n var cb = typeof method === \"string\" && this !== defaultThis\n ? this[method] : callback;\n var fn = nodebackForPromise(promise, multiArgs);\n try {\n cb.apply(_receiver, withAppended(arguments, fn));\n } catch(e) {\n promise._rejectCallback(maybeWrapAsError(e), true, true);\n }\n if (!promise._isFateSealed()) promise._setAsyncGuaranteed();\n return promise;\n }\n util.notEnumerableProp(promisified, \"__isPromisified__\", true);\n return promisified;\n}\n\nvar makeNodePromisified = canEvaluate\n ? makeNodePromisifiedEval\n : makeNodePromisifiedClosure;\n\nfunction promisifyAll(obj, suffix, filter, promisifier, multiArgs) {\n var suffixRegexp = new RegExp(escapeIdentRegex(suffix) + \"$\");\n var methods =\n promisifiableMethods(obj, suffix, suffixRegexp, filter);\n\n for (var i = 0, len = methods.length; i < len; i+= 2) {\n var key = methods[i];\n var fn = methods[i+1];\n var promisifiedKey = key + suffix;\n if (promisifier === makeNodePromisified) {\n obj[promisifiedKey] =\n makeNodePromisified(key, THIS, key, fn, suffix, multiArgs);\n } else {\n var promisified = promisifier(fn, function() {\n return makeNodePromisified(key, THIS, key,\n fn, suffix, multiArgs);\n });\n util.notEnumerableProp(promisified, \"__isPromisified__\", true);\n obj[promisifiedKey] = promisified;\n }\n }\n util.toFastProperties(obj);\n return obj;\n}\n\nfunction promisify(callback, receiver, multiArgs) {\n return makeNodePromisified(callback, receiver, undefined,\n callback, null, multiArgs);\n}\n\nPromise.promisify = function (fn, options) {\n if (typeof fn !== \"function\") {\n throw new TypeError(\"expecting a function but got \" + util.classString(fn));\n }\n if (isPromisified(fn)) {\n return fn;\n }\n options = Object(options);\n var receiver = options.context === undefined ? THIS : options.context;\n var multiArgs = !!options.multiArgs;\n var ret = promisify(fn, receiver, multiArgs);\n util.copyDescriptors(fn, ret, propsFilter);\n return ret;\n};\n\nPromise.promisifyAll = function (target, options) {\n if (typeof target !== \"function\" && typeof target !== \"object\") {\n throw new TypeError(\"the target of promisifyAll must be an object or a function\\u000a\\u000a See http://goo.gl/MqrFmX\\u000a\");\n }\n options = Object(options);\n var multiArgs = !!options.multiArgs;\n var suffix = options.suffix;\n if (typeof suffix !== \"string\") suffix = defaultSuffix;\n var filter = options.filter;\n if (typeof filter !== \"function\") filter = defaultFilter;\n var promisifier = options.promisifier;\n if (typeof promisifier !== \"function\") promisifier = makeNodePromisified;\n\n if (!util.isIdentifier(suffix)) {\n throw new RangeError(\"suffix must be a valid identifier\\u000a\\u000a See http://goo.gl/MqrFmX\\u000a\");\n }\n\n var keys = util.inheritedDataKeys(target);\n for (var i = 0; i < keys.length; ++i) {\n var value = target[keys[i]];\n if (keys[i] !== \"constructor\" &&\n util.isClass(value)) {\n promisifyAll(value.prototype, suffix, filter, promisifier,\n multiArgs);\n promisifyAll(value, suffix, filter, promisifier, multiArgs);\n }\n }\n\n return promisifyAll(target, suffix, filter, promisifier, multiArgs);\n};\n};\n\n\n},{\"./errors\":12,\"./nodeback\":20,\"./util\":36}],25:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function(\n Promise, PromiseArray, tryConvertToPromise, apiRejection) {\nvar util = _dereq_(\"./util\");\nvar isObject = util.isObject;\nvar es5 = _dereq_(\"./es5\");\nvar Es6Map;\nif (typeof Map === \"function\") Es6Map = Map;\n\nvar mapToEntries = (function() {\n var index = 0;\n var size = 0;\n\n function extractEntry(value, key) {\n this[index] = value;\n this[index + size] = key;\n index++;\n }\n\n return function mapToEntries(map) {\n size = map.size;\n index = 0;\n var ret = new Array(map.size * 2);\n map.forEach(extractEntry, ret);\n return ret;\n };\n})();\n\nvar entriesToMap = function(entries) {\n var ret = new Es6Map();\n var length = entries.length / 2 | 0;\n for (var i = 0; i < length; ++i) {\n var key = entries[length + i];\n var value = entries[i];\n ret.set(key, value);\n }\n return ret;\n};\n\nfunction PropertiesPromiseArray(obj) {\n var isMap = false;\n var entries;\n if (Es6Map !== undefined && obj instanceof Es6Map) {\n entries = mapToEntries(obj);\n isMap = true;\n } else {\n var keys = es5.keys(obj);\n var len = keys.length;\n entries = new Array(len * 2);\n for (var i = 0; i < len; ++i) {\n var key = keys[i];\n entries[i] = obj[key];\n entries[i + len] = key;\n }\n }\n this.constructor$(entries);\n this._isMap = isMap;\n this._init$(undefined, isMap ? -6 : -3);\n}\nutil.inherits(PropertiesPromiseArray, PromiseArray);\n\nPropertiesPromiseArray.prototype._init = function () {};\n\nPropertiesPromiseArray.prototype._promiseFulfilled = function (value, index) {\n this._values[index] = value;\n var totalResolved = ++this._totalResolved;\n if (totalResolved >= this._length) {\n var val;\n if (this._isMap) {\n val = entriesToMap(this._values);\n } else {\n val = {};\n var keyOffset = this.length();\n for (var i = 0, len = this.length(); i < len; ++i) {\n val[this._values[i + keyOffset]] = this._values[i];\n }\n }\n this._resolve(val);\n return true;\n }\n return false;\n};\n\nPropertiesPromiseArray.prototype.shouldCopyValues = function () {\n return false;\n};\n\nPropertiesPromiseArray.prototype.getActualLength = function (len) {\n return len >> 1;\n};\n\nfunction props(promises) {\n var ret;\n var castValue = tryConvertToPromise(promises);\n\n if (!isObject(castValue)) {\n return apiRejection(\"cannot await properties of a non-object\\u000a\\u000a See http://goo.gl/MqrFmX\\u000a\");\n } else if (castValue instanceof Promise) {\n ret = castValue._then(\n Promise.props, undefined, undefined, undefined, undefined);\n } else {\n ret = new PropertiesPromiseArray(castValue).promise();\n }\n\n if (castValue instanceof Promise) {\n ret._propagateFrom(castValue, 2);\n }\n return ret;\n}\n\nPromise.prototype.props = function () {\n return props(this);\n};\n\nPromise.props = function (promises) {\n return props(promises);\n};\n};\n\n},{\"./es5\":13,\"./util\":36}],26:[function(_dereq_,module,exports){\n\"use strict\";\nfunction arrayMove(src, srcIndex, dst, dstIndex, len) {\n for (var j = 0; j < len; ++j) {\n dst[j + dstIndex] = src[j + srcIndex];\n src[j + srcIndex] = void 0;\n }\n}\n\nfunction Queue(capacity) {\n this._capacity = capacity;\n this._length = 0;\n this._front = 0;\n}\n\nQueue.prototype._willBeOverCapacity = function (size) {\n return this._capacity < size;\n};\n\nQueue.prototype._pushOne = function (arg) {\n var length = this.length();\n this._checkCapacity(length + 1);\n var i = (this._front + length) & (this._capacity - 1);\n this[i] = arg;\n this._length = length + 1;\n};\n\nQueue.prototype.push = function (fn, receiver, arg) {\n var length = this.length() + 3;\n if (this._willBeOverCapacity(length)) {\n this._pushOne(fn);\n this._pushOne(receiver);\n this._pushOne(arg);\n return;\n }\n var j = this._front + length - 3;\n this._checkCapacity(length);\n var wrapMask = this._capacity - 1;\n this[(j + 0) & wrapMask] = fn;\n this[(j + 1) & wrapMask] = receiver;\n this[(j + 2) & wrapMask] = arg;\n this._length = length;\n};\n\nQueue.prototype.shift = function () {\n var front = this._front,\n ret = this[front];\n\n this[front] = undefined;\n this._front = (front + 1) & (this._capacity - 1);\n this._length--;\n return ret;\n};\n\nQueue.prototype.length = function () {\n return this._length;\n};\n\nQueue.prototype._checkCapacity = function (size) {\n if (this._capacity < size) {\n this._resizeTo(this._capacity << 1);\n }\n};\n\nQueue.prototype._resizeTo = function (capacity) {\n var oldCapacity = this._capacity;\n this._capacity = capacity;\n var front = this._front;\n var length = this._length;\n var moveItemsCount = (front + length) & (oldCapacity - 1);\n arrayMove(this, 0, this, oldCapacity, moveItemsCount);\n};\n\nmodule.exports = Queue;\n\n},{}],27:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function(\n Promise, INTERNAL, tryConvertToPromise, apiRejection) {\nvar util = _dereq_(\"./util\");\n\nvar raceLater = function (promise) {\n return promise.then(function(array) {\n return race(array, promise);\n });\n};\n\nfunction race(promises, parent) {\n var maybePromise = tryConvertToPromise(promises);\n\n if (maybePromise instanceof Promise) {\n return raceLater(maybePromise);\n } else {\n promises = util.asArray(promises);\n if (promises === null)\n return apiRejection(\"expecting an array or an iterable object but got \" + util.classString(promises));\n }\n\n var ret = new Promise(INTERNAL);\n if (parent !== undefined) {\n ret._propagateFrom(parent, 3);\n }\n var fulfill = ret._fulfill;\n var reject = ret._reject;\n for (var i = 0, len = promises.length; i < len; ++i) {\n var val = promises[i];\n\n if (val === undefined && !(i in promises)) {\n continue;\n }\n\n Promise.cast(val)._then(fulfill, reject, undefined, ret, null);\n }\n return ret;\n}\n\nPromise.race = function (promises) {\n return race(promises, undefined);\n};\n\nPromise.prototype.race = function () {\n return race(this, undefined);\n};\n\n};\n\n},{\"./util\":36}],28:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function(Promise,\n PromiseArray,\n apiRejection,\n tryConvertToPromise,\n INTERNAL,\n debug) {\nvar getDomain = Promise._getDomain;\nvar util = _dereq_(\"./util\");\nvar tryCatch = util.tryCatch;\n\nfunction ReductionPromiseArray(promises, fn, initialValue, _each) {\n this.constructor$(promises);\n var domain = getDomain();\n this._fn = domain === null ? fn : util.domainBind(domain, fn);\n if (initialValue !== undefined) {\n initialValue = Promise.resolve(initialValue);\n initialValue._attachCancellationCallback(this);\n }\n this._initialValue = initialValue;\n this._currentCancellable = null;\n if(_each === INTERNAL) {\n this._eachValues = Array(this._length);\n } else if (_each === 0) {\n this._eachValues = null;\n } else {\n this._eachValues = undefined;\n }\n this._promise._captureStackTrace();\n this._init$(undefined, -5);\n}\nutil.inherits(ReductionPromiseArray, PromiseArray);\n\nReductionPromiseArray.prototype._gotAccum = function(accum) {\n if (this._eachValues !== undefined && \n this._eachValues !== null && \n accum !== INTERNAL) {\n this._eachValues.push(accum);\n }\n};\n\nReductionPromiseArray.prototype._eachComplete = function(value) {\n if (this._eachValues !== null) {\n this._eachValues.push(value);\n }\n return this._eachValues;\n};\n\nReductionPromiseArray.prototype._init = function() {};\n\nReductionPromiseArray.prototype._resolveEmptyArray = function() {\n this._resolve(this._eachValues !== undefined ? this._eachValues\n : this._initialValue);\n};\n\nReductionPromiseArray.prototype.shouldCopyValues = function () {\n return false;\n};\n\nReductionPromiseArray.prototype._resolve = function(value) {\n this._promise._resolveCallback(value);\n this._values = null;\n};\n\nReductionPromiseArray.prototype._resultCancelled = function(sender) {\n if (sender === this._initialValue) return this._cancel();\n if (this._isResolved()) return;\n this._resultCancelled$();\n if (this._currentCancellable instanceof Promise) {\n this._currentCancellable.cancel();\n }\n if (this._initialValue instanceof Promise) {\n this._initialValue.cancel();\n }\n};\n\nReductionPromiseArray.prototype._iterate = function (values) {\n this._values = values;\n var value;\n var i;\n var length = values.length;\n if (this._initialValue !== undefined) {\n value = this._initialValue;\n i = 0;\n } else {\n value = Promise.resolve(values[0]);\n i = 1;\n }\n\n this._currentCancellable = value;\n\n if (!value.isRejected()) {\n for (; i < length; ++i) {\n var ctx = {\n accum: null,\n value: values[i],\n index: i,\n length: length,\n array: this\n };\n value = value._then(gotAccum, undefined, undefined, ctx, undefined);\n }\n }\n\n if (this._eachValues !== undefined) {\n value = value\n ._then(this._eachComplete, undefined, undefined, this, undefined);\n }\n value._then(completed, completed, undefined, value, this);\n};\n\nPromise.prototype.reduce = function (fn, initialValue) {\n return reduce(this, fn, initialValue, null);\n};\n\nPromise.reduce = function (promises, fn, initialValue, _each) {\n return reduce(promises, fn, initialValue, _each);\n};\n\nfunction completed(valueOrReason, array) {\n if (this.isFulfilled()) {\n array._resolve(valueOrReason);\n } else {\n array._reject(valueOrReason);\n }\n}\n\nfunction reduce(promises, fn, initialValue, _each) {\n if (typeof fn !== \"function\") {\n return apiRejection(\"expecting a function but got \" + util.classString(fn));\n }\n var array = new ReductionPromiseArray(promises, fn, initialValue, _each);\n return array.promise();\n}\n\nfunction gotAccum(accum) {\n this.accum = accum;\n this.array._gotAccum(accum);\n var value = tryConvertToPromise(this.value, this.array._promise);\n if (value instanceof Promise) {\n this.array._currentCancellable = value;\n return value._then(gotValue, undefined, undefined, this, undefined);\n } else {\n return gotValue.call(this, value);\n }\n}\n\nfunction gotValue(value) {\n var array = this.array;\n var promise = array._promise;\n var fn = tryCatch(array._fn);\n promise._pushContext();\n var ret;\n if (array._eachValues !== undefined) {\n ret = fn.call(promise._boundValue(), value, this.index, this.length);\n } else {\n ret = fn.call(promise._boundValue(),\n this.accum, value, this.index, this.length);\n }\n if (ret instanceof Promise) {\n array._currentCancellable = ret;\n }\n var promiseCreated = promise._popContext();\n debug.checkForgottenReturns(\n ret,\n promiseCreated,\n array._eachValues !== undefined ? \"Promise.each\" : \"Promise.reduce\",\n promise\n );\n return ret;\n}\n};\n\n},{\"./util\":36}],29:[function(_dereq_,module,exports){\n\"use strict\";\nvar util = _dereq_(\"./util\");\nvar schedule;\nvar noAsyncScheduler = function() {\n throw new Error(\"No async scheduler available\\u000a\\u000a See http://goo.gl/MqrFmX\\u000a\");\n};\nvar NativePromise = util.getNativePromise();\nif (util.isNode && typeof MutationObserver === \"undefined\") {\n var GlobalSetImmediate = global.setImmediate;\n var ProcessNextTick = process.nextTick;\n schedule = util.isRecentNode\n ? function(fn) { GlobalSetImmediate.call(global, fn); }\n : function(fn) { ProcessNextTick.call(process, fn); };\n} else if (typeof NativePromise === \"function\" &&\n typeof NativePromise.resolve === \"function\") {\n var nativePromise = NativePromise.resolve();\n schedule = function(fn) {\n nativePromise.then(fn);\n };\n} else if ((typeof MutationObserver !== \"undefined\") &&\n !(typeof window !== \"undefined\" &&\n window.navigator &&\n (window.navigator.standalone || window.cordova))) {\n schedule = (function() {\n var div = document.createElement(\"div\");\n var opts = {attributes: true};\n var toggleScheduled = false;\n var div2 = document.createElement(\"div\");\n var o2 = new MutationObserver(function() {\n div.classList.toggle(\"foo\");\n toggleScheduled = false;\n });\n o2.observe(div2, opts);\n\n var scheduleToggle = function() {\n if (toggleScheduled) return;\n toggleScheduled = true;\n div2.classList.toggle(\"foo\");\n };\n\n return function schedule(fn) {\n var o = new MutationObserver(function() {\n o.disconnect();\n fn();\n });\n o.observe(div, opts);\n scheduleToggle();\n };\n })();\n} else if (typeof setImmediate !== \"undefined\") {\n schedule = function (fn) {\n setImmediate(fn);\n };\n} else if (typeof setTimeout !== \"undefined\") {\n schedule = function (fn) {\n setTimeout(fn, 0);\n };\n} else {\n schedule = noAsyncScheduler;\n}\nmodule.exports = schedule;\n\n},{\"./util\":36}],30:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports =\n function(Promise, PromiseArray, debug) {\nvar PromiseInspection = Promise.PromiseInspection;\nvar util = _dereq_(\"./util\");\n\nfunction SettledPromiseArray(values) {\n this.constructor$(values);\n}\nutil.inherits(SettledPromiseArray, PromiseArray);\n\nSettledPromiseArray.prototype._promiseResolved = function (index, inspection) {\n this._values[index] = inspection;\n var totalResolved = ++this._totalResolved;\n if (totalResolved >= this._length) {\n this._resolve(this._values);\n return true;\n }\n return false;\n};\n\nSettledPromiseArray.prototype._promiseFulfilled = function (value, index) {\n var ret = new PromiseInspection();\n ret._bitField = 33554432;\n ret._settledValueField = value;\n return this._promiseResolved(index, ret);\n};\nSettledPromiseArray.prototype._promiseRejected = function (reason, index) {\n var ret = new PromiseInspection();\n ret._bitField = 16777216;\n ret._settledValueField = reason;\n return this._promiseResolved(index, ret);\n};\n\nPromise.settle = function (promises) {\n debug.deprecated(\".settle()\", \".reflect()\");\n return new SettledPromiseArray(promises).promise();\n};\n\nPromise.prototype.settle = function () {\n return Promise.settle(this);\n};\n};\n\n},{\"./util\":36}],31:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports =\nfunction(Promise, PromiseArray, apiRejection) {\nvar util = _dereq_(\"./util\");\nvar RangeError = _dereq_(\"./errors\").RangeError;\nvar AggregateError = _dereq_(\"./errors\").AggregateError;\nvar isArray = util.isArray;\nvar CANCELLATION = {};\n\n\nfunction SomePromiseArray(values) {\n this.constructor$(values);\n this._howMany = 0;\n this._unwrap = false;\n this._initialized = false;\n}\nutil.inherits(SomePromiseArray, PromiseArray);\n\nSomePromiseArray.prototype._init = function () {\n if (!this._initialized) {\n return;\n }\n if (this._howMany === 0) {\n this._resolve([]);\n return;\n }\n this._init$(undefined, -5);\n var isArrayResolved = isArray(this._values);\n if (!this._isResolved() &&\n isArrayResolved &&\n this._howMany > this._canPossiblyFulfill()) {\n this._reject(this._getRangeError(this.length()));\n }\n};\n\nSomePromiseArray.prototype.init = function () {\n this._initialized = true;\n this._init();\n};\n\nSomePromiseArray.prototype.setUnwrap = function () {\n this._unwrap = true;\n};\n\nSomePromiseArray.prototype.howMany = function () {\n return this._howMany;\n};\n\nSomePromiseArray.prototype.setHowMany = function (count) {\n this._howMany = count;\n};\n\nSomePromiseArray.prototype._promiseFulfilled = function (value) {\n this._addFulfilled(value);\n if (this._fulfilled() === this.howMany()) {\n this._values.length = this.howMany();\n if (this.howMany() === 1 && this._unwrap) {\n this._resolve(this._values[0]);\n } else {\n this._resolve(this._values);\n }\n return true;\n }\n return false;\n\n};\nSomePromiseArray.prototype._promiseRejected = function (reason) {\n this._addRejected(reason);\n return this._checkOutcome();\n};\n\nSomePromiseArray.prototype._promiseCancelled = function () {\n if (this._values instanceof Promise || this._values == null) {\n return this._cancel();\n }\n this._addRejected(CANCELLATION);\n return this._checkOutcome();\n};\n\nSomePromiseArray.prototype._checkOutcome = function() {\n if (this.howMany() > this._canPossiblyFulfill()) {\n var e = new AggregateError();\n for (var i = this.length(); i < this._values.length; ++i) {\n if (this._values[i] !== CANCELLATION) {\n e.push(this._values[i]);\n }\n }\n if (e.length > 0) {\n this._reject(e);\n } else {\n this._cancel();\n }\n return true;\n }\n return false;\n};\n\nSomePromiseArray.prototype._fulfilled = function () {\n return this._totalResolved;\n};\n\nSomePromiseArray.prototype._rejected = function () {\n return this._values.length - this.length();\n};\n\nSomePromiseArray.prototype._addRejected = function (reason) {\n this._values.push(reason);\n};\n\nSomePromiseArray.prototype._addFulfilled = function (value) {\n this._values[this._totalResolved++] = value;\n};\n\nSomePromiseArray.prototype._canPossiblyFulfill = function () {\n return this.length() - this._rejected();\n};\n\nSomePromiseArray.prototype._getRangeError = function (count) {\n var message = \"Input array must contain at least \" +\n this._howMany + \" items but contains only \" + count + \" items\";\n return new RangeError(message);\n};\n\nSomePromiseArray.prototype._resolveEmptyArray = function () {\n this._reject(this._getRangeError(0));\n};\n\nfunction some(promises, howMany) {\n if ((howMany | 0) !== howMany || howMany < 0) {\n return apiRejection(\"expecting a positive integer\\u000a\\u000a See http://goo.gl/MqrFmX\\u000a\");\n }\n var ret = new SomePromiseArray(promises);\n var promise = ret.promise();\n ret.setHowMany(howMany);\n ret.init();\n return promise;\n}\n\nPromise.some = function (promises, howMany) {\n return some(promises, howMany);\n};\n\nPromise.prototype.some = function (howMany) {\n return some(this, howMany);\n};\n\nPromise._SomePromiseArray = SomePromiseArray;\n};\n\n},{\"./errors\":12,\"./util\":36}],32:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function(Promise) {\nfunction PromiseInspection(promise) {\n if (promise !== undefined) {\n promise = promise._target();\n this._bitField = promise._bitField;\n this._settledValueField = promise._isFateSealed()\n ? promise._settledValue() : undefined;\n }\n else {\n this._bitField = 0;\n this._settledValueField = undefined;\n }\n}\n\nPromiseInspection.prototype._settledValue = function() {\n return this._settledValueField;\n};\n\nvar value = PromiseInspection.prototype.value = function () {\n if (!this.isFulfilled()) {\n throw new TypeError(\"cannot get fulfillment value of a non-fulfilled promise\\u000a\\u000a See http://goo.gl/MqrFmX\\u000a\");\n }\n return this._settledValue();\n};\n\nvar reason = PromiseInspection.prototype.error =\nPromiseInspection.prototype.reason = function () {\n if (!this.isRejected()) {\n throw new TypeError(\"cannot get rejection reason of a non-rejected promise\\u000a\\u000a See http://goo.gl/MqrFmX\\u000a\");\n }\n return this._settledValue();\n};\n\nvar isFulfilled = PromiseInspection.prototype.isFulfilled = function() {\n return (this._bitField & 33554432) !== 0;\n};\n\nvar isRejected = PromiseInspection.prototype.isRejected = function () {\n return (this._bitField & 16777216) !== 0;\n};\n\nvar isPending = PromiseInspection.prototype.isPending = function () {\n return (this._bitField & 50397184) === 0;\n};\n\nvar isResolved = PromiseInspection.prototype.isResolved = function () {\n return (this._bitField & 50331648) !== 0;\n};\n\nPromiseInspection.prototype.isCancelled = function() {\n return (this._bitField & 8454144) !== 0;\n};\n\nPromise.prototype.__isCancelled = function() {\n return (this._bitField & 65536) === 65536;\n};\n\nPromise.prototype._isCancelled = function() {\n return this._target().__isCancelled();\n};\n\nPromise.prototype.isCancelled = function() {\n return (this._target()._bitField & 8454144) !== 0;\n};\n\nPromise.prototype.isPending = function() {\n return isPending.call(this._target());\n};\n\nPromise.prototype.isRejected = function() {\n return isRejected.call(this._target());\n};\n\nPromise.prototype.isFulfilled = function() {\n return isFulfilled.call(this._target());\n};\n\nPromise.prototype.isResolved = function() {\n return isResolved.call(this._target());\n};\n\nPromise.prototype.value = function() {\n return value.call(this._target());\n};\n\nPromise.prototype.reason = function() {\n var target = this._target();\n target._unsetRejectionIsUnhandled();\n return reason.call(target);\n};\n\nPromise.prototype._value = function() {\n return this._settledValue();\n};\n\nPromise.prototype._reason = function() {\n this._unsetRejectionIsUnhandled();\n return this._settledValue();\n};\n\nPromise.PromiseInspection = PromiseInspection;\n};\n\n},{}],33:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function(Promise, INTERNAL) {\nvar util = _dereq_(\"./util\");\nvar errorObj = util.errorObj;\nvar isObject = util.isObject;\n\nfunction tryConvertToPromise(obj, context) {\n if (isObject(obj)) {\n if (obj instanceof Promise) return obj;\n var then = getThen(obj);\n if (then === errorObj) {\n if (context) context._pushContext();\n var ret = Promise.reject(then.e);\n if (context) context._popContext();\n return ret;\n } else if (typeof then === \"function\") {\n if (isAnyBluebirdPromise(obj)) {\n var ret = new Promise(INTERNAL);\n obj._then(\n ret._fulfill,\n ret._reject,\n undefined,\n ret,\n null\n );\n return ret;\n }\n return doThenable(obj, then, context);\n }\n }\n return obj;\n}\n\nfunction doGetThen(obj) {\n return obj.then;\n}\n\nfunction getThen(obj) {\n try {\n return doGetThen(obj);\n } catch (e) {\n errorObj.e = e;\n return errorObj;\n }\n}\n\nvar hasProp = {}.hasOwnProperty;\nfunction isAnyBluebirdPromise(obj) {\n try {\n return hasProp.call(obj, \"_promise0\");\n } catch (e) {\n return false;\n }\n}\n\nfunction doThenable(x, then, context) {\n var promise = new Promise(INTERNAL);\n var ret = promise;\n if (context) context._pushContext();\n promise._captureStackTrace();\n if (context) context._popContext();\n var synchronous = true;\n var result = util.tryCatch(then).call(x, resolve, reject);\n synchronous = false;\n\n if (promise && result === errorObj) {\n promise._rejectCallback(result.e, true, true);\n promise = null;\n }\n\n function resolve(value) {\n if (!promise) return;\n promise._resolveCallback(value);\n promise = null;\n }\n\n function reject(reason) {\n if (!promise) return;\n promise._rejectCallback(reason, synchronous, true);\n promise = null;\n }\n return ret;\n}\n\nreturn tryConvertToPromise;\n};\n\n},{\"./util\":36}],34:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function(Promise, INTERNAL, debug) {\nvar util = _dereq_(\"./util\");\nvar TimeoutError = Promise.TimeoutError;\n\nfunction HandleWrapper(handle) {\n this.handle = handle;\n}\n\nHandleWrapper.prototype._resultCancelled = function() {\n clearTimeout(this.handle);\n};\n\nvar afterValue = function(value) { return delay(+this).thenReturn(value); };\nvar delay = Promise.delay = function (ms, value) {\n var ret;\n var handle;\n if (value !== undefined) {\n ret = Promise.resolve(value)\n ._then(afterValue, null, null, ms, undefined);\n if (debug.cancellation() && value instanceof Promise) {\n ret._setOnCancel(value);\n }\n } else {\n ret = new Promise(INTERNAL);\n handle = setTimeout(function() { ret._fulfill(); }, +ms);\n if (debug.cancellation()) {\n ret._setOnCancel(new HandleWrapper(handle));\n }\n ret._captureStackTrace();\n }\n ret._setAsyncGuaranteed();\n return ret;\n};\n\nPromise.prototype.delay = function (ms) {\n return delay(ms, this);\n};\n\nvar afterTimeout = function (promise, message, parent) {\n var err;\n if (typeof message !== \"string\") {\n if (message instanceof Error) {\n err = message;\n } else {\n err = new TimeoutError(\"operation timed out\");\n }\n } else {\n err = new TimeoutError(message);\n }\n util.markAsOriginatingFromRejection(err);\n promise._attachExtraTrace(err);\n promise._reject(err);\n\n if (parent != null) {\n parent.cancel();\n }\n};\n\nfunction successClear(value) {\n clearTimeout(this.handle);\n return value;\n}\n\nfunction failureClear(reason) {\n clearTimeout(this.handle);\n throw reason;\n}\n\nPromise.prototype.timeout = function (ms, message) {\n ms = +ms;\n var ret, parent;\n\n var handleWrapper = new HandleWrapper(setTimeout(function timeoutTimeout() {\n if (ret.isPending()) {\n afterTimeout(ret, message, parent);\n }\n }, ms));\n\n if (debug.cancellation()) {\n parent = this.then();\n ret = parent._then(successClear, failureClear,\n undefined, handleWrapper, undefined);\n ret._setOnCancel(handleWrapper);\n } else {\n ret = this._then(successClear, failureClear,\n undefined, handleWrapper, undefined);\n }\n\n return ret;\n};\n\n};\n\n},{\"./util\":36}],35:[function(_dereq_,module,exports){\n\"use strict\";\nmodule.exports = function (Promise, apiRejection, tryConvertToPromise,\n createContext, INTERNAL, debug) {\n var util = _dereq_(\"./util\");\n var TypeError = _dereq_(\"./errors\").TypeError;\n var inherits = _dereq_(\"./util\").inherits;\n var errorObj = util.errorObj;\n var tryCatch = util.tryCatch;\n var NULL = {};\n\n function thrower(e) {\n setTimeout(function(){throw e;}, 0);\n }\n\n function castPreservingDisposable(thenable) {\n var maybePromise = tryConvertToPromise(thenable);\n if (maybePromise !== thenable &&\n typeof thenable._isDisposable === \"function\" &&\n typeof thenable._getDisposer === \"function\" &&\n thenable._isDisposable()) {\n maybePromise._setDisposable(thenable._getDisposer());\n }\n return maybePromise;\n }\n function dispose(resources, inspection) {\n var i = 0;\n var len = resources.length;\n var ret = new Promise(INTERNAL);\n function iterator() {\n if (i >= len) return ret._fulfill();\n var maybePromise = castPreservingDisposable(resources[i++]);\n if (maybePromise instanceof Promise &&\n maybePromise._isDisposable()) {\n try {\n maybePromise = tryConvertToPromise(\n maybePromise._getDisposer().tryDispose(inspection),\n resources.promise);\n } catch (e) {\n return thrower(e);\n }\n if (maybePromise instanceof Promise) {\n return maybePromise._then(iterator, thrower,\n null, null, null);\n }\n }\n iterator();\n }\n iterator();\n return ret;\n }\n\n function Disposer(data, promise, context) {\n this._data = data;\n this._promise = promise;\n this._context = context;\n }\n\n Disposer.prototype.data = function () {\n return this._data;\n };\n\n Disposer.prototype.promise = function () {\n return this._promise;\n };\n\n Disposer.prototype.resource = function () {\n if (this.promise().isFulfilled()) {\n return this.promise().value();\n }\n return NULL;\n };\n\n Disposer.prototype.tryDispose = function(inspection) {\n var resource = this.resource();\n var context = this._context;\n if (context !== undefined) context._pushContext();\n var ret = resource !== NULL\n ? this.doDispose(resource, inspection) : null;\n if (context !== undefined) context._popContext();\n this._promise._unsetDisposable();\n this._data = null;\n return ret;\n };\n\n Disposer.isDisposer = function (d) {\n return (d != null &&\n typeof d.resource === \"function\" &&\n typeof d.tryDispose === \"function\");\n };\n\n function FunctionDisposer(fn, promise, context) {\n this.constructor$(fn, promise, context);\n }\n inherits(FunctionDisposer, Disposer);\n\n FunctionDisposer.prototype.doDispose = function (resource, inspection) {\n var fn = this.data();\n return fn.call(resource, resource, inspection);\n };\n\n function maybeUnwrapDisposer(value) {\n if (Disposer.isDisposer(value)) {\n this.resources[this.index]._setDisposable(value);\n return value.promise();\n }\n return value;\n }\n\n function ResourceList(length) {\n this.length = length;\n this.promise = null;\n this[length-1] = null;\n }\n\n ResourceList.prototype._resultCancelled = function() {\n var len = this.length;\n for (var i = 0; i < len; ++i) {\n var item = this[i];\n if (item instanceof Promise) {\n item.cancel();\n }\n }\n };\n\n Promise.using = function () {\n var len = arguments.length;\n if (len < 2) return apiRejection(\n \"you must pass at least 2 arguments to Promise.using\");\n var fn = arguments[len - 1];\n if (typeof fn !== \"function\") {\n return apiRejection(\"expecting a function but got \" + util.classString(fn));\n }\n var input;\n var spreadArgs = true;\n if (len === 2 && Array.isArray(arguments[0])) {\n input = arguments[0];\n len = input.length;\n spreadArgs = false;\n } else {\n input = arguments;\n len--;\n }\n var resources = new ResourceList(len);\n for (var i = 0; i < len; ++i) {\n var resource = input[i];\n if (Disposer.isDisposer(resource)) {\n var disposer = resource;\n resource = resource.promise();\n resource._setDisposable(disposer);\n } else {\n var maybePromise = tryConvertToPromise(resource);\n if (maybePromise instanceof Promise) {\n resource =\n maybePromise._then(maybeUnwrapDisposer, null, null, {\n resources: resources,\n index: i\n }, undefined);\n }\n }\n resources[i] = resource;\n }\n\n var reflectedResources = new Array(resources.length);\n for (var i = 0; i < reflectedResources.length; ++i) {\n reflectedResources[i] = Promise.resolve(resources[i]).reflect();\n }\n\n var resultPromise = Promise.all(reflectedResources)\n .then(function(inspections) {\n for (var i = 0; i < inspections.length; ++i) {\n var inspection = inspections[i];\n if (inspection.isRejected()) {\n errorObj.e = inspection.error();\n return errorObj;\n } else if (!inspection.isFulfilled()) {\n resultPromise.cancel();\n return;\n }\n inspections[i] = inspection.value();\n }\n promise._pushContext();\n\n fn = tryCatch(fn);\n var ret = spreadArgs\n ? fn.apply(undefined, inspections) : fn(inspections);\n var promiseCreated = promise._popContext();\n debug.checkForgottenReturns(\n ret, promiseCreated, \"Promise.using\", promise);\n return ret;\n });\n\n var promise = resultPromise.lastly(function() {\n var inspection = new Promise.PromiseInspection(resultPromise);\n return dispose(resources, inspection);\n });\n resources.promise = promise;\n promise._setOnCancel(resources);\n return promise;\n };\n\n Promise.prototype._setDisposable = function (disposer) {\n this._bitField = this._bitField | 131072;\n this._disposer = disposer;\n };\n\n Promise.prototype._isDisposable = function () {\n return (this._bitField & 131072) > 0;\n };\n\n Promise.prototype._getDisposer = function () {\n return this._disposer;\n };\n\n Promise.prototype._unsetDisposable = function () {\n this._bitField = this._bitField & (~131072);\n this._disposer = undefined;\n };\n\n Promise.prototype.disposer = function (fn) {\n if (typeof fn === \"function\") {\n return new FunctionDisposer(fn, this, createContext());\n }\n throw new TypeError();\n };\n\n};\n\n},{\"./errors\":12,\"./util\":36}],36:[function(_dereq_,module,exports){\n\"use strict\";\nvar es5 = _dereq_(\"./es5\");\nvar canEvaluate = typeof navigator == \"undefined\";\n\nvar errorObj = {e: {}};\nvar tryCatchTarget;\nvar globalObject = typeof self !== \"undefined\" ? self :\n typeof window !== \"undefined\" ? window :\n typeof global !== \"undefined\" ? global :\n this !== undefined ? this : null;\n\nfunction tryCatcher() {\n try {\n var target = tryCatchTarget;\n tryCatchTarget = null;\n return target.apply(this, arguments);\n } catch (e) {\n errorObj.e = e;\n return errorObj;\n }\n}\nfunction tryCatch(fn) {\n tryCatchTarget = fn;\n return tryCatcher;\n}\n\nvar inherits = function(Child, Parent) {\n var hasProp = {}.hasOwnProperty;\n\n function T() {\n this.constructor = Child;\n this.constructor$ = Parent;\n for (var propertyName in Parent.prototype) {\n if (hasProp.call(Parent.prototype, propertyName) &&\n propertyName.charAt(propertyName.length-1) !== \"$\"\n ) {\n this[propertyName + \"$\"] = Parent.prototype[propertyName];\n }\n }\n }\n T.prototype = Parent.prototype;\n Child.prototype = new T();\n return Child.prototype;\n};\n\n\nfunction isPrimitive(val) {\n return val == null || val === true || val === false ||\n typeof val === \"string\" || typeof val === \"number\";\n\n}\n\nfunction isObject(value) {\n return typeof value === \"function\" ||\n typeof value === \"object\" && value !== null;\n}\n\nfunction maybeWrapAsError(maybeError) {\n if (!isPrimitive(maybeError)) return maybeError;\n\n return new Error(safeToString(maybeError));\n}\n\nfunction withAppended(target, appendee) {\n var len = target.length;\n var ret = new Array(len + 1);\n var i;\n for (i = 0; i < len; ++i) {\n ret[i] = target[i];\n }\n ret[i] = appendee;\n return ret;\n}\n\nfunction getDataPropertyOrDefault(obj, key, defaultValue) {\n if (es5.isES5) {\n var desc = Object.getOwnPropertyDescriptor(obj, key);\n\n if (desc != null) {\n return desc.get == null && desc.set == null\n ? desc.value\n : defaultValue;\n }\n } else {\n return {}.hasOwnProperty.call(obj, key) ? obj[key] : undefined;\n }\n}\n\nfunction notEnumerableProp(obj, name, value) {\n if (isPrimitive(obj)) return obj;\n var descriptor = {\n value: value,\n configurable: true,\n enumerable: false,\n writable: true\n };\n es5.defineProperty(obj, name, descriptor);\n return obj;\n}\n\nfunction thrower(r) {\n throw r;\n}\n\nvar inheritedDataKeys = (function() {\n var excludedPrototypes = [\n Array.prototype,\n Object.prototype,\n Function.prototype\n ];\n\n var isExcludedProto = function(val) {\n for (var i = 0; i < excludedPrototypes.length; ++i) {\n if (excludedPrototypes[i] === val) {\n return true;\n }\n }\n return false;\n };\n\n if (es5.isES5) {\n var getKeys = Object.getOwnPropertyNames;\n return function(obj) {\n var ret = [];\n var visitedKeys = Object.create(null);\n while (obj != null && !isExcludedProto(obj)) {\n var keys;\n try {\n keys = getKeys(obj);\n } catch (e) {\n return ret;\n }\n for (var i = 0; i < keys.length; ++i) {\n var key = keys[i];\n if (visitedKeys[key]) continue;\n visitedKeys[key] = true;\n var desc = Object.getOwnPropertyDescriptor(obj, key);\n if (desc != null && desc.get == null && desc.set == null) {\n ret.push(key);\n }\n }\n obj = es5.getPrototypeOf(obj);\n }\n return ret;\n };\n } else {\n var hasProp = {}.hasOwnProperty;\n return function(obj) {\n if (isExcludedProto(obj)) return [];\n var ret = [];\n\n /*jshint forin:false */\n enumeration: for (var key in obj) {\n if (hasProp.call(obj, key)) {\n ret.push(key);\n } else {\n for (var i = 0; i < excludedPrototypes.length; ++i) {\n if (hasProp.call(excludedPrototypes[i], key)) {\n continue enumeration;\n }\n }\n ret.push(key);\n }\n }\n return ret;\n };\n }\n\n})();\n\nvar thisAssignmentPattern = /this\\s*\\.\\s*\\S+\\s*=/;\nfunction isClass(fn) {\n try {\n if (typeof fn === \"function\") {\n var keys = es5.names(fn.prototype);\n\n var hasMethods = es5.isES5 && keys.length > 1;\n var hasMethodsOtherThanConstructor = keys.length > 0 &&\n !(keys.length === 1 && keys[0] === \"constructor\");\n var hasThisAssignmentAndStaticMethods =\n thisAssignmentPattern.test(fn + \"\") && es5.names(fn).length > 0;\n\n if (hasMethods || hasMethodsOtherThanConstructor ||\n hasThisAssignmentAndStaticMethods) {\n return true;\n }\n }\n return false;\n } catch (e) {\n return false;\n }\n}\n\nfunction toFastProperties(obj) {\n /*jshint -W027,-W055,-W031*/\n function FakeConstructor() {}\n FakeConstructor.prototype = obj;\n var l = 8;\n while (l--) new FakeConstructor();\n return obj;\n eval(obj);\n}\n\nvar rident = /^[a-z$_][a-z$_0-9]*$/i;\nfunction isIdentifier(str) {\n return rident.test(str);\n}\n\nfunction filledRange(count, prefix, suffix) {\n var ret = new Array(count);\n for(var i = 0; i < count; ++i) {\n ret[i] = prefix + i + suffix;\n }\n return ret;\n}\n\nfunction safeToString(obj) {\n try {\n return obj + \"\";\n } catch (e) {\n return \"[no string representation]\";\n }\n}\n\nfunction isError(obj) {\n return obj instanceof Error ||\n (obj !== null &&\n typeof obj === \"object\" &&\n typeof obj.message === \"string\" &&\n typeof obj.name === \"string\");\n}\n\nfunction markAsOriginatingFromRejection(e) {\n try {\n notEnumerableProp(e, \"isOperational\", true);\n }\n catch(ignore) {}\n}\n\nfunction originatesFromRejection(e) {\n if (e == null) return false;\n return ((e instanceof Error[\"__BluebirdErrorTypes__\"].OperationalError) ||\n e[\"isOperational\"] === true);\n}\n\nfunction canAttachTrace(obj) {\n return isError(obj) && es5.propertyIsWritable(obj, \"stack\");\n}\n\nvar ensureErrorObject = (function() {\n if (!(\"stack\" in new Error())) {\n return function(value) {\n if (canAttachTrace(value)) return value;\n try {throw new Error(safeToString(value));}\n catch(err) {return err;}\n };\n } else {\n return function(value) {\n if (canAttachTrace(value)) return value;\n return new Error(safeToString(value));\n };\n }\n})();\n\nfunction classString(obj) {\n return {}.toString.call(obj);\n}\n\nfunction copyDescriptors(from, to, filter) {\n var keys = es5.names(from);\n for (var i = 0; i < keys.length; ++i) {\n var key = keys[i];\n if (filter(key)) {\n try {\n es5.defineProperty(to, key, es5.getDescriptor(from, key));\n } catch (ignore) {}\n }\n }\n}\n\nvar asArray = function(v) {\n if (es5.isArray(v)) {\n return v;\n }\n return null;\n};\n\nif (typeof Symbol !== \"undefined\" && Symbol.iterator) {\n var ArrayFrom = typeof Array.from === \"function\" ? function(v) {\n return Array.from(v);\n } : function(v) {\n var ret = [];\n var it = v[Symbol.iterator]();\n var itResult;\n while (!((itResult = it.next()).done)) {\n ret.push(itResult.value);\n }\n return ret;\n };\n\n asArray = function(v) {\n if (es5.isArray(v)) {\n return v;\n } else if (v != null && typeof v[Symbol.iterator] === \"function\") {\n return ArrayFrom(v);\n }\n return null;\n };\n}\n\nvar isNode = typeof process !== \"undefined\" &&\n classString(process).toLowerCase() === \"[object process]\";\n\nvar hasEnvVariables = typeof process !== \"undefined\" &&\n typeof process.env !== \"undefined\";\n\nfunction env(key) {\n return hasEnvVariables ? process.env[key] : undefined;\n}\n\nfunction getNativePromise() {\n if (typeof Promise === \"function\") {\n try {\n var promise = new Promise(function(){});\n if ({}.toString.call(promise) === \"[object Promise]\") {\n return Promise;\n }\n } catch (e) {}\n }\n}\n\nfunction domainBind(self, cb) {\n return self.bind(cb);\n}\n\nvar ret = {\n isClass: isClass,\n isIdentifier: isIdentifier,\n inheritedDataKeys: inheritedDataKeys,\n getDataPropertyOrDefault: getDataPropertyOrDefault,\n thrower: thrower,\n isArray: es5.isArray,\n asArray: asArray,\n notEnumerableProp: notEnumerableProp,\n isPrimitive: isPrimitive,\n isObject: isObject,\n isError: isError,\n canEvaluate: canEvaluate,\n errorObj: errorObj,\n tryCatch: tryCatch,\n inherits: inherits,\n withAppended: withAppended,\n maybeWrapAsError: maybeWrapAsError,\n toFastProperties: toFastProperties,\n filledRange: filledRange,\n toString: safeToString,\n canAttachTrace: canAttachTrace,\n ensureErrorObject: ensureErrorObject,\n originatesFromRejection: originatesFromRejection,\n markAsOriginatingFromRejection: markAsOriginatingFromRejection,\n classString: classString,\n copyDescriptors: copyDescriptors,\n hasDevTools: typeof chrome !== \"undefined\" && chrome &&\n typeof chrome.loadTimes === \"function\",\n isNode: isNode,\n hasEnvVariables: hasEnvVariables,\n env: env,\n global: globalObject,\n getNativePromise: getNativePromise,\n domainBind: domainBind\n};\nret.isRecentNode = ret.isNode && (function() {\n var version = process.versions.node.split(\".\").map(Number);\n return (version[0] === 0 && version[1] > 10) || (version[0] > 0);\n})();\n\nif (ret.isNode) ret.toFastProperties(process);\n\ntry {throw new Error(); } catch (e) {ret.lastLineError = e;}\nmodule.exports = ret;\n\n},{\"./es5\":13}]},{},[4])(4)\n}); ;if (typeof window !== 'undefined' && window !== null) { window.P = window.Promise; } else if (typeof self !== 'undefined' && self !== null) { self.P = self.Promise; }","(function(self) {\n 'use strict';\n\n if (self.fetch) {\n return\n }\n\n var support = {\n searchParams: 'URLSearchParams' in self,\n iterable: 'Symbol' in self && 'iterator' in Symbol,\n blob: 'FileReader' in self && 'Blob' in self && (function() {\n try {\n new Blob()\n return true\n } catch(e) {\n return false\n }\n })(),\n formData: 'FormData' in self,\n arrayBuffer: 'ArrayBuffer' in self\n }\n\n if (support.arrayBuffer) {\n var viewClasses = [\n '[object Int8Array]',\n '[object Uint8Array]',\n '[object Uint8ClampedArray]',\n '[object Int16Array]',\n '[object Uint16Array]',\n '[object Int32Array]',\n '[object Uint32Array]',\n '[object Float32Array]',\n '[object Float64Array]'\n ]\n\n var isDataView = function(obj) {\n return obj && DataView.prototype.isPrototypeOf(obj)\n }\n\n var isArrayBufferView = ArrayBuffer.isView || function(obj) {\n return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1\n }\n }\n\n function normalizeName(name) {\n if (typeof name !== 'string') {\n name = String(name)\n }\n if (/[^a-z0-9\\-#$%&'*+.\\^_`|~]/i.test(name)) {\n throw new TypeError('Invalid character in header field name')\n }\n return name.toLowerCase()\n }\n\n function normalizeValue(value) {\n if (typeof value !== 'string') {\n value = String(value)\n }\n return value\n }\n\n // Build a destructive iterator for the value list\n function iteratorFor(items) {\n var iterator = {\n next: function() {\n var value = items.shift()\n return {done: value === undefined, value: value}\n }\n }\n\n if (support.iterable) {\n iterator[Symbol.iterator] = function() {\n return iterator\n }\n }\n\n return iterator\n }\n\n function Headers(headers) {\n this.map = {}\n\n if (headers instanceof Headers) {\n headers.forEach(function(value, name) {\n this.append(name, value)\n }, this)\n } else if (Array.isArray(headers)) {\n headers.forEach(function(header) {\n this.append(header[0], header[1])\n }, this)\n } else if (headers) {\n Object.getOwnPropertyNames(headers).forEach(function(name) {\n this.append(name, headers[name])\n }, this)\n }\n }\n\n Headers.prototype.append = function(name, value) {\n name = normalizeName(name)\n value = normalizeValue(value)\n var oldValue = this.map[name]\n this.map[name] = oldValue ? oldValue+','+value : value\n }\n\n Headers.prototype['delete'] = function(name) {\n delete this.map[normalizeName(name)]\n }\n\n Headers.prototype.get = function(name) {\n name = normalizeName(name)\n return this.has(name) ? this.map[name] : null\n }\n\n Headers.prototype.has = function(name) {\n return this.map.hasOwnProperty(normalizeName(name))\n }\n\n Headers.prototype.set = function(name, value) {\n this.map[normalizeName(name)] = normalizeValue(value)\n }\n\n Headers.prototype.forEach = function(callback, thisArg) {\n for (var name in this.map) {\n if (this.map.hasOwnProperty(name)) {\n callback.call(thisArg, this.map[name], name, this)\n }\n }\n }\n\n Headers.prototype.keys = function() {\n var items = []\n this.forEach(function(value, name) { items.push(name) })\n return iteratorFor(items)\n }\n\n Headers.prototype.values = function() {\n var items = []\n this.forEach(function(value) { items.push(value) })\n return iteratorFor(items)\n }\n\n Headers.prototype.entries = function() {\n var items = []\n this.forEach(function(value, name) { items.push([name, value]) })\n return iteratorFor(items)\n }\n\n if (support.iterable) {\n Headers.prototype[Symbol.iterator] = Headers.prototype.entries\n }\n\n function consumed(body) {\n if (body.bodyUsed) {\n return Promise.reject(new TypeError('Already read'))\n }\n body.bodyUsed = true\n }\n\n function fileReaderReady(reader) {\n return new Promise(function(resolve, reject) {\n reader.onload = function() {\n resolve(reader.result)\n }\n reader.onerror = function() {\n reject(reader.error)\n }\n })\n }\n\n function readBlobAsArrayBuffer(blob) {\n var reader = new FileReader()\n var promise = fileReaderReady(reader)\n reader.readAsArrayBuffer(blob)\n return promise\n }\n\n function readBlobAsText(blob) {\n var reader = new FileReader()\n var promise = fileReaderReady(reader)\n reader.readAsText(blob)\n return promise\n }\n\n function readArrayBufferAsText(buf) {\n var view = new Uint8Array(buf)\n var chars = new Array(view.length)\n\n for (var i = 0; i < view.length; i++) {\n chars[i] = String.fromCharCode(view[i])\n }\n return chars.join('')\n }\n\n function bufferClone(buf) {\n if (buf.slice) {\n return buf.slice(0)\n } else {\n var view = new Uint8Array(buf.byteLength)\n view.set(new Uint8Array(buf))\n return view.buffer\n }\n }\n\n function Body() {\n this.bodyUsed = false\n\n this._initBody = function(body) {\n this._bodyInit = body\n if (!body) {\n this._bodyText = ''\n } else if (typeof body === 'string') {\n this._bodyText = body\n } else if (support.blob && Blob.prototype.isPrototypeOf(body)) {\n this._bodyBlob = body\n } else if (support.formData && FormData.prototype.isPrototypeOf(body)) {\n this._bodyFormData = body\n } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {\n this._bodyText = body.toString()\n } else if (support.arrayBuffer && support.blob && isDataView(body)) {\n this._bodyArrayBuffer = bufferClone(body.buffer)\n // IE 10-11 can't handle a DataView body.\n this._bodyInit = new Blob([this._bodyArrayBuffer])\n } else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) {\n this._bodyArrayBuffer = bufferClone(body)\n } else {\n throw new Error('unsupported BodyInit type')\n }\n\n if (!this.headers.get('content-type')) {\n if (typeof body === 'string') {\n this.headers.set('content-type', 'text/plain;charset=UTF-8')\n } else if (this._bodyBlob && this._bodyBlob.type) {\n this.headers.set('content-type', this._bodyBlob.type)\n } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {\n this.headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8')\n }\n }\n }\n\n if (support.blob) {\n this.blob = function() {\n var rejected = consumed(this)\n if (rejected) {\n return rejected\n }\n\n if (this._bodyBlob) {\n return Promise.resolve(this._bodyBlob)\n } else if (this._bodyArrayBuffer) {\n return Promise.resolve(new Blob([this._bodyArrayBuffer]))\n } else if (this._bodyFormData) {\n throw new Error('could not read FormData body as blob')\n } else {\n return Promise.resolve(new Blob([this._bodyText]))\n }\n }\n\n this.arrayBuffer = function() {\n if (this._bodyArrayBuffer) {\n return consumed(this) || Promise.resolve(this._bodyArrayBuffer)\n } else {\n return this.blob().then(readBlobAsArrayBuffer)\n }\n }\n }\n\n this.text = function() {\n var rejected = consumed(this)\n if (rejected) {\n return rejected\n }\n\n if (this._bodyBlob) {\n return readBlobAsText(this._bodyBlob)\n } else if (this._bodyArrayBuffer) {\n return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer))\n } else if (this._bodyFormData) {\n throw new Error('could not read FormData body as text')\n } else {\n return Promise.resolve(this._bodyText)\n }\n }\n\n if (support.formData) {\n this.formData = function() {\n return this.text().then(decode)\n }\n }\n\n this.json = function() {\n return this.text().then(JSON.parse)\n }\n\n return this\n }\n\n // HTTP methods whose capitalization should be normalized\n var methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT']\n\n function normalizeMethod(method) {\n var upcased = method.toUpperCase()\n return (methods.indexOf(upcased) > -1) ? upcased : method\n }\n\n function Request(input, options) {\n options = options || {}\n var body = options.body\n\n if (input instanceof Request) {\n if (input.bodyUsed) {\n throw new TypeError('Already read')\n }\n this.url = input.url\n this.credentials = input.credentials\n if (!options.headers) {\n this.headers = new Headers(input.headers)\n }\n this.method = input.method\n this.mode = input.mode\n if (!body && input._bodyInit != null) {\n body = input._bodyInit\n input.bodyUsed = true\n }\n } else {\n this.url = String(input)\n }\n\n this.credentials = options.credentials || this.credentials || 'omit'\n if (options.headers || !this.headers) {\n this.headers = new Headers(options.headers)\n }\n this.method = normalizeMethod(options.method || this.method || 'GET')\n this.mode = options.mode || this.mode || null\n this.referrer = null\n\n if ((this.method === 'GET' || this.method === 'HEAD') && body) {\n throw new TypeError('Body not allowed for GET or HEAD requests')\n }\n this._initBody(body)\n }\n\n Request.prototype.clone = function() {\n return new Request(this, { body: this._bodyInit })\n }\n\n function decode(body) {\n var form = new FormData()\n body.trim().split('&').forEach(function(bytes) {\n if (bytes) {\n var split = bytes.split('=')\n var name = split.shift().replace(/\\+/g, ' ')\n var value = split.join('=').replace(/\\+/g, ' ')\n form.append(decodeURIComponent(name), decodeURIComponent(value))\n }\n })\n return form\n }\n\n function parseHeaders(rawHeaders) {\n var headers = new Headers()\n rawHeaders.split(/\\r?\\n/).forEach(function(line) {\n var parts = line.split(':')\n var key = parts.shift().trim()\n if (key) {\n var value = parts.join(':').trim()\n headers.append(key, value)\n }\n })\n return headers\n }\n\n Body.call(Request.prototype)\n\n function Response(bodyInit, options) {\n if (!options) {\n options = {}\n }\n\n this.type = 'default'\n this.status = 'status' in options ? options.status : 200\n this.ok = this.status >= 200 && this.status < 300\n this.statusText = 'statusText' in options ? options.statusText : 'OK'\n this.headers = new Headers(options.headers)\n this.url = options.url || ''\n this._initBody(bodyInit)\n }\n\n Body.call(Response.prototype)\n\n Response.prototype.clone = function() {\n return new Response(this._bodyInit, {\n status: this.status,\n statusText: this.statusText,\n headers: new Headers(this.headers),\n url: this.url\n })\n }\n\n Response.error = function() {\n var response = new Response(null, {status: 0, statusText: ''})\n response.type = 'error'\n return response\n }\n\n var redirectStatuses = [301, 302, 303, 307, 308]\n\n Response.redirect = function(url, status) {\n if (redirectStatuses.indexOf(status) === -1) {\n throw new RangeError('Invalid status code')\n }\n\n return new Response(null, {status: status, headers: {location: url}})\n }\n\n self.Headers = Headers\n self.Request = Request\n self.Response = Response\n\n self.fetch = function(input, init) {\n return new Promise(function(resolve, reject) {\n var request = new Request(input, init)\n var xhr = new XMLHttpRequest()\n\n xhr.onload = function() {\n var options = {\n status: xhr.status,\n statusText: xhr.statusText,\n headers: parseHeaders(xhr.getAllResponseHeaders() || '')\n }\n options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL')\n var body = 'response' in xhr ? xhr.response : xhr.responseText\n resolve(new Response(body, options))\n }\n\n xhr.onerror = function() {\n reject(new TypeError('Network request failed'))\n }\n\n xhr.ontimeout = function() {\n reject(new TypeError('Network request failed'))\n }\n\n xhr.open(request.method, request.url, true)\n\n if (request.credentials === 'include') {\n xhr.withCredentials = true\n }\n\n if ('responseType' in xhr && support.blob) {\n xhr.responseType = 'blob'\n }\n\n request.headers.forEach(function(value, name) {\n xhr.setRequestHeader(name, value)\n })\n\n xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit)\n })\n }\n self.fetch.polyfill = true\n})(typeof self !== 'undefined' ? self : this);\n","import runtime from './runtime.js'\n\n// Promise API polyfill for IE11\nimport 'bluebird/js/browser/bluebird.js'\n\n// fetch API polyfill for old browsers\nimport 'whatwg-fetch'\n\nif (!console.time || !console.timeEnd) {\n var timers = {}\n console.time = function(key) {\n timers[key] = new Date().getTime()\n }\n console.timeEnd = function(key) {\n if (!timers[key]) return\n console.log(key + ': ' + (new Date().getTime() - timers[key]) + 'ms')\n delete timers[key]\n }\n}\n\n// from https://raw.githubusercontent.com/mrdoob/three.js/dev/src/polyfills.js\n\nif (Number.EPSILON === undefined) {\n Number.EPSILON = Math.pow(2, -52);\n}\n\nif (Number.isInteger === undefined) {\n // Missing in IE\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isInteger\n Number.isInteger = function (value) {\n return typeof value === 'number' && isFinite(value) && Math.floor(value) === value\n }\n}\n\nif (Math.sign === undefined) {\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sign\n Math.sign = function (x) {\n return ( x < 0 ) ? -1 : ( x > 0 ) ? 1 : +x\n }\n}\n\nif (Function.prototype.name === undefined) {\n // Missing in IE\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/name\n Object.defineProperty(Function.prototype, 'name', {\n get: function () {\n return this.toString().match(/^\\s*function\\s*([^\\(\\s]*)/)[1]\n }\n })\n}\n\nif (Object.assign === undefined) {\n // Missing in IE\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign\n (function () {\n Object.assign = function (target) {\n 'use strict';\n if (target === undefined || target === null) {\n throw new TypeError('Cannot convert undefined or null to object')\n }\n var output = Object(target)\n for (var index = 1; index < arguments.length; index++) {\n var source = arguments[index]\n if (source !== undefined && source !== null) {\n for (var nextKey in source) {\n if (Object.prototype.hasOwnProperty.call(source, nextKey)) {\n output[nextKey] = source[nextKey]\n }\n }\n }\n }\n return output\n }\n })()\n}\n\n// performance.now()\nif (runtime.isBrowser) {\n\n // browser polyfill\n // inspired by:\n // https://gist.github.com/paulirish/5438650\n // note: if we need performance.mark and other methods we might want to replace this with:\n // https://www.npmjs.com/package/performance-polyfill\n if (!window.performance) {\n window.performance = {}\n }\n if (!window.performance.now){\n var navigationStart = performance.timing ? performance.timing.navigationStart : null\n var nowOffset = navigationStart || Date.now()\n window.performance.now = function now(){\n return Date.now() - nowOffset\n }\n }\n\n} else {\n\n // node: use module\n global.performance = {\n now: require('performance-now')\n }\n\n}","/*!\r\n * js-logger - http://github.com/jonnyreeves/js-logger\r\n * Jonny Reeves, http://jonnyreeves.co.uk/\r\n * js-logger may be freely distributed under the MIT license.\r\n */\r\n(function (global) {\r\n\t\"use strict\";\r\n\r\n\t// Top level module for the global, static logger instance.\r\n\tvar Logger = { };\r\n\r\n\t// For those that are at home that are keeping score.\r\n\tLogger.VERSION = \"1.4.1\";\r\n\r\n\t// Function which handles all incoming log messages.\r\n\tvar logHandler;\r\n\r\n\t// Map of ContextualLogger instances by name; used by Logger.get() to return the same named instance.\r\n\tvar contextualLoggersByNameMap = {};\r\n\r\n\t// Polyfill for ES5's Function.bind.\r\n\tvar bind = function(scope, func) {\r\n\t\treturn function() {\r\n\t\t\treturn func.apply(scope, arguments);\r\n\t\t};\r\n\t};\r\n\r\n\t// Super exciting object merger-matron 9000 adding another 100 bytes to your download.\r\n\tvar merge = function () {\r\n\t\tvar args = arguments, target = args[0], key, i;\r\n\t\tfor (i = 1; i < args.length; i++) {\r\n\t\t\tfor (key in args[i]) {\r\n\t\t\t\tif (!(key in target) && args[i].hasOwnProperty(key)) {\r\n\t\t\t\t\ttarget[key] = args[i][key];\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn target;\r\n\t};\r\n\r\n\t// Helper to define a logging level object; helps with optimisation.\r\n\tvar defineLogLevel = function(value, name) {\r\n\t\treturn { value: value, name: name };\r\n\t};\r\n\r\n\t// Predefined logging levels.\r\n\tLogger.DEBUG = defineLogLevel(1, 'DEBUG');\r\n\tLogger.INFO = defineLogLevel(2, 'INFO');\r\n\tLogger.TIME = defineLogLevel(3, 'TIME');\r\n\tLogger.WARN = defineLogLevel(4, 'WARN');\r\n\tLogger.ERROR = defineLogLevel(8, 'ERROR');\r\n\tLogger.OFF = defineLogLevel(99, 'OFF');\r\n\r\n\t// Inner class which performs the bulk of the work; ContextualLogger instances can be configured independently\r\n\t// of each other.\r\n\tvar ContextualLogger = function(defaultContext) {\r\n\t\tthis.context = defaultContext;\r\n\t\tthis.setLevel(defaultContext.filterLevel);\r\n\t\tthis.log = this.info; // Convenience alias.\r\n\t};\r\n\r\n\tContextualLogger.prototype = {\r\n\t\t// Changes the current logging level for the logging instance.\r\n\t\tsetLevel: function (newLevel) {\r\n\t\t\t// Ensure the supplied Level object looks valid.\r\n\t\t\tif (newLevel && \"value\" in newLevel) {\r\n\t\t\t\tthis.context.filterLevel = newLevel;\r\n\t\t\t}\r\n\t\t},\r\n\t\t\r\n\t\t// Gets the current logging level for the logging instance\r\n\t\tgetLevel: function () {\r\n\t\t\treturn this.context.filterLevel;\r\n\t\t},\r\n\r\n\t\t// Is the logger configured to output messages at the supplied level?\r\n\t\tenabledFor: function (lvl) {\r\n\t\t\tvar filterLevel = this.context.filterLevel;\r\n\t\t\treturn lvl.value >= filterLevel.value;\r\n\t\t},\r\n\r\n\t\tdebug: function () {\r\n\t\t\tthis.invoke(Logger.DEBUG, arguments);\r\n\t\t},\r\n\r\n\t\tinfo: function () {\r\n\t\t\tthis.invoke(Logger.INFO, arguments);\r\n\t\t},\r\n\r\n\t\twarn: function () {\r\n\t\t\tthis.invoke(Logger.WARN, arguments);\r\n\t\t},\r\n\r\n\t\terror: function () {\r\n\t\t\tthis.invoke(Logger.ERROR, arguments);\r\n\t\t},\r\n\r\n\t\ttime: function (label) {\r\n\t\t\tif (typeof label === 'string' && label.length > 0) {\r\n\t\t\t\tthis.invoke(Logger.TIME, [ label, 'start' ]);\r\n\t\t\t}\r\n\t\t},\r\n\r\n\t\ttimeEnd: function (label) {\r\n\t\t\tif (typeof label === 'string' && label.length > 0) {\r\n\t\t\t\tthis.invoke(Logger.TIME, [ label, 'end' ]);\r\n\t\t\t}\r\n\t\t},\r\n\r\n\t\t// Invokes the logger callback if it's not being filtered.\r\n\t\tinvoke: function (level, msgArgs) {\r\n\t\t\tif (logHandler && this.enabledFor(level)) {\r\n\t\t\t\tlogHandler(msgArgs, merge({ level: level }, this.context));\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\r\n\t// Protected instance which all calls to the to level `Logger` module will be routed through.\r\n\tvar globalLogger = new ContextualLogger({ filterLevel: Logger.OFF });\r\n\r\n\t// Configure the global Logger instance.\r\n\t(function() {\r\n\t\t// Shortcut for optimisers.\r\n\t\tvar L = Logger;\r\n\r\n\t\tL.enabledFor = bind(globalLogger, globalLogger.enabledFor);\r\n\t\tL.debug = bind(globalLogger, globalLogger.debug);\r\n\t\tL.time = bind(globalLogger, globalLogger.time);\r\n\t\tL.timeEnd = bind(globalLogger, globalLogger.timeEnd);\r\n\t\tL.info = bind(globalLogger, globalLogger.info);\r\n\t\tL.warn = bind(globalLogger, globalLogger.warn);\r\n\t\tL.error = bind(globalLogger, globalLogger.error);\r\n\r\n\t\t// Don't forget the convenience alias!\r\n\t\tL.log = L.info;\r\n\t}());\r\n\r\n\t// Set the global logging handler. The supplied function should expect two arguments, the first being an arguments\r\n\t// object with the supplied log messages and the second being a context object which contains a hash of stateful\r\n\t// parameters which the logging function can consume.\r\n\tLogger.setHandler = function (func) {\r\n\t\tlogHandler = func;\r\n\t};\r\n\r\n\t// Sets the global logging filter level which applies to *all* previously registered, and future Logger instances.\r\n\t// (note that named loggers (retrieved via `Logger.get`) can be configured independently if required).\r\n\tLogger.setLevel = function(level) {\r\n\t\t// Set the globalLogger's level.\r\n\t\tglobalLogger.setLevel(level);\r\n\r\n\t\t// Apply this level to all registered contextual loggers.\r\n\t\tfor (var key in contextualLoggersByNameMap) {\r\n\t\t\tif (contextualLoggersByNameMap.hasOwnProperty(key)) {\r\n\t\t\t\tcontextualLoggersByNameMap[key].setLevel(level);\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\r\n\t// Gets the global logging filter level\r\n\tLogger.getLevel = function() {\r\n\t\treturn globalLogger.getLevel();\r\n\t};\r\n\r\n\t// Retrieve a ContextualLogger instance. Note that named loggers automatically inherit the global logger's level,\r\n\t// default context and log handler.\r\n\tLogger.get = function (name) {\r\n\t\t// All logger instances are cached so they can be configured ahead of use.\r\n\t\treturn contextualLoggersByNameMap[name] ||\r\n\t\t\t(contextualLoggersByNameMap[name] = new ContextualLogger(merge({ name: name }, globalLogger.context)));\r\n\t};\r\n\r\n\t// CreateDefaultHandler returns a handler function which can be passed to `Logger.setHandler()` which will\r\n\t// write to the window's console object (if present); the optional options object can be used to customise the\r\n\t// formatter used to format each log message.\r\n\tLogger.createDefaultHandler = function (options) {\r\n\t\toptions = options || {};\r\n\r\n\t\toptions.formatter = options.formatter || function defaultMessageFormatter(messages, context) {\r\n\t\t\t// Prepend the logger's name to the log message for easy identification.\r\n\t\t\tif (context.name) {\r\n\t\t\t\tmessages.unshift(\"[\" + context.name + \"]\");\r\n\t\t\t}\r\n\t\t};\r\n\r\n\t\t// Map of timestamps by timer labels used to track `#time` and `#timeEnd()` invocations in environments\r\n\t\t// that don't offer a native console method.\r\n\t\tvar timerStartTimeByLabelMap = {};\r\n\r\n\t\t// Support for IE8+ (and other, slightly more sane environments)\r\n\t\tvar invokeConsoleMethod = function (hdlr, messages) {\r\n\t\t\tFunction.prototype.apply.call(hdlr, console, messages);\r\n\t\t};\r\n\r\n\t\t// Check for the presence of a logger.\r\n\t\tif (typeof console === \"undefined\") {\r\n\t\t\treturn function () { /* no console */ };\r\n\t\t}\r\n\r\n\t\treturn function(messages, context) {\r\n\t\t\t// Convert arguments object to Array.\r\n\t\t\tmessages = Array.prototype.slice.call(messages);\r\n\r\n\t\t\tvar hdlr = console.log;\r\n\t\t\tvar timerLabel;\r\n\r\n\t\t\tif (context.level === Logger.TIME) {\r\n\t\t\t\ttimerLabel = (context.name ? '[' + context.name + '] ' : '') + messages[0];\r\n\r\n\t\t\t\tif (messages[1] === 'start') {\r\n\t\t\t\t\tif (console.time) {\r\n\t\t\t\t\t\tconsole.time(timerLabel);\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse {\r\n\t\t\t\t\t\ttimerStartTimeByLabelMap[timerLabel] = new Date().getTime();\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\telse {\r\n\t\t\t\t\tif (console.timeEnd) {\r\n\t\t\t\t\t\tconsole.timeEnd(timerLabel);\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse {\r\n\t\t\t\t\t\tinvokeConsoleMethod(hdlr, [ timerLabel + ': ' +\r\n\t\t\t\t\t\t\t(new Date().getTime() - timerStartTimeByLabelMap[timerLabel]) + 'ms' ]);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\t// Delegate through to custom warn/error loggers if present on the console.\r\n\t\t\t\tif (context.level === Logger.WARN && console.warn) {\r\n\t\t\t\t\thdlr = console.warn;\r\n\t\t\t\t} else if (context.level === Logger.ERROR && console.error) {\r\n\t\t\t\t\thdlr = console.error;\r\n\t\t\t\t} else if (context.level === Logger.INFO && console.info) {\r\n\t\t\t\t\thdlr = console.info;\r\n\t\t\t\t} else if (context.level === Logger.DEBUG && console.debug) {\r\n\t\t\t\t\thdlr = console.debug;\r\n\t\t\t\t}\r\n\r\n\t\t\t\toptions.formatter(messages, context);\r\n\t\t\t\tinvokeConsoleMethod(hdlr, messages);\r\n\t\t\t}\r\n\t\t};\r\n\t};\r\n\r\n\t// Configure and example a Default implementation which writes to the `window.console` (if present). The\r\n\t// `options` hash can be used to configure the default logLevel and provide a custom message formatter.\r\n\tLogger.useDefaults = function(options) {\r\n\t\tLogger.setLevel(options && options.defaultLevel || Logger.DEBUG);\r\n\t\tLogger.setHandler(Logger.createDefaultHandler(options));\r\n\t};\r\n\r\n\t// Export to popular environments boilerplate.\r\n\tif (typeof define === 'function' && define.amd) {\r\n\t\tdefine(Logger);\r\n\t}\r\n\telse if (typeof module !== 'undefined' && module.exports) {\r\n\t\tmodule.exports = Logger;\r\n\t}\r\n\telse {\r\n\t\tLogger._prevLogger = global.Logger;\r\n\r\n\t\tLogger.noConflict = function () {\r\n\t\t\tglobal.Logger = Logger._prevLogger;\r\n\t\t\treturn Logger;\r\n\t\t};\r\n\r\n\t\tglobal.Logger = Logger;\r\n\t}\r\n}(this));\r\n","import { name, version, homepage } from '../../package.json'\nimport Logger from 'js-logger'\nimport './polyfills.js'\nimport runtime from './runtime.js'\n\n// Bootstrap logger\nLogger.useDefaults()\n\n// print header to console in browser environment\nif (runtime.isBrowser) {\n console.log(homepage+' '+version+' (@'+GIT_BRANCH+' #'+GIT_COMMIT.substr(0,7)+' '+BUILD_DATE+')' )\n}\n\n// global dependencies\n\n// three.js\nif (runtime.isNode) global.THREE = require('three')","import log from 'js-logger'\nimport runtime from './runtime.js'\n\n// default configs values\n\nvar defaults = Object.freeze({\n logLevel: 'warn',\n publishableApiKey: getPublishableApiKeyFromUrl(),\n secretApiKey: null,\n servicesUrl: 'https://spaces.archilogic.com/api/v2',\n storageDomain: 'storage.3d.io',\n storageDomainNoCdn: 'storage-nocdn.3d.io'\n})\n\n// constants\n\nvar LOG_STRING_TO_ENUM = {\n error: log.ERROR,\n warn: log.WARN,\n info: log.INFO,\n debug: log.DEBUG\n}\n\n// main\n\nvar configs = function configs (args) {\n\n if (!args) {\n // no arguments: return copy of configs object\n return JSON.parse(JSON.stringify(this))\n }\n\n // apply log level if among arguments\n if (args.logLevel) {\n setLogLevel(args.logLevel)\n delete args.logLevel\n }\n\n // prevent secret API key to be included in browser environments\n if (runtime.isBrowser && args.secretApiKey) {\n log.error('The secret API key is not supposed to be used in browser environments!\\nPlease see https://3d.io/docs/api/1/get-started-browser.html#secret-api-key for more information.')\n }\n\n // simply copy over the other configs\n var key, keys = Object.keys(args)\n for (var i = 0, l = keys.length; i < l; i++) {\n key = keys[i]\n if (defaults[key] !== undefined) {\n configs[key] = args[key]\n } else {\n log.warn('Unknown config param \"' + key + '\". Available params are: ' + Object.keys(defaults).join(', '))\n }\n }\n\n return this\n}\n\n// private methods\n\nfunction setLogLevel (val) {\n // update logger\n var logLevelEnum = LOG_STRING_TO_ENUM[val]\n if (logLevelEnum) {\n // set log level\n log.setLevel(logLevelEnum)\n configs.logLevel = val\n } else {\n // handle error\n var errorMessage = 'Unknown log level \"' + val + '\". Possible are: \"' + Object.keys(LOG_STRING_TO_ENUM).join('\", \"') + '\". '\n if (configs.logLevel) {\n // do not change current log level\n errorMessage += 'Log level remains \"' + configs.logLevel\n } else {\n // set default log level\n var defaultVal = defaults.logLevel\n errorMessage += 'Fallback to default \"' + defaultVal + '\".'\n log.setLevel(LOG_STRING_TO_ENUM[defaultVal])\n configs.logLevel = defaultVal\n }\n console.error(errorMessage)\n }\n}\n\nfunction getPublishableApiKeyFromUrl () {\n if (!runtime.isBrowser) return null\n var libUrl\n if (document.currentScript) {\n libUrl = document.currentScript.getAttribute('src')\n } else {\n // browsers not supporting currentScript\n var src, libSearch\n var scripts = document.getElementsByTagName('script')\n var libNameRegex = new RegExp('(\\/3dio\\.js|\\/3dio\\.min\\.js)')\n // iterating backwarts as the last script is most likely the current one\n for (var i = scripts.length - 1; i > -1; i--) {\n src = scripts[i].getAttribute('src')\n if (libNameRegex.exec(src)) {\n libUrl = src\n break\n }\n }\n }\n var keySearch = /pk=([^&]+)/i.exec(libUrl)\n return keySearch ? keySearch[1] : null\n}\n\n// init\n\nconfigs(JSON.parse(JSON.stringify(defaults)))\n\n// api\n\nexport default configs\n","import runtime from '../core/runtime.js'\n\nexport default function checkDependencies (args, target) {\n\n if (args.three && !runtime.has.three) {\n return handleError(args.onError, target, 'Sorry: THREE not available.')\n } else if (args.aframe && !runtime.has.aframe) {\n return handleError(args.onError, target, 'Sorry: AFRAME not available.')\n } else {\n return typeof target === 'function' ? target() : target\n }\n\n}\n\n// helper\n\nfunction handleError (errorCallback, target, message) {\n // call errorCallback if provided\n if (errorCallback) errorCallback(message)\n // based on target type...\n if (typeof target === 'function') {\n // return a function throwing an error to handle runtime access\n return function onError () {\n throw new Error(message)\n }\n } else {\n return false\n }\n}","import runtime from '../../core/runtime.js'\n\nexport default (function(){\n\n if (runtime.isNode) {\n return require('node-fetch')\n } else if (typeof fetch !== 'undefined') {\n return fetch\n } else {\n console.warn('Missing global fetch API.')\n return function() {\n throw new Error('Missing global fetch API.')\n }\n }\n\n})()","var isES5 = (function(){\n \"use strict\";\n return this === undefined;\n})();\n\nif (isES5) {\n module.exports = {\n freeze: Object.freeze,\n defineProperty: Object.defineProperty,\n getDescriptor: Object.getOwnPropertyDescriptor,\n keys: Object.keys,\n names: Object.getOwnPropertyNames,\n getPrototypeOf: Object.getPrototypeOf,\n isArray: Array.isArray,\n isES5: isES5,\n propertyIsWritable: function(obj, prop) {\n var descriptor = Object.getOwnPropertyDescriptor(obj, prop);\n return !!(!descriptor || descriptor.writable || descriptor.set);\n }\n };\n} else {\n var has = {}.hasOwnProperty;\n var str = {}.toString;\n var proto = {}.constructor.prototype;\n\n var ObjectKeys = function (o) {\n var ret = [];\n for (var key in o) {\n if (has.call(o, key)) {\n ret.push(key);\n }\n }\n return ret;\n };\n\n var ObjectGetDescriptor = function(o, key) {\n return {value: o[key]};\n };\n\n var ObjectDefineProperty = function (o, key, desc) {\n o[key] = desc.value;\n return o;\n };\n\n var ObjectFreeze = function (obj) {\n return obj;\n };\n\n var ObjectGetPrototypeOf = function (obj) {\n try {\n return Object(obj).constructor.prototype;\n }\n catch (e) {\n return proto;\n }\n };\n\n var ArrayIsArray = function (obj) {\n try {\n return str.call(obj) === \"[object Array]\";\n }\n catch(e) {\n return false;\n }\n };\n\n module.exports = {\n isArray: ArrayIsArray,\n keys: ObjectKeys,\n names: ObjectKeys,\n defineProperty: ObjectDefineProperty,\n getDescriptor: ObjectGetDescriptor,\n freeze: ObjectFreeze,\n getPrototypeOf: ObjectGetPrototypeOf,\n isES5: isES5,\n propertyIsWritable: function() {\n return true;\n }\n };\n}\n","\"use strict\";\nvar es5 = require(\"./es5\");\nvar canEvaluate = typeof navigator == \"undefined\";\n\nvar errorObj = {e: {}};\nvar tryCatchTarget;\nvar globalObject = typeof self !== \"undefined\" ? self :\n typeof window !== \"undefined\" ? window :\n typeof global !== \"undefined\" ? global :\n this !== undefined ? this : null;\n\nfunction tryCatcher() {\n try {\n var target = tryCatchTarget;\n tryCatchTarget = null;\n return target.apply(this, arguments);\n } catch (e) {\n errorObj.e = e;\n return errorObj;\n }\n}\nfunction tryCatch(fn) {\n tryCatchTarget = fn;\n return tryCatcher;\n}\n\nvar inherits = function(Child, Parent) {\n var hasProp = {}.hasOwnProperty;\n\n function T() {\n this.constructor = Child;\n this.constructor$ = Parent;\n for (var propertyName in Parent.prototype) {\n if (hasProp.call(Parent.prototype, propertyName) &&\n propertyName.charAt(propertyName.length-1) !== \"$\"\n ) {\n this[propertyName + \"$\"] = Parent.prototype[propertyName];\n }\n }\n }\n T.prototype = Parent.prototype;\n Child.prototype = new T();\n return Child.prototype;\n};\n\n\nfunction isPrimitive(val) {\n return val == null || val === true || val === false ||\n typeof val === \"string\" || typeof val === \"number\";\n\n}\n\nfunction isObject(value) {\n return typeof value === \"function\" ||\n typeof value === \"object\" && value !== null;\n}\n\nfunction maybeWrapAsError(maybeError) {\n if (!isPrimitive(maybeError)) return maybeError;\n\n return new Error(safeToString(maybeError));\n}\n\nfunction withAppended(target, appendee) {\n var len = target.length;\n var ret = new Array(len + 1);\n var i;\n for (i = 0; i < len; ++i) {\n ret[i] = target[i];\n }\n ret[i] = appendee;\n return ret;\n}\n\nfunction getDataPropertyOrDefault(obj, key, defaultValue) {\n if (es5.isES5) {\n var desc = Object.getOwnPropertyDescriptor(obj, key);\n\n if (desc != null) {\n return desc.get == null && desc.set == null\n ? desc.value\n : defaultValue;\n }\n } else {\n return {}.hasOwnProperty.call(obj, key) ? obj[key] : undefined;\n }\n}\n\nfunction notEnumerableProp(obj, name, value) {\n if (isPrimitive(obj)) return obj;\n var descriptor = {\n value: value,\n configurable: true,\n enumerable: false,\n writable: true\n };\n es5.defineProperty(obj, name, descriptor);\n return obj;\n}\n\nfunction thrower(r) {\n throw r;\n}\n\nvar inheritedDataKeys = (function() {\n var excludedPrototypes = [\n Array.prototype,\n Object.prototype,\n Function.prototype\n ];\n\n var isExcludedProto = function(val) {\n for (var i = 0; i < excludedPrototypes.length; ++i) {\n if (excludedPrototypes[i] === val) {\n return true;\n }\n }\n return false;\n };\n\n if (es5.isES5) {\n var getKeys = Object.getOwnPropertyNames;\n return function(obj) {\n var ret = [];\n var visitedKeys = Object.create(null);\n while (obj != null && !isExcludedProto(obj)) {\n var keys;\n try {\n keys = getKeys(obj);\n } catch (e) {\n return ret;\n }\n for (var i = 0; i < keys.length; ++i) {\n var key = keys[i];\n if (visitedKeys[key]) continue;\n visitedKeys[key] = true;\n var desc = Object.getOwnPropertyDescriptor(obj, key);\n if (desc != null && desc.get == null && desc.set == null) {\n ret.push(key);\n }\n }\n obj = es5.getPrototypeOf(obj);\n }\n return ret;\n };\n } else {\n var hasProp = {}.hasOwnProperty;\n return function(obj) {\n if (isExcludedProto(obj)) return [];\n var ret = [];\n\n /*jshint forin:false */\n enumeration: for (var key in obj) {\n if (hasProp.call(obj, key)) {\n ret.push(key);\n } else {\n for (var i = 0; i < excludedPrototypes.length; ++i) {\n if (hasProp.call(excludedPrototypes[i], key)) {\n continue enumeration;\n }\n }\n ret.push(key);\n }\n }\n return ret;\n };\n }\n\n})();\n\nvar thisAssignmentPattern = /this\\s*\\.\\s*\\S+\\s*=/;\nfunction isClass(fn) {\n try {\n if (typeof fn === \"function\") {\n var keys = es5.names(fn.prototype);\n\n var hasMethods = es5.isES5 && keys.length > 1;\n var hasMethodsOtherThanConstructor = keys.length > 0 &&\n !(keys.length === 1 && keys[0] === \"constructor\");\n var hasThisAssignmentAndStaticMethods =\n thisAssignmentPattern.test(fn + \"\") && es5.names(fn).length > 0;\n\n if (hasMethods || hasMethodsOtherThanConstructor ||\n hasThisAssignmentAndStaticMethods) {\n return true;\n }\n }\n return false;\n } catch (e) {\n return false;\n }\n}\n\nfunction toFastProperties(obj) {\n /*jshint -W027,-W055,-W031*/\n function FakeConstructor() {}\n FakeConstructor.prototype = obj;\n var l = 8;\n while (l--) new FakeConstructor();\n return obj;\n eval(obj);\n}\n\nvar rident = /^[a-z$_][a-z$_0-9]*$/i;\nfunction isIdentifier(str) {\n return rident.test(str);\n}\n\nfunction filledRange(count, prefix, suffix) {\n var ret = new Array(count);\n for(var i = 0; i < count; ++i) {\n ret[i] = prefix + i + suffix;\n }\n return ret;\n}\n\nfunction safeToString(obj) {\n try {\n return obj + \"\";\n } catch (e) {\n return \"[no string representation]\";\n }\n}\n\nfunction isError(obj) {\n return obj instanceof Error ||\n (obj !== null &&\n typeof obj === \"object\" &&\n typeof obj.message === \"string\" &&\n typeof obj.name === \"string\");\n}\n\nfunction markAsOriginatingFromRejection(e) {\n try {\n notEnumerableProp(e, \"isOperational\", true);\n }\n catch(ignore) {}\n}\n\nfunction originatesFromRejection(e) {\n if (e == null) return false;\n return ((e instanceof Error[\"__BluebirdErrorTypes__\"].OperationalError) ||\n e[\"isOperational\"] === true);\n}\n\nfunction canAttachTrace(obj) {\n return isError(obj) && es5.propertyIsWritable(obj, \"stack\");\n}\n\nvar ensureErrorObject = (function() {\n if (!(\"stack\" in new Error())) {\n return function(value) {\n if (canAttachTrace(value)) return value;\n try {throw new Error(safeToString(value));}\n catch(err) {return err;}\n };\n } else {\n return function(value) {\n if (canAttachTrace(value)) return value;\n return new Error(safeToString(value));\n };\n }\n})();\n\nfunction classString(obj) {\n return {}.toString.call(obj);\n}\n\nfunction copyDescriptors(from, to, filter) {\n var keys = es5.names(from);\n for (var i = 0; i < keys.length; ++i) {\n var key = keys[i];\n if (filter(key)) {\n try {\n es5.defineProperty(to, key, es5.getDescriptor(from, key));\n } catch (ignore) {}\n }\n }\n}\n\nvar asArray = function(v) {\n if (es5.isArray(v)) {\n return v;\n }\n return null;\n};\n\nif (typeof Symbol !== \"undefined\" && Symbol.iterator) {\n var ArrayFrom = typeof Array.from === \"function\" ? function(v) {\n return Array.from(v);\n } : function(v) {\n var ret = [];\n var it = v[Symbol.iterator]();\n var itResult;\n while (!((itResult = it.next()).done)) {\n ret.push(itResult.value);\n }\n return ret;\n };\n\n asArray = function(v) {\n if (es5.isArray(v)) {\n return v;\n } else if (v != null && typeof v[Symbol.iterator] === \"function\") {\n return ArrayFrom(v);\n }\n return null;\n };\n}\n\nvar isNode = typeof process !== \"undefined\" &&\n classString(process).toLowerCase() === \"[object process]\";\n\nvar hasEnvVariables = typeof process !== \"undefined\" &&\n typeof process.env !== \"undefined\";\n\nfunction env(key) {\n return hasEnvVariables ? process.env[key] : undefined;\n}\n\nfunction getNativePromise() {\n if (typeof Promise === \"function\") {\n try {\n var promise = new Promise(function(){});\n if ({}.toString.call(promise) === \"[object Promise]\") {\n return Promise;\n }\n } catch (e) {}\n }\n}\n\nfunction domainBind(self, cb) {\n return self.bind(cb);\n}\n\nvar ret = {\n isClass: isClass,\n isIdentifier: isIdentifier,\n inheritedDataKeys: inheritedDataKeys,\n getDataPropertyOrDefault: getDataPropertyOrDefault,\n thrower: thrower,\n isArray: es5.isArray,\n asArray: asArray,\n notEnumerableProp: notEnumerableProp,\n isPrimitive: isPrimitive,\n isObject: isObject,\n isError: isError,\n canEvaluate: canEvaluate,\n errorObj: errorObj,\n tryCatch: tryCatch,\n inherits: inherits,\n withAppended: withAppended,\n maybeWrapAsError: maybeWrapAsError,\n toFastProperties: toFastProperties,\n filledRange: filledRange,\n toString: safeToString,\n canAttachTrace: canAttachTrace,\n ensureErrorObject: ensureErrorObject,\n originatesFromRejection: originatesFromRejection,\n markAsOriginatingFromRejection: markAsOriginatingFromRejection,\n classString: classString,\n copyDescriptors: copyDescriptors,\n hasDevTools: typeof chrome !== \"undefined\" && chrome &&\n typeof chrome.loadTimes === \"function\",\n isNode: isNode,\n hasEnvVariables: hasEnvVariables,\n env: env,\n global: globalObject,\n getNativePromise: getNativePromise,\n domainBind: domainBind\n};\nret.isRecentNode = ret.isNode && (function() {\n var version = process.versions.node.split(\".\").map(Number);\n return (version[0] === 0 && version[1] > 10) || (version[0] > 0);\n})();\n\nif (ret.isNode) ret.toFastProperties(process);\n\ntry {throw new Error(); } catch (e) {ret.lastLineError = e;}\nmodule.exports = ret;\n","\"use strict\";\nvar util = require(\"./util\");\nvar schedule;\nvar noAsyncScheduler = function() {\n throw new Error(\"No async scheduler available\\u000a\\u000a See http://goo.gl/MqrFmX\\u000a\");\n};\nvar NativePromise = util.getNativePromise();\nif (util.isNode && typeof MutationObserver === \"undefined\") {\n var GlobalSetImmediate = global.setImmediate;\n var ProcessNextTick = process.nextTick;\n schedule = util.isRecentNode\n ? function(fn) { GlobalSetImmediate.call(global, fn); }\n : function(fn) { ProcessNextTick.call(process, fn); };\n} else if (typeof NativePromise === \"function\" &&\n typeof NativePromise.resolve === \"function\") {\n var nativePromise = NativePromise.resolve();\n schedule = function(fn) {\n nativePromise.then(fn);\n };\n} else if ((typeof MutationObserver !== \"undefined\") &&\n !(typeof window !== \"undefined\" &&\n window.navigator &&\n (window.navigator.standalone || window.cordova))) {\n schedule = (function() {\n var div = document.createElement(\"div\");\n var opts = {attributes: true};\n var toggleScheduled = false;\n var div2 = document.createElement(\"div\");\n var o2 = new MutationObserver(function() {\n div.classList.toggle(\"foo\");\n toggleScheduled = false;\n });\n o2.observe(div2, opts);\n\n var scheduleToggle = function() {\n if (toggleScheduled) return;\n toggleScheduled = true;\n div2.classList.toggle(\"foo\");\n };\n\n return function schedule(fn) {\n var o = new MutationObserver(function() {\n o.disconnect();\n fn();\n });\n o.observe(div, opts);\n scheduleToggle();\n };\n })();\n} else if (typeof setImmediate !== \"undefined\") {\n schedule = function (fn) {\n setImmediate(fn);\n };\n} else if (typeof setTimeout !== \"undefined\") {\n schedule = function (fn) {\n setTimeout(fn, 0);\n };\n} else {\n schedule = noAsyncScheduler;\n}\nmodule.exports = schedule;\n","\"use strict\";\nfunction arrayMove(src, srcIndex, dst, dstIndex, len) {\n for (var j = 0; j < len; ++j) {\n dst[j + dstIndex] = src[j + srcIndex];\n src[j + srcIndex] = void 0;\n }\n}\n\nfunction Queue(capacity) {\n this._capacity = capacity;\n this._length = 0;\n this._front = 0;\n}\n\nQueue.prototype._willBeOverCapacity = function (size) {\n return this._capacity < size;\n};\n\nQueue.prototype._pushOne = function (arg) {\n var length = this.length();\n this._checkCapacity(length + 1);\n var i = (this._front + length) & (this._capacity - 1);\n this[i] = arg;\n this._length = length + 1;\n};\n\nQueue.prototype.push = function (fn, receiver, arg) {\n var length = this.length() + 3;\n if (this._willBeOverCapacity(length)) {\n this._pushOne(fn);\n this._pushOne(receiver);\n this._pushOne(arg);\n return;\n }\n var j = this._front + length - 3;\n this._checkCapacity(length);\n var wrapMask = this._capacity - 1;\n this[(j + 0) & wrapMask] = fn;\n this[(j + 1) & wrapMask] = receiver;\n this[(j + 2) & wrapMask] = arg;\n this._length = length;\n};\n\nQueue.prototype.shift = function () {\n var front = this._front,\n ret = this[front];\n\n this[front] = undefined;\n this._front = (front + 1) & (this._capacity - 1);\n this._length--;\n return ret;\n};\n\nQueue.prototype.length = function () {\n return this._length;\n};\n\nQueue.prototype._checkCapacity = function (size) {\n if (this._capacity < size) {\n this._resizeTo(this._capacity << 1);\n }\n};\n\nQueue.prototype._resizeTo = function (capacity) {\n var oldCapacity = this._capacity;\n this._capacity = capacity;\n var front = this._front;\n var length = this._length;\n var moveItemsCount = (front + length) & (oldCapacity - 1);\n arrayMove(this, 0, this, oldCapacity, moveItemsCount);\n};\n\nmodule.exports = Queue;\n","\"use strict\";\nvar firstLineError;\ntry {throw new Error(); } catch (e) {firstLineError = e;}\nvar schedule = require(\"./schedule\");\nvar Queue = require(\"./queue\");\nvar util = require(\"./util\");\n\nfunction Async() {\n this._customScheduler = false;\n this._isTickUsed = false;\n this._lateQueue = new Queue(16);\n this._normalQueue = new Queue(16);\n this._haveDrainedQueues = false;\n this._trampolineEnabled = true;\n var self = this;\n this.drainQueues = function () {\n self._drainQueues();\n };\n this._schedule = schedule;\n}\n\nAsync.prototype.setScheduler = function(fn) {\n var prev = this._schedule;\n this._schedule = fn;\n this._customScheduler = true;\n return prev;\n};\n\nAsync.prototype.hasCustomScheduler = function() {\n return this._customScheduler;\n};\n\nAsync.prototype.enableTrampoline = function() {\n this._trampolineEnabled = true;\n};\n\nAsync.prototype.disableTrampolineIfNecessary = function() {\n if (util.hasDevTools) {\n this._trampolineEnabled = false;\n }\n};\n\nAsync.prototype.haveItemsQueued = function () {\n return this._isTickUsed || this._haveDrainedQueues;\n};\n\n\nAsync.prototype.fatalError = function(e, isNode) {\n if (isNode) {\n process.stderr.write(\"Fatal \" + (e instanceof Error ? e.stack : e) +\n \"\\n\");\n process.exit(2);\n } else {\n this.throwLater(e);\n }\n};\n\nAsync.prototype.throwLater = function(fn, arg) {\n if (arguments.length === 1) {\n arg = fn;\n fn = function () { throw arg; };\n }\n if (typeof setTimeout !== \"undefined\") {\n setTimeout(function() {\n fn(arg);\n }, 0);\n } else try {\n this._schedule(function() {\n fn(arg);\n });\n } catch (e) {\n throw new Error(\"No async scheduler available\\u000a\\u000a See http://goo.gl/MqrFmX\\u000a\");\n }\n};\n\nfunction AsyncInvokeLater(fn, receiver, arg) {\n this._lateQueue.push(fn, receiver, arg);\n this._queueTick();\n}\n\nfunction AsyncInvoke(fn, receiver, arg) {\n this._normalQueue.push(fn, receiver, arg);\n this._queueTick();\n}\n\nfunction AsyncSettlePromises(promise) {\n this._normalQueue._pushOne(promise);\n this._queueTick();\n}\n\nif (!util.hasDevTools) {\n Async.prototype.invokeLater = AsyncInvokeLater;\n Async.prototype.invoke = AsyncInvoke;\n Async.prototype.settlePromises = AsyncSettlePromises;\n} else {\n Async.prototype.invokeLater = function (fn, receiver, arg) {\n if (this._trampolineEnabled) {\n AsyncInvokeLater.call(this, fn, receiver, arg);\n } else {\n this._schedule(function() {\n setTimeout(function() {\n fn.call(receiver, arg);\n }, 100);\n });\n }\n };\n\n Async.prototype.invoke = function (fn, receiver, arg) {\n if (this._trampolineEnabled) {\n AsyncInvoke.call(this, fn, receiver, arg);\n } else {\n this._schedule(function() {\n fn.call(receiver, arg);\n });\n }\n };\n\n Async.prototype.settlePromises = function(promise) {\n if (this._trampolineEnabled) {\n AsyncSettlePromises.call(this, promise);\n } else {\n this._schedule(function() {\n promise._settlePromises();\n });\n }\n };\n}\n\nAsync.prototype._drainQueue = function(queue) {\n while (queue.length() > 0) {\n var fn = queue.shift();\n if (typeof fn !== \"function\") {\n fn._settlePromises();\n continue;\n }\n var receiver = queue.shift();\n var arg = queue.shift();\n fn.call(receiver, arg);\n }\n};\n\nAsync.prototype._drainQueues = function () {\n this._drainQueue(this._normalQueue);\n this._reset();\n this._haveDrainedQueues = true;\n this._drainQueue(this._lateQueue);\n};\n\nAsync.prototype._queueTick = function () {\n if (!this._isTickUsed) {\n this._isTickUsed = true;\n this._schedule(this.drainQueues);\n }\n};\n\nAsync.prototype._reset = function () {\n this._isTickUsed = false;\n};\n\nmodule.exports = Async;\nmodule.exports.firstLineError = firstLineError;\n","\"use strict\";\nvar es5 = require(\"./es5\");\nvar Objectfreeze = es5.freeze;\nvar util = require(\"./util\");\nvar inherits = util.inherits;\nvar notEnumerableProp = util.notEnumerableProp;\n\nfunction subError(nameProperty, defaultMessage) {\n function SubError(message) {\n if (!(this instanceof SubError)) return new SubError(message);\n notEnumerableProp(this, \"message\",\n typeof message === \"string\" ? message : defaultMessage);\n notEnumerableProp(this, \"name\", nameProperty);\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, this.constructor);\n } else {\n Error.call(this);\n }\n }\n inherits(SubError, Error);\n return SubError;\n}\n\nvar _TypeError, _RangeError;\nvar Warning = subError(\"Warning\", \"warning\");\nvar CancellationError = subError(\"CancellationError\", \"cancellation error\");\nvar TimeoutError = subError(\"TimeoutError\", \"timeout error\");\nvar AggregateError = subError(\"AggregateError\", \"aggregate error\");\ntry {\n _TypeError = TypeError;\n _RangeError = RangeError;\n} catch(e) {\n _TypeError = subError(\"TypeError\", \"type error\");\n _RangeError = subError(\"RangeError\", \"range error\");\n}\n\nvar methods = (\"join pop push shift unshift slice filter forEach some \" +\n \"every map indexOf lastIndexOf reduce reduceRight sort reverse\").split(\" \");\n\nfor (var i = 0; i < methods.length; ++i) {\n if (typeof Array.prototype[methods[i]] === \"function\") {\n AggregateError.prototype[methods[i]] = Array.prototype[methods[i]];\n }\n}\n\nes5.defineProperty(AggregateError.prototype, \"length\", {\n value: 0,\n configurable: false,\n writable: true,\n enumerable: true\n});\nAggregateError.prototype[\"isOperational\"] = true;\nvar level = 0;\nAggregateError.prototype.toString = function() {\n var indent = Array(level * 4 + 1).join(\" \");\n var ret = \"\\n\" + indent + \"AggregateError of:\" + \"\\n\";\n level++;\n indent = Array(level * 4 + 1).join(\" \");\n for (var i = 0; i < this.length; ++i) {\n var str = this[i] === this ? \"[Circular AggregateError]\" : this[i] + \"\";\n var lines = str.split(\"\\n\");\n for (var j = 0; j < lines.length; ++j) {\n lines[j] = indent + lines[j];\n }\n str = lines.join(\"\\n\");\n ret += str + \"\\n\";\n }\n level--;\n return ret;\n};\n\nfunction OperationalError(message) {\n if (!(this instanceof OperationalError))\n return new OperationalError(message);\n notEnumerableProp(this, \"name\", \"OperationalError\");\n notEnumerableProp(this, \"message\", message);\n this.cause = message;\n this[\"isOperational\"] = true;\n\n if (message instanceof Error) {\n notEnumerableProp(this, \"message\", message.message);\n notEnumerableProp(this, \"stack\", message.stack);\n } else if (Error.captureStackTrace) {\n Error.captureStackTrace(this, this.constructor);\n }\n\n}\ninherits(OperationalError, Error);\n\nvar errorTypes = Error[\"__BluebirdErrorTypes__\"];\nif (!errorTypes) {\n errorTypes = Objectfreeze({\n CancellationError: CancellationError,\n TimeoutError: TimeoutError,\n OperationalError: OperationalError,\n RejectionError: OperationalError,\n AggregateError: AggregateError\n });\n es5.defineProperty(Error, \"__BluebirdErrorTypes__\", {\n value: errorTypes,\n writable: false,\n enumerable: false,\n configurable: false\n });\n}\n\nmodule.exports = {\n Error: Error,\n TypeError: _TypeError,\n RangeError: _RangeError,\n CancellationError: errorTypes.CancellationError,\n OperationalError: errorTypes.OperationalError,\n TimeoutError: errorTypes.TimeoutError,\n AggregateError: errorTypes.AggregateError,\n Warning: Warning\n};\n","\"use strict\";\nmodule.exports = function(Promise, INTERNAL) {\nvar util = require(\"./util\");\nvar errorObj = util.errorObj;\nvar isObject = util.isObject;\n\nfunction tryConvertToPromise(obj, context) {\n if (isObject(obj)) {\n if (obj instanceof Promise) return obj;\n var then = getThen(obj);\n if (then === errorObj) {\n if (context) context._pushContext();\n var ret = Promise.reject(then.e);\n if (context) context._popContext();\n return ret;\n } else if (typeof then === \"function\") {\n if (isAnyBluebirdPromise(obj)) {\n var ret = new Promise(INTERNAL);\n obj._then(\n ret._fulfill,\n ret._reject,\n undefined,\n ret,\n null\n );\n return ret;\n }\n return doThenable(obj, then, context);\n }\n }\n return obj;\n}\n\nfunction doGetThen(obj) {\n return obj.then;\n}\n\nfunction getThen(obj) {\n try {\n return doGetThen(obj);\n } catch (e) {\n errorObj.e = e;\n return errorObj;\n }\n}\n\nvar hasProp = {}.hasOwnProperty;\nfunction isAnyBluebirdPromise(obj) {\n try {\n return hasProp.call(obj, \"_promise0\");\n } catch (e) {\n return false;\n }\n}\n\nfunction doThenable(x, then, context) {\n var promise = new Promise(INTERNAL);\n var ret = promise;\n if (context) context._pushContext();\n promise._captureStackTrace();\n if (context) context._popContext();\n var synchronous = true;\n var result = util.tryCatch(then).call(x, resolve, reject);\n synchronous = false;\n\n if (promise && result === errorObj) {\n promise._rejectCallback(result.e, true, true);\n promise = null;\n }\n\n function resolve(value) {\n if (!promise) return;\n promise._resolveCallback(value);\n promise = null;\n }\n\n function reject(reason) {\n if (!promise) return;\n promise._rejectCallback(reason, synchronous, true);\n promise = null;\n }\n return ret;\n}\n\nreturn tryConvertToPromise;\n};\n","\"use strict\";\nmodule.exports = function(Promise, INTERNAL, tryConvertToPromise,\n apiRejection, Proxyable) {\nvar util = require(\"./util\");\nvar isArray = util.isArray;\n\nfunction toResolutionValue(val) {\n switch(val) {\n case -2: return [];\n case -3: return {};\n case -6: return new Map();\n }\n}\n\nfunction PromiseArray(values) {\n var promise = this._promise = new Promise(INTERNAL);\n if (values instanceof Promise) {\n promise._propagateFrom(values, 3);\n }\n promise._setOnCancel(this);\n this._values = values;\n this._length = 0;\n this._totalResolved = 0;\n this._init(undefined, -2);\n}\nutil.inherits(PromiseArray, Proxyable);\n\nPromiseArray.prototype.length = function () {\n return this._length;\n};\n\nPromiseArray.prototype.promise = function () {\n return this._promise;\n};\n\nPromiseArray.prototype._init = function init(_, resolveValueIfEmpty) {\n var values = tryConvertToPromise(this._values, this._promise);\n if (values instanceof Promise) {\n values = values._target();\n var bitField = values._bitField;\n ;\n this._values = values;\n\n if (((bitField & 50397184) === 0)) {\n this._promise._setAsyncGuaranteed();\n return values._then(\n init,\n this._reject,\n undefined,\n this,\n resolveValueIfEmpty\n );\n } else if (((bitField & 33554432) !== 0)) {\n values = values._value();\n } else if (((bitField & 16777216) !== 0)) {\n return this._reject(values._reason());\n } else {\n return this._cancel();\n }\n }\n values = util.asArray(values);\n if (values === null) {\n var err = apiRejection(\n \"expecting an array or an iterable object but got \" + util.classString(values)).reason();\n this._promise._rejectCallback(err, false);\n return;\n }\n\n if (values.length === 0) {\n if (resolveValueIfEmpty === -5) {\n this._resolveEmptyArray();\n }\n else {\n this._resolve(toResolutionValue(resolveValueIfEmpty));\n }\n return;\n }\n this._iterate(values);\n};\n\nPromiseArray.prototype._iterate = function(values) {\n var len = this.getActualLength(values.length);\n this._length = len;\n this._values = this.shouldCopyValues() ? new Array(len) : this._values;\n var result = this._promise;\n var isResolved = false;\n var bitField = null;\n for (var i = 0; i < len; ++i) {\n var maybePromise = tryConvertToPromise(values[i], result);\n\n if (maybePromise instanceof Promise) {\n maybePromise = maybePromise._target();\n bitField = maybePromise._bitField;\n } else {\n bitField = null;\n }\n\n if (isResolved) {\n if (bitField !== null) {\n maybePromise.suppressUnhandledRejections();\n }\n } else if (bitField !== null) {\n if (((bitField & 50397184) === 0)) {\n maybePromise._proxy(this, i);\n this._values[i] = maybePromise;\n } else if (((bitField & 33554432) !== 0)) {\n isResolved = this._promiseFulfilled(maybePromise._value(), i);\n } else if (((bitField & 16777216) !== 0)) {\n isResolved = this._promiseRejected(maybePromise._reason(), i);\n } else {\n isResolved = this._promiseCancelled(i);\n }\n } else {\n isResolved = this._promiseFulfilled(maybePromise, i);\n }\n }\n if (!isResolved) result._setAsyncGuaranteed();\n};\n\nPromiseArray.prototype._isResolved = function () {\n return this._values === null;\n};\n\nPromiseArray.prototype._resolve = function (value) {\n this._values = null;\n this._promise._fulfill(value);\n};\n\nPromiseArray.prototype._cancel = function() {\n if (this._isResolved() || !this._promise._isCancellable()) return;\n this._values = null;\n this._promise._cancel();\n};\n\nPromiseArray.prototype._reject = function (reason) {\n this._values = null;\n this._promise._rejectCallback(reason, false);\n};\n\nPromiseArray.prototype._promiseFulfilled = function (value, index) {\n this._values[index] = value;\n var totalResolved = ++this._totalResolved;\n if (totalResolved >= this._length) {\n this._resolve(this._values);\n return true;\n }\n return false;\n};\n\nPromiseArray.prototype._promiseCancelled = function() {\n this._cancel();\n return true;\n};\n\nPromiseArray.prototype._promiseRejected = function (reason) {\n this._totalResolved++;\n this._reject(reason);\n return true;\n};\n\nPromiseArray.prototype._resultCancelled = function() {\n if (this._isResolved()) return;\n var values = this._values;\n this._cancel();\n if (values instanceof Promise) {\n values.cancel();\n } else {\n for (var i = 0; i < values.length; ++i) {\n if (values[i] instanceof Promise) {\n values[i].cancel();\n }\n }\n }\n};\n\nPromiseArray.prototype.shouldCopyValues = function () {\n return true;\n};\n\nPromiseArray.prototype.getActualLength = function (len) {\n return len;\n};\n\nreturn PromiseArray;\n};\n","\"use strict\";\nmodule.exports = function(Promise) {\nvar longStackTraces = false;\nvar contextStack = [];\n\nPromise.prototype._promiseCreated = function() {};\nPromise.prototype._pushContext = function() {};\nPromise.prototype._popContext = function() {return null;};\nPromise._peekContext = Promise.prototype._peekContext = function() {};\n\nfunction Context() {\n this._trace = new Context.CapturedTrace(peekContext());\n}\nContext.prototype._pushContext = function () {\n if (this._trace !== undefined) {\n this._trace._promiseCreated = null;\n contextStack.push(this._trace);\n }\n};\n\nContext.prototype._popContext = function () {\n if (this._trace !== undefined) {\n var trace = contextStack.pop();\n var ret = trace._promiseCreated;\n trace._promiseCreated = null;\n return ret;\n }\n return null;\n};\n\nfunction createContext() {\n if (longStackTraces) return new Context();\n}\n\nfunction peekContext() {\n var lastIndex = contextStack.length - 1;\n if (lastIndex >= 0) {\n return contextStack[lastIndex];\n }\n return undefined;\n}\nContext.CapturedTrace = null;\nContext.create = createContext;\nContext.deactivateLongStackTraces = function() {};\nContext.activateLongStackTraces = function() {\n var Promise_pushContext = Promise.prototype._pushContext;\n var Promise_popContext = Promise.prototype._popContext;\n var Promise_PeekContext = Promise._peekContext;\n var Promise_peekContext = Promise.prototype._peekContext;\n var Promise_promiseCreated = Promise.prototype._promiseCreated;\n Context.deactivateLongStackTraces = function() {\n Promise.prototype._pushContext = Promise_pushContext;\n Promise.prototype._popContext = Promise_popContext;\n Promise._peekContext = Promise_PeekContext;\n Promise.prototype._peekContext = Promise_peekContext;\n Promise.prototype._promiseCreated = Promise_promiseCreated;\n longStackTraces = false;\n };\n longStackTraces = true;\n Promise.prototype._pushContext = Context.prototype._pushContext;\n Promise.prototype._popContext = Context.prototype._popContext;\n Promise._peekContext = Promise.prototype._peekContext = peekContext;\n Promise.prototype._promiseCreated = function() {\n var ctx = this._peekContext();\n if (ctx && ctx._promiseCreated == null) ctx._promiseCreated = this;\n };\n};\nreturn Context;\n};\n","\"use strict\";\nmodule.exports = function(Promise, Context) {\nvar getDomain = Promise._getDomain;\nvar async = Promise._async;\nvar Warning = require(\"./errors\").Warning;\nvar util = require(\"./util\");\nvar canAttachTrace = util.canAttachTrace;\nvar unhandledRejectionHandled;\nvar possiblyUnhandledRejection;\nvar bluebirdFramePattern =\n /[\\\\\\/]bluebird[\\\\\\/]js[\\\\\\/](release|debug|instrumented)/;\nvar nodeFramePattern = /\\((?:timers\\.js):\\d+:\\d+\\)/;\nvar parseLinePattern = /[\\/<\\(](.+?):(\\d+):(\\d+)\\)?\\s*$/;\nvar stackFramePattern = null;\nvar formatStack = null;\nvar indentStackFrames = false;\nvar printWarning;\nvar debugging = !!(util.env(\"BLUEBIRD_DEBUG\") != 0 &&\n (false ||\n util.env(\"BLUEBIRD_DEBUG\") ||\n util.env(\"NODE_ENV\") === \"development\"));\n\nvar warnings = !!(util.env(\"BLUEBIRD_WARNINGS\") != 0 &&\n (debugging || util.env(\"BLUEBIRD_WARNINGS\")));\n\nvar longStackTraces = !!(util.env(\"BLUEBIRD_LONG_STACK_TRACES\") != 0 &&\n (debugging || util.env(\"BLUEBIRD_LONG_STACK_TRACES\")));\n\nvar wForgottenReturn = util.env(\"BLUEBIRD_W_FORGOTTEN_RETURN\") != 0 &&\n (warnings || !!util.env(\"BLUEBIRD_W_FORGOTTEN_RETURN\"));\n\nPromise.prototype.suppressUnhandledRejections = function() {\n var target = this._target();\n target._bitField = ((target._bitField & (~1048576)) |\n 524288);\n};\n\nPromise.prototype._ensurePossibleRejectionHandled = function () {\n if ((this._bitField & 524288) !== 0) return;\n this._setRejectionIsUnhandled();\n var self = this;\n setTimeout(function() {\n self._notifyUnhandledRejection();\n }, 1);\n};\n\nPromise.prototype._notifyUnhandledRejectionIsHandled = function () {\n fireRejectionEvent(\"rejectionHandled\",\n unhandledRejectionHandled, undefined, this);\n};\n\nPromise.prototype._setReturnedNonUndefined = function() {\n this._bitField = this._bitField | 268435456;\n};\n\nPromise.prototype._returnedNonUndefined = function() {\n return (this._bitField & 268435456) !== 0;\n};\n\nPromise.prototype._notifyUnhandledRejection = function () {\n if (this._isRejectionUnhandled()) {\n var reason = this._settledValue();\n this._setUnhandledRejectionIsNotified();\n fireRejectionEvent(\"unhandledRejection\",\n possiblyUnhandledRejection, reason, this);\n }\n};\n\nPromise.prototype._setUnhandledRejectionIsNotified = function () {\n this._bitField = this._bitField | 262144;\n};\n\nPromise.prototype._unsetUnhandledRejectionIsNotified = function () {\n this._bitField = this._bitField & (~262144);\n};\n\nPromise.prototype._isUnhandledRejectionNotified = function () {\n return (this._bitField & 262144) > 0;\n};\n\nPromise.prototype._setRejectionIsUnhandled = function () {\n this._bitField = this._bitField | 1048576;\n};\n\nPromise.prototype._unsetRejectionIsUnhandled = function () {\n this._bitField = this._bitField & (~1048576);\n if (this._isUnhandledRejectionNotified()) {\n this._unsetUnhandledRejectionIsNotified();\n this._notifyUnhandledRejectionIsHandled();\n }\n};\n\nPromise.prototype._isRejectionUnhandled = function () {\n return (this._bitField & 1048576) > 0;\n};\n\nPromise.prototype._warn = function(message, shouldUseOwnTrace, promise) {\n return warn(message, shouldUseOwnTrace, promise || this);\n};\n\nPromise.onPossiblyUnhandledRejection = function (fn) {\n var domain = getDomain();\n possiblyUnhandledRejection =\n typeof fn === \"function\" ? (domain === null ?\n fn : util.domainBind(domain, fn))\n : undefined;\n};\n\nPromise.onUnhandledRejectionHandled = function (fn) {\n var domain = getDomain();\n unhandledRejectionHandled =\n typeof fn === \"function\" ? (domain === null ?\n fn : util.domainBind(domain, fn))\n : undefined;\n};\n\nvar disableLongStackTraces = function() {};\nPromise.longStackTraces = function () {\n if (async.haveItemsQueued() && !config.longStackTraces) {\n throw new Error(\"cannot enable long stack traces after promises have been created\\u000a\\u000a See http://goo.gl/MqrFmX\\u000a\");\n }\n if (!config.longStackTraces && longStackTracesIsSupported()) {\n var Promise_captureStackTrace = Promise.prototype._captureStackTrace;\n var Promise_attachExtraTrace = Promise.prototype._attachExtraTrace;\n config.longStackTraces = true;\n disableLongStackTraces = function() {\n if (async.haveItemsQueued() && !config.longStackTraces) {\n throw new Error(\"cannot enable long stack traces after promises have been created\\u000a\\u000a See http://goo.gl/MqrFmX\\u000a\");\n }\n Promise.prototype._captureStackTrace = Promise_captureStackTrace;\n Promise.prototype._attachExtraTrace = Promise_attachExtraTrace;\n Context.deactivateLongStackTraces();\n async.enableTrampoline();\n config.longStackTraces = false;\n };\n Promise.prototype._captureStackTrace = longStackTracesCaptureStackTrace;\n Promise.prototype._attachExtraTrace = longStackTracesAttachExtraTrace;\n Context.activateLongStackTraces();\n async.disableTrampolineIfNecessary();\n }\n};\n\nPromise.hasLongStackTraces = function () {\n return config.longStackTraces && longStackTracesIsSupported();\n};\n\nvar fireDomEvent = (function() {\n try {\n if (typeof CustomEvent === \"function\") {\n var event = new CustomEvent(\"CustomEvent\");\n util.global.dispatchEvent(event);\n return function(name, event) {\n var domEvent = new CustomEvent(name.toLowerCase(), {\n detail: event,\n cancelable: true\n });\n return !util.global.dispatchEvent(domEvent);\n };\n } else if (typeof Event === \"function\") {\n var event = new Event(\"CustomEvent\");\n util.global.dispatchEvent(event);\n return function(name, event) {\n var domEvent = new Event(name.toLowerCase(), {\n cancelable: true\n });\n domEvent.detail = event;\n return !util.global.dispatchEvent(domEvent);\n };\n } else {\n var event = document.createEvent(\"CustomEvent\");\n event.initCustomEvent(\"testingtheevent\", false, true, {});\n util.global.dispatchEvent(event);\n return function(name, event) {\n var domEvent = document.createEvent(\"CustomEvent\");\n domEvent.initCustomEvent(name.toLowerCase(), false, true,\n event);\n return !util.global.dispatchEvent(domEvent);\n };\n }\n } catch (e) {}\n return function() {\n return false;\n };\n})();\n\nvar fireGlobalEvent = (function() {\n if (util.isNode) {\n return function() {\n return process.emit.apply(process, arguments);\n };\n } else {\n if (!util.global) {\n return function() {\n return false;\n };\n }\n return function(name) {\n var methodName = \"on\" + name.toLowerCase();\n var method = util.global[methodName];\n if (!method) return false;\n method.apply(util.global, [].slice.call(arguments, 1));\n return true;\n };\n }\n})();\n\nfunction generatePromiseLifecycleEventObject(name, promise) {\n return {promise: promise};\n}\n\nvar eventToObjectGenerator = {\n promiseCreated: generatePromiseLifecycleEventObject,\n promiseFulfilled: generatePromiseLifecycleEventObject,\n promiseRejected: generatePromiseLifecycleEventObject,\n promiseResolved: generatePromiseLifecycleEventObject,\n promiseCancelled: generatePromiseLifecycleEventObject,\n promiseChained: function(name, promise, child) {\n return {promise: promise, child: child};\n },\n warning: function(name, warning) {\n return {warning: warning};\n },\n unhandledRejection: function (name, reason, promise) {\n return {reason: reason, promise: promise};\n },\n rejectionHandled: generatePromiseLifecycleEventObject\n};\n\nvar activeFireEvent = function (name) {\n var globalEventFired = false;\n try {\n globalEventFired = fireGlobalEvent.apply(null, arguments);\n } catch (e) {\n async.throwLater(e);\n globalEventFired = true;\n }\n\n var domEventFired = false;\n try {\n domEventFired = fireDomEvent(name,\n eventToObjectGenerator[name].apply(null, arguments));\n } catch (e) {\n async.throwLater(e);\n domEventFired = true;\n }\n\n return domEventFired || globalEventFired;\n};\n\nPromise.config = function(opts) {\n opts = Object(opts);\n if (\"longStackTraces\" in opts) {\n if (opts.longStackTraces) {\n Promise.longStackTraces();\n } else if (!opts.longStackTraces && Promise.hasLongStackTraces()) {\n disableLongStackTraces();\n }\n }\n if (\"warnings\" in opts) {\n var warningsOption = opts.warnings;\n config.warnings = !!warningsOption;\n wForgottenReturn = config.warnings;\n\n if (util.isObject(warningsOption)) {\n if (\"wForgottenReturn\" in warningsOption) {\n wForgottenReturn = !!warningsOption.wForgottenReturn;\n }\n }\n }\n if (\"cancellation\" in opts && opts.cancellation && !config.cancellation) {\n if (async.haveItemsQueued()) {\n throw new Error(\n \"cannot enable cancellation after promises are in use\");\n }\n Promise.prototype._clearCancellationData =\n cancellationClearCancellationData;\n Promise.prototype._propagateFrom = cancellationPropagateFrom;\n Promise.prototype._onCancel = cancellationOnCancel;\n Promise.prototype._setOnCancel = cancellationSetOnCancel;\n Promise.prototype._attachCancellationCallback =\n cancellationAttachCancellationCallback;\n Promise.prototype._execute = cancellationExecute;\n propagateFromFunction = cancellationPropagateFrom;\n config.cancellation = true;\n }\n if (\"monitoring\" in opts) {\n if (opts.monitoring && !config.monitoring) {\n config.monitoring = true;\n Promise.prototype._fireEvent = activeFireEvent;\n } else if (!opts.monitoring && config.monitoring) {\n config.monitoring = false;\n Promise.prototype._fireEvent = defaultFireEvent;\n }\n }\n return Promise;\n};\n\nfunction defaultFireEvent() { return false; }\n\nPromise.prototype._fireEvent = defaultFireEvent;\nPromise.prototype._execute = function(executor, resolve, reject) {\n try {\n executor(resolve, reject);\n } catch (e) {\n return e;\n }\n};\nPromise.prototype._onCancel = function () {};\nPromise.prototype._setOnCancel = function (handler) { ; };\nPromise.prototype._attachCancellationCallback = function(onCancel) {\n ;\n};\nPromise.prototype._captureStackTrace = function () {};\nPromise.prototype._attachExtraTrace = function () {};\nPromise.prototype._clearCancellationData = function() {};\nPromise.prototype._propagateFrom = function (parent, flags) {\n ;\n ;\n};\n\nfunction cancellationExecute(executor, resolve, reject) {\n var promise = this;\n try {\n executor(resolve, reject, function(onCancel) {\n if (typeof onCancel !== \"function\") {\n throw new TypeError(\"onCancel must be a function, got: \" +\n util.toString(onCancel));\n }\n promise._attachCancellationCallback(onCancel);\n });\n } catch (e) {\n return e;\n }\n}\n\nfunction cancellationAttachCancellationCallback(onCancel) {\n if (!this._isCancellable()) return this;\n\n var previousOnCancel = this._onCancel();\n if (previousOnCancel !== undefined) {\n if (util.isArray(previousOnCancel)) {\n previousOnCancel.push(onCancel);\n } else {\n this._setOnCancel([previousOnCancel, onCancel]);\n }\n } else {\n this._setOnCancel(onCancel);\n }\n}\n\nfunction cancellationOnCancel() {\n return this._onCancelField;\n}\n\nfunction cancellationSetOnCancel(onCancel) {\n this._onCancelField = onCancel;\n}\n\nfunction cancellationClearCancellationData() {\n this._cancellationParent = undefined;\n this._onCancelField = undefined;\n}\n\nfunction cancellationPropagateFrom(parent, flags) {\n if ((flags & 1) !== 0) {\n this._cancellationParent = parent;\n var branchesRemainingToCancel = parent._branchesRemainingToCancel;\n if (branchesRemainingToCancel === undefined) {\n branchesRemainingToCancel = 0;\n }\n parent._branchesRemainingToCancel = branchesRemainingToCancel + 1;\n }\n if ((flags & 2) !== 0 && parent._isBound()) {\n this._setBoundTo(parent._boundTo);\n }\n}\n\nfunction bindingPropagateFrom(parent, flags) {\n if ((flags & 2) !== 0 && parent._isBound()) {\n this._setBoundTo(parent._boundTo);\n }\n}\nvar propagateFromFunction = bindingPropagateFrom;\n\nfunction boundValueFunction() {\n var ret = this._boundTo;\n if (ret !== undefined) {\n if (ret instanceof Promise) {\n if (ret.isFulfilled()) {\n return ret.value();\n } else {\n return undefined;\n }\n }\n }\n return ret;\n}\n\nfunction longStackTracesCaptureStackTrace() {\n this._trace = new CapturedTrace(this._peekContext());\n}\n\nfunction longStackTracesAttachExtraTrace(error, ignoreSelf) {\n if (canAttachTrace(error)) {\n var trace = this._trace;\n if (trace !== undefined) {\n if (ignoreSelf) trace = trace._parent;\n }\n if (trace !== undefined) {\n trace.attachExtraTrace(error);\n } else if (!error.__stackCleaned__) {\n var parsed = parseStackAndMessage(error);\n util.notEnumerableProp(error, \"stack\",\n parsed.message + \"\\n\" + parsed.stack.join(\"\\n\"));\n util.notEnumerableProp(error, \"__stackCleaned__\", true);\n }\n }\n}\n\nfunction checkForgottenReturns(returnValue, promiseCreated, name, promise,\n parent) {\n if (returnValue === undefined && promiseCreated !== null &&\n wForgottenReturn) {\n if (parent !== undefined && parent._returnedNonUndefined()) return;\n if ((promise._bitField & 65535) === 0) return;\n\n if (name) name = name + \" \";\n var handlerLine = \"\";\n var creatorLine = \"\";\n if (promiseCreated._trace) {\n var traceLines = promiseCreated._trace.stack.split(\"\\n\");\n var stack = cleanStack(traceLines);\n for (var i = stack.length - 1; i >= 0; --i) {\n var line = stack[i];\n if (!nodeFramePattern.test(line)) {\n var lineMatches = line.match(parseLinePattern);\n if (lineMatches) {\n handlerLine = \"at \" + lineMatches[1] +\n \":\" + lineMatches[2] + \":\" + lineMatches[3] + \" \";\n }\n break;\n }\n }\n\n if (stack.length > 0) {\n var firstUserLine = stack[0];\n for (var i = 0; i < traceLines.length; ++i) {\n\n if (traceLines[i] === firstUserLine) {\n if (i > 0) {\n creatorLine = \"\\n\" + traceLines[i - 1];\n }\n break;\n }\n }\n\n }\n }\n var msg = \"a promise was created in a \" + name +\n \"handler \" + handlerLine + \"but was not returned from it, \" +\n \"see http://goo.gl/rRqMUw\" +\n creatorLine;\n promise._warn(msg, true, promiseCreated);\n }\n}\n\nfunction deprecated(name, replacement) {\n var message = name +\n \" is deprecated and will be removed in a future version.\";\n if (replacement) message += \" Use \" + replacement + \" instead.\";\n return warn(message);\n}\n\nfunction warn(message, shouldUseOwnTrace, promise) {\n if (!config.warnings) return;\n var warning = new Warning(message);\n var ctx;\n if (shouldUseOwnTrace) {\n promise._attachExtraTrace(warning);\n } else if (config.longStackTraces && (ctx = Promise._peekContext())) {\n ctx.attachExtraTrace(warning);\n } else {\n var parsed = parseStackAndMessage(warning);\n warning.stack = parsed.message + \"\\n\" + parsed.stack.join(\"\\n\");\n }\n\n if (!activeFireEvent(\"warning\", warning)) {\n formatAndLogError(warning, \"\", true);\n }\n}\n\nfunction reconstructStack(message, stacks) {\n for (var i = 0; i < stacks.length - 1; ++i) {\n stacks[i].push(\"From previous event:\");\n stacks[i] = stacks[i].join(\"\\n\");\n }\n if (i < stacks.length) {\n stacks[i] = stacks[i].join(\"\\n\");\n }\n return message + \"\\n\" + stacks.join(\"\\n\");\n}\n\nfunction removeDuplicateOrEmptyJumps(stacks) {\n for (var i = 0; i < stacks.length; ++i) {\n if (stacks[i].length === 0 ||\n ((i + 1 < stacks.length) && stacks[i][0] === stacks[i+1][0])) {\n stacks.splice(i, 1);\n i--;\n }\n }\n}\n\nfunction removeCommonRoots(stacks) {\n var current = stacks[0];\n for (var i = 1; i < stacks.length; ++i) {\n var prev = stacks[i];\n var currentLastIndex = current.length - 1;\n var currentLastLine = current[currentLastIndex];\n var commonRootMeetPoint = -1;\n\n for (var j = prev.length - 1; j >= 0; --j) {\n if (prev[j] === currentLastLine) {\n commonRootMeetPoint = j;\n break;\n }\n }\n\n for (var j = commonRootMeetPoint; j >= 0; --j) {\n var line = prev[j];\n if (current[currentLastIndex] === line) {\n current.pop();\n currentLastIndex--;\n } else {\n break;\n }\n }\n current = prev;\n }\n}\n\nfunction cleanStack(stack) {\n var ret = [];\n for (var i = 0; i < stack.length; ++i) {\n var line = stack[i];\n var isTraceLine = \" (No stack trace)\" === line ||\n stackFramePattern.test(line);\n var isInternalFrame = isTraceLine && shouldIgnore(line);\n if (isTraceLine && !isInternalFrame) {\n if (indentStackFrames && line.charAt(0) !== \" \") {\n line = \" \" + line;\n }\n ret.push(line);\n }\n }\n return ret;\n}\n\nfunction stackFramesAsArray(error) {\n var stack = error.stack.replace(/\\s+$/g, \"\").split(\"\\n\");\n for (var i = 0; i < stack.length; ++i) {\n var line = stack[i];\n if (\" (No stack trace)\" === line || stackFramePattern.test(line)) {\n break;\n }\n }\n if (i > 0 && error.name != \"SyntaxError\") {\n stack = stack.slice(i);\n }\n return stack;\n}\n\nfunction parseStackAndMessage(error) {\n var stack = error.stack;\n var message = error.toString();\n stack = typeof stack === \"string\" && stack.length > 0\n ? stackFramesAsArray(error) : [\" (No stack trace)\"];\n return {\n message: message,\n stack: error.name == \"SyntaxError\" ? stack : cleanStack(stack)\n };\n}\n\nfunction formatAndLogError(error, title, isSoft) {\n if (typeof console !== \"undefined\") {\n var message;\n if (util.isObject(error)) {\n var stack = error.stack;\n message = title + formatStack(stack, error);\n } else {\n message = title + String(error);\n }\n if (typeof printWarning === \"function\") {\n printWarning(message, isSoft);\n } else if (typeof console.log === \"function\" ||\n typeof console.log === \"object\") {\n console.log(message);\n }\n }\n}\n\nfunction fireRejectionEvent(name, localHandler, reason, promise) {\n var localEventFired = false;\n try {\n if (typeof localHandler === \"function\") {\n localEventFired = true;\n if (name === \"rejectionHandled\") {\n localHandler(promise);\n } else {\n localHandler(reason, promise);\n }\n }\n } catch (e) {\n async.throwLater(e);\n }\n\n if (name === \"unhandledRejection\") {\n if (!activeFireEvent(name, reason, promise) && !localEventFired) {\n formatAndLogError(reason, \"Unhandled rejection \");\n }\n } else {\n activeFireEvent(name, promise);\n }\n}\n\nfunction formatNonError(obj) {\n var str;\n if (typeof obj === \"function\") {\n str = \"[function \" +\n (obj.name || \"anonymous\") +\n \"]\";\n } else {\n str = obj && typeof obj.toString === \"function\"\n ? obj.toString() : util.toString(obj);\n var ruselessToString = /\\[object [a-zA-Z0-9$_]+\\]/;\n if (ruselessToString.test(str)) {\n try {\n var newStr = JSON.stringify(obj);\n str = newStr;\n }\n catch(e) {\n\n }\n }\n if (str.length === 0) {\n str = \"(empty array)\";\n }\n }\n return (\"(<\" + snip(str) + \">, no stack trace)\");\n}\n\nfunction snip(str) {\n var maxChars = 41;\n if (str.length < maxChars) {\n return str;\n }\n return str.substr(0, maxChars - 3) + \"...\";\n}\n\nfunction longStackTracesIsSupported() {\n return typeof captureStackTrace === \"function\";\n}\n\nvar shouldIgnore = function() { return false; };\nvar parseLineInfoRegex = /[\\/<\\(]([^:\\/]+):(\\d+):(?:\\d+)\\)?\\s*$/;\nfunction parseLineInfo(line) {\n var matches = line.match(parseLineInfoRegex);\n if (matches) {\n return {\n fileName: matches[1],\n line: parseInt(matches[2], 10)\n };\n }\n}\n\nfunction setBounds(firstLineError, lastLineError) {\n if (!longStackTracesIsSupported()) return;\n var firstStackLines = firstLineError.stack.split(\"\\n\");\n var lastStackLines = lastLineError.stack.split(\"\\n\");\n var firstIndex = -1;\n var lastIndex = -1;\n var firstFileName;\n var lastFileName;\n for (var i = 0; i < firstStackLines.length; ++i) {\n var result = parseLineInfo(firstStackLines[i]);\n if (result) {\n firstFileName = result.fileName;\n firstIndex = result.line;\n break;\n }\n }\n for (var i = 0; i < lastStackLines.length; ++i) {\n var result = parseLineInfo(lastStackLines[i]);\n if (result) {\n lastFileName = result.fileName;\n lastIndex = result.line;\n break;\n }\n }\n if (firstIndex < 0 || lastIndex < 0 || !firstFileName || !lastFileName ||\n firstFileName !== lastFileName || firstIndex >= lastIndex) {\n return;\n }\n\n shouldIgnore = function(line) {\n if (bluebirdFramePattern.test(line)) return true;\n var info = parseLineInfo(line);\n if (info) {\n if (info.fileName === firstFileName &&\n (firstIndex <= info.line && info.line <= lastIndex)) {\n return true;\n }\n }\n return false;\n };\n}\n\nfunction CapturedTrace(parent) {\n this._parent = parent;\n this._promisesCreated = 0;\n var length = this._length = 1 + (parent === undefined ? 0 : parent._length);\n captureStackTrace(this, CapturedTrace);\n if (length > 32) this.uncycle();\n}\nutil.inherits(CapturedTrace, Error);\nContext.CapturedTrace = CapturedTrace;\n\nCapturedTrace.prototype.uncycle = function() {\n var length = this._length;\n if (length < 2) return;\n var nodes = [];\n var stackToIndex = {};\n\n for (var i = 0, node = this; node !== undefined; ++i) {\n nodes.push(node);\n node = node._parent;\n }\n length = this._length = i;\n for (var i = length - 1; i >= 0; --i) {\n var stack = nodes[i].stack;\n if (stackToIndex[stack] === undefined) {\n stackToIndex[stack] = i;\n }\n }\n for (var i = 0; i < length; ++i) {\n var currentStack = nodes[i].stack;\n var index = stackToIndex[currentStack];\n if (index !== undefined && index !== i) {\n if (index > 0) {\n nodes[index - 1]._parent = undefined;\n nodes[index - 1]._length = 1;\n }\n nodes[i]._parent = undefined;\n nodes[i]._length = 1;\n var cycleEdgeNode = i > 0 ? nodes[i - 1] : this;\n\n if (index < length - 1) {\n cycleEdgeNode._parent = nodes[index + 1];\n cycleEdgeNode._parent.uncycle();\n cycleEdgeNode._length =\n cycleEdgeNode._parent._length + 1;\n } else {\n cycleEdgeNode._parent = undefined;\n cycleEdgeNode._length = 1;\n }\n var currentChildLength = cycleEdgeNode._length + 1;\n for (var j = i - 2; j >= 0; --j) {\n nodes[j]._length = currentChildLength;\n currentChildLength++;\n }\n return;\n }\n }\n};\n\nCapturedTrace.prototype.attachExtraTrace = function(error) {\n if (error.__stackCleaned__) return;\n this.uncycle();\n var parsed = parseStackAndMessage(error);\n var message = parsed.message;\n var stacks = [parsed.stack];\n\n var trace = this;\n while (trace !== undefined) {\n stacks.push(cleanStack(trace.stack.split(\"\\n\")));\n trace = trace._parent;\n }\n removeCommonRoots(stacks);\n removeDuplicateOrEmptyJumps(stacks);\n util.notEnumerableProp(error, \"stack\", reconstructStack(message, stacks));\n util.notEnumerableProp(error, \"__stackCleaned__\", true);\n};\n\nvar captureStackTrace = (function stackDetection() {\n var v8stackFramePattern = /^\\s*at\\s*/;\n var v8stackFormatter = function(stack, error) {\n if (typeof stack === \"string\") return stack;\n\n if (error.name !== undefined &&\n error.message !== undefined) {\n return error.toString();\n }\n return formatNonError(error);\n };\n\n if (typeof Error.stackTraceLimit === \"number\" &&\n typeof Error.captureStackTrace === \"function\") {\n Error.stackTraceLimit += 6;\n stackFramePattern = v8stackFramePattern;\n formatStack = v8stackFormatter;\n var captureStackTrace = Error.captureStackTrace;\n\n shouldIgnore = function(line) {\n return bluebirdFramePattern.test(line);\n };\n return function(receiver, ignoreUntil) {\n Error.stackTraceLimit += 6;\n captureStackTrace(receiver, ignoreUntil);\n Error.stackTraceLimit -= 6;\n };\n }\n var err = new Error();\n\n if (typeof err.stack === \"string\" &&\n err.stack.split(\"\\n\")[0].indexOf(\"stackDetection@\") >= 0) {\n stackFramePattern = /@/;\n formatStack = v8stackFormatter;\n indentStackFrames = true;\n return function captureStackTrace(o) {\n o.stack = new Error().stack;\n };\n }\n\n var hasStackAfterThrow;\n try { throw new Error(); }\n catch(e) {\n hasStackAfterThrow = (\"stack\" in e);\n }\n if (!(\"stack\" in err) && hasStackAfterThrow &&\n typeof Error.stackTraceLimit === \"number\") {\n stackFramePattern = v8stackFramePattern;\n formatStack = v8stackFormatter;\n return function captureStackTrace(o) {\n Error.stackTraceLimit += 6;\n try { throw new Error(); }\n catch(e) { o.stack = e.stack; }\n Error.stackTraceLimit -= 6;\n };\n }\n\n formatStack = function(stack, error) {\n if (typeof stack === \"string\") return stack;\n\n if ((typeof error === \"object\" ||\n typeof error === \"function\") &&\n error.name !== undefined &&\n error.message !== undefined) {\n return error.toString();\n }\n return formatNonError(error);\n };\n\n return null;\n\n})([]);\n\nif (typeof console !== \"undefined\" && typeof console.warn !== \"undefined\") {\n printWarning = function (message) {\n console.warn(message);\n };\n if (util.isNode && process.stderr.isTTY) {\n printWarning = function(message, isSoft) {\n var color = isSoft ? \"\\u001b[33m\" : \"\\u001b[31m\";\n console.warn(color + message + \"\\u001b[0m\\n\");\n };\n } else if (!util.isNode && typeof (new Error().stack) === \"string\") {\n printWarning = function(message, isSoft) {\n console.warn(\"%c\" + message,\n isSoft ? \"color: darkorange\" : \"color: red\");\n };\n }\n}\n\nvar config = {\n warnings: warnings,\n longStackTraces: false,\n cancellation: false,\n monitoring: false\n};\n\nif (longStackTraces) Promise.longStackTraces();\n\nreturn {\n longStackTraces: function() {\n return config.longStackTraces;\n },\n warnings: function() {\n return config.warnings;\n },\n cancellation: function() {\n return config.cancellation;\n },\n monitoring: function() {\n return config.monitoring;\n },\n propagateFromFunction: function() {\n return propagateFromFunction;\n },\n boundValueFunction: function() {\n return boundValueFunction;\n },\n checkForgottenReturns: checkForgottenReturns,\n setBounds: setBounds,\n warn: warn,\n deprecated: deprecated,\n CapturedTrace: CapturedTrace,\n fireDomEvent: fireDomEvent,\n fireGlobalEvent: fireGlobalEvent\n};\n};\n","\"use strict\";\nmodule.exports = function(NEXT_FILTER) {\nvar util = require(\"./util\");\nvar getKeys = require(\"./es5\").keys;\nvar tryCatch = util.tryCatch;\nvar errorObj = util.errorObj;\n\nfunction catchFilter(instances, cb, promise) {\n return function(e) {\n var boundTo = promise._boundValue();\n predicateLoop: for (var i = 0; i < instances.length; ++i) {\n var item = instances[i];\n\n if (item === Error ||\n (item != null && item.prototype instanceof Error)) {\n if (e instanceof item) {\n return tryCatch(cb).call(boundTo, e);\n }\n } else if (typeof item === \"function\") {\n var matchesPredicate = tryCatch(item).call(boundTo, e);\n if (matchesPredicate === errorObj) {\n return matchesPredicate;\n } else if (matchesPredicate) {\n return tryCatch(cb).call(boundTo, e);\n }\n } else if (util.isObject(e)) {\n var keys = getKeys(item);\n for (var j = 0; j < keys.length; ++j) {\n var key = keys[j];\n if (item[key] != e[key]) {\n continue predicateLoop;\n }\n }\n return tryCatch(cb).call(boundTo, e);\n }\n }\n return NEXT_FILTER;\n };\n}\n\nreturn catchFilter;\n};\n","\"use strict\";\nmodule.exports = function(Promise, tryConvertToPromise, NEXT_FILTER) {\nvar util = require(\"./util\");\nvar CancellationError = Promise.CancellationError;\nvar errorObj = util.errorObj;\nvar catchFilter = require(\"./catch_filter\")(NEXT_FILTER);\n\nfunction PassThroughHandlerContext(promise, type, handler) {\n this.promise = promise;\n this.type = type;\n this.handler = handler;\n this.called = false;\n this.cancelPromise = null;\n}\n\nPassThroughHandlerContext.prototype.isFinallyHandler = function() {\n return this.type === 0;\n};\n\nfunction FinallyHandlerCancelReaction(finallyHandler) {\n this.finallyHandler = finallyHandler;\n}\n\nFinallyHandlerCancelReaction.prototype._resultCancelled = function() {\n checkCancel(this.finallyHandler);\n};\n\nfunction checkCancel(ctx, reason) {\n if (ctx.cancelPromise != null) {\n if (arguments.length > 1) {\n ctx.cancelPromise._reject(reason);\n } else {\n ctx.cancelPromise._cancel();\n }\n ctx.cancelPromise = null;\n return true;\n }\n return false;\n}\n\nfunction succeed() {\n return finallyHandler.call(this, this.promise._target()._settledValue());\n}\nfunction fail(reason) {\n if (checkCancel(this, reason)) return;\n errorObj.e = reason;\n return errorObj;\n}\nfunction finallyHandler(reasonOrValue) {\n var promise = this.promise;\n var handler = this.handler;\n\n if (!this.called) {\n this.called = true;\n var ret = this.isFinallyHandler()\n ? handler.call(promise._boundValue())\n : handler.call(promise._boundValue(), reasonOrValue);\n if (ret === NEXT_FILTER) {\n return ret;\n } else if (ret !== undefined) {\n promise._setReturnedNonUndefined();\n var maybePromise = tryConvertToPromise(ret, promise);\n if (maybePromise instanceof Promise) {\n if (this.cancelPromise != null) {\n if (maybePromise._isCancelled()) {\n var reason =\n new CancellationError(\"late cancellation observer\");\n promise._attachExtraTrace(reason);\n errorObj.e = reason;\n return errorObj;\n } else if (maybePromise.isPending()) {\n maybePromise._attachCancellationCallback(\n new FinallyHandlerCancelReaction(this));\n }\n }\n return maybePromise._then(\n succeed, fail, undefined, this, undefined);\n }\n }\n }\n\n if (promise.isRejected()) {\n checkCancel(this);\n errorObj.e = reasonOrValue;\n return errorObj;\n } else {\n checkCancel(this);\n return reasonOrValue;\n }\n}\n\nPromise.prototype._passThrough = function(handler, type, success, fail) {\n if (typeof handler !== \"function\") return this.then();\n return this._then(success,\n fail,\n undefined,\n new PassThroughHandlerContext(this, type, handler),\n undefined);\n};\n\nPromise.prototype.lastly =\nPromise.prototype[\"finally\"] = function (handler) {\n return this._passThrough(handler,\n 0,\n finallyHandler,\n finallyHandler);\n};\n\n\nPromise.prototype.tap = function (handler) {\n return this._passThrough(handler, 1, finallyHandler);\n};\n\nPromise.prototype.tapCatch = function (handlerOrPredicate) {\n var len = arguments.length;\n if(len === 1) {\n return this._passThrough(handlerOrPredicate,\n 1,\n undefined,\n finallyHandler);\n } else {\n var catchInstances = new Array(len - 1),\n j = 0, i;\n for (i = 0; i < len - 1; ++i) {\n var item = arguments[i];\n if (util.isObject(item)) {\n catchInstances[j++] = item;\n } else {\n return Promise.reject(new TypeError(\n \"tapCatch statement predicate: \"\n + \"expecting an object but got \" + util.classString(item)\n ));\n }\n }\n catchInstances.length = j;\n var handler = arguments[i];\n return this._passThrough(catchFilter(catchInstances, handler, this),\n 1,\n undefined,\n finallyHandler);\n }\n\n};\n\nreturn PassThroughHandlerContext;\n};\n","\"use strict\";\nvar util = require(\"./util\");\nvar maybeWrapAsError = util.maybeWrapAsError;\nvar errors = require(\"./errors\");\nvar OperationalError = errors.OperationalError;\nvar es5 = require(\"./es5\");\n\nfunction isUntypedError(obj) {\n return obj instanceof Error &&\n es5.getPrototypeOf(obj) === Error.prototype;\n}\n\nvar rErrorKey = /^(?:name|message|stack|cause)$/;\nfunction wrapAsOperationalError(obj) {\n var ret;\n if (isUntypedError(obj)) {\n ret = new OperationalError(obj);\n ret.name = obj.name;\n ret.message = obj.message;\n ret.stack = obj.stack;\n var keys = es5.keys(obj);\n for (var i = 0; i < keys.length; ++i) {\n var key = keys[i];\n if (!rErrorKey.test(key)) {\n ret[key] = obj[key];\n }\n }\n return ret;\n }\n util.markAsOriginatingFromRejection(obj);\n return obj;\n}\n\nfunction nodebackForPromise(promise, multiArgs) {\n return function(err, value) {\n if (promise === null) return;\n if (err) {\n var wrapped = wrapAsOperationalError(maybeWrapAsError(err));\n promise._attachExtraTrace(wrapped);\n promise._reject(wrapped);\n } else if (!multiArgs) {\n promise._fulfill(value);\n } else {\n var $_len = arguments.length;var args = new Array(Math.max($_len - 1, 0)); for(var $_i = 1; $_i < $_len; ++$_i) {args[$_i - 1] = arguments[$_i];};\n promise._fulfill(args);\n }\n promise = null;\n };\n}\n\nmodule.exports = nodebackForPromise;\n","\"use strict\";\nmodule.exports =\nfunction(Promise, INTERNAL, tryConvertToPromise, apiRejection, debug) {\nvar util = require(\"./util\");\nvar tryCatch = util.tryCatch;\n\nPromise.method = function (fn) {\n if (typeof fn !== \"function\") {\n throw new Promise.TypeError(\"expecting a function but got \" + util.classString(fn));\n }\n return function () {\n var ret = new Promise(INTERNAL);\n ret._captureStackTrace();\n ret._pushContext();\n var value = tryCatch(fn).apply(this, arguments);\n var promiseCreated = ret._popContext();\n debug.checkForgottenReturns(\n value, promiseCreated, \"Promise.method\", ret);\n ret._resolveFromSyncValue(value);\n return ret;\n };\n};\n\nPromise.attempt = Promise[\"try\"] = function (fn) {\n if (typeof fn !== \"function\") {\n return apiRejection(\"expecting a function but got \" + util.classString(fn));\n }\n var ret = new Promise(INTERNAL);\n ret._captureStackTrace();\n ret._pushContext();\n var value;\n if (arguments.length > 1) {\n debug.deprecated(\"calling Promise.try with more than 1 argument\");\n var arg = arguments[1];\n var ctx = arguments[2];\n value = util.isArray(arg) ? tryCatch(fn).apply(ctx, arg)\n : tryCatch(fn).call(ctx, arg);\n } else {\n value = tryCatch(fn)();\n }\n var promiseCreated = ret._popContext();\n debug.checkForgottenReturns(\n value, promiseCreated, \"Promise.try\", ret);\n ret._resolveFromSyncValue(value);\n return ret;\n};\n\nPromise.prototype._resolveFromSyncValue = function (value) {\n if (value === util.errorObj) {\n this._rejectCallback(value.e, false);\n } else {\n this._resolveCallback(value, true);\n }\n};\n};\n","\"use strict\";\nmodule.exports = function(Promise, INTERNAL, tryConvertToPromise, debug) {\nvar calledBind = false;\nvar rejectThis = function(_, e) {\n this._reject(e);\n};\n\nvar targetRejected = function(e, context) {\n context.promiseRejectionQueued = true;\n context.bindingPromise._then(rejectThis, rejectThis, null, this, e);\n};\n\nvar bindingResolved = function(thisArg, context) {\n if (((this._bitField & 50397184) === 0)) {\n this._resolveCallback(context.target);\n }\n};\n\nvar bindingRejected = function(e, context) {\n if (!context.promiseRejectionQueued) this._reject(e);\n};\n\nPromise.prototype.bind = function (thisArg) {\n if (!calledBind) {\n calledBind = true;\n Promise.prototype._propagateFrom = debug.propagateFromFunction();\n Promise.prototype._boundValue = debug.boundValueFunction();\n }\n var maybePromise = tryConvertToPromise(thisArg);\n var ret = new Promise(INTERNAL);\n ret._propagateFrom(this, 1);\n var target = this._target();\n ret._setBoundTo(maybePromise);\n if (maybePromise instanceof Promise) {\n var context = {\n promiseRejectionQueued: false,\n promise: ret,\n target: target,\n bindingPromise: maybePromise\n };\n target._then(INTERNAL, targetRejected, undefined, ret, context);\n maybePromise._then(\n bindingResolved, bindingRejected, undefined, ret, context);\n ret._setOnCancel(maybePromise);\n } else {\n ret._resolveCallback(target);\n }\n return ret;\n};\n\nPromise.prototype._setBoundTo = function (obj) {\n if (obj !== undefined) {\n this._bitField = this._bitField | 2097152;\n this._boundTo = obj;\n } else {\n this._bitField = this._bitField & (~2097152);\n }\n};\n\nPromise.prototype._isBound = function () {\n return (this._bitField & 2097152) === 2097152;\n};\n\nPromise.bind = function (thisArg, value) {\n return Promise.resolve(value).bind(thisArg);\n};\n};\n","\"use strict\";\nmodule.exports = function(Promise, PromiseArray, apiRejection, debug) {\nvar util = require(\"./util\");\nvar tryCatch = util.tryCatch;\nvar errorObj = util.errorObj;\nvar async = Promise._async;\n\nPromise.prototype[\"break\"] = Promise.prototype.cancel = function() {\n if (!debug.cancellation()) return this._warn(\"cancellation is disabled\");\n\n var promise = this;\n var child = promise;\n while (promise._isCancellable()) {\n if (!promise._cancelBy(child)) {\n if (child._isFollowing()) {\n child._followee().cancel();\n } else {\n child._cancelBranched();\n }\n break;\n }\n\n var parent = promise._cancellationParent;\n if (parent == null || !parent._isCancellable()) {\n if (promise._isFollowing()) {\n promise._followee().cancel();\n } else {\n promise._cancelBranched();\n }\n break;\n } else {\n if (promise._isFollowing()) promise._followee().cancel();\n promise._setWillBeCancelled();\n child = promise;\n promise = parent;\n }\n }\n};\n\nPromise.prototype._branchHasCancelled = function() {\n this._branchesRemainingToCancel--;\n};\n\nPromise.prototype._enoughBranchesHaveCancelled = function() {\n return this._branchesRemainingToCancel === undefined ||\n this._branchesRemainingToCancel <= 0;\n};\n\nPromise.prototype._cancelBy = function(canceller) {\n if (canceller === this) {\n this._branchesRemainingToCancel = 0;\n this._invokeOnCancel();\n return true;\n } else {\n this._branchHasCancelled();\n if (this._enoughBranchesHaveCancelled()) {\n this._invokeOnCancel();\n return true;\n }\n }\n return false;\n};\n\nPromise.prototype._cancelBranched = function() {\n if (this._enoughBranchesHaveCancelled()) {\n this._cancel();\n }\n};\n\nPromise.prototype._cancel = function() {\n if (!this._isCancellable()) return;\n this._setCancelled();\n async.invoke(this._cancelPromises, this, undefined);\n};\n\nPromise.prototype._cancelPromises = function() {\n if (this._length() > 0) this._settlePromises();\n};\n\nPromise.prototype._unsetOnCancel = function() {\n this._onCancelField = undefined;\n};\n\nPromise.prototype._isCancellable = function() {\n return this.isPending() && !this._isCancelled();\n};\n\nPromise.prototype.isCancellable = function() {\n return this.isPending() && !this.isCancelled();\n};\n\nPromise.prototype._doInvokeOnCancel = function(onCancelCallback, internalOnly) {\n if (util.isArray(onCancelCallback)) {\n for (var i = 0; i < onCancelCallback.length; ++i) {\n this._doInvokeOnCancel(onCancelCallback[i], internalOnly);\n }\n } else if (onCancelCallback !== undefined) {\n if (typeof onCancelCallback === \"function\") {\n if (!internalOnly) {\n var e = tryCatch(onCancelCallback).call(this._boundValue());\n if (e === errorObj) {\n this._attachExtraTrace(e.e);\n async.throwLater(e.e);\n }\n }\n } else {\n onCancelCallback._resultCancelled(this);\n }\n }\n};\n\nPromise.prototype._invokeOnCancel = function() {\n var onCancelCallback = this._onCancel();\n this._unsetOnCancel();\n async.invoke(this._doInvokeOnCancel, this, onCancelCallback);\n};\n\nPromise.prototype._invokeInternalOnCancel = function() {\n if (this._isCancellable()) {\n this._doInvokeOnCancel(this._onCancel(), true);\n this._unsetOnCancel();\n }\n};\n\nPromise.prototype._resultCancelled = function() {\n this.cancel();\n};\n\n};\n","\"use strict\";\nmodule.exports = function(Promise) {\nfunction returner() {\n return this.value;\n}\nfunction thrower() {\n throw this.reason;\n}\n\nPromise.prototype[\"return\"] =\nPromise.prototype.thenReturn = function (value) {\n if (value instanceof Promise) value.suppressUnhandledRejections();\n return this._then(\n returner, undefined, undefined, {value: value}, undefined);\n};\n\nPromise.prototype[\"throw\"] =\nPromise.prototype.thenThrow = function (reason) {\n return this._then(\n thrower, undefined, undefined, {reason: reason}, undefined);\n};\n\nPromise.prototype.catchThrow = function (reason) {\n if (arguments.length <= 1) {\n return this._then(\n undefined, thrower, undefined, {reason: reason}, undefined);\n } else {\n var _reason = arguments[1];\n var handler = function() {throw _reason;};\n return this.caught(reason, handler);\n }\n};\n\nPromise.prototype.catchReturn = function (value) {\n if (arguments.length <= 1) {\n if (value instanceof Promise) value.suppressUnhandledRejections();\n return this._then(\n undefined, returner, undefined, {value: value}, undefined);\n } else {\n var _value = arguments[1];\n if (_value instanceof Promise) _value.suppressUnhandledRejections();\n var handler = function() {return _value;};\n return this.caught(value, handler);\n }\n};\n};\n","\"use strict\";\nmodule.exports = function(Promise) {\nfunction PromiseInspection(promise) {\n if (promise !== undefined) {\n promise = promise._target();\n this._bitField = promise._bitField;\n this._settledValueField = promise._isFateSealed()\n ? promise._settledValue() : undefined;\n }\n else {\n this._bitField = 0;\n this._settledValueField = undefined;\n }\n}\n\nPromiseInspection.prototype._settledValue = function() {\n return this._settledValueField;\n};\n\nvar value = PromiseInspection.prototype.value = function () {\n if (!this.isFulfilled()) {\n throw new TypeError(\"cannot get fulfillment value of a non-fulfilled promise\\u000a\\u000a See http://goo.gl/MqrFmX\\u000a\");\n }\n return this._settledValue();\n};\n\nvar reason = PromiseInspection.prototype.error =\nPromiseInspection.prototype.reason = function () {\n if (!this.isRejected()) {\n throw new TypeError(\"cannot get rejection reason of a non-rejected promise\\u000a\\u000a See http://goo.gl/MqrFmX\\u000a\");\n }\n return this._settledValue();\n};\n\nvar isFulfilled = PromiseInspection.prototype.isFulfilled = function() {\n return (this._bitField & 33554432) !== 0;\n};\n\nvar isRejected = PromiseInspection.prototype.isRejected = function () {\n return (this._bitField & 16777216) !== 0;\n};\n\nvar isPending = PromiseInspection.prototype.isPending = function () {\n return (this._bitField & 50397184) === 0;\n};\n\nvar isResolved = PromiseInspection.prototype.isResolved = function () {\n return (this._bitField & 50331648) !== 0;\n};\n\nPromiseInspection.prototype.isCancelled = function() {\n return (this._bitField & 8454144) !== 0;\n};\n\nPromise.prototype.__isCancelled = function() {\n return (this._bitField & 65536) === 65536;\n};\n\nPromise.prototype._isCancelled = function() {\n return this._target().__isCancelled();\n};\n\nPromise.prototype.isCancelled = function() {\n return (this._target()._bitField & 8454144) !== 0;\n};\n\nPromise.prototype.isPending = function() {\n return isPending.call(this._target());\n};\n\nPromise.prototype.isRejected = function() {\n return isRejected.call(this._target());\n};\n\nPromise.prototype.isFulfilled = function() {\n return isFulfilled.call(this._target());\n};\n\nPromise.prototype.isResolved = function() {\n return isResolved.call(this._target());\n};\n\nPromise.prototype.value = function() {\n return value.call(this._target());\n};\n\nPromise.prototype.reason = function() {\n var target = this._target();\n target._unsetRejectionIsUnhandled();\n return reason.call(target);\n};\n\nPromise.prototype._value = function() {\n return this._settledValue();\n};\n\nPromise.prototype._reason = function() {\n this._unsetRejectionIsUnhandled();\n return this._settledValue();\n};\n\nPromise.PromiseInspection = PromiseInspection;\n};\n","\"use strict\";\nmodule.exports =\nfunction(Promise, PromiseArray, tryConvertToPromise, INTERNAL, async,\n getDomain) {\nvar util = require(\"./util\");\nvar canEvaluate = util.canEvaluate;\nvar tryCatch = util.tryCatch;\nvar errorObj = util.errorObj;\nvar reject;\n\nif (!false) {\nif (canEvaluate) {\n var thenCallback = function(i) {\n return new Function(\"value\", \"holder\", \" \\n\\\n 'use strict'; \\n\\\n holder.pIndex = value; \\n\\\n holder.checkFulfillment(this); \\n\\\n \".replace(/Index/g, i));\n };\n\n var promiseSetter = function(i) {\n return new Function(\"promise\", \"holder\", \" \\n\\\n 'use strict'; \\n\\\n holder.pIndex = promise; \\n\\\n \".replace(/Index/g, i));\n };\n\n var generateHolderClass = function(total) {\n var props = new Array(total);\n for (var i = 0; i < props.length; ++i) {\n props[i] = \"this.p\" + (i+1);\n }\n var assignment = props.join(\" = \") + \" = null;\";\n var cancellationCode= \"var promise;\\n\" + props.map(function(prop) {\n return \" \\n\\\n promise = \" + prop + \"; \\n\\\n if (promise instanceof Promise) { \\n\\\n promise.cancel(); \\n\\\n } \\n\\\n \";\n }).join(\"\\n\");\n var passedArguments = props.join(\", \");\n var name = \"Holder$\" + total;\n\n\n var code = \"return function(tryCatch, errorObj, Promise, async) { \\n\\\n 'use strict'; \\n\\\n function [TheName](fn) { \\n\\\n [TheProperties] \\n\\\n this.fn = fn; \\n\\\n this.asyncNeeded = true; \\n\\\n this.now = 0; \\n\\\n } \\n\\\n \\n\\\n [TheName].prototype._callFunction = function(promise) { \\n\\\n promise._pushContext(); \\n\\\n var ret = tryCatch(this.fn)([ThePassedArguments]); \\n\\\n promise._popContext(); \\n\\\n if (ret === errorObj) { \\n\\\n promise._rejectCallback(ret.e, false); \\n\\\n } else { \\n\\\n promise._resolveCallback(ret); \\n\\\n } \\n\\\n }; \\n\\\n \\n\\\n [TheName].prototype.checkFulfillment = function(promise) { \\n\\\n var now = ++this.now; \\n\\\n if (now === [TheTotal]) { \\n\\\n if (this.asyncNeeded) { \\n\\\n async.invoke(this._callFunction, this, promise); \\n\\\n } else { \\n\\\n this._callFunction(promise); \\n\\\n } \\n\\\n \\n\\\n } \\n\\\n }; \\n\\\n \\n\\\n [TheName].prototype._resultCancelled = function() { \\n\\\n [CancellationCode] \\n\\\n }; \\n\\\n \\n\\\n return [TheName]; \\n\\\n }(tryCatch, errorObj, Promise, async); \\n\\\n \";\n\n code = code.replace(/\\[TheName\\]/g, name)\n .replace(/\\[TheTotal\\]/g, total)\n .replace(/\\[ThePassedArguments\\]/g, passedArguments)\n .replace(/\\[TheProperties\\]/g, assignment)\n .replace(/\\[CancellationCode\\]/g, cancellationCode);\n\n return new Function(\"tryCatch\", \"errorObj\", \"Promise\", \"async\", code)\n (tryCatch, errorObj, Promise, async);\n };\n\n var holderClasses = [];\n var thenCallbacks = [];\n var promiseSetters = [];\n\n for (var i = 0; i < 8; ++i) {\n holderClasses.push(generateHolderClass(i + 1));\n thenCallbacks.push(thenCallback(i + 1));\n promiseSetters.push(promiseSetter(i + 1));\n }\n\n reject = function (reason) {\n this._reject(reason);\n };\n}}\n\nPromise.join = function () {\n var last = arguments.length - 1;\n var fn;\n if (last > 0 && typeof arguments[last] === \"function\") {\n fn = arguments[last];\n if (!false) {\n if (last <= 8 && canEvaluate) {\n var ret = new Promise(INTERNAL);\n ret._captureStackTrace();\n var HolderClass = holderClasses[last - 1];\n var holder = new HolderClass(fn);\n var callbacks = thenCallbacks;\n\n for (var i = 0; i < last; ++i) {\n var maybePromise = tryConvertToPromise(arguments[i], ret);\n if (maybePromise instanceof Promise) {\n maybePromise = maybePromise._target();\n var bitField = maybePromise._bitField;\n ;\n if (((bitField & 50397184) === 0)) {\n maybePromise._then(callbacks[i], reject,\n undefined, ret, holder);\n promiseSetters[i](maybePromise, holder);\n holder.asyncNeeded = false;\n } else if (((bitField & 33554432) !== 0)) {\n callbacks[i].call(ret,\n maybePromise._value(), holder);\n } else if (((bitField & 16777216) !== 0)) {\n ret._reject(maybePromise._reason());\n } else {\n ret._cancel();\n }\n } else {\n callbacks[i].call(ret, maybePromise, holder);\n }\n }\n\n if (!ret._isFateSealed()) {\n if (holder.asyncNeeded) {\n var domain = getDomain();\n if (domain !== null) {\n holder.fn = util.domainBind(domain, holder.fn);\n }\n }\n ret._setAsyncGuaranteed();\n ret._setOnCancel(holder);\n }\n return ret;\n }\n }\n }\n var $_len = arguments.length;var args = new Array($_len); for(var $_i = 0; $_i < $_len; ++$_i) {args[$_i] = arguments[$_i];};\n if (fn) args.pop();\n var ret = new PromiseArray(args).promise();\n return fn !== undefined ? ret.spread(fn) : ret;\n};\n\n};\n","\"use strict\";\nmodule.exports = function(Promise,\n PromiseArray,\n apiRejection,\n tryConvertToPromise,\n INTERNAL,\n debug) {\nvar getDomain = Promise._getDomain;\nvar util = require(\"./util\");\nvar tryCatch = util.tryCatch;\nvar errorObj = util.errorObj;\nvar async = Promise._async;\n\nfunction MappingPromiseArray(promises, fn, limit, _filter) {\n this.constructor$(promises);\n this._promise._captureStackTrace();\n var domain = getDomain();\n this._callback = domain === null ? fn : util.domainBind(domain, fn);\n this._preservedValues = _filter === INTERNAL\n ? new Array(this.length())\n : null;\n this._limit = limit;\n this._inFlight = 0;\n this._queue = [];\n async.invoke(this._asyncInit, this, undefined);\n}\nutil.inherits(MappingPromiseArray, PromiseArray);\n\nMappingPromiseArray.prototype._asyncInit = function() {\n this._init$(undefined, -2);\n};\n\nMappingPromiseArray.prototype._init = function () {};\n\nMappingPromiseArray.prototype._promiseFulfilled = function (value, index) {\n var values = this._values;\n var length = this.length();\n var preservedValues = this._preservedValues;\n var limit = this._limit;\n\n if (index < 0) {\n index = (index * -1) - 1;\n values[index] = value;\n if (limit >= 1) {\n this._inFlight--;\n this._drainQueue();\n if (this._isResolved()) return true;\n }\n } else {\n if (limit >= 1 && this._inFlight >= limit) {\n values[index] = value;\n this._queue.push(index);\n return false;\n }\n if (preservedValues !== null) preservedValues[index] = value;\n\n var promise = this._promise;\n var callback = this._callback;\n var receiver = promise._boundValue();\n promise._pushContext();\n var ret = tryCatch(callback).call(receiver, value, index, length);\n var promiseCreated = promise._popContext();\n debug.checkForgottenReturns(\n ret,\n promiseCreated,\n preservedValues !== null ? \"Promise.filter\" : \"Promise.map\",\n promise\n );\n if (ret === errorObj) {\n this._reject(ret.e);\n return true;\n }\n\n var maybePromise = tryConvertToPromise(ret, this._promise);\n if (maybePromise instanceof Promise) {\n maybePromise = maybePromise._target();\n var bitField = maybePromise._bitField;\n ;\n if (((bitField & 50397184) === 0)) {\n if (limit >= 1) this._inFlight++;\n values[index] = maybePromise;\n maybePromise._proxy(this, (index + 1) * -1);\n return false;\n } else if (((bitField & 33554432) !== 0)) {\n ret = maybePromise._value();\n } else if (((bitField & 16777216) !== 0)) {\n this._reject(maybePromise._reason());\n return true;\n } else {\n this._cancel();\n return true;\n }\n }\n values[index] = ret;\n }\n var totalResolved = ++this._totalResolved;\n if (totalResolved >= length) {\n if (preservedValues !== null) {\n this._filter(values, preservedValues);\n } else {\n this._resolve(values);\n }\n return true;\n }\n return false;\n};\n\nMappingPromiseArray.prototype._drainQueue = function () {\n var queue = this._queue;\n var limit = this._limit;\n var values = this._values;\n while (queue.length > 0 && this._inFlight < limit) {\n if (this._isResolved()) return;\n var index = queue.pop();\n this._promiseFulfilled(values[index], index);\n }\n};\n\nMappingPromiseArray.prototype._filter = function (booleans, values) {\n var len = values.length;\n var ret = new Array(len);\n var j = 0;\n for (var i = 0; i < len; ++i) {\n if (booleans[i]) ret[j++] = values[i];\n }\n ret.length = j;\n this._resolve(ret);\n};\n\nMappingPromiseArray.prototype.preservedValues = function () {\n return this._preservedValues;\n};\n\nfunction map(promises, fn, options, _filter) {\n if (typeof fn !== \"function\") {\n return apiRejection(\"expecting a function but got \" + util.classString(fn));\n }\n\n var limit = 0;\n if (options !== undefined) {\n if (typeof options === \"object\" && options !== null) {\n if (typeof options.concurrency !== \"number\") {\n return Promise.reject(\n new TypeError(\"'concurrency' must be a number but it is \" +\n util.classString(options.concurrency)));\n }\n limit = options.concurrency;\n } else {\n return Promise.reject(new TypeError(\n \"options argument must be an object but it is \" +\n util.classString(options)));\n }\n }\n limit = typeof limit === \"number\" &&\n isFinite(limit) && limit >= 1 ? limit : 0;\n return new MappingPromiseArray(promises, fn, limit, _filter).promise();\n}\n\nPromise.prototype.map = function (fn, options) {\n return map(this, fn, options, null);\n};\n\nPromise.map = function (promises, fn, options, _filter) {\n return map(promises, fn, options, _filter);\n};\n\n\n};\n","\"use strict\";\nvar cr = Object.create;\nif (cr) {\n var callerCache = cr(null);\n var getterCache = cr(null);\n callerCache[\" size\"] = getterCache[\" size\"] = 0;\n}\n\nmodule.exports = function(Promise) {\nvar util = require(\"./util\");\nvar canEvaluate = util.canEvaluate;\nvar isIdentifier = util.isIdentifier;\n\nvar getMethodCaller;\nvar getGetter;\nif (!false) {\nvar makeMethodCaller = function (methodName) {\n return new Function(\"ensureMethod\", \" \\n\\\n return function(obj) { \\n\\\n 'use strict' \\n\\\n var len = this.length; \\n\\\n ensureMethod(obj, 'methodName'); \\n\\\n switch(len) { \\n\\\n case 1: return obj.methodName(this[0]); \\n\\\n case 2: return obj.methodName(this[0], this[1]); \\n\\\n case 3: return obj.methodName(this[0], this[1], this[2]); \\n\\\n case 0: return obj.methodName(); \\n\\\n default: \\n\\\n return obj.methodName.apply(obj, this); \\n\\\n } \\n\\\n }; \\n\\\n \".replace(/methodName/g, methodName))(ensureMethod);\n};\n\nvar makeGetter = function (propertyName) {\n return new Function(\"obj\", \" \\n\\\n 'use strict'; \\n\\\n return obj.propertyName; \\n\\\n \".replace(\"propertyName\", propertyName));\n};\n\nvar getCompiled = function(name, compiler, cache) {\n var ret = cache[name];\n if (typeof ret !== \"function\") {\n if (!isIdentifier(name)) {\n return null;\n }\n ret = compiler(name);\n cache[name] = ret;\n cache[\" size\"]++;\n if (cache[\" size\"] > 512) {\n var keys = Object.keys(cache);\n for (var i = 0; i < 256; ++i) delete cache[keys[i]];\n cache[\" size\"] = keys.length - 256;\n }\n }\n return ret;\n};\n\ngetMethodCaller = function(name) {\n return getCompiled(name, makeMethodCaller, callerCache);\n};\n\ngetGetter = function(name) {\n return getCompiled(name, makeGetter, getterCache);\n};\n}\n\nfunction ensureMethod(obj, methodName) {\n var fn;\n if (obj != null) fn = obj[methodName];\n if (typeof fn !== \"function\") {\n var message = \"Object \" + util.classString(obj) + \" has no method '\" +\n util.toString(methodName) + \"'\";\n throw new Promise.TypeError(message);\n }\n return fn;\n}\n\nfunction caller(obj) {\n var methodName = this.pop();\n var fn = ensureMethod(obj, methodName);\n return fn.apply(obj, this);\n}\nPromise.prototype.call = function (methodName) {\n var $_len = arguments.length;var args = new Array(Math.max($_len - 1, 0)); for(var $_i = 1; $_i < $_len; ++$_i) {args[$_i - 1] = arguments[$_i];};\n if (!false) {\n if (canEvaluate) {\n var maybeCaller = getMethodCaller(methodName);\n if (maybeCaller !== null) {\n return this._then(\n maybeCaller, undefined, undefined, args, undefined);\n }\n }\n }\n args.push(methodName);\n return this._then(caller, undefined, undefined, args, undefined);\n};\n\nfunction namedGetter(obj) {\n return obj[this];\n}\nfunction indexedGetter(obj) {\n var index = +this;\n if (index < 0) index = Math.max(0, index + obj.length);\n return obj[index];\n}\nPromise.prototype.get = function (propertyName) {\n var isIndex = (typeof propertyName === \"number\");\n var getter;\n if (!isIndex) {\n if (canEvaluate) {\n var maybeGetter = getGetter(propertyName);\n getter = maybeGetter !== null ? maybeGetter : namedGetter;\n } else {\n getter = namedGetter;\n }\n } else {\n getter = indexedGetter;\n }\n return this._then(getter, undefined, undefined, propertyName, undefined);\n};\n};\n","\"use strict\";\nmodule.exports = function (Promise, apiRejection, tryConvertToPromise,\n createContext, INTERNAL, debug) {\n var util = require(\"./util\");\n var TypeError = require(\"./errors\").TypeError;\n var inherits = require(\"./util\").inherits;\n var errorObj = util.errorObj;\n var tryCatch = util.tryCatch;\n var NULL = {};\n\n function thrower(e) {\n setTimeout(function(){throw e;}, 0);\n }\n\n function castPreservingDisposable(thenable) {\n var maybePromise = tryConvertToPromise(thenable);\n if (maybePromise !== thenable &&\n typeof thenable._isDisposable === \"function\" &&\n typeof thenable._getDisposer === \"function\" &&\n thenable._isDisposable()) {\n maybePromise._setDisposable(thenable._getDisposer());\n }\n return maybePromise;\n }\n function dispose(resources, inspection) {\n var i = 0;\n var len = resources.length;\n var ret = new Promise(INTERNAL);\n function iterator() {\n if (i >= len) return ret._fulfill();\n var maybePromise = castPreservingDisposable(resources[i++]);\n if (maybePromise instanceof Promise &&\n maybePromise._isDisposable()) {\n try {\n maybePromise = tryConvertToPromise(\n maybePromise._getDisposer().tryDispose(inspection),\n resources.promise);\n } catch (e) {\n return thrower(e);\n }\n if (maybePromise instanceof Promise) {\n return maybePromise._then(iterator, thrower,\n null, null, null);\n }\n }\n iterator();\n }\n iterator();\n return ret;\n }\n\n function Disposer(data, promise, context) {\n this._data = data;\n this._promise = promise;\n this._context = context;\n }\n\n Disposer.prototype.data = function () {\n return this._data;\n };\n\n Disposer.prototype.promise = function () {\n return this._promise;\n };\n\n Disposer.prototype.resource = function () {\n if (this.promise().isFulfilled()) {\n return this.promise().value();\n }\n return NULL;\n };\n\n Disposer.prototype.tryDispose = function(inspection) {\n var resource = this.resource();\n var context = this._context;\n if (context !== undefined) context._pushContext();\n var ret = resource !== NULL\n ? this.doDispose(resource, inspection) : null;\n if (context !== undefined) context._popContext();\n this._promise._unsetDisposable();\n this._data = null;\n return ret;\n };\n\n Disposer.isDisposer = function (d) {\n return (d != null &&\n typeof d.resource === \"function\" &&\n typeof d.tryDispose === \"function\");\n };\n\n function FunctionDisposer(fn, promise, context) {\n this.constructor$(fn, promise, context);\n }\n inherits(FunctionDisposer, Disposer);\n\n FunctionDisposer.prototype.doDispose = function (resource, inspection) {\n var fn = this.data();\n return fn.call(resource, resource, inspection);\n };\n\n function maybeUnwrapDisposer(value) {\n if (Disposer.isDisposer(value)) {\n this.resources[this.index]._setDisposable(value);\n return value.promise();\n }\n return value;\n }\n\n function ResourceList(length) {\n this.length = length;\n this.promise = null;\n this[length-1] = null;\n }\n\n ResourceList.prototype._resultCancelled = function() {\n var len = this.length;\n for (var i = 0; i < len; ++i) {\n var item = this[i];\n if (item instanceof Promise) {\n item.cancel();\n }\n }\n };\n\n Promise.using = function () {\n var len = arguments.length;\n if (len < 2) return apiRejection(\n \"you must pass at least 2 arguments to Promise.using\");\n var fn = arguments[len - 1];\n if (typeof fn !== \"function\") {\n return apiRejection(\"expecting a function but got \" + util.classString(fn));\n }\n var input;\n var spreadArgs = true;\n if (len === 2 && Array.isArray(arguments[0])) {\n input = arguments[0];\n len = input.length;\n spreadArgs = false;\n } else {\n input = arguments;\n len--;\n }\n var resources = new ResourceList(len);\n for (var i = 0; i < len; ++i) {\n var resource = input[i];\n if (Disposer.isDisposer(resource)) {\n var disposer = resource;\n resource = resource.promise();\n resource._setDisposable(disposer);\n } else {\n var maybePromise = tryConvertToPromise(resource);\n if (maybePromise instanceof Promise) {\n resource =\n maybePromise._then(maybeUnwrapDisposer, null, null, {\n resources: resources,\n index: i\n }, undefined);\n }\n }\n resources[i] = resource;\n }\n\n var reflectedResources = new Array(resources.length);\n for (var i = 0; i < reflectedResources.length; ++i) {\n reflectedResources[i] = Promise.resolve(resources[i]).reflect();\n }\n\n var resultPromise = Promise.all(reflectedResources)\n .then(function(inspections) {\n for (var i = 0; i < inspections.length; ++i) {\n var inspection = inspections[i];\n if (inspection.isRejected()) {\n errorObj.e = inspection.error();\n return errorObj;\n } else if (!inspection.isFulfilled()) {\n resultPromise.cancel();\n return;\n }\n inspections[i] = inspection.value();\n }\n promise._pushContext();\n\n fn = tryCatch(fn);\n var ret = spreadArgs\n ? fn.apply(undefined, inspections) : fn(inspections);\n var promiseCreated = promise._popContext();\n debug.checkForgottenReturns(\n ret, promiseCreated, \"Promise.using\", promise);\n return ret;\n });\n\n var promise = resultPromise.lastly(function() {\n var inspection = new Promise.PromiseInspection(resultPromise);\n return dispose(resources, inspection);\n });\n resources.promise = promise;\n promise._setOnCancel(resources);\n return promise;\n };\n\n Promise.prototype._setDisposable = function (disposer) {\n this._bitField = this._bitField | 131072;\n this._disposer = disposer;\n };\n\n Promise.prototype._isDisposable = function () {\n return (this._bitField & 131072) > 0;\n };\n\n Promise.prototype._getDisposer = function () {\n return this._disposer;\n };\n\n Promise.prototype._unsetDisposable = function () {\n this._bitField = this._bitField & (~131072);\n this._disposer = undefined;\n };\n\n Promise.prototype.disposer = function (fn) {\n if (typeof fn === \"function\") {\n return new FunctionDisposer(fn, this, createContext());\n }\n throw new TypeError();\n };\n\n};\n","\"use strict\";\nmodule.exports = function(Promise, INTERNAL, debug) {\nvar util = require(\"./util\");\nvar TimeoutError = Promise.TimeoutError;\n\nfunction HandleWrapper(handle) {\n this.handle = handle;\n}\n\nHandleWrapper.prototype._resultCancelled = function() {\n clearTimeout(this.handle);\n};\n\nvar afterValue = function(value) { return delay(+this).thenReturn(value); };\nvar delay = Promise.delay = function (ms, value) {\n var ret;\n var handle;\n if (value !== undefined) {\n ret = Promise.resolve(value)\n ._then(afterValue, null, null, ms, undefined);\n if (debug.cancellation() && value instanceof Promise) {\n ret._setOnCancel(value);\n }\n } else {\n ret = new Promise(INTERNAL);\n handle = setTimeout(function() { ret._fulfill(); }, +ms);\n if (debug.cancellation()) {\n ret._setOnCancel(new HandleWrapper(handle));\n }\n ret._captureStackTrace();\n }\n ret._setAsyncGuaranteed();\n return ret;\n};\n\nPromise.prototype.delay = function (ms) {\n return delay(ms, this);\n};\n\nvar afterTimeout = function (promise, message, parent) {\n var err;\n if (typeof message !== \"string\") {\n if (message instanceof Error) {\n err = message;\n } else {\n err = new TimeoutError(\"operation timed out\");\n }\n } else {\n err = new TimeoutError(message);\n }\n util.markAsOriginatingFromRejection(err);\n promise._attachExtraTrace(err);\n promise._reject(err);\n\n if (parent != null) {\n parent.cancel();\n }\n};\n\nfunction successClear(value) {\n clearTimeout(this.handle);\n return value;\n}\n\nfunction failureClear(reason) {\n clearTimeout(this.handle);\n throw reason;\n}\n\nPromise.prototype.timeout = function (ms, message) {\n ms = +ms;\n var ret, parent;\n\n var handleWrapper = new HandleWrapper(setTimeout(function timeoutTimeout() {\n if (ret.isPending()) {\n afterTimeout(ret, message, parent);\n }\n }, ms));\n\n if (debug.cancellation()) {\n parent = this.then();\n ret = parent._then(successClear, failureClear,\n undefined, handleWrapper, undefined);\n ret._setOnCancel(handleWrapper);\n } else {\n ret = this._then(successClear, failureClear,\n undefined, handleWrapper, undefined);\n }\n\n return ret;\n};\n\n};\n","\"use strict\";\nmodule.exports = function(Promise,\n apiRejection,\n INTERNAL,\n tryConvertToPromise,\n Proxyable,\n debug) {\nvar errors = require(\"./errors\");\nvar TypeError = errors.TypeError;\nvar util = require(\"./util\");\nvar errorObj = util.errorObj;\nvar tryCatch = util.tryCatch;\nvar yieldHandlers = [];\n\nfunction promiseFromYieldHandler(value, yieldHandlers, traceParent) {\n for (var i = 0; i < yieldHandlers.length; ++i) {\n traceParent._pushContext();\n var result = tryCatch(yieldHandlers[i])(value);\n traceParent._popContext();\n if (result === errorObj) {\n traceParent._pushContext();\n var ret = Promise.reject(errorObj.e);\n traceParent._popContext();\n return ret;\n }\n var maybePromise = tryConvertToPromise(result, traceParent);\n if (maybePromise instanceof Promise) return maybePromise;\n }\n return null;\n}\n\nfunction PromiseSpawn(generatorFunction, receiver, yieldHandler, stack) {\n if (debug.cancellation()) {\n var internal = new Promise(INTERNAL);\n var _finallyPromise = this._finallyPromise = new Promise(INTERNAL);\n this._promise = internal.lastly(function() {\n return _finallyPromise;\n });\n internal._captureStackTrace();\n internal._setOnCancel(this);\n } else {\n var promise = this._promise = new Promise(INTERNAL);\n promise._captureStackTrace();\n }\n this._stack = stack;\n this._generatorFunction = generatorFunction;\n this._receiver = receiver;\n this._generator = undefined;\n this._yieldHandlers = typeof yieldHandler === \"function\"\n ? [yieldHandler].concat(yieldHandlers)\n : yieldHandlers;\n this._yieldedPromise = null;\n this._cancellationPhase = false;\n}\nutil.inherits(PromiseSpawn, Proxyable);\n\nPromiseSpawn.prototype._isResolved = function() {\n return this._promise === null;\n};\n\nPromiseSpawn.prototype._cleanup = function() {\n this._promise = this._generator = null;\n if (debug.cancellation() && this._finallyPromise !== null) {\n this._finallyPromise._fulfill();\n this._finallyPromise = null;\n }\n};\n\nPromiseSpawn.prototype._promiseCancelled = function() {\n if (this._isResolved()) return;\n var implementsReturn = typeof this._generator[\"return\"] !== \"undefined\";\n\n var result;\n if (!implementsReturn) {\n var reason = new Promise.CancellationError(\n \"generator .return() sentinel\");\n Promise.coroutine.returnSentinel = reason;\n this._promise._attachExtraTrace(reason);\n this._promise._pushContext();\n result = tryCatch(this._generator[\"throw\"]).call(this._generator,\n reason);\n this._promise._popContext();\n } else {\n this._promise._pushContext();\n result = tryCatch(this._generator[\"return\"]).call(this._generator,\n undefined);\n this._promise._popContext();\n }\n this._cancellationPhase = true;\n this._yieldedPromise = null;\n this._continue(result);\n};\n\nPromiseSpawn.prototype._promiseFulfilled = function(value) {\n this._yieldedPromise = null;\n this._promise._pushContext();\n var result = tryCatch(this._generator.next).call(this._generator, value);\n this._promise._popContext();\n this._continue(result);\n};\n\nPromiseSpawn.prototype._promiseRejected = function(reason) {\n this._yieldedPromise = null;\n this._promise._attachExtraTrace(reason);\n this._promise._pushContext();\n var result = tryCatch(this._generator[\"throw\"])\n .call(this._generator, reason);\n this._promise._popContext();\n this._continue(result);\n};\n\nPromiseSpawn.prototype._resultCancelled = function() {\n if (this._yieldedPromise instanceof Promise) {\n var promise = this._yieldedPromise;\n this._yieldedPromise = null;\n promise.cancel();\n }\n};\n\nPromiseSpawn.prototype.promise = function () {\n return this._promise;\n};\n\nPromiseSpawn.prototype._run = function () {\n this._generator = this._generatorFunction.call(this._receiver);\n this._receiver =\n this._generatorFunction = undefined;\n this._promiseFulfilled(undefined);\n};\n\nPromiseSpawn.prototype._continue = function (result) {\n var promise = this._promise;\n if (result === errorObj) {\n this._cleanup();\n if (this._cancellationPhase) {\n return promise.cancel();\n } else {\n return promise._rejectCallback(result.e, false);\n }\n }\n\n var value = result.value;\n if (result.done === true) {\n this._cleanup();\n if (this._cancellationPhase) {\n return promise.cancel();\n } else {\n return promise._resolveCallback(value);\n }\n } else {\n var maybePromise = tryConvertToPromise(value, this._promise);\n if (!(maybePromise instanceof Promise)) {\n maybePromise =\n promiseFromYieldHandler(maybePromise,\n this._yieldHandlers,\n this._promise);\n if (maybePromise === null) {\n this._promiseRejected(\n new TypeError(\n \"A value %s was yielded that could not be treated as a promise\\u000a\\u000a See http://goo.gl/MqrFmX\\u000a\\u000a\".replace(\"%s\", String(value)) +\n \"From coroutine:\\u000a\" +\n this._stack.split(\"\\n\").slice(1, -7).join(\"\\n\")\n )\n );\n return;\n }\n }\n maybePromise = maybePromise._target();\n var bitField = maybePromise._bitField;\n ;\n if (((bitField & 50397184) === 0)) {\n this._yieldedPromise = maybePromise;\n maybePromise._proxy(this, null);\n } else if (((bitField & 33554432) !== 0)) {\n Promise._async.invoke(\n this._promiseFulfilled, this, maybePromise._value()\n );\n } else if (((bitField & 16777216) !== 0)) {\n Promise._async.invoke(\n this._promiseRejected, this, maybePromise._reason()\n );\n } else {\n this._promiseCancelled();\n }\n }\n};\n\nPromise.coroutine = function (generatorFunction, options) {\n if (typeof generatorFunction !== \"function\") {\n throw new TypeError(\"generatorFunction must be a function\\u000a\\u000a See http://goo.gl/MqrFmX\\u000a\");\n }\n var yieldHandler = Object(options).yieldHandler;\n var PromiseSpawn$ = PromiseSpawn;\n var stack = new Error().stack;\n return function () {\n var generator = generatorFunction.apply(this, arguments);\n var spawn = new PromiseSpawn$(undefined, undefined, yieldHandler,\n stack);\n var ret = spawn.promise();\n spawn._generator = generator;\n spawn._promiseFulfilled(undefined);\n return ret;\n };\n};\n\nPromise.coroutine.addYieldHandler = function(fn) {\n if (typeof fn !== \"function\") {\n throw new TypeError(\"expecting a function but got \" + util.classString(fn));\n }\n yieldHandlers.push(fn);\n};\n\nPromise.spawn = function (generatorFunction) {\n debug.deprecated(\"Promise.spawn()\", \"Promise.coroutine()\");\n if (typeof generatorFunction !== \"function\") {\n return apiRejection(\"generatorFunction must be a function\\u000a\\u000a See http://goo.gl/MqrFmX\\u000a\");\n }\n var spawn = new PromiseSpawn(generatorFunction, this);\n var ret = spawn.promise();\n spawn._run(Promise.spawn);\n return ret;\n};\n};\n","\"use strict\";\nmodule.exports = function(Promise) {\nvar util = require(\"./util\");\nvar async = Promise._async;\nvar tryCatch = util.tryCatch;\nvar errorObj = util.errorObj;\n\nfunction spreadAdapter(val, nodeback) {\n var promise = this;\n if (!util.isArray(val)) return successAdapter.call(promise, val, nodeback);\n var ret =\n tryCatch(nodeback).apply(promise._boundValue(), [null].concat(val));\n if (ret === errorObj) {\n async.throwLater(ret.e);\n }\n}\n\nfunction successAdapter(val, nodeback) {\n var promise = this;\n var receiver = promise._boundValue();\n var ret = val === undefined\n ? tryCatch(nodeback).call(receiver, null)\n : tryCatch(nodeback).call(receiver, null, val);\n if (ret === errorObj) {\n async.throwLater(ret.e);\n }\n}\nfunction errorAdapter(reason, nodeback) {\n var promise = this;\n if (!reason) {\n var newReason = new Error(reason + \"\");\n newReason.cause = reason;\n reason = newReason;\n }\n var ret = tryCatch(nodeback).call(promise._boundValue(), reason);\n if (ret === errorObj) {\n async.throwLater(ret.e);\n }\n}\n\nPromise.prototype.asCallback = Promise.prototype.nodeify = function (nodeback,\n options) {\n if (typeof nodeback == \"function\") {\n var adapter = successAdapter;\n if (options !== undefined && Object(options).spread) {\n adapter = spreadAdapter;\n }\n this._then(\n adapter,\n errorAdapter,\n undefined,\n this,\n nodeback\n );\n }\n return this;\n};\n};\n","\"use strict\";\nmodule.exports = function(Promise, INTERNAL) {\nvar THIS = {};\nvar util = require(\"./util\");\nvar nodebackForPromise = require(\"./nodeback\");\nvar withAppended = util.withAppended;\nvar maybeWrapAsError = util.maybeWrapAsError;\nvar canEvaluate = util.canEvaluate;\nvar TypeError = require(\"./errors\").TypeError;\nvar defaultSuffix = \"Async\";\nvar defaultPromisified = {__isPromisified__: true};\nvar noCopyProps = [\n \"arity\", \"length\",\n \"name\",\n \"arguments\",\n \"caller\",\n \"callee\",\n \"prototype\",\n \"__isPromisified__\"\n];\nvar noCopyPropsPattern = new RegExp(\"^(?:\" + noCopyProps.join(\"|\") + \")$\");\n\nvar defaultFilter = function(name) {\n return util.isIdentifier(name) &&\n name.charAt(0) !== \"_\" &&\n name !== \"constructor\";\n};\n\nfunction propsFilter(key) {\n return !noCopyPropsPattern.test(key);\n}\n\nfunction isPromisified(fn) {\n try {\n return fn.__isPromisified__ === true;\n }\n catch (e) {\n return false;\n }\n}\n\nfunction hasPromisified(obj, key, suffix) {\n var val = util.getDataPropertyOrDefault(obj, key + suffix,\n defaultPromisified);\n return val ? isPromisified(val) : false;\n}\nfunction checkValid(ret, suffix, suffixRegexp) {\n for (var i = 0; i < ret.length; i += 2) {\n var key = ret[i];\n if (suffixRegexp.test(key)) {\n var keyWithoutAsyncSuffix = key.replace(suffixRegexp, \"\");\n for (var j = 0; j < ret.length; j += 2) {\n if (ret[j] === keyWithoutAsyncSuffix) {\n throw new TypeError(\"Cannot promisify an API that has normal methods with '%s'-suffix\\u000a\\u000a See http://goo.gl/MqrFmX\\u000a\"\n .replace(\"%s\", suffix));\n }\n }\n }\n }\n}\n\nfunction promisifiableMethods(obj, suffix, suffixRegexp, filter) {\n var keys = util.inheritedDataKeys(obj);\n var ret = [];\n for (var i = 0; i < keys.length; ++i) {\n var key = keys[i];\n var value = obj[key];\n var passesDefaultFilter = filter === defaultFilter\n ? true : defaultFilter(key, value, obj);\n if (typeof value === \"function\" &&\n !isPromisified(value) &&\n !hasPromisified(obj, key, suffix) &&\n filter(key, value, obj, passesDefaultFilter)) {\n ret.push(key, value);\n }\n }\n checkValid(ret, suffix, suffixRegexp);\n return ret;\n}\n\nvar escapeIdentRegex = function(str) {\n return str.replace(/([$])/, \"\\\\$\");\n};\n\nvar makeNodePromisifiedEval;\nif (!false) {\nvar switchCaseArgumentOrder = function(likelyArgumentCount) {\n var ret = [likelyArgumentCount];\n var min = Math.max(0, likelyArgumentCount - 1 - 3);\n for(var i = likelyArgumentCount - 1; i >= min; --i) {\n ret.push(i);\n }\n for(var i = likelyArgumentCount + 1; i <= 3; ++i) {\n ret.push(i);\n }\n return ret;\n};\n\nvar argumentSequence = function(argumentCount) {\n return util.filledRange(argumentCount, \"_arg\", \"\");\n};\n\nvar parameterDeclaration = function(parameterCount) {\n return util.filledRange(\n Math.max(parameterCount, 3), \"_arg\", \"\");\n};\n\nvar parameterCount = function(fn) {\n if (typeof fn.length === \"number\") {\n return Math.max(Math.min(fn.length, 1023 + 1), 0);\n }\n return 0;\n};\n\nmakeNodePromisifiedEval =\nfunction(callback, receiver, originalName, fn, _, multiArgs) {\n var newParameterCount = Math.max(0, parameterCount(fn) - 1);\n var argumentOrder = switchCaseArgumentOrder(newParameterCount);\n var shouldProxyThis = typeof callback === \"string\" || receiver === THIS;\n\n function generateCallForArgumentCount(count) {\n var args = argumentSequence(count).join(\", \");\n var comma = count > 0 ? \", \" : \"\";\n var ret;\n if (shouldProxyThis) {\n ret = \"ret = callback.call(this, {{args}}, nodeback); break;\\n\";\n } else {\n ret = receiver === undefined\n ? \"ret = callback({{args}}, nodeback); break;\\n\"\n : \"ret = callback.call(receiver, {{args}}, nodeback); break;\\n\";\n }\n return ret.replace(\"{{args}}\", args).replace(\", \", comma);\n }\n\n function generateArgumentSwitchCase() {\n var ret = \"\";\n for (var i = 0; i < argumentOrder.length; ++i) {\n ret += \"case \" + argumentOrder[i] +\":\" +\n generateCallForArgumentCount(argumentOrder[i]);\n }\n\n ret += \" \\n\\\n default: \\n\\\n var args = new Array(len + 1); \\n\\\n var i = 0; \\n\\\n for (var i = 0; i < len; ++i) { \\n\\\n args[i] = arguments[i]; \\n\\\n } \\n\\\n args[i] = nodeback; \\n\\\n [CodeForCall] \\n\\\n break; \\n\\\n \".replace(\"[CodeForCall]\", (shouldProxyThis\n ? \"ret = callback.apply(this, args);\\n\"\n : \"ret = callback.apply(receiver, args);\\n\"));\n return ret;\n }\n\n var getFunctionCode = typeof callback === \"string\"\n ? (\"this != null ? this['\"+callback+\"'] : fn\")\n : \"fn\";\n var body = \"'use strict'; \\n\\\n var ret = function (Parameters) { \\n\\\n 'use strict'; \\n\\\n var len = arguments.length; \\n\\\n var promise = new Promise(INTERNAL); \\n\\\n promise._captureStackTrace(); \\n\\\n var nodeback = nodebackForPromise(promise, \" + multiArgs + \"); \\n\\\n var ret; \\n\\\n var callback = tryCatch([GetFunctionCode]); \\n\\\n switch(len) { \\n\\\n [CodeForSwitchCase] \\n\\\n } \\n\\\n if (ret === errorObj) { \\n\\\n promise._rejectCallback(maybeWrapAsError(ret.e), true, true);\\n\\\n } \\n\\\n if (!promise._isFateSealed()) promise._setAsyncGuaranteed(); \\n\\\n return promise; \\n\\\n }; \\n\\\n notEnumerableProp(ret, '__isPromisified__', true); \\n\\\n return ret; \\n\\\n \".replace(\"[CodeForSwitchCase]\", generateArgumentSwitchCase())\n .replace(\"[GetFunctionCode]\", getFunctionCode);\n body = body.replace(\"Parameters\", parameterDeclaration(newParameterCount));\n return new Function(\"Promise\",\n \"fn\",\n \"receiver\",\n \"withAppended\",\n \"maybeWrapAsError\",\n \"nodebackForPromise\",\n \"tryCatch\",\n \"errorObj\",\n \"notEnumerableProp\",\n \"INTERNAL\",\n body)(\n Promise,\n fn,\n receiver,\n withAppended,\n maybeWrapAsError,\n nodebackForPromise,\n util.tryCatch,\n util.errorObj,\n util.notEnumerableProp,\n INTERNAL);\n};\n}\n\nfunction makeNodePromisifiedClosure(callback, receiver, _, fn, __, multiArgs) {\n var defaultThis = (function() {return this;})();\n var method = callback;\n if (typeof method === \"string\") {\n callback = fn;\n }\n function promisified() {\n var _receiver = receiver;\n if (receiver === THIS) _receiver = this;\n var promise = new Promise(INTERNAL);\n promise._captureStackTrace();\n var cb = typeof method === \"string\" && this !== defaultThis\n ? this[method] : callback;\n var fn = nodebackForPromise(promise, multiArgs);\n try {\n cb.apply(_receiver, withAppended(arguments, fn));\n } catch(e) {\n promise._rejectCallback(maybeWrapAsError(e), true, true);\n }\n if (!promise._isFateSealed()) promise._setAsyncGuaranteed();\n return promise;\n }\n util.notEnumerableProp(promisified, \"__isPromisified__\", true);\n return promisified;\n}\n\nvar makeNodePromisified = canEvaluate\n ? makeNodePromisifiedEval\n : makeNodePromisifiedClosure;\n\nfunction promisifyAll(obj, suffix, filter, promisifier, multiArgs) {\n var suffixRegexp = new RegExp(escapeIdentRegex(suffix) + \"$\");\n var methods =\n promisifiableMethods(obj, suffix, suffixRegexp, filter);\n\n for (var i = 0, len = methods.length; i < len; i+= 2) {\n var key = methods[i];\n var fn = methods[i+1];\n var promisifiedKey = key + suffix;\n if (promisifier === makeNodePromisified) {\n obj[promisifiedKey] =\n makeNodePromisified(key, THIS, key, fn, suffix, multiArgs);\n } else {\n var promisified = promisifier(fn, function() {\n return makeNodePromisified(key, THIS, key,\n fn, suffix, multiArgs);\n });\n util.notEnumerableProp(promisified, \"__isPromisified__\", true);\n obj[promisifiedKey] = promisified;\n }\n }\n util.toFastProperties(obj);\n return obj;\n}\n\nfunction promisify(callback, receiver, multiArgs) {\n return makeNodePromisified(callback, receiver, undefined,\n callback, null, multiArgs);\n}\n\nPromise.promisify = function (fn, options) {\n if (typeof fn !== \"function\") {\n throw new TypeError(\"expecting a function but got \" + util.classString(fn));\n }\n if (isPromisified(fn)) {\n return fn;\n }\n options = Object(options);\n var receiver = options.context === undefined ? THIS : options.context;\n var multiArgs = !!options.multiArgs;\n var ret = promisify(fn, receiver, multiArgs);\n util.copyDescriptors(fn, ret, propsFilter);\n return ret;\n};\n\nPromise.promisifyAll = function (target, options) {\n if (typeof target !== \"function\" && typeof target !== \"object\") {\n throw new TypeError(\"the target of promisifyAll must be an object or a function\\u000a\\u000a See http://goo.gl/MqrFmX\\u000a\");\n }\n options = Object(options);\n var multiArgs = !!options.multiArgs;\n var suffix = options.suffix;\n if (typeof suffix !== \"string\") suffix = defaultSuffix;\n var filter = options.filter;\n if (typeof filter !== \"function\") filter = defaultFilter;\n var promisifier = options.promisifier;\n if (typeof promisifier !== \"function\") promisifier = makeNodePromisified;\n\n if (!util.isIdentifier(suffix)) {\n throw new RangeError(\"suffix must be a valid identifier\\u000a\\u000a See http://goo.gl/MqrFmX\\u000a\");\n }\n\n var keys = util.inheritedDataKeys(target);\n for (var i = 0; i < keys.length; ++i) {\n var value = target[keys[i]];\n if (keys[i] !== \"constructor\" &&\n util.isClass(value)) {\n promisifyAll(value.prototype, suffix, filter, promisifier,\n multiArgs);\n promisifyAll(value, suffix, filter, promisifier, multiArgs);\n }\n }\n\n return promisifyAll(target, suffix, filter, promisifier, multiArgs);\n};\n};\n\n","\"use strict\";\nmodule.exports = function(\n Promise, PromiseArray, tryConvertToPromise, apiRejection) {\nvar util = require(\"./util\");\nvar isObject = util.isObject;\nvar es5 = require(\"./es5\");\nvar Es6Map;\nif (typeof Map === \"function\") Es6Map = Map;\n\nvar mapToEntries = (function() {\n var index = 0;\n var size = 0;\n\n function extractEntry(value, key) {\n this[index] = value;\n this[index + size] = key;\n index++;\n }\n\n return function mapToEntries(map) {\n size = map.size;\n index = 0;\n var ret = new Array(map.size * 2);\n map.forEach(extractEntry, ret);\n return ret;\n };\n})();\n\nvar entriesToMap = function(entries) {\n var ret = new Es6Map();\n var length = entries.length / 2 | 0;\n for (var i = 0; i < length; ++i) {\n var key = entries[length + i];\n var value = entries[i];\n ret.set(key, value);\n }\n return ret;\n};\n\nfunction PropertiesPromiseArray(obj) {\n var isMap = false;\n var entries;\n if (Es6Map !== undefined && obj instanceof Es6Map) {\n entries = mapToEntries(obj);\n isMap = true;\n } else {\n var keys = es5.keys(obj);\n var len = keys.length;\n entries = new Array(len * 2);\n for (var i = 0; i < len; ++i) {\n var key = keys[i];\n entries[i] = obj[key];\n entries[i + len] = key;\n }\n }\n this.constructor$(entries);\n this._isMap = isMap;\n this._init$(undefined, isMap ? -6 : -3);\n}\nutil.inherits(PropertiesPromiseArray, PromiseArray);\n\nPropertiesPromiseArray.prototype._init = function () {};\n\nPropertiesPromiseArray.prototype._promiseFulfilled = function (value, index) {\n this._values[index] = value;\n var totalResolved = ++this._totalResolved;\n if (totalResolved >= this._length) {\n var val;\n if (this._isMap) {\n val = entriesToMap(this._values);\n } else {\n val = {};\n var keyOffset = this.length();\n for (var i = 0, len = this.length(); i < len; ++i) {\n val[this._values[i + keyOffset]] = this._values[i];\n }\n }\n this._resolve(val);\n return true;\n }\n return false;\n};\n\nPropertiesPromiseArray.prototype.shouldCopyValues = function () {\n return false;\n};\n\nPropertiesPromiseArray.prototype.getActualLength = function (len) {\n return len >> 1;\n};\n\nfunction props(promises) {\n var ret;\n var castValue = tryConvertToPromise(promises);\n\n if (!isObject(castValue)) {\n return apiRejection(\"cannot await properties of a non-object\\u000a\\u000a See http://goo.gl/MqrFmX\\u000a\");\n } else if (castValue instanceof Promise) {\n ret = castValue._then(\n Promise.props, undefined, undefined, undefined, undefined);\n } else {\n ret = new PropertiesPromiseArray(castValue).promise();\n }\n\n if (castValue instanceof Promise) {\n ret._propagateFrom(castValue, 2);\n }\n return ret;\n}\n\nPromise.prototype.props = function () {\n return props(this);\n};\n\nPromise.props = function (promises) {\n return props(promises);\n};\n};\n","\"use strict\";\nmodule.exports = function(\n Promise, INTERNAL, tryConvertToPromise, apiRejection) {\nvar util = require(\"./util\");\n\nvar raceLater = function (promise) {\n return promise.then(function(array) {\n return race(array, promise);\n });\n};\n\nfunction race(promises, parent) {\n var maybePromise = tryConvertToPromise(promises);\n\n if (maybePromise instanceof Promise) {\n return raceLater(maybePromise);\n } else {\n promises = util.asArray(promises);\n if (promises === null)\n return apiRejection(\"expecting an array or an iterable object but got \" + util.classString(promises));\n }\n\n var ret = new Promise(INTERNAL);\n if (parent !== undefined) {\n ret._propagateFrom(parent, 3);\n }\n var fulfill = ret._fulfill;\n var reject = ret._reject;\n for (var i = 0, len = promises.length; i < len; ++i) {\n var val = promises[i];\n\n if (val === undefined && !(i in promises)) {\n continue;\n }\n\n Promise.cast(val)._then(fulfill, reject, undefined, ret, null);\n }\n return ret;\n}\n\nPromise.race = function (promises) {\n return race(promises, undefined);\n};\n\nPromise.prototype.race = function () {\n return race(this, undefined);\n};\n\n};\n","\"use strict\";\nmodule.exports = function(Promise,\n PromiseArray,\n apiRejection,\n tryConvertToPromise,\n INTERNAL,\n debug) {\nvar getDomain = Promise._getDomain;\nvar util = require(\"./util\");\nvar tryCatch = util.tryCatch;\n\nfunction ReductionPromiseArray(promises, fn, initialValue, _each) {\n this.constructor$(promises);\n var domain = getDomain();\n this._fn = domain === null ? fn : util.domainBind(domain, fn);\n if (initialValue !== undefined) {\n initialValue = Promise.resolve(initialValue);\n initialValue._attachCancellationCallback(this);\n }\n this._initialValue = initialValue;\n this._currentCancellable = null;\n if(_each === INTERNAL) {\n this._eachValues = Array(this._length);\n } else if (_each === 0) {\n this._eachValues = null;\n } else {\n this._eachValues = undefined;\n }\n this._promise._captureStackTrace();\n this._init$(undefined, -5);\n}\nutil.inherits(ReductionPromiseArray, PromiseArray);\n\nReductionPromiseArray.prototype._gotAccum = function(accum) {\n if (this._eachValues !== undefined && \n this._eachValues !== null && \n accum !== INTERNAL) {\n this._eachValues.push(accum);\n }\n};\n\nReductionPromiseArray.prototype._eachComplete = function(value) {\n if (this._eachValues !== null) {\n this._eachValues.push(value);\n }\n return this._eachValues;\n};\n\nReductionPromiseArray.prototype._init = function() {};\n\nReductionPromiseArray.prototype._resolveEmptyArray = function() {\n this._resolve(this._eachValues !== undefined ? this._eachValues\n : this._initialValue);\n};\n\nReductionPromiseArray.prototype.shouldCopyValues = function () {\n return false;\n};\n\nReductionPromiseArray.prototype._resolve = function(value) {\n this._promise._resolveCallback(value);\n this._values = null;\n};\n\nReductionPromiseArray.prototype._resultCancelled = function(sender) {\n if (sender === this._initialValue) return this._cancel();\n if (this._isResolved()) return;\n this._resultCancelled$();\n if (this._currentCancellable instanceof Promise) {\n this._currentCancellable.cancel();\n }\n if (this._initialValue instanceof Promise) {\n this._initialValue.cancel();\n }\n};\n\nReductionPromiseArray.prototype._iterate = function (values) {\n this._values = values;\n var value;\n var i;\n var length = values.length;\n if (this._initialValue !== undefined) {\n value = this._initialValue;\n i = 0;\n } else {\n value = Promise.resolve(values[0]);\n i = 1;\n }\n\n this._currentCancellable = value;\n\n if (!value.isRejected()) {\n for (; i < length; ++i) {\n var ctx = {\n accum: null,\n value: values[i],\n index: i,\n length: length,\n array: this\n };\n value = value._then(gotAccum, undefined, undefined, ctx, undefined);\n }\n }\n\n if (this._eachValues !== undefined) {\n value = value\n ._then(this._eachComplete, undefined, undefined, this, undefined);\n }\n value._then(completed, completed, undefined, value, this);\n};\n\nPromise.prototype.reduce = function (fn, initialValue) {\n return reduce(this, fn, initialValue, null);\n};\n\nPromise.reduce = function (promises, fn, initialValue, _each) {\n return reduce(promises, fn, initialValue, _each);\n};\n\nfunction completed(valueOrReason, array) {\n if (this.isFulfilled()) {\n array._resolve(valueOrReason);\n } else {\n array._reject(valueOrReason);\n }\n}\n\nfunction reduce(promises, fn, initialValue, _each) {\n if (typeof fn !== \"function\") {\n return apiRejection(\"expecting a function but got \" + util.classString(fn));\n }\n var array = new ReductionPromiseArray(promises, fn, initialValue, _each);\n return array.promise();\n}\n\nfunction gotAccum(accum) {\n this.accum = accum;\n this.array._gotAccum(accum);\n var value = tryConvertToPromise(this.value, this.array._promise);\n if (value instanceof Promise) {\n this.array._currentCancellable = value;\n return value._then(gotValue, undefined, undefined, this, undefined);\n } else {\n return gotValue.call(this, value);\n }\n}\n\nfunction gotValue(value) {\n var array = this.array;\n var promise = array._promise;\n var fn = tryCatch(array._fn);\n promise._pushContext();\n var ret;\n if (array._eachValues !== undefined) {\n ret = fn.call(promise._boundValue(), value, this.index, this.length);\n } else {\n ret = fn.call(promise._boundValue(),\n this.accum, value, this.index, this.length);\n }\n if (ret instanceof Promise) {\n array._currentCancellable = ret;\n }\n var promiseCreated = promise._popContext();\n debug.checkForgottenReturns(\n ret,\n promiseCreated,\n array._eachValues !== undefined ? \"Promise.each\" : \"Promise.reduce\",\n promise\n );\n return ret;\n}\n};\n","\"use strict\";\nmodule.exports =\n function(Promise, PromiseArray, debug) {\nvar PromiseInspection = Promise.PromiseInspection;\nvar util = require(\"./util\");\n\nfunction SettledPromiseArray(values) {\n this.constructor$(values);\n}\nutil.inherits(SettledPromiseArray, PromiseArray);\n\nSettledPromiseArray.prototype._promiseResolved = function (index, inspection) {\n this._values[index] = inspection;\n var totalResolved = ++this._totalResolved;\n if (totalResolved >= this._length) {\n this._resolve(this._values);\n return true;\n }\n return false;\n};\n\nSettledPromiseArray.prototype._promiseFulfilled = function (value, index) {\n var ret = new PromiseInspection();\n ret._bitField = 33554432;\n ret._settledValueField = value;\n return this._promiseResolved(index, ret);\n};\nSettledPromiseArray.prototype._promiseRejected = function (reason, index) {\n var ret = new PromiseInspection();\n ret._bitField = 16777216;\n ret._settledValueField = reason;\n return this._promiseResolved(index, ret);\n};\n\nPromise.settle = function (promises) {\n debug.deprecated(\".settle()\", \".reflect()\");\n return new SettledPromiseArray(promises).promise();\n};\n\nPromise.prototype.settle = function () {\n return Promise.settle(this);\n};\n};\n","\"use strict\";\nmodule.exports =\nfunction(Promise, PromiseArray, apiRejection) {\nvar util = require(\"./util\");\nvar RangeError = require(\"./errors\").RangeError;\nvar AggregateError = require(\"./errors\").AggregateError;\nvar isArray = util.isArray;\nvar CANCELLATION = {};\n\n\nfunction SomePromiseArray(values) {\n this.constructor$(values);\n this._howMany = 0;\n this._unwrap = false;\n this._initialized = false;\n}\nutil.inherits(SomePromiseArray, PromiseArray);\n\nSomePromiseArray.prototype._init = function () {\n if (!this._initialized) {\n return;\n }\n if (this._howMany === 0) {\n this._resolve([]);\n return;\n }\n this._init$(undefined, -5);\n var isArrayResolved = isArray(this._values);\n if (!this._isResolved() &&\n isArrayResolved &&\n this._howMany > this._canPossiblyFulfill()) {\n this._reject(this._getRangeError(this.length()));\n }\n};\n\nSomePromiseArray.prototype.init = function () {\n this._initialized = true;\n this._init();\n};\n\nSomePromiseArray.prototype.setUnwrap = function () {\n this._unwrap = true;\n};\n\nSomePromiseArray.prototype.howMany = function () {\n return this._howMany;\n};\n\nSomePromiseArray.prototype.setHowMany = function (count) {\n this._howMany = count;\n};\n\nSomePromiseArray.prototype._promiseFulfilled = function (value) {\n this._addFulfilled(value);\n if (this._fulfilled() === this.howMany()) {\n this._values.length = this.howMany();\n if (this.howMany() === 1 && this._unwrap) {\n this._resolve(this._values[0]);\n } else {\n this._resolve(this._values);\n }\n return true;\n }\n return false;\n\n};\nSomePromiseArray.prototype._promiseRejected = function (reason) {\n this._addRejected(reason);\n return this._checkOutcome();\n};\n\nSomePromiseArray.prototype._promiseCancelled = function () {\n if (this._values instanceof Promise || this._values == null) {\n return this._cancel();\n }\n this._addRejected(CANCELLATION);\n return this._checkOutcome();\n};\n\nSomePromiseArray.prototype._checkOutcome = function() {\n if (this.howMany() > this._canPossiblyFulfill()) {\n var e = new AggregateError();\n for (var i = this.length(); i < this._values.length; ++i) {\n if (this._values[i] !== CANCELLATION) {\n e.push(this._values[i]);\n }\n }\n if (e.length > 0) {\n this._reject(e);\n } else {\n this._cancel();\n }\n return true;\n }\n return false;\n};\n\nSomePromiseArray.prototype._fulfilled = function () {\n return this._totalResolved;\n};\n\nSomePromiseArray.prototype._rejected = function () {\n return this._values.length - this.length();\n};\n\nSomePromiseArray.prototype._addRejected = function (reason) {\n this._values.push(reason);\n};\n\nSomePromiseArray.prototype._addFulfilled = function (value) {\n this._values[this._totalResolved++] = value;\n};\n\nSomePromiseArray.prototype._canPossiblyFulfill = function () {\n return this.length() - this._rejected();\n};\n\nSomePromiseArray.prototype._getRangeError = function (count) {\n var message = \"Input array must contain at least \" +\n this._howMany + \" items but contains only \" + count + \" items\";\n return new RangeError(message);\n};\n\nSomePromiseArray.prototype._resolveEmptyArray = function () {\n this._reject(this._getRangeError(0));\n};\n\nfunction some(promises, howMany) {\n if ((howMany | 0) !== howMany || howMany < 0) {\n return apiRejection(\"expecting a positive integer\\u000a\\u000a See http://goo.gl/MqrFmX\\u000a\");\n }\n var ret = new SomePromiseArray(promises);\n var promise = ret.promise();\n ret.setHowMany(howMany);\n ret.init();\n return promise;\n}\n\nPromise.some = function (promises, howMany) {\n return some(promises, howMany);\n};\n\nPromise.prototype.some = function (howMany) {\n return some(this, howMany);\n};\n\nPromise._SomePromiseArray = SomePromiseArray;\n};\n","\"use strict\";\nmodule.exports = function(Promise, INTERNAL) {\nvar PromiseMap = Promise.map;\n\nPromise.prototype.filter = function (fn, options) {\n return PromiseMap(this, fn, options, INTERNAL);\n};\n\nPromise.filter = function (promises, fn, options) {\n return PromiseMap(promises, fn, options, INTERNAL);\n};\n};\n","\"use strict\";\nmodule.exports = function(Promise, INTERNAL) {\nvar PromiseReduce = Promise.reduce;\nvar PromiseAll = Promise.all;\n\nfunction promiseAllThis() {\n return PromiseAll(this);\n}\n\nfunction PromiseMapSeries(promises, fn) {\n return PromiseReduce(promises, fn, INTERNAL, INTERNAL);\n}\n\nPromise.prototype.each = function (fn) {\n return PromiseReduce(this, fn, INTERNAL, 0)\n ._then(promiseAllThis, undefined, undefined, this, undefined);\n};\n\nPromise.prototype.mapSeries = function (fn) {\n return PromiseReduce(this, fn, INTERNAL, INTERNAL);\n};\n\nPromise.each = function (promises, fn) {\n return PromiseReduce(promises, fn, INTERNAL, 0)\n ._then(promiseAllThis, undefined, undefined, promises, undefined);\n};\n\nPromise.mapSeries = PromiseMapSeries;\n};\n\n","\"use strict\";\nmodule.exports = function(Promise) {\nvar SomePromiseArray = Promise._SomePromiseArray;\nfunction any(promises) {\n var ret = new SomePromiseArray(promises);\n var promise = ret.promise();\n ret.setHowMany(1);\n ret.setUnwrap();\n ret.init();\n return promise;\n}\n\nPromise.any = function (promises) {\n return any(promises);\n};\n\nPromise.prototype.any = function () {\n return any(this);\n};\n\n};\n","\"use strict\";\nmodule.exports = function() {\nvar makeSelfResolutionError = function () {\n return new TypeError(\"circular promise resolution chain\\u000a\\u000a See http://goo.gl/MqrFmX\\u000a\");\n};\nvar reflectHandler = function() {\n return new Promise.PromiseInspection(this._target());\n};\nvar apiRejection = function(msg) {\n return Promise.reject(new TypeError(msg));\n};\nfunction Proxyable() {}\nvar UNDEFINED_BINDING = {};\nvar util = require(\"./util\");\n\nvar getDomain;\nif (util.isNode) {\n getDomain = function() {\n var ret = process.domain;\n if (ret === undefined) ret = null;\n return ret;\n };\n} else {\n getDomain = function() {\n return null;\n };\n}\nutil.notEnumerableProp(Promise, \"_getDomain\", getDomain);\n\nvar es5 = require(\"./es5\");\nvar Async = require(\"./async\");\nvar async = new Async();\nes5.defineProperty(Promise, \"_async\", {value: async});\nvar errors = require(\"./errors\");\nvar TypeError = Promise.TypeError = errors.TypeError;\nPromise.RangeError = errors.RangeError;\nvar CancellationError = Promise.CancellationError = errors.CancellationError;\nPromise.TimeoutError = errors.TimeoutError;\nPromise.OperationalError = errors.OperationalError;\nPromise.RejectionError = errors.OperationalError;\nPromise.AggregateError = errors.AggregateError;\nvar INTERNAL = function(){};\nvar APPLY = {};\nvar NEXT_FILTER = {};\nvar tryConvertToPromise = require(\"./thenables\")(Promise, INTERNAL);\nvar PromiseArray =\n require(\"./promise_array\")(Promise, INTERNAL,\n tryConvertToPromise, apiRejection, Proxyable);\nvar Context = require(\"./context\")(Promise);\n /*jshint unused:false*/\nvar createContext = Context.create;\nvar debug = require(\"./debuggability\")(Promise, Context);\nvar CapturedTrace = debug.CapturedTrace;\nvar PassThroughHandlerContext =\n require(\"./finally\")(Promise, tryConvertToPromise, NEXT_FILTER);\nvar catchFilter = require(\"./catch_filter\")(NEXT_FILTER);\nvar nodebackForPromise = require(\"./nodeback\");\nvar errorObj = util.errorObj;\nvar tryCatch = util.tryCatch;\nfunction check(self, executor) {\n if (self == null || self.constructor !== Promise) {\n throw new TypeError(\"the promise constructor cannot be invoked directly\\u000a\\u000a See http://goo.gl/MqrFmX\\u000a\");\n }\n if (typeof executor !== \"function\") {\n throw new TypeError(\"expecting a function but got \" + util.classString(executor));\n }\n\n}\n\nfunction Promise(executor) {\n if (executor !== INTERNAL) {\n check(this, executor);\n }\n this._bitField = 0;\n this._fulfillmentHandler0 = undefined;\n this._rejectionHandler0 = undefined;\n this._promise0 = undefined;\n this._receiver0 = undefined;\n this._resolveFromExecutor(executor);\n this._promiseCreated();\n this._fireEvent(\"promiseCreated\", this);\n}\n\nPromise.prototype.toString = function () {\n return \"[object Promise]\";\n};\n\nPromise.prototype.caught = Promise.prototype[\"catch\"] = function (fn) {\n var len = arguments.length;\n if (len > 1) {\n var catchInstances = new Array(len - 1),\n j = 0, i;\n for (i = 0; i < len - 1; ++i) {\n var item = arguments[i];\n if (util.isObject(item)) {\n catchInstances[j++] = item;\n } else {\n return apiRejection(\"Catch statement predicate: \" +\n \"expecting an object but got \" + util.classString(item));\n }\n }\n catchInstances.length = j;\n fn = arguments[i];\n return this.then(undefined, catchFilter(catchInstances, fn, this));\n }\n return this.then(undefined, fn);\n};\n\nPromise.prototype.reflect = function () {\n return this._then(reflectHandler,\n reflectHandler, undefined, this, undefined);\n};\n\nPromise.prototype.then = function (didFulfill, didReject) {\n if (debug.warnings() && arguments.length > 0 &&\n typeof didFulfill !== \"function\" &&\n typeof didReject !== \"function\") {\n var msg = \".then() only accepts functions but was passed: \" +\n util.classString(didFulfill);\n if (arguments.length > 1) {\n msg += \", \" + util.classString(didReject);\n }\n this._warn(msg);\n }\n return this._then(didFulfill, didReject, undefined, undefined, undefined);\n};\n\nPromise.prototype.done = function (didFulfill, didReject) {\n var promise =\n this._then(didFulfill, didReject, undefined, undefined, undefined);\n promise._setIsFinal();\n};\n\nPromise.prototype.spread = function (fn) {\n if (typeof fn !== \"function\") {\n return apiRejection(\"expecting a function but got \" + util.classString(fn));\n }\n return this.all()._then(fn, undefined, undefined, APPLY, undefined);\n};\n\nPromise.prototype.toJSON = function () {\n var ret = {\n isFulfilled: false,\n isRejected: false,\n fulfillmentValue: undefined,\n rejectionReason: undefined\n };\n if (this.isFulfilled()) {\n ret.fulfillmentValue = this.value();\n ret.isFulfilled = true;\n } else if (this.isRejected()) {\n ret.rejectionReason = this.reason();\n ret.isRejected = true;\n }\n return ret;\n};\n\nPromise.prototype.all = function () {\n if (arguments.length > 0) {\n this._warn(\".all() was passed arguments but it does not take any\");\n }\n return new PromiseArray(this).promise();\n};\n\nPromise.prototype.error = function (fn) {\n return this.caught(util.originatesFromRejection, fn);\n};\n\nPromise.getNewLibraryCopy = module.exports;\n\nPromise.is = function (val) {\n return val instanceof Promise;\n};\n\nPromise.fromNode = Promise.fromCallback = function(fn) {\n var ret = new Promise(INTERNAL);\n ret._captureStackTrace();\n var multiArgs = arguments.length > 1 ? !!Object(arguments[1]).multiArgs\n : false;\n var result = tryCatch(fn)(nodebackForPromise(ret, multiArgs));\n if (result === errorObj) {\n ret._rejectCallback(result.e, true);\n }\n if (!ret._isFateSealed()) ret._setAsyncGuaranteed();\n return ret;\n};\n\nPromise.all = function (promises) {\n return new PromiseArray(promises).promise();\n};\n\nPromise.cast = function (obj) {\n var ret = tryConvertToPromise(obj);\n if (!(ret instanceof Promise)) {\n ret = new Promise(INTERNAL);\n ret._captureStackTrace();\n ret._setFulfilled();\n ret._rejectionHandler0 = obj;\n }\n return ret;\n};\n\nPromise.resolve = Promise.fulfilled = Promise.cast;\n\nPromise.reject = Promise.rejected = function (reason) {\n var ret = new Promise(INTERNAL);\n ret._captureStackTrace();\n ret._rejectCallback(reason, true);\n return ret;\n};\n\nPromise.setScheduler = function(fn) {\n if (typeof fn !== \"function\") {\n throw new TypeError(\"expecting a function but got \" + util.classString(fn));\n }\n return async.setScheduler(fn);\n};\n\nPromise.prototype._then = function (\n didFulfill,\n didReject,\n _, receiver,\n internalData\n) {\n var haveInternalData = internalData !== undefined;\n var promise = haveInternalData ? internalData : new Promise(INTERNAL);\n var target = this._target();\n var bitField = target._bitField;\n\n if (!haveInternalData) {\n promise._propagateFrom(this, 3);\n promise._captureStackTrace();\n if (receiver === undefined &&\n ((this._bitField & 2097152) !== 0)) {\n if (!((bitField & 50397184) === 0)) {\n receiver = this._boundValue();\n } else {\n receiver = target === this ? undefined : this._boundTo;\n }\n }\n this._fireEvent(\"promiseChained\", this, promise);\n }\n\n var domain = getDomain();\n if (!((bitField & 50397184) === 0)) {\n var handler, value, settler = target._settlePromiseCtx;\n if (((bitField & 33554432) !== 0)) {\n value = target._rejectionHandler0;\n handler = didFulfill;\n } else if (((bitField & 16777216) !== 0)) {\n value = target._fulfillmentHandler0;\n handler = didReject;\n target._unsetRejectionIsUnhandled();\n } else {\n settler = target._settlePromiseLateCancellationObserver;\n value = new CancellationError(\"late cancellation observer\");\n target._attachExtraTrace(value);\n handler = didReject;\n }\n\n async.invoke(settler, target, {\n handler: domain === null ? handler\n : (typeof handler === \"function\" &&\n util.domainBind(domain, handler)),\n promise: promise,\n receiver: receiver,\n value: value\n });\n } else {\n target._addCallbacks(didFulfill, didReject, promise, receiver, domain);\n }\n\n return promise;\n};\n\nPromise.prototype._length = function () {\n return this._bitField & 65535;\n};\n\nPromise.prototype._isFateSealed = function () {\n return (this._bitField & 117506048) !== 0;\n};\n\nPromise.prototype._isFollowing = function () {\n return (this._bitField & 67108864) === 67108864;\n};\n\nPromise.prototype._setLength = function (len) {\n this._bitField = (this._bitField & -65536) |\n (len & 65535);\n};\n\nPromise.prototype._setFulfilled = function () {\n this._bitField = this._bitField | 33554432;\n this._fireEvent(\"promiseFulfilled\", this);\n};\n\nPromise.prototype._setRejected = function () {\n this._bitField = this._bitField | 16777216;\n this._fireEvent(\"promiseRejected\", this);\n};\n\nPromise.prototype._setFollowing = function () {\n this._bitField = this._bitField | 67108864;\n this._fireEvent(\"promiseResolved\", this);\n};\n\nPromise.prototype._setIsFinal = function () {\n this._bitField = this._bitField | 4194304;\n};\n\nPromise.prototype._isFinal = function () {\n return (this._bitField & 4194304) > 0;\n};\n\nPromise.prototype._unsetCancelled = function() {\n this._bitField = this._bitField & (~65536);\n};\n\nPromise.prototype._setCancelled = function() {\n this._bitField = this._bitField | 65536;\n this._fireEvent(\"promiseCancelled\", this);\n};\n\nPromise.prototype._setWillBeCancelled = function() {\n this._bitField = this._bitField | 8388608;\n};\n\nPromise.prototype._setAsyncGuaranteed = function() {\n if (async.hasCustomScheduler()) return;\n this._bitField = this._bitField | 134217728;\n};\n\nPromise.prototype._receiverAt = function (index) {\n var ret = index === 0 ? this._receiver0 : this[\n index * 4 - 4 + 3];\n if (ret === UNDEFINED_BINDING) {\n return undefined;\n } else if (ret === undefined && this._isBound()) {\n return this._boundValue();\n }\n return ret;\n};\n\nPromise.prototype._promiseAt = function (index) {\n return this[\n index * 4 - 4 + 2];\n};\n\nPromise.prototype._fulfillmentHandlerAt = function (index) {\n return this[\n index * 4 - 4 + 0];\n};\n\nPromise.prototype._rejectionHandlerAt = function (index) {\n return this[\n index * 4 - 4 + 1];\n};\n\nPromise.prototype._boundValue = function() {};\n\nPromise.prototype._migrateCallback0 = function (follower) {\n var bitField = follower._bitField;\n var fulfill = follower._fulfillmentHandler0;\n var reject = follower._rejectionHandler0;\n var promise = follower._promise0;\n var receiver = follower._receiverAt(0);\n if (receiver === undefined) receiver = UNDEFINED_BINDING;\n this._addCallbacks(fulfill, reject, promise, receiver, null);\n};\n\nPromise.prototype._migrateCallbackAt = function (follower, index) {\n var fulfill = follower._fulfillmentHandlerAt(index);\n var reject = follower._rejectionHandlerAt(index);\n var promise = follower._promiseAt(index);\n var receiver = follower._receiverAt(index);\n if (receiver === undefined) receiver = UNDEFINED_BINDING;\n this._addCallbacks(fulfill, reject, promise, receiver, null);\n};\n\nPromise.prototype._addCallbacks = function (\n fulfill,\n reject,\n promise,\n receiver,\n domain\n) {\n var index = this._length();\n\n if (index >= 65535 - 4) {\n index = 0;\n this._setLength(0);\n }\n\n if (index === 0) {\n this._promise0 = promise;\n this._receiver0 = receiver;\n if (typeof fulfill === \"function\") {\n this._fulfillmentHandler0 =\n domain === null ? fulfill : util.domainBind(domain, fulfill);\n }\n if (typeof reject === \"function\") {\n this._rejectionHandler0 =\n domain === null ? reject : util.domainBind(domain, reject);\n }\n } else {\n var base = index * 4 - 4;\n this[base + 2] = promise;\n this[base + 3] = receiver;\n if (typeof fulfill === \"function\") {\n this[base + 0] =\n domain === null ? fulfill : util.domainBind(domain, fulfill);\n }\n if (typeof reject === \"function\") {\n this[base + 1] =\n domain === null ? reject : util.domainBind(domain, reject);\n }\n }\n this._setLength(index + 1);\n return index;\n};\n\nPromise.prototype._proxy = function (proxyable, arg) {\n this._addCallbacks(undefined, undefined, arg, proxyable, null);\n};\n\nPromise.prototype._resolveCallback = function(value, shouldBind) {\n if (((this._bitField & 117506048) !== 0)) return;\n if (value === this)\n return this._rejectCallback(makeSelfResolutionError(), false);\n var maybePromise = tryConvertToPromise(value, this);\n if (!(maybePromise instanceof Promise)) return this._fulfill(value);\n\n if (shouldBind) this._propagateFrom(maybePromise, 2);\n\n var promise = maybePromise._target();\n\n if (promise === this) {\n this._reject(makeSelfResolutionError());\n return;\n }\n\n var bitField = promise._bitField;\n if (((bitField & 50397184) === 0)) {\n var len = this._length();\n if (len > 0) promise._migrateCallback0(this);\n for (var i = 1; i < len; ++i) {\n promise._migrateCallbackAt(this, i);\n }\n this._setFollowing();\n this._setLength(0);\n this._setFollowee(promise);\n } else if (((bitField & 33554432) !== 0)) {\n this._fulfill(promise._value());\n } else if (((bitField & 16777216) !== 0)) {\n this._reject(promise._reason());\n } else {\n var reason = new CancellationError(\"late cancellation observer\");\n promise._attachExtraTrace(reason);\n this._reject(reason);\n }\n};\n\nPromise.prototype._rejectCallback =\nfunction(reason, synchronous, ignoreNonErrorWarnings) {\n var trace = util.ensureErrorObject(reason);\n var hasStack = trace === reason;\n if (!hasStack && !ignoreNonErrorWarnings && debug.warnings()) {\n var message = \"a promise was rejected with a non-error: \" +\n util.classString(reason);\n this._warn(message, true);\n }\n this._attachExtraTrace(trace, synchronous ? hasStack : false);\n this._reject(reason);\n};\n\nPromise.prototype._resolveFromExecutor = function (executor) {\n if (executor === INTERNAL) return;\n var promise = this;\n this._captureStackTrace();\n this._pushContext();\n var synchronous = true;\n var r = this._execute(executor, function(value) {\n promise._resolveCallback(value);\n }, function (reason) {\n promise._rejectCallback(reason, synchronous);\n });\n synchronous = false;\n this._popContext();\n\n if (r !== undefined) {\n promise._rejectCallback(r, true);\n }\n};\n\nPromise.prototype._settlePromiseFromHandler = function (\n handler, receiver, value, promise\n) {\n var bitField = promise._bitField;\n if (((bitField & 65536) !== 0)) return;\n promise._pushContext();\n var x;\n if (receiver === APPLY) {\n if (!value || typeof value.length !== \"number\") {\n x = errorObj;\n x.e = new TypeError(\"cannot .spread() a non-array: \" +\n util.classString(value));\n } else {\n x = tryCatch(handler).apply(this._boundValue(), value);\n }\n } else {\n x = tryCatch(handler).call(receiver, value);\n }\n var promiseCreated = promise._popContext();\n bitField = promise._bitField;\n if (((bitField & 65536) !== 0)) return;\n\n if (x === NEXT_FILTER) {\n promise._reject(value);\n } else if (x === errorObj) {\n promise._rejectCallback(x.e, false);\n } else {\n debug.checkForgottenReturns(x, promiseCreated, \"\", promise, this);\n promise._resolveCallback(x);\n }\n};\n\nPromise.prototype._target = function() {\n var ret = this;\n while (ret._isFollowing()) ret = ret._followee();\n return ret;\n};\n\nPromise.prototype._followee = function() {\n return this._rejectionHandler0;\n};\n\nPromise.prototype._setFollowee = function(promise) {\n this._rejectionHandler0 = promise;\n};\n\nPromise.prototype._settlePromise = function(promise, handler, receiver, value) {\n var isPromise = promise instanceof Promise;\n var bitField = this._bitField;\n var asyncGuaranteed = ((bitField & 134217728) !== 0);\n if (((bitField & 65536) !== 0)) {\n if (isPromise) promise._invokeInternalOnCancel();\n\n if (receiver instanceof PassThroughHandlerContext &&\n receiver.isFinallyHandler()) {\n receiver.cancelPromise = promise;\n if (tryCatch(handler).call(receiver, value) === errorObj) {\n promise._reject(errorObj.e);\n }\n } else if (handler === reflectHandler) {\n promise._fulfill(reflectHandler.call(receiver));\n } else if (receiver instanceof Proxyable) {\n receiver._promiseCancelled(promise);\n } else if (isPromise || promise instanceof PromiseArray) {\n promise._cancel();\n } else {\n receiver.cancel();\n }\n } else if (typeof handler === \"function\") {\n if (!isPromise) {\n handler.call(receiver, value, promise);\n } else {\n if (asyncGuaranteed) promise._setAsyncGuaranteed();\n this._settlePromiseFromHandler(handler, receiver, value, promise);\n }\n } else if (receiver instanceof Proxyable) {\n if (!receiver._isResolved()) {\n if (((bitField & 33554432) !== 0)) {\n receiver._promiseFulfilled(value, promise);\n } else {\n receiver._promiseRejected(value, promise);\n }\n }\n } else if (isPromise) {\n if (asyncGuaranteed) promise._setAsyncGuaranteed();\n if (((bitField & 33554432) !== 0)) {\n promise._fulfill(value);\n } else {\n promise._reject(value);\n }\n }\n};\n\nPromise.prototype._settlePromiseLateCancellationObserver = function(ctx) {\n var handler = ctx.handler;\n var promise = ctx.promise;\n var receiver = ctx.receiver;\n var value = ctx.value;\n if (typeof handler === \"function\") {\n if (!(promise instanceof Promise)) {\n handler.call(receiver, value, promise);\n } else {\n this._settlePromiseFromHandler(handler, receiver, value, promise);\n }\n } else if (promise instanceof Promise) {\n promise._reject(value);\n }\n};\n\nPromise.prototype._settlePromiseCtx = function(ctx) {\n this._settlePromise(ctx.promise, ctx.handler, ctx.receiver, ctx.value);\n};\n\nPromise.prototype._settlePromise0 = function(handler, value, bitField) {\n var promise = this._promise0;\n var receiver = this._receiverAt(0);\n this._promise0 = undefined;\n this._receiver0 = undefined;\n this._settlePromise(promise, handler, receiver, value);\n};\n\nPromise.prototype._clearCallbackDataAtIndex = function(index) {\n var base = index * 4 - 4;\n this[base + 2] =\n this[base + 3] =\n this[base + 0] =\n this[base + 1] = undefined;\n};\n\nPromise.prototype._fulfill = function (value) {\n var bitField = this._bitField;\n if (((bitField & 117506048) >>> 16)) return;\n if (value === this) {\n var err = makeSelfResolutionError();\n this._attachExtraTrace(err);\n return this._reject(err);\n }\n this._setFulfilled();\n this._rejectionHandler0 = value;\n\n if ((bitField & 65535) > 0) {\n if (((bitField & 134217728) !== 0)) {\n this._settlePromises();\n } else {\n async.settlePromises(this);\n }\n }\n};\n\nPromise.prototype._reject = function (reason) {\n var bitField = this._bitField;\n if (((bitField & 117506048) >>> 16)) return;\n this._setRejected();\n this._fulfillmentHandler0 = reason;\n\n if (this._isFinal()) {\n return async.fatalError(reason, util.isNode);\n }\n\n if ((bitField & 65535) > 0) {\n async.settlePromises(this);\n } else {\n this._ensurePossibleRejectionHandled();\n }\n};\n\nPromise.prototype._fulfillPromises = function (len, value) {\n for (var i = 1; i < len; i++) {\n var handler = this._fulfillmentHandlerAt(i);\n var promise = this._promiseAt(i);\n var receiver = this._receiverAt(i);\n this._clearCallbackDataAtIndex(i);\n this._settlePromise(promise, handler, receiver, value);\n }\n};\n\nPromise.prototype._rejectPromises = function (len, reason) {\n for (var i = 1; i < len; i++) {\n var handler = this._rejectionHandlerAt(i);\n var promise = this._promiseAt(i);\n var receiver = this._receiverAt(i);\n this._clearCallbackDataAtIndex(i);\n this._settlePromise(promise, handler, receiver, reason);\n }\n};\n\nPromise.prototype._settlePromises = function () {\n var bitField = this._bitField;\n var len = (bitField & 65535);\n\n if (len > 0) {\n if (((bitField & 16842752) !== 0)) {\n var reason = this._fulfillmentHandler0;\n this._settlePromise0(this._rejectionHandler0, reason, bitField);\n this._rejectPromises(len, reason);\n } else {\n var value = this._rejectionHandler0;\n this._settlePromise0(this._fulfillmentHandler0, value, bitField);\n this._fulfillPromises(len, value);\n }\n this._setLength(0);\n }\n this._clearCancellationData();\n};\n\nPromise.prototype._settledValue = function() {\n var bitField = this._bitField;\n if (((bitField & 33554432) !== 0)) {\n return this._rejectionHandler0;\n } else if (((bitField & 16777216) !== 0)) {\n return this._fulfillmentHandler0;\n }\n};\n\nfunction deferResolve(v) {this.promise._resolveCallback(v);}\nfunction deferReject(v) {this.promise._rejectCallback(v, false);}\n\nPromise.defer = Promise.pending = function() {\n debug.deprecated(\"Promise.defer\", \"new Promise\");\n var promise = new Promise(INTERNAL);\n return {\n promise: promise,\n resolve: deferResolve,\n reject: deferReject\n };\n};\n\nutil.notEnumerableProp(Promise,\n \"_makeSelfResolutionError\",\n makeSelfResolutionError);\n\nrequire(\"./method\")(Promise, INTERNAL, tryConvertToPromise, apiRejection,\n debug);\nrequire(\"./bind\")(Promise, INTERNAL, tryConvertToPromise, debug);\nrequire(\"./cancel\")(Promise, PromiseArray, apiRejection, debug);\nrequire(\"./direct_resolve\")(Promise);\nrequire(\"./synchronous_inspection\")(Promise);\nrequire(\"./join\")(\n Promise, PromiseArray, tryConvertToPromise, INTERNAL, async, getDomain);\nPromise.Promise = Promise;\nPromise.version = \"3.5.1\";\nrequire('./map.js')(Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL, debug);\nrequire('./call_get.js')(Promise);\nrequire('./using.js')(Promise, apiRejection, tryConvertToPromise, createContext, INTERNAL, debug);\nrequire('./timers.js')(Promise, INTERNAL, debug);\nrequire('./generators.js')(Promise, apiRejection, INTERNAL, tryConvertToPromise, Proxyable, debug);\nrequire('./nodeify.js')(Promise);\nrequire('./promisify.js')(Promise, INTERNAL);\nrequire('./props.js')(Promise, PromiseArray, tryConvertToPromise, apiRejection);\nrequire('./race.js')(Promise, INTERNAL, tryConvertToPromise, apiRejection);\nrequire('./reduce.js')(Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL, debug);\nrequire('./settle.js')(Promise, PromiseArray, debug);\nrequire('./some.js')(Promise, PromiseArray, apiRejection);\nrequire('./filter.js')(Promise, INTERNAL);\nrequire('./each.js')(Promise, INTERNAL);\nrequire('./any.js')(Promise);\n \n util.toFastProperties(Promise); \n util.toFastProperties(Promise.prototype); \n function fillTypes(value) { \n var p = new Promise(INTERNAL); \n p._fulfillmentHandler0 = value; \n p._rejectionHandler0 = value; \n p._promise0 = value; \n p._receiver0 = value; \n } \n // Complete slack tracking, opt out of field-type tracking and \n // stabilize map \n fillTypes({a: 1}); \n fillTypes({b: 2}); \n fillTypes({c: 3}); \n fillTypes(1); \n fillTypes(function(){}); \n fillTypes(undefined); \n fillTypes(false); \n fillTypes(new Promise(INTERNAL)); \n debug.setBounds(Async.firstLineError, util.lastLineError); \n return Promise; \n\n};\n","\"use strict\";\nvar old;\nif (typeof Promise !== \"undefined\") old = Promise;\nfunction noConflict() {\n try { if (Promise === bluebird) Promise = old; }\n catch (e) {}\n return bluebird;\n}\nvar bluebird = require(\"./promise\")();\nbluebird.noConflict = noConflict;\nmodule.exports = bluebird;\n","var PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i\n\n/**\n * Generate an UUID as specified in RFC4122\n */\n\nvar uuid = {}\n\nuuid.generate = function generateUuid () {\n var d = Date.now()\n var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {\n var r = (d + Math.random() * 16) % 16 | 0;\n d = Math.floor(d / 16);\n return (c == 'x' ? r : (r & 0x3 | 0x8)).toString(16);\n })\n return uuid\n}\n\n/**\n * Validates UUID as specified in RFC4122\n */\n\nuuid.validate = function validateUuid (str) {\n if (!str || typeof str !== \"string\") return false\n return PATTERN.test(str)\n}\n\nexport default uuid","import Promise from 'bluebird'\nimport runtime from '../../core/runtime.js'\nimport uuid from '../../utils/uuid.js'\n\n// main\n\nexport default function JsonRpc2Client () {\n\n this._openRequests = {} // open request cache (indexed by request id)\n this._closedRequestIds = []\n\n}\n\nJsonRpc2Client.prototype = {\n\n // private methods\n\n _handleError: function (message, additionalInfo) {\n console.error(message, additionalInfo)\n },\n\n _closeRequest: function(id) {\n // remove request from open request cache\n delete this._openRequests[ id ]\n // remember closed request\n this._closedRequestIds.push(id)\n },\n\n // public methods\n\n createRequest: function (methodName, params) {\n\n var self = this\n\n var id = uuid.generate()\n var timestamp = Date.now()\n var message = {\n jsonrpc: '2.0',\n method: methodName,\n params: params,\n id: id\n }\n var request = {\n id: id,\n message: message,\n timestamp: timestamp\n }\n var promise = new Promise(function(resolve, reject){\n request._resolve = resolve\n request._reject = reject\n request.cancel = reject\n })\n request.promise = promise\n\n // remember open request\n self._openRequests[ id ] = request\n\n // handle closing of request independent of promise fate\n promise.finally(function(){\n self._closeRequest(id)\n }).catch(function(){\n self._closeRequest(id)\n })\n\n // return request\n return request\n\n },\n\n handleResponse: function (response) {\n\n var id = response.id\n var request = this._openRequests[ id ]\n\n if (id === undefined) {\n // not valid JSON-RPC2 response\n if (runtime.isDebugMode) console.error('Incoming message is not a valid JSON-RPC2 response (ID should be present as string, number or null).', response)\n\n } else if (request) {\n\n // response to an open request\n if (response.error) {\n if (response.error.message) {\n // valid JSON-RPC2 error message. log only in debug mode\n if (runtime.isDebugMode) console.error('API error response: \"'+response.error.message+'\"\\nResponse JSON-RPC2 ID: '+id+'\\nOriginal JSON-RPC2 request: '+JSON.stringify(request.message, null, 2))\n request._reject(response.error.message)\n } else {\n // non-standard (unexpected) error: log everything into console\n console.error('API error (not JSON-RPC2 standard): '+JSON.stringify(response)+'\\nOriginal JSON-RPC2 request: '+JSON.stringify(request.message, null, 2))\n request._reject('Undefined Error. Check console for details.')\n }\n } else {\n // success\n request._resolve(response.result)\n }\n\n } else if (this._closedRequestIds.indexOf(id) !== -1) {\n // Request has been closed already or timed out\n if (runtime.isDebugMode) console.error('JSON-RPC2 request has already been responded, canceled or timed out.', id)\n\n } else if (id === null) {\n // id = null (valid according to JSON-RPC2 specs. but can not be matched with request. should be avoided!)\n if (runtime.isDebugMode) console.error('Incoming JSON-RPC2 response has ID = null.', response)\n\n } else {\n // unknown id\n if (runtime.isDebugMode) console.error('Incoming JSON-RPC2 response has an unknown ID.', id)\n\n }\n\n }\n\n}","import runtime from '../../core/runtime.js'\nimport configs from '../../core/configs.js'\nimport fetch from '../../utils/io/fetch.js'\nimport Promise from 'bluebird'\nimport JsonRpc2Client from './json-rpc2-client.js'\n// import cache from './common/promise-cache.js'\n\n// internals\nvar rpcClient = new JsonRpc2Client()\n\n// main\n\n// TODO: add api.onMethod('methodName')\n// TODO: add api.onNotification('methodName')\n\nexport default function callService (methodName, params, options) {\n\n // API\n params = params || {}\n options = options || {}\n var secretApiKey = options.secretApiKey || configs.secretApiKey\n var publishableApiKey = options.publishableApiKey || configs.publishableApiKey\n\n // try cache\n // var cacheKey\n // if (useCache) {\n // cacheKey = JSON.stringify([methodName, params, options])\n // var promiseFromCache = cache.get(cacheKey)\n // if (promiseFromCache) {\n // return promiseFromCache\n // }\n // }\n\n // internals\n var rpcRequest = rpcClient.createRequest(methodName, params)\n\n sendHttpRequest(rpcRequest, secretApiKey, publishableApiKey)\n\n // add to cache\n // if (useCache) {\n // cache.add(cacheKey, rpcRequest.promise)\n // }\n\n return rpcRequest.promise\n\n}\n\n// private\n\nfunction handleError (error, additionalInfo) {\n console.warn(error || 'API Connection Error', additionalInfo)\n}\n\nfunction handleIncomingMessage (event) {\n var message\n try {\n message = JSON.parse(event.data)\n } catch (e) {\n // non-valid JSON\n handleError('Incoming message is not valid JSON format.', event.data)\n return\n }\n\n if (message && !message.method) {\n // has no method = it's a response\n rpcClient.handleResponse(message)\n\n } else if (message.method) {\n if (message.id) {\n // method call\n // TODO: trigger onMethod event\n } else {\n // notification call\n // TODO: trigger onNotification event\n }\n }\n}\n\nfunction sendHttpRequest (rpcRequest, secretApiKey, publishableApiKey) {\n\n var isTrustedOrigin = ( runtime.isBrowser && window.location.href.match(/^[^\\:]+:\\/\\/([^\\.]+\\.)?(3d\\.io|archilogic.com|localhost)(:\\d+)?\\//) )\n var headers = { 'Content-Type': 'application/json' }\n if (secretApiKey) headers['X-Secret-Key'] = secretApiKey\n if (publishableApiKey) headers['X-Publishable-Key'] = publishableApiKey\n\n // send request\n fetch(configs.servicesUrl, {\n body: JSON.stringify(rpcRequest.message),\n method: 'POST',\n headers: headers,\n credentials: (isTrustedOrigin ? 'include' : 'omit' ) //TODO: Find a way to allow this more broadly yet safely\n }).then(function (response) {\n return response.text().then(function onParsingSuccess(body){\n // try to parse JSON in any case because valid JSON-RPC2 errors do have error status too\n var message\n try {\n message = JSON.parse(body)\n } catch (error) {\n return Promise.reject('JSON parsing Error: \"'+error+'\" Response body: \"'+body+'\"')\n }\n // rpc client will handle JSON-RPC2 success messages and errors and resolve or reject prcRequest promise accordingly\n rpcClient.handleResponse(message)\n }).catch(function onParsingError(error){\n var errorString = ''\n if (error instanceof Error || typeof error === 'string') {\n errorString = error\n } else {\n try {\n errorString = JSON.stringify(error, null, 2)\n } catch (e) {\n errorString = error && error.toString ? error.toString() : ''\n }\n }\n // response is not a valid json error message. (most likely a network error)\n var errorMessage = 'API request to '+configs.servicesUrl+' failed: '+response.status+': '+response.statusText+'\\n'+errorString+'\\nOriginal JSON-RPC2 request to 3d.io: '+JSON.stringify(rpcRequest.message, null, 2)\n rpcRequest.cancel(errorMessage)\n })\n }).catch(function(error){\n rpcRequest.cancel('Error sending request to 3d.io API: \"'+(error.code || JSON.stringify(error) )+'\"')\n })\n\n}","import callService from '../../utils/services/call'\n\nexport default {\n\n schema: {\n url: {\n type: 'string',\n default: ''\n },\n key: {\n type: 'string',\n default: ''\n },\n scene: {\n type: 'string',\n default: ''\n },\n lightMapIntensity: {\n type: 'float',\n default: 1.2,\n parse: function (value) {\n if (parseFloat(value) >= 0.0) {\n return parseFloat(value)\n }\n return -100.0 // = fallback to value from data3d file\n }\n },\n lightMapExposure: {\n type: 'float',\n default: 0.6,\n parse: function (value) {\n if (parseFloat(value)) {\n return parseFloat(value)\n }\n return -100.0 // = fallback to value from data3d file\n }\n }\n },\n\n init: function () {\n },\n\n update: function () {\n var this_ = this\n var url = this_.data.url || this_.data.URL\n var key = this_.data.key || this_.data.KEY\n var scene = this_.data.scene\n var lightMapIntensity = this_.data.lightMapIntensity\n var lightMapExposure = this_.data.lightMapExposure\n\n if(scene !== '') {\n callService('Model.read', {arguments: { resourceId: scene}}).then(function onResult(result) {\n var level = result.modelStructure.children.filter(function(item) { return item.type === 'level' })[0]\n if (!level) {\n console.error('Unable to load data3d from scene ' + scene + ': The scene does not contain data in the expected format. Error was: No level found.')\n return\n }\n if (!level.bakedModelUrl) {\n console.error('Unable to load data3d from scene ' + scene + ': The scene is not baked. Enable realistic lighting on this scene. Error was: No baked data3d present.')\n return\n }\n var bakedModel = level.bakedModelUrl\n if (bakedModel.split('.')[bakedModel.split('.').length - 1] !== 'buffer') {\n console.error('Unable to load data3d from scene ' + scene + ': The scene is not in Data3D format. Disable and enable realistic lighting on this scene. Error was: No buffer3d found.')\n return\n }\n this_.data.key = bakedModel\n key = bakedModel\n console.log('Loading scene', key)\n this_.data.scene = ''\n this_.update()\n }).catch(function onApiError(err) {\n console.error('Unable to load data3d from scene ' + scene + ': The API returned an error. Error was:', err)\n })\n }\n\n // check params\n if ((!url || url === '') && (!key || key === '' || key === 'undefined')) return\n\n // remove old mesh\n this_.remove()\n\n // create new one\n this_.mesh = new THREE.Object3D()\n this_.data3dView = new io3d.aframe.three.Data3dView({parent: this_.mesh})\n this_.el.data3dView = this_.data3dView\n\n // load 3d file\n Promise.resolve().then(function(){\n if (key) {\n return io3d.storage.get(key, { loadingQueuePrefix: 'architecture' })\n } else {\n return io3d.utils.data3d.load(url, { loadingQueuePrefix: 'architecture' })\n }\n }).then(function (data3d) {\n this_.el.data3d = data3d\n // update view\n this_.data3dView.set(data3d, {\n lightMapIntensity: lightMapIntensity,\n lightMapExposure: lightMapExposure,\n loadingQueuePrefix: 'architecture'\n })\n this_.el.setObject3D('mesh', this_.mesh)\n // emit event\n this_.el.emit('model-loaded', {format: 'data3d', model: this_.mesh});\n }).catch(function(error) {\n console.warn(error)\n })\n },\n\n remove: function () {\n if (this.data3dView) {\n this.data3dView.destroy()\n this.data3dView = null\n this.el.data3dView = null\n }\n if (this.mesh) {\n this.el.removeObject3D('mesh')\n this.mesh = null\n }\n }\n\n}\n","// API\n\nvar clone = cloneData3d\nclone.withPayload = cloneData3dWithPayload\nclone.meshes = cloneMeshes\nclone.mesh = cloneSingleMesh\nclone.materials = cloneMaterials\nclone.material = cloneSingleMaterial\n\nexport default clone\n\n// methods\n\nfunction cloneData3d (_data3d, options) {\n\n var clone = {}\n\n clone.meshes = cloneMeshes(_data3d.meshes, options)\n clone.materials = cloneMaterials(_data3d.materials)\n\n if (_data3d.alternativeMaterialsByMeshKey) {\n clone.alternativeMaterialsByMeshKey = JSON.parse(JSON.stringify(_data3d.alternativeMaterialsByMeshKey))\n }\n if (_data3d._params) {\n clone._params = _data3d._params\n }\n if (_data3d.position) {\n clone.position = _data3d.position.slice(0)\n }\n if (_data3d.rotDeg) {\n clone.rotDeg = _data3d.rotDeg.slice(0)\n }\n if (_data3d.rotRad) {\n clone.rotRad = _data3d.rotRad.slice(0)\n }\n if (_data3d.children) {\n clone.children = _data3d.children.map(function (childData3d) {\n return cloneData3d(childData3d, options)\n })\n }\n\n return clone\n}\n\nfunction cloneData3dWithPayload (data3d) {\n // payload = heavy arrays containing geometry & uv data\n return cloneData3d(data3d, {\n clonePositions: true,\n cloneNormals: true,\n cloneUvs: true,\n cloneUvsLightmap: true\n })\n}\n\nfunction cloneSingleMesh (mesh, options) {\n return cloneMeshes({x: mesh}, options).x\n}\n\nfunction cloneMeshes (_meshes, options) {\n\n if (!_meshes) {\n return {}\n }\n\n // API\n options = options || {}\n var clonePositions = !!options.clonePositions\n var cloneNormals = !!options.cloneNormals\n var cloneUvs = !!options.cloneUvs\n var cloneUvsLightmap = !!options.cloneUvsLightmap\n\n // internals\n var\n meshId, _mesh, mesh,\n meshKeys = Object.keys(_meshes),\n meshes = {}\n\n for (var i = 0, l = meshKeys.length; i < l; i++) {\n\n meshId = meshKeys[i]\n mesh = {}\n _mesh = _meshes[meshId]\n\n // vertices\n if (_mesh.positions) {\n if (clonePositions && (_mesh.positions instanceof Array || _mesh.positions instanceof Float32Array)) {\n mesh.positions = _mesh.positions.slice(0)\n } else {\n mesh.positions = _mesh.positions\n }\n }\n\n // normals\n if (_mesh.normals) {\n if (cloneNormals && (_mesh.normals instanceof Array || _mesh.normals instanceof Float32Array)) {\n mesh.normals = _mesh.normals.slice(0)\n } else {\n mesh.normals = _mesh.normals\n }\n }\n\n // uvs\n if (_mesh.uvs) {\n if (cloneUvs && (_mesh.uvs instanceof Array || _mesh.uvs instanceof Float32Array)) {\n mesh.uvs = _mesh.uvs.slice(0)\n } else {\n mesh.uvs = _mesh.uvs\n }\n }\n\n // uvs lightmap\n if (_mesh.uvsLightmap) {\n if (cloneUvsLightmap && (_mesh.uvsLightmap instanceof Array || _mesh.uvsLightmap instanceof Float32Array)) {\n mesh.uvsLightmap = _mesh.uvsLightmap.slice(0)\n } else {\n mesh.uvsLightmap = _mesh.uvsLightmap\n }\n }\n\n // other arrays\n if (_mesh.matrix) mesh.matrix = _mesh.matrix.slice(0)\n if (_mesh.uvMatrix) mesh.uvMatrix = _mesh.uvMatrix.slice(0)\n if (_mesh.meshKeys) mesh.meshKeys = _mesh.meshKeys.slice(0)\n if (_mesh.position) mesh.position = _mesh.position.slice(0)\n if (_mesh.rotDeg) mesh.rotDeg = _mesh.rotDeg.slice(0)\n if (_mesh.rotRad) mesh.rotRad = _mesh.rotRad.slice(0)\n if (_mesh.scale) mesh.scale = _mesh.scale.slice(0)\n\n // primitives\n if (_mesh.v) mesh.v = _mesh.v\n if (_mesh.vertexMode) mesh.vertexMode = _mesh.vertexMode\n if (_mesh.side) mesh.side = _mesh.side\n if (_mesh.material) mesh.material = _mesh.material\n if (_mesh.visibleInPersonView) mesh.visibleInPersonView = _mesh.visibleInPersonView\n if (_mesh.visibleInBirdView) mesh.visibleInBirdView = _mesh.visibleInBirdView\n if (_mesh.visibleInFloorplanView) mesh.visibleInFloorplanView = _mesh.visibleInFloorplanView\n\n meshes[meshId] = mesh\n }\n\n // output\n return meshes\n}\n\nfunction cloneSingleMaterial (material) {\n return cloneMaterials({x: material}).x\n}\n\nfunction cloneMaterials (_materials) {\n\n if (!_materials) {\n return {}\n }\n\n var materialId, _material, materials, material, materialKeys, _attributes, _attributeKeys, attributeKey, type,\n attributes, isExtended\n\n materialKeys = Object.keys(_materials)\n // result\n materials = {}\n\n if (materialKeys.length === 0) {\n return {}\n }\n\n if (_materials[materialKeys[0]].attributes) {\n isExtended = true\n // deep copy source\n materials = JSON.parse(JSON.stringify(_materials))\n } else {\n isExtended = false\n }\n\n for (var i = 0, l = materialKeys.length; i < l; i++) {\n\n materialId = materialKeys[i]\n _attributes = isExtended ? _materials[materialId].attributes : _materials[materialId]\n\n if (typeof _attributes === 'string') {\n\n if (isExtended) {\n materials[materialId].attributes = _attributes\n } else {\n materials[materialId] = _attributes\n }\n\n } else if (_attributes) {\n\n attributes = {}\n _attributeKeys = Object.keys(_attributes)\n\n for (var j = 0, k = _attributeKeys.length; j < k; j++) {\n attributeKey = _attributeKeys[j]\n type = typeof _attributes[attributeKey]\n if (type === 'string' || type === 'number' || type === 'boolean') {\n // primitive\n attributes[attributeKey] = _attributes[attributeKey]\n } else if (_attributes[attributeKey]) {\n if (_attributes[attributeKey].length === 3) {\n // color array\n attributes[attributeKey] = [\n _attributes[attributeKey][0],\n _attributes[attributeKey][1],\n _attributes[attributeKey][2]\n ]\n } else if (_attributes[attributeKey].length === 2) {\n // size array\n attributes[attributeKey] = [\n _attributes[attributeKey][0],\n _attributes[attributeKey][1]\n ]\n }\n }\n }\n\n if (isExtended) {\n materials[materialId].attributes = attributes\n } else {\n materials[materialId] = attributes\n }\n\n }\n\n }\n\n return materials\n\n}","import cloneData3d from '../../utils/data3d/clone.js'\n\nexport default {\n\n schema: {\n id: {\n type: 'string',\n default: '10344b13-d981-47a0-90ac-f048ee2780a6'\n }\n },\n\n init: function () {\n },\n\n updateSchema: function(newData) {\n var materialProperties = {}\n Object.keys(newData)\n .filter(function (propKey) { return propKey.substr(0, 9) === 'material_' })\n .forEach(function (propKey) {\n materialProperties[propKey] = { type: 'string' }\n })\n this.extendSchema(materialProperties)\n },\n\n update: function (oldData) {\n var this_ = this\n var el = this.el\n var data = this.data\n var furnitureId = data.id\n // check if the furniture id has changed\n var idHasChanged = false\n if ((oldData && oldData.id) && oldData.id !== data.id ) idHasChanged = true\n // check params\n if (!furnitureId || furnitureId === '') return\n\n // remove old mesh\n this_.remove()\n\n // create new one\n this_.mesh = new THREE.Object3D()\n this_.data3dView = new io3d.aframe.three.Data3dView({parent: this_.mesh})\n this_.el.data3dView = this_.data3dView\n\n // get furniture data\n io3d.furniture.get(furnitureId).then(function (result) {\n\n var info = result.info // lightweight info like name, manufacturer, description...\n var data3d = result.data3d // geometries and materials\n var availableMaterials = {}\n\n // Expose properties\n this_.info = info\n this_.data3d = data3d\n this_.availableMaterials = availableMaterials\n\n // check for material presets in the furniture sceneStructure definition\n var materialPreset = info.sceneStructure && JSON.parse(info.sceneStructure).materials\n // Parse materials\n Object.keys(data3d.meshes).forEach(function eachMesh (meshId) {\n availableMaterials[meshId] = data3d.alternativeMaterialsByMeshKey ? data3d.alternativeMaterialsByMeshKey[meshId] : data3d.meshes[meshId].material\n\n // clone data3d to avoid reference mix up\n data3d = this_.data3d = cloneData3d(data3d)\n // get material name from inspector\n var materialPropName = 'material_' + meshId.replace(/\\s/g, '_')\n // get materialId from aframe attribute or from furniture API scene structure preset\n var newMaterialId = data[materialPropName] || materialPreset && materialPreset[meshId]\n // if we're loading a new furniture piece make sure to load it's material preset\n if (idHasChanged && materialPreset) newMaterialId = materialPreset[meshId]\n // update view with custom material (if available)\n if (newMaterialId) {\n // update material\n data3d.meshes[meshId].material = newMaterialId\n // trigger event\n el.emit('material-changed', {mesh: meshId, material: newMaterialId})\n }\n\n // register changeable materials schema\n // (not all furniture have changeable materials)\n if (data3d.alternativeMaterialsByMeshKey && data3d.alternativeMaterialsByMeshKey[meshId]) {\n // extend schema with changeable material\n var prop = {}\n prop[materialPropName] = {\n type: 'string',\n default: data3d.meshes[meshId].material,\n oneOf: data3d.alternativeMaterialsByMeshKey[meshId]\n }\n this_.extendSchema(prop)\n // update current params\n this_.data[materialPropName] = data3d.meshes[meshId].material\n }\n\n })\n\n // update view\n this_.data3dView.set(data3d, {\n loadingQueuePrefix: 'interior'\n })\n this_.el.data3d = data3d\n this_.el.setObject3D('mesh', this_.mesh)\n\n // emit events\n if (this_._previousFurnitureId !== furnitureId) {\n this_.el.emit('model-loaded', {format: 'data3d', model: this_.mesh})\n this_._previousFurnitureId = furnitureId\n }\n\n })\n .catch(function(err) {\n console.warn(err)\n })\n },\n\n remove: function () {\n if (this.data3dView) {\n this.data3dView.destroy()\n this.data3dView = null\n this.el.data3dView = null\n }\n if (this.mesh) {\n this.el.removeObject3D('mesh')\n this.mesh = null\n }\n }\n\n}\n","/**\n * Removes all key-value entries from the list cache.\n *\n * @private\n * @name clear\n * @memberOf ListCache\n */\nfunction listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n}\n\nmodule.exports = listCacheClear;\n","/**\n * Performs a\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * comparison between two values to determine if they are equivalent.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * var object = { 'a': 1 };\n * var other = { 'a': 1 };\n *\n * _.eq(object, object);\n * // => true\n *\n * _.eq(object, other);\n * // => false\n *\n * _.eq('a', 'a');\n * // => true\n *\n * _.eq('a', Object('a'));\n * // => false\n *\n * _.eq(NaN, NaN);\n * // => true\n */\nfunction eq(value, other) {\n return value === other || (value !== value && other !== other);\n}\n\nmodule.exports = eq;\n","var eq = require('./eq');\n\n/**\n * Gets the index at which the `key` is found in `array` of key-value pairs.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} key The key to search for.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\nfunction assocIndexOf(array, key) {\n var length = array.length;\n while (length--) {\n if (eq(array[length][0], key)) {\n return length;\n }\n }\n return -1;\n}\n\nmodule.exports = assocIndexOf;\n","var assocIndexOf = require('./_assocIndexOf');\n\n/** Used for built-in method references. */\nvar arrayProto = Array.prototype;\n\n/** Built-in value references. */\nvar splice = arrayProto.splice;\n\n/**\n * Removes `key` and its value from the list cache.\n *\n * @private\n * @name delete\n * @memberOf ListCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction listCacheDelete(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n return false;\n }\n var lastIndex = data.length - 1;\n if (index == lastIndex) {\n data.pop();\n } else {\n splice.call(data, index, 1);\n }\n --this.size;\n return true;\n}\n\nmodule.exports = listCacheDelete;\n","var assocIndexOf = require('./_assocIndexOf');\n\n/**\n * Gets the list cache value for `key`.\n *\n * @private\n * @name get\n * @memberOf ListCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction listCacheGet(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n return index < 0 ? undefined : data[index][1];\n}\n\nmodule.exports = listCacheGet;\n","var assocIndexOf = require('./_assocIndexOf');\n\n/**\n * Checks if a list cache value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf ListCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction listCacheHas(key) {\n return assocIndexOf(this.__data__, key) > -1;\n}\n\nmodule.exports = listCacheHas;\n","var assocIndexOf = require('./_assocIndexOf');\n\n/**\n * Sets the list cache `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf ListCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the list cache instance.\n */\nfunction listCacheSet(key, value) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n ++this.size;\n data.push([key, value]);\n } else {\n data[index][1] = value;\n }\n return this;\n}\n\nmodule.exports = listCacheSet;\n","var listCacheClear = require('./_listCacheClear'),\n listCacheDelete = require('./_listCacheDelete'),\n listCacheGet = require('./_listCacheGet'),\n listCacheHas = require('./_listCacheHas'),\n listCacheSet = require('./_listCacheSet');\n\n/**\n * Creates an list cache object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction ListCache(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n// Add methods to `ListCache`.\nListCache.prototype.clear = listCacheClear;\nListCache.prototype['delete'] = listCacheDelete;\nListCache.prototype.get = listCacheGet;\nListCache.prototype.has = listCacheHas;\nListCache.prototype.set = listCacheSet;\n\nmodule.exports = ListCache;\n","var ListCache = require('./_ListCache');\n\n/**\n * Removes all key-value entries from the stack.\n *\n * @private\n * @name clear\n * @memberOf Stack\n */\nfunction stackClear() {\n this.__data__ = new ListCache;\n this.size = 0;\n}\n\nmodule.exports = stackClear;\n","/**\n * Removes `key` and its value from the stack.\n *\n * @private\n * @name delete\n * @memberOf Stack\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction stackDelete(key) {\n var data = this.__data__,\n result = data['delete'](key);\n\n this.size = data.size;\n return result;\n}\n\nmodule.exports = stackDelete;\n","/**\n * Gets the stack value for `key`.\n *\n * @private\n * @name get\n * @memberOf Stack\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction stackGet(key) {\n return this.__data__.get(key);\n}\n\nmodule.exports = stackGet;\n","/**\n * Checks if a stack value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Stack\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction stackHas(key) {\n return this.__data__.has(key);\n}\n\nmodule.exports = stackHas;\n","/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\nmodule.exports = freeGlobal;\n","var freeGlobal = require('./_freeGlobal');\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\nmodule.exports = root;\n","var root = require('./_root');\n\n/** Built-in value references. */\nvar Symbol = root.Symbol;\n\nmodule.exports = Symbol;\n","var Symbol = require('./_Symbol');\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the raw `toStringTag`.\n */\nfunction getRawTag(value) {\n var isOwn = hasOwnProperty.call(value, symToStringTag),\n tag = value[symToStringTag];\n\n try {\n value[symToStringTag] = undefined;\n var unmasked = true;\n } catch (e) {}\n\n var result = nativeObjectToString.call(value);\n if (unmasked) {\n if (isOwn) {\n value[symToStringTag] = tag;\n } else {\n delete value[symToStringTag];\n }\n }\n return result;\n}\n\nmodule.exports = getRawTag;\n","/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/**\n * Converts `value` to a string using `Object.prototype.toString`.\n *\n * @private\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n */\nfunction objectToString(value) {\n return nativeObjectToString.call(value);\n}\n\nmodule.exports = objectToString;\n","var Symbol = require('./_Symbol'),\n getRawTag = require('./_getRawTag'),\n objectToString = require('./_objectToString');\n\n/** `Object#toString` result references. */\nvar nullTag = '[object Null]',\n undefinedTag = '[object Undefined]';\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * The base implementation of `getTag` without fallbacks for buggy environments.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nfunction baseGetTag(value) {\n if (value == null) {\n return value === undefined ? undefinedTag : nullTag;\n }\n return (symToStringTag && symToStringTag in Object(value))\n ? getRawTag(value)\n : objectToString(value);\n}\n\nmodule.exports = baseGetTag;\n","/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return value != null && (type == 'object' || type == 'function');\n}\n\nmodule.exports = isObject;\n","var baseGetTag = require('./_baseGetTag'),\n isObject = require('./isObject');\n\n/** `Object#toString` result references. */\nvar asyncTag = '[object AsyncFunction]',\n funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]',\n proxyTag = '[object Proxy]';\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a function, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n if (!isObject(value)) {\n return false;\n }\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in Safari 9 which returns 'object' for typed arrays and other constructors.\n var tag = baseGetTag(value);\n return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;\n}\n\nmodule.exports = isFunction;\n","var root = require('./_root');\n\n/** Used to detect overreaching core-js shims. */\nvar coreJsData = root['__core-js_shared__'];\n\nmodule.exports = coreJsData;\n","var coreJsData = require('./_coreJsData');\n\n/** Used to detect methods masquerading as native. */\nvar maskSrcKey = (function() {\n var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');\n return uid ? ('Symbol(src)_1.' + uid) : '';\n}());\n\n/**\n * Checks if `func` has its source masked.\n *\n * @private\n * @param {Function} func The function to check.\n * @returns {boolean} Returns `true` if `func` is masked, else `false`.\n */\nfunction isMasked(func) {\n return !!maskSrcKey && (maskSrcKey in func);\n}\n\nmodule.exports = isMasked;\n","/** Used for built-in method references. */\nvar funcProto = Function.prototype;\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString = funcProto.toString;\n\n/**\n * Converts `func` to its source code.\n *\n * @private\n * @param {Function} func The function to convert.\n * @returns {string} Returns the source code.\n */\nfunction toSource(func) {\n if (func != null) {\n try {\n return funcToString.call(func);\n } catch (e) {}\n try {\n return (func + '');\n } catch (e) {}\n }\n return '';\n}\n\nmodule.exports = toSource;\n","var isFunction = require('./isFunction'),\n isMasked = require('./_isMasked'),\n isObject = require('./isObject'),\n toSource = require('./_toSource');\n\n/**\n * Used to match `RegExp`\n * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).\n */\nvar reRegExpChar = /[\\\\^$.*+?()[\\]{}|]/g;\n\n/** Used to detect host constructors (Safari). */\nvar reIsHostCtor = /^\\[object .+?Constructor\\]$/;\n\n/** Used for built-in method references. */\nvar funcProto = Function.prototype,\n objectProto = Object.prototype;\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString = funcProto.toString;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/** Used to detect if a method is native. */\nvar reIsNative = RegExp('^' +\n funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\\\$&')\n .replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g, '$1.*?') + '$'\n);\n\n/**\n * The base implementation of `_.isNative` without bad shim checks.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a native function,\n * else `false`.\n */\nfunction baseIsNative(value) {\n if (!isObject(value) || isMasked(value)) {\n return false;\n }\n var pattern = isFunction(value) ? reIsNative : reIsHostCtor;\n return pattern.test(toSource(value));\n}\n\nmodule.exports = baseIsNative;\n","/**\n * Gets the value at `key` of `object`.\n *\n * @private\n * @param {Object} [object] The object to query.\n * @param {string} key The key of the property to get.\n * @returns {*} Returns the property value.\n */\nfunction getValue(object, key) {\n return object == null ? undefined : object[key];\n}\n\nmodule.exports = getValue;\n","var baseIsNative = require('./_baseIsNative'),\n getValue = require('./_getValue');\n\n/**\n * Gets the native function at `key` of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {string} key The key of the method to get.\n * @returns {*} Returns the function if it's native, else `undefined`.\n */\nfunction getNative(object, key) {\n var value = getValue(object, key);\n return baseIsNative(value) ? value : undefined;\n}\n\nmodule.exports = getNative;\n","var getNative = require('./_getNative'),\n root = require('./_root');\n\n/* Built-in method references that are verified to be native. */\nvar Map = getNative(root, 'Map');\n\nmodule.exports = Map;\n","var getNative = require('./_getNative');\n\n/* Built-in method references that are verified to be native. */\nvar nativeCreate = getNative(Object, 'create');\n\nmodule.exports = nativeCreate;\n","var nativeCreate = require('./_nativeCreate');\n\n/**\n * Removes all key-value entries from the hash.\n *\n * @private\n * @name clear\n * @memberOf Hash\n */\nfunction hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n}\n\nmodule.exports = hashClear;\n","/**\n * Removes `key` and its value from the hash.\n *\n * @private\n * @name delete\n * @memberOf Hash\n * @param {Object} hash The hash to modify.\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction hashDelete(key) {\n var result = this.has(key) && delete this.__data__[key];\n this.size -= result ? 1 : 0;\n return result;\n}\n\nmodule.exports = hashDelete;\n","var nativeCreate = require('./_nativeCreate');\n\n/** Used to stand-in for `undefined` hash values. */\nvar HASH_UNDEFINED = '__lodash_hash_undefined__';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Gets the hash value for `key`.\n *\n * @private\n * @name get\n * @memberOf Hash\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction hashGet(key) {\n var data = this.__data__;\n if (nativeCreate) {\n var result = data[key];\n return result === HASH_UNDEFINED ? undefined : result;\n }\n return hasOwnProperty.call(data, key) ? data[key] : undefined;\n}\n\nmodule.exports = hashGet;\n","var nativeCreate = require('./_nativeCreate');\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Checks if a hash value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Hash\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction hashHas(key) {\n var data = this.__data__;\n return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);\n}\n\nmodule.exports = hashHas;\n","var nativeCreate = require('./_nativeCreate');\n\n/** Used to stand-in for `undefined` hash values. */\nvar HASH_UNDEFINED = '__lodash_hash_undefined__';\n\n/**\n * Sets the hash `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf Hash\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the hash instance.\n */\nfunction hashSet(key, value) {\n var data = this.__data__;\n this.size += this.has(key) ? 0 : 1;\n data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;\n return this;\n}\n\nmodule.exports = hashSet;\n","var hashClear = require('./_hashClear'),\n hashDelete = require('./_hashDelete'),\n hashGet = require('./_hashGet'),\n hashHas = require('./_hashHas'),\n hashSet = require('./_hashSet');\n\n/**\n * Creates a hash object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction Hash(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n// Add methods to `Hash`.\nHash.prototype.clear = hashClear;\nHash.prototype['delete'] = hashDelete;\nHash.prototype.get = hashGet;\nHash.prototype.has = hashHas;\nHash.prototype.set = hashSet;\n\nmodule.exports = Hash;\n","var Hash = require('./_Hash'),\n ListCache = require('./_ListCache'),\n Map = require('./_Map');\n\n/**\n * Removes all key-value entries from the map.\n *\n * @private\n * @name clear\n * @memberOf MapCache\n */\nfunction mapCacheClear() {\n this.size = 0;\n this.__data__ = {\n 'hash': new Hash,\n 'map': new (Map || ListCache),\n 'string': new Hash\n };\n}\n\nmodule.exports = mapCacheClear;\n","/**\n * Checks if `value` is suitable for use as unique object key.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is suitable, else `false`.\n */\nfunction isKeyable(value) {\n var type = typeof value;\n return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')\n ? (value !== '__proto__')\n : (value === null);\n}\n\nmodule.exports = isKeyable;\n","var isKeyable = require('./_isKeyable');\n\n/**\n * Gets the data for `map`.\n *\n * @private\n * @param {Object} map The map to query.\n * @param {string} key The reference key.\n * @returns {*} Returns the map data.\n */\nfunction getMapData(map, key) {\n var data = map.__data__;\n return isKeyable(key)\n ? data[typeof key == 'string' ? 'string' : 'hash']\n : data.map;\n}\n\nmodule.exports = getMapData;\n","var getMapData = require('./_getMapData');\n\n/**\n * Removes `key` and its value from the map.\n *\n * @private\n * @name delete\n * @memberOf MapCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction mapCacheDelete(key) {\n var result = getMapData(this, key)['delete'](key);\n this.size -= result ? 1 : 0;\n return result;\n}\n\nmodule.exports = mapCacheDelete;\n","var getMapData = require('./_getMapData');\n\n/**\n * Gets the map value for `key`.\n *\n * @private\n * @name get\n * @memberOf MapCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction mapCacheGet(key) {\n return getMapData(this, key).get(key);\n}\n\nmodule.exports = mapCacheGet;\n","var getMapData = require('./_getMapData');\n\n/**\n * Checks if a map value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf MapCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction mapCacheHas(key) {\n return getMapData(this, key).has(key);\n}\n\nmodule.exports = mapCacheHas;\n","var getMapData = require('./_getMapData');\n\n/**\n * Sets the map `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf MapCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the map cache instance.\n */\nfunction mapCacheSet(key, value) {\n var data = getMapData(this, key),\n size = data.size;\n\n data.set(key, value);\n this.size += data.size == size ? 0 : 1;\n return this;\n}\n\nmodule.exports = mapCacheSet;\n","var mapCacheClear = require('./_mapCacheClear'),\n mapCacheDelete = require('./_mapCacheDelete'),\n mapCacheGet = require('./_mapCacheGet'),\n mapCacheHas = require('./_mapCacheHas'),\n mapCacheSet = require('./_mapCacheSet');\n\n/**\n * Creates a map cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction MapCache(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n// Add methods to `MapCache`.\nMapCache.prototype.clear = mapCacheClear;\nMapCache.prototype['delete'] = mapCacheDelete;\nMapCache.prototype.get = mapCacheGet;\nMapCache.prototype.has = mapCacheHas;\nMapCache.prototype.set = mapCacheSet;\n\nmodule.exports = MapCache;\n","var ListCache = require('./_ListCache'),\n Map = require('./_Map'),\n MapCache = require('./_MapCache');\n\n/** Used as the size to enable large array optimizations. */\nvar LARGE_ARRAY_SIZE = 200;\n\n/**\n * Sets the stack `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf Stack\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the stack cache instance.\n */\nfunction stackSet(key, value) {\n var data = this.__data__;\n if (data instanceof ListCache) {\n var pairs = data.__data__;\n if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {\n pairs.push([key, value]);\n this.size = ++data.size;\n return this;\n }\n data = this.__data__ = new MapCache(pairs);\n }\n data.set(key, value);\n this.size = data.size;\n return this;\n}\n\nmodule.exports = stackSet;\n","var ListCache = require('./_ListCache'),\n stackClear = require('./_stackClear'),\n stackDelete = require('./_stackDelete'),\n stackGet = require('./_stackGet'),\n stackHas = require('./_stackHas'),\n stackSet = require('./_stackSet');\n\n/**\n * Creates a stack cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction Stack(entries) {\n var data = this.__data__ = new ListCache(entries);\n this.size = data.size;\n}\n\n// Add methods to `Stack`.\nStack.prototype.clear = stackClear;\nStack.prototype['delete'] = stackDelete;\nStack.prototype.get = stackGet;\nStack.prototype.has = stackHas;\nStack.prototype.set = stackSet;\n\nmodule.exports = Stack;\n","/**\n * A specialized version of `_.forEach` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns `array`.\n */\nfunction arrayEach(array, iteratee) {\n var index = -1,\n length = array == null ? 0 : array.length;\n\n while (++index < length) {\n if (iteratee(array[index], index, array) === false) {\n break;\n }\n }\n return array;\n}\n\nmodule.exports = arrayEach;\n","var getNative = require('./_getNative');\n\nvar defineProperty = (function() {\n try {\n var func = getNative(Object, 'defineProperty');\n func({}, '', {});\n return func;\n } catch (e) {}\n}());\n\nmodule.exports = defineProperty;\n","var defineProperty = require('./_defineProperty');\n\n/**\n * The base implementation of `assignValue` and `assignMergeValue` without\n * value checks.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\nfunction baseAssignValue(object, key, value) {\n if (key == '__proto__' && defineProperty) {\n defineProperty(object, key, {\n 'configurable': true,\n 'enumerable': true,\n 'value': value,\n 'writable': true\n });\n } else {\n object[key] = value;\n }\n}\n\nmodule.exports = baseAssignValue;\n","var baseAssignValue = require('./_baseAssignValue'),\n eq = require('./eq');\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Assigns `value` to `key` of `object` if the existing value is not equivalent\n * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\nfunction assignValue(object, key, value) {\n var objValue = object[key];\n if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||\n (value === undefined && !(key in object))) {\n baseAssignValue(object, key, value);\n }\n}\n\nmodule.exports = assignValue;\n","var assignValue = require('./_assignValue'),\n baseAssignValue = require('./_baseAssignValue');\n\n/**\n * Copies properties of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy properties from.\n * @param {Array} props The property identifiers to copy.\n * @param {Object} [object={}] The object to copy properties to.\n * @param {Function} [customizer] The function to customize copied values.\n * @returns {Object} Returns `object`.\n */\nfunction copyObject(source, props, object, customizer) {\n var isNew = !object;\n object || (object = {});\n\n var index = -1,\n length = props.length;\n\n while (++index < length) {\n var key = props[index];\n\n var newValue = customizer\n ? customizer(object[key], source[key], key, object, source)\n : undefined;\n\n if (newValue === undefined) {\n newValue = source[key];\n }\n if (isNew) {\n baseAssignValue(object, key, newValue);\n } else {\n assignValue(object, key, newValue);\n }\n }\n return object;\n}\n\nmodule.exports = copyObject;\n","/**\n * The base implementation of `_.times` without support for iteratee shorthands\n * or max array length checks.\n *\n * @private\n * @param {number} n The number of times to invoke `iteratee`.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the array of results.\n */\nfunction baseTimes(n, iteratee) {\n var index = -1,\n result = Array(n);\n\n while (++index < n) {\n result[index] = iteratee(index);\n }\n return result;\n}\n\nmodule.exports = baseTimes;\n","/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return value != null && typeof value == 'object';\n}\n\nmodule.exports = isObjectLike;\n","var baseGetTag = require('./_baseGetTag'),\n isObjectLike = require('./isObjectLike');\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]';\n\n/**\n * The base implementation of `_.isArguments`.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n */\nfunction baseIsArguments(value) {\n return isObjectLike(value) && baseGetTag(value) == argsTag;\n}\n\nmodule.exports = baseIsArguments;\n","var baseIsArguments = require('./_baseIsArguments'),\n isObjectLike = require('./isObjectLike');\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/** Built-in value references. */\nvar propertyIsEnumerable = objectProto.propertyIsEnumerable;\n\n/**\n * Checks if `value` is likely an `arguments` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n * else `false`.\n * @example\n *\n * _.isArguments(function() { return arguments; }());\n * // => true\n *\n * _.isArguments([1, 2, 3]);\n * // => false\n */\nvar isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {\n return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&\n !propertyIsEnumerable.call(value, 'callee');\n};\n\nmodule.exports = isArguments;\n","/**\n * Checks if `value` is classified as an `Array` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array, else `false`.\n * @example\n *\n * _.isArray([1, 2, 3]);\n * // => true\n *\n * _.isArray(document.body.children);\n * // => false\n *\n * _.isArray('abc');\n * // => false\n *\n * _.isArray(_.noop);\n * // => false\n */\nvar isArray = Array.isArray;\n\nmodule.exports = isArray;\n","/**\n * This method returns `false`.\n *\n * @static\n * @memberOf _\n * @since 4.13.0\n * @category Util\n * @returns {boolean} Returns `false`.\n * @example\n *\n * _.times(2, _.stubFalse);\n * // => [false, false]\n */\nfunction stubFalse() {\n return false;\n}\n\nmodule.exports = stubFalse;\n","var root = require('./_root'),\n stubFalse = require('./stubFalse');\n\n/** Detect free variable `exports`. */\nvar freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;\n\n/** Detect free variable `module`. */\nvar freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;\n\n/** Detect the popular CommonJS extension `module.exports`. */\nvar moduleExports = freeModule && freeModule.exports === freeExports;\n\n/** Built-in value references. */\nvar Buffer = moduleExports ? root.Buffer : undefined;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;\n\n/**\n * Checks if `value` is a buffer.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.\n * @example\n *\n * _.isBuffer(new Buffer(2));\n * // => true\n *\n * _.isBuffer(new Uint8Array(2));\n * // => false\n */\nvar isBuffer = nativeIsBuffer || stubFalse;\n\nmodule.exports = isBuffer;\n","/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/** Used to detect unsigned integer values. */\nvar reIsUint = /^(?:0|[1-9]\\d*)$/;\n\n/**\n * Checks if `value` is a valid array-like index.\n *\n * @private\n * @param {*} value The value to check.\n * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.\n * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.\n */\nfunction isIndex(value, length) {\n length = length == null ? MAX_SAFE_INTEGER : length;\n return !!length &&\n (typeof value == 'number' || reIsUint.test(value)) &&\n (value > -1 && value % 1 == 0 && value < length);\n}\n\nmodule.exports = isIndex;\n","/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/**\n * Checks if `value` is a valid array-like length.\n *\n * **Note:** This method is loosely based on\n * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n * @example\n *\n * _.isLength(3);\n * // => true\n *\n * _.isLength(Number.MIN_VALUE);\n * // => false\n *\n * _.isLength(Infinity);\n * // => false\n *\n * _.isLength('3');\n * // => false\n */\nfunction isLength(value) {\n return typeof value == 'number' &&\n value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n}\n\nmodule.exports = isLength;\n","var baseGetTag = require('./_baseGetTag'),\n isLength = require('./isLength'),\n isObjectLike = require('./isObjectLike');\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]',\n arrayTag = '[object Array]',\n boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n errorTag = '[object Error]',\n funcTag = '[object Function]',\n mapTag = '[object Map]',\n numberTag = '[object Number]',\n objectTag = '[object Object]',\n regexpTag = '[object RegExp]',\n setTag = '[object Set]',\n stringTag = '[object String]',\n weakMapTag = '[object WeakMap]';\n\nvar arrayBufferTag = '[object ArrayBuffer]',\n dataViewTag = '[object DataView]',\n float32Tag = '[object Float32Array]',\n float64Tag = '[object Float64Array]',\n int8Tag = '[object Int8Array]',\n int16Tag = '[object Int16Array]',\n int32Tag = '[object Int32Array]',\n uint8Tag = '[object Uint8Array]',\n uint8ClampedTag = '[object Uint8ClampedArray]',\n uint16Tag = '[object Uint16Array]',\n uint32Tag = '[object Uint32Array]';\n\n/** Used to identify `toStringTag` values of typed arrays. */\nvar typedArrayTags = {};\ntypedArrayTags[float32Tag] = typedArrayTags[float64Tag] =\ntypedArrayTags[int8Tag] = typedArrayTags[int16Tag] =\ntypedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =\ntypedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =\ntypedArrayTags[uint32Tag] = true;\ntypedArrayTags[argsTag] = typedArrayTags[arrayTag] =\ntypedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =\ntypedArrayTags[dataViewTag] = typedArrayTags[dateTag] =\ntypedArrayTags[errorTag] = typedArrayTags[funcTag] =\ntypedArrayTags[mapTag] = typedArrayTags[numberTag] =\ntypedArrayTags[objectTag] = typedArrayTags[regexpTag] =\ntypedArrayTags[setTag] = typedArrayTags[stringTag] =\ntypedArrayTags[weakMapTag] = false;\n\n/**\n * The base implementation of `_.isTypedArray` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.\n */\nfunction baseIsTypedArray(value) {\n return isObjectLike(value) &&\n isLength(value.length) && !!typedArrayTags[baseGetTag(value)];\n}\n\nmodule.exports = baseIsTypedArray;\n","/**\n * The base implementation of `_.unary` without support for storing metadata.\n *\n * @private\n * @param {Function} func The function to cap arguments for.\n * @returns {Function} Returns the new capped function.\n */\nfunction baseUnary(func) {\n return function(value) {\n return func(value);\n };\n}\n\nmodule.exports = baseUnary;\n","var freeGlobal = require('./_freeGlobal');\n\n/** Detect free variable `exports`. */\nvar freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;\n\n/** Detect free variable `module`. */\nvar freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;\n\n/** Detect the popular CommonJS extension `module.exports`. */\nvar moduleExports = freeModule && freeModule.exports === freeExports;\n\n/** Detect free variable `process` from Node.js. */\nvar freeProcess = moduleExports && freeGlobal.process;\n\n/** Used to access faster Node.js helpers. */\nvar nodeUtil = (function() {\n try {\n return freeProcess && freeProcess.binding && freeProcess.binding('util');\n } catch (e) {}\n}());\n\nmodule.exports = nodeUtil;\n","var baseIsTypedArray = require('./_baseIsTypedArray'),\n baseUnary = require('./_baseUnary'),\n nodeUtil = require('./_nodeUtil');\n\n/* Node.js helper references. */\nvar nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;\n\n/**\n * Checks if `value` is classified as a typed array.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.\n * @example\n *\n * _.isTypedArray(new Uint8Array);\n * // => true\n *\n * _.isTypedArray([]);\n * // => false\n */\nvar isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;\n\nmodule.exports = isTypedArray;\n","var baseTimes = require('./_baseTimes'),\n isArguments = require('./isArguments'),\n isArray = require('./isArray'),\n isBuffer = require('./isBuffer'),\n isIndex = require('./_isIndex'),\n isTypedArray = require('./isTypedArray');\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Creates an array of the enumerable property names of the array-like `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @param {boolean} inherited Specify returning inherited property names.\n * @returns {Array} Returns the array of property names.\n */\nfunction arrayLikeKeys(value, inherited) {\n var isArr = isArray(value),\n isArg = !isArr && isArguments(value),\n isBuff = !isArr && !isArg && isBuffer(value),\n isType = !isArr && !isArg && !isBuff && isTypedArray(value),\n skipIndexes = isArr || isArg || isBuff || isType,\n result = skipIndexes ? baseTimes(value.length, String) : [],\n length = result.length;\n\n for (var key in value) {\n if ((inherited || hasOwnProperty.call(value, key)) &&\n !(skipIndexes && (\n // Safari 9 has enumerable `arguments.length` in strict mode.\n key == 'length' ||\n // Node.js 0.10 has enumerable non-index properties on buffers.\n (isBuff && (key == 'offset' || key == 'parent')) ||\n // PhantomJS 2 has enumerable non-index properties on typed arrays.\n (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||\n // Skip index properties.\n isIndex(key, length)\n ))) {\n result.push(key);\n }\n }\n return result;\n}\n\nmodule.exports = arrayLikeKeys;\n","/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Checks if `value` is likely a prototype object.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.\n */\nfunction isPrototype(value) {\n var Ctor = value && value.constructor,\n proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;\n\n return value === proto;\n}\n\nmodule.exports = isPrototype;\n","/**\n * Creates a unary function that invokes `func` with its argument transformed.\n *\n * @private\n * @param {Function} func The function to wrap.\n * @param {Function} transform The argument transform.\n * @returns {Function} Returns the new function.\n */\nfunction overArg(func, transform) {\n return function(arg) {\n return func(transform(arg));\n };\n}\n\nmodule.exports = overArg;\n","var overArg = require('./_overArg');\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeKeys = overArg(Object.keys, Object);\n\nmodule.exports = nativeKeys;\n","var isPrototype = require('./_isPrototype'),\n nativeKeys = require('./_nativeKeys');\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction baseKeys(object) {\n if (!isPrototype(object)) {\n return nativeKeys(object);\n }\n var result = [];\n for (var key in Object(object)) {\n if (hasOwnProperty.call(object, key) && key != 'constructor') {\n result.push(key);\n }\n }\n return result;\n}\n\nmodule.exports = baseKeys;\n","var isFunction = require('./isFunction'),\n isLength = require('./isLength');\n\n/**\n * Checks if `value` is array-like. A value is considered array-like if it's\n * not a function and has a `value.length` that's an integer greater than or\n * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n * @example\n *\n * _.isArrayLike([1, 2, 3]);\n * // => true\n *\n * _.isArrayLike(document.body.children);\n * // => true\n *\n * _.isArrayLike('abc');\n * // => true\n *\n * _.isArrayLike(_.noop);\n * // => false\n */\nfunction isArrayLike(value) {\n return value != null && isLength(value.length) && !isFunction(value);\n}\n\nmodule.exports = isArrayLike;\n","var arrayLikeKeys = require('./_arrayLikeKeys'),\n baseKeys = require('./_baseKeys'),\n isArrayLike = require('./isArrayLike');\n\n/**\n * Creates an array of the own enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects. See the\n * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)\n * for more details.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keys(new Foo);\n * // => ['a', 'b'] (iteration order is not guaranteed)\n *\n * _.keys('hi');\n * // => ['0', '1']\n */\nfunction keys(object) {\n return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);\n}\n\nmodule.exports = keys;\n","var copyObject = require('./_copyObject'),\n keys = require('./keys');\n\n/**\n * The base implementation of `_.assign` without support for multiple sources\n * or `customizer` functions.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @returns {Object} Returns `object`.\n */\nfunction baseAssign(object, source) {\n return object && copyObject(source, keys(source), object);\n}\n\nmodule.exports = baseAssign;\n","/**\n * This function is like\n * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)\n * except that it includes inherited enumerable properties.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction nativeKeysIn(object) {\n var result = [];\n if (object != null) {\n for (var key in Object(object)) {\n result.push(key);\n }\n }\n return result;\n}\n\nmodule.exports = nativeKeysIn;\n","var isObject = require('./isObject'),\n isPrototype = require('./_isPrototype'),\n nativeKeysIn = require('./_nativeKeysIn');\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction baseKeysIn(object) {\n if (!isObject(object)) {\n return nativeKeysIn(object);\n }\n var isProto = isPrototype(object),\n result = [];\n\n for (var key in object) {\n if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {\n result.push(key);\n }\n }\n return result;\n}\n\nmodule.exports = baseKeysIn;\n","var arrayLikeKeys = require('./_arrayLikeKeys'),\n baseKeysIn = require('./_baseKeysIn'),\n isArrayLike = require('./isArrayLike');\n\n/**\n * Creates an array of the own and inherited enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keysIn(new Foo);\n * // => ['a', 'b', 'c'] (iteration order is not guaranteed)\n */\nfunction keysIn(object) {\n return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);\n}\n\nmodule.exports = keysIn;\n","var copyObject = require('./_copyObject'),\n keysIn = require('./keysIn');\n\n/**\n * The base implementation of `_.assignIn` without support for multiple sources\n * or `customizer` functions.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @returns {Object} Returns `object`.\n */\nfunction baseAssignIn(object, source) {\n return object && copyObject(source, keysIn(source), object);\n}\n\nmodule.exports = baseAssignIn;\n","var root = require('./_root');\n\n/** Detect free variable `exports`. */\nvar freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;\n\n/** Detect free variable `module`. */\nvar freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;\n\n/** Detect the popular CommonJS extension `module.exports`. */\nvar moduleExports = freeModule && freeModule.exports === freeExports;\n\n/** Built-in value references. */\nvar Buffer = moduleExports ? root.Buffer : undefined,\n allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined;\n\n/**\n * Creates a clone of `buffer`.\n *\n * @private\n * @param {Buffer} buffer The buffer to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Buffer} Returns the cloned buffer.\n */\nfunction cloneBuffer(buffer, isDeep) {\n if (isDeep) {\n return buffer.slice();\n }\n var length = buffer.length,\n result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);\n\n buffer.copy(result);\n return result;\n}\n\nmodule.exports = cloneBuffer;\n","/**\n * Copies the values of `source` to `array`.\n *\n * @private\n * @param {Array} source The array to copy values from.\n * @param {Array} [array=[]] The array to copy values to.\n * @returns {Array} Returns `array`.\n */\nfunction copyArray(source, array) {\n var index = -1,\n length = source.length;\n\n array || (array = Array(length));\n while (++index < length) {\n array[index] = source[index];\n }\n return array;\n}\n\nmodule.exports = copyArray;\n","/**\n * A specialized version of `_.filter` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {Array} Returns the new filtered array.\n */\nfunction arrayFilter(array, predicate) {\n var index = -1,\n length = array == null ? 0 : array.length,\n resIndex = 0,\n result = [];\n\n while (++index < length) {\n var value = array[index];\n if (predicate(value, index, array)) {\n result[resIndex++] = value;\n }\n }\n return result;\n}\n\nmodule.exports = arrayFilter;\n","/**\n * This method returns a new empty array.\n *\n * @static\n * @memberOf _\n * @since 4.13.0\n * @category Util\n * @returns {Array} Returns the new empty array.\n * @example\n *\n * var arrays = _.times(2, _.stubArray);\n *\n * console.log(arrays);\n * // => [[], []]\n *\n * console.log(arrays[0] === arrays[1]);\n * // => false\n */\nfunction stubArray() {\n return [];\n}\n\nmodule.exports = stubArray;\n","var arrayFilter = require('./_arrayFilter'),\n stubArray = require('./stubArray');\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Built-in value references. */\nvar propertyIsEnumerable = objectProto.propertyIsEnumerable;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeGetSymbols = Object.getOwnPropertySymbols;\n\n/**\n * Creates an array of the own enumerable symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of symbols.\n */\nvar getSymbols = !nativeGetSymbols ? stubArray : function(object) {\n if (object == null) {\n return [];\n }\n object = Object(object);\n return arrayFilter(nativeGetSymbols(object), function(symbol) {\n return propertyIsEnumerable.call(object, symbol);\n });\n};\n\nmodule.exports = getSymbols;\n","var copyObject = require('./_copyObject'),\n getSymbols = require('./_getSymbols');\n\n/**\n * Copies own symbols of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy symbols from.\n * @param {Object} [object={}] The object to copy symbols to.\n * @returns {Object} Returns `object`.\n */\nfunction copySymbols(source, object) {\n return copyObject(source, getSymbols(source), object);\n}\n\nmodule.exports = copySymbols;\n","/**\n * Appends the elements of `values` to `array`.\n *\n * @private\n * @param {Array} array The array to modify.\n * @param {Array} values The values to append.\n * @returns {Array} Returns `array`.\n */\nfunction arrayPush(array, values) {\n var index = -1,\n length = values.length,\n offset = array.length;\n\n while (++index < length) {\n array[offset + index] = values[index];\n }\n return array;\n}\n\nmodule.exports = arrayPush;\n","var overArg = require('./_overArg');\n\n/** Built-in value references. */\nvar getPrototype = overArg(Object.getPrototypeOf, Object);\n\nmodule.exports = getPrototype;\n","var arrayPush = require('./_arrayPush'),\n getPrototype = require('./_getPrototype'),\n getSymbols = require('./_getSymbols'),\n stubArray = require('./stubArray');\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeGetSymbols = Object.getOwnPropertySymbols;\n\n/**\n * Creates an array of the own and inherited enumerable symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of symbols.\n */\nvar getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {\n var result = [];\n while (object) {\n arrayPush(result, getSymbols(object));\n object = getPrototype(object);\n }\n return result;\n};\n\nmodule.exports = getSymbolsIn;\n","var copyObject = require('./_copyObject'),\n getSymbolsIn = require('./_getSymbolsIn');\n\n/**\n * Copies own and inherited symbols of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy symbols from.\n * @param {Object} [object={}] The object to copy symbols to.\n * @returns {Object} Returns `object`.\n */\nfunction copySymbolsIn(source, object) {\n return copyObject(source, getSymbolsIn(source), object);\n}\n\nmodule.exports = copySymbolsIn;\n","var arrayPush = require('./_arrayPush'),\n isArray = require('./isArray');\n\n/**\n * The base implementation of `getAllKeys` and `getAllKeysIn` which uses\n * `keysFunc` and `symbolsFunc` to get the enumerable property names and\n * symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Function} keysFunc The function to get the keys of `object`.\n * @param {Function} symbolsFunc The function to get the symbols of `object`.\n * @returns {Array} Returns the array of property names and symbols.\n */\nfunction baseGetAllKeys(object, keysFunc, symbolsFunc) {\n var result = keysFunc(object);\n return isArray(object) ? result : arrayPush(result, symbolsFunc(object));\n}\n\nmodule.exports = baseGetAllKeys;\n","var baseGetAllKeys = require('./_baseGetAllKeys'),\n getSymbols = require('./_getSymbols'),\n keys = require('./keys');\n\n/**\n * Creates an array of own enumerable property names and symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names and symbols.\n */\nfunction getAllKeys(object) {\n return baseGetAllKeys(object, keys, getSymbols);\n}\n\nmodule.exports = getAllKeys;\n","var baseGetAllKeys = require('./_baseGetAllKeys'),\n getSymbolsIn = require('./_getSymbolsIn'),\n keysIn = require('./keysIn');\n\n/**\n * Creates an array of own and inherited enumerable property names and\n * symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names and symbols.\n */\nfunction getAllKeysIn(object) {\n return baseGetAllKeys(object, keysIn, getSymbolsIn);\n}\n\nmodule.exports = getAllKeysIn;\n","var getNative = require('./_getNative'),\n root = require('./_root');\n\n/* Built-in method references that are verified to be native. */\nvar DataView = getNative(root, 'DataView');\n\nmodule.exports = DataView;\n","var getNative = require('./_getNative'),\n root = require('./_root');\n\n/* Built-in method references that are verified to be native. */\nvar Promise = getNative(root, 'Promise');\n\nmodule.exports = Promise;\n","var getNative = require('./_getNative'),\n root = require('./_root');\n\n/* Built-in method references that are verified to be native. */\nvar Set = getNative(root, 'Set');\n\nmodule.exports = Set;\n","var getNative = require('./_getNative'),\n root = require('./_root');\n\n/* Built-in method references that are verified to be native. */\nvar WeakMap = getNative(root, 'WeakMap');\n\nmodule.exports = WeakMap;\n","var DataView = require('./_DataView'),\n Map = require('./_Map'),\n Promise = require('./_Promise'),\n Set = require('./_Set'),\n WeakMap = require('./_WeakMap'),\n baseGetTag = require('./_baseGetTag'),\n toSource = require('./_toSource');\n\n/** `Object#toString` result references. */\nvar mapTag = '[object Map]',\n objectTag = '[object Object]',\n promiseTag = '[object Promise]',\n setTag = '[object Set]',\n weakMapTag = '[object WeakMap]';\n\nvar dataViewTag = '[object DataView]';\n\n/** Used to detect maps, sets, and weakmaps. */\nvar dataViewCtorString = toSource(DataView),\n mapCtorString = toSource(Map),\n promiseCtorString = toSource(Promise),\n setCtorString = toSource(Set),\n weakMapCtorString = toSource(WeakMap);\n\n/**\n * Gets the `toStringTag` of `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nvar getTag = baseGetTag;\n\n// Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.\nif ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||\n (Map && getTag(new Map) != mapTag) ||\n (Promise && getTag(Promise.resolve()) != promiseTag) ||\n (Set && getTag(new Set) != setTag) ||\n (WeakMap && getTag(new WeakMap) != weakMapTag)) {\n getTag = function(value) {\n var result = baseGetTag(value),\n Ctor = result == objectTag ? value.constructor : undefined,\n ctorString = Ctor ? toSource(Ctor) : '';\n\n if (ctorString) {\n switch (ctorString) {\n case dataViewCtorString: return dataViewTag;\n case mapCtorString: return mapTag;\n case promiseCtorString: return promiseTag;\n case setCtorString: return setTag;\n case weakMapCtorString: return weakMapTag;\n }\n }\n return result;\n };\n}\n\nmodule.exports = getTag;\n","/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Initializes an array clone.\n *\n * @private\n * @param {Array} array The array to clone.\n * @returns {Array} Returns the initialized clone.\n */\nfunction initCloneArray(array) {\n var length = array.length,\n result = array.constructor(length);\n\n // Add properties assigned by `RegExp#exec`.\n if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {\n result.index = array.index;\n result.input = array.input;\n }\n return result;\n}\n\nmodule.exports = initCloneArray;\n","var root = require('./_root');\n\n/** Built-in value references. */\nvar Uint8Array = root.Uint8Array;\n\nmodule.exports = Uint8Array;\n","var Uint8Array = require('./_Uint8Array');\n\n/**\n * Creates a clone of `arrayBuffer`.\n *\n * @private\n * @param {ArrayBuffer} arrayBuffer The array buffer to clone.\n * @returns {ArrayBuffer} Returns the cloned array buffer.\n */\nfunction cloneArrayBuffer(arrayBuffer) {\n var result = new arrayBuffer.constructor(arrayBuffer.byteLength);\n new Uint8Array(result).set(new Uint8Array(arrayBuffer));\n return result;\n}\n\nmodule.exports = cloneArrayBuffer;\n","var cloneArrayBuffer = require('./_cloneArrayBuffer');\n\n/**\n * Creates a clone of `dataView`.\n *\n * @private\n * @param {Object} dataView The data view to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the cloned data view.\n */\nfunction cloneDataView(dataView, isDeep) {\n var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;\n return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);\n}\n\nmodule.exports = cloneDataView;\n","/**\n * Adds the key-value `pair` to `map`.\n *\n * @private\n * @param {Object} map The map to modify.\n * @param {Array} pair The key-value pair to add.\n * @returns {Object} Returns `map`.\n */\nfunction addMapEntry(map, pair) {\n // Don't return `map.set` because it's not chainable in IE 11.\n map.set(pair[0], pair[1]);\n return map;\n}\n\nmodule.exports = addMapEntry;\n","/**\n * A specialized version of `_.reduce` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {*} [accumulator] The initial value.\n * @param {boolean} [initAccum] Specify using the first element of `array` as\n * the initial value.\n * @returns {*} Returns the accumulated value.\n */\nfunction arrayReduce(array, iteratee, accumulator, initAccum) {\n var index = -1,\n length = array == null ? 0 : array.length;\n\n if (initAccum && length) {\n accumulator = array[++index];\n }\n while (++index < length) {\n accumulator = iteratee(accumulator, array[index], index, array);\n }\n return accumulator;\n}\n\nmodule.exports = arrayReduce;\n","/**\n * Converts `map` to its key-value pairs.\n *\n * @private\n * @param {Object} map The map to convert.\n * @returns {Array} Returns the key-value pairs.\n */\nfunction mapToArray(map) {\n var index = -1,\n result = Array(map.size);\n\n map.forEach(function(value, key) {\n result[++index] = [key, value];\n });\n return result;\n}\n\nmodule.exports = mapToArray;\n","var addMapEntry = require('./_addMapEntry'),\n arrayReduce = require('./_arrayReduce'),\n mapToArray = require('./_mapToArray');\n\n/** Used to compose bitmasks for cloning. */\nvar CLONE_DEEP_FLAG = 1;\n\n/**\n * Creates a clone of `map`.\n *\n * @private\n * @param {Object} map The map to clone.\n * @param {Function} cloneFunc The function to clone values.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the cloned map.\n */\nfunction cloneMap(map, isDeep, cloneFunc) {\n var array = isDeep ? cloneFunc(mapToArray(map), CLONE_DEEP_FLAG) : mapToArray(map);\n return arrayReduce(array, addMapEntry, new map.constructor);\n}\n\nmodule.exports = cloneMap;\n","/** Used to match `RegExp` flags from their coerced string values. */\nvar reFlags = /\\w*$/;\n\n/**\n * Creates a clone of `regexp`.\n *\n * @private\n * @param {Object} regexp The regexp to clone.\n * @returns {Object} Returns the cloned regexp.\n */\nfunction cloneRegExp(regexp) {\n var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));\n result.lastIndex = regexp.lastIndex;\n return result;\n}\n\nmodule.exports = cloneRegExp;\n","/**\n * Adds `value` to `set`.\n *\n * @private\n * @param {Object} set The set to modify.\n * @param {*} value The value to add.\n * @returns {Object} Returns `set`.\n */\nfunction addSetEntry(set, value) {\n // Don't return `set.add` because it's not chainable in IE 11.\n set.add(value);\n return set;\n}\n\nmodule.exports = addSetEntry;\n","/**\n * Converts `set` to an array of its values.\n *\n * @private\n * @param {Object} set The set to convert.\n * @returns {Array} Returns the values.\n */\nfunction setToArray(set) {\n var index = -1,\n result = Array(set.size);\n\n set.forEach(function(value) {\n result[++index] = value;\n });\n return result;\n}\n\nmodule.exports = setToArray;\n","var addSetEntry = require('./_addSetEntry'),\n arrayReduce = require('./_arrayReduce'),\n setToArray = require('./_setToArray');\n\n/** Used to compose bitmasks for cloning. */\nvar CLONE_DEEP_FLAG = 1;\n\n/**\n * Creates a clone of `set`.\n *\n * @private\n * @param {Object} set The set to clone.\n * @param {Function} cloneFunc The function to clone values.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the cloned set.\n */\nfunction cloneSet(set, isDeep, cloneFunc) {\n var array = isDeep ? cloneFunc(setToArray(set), CLONE_DEEP_FLAG) : setToArray(set);\n return arrayReduce(array, addSetEntry, new set.constructor);\n}\n\nmodule.exports = cloneSet;\n","var Symbol = require('./_Symbol');\n\n/** Used to convert symbols to primitives and strings. */\nvar symbolProto = Symbol ? Symbol.prototype : undefined,\n symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;\n\n/**\n * Creates a clone of the `symbol` object.\n *\n * @private\n * @param {Object} symbol The symbol object to clone.\n * @returns {Object} Returns the cloned symbol object.\n */\nfunction cloneSymbol(symbol) {\n return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};\n}\n\nmodule.exports = cloneSymbol;\n","var cloneArrayBuffer = require('./_cloneArrayBuffer');\n\n/**\n * Creates a clone of `typedArray`.\n *\n * @private\n * @param {Object} typedArray The typed array to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the cloned typed array.\n */\nfunction cloneTypedArray(typedArray, isDeep) {\n var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;\n return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);\n}\n\nmodule.exports = cloneTypedArray;\n","var cloneArrayBuffer = require('./_cloneArrayBuffer'),\n cloneDataView = require('./_cloneDataView'),\n cloneMap = require('./_cloneMap'),\n cloneRegExp = require('./_cloneRegExp'),\n cloneSet = require('./_cloneSet'),\n cloneSymbol = require('./_cloneSymbol'),\n cloneTypedArray = require('./_cloneTypedArray');\n\n/** `Object#toString` result references. */\nvar boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n mapTag = '[object Map]',\n numberTag = '[object Number]',\n regexpTag = '[object RegExp]',\n setTag = '[object Set]',\n stringTag = '[object String]',\n symbolTag = '[object Symbol]';\n\nvar arrayBufferTag = '[object ArrayBuffer]',\n dataViewTag = '[object DataView]',\n float32Tag = '[object Float32Array]',\n float64Tag = '[object Float64Array]',\n int8Tag = '[object Int8Array]',\n int16Tag = '[object Int16Array]',\n int32Tag = '[object Int32Array]',\n uint8Tag = '[object Uint8Array]',\n uint8ClampedTag = '[object Uint8ClampedArray]',\n uint16Tag = '[object Uint16Array]',\n uint32Tag = '[object Uint32Array]';\n\n/**\n * Initializes an object clone based on its `toStringTag`.\n *\n * **Note:** This function only supports cloning values with tags of\n * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.\n *\n * @private\n * @param {Object} object The object to clone.\n * @param {string} tag The `toStringTag` of the object to clone.\n * @param {Function} cloneFunc The function to clone values.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the initialized clone.\n */\nfunction initCloneByTag(object, tag, cloneFunc, isDeep) {\n var Ctor = object.constructor;\n switch (tag) {\n case arrayBufferTag:\n return cloneArrayBuffer(object);\n\n case boolTag:\n case dateTag:\n return new Ctor(+object);\n\n case dataViewTag:\n return cloneDataView(object, isDeep);\n\n case float32Tag: case float64Tag:\n case int8Tag: case int16Tag: case int32Tag:\n case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:\n return cloneTypedArray(object, isDeep);\n\n case mapTag:\n return cloneMap(object, isDeep, cloneFunc);\n\n case numberTag:\n case stringTag:\n return new Ctor(object);\n\n case regexpTag:\n return cloneRegExp(object);\n\n case setTag:\n return cloneSet(object, isDeep, cloneFunc);\n\n case symbolTag:\n return cloneSymbol(object);\n }\n}\n\nmodule.exports = initCloneByTag;\n","var isObject = require('./isObject');\n\n/** Built-in value references. */\nvar objectCreate = Object.create;\n\n/**\n * The base implementation of `_.create` without support for assigning\n * properties to the created object.\n *\n * @private\n * @param {Object} proto The object to inherit from.\n * @returns {Object} Returns the new object.\n */\nvar baseCreate = (function() {\n function object() {}\n return function(proto) {\n if (!isObject(proto)) {\n return {};\n }\n if (objectCreate) {\n return objectCreate(proto);\n }\n object.prototype = proto;\n var result = new object;\n object.prototype = undefined;\n return result;\n };\n}());\n\nmodule.exports = baseCreate;\n","var baseCreate = require('./_baseCreate'),\n getPrototype = require('./_getPrototype'),\n isPrototype = require('./_isPrototype');\n\n/**\n * Initializes an object clone.\n *\n * @private\n * @param {Object} object The object to clone.\n * @returns {Object} Returns the initialized clone.\n */\nfunction initCloneObject(object) {\n return (typeof object.constructor == 'function' && !isPrototype(object))\n ? baseCreate(getPrototype(object))\n : {};\n}\n\nmodule.exports = initCloneObject;\n","var Stack = require('./_Stack'),\n arrayEach = require('./_arrayEach'),\n assignValue = require('./_assignValue'),\n baseAssign = require('./_baseAssign'),\n baseAssignIn = require('./_baseAssignIn'),\n cloneBuffer = require('./_cloneBuffer'),\n copyArray = require('./_copyArray'),\n copySymbols = require('./_copySymbols'),\n copySymbolsIn = require('./_copySymbolsIn'),\n getAllKeys = require('./_getAllKeys'),\n getAllKeysIn = require('./_getAllKeysIn'),\n getTag = require('./_getTag'),\n initCloneArray = require('./_initCloneArray'),\n initCloneByTag = require('./_initCloneByTag'),\n initCloneObject = require('./_initCloneObject'),\n isArray = require('./isArray'),\n isBuffer = require('./isBuffer'),\n isObject = require('./isObject'),\n keys = require('./keys');\n\n/** Used to compose bitmasks for cloning. */\nvar CLONE_DEEP_FLAG = 1,\n CLONE_FLAT_FLAG = 2,\n CLONE_SYMBOLS_FLAG = 4;\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]',\n arrayTag = '[object Array]',\n boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n errorTag = '[object Error]',\n funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]',\n mapTag = '[object Map]',\n numberTag = '[object Number]',\n objectTag = '[object Object]',\n regexpTag = '[object RegExp]',\n setTag = '[object Set]',\n stringTag = '[object String]',\n symbolTag = '[object Symbol]',\n weakMapTag = '[object WeakMap]';\n\nvar arrayBufferTag = '[object ArrayBuffer]',\n dataViewTag = '[object DataView]',\n float32Tag = '[object Float32Array]',\n float64Tag = '[object Float64Array]',\n int8Tag = '[object Int8Array]',\n int16Tag = '[object Int16Array]',\n int32Tag = '[object Int32Array]',\n uint8Tag = '[object Uint8Array]',\n uint8ClampedTag = '[object Uint8ClampedArray]',\n uint16Tag = '[object Uint16Array]',\n uint32Tag = '[object Uint32Array]';\n\n/** Used to identify `toStringTag` values supported by `_.clone`. */\nvar cloneableTags = {};\ncloneableTags[argsTag] = cloneableTags[arrayTag] =\ncloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =\ncloneableTags[boolTag] = cloneableTags[dateTag] =\ncloneableTags[float32Tag] = cloneableTags[float64Tag] =\ncloneableTags[int8Tag] = cloneableTags[int16Tag] =\ncloneableTags[int32Tag] = cloneableTags[mapTag] =\ncloneableTags[numberTag] = cloneableTags[objectTag] =\ncloneableTags[regexpTag] = cloneableTags[setTag] =\ncloneableTags[stringTag] = cloneableTags[symbolTag] =\ncloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =\ncloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;\ncloneableTags[errorTag] = cloneableTags[funcTag] =\ncloneableTags[weakMapTag] = false;\n\n/**\n * The base implementation of `_.clone` and `_.cloneDeep` which tracks\n * traversed objects.\n *\n * @private\n * @param {*} value The value to clone.\n * @param {boolean} bitmask The bitmask flags.\n * 1 - Deep clone\n * 2 - Flatten inherited properties\n * 4 - Clone symbols\n * @param {Function} [customizer] The function to customize cloning.\n * @param {string} [key] The key of `value`.\n * @param {Object} [object] The parent object of `value`.\n * @param {Object} [stack] Tracks traversed objects and their clone counterparts.\n * @returns {*} Returns the cloned value.\n */\nfunction baseClone(value, bitmask, customizer, key, object, stack) {\n var result,\n isDeep = bitmask & CLONE_DEEP_FLAG,\n isFlat = bitmask & CLONE_FLAT_FLAG,\n isFull = bitmask & CLONE_SYMBOLS_FLAG;\n\n if (customizer) {\n result = object ? customizer(value, key, object, stack) : customizer(value);\n }\n if (result !== undefined) {\n return result;\n }\n if (!isObject(value)) {\n return value;\n }\n var isArr = isArray(value);\n if (isArr) {\n result = initCloneArray(value);\n if (!isDeep) {\n return copyArray(value, result);\n }\n } else {\n var tag = getTag(value),\n isFunc = tag == funcTag || tag == genTag;\n\n if (isBuffer(value)) {\n return cloneBuffer(value, isDeep);\n }\n if (tag == objectTag || tag == argsTag || (isFunc && !object)) {\n result = (isFlat || isFunc) ? {} : initCloneObject(value);\n if (!isDeep) {\n return isFlat\n ? copySymbolsIn(value, baseAssignIn(result, value))\n : copySymbols(value, baseAssign(result, value));\n }\n } else {\n if (!cloneableTags[tag]) {\n return object ? value : {};\n }\n result = initCloneByTag(value, tag, baseClone, isDeep);\n }\n }\n // Check for circular references and return its corresponding clone.\n stack || (stack = new Stack);\n var stacked = stack.get(value);\n if (stacked) {\n return stacked;\n }\n stack.set(value, result);\n\n var keysFunc = isFull\n ? (isFlat ? getAllKeysIn : getAllKeys)\n : (isFlat ? keysIn : keys);\n\n var props = isArr ? undefined : keysFunc(value);\n arrayEach(props || value, function(subValue, key) {\n if (props) {\n key = subValue;\n subValue = value[key];\n }\n // Recursively populate clone (susceptible to call stack limits).\n assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));\n });\n return result;\n}\n\nmodule.exports = baseClone;\n","var baseClone = require('./_baseClone');\n\n/** Used to compose bitmasks for cloning. */\nvar CLONE_SYMBOLS_FLAG = 4;\n\n/**\n * Creates a shallow clone of `value`.\n *\n * **Note:** This method is loosely based on the\n * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)\n * and supports cloning arrays, array buffers, booleans, date objects, maps,\n * numbers, `Object` objects, regexes, sets, strings, symbols, and typed\n * arrays. The own enumerable properties of `arguments` objects are cloned\n * as plain objects. An empty object is returned for uncloneable values such\n * as error objects, functions, DOM nodes, and WeakMaps.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to clone.\n * @returns {*} Returns the cloned value.\n * @see _.cloneDeep\n * @example\n *\n * var objects = [{ 'a': 1 }, { 'b': 2 }];\n *\n * var shallow = _.clone(objects);\n * console.log(shallow[0] === objects[0]);\n * // => true\n */\nfunction clone(value) {\n return baseClone(value, CLONE_SYMBOLS_FLAG);\n}\n\nmodule.exports = clone;\n","/**\n * A faster alternative to `Function#apply`, this function invokes `func`\n * with the `this` binding of `thisArg` and the arguments of `args`.\n *\n * @private\n * @param {Function} func The function to invoke.\n * @param {*} thisArg The `this` binding of `func`.\n * @param {Array} args The arguments to invoke `func` with.\n * @returns {*} Returns the result of `func`.\n */\nfunction apply(func, thisArg, args) {\n switch (args.length) {\n case 0: return func.call(thisArg);\n case 1: return func.call(thisArg, args[0]);\n case 2: return func.call(thisArg, args[0], args[1]);\n case 3: return func.call(thisArg, args[0], args[1], args[2]);\n }\n return func.apply(thisArg, args);\n}\n\nmodule.exports = apply;\n","/**\n * This method returns the first argument it receives.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Util\n * @param {*} value Any value.\n * @returns {*} Returns `value`.\n * @example\n *\n * var object = { 'a': 1 };\n *\n * console.log(_.identity(object) === object);\n * // => true\n */\nfunction identity(value) {\n return value;\n}\n\nmodule.exports = identity;\n","var apply = require('./_apply');\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max;\n\n/**\n * A specialized version of `baseRest` which transforms the rest array.\n *\n * @private\n * @param {Function} func The function to apply a rest parameter to.\n * @param {number} [start=func.length-1] The start position of the rest parameter.\n * @param {Function} transform The rest array transform.\n * @returns {Function} Returns the new function.\n */\nfunction overRest(func, start, transform) {\n start = nativeMax(start === undefined ? (func.length - 1) : start, 0);\n return function() {\n var args = arguments,\n index = -1,\n length = nativeMax(args.length - start, 0),\n array = Array(length);\n\n while (++index < length) {\n array[index] = args[start + index];\n }\n index = -1;\n var otherArgs = Array(start + 1);\n while (++index < start) {\n otherArgs[index] = args[index];\n }\n otherArgs[start] = transform(array);\n return apply(func, this, otherArgs);\n };\n}\n\nmodule.exports = overRest;\n","/**\n * Creates a function that returns `value`.\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Util\n * @param {*} value The value to return from the new function.\n * @returns {Function} Returns the new constant function.\n * @example\n *\n * var objects = _.times(2, _.constant({ 'a': 1 }));\n *\n * console.log(objects);\n * // => [{ 'a': 1 }, { 'a': 1 }]\n *\n * console.log(objects[0] === objects[1]);\n * // => true\n */\nfunction constant(value) {\n return function() {\n return value;\n };\n}\n\nmodule.exports = constant;\n","var constant = require('./constant'),\n defineProperty = require('./_defineProperty'),\n identity = require('./identity');\n\n/**\n * The base implementation of `setToString` without support for hot loop shorting.\n *\n * @private\n * @param {Function} func The function to modify.\n * @param {Function} string The `toString` result.\n * @returns {Function} Returns `func`.\n */\nvar baseSetToString = !defineProperty ? identity : function(func, string) {\n return defineProperty(func, 'toString', {\n 'configurable': true,\n 'enumerable': false,\n 'value': constant(string),\n 'writable': true\n });\n};\n\nmodule.exports = baseSetToString;\n","/** Used to detect hot functions by number of calls within a span of milliseconds. */\nvar HOT_COUNT = 800,\n HOT_SPAN = 16;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeNow = Date.now;\n\n/**\n * Creates a function that'll short out and invoke `identity` instead\n * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`\n * milliseconds.\n *\n * @private\n * @param {Function} func The function to restrict.\n * @returns {Function} Returns the new shortable function.\n */\nfunction shortOut(func) {\n var count = 0,\n lastCalled = 0;\n\n return function() {\n var stamp = nativeNow(),\n remaining = HOT_SPAN - (stamp - lastCalled);\n\n lastCalled = stamp;\n if (remaining > 0) {\n if (++count >= HOT_COUNT) {\n return arguments[0];\n }\n } else {\n count = 0;\n }\n return func.apply(undefined, arguments);\n };\n}\n\nmodule.exports = shortOut;\n","var baseSetToString = require('./_baseSetToString'),\n shortOut = require('./_shortOut');\n\n/**\n * Sets the `toString` method of `func` to return `string`.\n *\n * @private\n * @param {Function} func The function to modify.\n * @param {Function} string The `toString` result.\n * @returns {Function} Returns `func`.\n */\nvar setToString = shortOut(baseSetToString);\n\nmodule.exports = setToString;\n","var identity = require('./identity'),\n overRest = require('./_overRest'),\n setToString = require('./_setToString');\n\n/**\n * The base implementation of `_.rest` which doesn't validate or coerce arguments.\n *\n * @private\n * @param {Function} func The function to apply a rest parameter to.\n * @param {number} [start=func.length-1] The start position of the rest parameter.\n * @returns {Function} Returns the new function.\n */\nfunction baseRest(func, start) {\n return setToString(overRest(func, start, identity), func + '');\n}\n\nmodule.exports = baseRest;\n","var eq = require('./eq'),\n isArrayLike = require('./isArrayLike'),\n isIndex = require('./_isIndex'),\n isObject = require('./isObject');\n\n/**\n * Checks if the given arguments are from an iteratee call.\n *\n * @private\n * @param {*} value The potential iteratee value argument.\n * @param {*} index The potential iteratee index or key argument.\n * @param {*} object The potential iteratee object argument.\n * @returns {boolean} Returns `true` if the arguments are from an iteratee call,\n * else `false`.\n */\nfunction isIterateeCall(value, index, object) {\n if (!isObject(object)) {\n return false;\n }\n var type = typeof index;\n if (type == 'number'\n ? (isArrayLike(object) && isIndex(index, object.length))\n : (type == 'string' && index in object)\n ) {\n return eq(object[index], value);\n }\n return false;\n}\n\nmodule.exports = isIterateeCall;\n","var baseRest = require('./_baseRest'),\n isIterateeCall = require('./_isIterateeCall');\n\n/**\n * Creates a function like `_.assign`.\n *\n * @private\n * @param {Function} assigner The function to assign values.\n * @returns {Function} Returns the new assigner function.\n */\nfunction createAssigner(assigner) {\n return baseRest(function(object, sources) {\n var index = -1,\n length = sources.length,\n customizer = length > 1 ? sources[length - 1] : undefined,\n guard = length > 2 ? sources[2] : undefined;\n\n customizer = (assigner.length > 3 && typeof customizer == 'function')\n ? (length--, customizer)\n : undefined;\n\n if (guard && isIterateeCall(sources[0], sources[1], guard)) {\n customizer = length < 3 ? undefined : customizer;\n length = 1;\n }\n object = Object(object);\n while (++index < length) {\n var source = sources[index];\n if (source) {\n assigner(object, source, index, customizer);\n }\n }\n return object;\n });\n}\n\nmodule.exports = createAssigner;\n","var copyObject = require('./_copyObject'),\n createAssigner = require('./_createAssigner'),\n keysIn = require('./keysIn');\n\n/**\n * This method is like `_.assignIn` except that it accepts `customizer`\n * which is invoked to produce the assigned values. If `customizer` returns\n * `undefined`, assignment is handled by the method instead. The `customizer`\n * is invoked with five arguments: (objValue, srcValue, key, object, source).\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @alias extendWith\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} sources The source objects.\n * @param {Function} [customizer] The function to customize assigned values.\n * @returns {Object} Returns `object`.\n * @see _.assignWith\n * @example\n *\n * function customizer(objValue, srcValue) {\n * return _.isUndefined(objValue) ? srcValue : objValue;\n * }\n *\n * var defaults = _.partialRight(_.assignInWith, customizer);\n *\n * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });\n * // => { 'a': 1, 'b': 2 }\n */\nvar assignInWith = createAssigner(function(object, source, srcIndex, customizer) {\n copyObject(source, keysIn(source), object, customizer);\n});\n\nmodule.exports = assignInWith;\n","var eq = require('./eq');\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used by `_.defaults` to customize its `_.assignIn` use to assign properties\n * of source objects to the destination object for all destination properties\n * that resolve to `undefined`.\n *\n * @private\n * @param {*} objValue The destination value.\n * @param {*} srcValue The source value.\n * @param {string} key The key of the property to assign.\n * @param {Object} object The parent object of `objValue`.\n * @returns {*} Returns the value to assign.\n */\nfunction customDefaultsAssignIn(objValue, srcValue, key, object) {\n if (objValue === undefined ||\n (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {\n return srcValue;\n }\n return objValue;\n}\n\nmodule.exports = customDefaultsAssignIn;\n","var apply = require('./_apply'),\n assignInWith = require('./assignInWith'),\n baseRest = require('./_baseRest'),\n customDefaultsAssignIn = require('./_customDefaultsAssignIn');\n\n/**\n * Assigns own and inherited enumerable string keyed properties of source\n * objects to the destination object for all destination properties that\n * resolve to `undefined`. Source objects are applied from left to right.\n * Once a property is set, additional values of the same property are ignored.\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} [sources] The source objects.\n * @returns {Object} Returns `object`.\n * @see _.defaultsDeep\n * @example\n *\n * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });\n * // => { 'a': 1, 'b': 2 }\n */\nvar defaults = baseRest(function(args) {\n args.push(undefined, customDefaultsAssignIn);\n return apply(assignInWith, undefined, args);\n});\n\nmodule.exports = defaults;\n","import clone from 'lodash/clone'\nimport defaults from 'lodash/defaults'\n\nexport default {\n schema: {\n autoStart: {\n type: 'boolean',\n default: true\n },\n loop: {\n type: 'boolean',\n default: true\n },\n wait: {\n type: 'number',\n default: 2000\n },\n move: {\n type: 'number',\n default: 3000\n }\n },\n\n init: function () {\n this._currentWayPoint = -1\n this.el.setAttribute('animation__move', { startEvents: 'doNotFire', pauseEvents: 'pauseTour', resumeEvents:'resumeTour', property: 'position', easing: 'easeInOutSine', dur: 100 })\n this.el.setAttribute('animation__turn', { startEvents: 'doNotFire', pauseEvents: 'pauseTour', resumeEvents:'resumeTour', property: 'rotation', easing: 'easeInOutSine', dur: 100 })\n this._nextWaypointHandler = this._nextWaypoint.bind(this)\n this.el.addEventListener('animation__move-complete', this._nextWaypointHandler)\n },\n\n update: function () {\n this._waypoints = Array.from(this.el.querySelectorAll('[tour-waypoint]'))\n\n if(this.data.autoStart) {\n this.playTour()\n }\n },\n\n playTour: function () {\n if (!this._waypoints || !this._waypoints.length) {\n console.warn('camera tour has no waypoints')\n return\n }\n if (this._isPlaying) {\n if(this._isChangingAnimation) {\n clearTimeout(this._nextAnimationTimeout)\n this.goTo(this._waypoints[this._currentWayPoint].getAttribute('io3d-uuid'), this._isPlaying)\n } else {\n this.el.dispatchEvent(new CustomEvent('resumeTour'))\n }\n this._isPaused = false\n } else {\n this._isPlaying = true\n this._isPaused = false\n var next = this._waypoints[++this._currentWayPoint]\n if (next) this.goTo(next.getAttribute('io3d-uuid'), true)\n else if (this.data.loop) {\n this._currentWayPoint = 0\n this.goTo(this._waypoints[0].getAttribute('io3d-uuid'), true)\n }\n }\n },\n\n pauseTour: function () {\n this._isPaused = true\n this.el.dispatchEvent(new CustomEvent('pauseTour'))\n },\n\n stopTour: function () {\n this.pauseTour()\n this._isPlaying = false\n this._isPaused = false\n },\n\n goTo: function (uuid, keepPlaying) {\n this._isPlaying = !!keepPlaying\n var target = this._waypoints.find(function (item) { return item.getAttribute('io3d-uuid') === uuid })\n if (!target) {\n console.error('The given waypoint ' + uuid + ' does not exist. Available waypoints:', this._waypoints.map(function (elem) { return elem.getAttribute('io3d-uuid') }))\n return\n }\n\n this.animate(target)\n },\n\n // set camera position and rotation by providing changes for certain axes\n // to reset camera to walking mode do:\n // updateViewPoint({position: {y:1.6}, rotation: {x:0})\n updateViewPoint: function (args) {\n args = args || {}\n if (typeof args !== 'object') {\n console.error('not supported camera view point: ' + args)\n return\n }\n var posChange = args.position || {}\n var rotChange = args.rotation || {}\n\n this._isPlaying = false\n // apply changes to current camera position\n var pos = defaults({}, posChange, clone(this.el.getAttribute('position')))\n var rot = defaults({}, rotChange, clone(this.el.getAttribute('rotation')))\n\n var target = {\n position: pos,\n rotation: rot\n }\n this.animate(target)\n },\n\n animate: function (bookmark) {\n var isDomElement = isElement(bookmark)\n var entity = this.el\n var newPosition = isDomElement ? bookmark.getAttribute('position') : bookmark.position\n var newRotation = isDomElement ? bookmark.getAttribute('rotation') : bookmark.rotation\n var startPosition = entity.getAttribute('position')\n var startRotation = entity.getAttribute('rotation')\n\n // normalize start and end rotation and find shortest arc for each rotation\n var normalizedRotations = getNormalizeRotations(startRotation, newRotation)\n newRotation = normalizedRotations.end\n startRotation = normalizedRotations.start\n\n // compute distance to adapt speed\n var d = dist(startPosition, newPosition)\n // compute angle difference to adapt speed\n var angle = Math.abs(startRotation.y - newRotation.y)\n // compute animation time\n // add 1 to the this.data.move parameter to allow users to specify 0 without the animation cancelling out\n var t = Math.round((this.data.move === undefined ? 3000 : this.data.move + 1) / 6 * (d + angle / 30))\n if (t > Math.max(5000, this.data.move)) t = Math.max(5000, this.data.move)\n // prevent zero length animation\n if (!t) return this._nextWaypoint()\n\n entity.components.animation__move.pauseAnimation()\n entity.components.animation__turn.pauseAnimation()\n entity.components.animation__move.data.dur = t\n entity.components.animation__move.data.from = startPosition\n entity.components.animation__move.data.to = newPosition\n entity.components.animation__move.update()\n entity.components.animation__turn.data.dur = t\n entity.components.animation__turn.data.from = startRotation\n entity.components.animation__turn.data.to = newRotation\n entity.components.animation__turn.update()\n entity.components.animation__move.resumeAnimation()\n entity.components.animation__turn.resumeAnimation()\n this._isChangingAnimation = false\n },\n\n _nextWaypoint: function () {\n // FIXME: Find the root cause of the weird jumpy behaviour when using WASD controls\n this.el.setAttribute('position', AFRAME.utils.coordinates.stringify(this.el.getAttribute('position')))\n\n if (!this._isPlaying) return this.stopTour()\n if (this._currentWayPoint === this._waypoints.length - 1) {\n if (!this.data.loop) return\n this._currentWayPoint = -1\n }\n this._isChangingAnimation = true\n var next = this._waypoints[++this._currentWayPoint]\n this._nextAnimationTimeout = setTimeout(function () { this.goTo(next.getAttribute('io3d-uuid'), this._isPlaying) }.bind(this), this.data.wait === undefined ? 0 : this.data.wait)\n }\n}\n\n// we want to prevent excessive spinning in rotations\nfunction getNormalizeRotations(start, end) {\n // normalize both rotations\n var normStart = normalizeRotation(start)\n var normEnd = normalizeRotation(end)\n // find the shortest arc for each rotation\n Object.keys(start).forEach(function(axis) {\n if (normEnd[axis] - normStart[axis] > 180) normEnd[axis] -= 360\n })\n return { start: normStart, end: normEnd }\n}\n\nfunction normalizeRotation(rot) {\n return {\n x: rot.x % 360,\n y: rot.y % 360,\n z: rot.z % 360,\n }\n}\n\nfunction dist(p, q) {\n var a = parseFloat(q.x) - parseFloat(p.x)\n var b = parseFloat(q.y) - parseFloat(p.y)\n var c = parseFloat(q.z) - parseFloat(p.z)\n return Math.sqrt(Math.pow(a, 2) + Math.pow(b, 2) + Math.pow(c, 2))\n}\n\n// Returns true if it is a DOM element\n// https://stackoverflow.com/a/384380/2835973\nfunction isElement(o){\n var DOM_ELEMENT = 1\n return (\n typeof HTMLElement === \"object\" ? o instanceof HTMLElement : //DOM2\n o && typeof o === \"object\" && o !== null && o.nodeType === DOM_ELEMENT && typeof o.nodeName===\"string\"\n );\n}\n","import runtime from '../../core/runtime.js'\n\n// decodes Uint8Array to String\n\n// TODO: use StringDecoder in Node environment\n\n// from https://github.com/mrdoob/three.js/blob/master/examples/js/loaders/GLTFLoader.js\nfunction decodeArrayToStringUtf8 (a) {\n // FIXME: give this some more testing (i.e. inside gblock component)\n // Avoid the String.fromCharCode.apply(null, array) shortcut, which\n // throws a \"maximum call stack size exceeded\" error for large arrays.\n for (var i = 0, l = a.length, s = ''; i < l; i++) s += String.fromCharCode(a[i])\n return s\n}\n\nfunction decodeArrayToStringUtf16 (a) {\n var\n s = '',\n // ignore any initial character other than '{' = 123 and '[' = 91 (>> bug #9818)\n i = a[0] === 123 || a[1] === 91 ? 0 : 1,\n l20 = a.length - 20,\n l2 = a.length\n // passing 20 arguments into fromCharCode function provides fastest performance\n // (based on practical performance testing)\n for (; i < l20; i += 20) {\n s += String.fromCharCode(\n a[i], a[i + 1], a[i + 2], a[i + 3], a[i + 4], a[i + 5], a[i + 6], a[i + 7], a[i + 8], a[i + 9],\n a[i + 10], a[i + 11], a[i + 12], a[i + 13], a[i + 14], a[i + 15], a[i + 16], a[i + 17], a[i + 18], a[i + 19]\n )\n }\n // the rest we do char by char\n for (; i < l2; i++) {\n s += String.fromCharCode(a[i])\n }\n return s\n}\n\nvar decodeArrayToStringShims = {\n // UTF-8\n 'utf-8': decodeArrayToStringUtf8,\n 'UTF-8': decodeArrayToStringUtf8,\n // UTF-16\n 'utf-16': decodeArrayToStringUtf16,\n 'UTF-16': decodeArrayToStringUtf16\n}\n\nfunction makeArrayToStringDecoder (enc) {\n\n // use native decoder when available\n if (runtime.isBrowser && window.TextDecoder) {\n var textDecoderUtf16 = new window.TextDecoder(enc)\n return textDecoderUtf16.decode.bind(textDecoderUtf16)\n\n } else {\n // use shim\n return decodeArrayToStringShims[enc]\n }\n\n}\n\n// API\n\nvar decodeTextArray = {\n\n utf8: makeArrayToStringDecoder('utf-8'),\n utf16: makeArrayToStringDecoder('utf-16')\n\n}\n\n// expose API\n\nexport default decodeTextArray","var Symbol = require('./_Symbol'),\n isArguments = require('./isArguments'),\n isArray = require('./isArray');\n\n/** Built-in value references. */\nvar spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined;\n\n/**\n * Checks if `value` is a flattenable `arguments` object or array.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.\n */\nfunction isFlattenable(value) {\n return isArray(value) || isArguments(value) ||\n !!(spreadableSymbol && value && value[spreadableSymbol]);\n}\n\nmodule.exports = isFlattenable;\n","var arrayPush = require('./_arrayPush'),\n isFlattenable = require('./_isFlattenable');\n\n/**\n * The base implementation of `_.flatten` with support for restricting flattening.\n *\n * @private\n * @param {Array} array The array to flatten.\n * @param {number} depth The maximum recursion depth.\n * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.\n * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.\n * @param {Array} [result=[]] The initial result value.\n * @returns {Array} Returns the new flattened array.\n */\nfunction baseFlatten(array, depth, predicate, isStrict, result) {\n var index = -1,\n length = array.length;\n\n predicate || (predicate = isFlattenable);\n result || (result = []);\n\n while (++index < length) {\n var value = array[index];\n if (depth > 0 && predicate(value)) {\n if (depth > 1) {\n // Recursively flatten arrays (susceptible to call stack limits).\n baseFlatten(value, depth - 1, predicate, isStrict, result);\n } else {\n arrayPush(result, value);\n }\n } else if (!isStrict) {\n result[result.length] = value;\n }\n }\n return result;\n}\n\nmodule.exports = baseFlatten;\n","/**\n * A specialized version of `_.map` for arrays without support for iteratee\n * shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the new mapped array.\n */\nfunction arrayMap(array, iteratee) {\n var index = -1,\n length = array == null ? 0 : array.length,\n result = Array(length);\n\n while (++index < length) {\n result[index] = iteratee(array[index], index, array);\n }\n return result;\n}\n\nmodule.exports = arrayMap;\n","/** Used to stand-in for `undefined` hash values. */\nvar HASH_UNDEFINED = '__lodash_hash_undefined__';\n\n/**\n * Adds `value` to the array cache.\n *\n * @private\n * @name add\n * @memberOf SetCache\n * @alias push\n * @param {*} value The value to cache.\n * @returns {Object} Returns the cache instance.\n */\nfunction setCacheAdd(value) {\n this.__data__.set(value, HASH_UNDEFINED);\n return this;\n}\n\nmodule.exports = setCacheAdd;\n","/**\n * Checks if `value` is in the array cache.\n *\n * @private\n * @name has\n * @memberOf SetCache\n * @param {*} value The value to search for.\n * @returns {number} Returns `true` if `value` is found, else `false`.\n */\nfunction setCacheHas(value) {\n return this.__data__.has(value);\n}\n\nmodule.exports = setCacheHas;\n","var MapCache = require('./_MapCache'),\n setCacheAdd = require('./_setCacheAdd'),\n setCacheHas = require('./_setCacheHas');\n\n/**\n *\n * Creates an array cache object to store unique values.\n *\n * @private\n * @constructor\n * @param {Array} [values] The values to cache.\n */\nfunction SetCache(values) {\n var index = -1,\n length = values == null ? 0 : values.length;\n\n this.__data__ = new MapCache;\n while (++index < length) {\n this.add(values[index]);\n }\n}\n\n// Add methods to `SetCache`.\nSetCache.prototype.add = SetCache.prototype.push = setCacheAdd;\nSetCache.prototype.has = setCacheHas;\n\nmodule.exports = SetCache;\n","/**\n * A specialized version of `_.some` for arrays without support for iteratee\n * shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {boolean} Returns `true` if any element passes the predicate check,\n * else `false`.\n */\nfunction arraySome(array, predicate) {\n var index = -1,\n length = array == null ? 0 : array.length;\n\n while (++index < length) {\n if (predicate(array[index], index, array)) {\n return true;\n }\n }\n return false;\n}\n\nmodule.exports = arraySome;\n","/**\n * Checks if a `cache` value for `key` exists.\n *\n * @private\n * @param {Object} cache The cache to query.\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction cacheHas(cache, key) {\n return cache.has(key);\n}\n\nmodule.exports = cacheHas;\n","var SetCache = require('./_SetCache'),\n arraySome = require('./_arraySome'),\n cacheHas = require('./_cacheHas');\n\n/** Used to compose bitmasks for value comparisons. */\nvar COMPARE_PARTIAL_FLAG = 1,\n COMPARE_UNORDERED_FLAG = 2;\n\n/**\n * A specialized version of `baseIsEqualDeep` for arrays with support for\n * partial deep comparisons.\n *\n * @private\n * @param {Array} array The array to compare.\n * @param {Array} other The other array to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} stack Tracks traversed `array` and `other` objects.\n * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.\n */\nfunction equalArrays(array, other, bitmask, customizer, equalFunc, stack) {\n var isPartial = bitmask & COMPARE_PARTIAL_FLAG,\n arrLength = array.length,\n othLength = other.length;\n\n if (arrLength != othLength && !(isPartial && othLength > arrLength)) {\n return false;\n }\n // Assume cyclic values are equal.\n var stacked = stack.get(array);\n if (stacked && stack.get(other)) {\n return stacked == other;\n }\n var index = -1,\n result = true,\n seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;\n\n stack.set(array, other);\n stack.set(other, array);\n\n // Ignore non-index properties.\n while (++index < arrLength) {\n var arrValue = array[index],\n othValue = other[index];\n\n if (customizer) {\n var compared = isPartial\n ? customizer(othValue, arrValue, index, other, array, stack)\n : customizer(arrValue, othValue, index, array, other, stack);\n }\n if (compared !== undefined) {\n if (compared) {\n continue;\n }\n result = false;\n break;\n }\n // Recursively compare arrays (susceptible to call stack limits).\n if (seen) {\n if (!arraySome(other, function(othValue, othIndex) {\n if (!cacheHas(seen, othIndex) &&\n (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {\n return seen.push(othIndex);\n }\n })) {\n result = false;\n break;\n }\n } else if (!(\n arrValue === othValue ||\n equalFunc(arrValue, othValue, bitmask, customizer, stack)\n )) {\n result = false;\n break;\n }\n }\n stack['delete'](array);\n stack['delete'](other);\n return result;\n}\n\nmodule.exports = equalArrays;\n","var Symbol = require('./_Symbol'),\n Uint8Array = require('./_Uint8Array'),\n eq = require('./eq'),\n equalArrays = require('./_equalArrays'),\n mapToArray = require('./_mapToArray'),\n setToArray = require('./_setToArray');\n\n/** Used to compose bitmasks for value comparisons. */\nvar COMPARE_PARTIAL_FLAG = 1,\n COMPARE_UNORDERED_FLAG = 2;\n\n/** `Object#toString` result references. */\nvar boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n errorTag = '[object Error]',\n mapTag = '[object Map]',\n numberTag = '[object Number]',\n regexpTag = '[object RegExp]',\n setTag = '[object Set]',\n stringTag = '[object String]',\n symbolTag = '[object Symbol]';\n\nvar arrayBufferTag = '[object ArrayBuffer]',\n dataViewTag = '[object DataView]';\n\n/** Used to convert symbols to primitives and strings. */\nvar symbolProto = Symbol ? Symbol.prototype : undefined,\n symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;\n\n/**\n * A specialized version of `baseIsEqualDeep` for comparing objects of\n * the same `toStringTag`.\n *\n * **Note:** This function only supports comparing values with tags of\n * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {string} tag The `toStringTag` of the objects to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} stack Tracks traversed `object` and `other` objects.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\nfunction equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {\n switch (tag) {\n case dataViewTag:\n if ((object.byteLength != other.byteLength) ||\n (object.byteOffset != other.byteOffset)) {\n return false;\n }\n object = object.buffer;\n other = other.buffer;\n\n case arrayBufferTag:\n if ((object.byteLength != other.byteLength) ||\n !equalFunc(new Uint8Array(object), new Uint8Array(other))) {\n return false;\n }\n return true;\n\n case boolTag:\n case dateTag:\n case numberTag:\n // Coerce booleans to `1` or `0` and dates to milliseconds.\n // Invalid dates are coerced to `NaN`.\n return eq(+object, +other);\n\n case errorTag:\n return object.name == other.name && object.message == other.message;\n\n case regexpTag:\n case stringTag:\n // Coerce regexes to strings and treat strings, primitives and objects,\n // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring\n // for more details.\n return object == (other + '');\n\n case mapTag:\n var convert = mapToArray;\n\n case setTag:\n var isPartial = bitmask & COMPARE_PARTIAL_FLAG;\n convert || (convert = setToArray);\n\n if (object.size != other.size && !isPartial) {\n return false;\n }\n // Assume cyclic values are equal.\n var stacked = stack.get(object);\n if (stacked) {\n return stacked == other;\n }\n bitmask |= COMPARE_UNORDERED_FLAG;\n\n // Recursively compare objects (susceptible to call stack limits).\n stack.set(object, other);\n var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);\n stack['delete'](object);\n return result;\n\n case symbolTag:\n if (symbolValueOf) {\n return symbolValueOf.call(object) == symbolValueOf.call(other);\n }\n }\n return false;\n}\n\nmodule.exports = equalByTag;\n","var getAllKeys = require('./_getAllKeys');\n\n/** Used to compose bitmasks for value comparisons. */\nvar COMPARE_PARTIAL_FLAG = 1;\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * A specialized version of `baseIsEqualDeep` for objects with support for\n * partial deep comparisons.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} stack Tracks traversed `object` and `other` objects.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\nfunction equalObjects(object, other, bitmask, customizer, equalFunc, stack) {\n var isPartial = bitmask & COMPARE_PARTIAL_FLAG,\n objProps = getAllKeys(object),\n objLength = objProps.length,\n othProps = getAllKeys(other),\n othLength = othProps.length;\n\n if (objLength != othLength && !isPartial) {\n return false;\n }\n var index = objLength;\n while (index--) {\n var key = objProps[index];\n if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {\n return false;\n }\n }\n // Assume cyclic values are equal.\n var stacked = stack.get(object);\n if (stacked && stack.get(other)) {\n return stacked == other;\n }\n var result = true;\n stack.set(object, other);\n stack.set(other, object);\n\n var skipCtor = isPartial;\n while (++index < objLength) {\n key = objProps[index];\n var objValue = object[key],\n othValue = other[key];\n\n if (customizer) {\n var compared = isPartial\n ? customizer(othValue, objValue, key, other, object, stack)\n : customizer(objValue, othValue, key, object, other, stack);\n }\n // Recursively compare objects (susceptible to call stack limits).\n if (!(compared === undefined\n ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))\n : compared\n )) {\n result = false;\n break;\n }\n skipCtor || (skipCtor = key == 'constructor');\n }\n if (result && !skipCtor) {\n var objCtor = object.constructor,\n othCtor = other.constructor;\n\n // Non `Object` object instances with different constructors are not equal.\n if (objCtor != othCtor &&\n ('constructor' in object && 'constructor' in other) &&\n !(typeof objCtor == 'function' && objCtor instanceof objCtor &&\n typeof othCtor == 'function' && othCtor instanceof othCtor)) {\n result = false;\n }\n }\n stack['delete'](object);\n stack['delete'](other);\n return result;\n}\n\nmodule.exports = equalObjects;\n","var Stack = require('./_Stack'),\n equalArrays = require('./_equalArrays'),\n equalByTag = require('./_equalByTag'),\n equalObjects = require('./_equalObjects'),\n getTag = require('./_getTag'),\n isArray = require('./isArray'),\n isBuffer = require('./isBuffer'),\n isTypedArray = require('./isTypedArray');\n\n/** Used to compose bitmasks for value comparisons. */\nvar COMPARE_PARTIAL_FLAG = 1;\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]',\n arrayTag = '[object Array]',\n objectTag = '[object Object]';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * A specialized version of `baseIsEqual` for arrays and objects which performs\n * deep comparisons and tracks traversed objects enabling objects with circular\n * references to be compared.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} [stack] Tracks traversed `object` and `other` objects.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\nfunction baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {\n var objIsArr = isArray(object),\n othIsArr = isArray(other),\n objTag = objIsArr ? arrayTag : getTag(object),\n othTag = othIsArr ? arrayTag : getTag(other);\n\n objTag = objTag == argsTag ? objectTag : objTag;\n othTag = othTag == argsTag ? objectTag : othTag;\n\n var objIsObj = objTag == objectTag,\n othIsObj = othTag == objectTag,\n isSameTag = objTag == othTag;\n\n if (isSameTag && isBuffer(object)) {\n if (!isBuffer(other)) {\n return false;\n }\n objIsArr = true;\n objIsObj = false;\n }\n if (isSameTag && !objIsObj) {\n stack || (stack = new Stack);\n return (objIsArr || isTypedArray(object))\n ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)\n : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);\n }\n if (!(bitmask & COMPARE_PARTIAL_FLAG)) {\n var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),\n othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');\n\n if (objIsWrapped || othIsWrapped) {\n var objUnwrapped = objIsWrapped ? object.value() : object,\n othUnwrapped = othIsWrapped ? other.value() : other;\n\n stack || (stack = new Stack);\n return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);\n }\n }\n if (!isSameTag) {\n return false;\n }\n stack || (stack = new Stack);\n return equalObjects(object, other, bitmask, customizer, equalFunc, stack);\n}\n\nmodule.exports = baseIsEqualDeep;\n","var baseIsEqualDeep = require('./_baseIsEqualDeep'),\n isObjectLike = require('./isObjectLike');\n\n/**\n * The base implementation of `_.isEqual` which supports partial comparisons\n * and tracks traversed objects.\n *\n * @private\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @param {boolean} bitmask The bitmask flags.\n * 1 - Unordered comparison\n * 2 - Partial comparison\n * @param {Function} [customizer] The function to customize comparisons.\n * @param {Object} [stack] Tracks traversed `value` and `other` objects.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n */\nfunction baseIsEqual(value, other, bitmask, customizer, stack) {\n if (value === other) {\n return true;\n }\n if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {\n return value !== value && other !== other;\n }\n return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);\n}\n\nmodule.exports = baseIsEqual;\n","var Stack = require('./_Stack'),\n baseIsEqual = require('./_baseIsEqual');\n\n/** Used to compose bitmasks for value comparisons. */\nvar COMPARE_PARTIAL_FLAG = 1,\n COMPARE_UNORDERED_FLAG = 2;\n\n/**\n * The base implementation of `_.isMatch` without support for iteratee shorthands.\n *\n * @private\n * @param {Object} object The object to inspect.\n * @param {Object} source The object of property values to match.\n * @param {Array} matchData The property names, values, and compare flags to match.\n * @param {Function} [customizer] The function to customize comparisons.\n * @returns {boolean} Returns `true` if `object` is a match, else `false`.\n */\nfunction baseIsMatch(object, source, matchData, customizer) {\n var index = matchData.length,\n length = index,\n noCustomizer = !customizer;\n\n if (object == null) {\n return !length;\n }\n object = Object(object);\n while (index--) {\n var data = matchData[index];\n if ((noCustomizer && data[2])\n ? data[1] !== object[data[0]]\n : !(data[0] in object)\n ) {\n return false;\n }\n }\n while (++index < length) {\n data = matchData[index];\n var key = data[0],\n objValue = object[key],\n srcValue = data[1];\n\n if (noCustomizer && data[2]) {\n if (objValue === undefined && !(key in object)) {\n return false;\n }\n } else {\n var stack = new Stack;\n if (customizer) {\n var result = customizer(objValue, srcValue, key, object, source, stack);\n }\n if (!(result === undefined\n ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)\n : result\n )) {\n return false;\n }\n }\n }\n return true;\n}\n\nmodule.exports = baseIsMatch;\n","var isObject = require('./isObject');\n\n/**\n * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` if suitable for strict\n * equality comparisons, else `false`.\n */\nfunction isStrictComparable(value) {\n return value === value && !isObject(value);\n}\n\nmodule.exports = isStrictComparable;\n","var isStrictComparable = require('./_isStrictComparable'),\n keys = require('./keys');\n\n/**\n * Gets the property names, values, and compare flags of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the match data of `object`.\n */\nfunction getMatchData(object) {\n var result = keys(object),\n length = result.length;\n\n while (length--) {\n var key = result[length],\n value = object[key];\n\n result[length] = [key, value, isStrictComparable(value)];\n }\n return result;\n}\n\nmodule.exports = getMatchData;\n","/**\n * A specialized version of `matchesProperty` for source values suitable\n * for strict equality comparisons, i.e. `===`.\n *\n * @private\n * @param {string} key The key of the property to get.\n * @param {*} srcValue The value to match.\n * @returns {Function} Returns the new spec function.\n */\nfunction matchesStrictComparable(key, srcValue) {\n return function(object) {\n if (object == null) {\n return false;\n }\n return object[key] === srcValue &&\n (srcValue !== undefined || (key in Object(object)));\n };\n}\n\nmodule.exports = matchesStrictComparable;\n","var baseIsMatch = require('./_baseIsMatch'),\n getMatchData = require('./_getMatchData'),\n matchesStrictComparable = require('./_matchesStrictComparable');\n\n/**\n * The base implementation of `_.matches` which doesn't clone `source`.\n *\n * @private\n * @param {Object} source The object of property values to match.\n * @returns {Function} Returns the new spec function.\n */\nfunction baseMatches(source) {\n var matchData = getMatchData(source);\n if (matchData.length == 1 && matchData[0][2]) {\n return matchesStrictComparable(matchData[0][0], matchData[0][1]);\n }\n return function(object) {\n return object === source || baseIsMatch(object, source, matchData);\n };\n}\n\nmodule.exports = baseMatches;\n","var baseGetTag = require('./_baseGetTag'),\n isObjectLike = require('./isObjectLike');\n\n/** `Object#toString` result references. */\nvar symbolTag = '[object Symbol]';\n\n/**\n * Checks if `value` is classified as a `Symbol` primitive or object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.\n * @example\n *\n * _.isSymbol(Symbol.iterator);\n * // => true\n *\n * _.isSymbol('abc');\n * // => false\n */\nfunction isSymbol(value) {\n return typeof value == 'symbol' ||\n (isObjectLike(value) && baseGetTag(value) == symbolTag);\n}\n\nmodule.exports = isSymbol;\n","var isArray = require('./isArray'),\n isSymbol = require('./isSymbol');\n\n/** Used to match property names within property paths. */\nvar reIsDeepProp = /\\.|\\[(?:[^[\\]]*|([\"'])(?:(?!\\1)[^\\\\]|\\\\.)*?\\1)\\]/,\n reIsPlainProp = /^\\w*$/;\n\n/**\n * Checks if `value` is a property name and not a property path.\n *\n * @private\n * @param {*} value The value to check.\n * @param {Object} [object] The object to query keys on.\n * @returns {boolean} Returns `true` if `value` is a property name, else `false`.\n */\nfunction isKey(value, object) {\n if (isArray(value)) {\n return false;\n }\n var type = typeof value;\n if (type == 'number' || type == 'symbol' || type == 'boolean' ||\n value == null || isSymbol(value)) {\n return true;\n }\n return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||\n (object != null && value in Object(object));\n}\n\nmodule.exports = isKey;\n","var MapCache = require('./_MapCache');\n\n/** Error message constants. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/**\n * Creates a function that memoizes the result of `func`. If `resolver` is\n * provided, it determines the cache key for storing the result based on the\n * arguments provided to the memoized function. By default, the first argument\n * provided to the memoized function is used as the map cache key. The `func`\n * is invoked with the `this` binding of the memoized function.\n *\n * **Note:** The cache is exposed as the `cache` property on the memoized\n * function. Its creation may be customized by replacing the `_.memoize.Cache`\n * constructor with one whose instances implement the\n * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)\n * method interface of `clear`, `delete`, `get`, `has`, and `set`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to have its output memoized.\n * @param {Function} [resolver] The function to resolve the cache key.\n * @returns {Function} Returns the new memoized function.\n * @example\n *\n * var object = { 'a': 1, 'b': 2 };\n * var other = { 'c': 3, 'd': 4 };\n *\n * var values = _.memoize(_.values);\n * values(object);\n * // => [1, 2]\n *\n * values(other);\n * // => [3, 4]\n *\n * object.a = 2;\n * values(object);\n * // => [1, 2]\n *\n * // Modify the result cache.\n * values.cache.set(object, ['a', 'b']);\n * values(object);\n * // => ['a', 'b']\n *\n * // Replace `_.memoize.Cache`.\n * _.memoize.Cache = WeakMap;\n */\nfunction memoize(func, resolver) {\n if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n var memoized = function() {\n var args = arguments,\n key = resolver ? resolver.apply(this, args) : args[0],\n cache = memoized.cache;\n\n if (cache.has(key)) {\n return cache.get(key);\n }\n var result = func.apply(this, args);\n memoized.cache = cache.set(key, result) || cache;\n return result;\n };\n memoized.cache = new (memoize.Cache || MapCache);\n return memoized;\n}\n\n// Expose `MapCache`.\nmemoize.Cache = MapCache;\n\nmodule.exports = memoize;\n","var memoize = require('./memoize');\n\n/** Used as the maximum memoize cache size. */\nvar MAX_MEMOIZE_SIZE = 500;\n\n/**\n * A specialized version of `_.memoize` which clears the memoized function's\n * cache when it exceeds `MAX_MEMOIZE_SIZE`.\n *\n * @private\n * @param {Function} func The function to have its output memoized.\n * @returns {Function} Returns the new memoized function.\n */\nfunction memoizeCapped(func) {\n var result = memoize(func, function(key) {\n if (cache.size === MAX_MEMOIZE_SIZE) {\n cache.clear();\n }\n return key;\n });\n\n var cache = result.cache;\n return result;\n}\n\nmodule.exports = memoizeCapped;\n","var memoizeCapped = require('./_memoizeCapped');\n\n/** Used to match property names within property paths. */\nvar reLeadingDot = /^\\./,\n rePropName = /[^.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|([\"'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))/g;\n\n/** Used to match backslashes in property paths. */\nvar reEscapeChar = /\\\\(\\\\)?/g;\n\n/**\n * Converts `string` to a property path array.\n *\n * @private\n * @param {string} string The string to convert.\n * @returns {Array} Returns the property path array.\n */\nvar stringToPath = memoizeCapped(function(string) {\n var result = [];\n if (reLeadingDot.test(string)) {\n result.push('');\n }\n string.replace(rePropName, function(match, number, quote, string) {\n result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match));\n });\n return result;\n});\n\nmodule.exports = stringToPath;\n","var Symbol = require('./_Symbol'),\n arrayMap = require('./_arrayMap'),\n isArray = require('./isArray'),\n isSymbol = require('./isSymbol');\n\n/** Used as references for various `Number` constants. */\nvar INFINITY = 1 / 0;\n\n/** Used to convert symbols to primitives and strings. */\nvar symbolProto = Symbol ? Symbol.prototype : undefined,\n symbolToString = symbolProto ? symbolProto.toString : undefined;\n\n/**\n * The base implementation of `_.toString` which doesn't convert nullish\n * values to empty strings.\n *\n * @private\n * @param {*} value The value to process.\n * @returns {string} Returns the string.\n */\nfunction baseToString(value) {\n // Exit early for strings to avoid a performance hit in some environments.\n if (typeof value == 'string') {\n return value;\n }\n if (isArray(value)) {\n // Recursively convert values (susceptible to call stack limits).\n return arrayMap(value, baseToString) + '';\n }\n if (isSymbol(value)) {\n return symbolToString ? symbolToString.call(value) : '';\n }\n var result = (value + '');\n return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;\n}\n\nmodule.exports = baseToString;\n","var baseToString = require('./_baseToString');\n\n/**\n * Converts `value` to a string. An empty string is returned for `null`\n * and `undefined` values. The sign of `-0` is preserved.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n * @example\n *\n * _.toString(null);\n * // => ''\n *\n * _.toString(-0);\n * // => '-0'\n *\n * _.toString([1, 2, 3]);\n * // => '1,2,3'\n */\nfunction toString(value) {\n return value == null ? '' : baseToString(value);\n}\n\nmodule.exports = toString;\n","var isArray = require('./isArray'),\n isKey = require('./_isKey'),\n stringToPath = require('./_stringToPath'),\n toString = require('./toString');\n\n/**\n * Casts `value` to a path array if it's not one.\n *\n * @private\n * @param {*} value The value to inspect.\n * @param {Object} [object] The object to query keys on.\n * @returns {Array} Returns the cast property path array.\n */\nfunction castPath(value, object) {\n if (isArray(value)) {\n return value;\n }\n return isKey(value, object) ? [value] : stringToPath(toString(value));\n}\n\nmodule.exports = castPath;\n","var isSymbol = require('./isSymbol');\n\n/** Used as references for various `Number` constants. */\nvar INFINITY = 1 / 0;\n\n/**\n * Converts `value` to a string key if it's not a string or symbol.\n *\n * @private\n * @param {*} value The value to inspect.\n * @returns {string|symbol} Returns the key.\n */\nfunction toKey(value) {\n if (typeof value == 'string' || isSymbol(value)) {\n return value;\n }\n var result = (value + '');\n return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;\n}\n\nmodule.exports = toKey;\n","var castPath = require('./_castPath'),\n toKey = require('./_toKey');\n\n/**\n * The base implementation of `_.get` without support for default values.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array|string} path The path of the property to get.\n * @returns {*} Returns the resolved value.\n */\nfunction baseGet(object, path) {\n path = castPath(path, object);\n\n var index = 0,\n length = path.length;\n\n while (object != null && index < length) {\n object = object[toKey(path[index++])];\n }\n return (index && index == length) ? object : undefined;\n}\n\nmodule.exports = baseGet;\n","var baseGet = require('./_baseGet');\n\n/**\n * Gets the value at `path` of `object`. If the resolved value is\n * `undefined`, the `defaultValue` is returned in its place.\n *\n * @static\n * @memberOf _\n * @since 3.7.0\n * @category Object\n * @param {Object} object The object to query.\n * @param {Array|string} path The path of the property to get.\n * @param {*} [defaultValue] The value returned for `undefined` resolved values.\n * @returns {*} Returns the resolved value.\n * @example\n *\n * var object = { 'a': [{ 'b': { 'c': 3 } }] };\n *\n * _.get(object, 'a[0].b.c');\n * // => 3\n *\n * _.get(object, ['a', '0', 'b', 'c']);\n * // => 3\n *\n * _.get(object, 'a.b.c', 'default');\n * // => 'default'\n */\nfunction get(object, path, defaultValue) {\n var result = object == null ? undefined : baseGet(object, path);\n return result === undefined ? defaultValue : result;\n}\n\nmodule.exports = get;\n","/**\n * The base implementation of `_.hasIn` without support for deep paths.\n *\n * @private\n * @param {Object} [object] The object to query.\n * @param {Array|string} key The key to check.\n * @returns {boolean} Returns `true` if `key` exists, else `false`.\n */\nfunction baseHasIn(object, key) {\n return object != null && key in Object(object);\n}\n\nmodule.exports = baseHasIn;\n","var castPath = require('./_castPath'),\n isArguments = require('./isArguments'),\n isArray = require('./isArray'),\n isIndex = require('./_isIndex'),\n isLength = require('./isLength'),\n toKey = require('./_toKey');\n\n/**\n * Checks if `path` exists on `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array|string} path The path to check.\n * @param {Function} hasFunc The function to check properties.\n * @returns {boolean} Returns `true` if `path` exists, else `false`.\n */\nfunction hasPath(object, path, hasFunc) {\n path = castPath(path, object);\n\n var index = -1,\n length = path.length,\n result = false;\n\n while (++index < length) {\n var key = toKey(path[index]);\n if (!(result = object != null && hasFunc(object, key))) {\n break;\n }\n object = object[key];\n }\n if (result || ++index != length) {\n return result;\n }\n length = object == null ? 0 : object.length;\n return !!length && isLength(length) && isIndex(key, length) &&\n (isArray(object) || isArguments(object));\n}\n\nmodule.exports = hasPath;\n","var baseHasIn = require('./_baseHasIn'),\n hasPath = require('./_hasPath');\n\n/**\n * Checks if `path` is a direct or inherited property of `object`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Object\n * @param {Object} object The object to query.\n * @param {Array|string} path The path to check.\n * @returns {boolean} Returns `true` if `path` exists, else `false`.\n * @example\n *\n * var object = _.create({ 'a': _.create({ 'b': 2 }) });\n *\n * _.hasIn(object, 'a');\n * // => true\n *\n * _.hasIn(object, 'a.b');\n * // => true\n *\n * _.hasIn(object, ['a', 'b']);\n * // => true\n *\n * _.hasIn(object, 'b');\n * // => false\n */\nfunction hasIn(object, path) {\n return object != null && hasPath(object, path, baseHasIn);\n}\n\nmodule.exports = hasIn;\n","var baseIsEqual = require('./_baseIsEqual'),\n get = require('./get'),\n hasIn = require('./hasIn'),\n isKey = require('./_isKey'),\n isStrictComparable = require('./_isStrictComparable'),\n matchesStrictComparable = require('./_matchesStrictComparable'),\n toKey = require('./_toKey');\n\n/** Used to compose bitmasks for value comparisons. */\nvar COMPARE_PARTIAL_FLAG = 1,\n COMPARE_UNORDERED_FLAG = 2;\n\n/**\n * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.\n *\n * @private\n * @param {string} path The path of the property to get.\n * @param {*} srcValue The value to match.\n * @returns {Function} Returns the new spec function.\n */\nfunction baseMatchesProperty(path, srcValue) {\n if (isKey(path) && isStrictComparable(srcValue)) {\n return matchesStrictComparable(toKey(path), srcValue);\n }\n return function(object) {\n var objValue = get(object, path);\n return (objValue === undefined && objValue === srcValue)\n ? hasIn(object, path)\n : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);\n };\n}\n\nmodule.exports = baseMatchesProperty;\n","/**\n * The base implementation of `_.property` without support for deep paths.\n *\n * @private\n * @param {string} key The key of the property to get.\n * @returns {Function} Returns the new accessor function.\n */\nfunction baseProperty(key) {\n return function(object) {\n return object == null ? undefined : object[key];\n };\n}\n\nmodule.exports = baseProperty;\n","var baseGet = require('./_baseGet');\n\n/**\n * A specialized version of `baseProperty` which supports deep paths.\n *\n * @private\n * @param {Array|string} path The path of the property to get.\n * @returns {Function} Returns the new accessor function.\n */\nfunction basePropertyDeep(path) {\n return function(object) {\n return baseGet(object, path);\n };\n}\n\nmodule.exports = basePropertyDeep;\n","var baseProperty = require('./_baseProperty'),\n basePropertyDeep = require('./_basePropertyDeep'),\n isKey = require('./_isKey'),\n toKey = require('./_toKey');\n\n/**\n * Creates a function that returns the value at `path` of a given object.\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Util\n * @param {Array|string} path The path of the property to get.\n * @returns {Function} Returns the new accessor function.\n * @example\n *\n * var objects = [\n * { 'a': { 'b': 2 } },\n * { 'a': { 'b': 1 } }\n * ];\n *\n * _.map(objects, _.property('a.b'));\n * // => [2, 1]\n *\n * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');\n * // => [1, 2]\n */\nfunction property(path) {\n return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);\n}\n\nmodule.exports = property;\n","var baseMatches = require('./_baseMatches'),\n baseMatchesProperty = require('./_baseMatchesProperty'),\n identity = require('./identity'),\n isArray = require('./isArray'),\n property = require('./property');\n\n/**\n * The base implementation of `_.iteratee`.\n *\n * @private\n * @param {*} [value=_.identity] The value to convert to an iteratee.\n * @returns {Function} Returns the iteratee.\n */\nfunction baseIteratee(value) {\n // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.\n // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.\n if (typeof value == 'function') {\n return value;\n }\n if (value == null) {\n return identity;\n }\n if (typeof value == 'object') {\n return isArray(value)\n ? baseMatchesProperty(value[0], value[1])\n : baseMatches(value);\n }\n return property(value);\n}\n\nmodule.exports = baseIteratee;\n","/**\n * Creates a base function for methods like `_.forIn` and `_.forOwn`.\n *\n * @private\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Function} Returns the new base function.\n */\nfunction createBaseFor(fromRight) {\n return function(object, iteratee, keysFunc) {\n var index = -1,\n iterable = Object(object),\n props = keysFunc(object),\n length = props.length;\n\n while (length--) {\n var key = props[fromRight ? length : ++index];\n if (iteratee(iterable[key], key, iterable) === false) {\n break;\n }\n }\n return object;\n };\n}\n\nmodule.exports = createBaseFor;\n","var createBaseFor = require('./_createBaseFor');\n\n/**\n * The base implementation of `baseForOwn` which iterates over `object`\n * properties returned by `keysFunc` and invokes `iteratee` for each property.\n * Iteratee functions may exit iteration early by explicitly returning `false`.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {Function} keysFunc The function to get the keys of `object`.\n * @returns {Object} Returns `object`.\n */\nvar baseFor = createBaseFor();\n\nmodule.exports = baseFor;\n","var baseFor = require('./_baseFor'),\n keys = require('./keys');\n\n/**\n * The base implementation of `_.forOwn` without support for iteratee shorthands.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Object} Returns `object`.\n */\nfunction baseForOwn(object, iteratee) {\n return object && baseFor(object, iteratee, keys);\n}\n\nmodule.exports = baseForOwn;\n","var isArrayLike = require('./isArrayLike');\n\n/**\n * Creates a `baseEach` or `baseEachRight` function.\n *\n * @private\n * @param {Function} eachFunc The function to iterate over a collection.\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Function} Returns the new base function.\n */\nfunction createBaseEach(eachFunc, fromRight) {\n return function(collection, iteratee) {\n if (collection == null) {\n return collection;\n }\n if (!isArrayLike(collection)) {\n return eachFunc(collection, iteratee);\n }\n var length = collection.length,\n index = fromRight ? length : -1,\n iterable = Object(collection);\n\n while ((fromRight ? index-- : ++index < length)) {\n if (iteratee(iterable[index], index, iterable) === false) {\n break;\n }\n }\n return collection;\n };\n}\n\nmodule.exports = createBaseEach;\n","var baseForOwn = require('./_baseForOwn'),\n createBaseEach = require('./_createBaseEach');\n\n/**\n * The base implementation of `_.forEach` without support for iteratee shorthands.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array|Object} Returns `collection`.\n */\nvar baseEach = createBaseEach(baseForOwn);\n\nmodule.exports = baseEach;\n","var baseEach = require('./_baseEach'),\n isArrayLike = require('./isArrayLike');\n\n/**\n * The base implementation of `_.map` without support for iteratee shorthands.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the new mapped array.\n */\nfunction baseMap(collection, iteratee) {\n var index = -1,\n result = isArrayLike(collection) ? Array(collection.length) : [];\n\n baseEach(collection, function(value, key, collection) {\n result[++index] = iteratee(value, key, collection);\n });\n return result;\n}\n\nmodule.exports = baseMap;\n","/**\n * The base implementation of `_.sortBy` which uses `comparer` to define the\n * sort order of `array` and replaces criteria objects with their corresponding\n * values.\n *\n * @private\n * @param {Array} array The array to sort.\n * @param {Function} comparer The function to define sort order.\n * @returns {Array} Returns `array`.\n */\nfunction baseSortBy(array, comparer) {\n var length = array.length;\n\n array.sort(comparer);\n while (length--) {\n array[length] = array[length].value;\n }\n return array;\n}\n\nmodule.exports = baseSortBy;\n","var isSymbol = require('./isSymbol');\n\n/**\n * Compares values to sort them in ascending order.\n *\n * @private\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {number} Returns the sort order indicator for `value`.\n */\nfunction compareAscending(value, other) {\n if (value !== other) {\n var valIsDefined = value !== undefined,\n valIsNull = value === null,\n valIsReflexive = value === value,\n valIsSymbol = isSymbol(value);\n\n var othIsDefined = other !== undefined,\n othIsNull = other === null,\n othIsReflexive = other === other,\n othIsSymbol = isSymbol(other);\n\n if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||\n (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||\n (valIsNull && othIsDefined && othIsReflexive) ||\n (!valIsDefined && othIsReflexive) ||\n !valIsReflexive) {\n return 1;\n }\n if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||\n (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||\n (othIsNull && valIsDefined && valIsReflexive) ||\n (!othIsDefined && valIsReflexive) ||\n !othIsReflexive) {\n return -1;\n }\n }\n return 0;\n}\n\nmodule.exports = compareAscending;\n","var compareAscending = require('./_compareAscending');\n\n/**\n * Used by `_.orderBy` to compare multiple properties of a value to another\n * and stable sort them.\n *\n * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,\n * specify an order of \"desc\" for descending or \"asc\" for ascending sort order\n * of corresponding values.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {boolean[]|string[]} orders The order to sort by for each property.\n * @returns {number} Returns the sort order indicator for `object`.\n */\nfunction compareMultiple(object, other, orders) {\n var index = -1,\n objCriteria = object.criteria,\n othCriteria = other.criteria,\n length = objCriteria.length,\n ordersLength = orders.length;\n\n while (++index < length) {\n var result = compareAscending(objCriteria[index], othCriteria[index]);\n if (result) {\n if (index >= ordersLength) {\n return result;\n }\n var order = orders[index];\n return result * (order == 'desc' ? -1 : 1);\n }\n }\n // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications\n // that causes it, under certain circumstances, to provide the same value for\n // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247\n // for more details.\n //\n // This also ensures a stable sort in V8 and other engines.\n // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.\n return object.index - other.index;\n}\n\nmodule.exports = compareMultiple;\n","var arrayMap = require('./_arrayMap'),\n baseIteratee = require('./_baseIteratee'),\n baseMap = require('./_baseMap'),\n baseSortBy = require('./_baseSortBy'),\n baseUnary = require('./_baseUnary'),\n compareMultiple = require('./_compareMultiple'),\n identity = require('./identity');\n\n/**\n * The base implementation of `_.orderBy` without param guards.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.\n * @param {string[]} orders The sort orders of `iteratees`.\n * @returns {Array} Returns the new sorted array.\n */\nfunction baseOrderBy(collection, iteratees, orders) {\n var index = -1;\n iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(baseIteratee));\n\n var result = baseMap(collection, function(value, key, collection) {\n var criteria = arrayMap(iteratees, function(iteratee) {\n return iteratee(value);\n });\n return { 'criteria': criteria, 'index': ++index, 'value': value };\n });\n\n return baseSortBy(result, function(object, other) {\n return compareMultiple(object, other, orders);\n });\n}\n\nmodule.exports = baseOrderBy;\n","var baseFlatten = require('./_baseFlatten'),\n baseOrderBy = require('./_baseOrderBy'),\n baseRest = require('./_baseRest'),\n isIterateeCall = require('./_isIterateeCall');\n\n/**\n * Creates an array of elements, sorted in ascending order by the results of\n * running each element in a collection thru each iteratee. This method\n * performs a stable sort, that is, it preserves the original sort order of\n * equal elements. The iteratees are invoked with one argument: (value).\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {...(Function|Function[])} [iteratees=[_.identity]]\n * The iteratees to sort by.\n * @returns {Array} Returns the new sorted array.\n * @example\n *\n * var users = [\n * { 'user': 'fred', 'age': 48 },\n * { 'user': 'barney', 'age': 36 },\n * { 'user': 'fred', 'age': 40 },\n * { 'user': 'barney', 'age': 34 }\n * ];\n *\n * _.sortBy(users, [function(o) { return o.user; }]);\n * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]\n *\n * _.sortBy(users, ['user', 'age']);\n * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]]\n */\nvar sortBy = baseRest(function(collection, iteratees) {\n if (collection == null) {\n return [];\n }\n var length = iteratees.length;\n if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {\n iteratees = [];\n } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {\n iteratees = [iteratees[0]];\n }\n return baseOrderBy(collection, baseFlatten(iteratees, 1), []);\n});\n\nmodule.exports = sortBy;\n","import sortBy from 'lodash/sortBy'\n\n// main\n\nfunction PromiseCache (args) {\n\n var args = args || {}\n\n this.maxResolvedCache = args.maxResolvedCache || 1000\n\n this._pendingPromises = {}\n this._resolvedPromises = {}\n\n}\n\nPromiseCache.prototype = {\n\n add: function (key, promise) {\n\n var self = this\n\n // check if it already exists\n if (this._pendingPromises[ key ]) {\n return this._pendingPromises[ key ]\n }\n if (this._resolvedPromises[ key ]) {\n return this._resolvedPromises[ key ]\n }\n\n // create cache object\n var cacheObject = {\n key: key,\n timestamp: Date.now(),\n promise: promise\n }\n\n // add to store\n this._pendingPromises[ key ] = cacheObject\n\n // move to resolved store and update state when resolved\n promise.then(function (data) {\n\n var cacheObject = self._pendingPromises[ key ]\n delete self._pendingPromises[ key ]\n\n cacheObject.data = data\n\n self._resolvedPromises[ key ] = cacheObject\n\n }, function () {\n\n delete self._pendingPromises[ key ]\n\n })\n\n // collect garbage\n this._collectGarbage()\n\n // return cache object\n return cacheObject\n\n },\n\n get: function (key) {\n\n // check store\n var cacheObject = this._pendingPromises[ key ] || this._resolvedPromises[ key ]\n if (!cacheObject) {\n return false\n }\n\n // update timestamp\n cacheObject.timestamp = Date.now()\n\n // return promise\n return cacheObject.promise\n\n },\n\n purge: function () {\n\n for (var key in this._resolvedPromises) {\n delete this._resolvedPromises[ key ]\n }\n\n },\n\n _collectGarbage: function () {\n\n // sort archive by timestamp\n var sortedPromises = sortBy(this._resolvedPromises, function (obj) {\n return obj.timestamp\n })\n\n // the amount of cache objects that have to be removed\n var removeCount = (sortedPromises.length - this.maxResolvedCache)\n if (removeCount <= 0) {\n return\n }\n\n for (var i = 0; i < removeCount; i++) {\n delete this._resolvedPromises[ sortedPromises[ i ].key ]\n }\n\n }\n\n}\n\nexport default PromiseCache","import runtime from '../../core/runtime.js'\nimport PromiseCache from '../promise-cache.js'\nimport fetch from './fetch.js'\n\nvar promiseCache = new PromiseCache()\n\nexport default function fetchScript (url) {\n runtime.assertBrowser('Please use \"require()\" to fetch modules in server environment.')\n\n // module wrapper\n window.___modules = window.___modules || {}\n\n // return module if it has been loaded already\n if (window.___modules[url]) {\n return Promise.resolve(window.___modules[url])\n\n } else {\n\n // try promise cache (could be in loading state)\n var promiseFromCache = promiseCache.get(url)\n if (promiseFromCache) return promiseFromCache\n\n // load code and use module wrapper\n var fetchPromise = fetch(url).then(function(response){\n if (!response.ok) throw 'Could not load script from URL: '+url\n return response.text()\n }).then(function(code){\n\n // check module type\n var moduleWrapper\n if (code.indexOf('define(function()') > -1) {\n // AMD\n moduleWrapper = code+'\\nfunction define(cb){ window.___modules[\"'+url+'\"] = cb(); };'\n } else {\n // CommonJS\n moduleWrapper = 'window.___modules[\"'+url+'\"] = (function(){ var exports = {}, module = {exports:exports};'+code+'\\nreturn module.exports\\n})()'\n }\n\n var script = document.createElement('script')\n try {\n script.appendChild(document.createTextNode(moduleWrapper))\n document.body.appendChild(script)\n } catch (e) {\n script.text = moduleWrapper\n document.body.appendChild(script)\n }\n return window.___modules[url]\n })\n\n // add to cache\n promiseCache.add(url, fetchPromise)\n\n return fetchPromise\n\n }\n\n}","// TODO: Replace placeholder shaders by original ones (requires fixing projection matrix)\nimport Promise from 'bluebird'\nimport decodeArrayToString from '../../utils/array/decode-to-string.js'\nimport fetchScript from '../../utils/io/fetch-script.js'\nimport PromiseCache from '../../utils/promise-cache.js'\nimport fragmentShader from './gblock/fragment-placeholder.glsl'\nimport vertexShader from './gblock/vertex-placeholder.glsl'\n\n// configs\n\nvar LEGACY_GLFT_V1_LOADER_URL = 'https://cdn.rawgit.com/mrdoob/three.js/r86/examples/js/loaders/GLTFLoader.js'\nvar GBLOCK_API_GET_OFFICIAL_GLTF_URL = 'https://gblock.3d.io/api/get-gltf-url/?url='\n\n// internals\n\nvar promiseCache = new PromiseCache()\n\n// aframe module\n\nexport default {\n\n schema: {type: 'asset'},\n\n init: function () {\n\n this.model = null\n\n },\n\n update: function () {\n\n var self = this\n var el = this.el\n var src = this.data\n\n if (!src) { return; }\n\n this.remove()\n\n getGltfUrl(src).then(loadGblockModel).then(function onLoaded (gltfModel) {\n\n self.model = gltfModel.scene || gltfModel.scenes[0]\n self.model.animations = gltfModel.animations\n\n el.setObject3D('mesh', self.model)\n el.emit('model-loaded', {format: 'gltf', model: self.model})\n\n }).catch(function(errorMessage){\n\n console.error('ERROR loading gblock model from \"' + src +'\" : ' + errorMessage)\n el.emit('model-error', { message: errorMessage })\n\n })\n\n },\n\n remove: function () {\n\n if (!this.model) { return; }\n this.el.removeObject3D('mesh')\n\n }\n\n}\n\n// private shared methods\n\n// FIXME: Replace this with an official API URL once available\n// This API call is only needed to obtain the official glTF URL of a google block model.\n// The glTF itself is not being proxied and gets fetched from https://vr.google.com/downloads/* directly.\n// https://github.com/archilogic-com/aframe-gblock/issues/1\n// API server code: server/index.js\n// try promise cache (could be in loading state)\nfunction getGltfUrl (src) {\n\n // try cache\n var getUrlPromise = promiseCache.get(src)\n\n if (!getUrlPromise) {\n\n getUrlPromise = fetch(GBLOCK_API_GET_OFFICIAL_GLTF_URL + src).then(function (response) {\n\n // parse response\n return response.json().catch(function(error){\n // handle JSON parsing error\n console.log('ERROR parsing gblock API server response JSON.\\nRequested Model: \"' + src + '\"\\nError: \"' + JSON.stringify(error) + '\"')\n return Promise.reject('gblock API server error. Check console for details.')\n }).then(function (message) {\n if (response.ok) {\n // return glTF URL\n return message.gltfUrl\n } else {\n // handle error response\n console.error('ERROR loading gblock model \"'+ src +'\" : ' + response.status + ' \"' + message.message)\n return Promise.reject(message.message)\n }\n })\n\n })\n\n // add to cache\n promiseCache.add(src, getUrlPromise)\n\n }\n\n return getUrlPromise\n\n}\n\n// loads google block models (poly.google.com)\nfunction loadGblockModel(url, onProgress) {\n return new Promise(function(resolve, reject) {\n\n // create unviresal GLTF loader for google blocks\n // this one will inherit methods from GLTF V1 or V2 based on file version\n function GBlockLoader () {\n this.manager = THREE.DefaultLoadingManager\n this.path = THREE.Loader.prototype.extractUrlBase( url )\n }\n\n // load model\n var loader = new THREE.FileLoader( GBlockLoader.manager )\n loader.setResponseType( 'arraybuffer' )\n loader.load( url, function onLoad( data ) {\n try {\n\n // convert uint8 to json\n var json = JSON.parse(decodeArrayToString.utf8(data))\n\n // check GLTF version\n var isGLTF1 = json.asset === undefined || json.asset.version[ 0 ] < 2\n\n if (isGLTF1) {\n\n fetchGLTF1Loader().then(function(GLTF1Loader){\n\n // inherit methods from GLTF V1 loader\n GBlockLoader.prototype = GLTF1Loader.prototype\n var gblockLoader = new GBlockLoader()\n GLTF1Loader.call(gblockLoader)\n\n // Replace original shaders with placeholders\n Object.keys(json.shaders).forEach(function (key, i) {\n if (key.indexOf('fragment') > -1) json.shaders[key].uri = fragmentShader.base64\n else if (key.indexOf('vertex') > -1) json.shaders[key].uri = vertexShader.base64\n })\n\n // convert json back to uint8 data\n var modifiedData = new TextEncoder('utf-8').encode(JSON.stringify(json))\n\n // parse data\n gblockLoader.parse( modifiedData, function onParsingDone (gltf) {\n\n // FIXME: adapt projection matrix in original shaders and do not replace materials\n (gltf.scene || gltf.scenes[0]).traverse(function (child) {\n if (child.material) child.material = new THREE.MeshPhongMaterial({ vertexColors: THREE.VertexColors })\n })\n\n // GLTF V1 ready\n resolve(gltf)\n\n }, gblockLoader.path)\n\n })\n\n } else {\n\n // inferit methods from GLTF V2 loader\n GBlockLoader.prototype = THREE.GLTFLoader.prototype\n var gblockLoader = new GBlockLoader()\n THREE.GLTFLoader.call(gblockLoader)\n\n // parse data\n gblockLoader.parse( data, gblockLoader.path, resolve, reject)\n\n }\n\n } catch ( e ) {\n\n // For SyntaxError or TypeError, return a generic failure message.\n reject( e.constructor === Error ? e : new Error( 'THREE.GLTFLoader: Unable to parse model.' ) )\n\n }\n\n }, onProgress, reject )\n\n })\n}\n\n// fetch legacy GLTF v1 loader on demand\nvar GLFT1LoaderPromise\nfunction fetchGLTF1Loader () {\n if (!GLFT1LoaderPromise ) {\n // legacy loader will overwrite THREE.GLTFLoader so we need to keep reference to it\n THREE.___GLTF2Loader = THREE.GLTFLoader\n // fetch legacy loader for GLTF1\n GLFT1LoaderPromise = fetchScript(LEGACY_GLFT_V1_LOADER_URL).then(function(){\n // keep reference GLTF V1 loader\n var GLTF1Loader = THREE.GLTFLoader\n // restore GLTF V2 loader reference\n THREE.GLTFLoader = THREE.___GLTF2Loader\n\n return GLTF1Loader\n })\n }\n return GLFT1LoaderPromise\n}","export default {\n\n schema: {\n preset: {\n type: 'string',\n default: 'studio'\n },\n intensity: {\n type: 'float',\n default: 1\n },\n saturation: {\n type: 'float',\n default: 1\n }\n },\n\n init: function () {\n var cameraEl = document.querySelector('a-entity[camera]') || document.querySelector('a-camera')\n if (!cameraEl) {\n console.warn('this scene has no camera, add one to make the lighting work')\n return\n }\n this.cam = cameraEl.object3D\n\n // main\n this.staticLights = document.createElement('a-entity')\n this.staticLights.id = 'static-lights'\n this.movingWithCamera = document.createElement('a-entity')\n this.movingWithCamera.id = 'moving-lights'\n this.rotatingWithCamera = document.createElement('a-entity')\n this.rotatingWithCamera.id = 'rotating-lights'\n this.el.appendChild(this.staticLights)\n this.el.appendChild(this.movingWithCamera)\n this.el.appendChild(this.rotatingWithCamera)\n },\n\n update: function () {\n if (this.camera) this.cam = this.camera.object3D\n\n // clear existing lights\n while (this.movingWithCamera.hasChildNodes()) {\n this.movingWithCamera.removeChild(this.movingWithCamera.lastChild);\n }\n while (this.rotatingWithCamera.hasChildNodes()) {\n this.rotatingWithCamera.removeChild(this.rotatingWithCamera.lastChild);\n }\n while (this.staticLights.hasChildNodes()) {\n this.staticLights.removeChild(this.staticLights.lastChild);\n }\n\n // create new light setup\n createLighting[this.data.preset](\n this.movingWithCamera,\n this.rotatingWithCamera,\n this.staticLights,\n this.data.intensity,\n this.data.saturation\n )\n },\n\n remove: function () {\n // tear down light setup\n this.el.removeChild(this.staticLights)\n this.el.removeChild(this.movingWithCamera)\n this.el.removeChild(this.rotatingWithCamera)\n },\n\n tick: function (dt) {\n if (!this.movingWithCamera) return\n // set position from camera\n this.movingWithCamera.setAttribute('position', this.cam.position)\n // set y rotation - convert rad to deg\n var lightRotation = {x: 0, y: this.cam.rotation.y * 180 / Math.PI, z: 0}\n this.rotatingWithCamera.setAttribute('rotation', AFRAME.utils.coordinates.stringify(lightRotation))\n }\n\n}\n\n// configs\n\nvar SHADOW_CAMERA_NEAR = 1\nvar SHADOW_CAMERA_FAR = 60\nvar SHADOW_SIZE = 20 // real size of shadow map in meters\nvar SHADOW_MAP_SIZE = 1024 // pixel size of shadow map\nvar SHADOW_BIAS = 0.001\n// var SHADOW_DARKNESS = 0.2\n\n// light presets\n\nvar createLighting = {\n studio: function(movingWithCamera, rotatingWithCamera, staticLights, intensity, saturation) {\n\n // target for moving directional lights\n addElement({\n 'id': 'light-target',\n 'position': {x: 0, y: 0, z:-2}\n }, movingWithCamera)\n\n // shadow casting top down light\n addElement({\n 'light': {\n type: 'directional',\n color: '#333',\n intensity: 1,\n target: '#light-target',\n castShadow: true,\n shadowCameraLeft: -SHADOW_SIZE / 2,\n shadowCameraRight: SHADOW_SIZE / 2,\n shadowCameraBottom: -SHADOW_SIZE / 2,\n shadowCameraTop: SHADOW_SIZE / 2,\n shadowMapHeight: SHADOW_MAP_SIZE,\n shadowMapWidth: SHADOW_MAP_SIZE,\n shadowBias: SHADOW_BIAS,\n shadowCameraNear: SHADOW_CAMERA_NEAR,\n shadowCameraFar: SHADOW_CAMERA_FAR\n },\n 'position': {x: 0, y: 10, z:-2},\n 'id': 'shadow-light'\n }, movingWithCamera)\n\n // hemisphere light for yellow - blue tint\n addElement({\n 'light': {\n type: 'hemisphere',\n // yellow\n color: 'hsl(35, ' + Math.round(15 * saturation) + '%, 60%)',\n // blue\n groundColor: 'hsl(220, ' + Math.round(10 * saturation) + '%, 65%)',\n intensity: 0.4 * intensity\n },\n // positioning left equals rotation by 90°\n 'position': {x: -2, y: 0, z:0},\n 'rotation': {x: 0, y: 45, z:0},\n 'id': 'hemisphere-color'\n }, rotatingWithCamera)\n\n // hemisphere light for brightness from front\n addElement({\n 'light': {\n type: 'hemisphere',\n color: 'hsl(0, 0%, 0%)',\n groundColor: 'hsl(0, 0%, 80%)',\n intensity: 0.3 * intensity\n },\n // positioning front equals rotation by 90°\n 'position': {x: 0, y: 1, z:0},\n 'id': 'hemisphere-white'\n }, rotatingWithCamera)\n\n // lights for specular\n // blue\n addElement({\n 'light': {\n type: 'directional',\n color: 'hsl(200, ' + Math.round(10 * saturation) + '%, 60%)',\n intensity: 0.25 * intensity,\n // target: '#light-target'\n },\n 'position': {x: 2, y: 2, z:-1},\n 'id': 'specular-blue'\n }, rotatingWithCamera)\n\n // yellow\n addElement({\n 'light': {\n type: 'directional',\n color: 'hsl(35, ' + Math.round(10 * saturation) + '%, 60%)',\n intensity: 0.35 * intensity,\n // target: '#light-target'\n },\n 'position': {x: -2, y: 1, z:2},\n 'id': 'specular-yellow'\n }, rotatingWithCamera)\n\n // overall ambient light\n addElement({\n 'light': {\n type: 'ambient',\n color: '#FFF',\n intensity: 0.45\n },\n 'id': 'ambient-light'\n }, staticLights)\n }\n}\n\nfunction addElement(attributes, parent) {\n var el = document.createElement('a-entity')\n Object.keys(attributes).forEach(function(key) {\n el.setAttribute(key, attributes[key])\n })\n parent.appendChild(el)\n}","var baseClone = require('./_baseClone');\n\n/** Used to compose bitmasks for cloning. */\nvar CLONE_DEEP_FLAG = 1,\n CLONE_SYMBOLS_FLAG = 4;\n\n/**\n * This method is like `_.clone` except that it recursively clones `value`.\n *\n * @static\n * @memberOf _\n * @since 1.0.0\n * @category Lang\n * @param {*} value The value to recursively clone.\n * @returns {*} Returns the deep cloned value.\n * @see _.clone\n * @example\n *\n * var objects = [{ 'a': 1 }, { 'b': 2 }];\n *\n * var deep = _.cloneDeep(objects);\n * console.log(deep[0] === objects[0]);\n * // => false\n */\nfunction cloneDeep(value) {\n return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);\n}\n\nmodule.exports = cloneDeep;\n","import cloneDeep from 'lodash/cloneDeep'\n\nexport default {\n schema: {\n sceneId: {\n type: 'string'\n },\n rotation: {\n type: 'number',\n default: 0\n },\n width: {\n type: 'number',\n default: 150\n },\n position: {\n type: 'string',\n default: 'left',\n oneOf: ['left', 'right']\n }\n },\n init: function () {\n var this_ = this\n var data = this.data\n\n // get scene structure\n io3d.scene.getStructure(data.sceneId)\n .then(result => {\n //this.sceneStructure = result\n if (!Array.isArray(result)) result = [result]\n // find all spaces in the model\n let spaces = getSpaces(result)\n // apply plan rotation / position\n\n if (!spaces || !spaces.length) {\n return Promise.reject('Minimap generation failed, scene has no spaces')\n }\n spaces = spaces.map(space => {\n let location = applyLocation(space, result[0])\n Object.keys(location).forEach(prop => {\n space[prop] = location[prop]\n })\n //console.log(' ' + space.ry)\n return space\n })\n setupMap()\n // generate a clickable plan\n generatePlan(spaces, this.svgEl)\n })\n .catch(console.warn)\n\n function setupMap () {\n // get camera\n var cameras = document.querySelectorAll('[camera]')\n // pick the last camera\n // TODO: better to pick the active one\n this_.camera = cameras.length > 1 ? cameras[1] : cameras[0]\n // console.log('loading minimap', data)\n // console.log('loading minimap', cameras, this_.camera.getAttribute('position'))\n // create html container for minimap\n var container = document.createElement('div')\n container.id = 'minimap-container'\n container.setAttribute('style', `position:absolute; width: ${data.width}px; z-index: 1000; top:10px; ${data.position}:10px`)\n container.innerHTML = ``\n // put container as first child in body\n var body = document.querySelector('body')\n body.insertBefore(container, body.firstChild)\n // bind svg element with component\n this_.svgEl = container.querySelector('svg')\n this_.svgEl.setAttribute('style', `transform: rotate(${data.rotation}deg);`)\n }\n // generate a pictogram of the floor plan\n function generatePlan (spaces, svgEl) {\n // empty svg element to fill\n this_.min = [Infinity, Infinity]\n this_.max = [-Infinity, -Infinity]\n var polygonStr = ''\n\n const style1 = 'fill:rgba(248, 248, 250, 0.8); stroke:rgba(48, 48, 50, 0.8); stroke-width:0.5;'\n const style2 = 'fill:rgba(255, 127, 80, 0.8);'\n\n spaces.forEach(space => {\n var pointStr = ''\n // get the polygon data for each space\n space.polygon.forEach(point => {\n // get absolute coordinates and map z to y\n // polygon points are relative to the polygon position\n var location = applyLocation({x: point[0], z: point[1]}, space)\n var x = Math.round(location.x * 20)\n var y = Math.round(location.z * 20)\n // get min and max values for the overall boundingbox\n if (x < this_.min[0]) this_.min[0] = x\n else if (x > this_.max[0]) this_.max[0] = x\n if (y < this_.min[1]) this_.min[1] = y\n else if (y > this_.max[1]) this_.max[1] = y\n pointStr += x + ',' + y + ' '\n })\n polygonStr += ``\n })\n // populate the svg\n svgEl.innerHTML = polygonStr\n // match the svg viewbox with the bouningbox of the polygons\n svgEl.setAttribute('viewBox', `${this_.min[0]} ${this_.min[1]} ${this_.max[0] - this_.min[0]} ${this_.max[1] - this_.min[1]}`)\n\n // start position tracking\n this_.mapActivated = true\n this_.el.emit('minimap-created')\n }\n\n function applyLocation (element, parent) {\n\n // Rotate look-at point on the XZ plane around parent's center\n var angleY = -parent.ry * Math.PI / 180\n\n var rotatedX = element.x * Math.cos(angleY) - element.z * Math.sin(angleY)\n var rotatedZ = element.z * Math.cos(angleY) + element.x * Math.sin(angleY)\n\n // Get world space coordinates for our look-at point\n var location = {}\n location.x = parent.x + rotatedX\n if (element.y !== undefined) location.y = parent.y + element.y\n location.z = parent.z + rotatedZ\n if (element.ry !== undefined) location.ry = parent.ry + element.ry\n return location\n }\n\n function getSpaces (sceneStructure) {\n var spaces = []\n sceneStructure.forEach(element3d => {\n if (element3d.type === 'polyfloor') spaces.push(element3d)\n if (element3d.children && element3d.children.length) {\n spaces = spaces.concat(getSpaces(element3d.children))\n }\n })\n return spaces\n }\n },\n remove: function() {\n var minimapEl = document.querySelector('#minimap-container')\n minimapEl.parentNode.removeChild(minimapEl)\n },\n tick: function (time, timeDiff) {\n if (!this.mapActivated) return\n\n // update dot every 100 ms\n if (time % 50 < timeDiff + 5) {\n var cameraDot = this.svgEl.querySelector('#camera-dot')\n var cameraPos = this.camera.getAttribute('position')\n var cameraRot = this.camera.getAttribute('rotation')\n // make sure our point stays within the map\n var pointPos = cloneDeep(cameraPos)\n if (pointPos.x * 20 < this.min[0]) pointPos.x = this.min[0] / 20\n else if (pointPos.x * 20 > this.max[0]) pointPos.x = this.max[0] / 20\n if (pointPos.z * 20 < this.min[1]) pointPos.z = this.min[1] / 20\n else if (pointPos.z * 20 > this.max[1]) pointPos.z = this.max[1] / 20\n\n // console.log(cameraPos)\n if (!cameraDot) {\n console.log('create dot')\n this.svgEl.innerHTML +=\n `\n\t\n\t\n\n\n \n \n \n \n`\n // circle cx=\"150\" cy=\"50\" r=\"40\"\n } else {\n cameraDot.setAttribute('transform', `translate(${pointPos.x * 20},${pointPos.z * 20}) rotate(${-cameraRot.y - 90})`)\n }\n }\n }\n}","export default {\n params: {\n type: {\n type: 'string',\n possibleValues: [\n 'box',\n 'camera-bookmark',\n 'closet',\n 'column',\n 'curtain',\n 'door',\n 'floor',\n 'floorplan',\n 'group',\n 'interior',\n 'kitchen',\n 'level',\n 'object',\n 'plan',\n 'polybox',\n 'polyfloor',\n 'railing',\n 'stairs',\n 'tag',\n 'wall',\n 'window',\n ],\n optional: false,\n skipInAframe: true\n },\n x: { // x position in meters\n type: 'number',\n defaultValue: 0,\n optional: false,\n skipInAframe: true\n },\n y: { // y position in meters\n type: 'number',\n defaultValue: 0,\n optional: false,\n skipInAframe: true\n },\n z: { // z position in meters\n type: 'number',\n defaultValue: 0,\n optional: false,\n skipInAframe: true\n },\n ry: { // y rotation in angle degrees\n type: 'number',\n defaultValue: 0,\n optional: false,\n skipInAframe: true,\n description: 'rotation around y axis'\n },\n children: {\n //type: 'array-with-objects',\n type: 'array',\n defaultValue: [],\n optional: true,\n skipInAframe: true\n },\n id: {\n type: 'string',\n optional: false,\n skipInAframe: true,\n description: 'unique identifier: UUID v4'\n },\n materials: {\n type: 'object',\n optional: true\n }\n }\n}\n","export default {\n description: 'simple box object',\n params: {\n v: {\n type: 'number',\n defaultValue: 0,\n optional: true,\n description: 'version'\n },\n l: { // length in meters\n type: 'number',\n defaultValue: 1,\n optional: false,\n min: 0.01,\n description: 'length'\n },\n w: { // width in meters\n type: 'number',\n defaultValue: 1,\n optional: false,\n min: 0.01,\n description: 'width'\n },\n h: { // height in meters\n type: 'number',\n defaultValue: 1,\n optional: false,\n min: 0.01,\n description: 'height'\n }\n },\n childrenTypes: [],\n parentTypes: ['level'],\n aframeComponent: {\n name: 'io3d-box'\n }\n}","export default {\n description: 'preset camera positions for animations and navigation',\n params: {\n v: {\n type: 'number',\n defaultValue: 0,\n optional: true,\n description: 'version'\n },\n rx: {\n type: 'number',\n defaultValue: 0,\n skipInAframe: true,\n description: 'pitch'\n },\n distance: {\n type: 'number',\n skipInAframe: true\n },\n fov: {\n type: 'number',\n defaultValue: 71,\n skipInAframe: true\n },\n name: {\n type: 'string',\n defaultValue: 'Camera Bookmark'\n }\n },\n parentTypes: ['plan'],\n aframeComponent: {\n name: 'tour-waypoint'\n }\n}","export default {\n description: 'parametric closet with segmentation targeting 0.6m',\n params: {\n v: {\n type: 'number',\n defaultValue: 1,\n optional: true,\n description: 'version'\n },\n l: { // length in meters\n type: 'number',\n defaultValue: 1.8,\n optional: false,\n min: 0.01,\n description: 'length'\n },\n w: { // width in meters\n type: 'number',\n defaultValue: 0.6,\n optional: false,\n min: 0.01,\n description: 'width'\n },\n h: { // height in meters\n type: 'number',\n defaultValue: 2.4,\n optional: false,\n min: 0.01,\n description: 'height'\n },\n baseboard: {\n type: 'number',\n defaultValue: 0.1,\n optional: true,\n min: 0.01,\n description: 'height of baseboard'\n },\n doorWidth: {\n type: 'number',\n defaultValue: 0.02,\n optional: true,\n min: 0.01,\n description: 'thickness of closet door'\n },\n handleLength: {\n type: 'number',\n defaultValue: 0.02,\n optional: true,\n min: 0.01,\n description: 'length of closet door handle'\n },\n handleWidth: {\n type: 'number',\n defaultValue: 0.02,\n optional: true,\n min: 0.01,\n description: 'thickness of closet door handle'\n },\n handleHeight: {\n type: 'number',\n defaultValue: 0.3,\n optional: true,\n min: 0.01,\n description: 'height of closet door handle'\n }\n },\n childrenTypes: [],\n parentTypes: ['level'],\n aframeComponent: {\n name: 'io3d-closet'\n }\n}\n","export default {\n description: 'simple structural column object, round or square',\n params: {\n v: {\n type: 'number',\n defaultValue: 1,\n optional: true,\n description: 'version'\n },\n l: { // diameter\n type: 'number',\n defaultValue: 0.2,\n optional: false,\n min: 0.01,\n description: 'length for square / diameter for circle'\n },\n h: { // height in meters\n type: 'number',\n defaultValue: 2.4,\n optional: false,\n min: 0.01,\n description: 'height'\n },\n shape: {\n type: 'string',\n defaultValue: 'square',\n optional: false,\n min: 0.01,\n possibleValues: ['square', 'circle'],\n description: 'column contour'\n }\n },\n childrenTypes: [],\n parentTypes: [\n 'level',\n 'group'\n ],\n aframeComponent: {\n name: 'io3d-column'\n }\n}","export default {\n description: 'curtain with random folds',\n params: {\n v: {\n type: 'number',\n defaultValue: 1,\n optional: true,\n description: 'version'\n },\n l: { // length in meters\n type: 'number',\n defaultValue: 1.8,\n optional: false,\n min: 0.01,\n description: 'length'\n },\n w: { // width in meters\n type: 'number',\n defaultValue: 0.2,\n optional: false,\n min: 0.01,\n description: 'thickness'\n },\n h: { // height in meters\n type: 'number',\n defaultValue: 2.4,\n optional: false,\n min: 0.01,\n description: 'height'\n },\n folds: {\n type: 'number',\n defaultValue: 14,\n optional: true,\n min: 0.01,\n description: 'number of folds'\n }\n },\n childrenTypes: [],\n parentTypes: ['level']\n}","export default {\n description: 'door within a wall',\n params: {\n v: {\n type: 'number',\n defaultValue: 3,\n optional: false,\n description: 'version'\n },\n l: { // length in meters\n type: 'number',\n defaultValue: 0.9,\n optional: false,\n min: 0.01,\n description: 'length'\n },\n w: { // width in meters\n type: 'number',\n defaultValue: 0.05,\n optional: false,\n min: 0.01,\n description: 'width'\n },\n h: { // height in meters\n type: 'number',\n defaultValue: 2,\n optional: false,\n min: 0.01,\n description: 'height'\n },\n frameLength: { // in meters\n type: 'number',\n defaultValue: 0.05,\n optional: true,\n min: 0.01,\n description: 'thickness of frame'\n },\n frameOffset: { // in meters\n type: 'number',\n defaultValue: 0,\n optional: true,\n description: 'frame thicker than wall'\n },\n leafWidth: { // in meters\n type: 'number',\n defaultValue: 0.03,\n optional: true,\n description: 'thickness of door leaf'\n },\n leafOffset: { // in meters\n type: 'number',\n defaultValue: 0.005,\n optional: true,\n description: 'z offset of door leaf'\n },\n doorType: {\n type: 'string',\n defaultValue: 'singleSwing',\n optional: false,\n possibleValues: ['singleSwing', 'doubleSwing', 'swingFix', 'swingDoubleFix', 'doubleSwingDoubleFix', 'slidingDoor', 'opening'],\n description: 'defines opening type'\n },\n hinge: {\n type: 'string',\n defaultValue: 'right',\n optional: false,\n possibleValues: ['right', 'left'],\n description: 'door leaf opening direction'\n },\n side: {\n type: 'string',\n defaultValue: 'back',\n optional: false,\n possibleValues: ['front', 'back'],\n description: 'door leaf opening to the front or back of the wall'\n },\n doorAngle: { // in angle degrees\n type: 'number',\n defaultValue: 92,\n optional: true,\n description: 'door leaf opening anlge'\n },\n fixLeafRatio: { // in meters\n type: 'number',\n defaultValue: 0.3,\n optional: true\n },\n threshold: {\n type: 'boolean',\n defaultValue: true\n },\n thresholdHeight: {\n type: 'number',\n defaultValue: 0.01,\n optional: true\n }\n },\n childrenTypes: [],\n parentTypes: ['wall'],\n aframeComponent: {\n name: 'io3d-door'\n }\n}","export default {\n description: 'rectangular floor with optional ceiling',\n params: {\n v: {\n type: 'number',\n defaultValue: 0,\n optional: true,\n description: 'version'\n },\n w: { // width in meters\n type: 'number',\n defaultValue: 4,\n optional: false,\n min: 0.01,\n description: 'width'\n },\n h: { // height in meters\n type: 'number',\n defaultValue: 0.2,\n optional: false,\n min: 0.01,\n description: 'height'\n },\n l: { // length in meters\n type: 'number',\n defaultValue: 4,\n optional: false,\n min: 0.01,\n description: 'length'\n },\n hasCeiling: { // in meters\n type: 'boolean',\n defaultValue: true,\n optional: false,\n description: 'toggle ceiling'\n },\n hCeiling: { // in meters\n type: 'number',\n defaultValue: 2.4,\n optional: false,\n description: 'ceiling height'\n }\n },\n childrenTypes: [],\n parentTypes: ['level'],\n aframeComponent: {\n name: 'io3d-floor'\n }\n}","export default {\n description: 'reference to a floor plan image',\n params: {\n v: {\n type: 'number',\n defaultValue: 0,\n optional: true,\n description: 'version'\n },\n w: { // width in meters\n type: 'number',\n optional: false,\n min: 0.01\n },\n l: { // length in meters\n type: 'number',\n optional: false,\n min: 0.01\n },\n file: {\n type: 'string',\n optional: false\n }\n },\n childrenTypes: [],\n parentTypes: ['level']\n}","export default {\n description: 'group node, for relative positioning',\n params: {\n src: {\n type: 'string',\n optional: true,\n skipInAframe: true\n }\n },\n childrenTypes: [\n 'box',\n 'column',\n 'group',\n 'interior',\n 'object',\n 'polybox',\n 'wall'\n ],\n parentTypes: [\n 'level',\n 'group'\n ]\n}","export default {\n params: {\n src: {\n type: 'string',\n optional: false,\n skipInAframe: true,\n description: 'furniture id prefixed with \\'!\\', check https://furniture.3d.io'\n }\n },\n childrenTypes: ['interior', 'object', 'tag'],\n parentTypes: ['level', 'group', 'interior'],\n aframeComponent: {\n name: 'io3d-furniture'\n }\n}","export default {\n description: 'parametric kitchen with vast configuration options',\n params: {\n v: {\n type: 'number',\n defaultValue: 2,\n optional: true,\n description: 'version'\n },\n w: { // width in meters\n type: 'number',\n defaultValue: 0.6,\n optional: false,\n min: 0.01\n },\n h: { // height in meters\n type: 'number',\n defaultValue: 2.4,\n optional: false,\n min: 0.01\n },\n l: {\n type: 'number',\n defaultValue: 4.2,\n optional: false,\n min: 0.01\n },\n elementLength: {\n type: 'number',\n defaultValue: 0.6,\n optional: false,\n min: 0.01\n },\n baseBoard: {\n type: 'number',\n defaultValue: 0.1,\n optional: true,\n min: 0.01\n },\n counterHeight: {\n type: 'number',\n defaultValue: 0.9,\n optional: true,\n min: 0.01\n },\n counterThickness: {\n type: 'number',\n defaultValue: 0.03,\n optional: true,\n min: 0.01\n },\n barCounter: {\n type: 'boolean',\n defaultValue: false,\n optional: true\n },\n doorWidth: {\n type: 'number',\n defaultValue: 0.02,\n optional: true,\n min: 0.01\n },\n highCabinetLeft: {\n type: 'int',\n defaultValue: 2,\n optional: true\n },\n highCabinetRight: {\n type: 'int',\n defaultValue: 0,\n optional: true\n },\n wallCabinet: {\n type: 'boolean',\n defaultValue: true,\n optional: true\n },\n wallCabinetHeight: {\n type: 'number',\n defaultValue: 1.5,\n optional: true,\n min: 0.01\n },\n wallCabinetWidth: {\n type: 'number',\n defaultValue: 0.45,\n optional: true,\n min: 0.01\n },\n cabinetType: {\n type: 'string',\n defaultValue: 'flat',\n optional: true,\n possibleValues: ['flat', 'style1', 'style2']\n },\n sinkType: {\n type: 'string',\n defaultValue: 'single',\n optional: true,\n possibleValues: ['single', 'double', 'none']\n },\n sinkPos: {\n type: 'int',\n defaultValue: 4,\n optional: true\n },\n extractorType: {\n type: 'string',\n defaultValue: 'integrated',\n optional: true,\n possibleValues: ['box', 'pyramid', 'integrated', 'none']\n },\n ovenType: {\n type: 'string',\n defaultValue: 'single',\n optional: true,\n possibleValues: ['single', 'double', 'none']\n },\n ovenPos: {\n type: 'int',\n defaultValue: 6,\n optional: true\n },\n cooktopType: {\n type: 'string',\n defaultValue: 'electro60',\n optional: true,\n possibleValues: [\n 'electro60',\n 'electro90',\n 'gas60',\n 'gas90',\n 'none'\n ]\n },\n cooktopPos: {\n type: 'int',\n defaultValue: 6,\n optional: true\n },\n microwave: {\n type: 'boolean',\n defaultValue: false,\n optional: true\n },\n microwavePos: {\n type: 'int',\n defaultValue: 1,\n optional: true\n },\n fridge: {\n type: 'boolean',\n defaultValue: false,\n optional: true\n },\n fridgePos: {\n type: 'int',\n defaultValue: 1,\n optional: true\n }\n // TODO: add all the default values\n },\n childrenTypes: [],\n parentTypes: ['level'],\n aframeComponent: {\n name: 'io3d-kitchen'\n }\n}\n","export default {\n description: 'node equivalent to a building storey',\n params: {},\n childrenTypes: [\n 'box',\n 'closet',\n 'column',\n 'curtain',\n 'floor',\n 'floorplan',\n 'group',\n 'interior',\n 'kitchen',\n 'object',\n 'polybox',\n 'polyfloor',\n 'railing',\n 'stairs',\n 'tag',\n 'wall'\n ],\n parentTypes: ['plan']\n}\n","export default {\n description: 'referenced 3d object in data3d.buffer format, for conversion drop a .obj into the editor spaces.archilogic.com/3d',\n params: {\n object: {\n type: 'string',\n optional: false,\n skipInAframe: true,\n description: 'reference to data3d.buffer file'\n },\n sourceScale: {\n type: 'number',\n optional: true,\n skipInAframe: true,\n description: 'relative scale of source file to 1 meter'\n },\n flipYZ: {\n type: 'boolean',\n optional: true,\n skipInAframe: true,\n description: 'flip Y and Z Axis'\n }\n },\n childrenTypes: ['interior'],\n parentTypes: ['level'],\n aframeComponent: {\n name: 'io3d-data3d'\n }\n}","export default {\n description: 'highest node in hierarchy, contains levels',\n params: {\n modelDisplayName: {\n type: 'string',\n optional: true,\n skipInAframe: true,\n description: 'name of the scene'\n },\n v: {\n type: 'number',\n defaultValue: 1,\n optional: true,\n skipInAframe: true,\n description: 'version'\n }\n },\n childrenTypes: ['level', 'camera-bookmark'],\n parentTypes: []\n}","export default {\n description: 'polygonal extrusion object',\n params: {\n v: {\n type: 'number',\n defaultValue: 1,\n optional: true,\n description: 'version'\n },\n h: { // height in meters\n type: 'number',\n defaultValue: 1,\n optional: false,\n min: 0.01\n },\n polygon: {\n //type: 'array-with-arrays-with-numbers',\n type: 'array',\n aframeType: 'string',\n optional: false\n }\n },\n childrenTypes: [],\n parentTypes: ['level'],\n aframeComponent: {\n name: 'io3d-polybox'\n }\n}\n","export default {\n description: 'polygonal floor with optional ceiling',\n params: {\n v: {\n type: 'number',\n defaultValue: 0,\n optional: true,\n description: 'version'\n },\n h: { // height in meters\n type: 'number',\n defaultValue: 0.2,\n optional: false,\n min: 0.01,\n description: 'height'\n },\n polygon: {\n //type: 'array-with-arrays-with-numbers',\n type: 'array',\n // aframeType: 'string',\n defaultValue: [[1.5,1.5], [1.5,-1.5], [-1.5,-1.5], [-1.5,1.5]],\n aframeDefault: '[[1.5,1.5], [1.5,-1.5], [-1.5,-1.5], [-1.5,1.5]]',\n optional: false,\n description: 'outer polygon',\n parse: function(val) {\n if (!/^\\[.+\\]/.test(val)) {\n console.warn('invalid input for polyfloor polygon', val)\n return [[1.5,1.5], [1.5,-1.5], [-1.5,-1.5], [-1.5,1.5]]\n }\n return JSON.parse(val)\n }\n },\n polygonHoles: {\n type: 'array',\n optional: true,\n description: 'polygon holes'\n },\n hasCeiling: { // in meters\n type: 'boolean',\n defaultValue: true,\n optional: false,\n description: 'toggle ceiling'\n },\n hCeiling: { // in meters\n type: 'number',\n defaultValue: 2.4,\n optional: false,\n description: 'ceiling height'\n },\n usage: { // in meters\n type: 'string',\n optional: true\n }\n },\n childrenTypes: [],\n parentTypes: ['level'],\n aframeComponent: {\n name: 'io3d-polyfloor'\n }\n}\n","export default {\n description: 'segmented or solid railing',\n params: {\n v: {\n type: 'number',\n defaultValue: 0,\n optional: true,\n description: 'version'\n },\n w: { // width in meters\n type: 'number',\n defaultValue: 0.05,\n optional: false,\n min: 0.01,\n description: 'width'\n },\n h: { // height in meters\n type: 'number',\n defaultValue: 1,\n optional: false,\n min: 0.01,\n description: 'height'\n },\n l: { // length in meters\n type: 'number',\n defaultValue: 1,\n optional: false,\n min: 0.01,\n description: 'length'\n },\n pailing: {\n type: 'number',\n defaultValue: 0.01,\n optional: false,\n description: 'strength of the posts'\n },\n railCount: {\n type: 'int',\n defaultValue: 2,\n optional: true,\n description: 'horizontal rail count'\n },\n segmentation: {\n type: 'string',\n defaultValue: 'distance',\n possibleValues: ['distance', 'number', 'none'],\n optional: false,\n description: 'vertical segmentation type'\n },\n segments: {\n type: 'int',\n defaultValue: 5,\n optional: true,\n description: 'number of vertical segments, for segmentation = \\'number\\''\n },\n segmentDistance: {\n type: 'number',\n defaultValue: 0.14,\n optional: true,\n description: 'distance between vertical segments, for segmentation = \\'distance\\''\n }\n },\n childrenTypes: [],\n parentTypes: ['level'],\n aframeComponent: {\n name: 'io3d-railing'\n }\n}\n","export default {\n description: 'all kinds of stairs types',\n params: {\n v: {\n type: 'number',\n defaultValue: 1,\n optional: true,\n description: 'version'\n },\n w: { // width in meters\n type: 'number',\n defaultValue: 1.2,\n optional: false,\n min: 0.01\n },\n h: { // height in meters\n type: 'number',\n defaultValue: 2.4,\n optional: false,\n min: 0.01\n },\n l: { // length in meters\n type: 'number',\n defaultValue: 4,\n optional: false,\n min: 0.01\n },\n stepWidth: {\n type: 'number',\n defaultValue: 1.2,\n optional: false,\n min: 0.01\n },\n stairType: {\n type: 'string',\n defaultValue: 'straight',\n optional: false,\n possibleValues: ['straight', 'straightLanding', 'lShaped', 'halfLanding', '2QuarterLanding', 'winder', 'doubleWinder', 'spiral']\n },\n treadHeight: {\n type: 'number',\n defaultValue: 0.02,\n optional: false\n },\n stepThickness: {\n type: 'number',\n defaultValue: 0.17,\n optional: false\n },\n railing: {\n type: 'string',\n defaultValue: 'right',\n optional: false,\n possibleValues: ['none', 'left', 'right', 'both']\n },\n railingType: {\n type: 'string',\n defaultValue: 'verticalBars',\n optional: false,\n possibleValues: ['verticalBars']\n }\n // TODO: add all default values\n },\n childrenTypes: [],\n parentTypes: ['level'],\n aframeComponent: {\n name: 'io3d-stairs'\n }\n}\n","export default {\n description: 'all kinds of stairs types',\n params: {\n v: {\n type: 'number',\n defaultValue: 0,\n optional: true,\n description: 'version'\n },\n title: {\n type: 'string',\n optional: false\n },\n notes: {\n type: 'string',\n optional: true\n },\n },\n childrenTypes: [],\n parentTypes: ['level', 'interior']\n}\n","export default {\n description: 'structural wall, can contains doors and windows',\n params: {\n v: {\n type: 'number',\n defaultValue: 0,\n optional: true,\n description: 'version'\n },\n w: { // width in meters\n type: 'number',\n defaultValue: 0.15,\n optional: false,\n min: 0.01,\n description: 'width'\n },\n h: { // height in meters\n type: 'number',\n defaultValue: 2.4,\n optional: false,\n min: 0.01,\n description: 'height'\n },\n l: { // length in meters\n type: 'number',\n defaultValue: 1,\n optional: false,\n min: 0.01,\n description: 'length'\n },\n controlLine: {\n type: 'string',\n defaultValue: 'back',\n optional: true,\n possibleValues: ['back', 'center', 'front'],\n description: 'relative position of the control line to the wall'\n },\n baseHeight: {\n type: 'number',\n defaultValue: 0,\n optional: true,\n description: 'height of the baseboard'\n },\n frontHasBase: {\n type: 'boolean',\n defaultValue: false,\n optional: true,\n description: 'show baseboard on the front'\n },\n backHasBase: {\n type: 'boolean',\n defaultValue: false,\n optional: true,\n description: 'show baseboard on the back'\n }\n },\n childrenTypes: [\n 'window',\n 'door'\n ],\n parentTypes: [\n 'level',\n 'group'\n ],\n aframeComponent: {\n name: 'io3d-wall'\n }\n}","export default {\n description: 'window with optional segmentation',\n params: {\n v: {\n type: 'number',\n defaultValue: 0,\n optional: true,\n description: 'version'\n },\n y: {\n defaultValue: 0.8,\n },\n h: {\n type: 'number',\n defaultValue: 1.5,\n optional: false,\n min: 0.01,\n description: 'height'\n },\n l: {\n type: 'number',\n defaultValue: 1.6,\n optional: false,\n min: 0.01,\n description: 'length'\n },\n side: {\n type: 'string',\n defaultValue: 'back',\n optional: true,\n possibleValues: ['back', 'center', 'front'],\n description: 'relative position of the window inside the wall opening'\n },\n rowRatios: {\n //type: 'array-with-numbers',\n type: 'array',\n defaultValue: [ 1 ],\n aframeDefault: '[1]',\n optional: true,\n description: 'relative height of horizontal segmentation',\n parse: function(val) {\n if (!/^\\[.+\\]/.test(val)) {\n console.warn('invalid input for window rowRatios')\n return [ 1 ]\n }\n return JSON.parse(val)\n }\n },\n columnRatios: {\n //type: 'array-with-arrays-with-numbers',\n type: 'array',\n defaultValue: [ [ 1 ] ],\n aframeDefault: '[[1]]',\n optional: true,\n description: 'relative width of vertical segmentation per row',\n parse: function(val) {\n if (!/^\\[\\s*\\[.+\\]\\s*\\]/.test(val)) {\n console.warn('invalid input for window columnRatios')\n return [ [ 1 ] ]\n }\n return JSON.parse(val)\n }\n },\n frameLength: {\n type: 'number',\n defaultValue: 0.04,\n optional: true,\n min: 0.01,\n description: 'thickness of the frame'\n },\n frameWidth: {\n type: 'number',\n defaultValue: 0.06,\n optional: true,\n min: 0.01,\n description: 'width of the frame'\n },\n hideGlass: {\n type: 'boolean',\n defaultValue: false,\n optional: true,\n description: 'Hides glass mesh'\n }\n },\n childrenTypes: [],\n parentTypes: ['wall'],\n aframeComponent: {\n name: 'io3d-window'\n }\n}","// import sceneStructure types\nimport generic from './generic'\nimport box from './by-type/box.js'\nimport cameraBookmark from './by-type/camera-bookmark.js'\nimport closet from './by-type/closet.js'\nimport column from './by-type/column.js'\nimport curtain from './by-type/curtain.js'\nimport door from './by-type/door.js'\nimport floor from './by-type/floor.js'\nimport floorplan from './by-type/floorplan.js'\nimport group from './by-type/group'\nimport interior from './by-type/interior'\nimport kitchen from './by-type/kitchen.js'\nimport level from './by-type/level.js'\nimport object from './by-type/object.js'\nimport plan from './by-type/plan.js'\nimport polybox from './by-type/polybox.js'\nimport polyfloor from './by-type/polyfloor.js'\nimport railing from './by-type/railing.js'\nimport stairs from './by-type/stairs.js'\nimport tag from './by-type/tag.js'\nimport wall from './by-type/wall.js'\nimport window from './by-type/window.js'\n\nimport defaults from 'lodash/defaults'\n\nexport default function getDefaultsByType (type) {\n var types = {\n box: box,\n 'camera-bookmark': cameraBookmark,\n closet: closet,\n column: column,\n curtain: curtain,\n door: door,\n floor: floor,\n floorplan: floorplan,\n group: group,\n interior: interior,\n kitchen: kitchen,\n level: level,\n object: object,\n plan: plan,\n polybox: polybox,\n polyfloor: polyfloor,\n railing: railing,\n stairs: stairs,\n tag: tag,\n wall: wall,\n window: window\n }\n\n if (type && types[type]) {\n return {\n params: defaults({}, generic.params, types[type].params),\n childrenTypes: types[type].childrenTypes,\n parentTypes: types[type].parentTypes,\n aframeComponent: types[type].aframeComponent\n }\n } else {\n var typeSpecificValidations = {}\n\n Object.keys(types).forEach(function (key) {\n generic.type = key\n typeSpecificValidations[key] = {\n params: defaults({}, generic.params, types[key].params),\n childrenTypes: types[key].childrenTypes,\n parentTypes: types[key].parentTypes,\n aframeComponent: types[key].aframeComponent\n }\n })\n return typeSpecificValidations\n }\n}\n\n\n\n","import getDefaultsByType from '../../../../scene/structure/validate/get-defaults-by-type'\n\nfunction getSchema (type) {\n // get valid params and default values for each type\n var validProps = getDefaultsByType(type)\n let schema = {}\n var params = validProps.params\n var propKeys = Object.keys(params)\n propKeys.forEach(function (key) {\n // skip location, children, material and id params\n if (params[key].skipInAframe || key === 'materials') return\n // map defaults to aframe schema convention\n schema[key] = {}\n // check schema definition for custom parsing rules\n if (params[key].parse) {\n schema[key].parse = params[key].parse\n // or set the preset type\n } else {\n schema[key].type = params[key].aframeType || params[key].type\n }\n if (params[key].defaultValue) schema[key].default = params[key].aframeDefault || params[key].defaultValue\n if (params[key].possibleValues) schema[key].oneOf = params[key].possibleValues\n })\n return schema\n}\n\nexport default getSchema","export default {\n \"basic-floor\": {\n \"meta\": {\n \"displayName\": \"Basic floor\",\n \"category\": \"floor\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [2,2],\n \"colorDiffuse\": [0.278,0.278,0.278],\n \"colorSpecular\": [0.4,0.4,0.4],\n \"specularCoef\": 40,\n \"mapNormal\": \"archilogic/tex/f4bee6370d34d5616e4693aa39287efd.hi-res.gz.dds\",\n \"mapSpecular\": \"archilogic/tex/22dacd7e3ed1e454bddb88f321fd1315.hi-res.gz.dds\",\n \"mapNormalSource\": \"archilogic/tex/f4bee6370d34d5616e4693aa39287efd.source.png\",\n \"mapNormalPreview\": \"archilogic/tex/f4bee6370d34d5616e4693aa39287efd.lo-res.jpg\",\n \"mapSpecularSource\": \"archilogic/tex/22dacd7e3ed1e454bddb88f321fd1315.source.png\",\n \"mapSpecularPreview\": \"archilogic/tex/22dacd7e3ed1e454bddb88f321fd1315.lo-res.jpg\",\n \"receiveRealTimeShadows\": true\n }\n },\n \"basic-balcony\": {\n \"meta\": {\n \"displayName\": \"Basic balcony\",\n \"category\": \"floor\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [3,3],\n \"colorDiffuse\": [0.5,0.5,0.5],\n \"colorSpecular\": [0.125,0.125,0.125],\n \"specularCoef\": 10,\n \"receiveRealTimeShadows\": true\n }\n },\n \"basic-wall\": {\n \"meta\": {\n \"displayName\": \"Basic wall\",\n \"category\": \"wall\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [3,3],\n \"colorDiffuse\": [0.839,0.839,0.839],\n \"colorSpecular\": [0.098,0.098,0.098],\n \"specularCoef\": 2\n }\n },\n \"basic-ceiling\": {\n \"meta\": {\n \"displayName\": \"Basic ceiling\",\n \"category\": \"ceiling\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [3,3],\n \"colorDiffuse\": [0.878,0.878,0.878],\n \"colorSpecular\": [0.125,0.125,0.125],\n \"specularCoef\": 10\n }\n },\n \"wood_parquet_oak\": {\n \"meta\": {\n \"displayName\": \"Parquet Oak\",\n \"category\": \"floor\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [3,3],\n \"colorDiffuse\": [0.89,0.82,0.69],\n \"colorSpecular\": [0.667,0.667,0.667],\n \"specularCoef\": 30,\n \"mapDiffuse\": \"archilogic/tex/c659ad823689f7502699105e6b8974f1.hi-res.gz.dds\",\n \"mapNormal\": \"archilogic/tex/671b2122630e5d1f7c2ebc864dd87f5c.hi-res.gz.dds\",\n \"mapSpecular\": \"archilogic/tex/a98a53f296ac58b8bde6a5fec57cd476.hi-res.gz.dds\",\n \"receiveRealTimeShadows\": true,\n \"mapDiffusePreview\": \"archilogic/tex/c659ad823689f7502699105e6b8974f1.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/c659ad823689f7502699105e6b8974f1.source.jpg\",\n \"mapSpecularPreview\": \"archilogic/tex/a98a53f296ac58b8bde6a5fec57cd476.lo-res.jpg\",\n \"mapSpecularSource\": \"archilogic/tex/a98a53f296ac58b8bde6a5fec57cd476.source.jpg\",\n \"mapNormalPreview\": \"archilogic/tex/671b2122630e5d1f7c2ebc864dd87f5c.lo-res.jpg\",\n \"mapNormalSource\": \"archilogic/tex/671b2122630e5d1f7c2ebc864dd87f5c.source.jpg\"\n }\n },\n \"wood_parquet_4\": {\n \"meta\": {\n \"displayName\": \"Parquet Stained Oak\",\n \"category\": \"floor\",\n \"showInMenu\": false\n },\n \"attributes\": {\n \"size\": [3,3],\n \"colorSpecular\": [0.45,0.45,0.45],\n \"specularCoef\": 30,\n \"mapDiffuse\": \"archilogic/tex/c659ad823689f7502699105e6b8974f1.hi-res.gz.dds\",\n \"mapNormal\": \"archilogic/tex/671b2122630e5d1f7c2ebc864dd87f5c.hi-res.gz.dds\",\n \"mapSpecular\": \"archilogic/tex/a98a53f296ac58b8bde6a5fec57cd476.hi-res.gz.dds\",\n \"receiveRealTimeShadows\": true,\n \"mapDiffusePreview\": \"archilogic/tex/c659ad823689f7502699105e6b8974f1.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/c659ad823689f7502699105e6b8974f1.source.jpg\",\n \"mapSpecularPreview\": \"archilogic/tex/a98a53f296ac58b8bde6a5fec57cd476.lo-res.jpg\",\n \"mapSpecularSource\": \"archilogic/tex/a98a53f296ac58b8bde6a5fec57cd476.source.jpg\",\n \"mapNormalPreview\": \"archilogic/tex/671b2122630e5d1f7c2ebc864dd87f5c.lo-res.jpg\",\n \"mapNormalSource\": \"archilogic/tex/671b2122630e5d1f7c2ebc864dd87f5c.source.jpg\"\n }\n },\n \"wood_parquet_oak_stained\": {\n \"meta\": {\n \"displayName\": \"Parquet Stained Oak\",\n \"category\": \"floor\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [3,3],\n \"colorDiffuse\": [ 0.906, 0.91,0.89],\n \"colorSpecular\": [0.667,0.667,0.667],\n \"specularCoef\": 30,\n \"mapDiffuse\": \"archilogic/tex/c659ad823689f7502699105e6b8974f1.hi-res.gz.dds\",\n \"mapNormal\": \"archilogic/tex/671b2122630e5d1f7c2ebc864dd87f5c.hi-res.gz.dds\",\n \"mapSpecular\": \"archilogic/tex/a98a53f296ac58b8bde6a5fec57cd476.hi-res.gz.dds\",\n \"receiveRealTimeShadows\": true,\n \"mapDiffusePreview\": \"archilogic/tex/c659ad823689f7502699105e6b8974f1.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/c659ad823689f7502699105e6b8974f1.source.jpg\",\n \"mapSpecularPreview\": \"archilogic/tex/a98a53f296ac58b8bde6a5fec57cd476.lo-res.jpg\",\n \"mapSpecularSource\": \"archilogic/tex/a98a53f296ac58b8bde6a5fec57cd476.source.jpg\",\n \"mapNormalPreview\": \"archilogic/tex/671b2122630e5d1f7c2ebc864dd87f5c.lo-res.jpg\",\n \"mapNormalSource\": \"archilogic/tex/671b2122630e5d1f7c2ebc864dd87f5c.source.jpg\"\n }\n },\n \"wood_parquet_oak_dark\": {\n \"meta\": {\n \"displayName\": \"Parquet Oak Dark\",\n \"category\": \"floor\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [3,3],\n \"colorDiffuse\": [ 0.463,0.412, 0.337],\n \"colorSpecular\": [0.667,0.667,0.667],\n \"specularCoef\": 30,\n \"mapDiffuse\": \"archilogic/tex/c659ad823689f7502699105e6b8974f1.hi-res.gz.dds\",\n \"mapNormal\": \"archilogic/tex/671b2122630e5d1f7c2ebc864dd87f5c.hi-res.gz.dds\",\n \"mapSpecular\": \"archilogic/tex/a98a53f296ac58b8bde6a5fec57cd476.hi-res.gz.dds\",\n \"receiveRealTimeShadows\": true,\n \"mapDiffusePreview\": \"archilogic/tex/c659ad823689f7502699105e6b8974f1.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/c659ad823689f7502699105e6b8974f1.source.jpg\",\n \"mapSpecularPreview\": \"archilogic/tex/a98a53f296ac58b8bde6a5fec57cd476.lo-res.jpg\",\n \"mapSpecularSource\": \"archilogic/tex/a98a53f296ac58b8bde6a5fec57cd476.source.jpg\",\n \"mapNormalPreview\": \"archilogic/tex/671b2122630e5d1f7c2ebc864dd87f5c.lo-res.jpg\",\n \"mapNormalSource\": \"archilogic/tex/671b2122630e5d1f7c2ebc864dd87f5c.source.jpg\"\n }\n },\n \"wood_parquet_oak_black\": {\n \"meta\": {\n \"displayName\": \"Parquet Oak Black\",\n \"category\": \"floor\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [3,3],\n \"colorDiffuse\": [0.204,0.176,0.137],\n \"colorSpecular\": [0.667,0.667,0.667],\n \"specularCoef\": 30,\n \"mapDiffuse\": \"archilogic/tex/c659ad823689f7502699105e6b8974f1.hi-res.gz.dds\",\n \"mapNormal\": \"archilogic/tex/671b2122630e5d1f7c2ebc864dd87f5c.hi-res.gz.dds\",\n \"mapSpecular\": \"archilogic/tex/a98a53f296ac58b8bde6a5fec57cd476.hi-res.gz.dds\",\n \"receiveRealTimeShadows\": true,\n \"mapDiffusePreview\": \"archilogic/tex/c659ad823689f7502699105e6b8974f1.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/c659ad823689f7502699105e6b8974f1.source.jpg\",\n \"mapSpecularPreview\": \"archilogic/tex/a98a53f296ac58b8bde6a5fec57cd476.lo-res.jpg\",\n \"mapSpecularSource\": \"archilogic/tex/a98a53f296ac58b8bde6a5fec57cd476.source.jpg\",\n \"mapNormalPreview\": \"archilogic/tex/671b2122630e5d1f7c2ebc864dd87f5c.lo-res.jpg\",\n \"mapNormalSource\": \"archilogic/tex/671b2122630e5d1f7c2ebc864dd87f5c.source.jpg\"\n }\n },\n \"floor_oak_parquet\": {\n \"meta\": {\n \"displayName\": \"Parquet Herringbone\",\n \"category\": \"floor\",\n \"showInMenu\": false\n },\n \"attributes\": {\n \"size\": [3.3,3.5],\n \"specularCoef\": 40,\n \"mapDiffuse\": \"archilogic/tex/b63633f00674bd2317c40c90b7ec30b9.hi-res.gz.dds\",\n \"receiveRealTimeShadows\": true,\n \"mapDiffusePreview\": \"archilogic/tex/b63633f00674bd2317c40c90b7ec30b9.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/b63633f00674bd2317c40c90b7ec30b9.source.jpg\"\n }\n },\n \"parquet_heringbone_oak\": {\n \"meta\": {\n \"displayName\": \"Parquet Herringbone Oak\",\n \"category\": \"floor\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [3,3],\n \"colorSpecular\": [0.188,0.188,0.188],\n \"specularCoef\": 30,\n \"mapDiffuse\": \"archilogic/tex/87e4c3ef437932b07adfc132b2b58d00.hi-res.gz.dds\",\n \"mapNormal\": \"archilogic/tex/9e3128f1785cc3355b178702816024b1.hi-res.gz.dds\",\n \"mapSpecular\": \"archilogic/tex/82b49d5fedede1707f8015b2987bd0b8.hi-res.gz.dds\",\n \"receiveRealTimeShadows\": true,\n \"mapDiffusePreview\": \"archilogic/tex/87e4c3ef437932b07adfc132b2b58d00.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/87e4c3ef437932b07adfc132b2b58d00.source.jpg\",\n \"mapSpecularPreview\": \"archilogic/tex/82b49d5fedede1707f8015b2987bd0b8.lo-res.jpg\",\n \"mapSpecularSource\": \"archilogic/tex/82b49d5fedede1707f8015b2987bd0b8.source.jpg\",\n \"mapNormalPreview\": \"archilogic/tex/9e3128f1785cc3355b178702816024b1.lo-res.jpg\",\n \"mapNormalSource\": \"archilogic/tex/9e3128f1785cc3355b178702816024b1.source.jpg\"\n }\n },\n \"parquet_tiles_01\": {\n \"meta\": {\n \"displayName\": \"Parquet Tiles\",\n \"category\": \"floor\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [1.5,1.5],\n \"colorSpecular\": [0.376,0.376,0.376],\n \"specularCoef\": 30,\n \"mapDiffuse\": \"archilogic/tex/3727a4b6bae77be55d2ce2b2de033a5b.hi-res.gz.dds\",\n \"mapNormal\": \"archilogic/tex/dc9143fbf3e7df6c5ff67d9b12bdc2e7.hi-res.gz.dds\",\n \"mapSpecular\": \"archilogic/tex/e3fc1d6cdf6bfd30f805c25b72fcea65.hi-res.gz.dds\",\n \"receiveRealTimeShadows\": true,\n \"mapDiffusePreview\": \"archilogic/tex/3727a4b6bae77be55d2ce2b2de033a5b.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/3727a4b6bae77be55d2ce2b2de033a5b.source.jpg\",\n \"mapSpecularPreview\": \"archilogic/tex/e3fc1d6cdf6bfd30f805c25b72fcea65.lo-res.jpg\",\n \"mapSpecularSource\": \"archilogic/tex/e3fc1d6cdf6bfd30f805c25b72fcea65.source.jpg\",\n \"mapNormalPreview\": \"archilogic/tex/dc9143fbf3e7df6c5ff67d9b12bdc2e7.lo-res.jpg\",\n \"mapNormalSource\": \"archilogic/tex/dc9143fbf3e7df6c5ff67d9b12bdc2e7.source.jpg\"\n }\n },\n \"wood_parquet\": {\n \"meta\": {\n \"displayName\": \"Parquet 2\",\n \"category\": \"floor\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [3,3],\n \"colorSpecular\": [0.376,0.376,0.376],\n \"specularCoef\": 40,\n \"mapDiffuse\": \"archilogic/tex/23fecde666551205efd5469b10dbcc57.hi-res.gz.dds\",\n \"mapNormal\": \"archilogic/tex/7339da972d8f15d586f849ff7b7ca455.hi-res.gz.dds\",\n \"mapSpecular\": \"archilogic/tex/076bf25a31aac947867fc15afdfa4a6c.hi-res.gz.dds\",\n \"receiveRealTimeShadows\": true,\n \"mapDiffusePreview\": \"archilogic/tex/23fecde666551205efd5469b10dbcc57.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/23fecde666551205efd5469b10dbcc57.source.png\",\n \"mapSpecularPreview\": \"archilogic/tex/076bf25a31aac947867fc15afdfa4a6c.lo-res.jpg\",\n \"mapSpecularSource\": \"archilogic/tex/076bf25a31aac947867fc15afdfa4a6c.source.png\",\n \"mapNormalPreview\": \"archilogic/tex/7339da972d8f15d586f849ff7b7ca455.lo-res.jpg\",\n \"mapNormalSource\": \"archilogic/tex/7339da972d8f15d586f849ff7b7ca455.source.png\"\n }\n },\n \"wood_parquet_3\": {\n \"meta\": {\n \"displayName\": \"Parquet 3\",\n \"category\": \"floor\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [2,2],\n \"colorSpecular\": [0.667,0.667,0.667],\n \"mapDiffuse\": \"archilogic/tex/47204e093a6ac04f6ac3467fb78efc46.hi-res.gz.dds\",\n \"mapNormal\": \"archilogic/tex/f4bee6370d34d5616e4693aa39287efd.hi-res.gz.dds\",\n \"mapSpecular\": \"archilogic/tex/22dacd7e3ed1e454bddb88f321fd1315.hi-res.gz.dds\",\n \"receiveRealTimeShadows\": true,\n \"mapDiffusePreview\": \"archilogic/tex/47204e093a6ac04f6ac3467fb78efc46.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/47204e093a6ac04f6ac3467fb78efc46.source.png\",\n \"mapSpecularPreview\": \"archilogic/tex/22dacd7e3ed1e454bddb88f321fd1315.lo-res.jpg\",\n \"mapSpecularSource\": \"archilogic/tex/22dacd7e3ed1e454bddb88f321fd1315.source.png\",\n \"mapNormalPreview\": \"archilogic/tex/f4bee6370d34d5616e4693aa39287efd.lo-res.jpg\",\n \"mapNormalSource\": \"archilogic/tex/f4bee6370d34d5616e4693aa39287efd.source.png\"\n }\n },\n \"parquet_dark_01\": {\n \"meta\": {\n \"displayName\": \"Parquet Dark\",\n \"category\": \"floor\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [2,2],\n \"colorSpecular\": [0.4,0.4,0.4],\n \"specularCoef\": 40,\n \"mapDiffuse\": \"archilogic/tex/c5a58ec7d86d3641cf77c661c0fdf500.hi-res.gz.dds\",\n \"mapNormal\": \"archilogic/tex/f4bee6370d34d5616e4693aa39287efd.hi-res.gz.dds\",\n \"mapSpecular\": \"archilogic/tex/22dacd7e3ed1e454bddb88f321fd1315.hi-res.gz.dds\",\n \"receiveRealTimeShadows\": true,\n \"mapDiffusePreview\": \"archilogic/tex/c5a58ec7d86d3641cf77c661c0fdf500.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/c5a58ec7d86d3641cf77c661c0fdf500.source.png\",\n \"mapSpecularPreview\": \"archilogic/tex/22dacd7e3ed1e454bddb88f321fd1315.lo-res.jpg\",\n \"mapSpecularSource\": \"archilogic/tex/22dacd7e3ed1e454bddb88f321fd1315.source.png\",\n \"mapNormalPreview\": \"archilogic/tex/f4bee6370d34d5616e4693aa39287efd.lo-res.jpg\",\n \"mapNormalSource\": \"archilogic/tex/f4bee6370d34d5616e4693aa39287efd.source.png\"\n }\n },\n \"fitted_carpet_light_grey\": {\n \"meta\": {\n \"displayName\": \"Fitted Carpet Light Grey\",\n \"category\": \"floor\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [2,2],\n \"colorSpecular\": [0.6,0.6,0.6],\n \"specularCoef\": 40,\n \"mapDiffuse\": \"archilogic/tex/acdcd29e06d541f25ab8e60d3d3f9a85.hi-res.gz.dds\",\n \"mapNormal\": \"archilogic/tex/7d425fc857c256bfa8a06ac48208078f.hi-res.gz.dds\",\n \"mapSpecular\": \"archilogic/tex/2d373be23d2925ecab0d809e14734c5a.hi-res.gz.dds\",\n \"receiveRealTimeShadows\": true,\n \"mapDiffusePreview\": \"archilogic/tex/acdcd29e06d541f25ab8e60d3d3f9a85.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/acdcd29e06d541f25ab8e60d3d3f9a85.source.jpg\",\n \"mapSpecularPreview\": \"archilogic/tex/2d373be23d2925ecab0d809e14734c5a.lo-res.jpg\",\n \"mapSpecularSource\": \"archilogic/tex/2d373be23d2925ecab0d809e14734c5a.source.jpg\",\n \"mapNormalPreview\": \"archilogic/tex/7d425fc857c256bfa8a06ac48208078f.lo-res.jpg\",\n \"mapNormalSource\": \"archilogic/tex/7d425fc857c256bfa8a06ac48208078f.source.jpg\"\n }\n },\n \"floor_concrete_001\": {\n \"meta\": {\n \"displayName\": \"Floor Concrete 001\",\n \"category\": \"floor\",\n \"showInMenu\": false\n },\n \"attributes\": {\n \"size\": [4,4],\n \"colorSpecular\": [0.063,0.063,0.063],\n \"specularCoef\": 30,\n \"mapDiffuse\": \"archilogic/tex/3fdde165b96f531f1f4ff81ccd7b38c4.hi-res.gz.dds\",\n \"receiveRealTimeShadows\": true,\n \"mapDiffusePreview\": \"archilogic/tex/3fdde165b96f531f1f4ff81ccd7b38c4.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/3fdde165b96f531f1f4ff81ccd7b38c4.source.jpg\"\n }\n },\n \"floor_concrete_001_ceiling\": {\n \"meta\": {\n \"displayName\": \"Floor Concrete 001\",\n \"category\": \"ceiling\",\n \"showInMenu\": false\n },\n \"attributes\": {\n \"size\": [4,4],\n \"colorSpecular\": [0.063,0.063,0.063],\n \"specularCoef\": 30,\n \"mapDiffuse\": \"archilogic/tex/3fdde165b96f531f1f4ff81ccd7b38c4.hi-res.gz.dds\",\n \"mapDiffusePreview\": \"archilogic/tex/3fdde165b96f531f1f4ff81ccd7b38c4.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/3fdde165b96f531f1f4ff81ccd7b38c4.source.jpg\"\n }\n },\n \"concrete_fluid\": {\n \"meta\": {\n \"displayName\": \"Concrete Natural\",\n \"category\": \"floor\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [2,2],\n \"colorDiffuse\": [0.867,0.867,0.867],\n \"colorSpecular\": [0.537,0.537,0.537],\n \"specularCoef\": 40,\n \"mapDiffuse\": \"archilogic/tex/7af78308b190531d128c71e3482e21ea.hi-res.gz.dds\",\n \"mapNormal\": \"archilogic/tex/f544850902a92746d30d0b80bda43c62.hi-res.gz.dds\",\n \"mapSpecular\": \"archilogic/tex/34b87f4d4d1b6d89b370862e243ebf12.hi-res.gz.dds\",\n \"receiveRealTimeShadows\": true,\n \"mapDiffusePreview\": \"archilogic/tex/7af78308b190531d128c71e3482e21ea.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/7af78308b190531d128c71e3482e21ea.source.jpg\",\n \"mapSpecularPreview\": \"archilogic/tex/34b87f4d4d1b6d89b370862e243ebf12.lo-res.jpg\",\n \"mapSpecularSource\": \"archilogic/tex/34b87f4d4d1b6d89b370862e243ebf12.source.jpg\",\n \"mapNormalPreview\": \"archilogic/tex/f544850902a92746d30d0b80bda43c62.lo-res.jpg\",\n \"mapNormalSource\": \"archilogic/tex/f544850902a92746d30d0b80bda43c62.source.jpg\"\n }\n },\n \"concrete_beige\": {\n \"meta\": {\n \"displayName\": \"Concrete Beige\",\n \"category\": \"floor\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [2,2],\n \"colorSpecular\": [0.537,0.537,0.537],\n \"specularCoef\": 40,\n \"mapDiffuse\": \"archilogic/tex/5b293c62b59fd9a56122244d7d4ce13d.hi-res.gz.dds\",\n \"mapNormal\": \"archilogic/tex/f544850902a92746d30d0b80bda43c62.hi-res.gz.dds\",\n \"mapSpecular\": \"archilogic/tex/34b87f4d4d1b6d89b370862e243ebf12.hi-res.gz.dds\",\n \"receiveRealTimeShadows\": true,\n \"mapDiffusePreview\": \"archilogic/tex/5b293c62b59fd9a56122244d7d4ce13d.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/5b293c62b59fd9a56122244d7d4ce13d.source.jpg\",\n \"mapSpecularPreview\": \"archilogic/tex/34b87f4d4d1b6d89b370862e243ebf12.lo-res.jpg\",\n \"mapSpecularSource\": \"archilogic/tex/34b87f4d4d1b6d89b370862e243ebf12.source.jpg\",\n \"mapNormalPreview\": \"archilogic/tex/f544850902a92746d30d0b80bda43c62.lo-res.jpg\",\n \"mapNormalSource\": \"archilogic/tex/f544850902a92746d30d0b80bda43c62.source.jpg\"\n }\n },\n \"concrete_beige_ceiling\": {\n \"meta\": {\n \"displayName\": \"Concrete Beige\",\n \"category\": \"ceiling\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [2,2],\n \"colorSpecular\": [0.537,0.537,0.537],\n \"specularCoef\": 40,\n \"mapDiffuse\": \"archilogic/tex/5b293c62b59fd9a56122244d7d4ce13d.hi-res.gz.dds\",\n \"mapNormal\": \"archilogic/tex/f544850902a92746d30d0b80bda43c62.hi-res.gz.dds\",\n \"mapSpecular\": \"archilogic/tex/34b87f4d4d1b6d89b370862e243ebf12.hi-res.gz.dds\",\n \"mapDiffusePreview\": \"archilogic/tex/5b293c62b59fd9a56122244d7d4ce13d.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/5b293c62b59fd9a56122244d7d4ce13d.source.jpg\",\n \"mapSpecularPreview\": \"archilogic/tex/34b87f4d4d1b6d89b370862e243ebf12.lo-res.jpg\",\n \"mapSpecularSource\": \"archilogic/tex/34b87f4d4d1b6d89b370862e243ebf12.source.jpg\",\n \"mapNormalPreview\": \"archilogic/tex/f544850902a92746d30d0b80bda43c62.lo-res.jpg\",\n \"mapNormalSource\": \"archilogic/tex/f544850902a92746d30d0b80bda43c62.source.jpg\"\n }\n },\n \"concrete_dark\": {\n \"meta\": {\n \"displayName\": \"Concrete Dark\",\n \"category\": \"floor\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [2,2],\n \"colorSpecular\": [0.537,0.537,0.537],\n \"specularCoef\": 40,\n \"mapDiffuse\": \"archilogic/tex/e533a34333f62a4999a50e4ddf00a898.hi-res.gz.dds\",\n \"mapNormal\": \"archilogic/tex/f544850902a92746d30d0b80bda43c62.hi-res.gz.dds\",\n \"mapSpecular\": \"archilogic/tex/34b87f4d4d1b6d89b370862e243ebf12.hi-res.gz.dds\",\n \"receiveRealTimeShadows\": true,\n \"mapDiffusePreview\": \"archilogic/tex/e533a34333f62a4999a50e4ddf00a898.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/e533a34333f62a4999a50e4ddf00a898.source.jpg\",\n \"mapSpecularPreview\": \"archilogic/tex/34b87f4d4d1b6d89b370862e243ebf12.lo-res.jpg\",\n \"mapSpecularSource\": \"archilogic/tex/34b87f4d4d1b6d89b370862e243ebf12.source.jpg\",\n \"mapNormalPreview\": \"archilogic/tex/f544850902a92746d30d0b80bda43c62.lo-res.jpg\",\n \"mapNormalSource\": \"archilogic/tex/f544850902a92746d30d0b80bda43c62.source.jpg\"\n }\n },\n \"concrete_dark_ceiling\": {\n \"meta\": {\n \"displayName\": \"Concrete Dark\",\n \"category\": \"ceiling\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [2,2],\n \"colorSpecular\": [0.537,0.537,0.537],\n \"specularCoef\": 40,\n \"mapDiffuse\": \"archilogic/tex/e533a34333f62a4999a50e4ddf00a898.hi-res.gz.dds\",\n \"mapNormal\": \"archilogic/tex/f544850902a92746d30d0b80bda43c62.hi-res.gz.dds\",\n \"mapSpecular\": \"archilogic/tex/34b87f4d4d1b6d89b370862e243ebf12.hi-res.gz.dds\",\n \"mapDiffusePreview\": \"archilogic/tex/e533a34333f62a4999a50e4ddf00a898.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/e533a34333f62a4999a50e4ddf00a898.source.jpg\",\n \"mapSpecularPreview\": \"archilogic/tex/34b87f4d4d1b6d89b370862e243ebf12.lo-res.jpg\",\n \"mapSpecularSource\": \"archilogic/tex/34b87f4d4d1b6d89b370862e243ebf12.source.jpg\",\n \"mapNormalPreview\": \"archilogic/tex/f544850902a92746d30d0b80bda43c62.lo-res.jpg\",\n \"mapNormalSource\": \"archilogic/tex/f544850902a92746d30d0b80bda43c62.source.jpg\"\n }\n },\n \"concrete_black\": {\n \"meta\": {\n \"displayName\": \"Concrete Black\",\n \"category\": \"floor\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [2,2],\n \"colorSpecular\": [0.537,0.537,0.537],\n \"specularCoef\": 40,\n \"mapDiffuse\": \"archilogic/tex/7304a447edb67785758a328b5e9770c8.hi-res.gz.dds\",\n \"mapNormal\": \"archilogic/tex/f544850902a92746d30d0b80bda43c62.hi-res.gz.dds\",\n \"mapSpecular\": \"archilogic/tex/34b87f4d4d1b6d89b370862e243ebf12.hi-res.gz.dds\",\n \"receiveRealTimeShadows\": true,\n \"mapDiffusePreview\": \"archilogic/tex/7304a447edb67785758a328b5e9770c8.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/7304a447edb67785758a328b5e9770c8.source.jpg\",\n \"mapSpecularPreview\": \"archilogic/tex/34b87f4d4d1b6d89b370862e243ebf12.lo-res.jpg\",\n \"mapSpecularSource\": \"archilogic/tex/34b87f4d4d1b6d89b370862e243ebf12.source.jpg\",\n \"mapNormalPreview\": \"archilogic/tex/f544850902a92746d30d0b80bda43c62.lo-res.jpg\",\n \"mapNormalSource\": \"archilogic/tex/f544850902a92746d30d0b80bda43c62.source.jpg\"\n }\n },\n \"concrete_black_ceiling\": {\n \"meta\": {\n \"displayName\": \"Concrete Black\",\n \"category\": \"ceiling\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [2,2],\n \"colorSpecular\": [0.537,0.537,0.537],\n \"specularCoef\": 40,\n \"mapDiffuse\": \"archilogic/tex/7304a447edb67785758a328b5e9770c8.hi-res.gz.dds\",\n \"mapNormal\": \"archilogic/tex/f544850902a92746d30d0b80bda43c62.hi-res.gz.dds\",\n \"mapSpecular\": \"archilogic/tex/34b87f4d4d1b6d89b370862e243ebf12.hi-res.gz.dds\",\n \"mapDiffusePreview\": \"archilogic/tex/7304a447edb67785758a328b5e9770c8.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/7304a447edb67785758a328b5e9770c8.source.jpg\",\n \"mapSpecularPreview\": \"archilogic/tex/34b87f4d4d1b6d89b370862e243ebf12.lo-res.jpg\",\n \"mapSpecularSource\": \"archilogic/tex/34b87f4d4d1b6d89b370862e243ebf12.source.jpg\",\n \"mapNormalPreview\": \"archilogic/tex/f544850902a92746d30d0b80bda43c62.lo-res.jpg\",\n \"mapNormalSource\": \"archilogic/tex/f544850902a92746d30d0b80bda43c62.source.jpg\"\n }\n },\n \"default_plaster_001\": {\n \"meta\": {\n \"displayName\": \"Plaster Rough\",\n \"category\": \"wall\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [0.5,0.5],\n \"specularCoef\": 20,\n \"mapDiffuse\": \"archilogic/tex/278b6dee7782d3ca882d8dd8b0dcd85c.hi-res.gz.dds\",\n \"mapNormal\": \"archilogic/tex/79542e108b0ff7749e4c3df25ad96267.hi-res.gz.dds\",\n \"mapSpecular\": \"archilogic/tex/d4460b4a6f82d9cd693db900dd547ee2.hi-res.gz.dds\",\n \"mapDiffusePreview\": \"archilogic/tex/278b6dee7782d3ca882d8dd8b0dcd85c.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/278b6dee7782d3ca882d8dd8b0dcd85c.source.jpg\",\n \"mapSpecularPreview\": \"archilogic/tex/d4460b4a6f82d9cd693db900dd547ee2.lo-res.jpg\",\n \"mapSpecularSource\": \"archilogic/tex/d4460b4a6f82d9cd693db900dd547ee2.source.jpg\",\n \"mapNormalPreview\": \"archilogic/tex/79542e108b0ff7749e4c3df25ad96267.lo-res.jpg\",\n \"mapNormalSource\": \"archilogic/tex/79542e108b0ff7749e4c3df25ad96267.source.jpg\"\n }\n },\n \"default_plaster_001_ceiling\": {\n \"meta\": {\n \"displayName\": \"Plaster Rough\",\n \"category\": \"ceiling\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [0.5,0.5],\n \"specularCoef\": 20,\n \"mapDiffuse\": \"archilogic/tex/278b6dee7782d3ca882d8dd8b0dcd85c.hi-res.gz.dds\",\n \"mapNormal\": \"archilogic/tex/79542e108b0ff7749e4c3df25ad96267.hi-res.gz.dds\",\n \"mapSpecular\": \"archilogic/tex/d4460b4a6f82d9cd693db900dd547ee2.hi-res.gz.dds\",\n \"mapDiffusePreview\": \"archilogic/tex/278b6dee7782d3ca882d8dd8b0dcd85c.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/278b6dee7782d3ca882d8dd8b0dcd85c.source.jpg\",\n \"mapSpecularPreview\": \"archilogic/tex/d4460b4a6f82d9cd693db900dd547ee2.lo-res.jpg\",\n \"mapSpecularSource\": \"archilogic/tex/d4460b4a6f82d9cd693db900dd547ee2.source.jpg\",\n \"mapNormalPreview\": \"archilogic/tex/79542e108b0ff7749e4c3df25ad96267.lo-res.jpg\",\n \"mapNormalSource\": \"archilogic/tex/79542e108b0ff7749e4c3df25ad96267.source.jpg\"\n }\n },\n \"plaster_smooth\": {\n \"meta\": {\n \"displayName\": \"Plaster Smooth\",\n \"category\": \"wall\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [0.3,0.3],\n \"specularCoef\": 20,\n \"mapDiffuse\": \"archilogic/tex/1c6397e5715169b6b024c8645cf2efdc.hi-res.gz.dds\",\n \"mapNormal\": \"archilogic/tex/79542e108b0ff7749e4c3df25ad96267.hi-res.gz.dds\",\n \"mapSpecular\": \"archilogic/tex/d4460b4a6f82d9cd693db900dd547ee2.hi-res.gz.dds\",\n \"mapDiffusePreview\": \"archilogic/tex/1c6397e5715169b6b024c8645cf2efdc.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/1c6397e5715169b6b024c8645cf2efdc.source.jpg\",\n \"mapSpecularPreview\": \"archilogic/tex/d4460b4a6f82d9cd693db900dd547ee2.lo-res.jpg\",\n \"mapSpecularSource\": \"archilogic/tex/d4460b4a6f82d9cd693db900dd547ee2.source.jpg\",\n \"mapNormalPreview\": \"archilogic/tex/79542e108b0ff7749e4c3df25ad96267.lo-res.jpg\",\n \"mapNormalSource\": \"archilogic/tex/79542e108b0ff7749e4c3df25ad96267.source.jpg\"\n }\n },\n \"plaster_smooth_ceiling\": {\n \"meta\": {\n \"displayName\": \"Plaster Smooth\",\n \"category\": \"ceiling\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [0.3,0.3],\n \"specularCoef\": 20,\n \"mapDiffuse\": \"archilogic/tex/1c6397e5715169b6b024c8645cf2efdc.hi-res.gz.dds\",\n \"mapNormal\": \"archilogic/tex/79542e108b0ff7749e4c3df25ad96267.hi-res.gz.dds\",\n \"mapSpecular\": \"archilogic/tex/d4460b4a6f82d9cd693db900dd547ee2.hi-res.gz.dds\",\n \"mapDiffusePreview\": \"archilogic/tex/1c6397e5715169b6b024c8645cf2efdc.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/1c6397e5715169b6b024c8645cf2efdc.source.jpg\",\n \"mapSpecularPreview\": \"archilogic/tex/d4460b4a6f82d9cd693db900dd547ee2.lo-res.jpg\",\n \"mapSpecularSource\": \"archilogic/tex/d4460b4a6f82d9cd693db900dd547ee2.source.jpg\",\n \"mapNormalPreview\": \"archilogic/tex/79542e108b0ff7749e4c3df25ad96267.lo-res.jpg\",\n \"mapNormalSource\": \"archilogic/tex/79542e108b0ff7749e4c3df25ad96267.source.jpg\"\n }\n },\n \"tiles-white-large\": {\n \"meta\": {\n \"displayName\": \"Tiles Square White\",\n \"category\": \"floor\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [1,1],\n \"colorDiffuse\": [0.976,0.976,0.976],\n \"colorSpecular\": [0.251,0.251,0.251],\n \"specularCoef\": 30,\n \"mapDiffuse\": \"archilogic/tex/0b4ecca17b840beb219e32bceb21ffc3.hi-res.gz.dds\",\n \"mapNormal\": \"archilogic/tex/627ac2ca3cab7e2790b36c97cd58e243.hi-res.gz.dds\",\n \"mapSpecular\": \"archilogic/tex/bd83b5c8611c3bbe71d61f9b2c57b45f.hi-res.gz.dds\",\n \"receiveRealTimeShadows\": true,\n \"mapDiffusePreview\": \"archilogic/tex/0b4ecca17b840beb219e32bceb21ffc3.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/0b4ecca17b840beb219e32bceb21ffc3.source.jpg\",\n \"mapSpecularPreview\": \"archilogic/tex/bd83b5c8611c3bbe71d61f9b2c57b45f.lo-res.jpg\",\n \"mapSpecularSource\": \"archilogic/tex/bd83b5c8611c3bbe71d61f9b2c57b45f.source.jpg\",\n \"mapNormalPreview\": \"archilogic/tex/627ac2ca3cab7e2790b36c97cd58e243.lo-res.jpg\",\n \"mapNormalSource\": \"archilogic/tex/627ac2ca3cab7e2790b36c97cd58e243.source.jpg\"\n }\n },\n \"tiles-dark-large\": {\n \"meta\": {\n \"displayName\": \"Tiles Square Anthrazit\",\n \"category\": \"floor\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [1,1],\n \"colorSpecular\": [0.4,0.4,0.4],\n \"specularCoef\": 50,\n \"mapDiffuse\": \"archilogic/tex/8aa2417d8bc9c6bb1d80db87bc409c9f.hi-res.gz.dds\",\n \"mapNormal\": \"archilogic/tex/dcc25defadefce42ac0dde87d6060150.hi-res.gz.dds\",\n \"mapSpecular\": \"archilogic/tex/14398cecb6ce505232a7c7ed5644b07a.hi-res.gz.dds\",\n \"receiveRealTimeShadows\": true,\n \"mapDiffusePreview\": \"archilogic/tex/8aa2417d8bc9c6bb1d80db87bc409c9f.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/8aa2417d8bc9c6bb1d80db87bc409c9f.source.jpg\",\n \"mapSpecularPreview\": \"archilogic/tex/14398cecb6ce505232a7c7ed5644b07a.lo-res.jpg\",\n \"mapSpecularSource\": \"archilogic/tex/14398cecb6ce505232a7c7ed5644b07a.source.jpg\",\n \"mapNormalPreview\": \"archilogic/tex/dcc25defadefce42ac0dde87d6060150.lo-res.jpg\",\n \"mapNormalSource\": \"archilogic/tex/dcc25defadefce42ac0dde87d6060150.source.jpg\"\n }\n },\n \"tiles_large_rect_white\": {\n \"meta\": {\n \"displayName\": \"Tiles Rectangle White\",\n \"category\": \"wall\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [1,1],\n \"colorSpecular\": [0.025,0.025,0.025],\n \"specularCoef\": 50,\n \"mapDiffuse\": \"archilogic/tex/d8572227e2a76395a528e0462cf5b895.hi-res.gz.dds\",\n \"mapNormal\": \"archilogic/tex/af2ce3936272199e72b91a52cd032d38.hi-res.gz.dds\",\n \"mapSpecular\": \"archilogic/tex/ade515c7810e38629f1c5992570d5c44.hi-res.gz.dds\",\n \"mapDiffusePreview\": \"archilogic/tex/d8572227e2a76395a528e0462cf5b895.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/d8572227e2a76395a528e0462cf5b895.source.jpg\",\n \"mapSpecularPreview\": \"archilogic/tex/ade515c7810e38629f1c5992570d5c44.lo-res.jpg\",\n \"mapSpecularSource\": \"archilogic/tex/ade515c7810e38629f1c5992570d5c44.source.jpg\",\n \"mapNormalPreview\": \"archilogic/tex/af2ce3936272199e72b91a52cd032d38.lo-res.jpg\",\n \"mapNormalSource\": \"archilogic/tex/af2ce3936272199e72b91a52cd032d38.source.jpg\"\n }\n },\n \"tiles_large_rect_white_floor\": {\n \"meta\": {\n \"displayName\": \"Tiles Rectangle White\",\n \"category\": \"floor\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [1,1],\n \"colorSpecular\": [0.025,0.025,0.025],\n \"specularCoef\": 50,\n \"mapDiffuse\": \"archilogic/tex/d8572227e2a76395a528e0462cf5b895.hi-res.gz.dds\",\n \"mapNormal\": \"archilogic/tex/af2ce3936272199e72b91a52cd032d38.hi-res.gz.dds\",\n \"mapSpecular\": \"archilogic/tex/ade515c7810e38629f1c5992570d5c44.hi-res.gz.dds\",\n \"receiveRealTimeShadows\": true,\n \"mapDiffusePreview\": \"archilogic/tex/d8572227e2a76395a528e0462cf5b895.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/d8572227e2a76395a528e0462cf5b895.source.jpg\",\n \"mapSpecularPreview\": \"archilogic/tex/ade515c7810e38629f1c5992570d5c44.lo-res.jpg\",\n \"mapSpecularSource\": \"archilogic/tex/ade515c7810e38629f1c5992570d5c44.source.jpg\",\n \"mapNormalPreview\": \"archilogic/tex/af2ce3936272199e72b91a52cd032d38.lo-res.jpg\",\n \"mapNormalSource\": \"archilogic/tex/af2ce3936272199e72b91a52cd032d38.source.jpg\"\n }\n },\n \"tiles_large_rect_grey\": {\n \"meta\": {\n \"displayName\": \"Tiles Rectangle Grey\",\n \"category\": \"wall\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [1,1],\n \"colorSpecular\": [0.03,0.03,0.03],\n \"specularCoef\": 50,\n \"mapDiffuse\": \"archilogic/tex/0921c5463ce717013b12f45418f8a81f.hi-res.gz.dds\",\n \"mapNormal\": \"archilogic/tex/af2ce3936272199e72b91a52cd032d38.hi-res.gz.dds\",\n \"mapSpecular\": \"archilogic/tex/ade515c7810e38629f1c5992570d5c44.hi-res.gz.dds\",\n \"mapDiffusePreview\": \"archilogic/tex/0921c5463ce717013b12f45418f8a81f.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/0921c5463ce717013b12f45418f8a81f.source.jpg\",\n \"mapSpecularPreview\": \"archilogic/tex/ade515c7810e38629f1c5992570d5c44.lo-res.jpg\",\n \"mapSpecularSource\": \"archilogic/tex/ade515c7810e38629f1c5992570d5c44.source.jpg\",\n \"mapNormalPreview\": \"archilogic/tex/af2ce3936272199e72b91a52cd032d38.lo-res.jpg\",\n \"mapNormalSource\": \"archilogic/tex/af2ce3936272199e72b91a52cd032d38.source.jpg\"\n }\n },\n \"tiles_large_rect_grey_floor\": {\n \"meta\": {\n \"displayName\": \"Tiles Rectangle Grey\",\n \"category\": \"floor\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [1,1],\n \"colorSpecular\": [0.03,0.03,0.03],\n \"specularCoef\": 50,\n \"mapDiffuse\": \"archilogic/tex/0921c5463ce717013b12f45418f8a81f.hi-res.gz.dds\",\n \"mapNormal\": \"archilogic/tex/af2ce3936272199e72b91a52cd032d38.hi-res.gz.dds\",\n \"mapSpecular\": \"archilogic/tex/ade515c7810e38629f1c5992570d5c44.hi-res.gz.dds\",\n \"receiveRealTimeShadows\": true,\n \"mapDiffusePreview\": \"archilogic/tex/0921c5463ce717013b12f45418f8a81f.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/0921c5463ce717013b12f45418f8a81f.source.jpg\",\n \"mapSpecularPreview\": \"archilogic/tex/ade515c7810e38629f1c5992570d5c44.lo-res.jpg\",\n \"mapSpecularSource\": \"archilogic/tex/ade515c7810e38629f1c5992570d5c44.source.jpg\",\n \"mapNormalPreview\": \"archilogic/tex/af2ce3936272199e72b91a52cd032d38.lo-res.jpg\",\n \"mapNormalSource\": \"archilogic/tex/af2ce3936272199e72b91a52cd032d38.source.jpg\"\n }\n },\n \"tiles_large_shifted_sand\": {\n \"meta\": {\n \"displayName\": \"Tiles Shifted Sand\",\n \"category\": \"wall\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [2,2],\n \"colorSpecular\": [0.25,0.25,0.25],\n \"specularCoef\": 50,\n \"mapDiffuse\": \"archilogic/tex/f0d0f3f85673051179bf44bfce706efd.hi-res.gz.dds\",\n \"mapNormal\": \"archilogic/tex/6d3096b1dbb5c9ae16f9cae41c08c86f.hi-res.gz.dds\",\n \"mapSpecular\": \"archilogic/tex/8e1e6a287c1930134639a7b4236bd552.hi-res.gz.dds\",\n \"mapDiffusePreview\": \"archilogic/tex/f0d0f3f85673051179bf44bfce706efd.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/f0d0f3f85673051179bf44bfce706efd.source.jpg\",\n \"mapSpecularPreview\": \"archilogic/tex/8e1e6a287c1930134639a7b4236bd552.lo-res.jpg\",\n \"mapSpecularSource\": \"archilogic/tex/8e1e6a287c1930134639a7b4236bd552.source.jpg\",\n \"mapNormalPreview\": \"archilogic/tex/6d3096b1dbb5c9ae16f9cae41c08c86f.lo-res.jpg\",\n \"mapNormalSource\": \"archilogic/tex/6d3096b1dbb5c9ae16f9cae41c08c86f.source.jpg\"\n }\n },\n \"tiles_large_shifted_sand_floor\": {\n \"meta\": {\n \"displayName\": \"Tiles Shifted Sand\",\n \"category\": \"floor\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [2,2],\n \"colorSpecular\": [0.25,0.25,0.25],\n \"specularCoef\": 50,\n \"mapDiffuse\": \"archilogic/tex/f0d0f3f85673051179bf44bfce706efd.hi-res.gz.dds\",\n \"mapNormal\": \"archilogic/tex/6d3096b1dbb5c9ae16f9cae41c08c86f.hi-res.gz.dds\",\n \"mapSpecular\": \"archilogic/tex/8e1e6a287c1930134639a7b4236bd552.hi-res.gz.dds\",\n \"receiveRealTimeShadows\": true,\n \"mapDiffusePreview\": \"archilogic/tex/f0d0f3f85673051179bf44bfce706efd.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/f0d0f3f85673051179bf44bfce706efd.source.jpg\",\n \"mapSpecularPreview\": \"archilogic/tex/8e1e6a287c1930134639a7b4236bd552.lo-res.jpg\",\n \"mapSpecularSource\": \"archilogic/tex/8e1e6a287c1930134639a7b4236bd552.source.jpg\",\n \"mapNormalPreview\": \"archilogic/tex/6d3096b1dbb5c9ae16f9cae41c08c86f.lo-res.jpg\",\n \"mapNormalSource\": \"archilogic/tex/6d3096b1dbb5c9ae16f9cae41c08c86f.source.jpg\"\n }\n },\n \"black_white_tiles\": {\n \"meta\": {\n \"displayName\": \"Tiles Checkerboard Black/White\",\n \"category\": \"floor\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [1,1],\n \"colorSpecular\": [0.537,0.537,0.537],\n \"specularCoef\": 40,\n \"mapDiffuse\": \"archilogic/tex/6516dbd748a176400f878fa8e9c99ba3.hi-res.gz.dds\",\n \"mapNormal\": \"archilogic/tex/a72b2b7a876446fc0266c483eec1e1c5.hi-res.gz.dds\",\n \"mapSpecular\": \"archilogic/tex/98b4993fcad50697c3387edff1df4414.hi-res.gz.dds\",\n \"receiveRealTimeShadows\": true,\n \"mapDiffusePreview\": \"archilogic/tex/6516dbd748a176400f878fa8e9c99ba3.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/6516dbd748a176400f878fa8e9c99ba3.source.jpg\",\n \"mapSpecularPreview\": \"archilogic/tex/98b4993fcad50697c3387edff1df4414.lo-res.jpg\",\n \"mapSpecularSource\": \"archilogic/tex/98b4993fcad50697c3387edff1df4414.source.jpg\",\n \"mapNormalPreview\": \"archilogic/tex/a72b2b7a876446fc0266c483eec1e1c5.lo-res.jpg\",\n \"mapNormalSource\": \"archilogic/tex/a72b2b7a876446fc0266c483eec1e1c5.source.jpg\"\n }\n },\n \"floor_tiles_002\": {\n \"meta\": {\n \"displayName\": \"Floor Tiles 002\",\n \"category\": \"floor\",\n \"showInMenu\": false\n },\n \"attributes\": {\n \"size\": [2,2],\n \"specularCoef\": 40,\n \"mapDiffuse\": \"archilogic/tex/033cf06fbf6b93c7bd0fb3691fa72f17.hi-res.gz.dds\",\n \"receiveRealTimeShadows\": true,\n \"mapDiffusePreview\": \"archilogic/tex/033cf06fbf6b93c7bd0fb3691fa72f17.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/033cf06fbf6b93c7bd0fb3691fa72f17.source.jpg\"\n }\n },\n \"floor_tiles_003\": {\n \"meta\": {\n \"displayName\": \"Floor Tiles 003\",\n \"category\": \"floor\",\n \"showInMenu\": false\n },\n \"attributes\": {\n \"size\": [2,2],\n \"specularCoef\": 40,\n \"mapDiffuse\": \"archilogic/tex/09716599ae75e4f4fc559b8dc37c7671.hi-res.gz.dds\",\n \"receiveRealTimeShadows\": true,\n \"mapDiffusePreview\": \"archilogic/tex/09716599ae75e4f4fc559b8dc37c7671.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/09716599ae75e4f4fc559b8dc37c7671.source.jpg\"\n }\n },\n \"white_tiles\": {\n \"meta\": {\n \"displayName\": \"Tiles Mosaic White Big\",\n \"category\": \"wall\",\n \"showInMenu\": false\n },\n \"attributes\": {\n \"size\": [1,1],\n \"colorSpecular\": [0.125,0.125,0.125],\n \"specularCoef\": 50,\n \"mapDiffuse\": \"archilogic/tex/3df033cc051926797d49509f766af355.hi-res.gz.dds\",\n \"mapNormal\": \"archilogic/tex/02aab5d4adaf4690c49ba55cfaa6b80f.hi-res.gz.dds\",\n \"mapSpecular\": \"archilogic/tex/0a2a5927b4f16b67adef3af0f1f5826d.hi-res.gz.dds\",\n \"mapDiffusePreview\": \"archilogic/tex/3df033cc051926797d49509f766af355.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/3df033cc051926797d49509f766af355.source.png\",\n \"mapSpecularPreview\": \"archilogic/tex/0a2a5927b4f16b67adef3af0f1f5826d.lo-res.jpg\",\n \"mapSpecularSource\": \"archilogic/tex/0a2a5927b4f16b67adef3af0f1f5826d.source.png\",\n \"mapNormalPreview\": \"archilogic/tex/02aab5d4adaf4690c49ba55cfaa6b80f.lo-res.jpg\",\n \"mapNormalSource\": \"archilogic/tex/02aab5d4adaf4690c49ba55cfaa6b80f.source.png\"\n }\n },\n \"white_tiles_floor\": {\n \"meta\": {\n \"displayName\": \"Tiles Mosaic White Big\",\n \"category\": \"floor\",\n \"showInMenu\": false\n },\n \"attributes\": {\n \"size\": [1,1],\n \"colorSpecular\": [0.125,0.125,0.125],\n \"specularCoef\": 50,\n \"mapDiffuse\": \"archilogic/tex/3df033cc051926797d49509f766af355.hi-res.gz.dds\",\n \"mapNormal\": \"archilogic/tex/02aab5d4adaf4690c49ba55cfaa6b80f.hi-res.gz.dds\",\n \"mapSpecular\": \"archilogic/tex/0a2a5927b4f16b67adef3af0f1f5826d.hi-res.gz.dds\",\n \"receiveRealTimeShadows\": true,\n \"mapDiffusePreview\": \"archilogic/tex/3df033cc051926797d49509f766af355.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/3df033cc051926797d49509f766af355.source.png\",\n \"mapSpecularPreview\": \"archilogic/tex/0a2a5927b4f16b67adef3af0f1f5826d.lo-res.jpg\",\n \"mapSpecularSource\": \"archilogic/tex/0a2a5927b4f16b67adef3af0f1f5826d.source.png\",\n \"mapNormalPreview\": \"archilogic/tex/02aab5d4adaf4690c49ba55cfaa6b80f.lo-res.jpg\",\n \"mapNormalSource\": \"archilogic/tex/02aab5d4adaf4690c49ba55cfaa6b80f.source.png\"\n }\n },\n \"white_tiles_small\": {\n \"meta\": {\n \"displayName\": \"Tiles Mosaic White\",\n \"category\": \"wall\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [1,1],\n \"colorSpecular\": [0.125,0.125,0.125],\n \"specularCoef\": 50,\n \"mapDiffuse\": \"archilogic/tex/3416ceb5e5625b1214d778e71413e138.hi-res.gz.dds\",\n \"mapNormal\": \"archilogic/tex/e5f0d1e90c2b0fdd1f88fa48157dc68c.hi-res.gz.dds\",\n \"mapSpecular\": \"archilogic/tex/044e5fcdc243b61f90b8a92f1355b9be.hi-res.gz.dds\",\n \"mapDiffusePreview\": \"archilogic/tex/3416ceb5e5625b1214d778e71413e138.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/3416ceb5e5625b1214d778e71413e138.source.png\",\n \"mapSpecularPreview\": \"archilogic/tex/044e5fcdc243b61f90b8a92f1355b9be.lo-res.jpg\",\n \"mapSpecularSource\": \"archilogic/tex/044e5fcdc243b61f90b8a92f1355b9be.source.png\",\n \"mapNormalPreview\": \"archilogic/tex/e5f0d1e90c2b0fdd1f88fa48157dc68c.lo-res.jpg\",\n \"mapNormalSource\": \"archilogic/tex/e5f0d1e90c2b0fdd1f88fa48157dc68c.source.png\"\n }\n },\n \"white_tiles_small_floor\": {\n \"meta\": {\n \"displayName\": \"Tiles Mosaic White\",\n \"category\": \"floor\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [1,1],\n \"colorSpecular\": [0.125,0.125,0.125],\n \"specularCoef\": 50,\n \"mapDiffuse\": \"archilogic/tex/3416ceb5e5625b1214d778e71413e138.hi-res.gz.dds\",\n \"mapNormal\": \"archilogic/tex/e5f0d1e90c2b0fdd1f88fa48157dc68c.hi-res.gz.dds\",\n \"mapSpecular\": \"archilogic/tex/044e5fcdc243b61f90b8a92f1355b9be.hi-res.gz.dds\",\n \"receiveRealTimeShadows\": true,\n \"mapDiffusePreview\": \"archilogic/tex/3416ceb5e5625b1214d778e71413e138.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/3416ceb5e5625b1214d778e71413e138.source.png\",\n \"mapSpecularPreview\": \"archilogic/tex/044e5fcdc243b61f90b8a92f1355b9be.lo-res.jpg\",\n \"mapSpecularSource\": \"archilogic/tex/044e5fcdc243b61f90b8a92f1355b9be.source.png\",\n \"mapNormalPreview\": \"archilogic/tex/e5f0d1e90c2b0fdd1f88fa48157dc68c.lo-res.jpg\",\n \"mapNormalSource\": \"archilogic/tex/e5f0d1e90c2b0fdd1f88fa48157dc68c.source.png\"\n }\n },\n \"tiles_mosaic_brown\": {\n \"meta\": {\n \"displayName\": \"Tiles Mosaic Brown\",\n \"category\": \"wall\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [0.5,0.5],\n \"colorSpecular\": [0.15,0.15,0.15],\n \"specularCoef\": 50,\n \"mapDiffuse\": \"archilogic/tex/739ac1c99b22d62693314fb55c8b847a.hi-res.gz.dds\",\n \"mapNormal\": \"archilogic/tex/5c4f63d51333703dcac9659cb7fcd68d.hi-res.gz.dds\",\n \"mapSpecular\": \"archilogic/tex/b19abec3667b65b6ef609d9aaf0a9461.hi-res.gz.dds\",\n \"mapDiffusePreview\": \"archilogic/tex/739ac1c99b22d62693314fb55c8b847a.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/739ac1c99b22d62693314fb55c8b847a.source.jpg\",\n \"mapSpecularPreview\": \"archilogic/tex/b19abec3667b65b6ef609d9aaf0a9461.lo-res.jpg\",\n \"mapSpecularSource\": \"archilogic/tex/b19abec3667b65b6ef609d9aaf0a9461.source.jpg\",\n \"mapNormalPreview\": \"archilogic/tex/5c4f63d51333703dcac9659cb7fcd68d.lo-res.jpg\",\n \"mapNormalSource\": \"archilogic/tex/5c4f63d51333703dcac9659cb7fcd68d.source.jpg\"\n }\n },\n \"tiles_mosaic_brown_floor\": {\n \"meta\": {\n \"displayName\": \"Tiles Mosaic Brown\",\n \"category\": \"floor\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [0.5,0.5],\n \"colorSpecular\": [0.15,0.15,0.15],\n \"specularCoef\": 50,\n \"mapDiffuse\": \"archilogic/tex/739ac1c99b22d62693314fb55c8b847a.hi-res.gz.dds\",\n \"mapNormal\": \"archilogic/tex/5c4f63d51333703dcac9659cb7fcd68d.hi-res.gz.dds\",\n \"mapSpecular\": \"archilogic/tex/b19abec3667b65b6ef609d9aaf0a9461.hi-res.gz.dds\",\n \"receiveRealTimeShadows\": true,\n \"mapDiffusePreview\": \"archilogic/tex/739ac1c99b22d62693314fb55c8b847a.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/739ac1c99b22d62693314fb55c8b847a.source.jpg\",\n \"mapSpecularPreview\": \"archilogic/tex/b19abec3667b65b6ef609d9aaf0a9461.lo-res.jpg\",\n \"mapSpecularSource\": \"archilogic/tex/b19abec3667b65b6ef609d9aaf0a9461.source.jpg\",\n \"mapNormalPreview\": \"archilogic/tex/5c4f63d51333703dcac9659cb7fcd68d.lo-res.jpg\",\n \"mapNormalSource\": \"archilogic/tex/5c4f63d51333703dcac9659cb7fcd68d.source.jpg\"\n }\n },\n \"tiles_mosaic_green\": {\n \"meta\": {\n \"displayName\": \"Tiles Mosaic Green\",\n \"category\": \"wall\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [0.5,0.5],\n \"colorSpecular\": [0.1,0.1,0.1],\n \"specularCoef\": 50,\n \"mapDiffuse\": \"archilogic/tex/cf01041b30b308d8c1d5797490eefb3d.hi-res.gz.dds\",\n \"mapNormal\": \"archilogic/tex/5c4f63d51333703dcac9659cb7fcd68d.hi-res.gz.dds\",\n \"mapSpecular\": \"archilogic/tex/b19abec3667b65b6ef609d9aaf0a9461.hi-res.gz.dds\",\n \"mapDiffusePreview\": \"archilogic/tex/cf01041b30b308d8c1d5797490eefb3d.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/cf01041b30b308d8c1d5797490eefb3d.source.jpg\",\n \"mapSpecularPreview\": \"archilogic/tex/b19abec3667b65b6ef609d9aaf0a9461.lo-res.jpg\",\n \"mapSpecularSource\": \"archilogic/tex/b19abec3667b65b6ef609d9aaf0a9461.source.jpg\",\n \"mapNormalPreview\": \"archilogic/tex/5c4f63d51333703dcac9659cb7fcd68d.lo-res.jpg\",\n \"mapNormalSource\": \"archilogic/tex/5c4f63d51333703dcac9659cb7fcd68d.source.jpg\"\n }\n },\n \"tiles_mosaic_green_floor\": {\n \"meta\": {\n \"displayName\": \"Tiles Mosaic Green\",\n \"category\": \"floor\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [0.5,0.5],\n \"colorSpecular\": [0.1,0.1,0.1],\n \"specularCoef\": 50,\n \"mapDiffuse\": \"archilogic/tex/cf01041b30b308d8c1d5797490eefb3d.hi-res.gz.dds\",\n \"mapNormal\": \"archilogic/tex/5c4f63d51333703dcac9659cb7fcd68d.hi-res.gz.dds\",\n \"mapSpecular\": \"archilogic/tex/b19abec3667b65b6ef609d9aaf0a9461.hi-res.gz.dds\",\n \"receiveRealTimeShadows\": true,\n \"mapDiffusePreview\": \"archilogic/tex/cf01041b30b308d8c1d5797490eefb3d.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/cf01041b30b308d8c1d5797490eefb3d.source.jpg\",\n \"mapSpecularPreview\": \"archilogic/tex/b19abec3667b65b6ef609d9aaf0a9461.lo-res.jpg\",\n \"mapSpecularSource\": \"archilogic/tex/b19abec3667b65b6ef609d9aaf0a9461.source.jpg\",\n \"mapNormalPreview\": \"archilogic/tex/5c4f63d51333703dcac9659cb7fcd68d.lo-res.jpg\",\n \"mapNormalSource\": \"archilogic/tex/5c4f63d51333703dcac9659cb7fcd68d.source.jpg\"\n }\n },\n \"dark_tiles\": {\n \"meta\": {\n \"displayName\": \"Brown Tiles\",\n \"category\": \"floor\",\n \"showInMenu\": false\n },\n \"attributes\": {\n \"size\": [1,1],\n \"colorSpecular\": [0.486,0.486,0.486],\n \"specularCoef\": 50,\n \"mapDiffuse\": \"archilogic/tex/6b0b81b4cdbaca9628eb0d78ed092f0f.hi-res.gz.dds\",\n \"mapNormal\": \"archilogic/tex/02aab5d4adaf4690c49ba55cfaa6b80f.hi-res.gz.dds\",\n \"mapSpecular\": \"archilogic/tex/0a2a5927b4f16b67adef3af0f1f5826d.hi-res.gz.dds\",\n \"receiveRealTimeShadows\": true,\n \"mapDiffusePreview\": \"archilogic/tex/6b0b81b4cdbaca9628eb0d78ed092f0f.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/6b0b81b4cdbaca9628eb0d78ed092f0f.source.png\",\n \"mapSpecularPreview\": \"archilogic/tex/0a2a5927b4f16b67adef3af0f1f5826d.lo-res.jpg\",\n \"mapSpecularSource\": \"archilogic/tex/0a2a5927b4f16b67adef3af0f1f5826d.source.png\",\n \"mapNormalPreview\": \"archilogic/tex/02aab5d4adaf4690c49ba55cfaa6b80f.lo-res.jpg\",\n \"mapNormalSource\": \"archilogic/tex/02aab5d4adaf4690c49ba55cfaa6b80f.source.png\"\n }\n },\n \"dark_tiles_small\": {\n \"meta\": {\n \"displayName\": \"Brown Tiles Small\",\n \"category\": \"floor\",\n \"showInMenu\": false\n },\n \"attributes\": {\n \"size\": [1,1],\n \"colorSpecular\": [0.486,0.486,0.486],\n \"specularCoef\": 50,\n \"mapDiffuse\": \"archilogic/tex/186699961b8afaf24d3a21eb07aadd6d.hi-res.gz.dds\",\n \"mapNormal\": \"archilogic/tex/e5f0d1e90c2b0fdd1f88fa48157dc68c.hi-res.gz.dds\",\n \"mapSpecular\": \"archilogic/tex/044e5fcdc243b61f90b8a92f1355b9be.hi-res.gz.dds\",\n \"receiveRealTimeShadows\": true,\n \"mapDiffusePreview\": \"archilogic/tex/186699961b8afaf24d3a21eb07aadd6d.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/186699961b8afaf24d3a21eb07aadd6d.source.png\",\n \"mapSpecularPreview\": \"archilogic/tex/044e5fcdc243b61f90b8a92f1355b9be.lo-res.jpg\",\n \"mapSpecularSource\": \"archilogic/tex/044e5fcdc243b61f90b8a92f1355b9be.source.png\",\n \"mapNormalPreview\": \"archilogic/tex/e5f0d1e90c2b0fdd1f88fa48157dc68c.lo-res.jpg\",\n \"mapNormalSource\": \"archilogic/tex/e5f0d1e90c2b0fdd1f88fa48157dc68c.source.png\"\n }\n },\n \"floor_tiles_001\": {\n \"meta\": {\n \"displayName\": \"Tiles Slate\",\n \"category\": \"floor\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [1.5,1.5],\n \"colorSpecular\": [0.584,0.584,0.584],\n \"specularCoef\": 40,\n \"mapDiffuse\": \"archilogic/tex/2d6e29a6701b30f14a9fd4ff5611821c.hi-res.gz.dds\",\n \"mapNormal\": \"archilogic/tex/0cbeaa8fae8ac9c017f3e54a0d0f2b7a.hi-res.gz.dds\",\n \"mapSpecular\": \"archilogic/tex/cf02b31506b385e6dd0a1cade7e22cc7.hi-res.gz.dds\",\n \"receiveRealTimeShadows\": true,\n \"mapDiffusePreview\": \"archilogic/tex/2d6e29a6701b30f14a9fd4ff5611821c.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/2d6e29a6701b30f14a9fd4ff5611821c.source.jpg\",\n \"mapSpecularPreview\": \"archilogic/tex/cf02b31506b385e6dd0a1cade7e22cc7.lo-res.jpg\",\n \"mapSpecularSource\": \"archilogic/tex/cf02b31506b385e6dd0a1cade7e22cc7.source.jpg\",\n \"mapNormalPreview\": \"archilogic/tex/0cbeaa8fae8ac9c017f3e54a0d0f2b7a.lo-res.jpg\",\n \"mapNormalSource\": \"archilogic/tex/0cbeaa8fae8ac9c017f3e54a0d0f2b7a.source.jpg\"\n }\n },\n \"terrazzo_tiles\": {\n \"meta\": {\n \"displayName\": \"Tiles Terrazzo\",\n \"category\": \"floor\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [2,2],\n \"colorSpecular\": [0.584,0.584,0.584],\n \"specularCoef\": 50,\n \"mapDiffuse\": \"archilogic/tex/25694889b08b343b90c3e4c7261d86e8.hi-res.gz.dds\",\n \"mapNormal\": \"archilogic/tex/57e26201a21d93254c4bb45ed2d2aa19.hi-res.gz.dds\",\n \"mapSpecular\": \"archilogic/tex/6702ac5458148d80116088ba2c7d2c42.hi-res.gz.dds\",\n \"receiveRealTimeShadows\": true,\n \"mapDiffusePreview\": \"archilogic/tex/25694889b08b343b90c3e4c7261d86e8.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/25694889b08b343b90c3e4c7261d86e8.source.png\",\n \"mapSpecularPreview\": \"archilogic/tex/6702ac5458148d80116088ba2c7d2c42.lo-res.jpg\",\n \"mapSpecularSource\": \"archilogic/tex/6702ac5458148d80116088ba2c7d2c42.source.png\",\n \"mapNormalPreview\": \"archilogic/tex/57e26201a21d93254c4bb45ed2d2aa19.lo-res.jpg\",\n \"mapNormalSource\": \"archilogic/tex/57e26201a21d93254c4bb45ed2d2aa19.source.png\"\n }\n },\n \"tiles_white_marble\": {\n \"meta\": {\n \"displayName\": \"Tiles Marble White\",\n \"category\": \"wall\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [1,1],\n \"colorSpecular\": [0.4,0.4,0.4],\n \"specularCoef\": 25,\n \"mapDiffuse\": \"archilogic/tex/0b2c734dd939a01faaa867ec65e0ef4c.hi-res.gz.dds\",\n \"mapNormal\": \"archilogic/tex/69bba4d9620c0c37fa9f0997156e693a.hi-res.gz.dds\",\n \"mapSpecular\": \"archilogic/tex/8fc3f68d9193efa80002bd940ad93be4.hi-res.gz.dds\",\n \"mapDiffusePreview\": \"archilogic/tex/0b2c734dd939a01faaa867ec65e0ef4c.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/0b2c734dd939a01faaa867ec65e0ef4c.source.jpg\",\n \"mapSpecularPreview\": \"archilogic/tex/8fc3f68d9193efa80002bd940ad93be4.lo-res.jpg\",\n \"mapSpecularSource\": \"archilogic/tex/8fc3f68d9193efa80002bd940ad93be4.source.jpg\",\n \"mapNormalPreview\": \"archilogic/tex/69bba4d9620c0c37fa9f0997156e693a.lo-res.jpg\",\n \"mapNormalSource\": \"archilogic/tex/69bba4d9620c0c37fa9f0997156e693a.source.jpg\"\n }\n },\n \"tiles_white_marble_floor\": {\n \"meta\": {\n \"displayName\": \"Tiles Marble White\",\n \"category\": \"floor\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [1,1],\n \"colorSpecular\": [0.4,0.4,0.4],\n \"specularCoef\": 25,\n \"mapDiffuse\": \"archilogic/tex/0b2c734dd939a01faaa867ec65e0ef4c.hi-res.gz.dds\",\n \"mapNormal\": \"archilogic/tex/69bba4d9620c0c37fa9f0997156e693a.hi-res.gz.dds\",\n \"mapSpecular\": \"archilogic/tex/8fc3f68d9193efa80002bd940ad93be4.hi-res.gz.dds\",\n \"receiveRealTimeShadows\": true,\n \"mapDiffusePreview\": \"archilogic/tex/0b2c734dd939a01faaa867ec65e0ef4c.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/0b2c734dd939a01faaa867ec65e0ef4c.source.jpg\",\n \"mapSpecularPreview\": \"archilogic/tex/8fc3f68d9193efa80002bd940ad93be4.lo-res.jpg\",\n \"mapSpecularSource\": \"archilogic/tex/8fc3f68d9193efa80002bd940ad93be4.source.jpg\",\n \"mapNormalPreview\": \"archilogic/tex/69bba4d9620c0c37fa9f0997156e693a.lo-res.jpg\",\n \"mapNormalSource\": \"archilogic/tex/69bba4d9620c0c37fa9f0997156e693a.source.jpg\"\n }\n },\n \"stone-travertin\": {\n \"meta\": {\n \"displayName\": \"Tiles Travertin\",\n \"category\": \"wall\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [2,2],\n \"colorSpecular\": [0.424,0.424,0.424],\n \"specularCoef\": 25,\n \"mapDiffuse\": \"archilogic/tex/82a80f62139d16b46c21188d6bf65383.hi-res.gz.dds\",\n \"mapNormal\": \"archilogic/tex/3c34372d7adc7d0cfb6241818e7bdd33.hi-res.gz.dds\",\n \"mapSpecular\": \"archilogic/tex/77a50e96fcb72da716a1fa5ff59a6405.hi-res.gz.dds\",\n \"mapDiffusePreview\": \"archilogic/tex/82a80f62139d16b46c21188d6bf65383.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/82a80f62139d16b46c21188d6bf65383.source.jpg\",\n \"mapSpecularPreview\": \"archilogic/tex/77a50e96fcb72da716a1fa5ff59a6405.lo-res.jpg\",\n \"mapSpecularSource\": \"archilogic/tex/77a50e96fcb72da716a1fa5ff59a6405.source.jpg\",\n \"mapNormalPreview\": \"archilogic/tex/3c34372d7adc7d0cfb6241818e7bdd33.lo-res.jpg\",\n \"mapNormalSource\": \"archilogic/tex/3c34372d7adc7d0cfb6241818e7bdd33.source.jpg\"\n }\n },\n \"stone-travertin-floor\": {\n \"meta\": {\n \"displayName\": \"Tiles Travertin\",\n \"category\": \"floor\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [2,2],\n \"colorSpecular\": [0.424,0.424,0.424],\n \"specularCoef\": 25,\n \"mapDiffuse\": \"archilogic/tex/82a80f62139d16b46c21188d6bf65383.hi-res.gz.dds\",\n \"mapNormal\": \"archilogic/tex/3c34372d7adc7d0cfb6241818e7bdd33.hi-res.gz.dds\",\n \"mapSpecular\": \"archilogic/tex/77a50e96fcb72da716a1fa5ff59a6405.hi-res.gz.dds\",\n \"receiveRealTimeShadows\": true,\n \"mapDiffusePreview\": \"archilogic/tex/82a80f62139d16b46c21188d6bf65383.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/82a80f62139d16b46c21188d6bf65383.source.jpg\",\n \"mapSpecularPreview\": \"archilogic/tex/77a50e96fcb72da716a1fa5ff59a6405.lo-res.jpg\",\n \"mapSpecularSource\": \"archilogic/tex/77a50e96fcb72da716a1fa5ff59a6405.source.jpg\",\n \"mapNormalPreview\": \"archilogic/tex/3c34372d7adc7d0cfb6241818e7bdd33.lo-res.jpg\",\n \"mapNormalSource\": \"archilogic/tex/3c34372d7adc7d0cfb6241818e7bdd33.source.jpg\"\n }\n },\n \"terrazzo\": {\n \"meta\": {\n \"displayName\": \"Terrazzo\",\n \"category\": \"floor\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [0.8,0.8],\n \"colorSpecular\": [0.125,0.125,0.125],\n \"specularCoef\": 50,\n \"mapDiffuse\": \"archilogic/tex/b6669597fae40407427303941f738325.hi-res.gz.dds\",\n \"mapNormal\": \"archilogic/tex/550eb2c4d601fe57c9ea74d9b1987eea.hi-res.gz.dds\",\n \"mapSpecular\": \"archilogic/tex/a0a56174d016a466f6bb465c1fb8a55e.hi-res.gz.dds\",\n \"receiveRealTimeShadows\": true,\n \"mapDiffusePreview\": \"archilogic/tex/b6669597fae40407427303941f738325.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/b6669597fae40407427303941f738325.source.jpg\",\n \"mapSpecularPreview\": \"archilogic/tex/a0a56174d016a466f6bb465c1fb8a55e.lo-res.jpg\",\n \"mapSpecularSource\": \"archilogic/tex/a0a56174d016a466f6bb465c1fb8a55e.source.jpg\",\n \"mapNormalPreview\": \"archilogic/tex/550eb2c4d601fe57c9ea74d9b1987eea.lo-res.jpg\",\n \"mapNormalSource\": \"archilogic/tex/550eb2c4d601fe57c9ea74d9b1987eea.source.jpg\"\n }\n },\n \"terrazzo_ceiling\": {\n \"meta\": {\n \"displayName\": \"Terrazzo\",\n \"category\": \"ceiling\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [0.8,0.8],\n \"colorSpecular\": [0.125,0.125,0.125],\n \"specularCoef\": 50,\n \"mapDiffuse\": \"archilogic/tex/b6669597fae40407427303941f738325.hi-res.gz.dds\",\n \"mapNormal\": \"archilogic/tex/550eb2c4d601fe57c9ea74d9b1987eea.hi-res.gz.dds\",\n \"mapSpecular\": \"archilogic/tex/a0a56174d016a466f6bb465c1fb8a55e.hi-res.gz.dds\",\n \"mapDiffusePreview\": \"archilogic/tex/b6669597fae40407427303941f738325.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/b6669597fae40407427303941f738325.source.jpg\",\n \"mapSpecularPreview\": \"archilogic/tex/a0a56174d016a466f6bb465c1fb8a55e.lo-res.jpg\",\n \"mapSpecularSource\": \"archilogic/tex/a0a56174d016a466f6bb465c1fb8a55e.source.jpg\",\n \"mapNormalPreview\": \"archilogic/tex/550eb2c4d601fe57c9ea74d9b1987eea.lo-res.jpg\",\n \"mapNormalSource\": \"archilogic/tex/550eb2c4d601fe57c9ea74d9b1987eea.source.jpg\"\n }\n },\n \"bricks_clean_red\": {\n \"meta\": {\n \"displayName\": \"Bricks Clean Red\",\n \"category\": \"wall\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [1.2,1.2],\n \"colorSpecular\": [0.08,0.08,0.08],\n \"specularCoef\": 50,\n \"mapDiffuse\": \"/535e624259ee6b0200000484/textures/uploads/d399b0bf607e60e545c0ceb060b7982c.hi-res.gz.dds\",\n \"mapNormal\": \"/535e624259ee6b0200000484/textures/uploads/7a6112cd3134c623afacd882e2cb4585.hi-res.gz.dds\",\n \"mapSpecular\": \"/535e624259ee6b0200000484/textures/uploads/06fd5ee205b44156205c4180a21e815a.hi-res.gz.dds\",\n \"mapDiffusePreview\": \"/535e624259ee6b0200000484/textures/uploads/d399b0bf607e60e545c0ceb060b7982c.lo-res.jpg\",\n \"mapDiffuseSource\": \"/535e624259ee6b0200000484/textures/uploads/d399b0bf607e60e545c0ceb060b7982c.source.jpg\",\n \"mapSpecularPreview\": \"/535e624259ee6b0200000484/textures/uploads/06fd5ee205b44156205c4180a21e815a.lo-res.jpg\",\n \"mapSpecularSource\": \"/535e624259ee6b0200000484/textures/uploads/06fd5ee205b44156205c4180a21e815a.source.jpg\",\n \"mapNormalPreview\": \"/535e624259ee6b0200000484/textures/uploads/7a6112cd3134c623afacd882e2cb4585.lo-res.jpg\",\n \"mapNormalSource\": \"/535e624259ee6b0200000484/textures/uploads/7a6112cd3134c623afacd882e2cb4585.source.jpg\"\n }\n },\n \"bricks_clean_orange\": {\n \"meta\": {\n \"displayName\": \"Bricks Clean Orange\",\n \"category\": \"wall\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [1.2,1.2],\n \"colorSpecular\": [0.08,0.08,0.08],\n \"specularCoef\": 50,\n \"mapDiffuse\": \"/535e624259ee6b0200000484/textures/uploads/d981f439a0d62b0e1d68c5c91daad674.hi-res.gz.dds\",\n \"mapNormal\": \"/535e624259ee6b0200000484/textures/uploads/7a6112cd3134c623afacd882e2cb4585.hi-res.gz.dds\",\n \"mapSpecular\": \"/535e624259ee6b0200000484/textures/uploads/06fd5ee205b44156205c4180a21e815a.hi-res.gz.dds\",\n \"mapDiffusePreview\": \"/535e624259ee6b0200000484/textures/uploads/d981f439a0d62b0e1d68c5c91daad674.lo-res.jpg\",\n \"mapDiffuseSource\": \"/535e624259ee6b0200000484/textures/uploads/d981f439a0d62b0e1d68c5c91daad674.source.jpg\",\n \"mapSpecularPreview\": \"/535e624259ee6b0200000484/textures/uploads/06fd5ee205b44156205c4180a21e815a.lo-res.jpg\",\n \"mapSpecularSource\": \"/535e624259ee6b0200000484/textures/uploads/06fd5ee205b44156205c4180a21e815a.source.jpg\",\n \"mapNormalPreview\": \"/535e624259ee6b0200000484/textures/uploads/7a6112cd3134c623afacd882e2cb4585.lo-res.jpg\",\n \"mapNormalSource\": \"/535e624259ee6b0200000484/textures/uploads/7a6112cd3134c623afacd882e2cb4585.source.jpg\"\n }\n },\n \"bricks_clean_white\": {\n \"meta\": {\n \"displayName\": \"Bricks Clean White\",\n \"category\": \"wall\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [1.2,1.2],\n \"colorSpecular\": [0.08,0.08,0.08],\n \"specularCoef\": 50,\n \"mapDiffuse\": \"/535e624259ee6b0200000484/textures/uploads/e167b3c467c84e496fdf5feb34e3a978.hi-res.gz.dds\",\n \"mapNormal\": \"/535e624259ee6b0200000484/textures/uploads/7a6112cd3134c623afacd882e2cb4585.hi-res.gz.dds\",\n \"mapSpecular\": \"/535e624259ee6b0200000484/textures/uploads/06fd5ee205b44156205c4180a21e815a.hi-res.gz.dds\",\n \"mapDiffusePreview\": \"/535e624259ee6b0200000484/textures/uploads/e167b3c467c84e496fdf5feb34e3a978.lo-res.jpg\",\n \"mapDiffuseSource\": \"/535e624259ee6b0200000484/textures/uploads/e167b3c467c84e496fdf5feb34e3a978.source.jpg\",\n \"mapSpecularPreview\": \"/535e624259ee6b0200000484/textures/uploads/06fd5ee205b44156205c4180a21e815a.lo-res.jpg\",\n \"mapSpecularSource\": \"/535e624259ee6b0200000484/textures/uploads/06fd5ee205b44156205c4180a21e815a.source.jpg\",\n \"mapNormalPreview\": \"/535e624259ee6b0200000484/textures/uploads/7a6112cd3134c623afacd882e2cb4585.lo-res.jpg\",\n \"mapNormalSource\": \"/535e624259ee6b0200000484/textures/uploads/7a6112cd3134c623afacd882e2cb4585.source.jpg\"\n }\n },\n \"bricks_red\": {\n \"meta\": {\n \"displayName\": \"Bricks Red\",\n \"category\": \"wall\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [1,1],\n \"colorSpecular\": [0.08,0.08,0.08],\n \"specularCoef\": 50,\n \"mapDiffuse\": \"archilogic/tex/e4946d35b80274163c6b6477e68e2b00.hi-res.gz.dds\",\n \"mapNormal\": \"archilogic/tex/545119d25a25288d358632490643ddc2.hi-res.gz.dds\",\n \"mapSpecular\": \"archilogic/tex/0e83232f013132b11b4b2b194717fbc5.hi-res.gz.dds\",\n \"mapDiffusePreview\": \"archilogic/tex/e4946d35b80274163c6b6477e68e2b00.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/e4946d35b80274163c6b6477e68e2b00.source.jpg\",\n \"mapSpecularPreview\": \"archilogic/tex/0e83232f013132b11b4b2b194717fbc5.lo-res.jpg\",\n \"mapSpecularSource\": \"archilogic/tex/0e83232f013132b11b4b2b194717fbc5.source.jpg\",\n \"mapNormalPreview\": \"archilogic/tex/545119d25a25288d358632490643ddc2.lo-res.jpg\",\n \"mapNormalSource\": \"archilogic/tex/545119d25a25288d358632490643ddc2.source.jpg\"\n }\n },\n \"bricks_yellow\": {\n \"meta\": {\n \"displayName\": \"Bricks Yellow\",\n \"category\": \"wall\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [1,1],\n \"colorSpecular\": [0.05,0.05,0.05],\n \"specularCoef\": 50,\n \"mapDiffuse\": \"archilogic/tex/d287580522c79c80aea849747b9ab914.hi-res.gz.dds\",\n \"mapNormal\": \"archilogic/tex/545119d25a25288d358632490643ddc2.hi-res.gz.dds\",\n \"mapSpecular\": \"archilogic/tex/0e83232f013132b11b4b2b194717fbc5.hi-res.gz.dds\",\n \"mapDiffusePreview\": \"archilogic/tex/d287580522c79c80aea849747b9ab914.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/d287580522c79c80aea849747b9ab914.source.jpg\",\n \"mapSpecularPreview\": \"archilogic/tex/0e83232f013132b11b4b2b194717fbc5.lo-res.jpg\",\n \"mapSpecularSource\": \"archilogic/tex/0e83232f013132b11b4b2b194717fbc5.source.jpg\",\n \"mapNormalPreview\": \"archilogic/tex/545119d25a25288d358632490643ddc2.lo-res.jpg\",\n \"mapNormalSource\": \"archilogic/tex/545119d25a25288d358632490643ddc2.source.jpg\"\n }\n },\n \"bricks_white\": {\n \"meta\": {\n \"displayName\": \"Bricks White\",\n \"category\": \"wall\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [1,1],\n \"colorSpecular\": [0.05,0.05,0.05],\n \"specularCoef\": 50,\n \"mapDiffuse\": \"archilogic/tex/7c5134a614d03c79d008c5c1a7cf5f54.hi-res.gz.dds\",\n \"mapNormal\": \"archilogic/tex/545119d25a25288d358632490643ddc2.hi-res.gz.dds\",\n \"mapSpecular\": \"archilogic/tex/0e83232f013132b11b4b2b194717fbc5.hi-res.gz.dds\",\n \"mapDiffusePreview\": \"archilogic/tex/7c5134a614d03c79d008c5c1a7cf5f54.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/7c5134a614d03c79d008c5c1a7cf5f54.source.jpg\",\n \"mapSpecularPreview\": \"archilogic/tex/0e83232f013132b11b4b2b194717fbc5.lo-res.jpg\",\n \"mapSpecularSource\": \"archilogic/tex/0e83232f013132b11b4b2b194717fbc5.source.jpg\",\n \"mapNormalPreview\": \"archilogic/tex/545119d25a25288d358632490643ddc2.lo-res.jpg\",\n \"mapNormalSource\": \"archilogic/tex/545119d25a25288d358632490643ddc2.source.jpg\"\n }\n },\n \"concrete_board\": {\n \"meta\": {\n \"displayName\": \"Concrete Raw Board\",\n \"category\": \"wall\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [2.4,2.4],\n \"specularCoef\": 30,\n \"mapDiffuse\": \"archilogic/tex/fea909bb96aa0fcea514647d97875be5.hi-res.gz.dds\",\n \"mapNormal\": \"archilogic/tex/b9f04ce9f2742488128ea450d465963b.hi-res.gz.dds\",\n \"mapSpecular\": \"archilogic/tex/ae044508902f2bf472542a6afc0db6f8.hi-res.gz.dds\",\n \"mapDiffusePreview\": \"archilogic/tex/fea909bb96aa0fcea514647d97875be5.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/fea909bb96aa0fcea514647d97875be5.source.jpg\",\n \"mapSpecularPreview\": \"archilogic/tex/ae044508902f2bf472542a6afc0db6f8.lo-res.jpg\",\n \"mapSpecularSource\": \"archilogic/tex/ae044508902f2bf472542a6afc0db6f8.source.jpg\",\n \"mapNormalPreview\": \"archilogic/tex/b9f04ce9f2742488128ea450d465963b.lo-res.jpg\",\n \"mapNormalSource\": \"archilogic/tex/b9f04ce9f2742488128ea450d465963b.source.jpg\"\n }\n },\n \"concrete_board_ceiling\": {\n \"meta\": {\n \"displayName\": \"Concrete Raw Board\",\n \"category\": \"ceiling\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [2.4,2.4],\n \"specularCoef\": 30,\n \"mapDiffuse\": \"archilogic/tex/fea909bb96aa0fcea514647d97875be5.hi-res.gz.dds\",\n \"mapNormal\": \"archilogic/tex/b9f04ce9f2742488128ea450d465963b.hi-res.gz.dds\",\n \"mapSpecular\": \"archilogic/tex/ae044508902f2bf472542a6afc0db6f8.hi-res.gz.dds\",\n \"mapDiffusePreview\": \"archilogic/tex/fea909bb96aa0fcea514647d97875be5.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/fea909bb96aa0fcea514647d97875be5.source.jpg\",\n \"mapSpecularPreview\": \"archilogic/tex/ae044508902f2bf472542a6afc0db6f8.lo-res.jpg\",\n \"mapSpecularSource\": \"archilogic/tex/ae044508902f2bf472542a6afc0db6f8.source.jpg\",\n \"mapNormalPreview\": \"archilogic/tex/b9f04ce9f2742488128ea450d465963b.lo-res.jpg\",\n \"mapNormalSource\": \"archilogic/tex/b9f04ce9f2742488128ea450d465963b.source.jpg\"\n }\n },\n \"wall_top\": {\n \"meta\": {\n \"displayName\": \"Stone Wall Natural\",\n \"category\": \"wall\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"colorDiffuse\": [0.2,0.2,0.2],\n \"addLightmap\": false,\n \"useInBaking\": true,\n \"hideAfterBaking\": false\n }\n },\n \"stone_wall\": {\n \"meta\": {\n \"displayName\": \"Stone Wall Natural\",\n \"category\": \"wall\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [1,1],\n \"colorSpecular\": [0.424,0.424,0.424],\n \"specularCoef\": 50,\n \"mapDiffuse\": \"archilogic/tex/5b9bed2afa0dff30e14bfbc0344c90e7.hi-res.gz.dds\",\n \"mapNormal\": \"archilogic/tex/0f2f5fcd5532a2acfbe1b62e93b1e2da.hi-res.gz.dds\",\n \"mapSpecular\": \"archilogic/tex/d562e8020049d2d6e4b3583e4e624522.hi-res.gz.dds\",\n \"mapDiffusePreview\": \"archilogic/tex/5b9bed2afa0dff30e14bfbc0344c90e7.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/5b9bed2afa0dff30e14bfbc0344c90e7.source.jpg\",\n \"mapSpecularPreview\": \"archilogic/tex/d562e8020049d2d6e4b3583e4e624522.lo-res.jpg\",\n \"mapSpecularSource\": \"archilogic/tex/d562e8020049d2d6e4b3583e4e624522.source.jpg\",\n \"mapNormalPreview\": \"archilogic/tex/0f2f5fcd5532a2acfbe1b62e93b1e2da.lo-res.jpg\",\n \"mapNormalSource\": \"archilogic/tex/0f2f5fcd5532a2acfbe1b62e93b1e2da.source.jpg\"\n }\n },\n \"floor_vintage_timber_2\": {\n \"meta\": {\n \"displayName\": \"Planks Stained\",\n \"category\": \"floor\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [3.4,3.4],\n \"colorSpecular\": [0.031,0.031,0.031],\n \"specularCoef\": 40,\n \"mapDiffuse\": \"archilogic/tex/dc17b74b6569a8fc02c51369bcc20b9b.hi-res.gz.dds\",\n \"receiveRealTimeShadows\": true,\n \"mapDiffusePreview\": \"archilogic/tex/dc17b74b6569a8fc02c51369bcc20b9b.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/dc17b74b6569a8fc02c51369bcc20b9b.source.jpg\"\n }\n },\n \"ceiling_vintage_timber_2\": {\n \"meta\": {\n \"displayName\": \"Planks Stained\",\n \"category\": \"ceiling\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [3.4,3.4],\n \"colorSpecular\": [0.031,0.031,0.031],\n \"specularCoef\": 40,\n \"mapDiffuse\": \"archilogic/tex/dc17b74b6569a8fc02c51369bcc20b9b.hi-res.gz.dds\",\n \"mapDiffusePreview\": \"archilogic/tex/dc17b74b6569a8fc02c51369bcc20b9b.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/dc17b74b6569a8fc02c51369bcc20b9b.source.jpg\"\n }\n },\n \"wall_vintage_timber_2\": {\n \"meta\": {\n \"displayName\": \"Planks Stained\",\n \"category\": \"wall\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [3.4,3.4],\n \"colorSpecular\": [0.031,0.031,0.031],\n \"specularCoef\": 40,\n \"mapDiffuse\": \"archilogic/tex/dc17b74b6569a8fc02c51369bcc20b9b.hi-res.gz.dds\",\n \"mapDiffusePreview\": \"archilogic/tex/dc17b74b6569a8fc02c51369bcc20b9b.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/dc17b74b6569a8fc02c51369bcc20b9b.source.jpg\"\n }\n },\n \"truss_wood\": {\n \"meta\": {\n \"displayName\": \"Truss Wood\",\n \"category\": \"other\",\n \"showInMenu\": false\n },\n \"attributes\": {\n \"size\": [2,2],\n \"colorSpecular\": [0.667,0.667,0.667],\n \"specularCoef\": 50,\n \"mapDiffuse\": \"archilogic/tex/22327ea017e8c358402d1130c5a74ba7.hi-res.gz.dds\",\n \"mapNormal\": \"archilogic/tex/2ccf45239f3760043910d7729a7c0b30.hi-res.gz.dds\",\n \"mapSpecular\": \"archilogic/tex/e96e36ae77a7b6929ff62d6e70b18d8b.hi-res.gz.dds\",\n \"mapDiffusePreview\": \"archilogic/tex/22327ea017e8c358402d1130c5a74ba7.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/22327ea017e8c358402d1130c5a74ba7.source.png\",\n \"mapSpecularPreview\": \"archilogic/tex/e96e36ae77a7b6929ff62d6e70b18d8b.lo-res.jpg\",\n \"mapSpecularSource\": \"archilogic/tex/e96e36ae77a7b6929ff62d6e70b18d8b.source.png\",\n \"mapNormalPreview\": \"archilogic/tex/2ccf45239f3760043910d7729a7c0b30.lo-res.jpg\",\n \"mapNormalSource\": \"archilogic/tex/2ccf45239f3760043910d7729a7c0b30.source.png\"\n }\n },\n \"brushed_chrome\": {\n \"meta\": {\n \"displayName\": \"Brushed Chrome\",\n \"category\": \"counter\",\n \"showInMenu\": false\n },\n \"attributes\": {\n \"size\": [1,1],\n \"colorSpecular\": [0.855,0.855,0.855],\n \"specularCoef\": 80\n }\n },\n \"concrete_tiles_vertical\": {\n \"meta\": {\n \"displayName\": \"Concrete Tiles Vertical\",\n \"category\": \"wall\",\n \"showInMenu\": false\n },\n \"attributes\": {\n \"size\": [2.4,2.4],\n \"colorSpecular\": [0.486,0.486,0.486],\n \"specularCoef\": 50,\n \"mapDiffuse\": \"archilogic/tex/ea24f67d1cfba1caa593e621e937bc37.hi-res.gz.dds\",\n \"mapNormal\": \"archilogic/tex/391452dc766083a8a6fce340b2d2af44.hi-res.gz.dds\",\n \"mapSpecular\": \"archilogic/tex/55d5ac9d2cd7c1ed99514fd92175e5bc.hi-res.gz.dds\",\n \"mapDiffusePreview\": \"archilogic/tex/ea24f67d1cfba1caa593e621e937bc37.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/ea24f67d1cfba1caa593e621e937bc37.source.png\",\n \"mapSpecularPreview\": \"archilogic/tex/55d5ac9d2cd7c1ed99514fd92175e5bc.lo-res.jpg\",\n \"mapSpecularSource\": \"archilogic/tex/55d5ac9d2cd7c1ed99514fd92175e5bc.source.png\",\n \"mapNormalPreview\": \"archilogic/tex/391452dc766083a8a6fce340b2d2af44.lo-res.jpg\",\n \"mapNormalSource\": \"archilogic/tex/391452dc766083a8a6fce340b2d2af44.source.png\"\n }\n },\n \"glass_old\": {\n \"meta\": {\n \"displayName\": \"Glass (Old)\",\n \"category\": \"glass\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"colorDiffuse\": [1,1,1],\n \"specularCoef\": 40,\n \"opacity\": 0.3,\n \"addLightmap\": false,\n \"useInBaking\": false\n }\n },\n \"glass\": {\n \"meta\": {\n \"displayName\": \"Glass\",\n \"category\": \"glass\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"colorDiffuse\": [0.949,1,0.988],\n \"colorSpecular\": [0,1,0.769],\n \"specularCoef\": 100,\n \"opacity\": 0.14,\n \"addLightmap\": false,\n \"useInBaking\": false\n }\n },\n \"glass-wall\": {\n \"meta\": {\n \"displayName\": \"Glass\",\n \"category\": \"wall\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"colorDiffuse\": [0.949,1,0.988],\n \"colorSpecular\": [0,1,0.769],\n \"specularCoef\": 100,\n \"opacity\": 0.14,\n \"addLightmap\": false,\n \"useInBaking\": false\n }\n },\n \"wallTop\": {\n \"meta\": {\n \"displayName\": \"Wall Top\"\n },\n \"attributes\": {\n \"colorDiffuse\": [0.188,0.188,0.188],\n \"specularCoef\": 0.1\n }\n },\n \"grass-01\": {\n \"meta\": {\n \"displayName\": \"Grass\",\n \"category\": \"floor\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [4,4],\n \"specularCoef\": 20,\n \"mapDiffuse\": \"archilogic/tex/8463d96062b98f018edb34af61642f50.hi-res.gz.dds\",\n \"mapNormal\": \"archilogic/tex/626edbfd34ba34c19fb92dad87fade82.hi-res.gz.dds\",\n \"mapSpecular\": \"archilogic/tex/12fd170deef977469cb810a8759aa3eb.hi-res.gz.dds\",\n \"receiveRealTimeShadows\": true,\n \"mapDiffusePreview\": \"archilogic/tex/8463d96062b98f018edb34af61642f50.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/8463d96062b98f018edb34af61642f50.source.jpg\",\n \"mapSpecularPreview\": \"archilogic/tex/12fd170deef977469cb810a8759aa3eb.lo-res.jpg\",\n \"mapSpecularSource\": \"archilogic/tex/12fd170deef977469cb810a8759aa3eb.source.jpg\",\n \"mapNormalPreview\": \"archilogic/tex/626edbfd34ba34c19fb92dad87fade82.lo-res.jpg\",\n \"mapNormalSource\": \"archilogic/tex/626edbfd34ba34c19fb92dad87fade82.source.jpg\"\n }\n },\n \"gravel-01\": {\n \"meta\": {\n \"displayName\": \"Gravel\",\n \"category\": \"floor\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [3,3],\n \"specularCoef\": 20,\n \"mapDiffuse\": \"archilogic/tex/9fbf5f70818f431ddf28b6a828b68af7.hi-res.gz.dds\",\n \"mapNormal\": \"archilogic/tex/0f83e844962e6c10ca9ca56d0ae02cfd.hi-res.gz.dds\",\n \"mapSpecular\": \"archilogic/tex/367a4374a0d049aa0886ef68b76054f4.hi-res.gz.dds\",\n \"receiveRealTimeShadows\": true,\n \"mapDiffusePreview\": \"archilogic/tex/9fbf5f70818f431ddf28b6a828b68af7.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/9fbf5f70818f431ddf28b6a828b68af7.source.jpg\",\n \"mapSpecularPreview\": \"archilogic/tex/367a4374a0d049aa0886ef68b76054f4.lo-res.jpg\",\n \"mapSpecularSource\": \"archilogic/tex/367a4374a0d049aa0886ef68b76054f4.source.jpg\",\n \"mapNormalPreview\": \"archilogic/tex/0f83e844962e6c10ca9ca56d0ae02cfd.lo-res.jpg\",\n \"mapNormalSource\": \"archilogic/tex/0f83e844962e6c10ca9ca56d0ae02cfd.source.jpg\"\n }\n },\n \"floor_grass\": {\n \"meta\": {\n \"displayName\": \"Grass\",\n \"category\": \"floor\",\n \"showInMenu\": false\n },\n \"attributes\": {\n \"size\": [1,1],\n \"colorSpecular\": [1,1,1],\n \"specularCoef\": 50,\n \"mapDiffuse\": \"archilogic/tex/828dfb1aae222e7e4bf563cfb65fc26a.hi-res.gz.dds\",\n \"receiveRealTimeShadows\": true,\n \"mapDiffusePreview\": \"archilogic/tex/828dfb1aae222e7e4bf563cfb65fc26a.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/828dfb1aae222e7e4bf563cfb65fc26a.source.jpg\"\n }\n },\n \"concrete-wall\": {\n \"meta\": {\n \"displayName\": \"Concrete Formwork\",\n \"category\": \"floor\",\n \"showInMenu\": false\n },\n \"attributes\": {\n \"size\": [3.6,3.6],\n \"specularCoef\": 40,\n \"mapDiffuse\": \"archilogic/tex/e529f05d7e3b1ad95c94752098c6ee8e.hi-res.gz.dds\",\n \"receiveRealTimeShadows\": true,\n \"mapDiffusePreview\": \"archilogic/tex/e529f05d7e3b1ad95c94752098c6ee8e.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/e529f05d7e3b1ad95c94752098c6ee8e.source.jpg\"\n }\n },\n \"floor_wood\": {\n \"meta\": {\n \"displayName\": \"Floor Wood\",\n \"category\": \"floor\",\n \"showInMenu\": false\n },\n \"attributes\": {\n \"size\": [7,7],\n \"specularCoef\": 40,\n \"mapDiffuse\": \"archilogic/tex/4433d7b5ed780022d4ad9be94a457961.hi-res.gz.dds\",\n \"receiveRealTimeShadows\": true,\n \"mapDiffusePreview\": \"archilogic/tex/4433d7b5ed780022d4ad9be94a457961.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/4433d7b5ed780022d4ad9be94a457961.source.jpg\"\n }\n },\n \"floor_ahorn\": {\n \"meta\": {\n \"displayName\": \"Floor Ahorn\",\n \"category\": \"floor\",\n \"showInMenu\": false\n },\n \"attributes\": {\n \"size\": [3,3],\n \"specularCoef\": 40,\n \"mapDiffuse\": \"archilogic/tex/73fc859500c231c1f67346dd40ace8dc.hi-res.gz.dds\",\n \"receiveRealTimeShadows\": true,\n \"mapDiffusePreview\": \"archilogic/tex/73fc859500c231c1f67346dd40ace8dc.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/73fc859500c231c1f67346dd40ace8dc.source.jpg\"\n }\n },\n \"floor_ebenholz\": {\n \"meta\": {\n \"displayName\": \"Floor Ebenholz\",\n \"category\": \"floor\",\n \"showInMenu\": false\n },\n \"attributes\": {\n \"size\": [3,3],\n \"specularCoef\": 40,\n \"mapDiffuse\": \"archilogic/tex/d6f9e525372773289d3721cdad924fb9.hi-res.gz.dds\",\n \"receiveRealTimeShadows\": true,\n \"mapDiffusePreview\": \"archilogic/tex/d6f9e525372773289d3721cdad924fb9.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/d6f9e525372773289d3721cdad924fb9.source.jpg\"\n }\n },\n \"floor_vintage_timber_1\": {\n \"meta\": {\n \"displayName\": \"Floor Vintage Timber 1\",\n \"category\": \"floor\",\n \"showInMenu\": false\n },\n \"attributes\": {\n \"size\": [3,3],\n \"specularCoef\": 40,\n \"mapDiffuse\": \"archilogic/tex/26601a09792802ffd9ebdd66d418a1b1.hi-res.gz.dds\",\n \"receiveRealTimeShadows\": true,\n \"mapDiffusePreview\": \"archilogic/tex/26601a09792802ffd9ebdd66d418a1b1.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/26601a09792802ffd9ebdd66d418a1b1.source.jpg\"\n }\n },\n \"wood_parquet_2\": {\n \"meta\": {\n \"displayName\": \"Wood Parquet 2\",\n \"category\": \"floor\",\n \"showInMenu\": false\n },\n \"attributes\": {\n \"size\": [2,2],\n \"colorSpecular\": [0.667,0.667,0.667],\n \"specularCoef\": 40,\n \"mapDiffuse\": \"archilogic/tex/22327ea017e8c358402d1130c5a74ba7.hi-res.gz.dds\",\n \"mapNormal\": \"archilogic/tex/2ccf45239f3760043910d7729a7c0b30.hi-res.gz.dds\",\n \"mapSpecular\": \"archilogic/tex/e96e36ae77a7b6929ff62d6e70b18d8b.hi-res.gz.dds\",\n \"receiveRealTimeShadows\": true,\n \"mapDiffusePreview\": \"archilogic/tex/22327ea017e8c358402d1130c5a74ba7.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/22327ea017e8c358402d1130c5a74ba7.source.png\",\n \"mapSpecularPreview\": \"archilogic/tex/e96e36ae77a7b6929ff62d6e70b18d8b.lo-res.jpg\",\n \"mapSpecularSource\": \"archilogic/tex/e96e36ae77a7b6929ff62d6e70b18d8b.source.png\",\n \"mapNormalPreview\": \"archilogic/tex/2ccf45239f3760043910d7729a7c0b30.lo-res.jpg\",\n \"mapNormalSource\": \"archilogic/tex/2ccf45239f3760043910d7729a7c0b30.source.png\"\n }\n },\n \"floor_vintage_timber_3\": {\n \"meta\": {\n \"displayName\": \"Floor Vintage Timber 3\",\n \"category\": \"floor\",\n \"showInMenu\": false\n },\n \"attributes\": {\n \"size\": [3.2,3.2],\n \"colorSpecular\": [0.102,0.102,0.102],\n \"specularCoef\": 40,\n \"mapDiffuse\": \"archilogic/tex/c659ad823689f7502699105e6b8974f1.hi-res.gz.dds\",\n \"receiveRealTimeShadows\": true,\n \"mapDiffusePreview\": \"archilogic/tex/c659ad823689f7502699105e6b8974f1.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/c659ad823689f7502699105e6b8974f1.source.jpg\"\n }\n },\n \"floor_vintage_timber_4\": {\n \"meta\": {\n \"displayName\": \"Floor Vintage Timber 4\",\n \"category\": \"floor\",\n \"showInMenu\": false\n },\n \"attributes\": {\n \"size\": [3,3],\n \"specularCoef\": 40,\n \"mapDiffuse\": \"archilogic/tex/e4ce6e72837661fa4555fb4cb9da7b1b.hi-res.gz.dds\",\n \"receiveRealTimeShadows\": true,\n \"mapDiffusePreview\": \"archilogic/tex/e4ce6e72837661fa4555fb4cb9da7b1b.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/e4ce6e72837661fa4555fb4cb9da7b1b.source.jpg\"\n }\n },\n \"floor_vintage_timber_5\": {\n \"meta\": {\n \"displayName\": \"Floor Vintage Timber 5\",\n \"category\": \"floor\",\n \"showInMenu\": false\n },\n \"attributes\": {\n \"size\": [3.6,3.6],\n \"specularCoef\": 40,\n \"mapDiffuse\": \"archilogic/tex/04e192e36ae01ff961c9a882682a19ff.hi-res.gz.dds\",\n \"receiveRealTimeShadows\": true,\n \"mapDiffusePreview\": \"archilogic/tex/04e192e36ae01ff961c9a882682a19ff.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/04e192e36ae01ff961c9a882682a19ff.source.jpg\"\n }\n },\n \"floor_vintage_timber_6\": {\n \"meta\": {\n \"displayName\": \"Floor Vintage Timber 6\",\n \"category\": \"floor\",\n \"showInMenu\": false\n },\n \"attributes\": {\n \"size\": [2,2],\n \"specularCoef\": 40,\n \"mapDiffuse\": \"archilogic/tex/82ca0b741e0ef051e55d0d5b7a46cd54.hi-res.gz.dds\",\n \"receiveRealTimeShadows\": true,\n \"mapDiffusePreview\": \"archilogic/tex/82ca0b741e0ef051e55d0d5b7a46cd54.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/82ca0b741e0ef051e55d0d5b7a46cd54.source.jpg\"\n }\n },\n \"doorLeaf-flush-white\": {\n \"meta\": {\n \"displayName\": \"Door Flush White\",\n \"category\": \"doorLeaf\",\n \"showInMenu\": true,\n \"thumb\": \"/archilogic/texture/doors/thumbs/door-flush-white-thumb.jpg\"\n },\n \"attributes\": {\n \"colorDiffuse\": [0.95,0.95,0.95],\n \"colorSpecular\": [0.04,0.04,0.04],\n \"specularCoef\": 30\n }\n },\n \"doorLeaf-4-panels-white\": {\n \"meta\": {\n \"displayName\": \"Door 4 Panels White\",\n \"category\": \"doorLeaf\",\n \"showInMenu\": true,\n \"thumb\": \"/archilogic/texture/doors/thumbs/door-panel-white-thumb.jpg\"\n },\n \"attributes\": {\n \"size\": [1,1],\n \"colorDiffuse\": [0.95,0.95,0.95],\n \"colorSpecular\": [0.04,0.04,0.04],\n \"specularCoef\": 30,\n \"mapDiffuse\": \"archilogic/tex/dd1814c45fe19b59a01d389dbf9d2ab1.hi-res.gz.dds\",\n \"mapNormal\": \"archilogic/tex/b42162adaa029e5d56958027b066eb1c.hi-res.gz.dds\",\n \"mapDiffusePreview\": \"archilogic/tex/dd1814c45fe19b59a01d389dbf9d2ab1.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/dd1814c45fe19b59a01d389dbf9d2ab1.source.jpg\",\n \"mapNormalPreview\": \"archilogic/tex/b42162adaa029e5d56958027b066eb1c.lo-res.jpg\",\n \"mapNormalSource\": \"archilogic/tex/b42162adaa029e5d56958027b066eb1c.source.jpg\"\n }\n },\n \"doorFrame-flush-white\": {\n \"meta\": {\n \"displayName\": \"Door Flush White\",\n \"category\": \"doorFrame\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [1,1],\n \"colorDiffuse\": [0.95,0.95,0.95],\n \"colorSpecular\": [0.04,0.04,0.04],\n \"specularCoef\": 30\n }\n },\n \"aluminium\": {\n \"meta\": {\n \"displayName\": \"Aluminium\",\n \"category\": \"doorHandle\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [1,1],\n \"colorDiffuse\": [0.5,0.5,0.5],\n \"colorSpecular\": [0.34,0.34,0.34],\n \"specularCoef\": 40\n }\n },\n \"doorLeaf-whitewood\": {\n \"meta\": {\n \"displayName\": \"Whitewood Panels\",\n \"category\": \"doorLeaf\",\n \"showInMenu\": true,\n \"thumb\": \"/archilogic/texture/doors/thumbs/door-panel-whitewood-thumb.jpg\"\n },\n \"attributes\": {\n \"size\": [1,1],\n \"colorDiffuse\": [1,1,1],\n \"colorSpecular\": [0.19,0.19,0.19],\n \"specularCoef\": 20,\n \"mapDiffuse\": \"archilogic/tex/072bd60b99f5a92cdde5bd5098dc9284.hi-res.gz.dds\",\n \"mapSpecular\": \"archilogic/tex/7f51acb6c6eb3d81aa866f9eed5dc3d6.hi-res.gz.dds\",\n \"mapNormal\": \"archilogic/tex/b42162adaa029e5d56958027b066eb1c.hi-res.gz.dds\",\n \"mapDiffusePreview\": \"archilogic/tex/072bd60b99f5a92cdde5bd5098dc9284.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/072bd60b99f5a92cdde5bd5098dc9284.source.jpg\",\n \"mapSpecularPreview\": \"archilogic/tex/7f51acb6c6eb3d81aa866f9eed5dc3d6.lo-res.jpg\",\n \"mapSpecularSource\": \"archilogic/tex/7f51acb6c6eb3d81aa866f9eed5dc3d6.source.jpg\",\n \"mapNormalPreview\": \"archilogic/tex/b42162adaa029e5d56958027b066eb1c.lo-res.jpg\",\n \"mapNormalSource\": \"archilogic/tex/b42162adaa029e5d56958027b066eb1c.source.jpg\"\n }\n },\n \"doorLeaf-glass\": {\n \"meta\": {\n \"displayName\": \"Glass\",\n \"category\": \"doorLeaf\",\n \"showInMenu\": true,\n \"thumb\": \"/archilogic/texture/doors/thumbs/door-glass-thumb.jpg\"\n },\n \"attributes\": {\n \"colorDiffuse\": [0.949,1,0.988],\n \"colorSpecular\": [0,1,0.769],\n \"specularCoef\": 100,\n \"opacity\": 0.24,\n \"addLightmap\": false\n }\n },\n \"chrome\": {\n \"meta\": {\n \"displayName\": \"Aluminium\",\n \"category\": \"metal\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [1,1],\n \"colorDiffuse\": [0.5,0.5,0.5],\n \"colorSpecular\": [0.34,0.34,0.34],\n \"specularCoef\": 50\n }\n },\n \"cabinet_paint_white\": {\n \"meta\": {\n \"displayName\": \"Paint White\",\n \"category\": \"cabinet\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [1,1],\n \"colorDiffuse\": [0.9,0.9,0.9],\n \"colorSpecular\": [0.1,0.1,0.1],\n \"specularCoef\": 10\n }\n },\n \"cabinet_paint_creme\": {\n \"meta\": {\n \"displayName\": \"Paint Creme\",\n \"category\": \"cabinet\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [1,1],\n \"colorDiffuse\": [0.8,0.78,0.73],\n \"colorSpecular\": [0.2,0.2,0.2],\n \"specularCoef\": 10\n }\n },\n \"cabinet_paint_grey\": {\n \"meta\": {\n \"displayName\": \"Paint Light Grey\",\n \"category\": \"cabinet\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [1,1],\n \"colorDiffuse\": [0.7,0.7,0.7],\n \"colorSpecular\": [0.2,0.2,0.2],\n \"specularCoef\": 10\n }\n },\n \"cabinet_paint_beige\": {\n \"meta\": {\n \"displayName\": \"Paint Beige\",\n \"category\": \"cabinet\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [1,1],\n \"colorDiffuse\": [0.57,0.53,0.48],\n \"colorSpecular\": [0.4,0.4,0.4],\n \"specularCoef\": 10\n }\n },\n \"cabinet_paint_green\": {\n \"meta\": {\n \"displayName\": \"Paint Green\",\n \"category\": \"cabinet\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [1,1],\n \"colorDiffuse\": [0.455, 0.502, 0.357],\n \"colorSpecular\": [0.4,0.4,0.4],\n \"specularCoef\": 10\n }\n },\n \"cabinet_paint_blue\": {\n \"meta\": {\n \"displayName\": \"Paint Blue\",\n \"category\": \"cabinet\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [1,1],\n \"colorDiffuse\":[0.357,0.447,0.502],\n \"colorSpecular\": [0.4,0.4,0.4],\n \"specularCoef\": 10\n }\n },\n \"cabinet_paint_brick\": {\n \"meta\": {\n \"displayName\": \"Paint Brick\",\n \"category\": \"cabinet\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [1,1],\n \"colorDiffuse\": [0.651, 0.357, 0.247],\n \"colorSpecular\": [0.4,0.4,0.4],\n \"specularCoef\": 10\n }\n },\n \"cabinet_paint_anthrazit\": {\n \"meta\": {\n \"displayName\": \"Paint Anthrazit\",\n \"category\": \"cabinet\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [1,1],\n \"colorDiffuse\": [0.3,0.3,0.3],\n \"colorSpecular\": [0.4,0.4,0.4],\n \"specularCoef\": 10\n }\n },\n \"cabinet_paint_black\": {\n \"meta\": {\n \"displayName\": \"Paint Black\",\n \"category\": \"cabinet\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [1,1],\n \"colorDiffuse\": [0.05,0.05,0.05],\n \"colorSpecular\": [0.5,0.5,0.5],\n \"specularCoef\": 10\n }\n },\n \"cabinet_wood_fir\": {\n \"meta\": {\n \"displayName\": \"Wood Fir mtex_12756\",\n \"category\": \"cabinet\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [2.4,2.4],\n \"colorDiffuse\": [1,1,1],\n \"colorSpecular\": [0.2,0.2,0.2],\n \"specularCoef\": 15,\n \"mapDiffuse\": \"archilogic/tex/e0ad17dc344e514eb91d98b365d4e1c0.hi-res.gz.dds\",\n \"mapDiffusePreview\": \"archilogic/tex/e0ad17dc344e514eb91d98b365d4e1c0.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/e0ad17dc344e514eb91d98b365d4e1c0.source.jpg\"\n }\n },\n \"cabinet_cherry_veneer\": {\n \"meta\": {\n \"displayName\": \"Wood Cherry Veneer\",\n \"category\": \"cabinet\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [1.2, 1.2 ],\n \"colorDiffuse\": [1, 1, 1],\n \"colorSpecular\": [0.322, 0.318,0.318],\n \"specularCoef\": 26,\n \"mapDiffusePreview\": \"/535e624259ee6b0200000484/textures/uploads/7239eb736d6877a34e8ebe2e5e9c8a57.lo-res.jpg\",\n \"mapDiffuse\": \"/535e624259ee6b0200000484/textures/uploads/7239eb736d6877a34e8ebe2e5e9c8a57.hi-res.gz.dds\",\n \"mapDiffuseSource\": \"/535e624259ee6b0200000484/textures/uploads/7239eb736d6877a34e8ebe2e5e9c8a57.source.jpg\",\n \"mapSpecularPreview\": \"/535e624259ee6b0200000484/textures/uploads/58301ccaa8ed2be78e00c9ecdf5ab7af.lo-res.jpg\",\n \"mapSpecular\": \"/535e624259ee6b0200000484/textures/uploads/58301ccaa8ed2be78e00c9ecdf5ab7af.hi-res.gz.dds\",\n \"mapSpecularSource\": \"/535e624259ee6b0200000484/textures/uploads/58301ccaa8ed2be78e00c9ecdf5ab7af.source.jpg\",\n \"mapNormalPreview\": \"/535e624259ee6b0200000484/textures/uploads/ff30448e22c5e2131991e25c219d2c2c.lo-res.jpg\",\n \"mapNormal\": \"/535e624259ee6b0200000484/textures/uploads/ff30448e22c5e2131991e25c219d2c2c.hi-res.gz.dds\",\n \"mapNormalSource\": \"/535e624259ee6b0200000484/textures/uploads/ff30448e22c5e2131991e25c219d2c2c.source.jpg\"\n }\n },\n \"cabinet_beech_veneer\": {\n \"meta\": {\n \"displayName\": \"Wood Beech Veneer\",\n \"category\": \"cabinet\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [1, 1],\n \"colorDiffuse\": [1, 1, 1],\n \"colorSpecular\": [0.212, 0.212, 0.212],\n \"specularCoef\": 24,\n \"mapDiffusePreview\": \"/535e624259ee6b0200000484/textures/uploads/96487b8905d72f171b84400f5f1759d8.lo-res.jpg\",\n \"mapDiffuse\": \"/535e624259ee6b0200000484/textures/uploads/96487b8905d72f171b84400f5f1759d8.hi-res.gz.dds\",\n \"mapDiffuseSource\": \"/535e624259ee6b0200000484/textures/uploads/96487b8905d72f171b84400f5f1759d8.source.jpg\",\n \"mapNormalPreview\": \"/535e624259ee6b0200000484/textures/uploads/62b61216bf12d6c1a1a26938fbb454f7.lo-res.jpg\",\n \"mapNormal\": \"/535e624259ee6b0200000484/textures/uploads/62b61216bf12d6c1a1a26938fbb454f7.hi-res.gz.dds\",\n \"mapNormalSource\": \"/535e624259ee6b0200000484/textures/uploads/62b61216bf12d6c1a1a26938fbb454f7.source.jpg\",\n \"mapSpecularPreview\": \"/535e624259ee6b0200000484/textures/uploads/9f974ddee94d5c2a49b99d5ec32da287.lo-res.jpg\",\n \"mapSpecular\": \"/535e624259ee6b0200000484/textures/uploads/9f974ddee94d5c2a49b99d5ec32da287.hi-res.gz.dds\",\n \"mapSpecularSource\": \"/535e624259ee6b0200000484/textures/uploads/9f974ddee94d5c2a49b99d5ec32da287.source.jpg\"\n }\n },\n \"cabinet_chalked_veneer\": {\n \"meta\": {\n \"displayName\": \"Wood Chalked Veneer\",\n \"category\": \"cabinet\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [1, 1],\n \"colorDiffuse\": [1, 1, 1],\n \"colorSpecular\": [0.14, 0.14, 0.14],\n \"specularCoef\": 24,\n \"mapDiffusePreview\": \"/535e624259ee6b0200000484/textures/uploads/a08fb76c0fc9ece60f60262b730c7e59.lo-res.jpg\",\n \"mapDiffuse\": \"/535e624259ee6b0200000484/textures/uploads/a08fb76c0fc9ece60f60262b730c7e59.hi-res.gz.dds\",\n \"mapDiffuseSource\": \"/535e624259ee6b0200000484/textures/uploads/a08fb76c0fc9ece60f60262b730c7e59.source.jpg\",\n \"mapNormalPreview\": \"/535e624259ee6b0200000484/textures/uploads/62b61216bf12d6c1a1a26938fbb454f7.lo-res.jpg\",\n \"mapNormal\": \"/535e624259ee6b0200000484/textures/uploads/62b61216bf12d6c1a1a26938fbb454f7.hi-res.gz.dds\",\n \"mapNormalSource\": \"/535e624259ee6b0200000484/textures/uploads/62b61216bf12d6c1a1a26938fbb454f7.source.jpg\",\n \"mapSpecularPreview\": \"/535e624259ee6b0200000484/textures/uploads/9f974ddee94d5c2a49b99d5ec32da287.lo-res.jpg\",\n \"mapSpecular\": \"/535e624259ee6b0200000484/textures/uploads/9f974ddee94d5c2a49b99d5ec32da287.hi-res.gz.dds\",\n \"mapSpecularSource\": \"/535e624259ee6b0200000484/textures/uploads/9f974ddee94d5c2a49b99d5ec32da287.source.jpg\"\n }\n },\n \"cabinet_wood_fir_wall\": {\n \"meta\": {\n \"displayName\": \"Wood Fir mtex_12756\",\n \"category\": \"wall\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [2.4,2.4],\n \"colorDiffuse\": [1,1,1],\n \"colorSpecular\": [0.2,0.2,0.2],\n \"specularCoef\": 15,\n \"mapDiffuse\": \"archilogic/tex/e0ad17dc344e514eb91d98b365d4e1c0.hi-res.gz.dds\",\n \"mapDiffusePreview\": \"archilogic/tex/e0ad17dc344e514eb91d98b365d4e1c0.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/e0ad17dc344e514eb91d98b365d4e1c0.source.jpg\"\n }\n },\n \"counter_chrome_brushed\": {\n \"meta\": {\n \"displayName\": \"Chrome Brushed\",\n \"category\": \"counter\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [0.2,0.7],\n \"colorDiffuse\": [0.5,0.5,0.5],\n \"colorSpecular\": [0.34,0.34,0.34],\n \"specularCoef\": 50,\n \"mapNormal\": \"archilogic/tex/03305e054dbd97bb57de94531ebcde49.hi-res.gz.dds\",\n \"mapSpecular\": \"archilogic/tex/fe502e29ec739e20e25e0a26090f8200.hi-res.gz.dds\",\n \"mapSpecularPreview\": \"archilogic/tex/fe502e29ec739e20e25e0a26090f8200.lo-res.jpg\",\n \"mapSpecularSource\": \"archilogic/tex/fe502e29ec739e20e25e0a26090f8200.source.jpg\",\n \"mapNormalPreview\": \"archilogic/tex/03305e054dbd97bb57de94531ebcde49.lo-res.jpg\",\n \"mapNormalSource\": \"archilogic/tex/03305e054dbd97bb57de94531ebcde49.source.jpg\"\n }\n },\n \"counter_stone_white\": {\n \"meta\": {\n \"displayName\": \"Stone White\",\n \"category\": \"counter\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [0.5,0.5],\n \"colorDiffuse\": [0.9,0.9,0.9],\n \"colorSpecular\": [0.3,0.3,0.3],\n \"specularCoef\": 15,\n \"mapDiffuse\": \"archilogic/tex/61019e9b8e7f4542eb7a013e7dfae30b.hi-res.gz.dds\",\n \"mapNormal\": \"archilogic/tex/cfe24afab1a720ee1525af2b6821f1e7.hi-res.gz.dds\",\n \"mapSpecular\": \"archilogic/tex/5ec4dfae5d8545d38177a6f76147fd26.hi-res.gz.dds\",\n \"mapDiffusePreview\": \"archilogic/tex/61019e9b8e7f4542eb7a013e7dfae30b.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/61019e9b8e7f4542eb7a013e7dfae30b.source.jpg\",\n \"mapSpecularPreview\": \"archilogic/tex/5ec4dfae5d8545d38177a6f76147fd26.lo-res.jpg\",\n \"mapSpecularSource\": \"archilogic/tex/5ec4dfae5d8545d38177a6f76147fd26.source.jpg\",\n \"mapNormalPreview\": \"archilogic/tex/cfe24afab1a720ee1525af2b6821f1e7.lo-res.jpg\",\n \"mapNormalSource\": \"archilogic/tex/cfe24afab1a720ee1525af2b6821f1e7.source.jpg\"\n }\n },\n \"counter_granite_light\": {\n \"meta\": {\n \"displayName\": \"Granite Light mtex_11181\",\n \"category\": \"counter\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [0.5,0.5],\n \"colorDiffuse\": [0.9,0.9,0.9],\n \"colorSpecular\": [0.3,0.3,0.3],\n \"specularCoef\": 40,\n \"mapDiffuse\": \"archilogic/tex/ded6f1d9a706119919bbc7c96d8ed6b2.hi-res.gz.dds\",\n \"mapNormal\": \"archilogic/tex/cfe24afab1a720ee1525af2b6821f1e7.hi-res.gz.dds\",\n \"mapSpecular\": \"archilogic/tex/976e94355e5bda592304f280d1d02d48.hi-res.gz.dds\",\n \"mapDiffusePreview\": \"archilogic/tex/ded6f1d9a706119919bbc7c96d8ed6b2.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/ded6f1d9a706119919bbc7c96d8ed6b2.source.jpg\",\n \"mapSpecularPreview\": \"archilogic/tex/976e94355e5bda592304f280d1d02d48.lo-res.jpg\",\n \"mapSpecularSource\": \"archilogic/tex/976e94355e5bda592304f280d1d02d48.source.jpg\",\n \"mapNormalPreview\": \"archilogic/tex/cfe24afab1a720ee1525af2b6821f1e7.lo-res.jpg\",\n \"mapNormalSource\": \"archilogic/tex/cfe24afab1a720ee1525af2b6821f1e7.source.jpg\"\n }\n },\n \"counter_granite_black\": {\n \"meta\": {\n \"displayName\": \"Granite Black mtex_11180\",\n \"category\": \"counter\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [0.5,0.5],\n \"colorDiffuse\": [1,1,1],\n \"colorSpecular\": [0.4,0.4,0.4],\n \"specularCoef\": 40,\n \"mapDiffuse\": \"archilogic/tex/975742bddd8326ef574878ca9132b4ed.hi-res.gz.dds\",\n \"mapNormal\": \"archilogic/tex/19cc02e1993bd5b118e03c169ee0ef33.hi-res.gz.dds\",\n \"mapSpecular\": \"archilogic/tex/7fe0c88fc1c03881949652c8c3d55aaa.hi-res.gz.dds\",\n \"mapDiffusePreview\": \"archilogic/tex/975742bddd8326ef574878ca9132b4ed.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/975742bddd8326ef574878ca9132b4ed.source.jpg\",\n \"mapSpecularPreview\": \"archilogic/tex/7fe0c88fc1c03881949652c8c3d55aaa.lo-res.jpg\",\n \"mapSpecularSource\": \"archilogic/tex/7fe0c88fc1c03881949652c8c3d55aaa.source.jpg\",\n \"mapNormalPreview\": \"archilogic/tex/19cc02e1993bd5b118e03c169ee0ef33.lo-res.jpg\",\n \"mapNormalSource\": \"archilogic/tex/19cc02e1993bd5b118e03c169ee0ef33.source.jpg\"\n }\n },\n \"counter_concrete_fluid\": {\n \"meta\": {\n \"displayName\": \"Concrete Natural\",\n \"category\": \"counter\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [0.5,0.5],\n \"colorDiffuse\": [0.867,0.867,0.867],\n \"colorSpecular\": [0.4,0.4,0.4],\n \"specularCoef\": 40,\n \"mapDiffuse\": \"archilogic/tex/7af78308b190531d128c71e3482e21ea.hi-res.gz.dds\",\n \"mapNormal\": \"archilogic/tex/f544850902a92746d30d0b80bda43c62.hi-res.gz.dds\",\n \"mapSpecular\": \"archilogic/tex/34b87f4d4d1b6d89b370862e243ebf12.hi-res.gz.dds\",\n \"mapDiffusePreview\": \"archilogic/tex/7af78308b190531d128c71e3482e21ea.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/7af78308b190531d128c71e3482e21ea.source.jpg\",\n \"mapSpecularPreview\": \"archilogic/tex/34b87f4d4d1b6d89b370862e243ebf12.lo-res.jpg\",\n \"mapSpecularSource\": \"archilogic/tex/34b87f4d4d1b6d89b370862e243ebf12.source.jpg\",\n \"mapNormalPreview\": \"archilogic/tex/f544850902a92746d30d0b80bda43c62.lo-res.jpg\",\n \"mapNormalSource\": \"archilogic/tex/f544850902a92746d30d0b80bda43c62.source.jpg\"\n }\n },\n \"cooktop_westinghouse_60\": {\n \"meta\": {\n \"displayName\": \"Cooktop Westinghouse 60\",\n \"category\": \"cooktop60\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [1,1],\n \"colorDiffuse\": [1,1,1],\n \"colorSpecular\": [0.3,0.3,0.3],\n \"specularCoef\": 50,\n \"mapDiffuse\": \"/535e624259ee6b0200000484/textures/uploads/03796b53a0776136c919ef7e9dc6c96b.hi-res.gz.dds\",\n \"mapDiffusePreview\": \"/535e624259ee6b0200000484/textures/uploads/03796b53a0776136c919ef7e9dc6c96b.lo-res.jpg\",\n \"mapDiffuseSource\": \"/535e624259ee6b0200000484/textures/uploads/03796b53a0776136c919ef7e9dc6c96b.source.jpg\"\n }\n },\n \"cooktop_westinghouse_90\": {\n \"meta\": {\n \"displayName\": \"Cooktop Westinghouse 90\",\n \"category\": \"cooktop90\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [1,1],\n \"colorDiffuse\": [1,1,1],\n \"colorSpecular\": [0.3,0.3,0.3],\n \"specularCoef\": 50,\n \"mapDiffuse\": \"/535e624259ee6b0200000484/textures/uploads/8aa7c25cd74007e497b782f0fbfea187.hi-res.gz.dds\",\n \"mapDiffusePreview\": \"/535e624259ee6b0200000484/textures/uploads/8aa7c25cd74007e497b782f0fbfea187.lo-res.jpg\",\n \"mapDiffuseSource\": \"/535e624259ee6b0200000484/textures/uploads/8aa7c25cd74007e497b782f0fbfea187.source.jpg\"\n }\n },\n \"oven_miele_60-60\": {\n \"meta\": {\n \"displayName\": \"Oven Miele 60x60\",\n \"category\": \"oven60\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [1,1],\n \"colorDiffuse\": [1,1,1],\n \"colorSpecular\": [0.3,0.3,0.3],\n \"specularCoef\": 50,\n \"mapDiffuse\": \"/535e624259ee6b0200000484/textures/uploads/53ce86d2ae02d701c70c9488e681d54e.hi-res.gz.dds\",\n \"mapDiffusePreview\": \"/535e624259ee6b0200000484/textures/uploads/53ce86d2ae02d701c70c9488e681d54e.lo-res.jpg\",\n \"mapDiffuseSource\": \"/535e624259ee6b0200000484/textures/uploads/53ce86d2ae02d701c70c9488e681d54e.source.jpg\"\n }\n },\n \"oven_miele_90-48\": {\n \"meta\": {\n \"displayName\": \"Oven Miele 90x48\",\n \"category\": \"oven90\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [1,1],\n \"colorDiffuse\": [1,1,1],\n \"colorSpecular\": [0.3,0.3,0.3],\n \"specularCoef\": 50,\n \"mapDiffuse\": \"/535e624259ee6b0200000484/textures/uploads/22e8dd6c7d90cf88e6d0d5c89403753d.hi-res.gz.dds\",\n \"mapDiffusePreview\": \"/535e624259ee6b0200000484/textures/uploads/22e8dd6c7d90cf88e6d0d5c89403753d.lo-res.jpg\",\n \"mapDiffuseSource\": \"/535e624259ee6b0200000484/textures/uploads/22e8dd6c7d90cf88e6d0d5c89403753d.source.jpg\"\n }\n },\n \"microwave_samsung\": {\n \"meta\": {\n \"displayName\": \"Microwave Samsung\",\n \"category\": \"microwave\",\n \"showInMenu\": true\n },\n \"attributes\": {\n \"size\": [1,1],\n \"colorDiffuse\": [1,1,1],\n \"colorSpecular\": [0.3,0.3,0.3],\n \"specularCoef\": 50,\n \"mapDiffuse\": \"/535e624259ee6b0200000484/textures/uploads/e3959871393650ae83389cd69f377c25.hi-res.gz.dds\",\n \"mapDiffusePreview\": \"/535e624259ee6b0200000484/textures/uploads/e3959871393650ae83389cd69f377c25.lo-res.jpg\",\n \"mapDiffuseSource\": \"/535e624259ee6b0200000484/textures/uploads/e3959871393650ae83389cd69f377c25.source.jpg\"\n }\n },\n \"oven_vzug\": {\n \"meta\": {\n \"displayName\": \"Oven VZug\",\n \"category\": \"oven\",\n \"showInMenu\": false\n },\n \"attributes\": {\n \"size\": [1,1],\n \"colorDiffuse\": [1,1,1],\n \"colorSpecular\": [0.3,0.3,0.3],\n \"specularCoef\": 50,\n \"mapDiffuse\": \"archilogic/tex/d67fb5b3b852f44aa95f12b9f6f9e721.hi-res.gz.dds\",\n \"mapSpecular\": \"archilogic/tex/18168af2d7c5d21845d67424b9f42fee.hi-res.gz.dds\",\n \"mapDiffusePreview\": \"archilogic/tex/d67fb5b3b852f44aa95f12b9f6f9e721.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/d67fb5b3b852f44aa95f12b9f6f9e721.source.jpg\",\n \"mapSpecularPreview\": \"archilogic/tex/18168af2d7c5d21845d67424b9f42fee.lo-res.jpg\",\n \"mapSpecularSource\": \"archilogic/tex/18168af2d7c5d21845d67424b9f42fee.source.jpg\"\n }\n },\n \"oven_miele\": {\n \"meta\": {\n \"displayName\": \"Oven VZug\",\n \"category\": \"oven\",\n \"showInMenu\": false\n },\n \"attributes\": {\n \"size\": [1,1],\n \"colorDiffuse\": [1,1,1],\n \"colorSpecular\": [0.3,0.3,0.3],\n \"specularCoef\": 50,\n \"mapDiffuse\": \"archilogic/tex/1fc90bca228862d77d943a3a0fc0c22a.hi-res.gz.dds\",\n \"mapSpecular\": \"archilogic/tex/b6c63f108ef511dd768663c334123496.hi-res.gz.dds\",\n \"mapDiffusePreview\": \"archilogic/tex/1fc90bca228862d77d943a3a0fc0c22a.lo-res.jpg\",\n \"mapDiffuseSource\": \"archilogic/tex/1fc90bca228862d77d943a3a0fc0c22a.source.jpg\",\n \"mapSpecularPreview\": \"archilogic/tex/b6c63f108ef511dd768663c334123496.lo-res.jpg\",\n \"mapSpecularSource\": \"archilogic/tex/b6c63f108ef511dd768663c334123496.source.jpg\"\n }\n }\n}\n","import cloneDeep from 'lodash/cloneDeep'\nimport materialLibrary from './material-lib.js'\n\nexport default function getMaterial(material) {\n var STORAGE_URL = 'https://storage.3d.io/'\n var mat = materialLibrary[material]\n\n if (!mat) return material\n\n var attr = cloneDeep(mat.attributes)\n Object.keys(attr).forEach(a => {\n // get textures\n if (a.indexOf('map') > -1 ) {\n // fix to prevent double slash\n if (attr[a][0] === '/') attr[a] = attr[a].substring(1)\n // get full texture path\n attr[a] = STORAGE_URL + attr[a]\n }\n })\n return attr\n}","export default function updateSchema(newData) {\n var materialProperties = {}\n Object.keys(newData)\n .filter(function (propKey) { return propKey.substr(0, 9) === 'material_' })\n .forEach(function (propKey) {\n materialProperties[propKey] = { type: 'string' }\n })\n this.extendSchema(materialProperties)\n}","var DEBUG = true\n\n// methods\n\nfunction flat (v) {\n // calculate normals for flat shading\n var n = new Float32Array(v.length)\n var i, l, crx, cry, crz, invScalar\n var hasFaultyTrigons = false\n for (i = 0, l = v.length; i < l; i += 9) {\n // cross product (a-b) x (c-b)\n crx = (v[i + 7] - v[i + 4]) * (v[i + 2] - v[i + 5]) - (v[i + 8] - v[i + 5]) * (v[i + 1] - v[i + 4])\n cry = (v[i + 8] - v[i + 5]) * (v[i] - v[i + 3]) - (v[i + 6] - v[i + 3]) * (v[i + 2] - v[i + 5])\n crz = (v[i + 6] - v[i + 3]) * (v[i + 1] - v[i + 4]) - (v[i + 7] - v[i + 4]) * (v[i] - v[i + 3])\n // normalize\n invScalar = 1 / Math.sqrt(crx * crx + cry * cry + crz * crz)\n // Fallback for trigons that don't span an area\n if (invScalar === Infinity) {\n invScalar = 0\n hasFaultyTrigons = true\n }\n // set normals\n n[i] = n[i + 3] = n[i + 6] = crx * invScalar\n n[i + 1] = n[i + 4] = n[i + 7] = cry * invScalar\n n[i + 2] = n[i + 5] = n[i + 8] = crz * invScalar\n\n }\n if (DEBUG && hasFaultyTrigons) console.error('Geometry contains trigons that don\\'t span an area.')\n return n\n}\nflat.title = 'Flat'\n\nfunction smooth (v) {\n\n // output\n\n var normals = new Float32Array(v.length)\n\n // internals\n\n var hash, hashes = [], vertexRelatedNormals = {}, faceNormals, averageNormal\n var n\n var crx, cry, crz, invScalar\n var hasFaultyTrigons = false\n var i, l, i2, l2\n\n ////////// 1. connect vertices to faces\n\n // go face by face\n for (i = 0, l = v.length; i < l; i += 9) {\n\n // calculate face normal\n // cross product (a-b) x (c-b)\n crx = (v[i + 7] - v[i + 4]) * (v[i + 2] - v[i + 5]) - (v[i + 8] - v[i + 5]) * (v[i + 1] - v[i + 4])\n cry = (v[i + 8] - v[i + 5]) * (v[i] - v[i + 3]) - (v[i + 6] - v[i + 3]) * (v[i + 2] - v[i + 5])\n crz = (v[i + 6] - v[i + 3]) * (v[i + 1] - v[i + 4]) - (v[i + 7] - v[i + 4]) * (v[i] - v[i + 3])\n // normalize\n invScalar = 1 / Math.sqrt(crx * crx + cry * cry + crz * crz)\n if (invScalar === Infinity) {\n hasFaultyTrigons = true\n invScalar = 0\n }\n // set normals\n n = [crx * invScalar, cry * invScalar, crz * invScalar]\n\n for (i2 = 0, l2 = 9; i2 < l2; i2 += 3) {\n hash = v[i + i2] + '_' + v[i + i2 + 1] + '_' + v[i + i2 + 2]\n if (!vertexRelatedNormals[hash]) {\n vertexRelatedNormals[hash] = {\n faceNormals: [n]\n }\n hashes[hashes.length] = hash\n } else {\n vertexRelatedNormals[hash].faceNormals.push(n)\n }\n }\n }\n\n ////////// 2. calculate average normals from related face normals\n\n var avx, avy, avz\n for (i = 0, l = hashes.length; i < l; i++) {\n hash = hashes[i]\n faceNormals = vertexRelatedNormals[hash].faceNormals\n avx = 0\n avy = 0\n avz = 0\n for (i2 = 0, l2 = faceNormals.length; i2 < l2; i2++) {\n avx += faceNormals[i2][0]\n avy += faceNormals[i2][1]\n avz += faceNormals[i2][2]\n }\n // normalize\n invScalar = 1 / Math.sqrt(avx * avx + avy * avy + avz * avz)\n if (invScalar === Infinity) {\n hasFaultyTrigons = true\n invScalar = 0\n }\n // set average normal\n vertexRelatedNormals[hash].averageNormal = [avx * invScalar, avy * invScalar, avz * invScalar]\n }\n\n ////////// 3. apply average normals to vertices\n\n for (i = 0, l = v.length; i < l; i += 3) {\n hash = v[i] + '_' + v[i + 1] + '_' + v[i + 2]\n averageNormal = vertexRelatedNormals[hash].averageNormal\n normals[i] = averageNormal[0]\n normals[i + 1] = averageNormal[1]\n normals[i + 2] = averageNormal[2]\n }\n\n // return\n if (DEBUG && hasFaultyTrigons) console.error('Shade Smooth: Geometry contains trigons that don\\'t span an area.')\n return normals\n\n}\nsmooth.title = 'Smooth'\n\n// API\n\nvar getNormalsBuffer = {\n flat: flat,\n smooth: smooth,\n}\n\nexport default getNormalsBuffer","// methods\n\nfunction projectAxisY (v) {\n\n var uvs = new Float32Array(v.length / 1.5)\n var uvPos = 0\n\n var i, l\n for (i = 0, l = v.length; i < l; i += 9) {\n\n uvs[uvPos] = v[i + 2]\n uvs[uvPos + 1] = v[i]\n uvs[uvPos + 2] = v[i + 5]\n uvs[uvPos + 3] = v[i + 3]\n uvs[uvPos + 4] = v[i + 8]\n uvs[uvPos + 5] = v[i + 6]\n uvPos += 6\n\n }\n\n return uvs\n\n}\nprojectAxisY.title = 'Project Top Down'\n\nfunction architectural (v) {\n\n var uvs = new Float32Array(v.length / 1.5)\n var uvPos = 0\n\n var i, l, n, components\n for (i = 0, l = v.length; i < l; i += 9) {\n\n // calculate face normal\n // cross product (a-b) x (c-b)\n n = [\n (v[i + 7] - v[i + 4]) * (v[i + 2] - v[i + 5]) - (v[i + 8] - v[i + 5]) * (v[i + 1] - v[i + 4]),\n (v[i + 8] - v[i + 5]) * (v[i] - v[i + 3]) - (v[i + 6] - v[i + 3]) * (v[i + 2] - v[i + 5]),\n (v[i + 6] - v[i + 3]) * (v[i + 1] - v[i + 4]) - (v[i + 7] - v[i + 4]) * (v[i] - v[i + 3])\n ]\n\n // normals should be absolute\n if (n[0] < 0) {\n n[0] *= -1\n }\n if (n[1] < 0) {\n n[1] *= -1\n }\n if (n[2] < 0) {\n n[2] *= -1\n }\n\n // highest first?\n components = [1, 0, 2].sort(function (a, b) {\n return n[a] - n[b]\n })\n\n uvs[uvPos] = v[i + components[1]]\n uvs[uvPos + 1] = v[i + components[0]]\n uvs[uvPos + 2] = v[i + 3 + components[1]]\n uvs[uvPos + 3] = v[i + 3 + components[0]]\n uvs[uvPos + 4] = v[i + 6 + components[1]]\n uvs[uvPos + 5] = v[i + 6 + components[0]]\n uvPos += 6\n\n }\n\n return uvs\n\n}\narchitectural.title = 'Architectural'\n\n// API\n\nvar getUvsBuffer = {\n architectural: architectural,\n projectAxisY: projectAxisY\n}\n\nexport default getUvsBuffer\n","'use strict';\n\n// dependencies\n\nimport getSchema from './common/get-schema.js'\nimport getMaterial from './common/get-material.js'\nimport updateSchema from './common/update-schema.js'\nimport generateNormals from '../../../utils/data3d/buffer/get-normals'\nimport generateUvs from '../../../utils/data3d/buffer/get-uvs'\nimport cloneDeep from 'lodash/cloneDeep'\n\nexport default {\n\n schema: getSchema('closet'),\n\n init: function () {},\n\n updateSchema: updateSchema,\n\n update: function (oldData) {\n var this_ = this\n var data = this_.data\n\n // remove old mesh\n this.remove()\n\n // get defaults and\n this.attributes = cloneDeep(data)\n\n // get meshes and materials from el3d modules\n var meshes = this.generateMeshes3d()\n\n // clean up empty meshes to prevent errors\n var meshKeys = Object.keys(meshes)\n meshKeys.forEach(key => {\n if (!meshes[key].positions || !meshes[key].positions.length) {\n // console.warn('no vertices for mesh', key)\n delete meshes[key]\n }\n })\n\n // setup materials\n // defaults\n var materials = {\n closet: 'cabinet_paint_white'\n }\n\n // check for adapted materials\n var materialKeys = Object.keys(data).filter(function(key) {\n return key.indexOf('material_') > -1\n })\n // add materials to instance\n materialKeys.forEach(function(key) {\n var mesh = key.replace('material_', '')\n materials[mesh] = data[key]\n })\n\n // fetch materials from mat library\n Object.keys(materials).forEach(mat => {\n materials[mat] = getMaterial(materials[mat])\n })\n\n // construct data3d object\n var data3d = {\n meshes: meshes,\n materials: materials\n }\n\n // create new one\n this_.mesh = new THREE.Object3D()\n this_.data3dView = new io3d.aFrame.three.Data3dView({parent: this_.mesh})\n\n // update view\n this_.data3dView.set(data3d)\n this_.el.setObject3D('mesh', this_.mesh)\n // emit event\n this_.el.emit('mesh-updated');\n },\n\n remove: function () {\n if (this.data3dView) {\n this.data3dView.destroy()\n this.data3dView = null\n }\n if (this.mesh) {\n this.el.removeObject3D('mesh')\n this.mesh = null\n }\n },\n\n generateMeshes3d: function () {\n var a = this.attributes\n\n var step = 0,\n elementNum = Math.round(a.l/0.6),\n elementLength = a.l/elementNum,\n handlePos = elementLength*0.8,\n //handleWidth = a.handleWidth+ a.doorWidth,\n handleDistance = 0.05,\n offsetY = -0.01,\n\n // internals\n closetVertices = [],\n cvPos = 0\n\n //CLOSET DOORS\n\n // FRONT VIEW VERTICES\n //\n // A------------C\n // |E\\I------G\\K|\n // | | | |\n // | |M\\Q-O\\S | |\n // | || | | |\n // | |N\\R-P\\T | |\n // |F\\J------H\\L|\n // B------------D\n\n var aX = step,\n aY = a.h + offsetY,\n aZ = a.w,\n bY = 0,\n cX = step+elementLength,\n eX = step+a.doorWidth/2,\n eY = a.h-a.doorWidth,\n fY = a.baseboard,\n gX = step+elementLength-a.doorWidth/2,\n iZ = a.w+a.doorWidth,\n mX = step+handlePos,\n mY = 1+a.handleHeight/2,\n nY = 1-a.handleHeight/2,\n oX = step+handlePos+a.handleLength,\n qZ = a.w+a.doorWidth+ a.handleWidth\n\n for(var c = 0; c0 ) {\n // HANDLE SIDES\n //M\n closetVertices[cvPos] = closetVertices[cvPos + 9] = mX\n closetVertices[cvPos + 1] = closetVertices[cvPos + 10] = mY\n closetVertices[cvPos + 2] = closetVertices[cvPos + 11] = iZ\n //N\n closetVertices[cvPos + 3] = mX\n closetVertices[cvPos + 4] = nY\n closetVertices[cvPos + 5] = iZ\n //R\n closetVertices[cvPos + 6] = closetVertices[cvPos + 12] = mX\n closetVertices[cvPos + 7] = closetVertices[cvPos + 13] = nY\n closetVertices[cvPos + 8] = closetVertices[cvPos + 14] = qZ\n //Q\n closetVertices[cvPos + 15] = mX\n closetVertices[cvPos + 16] = mY\n closetVertices[cvPos + 17] = qZ\n\n cvPos = cvPos + 18\n\n //R\n closetVertices[cvPos] = closetVertices[cvPos + 9] = mX\n closetVertices[cvPos + 1] = closetVertices[cvPos + 10] = nY\n closetVertices[cvPos + 2] = closetVertices[cvPos + 11] = qZ\n //N\n closetVertices[cvPos + 3] = mX\n closetVertices[cvPos + 4] = nY\n closetVertices[cvPos + 5] = iZ\n //P\n closetVertices[cvPos + 6] = closetVertices[cvPos + 12] = oX\n closetVertices[cvPos + 7] = closetVertices[cvPos + 13] = nY\n closetVertices[cvPos + 8] = closetVertices[cvPos + 14] = iZ\n //T\n closetVertices[cvPos + 15] = oX\n closetVertices[cvPos + 16] = nY\n closetVertices[cvPos + 17] = qZ\n\n cvPos = cvPos + 18\n\n //S\n closetVertices[cvPos] = closetVertices[cvPos + 9] = oX\n closetVertices[cvPos + 1] = closetVertices[cvPos + 10] = mY\n closetVertices[cvPos + 2] = closetVertices[cvPos + 11] = qZ\n //T\n closetVertices[cvPos + 3] = oX\n closetVertices[cvPos + 4] = nY\n closetVertices[cvPos + 5] = qZ\n //P\n closetVertices[cvPos + 6] = closetVertices[cvPos + 12] = oX\n closetVertices[cvPos + 7] = closetVertices[cvPos + 13] = nY\n closetVertices[cvPos + 8] = closetVertices[cvPos + 14] = iZ\n //O\n closetVertices[cvPos + 15] = oX\n closetVertices[cvPos + 16] = mY\n closetVertices[cvPos + 17] = iZ\n\n cvPos = cvPos + 18\n\n //M\n closetVertices[cvPos] = closetVertices[cvPos + 9] = mX\n closetVertices[cvPos + 1] = closetVertices[cvPos + 10] = mY\n closetVertices[cvPos + 2] = closetVertices[cvPos + 11] = iZ\n //Q\n closetVertices[cvPos + 3] = mX\n closetVertices[cvPos + 4] = mY\n closetVertices[cvPos + 5] = qZ\n //S\n closetVertices[cvPos + 6] = closetVertices[cvPos + 12] = oX\n closetVertices[cvPos + 7] = closetVertices[cvPos + 13] = mY\n closetVertices[cvPos + 8] = closetVertices[cvPos + 14] = qZ\n //O\n closetVertices[cvPos + 15] = oX\n closetVertices[cvPos + 16] = mY\n closetVertices[cvPos + 17] = iZ\n\n cvPos = cvPos + 18\n }\n // HANDLE FRONT\n //Q\n closetVertices[cvPos] = closetVertices[cvPos+9] = mX\n closetVertices[cvPos+1] = closetVertices[cvPos+10] = mY\n closetVertices[cvPos+2] = closetVertices[cvPos+11] = qZ\n //R\n closetVertices[cvPos+3] = mX\n closetVertices[cvPos+4] = nY\n closetVertices[cvPos+5] = qZ\n //T\n closetVertices[cvPos+6] = closetVertices[cvPos+12] = oX\n closetVertices[cvPos+7] = closetVertices[cvPos+13] = nY\n closetVertices[cvPos+8] = closetVertices[cvPos+14] = qZ\n //S\n closetVertices[cvPos+15] = oX\n closetVertices[cvPos+16] = mY\n closetVertices[cvPos+17] = qZ\n\n cvPos = cvPos+18\n\n step += elementLength;\n }\n\n //CLOSET BOX\n\n // FRONT VIEW VERTICES\n //\n // A/E---C/G\n // | |\n // | |\n // | |\n // B/F---D/H\n\n aX = 0\n aY = a.h + offsetY\n aZ = a.w\n bY = 0\n cX = a.l\n var eZ = 0\n\n //E\n closetVertices[cvPos] = closetVertices[cvPos+9] = aX\n closetVertices[cvPos+1] = closetVertices[cvPos+10] = aY\n closetVertices[cvPos+2] = closetVertices[cvPos+11] = eZ\n //F\n closetVertices[cvPos+3] = aX\n closetVertices[cvPos+4] = bY\n closetVertices[cvPos+5] = eZ\n //B\n closetVertices[cvPos+6] = closetVertices[cvPos+12] = aX\n closetVertices[cvPos+7] = closetVertices[cvPos+13] = bY\n closetVertices[cvPos+8] = closetVertices[cvPos+14] = aZ\n //A\n closetVertices[cvPos+15] = aX\n closetVertices[cvPos+16] = aY\n closetVertices[cvPos+17] = aZ\n\n cvPos = cvPos+18\n\n //E\n closetVertices[cvPos] = closetVertices[cvPos+9] = aX\n closetVertices[cvPos+1] = closetVertices[cvPos+10] = aY\n closetVertices[cvPos+2] = closetVertices[cvPos+11] = eZ\n //A\n closetVertices[cvPos+3] = aX\n closetVertices[cvPos+4] = aY\n closetVertices[cvPos+5] = aZ\n //C\n closetVertices[cvPos+6] = closetVertices[cvPos+12] = cX\n closetVertices[cvPos+7] = closetVertices[cvPos+13] = aY\n closetVertices[cvPos+8] = closetVertices[cvPos+14] = aZ\n //G\n closetVertices[cvPos+15] = cX\n closetVertices[cvPos+16] = aY\n closetVertices[cvPos+17] = eZ\n\n cvPos = cvPos+18\n\n //C\n closetVertices[cvPos] = closetVertices[cvPos+9] = cX\n closetVertices[cvPos+1] = closetVertices[cvPos+10] = aY\n closetVertices[cvPos+2] = closetVertices[cvPos+11] = aZ\n //D\n closetVertices[cvPos+3] = cX\n closetVertices[cvPos+4] = bY\n closetVertices[cvPos+5] = aZ\n //H\n closetVertices[cvPos+6] = closetVertices[cvPos+12] = cX\n closetVertices[cvPos+7] = closetVertices[cvPos+13] = bY\n closetVertices[cvPos+8] = closetVertices[cvPos+14] = eZ\n //G\n closetVertices[cvPos+15] = cX\n closetVertices[cvPos+16] = aY\n closetVertices[cvPos+17] = eZ\n\n cvPos = cvPos+18\n\n //G\n closetVertices[cvPos] = closetVertices[cvPos+9] = cX\n closetVertices[cvPos+1] = closetVertices[cvPos+10] = aY\n closetVertices[cvPos+2] = closetVertices[cvPos+11] = eZ\n //H\n closetVertices[cvPos+3] = cX\n closetVertices[cvPos+4] = bY\n closetVertices[cvPos+5] = eZ\n //F\n closetVertices[cvPos+6] = closetVertices[cvPos+12] = aX\n closetVertices[cvPos+7] = closetVertices[cvPos+13] = bY\n closetVertices[cvPos+8] = closetVertices[cvPos+14] = eZ\n //E\n closetVertices[cvPos+15] = aX\n closetVertices[cvPos+16] = aY\n closetVertices[cvPos+17] = eZ\n\n return {\n closet: {\n positions: new Float32Array(closetVertices),\n normals: generateNormals.flat(closetVertices),\n uvs: generateUvs.architectural(closetVertices),\n material: 'closet'\n }\n }\n }\n}","// fast 2d polygon tesselation\n// can also triangulate 3D n-gons but fails very often to do so\n// use triangulate-3d for 3D n-gons\n\n// modified version of triangulate.js (https://github.com/mapbox/earcut)\n// - wrapped in require module\n\n/**\n * earcut.js triangulation function\n * Copyright (c) 2015, Mapbox\n */\n\n'use strict'\n\n//function earcut (data, holeIndices, dim) {\nvar triangulate2d = function (data, holeIndices, dim) {\n\n dim = dim || 2\n\n var hasHoles = holeIndices && holeIndices.length,\n outerLen = hasHoles ? holeIndices[0] * dim : data.length,\n outerNode = filterPoints(data, linkedList(data, 0, outerLen, dim, true)),\n triangles = []\n\n if (!outerNode) {\n return triangles\n }\n\n var minX, minY, maxX, maxY, x, y, size\n\n if (hasHoles) {\n outerNode = eliminateHoles(data, holeIndices, outerNode, dim)\n }\n\n // if the shape is not too simple, we'll use z-order curve hash later; calculate polygon bbox\n if (data.length > 80 * dim) {\n minX = maxX = data[0]\n minY = maxY = data[1]\n\n for (var i = dim; i < outerLen; i += dim) {\n x = data[i]\n y = data[i + 1]\n if (x < minX) {\n minX = x\n }\n if (y < minY) {\n minY = y\n }\n if (x > maxX) {\n maxX = x\n }\n if (y > maxY) {\n maxY = y\n }\n }\n\n // minX, minY and size are later used to transform coords into integers for z-order calculation\n size = Math.max(maxX - minX, maxY - minY)\n }\n\n earcutLinked(data, outerNode, triangles, dim, minX, minY, size)\n\n return triangles\n}\n\n// create a circular doubly linked list from polygon points in the specified winding order\nfunction linkedList (data, start, end, dim, clockwise) {\n var sum = 0,\n i, j, last\n\n // calculate original winding order of a polygon ring\n for (i = start, j = end - dim; i < end; i += dim) {\n sum += (data[j] - data[i]) * (data[i + 1] + data[j + 1])\n j = i\n }\n\n // link points into circular doubly-linked list in the specified winding order\n if (clockwise === (sum > 0)) {\n for (i = start; i < end; i += dim) {\n last = insertNode(i, last)\n }\n } else {\n for (i = end - dim; i >= start; i -= dim) {\n last = insertNode(i, last)\n }\n }\n\n return last\n}\n\n// eliminate colinear or duplicate points\nfunction filterPoints (data, start, end) {\n if (!end) {\n end = start\n }\n\n var node = start,\n again\n do {\n again = false\n\n if (!node.steiner && (equals(data, node.i, node.next.i) || orient(data, node.prev.i, node.i, node.next.i) === 0)) {\n\n // remove node\n node.prev.next = node.next\n node.next.prev = node.prev\n\n if (node.prevZ) {\n node.prevZ.nextZ = node.nextZ\n }\n if (node.nextZ) {\n node.nextZ.prevZ = node.prevZ\n }\n\n node = end = node.prev\n\n if (node === node.next) {\n return null\n }\n again = true\n\n } else {\n node = node.next\n }\n } while (again || node !== end)\n\n return end\n}\n\n// main ear slicing loop which triangulates a polygon (given as a linked list)\nfunction earcutLinked (data, ear, triangles, dim, minX, minY, size, pass) {\n if (!ear) {\n return\n }\n\n // interlink polygon nodes in z-order\n if (!pass && minX !== undefined) {\n indexCurve(data, ear, minX, minY, size)\n }\n\n var stop = ear,\n prev, next\n\n // iterate through ears, slicing them one by one\n while (ear.prev !== ear.next) {\n prev = ear.prev\n next = ear.next\n\n if (isEar(data, ear, minX, minY, size)) {\n // cut off the triangle\n triangles.push(prev.i / dim)\n triangles.push(ear.i / dim)\n triangles.push(next.i / dim)\n\n // remove ear node\n next.prev = prev\n prev.next = next\n\n if (ear.prevZ) {\n ear.prevZ.nextZ = ear.nextZ\n }\n if (ear.nextZ) {\n ear.nextZ.prevZ = ear.prevZ\n }\n\n // skipping the next vertice leads to less sliver triangles\n ear = next.next\n stop = next.next\n\n continue\n }\n\n ear = next\n\n // if we looped through the whole remaining polygon and can't find any more ears\n if (ear === stop) {\n // try filtering points and slicing again\n if (!pass) {\n earcutLinked(data, filterPoints(data, ear), triangles, dim, minX, minY, size, 1)\n\n // if this didn't work, try curing all small self-intersections locally\n } else if (pass === 1) {\n ear = cureLocalIntersections(data, ear, triangles, dim)\n earcutLinked(data, ear, triangles, dim, minX, minY, size, 2)\n\n // as a last resort, try splitting the remaining polygon into two\n } else if (pass === 2) {\n splitEarcut(data, ear, triangles, dim, minX, minY, size)\n }\n\n break\n }\n }\n}\n\n// check whether a polygon node forms a valid ear with adjacent nodes\nfunction isEar (data, ear, minX, minY, size) {\n\n var a = ear.prev.i,\n b = ear.i,\n c = ear.next.i,\n\n ax = data[a], ay = data[a + 1],\n bx = data[b], by = data[b + 1],\n cx = data[c], cy = data[c + 1],\n\n abd = ax * by - ay * bx,\n acd = ax * cy - ay * cx,\n cbd = cx * by - cy * bx,\n A = abd - acd - cbd\n\n if (A <= 0) {\n return false\n } // reflex, can't be an ear\n\n // now make sure we don't have other points inside the potential ear;\n // the code below is a bit verbose and repetitive but this is done for performance\n\n var cay = cy - ay,\n acx = ax - cx,\n aby = ay - by,\n bax = bx - ax,\n i, px, py, s, t, k, node\n\n // if we use z-order curve hashing, iterate through the curve\n if (minX !== undefined) {\n\n // triangle bbox; min & max are calculated like this for speed\n var minTX = ax < bx ? (ax < cx ? ax : cx) : (bx < cx ? bx : cx),\n minTY = ay < by ? (ay < cy ? ay : cy) : (by < cy ? by : cy),\n maxTX = ax > bx ? (ax > cx ? ax : cx) : (bx > cx ? bx : cx),\n maxTY = ay > by ? (ay > cy ? ay : cy) : (by > cy ? by : cy),\n\n // z-order range for the current triangle bbox;\n minZ = zOrder(minTX, minTY, minX, minY, size),\n maxZ = zOrder(maxTX, maxTY, minX, minY, size)\n\n // first look for points inside the triangle in increasing z-order\n node = ear.nextZ\n\n while (node && node.z <= maxZ) {\n i = node.i\n node = node.nextZ\n if (i === a || i === c) {\n continue\n }\n\n px = data[i]\n py = data[i + 1]\n\n s = cay * px + acx * py - acd\n if (s >= 0) {\n t = aby * px + bax * py + abd\n if (t >= 0) {\n k = A - s - t\n if ((k >= 0) && ((s && t) || (s && k) || (t && k))) {\n return false\n }\n }\n }\n }\n\n // then look for points in decreasing z-order\n node = ear.prevZ\n\n while (node && node.z >= minZ) {\n i = node.i\n node = node.prevZ\n if (i === a || i === c) {\n continue\n }\n\n px = data[i]\n py = data[i + 1]\n\n s = cay * px + acx * py - acd\n if (s >= 0) {\n t = aby * px + bax * py + abd\n if (t >= 0) {\n k = A - s - t\n if ((k >= 0) && ((s && t) || (s && k) || (t && k))) {\n return false\n }\n }\n }\n }\n\n // if we don't use z-order curve hash, simply iterate through all other points\n } else {\n node = ear.next.next\n\n while (node !== ear.prev) {\n i = node.i\n node = node.next\n\n px = data[i]\n py = data[i + 1]\n\n s = cay * px + acx * py - acd\n if (s >= 0) {\n t = aby * px + bax * py + abd\n if (t >= 0) {\n k = A - s - t\n if ((k >= 0) && ((s && t) || (s && k) || (t && k))) {\n return false\n }\n }\n }\n }\n }\n\n return true\n}\n\n// go through all polygon nodes and cure small local self-intersections\nfunction cureLocalIntersections (data, start, triangles, dim) {\n var node = start\n do {\n var a = node.prev,\n b = node.next.next\n\n // a self-intersection where edge (v[i-1],v[i]) intersects (v[i+1],v[i+2])\n if (a.i !== b.i && intersects(data, a.i, node.i, node.next.i, b.i) &&\n locallyInside(data, a, b) && locallyInside(data, b, a)) {\n\n triangles.push(a.i / dim)\n triangles.push(node.i / dim)\n triangles.push(b.i / dim)\n\n // remove two nodes involved\n a.next = b\n b.prev = a\n\n var az = node.prevZ,\n bz = node.nextZ && node.nextZ.nextZ\n\n if (az) {\n az.nextZ = bz\n }\n if (bz) {\n bz.prevZ = az\n }\n\n node = start = b\n }\n node = node.next\n } while (node !== start)\n\n return node\n}\n\n// try splitting polygon into two and triangulate them independently\nfunction splitEarcut (data, start, triangles, dim, minX, minY, size) {\n // look for a valid diagonal that divides the polygon into two\n var a = start\n do {\n var b = a.next.next\n while (b !== a.prev) {\n if (a.i !== b.i && isValidDiagonal(data, a, b)) {\n // split the polygon in two by the diagonal\n var c = splitPolygon(a, b)\n\n // filter colinear points around the cuts\n a = filterPoints(data, a, a.next)\n c = filterPoints(data, c, c.next)\n\n // run earcut on each half\n earcutLinked(data, a, triangles, dim, minX, minY, size)\n earcutLinked(data, c, triangles, dim, minX, minY, size)\n return\n }\n b = b.next\n }\n a = a.next\n } while (a !== start)\n}\n\n// link every hole into the outer loop, producing a single-ring polygon without holes\nfunction eliminateHoles (data, holeIndices, outerNode, dim) {\n var queue = [],\n i, len, start, end, list\n\n for (i = 0, len = holeIndices.length; i < len; i++) {\n start = holeIndices[i] * dim\n end = i < len - 1 ? holeIndices[i + 1] * dim : data.length\n list = linkedList(data, start, end, dim, false)\n if (list === list.next) {\n list.steiner = true\n }\n list = filterPoints(data, list)\n if (list) {\n queue.push(getLeftmost(data, list))\n }\n }\n\n queue.sort(function (a, b) {\n return data[a.i] - data[b.i]\n })\n\n // process holes from left to right\n for (i = 0; i < queue.length; i++) {\n eliminateHole(data, queue[i], outerNode)\n outerNode = filterPoints(data, outerNode, outerNode.next)\n }\n\n return outerNode\n}\n\n// find a bridge between vertices that connects hole with an outer ring and and link it\nfunction eliminateHole (data, holeNode, outerNode) {\n outerNode = findHoleBridge(data, holeNode, outerNode)\n if (outerNode) {\n var b = splitPolygon(outerNode, holeNode)\n filterPoints(data, b, b.next)\n }\n}\n\n// David Eberly's algorithm for finding a bridge between hole and outer polygon\nfunction findHoleBridge (data, holeNode, outerNode) {\n var node = outerNode,\n i = holeNode.i,\n px = data[i],\n py = data[i + 1],\n qMax = -Infinity,\n mNode, a, b\n\n // find a segment intersected by a ray from the hole's leftmost point to the left;\n // segment's endpoint with lesser x will be potential connection point\n do {\n a = node.i\n b = node.next.i\n\n if (py <= data[a + 1] && py >= data[b + 1]) {\n var qx = data[a] + (py - data[a + 1]) * (data[b] - data[a]) / (data[b + 1] - data[a + 1])\n if (qx <= px && qx > qMax) {\n qMax = qx\n mNode = data[a] < data[b] ? node : node.next\n }\n }\n node = node.next\n } while (node !== outerNode)\n\n if (!mNode) {\n return null\n }\n\n // look for points strictly inside the triangle of hole point, segment intersection and endpoint;\n // if there are no points found, we have a valid connection;\n // otherwise choose the point of the minimum angle with the ray as connection point\n\n var bx = data[mNode.i],\n by = data[mNode.i + 1],\n pbd = px * by - py * bx,\n pcd = px * py - py * qMax,\n cpy = py - py,\n pcx = px - qMax,\n pby = py - by,\n bpx = bx - px,\n A = pbd - pcd - (qMax * by - py * bx),\n sign = A <= 0 ? -1 : 1,\n stop = mNode,\n tanMin = Infinity,\n mx, my, amx, s, t, tan\n\n node = mNode.next\n\n while (node !== stop) {\n\n mx = data[node.i]\n my = data[node.i + 1]\n amx = px - mx\n\n if (amx >= 0 && mx >= bx) {\n s = (cpy * mx + pcx * my - pcd) * sign\n if (s >= 0) {\n t = (pby * mx + bpx * my + pbd) * sign\n\n if (t >= 0 && A * sign - s - t >= 0) {\n tan = Math.abs(py - my) / amx // tangential\n if (tan < tanMin && locallyInside(data, node, holeNode)) {\n mNode = node\n tanMin = tan\n }\n }\n }\n }\n\n node = node.next\n }\n\n return mNode\n}\n\n// interlink polygon nodes in z-order\nfunction indexCurve (data, start, minX, minY, size) {\n var node = start\n\n do {\n if (node.z === null) {\n node.z = zOrder(data[node.i], data[node.i + 1], minX, minY, size)\n }\n node.prevZ = node.prev\n node.nextZ = node.next\n node = node.next\n } while (node !== start)\n\n node.prevZ.nextZ = null\n node.prevZ = null\n\n sortLinked(node)\n}\n\n// Simon Tatham's linked list merge sort algorithm\n// http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html\nfunction sortLinked (list) {\n var i, p, q, e, tail, numMerges, pSize, qSize,\n inSize = 1\n\n do {\n p = list\n list = null\n tail = null\n numMerges = 0\n\n while (p) {\n numMerges++\n q = p\n pSize = 0\n for (i = 0; i < inSize; i++) {\n pSize++\n q = q.nextZ\n if (!q) {\n break\n }\n }\n\n qSize = inSize\n\n while (pSize > 0 || (qSize > 0 && q)) {\n\n if (pSize === 0) {\n e = q\n q = q.nextZ\n qSize--\n } else if (qSize === 0 || !q) {\n e = p\n p = p.nextZ\n pSize--\n } else if (p.z <= q.z) {\n e = p\n p = p.nextZ\n pSize--\n } else {\n e = q\n q = q.nextZ\n qSize--\n }\n\n if (tail) {\n tail.nextZ = e\n } else {\n list = e\n }\n\n e.prevZ = tail\n tail = e\n }\n\n p = q\n }\n\n tail.nextZ = null\n inSize *= 2\n\n } while (numMerges > 1)\n\n return list\n}\n\n// z-order of a point given coords and size of the data bounding box\nfunction zOrder (x, y, minX, minY, size) {\n // coords are transformed into (0..1000) integer range\n x = 1000 * (x - minX) / size\n x = (x | (x << 8)) & 0x00FF00FF\n x = (x | (x << 4)) & 0x0F0F0F0F\n x = (x | (x << 2)) & 0x33333333\n x = (x | (x << 1)) & 0x55555555\n\n y = 1000 * (y - minY) / size\n y = (y | (y << 8)) & 0x00FF00FF\n y = (y | (y << 4)) & 0x0F0F0F0F\n y = (y | (y << 2)) & 0x33333333\n y = (y | (y << 1)) & 0x55555555\n\n return x | (y << 1)\n}\n\n// find the leftmost node of a polygon ring\nfunction getLeftmost (data, start) {\n var node = start,\n leftmost = start\n do {\n if (data[node.i] < data[leftmost.i]) {\n leftmost = node\n }\n node = node.next\n } while (node !== start)\n\n return leftmost\n}\n\n// check if a diagonal between two polygon nodes is valid (lies in polygon interior)\nfunction isValidDiagonal (data, a, b) {\n return !intersectsPolygon(data, a, a.i, b.i) &&\n locallyInside(data, a, b) && locallyInside(data, b, a) &&\n middleInside(data, a, a.i, b.i)\n}\n\n// winding order of triangle formed by 3 given points\nfunction orient (data, p, q, r) {\n var o = (data[q + 1] - data[p + 1]) * (data[r] - data[q]) - (data[q] - data[p]) * (data[r + 1] - data[q + 1])\n return o > 0 ? 1 : o < 0 ? -1 : 0\n}\n\n// check if two points are equal\nfunction equals (data, p1, p2) {\n return data[p1] === data[p2] && data[p1 + 1] === data[p2 + 1]\n}\n\n// check if two segments intersect\nfunction intersects (data, p1, q1, p2, q2) {\n return orient(data, p1, q1, p2) !== orient(data, p1, q1, q2) &&\n orient(data, p2, q2, p1) !== orient(data, p2, q2, q1)\n}\n\n// check if a polygon diagonal intersects any polygon segments\nfunction intersectsPolygon (data, start, a, b) {\n var node = start\n do {\n var p1 = node.i,\n p2 = node.next.i\n\n if (p1 !== a && p2 !== a && p1 !== b && p2 !== b && intersects(data, p1, p2, a, b)) {\n return true\n }\n\n node = node.next\n } while (node !== start)\n\n return false\n}\n\n// check if a polygon diagonal is locally inside the polygon\nfunction locallyInside (data, a, b) {\n return orient(data, a.prev.i, a.i, a.next.i) === -1 ? orient(data, a.i, b.i, a.next.i) !== -1 && orient(data, a.i, a.prev.i, b.i) !== -1 : orient(data, a.i, b.i, a.prev.i) === -1 || orient(data, a.i, a.next.i, b.i) === -1\n}\n\n// check if the middle point of a polygon diagonal is inside the polygon\nfunction middleInside (data, start, a, b) {\n var node = start,\n inside = false,\n px = (data[a] + data[b]) / 2,\n py = (data[a + 1] + data[b + 1]) / 2\n do {\n var p1 = node.i,\n p2 = node.next.i\n\n if (((data[p1 + 1] > py) !== (data[p2 + 1] > py)) &&\n (px < (data[p2] - data[p1]) * (py - data[p1 + 1]) / (data[p2 + 1] - data[p1 + 1]) + data[p1])) {\n inside = !inside\n }\n\n node = node.next\n } while (node !== start)\n\n return inside\n}\n\n// link two polygon vertices with a bridge; if the vertices belong to the same ring, it splits polygon into two;\n// if one belongs to the outer ring and another to a hole, it merges it into a single ring\nfunction splitPolygon (a, b) {\n var a2 = new Node(a.i),\n b2 = new Node(b.i),\n an = a.next,\n bp = b.prev\n\n a.next = b\n b.prev = a\n\n a2.next = an\n an.prev = a2\n\n b2.next = a2\n a2.prev = b2\n\n bp.next = b2\n b2.prev = bp\n\n return b2\n}\n\n// create a node and optionally link it with previous one (in a circular doubly linked list)\nfunction insertNode (i, last) {\n var node = new Node(i)\n\n if (!last) {\n node.prev = node\n node.next = node\n\n } else {\n node.next = last.next\n node.prev = last\n last.next.prev = node\n last.next = node\n }\n return node\n}\n\nfunction Node (i) {\n // vertex coordinates\n this.i = i\n\n // previous and next vertice nodes in a polygon ring\n this.prev = null\n this.next = null\n\n // z-order curve value\n this.z = null\n\n // previous and next nodes in z-order\n this.prevZ = null\n this.nextZ = null\n\n // indicates whether this is a steiner point\n this.steiner = false\n}\n\n// API\n\nexport default triangulate2d\n\n","\n'use strict';\n\n// dependencies\n\nimport triangulate2d from './triangulate-2d'\n\nvar generatePolygonBuffer = function(options) {\n\n // API\n\n var inputVertices = options.outline\n var holes = options.holes\n var uvx = options.uvx || 0\n var uvz = options.uvz || 0\n var y = options.y || 0\n var flipSide = !!options.flipSide\n\n // internals\n var i, l, iv, iuv\n var indices\n\n // triangulate\n if (inputVertices.length === 4 && (holes === undefined || holes.length === 0)) {\n // its a quad - no triangulation needed\n indices = [1,0,3,3,2,1]\n } else {\n // use \"earcut\" triangulation\n if ( holes && holes.length > 0 ) {\n // has holes\n var holeIndices = new Array(holes.length)\n for (i = 0, l = holes.length; i < l; i++) {\n holeIndices[i] = inputVertices.length / 2\n inputVertices = inputVertices.concat(holes[i])\n }\n indices = triangulate2d(inputVertices, holeIndices)\n } else {\n // has no holes\n indices = triangulate2d(inputVertices)\n }\n\n }\n\n var outputVertices = new Float32Array(indices.length * 3)\n var outputUvs = new Float32Array(indices.length * 2)\n\n if (flipSide) {\n\n for (i = 0, l = indices.length; i < l; i += 3) {\n iv = i * 3\n iuv = i * 2\n // vertices\n outputVertices[ iv ] = inputVertices[ indices[ i + 2 ] * 2 ]\n outputVertices[ iv + 1 ] = y\n outputVertices[ iv + 2 ] = inputVertices[ indices[ i + 2 ] * 2 + 1 ]\n outputVertices[ iv + 3 ] = inputVertices[ indices[ i ] * 2 ]\n outputVertices[ iv + 4 ] = y\n outputVertices[ iv + 5 ] = inputVertices[ indices[ i ] * 2 + 1 ]\n outputVertices[ iv + 6 ] = inputVertices[ indices[ i + 1 ] * 2 ]\n outputVertices[ iv + 7 ] = y\n outputVertices[ iv + 8 ] = inputVertices[ indices[ i + 1 ] * 2 + 1 ]\n // uvs\n outputUvs[ iuv ] = inputVertices[ indices[ i + 2 ] * 2 +1 ] + uvz\n outputUvs[ iuv + 1 ] = inputVertices[ indices[ i + 2 ] * 2 ] + uvx\n outputUvs[ iuv + 2 ] = inputVertices[ indices[ i ] * 2+1 ] + uvz\n outputUvs[ iuv + 3 ] = inputVertices[ indices[ i ] * 2 ] + uvx\n outputUvs[ iuv + 4 ] = inputVertices[ indices[ i + 1 ] * 2+1 ] + uvz\n outputUvs[ iuv + 5 ] = inputVertices[ indices[ i + 1 ] * 2 ] + uvx\n }\n\n } else {\n\n for (i = 0, l = indices.length; i < l; i += 3) {\n iv = i * 3\n iuv = i * 2\n // vertices\n outputVertices[ iv ] = inputVertices[ indices[ i + 2 ] * 2 ]\n outputVertices[ iv + 1 ] = y\n outputVertices[ iv + 2 ] = inputVertices[ indices[ i + 2 ] * 2 + 1 ]\n outputVertices[ iv + 3 ] = inputVertices[ indices[ i + 1 ] * 2 ]\n outputVertices[ iv + 4 ] = y\n outputVertices[ iv + 5 ] = inputVertices[ indices[ i + 1 ] * 2 + 1 ]\n outputVertices[ iv + 6 ] = inputVertices[ indices[ i ] * 2 ]\n outputVertices[ iv + 7 ] = y\n outputVertices[ iv + 8 ] = inputVertices[ indices[ i ] * 2 + 1 ]\n // uvs\n outputUvs[ iuv ] = inputVertices[ indices[ i + 2 ] * 2+1 ] + uvz\n outputUvs[ iuv + 1 ] = inputVertices[ indices[ i + 2 ] * 2 ] + uvx\n outputUvs[ iuv + 2 ] = inputVertices[ indices[ i + 1 ] * 2+1 ] + uvz\n outputUvs[ iuv + 3 ] = inputVertices[ indices[ i + 1 ] * 2 ] + uvx\n outputUvs[ iuv + 4 ] = inputVertices[ indices[ i ] * 2+1 ] + uvz\n outputUvs[ iuv + 5 ] = inputVertices[ indices[ i ] * 2 ] + uvx\n }\n\n }\n\n return {\n vertices: outputVertices,\n uvs: outputUvs\n }\n\n}\n\nexport default generatePolygonBuffer\n","'use strict';\n\n// main\n\nvar generateExtrusionBuffer = function(options) {\n\n // API\n\n var inputVertices = options.outline\n var y = options.y || 1\n var flipSide = !!options.flipSide\n var isOpenOutline = options.isOpenOutline || false\n var inputVerticesLength = inputVertices.length\n\n // side faces\n\n var outputVertices = new Float32Array(inputVerticesLength * 9)\n var outputUvs = new Float32Array(inputVerticesLength * 6)\n var distance\n\n if (flipSide) {\n\n if (!isOpenOutline) {\n\n // first side quad is special because it has to deal with first and last point\n\n outputVertices[0] = inputVertices[inputVerticesLength - 2]\n outputVertices[1] = 0\n outputVertices[2] = inputVertices[inputVerticesLength - 1]\n outputVertices[3] = inputVertices[inputVerticesLength - 2]\n outputVertices[4] = y\n outputVertices[5] = inputVertices[inputVerticesLength - 1]\n outputVertices[6] = inputVertices[0]\n outputVertices[7] = 0\n outputVertices[8] = inputVertices[1]\n outputVertices[9] = inputVertices[inputVerticesLength - 2]\n outputVertices[10] = y\n outputVertices[11] = inputVertices[inputVerticesLength - 1]\n outputVertices[12] = inputVertices[0]\n outputVertices[13] = y\n outputVertices[14] = inputVertices[1]\n outputVertices[15] = inputVertices[0]\n outputVertices[16] = 0\n outputVertices[17] = inputVertices[1]\n\n distance = distance2d(inputVertices[inputVerticesLength - 2], inputVertices[inputVerticesLength - 1], inputVertices[0], inputVertices[1])\n outputUvs[0] = 0\n outputUvs[1] = 0\n outputUvs[2] = 0\n outputUvs[3] = y\n outputUvs[4] = distance\n outputUvs[5] = 0\n outputUvs[6] = 0\n outputUvs[7] = y\n outputUvs[8] = distance\n outputUvs[9] = y\n outputUvs[10] = distance\n outputUvs[11] = 0\n }\n\n // other side quads\n for (var i = 2; i < inputVerticesLength; i += 2) {\n\n outputVertices[ i * 9 ] = inputVertices[ i - 2 ]\n outputVertices[ i * 9 + 1 ] = 0\n outputVertices[ i * 9 + 2 ] = inputVertices[ i - 1 ]\n outputVertices[ i * 9 + 3 ] = inputVertices[ i - 2 ]\n outputVertices[ i * 9 + 4 ] = y\n outputVertices[ i * 9 + 5 ] = inputVertices[ i - 1 ]\n outputVertices[ i * 9 + 6 ] = inputVertices[ i ]\n outputVertices[ i * 9 + 7 ] = 0\n outputVertices[ i * 9 + 8 ] = inputVertices[ i + 1 ]\n outputVertices[ i * 9 + 9 ] = inputVertices[ i - 2 ]\n outputVertices[ i * 9 + 10 ] = y\n outputVertices[ i * 9 + 11 ] = inputVertices[ i - 1 ]\n outputVertices[ i * 9 + 12 ] = inputVertices[ i ]\n outputVertices[ i * 9 + 13 ] = y\n outputVertices[ i * 9 + 14 ] = inputVertices[ i + 1 ]\n outputVertices[ i * 9 + 15 ] = inputVertices[ i ]\n outputVertices[ i * 9 + 16 ] = 0\n outputVertices[ i * 9 + 17 ] = inputVertices[ i + 1 ]\n\n distance = distance2d(inputVertices[ i - 2 ], inputVertices[ i - 1 ], inputVertices[ i ], inputVertices[ i + 1 ])\n outputUvs[ i * 6 ] = 0\n outputUvs[ i * 6 + 1 ] = 0\n outputUvs[ i * 6 + 2 ] = 0\n outputUvs[ i * 6 + 3 ] = y\n outputUvs[ i * 6 + 4 ] = distance\n outputUvs[ i * 6 + 5 ] = 0\n outputUvs[ i * 6 + 6 ] = 0\n outputUvs[ i * 6 + 7 ] = y\n outputUvs[ i * 6 + 8 ] = distance\n outputUvs[ i * 6 + 9 ] = y\n outputUvs[ i * 6 + 10 ] = distance\n outputUvs[ i * 6 + 11 ] = 0\n }\n\n } else {\n\n if (!isOpenOutline) {\n\n // first side quad is special because it has to deal with first and last point\n\n outputVertices[0] = inputVertices[inputVerticesLength - 2]\n outputVertices[1] = 0\n outputVertices[2] = inputVertices[inputVerticesLength - 1]\n outputVertices[3] = inputVertices[0]\n outputVertices[4] = 0\n outputVertices[5] = inputVertices[1]\n outputVertices[6] = inputVertices[inputVerticesLength - 2]\n outputVertices[7] = y\n outputVertices[8] = inputVertices[inputVerticesLength - 1]\n outputVertices[9] = inputVertices[inputVerticesLength - 2]\n outputVertices[10] = y\n outputVertices[11] = inputVertices[inputVerticesLength - 1]\n outputVertices[12] = inputVertices[0]\n outputVertices[13] = 0\n outputVertices[14] = inputVertices[1]\n outputVertices[15] = inputVertices[0]\n outputVertices[16] = y\n outputVertices[17] = inputVertices[1]\n\n distance = distance2d(inputVertices[inputVerticesLength - 2], inputVertices[inputVerticesLength - 1], inputVertices[0], inputVertices[1])\n outputUvs[0] = 0\n outputUvs[1] = 0\n outputUvs[2] = distance\n outputUvs[3] = 0\n outputUvs[4] = 0\n outputUvs[5] = y\n outputUvs[6] = 0\n outputUvs[7] = y\n outputUvs[8] = distance\n outputUvs[9] = 0\n outputUvs[10] = distance\n outputUvs[11] = y\n\n }\n\n // other side quads\n for (var i = 2; i < inputVerticesLength; i += 2) {\n\n outputVertices[ i * 9 ] = inputVertices[ i - 2 ]\n outputVertices[ i * 9 + 1 ] = 0\n outputVertices[ i * 9 + 2 ] = inputVertices[ i - 1 ]\n outputVertices[ i * 9 + 3 ] = inputVertices[ i ]\n outputVertices[ i * 9 + 4 ] = 0\n outputVertices[ i * 9 + 5 ] = inputVertices[ i + 1 ]\n outputVertices[ i * 9 + 6 ] = inputVertices[ i - 2 ]\n outputVertices[ i * 9 + 7 ] = y\n outputVertices[ i * 9 + 8 ] = inputVertices[ i - 1 ]\n outputVertices[ i * 9 + 9 ] = inputVertices[ i - 2 ]\n outputVertices[ i * 9 + 10 ] = y\n outputVertices[ i * 9 + 11 ] = inputVertices[ i - 1 ]\n outputVertices[ i * 9 + 12 ] = inputVertices[ i ]\n outputVertices[ i * 9 + 13 ] = 0\n outputVertices[ i * 9 + 14 ] = inputVertices[ i + 1 ]\n outputVertices[ i * 9 + 15 ] = inputVertices[ i ]\n outputVertices[ i * 9 + 16 ] = y\n outputVertices[ i * 9 + 17 ] = inputVertices[ i + 1 ]\n\n distance = distance2d(inputVertices[ i - 2 ], inputVertices[ i - 1 ], inputVertices[ i ], inputVertices[ i + 1 ])\n outputUvs[ i * 6 ] = 0\n outputUvs[ i * 6 + 1 ] = 0\n outputUvs[ i * 6 + 2 ] = distance\n outputUvs[ i * 6 + 3 ] = 0\n outputUvs[ i * 6 + 4 ] = 0\n outputUvs[ i * 6 + 5 ] = y\n outputUvs[ i * 6 + 6 ] = 0\n outputUvs[ i * 6 + 7 ] = y\n outputUvs[ i * 6 + 8 ] = distance\n outputUvs[ i * 6 + 9 ] = 0\n outputUvs[ i * 6 + 10 ] = distance\n outputUvs[ i * 6 + 11 ] = y\n\n }\n\n }\n\n return {\n vertices: outputVertices,\n uvs: outputUvs\n }\n\n}\n\nexport default generateExtrusionBuffer\n\n// helpers\n\nfunction distance2d (p1x, p1y, p2x, p2y) {\n return Math.sqrt((p2x - p1x) * (p2x - p1x) + (p2y - p1y) * (p2y - p1y))\n}\n","'use strict';\n\n// dependencies\n\nimport getSchema from './common/get-schema.js'\nimport getMaterial from './common/get-material.js'\nimport updateSchema from './common/update-schema.js'\nimport generatePolygonBuffer from '../../../utils/data3d/buffer/get-polygon'\nimport generateExtrusionBuffer from '../../../utils/data3d/buffer/get-extrusion'\nimport generateNormals from '../../../utils/data3d/buffer/get-normals'\nimport cloneDeep from 'lodash/cloneDeep'\n\nexport default {\n\n schema: getSchema('column'),\n\n init: function () {},\n\n updateSchema: updateSchema,\n\n update: function (oldData) {\n var this_ = this\n var data = this_.data\n\n // remove old mesh\n this.remove()\n\n // get defaults and\n this.attributes = cloneDeep(data)\n\n // get meshes and materials from el3d modules\n var meshes = this.generateMeshes3d()\n\n // clean up empty meshes to prevent errors\n var meshKeys = Object.keys(meshes)\n meshKeys.forEach(key => {\n if (!meshes[key].positions || !meshes[key].positions.length) {\n // console.warn('no vertices for mesh', key)\n delete meshes[key]\n }\n })\n\n // setup materials\n // defaults\n var materials = {\n top: 'wall_top',\n side: 'basic-wall'\n }\n\n // check for adapted materials\n var materialKeys = Object.keys(data).filter(function(key) {\n return key.indexOf('material_') > -1\n })\n // add materials to instance\n materialKeys.forEach(function(key) {\n var mesh = key.replace('material_', '')\n materials[mesh] = data[key]\n })\n\n // fetch materials from mat library\n Object.keys(materials).forEach(mat => {\n materials[mat] = getMaterial(materials[mat])\n })\n\n // construct data3d object\n var data3d = {\n meshes: meshes,\n materials: materials\n }\n\n // create new one\n this_.mesh = new THREE.Object3D()\n this_.data3dView = new io3d.aFrame.three.Data3dView({parent: this_.mesh})\n\n // update view\n this_.data3dView.set(data3d)\n this_.el.setObject3D('mesh', this_.mesh)\n // emit event\n this_.el.emit('mesh-updated');\n },\n\n remove: function () {\n if (this.data3dView) {\n this.data3dView.destroy()\n this.data3dView = null\n }\n if (this.mesh) {\n this.el.removeObject3D('mesh')\n this.mesh = null\n }\n },\n\n generateMeshes3d: function () {\n var a = this.attributes\n\n // config\n var circleEdgeLength = 0.1\n var minCircleEdges = 12\n\n // internals\n var vertices = []\n var sideUvs = []\n var radius = a.l / 2\n var shape = a.shape\n var edgeCount = 4\n\n // for circles set edge count from radius\n if (shape === 'circle') edgeCount = Math.max(Math.floor(radius * Math.PI * 2 / circleEdgeLength), minCircleEdges)\n var stepAngle = Math.PI * 2 / edgeCount\n\n // for square get diagonal from edge length\n if (shape === 'square') radius = radius / Math.cos(stepAngle / 2)\n // edgeLength needed for correct side uvs\n var edgeLength = Math.tan(stepAngle / 2) * radius * 2\n\n // get contour vertices and side face uvs\n var svUvPos = 0\n var aX, aY, bY, cX\n for (var i = 0; i < edgeCount * 2; i += 2) {\n /* */\n vertices[i] = Math.sin(stepAngle * i / 2 - stepAngle / 2) * radius\n vertices[i + 1] = Math.cos(stepAngle * i / 2 - stepAngle / 2) * radius\n\n // create UVS manually to have a continuous texture\n // FRONT UVS\n // A-----D\n // | |\n // | |\n // | |\n // B-----C\n aX = i / 2 * edgeLength\n aY = a.h\n bY = 0\n cX = (i / 2 + 1) * edgeLength\n // B\n sideUvs[svUvPos] = aX\n sideUvs[svUvPos + 1] = bY\n // C\n sideUvs[svUvPos + 2] = cX\n sideUvs[svUvPos + 3] = bY\n // A\n sideUvs[svUvPos + 4] = aX\n sideUvs[svUvPos + 5] = aY\n // A\n sideUvs[svUvPos + 6] = aX\n sideUvs[svUvPos + 7] = aY\n // C\n sideUvs[svUvPos + 8] = cX\n sideUvs[svUvPos + 9] = bY\n // D\n sideUvs[svUvPos + 10] = cX\n sideUvs[svUvPos + 11] = aY\n svUvPos += 12\n }\n\n // top polygon\n var topPolygon = generatePolygonBuffer({\n outline: vertices,\n y: a.h,\n uvx: a.x,\n uvz: a.z,\n flipSide: false\n })\n\n // bottom polygon\n var bottomPolygon = generatePolygonBuffer({\n outline: vertices,\n y: 0,\n uvx: a.x,\n uvz: a.z,\n flipSide: true\n })\n\n // sides\n var sidesFaces = generateExtrusionBuffer({\n outline: vertices,\n y: a.h,\n flipSide: false\n })\n\n // set normal smoothing according to shape\n var sideNormals\n if (shape === 'circle') sideNormals = generateNormals.smooth(sidesFaces.vertices)\n else sideNormals = generateNormals.flat(sidesFaces.vertices)\n\n // return meshes\n return {\n top: {\n positions: topPolygon.vertices,\n normals: generateNormals.flat(topPolygon.vertices),\n uvs: topPolygon.uvs,\n material: 'top'\n },\n sides: {\n positions: sidesFaces.vertices,\n normals: sideNormals,\n uvs: new Float32Array(sideUvs),\n material: 'side'\n },\n bottom: {\n positions: bottomPolygon.vertices,\n normals: generateNormals.flat(bottomPolygon.vertices),\n uvs: bottomPolygon.uvs,\n material: 'side'\n }\n }\n }\n}","'use strict';\n\n// dependencies\n\nimport getSchema from './common/get-schema.js'\nimport getMaterial from './common/get-material.js'\nimport updateSchema from './common/update-schema.js'\nimport generateNormals from '../../../utils/data3d/buffer/get-normals'\nimport cloneDeep from 'lodash/cloneDeep'\n\nexport default {\n\n schema: getSchema('door'),\n\n init: function () {\n var this_ = this\n // listen to wall parent for updated geometry\n this.el.parentEl.addEventListener('wall-changed', this.updateFromWall)\n // FIXME: check for parent initially - we need to wait till it is available\n setTimeout(function() {\n this_.updateFromWall()\n }, 20)\n },\n\n updateFromWall: function(evt) {\n // if we have no event yet we need to get the attributes directly\n if (!evt) {\n var wallAttributes = this.el.parentEl.getAttribute('io3d-wall')\n if (wallAttributes) {\n // let's make sure we deal with an object\n if (typeof wallAttributes === 'string') wallAttributes = AFRAME.utils.styleParser.parse(wallAttributes)\n this.wallWidth = wallAttributes.w\n this.wallControlLine = wallAttributes.controlLine\n }\n } else {\n this.wallWidth = evt.detail.w\n this.wallControlLine = evt.detail.controlLine\n }\n this.update()\n },\n\n updateSchema: updateSchema,\n\n update: function (oldData) {\n var this_ = this\n var data = this_.data\n\n // remove old mesh\n this.remove()\n\n // get defaults and\n this.attributes = cloneDeep(data)\n\n // get meshes and materials from el3d modules\n var meshes = this.generateMeshes3d()\n\n // clean up empty meshes to prevent errors\n var meshKeys = Object.keys(meshes)\n meshKeys.forEach(key => {\n if (!meshes[key].positions || !meshes[key].positions.length) {\n // console.warn('no vertices for mesh', key)\n delete meshes[key]\n }\n })\n\n // setup materials\n // defaults\n var materials = {\n frame: {\n colorDiffuse: [0.95, 0.95, 0.95],\n colorSpecular: [0.04, 0.04, 0.04],\n specularCoef: 30\n },\n leaf: 'doorLeaf-flush-white',\n handle: 'aluminium',\n threshold: 'wood_parquet_oak'\n }\n\n // check for adapted materials\n var materialKeys = Object.keys(data).filter(function(key) {\n return key.indexOf('material_') > -1\n })\n // add materials to instance\n materialKeys.forEach(function(key) {\n var mesh = key.replace('material_', '')\n materials[mesh] = data[key]\n })\n\n // fetch materials from mat library\n Object.keys(materials).forEach(mat => {\n materials[mat] = getMaterial(materials[mat])\n })\n\n // construct data3d object\n var data3d = {\n meshes: meshes,\n materials: materials\n }\n\n // create new one\n this_.mesh = new THREE.Object3D()\n this_.data3dView = new io3d.aFrame.three.Data3dView({parent: this_.mesh})\n\n // update view\n this_.data3dView.set(data3d)\n this_.el.setObject3D('mesh', this_.mesh)\n // emit event\n this_.el.emit('mesh-updated');\n },\n\n remove: function () {\n this.el.parentEl.removeEventListener('wall-changed', this.updateFromWall)\n if (this.data3dView) {\n this.data3dView.destroy()\n this.data3dView = null\n }\n if (this.mesh) {\n this.el.removeObject3D('mesh')\n this.mesh = null\n }\n },\n\n generateMeshes3d: function () {\n var a = this.attributes\n\n var wallWidth = a.w || 0.15\n var wallControlLine = 'back'\n // get parent wall attributes\n if (this.wallWidth || this.wallControlLine) {\n wallWidth = this.wallWidth\n wallControlLine = this.wallControlLine\n a.w = wallWidth\n }\n\n // definitions\n var\n wallBackPos = wallControlLine === 'front' ? -wallWidth : wallControlLine === 'center' ? -wallWidth / 2 : 0,\n wallFrontPos = wallWidth + wallBackPos,\n frameLength = a.frameLength,\n frameWidth = a.w,\n leafLength = a.l - (frameLength * 2),\n leafOffset = a.leafOffset,\n frameOffset = a.frameOffset,\n prevLeafs = 0,\n doorType = a.doorType,\n threshold = a.threshold,\n thresholdHeight = a.thresholdHeight,\n leaf,\n doorOpening = a.l - (frameLength * 2),\n handleHeight = 1,\n handleThickness = 0.018,\n handleLength = 0.13,\n handleWidth = 0.035,\n handleDistance = 0.06, //Dornmass\n handlePlateLength = 0.04,\n handlePlateHeight = 0.21,\n handlePlateWidth = 0.002,\n handlePlateDistance = handleDistance+handleThickness/2-handlePlateLength/ 2,\n leafGap = threshold && thresholdHeight ? thresholdHeight : 0.005,\n\n // internals\n\n frameFacesCount = 0,\n floorFacesCount = threshold ? thresholdHeight > 0 ? 6 : 2 : 0,\n hvPos = 0,\n fvPos = 0,\n lvPos = 0,\n lvUvPos = 0,\n xCursor = 0,\n zCursor, xRotate, sinAngle, cosAngle, rotationOffset, lvs, lve, hvs, hve, hvf, hvt, hvm = [],\n aX,aY,aZ,bY,cX,cZ,dY,eX,eZ,gX,iZ,mZ,uZ\n\n // DOOR TYPE CONFIGURATIONS\n\n // swing default\n if (doorType==='singleSwing') {\n leaf = [{\n leafLength : leafLength,\n handle : true,\n angle : a.doorAngle\n }]\n } else if (doorType==='opening') {\n leaf = []\n } else if (doorType==='doubleSwing') {\n leaf = [{\n leafLength : leafLength/2,\n handle : true,\n angle : a.doorAngle\n },\n {\n leafLength : leafLength/2,\n handle : true,\n angle : a.doorAngle,\n flipLeaf : true\n }]\n } else if (doorType==='swingFix') {\n leaf = [{\n leafLength : doorOpening * (1-a.fixLeafRatio),\n handle : true,\n angle : a.doorAngle\n },\n {\n leafLength : doorOpening * a.fixLeafRatio,\n handle : false,\n angle : 0\n }]\n if (a.hinge==='left') leaf.reverse()\n } else if (doorType==='swingDoubleFix') {\n leaf = [{\n leafLength : doorOpening * a.fixLeafRatio/2,\n handle : false,\n angle : 0\n },\n {\n leafLength : doorOpening * (1-a.fixLeafRatio),\n handle : true,\n angle : a.doorAngle\n },\n {\n leafLength : doorOpening * a.fixLeafRatio/2,\n handle : false,\n angle : 0\n }]\n if (a.hinge==='left') leaf.reverse()\n } else if (doorType==='doubleSwingDoubleFix') {\n leaf = [{\n leafLength : doorOpening * a.fixLeafRatio/2,\n handle : false,\n angle : 0\n },\n {\n leafLength : doorOpening * ((1-a.fixLeafRatio)/2),\n handle : true,\n angle : a.doorAngle\n },\n {\n leafLength : doorOpening * ((1-a.fixLeafRatio)/2),\n handle : true,\n angle : a.doorAngle,\n flipLeaf : true\n },\n {\n leafLength : doorOpening * a.fixLeafRatio/2,\n handle : false,\n angle : 0\n }]\n } else if (doorType==='slidingDoor') {\n leaf = [{\n leafLength : leafLength* (1-a.doorAngle/180),\n handle : false,\n angle : 0\n }]\n leafOffset = -0.1\n if (a.hinge==='left') xCursor = doorOpening - leafLength* (1-a.doorAngle/180)\n } else {\n // Fallback old doors\n a.doorType = 'singleSwing'\n leaf = [{\n leafLength : leafLength,\n handle : true,\n angle : a.doorAngle\n }]\n }\n\n // FIXME Workaround for older Doors - remove Feb '16\n if (leafOffset>0.005) leafOffset = 0.005\n\n // Set Face Count\n if (frameLength>0) {\n frameFacesCount += 18\n if (frameOffset>0) frameFacesCount += 12\n }\n var leafVertices = [], //new Float32Array(leafFacesCount * 9),\n handleVertices = [], //new Float32Array(handleFacesCount * 9),\n leafUvs = [], //new Float32Array(leafFacesCount * 6),\n frameVertices = new Float32Array(frameFacesCount * 9)\n\n // Threshold VERTICES\n //\n // E------G\n // /| /|\n // A------C |\n // | F----|-H\n // |/ |/\n // B------D\n var floorVertices = new Float32Array(floorFacesCount * 9),\n floorUvs = new Float32Array(floorFacesCount * 6),\n wvPos = 0,\n fvUvPos = 0\n\n aX = frameLength\n aY = thresholdHeight\n aZ = wallFrontPos\n bY = 0\n cX = a.l - frameLength\n eZ = wallBackPos\n\n if (threshold) {\n // Top\n //E\n floorVertices[wvPos] = floorVertices[wvPos + 9] = aX\n floorVertices[wvPos + 1] = floorVertices[wvPos + 10] = aY\n floorVertices[wvPos + 2] = floorVertices[wvPos + 11] = eZ\n //A\n floorVertices[wvPos + 3] = aX\n floorVertices[wvPos + 4] = aY\n floorVertices[wvPos + 5] = aZ\n //C\n floorVertices[wvPos + 6] = floorVertices[wvPos + 12] = cX\n floorVertices[wvPos + 7] = floorVertices[wvPos + 13] = aY\n floorVertices[wvPos + 8] = floorVertices[wvPos + 14] = aZ\n //G\n floorVertices[wvPos + 15] = cX\n floorVertices[wvPos + 16] = aY\n floorVertices[wvPos + 17] = eZ\n\n floorUvs [fvUvPos] = floorUvs [fvUvPos + 2] = floorUvs [fvUvPos + 6] = 1 - cX\n floorUvs [fvUvPos + 1] = floorUvs [fvUvPos + 7] = floorUvs [fvUvPos + 11] = aZ\n floorUvs [fvUvPos + 3] = floorUvs [fvUvPos + 5] = floorUvs [fvUvPos + 9] = 0\n floorUvs [fvUvPos + 4] = floorUvs [fvUvPos + 8] = floorUvs [fvUvPos + 10] = 1\n\n wvPos += 18\n fvUvPos += 12\n\n if (thresholdHeight > 0) {\n // Front\n //A\n floorVertices[wvPos] = floorVertices[wvPos + 9] = aX\n floorVertices[wvPos + 1] = floorVertices[wvPos + 10] = aY\n floorVertices[wvPos + 2] = floorVertices[wvPos + 11] = aZ\n //B\n floorVertices[wvPos + 3] = aX\n floorVertices[wvPos + 4] = bY\n floorVertices[wvPos + 5] = aZ\n //D\n floorVertices[wvPos + 6] = floorVertices[wvPos + 12] = cX\n floorVertices[wvPos + 7] = floorVertices[wvPos + 13] = bY\n floorVertices[wvPos + 8] = floorVertices[wvPos + 14] = aZ\n //C\n floorVertices[wvPos + 15] = cX\n floorVertices[wvPos + 16] = aY\n floorVertices[wvPos + 17] = aZ\n\n floorUvs [fvUvPos] = floorUvs [fvUvPos + 2] = floorUvs [fvUvPos + 6] = 1 - cX\n floorUvs [fvUvPos + 1] = floorUvs [fvUvPos + 7] = floorUvs [fvUvPos + 11] = thresholdHeight\n floorUvs [fvUvPos + 3] = floorUvs [fvUvPos + 5] = floorUvs [fvUvPos + 9] = 0\n floorUvs [fvUvPos + 4] = floorUvs [fvUvPos + 8] = floorUvs [fvUvPos + 10] = 1\n\n wvPos += 18\n fvUvPos += 12\n\n // Back\n //G\n floorVertices[wvPos] = floorVertices[wvPos + 9] = cX\n floorVertices[wvPos + 1] = floorVertices[wvPos + 10] = aY\n floorVertices[wvPos + 2] = floorVertices[wvPos + 11] = eZ\n //H\n floorVertices[wvPos + 3] = cX\n floorVertices[wvPos + 4] = bY\n floorVertices[wvPos + 5] = eZ\n //F\n floorVertices[wvPos + 6] = floorVertices[wvPos + 12] = aX\n floorVertices[wvPos + 7] = floorVertices[wvPos + 13] = bY\n floorVertices[wvPos + 8] = floorVertices[wvPos + 14] = eZ\n //E\n floorVertices[wvPos + 15] = aX\n floorVertices[wvPos + 16] = aY\n floorVertices[wvPos + 17] = eZ\n\n floorUvs [fvUvPos] = floorUvs [fvUvPos + 2] = floorUvs [fvUvPos + 6] = 1 - cX\n floorUvs [fvUvPos + 1] = floorUvs [fvUvPos + 7] = floorUvs [fvUvPos + 11] = thresholdHeight\n floorUvs [fvUvPos + 3] = floorUvs [fvUvPos + 5] = floorUvs [fvUvPos + 9] = 0\n floorUvs [fvUvPos + 4] = floorUvs [fvUvPos + 8] = floorUvs [fvUvPos + 10] = 1\n }\n }\n\n // DOOR FRAME CREATION\n if (frameLength>0) {\n\n // DOOR FRAME FRONT\n\n // A/I-------H/L\n // | D---E |\n // | | | |\n // | | | |\n // B/J-C F-G/K\n\n // DOOR FRAME BACK\n\n // M/U-------T/X\n // | P---Q |\n // | | | |\n // | | | |\n // N/V-O R-S/W\n\n aX = 0\n aY = a.h\n aZ = wallFrontPos + frameOffset\n bY = 0\n cX = frameLength\n dY = a.h - frameLength\n eX = a.l - frameLength\n gX = a.l\n iZ = wallFrontPos\n mZ = wallBackPos - frameOffset\n uZ = wallBackPos\n\n // DOOR FRAME FRONT FACES\n // A\n frameVertices[fvPos] = frameVertices[fvPos + 9] = aX\n frameVertices[fvPos + 1] = frameVertices[fvPos + 10] = aY\n frameVertices[fvPos + 2] = frameVertices[fvPos + 11] = aZ\n // B\n frameVertices[fvPos + 3] = aX\n frameVertices[fvPos + 4] = bY\n frameVertices[fvPos + 5] = aZ\n // C\n frameVertices[fvPos + 6] = frameVertices[fvPos + 12] = cX\n frameVertices[fvPos + 7] = frameVertices[fvPos + 13] = bY\n frameVertices[fvPos + 8] = frameVertices[fvPos + 14] = aZ\n // D\n frameVertices[fvPos + 15] = cX\n frameVertices[fvPos + 16] = dY\n frameVertices[fvPos + 17] = aZ\n\n fvPos += 18\n // A\n frameVertices[fvPos] = frameVertices[fvPos + 9] = aX\n frameVertices[fvPos + 1] = frameVertices[fvPos + 10] = aY\n frameVertices[fvPos + 2] = frameVertices[fvPos + 11] = aZ\n // D\n frameVertices[fvPos + 3] = cX\n frameVertices[fvPos + 4] = dY\n frameVertices[fvPos + 5] = aZ\n // E\n frameVertices[fvPos + 6] = frameVertices[fvPos + 12] = eX\n frameVertices[fvPos + 7] = frameVertices[fvPos + 13] = dY\n frameVertices[fvPos + 8] = frameVertices[fvPos + 14] = aZ\n // H\n frameVertices[fvPos + 15] = gX\n frameVertices[fvPos + 16] = aY\n frameVertices[fvPos + 17] = aZ\n\n fvPos += 18\n // E\n frameVertices[fvPos] = frameVertices[fvPos + 9] = eX\n frameVertices[fvPos + 1] = frameVertices[fvPos + 10] = dY\n frameVertices[fvPos + 2] = frameVertices[fvPos + 11] = aZ\n // F\n frameVertices[fvPos + 3] = eX\n frameVertices[fvPos + 4] = bY\n frameVertices[fvPos + 5] = aZ\n // G\n frameVertices[fvPos + 6] = frameVertices[fvPos + 12] = gX\n frameVertices[fvPos + 7] = frameVertices[fvPos + 13] = bY\n frameVertices[fvPos + 8] = frameVertices[fvPos + 14] = aZ\n // H\n frameVertices[fvPos + 15] = gX\n frameVertices[fvPos + 16] = aY\n frameVertices[fvPos + 17] = aZ\n\n fvPos += 18\n\n // DOOR FRAME BACK FACES\n\n // M\n frameVertices[fvPos] = frameVertices[fvPos + 9] = gX\n frameVertices[fvPos + 1] = frameVertices[fvPos + 10] = aY\n frameVertices[fvPos + 2] = frameVertices[fvPos + 11] = mZ\n // N\n frameVertices[fvPos + 3] = gX\n frameVertices[fvPos + 4] = bY\n frameVertices[fvPos + 5] = mZ\n // O\n frameVertices[fvPos + 6] = frameVertices[fvPos + 12] = eX\n frameVertices[fvPos + 7] = frameVertices[fvPos + 13] = bY\n frameVertices[fvPos + 8] = frameVertices[fvPos + 14] = mZ\n // P\n frameVertices[fvPos + 15] = eX\n frameVertices[fvPos + 16] = dY\n frameVertices[fvPos + 17] = mZ\n\n fvPos += 18\n\n // M\n frameVertices[fvPos] = frameVertices[fvPos + 9] = gX\n frameVertices[fvPos + 1] = frameVertices[fvPos + 10] = aY\n frameVertices[fvPos + 2] = frameVertices[fvPos + 11] = mZ\n // P\n frameVertices[fvPos + 3] = eX\n frameVertices[fvPos + 4] = dY\n frameVertices[fvPos + 5] = mZ\n // Q\n frameVertices[fvPos + 6] = frameVertices[fvPos + 12] = cX\n frameVertices[fvPos + 7] = frameVertices[fvPos + 13] = dY\n frameVertices[fvPos + 8] = frameVertices[fvPos + 14] = mZ\n // T\n frameVertices[fvPos + 15] = aX\n frameVertices[fvPos + 16] = aY\n frameVertices[fvPos + 17] = mZ\n\n fvPos += 18\n\n // Q\n frameVertices[fvPos] = frameVertices[fvPos + 9] = cX\n frameVertices[fvPos + 1] = frameVertices[fvPos + 10] = dY\n frameVertices[fvPos + 2] = frameVertices[fvPos + 11] = mZ\n // R\n frameVertices[fvPos + 3] = cX\n frameVertices[fvPos + 4] = bY\n frameVertices[fvPos + 5] = mZ\n // S\n frameVertices[fvPos + 6] = frameVertices[fvPos + 12] = aX\n frameVertices[fvPos + 7] = frameVertices[fvPos + 13] = bY\n frameVertices[fvPos + 8] = frameVertices[fvPos + 14] = mZ\n // T\n frameVertices[fvPos + 15] = aX\n frameVertices[fvPos + 16] = aY\n frameVertices[fvPos + 17] = mZ\n\n fvPos += 18\n\n // FRAME INSIDE\n\n // D\n frameVertices[fvPos] = frameVertices[fvPos + 9] = cX\n frameVertices[fvPos + 1] = frameVertices[fvPos + 10] = dY\n frameVertices[fvPos + 2] = frameVertices[fvPos + 11] = aZ\n // C\n frameVertices[fvPos + 3] = cX\n frameVertices[fvPos + 4] = bY\n frameVertices[fvPos + 5] = aZ\n // R\n frameVertices[fvPos + 6] = frameVertices[fvPos + 12] = cX\n frameVertices[fvPos + 7] = frameVertices[fvPos + 13] = bY\n frameVertices[fvPos + 8] = frameVertices[fvPos + 14] = mZ\n // Q\n frameVertices[fvPos + 15] = cX\n frameVertices[fvPos + 16] = dY\n frameVertices[fvPos + 17] = mZ\n\n fvPos += 18\n\n // D\n frameVertices[fvPos] = frameVertices[fvPos + 9] = cX\n frameVertices[fvPos + 1] = frameVertices[fvPos + 10] = dY\n frameVertices[fvPos + 2] = frameVertices[fvPos + 11] = aZ\n // Q\n frameVertices[fvPos + 3] = cX\n frameVertices[fvPos + 4] = dY\n frameVertices[fvPos + 5] = mZ\n // P\n frameVertices[fvPos + 6] = frameVertices[fvPos + 12] = eX\n frameVertices[fvPos + 7] = frameVertices[fvPos + 13] = dY\n frameVertices[fvPos + 8] = frameVertices[fvPos + 14] = mZ\n // E\n frameVertices[fvPos + 15] = eX\n frameVertices[fvPos + 16] = dY\n frameVertices[fvPos + 17] = aZ\n\n fvPos += 18\n\n // Q\n frameVertices[fvPos] = frameVertices[fvPos + 9] = eX\n frameVertices[fvPos + 1] = frameVertices[fvPos + 10] = dY\n frameVertices[fvPos + 2] = frameVertices[fvPos + 11] = mZ\n // R\n frameVertices[fvPos + 3] = eX\n frameVertices[fvPos + 4] = bY\n frameVertices[fvPos + 5] = mZ\n // F\n frameVertices[fvPos + 6] = frameVertices[fvPos + 12] = eX\n frameVertices[fvPos + 7] = frameVertices[fvPos + 13] = bY\n frameVertices[fvPos + 8] = frameVertices[fvPos + 14] = aZ\n // E\n frameVertices[fvPos + 15] = eX\n frameVertices[fvPos + 16] = dY\n frameVertices[fvPos + 17] = aZ\n\n fvPos += 18\n\n\n // FRAME OFFSET SIDE FACES\n if (frameOffset>0) {\n // FRONT\n // I\n frameVertices[ fvPos ] = frameVertices[ fvPos + 9 ] = aX\n frameVertices[ fvPos + 1 ] = frameVertices[ fvPos + 10 ] = aY\n frameVertices[ fvPos + 2 ] = frameVertices[ fvPos + 11 ] = iZ\n // J\n frameVertices[ fvPos + 3 ] = aX\n frameVertices[ fvPos + 4 ] = bY\n frameVertices[ fvPos + 5 ] = iZ\n // B\n frameVertices[ fvPos + 6 ] = frameVertices[ fvPos + 12 ] = aX\n frameVertices[ fvPos + 7 ] = frameVertices[ fvPos + 13 ] = bY\n frameVertices[ fvPos + 8 ] = frameVertices[ fvPos + 14 ] = aZ\n // A\n frameVertices[ fvPos + 15 ] = aX\n frameVertices[ fvPos + 16 ] = aY\n frameVertices[ fvPos + 17 ] = aZ\n\n fvPos += 18\n\n // I\n frameVertices[ fvPos ] = frameVertices[ fvPos + 9 ] = aX\n frameVertices[ fvPos + 1 ] = frameVertices[ fvPos + 10 ] = aY\n frameVertices[ fvPos + 2 ] = frameVertices[ fvPos + 11 ] = iZ\n // A\n frameVertices[ fvPos + 3 ] = aX\n frameVertices[ fvPos + 4 ] = aY\n frameVertices[ fvPos + 5 ] = aZ\n // H\n frameVertices[ fvPos + 6 ] = frameVertices[ fvPos + 12 ] = gX\n frameVertices[ fvPos + 7 ] = frameVertices[ fvPos + 13 ] = aY\n frameVertices[ fvPos + 8 ] = frameVertices[ fvPos + 14 ] = aZ\n // L\n frameVertices[ fvPos + 15 ] = gX\n frameVertices[ fvPos + 16 ] = aY\n frameVertices[ fvPos + 17 ] = iZ\n\n fvPos += 18\n\n // H\n frameVertices[ fvPos ] = frameVertices[ fvPos + 9 ] = gX\n frameVertices[ fvPos + 1 ] = frameVertices[ fvPos + 10 ] = aY\n frameVertices[ fvPos + 2 ] = frameVertices[ fvPos + 11 ] = aZ\n // G\n frameVertices[ fvPos + 3 ] = gX\n frameVertices[ fvPos + 4 ] = bY\n frameVertices[ fvPos + 5 ] = aZ\n // K\n frameVertices[ fvPos + 6 ] = frameVertices[ fvPos + 12 ] = gX\n frameVertices[ fvPos + 7 ] = frameVertices[ fvPos + 13 ] = bY\n frameVertices[ fvPos + 8 ] = frameVertices[ fvPos + 14 ] = iZ\n // L\n frameVertices[ fvPos + 15 ] = gX\n frameVertices[ fvPos + 16 ] = aY\n frameVertices[ fvPos + 17 ] = iZ\n\n fvPos += 18\n\n // BACK\n\n // U\n frameVertices[ fvPos ] = frameVertices[ fvPos + 9 ] = gX\n frameVertices[ fvPos + 1 ] = frameVertices[ fvPos + 10 ] = aY\n frameVertices[ fvPos + 2 ] = frameVertices[ fvPos + 11 ] = uZ\n // V\n frameVertices[ fvPos + 3 ] = gX\n frameVertices[ fvPos + 4 ] = bY\n frameVertices[ fvPos + 5 ] = uZ\n // N\n frameVertices[ fvPos + 6 ] = frameVertices[ fvPos + 12 ] = gX\n frameVertices[ fvPos + 7 ] = frameVertices[ fvPos + 13 ] = bY\n frameVertices[ fvPos + 8 ] = frameVertices[ fvPos + 14 ] = mZ\n // M\n frameVertices[ fvPos + 15 ] = gX\n frameVertices[ fvPos + 16 ] = aY\n frameVertices[ fvPos + 17 ] = mZ\n\n fvPos += 18\n\n // U\n frameVertices[ fvPos ] = frameVertices[ fvPos + 9 ] = gX\n frameVertices[ fvPos + 1 ] = frameVertices[ fvPos + 10 ] = aY\n frameVertices[ fvPos + 2 ] = frameVertices[ fvPos + 11 ] = uZ\n // M\n frameVertices[ fvPos + 3 ] = gX\n frameVertices[ fvPos + 4 ] = aY\n frameVertices[ fvPos + 5 ] = mZ\n // T\n frameVertices[ fvPos + 6 ] = frameVertices[ fvPos + 12 ] = aX\n frameVertices[ fvPos + 7 ] = frameVertices[ fvPos + 13 ] = aY\n frameVertices[ fvPos + 8 ] = frameVertices[ fvPos + 14 ] = mZ\n // X\n frameVertices[ fvPos + 15 ] = aX\n frameVertices[ fvPos + 16 ] = aY\n frameVertices[ fvPos + 17 ] = uZ\n\n fvPos += 18\n\n // T\n frameVertices[ fvPos ] = frameVertices[ fvPos + 9 ] = aX\n frameVertices[ fvPos + 1 ] = frameVertices[ fvPos + 10 ] = aY\n frameVertices[ fvPos + 2 ] = frameVertices[ fvPos + 11 ] = mZ\n // S\n frameVertices[ fvPos + 3 ] = aX\n frameVertices[ fvPos + 4 ] = bY\n frameVertices[ fvPos + 5 ] = mZ\n // W\n frameVertices[ fvPos + 6 ] = frameVertices[ fvPos + 12 ] = aX\n frameVertices[ fvPos + 7 ] = frameVertices[ fvPos + 13 ] = bY\n frameVertices[ fvPos + 8 ] = frameVertices[ fvPos + 14 ] = uZ\n // X\n frameVertices[ fvPos + 15 ] = aX\n frameVertices[ fvPos + 16 ] = aY\n frameVertices[ fvPos + 17 ] = uZ\n\n }\n }\n\n // LEAF + HANDLE CREATION depending on Door Type\n for (var c = 0;c1) prevLeafs = leaf[c-1].leafLength+leaf[c-2].leafLength\n else if (c>0) prevLeafs = leaf[c-1].leafLength\n\n // Vertex Front View\n // A/H____D/E\n // | |\n // | |\n // B/G____C/F\n\n aX = xCursor + frameLength// + leafGap\n aY = a.h - frameLength\n aZ = wallBackPos + a.leafWidth - leafOffset - frameOffset\n bY = leafGap\n cX = xCursor + frameLength + leafLength//-leafGap\n eZ = wallBackPos-leafOffset-frameOffset\n\n // door leaf front ABCD\n leafVertices[lvPos] = leafVertices[lvPos + 3] = leafVertices[lvPos + 9] = aX\n leafVertices[lvPos + 1] = leafVertices[lvPos + 10] = leafVertices[lvPos + 16] = aY\n leafVertices[lvPos + 2] = leafVertices[lvPos + 5] = leafVertices[lvPos + 11] = aZ\n leafVertices[lvPos + 4] = leafVertices[lvPos + 7] = leafVertices[lvPos + 13] = bY\n leafVertices[lvPos + 6] = leafVertices[lvPos + 12] = leafVertices[lvPos + 15] = cX\n leafVertices[lvPos + 8] = leafVertices[lvPos + 14] = leafVertices[lvPos + 17] = aZ\n\n // UV Mapping depending on Door Configuration\n if (a.hinge==='left') leafUvs [lvUvPos] = leafUvs [lvUvPos + 2] = leafUvs [lvUvPos + 6] = xCursor/doorOpening\n else leafUvs [lvUvPos] = leafUvs [lvUvPos + 2] = leafUvs [lvUvPos + 6] = -xCursor/doorOpening\n leafUvs [lvUvPos + 1] = leafUvs [lvUvPos + 7] = leafUvs [lvUvPos + 11] = 1\n leafUvs [lvUvPos + 3] = leafUvs [lvUvPos + 5] = leafUvs [lvUvPos + 9] = 0\n if (a.hinge==='left')leafUvs [lvUvPos + 4] = leafUvs [lvUvPos + 8] = leafUvs [lvUvPos + 10] = (xCursor+leafLength)/doorOpening\n else leafUvs [lvUvPos + 4] = leafUvs [lvUvPos + 8] = leafUvs [lvUvPos + 10] = -(xCursor+leafLength)/doorOpening\n\n lvPos += 18\n lvUvPos += 12\n\n // door leaf back EFGH\n leafVertices[lvPos] = leafVertices[lvPos + 3] = leafVertices[lvPos + 9] = cX\n leafVertices[lvPos + 1] = leafVertices[lvPos + 10] = leafVertices[lvPos + 16] = aY\n leafVertices[lvPos + 2] = leafVertices[lvPos + 5] = leafVertices[lvPos + 11] = eZ\n leafVertices[lvPos + 4] = leafVertices[lvPos + 7] = leafVertices[lvPos + 13] = bY\n leafVertices[lvPos + 6] = leafVertices[lvPos + 12] = leafVertices[lvPos + 15] = aX\n leafVertices[lvPos + 8] = leafVertices[lvPos + 14] = leafVertices[lvPos + 17] = eZ\n\n // UV Mapping depending on Door Configuration\n if (a.hinge==='right') leafUvs [lvUvPos] = leafUvs [lvUvPos + 2] = leafUvs [lvUvPos + 6] = -xCursor/doorOpening\n else leafUvs [lvUvPos] = leafUvs [lvUvPos + 2] = leafUvs [lvUvPos + 6] = xCursor/doorOpening\n leafUvs [lvUvPos + 1] = leafUvs [lvUvPos + 7] = leafUvs [lvUvPos + 11] = 1\n leafUvs [lvUvPos + 3] = leafUvs [lvUvPos + 5] = leafUvs [lvUvPos + 9] = 0\n if (a.hinge==='right') leafUvs [lvUvPos + 4] = leafUvs [lvUvPos + 8] = leafUvs [lvUvPos + 10] = -(xCursor+leafLength)/doorOpening\n else leafUvs [lvUvPos + 4] = leafUvs [lvUvPos + 8] = leafUvs [lvUvPos + 10] = (xCursor+leafLength)/doorOpening\n\n lvPos += 18\n lvUvPos += 12\n\n // door leaf extrusion top HADE\n // H\n leafVertices[ lvPos ] = leafVertices[ lvPos + 9 ] = aX\n leafVertices[ lvPos + 1 ] = leafVertices[ lvPos + 10 ] = aY\n leafVertices[ lvPos + 2 ] = leafVertices[ lvPos + 11 ] = eZ\n // A\n leafVertices[ lvPos + 3 ] = aX\n leafVertices[ lvPos + 4 ] = aY\n leafVertices[ lvPos + 5 ] = aZ\n // D\n leafVertices[ lvPos + 6 ] = leafVertices[ lvPos + 12 ] = cX\n leafVertices[ lvPos + 7 ] = leafVertices[ lvPos + 13 ] = aY\n leafVertices[ lvPos + 8 ] = leafVertices[ lvPos + 14 ] = aZ\n // E\n leafVertices[ lvPos + 15 ] = cX\n leafVertices[ lvPos + 16 ] = aY\n leafVertices[ lvPos + 17 ] = eZ\n\n leafUvs [lvUvPos] = leafUvs [lvUvPos + 2] = leafUvs [lvUvPos + 6] = 0\n leafUvs [lvUvPos + 1] = leafUvs [lvUvPos + 7] = leafUvs [lvUvPos + 11] = 1\n leafUvs [lvUvPos + 3] = leafUvs [lvUvPos + 5] = leafUvs [lvUvPos + 9] = 0\n leafUvs [lvUvPos + 4] = leafUvs [lvUvPos + 8] = leafUvs [lvUvPos + 10] = 0.05\n\n lvPos += 18\n lvUvPos += 12\n\n // door leaf extrusion outer side DCFE\n // D\n leafVertices[ lvPos ] = leafVertices[ lvPos + 9 ] = cX\n leafVertices[ lvPos + 1 ] = leafVertices[ lvPos + 10 ] = aY\n leafVertices[ lvPos + 2 ] = leafVertices[ lvPos + 11 ] = aZ\n // C\n leafVertices[ lvPos + 3 ] = cX\n leafVertices[ lvPos + 4 ] = bY\n leafVertices[ lvPos + 5 ] = aZ\n // F\n leafVertices[ lvPos + 6 ] = leafVertices[ lvPos + 12 ] = cX\n leafVertices[ lvPos + 7 ] = leafVertices[ lvPos + 13 ] = bY\n leafVertices[ lvPos + 8 ] = leafVertices[ lvPos + 14 ] = eZ\n // E\n leafVertices[ lvPos + 15 ] = cX\n leafVertices[ lvPos + 16 ] = aY\n leafVertices[ lvPos + 17 ] = eZ\n\n leafUvs [lvUvPos] = leafUvs [lvUvPos + 2] = leafUvs [lvUvPos + 6] = 0\n leafUvs [lvUvPos + 1] = leafUvs [lvUvPos + 7] = leafUvs [lvUvPos + 11] = 1\n leafUvs [lvUvPos + 3] = leafUvs [lvUvPos + 5] = leafUvs [lvUvPos + 9] = 0\n leafUvs [lvUvPos + 4] = leafUvs [lvUvPos + 8] = leafUvs [lvUvPos + 10] = 0.05\n\n lvPos += 18\n lvUvPos += 12\n\n // door leaf extrusion inner side HGBA\n // H\n leafVertices[ lvPos ] = leafVertices[ lvPos + 9 ] = aX\n leafVertices[ lvPos + 1 ] = leafVertices[ lvPos + 10 ] = aY\n leafVertices[ lvPos + 2 ] = leafVertices[ lvPos + 11 ] = eZ\n // G\n leafVertices[ lvPos + 3 ] = aX\n leafVertices[ lvPos + 4 ] = bY\n leafVertices[ lvPos + 5 ] = eZ\n // B\n leafVertices[ lvPos + 6 ] = leafVertices[ lvPos + 12 ] = aX\n leafVertices[ lvPos + 7 ] = leafVertices[ lvPos + 13 ] = bY\n leafVertices[ lvPos + 8 ] = leafVertices[ lvPos + 14 ] = aZ\n // A\n leafVertices[ lvPos + 15 ] = aX\n leafVertices[ lvPos + 16 ] = aY\n leafVertices[ lvPos + 17 ] = aZ\n\n leafUvs [lvUvPos] = leafUvs [lvUvPos + 2] = leafUvs [lvUvPos + 6] = 0\n leafUvs [lvUvPos + 1] = leafUvs [lvUvPos + 7] = leafUvs [lvUvPos + 11] = 1\n leafUvs [lvUvPos + 3] = leafUvs [lvUvPos + 5] = leafUvs [lvUvPos + 9] = 0\n leafUvs [lvUvPos + 4] = leafUvs [lvUvPos + 8] = leafUvs [lvUvPos + 10] = 0.05\n\n lvPos += 18\n lvUvPos += 12\n\n // set end position in leaf vertex array for current door leaf\n lve = leafVertices.length\n\n if (leaf[c].handle){\n // DOOR HANDLE\n //\n // Top View:\n //\n // I/J__K/L\n // | |\n // E/F______G/H |\n // | |\n // A/B___________C/D\n\n // Size Definitions\n\n zCursor = wallBackPos-leafOffset-frameOffset\n aX = xCursor + frameLength + leafLength-handleDistance-handleLength\n aY = handleHeight\n aZ = zCursor+a.leafWidth+handleWidth+handleThickness*0.6\n bY = handleHeight-handleThickness\n cX = xCursor + frameLength + leafLength-handleDistance\n cZ = zCursor+a.leafWidth+handleWidth+handleThickness\n eZ = zCursor+a.leafWidth+handleWidth\n gX = xCursor + frameLength + leafLength-handleDistance-handleThickness\n iZ = zCursor+a.leafWidth\n\n var l\n // set start position in handle vertex array for current door leaf\n hvs = handleVertices.length\n if (a.handleType==='knob') {\n handleVertices = handleVertices.concat([0.025203,-0.091811,-1.094472e-08,0.025203,-0.091811,0.007999989,0.0265,-0.1,0.007999988,0.0025,-0.099188,0.007999988,0.0025,-0.1,0.007999988,0.0265,-0.1,0.007999988,0.025203,-0.091811,-1.094472e-08,0.021439,-0.084424,-1.006412e-08,0.021439,-0.084424,0.00799999,0.015576,-0.078561,-9.365201e-09,0.015576,-0.078561,0.007999991,0.021439,-0.084424,0.00799999,0.008189,-0.074797,-8.916497e-09,0.008189,-0.074797,0.007999991,0.015576,-0.078561,0.007999991,0,-0.0735,0.007999992,0.008189,-0.074797,0.007999991,0.008189,-0.074797,-8.916497e-09,0.0025,-0.0875,0.00799999,0.0025,-0.092306,0.007999989,0.008189,-0.074797,0.007999991,-0.008189,-0.074797,-8.916497e-09,-0.008189,-0.074797,0.007999991,0,-0.0735,0.007999992,-0.015576,-0.078561,0.007999991,-0.008189,-0.074797,0.007999991,-0.008189,-0.074797,-8.916497e-09,-0.021439,-0.084424,0.00799999,-0.015576,-0.078561,0.007999991,-0.015576,-0.078561,-9.365201e-09,-0.025203,-0.091811,0.007999989,-0.021439,-0.084424,0.00799999,-0.021439,-0.084424,-1.006412e-08,-0.0025,-0.098184,0.007999988,-0.021439,-0.084424,0.00799999,-0.025203,-0.091811,0.007999989,-0.0265,-0.1,0.007999988,-0.025203,-0.091811,0.007999989,-0.025203,-0.091811,-1.094472e-08,-0.025203,-0.108189,0.007999987,-0.0265,-0.1,0.007999988,-0.0265,-0.1,-1.192093e-08,-0.021439,-0.115576,0.007999986,-0.025203,-0.108189,0.007999987,-0.025203,-0.108189,-1.289713e-08,-0.0025,-0.101816,0.007999988,-0.0025,-0.100812,0.007999988,-0.025203,-0.108189,0.007999987,-0.015576,-0.121439,0.007999985,-0.021439,-0.115576,0.007999986,-0.021439,-0.115576,-1.377773e-08,-0.008189,-0.125203,0.007999985,-0.015576,-0.121439,0.007999985,-0.015576,-0.121439,-1.447666e-08,0,-0.1265,0.007999985,-0.008189,-0.125203,0.007999985,-0.008189,-0.125203,-1.492536e-08,0.008189,-0.125203,0.007999985,0,-0.1265,0.007999985,0,-0.1265,-1.507997e-08,0.0025,-0.1125,0.007999987,0,-0.1125,0.007999987,0,-0.1265,0.007999985,0.008189,-0.125203,0.007999985,0.0025,-0.107694,0.007999987,0.0025,-0.1125,0.007999987,0.015576,-0.121439,0.007999985,0.008189,-0.125203,0.007999985,0.008189,-0.125203,-1.492536e-08,0.0025,-0.107694,0.007999987,0.008189,-0.125203,0.007999985,0.015576,-0.121439,0.007999985,0.021439,-0.115576,0.007999986,0.015576,-0.121439,0.007999985,0.015576,-0.121439,-1.447666e-08,0.025203,-0.108189,0.007999987,0.021439,-0.115576,0.007999986,0.021439,-0.115576,-1.377773e-08,0.0265,-0.1,0.007999988,0.025203,-0.108189,0.007999987,0.025203,-0.108189,-1.289713e-08,-0.021439,-0.115576,0.007999986,-0.015576,-0.121439,0.007999985,-0.0025,-0.103441,0.007999988,0.0025,-0.098184,0.007999988,0.0025,-0.099188,0.007999988,0.025203,-0.091811,0.007999989,-0.0025,-0.100812,0.007999988,-0.0025,-0.1,0.007999988,-0.0265,-0.1,0.007999988,-0.008189,-0.074797,0.007999991,-0.0025,-0.092306,0.007999989,-0.0025,-0.0875,0.00799999,-0.015576,-0.121439,0.007999985,-0.008189,-0.125203,0.007999985,-0.0025,-0.107694,0.007999987,-0.0025,-0.096559,0.007999989,-0.015576,-0.078561,0.007999991,-0.021439,-0.084424,0.00799999,-0.0265,-0.1,0.007999988,-0.0025,-0.1,0.007999988,-0.0025,-0.099188,0.007999988,-0.0025,-0.0875,0.00799999,0,-0.0875,0.00799999,0,-0.0735,0.007999992,-0.0025,-0.092306,0.007999989,-0.008189,-0.074797,0.007999991,-0.015576,-0.078561,0.007999991,-0.0025,-0.1125,0.0008419866,0.0025,-0.1125,0.0008419866,0.0025,-0.0875,0.0008419896,0,-0.1125,0.007999987,0.0025,-0.1125,0.007999987,0.0025,-0.1125,0.0008419866,0.0025,-0.101816,0.007999988,0.021439,-0.115576,0.007999986,0.025203,-0.108189,0.007999987,-0.0025,-0.1125,0.007999987,-0.0025,-0.107694,0.007999987,-0.008189,-0.125203,0.007999985,0.0025,-0.1,0.007999988,0.0025,-0.1125,0.0008419866,0.0025,-0.100812,0.007999988,-0.0025,-0.0875,0.0008419896,-0.0025,-0.098184,0.007999988,-0.0025,-0.099188,0.007999988,0.0265,-0.1,0.007999988,0.0025,-0.1,0.007999988,0.0025,-0.100812,0.007999988,0,-0.0875,0.00799999,-0.0025,-0.0875,0.00799999,-0.0025,-0.0875,0.0008419896,0,-0.1265,0.007999985,0,-0.1125,0.007999987,-0.0025,-0.1125,0.007999987,0.0025,-0.103441,0.007999988,0.015576,-0.121439,0.007999985,0.021439,-0.115576,0.007999986,0,-0.0735,0.007999992,0,-0.0875,0.00799999,0.0025,-0.0875,0.00799999,0.021439,-0.084424,0.00799999,0.015576,-0.078561,0.007999991,0.0025,-0.096559,0.007999989,0.015576,-0.078561,0.007999991,0.008189,-0.074797,0.007999991,0.0025,-0.092306,0.007999989,-0.010141,0.024483,0.033,0,0.0265,0.033,0,0.009999997,0.033,0.0265,-4.53789e-09,0.049,0.024483,-0.010141,0.049,0.024483,-0.010141,0.033,-0.010141,-0.024483,0.033,-0.018738,-0.018738,0.033,-0.007071,-0.007071002,0.033,0,-0.0265,0.033,0,-0.0265,0.049,-0.010141,-0.024483,0.049,-0.007071,-0.007071002,0.033,-0.018738,-0.018738,0.033,-0.024483,-0.010141,0.033,-0.024483,-0.010141,0.033,-0.0265,-2.630541e-09,0.033,-0.01,-2.630541e-09,0.033,0.010141,0.024483,0.033,0.018738,0.018738,0.033,0.007071,0.007070998,0.033,0,0.009999997,0.033,0,0.0265,0.033,0.010141,0.024483,0.033,0.018738,0.018738,0.04900001,0,-4.53789e-09,0.049,0.024483,0.010141,0.049,0.010141,0.024483,0.04900001,0,-4.53789e-09,0.049,0.018738,0.018738,0.04900001,0.024483,-0.010141,0.033,0.024483,-0.010141,0.049,0.018738,-0.018738,0.049,-0.024483,0.010141,0.049,-0.018738,0.018738,0.04900001,-0.018738,0.018738,0.033,-0.0265,-2.630541e-09,0.033,-0.0265,-4.53789e-09,0.049,-0.024483,0.010141,0.049,0.024483,-0.010141,0.033,0.018738,-0.018738,0.033,0.007071,-0.007071002,0.033,-0.018738,-0.018738,0.049,0,-4.53789e-09,0.049,-0.024483,-0.010141,0.049,-0.010141,-0.024483,0.049,0,-4.53789e-09,0.049,-0.018738,-0.018738,0.049,0,-0.01,0.033,0,-0.0265,0.033,-0.010141,-0.024483,0.033,0,-0.0265,0.049,0,-4.53789e-09,0.049,-0.010141,-0.024483,0.049,0.0265,-4.53789e-09,0.049,0,-4.53789e-09,0.049,0.024483,-0.010141,0.049,-0.024483,0.010141,0.033,-0.007071,0.007070998,0.033,-0.01,-2.630541e-09,0.033,0.010141,-0.024483,0.049,0,-0.0265,0.049,0,-0.0265,0.033,-0.024483,0.010141,0.033,-0.018738,0.018738,0.033,-0.007071,0.007070998,0.033,-0.010141,0.024483,0.033,0,0.009999997,0.033,-0.007071,0.007070998,0.033,0.010141,-0.024483,0.049,0,-4.53789e-09,0.049,0,-0.0265,0.049,0.024483,0.010141,0.049,0.0265,-4.53789e-09,0.049,0.0265,-2.630541e-09,0.033,0.024483,0.010141,0.049,0,-4.53789e-09,0.049,0.0265,-4.53789e-09,0.049,0.018738,-0.018738,0.049,0.010141,-0.024483,0.049,0.010141,-0.024483,0.033,0.018738,0.018738,0.033,0.018738,0.018738,0.04900001,0.024483,0.010141,0.049,0.018738,-0.018738,0.049,0,-4.53789e-09,0.049,0.010141,-0.024483,0.049,0.010141,0.024483,0.04900001,0.018738,0.018738,0.04900001,0.018738,0.018738,0.033,0,0.0265,0.04900001,0.010141,0.024483,0.04900001,0.010141,0.024483,0.033,0,0.0265,0.04900001,0,-4.53789e-09,0.049,0.010141,0.024483,0.04900001,0.024483,-0.010141,0.049,0,-4.53789e-09,0.049,0.018738,-0.018738,0.049,-0.010141,0.024483,0.04900001,0,0.0265,0.04900001,0,0.0265,0.033,-0.010141,0.024483,0.04900001,0,-4.53789e-09,0.049,0,0.0265,0.04900001,0.007071,0.007070998,0.033,0.018738,0.018738,0.033,0.024483,0.010141,0.033,-0.010141,0.024483,0.033,-0.018738,0.018738,0.033,-0.018738,0.018738,0.04900001,-0.018738,0.018738,0.04900001,0,-4.53789e-09,0.049,-0.010141,0.024483,0.04900001,0.024483,0.010141,0.033,0.0265,-2.630541e-09,0.033,0.01,-2.630541e-09,0.033,-0.024483,0.010141,0.049,0,-4.53789e-09,0.049,-0.018738,0.018738,0.04900001,0.01,-2.630541e-09,0.033,0.0265,-2.630541e-09,0.033,0.024483,-0.010141,0.033,-0.0265,-4.53789e-09,0.049,0,-4.53789e-09,0.049,-0.024483,0.010141,0.049,-0.024483,-0.010141,0.033,-0.024483,-0.010141,0.049,-0.0265,-4.53789e-09,0.049,-0.024483,-0.010141,0.049,0,-4.53789e-09,0.049,-0.0265,-4.53789e-09,0.049,0.007071,-0.007071002,0.033,0.018738,-0.018738,0.033,0.010141,-0.024483,0.033,-0.018738,-0.018738,0.049,-0.024483,-0.010141,0.049,-0.024483,-0.010141,0.033,0.010141,-0.024483,0.033,0,-0.0265,0.033,0,-0.01,0.033,-0.010141,-0.024483,0.049,-0.018738,-0.018738,0.049,-0.018738,-0.018738,0.033,0.025203,0.008188999,0.008000001,0.0265,-9.536744e-10,0.008,0.0265,0,0,0.021439,0.015576,0.008000002,0.025203,0.008188999,0.008000001,0.025203,0.008189,9.762049e-10,0.007071,0.007071001,0.008000001,0.01,-9.536744e-10,0.008,0.025203,0.008188999,0.008000001,0.015576,0.021439,0.008000003,0.021439,0.015576,0.008000002,0.021439,0.015576,1.856804e-09,0.008189,0.025203,0.008000003,0.015576,0.021439,0.008000003,0.015576,0.021439,2.555728e-09,0,0.0265,0.008000003,0.008189,0.025203,0.008000003,0.008189,0.025203,3.004432e-09,-0.008189,0.025203,0.008000003,0,0.0265,0.008000003,0,0.0265,3.159046e-09,-0.015576,0.021439,0.008000003,-0.008189,0.025203,0.008000003,-0.008189,0.025203,3.004432e-09,-0.021439,0.015576,0.008000002,-0.015576,0.021439,0.008000003,-0.015576,0.021439,2.555728e-09,-0.025203,0.008188999,0.008000001,-0.021439,0.015576,0.008000002,-0.021439,0.015576,1.856804e-09,-0.0265,0,0,-0.0265,-9.536744e-10,0.008,-0.025203,0.008188999,0.008000001,-0.025203,-0.008189001,0.007999999,-0.0265,-9.536744e-10,0.008,-0.0265,0,0,-0.021439,-0.015576,0.007999999,-0.025203,-0.008189001,0.007999999,-0.025203,-0.008189,-9.762049e-10,-0.015576,-0.021439,0.007999998,-0.021439,-0.015576,0.007999999,-0.021439,-0.015576,-1.856804e-09,-0.008189,-0.025203,0.007999998,-0.015576,-0.021439,0.007999998,-0.015576,-0.021439,-2.555728e-09,0,-0.0265,0.007999998,-0.008189,-0.025203,0.007999998,-0.008189,-0.025203,-3.004432e-09,0.008189,-0.025203,0.007999998,0,-0.0265,0.007999998,0,-0.0265,-3.159046e-09,0.015576,-0.021439,0.007999998,0.008189,-0.025203,0.007999998,0.008189,-0.025203,-3.004432e-09,0.021439,-0.015576,-1.856804e-09,0.021439,-0.015576,0.007999999,0.015576,-0.021439,0.007999998,0.025203,-0.008189001,0.007999999,0.021439,-0.015576,0.007999999,0.021439,-0.015576,-1.856804e-09,0.0265,-9.536744e-10,0.008,0.025203,-0.008189001,0.007999999,0.025203,-0.008189,-9.762049e-10,0.007071,0.007070998,0.033,0.01,-2.630541e-09,0.033,0.01,-9.536744e-10,0.008,0,0.009999997,0.033,0.007071,0.007070998,0.033,0.007071,0.007071001,0.008000001,-0.007071,0.007071,0.008,-0.007071,0.007070998,0.033,0,0.009999997,0.033,-0.01,-2.630541e-09,0.033,-0.007071,0.007070998,0.033,-0.007071,0.007071,0.008,-0.007071,-0.007071002,0.033,-0.01,-2.630541e-09,0.033,-0.01,-1.186505e-09,0.008,0,-0.01,0.007999999,0,-0.01,0.033,-0.007071,-0.007071002,0.033,0.007071,-0.007071,0.007999999,0.007071,-0.007071002,0.033,0,-0.01,0.033,0.01,-9.536744e-10,0.008,0.01,-2.630541e-09,0.033,0.007071,-0.007071002,0.033,0.0265,-9.536744e-10,0.008,0.025203,0.008188999,0.008000001,0.01,-9.536744e-10,0.008,0.021439,0.015576,0.008000002,0.015576,0.021439,0.008000003,0.007071,0.007071001,0.008000001,0.008189,0.025203,0.008000003,0,0.01,0.008000001,0.007071,0.007071001,0.008000001,0.008189,0.025203,0.008000003,0,0.0265,0.008000003,0,0.01,0.008000001,-0.008189,0.025203,0.008000003,-0.007071,0.007071,0.008,0,0.01,0.008000001,-0.008189,0.025203,0.008000003,-0.015576,0.021439,0.008000003,-0.007071,0.007071,0.008,-0.021439,0.015576,0.008000002,-0.007071,0.007071,0.008,-0.015576,0.021439,0.008000003,-0.025203,0.008188999,0.008000001,-0.01,-1.186505e-09,0.008,-0.007071,0.007071,0.008,-0.0265,-9.536744e-10,0.008,-0.01,-1.186505e-09,0.008,-0.025203,0.008188999,0.008000001,-0.025203,-0.008189001,0.007999999,-0.007071,-0.007071,0.007999999,-0.01,-1.186505e-09,0.008,-0.021439,-0.015576,0.007999999,-0.007071,-0.007071,0.007999999,-0.025203,-0.008189001,0.007999999,-0.021439,-0.015576,0.007999999,-0.015576,-0.021439,0.007999998,-0.007071,-0.007071,0.007999999,-0.008189,-0.025203,0.007999998,0,-0.01,0.007999999,-0.007071,-0.007071,0.007999999,-0.008189,-0.025203,0.007999998,0,-0.0265,0.007999998,0,-0.01,0.007999999,0.008189,-0.025203,0.007999998,0,-0.01,0.007999999,0,-0.0265,0.007999998,0.008189,-0.025203,0.007999998,0.015576,-0.021439,0.007999998,0.007071,-0.007071,0.007999999,0.021439,-0.015576,0.007999999,0.007071,-0.007071,0.007999999,0.015576,-0.021439,0.007999998,0.021439,-0.015576,0.007999999,0.025203,-0.008189001,0.007999999,0.007071,-0.007071,0.007999999,0.01,-9.536744e-10,0.008,0.007071,-0.007071,0.007999999,0.025203,-0.008189001,0.007999999,0.0265,-0.1,-1.192093e-08,0.025203,-0.091811,-1.094472e-08,0.0265,-0.1,0.007999988,0.025203,-0.091811,0.007999989,0.0025,-0.099188,0.007999988,0.0265,-0.1,0.007999988,0.025203,-0.091811,0.007999989,0.025203,-0.091811,-1.094472e-08,0.021439,-0.084424,0.00799999,0.021439,-0.084424,-1.006412e-08,0.015576,-0.078561,-9.365201e-09,0.021439,-0.084424,0.00799999,0.015576,-0.078561,-9.365201e-09,0.008189,-0.074797,-8.916497e-09,0.015576,-0.078561,0.007999991,0,-0.0735,-8.761883e-09,0,-0.0735,0.007999992,0.008189,-0.074797,-8.916497e-09,0,-0.0735,-8.761883e-09,-0.008189,-0.074797,-8.916497e-09,0,-0.0735,0.007999992,-0.015576,-0.078561,-9.365201e-09,-0.015576,-0.078561,0.007999991,-0.008189,-0.074797,-8.916497e-09,-0.021439,-0.084424,-1.006412e-08,-0.021439,-0.084424,0.00799999,-0.015576,-0.078561,-9.365201e-09,-0.025203,-0.091811,-1.094472e-08,-0.025203,-0.091811,0.007999989,-0.021439,-0.084424,-1.006412e-08,-0.0025,-0.099188,0.007999988,-0.0025,-0.098184,0.007999988,-0.025203,-0.091811,0.007999989,-0.0265,-0.1,-1.192093e-08,-0.0265,-0.1,0.007999988,-0.025203,-0.091811,-1.094472e-08,-0.025203,-0.108189,-1.289713e-08,-0.025203,-0.108189,0.007999987,-0.0265,-0.1,-1.192093e-08,-0.021439,-0.115576,-1.377773e-08,-0.021439,-0.115576,0.007999986,-0.025203,-0.108189,-1.289713e-08,-0.021439,-0.115576,0.007999986,-0.0025,-0.101816,0.007999988,-0.025203,-0.108189,0.007999987,-0.015576,-0.121439,-1.447666e-08,-0.015576,-0.121439,0.007999985,-0.021439,-0.115576,-1.377773e-08,-0.008189,-0.125203,-1.492536e-08,-0.008189,-0.125203,0.007999985,-0.015576,-0.121439,-1.447666e-08,0,-0.1265,-1.507997e-08,0,-0.1265,0.007999985,-0.008189,-0.125203,-1.492536e-08,0.008189,-0.125203,-1.492536e-08,0.008189,-0.125203,0.007999985,0,-0.1265,-1.507997e-08,0.008189,-0.125203,0.007999985,0.0025,-0.1125,0.007999987,0,-0.1265,0.007999985,0.015576,-0.121439,-1.447666e-08,0.015576,-0.121439,0.007999985,0.008189,-0.125203,-1.492536e-08,0.0025,-0.103441,0.007999988,0.0025,-0.107694,0.007999987,0.015576,-0.121439,0.007999985,0.021439,-0.115576,-1.377773e-08,0.021439,-0.115576,0.007999986,0.015576,-0.121439,-1.447666e-08,0.025203,-0.108189,-1.289713e-08,0.025203,-0.108189,0.007999987,0.021439,-0.115576,-1.377773e-08,0.0265,-0.1,-1.192093e-08,0.0265,-0.1,0.007999988,0.025203,-0.108189,-1.289713e-08,-0.0025,-0.101816,0.007999988,-0.021439,-0.115576,0.007999986,-0.0025,-0.103441,0.007999988,0.021439,-0.084424,0.00799999,0.0025,-0.098184,0.007999988,0.025203,-0.091811,0.007999989,-0.025203,-0.108189,0.007999987,-0.0025,-0.100812,0.007999988,-0.0265,-0.1,0.007999988,-0.0025,-0.103441,0.007999988,-0.015576,-0.121439,0.007999985,-0.0025,-0.107694,0.007999987,-0.0025,-0.098184,0.007999988,-0.0025,-0.096559,0.007999989,-0.021439,-0.084424,0.00799999,-0.025203,-0.091811,0.007999989,-0.0265,-0.1,0.007999988,-0.0025,-0.099188,0.007999988,-0.008189,-0.074797,0.007999991,-0.0025,-0.0875,0.00799999,0,-0.0735,0.007999992,-0.0025,-0.096559,0.007999989,-0.0025,-0.092306,0.007999989,-0.015576,-0.078561,0.007999991,-0.0025,-0.0875,0.0008419896,-0.0025,-0.1125,0.0008419866,0.0025,-0.0875,0.0008419896,-0.0025,-0.1125,0.0008419866,-0.0025,-0.1125,0.007999987,0,-0.1125,0.007999987,0,-0.1125,0.007999987,0.0025,-0.1125,0.0008419866,-0.0025,-0.1125,0.0008419866,0.0025,-0.100812,0.007999988,0.0025,-0.101816,0.007999988,0.025203,-0.108189,0.007999987,0.0025,-0.0875,0.0008419896,0.0025,-0.096559,0.007999989,0.0025,-0.092306,0.007999989,0.0025,-0.0875,0.0008419896,0.0025,-0.1,0.007999988,0.0025,-0.098184,0.007999988,0.0025,-0.1125,0.0008419866,0.0025,-0.101816,0.007999988,0.0025,-0.100812,0.007999988,0.0025,-0.1125,0.0008419866,0.0025,-0.1125,0.007999987,0.0025,-0.107694,0.007999987,0.0025,-0.1125,0.0008419866,0.0025,-0.103441,0.007999988,0.0025,-0.101816,0.007999988,0.0025,-0.092306,0.007999989,0.0025,-0.0875,0.00799999,0.0025,-0.0875,0.0008419896,0.0025,-0.0875,0.0008419896,0.0025,-0.1125,0.0008419866,0.0025,-0.1,0.007999988,0.0025,-0.098184,0.007999988,0.0025,-0.096559,0.007999989,0.0025,-0.0875,0.0008419896,0.0025,-0.103441,0.007999988,0.0025,-0.1125,0.0008419866,0.0025,-0.107694,0.007999987,-0.0025,-0.1,0.007999988,-0.0025,-0.1125,0.0008419866,-0.0025,-0.0875,0.0008419896,-0.0025,-0.1125,0.0008419866,-0.0025,-0.103441,0.007999988,-0.0025,-0.107694,0.007999987,-0.0025,-0.107694,0.007999987,-0.0025,-0.1125,0.007999987,-0.0025,-0.1125,0.0008419866,-0.0025,-0.0875,0.0008419896,-0.0025,-0.0875,0.00799999,-0.0025,-0.092306,0.007999989,-0.0025,-0.0875,0.0008419896,-0.0025,-0.096559,0.007999989,-0.0025,-0.098184,0.007999988,-0.0025,-0.0875,0.0008419896,-0.0025,-0.099188,0.007999988,-0.0025,-0.1,0.007999988,-0.0025,-0.1125,0.0008419866,-0.0025,-0.100812,0.007999988,-0.0025,-0.101816,0.007999988,-0.0025,-0.101816,0.007999988,-0.0025,-0.103441,0.007999988,-0.0025,-0.1125,0.0008419866,-0.0025,-0.0875,0.0008419896,-0.0025,-0.092306,0.007999989,-0.0025,-0.096559,0.007999989,-0.0025,-0.1125,0.0008419866,-0.0025,-0.1,0.007999988,-0.0025,-0.100812,0.007999988,0.025203,-0.108189,0.007999987,0.0265,-0.1,0.007999988,0.0025,-0.100812,0.007999988,0.0025,-0.0875,0.0008419896,0.0025,-0.0875,0.00799999,0,-0.0875,0.00799999,0,-0.0875,0.00799999,-0.0025,-0.0875,0.0008419896,0.0025,-0.0875,0.0008419896,-0.008189,-0.125203,0.007999985,0,-0.1265,0.007999985,-0.0025,-0.1125,0.007999987,0.0025,-0.101816,0.007999988,0.0025,-0.103441,0.007999988,0.021439,-0.115576,0.007999986,0.008189,-0.074797,0.007999991,0,-0.0735,0.007999992,0.0025,-0.0875,0.00799999,0.0025,-0.098184,0.007999988,0.021439,-0.084424,0.00799999,0.0025,-0.096559,0.007999989,0.0025,-0.096559,0.007999989,0.015576,-0.078561,0.007999991,0.0025,-0.092306,0.007999989,0.0265,-2.630541e-09,0.033,0.0265,-4.53789e-09,0.049,0.024483,-0.010141,0.033,-0.010141,-0.024483,0.033,0,-0.0265,0.033,-0.010141,-0.024483,0.049,-0.01,-2.630541e-09,0.033,-0.007071,-0.007071002,0.033,-0.024483,-0.010141,0.033,0.007071,0.007070998,0.033,0,0.009999997,0.033,0.010141,0.024483,0.033,0.018738,-0.018738,0.033,0.024483,-0.010141,0.033,0.018738,-0.018738,0.049,-0.024483,0.010141,0.033,-0.024483,0.010141,0.049,-0.018738,0.018738,0.033,-0.024483,0.010141,0.033,-0.0265,-2.630541e-09,0.033,-0.024483,0.010141,0.049,-0.007071,-0.007071002,0.033,0,-0.01,0.033,-0.010141,-0.024483,0.033,-0.0265,-2.630541e-09,0.033,-0.024483,0.010141,0.033,-0.01,-2.630541e-09,0.033,0.010141,-0.024483,0.033,0.010141,-0.024483,0.049,0,-0.0265,0.033,-0.018738,0.018738,0.033,-0.010141,0.024483,0.033,-0.007071,0.007070998,0.033,0.024483,0.010141,0.033,0.024483,0.010141,0.049,0.0265,-2.630541e-09,0.033,0.018738,-0.018738,0.033,0.018738,-0.018738,0.049,0.010141,-0.024483,0.033,0.024483,0.010141,0.033,0.018738,0.018738,0.033,0.024483,0.010141,0.049,0.010141,0.024483,0.033,0.010141,0.024483,0.04900001,0.018738,0.018738,0.033,0,0.0265,0.033,0,0.0265,0.04900001,0.010141,0.024483,0.033,-0.010141,0.024483,0.033,-0.010141,0.024483,0.04900001,0,0.0265,0.033,0.01,-2.630541e-09,0.033,0.007071,0.007070998,0.033,0.024483,0.010141,0.033,-0.010141,0.024483,0.04900001,-0.010141,0.024483,0.033,-0.018738,0.018738,0.04900001,0.007071,-0.007071002,0.033,0.01,-2.630541e-09,0.033,0.024483,-0.010141,0.033,-0.0265,-2.630541e-09,0.033,-0.024483,-0.010141,0.033,-0.0265,-4.53789e-09,0.049,0,-0.01,0.033,0.007071,-0.007071002,0.033,0.010141,-0.024483,0.033,-0.018738,-0.018738,0.033,-0.018738,-0.018738,0.049,-0.024483,-0.010141,0.033,-0.010141,-0.024483,0.033,-0.010141,-0.024483,0.049,-0.018738,-0.018738,0.033,0.025203,0.008189,9.762049e-10,0.025203,0.008188999,0.008000001,0.0265,0,0,0.021439,0.015576,1.856804e-09,0.021439,0.015576,0.008000002,0.025203,0.008189,9.762049e-10,0.021439,0.015576,0.008000002,0.007071,0.007071001,0.008000001,0.025203,0.008188999,0.008000001,0.015576,0.021439,2.555728e-09,0.015576,0.021439,0.008000003,0.021439,0.015576,1.856804e-09,0.008189,0.025203,3.004432e-09,0.008189,0.025203,0.008000003,0.015576,0.021439,2.555728e-09,0,0.0265,3.159046e-09,0,0.0265,0.008000003,0.008189,0.025203,3.004432e-09,-0.008189,0.025203,3.004432e-09,-0.008189,0.025203,0.008000003,0,0.0265,3.159046e-09,-0.015576,0.021439,2.555728e-09,-0.015576,0.021439,0.008000003,-0.008189,0.025203,3.004432e-09,-0.021439,0.015576,1.856804e-09,-0.021439,0.015576,0.008000002,-0.015576,0.021439,2.555728e-09,-0.025203,0.008189,9.762049e-10,-0.025203,0.008188999,0.008000001,-0.021439,0.015576,1.856804e-09,-0.025203,0.008189,9.762049e-10,-0.0265,0,0,-0.025203,0.008188999,0.008000001,-0.025203,-0.008189,-9.762049e-10,-0.025203,-0.008189001,0.007999999,-0.0265,0,0,-0.021439,-0.015576,-1.856804e-09,-0.021439,-0.015576,0.007999999,-0.025203,-0.008189,-9.762049e-10,-0.015576,-0.021439,-2.555728e-09,-0.015576,-0.021439,0.007999998,-0.021439,-0.015576,-1.856804e-09,-0.008189,-0.025203,-3.004432e-09,-0.008189,-0.025203,0.007999998,-0.015576,-0.021439,-2.555728e-09,0,-0.0265,-3.159046e-09,0,-0.0265,0.007999998,-0.008189,-0.025203,-3.004432e-09,0.008189,-0.025203,-3.004432e-09,0.008189,-0.025203,0.007999998,0,-0.0265,-3.159046e-09,0.015576,-0.021439,-2.555728e-09,0.015576,-0.021439,0.007999998,0.008189,-0.025203,-3.004432e-09,0.015576,-0.021439,-2.555728e-09,0.021439,-0.015576,-1.856804e-09,0.015576,-0.021439,0.007999998,0.025203,-0.008189,-9.762049e-10,0.025203,-0.008189001,0.007999999,0.021439,-0.015576,-1.856804e-09,0.0265,0,0,0.0265,-9.536744e-10,0.008,0.025203,-0.008189,-9.762049e-10,0.007071,0.007071001,0.008000001,0.007071,0.007070998,0.033,0.01,-9.536744e-10,0.008,0,0.01,0.008000001,0,0.009999997,0.033,0.007071,0.007071001,0.008000001,0,0.01,0.008000001,-0.007071,0.007071,0.008,0,0.009999997,0.033,-0.01,-1.186505e-09,0.008,-0.01,-2.630541e-09,0.033,-0.007071,0.007071,0.008,-0.007071,-0.007071,0.007999999,-0.007071,-0.007071002,0.033,-0.01,-1.186505e-09,0.008,-0.007071,-0.007071,0.007999999,0,-0.01,0.007999999,-0.007071,-0.007071002,0.033,0,-0.01,0.007999999,0.007071,-0.007071,0.007999999,0,-0.01,0.033,0.007071,-0.007071,0.007999999,0.01,-9.536744e-10,0.008,0.007071,-0.007071002,0.033,0.015576,0.021439,0.008000003,0.008189,0.025203,0.008000003,0.007071,0.007071001,0.008000001,0,0.0265,0.008000003,-0.008189,0.025203,0.008000003,0,0.01,0.008000001,-0.021439,0.015576,0.008000002,-0.025203,0.008188999,0.008000001,-0.007071,0.007071,0.008,-0.0265,-9.536744e-10,0.008,-0.025203,-0.008189001,0.007999999,-0.01,-1.186505e-09,0.008,-0.015576,-0.021439,0.007999998,-0.008189,-0.025203,0.007999998,-0.007071,-0.007071,0.007999999,0,-0.01,0.007999999,0.008189,-0.025203,0.007999998,0.007071,-0.007071,0.007999999,0.0265,-9.536744e-10,0.008,0.01,-9.536744e-10,0.008,0.025203,-0.008189001,0.007999999])\n for (l = hvs; l < handleVertices.length - 2; l = l + 3) {\n handleVertices[l] += cX\n handleVertices[l + 1] += aY\n handleVertices[l + 2] += iZ\n }\n } else if (a.handleType==='round') {\n handleVertices = handleVertices.concat([-0.12,0.005877995,0.04491,-0.12,-5.126e-09,0.043,-0.12,-6.318092e-09,0.053,-0.12,0.005877995,0.04491,-0.00809,0.005877995,0.04491,-0.01,-5.126e-09,0.043,-0.12,0.009510994,0.04991,-0.12,0.005877995,0.04491,-0.12,-6.318092e-09,0.053,-0.12,0.009510993,0.05609,-0.12,0.009510994,0.04991,-0.12,-6.318092e-09,0.053,-0.12,0.005877993,0.06109,-0.12,0.009510993,0.05609,-0.12,-6.318092e-09,0.053,-0.12,-7.510185e-09,0.063,-0.12,0.005877993,0.06109,-0.12,-6.318092e-09,0.053,-0.12,-0.005878008,0.06109,-0.12,-7.510185e-09,0.063,-0.12,-6.318092e-09,0.053,-0.12,-7.510185e-09,0.063,-0.12,-0.005878008,0.06109,0.00809,-0.005878008,0.06109,-0.12,-0.009511006,0.05609,-0.12,-0.005878008,0.06109,-0.12,-6.318092e-09,0.053,-0.12,-0.009511005,0.04991,-0.12,-0.009511006,0.05609,-0.12,-6.318092e-09,0.053,-0.12,-0.005878005,0.04491,-0.12,-0.009511005,0.04991,-0.12,-6.318092e-09,0.053,-0.12,-0.009511005,0.04991,-0.12,-0.005878005,0.04491,-0.00809,-0.005878005,0.04491,-0.12,-5.126e-09,0.043,-0.12,-0.005878005,0.04491,-0.12,-6.318092e-09,0.053,-0.12,-0.005878005,0.04491,-0.12,-5.126e-09,0.043,-0.01,-5.126e-09,0.043,0.00809,0.005878,0.008,0.00309,0.009511,0.008,0.00309,0.009510993,0.05609,0.00309,0.009511,0.008,-0.00309,0.009511,0.008,-0.00309,0.009510994,0.04991,-0.00809,0.005877995,0.04491,-0.12,0.005877995,0.04491,-0.12,0.009510994,0.04991,-0.00309,0.009510994,0.04991,-0.12,0.009510994,0.04991,-0.12,0.009510993,0.05609,0.00309,0.009510993,0.05609,-0.12,0.009510993,0.05609,-0.12,0.005877993,0.06109,0.00809,0.005877993,0.06109,-0.12,0.005877993,0.06109,-0.12,-7.510185e-09,0.063,-0.12,-0.005878008,0.06109,-0.12,-0.009511006,0.05609,0.00309,-0.009511006,0.05609,-0.12,-0.009511006,0.05609,-0.12,-0.009511005,0.04991,-0.00309,-0.009511005,0.04991,0.01,-1.390709e-10,0.007999999,0.00809,0.005878,0.008,0.00809,0.005877993,0.06109,-0.00309,0.009511,0.008,-0.00809,0.005878,0.008,-0.00809,0.005877995,0.04491,-0.00809,0.005878,0.008,-0.01,-1.390709e-10,0.007999999,-0.01,-5.126e-09,0.043,-0.00309,-0.009511005,0.04991,-0.00309,-0.009511,0.007999999,0.00309,-0.009511,0.007999999,0.025203,-0.091811,-1.094472e-08,0.025203,-0.091811,0.007999989,0.0265,-0.1,0.007999988,0.0025,-0.099188,0.007999988,0.0025,-0.1,0.007999988,0.0265,-0.1,0.007999988,0.025203,-0.091811,-1.094472e-08,0.021439,-0.084424,-1.006412e-08,0.021439,-0.084424,0.00799999,0.015576,-0.078561,-9.365201e-09,0.015576,-0.078561,0.007999991,0.021439,-0.084424,0.00799999,0.008189,-0.074797,-8.916497e-09,0.008189,-0.074797,0.007999991,0.015576,-0.078561,0.007999991,0,-0.0735,0.007999992,0.008189,-0.074797,0.007999991,0.008189,-0.074797,-8.916497e-09,0.0025,-0.0875,0.00799999,0.0025,-0.092306,0.007999989,0.008189,-0.074797,0.007999991,-0.008189,-0.074797,-8.916497e-09,-0.008189,-0.074797,0.007999991,0,-0.0735,0.007999992,-0.015576,-0.078561,0.007999991,-0.008189,-0.074797,0.007999991,-0.008189,-0.074797,-8.916497e-09,-0.021439,-0.084424,0.00799999,-0.015576,-0.078561,0.007999991,-0.015576,-0.078561,-9.365201e-09,-0.025203,-0.091811,0.007999989,-0.021439,-0.084424,0.00799999,-0.021439,-0.084424,-1.006412e-08,-0.0025,-0.098184,0.007999988,-0.021439,-0.084424,0.00799999,-0.025203,-0.091811,0.007999989,-0.0265,-0.1,0.007999988,-0.025203,-0.091811,0.007999989,-0.025203,-0.091811,-1.094472e-08,-0.025203,-0.108189,0.007999987,-0.0265,-0.1,0.007999988,-0.0265,-0.1,-1.192093e-08,-0.021439,-0.115576,0.007999986,-0.025203,-0.108189,0.007999987,-0.025203,-0.108189,-1.289713e-08,-0.0025,-0.101816,0.007999988,-0.0025,-0.100812,0.007999988,-0.025203,-0.108189,0.007999987,-0.015576,-0.121439,0.007999985,-0.021439,-0.115576,0.007999986,-0.021439,-0.115576,-1.377773e-08,-0.008189,-0.125203,0.007999985,-0.015576,-0.121439,0.007999985,-0.015576,-0.121439,-1.447666e-08,0,-0.1265,0.007999985,-0.008189,-0.125203,0.007999985,-0.008189,-0.125203,-1.492536e-08,0.008189,-0.125203,0.007999985,0,-0.1265,0.007999985,0,-0.1265,-1.507997e-08,0.0025,-0.1125,0.007999987,0,-0.1125,0.007999987,0,-0.1265,0.007999985,0.008189,-0.125203,0.007999985,0.0025,-0.107694,0.007999987,0.0025,-0.1125,0.007999987,0.015576,-0.121439,0.007999985,0.008189,-0.125203,0.007999985,0.008189,-0.125203,-1.492536e-08,0.0025,-0.107694,0.007999987,0.008189,-0.125203,0.007999985,0.015576,-0.121439,0.007999985,0.021439,-0.115576,0.007999986,0.015576,-0.121439,0.007999985,0.015576,-0.121439,-1.447666e-08,0.025203,-0.108189,0.007999987,0.021439,-0.115576,0.007999986,0.021439,-0.115576,-1.377773e-08,0.0265,-0.1,0.007999988,0.025203,-0.108189,0.007999987,0.025203,-0.108189,-1.289713e-08,-0.021439,-0.115576,0.007999986,-0.015576,-0.121439,0.007999985,-0.0025,-0.103441,0.007999988,0.0025,-0.098184,0.007999988,0.0025,-0.099188,0.007999988,0.025203,-0.091811,0.007999989,-0.0025,-0.100812,0.007999988,-0.0025,-0.1,0.007999988,-0.0265,-0.1,0.007999988,-0.008189,-0.074797,0.007999991,-0.0025,-0.092306,0.007999989,-0.0025,-0.0875,0.00799999,-0.015576,-0.121439,0.007999985,-0.008189,-0.125203,0.007999985,-0.0025,-0.107694,0.007999987,-0.0025,-0.096559,0.007999989,-0.015576,-0.078561,0.007999991,-0.021439,-0.084424,0.00799999,-0.0265,-0.1,0.007999988,-0.0025,-0.1,0.007999988,-0.0025,-0.099188,0.007999988,-0.0025,-0.0875,0.00799999,0,-0.0875,0.00799999,0,-0.0735,0.007999992,-0.0025,-0.092306,0.007999989,-0.008189,-0.074797,0.007999991,-0.015576,-0.078561,0.007999991,-0.0025,-0.1125,0.0008419866,0.0025,-0.1125,0.0008419866,0.0025,-0.0875,0.0008419896,0,-0.1125,0.007999987,0.0025,-0.1125,0.007999987,0.0025,-0.1125,0.0008419866,0.0025,-0.101816,0.007999988,0.021439,-0.115576,0.007999986,0.025203,-0.108189,0.007999987,-0.0025,-0.1125,0.007999987,-0.0025,-0.107694,0.007999987,-0.008189,-0.125203,0.007999985,0.0025,-0.1,0.007999988,0.0025,-0.1125,0.0008419866,0.0025,-0.100812,0.007999988,-0.0025,-0.0875,0.0008419896,-0.0025,-0.098184,0.007999988,-0.0025,-0.099188,0.007999988,0.0265,-0.1,0.007999988,0.0025,-0.1,0.007999988,0.0025,-0.100812,0.007999988,0,-0.0875,0.00799999,-0.0025,-0.0875,0.00799999,-0.0025,-0.0875,0.0008419896,0,-0.1265,0.007999985,0,-0.1125,0.007999987,-0.0025,-0.1125,0.007999987,0.0025,-0.103441,0.007999988,0.015576,-0.121439,0.007999985,0.021439,-0.115576,0.007999986,0,-0.0735,0.007999992,0,-0.0875,0.00799999,0.0025,-0.0875,0.00799999,0.021439,-0.084424,0.00799999,0.015576,-0.078561,0.007999991,0.0025,-0.096559,0.007999989,0.015576,-0.078561,0.007999991,0.008189,-0.074797,0.007999991,0.0025,-0.092306,0.007999989,0.025203,0.008188999,0.008000001,0.0265,-9.536744e-10,0.008,0.0265,0,0,0.021439,0.015576,0.008000002,0.025203,0.008188999,0.008000001,0.025203,0.008189,9.762049e-10,0.015576,0.021439,0.008000003,0.021439,0.015576,0.008000002,0.021439,0.015576,1.856804e-09,0.008189,0.025203,0.008000003,0.015576,0.021439,0.008000003,0.015576,0.021439,2.555728e-09,0,0.0265,0.008000003,0.008189,0.025203,0.008000003,0.008189,0.025203,3.004432e-09,-0.008189,0.025203,0.008000003,0,0.0265,0.008000003,0,0.0265,3.159046e-09,-0.015576,0.021439,0.008000003,-0.008189,0.025203,0.008000003,-0.008189,0.025203,3.004432e-09,-0.021439,0.015576,0.008000002,-0.015576,0.021439,0.008000003,-0.015576,0.021439,2.555728e-09,-0.025203,0.008188999,0.008000001,-0.021439,0.015576,0.008000002,-0.021439,0.015576,1.856804e-09,-0.0265,0,0,-0.0265,-9.536744e-10,0.008,-0.025203,0.008188999,0.008000001,-0.025203,-0.008189001,0.007999999,-0.0265,-9.536744e-10,0.008,-0.0265,0,0,-0.021439,-0.015576,0.007999999,-0.025203,-0.008189001,0.007999999,-0.025203,-0.008189,-9.762049e-10,-0.00809,-0.005878001,0.007999999,-0.009045,-0.002939001,0.008,-0.025203,-0.008189001,0.007999999,-0.015576,-0.021439,0.007999998,-0.021439,-0.015576,0.007999999,-0.021439,-0.015576,-1.856804e-09,-0.015576,-0.021439,0.007999998,-0.00559,-0.007694001,0.007999999,-0.00809,-0.005878001,0.007999999,-0.008189,-0.025203,0.007999998,-0.015576,-0.021439,0.007999998,-0.015576,-0.021439,-2.555728e-09,0,-0.0265,0.007999998,-0.008189,-0.025203,0.007999998,-0.008189,-0.025203,-3.004432e-09,0.008189,-0.025203,0.007999998,0,-0.0265,0.007999998,0,-0.0265,-3.159046e-09,0.015576,-0.021439,0.007999998,0.008189,-0.025203,0.007999998,0.008189,-0.025203,-3.004432e-09,0.021439,-0.015576,-1.856804e-09,0.021439,-0.015576,0.007999999,0.015576,-0.021439,0.007999998,0.00809,-0.005878001,0.007999999,0.00559,-0.007694001,0.007999999,0.015576,-0.021439,0.007999998,0.025203,-0.008189001,0.007999999,0.021439,-0.015576,0.007999999,0.021439,-0.015576,-1.856804e-09,0.025203,-0.008189001,0.007999999,0.009045,-0.002939001,0.008,0.00809,-0.005878001,0.007999999,0.0265,-9.536744e-10,0.008,0.025203,-0.008189001,0.007999999,0.025203,-0.008189,-9.762049e-10,-0.01,-5.126e-09,0.043,-0.01,-1.390709e-10,0.007999999,-0.00809,-0.005878001,0.007999999,-0.00809,-0.005878005,0.04491,-0.00809,-0.005878001,0.007999999,-0.00309,-0.009511,0.007999999,0.00309,-0.009511006,0.05609,0.00309,-0.009511,0.007999999,0.00809,-0.005878001,0.007999999,0.00809,-0.005878008,0.06109,0.00809,-0.005878001,0.007999999,0.01,-1.390709e-10,0.007999999,0.025203,0.008188999,0.008000001,0.009045,0.002938999,0.008,0.01,-1.390709e-10,0.007999999,0.00809,0.005878,0.008,0.009045,0.002938999,0.008,0.025203,0.008188999,0.008000001,0.015576,0.021439,0.008000003,0.00559,0.007693999,0.008000001,0.00809,0.005878,0.008,0.00309,0.009511,0.008,0.00559,0.007693999,0.008000001,0.015576,0.021439,0.008000003,0,0.0265,0.008000003,0,0.009510999,0.008000001,0.00309,0.009511,0.008,-0.00309,0.009511,0.008,0,0.009510999,0.008000001,0,0.0265,0.008000003,-0.015576,0.021439,0.008000003,-0.00559,0.007693999,0.008000001,-0.00309,0.009511,0.008,-0.00809,0.005878,0.008,-0.00559,0.007693999,0.008000001,-0.015576,0.021439,0.008000003,-0.025203,0.008188999,0.008000001,-0.009045,0.002938999,0.008,-0.00809,0.005878,0.008,-0.01,-1.390709e-10,0.007999999,-0.009045,0.002938999,0.008,-0.025203,0.008188999,0.008000001,-0.025203,-0.008189001,0.007999999,-0.009045,-0.002939001,0.008,-0.01,-1.390709e-10,0.007999999,-0.00309,-0.009511,0.007999999,-0.00559,-0.007694001,0.007999999,-0.015576,-0.021439,0.007999998,0,-0.0265,0.007999998,0,-0.009511,0.007999999,-0.00309,-0.009511,0.007999999,0.00309,-0.009511,0.007999999,0,-0.009511,0.007999999,0,-0.0265,0.007999998,0.015576,-0.021439,0.007999998,0.00559,-0.007694001,0.007999999,0.00309,-0.009511,0.007999999,0.01,-1.390709e-10,0.007999999,0.009045,-0.002939001,0.008,0.025203,-0.008189001,0.007999999,-0.12,-5.126e-09,0.043,-0.12,0.005877995,0.04491,-0.01,-5.126e-09,0.043,0.01,-7.510185e-09,0.063,-0.12,-7.510185e-09,0.063,0.00809,-0.005878008,0.06109,-0.00309,-0.009511005,0.04991,-0.12,-0.009511005,0.04991,-0.00809,-0.005878005,0.04491,-0.00809,-0.005878005,0.04491,-0.12,-0.005878005,0.04491,-0.01,-5.126e-09,0.043,0.00809,0.005877993,0.06109,0.00809,0.005878,0.008,0.00309,0.009510993,0.05609,0.00309,0.009510993,0.05609,0.00309,0.009511,0.008,-0.00309,0.009510994,0.04991,-0.00309,0.009510994,0.04991,-0.00809,0.005877995,0.04491,-0.12,0.009510994,0.04991,0.00309,0.009510993,0.05609,-0.00309,0.009510994,0.04991,-0.12,0.009510993,0.05609,0.00809,0.005877993,0.06109,0.00309,0.009510993,0.05609,-0.12,0.005877993,0.06109,0.01,-7.510185e-09,0.063,0.00809,0.005877993,0.06109,-0.12,-7.510185e-09,0.063,0.00809,-0.005878008,0.06109,-0.12,-0.005878008,0.06109,0.00309,-0.009511006,0.05609,0.00309,-0.009511006,0.05609,-0.12,-0.009511006,0.05609,-0.00309,-0.009511005,0.04991,0.01,-7.510185e-09,0.063,0.01,-1.390709e-10,0.007999999,0.00809,0.005877993,0.06109,-0.00309,0.009510994,0.04991,-0.00309,0.009511,0.008,-0.00809,0.005877995,0.04491,-0.00809,0.005877995,0.04491,-0.00809,0.005878,0.008,-0.01,-5.126e-09,0.043,0.00309,-0.009511006,0.05609,-0.00309,-0.009511005,0.04991,0.00309,-0.009511,0.007999999,0.0265,-0.1,-1.192093e-08,0.025203,-0.091811,-1.094472e-08,0.0265,-0.1,0.007999988,0.025203,-0.091811,0.007999989,0.0025,-0.099188,0.007999988,0.0265,-0.1,0.007999988,0.025203,-0.091811,0.007999989,0.025203,-0.091811,-1.094472e-08,0.021439,-0.084424,0.00799999,0.021439,-0.084424,-1.006412e-08,0.015576,-0.078561,-9.365201e-09,0.021439,-0.084424,0.00799999,0.015576,-0.078561,-9.365201e-09,0.008189,-0.074797,-8.916497e-09,0.015576,-0.078561,0.007999991,0,-0.0735,-8.761883e-09,0,-0.0735,0.007999992,0.008189,-0.074797,-8.916497e-09,0,-0.0735,-8.761883e-09,-0.008189,-0.074797,-8.916497e-09,0,-0.0735,0.007999992,-0.015576,-0.078561,-9.365201e-09,-0.015576,-0.078561,0.007999991,-0.008189,-0.074797,-8.916497e-09,-0.021439,-0.084424,-1.006412e-08,-0.021439,-0.084424,0.00799999,-0.015576,-0.078561,-9.365201e-09,-0.025203,-0.091811,-1.094472e-08,-0.025203,-0.091811,0.007999989,-0.021439,-0.084424,-1.006412e-08,-0.0025,-0.099188,0.007999988,-0.0025,-0.098184,0.007999988,-0.025203,-0.091811,0.007999989,-0.0265,-0.1,-1.192093e-08,-0.0265,-0.1,0.007999988,-0.025203,-0.091811,-1.094472e-08,-0.025203,-0.108189,-1.289713e-08,-0.025203,-0.108189,0.007999987,-0.0265,-0.1,-1.192093e-08,-0.021439,-0.115576,-1.377773e-08,-0.021439,-0.115576,0.007999986,-0.025203,-0.108189,-1.289713e-08,-0.021439,-0.115576,0.007999986,-0.0025,-0.101816,0.007999988,-0.025203,-0.108189,0.007999987,-0.015576,-0.121439,-1.447666e-08,-0.015576,-0.121439,0.007999985,-0.021439,-0.115576,-1.377773e-08,-0.008189,-0.125203,-1.492536e-08,-0.008189,-0.125203,0.007999985,-0.015576,-0.121439,-1.447666e-08,0,-0.1265,-1.507997e-08,0,-0.1265,0.007999985,-0.008189,-0.125203,-1.492536e-08,0.008189,-0.125203,-1.492536e-08,0.008189,-0.125203,0.007999985,0,-0.1265,-1.507997e-08,0.008189,-0.125203,0.007999985,0.0025,-0.1125,0.007999987,0,-0.1265,0.007999985,0.015576,-0.121439,-1.447666e-08,0.015576,-0.121439,0.007999985,0.008189,-0.125203,-1.492536e-08,0.0025,-0.103441,0.007999988,0.0025,-0.107694,0.007999987,0.015576,-0.121439,0.007999985,0.021439,-0.115576,-1.377773e-08,0.021439,-0.115576,0.007999986,0.015576,-0.121439,-1.447666e-08,0.025203,-0.108189,-1.289713e-08,0.025203,-0.108189,0.007999987,0.021439,-0.115576,-1.377773e-08,0.0265,-0.1,-1.192093e-08,0.0265,-0.1,0.007999988,0.025203,-0.108189,-1.289713e-08,-0.0025,-0.101816,0.007999988,-0.021439,-0.115576,0.007999986,-0.0025,-0.103441,0.007999988,0.021439,-0.084424,0.00799999,0.0025,-0.098184,0.007999988,0.025203,-0.091811,0.007999989,-0.025203,-0.108189,0.007999987,-0.0025,-0.100812,0.007999988,-0.0265,-0.1,0.007999988,-0.0025,-0.103441,0.007999988,-0.015576,-0.121439,0.007999985,-0.0025,-0.107694,0.007999987,-0.0025,-0.098184,0.007999988,-0.0025,-0.096559,0.007999989,-0.021439,-0.084424,0.00799999,-0.025203,-0.091811,0.007999989,-0.0265,-0.1,0.007999988,-0.0025,-0.099188,0.007999988,-0.008189,-0.074797,0.007999991,-0.0025,-0.0875,0.00799999,0,-0.0735,0.007999992,-0.0025,-0.096559,0.007999989,-0.0025,-0.092306,0.007999989,-0.015576,-0.078561,0.007999991,-0.0025,-0.0875,0.0008419896,-0.0025,-0.1125,0.0008419866,0.0025,-0.0875,0.0008419896,-0.0025,-0.1125,0.0008419866,-0.0025,-0.1125,0.007999987,0,-0.1125,0.007999987,0,-0.1125,0.007999987,0.0025,-0.1125,0.0008419866,-0.0025,-0.1125,0.0008419866,0.0025,-0.100812,0.007999988,0.0025,-0.101816,0.007999988,0.025203,-0.108189,0.007999987,0.0025,-0.0875,0.0008419896,0.0025,-0.096559,0.007999989,0.0025,-0.092306,0.007999989,0.0025,-0.0875,0.0008419896,0.0025,-0.1,0.007999988,0.0025,-0.098184,0.007999988,0.0025,-0.1125,0.0008419866,0.0025,-0.101816,0.007999988,0.0025,-0.100812,0.007999988,0.0025,-0.1125,0.0008419866,0.0025,-0.1125,0.007999987,0.0025,-0.107694,0.007999987,0.0025,-0.1125,0.0008419866,0.0025,-0.103441,0.007999988,0.0025,-0.101816,0.007999988,0.0025,-0.092306,0.007999989,0.0025,-0.0875,0.00799999,0.0025,-0.0875,0.0008419896,0.0025,-0.0875,0.0008419896,0.0025,-0.1125,0.0008419866,0.0025,-0.1,0.007999988,0.0025,-0.098184,0.007999988,0.0025,-0.096559,0.007999989,0.0025,-0.0875,0.0008419896,0.0025,-0.103441,0.007999988,0.0025,-0.1125,0.0008419866,0.0025,-0.107694,0.007999987,-0.0025,-0.1,0.007999988,-0.0025,-0.1125,0.0008419866,-0.0025,-0.0875,0.0008419896,-0.0025,-0.1125,0.0008419866,-0.0025,-0.103441,0.007999988,-0.0025,-0.107694,0.007999987,-0.0025,-0.107694,0.007999987,-0.0025,-0.1125,0.007999987,-0.0025,-0.1125,0.0008419866,-0.0025,-0.0875,0.0008419896,-0.0025,-0.0875,0.00799999,-0.0025,-0.092306,0.007999989,-0.0025,-0.0875,0.0008419896,-0.0025,-0.096559,0.007999989,-0.0025,-0.098184,0.007999988,-0.0025,-0.0875,0.0008419896,-0.0025,-0.099188,0.007999988,-0.0025,-0.1,0.007999988,-0.0025,-0.1125,0.0008419866,-0.0025,-0.100812,0.007999988,-0.0025,-0.101816,0.007999988,-0.0025,-0.101816,0.007999988,-0.0025,-0.103441,0.007999988,-0.0025,-0.1125,0.0008419866,-0.0025,-0.0875,0.0008419896,-0.0025,-0.092306,0.007999989,-0.0025,-0.096559,0.007999989,-0.0025,-0.1125,0.0008419866,-0.0025,-0.1,0.007999988,-0.0025,-0.100812,0.007999988,0.025203,-0.108189,0.007999987,0.0265,-0.1,0.007999988,0.0025,-0.100812,0.007999988,0.0025,-0.0875,0.0008419896,0.0025,-0.0875,0.00799999,0,-0.0875,0.00799999,0,-0.0875,0.00799999,-0.0025,-0.0875,0.0008419896,0.0025,-0.0875,0.0008419896,-0.008189,-0.125203,0.007999985,0,-0.1265,0.007999985,-0.0025,-0.1125,0.007999987,0.0025,-0.101816,0.007999988,0.0025,-0.103441,0.007999988,0.021439,-0.115576,0.007999986,0.008189,-0.074797,0.007999991,0,-0.0735,0.007999992,0.0025,-0.0875,0.00799999,0.0025,-0.098184,0.007999988,0.021439,-0.084424,0.00799999,0.0025,-0.096559,0.007999989,0.0025,-0.096559,0.007999989,0.015576,-0.078561,0.007999991,0.0025,-0.092306,0.007999989,0.025203,0.008189,9.762049e-10,0.025203,0.008188999,0.008000001,0.0265,0,0,0.021439,0.015576,1.856804e-09,0.021439,0.015576,0.008000002,0.025203,0.008189,9.762049e-10,0.015576,0.021439,2.555728e-09,0.015576,0.021439,0.008000003,0.021439,0.015576,1.856804e-09,0.008189,0.025203,3.004432e-09,0.008189,0.025203,0.008000003,0.015576,0.021439,2.555728e-09,0,0.0265,3.159046e-09,0,0.0265,0.008000003,0.008189,0.025203,3.004432e-09,-0.008189,0.025203,3.004432e-09,-0.008189,0.025203,0.008000003,0,0.0265,3.159046e-09,-0.015576,0.021439,2.555728e-09,-0.015576,0.021439,0.008000003,-0.008189,0.025203,3.004432e-09,-0.021439,0.015576,1.856804e-09,-0.021439,0.015576,0.008000002,-0.015576,0.021439,2.555728e-09,-0.025203,0.008189,9.762049e-10,-0.025203,0.008188999,0.008000001,-0.021439,0.015576,1.856804e-09,-0.025203,0.008189,9.762049e-10,-0.0265,0,0,-0.025203,0.008188999,0.008000001,-0.025203,-0.008189,-9.762049e-10,-0.025203,-0.008189001,0.007999999,-0.0265,0,0,-0.021439,-0.015576,-1.856804e-09,-0.021439,-0.015576,0.007999999,-0.025203,-0.008189,-9.762049e-10,-0.021439,-0.015576,0.007999999,-0.00809,-0.005878001,0.007999999,-0.025203,-0.008189001,0.007999999,-0.015576,-0.021439,-2.555728e-09,-0.015576,-0.021439,0.007999998,-0.021439,-0.015576,-1.856804e-09,-0.021439,-0.015576,0.007999999,-0.015576,-0.021439,0.007999998,-0.00809,-0.005878001,0.007999999,-0.008189,-0.025203,-3.004432e-09,-0.008189,-0.025203,0.007999998,-0.015576,-0.021439,-2.555728e-09,0,-0.0265,-3.159046e-09,0,-0.0265,0.007999998,-0.008189,-0.025203,-3.004432e-09,0.008189,-0.025203,-3.004432e-09,0.008189,-0.025203,0.007999998,0,-0.0265,-3.159046e-09,0.015576,-0.021439,-2.555728e-09,0.015576,-0.021439,0.007999998,0.008189,-0.025203,-3.004432e-09,0.015576,-0.021439,-2.555728e-09,0.021439,-0.015576,-1.856804e-09,0.015576,-0.021439,0.007999998,0.021439,-0.015576,0.007999999,0.00809,-0.005878001,0.007999999,0.015576,-0.021439,0.007999998,0.025203,-0.008189,-9.762049e-10,0.025203,-0.008189001,0.007999999,0.021439,-0.015576,-1.856804e-09,0.021439,-0.015576,0.007999999,0.025203,-0.008189001,0.007999999,0.00809,-0.005878001,0.007999999,0.0265,0,0,0.0265,-9.536744e-10,0.008,0.025203,-0.008189,-9.762049e-10,-0.00809,-0.005878005,0.04491,-0.01,-5.126e-09,0.043,-0.00809,-0.005878001,0.007999999,-0.00309,-0.009511005,0.04991,-0.00809,-0.005878005,0.04491,-0.00309,-0.009511,0.007999999,0.00809,-0.005878008,0.06109,0.00309,-0.009511006,0.05609,0.00809,-0.005878001,0.007999999,0.01,-7.510185e-09,0.063,0.00809,-0.005878008,0.06109,0.01,-1.390709e-10,0.007999999,0.0265,-9.536744e-10,0.008,0.025203,0.008188999,0.008000001,0.01,-1.390709e-10,0.007999999,0.021439,0.015576,0.008000002,0.00809,0.005878,0.008,0.025203,0.008188999,0.008000001,0.021439,0.015576,0.008000002,0.015576,0.021439,0.008000003,0.00809,0.005878,0.008,0.008189,0.025203,0.008000003,0.00309,0.009511,0.008,0.015576,0.021439,0.008000003,0.008189,0.025203,0.008000003,0,0.0265,0.008000003,0.00309,0.009511,0.008,-0.008189,0.025203,0.008000003,-0.00309,0.009511,0.008,0,0.0265,0.008000003,-0.008189,0.025203,0.008000003,-0.015576,0.021439,0.008000003,-0.00309,0.009511,0.008,-0.021439,0.015576,0.008000002,-0.00809,0.005878,0.008,-0.015576,0.021439,0.008000003,-0.021439,0.015576,0.008000002,-0.025203,0.008188999,0.008000001,-0.00809,0.005878,0.008,-0.0265,-9.536744e-10,0.008,-0.01,-1.390709e-10,0.007999999,-0.025203,0.008188999,0.008000001,-0.0265,-9.536744e-10,0.008,-0.025203,-0.008189001,0.007999999,-0.01,-1.390709e-10,0.007999999,-0.008189,-0.025203,0.007999998,-0.00309,-0.009511,0.007999999,-0.015576,-0.021439,0.007999998,-0.008189,-0.025203,0.007999998,0,-0.0265,0.007999998,-0.00309,-0.009511,0.007999999,0.008189,-0.025203,0.007999998,0.00309,-0.009511,0.007999999,0,-0.0265,0.007999998,0.008189,-0.025203,0.007999998,0.015576,-0.021439,0.007999998,0.00309,-0.009511,0.007999999,0.0265,-9.536744e-10,0.008,0.01,-1.390709e-10,0.007999999,0.025203,-0.008189001,0.007999999])\n for (l = hvs; l < handleVertices.length - 2; l = l + 3) {\n handleVertices[l] += cX\n handleVertices[l + 1] += aY\n handleVertices[l + 2] += iZ\n }\n } else if (a.handleType==='classic') {\n handleVertices = handleVertices.concat([-0.019075,0.060079,0.002000007,-0.02,0.06,0.002000007,-0.019047,-0.120065,0.001999986,0.016353,-0.121573,-1.449263e-08,0.016978,-0.121042,-1.442933e-08,0.016978,-0.121042,0.001999986,-0.02,-0.12,0.001999986,-0.019047,-0.120065,0.001999986,-0.02,0.06,0.002000007,0.015764,-0.122191,0.001999985,0.015764,-0.122191,-1.45663e-08,0.016353,-0.121573,-1.449263e-08,0.014929,-0.123252,-1.469278e-08,0.015764,-0.122191,-1.45663e-08,0.015764,-0.122191,0.001999985,-0.018231,0.060289,0.002000007,-0.019075,0.060079,0.002000007,0.019137,0.060079,0.002000007,0.002936,-0.134721,0.001999984,0.007464,-0.132813,0.001999984,0.008788,-0.131752,0.001999984,0.0015,-0.077781,0.001999991,0.019137,0.060079,0.002000007,-0.019075,0.060079,0.002000007,-0.018604,-0.120148,0.001999986,-0.0015,-0.097781,0.001999988,-0.0015,-0.077781,0.001999991,-0.018604,-0.120148,0.001999986,0.019149,-0.120075,0.001999986,0.0015,-0.097781,0.001999988,0.0015,-0.077781,0.001999991,0.0015,-0.097781,0.001999988,0.019149,-0.120075,0.001999986,0,-0.135,0.001999984,0.009953,-0.130562,0.001999984,-0.010391,-0.129722,0.001999985,-0.017458,0.060619,0.002000007,-0.018231,0.060289,0.002000007,0.018344,0.060288,0.002000007,0.001531,-0.134926,0.001999984,0.008788,-0.131752,0.001999984,0.009953,-0.130562,0.001999984,-0.016747,0.061058,0.002000007,-0.017458,0.060619,0.002000007,0.017614,0.060617,0.002000007,0.009953,-0.130562,0.001999984,0.014929,-0.123252,0.001999985,-0.011868,-0.127496,0.001999985,-0.016089,0.061593,0.002000008,-0.016747,0.061058,0.002000007,0.016937,0.061053,0.002000007,0.014929,-0.123252,0.001999985,0.015764,-0.122191,0.001999985,-0.014802,-0.122855,0.001999985,-0.015475,0.062214,0.002000008,-0.016089,0.061593,0.002000008,0.016304,0.061587,0.002000008,0.015764,-0.122191,0.001999985,0.016353,-0.121573,0.001999986,-0.015686,-0.121844,0.001999986,-0.014617,0.063281,0.002000008,-0.015475,0.062214,0.002000008,0.015421,0.062543,0.002000008,-0.007335,0.072848,0.002000009,-0.008209,0.072159,0.002000009,-0.004169,0.074417,0.002000009,-0.005324,0.073988,0.002000009,-0.006376,0.073461,0.002000009,-0.007335,0.072848,0.002000009,0.009953,-0.130562,-1.55642e-08,0.014929,-0.123252,-1.469278e-08,0.014929,-0.123252,0.001999985,0.016978,-0.121042,0.001999986,0.017646,-0.120607,0.001999986,-0.017021,-0.120787,0.001999986,0.016353,-0.121573,0.001999986,0.016978,-0.121042,0.001999986,-0.016327,-0.121269,0.001999986,-0.009384,0.071011,0.002000008,-0.014617,0.063281,0.002000008,0.012136,0.067516,0.002000008,0.009512,0.070979,0.002000008,0,0.075,0.002000009,-0.009384,0.071011,0.002000008,-0.008209,0.072159,0.002000009,-0.009384,0.071011,0.002000008,-0.002903,0.074736,0.002000009,-0.001517,0.074934,0.002000009,-0.002903,0.074736,0.002000009,-0.009384,0.071011,0.002000008,0.001519,0.074926,0.002000009,0,0.075,0.002000009,0.009512,0.070979,0.002000008,0.002913,0.074722,0.002000009,0.001519,0.074926,0.002000009,0.008304,0.072129,0.002000009,0.017646,-0.120607,0.001999986,0.018367,-0.120281,0.001999986,-0.017776,-0.120409,0.001999986,0.007408,0.072818,0.002000009,0.00536,0.073964,0.002000009,0.004191,0.074397,0.002000009,0.007408,0.072818,0.002000009,0.00643,0.073434,0.002000009,0.00536,0.073964,0.002000009,-0.018604,-0.120148,0.001999986,-0.017776,-0.120409,0.001999986,0.018367,-0.120281,0.001999986,0.02,0.06,0.002000007,0.019137,0.060079,0.002000007,0.019149,-0.120075,0.001999986,0.005401,-0.133961,0.001999984,0.006479,-0.13343,0.001999984,0.007464,-0.132813,0.001999984,0.008788,-0.131752,-1.570606e-08,0.009953,-0.130562,-1.55642e-08,0.009953,-0.130562,0.001999984,0.004223,-0.134395,0.001999984,0.005401,-0.133961,0.001999984,0.007464,-0.132813,0.001999984,-0.001527,-0.134934,0.001999984,0,-0.135,0.001999984,-0.009371,-0.130983,0.001999984,-0.00821,-0.132139,0.001999984,-0.004188,-0.134412,0.001999984,-0.002919,-0.134734,0.001999984,0.007464,-0.132813,-1.583254e-08,0.008788,-0.131752,-1.570606e-08,0.008788,-0.131752,0.001999984,-0.007343,-0.132832,0.001999984,-0.005342,-0.13398,0.001999984,-0.004188,-0.134412,0.001999984,0.006479,-0.13343,-1.59061e-08,0.007464,-0.132813,-1.583254e-08,0.007464,-0.132813,0.001999984,-0.007343,-0.132832,0.001999984,-0.00639,-0.13345,0.001999984,-0.005342,-0.13398,0.001999984,0.005401,-0.133961,0.001999984,0.005401,-0.133961,-1.59694e-08,0.006479,-0.13343,-1.59061e-08,0.004223,-0.134395,-1.602113e-08,0.005401,-0.133961,-1.59694e-08,0.005401,-0.133961,0.001999984,0.002936,-0.134721,-1.605999e-08,0.004223,-0.134395,-1.602113e-08,0.004223,-0.134395,0.001999984,0.001531,-0.134926,-1.608443e-08,0.002936,-0.134721,-1.605999e-08,0.002936,-0.134721,0.001999984,0,-0.135,-1.609325e-08,0.001531,-0.134926,-1.608443e-08,0.001531,-0.134926,0.001999984,-0.001527,-0.134934,-1.608539e-08,0,-0.135,-1.609325e-08,0,-0.135,0.001999984,-0.002919,-0.134734,-1.606154e-08,-0.001527,-0.134934,-1.608539e-08,-0.001527,-0.134934,0.001999984,-0.004188,-0.134412,-1.602316e-08,-0.002919,-0.134734,-1.606154e-08,-0.002919,-0.134734,0.001999984,-0.005342,-0.13398,-1.597166e-08,-0.004188,-0.134412,-1.602316e-08,-0.004188,-0.134412,0.001999984,-0.00639,-0.13345,-1.590848e-08,-0.005342,-0.13398,-1.597166e-08,-0.005342,-0.13398,0.001999984,-0.007343,-0.132832,-1.583481e-08,-0.00639,-0.13345,-1.590848e-08,-0.00639,-0.13345,0.001999984,-0.00821,-0.132139,-1.57522e-08,-0.007343,-0.132832,-1.583481e-08,-0.007343,-0.132832,0.001999984,-0.009371,-0.130983,-1.561439e-08,-0.00821,-0.132139,-1.57522e-08,-0.00821,-0.132139,0.001999984,-0.010391,-0.129722,-1.546407e-08,-0.009371,-0.130983,-1.561439e-08,-0.009371,-0.130983,0.001999984,-0.011868,-0.127496,-1.519871e-08,-0.010391,-0.129722,-1.546407e-08,-0.010391,-0.129722,0.001999985,-0.014802,-0.122855,-1.464546e-08,-0.011868,-0.127496,-1.519871e-08,-0.011868,-0.127496,0.001999985,-0.015686,-0.121844,-1.452494e-08,-0.014802,-0.122855,-1.464546e-08,-0.014802,-0.122855,0.001999985,-0.016327,-0.121269,-1.445639e-08,-0.015686,-0.121844,-1.452494e-08,-0.015686,-0.121844,0.001999986,-0.017021,-0.120787,-1.439893e-08,-0.016327,-0.121269,-1.445639e-08,-0.016327,-0.121269,0.001999986,-0.017776,-0.120409,-1.435387e-08,-0.017021,-0.120787,-1.439893e-08,-0.017021,-0.120787,0.001999986,-0.018604,-0.120148,-1.432276e-08,-0.017776,-0.120409,-1.435387e-08,-0.017776,-0.120409,0.001999986,-0.018604,-0.120148,-1.432276e-08,-0.018604,-0.120148,0.001999986,-0.019047,-0.120065,0.001999986,-0.02,-0.12,-1.430511e-08,-0.019047,-0.120065,-1.431286e-08,-0.019047,-0.120065,0.001999986,-0.02,0.06,7.152557e-09,-0.02,-0.12,-1.430511e-08,-0.02,-0.12,0.001999986,-0.019075,0.060079,7.161975e-09,-0.02,0.06,7.152557e-09,-0.02,0.06,0.002000007,-0.018231,0.060289,7.187009e-09,-0.019075,0.060079,7.161975e-09,-0.019075,0.060079,0.002000007,-0.017458,0.060619,7.226348e-09,-0.018231,0.060289,7.187009e-09,-0.018231,0.060289,0.002000007,-0.016747,0.061058,7.278681e-09,-0.017458,0.060619,7.226348e-09,-0.017458,0.060619,0.002000007,-0.016089,0.061593,7.342458e-09,-0.016747,0.061058,7.278681e-09,-0.016747,0.061058,0.002000007,-0.015475,0.062214,7.416487e-09,-0.016089,0.061593,7.342458e-09,-0.016089,0.061593,0.002000008,-0.014617,0.063281,7.543683e-09,-0.015475,0.062214,7.416487e-09,-0.015475,0.062214,0.002000008,-0.009384,0.071011,8.465171e-09,-0.014617,0.063281,7.543683e-09,-0.014617,0.063281,0.002000008,-0.008209,0.072159,8.602023e-09,-0.009384,0.071011,8.465171e-09,-0.009384,0.071011,0.002000008,-0.007335,0.072848,8.684158e-09,-0.008209,0.072159,8.602023e-09,-0.008209,0.072159,0.002000009,-0.006376,0.073461,8.757234e-09,-0.007335,0.072848,8.684158e-09,-0.007335,0.072848,0.002000009,-0.005324,0.073988,8.820057e-09,-0.006376,0.073461,8.757234e-09,-0.006376,0.073461,0.002000009,-0.004169,0.074417,8.871198e-09,-0.005324,0.073988,8.820057e-09,-0.005324,0.073988,0.002000009,-0.002903,0.074736,8.909225e-09,-0.004169,0.074417,8.871198e-09,-0.004169,0.074417,0.002000009,-0.001517,0.074934,8.932829e-09,-0.002903,0.074736,8.909225e-09,-0.002903,0.074736,0.002000009,0,0.075,8.940697e-09,-0.001517,0.074934,8.932829e-09,-0.001517,0.074934,0.002000009,0.001519,0.074926,8.931875e-09,0,0.075,8.940697e-09,0,0.075,0.002000009,0.002913,0.074722,8.907556e-09,0.001519,0.074926,8.931875e-09,0.001519,0.074926,0.002000009,0.004191,0.074397,8.868813e-09,0.002913,0.074722,8.907556e-09,0.002913,0.074722,0.002000009,0.00536,0.073964,8.817196e-09,0.004191,0.074397,8.868813e-09,0.004191,0.074397,0.002000009,0.00643,0.073434,8.754015e-09,0.00536,0.073964,8.817196e-09,0.00536,0.073964,0.002000009,0.007408,0.072818,0.002000009,0.007408,0.072818,8.680582e-09,0.00643,0.073434,8.754015e-09,0.008304,0.072129,8.598447e-09,0.007408,0.072818,8.680582e-09,0.007408,0.072818,0.002000009,0.009512,0.070979,0.002000008,0.009512,0.070979,8.461356e-09,0.008304,0.072129,8.598447e-09,0.010582,0.069727,8.312107e-09,0.009512,0.070979,8.461356e-09,0.009512,0.070979,0.002000008,0.012136,0.067516,8.048534e-09,0.010582,0.069727,8.312107e-09,0.010582,0.069727,0.002000008,0.015421,0.062543,0.002000008,0.015421,0.062543,7.455706e-09,0.012136,0.067516,8.048534e-09,0.016304,0.061587,7.341742e-09,0.015421,0.062543,7.455706e-09,0.015421,0.062543,0.002000008,0.016937,0.061053,0.002000007,0.016937,0.061053,7.278085e-09,0.016304,0.061587,7.341742e-09,0.017614,0.060617,7.226109e-09,0.016937,0.061053,7.278085e-09,0.016937,0.061053,0.002000007,0.018344,0.060288,7.18689e-09,0.017614,0.060617,7.226109e-09,0.017614,0.060617,0.002000007,0.019137,0.060079,7.161975e-09,0.018344,0.060288,7.18689e-09,0.018344,0.060288,0.002000007,0.02,0.06,7.152557e-09,0.019137,0.060079,7.161975e-09,0.019137,0.060079,0.002000007,0.02,-0.12,-1.430511e-08,0.02,0.06,7.152557e-09,0.02,0.06,0.002000007,0.019149,-0.120075,-1.431406e-08,0.02,-0.12,-1.430511e-08,0.02,-0.12,0.001999986,0.018367,-0.120281,0.001999986,0.018367,-0.120281,-1.433861e-08,0.019149,-0.120075,-1.431406e-08,0.017646,-0.120607,-1.437748e-08,0.018367,-0.120281,-1.433861e-08,0.018367,-0.120281,0.001999986,0.016978,-0.121042,-1.442933e-08,0.017646,-0.120607,-1.437748e-08,0.017646,-0.120607,0.001999986,0.0015,-0.097781,0.001999988,0.0015,-0.077781,0.001999991,0.0015,-0.077781,0.0002859907,-0.0015,-0.097781,0.0002859883,0.0015,-0.097781,0.0002859883,0.0015,-0.077781,0.0002859907,-0.0015,-0.077781,0.001999991,-0.0015,-0.097781,0.001999988,-0.0015,-0.097781,0.0002859883,0.0015,-0.077781,0.001999991,-0.0015,-0.077781,0.001999991,-0.0015,-0.077781,0.0002859907,-0.0015,-0.097781,0.001999988,0.0015,-0.097781,0.001999988,0.0015,-0.097781,0.0002859883,-0.117827,0.01488799,0.05,-0.13022,0.01067999,0.05,-0.12806,0.006308994,0.05,-0.099274,0.01439299,0.05,-0.099431,0.01943799,0.05,-0.117827,0.01488799,0.05,-0.014557,0.006875994,0.05,-0.013731,0.006550996,0.03,-0.025779,0.01158599,0.05,-0.117827,0.014888,0.03,-0.13022,0.01068,0.03,-0.13022,0.01067999,0.05,-0.084271,0.016682,0.05,-0.083361,0.02189199,0.05,-0.099431,0.01943799,0.05,-0.004666,0.011094,0.03,-0.010367,0.007194996,0.03,-0.006544,0.01007999,0.05,-0.07202,0.022593,0.05,-0.083361,0.02189199,0.05,-0.084271,0.016682,0.05,-0.001836,-0.011942,0.03,0.003453,-0.011674,0.03,0.002058,-0.01196301,0.05,-0.041427,0.017156,0.03,-0.036433,0.009406996,0.03,-0.046802,0.013694,0.03,-0.028133,0.004891996,0.03,-0.019128,-0.001211004,0.03,-0.025827,0.003515994,0.05,-0.025779,0.011586,0.03,-0.028133,0.004891996,0.03,-0.036433,0.009406996,0.03,-0.116398,0.01016199,0.05,-0.099274,0.01439299,0.05,-0.117827,0.01488799,0.05,-0.002725,-0.01174801,0.05,-0.006544,0.01007999,0.05,-0.008287,-0.009412006,0.05,-0.061504,0.017023,0.05,-0.063789,0.02212399,0.05,-0.07202,0.022593,0.05,-0.05451,0.020603,0.03,-0.066857,0.022477,0.03,-0.063789,0.02212399,0.05,-0.061504,0.017023,0.05,-0.05451,0.02060299,0.05,-0.063789,0.02212399,0.05,-0.099274,0.01439299,0.05,-0.099274,0.014393,0.03,-0.084271,0.016682,0.05,-0.041427,0.01715599,0.05,-0.05451,0.02060299,0.05,-0.048108,0.01411699,0.05,0.00138,0.012095,0.03,-0.004666,0.011094,0.03,-0.001142,0.01205599,0.05,-0.061504,0.017023,0.05,-0.048108,0.01411699,0.05,-0.05451,0.02060299,0.05,-0.084271,0.016682,0.03,-0.071009,0.017476,0.03,-0.071009,0.01747599,0.05,-0.025779,0.011586,0.03,-0.013731,0.006550996,0.03,-0.028133,0.004891996,0.03,-0.025779,0.01158599,0.05,-0.041427,0.01715599,0.05,-0.036433,0.009406994,0.05,0.008867,0.008342994,0.05,0.008705,0.008682996,0.03,0.004144,0.01134299,0.05,-0.048108,0.01411699,0.05,-0.036433,0.009406994,0.05,-0.041427,0.01715599,0.05,0.002058,-0.01196301,0.05,0.011654,-0.003769006,0.05,-0.002725,-0.01174801,0.05,-0.014557,0.006875994,0.05,-0.025779,0.01158599,0.05,-0.025827,0.003515994,0.05,-0.061504,0.017023,0.05,-0.060622,0.016912,0.03,-0.048108,0.01411699,0.05,-0.041427,0.017156,0.03,-0.025779,0.011586,0.03,-0.036433,0.009406996,0.03,-0.05451,0.020603,0.03,-0.060622,0.016912,0.03,-0.066857,0.022477,0.03,-0.010367,0.007194996,0.03,-0.013731,0.006550996,0.03,-0.011039,0.006736994,0.05,-0.025827,0.003515994,0.05,-0.011039,0.006736994,0.05,-0.014557,0.006875994,0.05,-0.099431,0.01943799,0.05,-0.099431,0.019438,0.03,-0.117827,0.01488799,0.05,-0.084271,0.016682,0.05,-0.084271,0.016682,0.03,-0.071009,0.01747599,0.05,-0.041427,0.01715599,0.05,-0.041427,0.017156,0.03,-0.05451,0.02060299,0.05,-0.05451,0.02060299,0.05,-0.05451,0.020603,0.03,-0.063789,0.02212399,0.05,0.011705,0.003085994,0.05,0.004144,0.01134299,0.05,0.011654,-0.003769006,0.05,-0.036433,0.009406994,0.05,-0.036433,0.009406996,0.03,-0.025827,0.003515994,0.05,-0.008287,-0.009412006,0.05,-0.006544,0.01007999,0.05,-0.011039,0.006736994,0.05,0.008705,0.008682996,0.03,0.00138,0.012095,0.03,0.004144,0.01134299,0.05,-0.011039,0.006736994,0.05,-0.013731,0.006550996,0.03,-0.014557,0.006875994,0.05,-0.013731,0.006550996,0.03,-0.019128,-0.001211004,0.03,-0.028133,0.004891996,0.03,0.004144,0.01134299,0.05,0.00138,0.012095,0.03,-0.001142,0.01205599,0.05,-0.099274,0.01439299,0.05,-0.084271,0.016682,0.05,-0.099431,0.01943799,0.05,-0.025827,0.003515994,0.05,-0.025779,0.01158599,0.05,-0.036433,0.009406994,0.05,-0.081659,0.022124,0.03,-0.099431,0.019438,0.03,-0.099431,0.01943799,0.05,-0.002725,-0.01174801,0.05,0.011654,-0.003769006,0.05,-0.006544,0.01007999,0.05,-0.099274,0.014393,0.03,-0.084271,0.016682,0.03,-0.084271,0.016682,0.05,-0.13022,0.01068,0.03,-0.12806,0.006308996,0.03,-0.12806,0.006308994,0.05,-0.013731,0.006550996,0.03,-0.025779,0.011586,0.03,-0.025779,0.01158599,0.05,-0.081659,0.022124,0.03,-0.084271,0.016682,0.03,-0.099431,0.019438,0.03,-0.025827,0.003515994,0.05,-0.008287,-0.009412006,0.05,-0.011039,0.006736994,0.05,-0.019128,-0.001211004,0.03,-0.007621,-0.009812004,0.03,-0.008287,-0.009412006,0.05,-0.025827,0.003515994,0.05,-0.019128,-0.001211004,0.03,-0.008287,-0.009412006,0.05,-0.071009,0.01747599,0.05,-0.07202,0.022593,0.05,-0.084271,0.016682,0.05,-0.063789,0.02212399,0.05,-0.066857,0.022477,0.03,-0.07202,0.022593,0.05,-0.07202,0.022593,0.05,-0.081659,0.022124,0.03,-0.083361,0.02189199,0.05,0.004144,0.01134299,0.05,-0.001142,0.01205599,0.05,0.011654,-0.003769006,0.05,-0.116398,0.010162,0.03,-0.099274,0.014393,0.03,-0.099274,0.01439299,0.05,-0.116398,0.01016199,0.05,-0.117827,0.01488799,0.05,-0.12806,0.006308994,0.05,-0.002725,-0.01174801,0.05,-0.001836,-0.011942,0.03,0.002058,-0.01196301,0.05,0.008867,0.008342994,0.05,0.004144,0.01134299,0.05,0.011705,0.003085994,0.05,-0.071009,0.01747599,0.05,-0.061504,0.017023,0.05,-0.07202,0.022593,0.05,-0.048108,0.01411699,0.05,-0.046802,0.013694,0.03,-0.036433,0.009406994,0.05,-0.025779,0.01158599,0.05,-0.025779,0.011586,0.03,-0.041427,0.01715599,0.05,-0.099431,0.019438,0.03,-0.117827,0.014888,0.03,-0.117827,0.01488799,0.05,-0.066857,0.022477,0.03,-0.081659,0.022124,0.03,-0.07202,0.022593,0.05,-0.099431,0.019438,0.03,-0.099274,0.014393,0.03,-0.117827,0.014888,0.03,-0.117827,0.01488799,0.05,-0.117827,0.014888,0.03,-0.13022,0.01067999,0.05,-0.116398,0.01016199,0.05,-0.116398,0.010162,0.03,-0.099274,0.01439299,0.05,-0.041427,0.017156,0.03,-0.05451,0.020603,0.03,-0.05451,0.02060299,0.05,-0.006544,0.01007999,0.05,-0.010367,0.007194996,0.03,-0.011039,0.006736994,0.05,-0.025779,0.011586,0.03,-0.041427,0.017156,0.03,-0.041427,0.01715599,0.05,-0.12806,0.006308996,0.03,-0.116398,0.010162,0.03,-0.116398,0.01016199,0.05,-0.13022,0.01067999,0.05,-0.13022,0.01068,0.03,-0.12806,0.006308994,0.05,-0.007621,-0.009812004,0.03,-0.019128,-0.001211004,0.03,-0.013731,0.006550996,0.03,-0.05451,0.020603,0.03,-0.046802,0.013694,0.03,-0.060622,0.016912,0.03,0.002058,-0.01196301,0.05,0.003453,-0.011674,0.03,0.007522,-0.009724005,0.05,-0.046802,0.013694,0.03,-0.036433,0.009406996,0.03,-0.036433,0.009406994,0.05,0.012011,0.001776996,0.03,0.008705,0.008682996,0.03,0.011705,0.003085994,0.05,-0.060622,0.016912,0.03,-0.046802,0.013694,0.03,-0.048108,0.01411699,0.05,-0.071009,0.017476,0.03,-0.060622,0.016912,0.03,-0.061504,0.017023,0.05,-0.001142,0.01205599,0.05,-0.006544,0.01007999,0.05,0.011654,-0.003769006,0.05,0.011654,-0.003769006,0.05,0.012011,0.001776996,0.03,0.011705,0.003085994,0.05,-0.008287,-0.009412006,0.05,-0.007621,-0.009812004,0.03,-0.002725,-0.01174801,0.05,-0.071009,0.01747599,0.05,-0.071009,0.017476,0.03,-0.061504,0.017023,0.05,-0.001142,0.01205599,0.05,-0.004666,0.011094,0.03,-0.006544,0.01007999,0.05,-0.05451,0.020603,0.03,-0.041427,0.017156,0.03,-0.046802,0.013694,0.03,0.011131,-0.005043004,0.03,0.012011,0.001776996,0.03,0.011654,-0.003769006,0.05,0.007522,-0.009724005,0.05,0.011654,-0.003769006,0.05,0.002058,-0.01196301,0.05,0.003453,-0.011674,0.03,0.007132,-0.009824004,0.03,0.007522,-0.009724005,0.05,-0.116398,0.010162,0.03,-0.12806,0.006308996,0.03,-0.117827,0.014888,0.03,-0.099274,0.014393,0.03,-0.116398,0.010162,0.03,-0.117827,0.014888,0.03,-0.12806,0.006308996,0.03,-0.13022,0.01068,0.03,-0.117827,0.014888,0.03,-0.084271,0.016682,0.03,-0.099274,0.014393,0.03,-0.099431,0.019438,0.03,-0.081659,0.022124,0.03,-0.071009,0.017476,0.03,-0.084271,0.016682,0.03,-0.083361,0.02189199,0.05,-0.081659,0.022124,0.03,-0.099431,0.01943799,0.05,-0.060622,0.016912,0.03,-0.071009,0.017476,0.03,-0.066857,0.022477,0.03,0.011705,0.003085994,0.05,0.008705,0.008682996,0.03,0.008867,0.008342994,0.05,0.007132,-0.009824004,0.03,0.011131,-0.005043004,0.03,0.007522,-0.009724005,0.05,-0.081659,0.022124,0.03,-0.066857,0.022477,0.03,-0.071009,0.017476,0.03,-0.036433,0.009406996,0.03,-0.028133,0.004891996,0.03,-0.025827,0.003515994,0.05,-0.12806,0.006308994,0.05,-0.12806,0.006308996,0.03,-0.116398,0.01016199,0.05,-0.007621,-0.009812004,0.03,-0.001836,-0.011942,0.03,-0.002725,-0.01174801,0.05,0.007522,-0.009724005,0.05,0.011131,-0.005043004,0.03,0.011654,-0.003769006,0.05,0.008705,0.008682996,0.03,0.006472,0.004701996,0.03,0.002472,0.007607996,0.03,0.00138,0.012095,0.03,0.002472,0.007607996,0.03,-0.002472,0.007607996,0.03,0.012011,0.001776996,0.03,0.008,-3.576279e-09,0.03,0.006472,0.004701996,0.03,0.011131,-0.005043004,0.03,0.006472,-0.004702004,0.03,0.008,-3.576279e-09,0.03,0.007132,-0.009824004,0.03,0.002472,-0.007608004,0.03,0.006472,-0.004702004,0.03,-0.002472,-0.007608004,0.03,-0.001836,-0.011942,0.03,-0.007621,-0.009812004,0.03,-0.007621,-0.009812004,0.03,-0.013731,0.006550996,0.03,-0.008,-3.576279e-09,0.03,-0.010367,0.007194996,0.03,-0.006472,0.004701996,0.03,-0.008,-3.576279e-09,0.03,-0.004666,0.011094,0.03,-0.002472,0.007607996,0.03,-0.006472,0.004701996,0.03,-0.006472,0.004701996,0.03,-0.002472,0.007607996,0.03,-0.002472,0.007608,0.002000001,0.006472,0.004701996,0.03,0.008,-3.576279e-09,0.03,0.008,-2.384186e-10,0.002,0.006472,-0.004702004,0.03,0.002472,-0.007608004,0.03,0.002472,-0.007608001,0.001999999,-0.008,-2.384186e-10,0.002,-0.008,-3.576279e-09,0.03,-0.006472,0.004701996,0.03,0.002472,0.007607996,0.03,0.006472,0.004701996,0.03,0.006472,0.004701999,0.002000001,0.002472,-0.007608004,0.03,-0.002472,-0.007608004,0.03,-0.002472,-0.007608001,0.001999999,-0.006472,-0.004702,0.002,-0.006472,-0.004702004,0.03,-0.008,-3.576279e-09,0.03,-0.002472,0.007607996,0.03,0.002472,0.007607996,0.03,0.002472,0.007608,0.002000001,0.008,-3.576279e-09,0.03,0.006472,-0.004702004,0.03,0.006472,-0.004702,0.002,-0.002472,-0.007608004,0.03,-0.006472,-0.004702004,0.03,-0.006472,-0.004702,0.002,0.002472,-0.007608004,0.03,0.003453,-0.011674,0.03,-0.001836,-0.011942,0.03,-0.018604,-0.120148,0.001999986,-0.019075,0.060079,0.002000007,-0.019047,-0.120065,0.001999986,0.016353,-0.121573,0.001999986,0.016353,-0.121573,-1.449263e-08,0.016978,-0.121042,0.001999986,0.016353,-0.121573,0.001999986,0.015764,-0.122191,0.001999985,0.016353,-0.121573,-1.449263e-08,0.014929,-0.123252,0.001999985,0.014929,-0.123252,-1.469278e-08,0.015764,-0.122191,0.001999985,0.018344,0.060288,0.002000007,-0.018231,0.060289,0.002000007,0.019137,0.060079,0.002000007,0.001531,-0.134926,0.001999984,0.002936,-0.134721,0.001999984,0.008788,-0.131752,0.001999984,-0.0015,-0.077781,0.001999991,0.0015,-0.077781,0.001999991,-0.019075,0.060079,0.002000007,-0.019075,0.060079,0.002000007,-0.018604,-0.120148,0.001999986,-0.0015,-0.077781,0.001999991,-0.0015,-0.097781,0.001999988,-0.018604,-0.120148,0.001999986,0.0015,-0.097781,0.001999988,0.019137,0.060079,0.002000007,0.0015,-0.077781,0.001999991,0.019149,-0.120075,0.001999986,-0.009371,-0.130983,0.001999984,0,-0.135,0.001999984,-0.010391,-0.129722,0.001999985,0.017614,0.060617,0.002000007,-0.017458,0.060619,0.002000007,0.018344,0.060288,0.002000007,0,-0.135,0.001999984,0.001531,-0.134926,0.001999984,0.009953,-0.130562,0.001999984,0.016937,0.061053,0.002000007,-0.016747,0.061058,0.002000007,0.017614,0.060617,0.002000007,-0.010391,-0.129722,0.001999985,0.009953,-0.130562,0.001999984,-0.011868,-0.127496,0.001999985,0.016304,0.061587,0.002000008,-0.016089,0.061593,0.002000008,0.016937,0.061053,0.002000007,-0.011868,-0.127496,0.001999985,0.014929,-0.123252,0.001999985,-0.014802,-0.122855,0.001999985,0.015421,0.062543,0.002000008,-0.015475,0.062214,0.002000008,0.016304,0.061587,0.002000008,-0.014802,-0.122855,0.001999985,0.015764,-0.122191,0.001999985,-0.015686,-0.121844,0.001999986,0.012136,0.067516,0.002000008,-0.014617,0.063281,0.002000008,0.015421,0.062543,0.002000008,-0.005324,0.073988,0.002000009,-0.007335,0.072848,0.002000009,-0.004169,0.074417,0.002000009,0.009953,-0.130562,0.001999984,0.009953,-0.130562,-1.55642e-08,0.014929,-0.123252,0.001999985,-0.016327,-0.121269,0.001999986,0.016978,-0.121042,0.001999986,-0.017021,-0.120787,0.001999986,-0.015686,-0.121844,0.001999986,0.016353,-0.121573,0.001999986,-0.016327,-0.121269,0.001999986,0.010582,0.069727,0.002000008,-0.009384,0.071011,0.002000008,0.012136,0.067516,0.002000008,0.010582,0.069727,0.002000008,0.009512,0.070979,0.002000008,-0.009384,0.071011,0.002000008,-0.004169,0.074417,0.002000009,-0.008209,0.072159,0.002000009,-0.002903,0.074736,0.002000009,0,0.075,0.002000009,-0.001517,0.074934,0.002000009,-0.009384,0.071011,0.002000008,0.008304,0.072129,0.002000009,0.001519,0.074926,0.002000009,0.009512,0.070979,0.002000008,0.004191,0.074397,0.002000009,0.002913,0.074722,0.002000009,0.008304,0.072129,0.002000009,-0.017021,-0.120787,0.001999986,0.017646,-0.120607,0.001999986,-0.017776,-0.120409,0.001999986,0.008304,0.072129,0.002000009,0.007408,0.072818,0.002000009,0.004191,0.074397,0.002000009,0.019149,-0.120075,0.001999986,-0.018604,-0.120148,0.001999986,0.018367,-0.120281,0.001999986,0.02,-0.12,0.001999986,0.02,0.06,0.002000007,0.019149,-0.120075,0.001999986,0.008788,-0.131752,0.001999984,0.008788,-0.131752,-1.570606e-08,0.009953,-0.130562,0.001999984,0.002936,-0.134721,0.001999984,0.004223,-0.134395,0.001999984,0.007464,-0.132813,0.001999984,-0.002919,-0.134734,0.001999984,-0.001527,-0.134934,0.001999984,-0.009371,-0.130983,0.001999984,-0.009371,-0.130983,0.001999984,-0.00821,-0.132139,0.001999984,-0.002919,-0.134734,0.001999984,0.007464,-0.132813,0.001999984,0.007464,-0.132813,-1.583254e-08,0.008788,-0.131752,0.001999984,-0.00821,-0.132139,0.001999984,-0.007343,-0.132832,0.001999984,-0.004188,-0.134412,0.001999984,0.006479,-0.13343,0.001999984,0.006479,-0.13343,-1.59061e-08,0.007464,-0.132813,0.001999984,0.006479,-0.13343,0.001999984,0.005401,-0.133961,0.001999984,0.006479,-0.13343,-1.59061e-08,0.004223,-0.134395,0.001999984,0.004223,-0.134395,-1.602113e-08,0.005401,-0.133961,0.001999984,0.002936,-0.134721,0.001999984,0.002936,-0.134721,-1.605999e-08,0.004223,-0.134395,0.001999984,0.001531,-0.134926,0.001999984,0.001531,-0.134926,-1.608443e-08,0.002936,-0.134721,0.001999984,0,-0.135,0.001999984,0,-0.135,-1.609325e-08,0.001531,-0.134926,0.001999984,-0.001527,-0.134934,0.001999984,-0.001527,-0.134934,-1.608539e-08,0,-0.135,0.001999984,-0.002919,-0.134734,0.001999984,-0.002919,-0.134734,-1.606154e-08,-0.001527,-0.134934,0.001999984,-0.004188,-0.134412,0.001999984,-0.004188,-0.134412,-1.602316e-08,-0.002919,-0.134734,0.001999984,-0.005342,-0.13398,0.001999984,-0.005342,-0.13398,-1.597166e-08,-0.004188,-0.134412,0.001999984,-0.00639,-0.13345,0.001999984,-0.00639,-0.13345,-1.590848e-08,-0.005342,-0.13398,0.001999984,-0.007343,-0.132832,0.001999984,-0.007343,-0.132832,-1.583481e-08,-0.00639,-0.13345,0.001999984,-0.00821,-0.132139,0.001999984,-0.00821,-0.132139,-1.57522e-08,-0.007343,-0.132832,0.001999984,-0.009371,-0.130983,0.001999984,-0.009371,-0.130983,-1.561439e-08,-0.00821,-0.132139,0.001999984,-0.010391,-0.129722,0.001999985,-0.010391,-0.129722,-1.546407e-08,-0.009371,-0.130983,0.001999984,-0.011868,-0.127496,0.001999985,-0.011868,-0.127496,-1.519871e-08,-0.010391,-0.129722,0.001999985,-0.014802,-0.122855,0.001999985,-0.014802,-0.122855,-1.464546e-08,-0.011868,-0.127496,0.001999985,-0.015686,-0.121844,0.001999986,-0.015686,-0.121844,-1.452494e-08,-0.014802,-0.122855,0.001999985,-0.016327,-0.121269,0.001999986,-0.016327,-0.121269,-1.445639e-08,-0.015686,-0.121844,0.001999986,-0.017021,-0.120787,0.001999986,-0.017021,-0.120787,-1.439893e-08,-0.016327,-0.121269,0.001999986,-0.017776,-0.120409,0.001999986,-0.017776,-0.120409,-1.435387e-08,-0.017021,-0.120787,0.001999986,-0.018604,-0.120148,0.001999986,-0.018604,-0.120148,-1.432276e-08,-0.017776,-0.120409,0.001999986,-0.019047,-0.120065,-1.431286e-08,-0.018604,-0.120148,-1.432276e-08,-0.019047,-0.120065,0.001999986,-0.02,-0.12,0.001999986,-0.02,-0.12,-1.430511e-08,-0.019047,-0.120065,0.001999986,-0.02,0.06,0.002000007,-0.02,0.06,7.152557e-09,-0.02,-0.12,0.001999986,-0.019075,0.060079,0.002000007,-0.019075,0.060079,7.161975e-09,-0.02,0.06,0.002000007,-0.018231,0.060289,0.002000007,-0.018231,0.060289,7.187009e-09,-0.019075,0.060079,0.002000007,-0.017458,0.060619,0.002000007,-0.017458,0.060619,7.226348e-09,-0.018231,0.060289,0.002000007,-0.016747,0.061058,0.002000007,-0.016747,0.061058,7.278681e-09,-0.017458,0.060619,0.002000007,-0.016089,0.061593,0.002000008,-0.016089,0.061593,7.342458e-09,-0.016747,0.061058,0.002000007,-0.015475,0.062214,0.002000008,-0.015475,0.062214,7.416487e-09,-0.016089,0.061593,0.002000008,-0.014617,0.063281,0.002000008,-0.014617,0.063281,7.543683e-09,-0.015475,0.062214,0.002000008,-0.009384,0.071011,0.002000008,-0.009384,0.071011,8.465171e-09,-0.014617,0.063281,0.002000008,-0.008209,0.072159,0.002000009,-0.008209,0.072159,8.602023e-09,-0.009384,0.071011,0.002000008,-0.007335,0.072848,0.002000009,-0.007335,0.072848,8.684158e-09,-0.008209,0.072159,0.002000009,-0.006376,0.073461,0.002000009,-0.006376,0.073461,8.757234e-09,-0.007335,0.072848,0.002000009,-0.005324,0.073988,0.002000009,-0.005324,0.073988,8.820057e-09,-0.006376,0.073461,0.002000009,-0.004169,0.074417,0.002000009,-0.004169,0.074417,8.871198e-09,-0.005324,0.073988,0.002000009,-0.002903,0.074736,0.002000009,-0.002903,0.074736,8.909225e-09,-0.004169,0.074417,0.002000009,-0.001517,0.074934,0.002000009,-0.001517,0.074934,8.932829e-09,-0.002903,0.074736,0.002000009,0,0.075,0.002000009,0,0.075,8.940697e-09,-0.001517,0.074934,0.002000009,0.001519,0.074926,0.002000009,0.001519,0.074926,8.931875e-09,0,0.075,0.002000009,0.002913,0.074722,0.002000009,0.002913,0.074722,8.907556e-09,0.001519,0.074926,0.002000009,0.004191,0.074397,0.002000009,0.004191,0.074397,8.868813e-09,0.002913,0.074722,0.002000009,0.00536,0.073964,0.002000009,0.00536,0.073964,8.817196e-09,0.004191,0.074397,0.002000009,0.00643,0.073434,0.002000009,0.00643,0.073434,8.754015e-09,0.00536,0.073964,0.002000009,0.00643,0.073434,0.002000009,0.007408,0.072818,0.002000009,0.00643,0.073434,8.754015e-09,0.008304,0.072129,0.002000009,0.008304,0.072129,8.598447e-09,0.007408,0.072818,0.002000009,0.008304,0.072129,0.002000009,0.009512,0.070979,0.002000008,0.008304,0.072129,8.598447e-09,0.010582,0.069727,0.002000008,0.010582,0.069727,8.312107e-09,0.009512,0.070979,0.002000008,0.012136,0.067516,0.002000008,0.012136,0.067516,8.048534e-09,0.010582,0.069727,0.002000008,0.012136,0.067516,0.002000008,0.015421,0.062543,0.002000008,0.012136,0.067516,8.048534e-09,0.016304,0.061587,0.002000008,0.016304,0.061587,7.341742e-09,0.015421,0.062543,0.002000008,0.016304,0.061587,0.002000008,0.016937,0.061053,0.002000007,0.016304,0.061587,7.341742e-09,0.017614,0.060617,0.002000007,0.017614,0.060617,7.226109e-09,0.016937,0.061053,0.002000007,0.018344,0.060288,0.002000007,0.018344,0.060288,7.18689e-09,0.017614,0.060617,0.002000007,0.019137,0.060079,0.002000007,0.019137,0.060079,7.161975e-09,0.018344,0.060288,0.002000007,0.02,0.06,0.002000007,0.02,0.06,7.152557e-09,0.019137,0.060079,0.002000007,0.02,-0.12,0.001999986,0.02,-0.12,-1.430511e-08,0.02,0.06,0.002000007,0.019149,-0.120075,0.001999986,0.019149,-0.120075,-1.431406e-08,0.02,-0.12,0.001999986,0.019149,-0.120075,0.001999986,0.018367,-0.120281,0.001999986,0.019149,-0.120075,-1.431406e-08,0.017646,-0.120607,0.001999986,0.017646,-0.120607,-1.437748e-08,0.018367,-0.120281,0.001999986,0.016978,-0.121042,0.001999986,0.016978,-0.121042,-1.442933e-08,0.017646,-0.120607,0.001999986,0.0015,-0.097781,0.0002859883,0.0015,-0.097781,0.001999988,0.0015,-0.077781,0.0002859907,-0.0015,-0.077781,0.0002859907,-0.0015,-0.097781,0.0002859883,0.0015,-0.077781,0.0002859907,-0.0015,-0.077781,0.0002859907,-0.0015,-0.077781,0.001999991,-0.0015,-0.097781,0.0002859883,0.0015,-0.077781,0.0002859907,0.0015,-0.077781,0.001999991,-0.0015,-0.077781,0.0002859907,-0.0015,-0.097781,0.0002859883,-0.0015,-0.097781,0.001999988,0.0015,-0.097781,0.0002859883,0.00138,0.012095,0.03,0.008705,0.008682996,0.03,0.002472,0.007607996,0.03,-0.004666,0.011094,0.03,0.00138,0.012095,0.03,-0.002472,0.007607996,0.03,0.008705,0.008682996,0.03,0.012011,0.001776996,0.03,0.006472,0.004701996,0.03,0.012011,0.001776996,0.03,0.011131,-0.005043004,0.03,0.008,-3.576279e-09,0.03,0.011131,-0.005043004,0.03,0.007132,-0.009824004,0.03,0.006472,-0.004702004,0.03,-0.006472,-0.004702004,0.03,-0.002472,-0.007608004,0.03,-0.007621,-0.009812004,0.03,-0.006472,-0.004702004,0.03,-0.007621,-0.009812004,0.03,-0.008,-3.576279e-09,0.03,-0.013731,0.006550996,0.03,-0.010367,0.007194996,0.03,-0.008,-3.576279e-09,0.03,-0.010367,0.007194996,0.03,-0.004666,0.011094,0.03,-0.006472,0.004701996,0.03,-0.006472,0.004701999,0.002000001,-0.006472,0.004701996,0.03,-0.002472,0.007608,0.002000001,0.006472,0.004701999,0.002000001,0.006472,0.004701996,0.03,0.008,-2.384186e-10,0.002,0.006472,-0.004702,0.002,0.006472,-0.004702004,0.03,0.002472,-0.007608001,0.001999999,-0.006472,0.004701999,0.002000001,-0.008,-2.384186e-10,0.002,-0.006472,0.004701996,0.03,0.002472,0.007608,0.002000001,0.002472,0.007607996,0.03,0.006472,0.004701999,0.002000001,0.002472,-0.007608001,0.001999999,0.002472,-0.007608004,0.03,-0.002472,-0.007608001,0.001999999,-0.008,-2.384186e-10,0.002,-0.006472,-0.004702,0.002,-0.008,-3.576279e-09,0.03,-0.002472,0.007608,0.002000001,-0.002472,0.007607996,0.03,0.002472,0.007608,0.002000001,0.008,-2.384186e-10,0.002,0.008,-3.576279e-09,0.03,0.006472,-0.004702,0.002,-0.002472,-0.007608001,0.001999999,-0.002472,-0.007608004,0.03,-0.006472,-0.004702,0.002,0.003453,-0.011674,0.03,0.002472,-0.007608004,0.03,0.007132,-0.009824004,0.03,0.002472,-0.007608004,0.03,-0.001836,-0.011942,0.03,-0.002472,-0.007608004,0.03])\n for (l = hvs; l < handleVertices.length - 2; l = l + 3) {\n handleVertices[l] += cX\n handleVertices[l + 1] += aY\n handleVertices[l + 2] += iZ\n }\n }\n else {\n // Face Definitions FRONT HANDLE\n // A\n handleVertices[ hvPos ] = handleVertices[ hvPos + 9 ] = aX\n handleVertices[ hvPos + 1 ] = handleVertices[ hvPos + 10 ] = aY\n handleVertices[ hvPos + 2 ] = handleVertices[ hvPos + 11 ] = aZ\n // B\n handleVertices[ hvPos + 3 ] = aX\n handleVertices[ hvPos + 4 ] = bY\n handleVertices[ hvPos + 5 ] = aZ\n // D\n handleVertices[ hvPos + 6 ] = handleVertices[ hvPos + 12 ] = cX\n handleVertices[ hvPos + 7 ] = handleVertices[ hvPos + 13 ] = bY\n handleVertices[ hvPos + 8 ] = handleVertices[ hvPos + 14 ] = cZ\n // C\n handleVertices[ hvPos + 15 ] = cX\n handleVertices[ hvPos + 16 ] = aY\n handleVertices[ hvPos + 17 ] = cZ\n\n hvPos += 18\n // E\n handleVertices[ hvPos ] = handleVertices[ hvPos + 9 ] = aX\n handleVertices[ hvPos + 1 ] = handleVertices[ hvPos + 10 ] = aY\n handleVertices[ hvPos + 2 ] = handleVertices[ hvPos + 11 ] = eZ\n // F\n handleVertices[ hvPos + 3 ] = aX\n handleVertices[ hvPos + 4 ] = bY\n handleVertices[ hvPos + 5 ] = eZ\n // B\n handleVertices[ hvPos + 6 ] = handleVertices[ hvPos + 12 ] = aX\n handleVertices[ hvPos + 7 ] = handleVertices[ hvPos + 13 ] = bY\n handleVertices[ hvPos + 8 ] = handleVertices[ hvPos + 14 ] = aZ\n // A\n handleVertices[ hvPos + 15 ] = aX\n handleVertices[ hvPos + 16 ] = aY\n handleVertices[ hvPos + 17 ] = aZ\n\n hvPos += 18\n // G\n handleVertices[ hvPos ] = handleVertices[ hvPos + 9 ] = gX\n handleVertices[ hvPos + 1 ] = handleVertices[ hvPos + 10 ] = aY\n handleVertices[ hvPos + 2 ] = handleVertices[ hvPos + 11 ] = eZ\n // H\n handleVertices[ hvPos + 3 ] = gX\n handleVertices[ hvPos + 4 ] = bY\n handleVertices[ hvPos + 5 ] = eZ\n // F\n handleVertices[ hvPos + 6 ] = handleVertices[ hvPos + 12 ] = aX\n handleVertices[ hvPos + 7 ] = handleVertices[ hvPos + 13 ] = bY\n handleVertices[ hvPos + 8 ] = handleVertices[ hvPos + 14 ] = eZ\n // E\n handleVertices[ hvPos + 15 ] = aX\n handleVertices[ hvPos + 16 ] = aY\n handleVertices[ hvPos + 17 ] = eZ\n\n hvPos += 18\n // I\n handleVertices[ hvPos ] = handleVertices[ hvPos + 9 ] = gX\n handleVertices[ hvPos + 1 ] = handleVertices[ hvPos + 10 ] = aY\n handleVertices[ hvPos + 2 ] = handleVertices[ hvPos + 11 ] = iZ\n // J\n handleVertices[ hvPos + 3 ] = gX\n handleVertices[ hvPos + 4 ] = bY\n handleVertices[ hvPos + 5 ] = iZ\n // H\n handleVertices[ hvPos + 6 ] = handleVertices[ hvPos + 12 ] = gX\n handleVertices[ hvPos + 7 ] = handleVertices[ hvPos + 13 ] = bY\n handleVertices[ hvPos + 8 ] = handleVertices[ hvPos + 14 ] = eZ\n // G\n handleVertices[ hvPos + 15 ] = gX\n handleVertices[ hvPos + 16 ] = aY\n handleVertices[ hvPos + 17 ] = eZ\n\n hvPos += 18\n // C\n handleVertices[ hvPos ] = handleVertices[ hvPos + 9 ] = cX\n handleVertices[ hvPos + 1 ] = handleVertices[ hvPos + 10 ] = aY\n handleVertices[ hvPos + 2 ] = handleVertices[ hvPos + 11 ] = cZ\n // D\n handleVertices[ hvPos + 3 ] = cX\n handleVertices[ hvPos + 4 ] = bY\n handleVertices[ hvPos + 5 ] = cZ\n // L\n handleVertices[ hvPos + 6 ] = handleVertices[ hvPos + 12 ] = cX\n handleVertices[ hvPos + 7 ] = handleVertices[ hvPos + 13 ] = bY\n handleVertices[ hvPos + 8 ] = handleVertices[ hvPos + 14 ] = iZ\n // K\n handleVertices[ hvPos + 15 ] = cX\n handleVertices[ hvPos + 16 ] = aY\n handleVertices[ hvPos + 17 ] = iZ\n\n hvPos += 18\n // E\n handleVertices[ hvPos ] = handleVertices[ hvPos + 9 ] = aX\n handleVertices[ hvPos + 1 ] = handleVertices[ hvPos + 10 ] = aY\n handleVertices[ hvPos + 2 ] = handleVertices[ hvPos + 11 ] = eZ\n // A\n handleVertices[ hvPos + 3 ] = aX\n handleVertices[ hvPos + 4 ] = aY\n handleVertices[ hvPos + 5 ] = aZ\n // C\n handleVertices[ hvPos + 6 ] = handleVertices[ hvPos + 12 ] = cX\n handleVertices[ hvPos + 7 ] = handleVertices[ hvPos + 13 ] = aY\n handleVertices[ hvPos + 8 ] = handleVertices[ hvPos + 14 ] = cZ\n // G\n handleVertices[ hvPos + 15 ] = gX\n handleVertices[ hvPos + 16 ] = aY\n handleVertices[ hvPos + 17 ] = eZ\n\n hvPos += 18\n // K\n handleVertices[ hvPos ] = handleVertices[ hvPos + 9 ] = cX\n handleVertices[ hvPos + 1 ] = handleVertices[ hvPos + 10 ] = aY\n handleVertices[ hvPos + 2 ] = handleVertices[ hvPos + 11 ] = iZ\n // I\n handleVertices[ hvPos + 3 ] = gX\n handleVertices[ hvPos + 4 ] = aY\n handleVertices[ hvPos + 5 ] = iZ\n // G\n handleVertices[ hvPos + 6 ] = handleVertices[ hvPos + 12 ] = gX\n handleVertices[ hvPos + 7 ] = handleVertices[ hvPos + 13 ] = aY\n handleVertices[ hvPos + 8 ] = handleVertices[ hvPos + 14 ] = eZ\n // C\n handleVertices[ hvPos + 15 ] = cX\n handleVertices[ hvPos + 16 ] = aY\n handleVertices[ hvPos + 17 ] = cZ\n\n hvPos += 18\n // B\n handleVertices[ hvPos ] = handleVertices[ hvPos + 9 ] = aX\n handleVertices[ hvPos + 1 ] = handleVertices[ hvPos + 10 ] = bY\n handleVertices[ hvPos + 2 ] = handleVertices[ hvPos + 11 ] = aZ\n // F\n handleVertices[ hvPos + 3 ] = aX\n handleVertices[ hvPos + 4 ] = bY\n handleVertices[ hvPos + 5 ] = eZ\n // H\n handleVertices[ hvPos + 6 ] = handleVertices[ hvPos + 12 ] = gX\n handleVertices[ hvPos + 7 ] = handleVertices[ hvPos + 13 ] = bY\n handleVertices[ hvPos + 8 ] = handleVertices[ hvPos + 14 ] = eZ\n // D\n handleVertices[ hvPos + 15 ] = cX\n handleVertices[ hvPos + 16 ] = bY\n handleVertices[ hvPos + 17 ] = cZ\n\n hvPos += 18\n // D\n handleVertices[ hvPos ] = handleVertices[ hvPos + 9 ] = cX\n handleVertices[ hvPos + 1 ] = handleVertices[ hvPos + 10 ] = bY\n handleVertices[ hvPos + 2 ] = handleVertices[ hvPos + 11 ] = cZ\n // H\n handleVertices[ hvPos + 3 ] = gX\n handleVertices[ hvPos + 4 ] = bY\n handleVertices[ hvPos + 5 ] = eZ\n // J\n handleVertices[ hvPos + 6 ] = handleVertices[ hvPos + 12 ] = gX\n handleVertices[ hvPos + 7 ] = handleVertices[ hvPos + 13 ] = bY\n handleVertices[ hvPos + 8 ] = handleVertices[ hvPos + 14 ] = iZ\n // L\n handleVertices[ hvPos + 15 ] = cX\n handleVertices[ hvPos + 16 ] = bY\n handleVertices[ hvPos + 17 ] = iZ\n\n hvPos += 18\n\n // HANDLE PLATE\n\n // Vertex Front View\n // A/E____D/H\n // | |\n // | |\n // | |\n // B/F____C/G\n\n aX = xCursor + frameLength + leafLength-handlePlateDistance-handlePlateLength\n aY = handleHeight+0.06\n aZ = zCursor+a.leafWidth+handlePlateWidth\n bY = handleHeight+0.06-handlePlateHeight\n cX = xCursor + frameLength + leafLength-handlePlateDistance\n eZ = zCursor-handlePlateWidth\n\n // A\n handleVertices[ hvPos ] = handleVertices[ hvPos + 9 ] = aX\n handleVertices[ hvPos + 1 ] = handleVertices[ hvPos + 10 ] = aY\n handleVertices[ hvPos + 2 ] = handleVertices[ hvPos + 11 ] = aZ\n // B\n handleVertices[ hvPos + 3 ] = aX\n handleVertices[ hvPos + 4 ] = bY\n handleVertices[ hvPos + 5 ] = aZ\n // C\n handleVertices[ hvPos + 6 ] = handleVertices[ hvPos + 12 ] = cX\n handleVertices[ hvPos + 7 ] = handleVertices[ hvPos + 13 ] = bY\n handleVertices[ hvPos + 8 ] = handleVertices[ hvPos + 14 ] = aZ\n // D\n handleVertices[ hvPos + 15 ] = cX\n handleVertices[ hvPos + 16 ] = aY\n handleVertices[ hvPos + 17 ] = aZ\n\n hvPos += 18\n }\n // set position in handle vertex array for current door leaf before mirroring\n hve = handleVertices.length\n // Duplicating Handle Vertices\n hvt = handleVertices.slice(hvs, hve)\n var t\n // Mirroring Z Vertices\n for (t = 0; t < hvt.length - 2; t = t + 3) {\n hvt[t + 2] = -hvt[t + 2] + (wallBackPos + a.leafWidth - leafOffset - frameOffset) * 2 - a.leafWidth\n }\n // Changing Vertex Order > Flipping Polygons\n for (t = 0; t < hvt.length - 8; t = t + 9) {\n hvm[1] = hvt[t + 3]\n hvm[2] = hvt[t + 4]\n hvm[3] = hvt[t + 5]\n hvt[t + 3] = hvt[t + 6]\n hvt[t + 4] = hvt[t + 7]\n hvt[t + 5] = hvt[t + 8]\n hvt[t + 6] = hvm[1]\n hvt[t + 7] = hvm[2]\n hvt[t + 8] = hvm[3]\n }\n // Push Vertices into Array\n handleVertices = handleVertices.concat(hvt)\n hvPos += hvt.length\n\n // set end position in handle vertex array for current door leaf\n hvf = handleVertices.length\n\n // Flip Handle for flipped door leafs or if hinge is left\n if (leaf[c].flipLeaf || (a.hinge === 'left' && (doorType !== 'doubleSwing' && doorType !== 'doubleSwingDoubleFix'))) {\n for (i = hvs; i < hvf - 2; i = i + 3) {\n xRotate = handleVertices[i] - frameLength - leafLength / 2 - prevLeafs\n handleVertices[i + 2] = handleVertices[i + 2] - wallBackPos - a.leafWidth / 2 + leafOffset + frameOffset\n handleVertices[i] = -xRotate + frameLength + leafLength / 2 + prevLeafs\n handleVertices[i + 2] = -handleVertices[i + 2] + wallBackPos + a.leafWidth / 2 - leafOffset - frameOffset\n }\n }\n }\n\n // rotation of leaf and handle vertices for door opening\n if (leaf[c].angle > 0) {\n\n // rotation setup\n xRotate = 0\n cosAngle = Math.cos(leaf[c].angle / 180 * Math.PI)\n sinAngle = Math.sin(leaf[c].angle / 180 * Math.PI)\n\n if (leaf[c].flipLeaf || (a.hinge === 'left' && (doorType !== 'doubleSwing' && doorType !== 'doubleSwingDoubleFix'))) {\n rotationOffset = -frameLength - leafLength - prevLeafs\n } else {\n rotationOffset = -frameLength - prevLeafs\n sinAngle = -sinAngle\n }\n\n // rotation of leaf vertices\n for (i = lvs; i < lve - 2; i = i + 3) {\n xRotate = leafVertices[i] + rotationOffset\n leafVertices[i + 2] = leafVertices[i + 2] - wallBackPos + leafOffset + frameOffset\n leafVertices[i] = xRotate * cosAngle - leafVertices[i + 2] * sinAngle - rotationOffset\n leafVertices[i + 2] = leafVertices[i + 2] * cosAngle + xRotate * sinAngle + wallBackPos - leafOffset - frameOffset\n }\n // rotation of handle vertices\n for (i = hvs; i < hvf - 2; i = i + 3) {\n xRotate = handleVertices[i] + rotationOffset\n handleVertices[i + 2] = handleVertices[i + 2] - wallBackPos + leafOffset + frameOffset\n handleVertices[i] = xRotate * cosAngle - handleVertices[i + 2] * sinAngle - rotationOffset\n handleVertices[i + 2] = handleVertices[i + 2] * cosAngle + xRotate * sinAngle + wallBackPos - leafOffset - frameOffset\n }\n }\n xCursor += leafLength\n }\n\n var i,\n ll = leafVertices.length,\n lh = handleVertices.length\n\n // rotate everything by PI if door is set to front\n\n if (a.side === 'front') {\n for (i = 0; i < ll; i = i + 3) {\n xRotate = leafVertices[i] - frameLength - doorOpening / 2\n leafVertices[i + 2] = leafVertices[i + 2] - wallBackPos - leafOffset / 2 - frameOffset / 2 - frameWidth / 2\n leafVertices[i] = -xRotate + frameLength + doorOpening / 2\n leafVertices[i + 2] = -leafVertices[i + 2] + wallBackPos - leafOffset / 2 - frameOffset / 2 + frameWidth / 2\n }\n for (i = 0; i < lh; i = i + 3) {\n xRotate = handleVertices[i] - frameLength - doorOpening / 2\n handleVertices[i + 2] = handleVertices[i + 2] - wallBackPos - leafOffset / 2 - frameOffset / 2 - frameWidth / 2\n handleVertices[i] = -xRotate + frameLength + doorOpening / 2\n handleVertices[i + 2] = -handleVertices[i + 2] + wallBackPos - leafOffset / 2 - frameOffset / 2 + frameWidth / 2\n }\n }\n\n return {\n frame: {\n positions: frameVertices,\n normals: generateNormals.flat(frameVertices),\n material: 'frame'\n },\n handle: {\n positions: new Float32Array(handleVertices),\n normals: generateNormals.flat(handleVertices),\n material: 'handle'\n },\n leaf: {\n positions: new Float32Array(leafVertices),\n normals: generateNormals.flat(leafVertices),\n uvs: new Float32Array(leafUvs),\n material: 'leaf'\n },\n threshold: {\n positions: floorVertices,\n normals: generateNormals.flat(floorVertices),\n uvs: floorUvs,\n material: 'threshold'\n }\n }\n }\n}","'use strict';\n\n// dependencies\n\nimport getSchema from './common/get-schema.js'\nimport getMaterial from './common/get-material.js'\nimport updateSchema from './common/update-schema.js'\nimport generatePolygonBuffer from '../../../utils/data3d/buffer/get-polygon'\nimport generateExtrusionBuffer from '../../../utils/data3d/buffer/get-extrusion'\nimport generateNormals from '../../../utils/data3d/buffer/get-normals'\nimport cloneDeep from 'lodash/cloneDeep'\n\nexport default {\n\n schema: getSchema('floor'),\n\n init: function () {},\n\n updateSchema: updateSchema,\n\n update: function (oldData) {\n var this_ = this\n var data = this_.data\n\n // remove old mesh\n this.remove()\n\n // get defaults and\n this.attributes = cloneDeep(data)\n\n // get meshes and materials from el3d modules\n var meshes = this.generateMeshes3d()\n\n // clean up empty meshes to prevent errors\n var meshKeys = Object.keys(meshes)\n meshKeys.forEach(key => {\n if (!meshes[key].positions || !meshes[key].positions.length) {\n // console.warn('no vertices for mesh', key)\n delete meshes[key]\n }\n })\n\n // setup materials\n // defaults\n var materials = {\n top: 'wood_parquet_oak',\n side: 'basic-wall',\n ceiling: 'basic-ceiling'\n }\n\n // check for adapted materials\n var materialKeys = Object.keys(data).filter(function(key) {\n return key.indexOf('material_') > -1\n })\n // add materials to instance\n materialKeys.forEach(function(key) {\n var mesh = key.replace('material_', '')\n materials[mesh] = data[key]\n })\n\n // fetch materials from mat library\n Object.keys(materials).forEach(mat => {\n materials[mat] = getMaterial(materials[mat])\n })\n\n // construct data3d object\n var data3d = {\n meshes: meshes,\n materials: materials\n }\n\n // create new one\n this_.mesh = new THREE.Object3D()\n this_.data3dView = new io3d.aFrame.three.Data3dView({parent: this_.mesh})\n\n // update view\n this_.data3dView.set(data3d)\n this_.el.setObject3D('mesh', this_.mesh)\n // emit event\n this_.el.emit('mesh-updated');\n },\n\n remove: function () {\n if (this.data3dView) {\n this.data3dView.destroy()\n this.data3dView = null\n }\n if (this.mesh) {\n this.el.removeObject3D('mesh')\n this.mesh = null\n }\n },\n\n generateMeshes3d: function () {\n var a = this.attributes\n\n // 2d polygon vertices\n var vertices = [ 0, 0, 0, a.w, a.l, a.w, a.l, 0 ]\n\n // top polygon\n var topPolygon = generatePolygonBuffer({\n outline: vertices,\n y: 0,\n uvx: a.x,\n uvz: a.z\n })\n\n // ceiling polygon\n var ceilingPolygon\n if (a.hasCeiling) {\n ceilingPolygon = generatePolygonBuffer({\n outline: vertices,\n y: a.hCeiling,\n uvx: a.x,\n uvz: a.z,\n flipSide: true\n })\n } else {\n ceilingPolygon = {\n vertices: new Float32Array(0),\n uvs: new Float32Array(0)\n }\n }\n\n // sides\n var sides = generateExtrusionBuffer({\n outline: vertices,\n y: -a.h,\n flipSide: true\n })\n\n // return meshes\n return {\n top: {\n positions: topPolygon.vertices,\n normals: generateNormals.flat(topPolygon.vertices),\n uvs: topPolygon.uvs,\n material: 'top'\n },\n sides: {\n positions: sides.vertices,\n normals: generateNormals.flat(sides.vertices),\n uvs: sides.uvs,\n material: 'side'\n },\n ceiling: {\n positions: ceilingPolygon.vertices,\n normals: generateNormals.flat(ceilingPolygon.vertices),\n uvs: ceilingPolygon.uvs,\n material: 'ceiling'\n }\n }\n }\n}","// from https://github.com/jbgutierrez/path-parse\n// Split a filename into [root, dir, basename, ext], unix version\n// 'root' is just a slash, or nothing.\nvar splitPathRe = /^(\\/?|)([\\s\\S]*?)((?:\\.{1,2}|[^\\/]+?|)(\\.[^.\\/]*|))(?:[\\/]*)$/;\n\nfunction parsePath (path) {\n if (typeof path !== 'string') {\n throw new TypeError(\n \"Parameter 'path' must be a string, not \" + typeof path\n );\n }\n var allParts = splitPathRe.exec(path).slice(1)\n if (!allParts || allParts.length !== 4) {\n throw new TypeError(\"Invalid path '\" + path + \"'\");\n }\n allParts[2] = allParts[2] || '';\n allParts[3] = allParts[3] || '';\n\n return {\n root: allParts[0],\n dir: allParts[0] + allParts[1].slice(0, -1),\n base: allParts[2],\n ext: allParts[3],\n name: allParts[2].slice(0, allParts[2].length - allParts[3].length)\n }\n}\n\nexport default {\n parse: parsePath\n}","// source: https://github.com/petkaantonov/urlparser\n// modified for browser compatibility\n\n/*\n Copyright (c) 2014 Petka Antonov\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in\n all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n THE SOFTWARE.\n */\nexport default function Url() {\n //For more efficient internal representation and laziness.\n //The non-underscore versions of these properties are accessor functions\n //defined on the prototype.\n this._protocol = null;\n this._href = \"\";\n this._port = -1;\n this._query = null;\n\n this.auth = null;\n this.slashes = null;\n this.host = null;\n this.hostname = null;\n this.hash = null;\n this.search = null;\n this.pathname = null;\n\n this._prependSlash = false;\n}\n\nUrl.prototype.parse =\n function Url$parse(str, parseQueryString, hostDenotesSlash, disableAutoEscapeChars) {\n if (typeof str !== \"string\") {\n throw new TypeError(\"Parameter 'url' must be a string, not \" +\n typeof str);\n }\n\n // check for relative URL in a browser\n if(typeof window !== 'undefined' && !str.match(/^[^:]+:\\/\\//) && str.substr(0, 2) !== '//') {\n if(str[0] === '/') str = str.slice(1)\n str = window.location.protocol + '//' + window.location.host + window.location.pathname + str\n console.error('mutated', str)\n }\n\n if (str.substr(0,2) === '//' && typeof window !== 'undefined' && window.location && window.location.protocol) {\n str = window.location.protocol + str\n }\n var start = 0;\n var end = str.length - 1;\n\n //Trim leading and trailing ws\n while (str.charCodeAt(start) <= 0x20 /*' '*/) start++;\n while (str.charCodeAt(end) <= 0x20 /*' '*/) end--;\n\n start = this._parseProtocol(str, start, end);\n\n //Javascript doesn't have host\n if (this._protocol !== \"javascript\") {\n start = this._parseHost(str, start, end, hostDenotesSlash);\n var proto = this._protocol;\n if (!this.hostname &&\n (this.slashes || (proto && !slashProtocols[proto]))) {\n this.hostname = this.host = \"\";\n }\n }\n\n if (start <= end) {\n var ch = str.charCodeAt(start);\n\n if (ch === 0x2F /*'/'*/ || ch === 0x5C /*'\\'*/) {\n this._parsePath(str, start, end, disableAutoEscapeChars);\n }\n else if (ch === 0x3F /*'?'*/) {\n this._parseQuery(str, start, end, disableAutoEscapeChars);\n }\n else if (ch === 0x23 /*'#'*/) {\n this._parseHash(str, start, end, disableAutoEscapeChars);\n }\n else if (this._protocol !== \"javascript\") {\n this._parsePath(str, start, end, disableAutoEscapeChars);\n }\n else { //For javascript the pathname is just the rest of it\n this.pathname = str.slice(start, end + 1 );\n }\n\n }\n\n if (!this.pathname && this.hostname &&\n this._slashProtocols[this._protocol]) {\n this.pathname = \"/\";\n }\n\n if (parseQueryString) {\n var search = this.search;\n if (search == null) {\n search = this.search = \"\";\n }\n if (search.charCodeAt(0) === 0x3F /*'?'*/) {\n search = search.slice(1);\n }\n //This calls a setter function, there is no .query data property\n this.query = Url.queryString.parse(search);\n }\n };\n\nUrl.prototype.resolve = function Url$resolve(relative) {\n return this.resolveObject(Url.parse(relative, false, true)).format();\n};\n\nUrl.prototype.format = function Url$format() {\n var auth = this.auth || \"\";\n\n if (auth) {\n auth = encodeURIComponent(auth);\n auth = auth.replace(/%3A/i, \":\");\n auth += \"@\";\n }\n\n var protocol = this.protocol || \"\";\n var pathname = this.pathname || \"\";\n var hash = this.hash || \"\";\n var search = this.search || \"\";\n var query = \"\";\n var hostname = this.hostname || \"\";\n var port = this.port || \"\";\n var host = false;\n var scheme = \"\";\n\n //Cache the result of the getter function\n var q = this.query;\n if (q && typeof q === \"object\") {\n query = Url.queryString.stringify(q);\n }\n\n if (!search) {\n search = query ? \"?\" + query : \"\";\n }\n\n if (protocol && protocol.charCodeAt(protocol.length - 1) !== 0x3A /*':'*/)\n protocol += \":\";\n\n if (this.host) {\n host = auth + this.host;\n }\n else if (hostname) {\n var ip6 = hostname.indexOf(\":\") > -1;\n if (ip6) hostname = \"[\" + hostname + \"]\";\n host = auth + hostname + (port ? \":\" + port : \"\");\n }\n\n var slashes = this.slashes ||\n ((!protocol ||\n slashProtocols[protocol]) && host !== false);\n\n\n if (protocol) scheme = protocol + (slashes ? \"//\" : \"\");\n else if (slashes) scheme = \"//\";\n\n if (slashes && pathname && pathname.charCodeAt(0) !== 0x2F /*'/'*/) {\n pathname = \"/\" + pathname;\n }\n if (search && search.charCodeAt(0) !== 0x3F /*'?'*/)\n search = \"?\" + search;\n if (hash && hash.charCodeAt(0) !== 0x23 /*'#'*/)\n hash = \"#\" + hash;\n\n pathname = escapePathName(pathname);\n search = escapeSearch(search);\n\n return scheme + (host === false ? \"\" : host) + pathname + search + hash;\n};\n\nUrl.prototype.resolveObject = function Url$resolveObject(relative) {\n if (typeof relative === \"string\")\n relative = Url.parse(relative, false, true);\n\n var result = this._clone();\n\n // hash is always overridden, no matter what.\n // even href=\"\" will remove it.\n result.hash = relative.hash;\n\n // if the relative url is empty, then there\"s nothing left to do here.\n if (!relative.href) {\n result._href = \"\";\n return result;\n }\n\n // hrefs like //foo/bar always cut to the protocol.\n if (relative.slashes && !relative._protocol) {\n relative._copyPropsTo(result, true);\n\n if (slashProtocols[result._protocol] &&\n result.hostname && !result.pathname) {\n result.pathname = \"/\";\n }\n result._href = \"\";\n return result;\n }\n\n if (relative._protocol && relative._protocol !== result._protocol) {\n // if it\"s a known url protocol, then changing\n // the protocol does weird things\n // first, if it\"s not file:, then we MUST have a host,\n // and if there was a path\n // to begin with, then we MUST have a path.\n // if it is file:, then the host is dropped,\n // because that\"s known to be hostless.\n // anything else is assumed to be absolute.\n if (!slashProtocols[relative._protocol]) {\n relative._copyPropsTo(result, false);\n result._href = \"\";\n return result;\n }\n\n result._protocol = relative._protocol;\n if (!relative.host && relative._protocol !== \"javascript\") {\n var relPath = (relative.pathname || \"\").split(\"/\");\n while (relPath.length && !(relative.host = relPath.shift()));\n if (!relative.host) relative.host = \"\";\n if (!relative.hostname) relative.hostname = \"\";\n if (relPath[0] !== \"\") relPath.unshift(\"\");\n if (relPath.length < 2) relPath.unshift(\"\");\n result.pathname = relPath.join(\"/\");\n } else {\n result.pathname = relative.pathname;\n }\n\n result.search = relative.search;\n result.host = relative.host || \"\";\n result.auth = relative.auth;\n result.hostname = relative.hostname || relative.host;\n result._port = relative._port;\n result.slashes = result.slashes || relative.slashes;\n result._href = \"\";\n return result;\n }\n\n var isSourceAbs =\n (result.pathname && result.pathname.charCodeAt(0) === 0x2F /*'/'*/);\n var isRelAbs = (\n relative.host ||\n (relative.pathname &&\n relative.pathname.charCodeAt(0) === 0x2F /*'/'*/)\n );\n var mustEndAbs = (isRelAbs || isSourceAbs ||\n (result.host && relative.pathname));\n\n var removeAllDots = mustEndAbs;\n\n var srcPath = result.pathname && result.pathname.split(\"/\") || [];\n var relPath = relative.pathname && relative.pathname.split(\"/\") || [];\n var psychotic = result._protocol && !slashProtocols[result._protocol];\n\n // if the url is a non-slashed url, then relative\n // links like ../.. should be able\n // to crawl up to the hostname, as well. This is strange.\n // result.protocol has already been set by now.\n // Later on, put the first path part into the host field.\n if (psychotic) {\n result.hostname = \"\";\n result._port = -1;\n if (result.host) {\n if (srcPath[0] === \"\") srcPath[0] = result.host;\n else srcPath.unshift(result.host);\n }\n result.host = \"\";\n if (relative._protocol) {\n relative.hostname = \"\";\n relative._port = -1;\n if (relative.host) {\n if (relPath[0] === \"\") relPath[0] = relative.host;\n else relPath.unshift(relative.host);\n }\n relative.host = \"\";\n }\n mustEndAbs = mustEndAbs && (relPath[0] === \"\" || srcPath[0] === \"\");\n }\n\n if (isRelAbs) {\n // it\"s absolute.\n result.host = relative.host ?\n relative.host : result.host;\n result.hostname = relative.hostname ?\n relative.hostname : result.hostname;\n result.search = relative.search;\n srcPath = relPath;\n // fall through to the dot-handling below.\n } else if (relPath.length) {\n // it\"s relative\n // throw away the existing file, and take the new path instead.\n if (!srcPath) srcPath = [];\n srcPath.pop();\n srcPath = srcPath.concat(relPath);\n result.search = relative.search;\n } else if (relative.search) {\n // just pull out the search.\n // like href=\"?foo\".\n // Put this after the other two cases because it simplifies the booleans\n if (psychotic) {\n result.hostname = result.host = srcPath.shift();\n //occationaly the auth can get stuck only in host\n //this especialy happens in cases like\n //url.resolveObject(\"mailto:local1@domain1\", \"local2@domain2\")\n var authInHost = result.host && result.host.indexOf(\"@\") > 0 ?\n result.host.split(\"@\") : false;\n if (authInHost) {\n result.auth = authInHost.shift();\n result.host = result.hostname = authInHost.shift();\n }\n }\n result.search = relative.search;\n result._href = \"\";\n return result;\n }\n\n if (!srcPath.length) {\n // no path at all. easy.\n // we\"ve already handled the other stuff above.\n result.pathname = null;\n result._href = \"\";\n return result;\n }\n\n // if a url ENDs in . or .., then it must get a trailing slash.\n // however, if it ends in anything else non-slashy,\n // then it must NOT get a trailing slash.\n var last = srcPath.slice(-1)[0];\n var hasTrailingSlash = (\n (result.host || relative.host) && (last === \".\" || last === \"..\") ||\n last === \"\");\n\n // strip single dots, resolve double dots to parent dir\n // if the path tries to go above the root, `up` ends up > 0\n var up = 0;\n for (var i = srcPath.length; i >= 0; i--) {\n last = srcPath[i];\n if (last === \".\") {\n srcPath.splice(i, 1);\n } else if (last === \"..\") {\n srcPath.splice(i, 1);\n up++;\n } else if (up) {\n srcPath.splice(i, 1);\n up--;\n }\n }\n\n // if the path is allowed to go above the root, restore leading ..s\n if (!mustEndAbs && !removeAllDots) {\n for (; up--; up) {\n srcPath.unshift(\"..\");\n }\n }\n\n if (mustEndAbs && srcPath[0] !== \"\" &&\n (!srcPath[0] || srcPath[0].charCodeAt(0) !== 0x2F /*'/'*/)) {\n srcPath.unshift(\"\");\n }\n\n if (hasTrailingSlash && (srcPath.join(\"/\").substr(-1) !== \"/\")) {\n srcPath.push(\"\");\n }\n\n var isAbsolute = srcPath[0] === \"\" ||\n (srcPath[0] && srcPath[0].charCodeAt(0) === 0x2F /*'/'*/);\n\n // put the host back\n if (psychotic) {\n result.hostname = result.host = isAbsolute ? \"\" :\n srcPath.length ? srcPath.shift() : \"\";\n //occationaly the auth can get stuck only in host\n //this especialy happens in cases like\n //url.resolveObject(\"mailto:local1@domain1\", \"local2@domain2\")\n var authInHost = result.host && result.host.indexOf(\"@\") > 0 ?\n result.host.split(\"@\") : false;\n if (authInHost) {\n result.auth = authInHost.shift();\n result.host = result.hostname = authInHost.shift();\n }\n }\n\n mustEndAbs = mustEndAbs || (result.host && srcPath.length);\n\n if (mustEndAbs && !isAbsolute) {\n srcPath.unshift(\"\");\n }\n\n result.pathname = srcPath.length === 0 ? null : srcPath.join(\"/\");\n result.auth = relative.auth || result.auth;\n result.slashes = result.slashes || relative.slashes;\n result._href = \"\";\n return result;\n};\n\nvar escapePathName = Url.prototype._escapePathName =\n function Url$_escapePathName(pathname) {\n if (!containsCharacter2(pathname, 0x23 /*'#'*/, 0x3F /*'?'*/)) {\n return pathname;\n }\n //Avoid closure creation to keep this inlinable\n return _escapePath(pathname);\n };\n\nvar escapeSearch = Url.prototype._escapeSearch =\n function Url$_escapeSearch(search) {\n if (!containsCharacter2(search, 0x23 /*'#'*/, -1)) return search;\n //Avoid closure creation to keep this inlinable\n return _escapeSearch(search);\n };\n\nUrl.prototype._parseProtocol = function Url$_parseProtocol(str, start, end) {\n var doLowerCase = false;\n var protocolCharacters = this._protocolCharacters;\n\n for (var i = start; i <= end; ++i) {\n var ch = str.charCodeAt(i);\n\n if (ch === 0x3A /*':'*/) {\n var protocol = str.slice(start, i);\n if (doLowerCase) protocol = protocol.toLowerCase();\n this._protocol = protocol;\n return i + 1;\n }\n else if (protocolCharacters[ch] === 1) {\n if (ch < 0x61 /*'a'*/)\n doLowerCase = true;\n }\n else {\n return start;\n }\n\n }\n return start;\n};\n\nUrl.prototype._parseAuth = function Url$_parseAuth(str, start, end, decode) {\n var auth = str.slice(start, end + 1);\n if (decode) {\n auth = decodeURIComponent(auth);\n }\n this.auth = auth;\n};\n\nUrl.prototype._parsePort = function Url$_parsePort(str, start, end) {\n //Internal format is integer for more efficient parsing\n //and for efficient trimming of leading zeros\n var port = 0;\n //Distinguish between :0 and : (no port number at all)\n var hadChars = false;\n var validPort = true;\n\n for (var i = start; i <= end; ++i) {\n var ch = str.charCodeAt(i);\n\n if (0x30 /*'0'*/ <= ch && ch <= 0x39 /*'9'*/) {\n port = (10 * port) + (ch - 0x30 /*'0'*/);\n hadChars = true;\n }\n else {\n validPort = false;\n if (ch === 0x5C/*'\\'*/ || ch === 0x2F/*'/'*/) {\n validPort = true;\n }\n break;\n }\n\n }\n if ((port === 0 && !hadChars) || !validPort) {\n if (!validPort) {\n this._port = -2;\n }\n return 0;\n }\n\n this._port = port;\n return i - start;\n};\n\nUrl.prototype._parseHost =\n function Url$_parseHost(str, start, end, slashesDenoteHost) {\n var hostEndingCharacters = this._hostEndingCharacters;\n var first = str.charCodeAt(start);\n var second = str.charCodeAt(start + 1);\n if ((first === 0x2F /*'/'*/ || first === 0x5C /*'\\'*/) &&\n (second === 0x2F /*'/'*/ || second === 0x5C /*'\\'*/)) {\n this.slashes = true;\n\n //The string starts with //\n if (start === 0) {\n //The string is just \"//\"\n if (end < 2) return start;\n //If slashes do not denote host and there is no auth,\n //there is no host when the string starts with //\n var hasAuth =\n containsCharacter(str, 0x40 /*'@'*/, 2, hostEndingCharacters);\n if (!hasAuth && !slashesDenoteHost) {\n this.slashes = null;\n return start;\n }\n }\n //There is a host that starts after the //\n start += 2;\n }\n //If there is no slashes, there is no hostname if\n //1. there was no protocol at all\n else if (!this._protocol ||\n //2. there was a protocol that requires slashes\n //e.g. in 'http:asd' 'asd' is not a hostname\n slashProtocols[this._protocol]\n ) {\n return start;\n }\n\n var doLowerCase = false;\n var idna = false;\n var hostNameStart = start;\n var hostNameEnd = end;\n var lastCh = -1;\n var portLength = 0;\n var charsAfterDot = 0;\n var authNeedsDecoding = false;\n\n var j = -1;\n\n //Find the last occurrence of an @-sign until hostending character is met\n //also mark if decoding is needed for the auth portion\n for (var i = start; i <= end; ++i) {\n var ch = str.charCodeAt(i);\n\n if (ch === 0x40 /*'@'*/) {\n j = i;\n }\n //This check is very, very cheap. Unneeded decodeURIComponent is very\n //very expensive\n else if (ch === 0x25 /*'%'*/) {\n authNeedsDecoding = true;\n }\n else if (hostEndingCharacters[ch] === 1) {\n break;\n }\n }\n\n //@-sign was found at index j, everything to the left from it\n //is auth part\n if (j > -1) {\n this._parseAuth(str, start, j - 1, authNeedsDecoding);\n //hostname starts after the last @-sign\n start = hostNameStart = j + 1;\n }\n\n //Host name is starting with a [\n if (str.charCodeAt(start) === 0x5B /*'['*/) {\n for (var i = start + 1; i <= end; ++i) {\n var ch = str.charCodeAt(i);\n\n //Assume valid IP6 is between the brackets\n if (ch === 0x5D /*']'*/) {\n if (str.charCodeAt(i + 1) === 0x3A /*':'*/) {\n portLength = this._parsePort(str, i + 2, end) + 1;\n }\n var hostname = str.slice(start + 1, i).toLowerCase();\n this.hostname = hostname;\n this.host = this._port > 0 ?\n \"[\" + hostname + \"]:\" + this._port :\n \"[\" + hostname + \"]\";\n this.pathname = \"/\";\n return i + portLength + 1;\n }\n }\n //Empty hostname, [ starts a path\n return start;\n }\n\n for (var i = start; i <= end; ++i) {\n if (charsAfterDot > 62) {\n this.hostname = this.host = str.slice(start, i);\n return i;\n }\n var ch = str.charCodeAt(i);\n\n if (ch === 0x3A /*':'*/) {\n portLength = this._parsePort(str, i + 1, end) + 1;\n hostNameEnd = i - 1;\n break;\n }\n else if (ch < 0x61 /*'a'*/) {\n if (ch === 0x2E /*'.'*/) {\n //Node.js ignores this error\n /*\n if (lastCh === DOT || lastCh === -1) {\n this.hostname = this.host = \"\";\n return start;\n }\n */\n charsAfterDot = -1;\n }\n else if (0x41 /*'A'*/ <= ch && ch <= 0x5A /*'Z'*/) {\n doLowerCase = true;\n }\n //Valid characters other than ASCII letters -, _, +, 0-9\n else if (!(ch === 0x2D /*'-'*/ ||\n ch === 0x5F /*'_'*/ ||\n ch === 0x2B /*'+'*/ ||\n (0x30 /*'0'*/ <= ch && ch <= 0x39 /*'9'*/))\n ) {\n if (hostEndingCharacters[ch] === 0 &&\n this._noPrependSlashHostEnders[ch] === 0) {\n this._prependSlash = true;\n }\n hostNameEnd = i - 1;\n break;\n }\n }\n else if (ch >= 0x7B /*'{'*/) {\n if (ch <= 0x7E /*'~'*/) {\n if (this._noPrependSlashHostEnders[ch] === 0) {\n this._prependSlash = true;\n }\n hostNameEnd = i - 1;\n break;\n }\n idna = true;\n }\n lastCh = ch;\n charsAfterDot++;\n }\n\n //Node.js ignores this error\n /*\n if (lastCh === DOT) {\n hostNameEnd--;\n }\n */\n\n if (hostNameEnd + 1 !== start &&\n hostNameEnd - hostNameStart <= 256) {\n var hostname = str.slice(hostNameStart, hostNameEnd + 1);\n if (doLowerCase) hostname = hostname.toLowerCase();\n this.hostname = hostname;\n this.host = this._port > 0 ? hostname + \":\" + this._port : hostname;\n }\n\n return hostNameEnd + 1 + portLength;\n\n };\n\nUrl.prototype._copyPropsTo = function Url$_copyPropsTo(input, noProtocol) {\n if (!noProtocol) {\n input._protocol = this._protocol;\n }\n input._href = this._href;\n input._port = this._port;\n input._prependSlash = this._prependSlash;\n input.auth = this.auth;\n input.slashes = this.slashes;\n input.host = this.host;\n input.hostname = this.hostname;\n input.hash = this.hash;\n input.search = this.search;\n input.pathname = this.pathname;\n};\n\nUrl.prototype._clone = function Url$_clone() {\n var ret = new Url();\n ret._protocol = this._protocol;\n ret._href = this._href;\n ret._port = this._port;\n ret._prependSlash = this._prependSlash;\n ret.auth = this.auth;\n ret.slashes = this.slashes;\n ret.host = this.host;\n ret.hostname = this.hostname;\n ret.hash = this.hash;\n ret.search = this.search;\n ret.pathname = this.pathname;\n return ret;\n};\n\nUrl.prototype._getComponentEscaped =\n function Url$_getComponentEscaped(str, start, end, isAfterQuery) {\n var cur = start;\n var i = start;\n var ret = \"\";\n var autoEscapeMap = isAfterQuery ?\n this._afterQueryAutoEscapeMap : this._autoEscapeMap;\n for (; i <= end; ++i) {\n var ch = str.charCodeAt(i);\n var escaped = autoEscapeMap[ch];\n\n if (escaped !== \"\" && escaped !== undefined) {\n if (cur < i) ret += str.slice(cur, i);\n ret += escaped;\n cur = i + 1;\n }\n }\n if (cur < i + 1) ret += str.slice(cur, i);\n return ret;\n };\n\nUrl.prototype._parsePath =\n function Url$_parsePath(str, start, end, disableAutoEscapeChars) {\n var pathStart = start;\n var pathEnd = end;\n var escape = false;\n var autoEscapeCharacters = this._autoEscapeCharacters;\n var prePath = this._port === -2 ? \"/:\" : \"\";\n\n for (var i = start; i <= end; ++i) {\n var ch = str.charCodeAt(i);\n if (ch === 0x23 /*'#'*/) {\n this._parseHash(str, i, end, disableAutoEscapeChars);\n pathEnd = i - 1;\n break;\n }\n else if (ch === 0x3F /*'?'*/) {\n this._parseQuery(str, i, end, disableAutoEscapeChars);\n pathEnd = i - 1;\n break;\n }\n else if (!disableAutoEscapeChars && !escape && autoEscapeCharacters[ch] === 1) {\n escape = true;\n }\n }\n\n if (pathStart > pathEnd) {\n this.pathname = prePath === \"\" ? \"/\" : prePath;\n return;\n }\n\n var path;\n if (escape) {\n path = this._getComponentEscaped(str, pathStart, pathEnd, false);\n }\n else {\n path = str.slice(pathStart, pathEnd + 1);\n }\n this.pathname = prePath === \"\"\n ? (this._prependSlash ? \"/\" + path : path)\n : prePath + path;\n };\n\nUrl.prototype._parseQuery = function Url$_parseQuery(str, start, end, disableAutoEscapeChars) {\n var queryStart = start;\n var queryEnd = end;\n var escape = false;\n var autoEscapeCharacters = this._autoEscapeCharacters;\n\n for (var i = start; i <= end; ++i) {\n var ch = str.charCodeAt(i);\n\n if (ch === 0x23 /*'#'*/) {\n this._parseHash(str, i, end, disableAutoEscapeChars);\n queryEnd = i - 1;\n break;\n }\n else if (!disableAutoEscapeChars && !escape && autoEscapeCharacters[ch] === 1) {\n escape = true;\n }\n }\n\n if (queryStart > queryEnd) {\n this.search = \"\";\n return;\n }\n\n var query;\n if (escape) {\n query = this._getComponentEscaped(str, queryStart, queryEnd, true);\n }\n else {\n query = str.slice(queryStart, queryEnd + 1);\n }\n this.search = query;\n};\n\nUrl.prototype._parseHash = function Url$_parseHash(str, start, end, disableAutoEscapeChars) {\n if (start > end) {\n this.hash = \"\";\n return;\n }\n\n this.hash = disableAutoEscapeChars ?\n str.slice(start, end + 1) : this._getComponentEscaped(str, start, end, true);\n};\n\nObject.defineProperty(Url.prototype, \"port\", {\n get: function() {\n if (this._port >= 0) {\n return (\"\" + this._port);\n }\n return null;\n },\n set: function(v) {\n if (v == null) {\n this._port = -1;\n }\n else {\n this._port = parseInt(v, 10);\n }\n }\n});\n\nObject.defineProperty(Url.prototype, \"query\", {\n get: function() {\n var query = this._query;\n if (query != null) {\n return query;\n }\n var search = this.search;\n\n if (search) {\n if (search.charCodeAt(0) === 0x3F /*'?'*/) {\n search = search.slice(1);\n }\n if (search !== \"\") {\n this._query = search;\n return search;\n }\n }\n return search;\n },\n set: function(v) {\n this._query = v;\n }\n});\n\nObject.defineProperty(Url.prototype, \"path\", {\n get: function() {\n var p = this.pathname || \"\";\n var s = this.search || \"\";\n if (p || s) {\n return p + s;\n }\n return (p == null && s) ? (\"/\" + s) : null;\n },\n set: function() {}\n});\n\nObject.defineProperty(Url.prototype, \"protocol\", {\n get: function() {\n var proto = this._protocol;\n return proto ? proto + \":\" : proto;\n },\n set: function(v) {\n if (typeof v === \"string\") {\n var end = v.length - 1;\n if (v.charCodeAt(end) === 0x3A /*':'*/) {\n this._protocol = v.slice(0, end);\n }\n else {\n this._protocol = v;\n }\n }\n else if (v == null) {\n this._protocol = null;\n }\n }\n});\n\nObject.defineProperty(Url.prototype, \"href\", {\n get: function() {\n var href = this._href;\n if (!href) {\n href = this._href = this.format();\n }\n return href;\n },\n set: function(v) {\n this._href = v;\n }\n});\n\nUrl.parse = function Url$Parse(str, parseQueryString, hostDenotesSlash, disableAutoEscapeChars) {\n if (str instanceof Url) return str;\n var ret = new Url();\n ret.parse(str, !!parseQueryString, !!hostDenotesSlash, !!disableAutoEscapeChars);\n return ret;\n};\n\nUrl.format = function Url$Format(obj) {\n if (typeof obj === \"string\") {\n obj = Url.parse(obj);\n }\n if (!(obj instanceof Url)) {\n return Url.prototype.format.call(obj);\n }\n return obj.format();\n};\n\nUrl.resolve = function Url$Resolve(source, relative) {\n return Url.parse(source, false, true).resolve(relative);\n};\n\nUrl.resolveObject = function Url$ResolveObject(source, relative) {\n if (!source) return relative;\n return Url.parse(source, false, true).resolveObject(relative);\n};\n\nfunction _escapePath(pathname) {\n return pathname.replace(/[?#]/g, function(match) {\n return encodeURIComponent(match);\n });\n}\n\nfunction _escapeSearch(search) {\n return search.replace(/#/g, function(match) {\n return encodeURIComponent(match);\n });\n}\n\n//Search `char1` (integer code for a character) in `string`\n//starting from `fromIndex` and ending at `string.length - 1`\n//or when a stop character is found\nfunction containsCharacter(string, char1, fromIndex, stopCharacterTable) {\n var len = string.length;\n for (var i = fromIndex; i < len; ++i) {\n var ch = string.charCodeAt(i);\n\n if (ch === char1) {\n return true;\n }\n else if (stopCharacterTable[ch] === 1) {\n return false;\n }\n }\n return false;\n}\n\n//See if `char1` or `char2` (integer codes for characters)\n//is contained in `string`\nfunction containsCharacter2(string, char1, char2) {\n for (var i = 0, len = string.length; i < len; ++i) {\n var ch = string.charCodeAt(i);\n if (ch === char1 || ch === char2) return true;\n }\n return false;\n}\n\n//Makes an array of 128 uint8's which represent boolean values.\n//Spec is an array of ascii code points or ascii code point ranges\n//ranges are expressed as [start, end]\n\n//Create a table with the characters 0x30-0x39 (decimals '0' - '9') and\n//0x7A (lowercaseletter 'z') as `true`:\n//\n//var a = makeAsciiTable([[0x30, 0x39], 0x7A]);\n//a[0x30]; //1\n//a[0x15]; //0\n//a[0x35]; //1\nfunction makeAsciiTable(spec) {\n var ret = new Uint8Array(128);\n spec.forEach(function(item){\n if (typeof item === \"number\") {\n ret[item] = 1;\n }\n else {\n var start = item[0];\n var end = item[1];\n for (var j = start; j <= end; ++j) {\n ret[j] = 1;\n }\n }\n });\n\n return ret;\n}\n\n\nvar autoEscape = [\"<\", \">\", \"\\\"\", \"`\", \" \", \"\\r\", \"\\n\",\n \"\\t\", \"{\", \"}\", \"|\", \"\\\\\", \"^\", \"`\", \"'\"];\n\nvar autoEscapeMap = new Array(128);\n\n\n\nfor (var i = 0, len = autoEscapeMap.length; i < len; ++i) {\n autoEscapeMap[i] = \"\";\n}\n\nfor (var i = 0, len = autoEscape.length; i < len; ++i) {\n var c = autoEscape[i];\n var esc = encodeURIComponent(c);\n if (esc === c) {\n esc = escape(c);\n }\n autoEscapeMap[c.charCodeAt(0)] = esc;\n}\nvar afterQueryAutoEscapeMap = autoEscapeMap.slice();\nautoEscapeMap[0x5C /*'\\'*/] = \"/\";\n\nvar slashProtocols = Url.prototype._slashProtocols = {\n http: true,\n https: true,\n gopher: true,\n file: true,\n ftp: true,\n\n \"http:\": true,\n \"https:\": true,\n \"gopher:\": true,\n \"file:\": true,\n \"ftp:\": true\n};\n\n//Optimize back from normalized object caused by non-identifier keys\nfunction f(){}\nf.prototype = slashProtocols;\n\nUrl.prototype._protocolCharacters = makeAsciiTable([\n [0x61 /*'a'*/, 0x7A /*'z'*/],\n [0x41 /*'A'*/, 0x5A /*'Z'*/],\n 0x2E /*'.'*/, 0x2B /*'+'*/, 0x2D /*'-'*/\n]);\n\nUrl.prototype._hostEndingCharacters = makeAsciiTable([\n 0x23 /*'#'*/, 0x3F /*'?'*/, 0x2F /*'/'*/, 0x5C /*'\\'*/\n]);\n\nUrl.prototype._autoEscapeCharacters = makeAsciiTable(\n autoEscape.map(function(v) {\n return v.charCodeAt(0);\n })\n);\n\n//If these characters end a host name, the path will not be prepended a /\nUrl.prototype._noPrependSlashHostEnders = makeAsciiTable(\n [\n \"<\", \">\", \"'\", \"`\", \" \", \"\\r\",\n \"\\n\", \"\\t\", \"{\", \"}\", \"|\",\n \"^\", \"`\", \"\\\"\", \"%\", \";\"\n ].map(function(v) {\n return v.charCodeAt(0);\n })\n);\n\nUrl.prototype._autoEscapeMap = autoEscapeMap;\nUrl.prototype._afterQueryAutoEscapeMap = afterQueryAutoEscapeMap;","import decodeArrayToString from '../array/decode-to-string.js'\nimport pathUtil from '../path.js'\nimport urlUtil from '../url.js'\nimport Promise from 'bluebird'\n\n// constants\nvar IS_URL = new RegExp('^http:\\\\/\\\\/.*$|^https:\\\\/\\\\/.*$')\n\n// configs\n\nvar HEADER_BYTE_LENGTH = 16\nvar MAGIC_NUMBER = 0x41443344 // AD3D encoded as ASCII characters in hex\nvar VERSION = 1\nvar TEXTURE_PATH_KEYS = [\n // source\n 'mapDiffuseSource',\n 'mapSpecularSource',\n 'mapNormalSource',\n 'mapAlphaSource',\n 'mapLightSource',\n // hi-res\n 'mapDiffuse',\n 'mapSpecular',\n 'mapNormal',\n 'mapAlpha',\n 'mapLight',\n // preview\n 'mapDiffusePreview',\n 'mapSpecularPreview',\n 'mapNormalPreview',\n 'mapAlphaPreview',\n 'mapLightPreview'\n]\n\n// public methods\n\nexport default function decodeBinary (buffer, options) {\n\n // API\n options = options || {}\n var url = options.url\n\n var parsedUrl, rootDir, origin\n\n if (url) {\n parsedUrl = urlUtil.parse(url)\n rootDir = pathUtil.parse(parsedUrl.path || parsedUrl.pathname || '').dir\n origin = parsedUrl.protocol + '//' + parsedUrl.host\n }\n\n // check buffer type\n if (!buffer) {\n return Promise.reject('Missing buffer parameter.')\n } else if (typeof Buffer !== 'undefined' && buffer instanceof Buffer) {\n // convert node buffer to arrayBuffer\n buffer = buffer.buffer.slice(buffer.byteOffset, buffer.byteOffset + buffer.byteLength)\n }\n\n // internals\n var headerArray = new Int32Array(buffer, 0, HEADER_BYTE_LENGTH / 4)\n var magicNumber = headerArray[0]\n var version = headerArray[1]\n var structureByteLength = headerArray[2]\n var payloadByteLength = headerArray[3]\n var expectedFileByteLength = HEADER_BYTE_LENGTH + structureByteLength + payloadByteLength\n\n // validation warnings\n\n if (magicNumber !== MAGIC_NUMBER) {\n console.error('File header error: Wrong magic number. File is probably not data3d buffer format.')\n }\n if (version !== VERSION) {\n console.error('File header error: Wrong version number: ' + version + '. Parser supports version: ' + VERSION)\n }\n\n // validation errors\n\n if (buffer.byteLength !== expectedFileByteLength) {\n var errorMessage = 'Can not parse Data3d buffer. Wrong buffer size: ' + buffer.byteLength + ' Expected: ' + expectedFileByteLength\n console.error(errorMessage)\n return Promise.reject(errorMessage)\n }\n\n // parse structure info\n\n var structureArray = new Uint16Array(buffer, HEADER_BYTE_LENGTH, structureByteLength / 2)\n var structureString = decodeArrayToString.utf16(structureArray)\n var structure\n try {\n structure = JSON.parse(structureString)\n } catch (e) {\n return Promise.reject(e)\n }\n\n\n // add geometry arrays to data3d\n\n var payloadByteOffset = HEADER_BYTE_LENGTH + structureByteLength\n traverseData3d(structure.data3d, function (data3d) {\n\n // map typed arrays to payload area in file buffer\n mapArraysToBuffer(data3d, buffer, payloadByteOffset, url)\n\n // convert relative material keys into absolute one\n if (origin && data3d.materials) convertTextureKeys(data3d, origin, rootDir)\n\n })\n\n return Promise.resolve(structure.data3d)\n\n}\n\nfunction convertTextureKeys (data3d, origin, rootDir) {\n\n var i, l, i2, l2, m, materialKeys = data3d.materialKeys || Object.keys(data3d.materials || {}), texturePathKey\n\n for (i = 0, l = materialKeys.length; i < l; i++) {\n m = data3d.materials[materialKeys[i]]\n\n // hi-res textures\n for (i2 = 0, l2 = TEXTURE_PATH_KEYS.length; i2 < l2; i2++) {\n texturePathKey = TEXTURE_PATH_KEYS[i2]\n\n if (m[texturePathKey]) {\n if (IS_URL.test(m[texturePathKey])) {\n // is full URL already\n m[texturePathKey] = m[texturePathKey]\n } else if (m[texturePathKey].substring(0,5) === '/http') {\n // FIXME: prevent leading slashes being added to absolute paths\n m[texturePathKey] = m[texturePathKey].substring(1)\n } else if (m[texturePathKey][0] === '/') {\n // absolute path\n m[texturePathKey] = origin + m[texturePathKey]\n } else {\n // relative path\n m[texturePathKey] = origin + rootDir +'/'+ m[texturePathKey]\n }\n }\n }\n\n }\n\n}\n\nfunction mapArraysToBuffer (data3d, buffer, payloadByteOffset, url) {\n\n var mesh, i, l, meshKeys = data3d.meshKeys || Object.keys(data3d.meshes || {})\n\n for (i = 0, l = meshKeys.length; i < l; i++) {\n mesh = data3d.meshes[meshKeys[i]]\n\n // map arrays to meshes\n if (mesh.positionsOffset !== undefined && mesh.positionsLength !== undefined) {\n mesh.positions = new Float32Array(buffer, payloadByteOffset + mesh.positionsOffset * 4, mesh.positionsLength)\n delete mesh.positionsOffset\n delete mesh.positionsLength\n }\n if (mesh.normalsOffset !== undefined && mesh.normalsLength !== undefined) {\n mesh.normals = new Float32Array(buffer, payloadByteOffset + mesh.normalsOffset * 4, mesh.normalsLength)\n delete mesh.normalsOffset\n delete mesh.normalsLength\n }\n if (mesh.uvsOffset !== undefined && mesh.uvsLength !== undefined) {\n mesh.uvs = new Float32Array(buffer, payloadByteOffset + mesh.uvsOffset * 4, mesh.uvsLength)\n delete mesh.uvsOffset\n delete mesh.uvsLength\n }\n if (mesh.uvsLightmapOffset !== undefined && mesh.uvsLightmapLength !== undefined) {\n mesh.uvsLightmap = new Float32Array(buffer, payloadByteOffset + mesh.uvsLightmapOffset * 4, mesh.uvsLightmapLength)\n delete mesh.uvsLightmapOffset\n delete mesh.uvsLightmapLength\n }\n\n // add cache key\n if (url) mesh.cacheKey = url + ':' + meshKeys[i]\n\n }\n\n}\n\nfunction traverseData3d (data3d, callback) {\n\n callback(data3d)\n\n if (data3d.children) {\n for (var i = 0, l = data3d.children.length; i < l; i++) {\n traverseData3d(data3d.children[i], callback)\n }\n }\n\n}","import fetch from '../io/fetch.js'\nimport decodeBinary from './decode-binary.js'\nimport PromiseCache from '../promise-cache.js'\n\n// private shared\n\nvar cache = new PromiseCache()\n\n// main\n\nexport default function loadData3d (url, options) {\n\n // prevent loading of unsupported formats\n if (url.indexOf('data3d.buffer') < 0) return Promise.reject(url + ' no data3d')\n // try cache\n var cacheKey = url\n var promiseFromCache = cache.get(cacheKey)\n if (promiseFromCache) return promiseFromCache\n\n // fetch\n var promise = fetch(url, options).then(function(res){\n return res.arrayBuffer()\n }).then(function(buffer){\n return decodeBinary(buffer, { url: url })\n })\n\n // add to cache\n cache.add(cacheKey, promise)\n\n return promise\n\n}\n","'use strict';\n\n// dependencies\n\nimport Promise from 'bluebird'\nimport getSchema from './common/get-schema.js'\nimport getMaterial from './common/get-material.js'\nimport updateSchema from './common/update-schema.js'\nimport generateNormals from '../../../utils/data3d/buffer/get-normals'\nimport generateUvs from '../../../utils/data3d/buffer/get-uvs'\nimport loadData3d from '../../../utils/data3d/load'\nimport cloneDeep from 'lodash/cloneDeep'\n\nexport default {\n\n schema: getSchema('kitchen'),\n\n init: function () {},\n\n updateSchema: updateSchema,\n\n update: function (oldData) {\n var this_ = this\n var data = this_.data\n\n // remove old mesh\n this.remove()\n\n // get defaults and\n this_.attributes = cloneDeep(data)\n\n // setup materials\n // defaults\n this_.materials = {\n kitchen: 'cabinet_paint_white',\n counter: 'counter_granite_black',\n tab: 'chrome',\n oven: 'oven_miele_60-60',\n cooktop: 'cooktop_westinghouse_60',\n microwave: 'microwave_samsung',\n chrome: 'chrome',\n black_metal: {\n \"specularCoef\": 24,\n \"colorDiffuse\": [0.02, 0.02, 0.02],\n \"colorSpecular\": [0.7, 0.7, 0.7]\n }\n }\n\n // get meshes and materials\n // promised base because it loads external meshes\n this.generateMeshes3d()\n .then(function(meshes) {\n\n // clean up empty meshes to prevent errors\n var meshKeys = Object.keys(meshes)\n meshKeys.forEach(function(key) {\n if (!meshes[key].positions || !meshes[key].positions.length) {\n // console.warn('no vertices for mesh', key)\n delete meshes[key]\n }\n })\n\n // check for adapted materials\n var materialKeys = Object.keys(data).filter(function(key) {\n return key.indexOf('material_') > -1\n })\n // add materials to instance\n materialKeys.forEach(function(key) {\n var mesh = key.replace('material_', '')\n this_.materials[mesh] = data[key]\n })\n\n // fetch materials from mat library\n Object.keys(this_.materials).forEach(function(mat) {\n this_.materials[mat] = getMaterial(this_.materials[mat])\n })\n\n // construct data3d object\n var data3d = {\n meshes: meshes,\n materials: this_.materials\n }\n\n // create new one\n this_.mesh = new THREE.Object3D()\n this_.data3dView = new io3d.aFrame.three.Data3dView({parent: this_.mesh})\n\n // update view\n this_.data3dView.set(data3d)\n this_.el.setObject3D('mesh', this_.mesh)\n // emit event\n this_.el.emit('mesh-updated');\n })\n },\n\n remove: function () {\n if (this.data3dView) {\n this.data3dView.destroy()\n this.data3dView = null\n }\n if (this.mesh) {\n this.el.removeObject3D('mesh')\n this.mesh = null\n }\n },\n\n generateMeshes3d: function () {\n var a = this.attributes\n\n // external meshes\n\n var externalMeshes = {\n singleSink: 'https://storage.3d.io/535e624259ee6b0200000484/170429-0355-60hukz/bf4e4a56-ed95-4b58-a214-4b1a0a84ae0e.gz.data3d.buffer',\n doubleSink: 'https://storage.3d.io/535e624259ee6b0200000484/170429-2156-7ufbnv/df481313-8fb4-48da-bc28-0369b08a2c6a.gz.data3d.buffer',\n gas60: 'https://storage.3d.io/535e624259ee6b0200000484/170428-2318-1ayck9/ece0ead0-d27f-4cf9-b137-2021f25ad4ee.gz.data3d.buffer',\n gas90: 'https://storage.3d.io/535e624259ee6b0200000484/170429-0114-jxswhr/523bb9dc-0103-4c93-aba8-ad0882123550.gz.data3d.buffer',\n fridge: 'https://storage.3d.io/535e624259ee6b0200000484/170429-1020-5zimgz/4cec6215-9d5c-4f38-b714-e62fdab6d892.gz.data3d.buffer'\n }\n\n // internals\n var\n fridgeHeight = 1.95,\n sinkWidth = 0.47,\n barCounter = 0.25,\n sink = a.sinkType !== 'none',\n oven = a.ovenType !== 'none',\n cooktop = a.cooktopType !== 'none',\n microwave = a.microwave,\n largeCooktop = cooktop && a.cooktopType.slice(-2) === '90',\n cabinetType = a.cabinetType\n\n // config\n var\n ovenDistance = 0.02,\n extractorHeight = 0.04,\n extractorPyramid = largeCooktop ? 0.18 : 0.12,\n extractorBottom = a.wallCabinetHeight + 0.1,\n extractorWidth = 0.50,\n microwaveHeight = 0.33,\n ovenHeight = largeCooktop && a.ovenPos === a.cooktopPos ? 0.48 : 0.6,\n offsetY = -0.01,\n minWallCabinet = 0.3,\n cabinetSegments = [\n [a.baseBoard, 0.7, 1.9, a.h + offsetY], // 0 High Cabinet\n [a.baseBoard, 0.7, 1.30, 1.9, a.h + offsetY], // 1 High Cabinet Oven\n [a.baseBoard, 0.4, 0.7, a.counterHeight - a.counterThickness], // 2 Base Cabinet 3 Drawers\n [a.baseBoard, 0.7, a.counterHeight - a.counterThickness], // 3 Base Cabinet 2 Drawers\n [a.baseBoard, a.counterHeight - a.counterThickness - ovenHeight, a.counterHeight - a.counterThickness], // 4 Base Cabinet Oven\n [a.wallCabinetHeight, a.h + offsetY], // 5 Wall Cabinet\n [a.wallCabinetHeight, a.wallCabinetHeight + microwaveHeight, a.h + offsetY] , // 6 Wall Cabinet Microwave\n [a.baseBoard + fridgeHeight, a.h + offsetY], // 7 High Cabinet Fridge\n [a.baseBoard, 0.7, 1.9 - microwaveHeight, 1.9, a.h + offsetY], // 8 High Cabinet Microwave\n [a.baseBoard, 0.7, 1.30, 1.9, 1.9 + microwaveHeight, a.h + offsetY], // 9 High Cabinet Oven Microwave\n ],\n elementLength = a.elementLength,\n i,\n elementNum, elements = []\n\n ///////////////////\n // INPUT VALIDATION\n ///////////////////\n\n // prevent invalid input\n if (a.highCabinetLeft < 0) a.highCabinetLeft = 0\n if (a.highCabinetRight < 0) a.highCabinetRight = 0\n if (a.fridgePos <= 0) a.fridgePos = 1\n\n // validate and adapt materials\n if (a.ovenPos === a.cooktopPos && typeof this.materials.oven === 'string') {\n if (largeCooktop && this.materials.oven.indexOf('_60') > -1) this.materials['oven'] = 'oven_miele_90-48'\n if (!largeCooktop && this.materials.oven.indexOf('_90') > -1) this.materials['oven'] = 'oven_miele_60-60'\n }\n if (typeof this.materials.cooktop === 'string') {\n if (largeCooktop && this.materials.cooktop.indexOf('_60') > -1) this.materials['cooktop'] = 'cooktop_westinghouse_90'\n if (!largeCooktop && this.materials.cooktop.indexOf('_90') > -1) this.materials['cooktop'] = 'cooktop_westinghouse_60'\n }\n\n // prevent bar counter with high cabinets\n if ((a.highCabinetLeft || a.highCabinetRight) && a.barCounter) a.barCounter = false\n // prevent integrated extractor when there is no wall cabinet\n if (!a.wallCabinet && a.extractorType === 'integrated') a.extractorType = 'box'\n\n elementNum = getElCount(a).elementNum\n var remainder = getElCount(a).remainder\n\n // check if fridge fits\n if (a.fridge && a.highCabinetLeft < a.fridgePos + 1) {\n console.log(elementNum - a.highCabinetRight - 1)\n if (a.fridgePos < elementNum - a.highCabinetRight - 1 ) a.highCabinetLeft = a.fridgePos + 1\n else a.fridgePos = a.highCabinetLeft - 1\n\n }\n\n // convert 90 cooktop to 60 if is space is too small\n if (cooktop && a.cooktopPos >= elementNum - a.highCabinetRight && a.cooktopType.slice(-2) === '90') {\n console.log('Large cooktop does not fit')\n a.cooktopType = a.cooktopType.substring(0, a.cooktopType.length - 2) + '60'\n elementNum = getElCount(a).elementNum\n remainder = getElCount(a).remainder\n }\n\n elements = updatePositions(a, {elementNum: elementNum, remainder: remainder})\n\n // validate positions\n var\n cLeft = a.highCabinetLeft,\n cRight = elementNum - a.highCabinetRight,\n baseCabinets = cRight - cLeft - (remainder > 0 ? 1 : 0),\n openPositions = []\n\n for (i = cLeft; i < cRight; i++) {\n if ((!cooktop || i !== a.cooktopPos - 1) && (!sink || i !== a.sinkPos - 1) && elements[i] >= elementLength) openPositions.push(i)\n }\n\n if (!baseCabinets) {\n a.sinkType = 'none'\n a.cooktopType = 'none'\n }\n\n if (a.highCabinetLeft && a.highCabinetRight + a.highCabinetLeft > elementNum) a.highCabinetLeft -= 1\n else if (a.highCabinetRight * elementLength > a.l) a.highCabinetRight -= 1\n\n // try to place out of scope elements\n if (openPositions.length > 0) {\n if (cooktop && a.cooktopPos <= cLeft) a.cooktopPos = openPositions[0] + 1\n if (cooktop && a.cooktopPos > cRight) a.cooktopPos = openPositions[openPositions.length - 1] + 1\n\n if (sink && a.sinkPos <= cLeft) a.sinkPos = openPositions[0] + 1\n if (sink && a.sinkPos > cRight) a.sinkPos = openPositions[openPositions.length - 1] + 1\n }\n\n if (oven && a.ovenType === 'double' && a.ovenPos > cLeft && a.ovenPos < cRight) a.ovenType = 'single'\n if (oven && sink && a.ovenPos === a.sinkPos) a.ovenPos -= 1\n if (oven && a.ovenPos <= 0) a.ovenPos = cLeft + 1\n if (oven && a.ovenPos > elementNum) a.ovenPos = cRight - 1\n\n // prevent placement in small cabinet\n if (cooktop && elements[a.cooktopPos - 1] < elementLength) a.cooktopPos -= 1\n if (sink && elements[a.sinkPos - 1] < elementLength) a.sinkPos -= 1\n if (sink && a.sinkType === 'double' && elements[a.sinkPos] < elementLength) a.sinkType = 'single'\n if (oven && elements[a.ovenPos - 1] < elementLength) {\n if (a.highCabinetRight > 0) a.ovenPos += 1\n else a.ovenPos -=1\n }\n if (microwave && elements[a.microwavePos - 1] < elementLength) a.microwavePos -= 1\n\n // prevent collision\n if (sink && a.sinkType === 'double' && cooktop && a.sinkPos + 1 === a.cooktopPos) a.sinkType = 'single'\n if (sink && cooktop && a.sinkPos === a.cooktopPos && openPositions.length > 0) {\n if (openPositions.length > 1 && openPositions[openPositions.length - 1] + 1 === a.sinkPos) a.sinkPos = openPositions[0] + 1\n else a.sinkPos = openPositions[openPositions.length - 1] + 1\n }\n\n // deactivate elements\n if (sink && cooktop && a.sinkPos === a.cooktopPos) a.sinkType = 'none'\n if (a.sinkPos <= cLeft || a.sinkPos > cRight) a.sinkType = 'none'\n if (a.cooktopType <= cLeft || a.cooktopType > cRight) a.cooktopType = 'none'\n\n elements = updatePositions(a, {elementNum: elementNum, remainder: remainder})\n\n // get x coordinate for element index\n function getElementPos(pos) {\n var l = 0\n for (var i = 0; i < pos - 1; i++) { l += elements[i] }\n return l\n }\n\n sink = a.sinkType !== 'none'\n oven = a.ovenType !== 'none'\n cooktop = a.cooktopType !== 'none'\n\n var\n sinkLength = a.sinkType === 'single' ? 0.54 : 1.16,\n sinkOffset = a.sinkType === 'single' ? 0.03 : 0.02,\n extractor = a.extractorType !== 'none',\n xCursor = 0, xCursorRight = 0,\n baseCabinetNum = elementNum - a.highCabinetLeft - a.highCabinetRight,\n\n // internals\n k = 0,\n kitchenVertices = [],\n kvPos = 0,\n counterVertices = [],\n cvPos = 0,\n extractorVertices = [],\n evPos = 0,\n ovenVertices = [],\n ovPos = 0,\n ovenUvs = [],\n ovUvPos = 0,\n cooktopVertices = [],\n cooktopUvs = [],\n mwVertices = [],\n mwUvs = [],\n aX,aY,aZ,bY,cX,eX,eY,eZ,fY,gX,iX, iY, iZ, jY, jZ, kX, mX, mY, mZ, nY, nZ, oX, qZ\n\n ///////////////////\n // GEOMETRY FUNCTIONS\n //////////////////\n\n function cabinetDoor(params) {\n\n ///////////////////\n // CABINET DOORS\n //////////////////\n\n var minCabinet = 0.1\n var minCabinetFrame = 0.15\n var isFlat = cabinetType === 'flat'\n\n // FRONT VIEW VERTICES\n //\n // A----------C I----------K\n // |E\\I----G\\K| | M------O |\n // | | | | | | Q S | |\n // | | | | | | R T | |\n // |F\\J----H\\L| | N------P |\n // B----------D J----------L\n // U----------V\n\n // __\n // style 1 _| \\__\n //\n // _ __\n // style 2 |_/\n\n var outerZOffset = cabinetType === 'style1' ? 0.01 : cabinetType === 'style2' ? -0.01 : a.doorWidth\n var outerOffset = cabinetType === 'style1' ? 0.04 : cabinetType === 'style2' ? 0.005 : 0\n var innerZOffset = cabinetType === 'style1' ? -0.01 : cabinetType === 'style2' ? 0.02 : 0\n var innerOffset = cabinetType === 'style1' ? 0.015 : cabinetType === 'style2' ? 0.03 : 0\n\n aX = params.aX\n aY = params.aY\n aZ = params.aZ\n bY = params.bY\n cX = params.cX\n eY = aY - a.doorWidth / 2\n iZ = aZ + outerZOffset\n fY = bY + a.doorWidth / 2\n\n // prevent messed up polygons\n if (aY <= bY || cX <= aX ) return\n\n mX = eX + outerOffset\n mY = eY - outerOffset\n nY = fY + outerOffset\n oX = gX - outerOffset\n var qX = mX + innerOffset\n var qY = mY - innerOffset\n qZ = iZ + innerZOffset\n var rY = nY + innerOffset\n var sX = oX - innerOffset\n\n // ADD BASEBOARD FOR LOWEST TILE\n if (params.i === 0) {\n //B\n kitchenVertices[kvPos] = kitchenVertices[kvPos + 9] = aX\n kitchenVertices[kvPos + 1] = kitchenVertices[kvPos + 10] = a.baseBoard\n kitchenVertices[kvPos + 2] = kitchenVertices[kvPos + 11] = aZ\n //U\n kitchenVertices[kvPos + 3] = aX\n kitchenVertices[kvPos + 4] = 0\n kitchenVertices[kvPos + 5] = aZ\n //V\n kitchenVertices[kvPos + 6] = kitchenVertices[kvPos + 12] = cX\n kitchenVertices[kvPos + 7] = kitchenVertices[kvPos + 13] = 0\n kitchenVertices[kvPos + 8] = kitchenVertices[kvPos + 14] = aZ\n //D\n kitchenVertices[kvPos + 15] = cX\n kitchenVertices[kvPos + 16] = a.baseBoard\n kitchenVertices[kvPos + 17] = aZ\n\n kvPos = kvPos + 18\n }\n\n // if the gap is too small we'll put a simple placeholder\n if (cX - aX < minCabinet || aY - bY < minCabinet) {\n // PLACE HOLDER\n //A\n kitchenVertices[kvPos] = kitchenVertices[kvPos + 9] = aX\n kitchenVertices[kvPos + 1] = kitchenVertices[kvPos + 10] = aY\n kitchenVertices[kvPos + 2] = kitchenVertices[kvPos + 11] = aZ\n //B\n kitchenVertices[kvPos + 3] = aX\n kitchenVertices[kvPos + 4] = bY\n kitchenVertices[kvPos + 5] = aZ\n //D\n kitchenVertices[kvPos + 6] = kitchenVertices[kvPos + 12] = cX\n kitchenVertices[kvPos + 7] = kitchenVertices[kvPos + 13] = bY\n kitchenVertices[kvPos + 8] = kitchenVertices[kvPos + 14] = aZ\n //C\n kitchenVertices[kvPos + 15] = cX\n kitchenVertices[kvPos + 16] = aY\n kitchenVertices[kvPos + 17] = aZ\n\n kvPos = kvPos + 18\n\n return\n }\n\n var showMicroWave = false, showOven = false\n if ( microwave && c + 1 === a.microwavePos ) {\n if (params.k === 6 && params.i === 0) showMicroWave = true\n else if (params.k === 8 && params.i === 2) showMicroWave = true\n else if (params.k === 9 && params.i === 3) showMicroWave = true\n }\n if ( oven && c + 1 === a.ovenPos ) {\n if (params.k === 1 && (params.i === 1 || (params.i === 2 && a.ovenType === 'double'))) showOven = true\n else if (params.k === 4 || params.k === 9) {\n if (params.i === 1 || (params.i === 2 && a.ovenType === 'double')) showOven = true\n }\n }\n // if (oven && c + 1 === a.ovenPos && a.ovenType === 'double') console.log('double oven', params.k, params.i, a.ovenType)\n // if (showMicroWave) console.log('showMicroWav', params.k, params.i)\n // if (showOven) console.log('showOven', params.k, params.i, a.ovenType)\n\n // DOOR FRAME\n //A\n kitchenVertices[kvPos] = kitchenVertices[kvPos + 9] = aX\n kitchenVertices[kvPos + 1] = kitchenVertices[kvPos + 10] = aY\n kitchenVertices[kvPos + 2] = kitchenVertices[kvPos + 11] = aZ\n //B\n kitchenVertices[kvPos + 3] = aX\n kitchenVertices[kvPos + 4] = bY\n kitchenVertices[kvPos + 5] = aZ\n //F\n kitchenVertices[kvPos + 6] = kitchenVertices[kvPos + 12] = eX\n kitchenVertices[kvPos + 7] = kitchenVertices[kvPos + 13] = fY\n kitchenVertices[kvPos + 8] = kitchenVertices[kvPos + 14] = aZ\n //E\n kitchenVertices[kvPos + 15] = eX\n kitchenVertices[kvPos + 16] = eY\n kitchenVertices[kvPos + 17] = aZ\n\n kvPos = kvPos + 18\n\n //F\n kitchenVertices[kvPos] = kitchenVertices[kvPos + 9] = eX\n kitchenVertices[kvPos + 1] = kitchenVertices[kvPos + 10] = fY\n kitchenVertices[kvPos + 2] = kitchenVertices[kvPos + 11] = aZ\n //B\n kitchenVertices[kvPos + 3] = aX\n kitchenVertices[kvPos + 4] = bY\n kitchenVertices[kvPos + 5] = aZ\n //D\n kitchenVertices[kvPos + 6] = kitchenVertices[kvPos + 12] = cX\n kitchenVertices[kvPos + 7] = kitchenVertices[kvPos + 13] = bY\n kitchenVertices[kvPos + 8] = kitchenVertices[kvPos + 14] = aZ\n //H\n kitchenVertices[kvPos + 15] = gX\n kitchenVertices[kvPos + 16] = fY\n kitchenVertices[kvPos + 17] = aZ\n\n kvPos = kvPos + 18\n\n //G\n kitchenVertices[kvPos] = kitchenVertices[kvPos + 9] = gX\n kitchenVertices[kvPos + 1] = kitchenVertices[kvPos + 10] = eY\n kitchenVertices[kvPos + 2] = kitchenVertices[kvPos + 11] = aZ\n //H\n kitchenVertices[kvPos + 3] = gX\n kitchenVertices[kvPos + 4] = fY\n kitchenVertices[kvPos + 5] = aZ\n //D\n kitchenVertices[kvPos + 6] = kitchenVertices[kvPos + 12] = cX\n kitchenVertices[kvPos + 7] = kitchenVertices[kvPos + 13] = bY\n kitchenVertices[kvPos + 8] = kitchenVertices[kvPos + 14] = aZ\n //C\n kitchenVertices[kvPos + 15] = cX\n kitchenVertices[kvPos + 16] = aY\n kitchenVertices[kvPos + 17] = aZ\n\n kvPos = kvPos + 18\n\n //A\n kitchenVertices[kvPos] = kitchenVertices[kvPos + 9] = aX\n kitchenVertices[kvPos + 1] = kitchenVertices[kvPos + 10] = aY\n kitchenVertices[kvPos + 2] = kitchenVertices[kvPos + 11] = aZ\n //E\n kitchenVertices[kvPos + 3] = eX\n kitchenVertices[kvPos + 4] = eY\n kitchenVertices[kvPos + 5] = aZ\n //G\n kitchenVertices[kvPos + 6] = kitchenVertices[kvPos + 12] = gX\n kitchenVertices[kvPos + 7] = kitchenVertices[kvPos + 13] = eY\n kitchenVertices[kvPos + 8] = kitchenVertices[kvPos + 14] = aZ\n //C\n kitchenVertices[kvPos + 15] = cX\n kitchenVertices[kvPos + 16] = aY\n kitchenVertices[kvPos + 17] = aZ\n\n kvPos = kvPos + 18\n\n // DOOR LEAF SIDES\n\n //E\n kitchenVertices[kvPos] = kitchenVertices[kvPos + 9] = eX\n kitchenVertices[kvPos + 1] = kitchenVertices[kvPos + 10] = eY\n kitchenVertices[kvPos + 2] = kitchenVertices[kvPos + 11] = aZ\n //F\n kitchenVertices[kvPos + 3] = eX\n kitchenVertices[kvPos + 4] = fY\n kitchenVertices[kvPos + 5] = aZ\n //J\n kitchenVertices[kvPos + 6] = kitchenVertices[kvPos + 12] = eX\n kitchenVertices[kvPos + 7] = kitchenVertices[kvPos + 13] = fY\n kitchenVertices[kvPos + 8] = kitchenVertices[kvPos + 14] = iZ\n //I\n kitchenVertices[kvPos + 15] = eX\n kitchenVertices[kvPos + 16] = eY\n kitchenVertices[kvPos + 17] = iZ\n\n kvPos = kvPos + 18\n\n //J\n kitchenVertices[kvPos] = kitchenVertices[kvPos + 9] = eX\n kitchenVertices[kvPos + 1] = kitchenVertices[kvPos + 10] = fY\n kitchenVertices[kvPos + 2] = kitchenVertices[kvPos + 11] = iZ\n //F\n kitchenVertices[kvPos + 3] = eX\n kitchenVertices[kvPos + 4] = fY\n kitchenVertices[kvPos + 5] = aZ\n //H\n kitchenVertices[kvPos + 6] = kitchenVertices[kvPos + 12] = gX\n kitchenVertices[kvPos + 7] = kitchenVertices[kvPos + 13] = fY\n kitchenVertices[kvPos + 8] = kitchenVertices[kvPos + 14] = aZ\n //L\n kitchenVertices[kvPos + 15] = gX\n kitchenVertices[kvPos + 16] = fY\n kitchenVertices[kvPos + 17] = iZ\n\n kvPos = kvPos + 18\n\n //K\n kitchenVertices[kvPos] = kitchenVertices[kvPos + 9] = gX\n kitchenVertices[kvPos + 1] = kitchenVertices[kvPos + 10] = eY\n kitchenVertices[kvPos + 2] = kitchenVertices[kvPos + 11] = iZ\n //L\n kitchenVertices[kvPos + 3] = gX\n kitchenVertices[kvPos + 4] = fY\n kitchenVertices[kvPos + 5] = iZ\n //H\n kitchenVertices[kvPos + 6] = kitchenVertices[kvPos + 12] = gX\n kitchenVertices[kvPos + 7] = kitchenVertices[kvPos + 13] = fY\n kitchenVertices[kvPos + 8] = kitchenVertices[kvPos + 14] = aZ\n //G\n kitchenVertices[kvPos + 15] = gX\n kitchenVertices[kvPos + 16] = eY\n kitchenVertices[kvPos + 17] = aZ\n\n kvPos = kvPos + 18\n\n //E\n kitchenVertices[kvPos] = kitchenVertices[kvPos + 9] = eX\n kitchenVertices[kvPos + 1] = kitchenVertices[kvPos + 10] = eY\n kitchenVertices[kvPos + 2] = kitchenVertices[kvPos + 11] = aZ\n //I\n kitchenVertices[kvPos + 3] = eX\n kitchenVertices[kvPos + 4] = eY\n kitchenVertices[kvPos + 5] = iZ\n //K\n kitchenVertices[kvPos + 6] = kitchenVertices[kvPos + 12] = gX\n kitchenVertices[kvPos + 7] = kitchenVertices[kvPos + 13] = eY\n kitchenVertices[kvPos + 8] = kitchenVertices[kvPos + 14] = iZ\n //G\n kitchenVertices[kvPos + 15] = gX\n kitchenVertices[kvPos + 16] = eY\n kitchenVertices[kvPos + 17] = aZ\n\n kvPos = kvPos + 18\n\n // DOOR LEAF FRONT\n if ( showOven ) {\n\n // oven front\n\n //I\n ovenVertices[ovPos] = ovenVertices[ovPos + 9] = eX\n ovenVertices[ovPos + 1] = ovenVertices[ovPos + 10] = eY\n ovenVertices[ovPos + 2] = ovenVertices[ovPos + 11] = iZ\n //J\n ovenVertices[ovPos + 3] = eX\n ovenVertices[ovPos + 4] = fY\n ovenVertices[ovPos + 5] = iZ\n //L\n ovenVertices[ovPos + 6] = ovenVertices[ovPos + 12] = gX\n ovenVertices[ovPos + 7] = ovenVertices[ovPos + 13] = fY\n ovenVertices[ovPos + 8] = ovenVertices[ovPos + 14] = iZ\n //K\n ovenVertices[ovPos + 15] = gX\n ovenVertices[ovPos + 16] = eY\n ovenVertices[ovPos + 17] = iZ\n\n ovPos = ovPos + 18\n\n //I\n ovenUvs [ovUvPos] = ovenUvs [ovUvPos + 6] = 0\n ovenUvs [ovUvPos + 1] = ovenUvs [ovUvPos + 7] = 1\n //J\n ovenUvs [ovUvPos + 2] = 0\n ovenUvs [ovUvPos + 3] = 0 //0.5\n //L\n ovenUvs [ovUvPos + 4] = ovenUvs [ovUvPos + 8] = 1\n ovenUvs [ovUvPos + 5] = ovenUvs [ovUvPos + 9] = 0 //0.5\n //K\n ovenUvs [ovUvPos + 10] = 1\n ovenUvs [ovUvPos + 11] = 1\n\n ovUvPos = ovUvPos + 12\n\n\n //kvPos = kvPos+18\n\n } else if ( showMicroWave ) {\n\n // microwave front\n\n //I\n mwVertices[0] = mwVertices[9] = eX\n mwVertices[1] = mwVertices[10] = eY\n mwVertices[2] = mwVertices[11] = iZ\n //J\n mwVertices[3] = eX\n mwVertices[4] = fY\n mwVertices[5] = iZ\n //L\n mwVertices[6] = mwVertices[12] = gX\n mwVertices[7] = mwVertices[13] = fY\n mwVertices[8] = mwVertices[14] = iZ\n //K\n mwVertices[15] = gX\n mwVertices[16] = eY\n mwVertices[17] = iZ\n\n mwUvs = [0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1]\n\n\n //kvPos = kvPos+18\n\n } else {\n\n // regular front\n\n if (isFlat || cX - aX <= minCabinetFrame || aY - bY <= minCabinetFrame ){\n\n //I\n kitchenVertices[kvPos] = kitchenVertices[kvPos + 9] = eX\n kitchenVertices[kvPos + 1] = kitchenVertices[kvPos + 10] = eY\n kitchenVertices[kvPos + 2] = kitchenVertices[kvPos + 11] = iZ\n //J\n kitchenVertices[kvPos + 3] = eX\n kitchenVertices[kvPos + 4] = fY\n kitchenVertices[kvPos + 5] = iZ\n //L\n kitchenVertices[kvPos + 6] = kitchenVertices[kvPos + 12] = gX\n kitchenVertices[kvPos + 7] = kitchenVertices[kvPos + 13] = fY\n kitchenVertices[kvPos + 8] = kitchenVertices[kvPos + 14] = iZ\n //K\n kitchenVertices[kvPos + 15] = gX\n kitchenVertices[kvPos + 16] = eY\n kitchenVertices[kvPos + 17] = iZ\n\n kvPos = kvPos + 18\n\n } else {\n\n // front facing ring\n\n //I\n kitchenVertices[kvPos] = kitchenVertices[kvPos + 9] = eX\n kitchenVertices[kvPos + 1] = kitchenVertices[kvPos + 10] = eY\n kitchenVertices[kvPos + 2] = kitchenVertices[kvPos + 11] = iZ\n //J\n kitchenVertices[kvPos + 3] = eX\n kitchenVertices[kvPos + 4] = fY\n kitchenVertices[kvPos + 5] = iZ\n //N\n kitchenVertices[kvPos + 6] = kitchenVertices[kvPos + 12] = mX\n kitchenVertices[kvPos + 7] = kitchenVertices[kvPos + 13] = nY\n kitchenVertices[kvPos + 8] = kitchenVertices[kvPos + 14] = iZ\n //M\n kitchenVertices[kvPos + 15] = mX\n kitchenVertices[kvPos + 16] = mY\n kitchenVertices[kvPos + 17] = iZ\n\n kvPos = kvPos + 18\n\n //N\n kitchenVertices[kvPos] = kitchenVertices[kvPos + 9] = mX\n kitchenVertices[kvPos + 1] = kitchenVertices[kvPos + 10] = nY\n kitchenVertices[kvPos + 2] = kitchenVertices[kvPos + 11] = iZ\n //J\n kitchenVertices[kvPos + 3] = eX\n kitchenVertices[kvPos + 4] = fY\n kitchenVertices[kvPos + 5] = iZ\n //L\n kitchenVertices[kvPos + 6] = kitchenVertices[kvPos + 12] = gX\n kitchenVertices[kvPos + 7] = kitchenVertices[kvPos + 13] = fY\n kitchenVertices[kvPos + 8] = kitchenVertices[kvPos + 14] = iZ\n //P\n kitchenVertices[kvPos + 15] = oX\n kitchenVertices[kvPos + 16] = nY\n kitchenVertices[kvPos + 17] = iZ\n\n kvPos = kvPos + 18\n\n //O\n kitchenVertices[kvPos] = kitchenVertices[kvPos + 9] = oX\n kitchenVertices[kvPos + 1] = kitchenVertices[kvPos + 10] = mY\n kitchenVertices[kvPos + 2] = kitchenVertices[kvPos + 11] = iZ\n //P\n kitchenVertices[kvPos + 3] = oX\n kitchenVertices[kvPos + 4] = nY\n kitchenVertices[kvPos + 5] = iZ\n //L\n kitchenVertices[kvPos + 6] = kitchenVertices[kvPos + 12] = gX\n kitchenVertices[kvPos + 7] = kitchenVertices[kvPos + 13] = fY\n kitchenVertices[kvPos + 8] = kitchenVertices[kvPos + 14] = iZ\n //K\n kitchenVertices[kvPos + 15] = gX\n kitchenVertices[kvPos + 16] = eY\n kitchenVertices[kvPos + 17] = iZ\n\n kvPos = kvPos + 18\n\n //I\n kitchenVertices[kvPos] = kitchenVertices[kvPos + 9] = eX\n kitchenVertices[kvPos + 1] = kitchenVertices[kvPos + 10] = eY\n kitchenVertices[kvPos + 2] = kitchenVertices[kvPos + 11] = iZ\n //M\n kitchenVertices[kvPos + 3] = mX\n kitchenVertices[kvPos + 4] = mY\n kitchenVertices[kvPos + 5] = iZ\n //O\n kitchenVertices[kvPos + 6] = kitchenVertices[kvPos + 12] = oX\n kitchenVertices[kvPos + 7] = kitchenVertices[kvPos + 13] = mY\n kitchenVertices[kvPos + 8] = kitchenVertices[kvPos + 14] = iZ\n //K\n kitchenVertices[kvPos + 15] = gX\n kitchenVertices[kvPos + 16] = eY\n kitchenVertices[kvPos + 17] = iZ\n\n kvPos = kvPos + 18\n\n // inner facing ring\n\n //M\n kitchenVertices[kvPos] = kitchenVertices[kvPos + 9] = mX\n kitchenVertices[kvPos + 1] = kitchenVertices[kvPos + 10] = mY\n kitchenVertices[kvPos + 2] = kitchenVertices[kvPos + 11] = iZ\n //N\n kitchenVertices[kvPos + 3] = mX\n kitchenVertices[kvPos + 4] = nY\n kitchenVertices[kvPos + 5] = iZ\n //R\n kitchenVertices[kvPos + 6] = kitchenVertices[kvPos + 12] = qX\n kitchenVertices[kvPos + 7] = kitchenVertices[kvPos + 13] = rY\n kitchenVertices[kvPos + 8] = kitchenVertices[kvPos + 14] = qZ\n //Q\n kitchenVertices[kvPos + 15] = qX\n kitchenVertices[kvPos + 16] = qY\n kitchenVertices[kvPos + 17] = qZ\n\n kvPos = kvPos + 18\n\n //R\n kitchenVertices[kvPos] = kitchenVertices[kvPos + 9] = qX\n kitchenVertices[kvPos + 1] = kitchenVertices[kvPos + 10] = rY\n kitchenVertices[kvPos + 2] = kitchenVertices[kvPos + 11] = qZ\n //N\n kitchenVertices[kvPos + 3] = mX\n kitchenVertices[kvPos + 4] = nY\n kitchenVertices[kvPos + 5] = iZ\n //P\n kitchenVertices[kvPos + 6] = kitchenVertices[kvPos + 12] = oX\n kitchenVertices[kvPos + 7] = kitchenVertices[kvPos + 13] = nY\n kitchenVertices[kvPos + 8] = kitchenVertices[kvPos + 14] = iZ\n //T\n kitchenVertices[kvPos + 15] = sX\n kitchenVertices[kvPos + 16] = rY\n kitchenVertices[kvPos + 17] = qZ\n\n kvPos = kvPos + 18\n\n //S\n kitchenVertices[kvPos] = kitchenVertices[kvPos + 9] = sX\n kitchenVertices[kvPos + 1] = kitchenVertices[kvPos + 10] = qY\n kitchenVertices[kvPos + 2] = kitchenVertices[kvPos + 11] = qZ\n //T\n kitchenVertices[kvPos + 3] = sX\n kitchenVertices[kvPos + 4] = rY\n kitchenVertices[kvPos + 5] = qZ\n //P\n kitchenVertices[kvPos + 6] = kitchenVertices[kvPos + 12] = oX\n kitchenVertices[kvPos + 7] = kitchenVertices[kvPos + 13] = nY\n kitchenVertices[kvPos + 8] = kitchenVertices[kvPos + 14] = iZ\n //O\n kitchenVertices[kvPos + 15] = oX\n kitchenVertices[kvPos + 16] = mY\n kitchenVertices[kvPos + 17] = iZ\n\n kvPos = kvPos + 18\n\n //M\n kitchenVertices[kvPos] = kitchenVertices[kvPos + 9] = mX\n kitchenVertices[kvPos + 1] = kitchenVertices[kvPos + 10] = mY\n kitchenVertices[kvPos + 2] = kitchenVertices[kvPos + 11] = iZ\n //Q\n kitchenVertices[kvPos + 3] = qX\n kitchenVertices[kvPos + 4] = qY\n kitchenVertices[kvPos + 5] = qZ\n //S\n kitchenVertices[kvPos + 6] = kitchenVertices[kvPos + 12] = sX\n kitchenVertices[kvPos + 7] = kitchenVertices[kvPos + 13] = qY\n kitchenVertices[kvPos + 8] = kitchenVertices[kvPos + 14] = qZ\n //O\n kitchenVertices[kvPos + 15] = oX\n kitchenVertices[kvPos + 16] = mY\n kitchenVertices[kvPos + 17] = iZ\n\n kvPos = kvPos + 18\n\n // inner face\n\n //Q\n kitchenVertices[kvPos] = kitchenVertices[kvPos + 9] = qX\n kitchenVertices[kvPos + 1] = kitchenVertices[kvPos + 10] = qY\n kitchenVertices[kvPos + 2] = kitchenVertices[kvPos + 11] = qZ\n //R\n kitchenVertices[kvPos + 3] = qX\n kitchenVertices[kvPos + 4] = rY\n kitchenVertices[kvPos + 5] = qZ\n //T\n kitchenVertices[kvPos + 6] = kitchenVertices[kvPos + 12] = sX\n kitchenVertices[kvPos + 7] = kitchenVertices[kvPos + 13] = rY\n kitchenVertices[kvPos + 8] = kitchenVertices[kvPos + 14] = qZ\n //S\n kitchenVertices[kvPos + 15] = sX\n kitchenVertices[kvPos + 16] = qY\n kitchenVertices[kvPos + 17] = qZ\n\n kvPos = kvPos + 18\n }\n }\n }\n\n function genExtractor () {\n // EXTRACTOR\n // E------G\n // /| /|\n // A------C |\n // | F----|-H\n // |/ |/\n // B------D\n\n var\n isIntegrated = a.extractorType === 'integrated',\n aX = getElementPos(a.cooktopPos) + (a.wallCabinet && !isIntegrated ? 0.05 : 0 ),\n aY = extractorBottom + extractorHeight,\n aZ = a.wallCabinet && isIntegrated ? extractorWidth : a.w - 0.6 + extractorWidth,\n cX = getElementPos(a.cooktopPos + 1) - (a.wallCabinet && !isIntegrated ? 0.05 : 0 ),\n eZ = a.wallCabinet && isIntegrated ? a.wallCabinetWidth : a.w - 0.6,\n bY = extractorBottom // a.wallCabinetHeight\n\n // front\n // A\n extractorVertices[evPos] = extractorVertices[evPos + 9] = aX\n extractorVertices[evPos + 1] = extractorVertices[evPos + 10] = aY\n extractorVertices[evPos + 2] = extractorVertices[evPos + 11] = aZ\n //B\n extractorVertices[evPos + 3] = aX\n extractorVertices[evPos + 4] = bY\n extractorVertices[evPos + 5] = aZ\n //D\n extractorVertices[evPos + 6] = extractorVertices[evPos + 12] = cX\n extractorVertices[evPos + 7] = extractorVertices[evPos + 13] = bY\n extractorVertices[evPos + 8] = extractorVertices[evPos + 14] = aZ\n //C\n extractorVertices[evPos + 15] = cX\n extractorVertices[evPos + 16] = aY\n extractorVertices[evPos + 17] = aZ\n\n evPos = evPos + 18\n\n if (a.wallCabinet && isIntegrated) {\n // top\n // E\n extractorVertices[evPos] = extractorVertices[evPos + 9] = aX\n extractorVertices[evPos + 1] = extractorVertices[evPos + 10] = aY\n extractorVertices[evPos + 2] = extractorVertices[evPos + 11] = eZ\n //A\n extractorVertices[evPos + 3] = aX\n extractorVertices[evPos + 4] = aY\n extractorVertices[evPos + 5] = aZ\n //C\n extractorVertices[evPos + 6] = extractorVertices[evPos + 12] = cX\n extractorVertices[evPos + 7] = extractorVertices[evPos + 13] = aY\n extractorVertices[evPos + 8] = extractorVertices[evPos + 14] = aZ\n //G\n extractorVertices[evPos + 15] = cX\n extractorVertices[evPos + 16] = aY\n extractorVertices[evPos + 17] = eZ\n\n evPos = evPos + 18\n }\n\n // left\n // E\n extractorVertices[evPos] = extractorVertices[evPos + 9] = aX\n extractorVertices[evPos + 1] = extractorVertices[evPos + 10] = aY\n extractorVertices[evPos + 2] = extractorVertices[evPos + 11] = eZ\n //F\n extractorVertices[evPos + 3] = aX\n extractorVertices[evPos + 4] = bY\n extractorVertices[evPos + 5] = eZ\n //B\n extractorVertices[evPos + 6] = extractorVertices[evPos + 12] = aX\n extractorVertices[evPos + 7] = extractorVertices[evPos + 13] = bY\n extractorVertices[evPos + 8] = extractorVertices[evPos + 14] = aZ\n //A\n extractorVertices[evPos + 15] = aX\n extractorVertices[evPos + 16] = aY\n extractorVertices[evPos + 17] = aZ\n\n evPos = evPos + 18\n\n // right\n //C\n extractorVertices[evPos] = extractorVertices[evPos + 9] = cX\n extractorVertices[evPos + 1] = extractorVertices[evPos + 10] = aY\n extractorVertices[evPos + 2] = extractorVertices[evPos + 11] = aZ\n //D\n extractorVertices[evPos + 3] = cX\n extractorVertices[evPos + 4] = bY\n extractorVertices[evPos + 5] = aZ\n //H\n extractorVertices[evPos + 6] = extractorVertices[evPos + 12] = cX\n extractorVertices[evPos + 7] = extractorVertices[evPos + 13] = bY\n extractorVertices[evPos + 8] = extractorVertices[evPos + 14] = eZ\n //G\n extractorVertices[evPos + 15] = cX\n extractorVertices[evPos + 16] = aY\n extractorVertices[evPos + 17] = eZ\n\n evPos = evPos + 18\n\n\n // bottom\n //B\n extractorVertices[evPos] = extractorVertices[evPos + 9] = aX\n extractorVertices[evPos + 1] = extractorVertices[evPos + 10] = bY\n extractorVertices[evPos + 2] = extractorVertices[evPos + 11] = aZ\n //F\n extractorVertices[evPos + 3] = aX\n extractorVertices[evPos + 4] = bY\n extractorVertices[evPos + 5] = eZ\n //H\n extractorVertices[evPos + 6] = extractorVertices[evPos + 12] = cX\n extractorVertices[evPos + 7] = extractorVertices[evPos + 13] = bY\n extractorVertices[evPos + 8] = extractorVertices[evPos + 14] = eZ\n //D\n extractorVertices[evPos + 15] = cX\n extractorVertices[evPos + 16] = bY\n extractorVertices[evPos + 17] = aZ\n\n evPos = evPos + 18\n\n // back\n //G\n extractorVertices[evPos] = extractorVertices[evPos + 9] = cX\n extractorVertices[evPos + 1] = extractorVertices[evPos + 10] = aY\n extractorVertices[evPos + 2] = extractorVertices[evPos + 11] = eZ\n //H\n extractorVertices[evPos + 3] = cX\n extractorVertices[evPos + 4] = bY\n extractorVertices[evPos + 5] = eZ\n //F\n extractorVertices[evPos + 6] = extractorVertices[evPos + 12] = aX\n extractorVertices[evPos + 7] = extractorVertices[evPos + 13] = bY\n extractorVertices[evPos + 8] = extractorVertices[evPos + 14] = eZ\n //E\n extractorVertices[evPos + 15] = aX\n extractorVertices[evPos + 16] = aY\n extractorVertices[evPos + 17] = eZ\n\n evPos = evPos + 18\n\n if (!a.wallCabinet || a.extractorType !== 'integrated') {\n\n var centerVent = (a.w >= 0.7 && !a.wallCabinet) || a.barCounter\n\n iX = aX + (cX - aX) / 2 - 0.12\n iY = a.h + offsetY\n iZ = centerVent ? a.w - 0.25 : a.w - 0.4\n jY = aY + (a.extractorType === 'pyramid' ? extractorPyramid : 0)\n kX = iX + 0.24\n mZ = centerVent ? a.w - 0.45 : a.w - 0.6\n\n // EXTRACTOR ROOF TOP\n // E-N--P--G\n // | J--L |\n // | |\n // A-------C\n\n\n // LEFT\n // E\n extractorVertices[evPos] = extractorVertices[evPos + 9] = aX\n extractorVertices[evPos + 1] = extractorVertices[evPos + 10] = aY\n extractorVertices[evPos + 2] = extractorVertices[evPos + 11] = eZ\n // A\n extractorVertices[evPos + 3] = aX\n extractorVertices[evPos + 4] = aY\n extractorVertices[evPos + 5] = aZ\n //J\n extractorVertices[evPos + 6] = extractorVertices[evPos + 12] = iX\n extractorVertices[evPos + 7] = extractorVertices[evPos + 13] = jY\n extractorVertices[evPos + 8] = extractorVertices[evPos + 14] = iZ\n //N\n extractorVertices[evPos + 15] = iX\n extractorVertices[evPos + 16] = jY\n extractorVertices[evPos + 17] = mZ\n\n evPos = evPos + 18\n\n // FRONT\n // J\n extractorVertices[evPos] = extractorVertices[evPos + 9] = iX\n extractorVertices[evPos + 1] = extractorVertices[evPos + 10] = jY\n extractorVertices[evPos + 2] = extractorVertices[evPos + 11] = iZ\n // A\n extractorVertices[evPos + 3] = aX\n extractorVertices[evPos + 4] = aY\n extractorVertices[evPos + 5] = aZ\n // C\n extractorVertices[evPos + 6] = extractorVertices[evPos + 12] = cX\n extractorVertices[evPos + 7] = extractorVertices[evPos + 13] = aY\n extractorVertices[evPos + 8] = extractorVertices[evPos + 14] = aZ\n // L\n extractorVertices[evPos + 15] = kX\n extractorVertices[evPos + 16] = jY\n extractorVertices[evPos + 17] = iZ\n\n evPos = evPos + 18\n\n // RIGHT\n // P\n extractorVertices[evPos] = extractorVertices[evPos + 9] = kX\n extractorVertices[evPos + 1] = extractorVertices[evPos + 10] = jY\n extractorVertices[evPos + 2] = extractorVertices[evPos + 11] = mZ\n // L\n extractorVertices[evPos + 3] = kX\n extractorVertices[evPos + 4] = jY\n extractorVertices[evPos + 5] = iZ\n // C\n extractorVertices[evPos + 6] = extractorVertices[evPos + 12] = cX\n extractorVertices[evPos + 7] = extractorVertices[evPos + 13] = aY\n extractorVertices[evPos + 8] = extractorVertices[evPos + 14] = aZ\n // G\n extractorVertices[evPos + 15] = cX\n extractorVertices[evPos + 16] = aY\n extractorVertices[evPos + 17] = eZ\n\n evPos = evPos + 18\n\n if (a.extractorType === 'pyramid' || a.w > 0.6 || a.barCounter ) {\n // BACK\n // E\n extractorVertices[evPos] = extractorVertices[evPos + 9] = aX\n extractorVertices[evPos + 1] = extractorVertices[evPos + 10] = aY\n extractorVertices[evPos + 2] = extractorVertices[evPos + 11] = eZ\n // N\n extractorVertices[evPos + 3] = iX\n extractorVertices[evPos + 4] = jY\n extractorVertices[evPos + 5] = mZ\n // P\n extractorVertices[evPos + 6] = extractorVertices[evPos + 12] = kX\n extractorVertices[evPos + 7] = extractorVertices[evPos + 13] = jY\n extractorVertices[evPos + 8] = extractorVertices[evPos + 14] = mZ\n // G\n extractorVertices[evPos + 15] = cX\n extractorVertices[evPos + 16] = aY\n extractorVertices[evPos + 17] = eZ\n\n evPos = evPos + 18\n }\n\n\n // ventilation\n // M------O\n // /| /|\n // I------K |\n // | N----|-P\n // |/ |/\n // J------L\n\n // front\n // A\n extractorVertices[evPos] = extractorVertices[evPos + 9] = iX\n extractorVertices[evPos + 1] = extractorVertices[evPos + 10] = iY\n extractorVertices[evPos + 2] = extractorVertices[evPos + 11] = iZ\n //B\n extractorVertices[evPos + 3] = iX\n extractorVertices[evPos + 4] = jY\n extractorVertices[evPos + 5] = iZ\n //D\n extractorVertices[evPos + 6] = extractorVertices[evPos + 12] = kX\n extractorVertices[evPos + 7] = extractorVertices[evPos + 13] = jY\n extractorVertices[evPos + 8] = extractorVertices[evPos + 14] = iZ\n //C\n extractorVertices[evPos + 15] = kX\n extractorVertices[evPos + 16] = iY\n extractorVertices[evPos + 17] = iZ\n\n evPos = evPos + 18\n\n // top\n // E\n extractorVertices[evPos] = extractorVertices[evPos + 9] = iX\n extractorVertices[evPos + 1] = extractorVertices[evPos + 10] = iY\n extractorVertices[evPos + 2] = extractorVertices[evPos + 11] = mZ\n //A\n extractorVertices[evPos + 3] = iX\n extractorVertices[evPos + 4] = iY\n extractorVertices[evPos + 5] = iZ\n //C\n extractorVertices[evPos + 6] = extractorVertices[evPos + 12] = kX\n extractorVertices[evPos + 7] = extractorVertices[evPos + 13] = iY\n extractorVertices[evPos + 8] = extractorVertices[evPos + 14] = iZ\n //G\n extractorVertices[evPos + 15] = kX\n extractorVertices[evPos + 16] = iY\n extractorVertices[evPos + 17] = mZ\n\n evPos = evPos + 18\n\n // left\n // E\n extractorVertices[evPos] = extractorVertices[evPos + 9] = iX\n extractorVertices[evPos + 1] = extractorVertices[evPos + 10] = iY\n extractorVertices[evPos + 2] = extractorVertices[evPos + 11] = mZ\n //F\n extractorVertices[evPos + 3] = iX\n extractorVertices[evPos + 4] = jY\n extractorVertices[evPos + 5] = mZ\n //B\n extractorVertices[evPos + 6] = extractorVertices[evPos + 12] = iX\n extractorVertices[evPos + 7] = extractorVertices[evPos + 13] = jY\n extractorVertices[evPos + 8] = extractorVertices[evPos + 14] = iZ\n //A\n extractorVertices[evPos + 15] = iX\n extractorVertices[evPos + 16] = iY\n extractorVertices[evPos + 17] = iZ\n\n evPos = evPos + 18\n\n // right\n //C\n extractorVertices[evPos] = extractorVertices[evPos + 9] = kX\n extractorVertices[evPos + 1] = extractorVertices[evPos + 10] = iY\n extractorVertices[evPos + 2] = extractorVertices[evPos + 11] = iZ\n //D\n extractorVertices[evPos + 3] = kX\n extractorVertices[evPos + 4] = jY\n extractorVertices[evPos + 5] = iZ\n //H\n extractorVertices[evPos + 6] = extractorVertices[evPos + 12] = kX\n extractorVertices[evPos + 7] = extractorVertices[evPos + 13] = jY\n extractorVertices[evPos + 8] = extractorVertices[evPos + 14] = mZ\n //G\n extractorVertices[evPos + 15] = kX\n extractorVertices[evPos + 16] = iY\n extractorVertices[evPos + 17] = mZ\n\n evPos = evPos + 18\n\n // back\n //O\n extractorVertices[evPos] = extractorVertices[evPos + 9] = kX\n extractorVertices[evPos + 1] = extractorVertices[evPos + 10] = iY\n extractorVertices[evPos + 2] = extractorVertices[evPos + 11] = mZ\n //P\n extractorVertices[evPos + 3] = kX\n extractorVertices[evPos + 4] = jY\n extractorVertices[evPos + 5] = mZ\n //N\n extractorVertices[evPos + 6] = extractorVertices[evPos + 12] = iX\n extractorVertices[evPos + 7] = extractorVertices[evPos + 13] = jY\n extractorVertices[evPos + 8] = extractorVertices[evPos + 14] = mZ\n //M\n extractorVertices[evPos + 15] = iX\n extractorVertices[evPos + 16] = iY\n extractorVertices[evPos + 17] = mZ\n\n evPos = evPos + 18\n }\n\n // reset variables\n aZ = a.w\n eZ = aZ\n iZ = a.w + a.doorWidth\n }\n\n function genCabinetBox(aX, aY, aZ, bY, cX, eZ, id) {\n\n ///////////////////\n // CABINET BOXES\n //////////////////\n\n // FRONT VIEW VERTICES\n //\n // E------G\n // /| /|\n // A------C |\n // | F----|-H\n // |/ |/\n // B------D\n\n if (id !== 1){\n // TOP\n //E\n kitchenVertices[kvPos] = kitchenVertices[kvPos + 9] = aX\n kitchenVertices[kvPos + 1] = kitchenVertices[kvPos + 10] = aY\n kitchenVertices[kvPos + 2] = kitchenVertices[kvPos + 11] = eZ\n //A\n kitchenVertices[kvPos + 3] = aX\n kitchenVertices[kvPos + 4] = aY\n kitchenVertices[kvPos + 5] = aZ\n //C\n kitchenVertices[kvPos + 6] = kitchenVertices[kvPos + 12] = cX\n kitchenVertices[kvPos + 7] = kitchenVertices[kvPos + 13] = aY\n kitchenVertices[kvPos + 8] = kitchenVertices[kvPos + 14] = aZ\n //G\n kitchenVertices[kvPos + 15] = cX\n kitchenVertices[kvPos + 16] = aY\n kitchenVertices[kvPos + 17] = eZ\n\n kvPos = kvPos + 18\n }\n\n // SIDES\n //E\n kitchenVertices[kvPos] = kitchenVertices[kvPos + 9] = aX\n kitchenVertices[kvPos + 1] = kitchenVertices[kvPos + 10] = aY\n kitchenVertices[kvPos + 2] = kitchenVertices[kvPos + 11] = eZ\n //F\n kitchenVertices[kvPos + 3] = aX\n kitchenVertices[kvPos + 4] = bY\n kitchenVertices[kvPos + 5] = eZ\n //B\n kitchenVertices[kvPos + 6] = kitchenVertices[kvPos + 12] = aX\n kitchenVertices[kvPos + 7] = kitchenVertices[kvPos + 13] = bY\n kitchenVertices[kvPos + 8] = kitchenVertices[kvPos + 14] = aZ\n //A\n kitchenVertices[kvPos + 15] = aX\n kitchenVertices[kvPos + 16] = aY\n kitchenVertices[kvPos + 17] = aZ\n\n kvPos = kvPos + 18\n\n // LEFT\n //E\n kitchenVertices[kvPos] = kitchenVertices[kvPos + 9] = aX\n kitchenVertices[kvPos + 1] = kitchenVertices[kvPos + 10] = aY\n kitchenVertices[kvPos + 2] = kitchenVertices[kvPos + 11] = eZ\n //F\n kitchenVertices[kvPos + 3] = aX\n kitchenVertices[kvPos + 4] = bY\n kitchenVertices[kvPos + 5] = eZ\n //B\n kitchenVertices[kvPos + 6] = kitchenVertices[kvPos + 12] = aX\n kitchenVertices[kvPos + 7] = kitchenVertices[kvPos + 13] = bY\n kitchenVertices[kvPos + 8] = kitchenVertices[kvPos + 14] = aZ\n //A\n kitchenVertices[kvPos + 15] = aX\n kitchenVertices[kvPos + 16] = aY\n kitchenVertices[kvPos + 17] = aZ\n\n kvPos = kvPos + 18\n\n // RIGHT\n //C\n kitchenVertices[kvPos] = kitchenVertices[kvPos + 9] = cX\n kitchenVertices[kvPos + 1] = kitchenVertices[kvPos + 10] = aY\n kitchenVertices[kvPos + 2] = kitchenVertices[kvPos + 11] = aZ\n //D\n kitchenVertices[kvPos + 3] = cX\n kitchenVertices[kvPos + 4] = bY\n kitchenVertices[kvPos + 5] = aZ\n //H\n kitchenVertices[kvPos + 6] = kitchenVertices[kvPos + 12] = cX\n kitchenVertices[kvPos + 7] = kitchenVertices[kvPos + 13] = bY\n kitchenVertices[kvPos + 8] = kitchenVertices[kvPos + 14] = eZ\n //G\n kitchenVertices[kvPos + 15] = cX\n kitchenVertices[kvPos + 16] = aY\n kitchenVertices[kvPos + 17] = eZ\n\n kvPos = kvPos + 18\n\n // BACK\n //G\n kitchenVertices[kvPos] = kitchenVertices[kvPos + 9] = cX\n kitchenVertices[kvPos + 1] = kitchenVertices[kvPos + 10] = aY\n kitchenVertices[kvPos + 2] = kitchenVertices[kvPos + 11] = eZ\n //H\n kitchenVertices[kvPos + 3] = cX\n kitchenVertices[kvPos + 4] = bY\n kitchenVertices[kvPos + 5] = eZ\n //F\n kitchenVertices[kvPos + 6] = kitchenVertices[kvPos + 12] = aX\n kitchenVertices[kvPos + 7] = kitchenVertices[kvPos + 13] = bY\n kitchenVertices[kvPos + 8] = kitchenVertices[kvPos + 14] = eZ\n //E\n kitchenVertices[kvPos + 15] = aX\n kitchenVertices[kvPos + 16] = aY\n kitchenVertices[kvPos + 17] = eZ\n\n kvPos = kvPos + 18\n if (id === 2){\n // BOTTOM\n //B\n kitchenVertices[kvPos] = kitchenVertices[kvPos + 9] = aX\n kitchenVertices[kvPos + 1] = kitchenVertices[kvPos + 10] = bY\n kitchenVertices[kvPos + 2] = kitchenVertices[kvPos + 11] = aZ\n //F\n kitchenVertices[kvPos + 3] = aX\n kitchenVertices[kvPos + 4] = bY\n kitchenVertices[kvPos + 5] = eZ\n //H\n kitchenVertices[kvPos + 6] = kitchenVertices[kvPos + 12] = cX\n kitchenVertices[kvPos + 7] = kitchenVertices[kvPos + 13] = bY\n kitchenVertices[kvPos + 8] = kitchenVertices[kvPos + 14] = eZ\n //D\n kitchenVertices[kvPos + 15] = cX\n kitchenVertices[kvPos + 16] = bY\n kitchenVertices[kvPos + 17] = aZ\n\n kvPos = kvPos + 18\n }\n }\n\n var baseCabinetCursor = getElementPos(a.highCabinetLeft + 1)\n\n aX = xCursor\n aY = a.counterHeight - a.counterThickness\n aZ = a.w\n bY = 0\n cX = xCursor + elements[0]\n eX = xCursor + a.doorWidth / 2\n eY = aY - a.doorWidth\n eZ = aZ\n fY = a.baseBoard\n gX = cX - a.doorWidth / 2\n iZ = a.w + a.doorWidth\n\n ///////////////////\n // CABINET DOORS\n //////////////////\n\n for (var c = 0; c < elementNum; c++) {\n aX = xCursor\n cX = xCursor + elements[c]\n eX = xCursor + a.doorWidth / 2\n gX = xCursor + elements[c] - a.doorWidth / 2\n\n var isSink = (c === a.sinkPos - 1 || (c === a.sinkPos && a.sinkType === 'double')) && sink\n\n // Get CabinetSegments depending on configuration\n if (c < a.highCabinetLeft) {\n if (a.fridge && (a.fridgePos - 1 === c || a.fridgePos === c)) k = 7\n else if (c + 1 === a.ovenPos && oven && c + 1 === a.microwavePos && microwave) k = 9\n else if (c + 1 === a.ovenPos && oven) k = 1\n else if (c + 1 === a.microwavePos && microwave) k = 8\n else k = 0\n }\n else if (c < a.highCabinetLeft + baseCabinetNum && c+1 === a.ovenPos && oven) k = 4\n //else if (c === elementNum - a.highCabinetRight - 1) k = 3\n else if (c > a.highCabinetLeft + baseCabinetNum -1 ) {\n if (c + 1 === a.ovenPos && oven && c + 1 === a.microwavePos && microwave) k = 9\n else if (c + 1 === a.ovenPos) k = 1\n else if (c + 1 === a.microwavePos && microwave) k = 8\n else k = 0\n aX = a.l - a.highCabinetRight * elementLength + xCursorRight\n eX = a.l - a.highCabinetRight * elementLength + a.doorWidth / 2 + xCursorRight\n cX = a.l - (a.highCabinetRight-1) * elementLength + xCursorRight\n gX = a.l - (a.highCabinetRight-1) * elementLength + xCursorRight - a.doorWidth / 2\n xCursorRight += elements[c];\n }\n else if ( isSink || c === a.highCabinetLeft || c === a.highCabinetLeft + baseCabinetNum - 1 ) k = 3\n else k = 2\n\n if (c === elementNum - a.highCabinetRight - 1) {\n cX = a.l - a.highCabinetRight * elementLength\n gX = a.l - a.highCabinetRight * elementLength - a.doorWidth / 2\n }\n\n if (c === a.cooktopPos-1 && cooktop && extractor) genExtractor()\n\n // HIGH & BASE CABINET DOORS\n for (var i = 0; i < cabinetSegments[k].length - 1; i++) {\n cabinetDoor({\n i: i,\n aX: aX,\n aY: cabinetSegments[k][i + 1],\n aZ: a.w,\n bY: cabinetSegments[k][i],\n cX: cX,\n k: k\n })\n\n }\n\n // WALL CABINET DOORS\n if (a.wallCabinet && c >= a.highCabinetLeft && c < a.highCabinetLeft + baseCabinetNum) {\n k = 5\n if (microwave && c === a.microwavePos - 1 ) k = 6\n var extractorOffset\n\n for (var j = 0; j < cabinetSegments[k].length - 1; j++) {\n // skip cabinet door for extractors\n if (extractor && cooktop && a.extractorType !== 'integrated') {\n if (c === a.cooktopPos - 1) continue\n if (elements[c] < minWallCabinet && c === a.cooktopPos) continue\n }\n // toggle door height for extractor\n extractorOffset = c === a.cooktopPos - 1 && cooktop && extractor ? extractorHeight + extractorBottom - a.wallCabinetHeight : 0\n cabinetDoor({\n i: j,\n aX: aX,\n aY: round(cabinetSegments[k][j + 1] + (cabinetSegments[k].length > 2 && j === 0 ? extractorOffset : 0), 100),\n aZ: a.wallCabinetWidth,\n bY: round(cabinetSegments[k][j] + extractorOffset, 100),\n cX: cX,\n k: k\n })\n }\n }\n aZ = a.w\n iZ = aZ + a.doorWidth\n xCursor += elements[c];\n }\n\n ///////////////////\n // CABINET BOXES\n //////////////////\n\n // define aX, aY, aZ, bY, cX, eZ, id for each Box Type\n // BASE CABINET BOX\n if (baseCabinetNum>0) genCabinetBox(baseCabinetCursor, a.counterHeight - a.counterThickness, a.w, 0, a.l - a.highCabinetRight * elementLength, 0,1)\n // WALL CABINET BOX\n if (a.wallCabinet && baseCabinetNum > 0) {\n var leftWallCabinet = a.cooktopPos > a.highCabinetLeft + 1\n var rightWallCabinet = elements[a.cooktopPos] >= minWallCabinet || a.extractorType === 'integrated'\n //console.log(elements.length, a.cooktopPos, elements[a.cooktopPos])\n if (!extractor || a.cooktopType === 'none') {\n // one single wall cabinet\n genCabinetBox(baseCabinetCursor, a.h + offsetY, a.wallCabinetWidth, a.wallCabinetHeight, a.l - a.highCabinetRight * elementLength, 0,2)\n } else if (extractor && a.extractorType !== 'integrated') {\n // two wall cabinets around the extractor\n if (leftWallCabinet) genCabinetBox(baseCabinetCursor, a.h + offsetY, a.wallCabinetWidth, a.wallCabinetHeight, getElementPos(a.cooktopPos), 0,2)\n if (rightWallCabinet) genCabinetBox(getElementPos(a.cooktopPos + 1), a.h + offsetY, a.wallCabinetWidth, a.wallCabinetHeight, a.l - a.highCabinetRight * elementLength, 0,2)\n } else {\n // two wall cabinets + the extractor integrated\n if (leftWallCabinet) genCabinetBox(baseCabinetCursor, a.h + offsetY, a.wallCabinetWidth, a.wallCabinetHeight, getElementPos(a.cooktopPos), 0,2)\n genCabinetBox(getElementPos(a.cooktopPos), a.h + offsetY, a.wallCabinetWidth, extractorBottom, getElementPos(a.cooktopPos + 1), 0,2)\n if (rightWallCabinet) genCabinetBox(getElementPos(a.cooktopPos + 1), a.h + offsetY, a.wallCabinetWidth, a.wallCabinetHeight, a.l - a.highCabinetRight * elementLength, 0, 2)\n }\n }\n // HIGH CABINET BOX LEFT\n if (a.highCabinetLeft!==0 && baseCabinetNum > 0) genCabinetBox(0, a.h + offsetY, a.w, 0, baseCabinetCursor, 0,3)\n if (a.highCabinetLeft!==0 && baseCabinetNum < 1) genCabinetBox(0, a.h + offsetY, a.w, 0, a.l, 0,3)\n // HIGH CABINET BOX RIGHT\n if (a.highCabinetRight!==0 && elementNum-a.highCabinetLeft>0) genCabinetBox(a.l - a.highCabinetRight * elementLength, a.h + offsetY, a.w, 0, a.l, 0,4)\n\n ///////////////////\n // COUNTER TOP\n //////////////////\n if (baseCabinetNum > 0) {\n // E------G\n // /| /|\n // A------C |\n // | F----|-H\n // |/ |/\n // B------D\n\n aX = getElementPos(a.highCabinetLeft + 1)//baseCabinetCursor\n aY = a.counterHeight\n aZ = a.w + a.doorWidth\n bY = a.counterHeight - a.counterThickness\n cX = a.l - a.highCabinetRight * elementLength\n eZ = a.barCounter ? - barCounter : 0\n\n var counterElements = [\n [ // cooktop\n getElementPos(a.cooktopPos) + ovenDistance,\n a.w + a.doorWidth - 0.55,\n a.w + a.doorWidth - ovenDistance,\n getElementPos(a.cooktopPos + 1) - ovenDistance\n ],\n [ // sink\n getElementPos(a.sinkPos) + sinkOffset,\n a.w + a.doorWidth - ovenDistance - sinkWidth,\n a.w + a.doorWidth - ovenDistance,\n getElementPos(a.sinkPos) + sinkOffset + sinkLength,\n ]\n ]\n\n if (cooktop && sink) {\n // E--------Q----G\n // / I---K M--O /\n // / J---L N--P /\n // A--------R----C\n if (a.cooktopPos < a.sinkPos) {\n // cooktop\n iX = counterElements [0][0]\n iZ = counterElements [0][1]\n jZ = counterElements [0][2]\n kX = counterElements [0][3]\n // sink\n mX = counterElements [1][0]\n mZ = counterElements [1][1]\n nZ = counterElements [1][2]\n oX = counterElements [1][3]\n }\n else {\n // sink\n iX = counterElements [1][0]\n iZ = counterElements [1][1]\n jZ = counterElements [1][2]\n kX = counterElements [1][3]\n // cooktop\n mX = counterElements [0][0]\n mZ = counterElements [0][1]\n nZ = counterElements [0][2]\n oX = counterElements [0][3]\n }\n // TOP\n //E\n counterVertices[cvPos] = counterVertices[cvPos + 9] = aX\n counterVertices[cvPos + 1] = counterVertices[cvPos + 10] = aY\n counterVertices[cvPos + 2] = counterVertices[cvPos + 11] = eZ\n //A\n counterVertices[cvPos + 3] = aX\n counterVertices[cvPos + 4] = aY\n counterVertices[cvPos + 5] = aZ\n //J\n counterVertices[cvPos + 6] = counterVertices[cvPos + 12] = iX\n counterVertices[cvPos + 7] = counterVertices[cvPos + 13] = aY\n counterVertices[cvPos + 8] = counterVertices[cvPos + 14] = jZ\n //I\n counterVertices[cvPos + 15] = iX\n counterVertices[cvPos + 16] = aY\n counterVertices[cvPos + 17] = iZ\n\n cvPos = cvPos + 18\n\n //J\n counterVertices[cvPos] = counterVertices[cvPos + 9] = iX\n counterVertices[cvPos + 1] = counterVertices[cvPos + 10] = aY\n counterVertices[cvPos + 2] = counterVertices[cvPos + 11] = jZ\n //A\n counterVertices[cvPos + 3] = aX\n counterVertices[cvPos + 4] = aY\n counterVertices[cvPos + 5] = aZ\n //R\n counterVertices[cvPos + 6] = counterVertices[cvPos + 12] = mX\n counterVertices[cvPos + 7] = counterVertices[cvPos + 13] = aY\n counterVertices[cvPos + 8] = counterVertices[cvPos + 14] = aZ\n //L\n counterVertices[cvPos + 15] = kX\n counterVertices[cvPos + 16] = aY\n counterVertices[cvPos + 17] = jZ\n\n cvPos = cvPos + 18\n\n //K\n counterVertices[cvPos] = counterVertices[cvPos + 9] = kX\n counterVertices[cvPos + 1] = counterVertices[cvPos + 10] = aY\n counterVertices[cvPos + 2] = counterVertices[cvPos + 11] = iZ\n //L\n counterVertices[cvPos + 3] = kX\n counterVertices[cvPos + 4] = aY\n counterVertices[cvPos + 5] = jZ\n //R\n counterVertices[cvPos + 6] = counterVertices[cvPos + 12] = mX\n counterVertices[cvPos + 7] = counterVertices[cvPos + 13] = aY\n counterVertices[cvPos + 8] = counterVertices[cvPos + 14] = aZ\n //Q\n counterVertices[cvPos + 15] = mX\n counterVertices[cvPos + 16] = aY\n counterVertices[cvPos + 17] = eZ\n\n cvPos = cvPos + 18\n\n //E\n counterVertices[cvPos] = counterVertices[cvPos + 9] = aX\n counterVertices[cvPos + 1] = counterVertices[cvPos + 10] = aY\n counterVertices[cvPos + 2] = counterVertices[cvPos + 11] = eZ\n //I\n counterVertices[cvPos + 3] = iX\n counterVertices[cvPos + 4] = aY\n counterVertices[cvPos + 5] = iZ\n //K\n counterVertices[cvPos + 6] = counterVertices[cvPos + 12] = kX\n counterVertices[cvPos + 7] = counterVertices[cvPos + 13] = aY\n counterVertices[cvPos + 8] = counterVertices[cvPos + 14] = iZ\n //Q\n counterVertices[cvPos + 15] = mX\n counterVertices[cvPos + 16] = aY\n counterVertices[cvPos + 17] = eZ\n\n cvPos = cvPos + 18\n\n //N\n counterVertices[cvPos] = counterVertices[cvPos + 9] = mX\n counterVertices[cvPos + 1] = counterVertices[cvPos + 10] = aY\n counterVertices[cvPos + 2] = counterVertices[cvPos + 11] = nZ\n //R\n counterVertices[cvPos + 3] = mX\n counterVertices[cvPos + 4] = aY\n counterVertices[cvPos + 5] = aZ\n //C\n counterVertices[cvPos + 6] = counterVertices[cvPos + 12] = cX\n counterVertices[cvPos + 7] = counterVertices[cvPos + 13] = aY\n counterVertices[cvPos + 8] = counterVertices[cvPos + 14] = aZ\n //P\n counterVertices[cvPos + 15] = oX\n counterVertices[cvPos + 16] = aY\n counterVertices[cvPos + 17] = nZ\n\n cvPos = cvPos + 18\n\n //O\n counterVertices[cvPos] = counterVertices[cvPos + 9] = oX\n counterVertices[cvPos + 1] = counterVertices[cvPos + 10] = aY\n counterVertices[cvPos + 2] = counterVertices[cvPos + 11] = mZ\n //P\n counterVertices[cvPos + 3] = oX\n counterVertices[cvPos + 4] = aY\n counterVertices[cvPos + 5] = nZ\n //C\n counterVertices[cvPos + 6] = counterVertices[cvPos + 12] = cX\n counterVertices[cvPos + 7] = counterVertices[cvPos + 13] = aY\n counterVertices[cvPos + 8] = counterVertices[cvPos + 14] = aZ\n //G\n counterVertices[cvPos + 15] = cX\n counterVertices[cvPos + 16] = aY\n counterVertices[cvPos + 17] = eZ\n\n cvPos = cvPos + 18\n\n //Q\n counterVertices[cvPos] = counterVertices[cvPos + 9] = mX\n counterVertices[cvPos + 1] = counterVertices[cvPos + 10] = aY\n counterVertices[cvPos + 2] = counterVertices[cvPos + 11] = eZ\n //M\n counterVertices[cvPos + 3] = mX\n counterVertices[cvPos + 4] = aY\n counterVertices[cvPos + 5] = mZ\n //O\n counterVertices[cvPos + 6] = counterVertices[cvPos + 12] = oX\n counterVertices[cvPos + 7] = counterVertices[cvPos + 13] = aY\n counterVertices[cvPos + 8] = counterVertices[cvPos + 14] = mZ\n //G\n counterVertices[cvPos + 15] = cX\n counterVertices[cvPos + 16] = aY\n counterVertices[cvPos + 17] = eZ\n\n cvPos = cvPos + 18\n\n // cooktop\n\n iX = counterElements [0][0]\n iZ = counterElements [0][1]\n jZ = counterElements [0][2]\n kX = counterElements [0][3]\n\n //I\n cooktopVertices[0] = cooktopVertices[9] = iX\n cooktopVertices[1] = cooktopVertices[10] = aY\n cooktopVertices[2] = cooktopVertices[11] = iZ\n //J\n cooktopVertices[3] = iX\n cooktopVertices[4] = aY\n cooktopVertices[5] = jZ\n //L\n cooktopVertices[6] = cooktopVertices[12] = kX\n cooktopVertices[7] = cooktopVertices[13] = aY\n cooktopVertices[8] = cooktopVertices[14] = jZ\n //K\n cooktopVertices[15] = kX\n cooktopVertices[16] = aY\n cooktopVertices[17] = iZ\n\n //I\n cooktopUvs = [0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1]\n }\n else if (cooktop || sink) {\n // E-------G\n // / I---K /\n // / J---L /\n // A-------C\n if (sink === false) {\n // cooktop\n iX = counterElements [0][0]\n iZ = counterElements [0][1]\n jZ = counterElements [0][2]\n kX = counterElements [0][3]\n }\n else {\n // sink\n iX = counterElements [1][0]\n iZ = counterElements [1][1]\n jZ = counterElements [1][2]\n kX = counterElements [1][3]\n }\n // TOP\n //E\n counterVertices[cvPos] = counterVertices[cvPos + 9] = aX\n counterVertices[cvPos + 1] = counterVertices[cvPos + 10] = aY\n counterVertices[cvPos + 2] = counterVertices[cvPos + 11] = eZ\n //A\n counterVertices[cvPos + 3] = aX\n counterVertices[cvPos + 4] = aY\n counterVertices[cvPos + 5] = aZ\n //J\n counterVertices[cvPos + 6] = counterVertices[cvPos + 12] = iX\n counterVertices[cvPos + 7] = counterVertices[cvPos + 13] = aY\n counterVertices[cvPos + 8] = counterVertices[cvPos + 14] = jZ\n //I\n counterVertices[cvPos + 15] = iX\n counterVertices[cvPos + 16] = aY\n counterVertices[cvPos + 17] = iZ\n\n cvPos = cvPos + 18\n\n //J\n counterVertices[cvPos] = counterVertices[cvPos + 9] = iX\n counterVertices[cvPos + 1] = counterVertices[cvPos + 10] = aY\n counterVertices[cvPos + 2] = counterVertices[cvPos + 11] = jZ\n //A\n counterVertices[cvPos + 3] = aX\n counterVertices[cvPos + 4] = aY\n counterVertices[cvPos + 5] = aZ\n //C\n counterVertices[cvPos + 6] = counterVertices[cvPos + 12] = cX\n counterVertices[cvPos + 7] = counterVertices[cvPos + 13] = aY\n counterVertices[cvPos + 8] = counterVertices[cvPos + 14] = aZ\n //L\n counterVertices[cvPos + 15] = kX\n counterVertices[cvPos + 16] = aY\n counterVertices[cvPos + 17] = jZ\n\n cvPos = cvPos + 18\n\n //K\n counterVertices[cvPos] = counterVertices[cvPos + 9] = kX\n counterVertices[cvPos + 1] = counterVertices[cvPos + 10] = aY\n counterVertices[cvPos + 2] = counterVertices[cvPos + 11] = iZ\n //L\n counterVertices[cvPos + 3] = kX\n counterVertices[cvPos + 4] = aY\n counterVertices[cvPos + 5] = jZ\n //C\n counterVertices[cvPos + 6] = counterVertices[cvPos + 12] = cX\n counterVertices[cvPos + 7] = counterVertices[cvPos + 13] = aY\n counterVertices[cvPos + 8] = counterVertices[cvPos + 14] = aZ\n //G\n counterVertices[cvPos + 15] = cX\n counterVertices[cvPos + 16] = aY\n counterVertices[cvPos + 17] = eZ\n\n cvPos = cvPos + 18\n\n //E\n counterVertices[cvPos] = counterVertices[cvPos + 9] = aX\n counterVertices[cvPos + 1] = counterVertices[cvPos + 10] = aY\n counterVertices[cvPos + 2] = counterVertices[cvPos + 11] = eZ\n //I\n counterVertices[cvPos + 3] = iX\n counterVertices[cvPos + 4] = aY\n counterVertices[cvPos + 5] = iZ\n //K\n counterVertices[cvPos + 6] = counterVertices[cvPos + 12] = kX\n counterVertices[cvPos + 7] = counterVertices[cvPos + 13] = aY\n counterVertices[cvPos + 8] = counterVertices[cvPos + 14] = iZ\n //G\n counterVertices[cvPos + 15] = cX\n counterVertices[cvPos + 16] = aY\n counterVertices[cvPos + 17] = eZ\n\n cvPos = cvPos + 18\n if (cooktop) {\n\n //I\n cooktopVertices[0] = cooktopVertices[9] = iX\n cooktopVertices[1] = cooktopVertices[10] = aY\n cooktopVertices[2] = cooktopVertices[11] = iZ\n //J\n cooktopVertices[3] = iX\n cooktopVertices[4] = aY\n cooktopVertices[5] = jZ\n //L\n cooktopVertices[6] = cooktopVertices[12] = kX\n cooktopVertices[7] = cooktopVertices[13] = aY\n cooktopVertices[8] = cooktopVertices[14] = jZ\n //K\n cooktopVertices[15] = kX\n cooktopVertices[16] = aY\n cooktopVertices[17] = iZ\n\n //I\n cooktopUvs = [0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1]\n }\n\n }\n else {\n // TOP\n //E\n counterVertices[cvPos] = counterVertices[cvPos + 9] = aX\n counterVertices[cvPos + 1] = counterVertices[cvPos + 10] = aY\n counterVertices[cvPos + 2] = counterVertices[cvPos + 11] = eZ\n //A\n counterVertices[cvPos + 3] = aX\n counterVertices[cvPos + 4] = aY\n counterVertices[cvPos + 5] = aZ\n //C\n counterVertices[cvPos + 6] = counterVertices[cvPos + 12] = cX\n counterVertices[cvPos + 7] = counterVertices[cvPos + 13] = aY\n counterVertices[cvPos + 8] = counterVertices[cvPos + 14] = aZ\n //G\n counterVertices[cvPos + 15] = cX\n counterVertices[cvPos + 16] = aY\n counterVertices[cvPos + 17] = eZ\n\n cvPos = cvPos + 18\n }\n\n // FRONT\n //A\n counterVertices[cvPos] = counterVertices[cvPos + 9] = aX\n counterVertices[cvPos + 1] = counterVertices[cvPos + 10] = aY\n counterVertices[cvPos + 2] = counterVertices[cvPos + 11] = aZ\n //B\n counterVertices[cvPos + 3] = aX\n counterVertices[cvPos + 4] = bY\n counterVertices[cvPos + 5] = aZ\n //D\n counterVertices[cvPos + 6] = counterVertices[cvPos + 12] = cX\n counterVertices[cvPos + 7] = counterVertices[cvPos + 13] = bY\n counterVertices[cvPos + 8] = counterVertices[cvPos + 14] = aZ\n //C\n counterVertices[cvPos + 15] = cX\n counterVertices[cvPos + 16] = aY\n counterVertices[cvPos + 17] = aZ\n\n cvPos = cvPos + 18\n\n // SIDES\n //E\n counterVertices[cvPos] = counterVertices[cvPos + 9] = aX\n counterVertices[cvPos + 1] = counterVertices[cvPos + 10] = aY\n counterVertices[cvPos + 2] = counterVertices[cvPos + 11] = eZ\n //F\n counterVertices[cvPos + 3] = aX\n counterVertices[cvPos + 4] = bY\n counterVertices[cvPos + 5] = eZ\n //B\n counterVertices[cvPos + 6] = counterVertices[cvPos + 12] = aX\n counterVertices[cvPos + 7] = counterVertices[cvPos + 13] = bY\n counterVertices[cvPos + 8] = counterVertices[cvPos + 14] = aZ\n //A\n counterVertices[cvPos + 15] = aX\n counterVertices[cvPos + 16] = aY\n counterVertices[cvPos + 17] = aZ\n\n cvPos = cvPos + 18\n\n //C\n counterVertices[cvPos] = counterVertices[cvPos + 9] = cX\n counterVertices[cvPos + 1] = counterVertices[cvPos + 10] = aY\n counterVertices[cvPos + 2] = counterVertices[cvPos + 11] = aZ\n //D\n counterVertices[cvPos + 3] = cX\n counterVertices[cvPos + 4] = bY\n counterVertices[cvPos + 5] = aZ\n //H\n counterVertices[cvPos + 6] = counterVertices[cvPos + 12] = cX\n counterVertices[cvPos + 7] = counterVertices[cvPos + 13] = bY\n counterVertices[cvPos + 8] = counterVertices[cvPos + 14] = eZ\n //G\n counterVertices[cvPos + 15] = cX\n counterVertices[cvPos + 16] = aY\n counterVertices[cvPos + 17] = eZ\n\n cvPos = cvPos + 18\n\n //G\n counterVertices[cvPos] = counterVertices[cvPos + 9] = cX\n counterVertices[cvPos + 1] = counterVertices[cvPos + 10] = aY\n counterVertices[cvPos + 2] = counterVertices[cvPos + 11] = eZ\n //H\n counterVertices[cvPos + 3] = cX\n counterVertices[cvPos + 4] = bY\n counterVertices[cvPos + 5] = eZ\n //F\n counterVertices[cvPos + 6] = counterVertices[cvPos + 12] = aX\n counterVertices[cvPos + 7] = counterVertices[cvPos + 13] = bY\n counterVertices[cvPos + 8] = counterVertices[cvPos + 14] = eZ\n //E\n counterVertices[cvPos + 15] = aX\n counterVertices[cvPos + 16] = aY\n counterVertices[cvPos + 17] = eZ\n\n }\n // collect meshes that need to be loaded\n var meshesToGet = []\n if (a.sinkType !== 'none') meshesToGet.push({name: 'sink', key: a.sinkType === 'single' ? externalMeshes.singleSink : externalMeshes.doubleSink})\n if (a.fridge) meshesToGet.push({name: 'fridge', key: externalMeshes.fridge})\n if (a.cooktopType === 'gas60' || a.cooktopType === 'gas90') meshesToGet.push({name: 'cooktop', key: externalMeshes[a.cooktopType]})\n\n // load external meshes\n return Promise.map(meshesToGet, function (obj) {\n return loadData3d(obj.key)\n .then(data3d => {\n // wrap results\n obj.data3d = data3d\n return obj\n })\n .catch(console.error)\n })\n .then(function (result) {\n // get mesh group positions\n var sinkX = getElementPos(a.sinkPos) + sinkOffset\n var cooktopX = getElementPos(a.cooktopPos) + elements[a.cooktopPos - 1] / 2\n\n var meshes3d = {}\n // map external meshes into internal meshes object\n result.forEach(function (obj) {\n // iterate through all meshes\n var meshKeys = Object.keys(obj.data3d.meshes)\n meshKeys.forEach(function (key, i) {\n // create unique mesh name\n var meshName = obj.name + '_' + i\n meshes3d[meshName] = obj.data3d.meshes[key]\n // apply mesh position\n if (obj.name === 'sink') meshes3d[meshName].position = [sinkX, a.counterHeight, a.w + a.doorWidth - ovenDistance]\n else if (obj.name === 'cooktop') meshes3d[meshName].position = [cooktopX, a.counterHeight, a.w + a.doorWidth - ovenDistance]\n else if (obj.name === 'fridge') meshes3d[meshName].position = [getElementPos(a.fridgePos), a.baseBoard, a.w + a.doorWidth - ovenDistance]\n })\n })\n\n return meshes3d\n })\n .then(function (meshes3d) {\n\n meshes3d.kitchen = {\n positions: new Float32Array(kitchenVertices),\n normals: generateNormals.flat(kitchenVertices),\n uvs: generateUvs.architectural(kitchenVertices),\n material: 'kitchen'\n }\n meshes3d.counter = {\n positions: new Float32Array(counterVertices),\n normals: generateNormals.flat(counterVertices),\n uvs: generateUvs.architectural(counterVertices),\n material: 'counter'\n }\n meshes3d.oven = {\n positions: new Float32Array(ovenVertices),\n normals: generateNormals.flat(ovenVertices),\n uvs: new Float32Array(ovenUvs),\n material: 'oven'\n }\n meshes3d.cooktop = {\n positions: new Float32Array(cooktopVertices),\n normals: generateNormals.flat(cooktopVertices),\n uvs: new Float32Array(cooktopUvs),\n material: 'cooktop'\n }\n meshes3d.extractor = {\n positions: new Float32Array(extractorVertices),\n normals: generateNormals.flat(extractorVertices),\n material: 'tab'\n }\n meshes3d.microwave = {\n positions: new Float32Array(mwVertices),\n normals: generateNormals.flat(mwVertices),\n uvs: new Float32Array(mwUvs),\n material: 'microwave'\n }\n return meshes3d\n })\n .catch(console.error)\n }\n}\n\n// helper\n\nfunction getElCount(a) {\n var\n cooktop = a.cooktopType !== 'none',\n largeCooktop = cooktop && a.cooktopType.slice(-2) === '90',\n fridgeLength = 0.52\n\n var nLength, elNum, remainder, elLength\n elLength = a.elementLength\n nLength = a.l + (a.fridge ? (elLength - fridgeLength) * 2 : 0) + (cooktop && largeCooktop ? elLength - 0.90 : 0)\n elNum = Math.ceil(round(nLength / elLength, 100))\n remainder = round(elLength - (elNum * elLength - nLength), 100)\n return {elementNum: elNum, remainder: remainder}\n}\n\nfunction updatePositions(a, config) {\n var\n cooktop = a.cooktopType !== 'none',\n largeCooktop = cooktop && a.cooktopType.slice(-2) === '90',\n fridgeLength = 0.52\n\n var elements = []\n var elNum = config.elementNum\n // set all element lengths\n for (var i = 0; i < elNum; i++) {\n if (a.fridge && (i === a.fridgePos - 1 || i === a.fridgePos)) {\n elements[i] = fridgeLength\n }\n else if (cooktop && largeCooktop && i === a.cooktopPos - 1) elements[i] = 0.9\n else if (config.remainder && ((!a.highCabinetRight && i === elNum - 1) || (a.highCabinetRight > 0 && i === elNum - a.highCabinetRight - 1))) elements[i] = config.remainder\n else elements[i] = a.elementLength\n }\n if (!elements[0] && a.l > a.elementLength) elements[0] = a.elementLength\n else if (![elements[0]]) elements[0] = config.remainder\n\n return elements\n}\n\nfunction round( value, factor ) {\n if (!factor) {\n return Math.round(value)\n } else {\n return Math.round(value * factor) / factor\n }\n}","'use strict';\n\n// dependencies\n\nimport getSchema from './common/get-schema.js'\nimport getMaterial from './common/get-material.js'\nimport updateSchema from './common/update-schema.js'\nimport generatePolygonBuffer from '../../../utils/data3d/buffer/get-polygon'\nimport generateExtrusionBuffer from '../../../utils/data3d/buffer/get-extrusion'\nimport generateNormals from '../../../utils/data3d/buffer/get-normals'\nimport cloneDeep from 'lodash/cloneDeep'\n\nexport default {\n\n schema: getSchema('polyfloor'),\n\n init: function () {},\n\n updateSchema: updateSchema,\n\n update: function (oldData) {\n var this_ = this\n var data = this_.data\n\n // remove old mesh\n this.remove()\n\n // get defaults and\n this.attributes = cloneDeep(data)\n\n // get meshes and materials from el3d modules\n var meshes = this.generateMeshes3d()\n\n // clean up empty meshes to prevent errors\n var meshKeys = Object.keys(meshes)\n meshKeys.forEach(key => {\n if (!meshes[key].positions || !meshes[key].positions.length) {\n // console.warn('no vertices for mesh', key)\n delete meshes[key]\n }\n })\n\n // setup materials\n // defaults\n var materials = {\n top: 'wood_parquet_oak',\n side: 'basic-wall',\n ceiling: 'basic-ceiling'\n }\n\n // check for adapted materials\n var materialKeys = Object.keys(data).filter(function(key) {\n return key.indexOf('material_') > -1\n })\n // add materials to instance\n materialKeys.forEach(function(key) {\n var mesh = key.replace('material_', '')\n materials[mesh] = data[key]\n })\n\n // fetch materials from mat library\n Object.keys(materials).forEach(mat => {\n materials[mat] = getMaterial(materials[mat])\n })\n\n // construct data3d object\n var data3d = {\n meshes: meshes,\n materials: materials\n }\n\n // create new one\n this_.mesh = new THREE.Object3D()\n this_.data3dView = new io3d.aFrame.three.Data3dView({parent: this_.mesh})\n\n // update view\n this_.data3dView.set(data3d)\n this_.el.setObject3D('mesh', this_.mesh)\n // emit event\n this_.el.emit('mesh-updated');\n },\n\n remove: function () {\n if (this.data3dView) {\n this.data3dView.destroy()\n this.data3dView = null\n }\n if (this.mesh) {\n this.el.removeObject3D('mesh')\n this.mesh = null\n }\n },\n\n generateMeshes3d: function () {\n var a = this.attributes\n\n // a polygon can not have less than 3 points\n if (a.polygon.length < 3) {\n if (this.model) {\n this.model.a.parent.remove(this.model)\n }\n return Promise.resolve({\n meshes: {}\n })\n }\n\n // prepare format\n var vertices = []\n for (var i = 0, l = a.polygon.length; i < l; i++) {\n vertices[ i * 2 ] = a.polygon[ i ][ 0 ]\n vertices[ i * 2 + 1 ] = a.polygon[ i ][ 1 ]\n }\n\n // top polygon\n var topPolygon = generatePolygonBuffer({\n outline: vertices,\n y: 0,\n uvx: a.x,\n uvz: a.z\n })\n\n // ceiling polygon\n var ceilingPolygon\n if (a.hasCeiling) {\n ceilingPolygon = generatePolygonBuffer({\n outline: vertices,\n y: a.hCeiling,\n uvx: a.x,\n uvz: a.z,\n flipSide: true\n })\n } else {\n ceilingPolygon = {\n vertices: new Float32Array(0),\n uvs: new Float32Array(0)\n }\n }\n\n // sides\n var sides = generateExtrusionBuffer({\n outline: vertices,\n y: -a.h,\n flipSide: true\n })\n\n // return meshes\n return {\n top: {\n positions: topPolygon.vertices,\n normals: generateNormals.flat(topPolygon.vertices),\n uvs: topPolygon.uvs,\n material: 'top'\n },\n sides: {\n positions: sides.vertices,\n normals: generateNormals.flat(sides.vertices),\n uvs: sides.uvs,\n material: 'side'\n },\n ceiling: {\n positions: ceilingPolygon.vertices,\n normals: generateNormals.flat(ceilingPolygon.vertices),\n uvs: ceilingPolygon.uvs,\n material: 'ceiling'\n }\n }\n }\n}","'use strict';\n\n// dependencies\n\nimport getSchema from './common/get-schema.js'\nimport getMaterial from './common/get-material.js'\nimport updateSchema from './common/update-schema.js'\nimport generateNormals from '../../../utils/data3d/buffer/get-normals'\nimport cloneDeep from 'lodash/cloneDeep'\n\nexport default {\n\n schema: getSchema('railing'),\n\n init: function () {},\n\n updateSchema: updateSchema,\n\n update: function (oldData) {\n var this_ = this\n var data = this_.data\n\n // remove old mesh\n this.remove()\n\n // get defaults and\n this.attributes = cloneDeep(data)\n\n // get meshes and materials from el3d modules\n var meshes = this.generateMeshes3d()\n\n // clean up empty meshes to prevent errors\n var meshKeys = Object.keys(meshes)\n meshKeys.forEach(key => {\n if (!meshes[key].positions || !meshes[key].positions.length) {\n // console.warn('no vertices for mesh', key)\n delete meshes[key]\n }\n })\n\n // setup materials\n // defaults\n var materials = {\n railing: {\n colorDiffuse: [0.85, 0.85, 0.85]\n }\n }\n\n // check for adapted materials\n var materialKeys = Object.keys(data).filter(function(key) {\n return key.indexOf('material_') > -1\n })\n // add materials to instance\n materialKeys.forEach(function(key) {\n var mesh = key.replace('material_', '')\n materials[mesh] = data[key]\n })\n\n // fetch materials from mat library\n Object.keys(materials).forEach(mat => {\n materials[mat] = getMaterial(materials[mat])\n })\n\n // construct data3d object\n var data3d = {\n meshes: meshes,\n materials: materials\n }\n\n // create new one\n this_.mesh = new THREE.Object3D()\n this_.data3dView = new io3d.aFrame.three.Data3dView({parent: this_.mesh})\n\n // update view\n this_.data3dView.set(data3d)\n this_.el.setObject3D('mesh', this_.mesh)\n // emit event\n this_.el.emit('mesh-updated');\n },\n\n remove: function () {\n if (this.data3dView) {\n this.data3dView.destroy()\n this.data3dView = null\n }\n if (this.mesh) {\n this.el.removeObject3D('mesh')\n this.mesh = null\n }\n },\n\n generateMeshes3d: function () {\n var a = this.attributes\n\n var\n railingVertices = [],\n rvPos = 0,\n segmentation = a.segmentation,\n segmentLen = (a.l - a.pailing) / (((a.l - a.pailing) / a.segmentDistance) >> 0),\n segments = a.l / segmentLen,\n railCount = Math.max(parseInt(a.railCount), 1),\n segmentHeight = (a.h - (railCount * a.pailing)) / Math.max(railCount - 1, 1)\n\n if (segmentation === 'number') {\n segments = a.segments\n segmentLen = (a.l - a.pailing) / segments\n }\n\n\n //POSTS\n\n // FRONT VIEW VERTICES\n // E-----G\n // /| /|\n // A-----C |\n // | | | |\n // | F---|-H\n // |/ |/\n // B-----D\n\n var aX = 0,\n aY,\n aZ = a.w,\n bY = railCount > 1 ? a.pailing : 0,\n cX = a.pailing,\n eZ = 0\n\n // posts\n if (segmentation !== 'none') {\n // split them by the rails\n for (var n = 0; n < Math.max(railCount - 1, 1); n++) {\n aY = bY + segmentHeight\n // iterate through posts\n for (var i = 0; i <= segments; i++) {\n var offset = i * segmentLen\n\n aX = offset\n cX = offset + a.pailing\n //FRONT\n //A\n railingVertices[rvPos] = railingVertices[rvPos + 9] = aX\n railingVertices[rvPos + 1] = railingVertices[rvPos + 10] = aY\n railingVertices[rvPos + 2] = railingVertices[rvPos + 11] = aZ\n //B\n railingVertices[rvPos + 3] = aX\n railingVertices[rvPos + 4] = bY\n railingVertices[rvPos + 5] = aZ\n //D\n railingVertices[rvPos + 6] = railingVertices[rvPos + 12] = cX\n railingVertices[rvPos + 7] = railingVertices[rvPos + 13] = bY\n railingVertices[rvPos + 8] = railingVertices[rvPos + 14] = aZ\n //C\n railingVertices[rvPos + 15] = cX\n railingVertices[rvPos + 16] = aY\n railingVertices[rvPos + 17] = aZ\n\n rvPos = rvPos + 18\n\n //LEFT\n //E\n railingVertices[rvPos] = railingVertices[rvPos + 9] = aX\n railingVertices[rvPos + 1] = railingVertices[rvPos + 10] = aY\n railingVertices[rvPos + 2] = railingVertices[rvPos + 11] = eZ\n //F\n railingVertices[rvPos + 3] = aX\n railingVertices[rvPos + 4] = bY\n railingVertices[rvPos + 5] = eZ\n //B\n railingVertices[rvPos + 6] = railingVertices[rvPos + 12] = aX\n railingVertices[rvPos + 7] = railingVertices[rvPos + 13] = bY\n railingVertices[rvPos + 8] = railingVertices[rvPos + 14] = aZ\n //A\n railingVertices[rvPos + 15] = aX\n railingVertices[rvPos + 16] = aY\n railingVertices[rvPos + 17] = aZ\n\n rvPos = rvPos + 18\n\n //RIGHT\n //C\n railingVertices[rvPos] = railingVertices[rvPos + 9] = cX\n railingVertices[rvPos + 1] = railingVertices[rvPos + 10] = aY\n railingVertices[rvPos + 2] = railingVertices[rvPos + 11] = aZ\n //D\n railingVertices[rvPos + 3] = cX\n railingVertices[rvPos + 4] = bY\n railingVertices[rvPos + 5] = aZ\n //H\n railingVertices[rvPos + 6] = railingVertices[rvPos + 12] = cX\n railingVertices[rvPos + 7] = railingVertices[rvPos + 13] = bY\n railingVertices[rvPos + 8] = railingVertices[rvPos + 14] = eZ\n //G\n railingVertices[rvPos + 15] = cX\n railingVertices[rvPos + 16] = aY\n railingVertices[rvPos + 17] = eZ\n\n rvPos = rvPos + 18\n\n //BACK\n //G\n railingVertices[rvPos] = railingVertices[rvPos + 9] = cX\n railingVertices[rvPos + 1] = railingVertices[rvPos + 10] = aY\n railingVertices[rvPos + 2] = railingVertices[rvPos + 11] = eZ\n //H\n railingVertices[rvPos + 3] = cX\n railingVertices[rvPos + 4] = bY\n railingVertices[rvPos + 5] = eZ\n //F\n railingVertices[rvPos + 6] = railingVertices[rvPos + 12] = aX\n railingVertices[rvPos + 7] = railingVertices[rvPos + 13] = bY\n railingVertices[rvPos + 8] = railingVertices[rvPos + 14] = eZ\n //E\n railingVertices[rvPos + 15] = aX\n railingVertices[rvPos + 16] = aY\n railingVertices[rvPos + 17] = eZ\n\n rvPos = rvPos + 18\n }\n bY += a.pailing + segmentHeight\n }\n }\n\n //HANDRAIL\n\n // start at top for single rail - otherwise at bottom\n var yCursor = segmentation !== 'none' && railCount === 1 ? a.h - a.pailing : 0\n railCount = segmentation !== 'none' ? railCount : 1\n\n for (var i = 0; i < railCount; i++) {\n // FRONT VIEW VERTICES\n // E----------G\n // /| /|\n // A----------C |\n // | F--------|-H\n // |/ |/\n // B----------D\n\n aX = 0\n aY = segmentation !== 'none' ? yCursor + a.pailing : a.h\n aZ = a.w\n bY = yCursor\n cX = a.l\n eZ = 0\n\n //TOP\n //E\n railingVertices[rvPos] = railingVertices[rvPos + 9] = aX\n railingVertices[rvPos + 1] = railingVertices[rvPos + 10] = aY\n railingVertices[rvPos + 2] = railingVertices[rvPos + 11] = eZ\n //A\n railingVertices[rvPos + 3] = aX\n railingVertices[rvPos + 4] = aY\n railingVertices[rvPos + 5] = aZ\n //C\n railingVertices[rvPos + 6] = railingVertices[rvPos + 12] = cX\n railingVertices[rvPos + 7] = railingVertices[rvPos + 13] = aY\n railingVertices[rvPos + 8] = railingVertices[rvPos + 14] = aZ\n //G\n railingVertices[rvPos + 15] = cX\n railingVertices[rvPos + 16] = aY\n railingVertices[rvPos + 17] = eZ\n\n rvPos = rvPos + 18\n\n //BOTTOM\n //B\n railingVertices[rvPos] = railingVertices[rvPos + 9] = aX\n railingVertices[rvPos + 1] = railingVertices[rvPos + 10] = bY\n railingVertices[rvPos + 2] = railingVertices[rvPos + 11] = aZ\n //F\n railingVertices[rvPos + 3] = aX\n railingVertices[rvPos + 4] = bY\n railingVertices[rvPos + 5] = eZ\n //H\n railingVertices[rvPos + 6] = railingVertices[rvPos + 12] = cX\n railingVertices[rvPos + 7] = railingVertices[rvPos + 13] = bY\n railingVertices[rvPos + 8] = railingVertices[rvPos + 14] = eZ\n //D\n railingVertices[rvPos + 15] = cX\n railingVertices[rvPos + 16] = bY\n railingVertices[rvPos + 17] = aZ\n\n rvPos = rvPos + 18\n\n //FRONT\n //A\n railingVertices[rvPos] = railingVertices[rvPos + 9] = aX\n railingVertices[rvPos + 1] = railingVertices[rvPos + 10] = aY\n railingVertices[rvPos + 2] = railingVertices[rvPos + 11] = aZ\n //B\n railingVertices[rvPos + 3] = aX\n railingVertices[rvPos + 4] = bY\n railingVertices[rvPos + 5] = aZ\n //D\n railingVertices[rvPos + 6] = railingVertices[rvPos + 12] = cX\n railingVertices[rvPos + 7] = railingVertices[rvPos + 13] = bY\n railingVertices[rvPos + 8] = railingVertices[rvPos + 14] = aZ\n //C\n railingVertices[rvPos + 15] = cX\n railingVertices[rvPos + 16] = aY\n railingVertices[rvPos + 17] = aZ\n\n rvPos = rvPos + 18\n\n //LEFT\n //E\n railingVertices[rvPos] = railingVertices[rvPos + 9] = aX\n railingVertices[rvPos + 1] = railingVertices[rvPos + 10] = aY\n railingVertices[rvPos + 2] = railingVertices[rvPos + 11] = eZ\n //F\n railingVertices[rvPos + 3] = aX\n railingVertices[rvPos + 4] = bY\n railingVertices[rvPos + 5] = eZ\n //B\n railingVertices[rvPos + 6] = railingVertices[rvPos + 12] = aX\n railingVertices[rvPos + 7] = railingVertices[rvPos + 13] = bY\n railingVertices[rvPos + 8] = railingVertices[rvPos + 14] = aZ\n //A\n railingVertices[rvPos + 15] = aX\n railingVertices[rvPos + 16] = aY\n railingVertices[rvPos + 17] = aZ\n\n rvPos = rvPos + 18\n\n //RIGHT\n //C\n railingVertices[rvPos] = railingVertices[rvPos + 9] = cX\n railingVertices[rvPos + 1] = railingVertices[rvPos + 10] = aY\n railingVertices[rvPos + 2] = railingVertices[rvPos + 11] = aZ\n //D\n railingVertices[rvPos + 3] = cX\n railingVertices[rvPos + 4] = bY\n railingVertices[rvPos + 5] = aZ\n //H\n railingVertices[rvPos + 6] = railingVertices[rvPos + 12] = cX\n railingVertices[rvPos + 7] = railingVertices[rvPos + 13] = bY\n railingVertices[rvPos + 8] = railingVertices[rvPos + 14] = eZ\n //G\n railingVertices[rvPos + 15] = cX\n railingVertices[rvPos + 16] = aY\n railingVertices[rvPos + 17] = eZ\n\n rvPos = rvPos + 18\n\n //BACK\n //G\n railingVertices[rvPos] = railingVertices[rvPos + 9] = cX\n railingVertices[rvPos + 1] = railingVertices[rvPos + 10] = aY\n railingVertices[rvPos + 2] = railingVertices[rvPos + 11] = eZ\n //H\n railingVertices[rvPos + 3] = cX\n railingVertices[rvPos + 4] = bY\n railingVertices[rvPos + 5] = eZ\n //F\n railingVertices[rvPos + 6] = railingVertices[rvPos + 12] = aX\n railingVertices[rvPos + 7] = railingVertices[rvPos + 13] = bY\n railingVertices[rvPos + 8] = railingVertices[rvPos + 14] = eZ\n //E\n railingVertices[rvPos + 15] = aX\n railingVertices[rvPos + 16] = aY\n railingVertices[rvPos + 17] = eZ\n\n rvPos = rvPos + 18\n\n yCursor += a.pailing + segmentHeight\n }\n\n return {\n railing: {\n positions: new Float32Array(railingVertices),\n normals: generateNormals.flat(railingVertices),\n material: 'railing'\n }\n }\n }\n}","'use strict';\n\n// dependencies\n\nimport getSchema from './common/get-schema.js'\nimport getMaterial from './common/get-material.js'\nimport updateSchema from './common/update-schema.js'\nimport generateNormals from '../../../utils/data3d/buffer/get-normals'\nimport generateUvs from '../../../utils/data3d/buffer/get-uvs'\nimport cloneDeep from 'lodash/cloneDeep'\n\nexport default {\n\n schema: getSchema('stairs'),\n\n init: function () {},\n\n updateSchema: updateSchema,\n\n update: function (oldData) {\n var this_ = this\n var data = this_.data\n\n // remove old mesh\n this.remove()\n\n // get defaults and\n this.attributes = cloneDeep(data)\n\n // get meshes and materials from el3d modules\n var meshes = this.generateMeshes3d()\n\n // clean up empty meshes to prevent errors\n var meshKeys = Object.keys(meshes)\n meshKeys.forEach(key => {\n if (!meshes[key].positions || !meshes[key].positions.length) {\n // console.warn('no vertices for mesh', key)\n delete meshes[key]\n }\n })\n\n // setup materials\n // defaults\n var materials = {\n steps: 'basic-wall',\n tread: 'wood_parquet_oak',\n railing: {\n colorDiffuse: [0.85, 0.85, 0.85]\n }\n }\n\n // check for adapted materials\n var materialKeys = Object.keys(data).filter(function(key) {\n return key.indexOf('material_') > -1\n })\n // add materials to instance\n materialKeys.forEach(function(key) {\n var mesh = key.replace('material_', '')\n materials[mesh] = data[key]\n })\n\n // fetch materials from mat library\n Object.keys(materials).forEach(mat => {\n materials[mat] = getMaterial(materials[mat])\n })\n\n // construct data3d object\n var data3d = {\n meshes: meshes,\n materials: materials\n }\n\n // create new one\n this_.mesh = new THREE.Object3D()\n this_.data3dView = new io3d.aFrame.three.Data3dView({parent: this_.mesh})\n\n // update view\n this_.data3dView.set(data3d)\n this_.el.setObject3D('mesh', this_.mesh)\n // emit event\n this_.el.emit('mesh-updated');\n },\n\n remove: function () {\n if (this.data3dView) {\n this.data3dView.destroy()\n this.data3dView = null\n }\n if (this.mesh) {\n this.el.removeObject3D('mesh')\n this.mesh = null\n }\n },\n\n generateMeshes3d: function () {\n var a = this.attributes\n\n // settings for step ratio\n var stepRatioMax = 2.6,\n stepRatioMin = 1.15,\n\n // internals\n stepsVertices = [],\n svPos = 0,\n treadVertices = [],\n tvPos = 0,\n railingVertices = [],\n rvPos = 0,\n\n // internal settings\n handrailThickness = 0.02,\n stairWidth = a.w,\n stairLength = a.l,\n flipStair = a.circulation === 'left',\n stepWidth = a.stepWidth,\n stairWell = 0.3,\n nosing = 0.02,\n riserExt = a.stepThickness\n\n var aX, aY, aZ, bY, cX, cY, cZ, dY, eX, eY, eZ, fX, fZ, gZ, hX, hZ, // BASE\n kX, kY, kZ, lY, mX, mZ, oX, oZ, qX, qZ, // TREAD\n runA, runB, runC, // RUN\n stepNumber, calcRiser, tread, calcTread, stepsLength\n\n // STAIR Configurations\n\n if (a.stairType === 'straight') {\n // Straight\n\n // reset stairWidth\n a.w = stepWidth\n stepWidth = a.w\n a.circulation = 'right'\n\n if ((a.l/ a.h)<=stepRatioMin) a.l = a.h*stepRatioMin\n if ((a.l/ a.h)>=stepRatioMax) a.l = a.h*stepRatioMax\n stairLength = a.l\n calcTread = ((stairLength/a.h + 1.2321)/0.10357)/100\n stepNumber = Math.round(stairLength/calcTread)\n calcRiser = a.h/stepNumber\n tread = stairLength/stepNumber\n\n runA = stepNumber\n\n _straightRun(0, 0, 0, runA, tread)\n\n } else if (a.stairType === 'straightLanding') {\n // Straight + Platform\n\n var platformLength = 1\n\n // reset stairWidth\n a.w = a.stepWidth\n stepWidth = a.w\n a.circulation = 'right'\n\n if (((a.l-platformLength) / a.h)stepRatioMax) a.l = a.h*stepRatioMax + platformLength\n stepsLength = a.l-platformLength\n calcTread = ((stepsLength / a.h + 1.2321)/0.10357)/100\n stepNumber = Math.round(stepsLength/calcTread)\n calcRiser = a.h/stepNumber\n tread = stepsLength/stepNumber\n\n runA = Math.ceil(stepNumber/2)\n runB = stepNumber - runA\n\n _straightRun(0, 0, 0, runA, tread)\n _platform(runA*tread, runA*calcRiser, 0, stepWidth, platformLength)\n _straightRun(runA*tread+platformLength, runA*calcRiser, 0, runB, tread)\n\n } else if (a.stairType === 'lShaped') {\n // L-Shaped\n\n if (a.wstepRatioMax) a.l = a.h/2*stepRatioMax + stepWidth\n stepsLength = a.l-stepWidth\n\n calcTread = ((stepsLength / (a.h/2) + 1.2321)/0.10357)/100\n stepNumber = Math.round(stepsLength/calcTread)\n calcRiser = (a.h/2)/stepNumber\n tread = stepsLength/stepNumber\n\n runA = stepNumber\n runB = stepNumber\n if (!flipStair) {\n _straightRun(0, 0, 0, runA, tread)\n _platform(runA * tread, runA * calcRiser, 0, stairWidth, stepWidth)\n _straightRun(runA * tread, runA * calcRiser, stairWidth, runB, tread, 180)\n } else {\n _straightRun(0, 0, stairWidth - stepWidth, runA, tread)\n _platform(runA * tread, runA * calcRiser, 0, stairWidth, stepWidth)\n _straightRun(runA * tread, runA * calcRiser, stepWidth, runB, tread, 180)\n }\n\n } else if (a.stairType === '2QuarterLanding') {\n // 2 Quarter Landing\n\n if (a.w stepWidth * 2) {\n runB = 1\n runC = runC - 1\n }\n\n if (!flipStair) {\n _straightRun(0, 0, 0, runA, (a.l - stepWidth) / runA)\n _platform(a.l - stepWidth, runA * calcRiser, 0, stepWidth, stepWidth)\n _straightRun(a.l, runA * calcRiser, stepWidth, runB, (a.w - stepWidth * 2) / runB, 90)\n _platform(a.l, (runA + runB) * calcRiser, stairWidth - stepWidth, stepWidth, stepWidth, 90)\n _straightRun(runA * tread, (runA + runB) * calcRiser, stairWidth, runC, (a.l - stepWidth) / runA, 180)\n } else {\n _straightRun(0, 0, stairWidth - stepWidth, runA, (a.l - stepWidth) / runA)\n _platform(a.l - stepWidth, (runA + runB) * calcRiser, 0, stepWidth, stepWidth)\n _straightRun(a.l - stepWidth, runA * calcRiser, stairWidth - stepWidth, runB, (a.w - stepWidth * 2) / runB, -90)\n _platform(a.l, runA * calcRiser, stairWidth - stepWidth, stepWidth, stepWidth, 90)\n _straightRun(runA * tread, (runA + runB) * calcRiser, stepWidth, runC, (a.l - stepWidth) / runA, 180)\n }\n\n } else if (a.stairType === 'winder') {\n // Winder\n\n if (a.w 0) _straightRun(a.l, (runA + runB) * calcRiser, stepWidth + stairWell, runC, (a.w - stepWidth - stairWell) / runC, 90)\n } else {\n _straightRun(0, 0, a.w-stepWidth, runA, (a.l - stepWidth - stairWell) / runA)\n _winder(a.l - stepWidth - stairWell, runA * calcRiser, a.w-stepWidth, runB, 0, flipStair)\n if (runC > 0) _straightRun(a.l - stepWidth, (runA + runB) * calcRiser, a.w - stepWidth - stairWell, runC, (a.w - stepWidth - stairWell) / runC, -90)\n }\n\n } else if (a.stairType === 'doubleWinder') {\n // Double Winder\n\n if (a.w<(stepWidth+0.15)*2) a.w=(stepWidth+0.15)*2\n if (a.l 0) _straightRun(0, 0, 0, runA, (a.l - stepWidth - stairWell) / runA)\n _winder(a.l - stepWidth - stairWell, runA * calcRiser, 0, runB / 2)\n if (runC > 0) _straightRun(a.l, (runA + runB / 2) * calcRiser, stepWidth + stairWell, runC, (a.w - (stepWidth + stairWell) * 2) / runC, 90)\n _winder(a.l, (runA + runB / 2 + runC) * calcRiser, a.w - stepWidth - stairWell, runB / 2, 90)\n if (runA > 0) _straightRun(a.l - stepWidth - stairWell, (runA + runB + runC) * calcRiser, a.w, runA, (a.l - stepWidth - stairWell) / runA, 180)\n } else {\n if (runA > 0) _straightRun(0, 0, a.w - stepWidth, runA, (a.l - stepWidth - stairWell) / runA)\n _winder(a.l - stepWidth - stairWell, runA * calcRiser, a.w - stepWidth, runB / 2, 0, flipStair)\n if (runC > 0) _straightRun(a.l - stepWidth, (runA + runB / 2) * calcRiser, a.w - stepWidth - stairWell, runC, (a.w - (stepWidth + stairWell) * 2) / runC, -90)\n _winder(a.l - stepWidth, (runA + runB / 2 + runC) * calcRiser, stepWidth + stairWell, runB / 2, -90, flipStair)\n if (runA > 0) _straightRun(a.l - stepWidth - stairWell, (runA + runB + runC) * calcRiser, stepWidth, runA, (a.l - stepWidth - stairWell) / runA, 180)\n }\n\n } else if (a.stairType === 'spiral') {\n // Spiral\n\n stairWidth = a.w\n\n if (stairWidth < stepWidth) {\n stairWidth = stepWidth\n a.w = stepWidth\n }\n\n if ((a.l/ a.h)<=stepRatioMin) a.l = a.h*stepRatioMin\n if ((a.l/ a.h)>=stepRatioMax) a.l = a.h*stepRatioMax\n stairLength = a.l\n calcTread = ((stairLength/a.h + 1.2321)/0.10357)/100\n stepNumber = Math.round(stairLength/calcTread)\n calcRiser = a.h/stepNumber\n tread = stairLength/stepNumber\n\n runA = stepNumber\n\n _spiralRun(0, 0, 0, runA, flipStair)\n\n }\n\n // Geometry Generation Functions\n\n function _straightRun(xCursor, yCursor, zCursor, stepNumber, tread, angle) {\n ////// BASE\n var vs, ve, ts, te, rs, re, xRotate, i,\n offsetX = xCursor,\n offsetZ = zCursor\n\n vs = stepsVertices.length\n ts = treadVertices.length\n rs = railingVertices.length\n\n // Left Railing\n if (a.railing === 'left'||a.railing === 'both') _railing(xCursor, yCursor+calcRiser, zCursor+handrailThickness+0.01, xCursor+stepNumber*tread, yCursor+stepNumber*calcRiser+calcRiser, zCursor+handrailThickness+0.01)\n if (a.railing === 'right'||a.railing === 'both') _railing(xCursor, yCursor+calcRiser, zCursor+stepWidth-0.01, xCursor+stepNumber*tread, yCursor+stepNumber*calcRiser+calcRiser, zCursor+stepWidth-0.01)\n\n for (var k = 0; k < stepNumber; k++) {\n\n // F----I\n // |\\ |\\\n // G \\ H \\\n // |\\ A----D\n // J \\| |\n // B C\n // | /\n // E\n\n aX = xCursor\n aY = yCursor + calcRiser - a.treadHeight\n aZ = zCursor + stepWidth\n bY = yCursor\n cX = xCursor + tread\n cY = yCursor + calcRiser - riserExt\n cZ = aZ\n eY = yCursor - riserExt\n fX = aX\n fZ = zCursor\n hX = cX\n hZ = fZ\n\n _step(aX, aY, aZ, bY, cY, cX, cZ, eY, fX, fZ, hX, hZ)\n\n xCursor += tread\n yCursor += calcRiser\n }\n\n ve = stepsVertices.length\n te = treadVertices.length\n re = railingVertices.length\n\n if (angle) {\n\n var cosAngle = Math.cos(angle / 180 * Math.PI),\n sinAngle = Math.sin(angle / 180 * Math.PI)\n\n for (i=vs;i 0) {\n\n // O----R\n // P\\---Q\\\n // \\\\ \\\\\n // \\K----N\n // L----M\n\n kX = aX\n kY = aY + a.treadHeight\n kZ = zCursor+ width\n lY = aY\n mX = aX + platformExt\n oZ = zCursor\n\n if (a.stairType === 'lShaped'||a.stairType === 'halfLanding' ||a.stairType === '2QuarterLanding') {\n\n // BACK\n //M\n treadVertices[tvPos] = treadVertices[tvPos + 9] = mX\n treadVertices[tvPos + 1] = treadVertices[tvPos + 10] = kY\n treadVertices[tvPos + 2] = treadVertices[tvPos + 11] = kZ\n //N\n treadVertices[tvPos + 3] = mX\n treadVertices[tvPos + 4] = lY\n treadVertices[tvPos + 5] = kZ\n //Q\n treadVertices[tvPos + 6] = treadVertices[tvPos + 12] = mX\n treadVertices[tvPos + 7] = treadVertices[tvPos + 13] = lY\n treadVertices[tvPos + 8] = treadVertices[tvPos + 14] = oZ\n //R\n treadVertices[tvPos + 15] = mX\n treadVertices[tvPos + 16] = kY\n treadVertices[tvPos + 17] = oZ\n\n tvPos += 18\n }\n\n // TOP\n //R\n treadVertices[tvPos] = treadVertices[tvPos + 9] = mX\n treadVertices[tvPos + 1] = treadVertices[tvPos + 10] = kY\n treadVertices[tvPos + 2] = treadVertices[tvPos + 11] = oZ\n //O\n treadVertices[tvPos + 3] = kX\n treadVertices[tvPos + 4] = kY\n treadVertices[tvPos + 5] = oZ\n //K\n treadVertices[tvPos + 6] = treadVertices[tvPos + 12] = kX\n treadVertices[tvPos + 7] = treadVertices[tvPos + 13] = kY\n treadVertices[tvPos + 8] = treadVertices[tvPos + 14] = kZ\n //N\n treadVertices[tvPos + 15] = mX\n treadVertices[tvPos + 16] = kY\n treadVertices[tvPos + 17] = kZ\n\n tvPos += 18\n // RIGHT\n //K\n treadVertices[tvPos] = treadVertices[tvPos + 9] = kX\n treadVertices[tvPos + 1] = treadVertices[tvPos + 10] = kY\n treadVertices[tvPos + 2] = treadVertices[tvPos + 11] = kZ\n //L\n treadVertices[tvPos + 3] = kX\n treadVertices[tvPos + 4] = lY\n treadVertices[tvPos + 5] = kZ\n //M\n treadVertices[tvPos + 6] = treadVertices[tvPos + 12] = mX\n treadVertices[tvPos + 7] = treadVertices[tvPos + 13] = lY\n treadVertices[tvPos + 8] = treadVertices[tvPos + 14] = kZ\n //N\n treadVertices[tvPos + 15] = mX\n treadVertices[tvPos + 16] = kY\n treadVertices[tvPos + 17] = kZ\n\n tvPos += 18\n // FRONT\n //O\n treadVertices[tvPos] = treadVertices[tvPos + 9] = kX\n treadVertices[tvPos + 1] = treadVertices[tvPos + 10] = kY\n treadVertices[tvPos + 2] = treadVertices[tvPos + 11] = oZ\n //P\n treadVertices[tvPos + 3] = kX\n treadVertices[tvPos + 4] = lY\n treadVertices[tvPos + 5] = oZ\n //L\n treadVertices[tvPos + 6] = treadVertices[tvPos + 12] = kX\n treadVertices[tvPos + 7] = treadVertices[tvPos + 13] = lY\n treadVertices[tvPos + 8] = treadVertices[tvPos + 14] = kZ\n //K\n treadVertices[tvPos + 15] = kX\n treadVertices[tvPos + 16] = kY\n treadVertices[tvPos + 17] = kZ\n\n tvPos += 18\n\n // LEFT\n //R\n treadVertices[tvPos] = treadVertices[tvPos + 9] = mX\n treadVertices[tvPos + 1] = treadVertices[tvPos + 10] = kY\n treadVertices[tvPos + 2] = treadVertices[tvPos + 11] = oZ\n //Q\n treadVertices[tvPos + 3] = mX\n treadVertices[tvPos + 4] = lY\n treadVertices[tvPos + 5] = oZ\n //P\n treadVertices[tvPos + 6] = treadVertices[tvPos + 12] = kX\n treadVertices[tvPos + 7] = treadVertices[tvPos + 13] = lY\n treadVertices[tvPos + 8] = treadVertices[tvPos + 14] = oZ\n //O\n treadVertices[tvPos + 15] = kX\n treadVertices[tvPos + 16] = kY\n treadVertices[tvPos + 17] = oZ\n\n tvPos += 18\n // Show Back and Bottom Face if Stair is not massive\n /*\n if (a.construction !== 0) {\n\n // BACK\n //N\n treadVertices[tvPos] = treadVertices[tvPos + 9] = mX\n treadVertices[tvPos + 1] = treadVertices[tvPos + 10] = kY\n treadVertices[tvPos + 2] = treadVertices[tvPos + 11] = kZ\n //M\n treadVertices[tvPos + 3] = mX\n treadVertices[tvPos + 4] = lY\n treadVertices[tvPos + 5] = kZ\n //Q\n treadVertices[tvPos + 6] = treadVertices[tvPos + 12] = mX\n treadVertices[tvPos + 7] = treadVertices[tvPos + 13] = lY\n treadVertices[tvPos + 8] = treadVertices[tvPos + 14] = oZ\n //R\n treadVertices[tvPos + 15] = mX\n treadVertices[tvPos + 16] = kY\n treadVertices[tvPos + 17] = oZ\n\n tvPos += 18\n\n // BOTTOM\n //M\n treadVertices[tvPos] = treadVertices[tvPos + 9] = mX\n treadVertices[tvPos + 1] = treadVertices[tvPos + 10] = lY\n treadVertices[tvPos + 2] = treadVertices[tvPos + 11] = kZ\n //L\n treadVertices[tvPos + 3] = kX\n treadVertices[tvPos + 4] = lY\n treadVertices[tvPos + 5] = kZ\n //P\n treadVertices[tvPos + 6] = treadVertices[tvPos + 12] = kX\n treadVertices[tvPos + 7] = treadVertices[tvPos + 13] = lY\n treadVertices[tvPos + 8] = treadVertices[tvPos + 14] = oZ\n //Q\n treadVertices[tvPos + 15] = mX\n treadVertices[tvPos + 16] = lY\n treadVertices[tvPos + 17] = oZ\n\n tvPos += 18\n } */\n\n ve = stepsVertices.length\n te = treadVertices.length\n re = railingVertices.length\n\n if (angle) {\n var cosAngle = Math.cos(angle / 180 * Math.PI),\n sinAngle = Math.sin(angle / 180 * Math.PI)\n\n for (i=vs;i= a.h-calcRiser) {\n // BACK > LAST STEP\n\n //D\n stepsVertices[svPos] = stepsVertices[svPos + 9] = cX\n stepsVertices[svPos + 1] = stepsVertices[svPos + 10] = aY\n stepsVertices[svPos + 2] = stepsVertices[svPos + 11] = cZ\n //C\n stepsVertices[svPos + 3] = cX\n stepsVertices[svPos + 4] = cY\n stepsVertices[svPos + 5] = cZ\n //H\n stepsVertices[svPos + 6] = stepsVertices[svPos + 12] = hX\n stepsVertices[svPos + 7] = stepsVertices[svPos + 13] = cY\n stepsVertices[svPos + 8] = stepsVertices[svPos + 14] = hZ\n //I\n stepsVertices[svPos + 15] = hX\n stepsVertices[svPos + 16] = aY\n stepsVertices[svPos + 17] = hZ\n\n svPos += 18\n }\n\n if (!a.treadHeight) {\n // TOP\n\n //I\n stepsVertices[svPos] = stepsVertices[svPos + 9] = hX\n stepsVertices[svPos + 1] = stepsVertices[svPos + 10] = aY\n stepsVertices[svPos + 2] = stepsVertices[svPos + 11] = hZ\n //F\n stepsVertices[svPos + 3] = fX\n stepsVertices[svPos + 4] = aY\n stepsVertices[svPos + 5] = fZ\n //A\n stepsVertices[svPos + 6] = stepsVertices[svPos + 12] = aX\n stepsVertices[svPos + 7] = stepsVertices[svPos + 13] = aY\n stepsVertices[svPos + 8] = stepsVertices[svPos + 14] = aZ\n //D\n stepsVertices[svPos + 15] = cX\n stepsVertices[svPos + 16] = aY\n stepsVertices[svPos + 17] = cZ\n\n svPos += 18\n }\n\n // SIDE RIGHT\n //A\n stepsVertices[svPos] = stepsVertices[svPos + 9] = aX\n stepsVertices[svPos + 1] = stepsVertices[svPos + 10] = aY\n stepsVertices[svPos + 2] = stepsVertices[svPos + 11] = aZ\n //B\n stepsVertices[svPos + 3] = aX\n stepsVertices[svPos + 4] = bY\n stepsVertices[svPos + 5] = aZ\n //C\n stepsVertices[svPos + 6] = stepsVertices[svPos + 12] = cX\n stepsVertices[svPos + 7] = stepsVertices[svPos + 13] = cY\n stepsVertices[svPos + 8] = stepsVertices[svPos + 14] = cZ\n //D\n stepsVertices[svPos + 15] = cX\n stepsVertices[svPos + 16] = aY\n stepsVertices[svPos + 17] = cZ\n\n svPos += 18\n\n if (bY === kY) {\n //B\n stepsVertices[svPos] = aX\n stepsVertices[svPos + 1] = bY\n stepsVertices[svPos + 2] = aZ\n //E\n stepsVertices[svPos + 3] = aX\n stepsVertices[svPos + 4] = eY\n stepsVertices[svPos + 5] = aZ\n //C\n stepsVertices[svPos + 6] = cX\n stepsVertices[svPos + 7] = cY\n stepsVertices[svPos + 8] = cZ\n\n svPos += 9\n } else {\n //C\n stepsVertices[svPos] = stepsVertices[svPos + 9] = cX\n stepsVertices[svPos + 1] = stepsVertices[svPos + 10] = cY\n stepsVertices[svPos + 2] = stepsVertices[svPos + 11] = cZ\n //B\n stepsVertices[svPos + 3] = aX\n stepsVertices[svPos + 4] = bY\n stepsVertices[svPos + 5] = aZ\n //K\n stepsVertices[svPos + 6] = stepsVertices[svPos + 12] = aX\n stepsVertices[svPos + 7] = stepsVertices[svPos + 13] = kY\n stepsVertices[svPos + 8] = stepsVertices[svPos + 14] = aZ\n //E\n stepsVertices[svPos + 15] = aX\n stepsVertices[svPos + 16] = eY\n stepsVertices[svPos + 17] = aZ\n\n svPos += 18\n }\n\n //Front\n //F\n stepsVertices[svPos] = stepsVertices[svPos + 9] = fX\n stepsVertices[svPos + 1] = stepsVertices[svPos + 10] = aY\n stepsVertices[svPos + 2] = stepsVertices[svPos + 11] = fZ\n //G\n stepsVertices[svPos + 3] = fX\n stepsVertices[svPos + 4] = bY\n stepsVertices[svPos + 5] = fZ\n //B\n stepsVertices[svPos + 6] = stepsVertices[svPos + 12] = aX\n stepsVertices[svPos + 7] = stepsVertices[svPos + 13] = bY\n stepsVertices[svPos + 8] = stepsVertices[svPos + 14] = aZ\n //A\n stepsVertices[svPos + 15] = aX\n stepsVertices[svPos + 16] = aY\n stepsVertices[svPos + 17] = aZ\n\n svPos += 18\n\n //SIDE LEFT\n //I\n stepsVertices[svPos] = stepsVertices[svPos + 9] = hX\n stepsVertices[svPos + 1] = stepsVertices[svPos + 10] = aY\n stepsVertices[svPos + 2] = stepsVertices[svPos + 11] = hZ\n //H\n stepsVertices[svPos + 3] = hX\n stepsVertices[svPos + 4] = cY\n stepsVertices[svPos + 5] = hZ\n //G\n stepsVertices[svPos + 6] = stepsVertices[svPos + 12] = fX\n stepsVertices[svPos + 7] = stepsVertices[svPos + 13] = bY\n stepsVertices[svPos + 8] = stepsVertices[svPos + 14] = fZ\n //F\n stepsVertices[svPos + 15] = fX\n stepsVertices[svPos + 16] = aY\n stepsVertices[svPos + 17] = fZ\n\n svPos += 18\n\n if (bY === kY) {\n //H\n stepsVertices[svPos] = hX\n stepsVertices[svPos + 1] = cY\n stepsVertices[svPos + 2] = hZ\n //J\n stepsVertices[svPos + 3] = fX\n stepsVertices[svPos + 4] = eY\n stepsVertices[svPos + 5] = fZ\n //G\n stepsVertices[svPos + 6] = fX\n stepsVertices[svPos + 7] = bY\n stepsVertices[svPos + 8] = fZ\n\n svPos += 9\n } else {\n //H\n stepsVertices[svPos] = stepsVertices[svPos + 9] = hX\n stepsVertices[svPos + 1] = stepsVertices[svPos + 10] = cY\n stepsVertices[svPos + 2] = stepsVertices[svPos + 11] = hZ\n //J\n stepsVertices[svPos + 3] = fX\n stepsVertices[svPos + 4] = eY\n stepsVertices[svPos + 5] = fZ\n //L\n stepsVertices[svPos + 6] = stepsVertices[svPos + 12] = fX\n stepsVertices[svPos + 7] = stepsVertices[svPos + 13] = kY\n stepsVertices[svPos + 8] = stepsVertices[svPos + 14] = fZ\n //G\n stepsVertices[svPos + 15] = fX\n stepsVertices[svPos + 16] = bY\n stepsVertices[svPos + 17] = fZ\n\n svPos += 18\n }\n\n // BOTTOM\n\n //H\n stepsVertices[svPos] = stepsVertices[svPos + 9] = hX\n stepsVertices[svPos + 1] = stepsVertices[svPos + 10] = cY\n stepsVertices[svPos + 2] = stepsVertices[svPos + 11] = hZ\n //C\n stepsVertices[svPos + 3] = cX\n stepsVertices[svPos + 4] = cY\n stepsVertices[svPos + 5] = cZ\n //E\n stepsVertices[svPos + 6] = stepsVertices[svPos + 12] = aX\n stepsVertices[svPos + 7] = stepsVertices[svPos + 13] = eY\n stepsVertices[svPos + 8] = stepsVertices[svPos + 14] = aZ\n //J\n stepsVertices[svPos + 15] = fX\n stepsVertices[svPos + 16] = eY\n stepsVertices[svPos + 17] = fZ\n\n svPos += 18\n\n if (a.treadHeight) {\n // TREAD\n\n // O----R\n // P\\---Q\\\n // \\\\ \\\\\n // \\K----N\n // L----M\n\n kX = aX - nosing\n kY = aY + a.treadHeight\n kZ = aZ\n lY = aY\n mX = cX\n mZ = cZ\n oX = fX - nosing\n oZ = fZ\n qX = hX\n qZ = hZ\n\n if (kX!==oX&&kZ!==oZ) {\n var radAngle = Math.atan2(kZ - oZ, kX-oX);\n var degAngle = Math.round(radAngle * 180 / Math.PI * 100)/100;\n if (a.stairType === 'winder' || a.stairType === 'doubleWinder' ){\n if (degAngle >= 135) {\n kX = aX\n kZ = aZ - nosing\n oX = fX\n oZ = fZ - nosing\n }\n if (degAngle <= 45 ) { //>= 45 && degAngle < 90) {\n kX = aX\n kZ = aZ + nosing\n oX = fX\n oZ = fZ + nosing\n }\n } else if (a.stairType === 'spiral') {\n kX = aX - nosing*Math.cos(radAngle-Math.PI/2)\n kZ = aZ - nosing*Math.sin(radAngle-Math.PI/2)\n oX = fX - nosing*Math.cos(radAngle-Math.PI/2)\n oZ = fZ - nosing*Math.sin(radAngle-Math.PI/2)\n }\n }\n\n if (aY >= a.h-calcRiser) {\n // BACK > LAST STEP\n\n //N\n treadVertices[tvPos] = treadVertices[tvPos + 9] = mX\n treadVertices[tvPos + 1] = treadVertices[tvPos + 10] = kY\n treadVertices[tvPos + 2] = treadVertices[tvPos + 11] = mZ\n //M\n treadVertices[tvPos + 3] = mX\n treadVertices[tvPos + 4] = lY\n treadVertices[tvPos + 5] = mZ\n //Q\n treadVertices[tvPos + 6] = treadVertices[tvPos + 12] = qX\n treadVertices[tvPos + 7] = treadVertices[tvPos + 13] = lY\n treadVertices[tvPos + 8] = treadVertices[tvPos + 14] = qZ\n //R\n treadVertices[tvPos + 15] = qX\n treadVertices[tvPos + 16] = kY\n treadVertices[tvPos + 17] = qZ\n\n tvPos += 18\n }\n\n // TOP\n //R\n treadVertices[tvPos] = treadVertices[tvPos + 9] = qX\n treadVertices[tvPos + 1] = treadVertices[tvPos + 10] = kY\n treadVertices[tvPos + 2] = treadVertices[tvPos + 11] = qZ\n //O\n treadVertices[tvPos + 3] = oX\n treadVertices[tvPos + 4] = kY\n treadVertices[tvPos + 5] = oZ\n //K\n treadVertices[tvPos + 6] = treadVertices[tvPos + 12] = kX\n treadVertices[tvPos + 7] = treadVertices[tvPos + 13] = kY\n treadVertices[tvPos + 8] = treadVertices[tvPos + 14] = kZ\n //N\n treadVertices[tvPos + 15] = mX\n treadVertices[tvPos + 16] = kY\n treadVertices[tvPos + 17] = mZ\n\n tvPos += 18\n // RIGHT\n //K\n treadVertices[tvPos] = treadVertices[tvPos + 9] = kX\n treadVertices[tvPos + 1] = treadVertices[tvPos + 10] = kY\n treadVertices[tvPos + 2] = treadVertices[tvPos + 11] = kZ\n //L\n treadVertices[tvPos + 3] = kX\n treadVertices[tvPos + 4] = lY\n treadVertices[tvPos + 5] = kZ\n //M\n treadVertices[tvPos + 6] = treadVertices[tvPos + 12] = mX\n treadVertices[tvPos + 7] = treadVertices[tvPos + 13] = lY\n treadVertices[tvPos + 8] = treadVertices[tvPos + 14] = mZ\n //N\n treadVertices[tvPos + 15] = mX\n treadVertices[tvPos + 16] = kY\n treadVertices[tvPos + 17] = mZ\n\n tvPos += 18\n // FRONT\n //O\n treadVertices[tvPos] = treadVertices[tvPos + 9] = oX\n treadVertices[tvPos + 1] = treadVertices[tvPos + 10] = kY\n treadVertices[tvPos + 2] = treadVertices[tvPos + 11] = oZ\n //P\n treadVertices[tvPos + 3] = oX\n treadVertices[tvPos + 4] = lY\n treadVertices[tvPos + 5] = oZ\n //L\n treadVertices[tvPos + 6] = treadVertices[tvPos + 12] = kX\n treadVertices[tvPos + 7] = treadVertices[tvPos + 13] = lY\n treadVertices[tvPos + 8] = treadVertices[tvPos + 14] = kZ\n //K\n treadVertices[tvPos + 15] = kX\n treadVertices[tvPos + 16] = kY\n treadVertices[tvPos + 17] = kZ\n\n tvPos += 18\n\n // LEFT\n //R\n treadVertices[tvPos] = treadVertices[tvPos + 9] = qX\n treadVertices[tvPos + 1] = treadVertices[tvPos + 10] = kY\n treadVertices[tvPos + 2] = treadVertices[tvPos + 11] = qZ\n //Q\n treadVertices[tvPos + 3] = qX\n treadVertices[tvPos + 4] = lY\n treadVertices[tvPos + 5] = qZ\n //P\n treadVertices[tvPos + 6] = treadVertices[tvPos + 12] = oX\n treadVertices[tvPos + 7] = treadVertices[tvPos + 13] = lY\n treadVertices[tvPos + 8] = treadVertices[tvPos + 14] = oZ\n //O\n treadVertices[tvPos + 15] = oX\n treadVertices[tvPos + 16] = kY\n treadVertices[tvPos + 17] = oZ\n\n tvPos += 18\n\n }\n }\n\n function _winder(xCursor, yCursor, zCursor, stepNumber, angle, flip) {\n\n var vs, ve, ts, te, rs, re, xRotate, i,\n offsetX = xCursor,\n offsetZ = zCursor\n\n vs = stepsVertices.length\n ts = treadVertices.length\n rs = railingVertices.length\n\n var winderOffset = stairWell\n\n var treadWinderNum = stepNumber/2\n\n var treadWinderMax = (stepWidth+winderOffset)/treadWinderNum\n var treadWinderMin = winderOffset/treadWinderNum\n\n var stepMin = 0\n var stepMax = 0\n\n // Railing adapted to stair direction\n if (!flip) {\n if (a.railing === 'left' || a.railing === 'both') _railing(xCursor, yCursor + calcRiser, zCursor + handrailThickness + 0.01, xCursor + treadWinderNum * treadWinderMax - 0.01, yCursor + treadWinderNum * calcRiser + calcRiser, zCursor + handrailThickness + 0.01, 0, true)\n if (a.railing === 'right' || a.railing === 'both') _railing(xCursor, yCursor + calcRiser, zCursor + stepWidth - 0.01, xCursor + treadWinderNum * treadWinderMin, yCursor + treadWinderNum * calcRiser + calcRiser, zCursor + stepWidth - 0.01, 0, true)\n } else {\n if (a.railing === 'left' || a.railing === 'both') _railing(xCursor, yCursor + calcRiser, zCursor + handrailThickness + 0.01, xCursor + treadWinderNum * treadWinderMin, yCursor + treadWinderNum * calcRiser + calcRiser, zCursor + handrailThickness + 0.01, 0, true)\n if (a.railing === 'right' || a.railing === 'both') _railing(xCursor, yCursor + calcRiser, zCursor + stepWidth - 0.01, xCursor + treadWinderNum * treadWinderMax - 0.01, yCursor + treadWinderNum * calcRiser + calcRiser, zCursor + stepWidth - 0.01, 0, true)\n }\n\n for (var c=0; c1 ? segments - 1 : segments\n\n\n // FRONT VIEW VERTICES\n // E-----G\n // /| /|\n // A-----C |\n // | | | |\n // | F---|-H\n // |/ |/\n // B-----D\n\n\n xCursor = x1\n yCursor = y1\n zCursor = z1\n\n for(i=0; i<=segments; i++) {\n\n aX = xCursor\n aY = yCursor+vertBarStart+vertBarHeight\n aZ = zCursor\n bY = a.railingType !== 'verticalBars' ? yCursor+vertBarStart-calcRiser : yCursor+vertBarStart+calcHandrailThickness\n cX = xCursor + pailing\n cY = aY + t\n dY = bY + t\n fZ = zCursor - pailing\n\n //FRONT\n //A\n railingVertices[rvPos] = railingVertices[rvPos + 9] = aX\n railingVertices[rvPos + 1] = railingVertices[rvPos + 10] = aY\n railingVertices[rvPos + 2] = railingVertices[rvPos + 11] = aZ\n //B\n railingVertices[rvPos + 3] = aX\n railingVertices[rvPos + 4] = bY\n railingVertices[rvPos + 5] = aZ\n //D\n railingVertices[rvPos + 6] = railingVertices[rvPos + 12] = cX\n railingVertices[rvPos + 7] = railingVertices[rvPos + 13] = dY\n railingVertices[rvPos + 8] = railingVertices[rvPos + 14] = aZ\n //C\n railingVertices[rvPos + 15] = cX\n railingVertices[rvPos + 16] = cY\n railingVertices[rvPos + 17] = aZ\n\n rvPos = rvPos + 18\n\n //LEFT\n //E\n railingVertices[rvPos] = railingVertices[rvPos + 9] = aX\n railingVertices[rvPos + 1] = railingVertices[rvPos + 10] = aY\n railingVertices[rvPos + 2] = railingVertices[rvPos + 11] = fZ\n //F\n railingVertices[rvPos + 3] = aX\n railingVertices[rvPos + 4] = bY\n railingVertices[rvPos + 5] = fZ\n //B\n railingVertices[rvPos + 6] = railingVertices[rvPos + 12] = aX\n railingVertices[rvPos + 7] = railingVertices[rvPos + 13] = bY\n railingVertices[rvPos + 8] = railingVertices[rvPos + 14] = aZ\n //A\n railingVertices[rvPos + 15] = aX\n railingVertices[rvPos + 16] = aY\n railingVertices[rvPos + 17] = aZ\n\n rvPos = rvPos + 18\n\n //RIGHT\n //C\n railingVertices[rvPos] = railingVertices[rvPos + 9] = cX\n railingVertices[rvPos + 1] = railingVertices[rvPos + 10] = cY\n railingVertices[rvPos + 2] = railingVertices[rvPos + 11] = aZ\n //D\n railingVertices[rvPos + 3] = cX\n railingVertices[rvPos + 4] = dY\n railingVertices[rvPos + 5] = aZ\n //H\n railingVertices[rvPos + 6] = railingVertices[rvPos + 12] = cX\n railingVertices[rvPos + 7] = railingVertices[rvPos + 13] = dY\n railingVertices[rvPos + 8] = railingVertices[rvPos + 14] = fZ\n //G\n railingVertices[rvPos + 15] = cX\n railingVertices[rvPos + 16] = cY\n railingVertices[rvPos + 17] = fZ\n\n rvPos = rvPos + 18\n\n //BACK\n //G\n railingVertices[rvPos] = railingVertices[rvPos + 9] = cX\n railingVertices[rvPos + 1] = railingVertices[rvPos + 10] = cY\n railingVertices[rvPos + 2] = railingVertices[rvPos + 11] = fZ\n //H\n railingVertices[rvPos + 3] = cX\n railingVertices[rvPos + 4] = dY\n railingVertices[rvPos + 5] = fZ\n //F\n railingVertices[rvPos + 6] = railingVertices[rvPos + 12] = aX\n railingVertices[rvPos + 7] = railingVertices[rvPos + 13] = bY\n railingVertices[rvPos + 8] = railingVertices[rvPos + 14] = fZ\n //E\n railingVertices[rvPos + 15] = aX\n railingVertices[rvPos + 16] = aY\n railingVertices[rvPos + 17] = fZ\n\n rvPos = rvPos + 18\n\n xCursor += xStep\n yCursor += yStep\n }\n }\n\n yCursor = handrailStart\n\n for(i=0; i {\n c[p] = pos[p]\n })\n this.attributes.children.push(c)\n } else console.log('invalid child')\n }\n // this.attributes.children = this.attributes.children.map(c => mapAttributes(cloneDeep(getType.get(c.type).params), c))\n\n // get meshes and materials from el3d modules\n var meshes = this.generateMeshes3d()\n\n // clean up empty meshes to prevent errors\n var meshKeys = Object.keys(meshes)\n meshKeys.forEach(key => {\n if (!meshes[key].positions || !meshes[key].positions.length) {\n // console.warn('no vertices for mesh', key)\n delete meshes[key]\n }\n })\n\n // setup materials\n // defaults\n var materials = {\n front: 'default_plaster_001', //'basic-wall',\n back: 'default_plaster_001', //'basic-wall',\n base: {\n colorDiffuse: [ 0.95, 0.95, 0.95 ]\n },\n top: 'wall_top'\n }\n\n // check for adapted materials\n var materialKeys = Object.keys(data).filter(function(key) {\n return key.indexOf('material_') > -1\n })\n // add materials to instance\n materialKeys.forEach(function(key) {\n var mesh = key.replace('material_', '')\n materials[mesh] = data[key]\n })\n\n // fetch materials from mat library\n Object.keys(materials).forEach(mat => {\n materials[mat] = getMaterial(materials[mat])\n })\n\n // construct data3d object\n var data3d = {\n meshes: meshes,\n materials: materials\n }\n\n // create new one\n this_.mesh = new THREE.Object3D()\n this_.data3dView = new io3d.aFrame.three.Data3dView({parent: this_.mesh})\n\n // update view\n this_.data3dView.set(data3d)\n this_.el.setObject3D('mesh', this_.mesh)\n // emit event\n this_.el.emit('mesh-updated');\n },\n\n remove: function () {\n if (this.data3dView) {\n this.data3dView.destroy()\n this.data3dView = null\n }\n if (this.mesh) {\n this.el.removeObject3D('mesh')\n this.mesh = null\n }\n },\n\n generateMeshes3d: function () {\n var a = this.attributes\n\n // get children\n var children = a.children\n children = sortBy(children, function (model) {\n if (model.a !== undefined) {\n return model.a.x\n } else {\n return model.x\n }\n })\n\n // geometry\n var baseHeightFront = a.frontHasBase ? a.baseHeight : 0,\n baseHeightBack = a.backHasBase ? a.baseHeight : 0,\n // walls are drawn along their controlLine\n controlLine = a.controlLine ? a.controlLine : 'back',\n\n baseVertices = [],\n baseVerticesPointer = 0,\n frontVertices = [],\n frontVerticesPointer = 0,\n frontUvs = [],\n frontUvsPointer = 0,\n backVertices = [],\n backVerticesPointer = 0,\n backUvs = [],\n backUvsPointer = 0,\n topVertices = [],\n topVerticesPointer = 0,\n\n pointer = 0,\n\n al = a.l,\n // wall width\n aw = a.w,\n // back position\n azb = controlLine === 'front' ? -aw : controlLine === 'center' ? -aw / 2 : 0,\n // front position\n azf = azb + aw,\n ah = a.h,\n\n c, cPrev, cNext, cx, cy, cz, cl, cw, ch, _y1, _y2, _yf, _yb\n\n for (var i = 0, l = children.length; i < l; i++) {\n\n c = (children[ i ].a) ? children[ i ].a : children[ i ] // children attributes\n cPrev = children[ i - 1 ] ? children[ i - 1 ].a : null // previous children attributes\n cNext = children[ i + 1 ] ? children[ i + 1 ].a : null // next children attributes\n\n cx = c.x\n cy = c.y\n cl = c.l\n cw = c.w\n ch = c.h\n cz = c.side === 'front' ? azf : c.side === 'center' ? azb + aw / 2 : azb\n\n // wall before children\n\n if (pointer < cx) {\n\n // front quad vertices\n frontVertices[ frontVerticesPointer ] = frontVertices[ frontVerticesPointer + 9 ] = pointer\n frontVertices[ frontVerticesPointer + 1 ] = frontVertices[ frontVerticesPointer + 10 ] = baseHeightFront\n frontVertices[ frontVerticesPointer + 2 ] = frontVertices[ frontVerticesPointer + 11 ] = azf\n frontVertices[ frontVerticesPointer + 3 ] = cx\n frontVertices[ frontVerticesPointer + 4 ] = baseHeightFront\n frontVertices[ frontVerticesPointer + 5 ] = azf\n frontVertices[ frontVerticesPointer + 6 ] = frontVertices[ frontVerticesPointer + 12 ] = cx\n frontVertices[ frontVerticesPointer + 7 ] = frontVertices[ frontVerticesPointer + 13 ] = ah\n frontVertices[ frontVerticesPointer + 8 ] = frontVertices[ frontVerticesPointer + 14 ] = azf\n frontVertices[ frontVerticesPointer + 15 ] = pointer\n frontVertices[ frontVerticesPointer + 16 ] = ah\n frontVertices[ frontVerticesPointer + 17 ] = azf\n frontVerticesPointer += 18\n // front quad uvs\n frontUvs[ frontUvsPointer ] = frontUvs[ frontUvsPointer + 6 ] = pointer\n frontUvs[ frontUvsPointer + 1 ] = frontUvs[ frontUvsPointer + 7 ] = baseHeightFront\n frontUvs[ frontUvsPointer + 2 ] = cx\n frontUvs[ frontUvsPointer + 3 ] = baseHeightFront\n frontUvs[ frontUvsPointer + 4 ] = frontUvs[ frontUvsPointer + 8 ] = cx\n frontUvs[ frontUvsPointer + 5 ] = frontUvs[ frontUvsPointer + 9 ] = ah\n frontUvs[ frontUvsPointer + 10 ] = pointer\n frontUvs[ frontUvsPointer + 11 ] = ah\n frontUvsPointer += 12\n\n // front baseboard quad vertices\n if (baseHeightFront) {\n baseVertices[ baseVerticesPointer ] = baseVertices[ baseVerticesPointer + 9 ] = pointer\n baseVertices[ baseVerticesPointer + 1 ] = baseVertices[ baseVerticesPointer + 10 ] = 0\n baseVertices[ baseVerticesPointer + 2 ] = baseVertices[ baseVerticesPointer + 11 ] = azf\n baseVertices[ baseVerticesPointer + 3 ] = cx\n baseVertices[ baseVerticesPointer + 4 ] = 0\n baseVertices[ baseVerticesPointer + 5 ] = azf\n baseVertices[ baseVerticesPointer + 6 ] = baseVertices[ baseVerticesPointer + 12 ] = cx\n baseVertices[ baseVerticesPointer + 7 ] = baseVertices[ baseVerticesPointer + 13 ] = baseHeightFront\n baseVertices[ baseVerticesPointer + 8 ] = baseVertices[ baseVerticesPointer + 14 ] = azf\n baseVertices[ baseVerticesPointer + 15 ] = pointer\n baseVertices[ baseVerticesPointer + 16 ] = baseHeightFront\n baseVertices[ baseVerticesPointer + 17 ] = azf\n baseVerticesPointer += 18\n }\n\n // back quad vertices\n backVertices[ backVerticesPointer ] = backVertices[ backVerticesPointer + 9 ] = pointer\n backVertices[ backVerticesPointer + 1 ] = backVertices[ backVerticesPointer + 10 ] = ah\n backVertices[ backVerticesPointer + 2 ] = backVertices[ backVerticesPointer + 11 ] = azb\n backVertices[ backVerticesPointer + 3 ] = cx\n backVertices[ backVerticesPointer + 4 ] = ah\n backVertices[ backVerticesPointer + 5 ] = azb\n backVertices[ backVerticesPointer + 6 ] = backVertices[ backVerticesPointer + 12 ] = cx\n backVertices[ backVerticesPointer + 7 ] = backVertices[ backVerticesPointer + 13 ] = baseHeightBack\n backVertices[ backVerticesPointer + 8 ] = backVertices[ backVerticesPointer + 14 ] = azb\n backVertices[ backVerticesPointer + 15 ] = pointer\n backVertices[ backVerticesPointer + 16 ] = baseHeightBack\n backVertices[ backVerticesPointer + 17 ] = azb\n backVerticesPointer += 18\n // back quad uvs\n backUvs[ backUvsPointer ] = backUvs[ backUvsPointer + 6 ] = pointer\n backUvs[ backUvsPointer + 1 ] = backUvs[ backUvsPointer + 7 ] = ah\n backUvs[ backUvsPointer + 2 ] = cx\n backUvs[ backUvsPointer + 3 ] = ah\n backUvs[ backUvsPointer + 4 ] = backUvs[ backUvsPointer + 8 ] = cx\n backUvs[ backUvsPointer + 5 ] = backUvs[ backUvsPointer + 9 ] = baseHeightBack\n backUvs[ backUvsPointer + 10 ] = pointer\n backUvs[ backUvsPointer + 11 ] = baseHeightBack\n backUvsPointer += 12\n\n // back baseboard quad vertices\n if (baseHeightBack) {\n baseVertices[ baseVerticesPointer ] = baseVertices[ baseVerticesPointer + 9 ] = pointer\n baseVertices[ baseVerticesPointer + 1 ] = baseVertices[ baseVerticesPointer + 10 ] = baseHeightBack\n baseVertices[ baseVerticesPointer + 2 ] = baseVertices[ baseVerticesPointer + 11 ] = azb\n baseVertices[ baseVerticesPointer + 3 ] = cx\n baseVertices[ baseVerticesPointer + 4 ] = baseHeightBack\n baseVertices[ baseVerticesPointer + 5 ] = azb\n baseVertices[ baseVerticesPointer + 6 ] = baseVertices[ baseVerticesPointer + 12 ] = cx\n baseVertices[ baseVerticesPointer + 7 ] = baseVertices[ baseVerticesPointer + 13 ] = 0\n baseVertices[ baseVerticesPointer + 8 ] = baseVertices[ baseVerticesPointer + 14 ] = azb\n baseVertices[ baseVerticesPointer + 15 ] = pointer\n baseVertices[ baseVerticesPointer + 16 ] = 0\n baseVertices[ baseVerticesPointer + 17 ] = azb\n baseVerticesPointer += 18\n }\n\n // top quad vertices\n topVertices[ topVerticesPointer ] = topVertices[ topVerticesPointer + 9 ] = pointer\n topVertices[ topVerticesPointer + 1 ] = topVertices[ topVerticesPointer + 10 ] = ah\n topVertices[ topVerticesPointer + 2 ] = topVertices[ topVerticesPointer + 11 ] = azf\n topVertices[ topVerticesPointer + 3 ] = cx\n topVertices[ topVerticesPointer + 4 ] = ah\n topVertices[ topVerticesPointer + 5 ] = azf\n topVertices[ topVerticesPointer + 6 ] = topVertices[ topVerticesPointer + 12 ] = cx\n topVertices[ topVerticesPointer + 7 ] = topVertices[ topVerticesPointer + 13 ] = ah\n topVertices[ topVerticesPointer + 8 ] = topVertices[ topVerticesPointer + 14 ] = azb\n topVertices[ topVerticesPointer + 15 ] = pointer\n topVertices[ topVerticesPointer + 16 ] = ah\n topVertices[ topVerticesPointer + 17 ] = azb\n topVerticesPointer += 18\n\n if (pointer === 0) {\n // start face of the wall if there are openings in the wall\n // react to wall controlLine position\n if (azf > 0) {\n // left side quad vertices\n frontVertices[ frontVerticesPointer ] = frontVertices[ frontVerticesPointer + 9 ] = pointer\n frontVertices[ frontVerticesPointer + 1 ] = frontVertices[ frontVerticesPointer + 10 ] = baseHeightFront\n frontVertices[ frontVerticesPointer + 2 ] = frontVertices[ frontVerticesPointer + 11 ] = 0\n frontVertices[ frontVerticesPointer + 3 ] = pointer\n frontVertices[ frontVerticesPointer + 4 ] = baseHeightFront\n frontVertices[ frontVerticesPointer + 5 ] = azf\n frontVertices[ frontVerticesPointer + 6 ] = frontVertices[ frontVerticesPointer + 12 ] = pointer\n frontVertices[ frontVerticesPointer + 7 ] = frontVertices[ frontVerticesPointer + 13 ] = ah\n frontVertices[ frontVerticesPointer + 8 ] = frontVertices[ frontVerticesPointer + 14 ] = azf\n frontVertices[ frontVerticesPointer + 15 ] = pointer\n frontVertices[ frontVerticesPointer + 16 ] = ah\n frontVertices[ frontVerticesPointer + 17 ] = 0\n frontVerticesPointer += 18\n // left side quad uvs\n frontUvs[ frontUvsPointer ] = frontUvs[ frontUvsPointer + 6 ] = 0\n frontUvs[ frontUvsPointer + 1 ] = frontUvs[ frontUvsPointer + 7 ] = baseHeightFront\n frontUvs[ frontUvsPointer + 2 ] = azf\n frontUvs[ frontUvsPointer + 3 ] = baseHeightFront\n frontUvs[ frontUvsPointer + 4 ] = frontUvs[ frontUvsPointer + 8 ] = azf\n frontUvs[ frontUvsPointer + 5 ] = frontUvs[ frontUvsPointer + 9 ] = ah\n frontUvs[ frontUvsPointer + 10 ] = 0\n frontUvs[ frontUvsPointer + 11 ] = ah\n frontUvsPointer += 12\n\n // left side baseboard quad vertrices\n if (baseHeightFront) {\n baseVertices[ baseVerticesPointer ] = baseVertices[ baseVerticesPointer + 9 ] = pointer\n baseVertices[ baseVerticesPointer + 1 ] = baseVertices[ baseVerticesPointer + 10 ] = 0\n baseVertices[ baseVerticesPointer + 2 ] = baseVertices[ baseVerticesPointer + 11 ] = 0\n baseVertices[ baseVerticesPointer + 3 ] = pointer\n baseVertices[ baseVerticesPointer + 4 ] = 0\n baseVertices[ baseVerticesPointer + 5 ] = azf\n baseVertices[ baseVerticesPointer + 6 ] = baseVertices[ baseVerticesPointer + 12 ] = pointer\n baseVertices[ baseVerticesPointer + 7 ] = baseVertices[ baseVerticesPointer + 13 ] = baseHeightFront\n baseVertices[ baseVerticesPointer + 8 ] = baseVertices[ baseVerticesPointer + 14 ] = azf\n baseVertices[ baseVerticesPointer + 15 ] = pointer\n baseVertices[ baseVerticesPointer + 16 ] = baseHeightFront\n baseVertices[ baseVerticesPointer + 17 ] = 0\n baseVerticesPointer += 18\n }\n }\n if (azb < 0) {\n // left side quad vertices\n backVertices[ backVerticesPointer ] = backVertices[ backVerticesPointer + 9 ] = pointer\n backVertices[ backVerticesPointer + 1 ] = backVertices[ backVerticesPointer + 10 ] = baseHeightBack\n backVertices[ backVerticesPointer + 2 ] = backVertices[ backVerticesPointer + 11 ] = azb\n backVertices[ backVerticesPointer + 3 ] = pointer\n backVertices[ backVerticesPointer + 4 ] = baseHeightBack\n backVertices[ backVerticesPointer + 5 ] = 0\n backVertices[ backVerticesPointer + 6 ] = backVertices[ backVerticesPointer + 12 ] = pointer\n backVertices[ backVerticesPointer + 7 ] = backVertices[ backVerticesPointer + 13 ] = ah\n backVertices[ backVerticesPointer + 8 ] = backVertices[ backVerticesPointer + 14 ] = 0\n backVertices[ backVerticesPointer + 15 ] = pointer\n backVertices[ backVerticesPointer + 16 ] = ah\n backVertices[ backVerticesPointer + 17 ] = azb\n backVerticesPointer += 18\n // left side quad uvs\n backUvs[ backUvsPointer ] = backUvs[ backUvsPointer + 6 ] = 0\n backUvs[ backUvsPointer + 1 ] = backUvs[ backUvsPointer + 7 ] = baseHeightBack\n backUvs[ backUvsPointer + 2 ] = azb\n backUvs[ backUvsPointer + 3 ] = baseHeightBack\n backUvs[ backUvsPointer + 4 ] = backUvs[ backUvsPointer + 8 ] = azb\n backUvs[ backUvsPointer + 5 ] = backUvs[ backUvsPointer + 9 ] = ah\n backUvs[ backUvsPointer + 10 ] = 0\n backUvs[ backUvsPointer + 11 ] = ah\n backUvsPointer += 12\n\n // left side baseboard quad vertrices\n if (baseHeightBack) {\n baseVertices[ baseVerticesPointer ] = baseVertices[ baseVerticesPointer + 9 ] = pointer\n baseVertices[ baseVerticesPointer + 1 ] = baseVertices[ baseVerticesPointer + 10 ] = 0\n baseVertices[ baseVerticesPointer + 2 ] = baseVertices[ baseVerticesPointer + 11 ] = azb\n baseVertices[ baseVerticesPointer + 3 ] = pointer\n baseVertices[ baseVerticesPointer + 4 ] = 0\n baseVertices[ baseVerticesPointer + 5 ] = 0\n baseVertices[ baseVerticesPointer + 6 ] = baseVertices[ baseVerticesPointer + 12 ] = pointer\n baseVertices[ baseVerticesPointer + 7 ] = baseVertices[ baseVerticesPointer + 13 ] = baseHeightBack\n baseVertices[ baseVerticesPointer + 8 ] = baseVertices[ baseVerticesPointer + 14 ] = 0\n baseVertices[ baseVerticesPointer + 15 ] = pointer\n baseVertices[ baseVerticesPointer + 16 ] = baseHeightBack\n baseVertices[ baseVerticesPointer + 17 ] = azb\n baseVerticesPointer += 18\n }\n }\n }\n }\n\n // move pointer position\n pointer = cx\n\n // wall below children\n if (cy > 0) {\n var baseHeightBackBelow = baseHeightBack > c.y ? c.y : baseHeightBack\n var baseHeightFrontBelow = baseHeightFront > c.y ? c.y : baseHeightFront\n\n if (c.y > baseHeightFront){\n // front quad vertices\n frontVertices[ frontVerticesPointer ] = frontVertices[ frontVerticesPointer + 9 ] = pointer\n frontVertices[ frontVerticesPointer + 1 ] = frontVertices[ frontVerticesPointer + 10 ] = baseHeightFront\n frontVertices[ frontVerticesPointer + 2 ] = frontVertices[ frontVerticesPointer + 11 ] = azf\n frontVertices[ frontVerticesPointer + 3 ] = pointer + cl\n frontVertices[ frontVerticesPointer + 4 ] = baseHeightFront\n frontVertices[ frontVerticesPointer + 5 ] = azf\n frontVertices[ frontVerticesPointer + 6 ] = frontVertices[ frontVerticesPointer + 12 ] = pointer + cl\n frontVertices[ frontVerticesPointer + 7 ] = frontVertices[ frontVerticesPointer + 13 ] = cy\n frontVertices[ frontVerticesPointer + 8 ] = frontVertices[ frontVerticesPointer + 14 ] = azf\n frontVertices[ frontVerticesPointer + 15 ] = pointer\n frontVertices[ frontVerticesPointer + 16 ] = cy\n frontVertices[ frontVerticesPointer + 17 ] = azf\n frontVerticesPointer += 18\n // front quad uvs\n frontUvs[ frontUvsPointer ] = frontUvs[ frontUvsPointer + 6 ] = pointer\n frontUvs[ frontUvsPointer + 1 ] = frontUvs[ frontUvsPointer + 7 ] = baseHeightFront\n frontUvs[ frontUvsPointer + 2 ] = pointer + cl\n frontUvs[ frontUvsPointer + 3 ] = baseHeightFront\n frontUvs[ frontUvsPointer + 4 ] = frontUvs[ frontUvsPointer + 8 ] = pointer + cl\n frontUvs[ frontUvsPointer + 5 ] = frontUvs[ frontUvsPointer + 9 ] = cy\n frontUvs[ frontUvsPointer + 10 ] = pointer\n frontUvs[ frontUvsPointer + 11 ] = cy\n frontUvsPointer += 12\n }\n\n if (baseHeightFront) {\n // front baseboard quad vertices\n baseVertices[ baseVerticesPointer ] = baseVertices[ baseVerticesPointer + 9 ] = pointer\n baseVertices[ baseVerticesPointer + 1 ] = baseVertices[ baseVerticesPointer + 10 ] = 0\n baseVertices[ baseVerticesPointer + 2 ] = baseVertices[ baseVerticesPointer + 11 ] = azf\n baseVertices[ baseVerticesPointer + 3 ] = pointer + cl\n baseVertices[ baseVerticesPointer + 4 ] = 0\n baseVertices[ baseVerticesPointer + 5 ] = azf\n baseVertices[ baseVerticesPointer + 6 ] = baseVertices[ baseVerticesPointer + 12 ] = pointer + cl\n baseVertices[ baseVerticesPointer + 7 ] = baseVertices[ baseVerticesPointer + 13 ] = baseHeightFrontBelow\n baseVertices[ baseVerticesPointer + 8 ] = baseVertices[ baseVerticesPointer + 14 ] = azf\n baseVertices[ baseVerticesPointer + 15 ] = pointer\n baseVertices[ baseVerticesPointer + 16 ] = baseHeightFrontBelow\n baseVertices[ baseVerticesPointer + 17 ] = azf\n baseVerticesPointer += 18\n }\n\n if (c.y>baseHeightBack){\n // back quad vertices\n backVertices[ backVerticesPointer ] = backVertices[ backVerticesPointer + 9 ] = pointer\n backVertices[ backVerticesPointer + 1 ] = backVertices[ backVerticesPointer + 10 ] = cy\n backVertices[ backVerticesPointer + 2 ] = backVertices[ backVerticesPointer + 11 ] = azb\n backVertices[ backVerticesPointer + 3 ] = pointer + cl\n backVertices[ backVerticesPointer + 4 ] = cy\n backVertices[ backVerticesPointer + 5 ] = azb\n backVertices[ backVerticesPointer + 6 ] = backVertices[ backVerticesPointer + 12 ] = pointer + cl\n backVertices[ backVerticesPointer + 7 ] = backVertices[ backVerticesPointer + 13 ] = baseHeightBack\n backVertices[ backVerticesPointer + 8 ] = backVertices[ backVerticesPointer + 14 ] = azb\n backVertices[ backVerticesPointer + 15 ] = pointer\n backVertices[ backVerticesPointer + 16 ] = baseHeightBack\n backVertices[ backVerticesPointer + 17 ] = azb\n backVerticesPointer += 18\n // back quad uvs\n backUvs[ backUvsPointer ] = backUvs[ backUvsPointer + 6 ] = pointer\n backUvs[ backUvsPointer + 1 ] = backUvs[ backUvsPointer + 7 ] = cy\n backUvs[ backUvsPointer + 2 ] = pointer + cl\n backUvs[ backUvsPointer + 3 ] = cy\n backUvs[ backUvsPointer + 4 ] = backUvs[ backUvsPointer + 8 ] = pointer + cl\n backUvs[ backUvsPointer + 5 ] = backUvs[ backUvsPointer + 9 ] = baseHeightBack\n backUvs[ backUvsPointer + 10 ] = pointer\n backUvs[ backUvsPointer + 11 ] = baseHeightBack\n backUvsPointer += 12\n }\n\n if (baseHeightBack) {\n // back base quad vertices\n baseVertices[ baseVerticesPointer ] = baseVertices[ baseVerticesPointer + 9 ] = pointer\n baseVertices[ baseVerticesPointer + 1 ] = baseVertices[ baseVerticesPointer + 10 ] = baseHeightBackBelow\n baseVertices[ baseVerticesPointer + 2 ] = baseVertices[ baseVerticesPointer + 11 ] = azb\n baseVertices[ baseVerticesPointer + 3 ] = pointer + cl\n baseVertices[ baseVerticesPointer + 4 ] = baseHeightBackBelow\n baseVertices[ baseVerticesPointer + 5 ] = azb\n baseVertices[ baseVerticesPointer + 6 ] = baseVertices[ baseVerticesPointer + 12 ] = pointer + cl\n baseVertices[ baseVerticesPointer + 7 ] = baseVertices[ baseVerticesPointer + 13 ] = 0\n baseVertices[ baseVerticesPointer + 8 ] = baseVertices[ baseVerticesPointer + 14 ] = azb\n baseVertices[ baseVerticesPointer + 15 ] = pointer\n baseVertices[ baseVerticesPointer + 16 ] = 0\n baseVertices[ baseVerticesPointer + 17 ] = azb\n baseVerticesPointer += 18\n }\n\n // top quad vertices below opening\n // react to opening z-position\n if (azf > cz) {\n if (c.y > baseHeightFront) {\n // baseboard lower than opening\n frontVertices[ frontVerticesPointer ] = frontVertices[ frontVerticesPointer + 9 ] = pointer\n frontVertices[ frontVerticesPointer + 1 ] = frontVertices[ frontVerticesPointer + 10 ] = cy\n frontVertices[ frontVerticesPointer + 2 ] = frontVertices[ frontVerticesPointer + 11 ] = azf\n frontVertices[ frontVerticesPointer + 3 ] = pointer + cl\n frontVertices[ frontVerticesPointer + 4 ] = cy\n frontVertices[ frontVerticesPointer + 5 ] = azf\n frontVertices[ frontVerticesPointer + 6 ] = frontVertices[ frontVerticesPointer + 12 ] = pointer + cl\n frontVertices[ frontVerticesPointer + 7 ] = frontVertices[ frontVerticesPointer + 13 ] = cy\n frontVertices[ frontVerticesPointer + 8 ] = frontVertices[ frontVerticesPointer + 14 ] = cz\n frontVertices[ frontVerticesPointer + 15 ] = pointer\n frontVertices[ frontVerticesPointer + 16 ] = cy\n frontVertices[ frontVerticesPointer + 17 ] = cz\n frontVerticesPointer += 18\n // top quad uvs\n frontUvs[ frontUvsPointer ] = frontUvs[ frontUvsPointer + 6 ] = pointer\n frontUvs[ frontUvsPointer + 1 ] = frontUvs[ frontUvsPointer + 7 ] = aw\n frontUvs[ frontUvsPointer + 2 ] = pointer + cl\n frontUvs[ frontUvsPointer + 3 ] = aw\n frontUvs[ frontUvsPointer + 4 ] = frontUvs[ frontUvsPointer + 8 ] = pointer + cl\n frontUvs[ frontUvsPointer + 5 ] = frontUvs[ frontUvsPointer + 9 ] = 0\n frontUvs[ frontUvsPointer + 10 ] = pointer\n frontUvs[ frontUvsPointer + 11 ] = 0\n frontUvsPointer += 12\n } else {\n // draw baseboard\n baseVertices[ baseVerticesPointer ] = baseVertices[ baseVerticesPointer + 9 ] = pointer\n baseVertices[ baseVerticesPointer + 1 ] = baseVertices[ baseVerticesPointer + 10 ] = cy\n baseVertices[ baseVerticesPointer + 2 ] = baseVertices[ baseVerticesPointer + 11 ] = azf\n baseVertices[ baseVerticesPointer + 3 ] = pointer + cl\n baseVertices[ baseVerticesPointer + 4 ] = cy\n baseVertices[ baseVerticesPointer + 5 ] = azf\n baseVertices[ baseVerticesPointer + 6 ] = baseVertices[ baseVerticesPointer + 12 ] = pointer + cl\n baseVertices[ baseVerticesPointer + 7 ] = baseVertices[ baseVerticesPointer + 13 ] = cy\n baseVertices[ baseVerticesPointer + 8 ] = baseVertices[ baseVerticesPointer + 14 ] = cz\n baseVertices[ baseVerticesPointer + 15 ] = pointer\n baseVertices[ baseVerticesPointer + 16 ] = cy\n baseVertices[ baseVerticesPointer + 17 ] = cz\n baseVerticesPointer += 18\n }\n\n }\n if (cz > azb) {\n if (c.y > baseHeightBack) {\n // baseboard lower than opening\n // top quad vertices\n backVertices[ backVerticesPointer ] = backVertices[ backVerticesPointer + 9 ] = pointer\n backVertices[ backVerticesPointer + 1 ] = backVertices[ backVerticesPointer + 10 ] = cy\n backVertices[ backVerticesPointer + 2 ] = backVertices[ backVerticesPointer + 11 ] = cz\n backVertices[ backVerticesPointer + 3 ] = pointer + cl\n backVertices[ backVerticesPointer + 4 ] = cy\n backVertices[ backVerticesPointer + 5 ] = cz\n backVertices[ backVerticesPointer + 6 ] = backVertices[ backVerticesPointer + 12 ] = pointer + cl\n backVertices[ backVerticesPointer + 7 ] = backVertices[ backVerticesPointer + 13 ] = cy\n backVertices[ backVerticesPointer + 8 ] = backVertices[ backVerticesPointer + 14 ] = azb\n backVertices[ backVerticesPointer + 15 ] = pointer\n backVertices[ backVerticesPointer + 16 ] = cy\n backVertices[ backVerticesPointer + 17 ] = azb\n backVerticesPointer += 18\n // top quad uvs\n backUvs[ backUvsPointer ] = backUvs[ backUvsPointer + 6 ] = pointer\n backUvs[ backUvsPointer + 1 ] = backUvs[ backUvsPointer + 7 ] = aw\n backUvs[ backUvsPointer + 2 ] = pointer + cl\n backUvs[ backUvsPointer + 3 ] = aw\n backUvs[ backUvsPointer + 4 ] = backUvs[ backUvsPointer + 8 ] = pointer + cl\n backUvs[ backUvsPointer + 5 ] = backUvs[ backUvsPointer + 9 ] = 0\n backUvs[ backUvsPointer + 10 ] = pointer\n backUvs[ backUvsPointer + 11 ] = 0\n backUvsPointer += 12\n } else {\n // draw baseboard\n baseVertices[ baseVerticesPointer ] = baseVertices[ baseVerticesPointer + 9 ] = pointer\n baseVertices[ baseVerticesPointer + 1 ] = baseVertices[ baseVerticesPointer + 10 ] = cy\n baseVertices[ baseVerticesPointer + 2 ] = baseVertices[ baseVerticesPointer + 11 ] = cz\n baseVertices[ baseVerticesPointer + 3 ] = pointer + cl\n baseVertices[ baseVerticesPointer + 4 ] = cy\n baseVertices[ baseVerticesPointer + 5 ] = cz\n baseVertices[ baseVerticesPointer + 6 ] = baseVertices[ baseVerticesPointer + 12 ] = pointer + cl\n baseVertices[ baseVerticesPointer + 7 ] = baseVertices[ baseVerticesPointer + 13 ] = cy\n baseVertices[ baseVerticesPointer + 8 ] = baseVertices[ baseVerticesPointer + 14 ] = azb\n baseVertices[ baseVerticesPointer + 15 ] = pointer\n baseVertices[ baseVerticesPointer + 16 ] = cy\n baseVertices[ baseVerticesPointer + 17 ] = azb\n baseVerticesPointer += 18\n }\n }\n // left side below opening\n if (pointer <= 0) {\n // start face of the wall if opening is at x = 0\n // left side quad vertices below opening\n // react to opening z-position\n if (azf > cz) {\n if (c.y > baseHeightFront) {\n frontVertices[ frontVerticesPointer ] = frontVertices[ frontVerticesPointer + 9 ] = pointer\n frontVertices[ frontVerticesPointer + 1 ] = frontVertices[ frontVerticesPointer + 10 ] = baseHeightFront\n frontVertices[ frontVerticesPointer + 2 ] = frontVertices[ frontVerticesPointer + 11 ] = cz\n frontVertices[ frontVerticesPointer + 3 ] = pointer\n frontVertices[ frontVerticesPointer + 4 ] = baseHeightFront\n frontVertices[ frontVerticesPointer + 5 ] = azf\n frontVertices[ frontVerticesPointer + 6 ] = frontVertices[ frontVerticesPointer + 12 ] = pointer\n frontVertices[ frontVerticesPointer + 7 ] = frontVertices[ frontVerticesPointer + 13 ] = cy\n frontVertices[ frontVerticesPointer + 8 ] = frontVertices[ frontVerticesPointer + 14 ] = azf\n frontVertices[ frontVerticesPointer + 15 ] = pointer\n frontVertices[ frontVerticesPointer + 16 ] = cy\n frontVertices[ frontVerticesPointer + 17 ] = cz\n frontVerticesPointer += 18\n // left side quad uvs\n frontUvs[ frontUvsPointer ] = frontUvs[ frontUvsPointer + 6 ] = 0\n frontUvs[ frontUvsPointer + 1 ] = frontUvs[ frontUvsPointer + 7 ] = baseHeightFront\n frontUvs[ frontUvsPointer + 2 ] = aw\n frontUvs[ frontUvsPointer + 3 ] = baseHeightFront\n frontUvs[ frontUvsPointer + 4 ] = frontUvs[ frontUvsPointer + 8 ] = aw\n frontUvs[ frontUvsPointer + 5 ] = frontUvs[ frontUvsPointer + 9 ] = cy\n frontUvs[ frontUvsPointer + 10 ] = 0\n frontUvs[ frontUvsPointer + 11 ] = cy\n frontUvsPointer += 12\n }\n // left side baseboard quad vertices\n if (baseHeightFront) {\n baseVertices[ baseVerticesPointer ] = baseVertices[ baseVerticesPointer + 9 ] = pointer\n baseVertices[ baseVerticesPointer + 1 ] = baseVertices[ baseVerticesPointer + 10 ] = 0\n baseVertices[ baseVerticesPointer + 2 ] = baseVertices[ baseVerticesPointer + 11 ] = cz\n baseVertices[ baseVerticesPointer + 3 ] = pointer\n baseVertices[ baseVerticesPointer + 4 ] = 0\n baseVertices[ baseVerticesPointer + 5 ] = azf\n baseVertices[ baseVerticesPointer + 6 ] = baseVertices[ baseVerticesPointer + 12 ] = pointer\n baseVertices[ baseVerticesPointer + 7 ] = baseVertices[ baseVerticesPointer + 13 ] = baseHeightFrontBelow\n baseVertices[ baseVerticesPointer + 8 ] = baseVertices[ baseVerticesPointer + 14 ] = azf\n baseVertices[ baseVerticesPointer + 15 ] = pointer\n baseVertices[ baseVerticesPointer + 16 ] = baseHeightFrontBelow\n baseVertices[ baseVerticesPointer + 17 ] = cz\n baseVerticesPointer += 18\n }\n }\n if (cz > azb) {\n if (c.y > baseHeightBack) {\n backVertices[ backVerticesPointer ] = backVertices[ backVerticesPointer + 9 ] = pointer\n backVertices[ backVerticesPointer + 1 ] = backVertices[ backVerticesPointer + 10 ] = baseHeightBack\n backVertices[ backVerticesPointer + 2 ] = backVertices[ backVerticesPointer + 11 ] = azb\n backVertices[ backVerticesPointer + 3 ] = pointer\n backVertices[ backVerticesPointer + 4 ] = baseHeightBack\n backVertices[ backVerticesPointer + 5 ] = cz\n backVertices[ backVerticesPointer + 6 ] = backVertices[ backVerticesPointer + 12 ] = pointer\n backVertices[ backVerticesPointer + 7 ] = backVertices[ backVerticesPointer + 13 ] = cy\n backVertices[ backVerticesPointer + 8 ] = backVertices[ backVerticesPointer + 14 ] = cz\n backVertices[ backVerticesPointer + 15 ] = pointer\n backVertices[ backVerticesPointer + 16 ] = cy\n backVertices[ backVerticesPointer + 17 ] = azb\n backVerticesPointer += 18\n // left side quad uvs\n backUvs[ backUvsPointer ] = backUvs[ backUvsPointer + 6 ] = 0\n backUvs[ backUvsPointer + 1 ] = backUvs[ backUvsPointer + 7 ] = baseHeightBack\n backUvs[ backUvsPointer + 2 ] = aw\n backUvs[ backUvsPointer + 3 ] = baseHeightBack\n backUvs[ backUvsPointer + 4 ] = backUvs[ backUvsPointer + 8 ] = aw\n backUvs[ backUvsPointer + 5 ] = backUvs[ backUvsPointer + 9 ] = cy\n backUvs[ backUvsPointer + 10 ] = 0\n backUvs[ backUvsPointer + 11 ] = cy\n backUvsPointer += 12\n }\n // left side baseboard quad vertices\n if (baseHeightBack) {\n baseVertices[ baseVerticesPointer ] = baseVertices[ baseVerticesPointer + 9 ] = pointer\n baseVertices[ baseVerticesPointer + 1 ] = baseVertices[ baseVerticesPointer + 10 ] = 0\n baseVertices[ baseVerticesPointer + 2 ] = baseVertices[ baseVerticesPointer + 11 ] = azb\n baseVertices[ baseVerticesPointer + 3 ] = pointer\n baseVertices[ baseVerticesPointer + 4 ] = 0\n baseVertices[ baseVerticesPointer + 5 ] = cz\n baseVertices[ baseVerticesPointer + 6 ] = baseVertices[ baseVerticesPointer + 12 ] = pointer\n baseVertices[ baseVerticesPointer + 7 ] = baseVertices[ baseVerticesPointer + 13 ] = baseHeightBackBelow\n baseVertices[ baseVerticesPointer + 8 ] = baseVertices[ baseVerticesPointer + 14 ] = cz\n baseVertices[ baseVerticesPointer + 15 ] = pointer\n baseVertices[ baseVerticesPointer + 16 ] = baseHeightBackBelow\n baseVertices[ baseVerticesPointer + 17 ] = azb\n baseVerticesPointer += 18\n }\n }\n } else if (cPrev && cx === round(cPrev.x + cPrev.l) && cPrev.y < cy) {\n // adjacent to a window\n _yf = cy > baseHeightFront ? baseHeightFront : cy\n _yb = cy > baseHeightBack ? baseHeightBack : cy\n // left side quad vertices\n // if previous opening is higher\n if (azf > cz) {\n // react to opening z-position\n if (c.y > baseHeightFront) {\n frontVertices[ frontVerticesPointer ] = frontVertices[ frontVerticesPointer + 9 ] = pointer\n frontVertices[ frontVerticesPointer + 1 ] = frontVertices[ frontVerticesPointer + 10 ] = _yf\n frontVertices[ frontVerticesPointer + 2 ] = frontVertices[ frontVerticesPointer + 11 ] = cz\n frontVertices[ frontVerticesPointer + 3 ] = pointer\n frontVertices[ frontVerticesPointer + 4 ] = _yf\n frontVertices[ frontVerticesPointer + 5 ] = azf\n frontVertices[ frontVerticesPointer + 6 ] = frontVertices[ frontVerticesPointer + 12 ] = pointer\n frontVertices[ frontVerticesPointer + 7 ] = frontVertices[ frontVerticesPointer + 13 ] = cy\n frontVertices[ frontVerticesPointer + 8 ] = frontVertices[ frontVerticesPointer + 14 ] = azf\n frontVertices[ frontVerticesPointer + 15 ] = pointer\n frontVertices[ frontVerticesPointer + 16 ] = cy\n frontVertices[ frontVerticesPointer + 17 ] = cz\n frontVerticesPointer += 18\n // left side quad uvs\n frontUvs[ frontUvsPointer ] = frontUvs[ frontUvsPointer + 6 ] = 0\n frontUvs[ frontUvsPointer + 1 ] = frontUvs[ frontUvsPointer + 7 ] = _yf\n frontUvs[ frontUvsPointer + 2 ] = aw\n frontUvs[ frontUvsPointer + 3 ] = _yf\n frontUvs[ frontUvsPointer + 4 ] = frontUvs[ frontUvsPointer + 8 ] = aw\n frontUvs[ frontUvsPointer + 5 ] = frontUvs[ frontUvsPointer + 9 ] = cy\n frontUvs[ frontUvsPointer + 10 ] = 0\n frontUvs[ frontUvsPointer + 11 ] = cy\n frontUvsPointer += 12\n }\n // left side base quad vertices\n if (baseHeightFront && cPrev.y < baseHeightFront) {\n baseVertices[ baseVerticesPointer ] = baseVertices[ baseVerticesPointer + 9 ] = pointer\n baseVertices[ baseVerticesPointer + 1 ] = baseVertices[ baseVerticesPointer + 10 ] = cPrev.y\n baseVertices[ baseVerticesPointer + 2 ] = baseVertices[ baseVerticesPointer + 11 ] = cz\n baseVertices[ baseVerticesPointer + 3 ] = pointer\n baseVertices[ baseVerticesPointer + 4 ] = cPrev.y\n baseVertices[ baseVerticesPointer + 5 ] = azf\n baseVertices[ baseVerticesPointer + 6 ] = baseVertices[ baseVerticesPointer + 12 ] = pointer\n baseVertices[ baseVerticesPointer + 7 ] = baseVertices[ baseVerticesPointer + 13 ] = _yf\n baseVertices[ baseVerticesPointer + 8 ] = baseVertices[ baseVerticesPointer + 14 ] = azf\n baseVertices[ baseVerticesPointer + 15 ] = pointer\n baseVertices[ baseVerticesPointer + 16 ] = _yf\n baseVertices[ baseVerticesPointer + 17 ] = cz\n baseVerticesPointer += 18\n }\n }\n if (cz > azb) {\n if ( c.y > baseHeightBack) {\n backVertices[ backVerticesPointer ] = backVertices[ backVerticesPointer + 9 ] = pointer\n backVertices[ backVerticesPointer + 1 ] = backVertices[ backVerticesPointer + 10 ] = _yb\n backVertices[ backVerticesPointer + 2 ] = backVertices[ backVerticesPointer + 11 ] = azb\n backVertices[ backVerticesPointer + 3 ] = pointer\n backVertices[ backVerticesPointer + 4 ] = _yb\n backVertices[ backVerticesPointer + 5 ] = cz\n backVertices[ backVerticesPointer + 6 ] = backVertices[ backVerticesPointer + 12 ] = pointer\n backVertices[ backVerticesPointer + 7 ] = backVertices[ backVerticesPointer + 13 ] = cy\n backVertices[ backVerticesPointer + 8 ] = backVertices[ backVerticesPointer + 14 ] = cz\n backVertices[ backVerticesPointer + 15 ] = pointer\n backVertices[ backVerticesPointer + 16 ] = cy\n backVertices[ backVerticesPointer + 17 ] = azb\n backVerticesPointer += 18\n // left side quad uvs\n backUvs[ backUvsPointer ] = backUvs[ backUvsPointer + 6 ] = 0\n backUvs[ backUvsPointer + 1 ] = backUvs[ backUvsPointer + 7 ] = _yb\n backUvs[ backUvsPointer + 2 ] = aw\n backUvs[ backUvsPointer + 3 ] = _yb\n backUvs[ backUvsPointer + 4 ] = backUvs[ backUvsPointer + 8 ] = aw\n backUvs[ backUvsPointer + 5 ] = backUvs[ backUvsPointer + 9 ] = cy\n backUvs[ backUvsPointer + 10 ] = 0\n backUvs[ backUvsPointer + 11 ] = cy\n backUvsPointer += 12\n }\n // left side base quad vertices\n if (baseHeightBack && cPrev.y < baseHeightBack) {\n baseVertices[ baseVerticesPointer ] = baseVertices[ baseVerticesPointer + 9 ] = pointer\n baseVertices[ baseVerticesPointer + 1 ] = baseVertices[ baseVerticesPointer + 10 ] = cPrev.y\n baseVertices[ baseVerticesPointer + 2 ] = baseVertices[ baseVerticesPointer + 11 ] = azb\n baseVertices[ baseVerticesPointer + 3 ] = pointer\n baseVertices[ baseVerticesPointer + 4 ] = cPrev.y\n baseVertices[ baseVerticesPointer + 5 ] = cz\n baseVertices[ baseVerticesPointer + 6 ] = baseVertices[ baseVerticesPointer + 12 ] = pointer\n baseVertices[ baseVerticesPointer + 7 ] = baseVertices[ baseVerticesPointer + 13 ] = _yb\n baseVertices[ baseVerticesPointer + 8 ] = baseVertices[ baseVerticesPointer + 14 ] = cz\n baseVertices[ baseVerticesPointer + 15 ] = pointer\n baseVertices[ baseVerticesPointer + 16 ] = _yb\n baseVertices[ baseVerticesPointer + 17 ] = azb\n baseVerticesPointer += 18\n }\n }\n }\n\n // right side below opening\n // end face of the wall if opening hits end of wall\n if (round(pointer + cl) >= al) {\n // right side quad vertices\n if (azf > cz) {\n if (c.y > baseHeightFront) {\n // react to opening z-position\n frontVertices[ frontVerticesPointer ] = frontVertices[ frontVerticesPointer + 9 ] = pointer + cl\n frontVertices[ frontVerticesPointer + 1 ] = frontVertices[ frontVerticesPointer + 10 ] = baseHeightFront\n frontVertices[ frontVerticesPointer + 2 ] = frontVertices[ frontVerticesPointer + 11 ] = azf\n frontVertices[ frontVerticesPointer + 3 ] = pointer + cl\n frontVertices[ frontVerticesPointer + 4 ] = baseHeightFront\n frontVertices[ frontVerticesPointer + 5 ] = cz\n frontVertices[ frontVerticesPointer + 6 ] = frontVertices[ frontVerticesPointer + 12 ] = pointer + cl\n frontVertices[ frontVerticesPointer + 7 ] = frontVertices[ frontVerticesPointer + 13 ] = cy\n frontVertices[ frontVerticesPointer + 8 ] = frontVertices[ frontVerticesPointer + 14 ] = cz\n frontVertices[ frontVerticesPointer + 15 ] = pointer + cl\n frontVertices[ frontVerticesPointer + 16 ] = cy\n frontVertices[ frontVerticesPointer + 17 ] = azf\n frontVerticesPointer += 18\n // right side quad uvs\n frontUvs[ frontUvsPointer ] = frontUvs[ frontUvsPointer + 6 ] = aw\n frontUvs[ frontUvsPointer + 1 ] = frontUvs[ frontUvsPointer + 7 ] = baseHeightFront\n frontUvs[ frontUvsPointer + 2 ] = 0\n frontUvs[ frontUvsPointer + 3 ] = baseHeightFront\n frontUvs[ frontUvsPointer + 4 ] = frontUvs[ frontUvsPointer + 8 ] = 0\n frontUvs[ frontUvsPointer + 5 ] = frontUvs[ frontUvsPointer + 9 ] = cy\n frontUvs[ frontUvsPointer + 10 ] = aw\n frontUvs[ frontUvsPointer + 11 ] = cy\n frontUvsPointer += 12\n }\n if (baseHeightFront) {\n // right side base quad vertices\n baseVertices[ baseVerticesPointer ] = baseVertices[ baseVerticesPointer + 9 ] = pointer + cl\n baseVertices[ baseVerticesPointer + 1 ] = baseVertices[ baseVerticesPointer + 10 ] = 0\n baseVertices[ baseVerticesPointer + 2 ] = baseVertices[ baseVerticesPointer + 11 ] = azf\n baseVertices[ baseVerticesPointer + 3 ] = pointer + cl\n baseVertices[ baseVerticesPointer + 4 ] = 0\n baseVertices[ baseVerticesPointer + 5 ] = cz\n baseVertices[ baseVerticesPointer + 6 ] = baseVertices[ baseVerticesPointer + 12 ] = pointer + cl\n baseVertices[ baseVerticesPointer + 7 ] = baseVertices[ baseVerticesPointer + 13 ] = baseHeightFrontBelow\n baseVertices[ baseVerticesPointer + 8 ] = baseVertices[ baseVerticesPointer + 14 ] = cz\n baseVertices[ baseVerticesPointer + 15 ] = pointer + cl\n baseVertices[ baseVerticesPointer + 16 ] = baseHeightFrontBelow\n baseVertices[ baseVerticesPointer + 17 ] = azf\n baseVerticesPointer += 18\n }\n }\n\n if (cz > azb) {\n if (c.y > baseHeightBack) {\n backVertices[ backVerticesPointer ] = backVertices[ backVerticesPointer + 9 ] = pointer + cl\n backVertices[ backVerticesPointer + 1 ] = backVertices[ backVerticesPointer + 10 ] = baseHeightBack\n backVertices[ backVerticesPointer + 2 ] = backVertices[ backVerticesPointer + 11 ] = cz\n backVertices[ backVerticesPointer + 3 ] = pointer + cl\n backVertices[ backVerticesPointer + 4 ] = baseHeightBack\n backVertices[ backVerticesPointer + 5 ] = azb\n backVertices[ backVerticesPointer + 6 ] = backVertices[ backVerticesPointer + 12 ] = pointer + cl\n backVertices[ backVerticesPointer + 7 ] = backVertices[ backVerticesPointer + 13 ] = cy\n backVertices[ backVerticesPointer + 8 ] = backVertices[ backVerticesPointer + 14 ] = azb\n backVertices[ backVerticesPointer + 15 ] = pointer + cl\n backVertices[ backVerticesPointer + 16 ] = cy\n backVertices[ backVerticesPointer + 17 ] = cz\n backVerticesPointer += 18\n // right side quad uvs\n backUvs[ backUvsPointer ] = backUvs[ backUvsPointer + 6 ] = aw\n backUvs[ backUvsPointer + 1 ] = backUvs[ backUvsPointer + 7 ] = baseHeightBack\n backUvs[ backUvsPointer + 2 ] = 0\n backUvs[ backUvsPointer + 3 ] = baseHeightBack\n backUvs[ backUvsPointer + 4 ] = backUvs[ backUvsPointer + 8 ] = 0\n backUvs[ backUvsPointer + 5 ] = backUvs[ backUvsPointer + 9 ] = cy\n backUvs[ backUvsPointer + 10 ] = aw\n backUvs[ backUvsPointer + 11 ] = cy\n backUvsPointer += 12\n }\n if (baseHeightBack) {\n // right side base quad vertices\n baseVertices[ baseVerticesPointer ] = baseVertices[ baseVerticesPointer + 9 ] = pointer + cl\n baseVertices[ baseVerticesPointer + 1 ] = baseVertices[ baseVerticesPointer + 10 ] = 0\n baseVertices[ baseVerticesPointer + 2 ] = baseVertices[ baseVerticesPointer + 11 ] = cz\n baseVertices[ baseVerticesPointer + 3 ] = pointer + cl\n baseVertices[ baseVerticesPointer + 4 ] = 0\n baseVertices[ baseVerticesPointer + 5 ] = azb\n baseVertices[ baseVerticesPointer + 6 ] = baseVertices[ baseVerticesPointer + 12 ] = pointer + cl\n baseVertices[ baseVerticesPointer + 7 ] = baseVertices[ baseVerticesPointer + 13 ] = baseHeightBackBelow\n baseVertices[ baseVerticesPointer + 8 ] = baseVertices[ baseVerticesPointer + 14 ] = azb\n baseVertices[ baseVerticesPointer + 15 ] = pointer + cl\n baseVertices[ baseVerticesPointer + 16 ] = baseHeightBackBelow\n baseVertices[ baseVerticesPointer + 17 ] = cz\n baseVerticesPointer += 18\n }\n }\n } else if (cNext && round(cx + cl) === cNext.x && cNext.y < cy) {\n // adjacent to a window\n // right side quad vertices\n // if next window is higher\n _yf = cy > baseHeightFront ? baseHeightFront : cy\n _yb = cy > baseHeightBack ? baseHeightBack : cy\n // react to opening z-position\n if (azf > cz) {\n if (c.y > baseHeightFront) {\n frontVertices[ frontVerticesPointer ] = frontVertices[ frontVerticesPointer + 9 ] = pointer + cl\n frontVertices[ frontVerticesPointer + 1 ] = frontVertices[ frontVerticesPointer + 10 ] = cy\n frontVertices[ frontVerticesPointer + 2 ] = frontVertices[ frontVerticesPointer + 11 ] = azf\n frontVertices[ frontVerticesPointer + 3 ] = pointer + cl\n frontVertices[ frontVerticesPointer + 4 ] = _yf\n frontVertices[ frontVerticesPointer + 5 ] = azf\n frontVertices[ frontVerticesPointer + 6 ] = frontVertices[ frontVerticesPointer + 12 ] = pointer + cl\n frontVertices[ frontVerticesPointer + 7 ] = frontVertices[ frontVerticesPointer + 13 ] = _yf\n frontVertices[ frontVerticesPointer + 8 ] = frontVertices[ frontVerticesPointer + 14 ] = cz\n frontVertices[ frontVerticesPointer + 15 ] = pointer + cl\n frontVertices[ frontVerticesPointer + 16 ] = cy\n frontVertices[ frontVerticesPointer + 17 ] = cz\n frontVerticesPointer += 18\n // right side quad uvs\n frontUvs[ frontUvsPointer ] = frontUvs[ frontUvsPointer + 6 ] = aw\n frontUvs[ frontUvsPointer + 1 ] = frontUvs[ frontUvsPointer + 7 ] = cy\n frontUvs[ frontUvsPointer + 2 ] = aw\n frontUvs[ frontUvsPointer + 3 ] = _yf\n frontUvs[ frontUvsPointer + 4 ] = frontUvs[ frontUvsPointer + 8 ] = 0\n frontUvs[ frontUvsPointer + 5 ] = frontUvs[ frontUvsPointer + 9 ] = _yf\n frontUvs[ frontUvsPointer + 10 ] = 0\n frontUvs[ frontUvsPointer + 11 ] = cy\n frontUvsPointer += 12\n }\n // add baseboard\n if (baseHeightFront && cNext.y < baseHeightFront) {\n // right side base quad vertices\n baseVertices[ baseVerticesPointer ] = baseVertices[ baseVerticesPointer + 9 ] = pointer + cl\n baseVertices[ baseVerticesPointer + 1 ] = baseVertices[ baseVerticesPointer + 10 ] = _yf\n baseVertices[ baseVerticesPointer + 2 ] = baseVertices[ baseVerticesPointer + 11 ] = azf\n baseVertices[ baseVerticesPointer + 3 ] = pointer + cl\n baseVertices[ baseVerticesPointer + 4 ] = cNext.y\n baseVertices[ baseVerticesPointer + 5 ] = azf\n baseVertices[ baseVerticesPointer + 6 ] = baseVertices[ baseVerticesPointer + 12 ] = pointer + cl\n baseVertices[ baseVerticesPointer + 7 ] = baseVertices[ baseVerticesPointer + 13 ] = cNext.y\n baseVertices[ baseVerticesPointer + 8 ] = baseVertices[ baseVerticesPointer + 14 ] = cz\n baseVertices[ baseVerticesPointer + 15 ] = pointer + cl\n baseVertices[ baseVerticesPointer + 16 ] = _yf\n baseVertices[ baseVerticesPointer + 17 ] = cz\n baseVerticesPointer += 18\n }\n }\n if (cz > azb) {\n if (c.y > baseHeightBack) {\n backVertices[ backVerticesPointer ] = backVertices[ backVerticesPointer + 9 ] = pointer + cl\n backVertices[ backVerticesPointer + 1 ] = backVertices[ backVerticesPointer + 10 ] = cy\n backVertices[ backVerticesPointer + 2 ] = backVertices[ backVerticesPointer + 11 ] = cz\n backVertices[ backVerticesPointer + 3 ] = pointer + cl\n backVertices[ backVerticesPointer + 4 ] = _yb\n backVertices[ backVerticesPointer + 5 ] = cz\n backVertices[ backVerticesPointer + 6 ] = backVertices[ backVerticesPointer + 12 ] = pointer + cl\n backVertices[ backVerticesPointer + 7 ] = backVertices[ backVerticesPointer + 13 ] = _yb\n backVertices[ backVerticesPointer + 8 ] = backVertices[ backVerticesPointer + 14 ] = azb\n backVertices[ backVerticesPointer + 15 ] = pointer + cl\n backVertices[ backVerticesPointer + 16 ] = cy\n backVertices[ backVerticesPointer + 17 ] = azb\n backVerticesPointer += 18\n // right side quad uvs\n backUvs[ backUvsPointer ] = backUvs[ backUvsPointer + 6 ] = aw\n backUvs[ backUvsPointer + 1 ] = backUvs[ backUvsPointer + 7 ] = cy\n backUvs[ backUvsPointer + 2 ] = aw\n backUvs[ backUvsPointer + 3 ] = _yb\n backUvs[ backUvsPointer + 4 ] = backUvs[ backUvsPointer + 8 ] = 0\n backUvs[ backUvsPointer + 5 ] = backUvs[ backUvsPointer + 9 ] = _yb\n backUvs[ backUvsPointer + 10 ] = 0\n backUvs[ backUvsPointer + 11 ] = cy\n backUvsPointer += 12\n }\n // add baseboard\n if (baseHeightBack && cNext.y < baseHeightBack) {\n // right side base quad vertices\n baseVertices[ baseVerticesPointer ] = baseVertices[ baseVerticesPointer + 9 ] = pointer + cl\n baseVertices[ baseVerticesPointer + 1 ] = baseVertices[ baseVerticesPointer + 10 ] = _yb\n baseVertices[ baseVerticesPointer + 2 ] = baseVertices[ baseVerticesPointer + 11 ] = cz\n baseVertices[ baseVerticesPointer + 3 ] = pointer + cl\n baseVertices[ baseVerticesPointer + 4 ] = cNext.y\n baseVertices[ baseVerticesPointer + 5 ] = cz\n baseVertices[ baseVerticesPointer + 6 ] = baseVertices[ baseVerticesPointer + 12 ] = pointer + cl\n baseVertices[ baseVerticesPointer + 7 ] = baseVertices[ baseVerticesPointer + 13 ] = cNext.y\n baseVertices[ baseVerticesPointer + 8 ] = baseVertices[ baseVerticesPointer + 14 ] = azb\n baseVertices[ baseVerticesPointer + 15 ] = pointer + cl\n baseVertices[ baseVerticesPointer + 16 ] = _yb\n baseVertices[ baseVerticesPointer + 17 ] = azb\n baseVerticesPointer += 18\n }\n }\n }\n }\n\n // wall left of children\n if (cx > 0) {\n\n if (!cPrev || cx !== round(cPrev.x + cPrev.l)) {\n\n _yf = Math.max(baseHeightFront, cy)\n _yb = Math.max(baseHeightBack, cy)\n _y2 = Math.max(baseHeightFront || baseHeightBack, cy + ch)\n // react to opening z-position\n // left side quad vertices\n if (azf > cz) {\n frontVertices[ frontVerticesPointer ] = frontVertices[ frontVerticesPointer + 9 ] = pointer\n frontVertices[ frontVerticesPointer + 1 ] = frontVertices[ frontVerticesPointer + 10 ] = _yf\n frontVertices[ frontVerticesPointer + 2 ] = frontVertices[ frontVerticesPointer + 11 ] = azf\n frontVertices[ frontVerticesPointer + 3 ] = pointer\n frontVertices[ frontVerticesPointer + 4 ] = _yf\n frontVertices[ frontVerticesPointer + 5 ] = cz\n frontVertices[ frontVerticesPointer + 6 ] = frontVertices[ frontVerticesPointer + 12 ] = pointer\n frontVertices[ frontVerticesPointer + 7 ] = frontVertices[ frontVerticesPointer + 13 ] = _y2\n frontVertices[ frontVerticesPointer + 8 ] = frontVertices[ frontVerticesPointer + 14 ] = cz\n frontVertices[ frontVerticesPointer + 15 ] = pointer\n frontVertices[ frontVerticesPointer + 16 ] = _y2\n frontVertices[ frontVerticesPointer + 17 ] = azf\n frontVerticesPointer += 18\n // left side quad uvs\n frontUvs[ frontUvsPointer ] = frontUvs[ frontUvsPointer + 6 ] = aw\n frontUvs[ frontUvsPointer + 1 ] = frontUvs[ frontUvsPointer + 7 ] = _yf\n frontUvs[ frontUvsPointer + 2 ] = 0\n frontUvs[ frontUvsPointer + 3 ] = _yf\n frontUvs[ frontUvsPointer + 4 ] = frontUvs[ frontUvsPointer + 8 ] = 0\n frontUvs[ frontUvsPointer + 5 ] = frontUvs[ frontUvsPointer + 9 ] = _y2\n frontUvs[ frontUvsPointer + 10 ] = aw\n frontUvs[ frontUvsPointer + 11 ] = _y2\n frontUvsPointer += 12\n\n if (baseHeightFront && cy < baseHeightFront) {\n // left side base quad vertices\n baseVertices[ baseVerticesPointer ] = baseVertices[ baseVerticesPointer + 9 ] = pointer\n baseVertices[ baseVerticesPointer + 1 ] = baseVertices[ baseVerticesPointer + 10 ] = cy\n baseVertices[ baseVerticesPointer + 2 ] = baseVertices[ baseVerticesPointer + 11 ] = azf\n baseVertices[ baseVerticesPointer + 3 ] = pointer\n baseVertices[ baseVerticesPointer + 4 ] = cy\n baseVertices[ baseVerticesPointer + 5 ] = cz\n baseVertices[ baseVerticesPointer + 6 ] = baseVertices[ baseVerticesPointer + 12 ] = pointer\n baseVertices[ baseVerticesPointer + 7 ] = baseVertices[ baseVerticesPointer + 13 ] = _yf\n baseVertices[ baseVerticesPointer + 8 ] = baseVertices[ baseVerticesPointer + 14 ] = cz\n baseVertices[ baseVerticesPointer + 15 ] = pointer\n baseVertices[ baseVerticesPointer + 16 ] = _yf\n baseVertices[ baseVerticesPointer + 17 ] = azf\n baseVerticesPointer += 18\n }\n }\n if (cz > azb) {\n // left side quad vertices\n backVertices[ backVerticesPointer ] = backVertices[ backVerticesPointer + 9 ] = pointer\n backVertices[ backVerticesPointer + 1 ] = backVertices[ backVerticesPointer + 10 ] = _yb\n backVertices[ backVerticesPointer + 2 ] = backVertices[ backVerticesPointer + 11 ] = cz\n backVertices[ backVerticesPointer + 3 ] = pointer\n backVertices[ backVerticesPointer + 4 ] = _yb\n backVertices[ backVerticesPointer + 5 ] = azb\n backVertices[ backVerticesPointer + 6 ] = backVertices[ backVerticesPointer + 12 ] = pointer\n backVertices[ backVerticesPointer + 7 ] = backVertices[ backVerticesPointer + 13 ] = _y2\n backVertices[ backVerticesPointer + 8 ] = backVertices[ backVerticesPointer + 14 ] = azb\n backVertices[ backVerticesPointer + 15 ] = pointer\n backVertices[ backVerticesPointer + 16 ] = _y2\n backVertices[ backVerticesPointer + 17 ] = cz\n backVerticesPointer += 18\n // left side quad uvs\n backUvs[ backUvsPointer ] = backUvs[ backUvsPointer + 6 ] = aw\n backUvs[ backUvsPointer + 1 ] = backUvs[ backUvsPointer + 7 ] = _yb\n backUvs[ backUvsPointer + 2 ] = 0\n backUvs[ backUvsPointer + 3 ] = _yb\n backUvs[ backUvsPointer + 4 ] = backUvs[ backUvsPointer + 8 ] = 0\n backUvs[ backUvsPointer + 5 ] = backUvs[ backUvsPointer + 9 ] = _y2\n backUvs[ backUvsPointer + 10 ] = aw\n backUvs[ backUvsPointer + 11 ] = _y2\n backUvsPointer += 12\n\n if (baseHeightBack && cy < baseHeightBack) {\n // left side base quad vertices\n baseVertices[ baseVerticesPointer ] = baseVertices[ baseVerticesPointer + 9 ] = pointer\n baseVertices[ baseVerticesPointer + 1 ] = baseVertices[ baseVerticesPointer + 10 ] = cy\n baseVertices[ baseVerticesPointer + 2 ] = baseVertices[ baseVerticesPointer + 11 ] = cz\n baseVertices[ baseVerticesPointer + 3 ] = pointer\n baseVertices[ baseVerticesPointer + 4 ] = cy\n baseVertices[ baseVerticesPointer + 5 ] = azb\n baseVertices[ baseVerticesPointer + 6 ] = baseVertices[ baseVerticesPointer + 12 ] = pointer\n baseVertices[ baseVerticesPointer + 7 ] = baseVertices[ baseVerticesPointer + 13 ] = _yb\n baseVertices[ baseVerticesPointer + 8 ] = baseVertices[ baseVerticesPointer + 14 ] = azb\n baseVertices[ baseVerticesPointer + 15 ] = pointer\n baseVertices[ baseVerticesPointer + 16 ] = _yb\n baseVertices[ baseVerticesPointer + 17 ] = cz\n baseVerticesPointer += 18\n }\n }\n }\n }\n\n // wall right of children\n if (cx + cl < al) {\n\n if (!cNext || round(cx + cl) !== cNext.x) {\n\n _yf = Math.max(baseHeightFront, cy)\n _yb = Math.max(baseHeightBack, cy)\n _y2 = Math.max(baseHeightFront || baseHeightBack, cy + ch)\n // react to opening z-position\n if (azf > cz) {\n // right side quad vertices\n frontVertices[ frontVerticesPointer ] = frontVertices[ frontVerticesPointer + 9 ] = pointer + cl\n frontVertices[ frontVerticesPointer + 1 ] = frontVertices[ frontVerticesPointer + 10 ] = _yf\n frontVertices[ frontVerticesPointer + 2 ] = frontVertices[ frontVerticesPointer + 11 ] = cz\n frontVertices[ frontVerticesPointer + 3 ] = pointer + cl\n frontVertices[ frontVerticesPointer + 4 ] = _yf\n frontVertices[ frontVerticesPointer + 5 ] = azf\n frontVertices[ frontVerticesPointer + 6 ] = frontVertices[ frontVerticesPointer + 12 ] = pointer + cl\n frontVertices[ frontVerticesPointer + 7 ] = frontVertices[ frontVerticesPointer + 13 ] = _y2\n frontVertices[ frontVerticesPointer + 8 ] = frontVertices[ frontVerticesPointer + 14 ] = azf\n frontVertices[ frontVerticesPointer + 15 ] = pointer + cl\n frontVertices[ frontVerticesPointer + 16 ] = _y2\n frontVertices[ frontVerticesPointer + 17 ] = cz\n frontVerticesPointer += 18\n // right side quad uvs\n frontUvs[ frontUvsPointer ] = frontUvs[ frontUvsPointer + 6 ] = 0\n frontUvs[ frontUvsPointer + 1 ] = frontUvs[ frontUvsPointer + 7 ] = _yf\n frontUvs[ frontUvsPointer + 2 ] = aw\n frontUvs[ frontUvsPointer + 3 ] = _yf\n frontUvs[ frontUvsPointer + 4 ] = frontUvs[ frontUvsPointer + 8 ] = aw\n frontUvs[ frontUvsPointer + 5 ] = frontUvs[ frontUvsPointer + 9 ] = _y2\n frontUvs[ frontUvsPointer + 10 ] = 0\n frontUvs[ frontUvsPointer + 11 ] = _y2\n frontUvsPointer += 12\n\n if (baseHeightFront && cy < baseHeightFront) {\n // right side baseboard quad vertices\n baseVertices[ baseVerticesPointer ] = baseVertices[ baseVerticesPointer + 9 ] = pointer + cl\n baseVertices[ baseVerticesPointer + 1 ] = baseVertices[ baseVerticesPointer + 10 ] = cy\n baseVertices[ baseVerticesPointer + 2 ] = baseVertices[ baseVerticesPointer + 11 ] = cz\n baseVertices[ baseVerticesPointer + 3 ] = pointer + cl\n baseVertices[ baseVerticesPointer + 4 ] = cy\n baseVertices[ baseVerticesPointer + 5 ] = azf\n baseVertices[ baseVerticesPointer + 6 ] = baseVertices[ baseVerticesPointer + 12 ] = pointer + cl\n baseVertices[ baseVerticesPointer + 7 ] = baseVertices[ baseVerticesPointer + 13 ] = _yf\n baseVertices[ baseVerticesPointer + 8 ] = baseVertices[ baseVerticesPointer + 14 ] = azf\n baseVertices[ baseVerticesPointer + 15 ] = pointer + cl\n baseVertices[ baseVerticesPointer + 16 ] = _yf\n baseVertices[ baseVerticesPointer + 17 ] = cz\n baseVerticesPointer += 18\n }\n }\n if (cz > azb) {\n // right side quad vertices\n backVertices[ backVerticesPointer ] = backVertices[ backVerticesPointer + 9 ] = pointer + cl\n backVertices[ backVerticesPointer + 1 ] = backVertices[ backVerticesPointer + 10 ] = _yb\n backVertices[ backVerticesPointer + 2 ] = backVertices[ backVerticesPointer + 11 ] = azb\n backVertices[ backVerticesPointer + 3 ] = pointer + cl\n backVertices[ backVerticesPointer + 4 ] = _yb\n backVertices[ backVerticesPointer + 5 ] = cz\n backVertices[ backVerticesPointer + 6 ] = backVertices[ backVerticesPointer + 12 ] = pointer + cl\n backVertices[ backVerticesPointer + 7 ] = backVertices[ backVerticesPointer + 13 ] = _y2\n backVertices[ backVerticesPointer + 8 ] = backVertices[ backVerticesPointer + 14 ] = cz\n backVertices[ backVerticesPointer + 15 ] = pointer + cl\n backVertices[ backVerticesPointer + 16 ] = _y2\n backVertices[ backVerticesPointer + 17 ] = azb\n backVerticesPointer += 18\n // right side quad uvs\n backUvs[ backUvsPointer ] = backUvs[ backUvsPointer + 6 ] = 0\n backUvs[ backUvsPointer + 1 ] = backUvs[ backUvsPointer + 7 ] = _yb\n backUvs[ backUvsPointer + 2 ] = aw\n backUvs[ backUvsPointer + 3 ] = _yb\n backUvs[ backUvsPointer + 4 ] = backUvs[ backUvsPointer + 8 ] = aw\n backUvs[ backUvsPointer + 5 ] = backUvs[ backUvsPointer + 9 ] = _y2\n backUvs[ backUvsPointer + 10 ] = 0\n backUvs[ backUvsPointer + 11 ] = _y2\n backUvsPointer += 12\n\n if (baseHeightBack && cy < baseHeightBack) {\n // right side baseboard quad vertices\n baseVertices[ baseVerticesPointer ] = baseVertices[ baseVerticesPointer + 9 ] = pointer + cl\n baseVertices[ baseVerticesPointer + 1 ] = baseVertices[ baseVerticesPointer + 10 ] = cy\n baseVertices[ baseVerticesPointer + 2 ] = baseVertices[ baseVerticesPointer + 11 ] = azb\n baseVertices[ baseVerticesPointer + 3 ] = pointer + cl\n baseVertices[ baseVerticesPointer + 4 ] = cy\n baseVertices[ baseVerticesPointer + 5 ] = cz\n baseVertices[ baseVerticesPointer + 6 ] = baseVertices[ baseVerticesPointer + 12 ] = pointer + cl\n baseVertices[ baseVerticesPointer + 7 ] = baseVertices[ baseVerticesPointer + 13 ] = _yb\n baseVertices[ baseVerticesPointer + 8 ] = baseVertices[ baseVerticesPointer + 14 ] = cz\n baseVertices[ baseVerticesPointer + 15 ] = pointer + cl\n baseVertices[ baseVerticesPointer + 16 ] = _yb\n baseVertices[ baseVerticesPointer + 17 ] = azb\n baseVerticesPointer += 18\n }\n }\n }\n }\n\n // wall above children\n if (round(cy + ch) < ah) {\n\n // front quad vertices\n frontVertices[ frontVerticesPointer ] = frontVertices[ frontVerticesPointer + 9 ] = pointer\n frontVertices[ frontVerticesPointer + 1 ] = frontVertices[ frontVerticesPointer + 10 ] = cy + ch\n frontVertices[ frontVerticesPointer + 2 ] = frontVertices[ frontVerticesPointer + 11 ] = azf\n frontVertices[ frontVerticesPointer + 3 ] = pointer + cl\n frontVertices[ frontVerticesPointer + 4 ] = cy + ch\n frontVertices[ frontVerticesPointer + 5 ] = azf\n frontVertices[ frontVerticesPointer + 6 ] = frontVertices[ frontVerticesPointer + 12 ] = pointer + cl\n frontVertices[ frontVerticesPointer + 7 ] = frontVertices[ frontVerticesPointer + 13 ] = ah\n frontVertices[ frontVerticesPointer + 8 ] = frontVertices[ frontVerticesPointer + 14 ] = azf\n frontVertices[ frontVerticesPointer + 15 ] = pointer\n frontVertices[ frontVerticesPointer + 16 ] = ah\n frontVertices[ frontVerticesPointer + 17 ] = azf\n frontVerticesPointer += 18\n // front quad uvs\n frontUvs[ frontUvsPointer ] = frontUvs[ frontUvsPointer + 6 ] = pointer\n frontUvs[ frontUvsPointer + 1 ] = frontUvs[ frontUvsPointer + 7 ] = cy + ch\n frontUvs[ frontUvsPointer + 2 ] = pointer + cl\n frontUvs[ frontUvsPointer + 3 ] = cy + ch\n frontUvs[ frontUvsPointer + 4 ] = frontUvs[ frontUvsPointer + 8 ] = pointer + cl\n frontUvs[ frontUvsPointer + 5 ] = frontUvs[ frontUvsPointer + 9 ] = ah\n frontUvs[ frontUvsPointer + 10 ] = pointer\n frontUvs[ frontUvsPointer + 11 ] = ah\n frontUvsPointer += 12\n\n // back quad vertices\n backVertices[ backVerticesPointer ] = backVertices[ backVerticesPointer + 9 ] = pointer\n backVertices[ backVerticesPointer + 1 ] = backVertices[ backVerticesPointer + 10 ] = ah\n backVertices[ backVerticesPointer + 2 ] = backVertices[ backVerticesPointer + 11 ] = azb\n backVertices[ backVerticesPointer + 3 ] = pointer + cl\n backVertices[ backVerticesPointer + 4 ] = ah\n backVertices[ backVerticesPointer + 5 ] = azb\n backVertices[ backVerticesPointer + 6 ] = backVertices[ backVerticesPointer + 12 ] = pointer + cl\n backVertices[ backVerticesPointer + 7 ] = backVertices[ backVerticesPointer + 13 ] = cy + ch\n backVertices[ backVerticesPointer + 8 ] = backVertices[ backVerticesPointer + 14 ] = azb\n backVertices[ backVerticesPointer + 15 ] = pointer\n backVertices[ backVerticesPointer + 16 ] = cy + ch\n backVertices[ backVerticesPointer + 17 ] = azb\n backVerticesPointer += 18\n // back quad uvs\n backUvs[ backUvsPointer ] = backUvs[ backUvsPointer + 6 ] = pointer\n backUvs[ backUvsPointer + 1 ] = backUvs[ backUvsPointer + 7 ] = ah\n backUvs[ backUvsPointer + 2 ] = pointer + cl\n backUvs[ backUvsPointer + 3 ] = ah\n backUvs[ backUvsPointer + 4 ] = backUvs[ backUvsPointer + 8 ] = pointer + cl\n backUvs[ backUvsPointer + 5 ] = backUvs[ backUvsPointer + 9 ] = cy + ch\n backUvs[ backUvsPointer + 10 ] = pointer\n backUvs[ backUvsPointer + 11 ] = cy + ch\n backUvsPointer += 12\n\n // top quad vertices\n topVertices[ topVerticesPointer ] = topVertices[ topVerticesPointer + 9 ] = pointer\n topVertices[ topVerticesPointer + 1 ] = topVertices[ topVerticesPointer + 10 ] = ah\n topVertices[ topVerticesPointer + 2 ] = topVertices[ topVerticesPointer + 11 ] = azf\n topVertices[ topVerticesPointer + 3 ] = pointer + cl\n topVertices[ topVerticesPointer + 4 ] = ah\n topVertices[ topVerticesPointer + 5 ] = azf\n topVertices[ topVerticesPointer + 6 ] = topVertices[ topVerticesPointer + 12 ] = pointer + cl\n topVertices[ topVerticesPointer + 7 ] = topVertices[ topVerticesPointer + 13 ] = ah\n topVertices[ topVerticesPointer + 8 ] = topVertices[ topVerticesPointer + 14 ] = azb\n topVertices[ topVerticesPointer + 15 ] = pointer\n topVertices[ topVerticesPointer + 16 ] = ah\n topVertices[ topVerticesPointer + 17 ] = azb\n topVerticesPointer += 18\n\n // react to opening z-position\n if (azf > cz) {\n // below quad vertices\n frontVertices[ frontVerticesPointer ] = frontVertices[ frontVerticesPointer + 9 ] = pointer\n frontVertices[ frontVerticesPointer + 1 ] = frontVertices[ frontVerticesPointer + 10 ] = cy + ch\n frontVertices[ frontVerticesPointer + 2 ] = frontVertices[ frontVerticesPointer + 11 ] = cz\n frontVertices[ frontVerticesPointer + 3 ] = pointer + cl\n frontVertices[ frontVerticesPointer + 4 ] = cy + ch\n frontVertices[ frontVerticesPointer + 5 ] = cz\n frontVertices[ frontVerticesPointer + 6 ] = frontVertices[ frontVerticesPointer + 12 ] = pointer + cl\n frontVertices[ frontVerticesPointer + 7 ] = frontVertices[ frontVerticesPointer + 13 ] = cy + ch\n frontVertices[ frontVerticesPointer + 8 ] = frontVertices[ frontVerticesPointer + 14 ] = azf\n frontVertices[ frontVerticesPointer + 15 ] = pointer\n frontVertices[ frontVerticesPointer + 16 ] = cy + ch\n frontVertices[ frontVerticesPointer + 17 ] = azf\n frontVerticesPointer += 18\n // below quad uvs\n frontUvs[ frontUvsPointer ] = frontUvs[ frontUvsPointer + 6 ] = pointer\n frontUvs[ frontUvsPointer + 1 ] = frontUvs[ frontUvsPointer + 7 ] = 0\n frontUvs[ frontUvsPointer + 2 ] = pointer + cl\n frontUvs[ frontUvsPointer + 3 ] = 0\n frontUvs[ frontUvsPointer + 4 ] = frontUvs[ frontUvsPointer + 8 ] = pointer + cl\n frontUvs[ frontUvsPointer + 5 ] = frontUvs[ frontUvsPointer + 9 ] = aw\n frontUvs[ frontUvsPointer + 10 ] = pointer\n frontUvs[ frontUvsPointer + 11 ] = aw\n frontUvsPointer += 12\n }\n if (cz > azb) {\n // below quad vertices\n backVertices[ backVerticesPointer ] = backVertices[ backVerticesPointer + 9 ] = pointer\n backVertices[ backVerticesPointer + 1 ] = backVertices[ backVerticesPointer + 10 ] = cy + ch\n backVertices[ backVerticesPointer + 2 ] = backVertices[ backVerticesPointer + 11 ] = azb\n backVertices[ backVerticesPointer + 3 ] = pointer + cl\n backVertices[ backVerticesPointer + 4 ] = cy + ch\n backVertices[ backVerticesPointer + 5 ] = azb\n backVertices[ backVerticesPointer + 6 ] = backVertices[ backVerticesPointer + 12 ] = pointer + cl\n backVertices[ backVerticesPointer + 7 ] = backVertices[ backVerticesPointer + 13 ] = cy + ch\n backVertices[ backVerticesPointer + 8 ] = backVertices[ backVerticesPointer + 14 ] = cz\n backVertices[ backVerticesPointer + 15 ] = pointer\n backVertices[ backVerticesPointer + 16 ] = cy + ch\n backVertices[ backVerticesPointer + 17 ] = cz\n backVerticesPointer += 18\n // below quad uvs\n backUvs[ backUvsPointer ] = backUvs[ backUvsPointer + 6 ] = pointer\n backUvs[ backUvsPointer + 1 ] = backUvs[ backUvsPointer + 7 ] = 0\n backUvs[ backUvsPointer + 2 ] = pointer + cl\n backUvs[ backUvsPointer + 3 ] = 0\n backUvs[ backUvsPointer + 4 ] = backUvs[ backUvsPointer + 8 ] = pointer + cl\n backUvs[ backUvsPointer + 5 ] = backUvs[ backUvsPointer + 9 ] = aw\n backUvs[ backUvsPointer + 10 ] = pointer\n backUvs[ backUvsPointer + 11 ] = aw\n backUvsPointer += 12\n }\n\n if (pointer <= 0) {\n // left side quad vertices\n // react to opening z-position\n if (azf > cz) {\n frontVertices[ frontVerticesPointer ] = frontVertices[ frontVerticesPointer + 9 ] = pointer\n frontVertices[ frontVerticesPointer + 1 ] = frontVertices[ frontVerticesPointer + 10 ] = cy + ch\n frontVertices[ frontVerticesPointer + 2 ] = frontVertices[ frontVerticesPointer + 11 ] = cz\n frontVertices[ frontVerticesPointer + 3 ] = pointer\n frontVertices[ frontVerticesPointer + 4 ] = cy + ch\n frontVertices[ frontVerticesPointer + 5 ] = azf\n frontVertices[ frontVerticesPointer + 6 ] = frontVertices[ frontVerticesPointer + 12 ] = pointer\n frontVertices[ frontVerticesPointer + 7 ] = frontVertices[ frontVerticesPointer + 13 ] = ah\n frontVertices[ frontVerticesPointer + 8 ] = frontVertices[ frontVerticesPointer + 14 ] = azf\n frontVertices[ frontVerticesPointer + 15 ] = pointer\n frontVertices[ frontVerticesPointer + 16 ] = ah\n frontVertices[ frontVerticesPointer + 17 ] = cz\n frontVerticesPointer += 18\n // left side quad uvs\n frontUvs[ frontUvsPointer ] = frontUvs[ frontUvsPointer + 6 ] = 0\n frontUvs[ frontUvsPointer + 1 ] = frontUvs[ frontUvsPointer + 7 ] = cy + ch\n frontUvs[ frontUvsPointer + 2 ] = aw\n frontUvs[ frontUvsPointer + 3 ] = cy + ch\n frontUvs[ frontUvsPointer + 4 ] = frontUvs[ frontUvsPointer + 8 ] = aw\n frontUvs[ frontUvsPointer + 5 ] = frontUvs[ frontUvsPointer + 9 ] = ah\n frontUvs[ frontUvsPointer + 10 ] = 0\n frontUvs[ frontUvsPointer + 11 ] = ah\n frontUvsPointer += 12\n\n }\n if (cz > azb) {\n backVertices[ backVerticesPointer ] = backVertices[ backVerticesPointer + 9 ] = pointer\n backVertices[ backVerticesPointer + 1 ] = backVertices[ backVerticesPointer + 10 ] = cy + ch\n backVertices[ backVerticesPointer + 2 ] = backVertices[ backVerticesPointer + 11 ] = azb\n backVertices[ backVerticesPointer + 3 ] = pointer\n backVertices[ backVerticesPointer + 4 ] = cy + ch\n backVertices[ backVerticesPointer + 5 ] = cz\n backVertices[ backVerticesPointer + 6 ] = backVertices[ backVerticesPointer + 12 ] = pointer\n backVertices[ backVerticesPointer + 7 ] = backVertices[ backVerticesPointer + 13 ] = ah\n backVertices[ backVerticesPointer + 8 ] = backVertices[ backVerticesPointer + 14 ] = cz\n backVertices[ backVerticesPointer + 15 ] = pointer\n backVertices[ backVerticesPointer + 16 ] = ah\n backVertices[ backVerticesPointer + 17 ] = azb\n backVerticesPointer += 18\n // left side quad uvs\n backUvs[ backUvsPointer ] = backUvs[ backUvsPointer + 6 ] = 0\n backUvs[ backUvsPointer + 1 ] = backUvs[ backUvsPointer + 7 ] = cy + ch\n backUvs[ backUvsPointer + 2 ] = aw\n backUvs[ backUvsPointer + 3 ] = cy + ch\n backUvs[ backUvsPointer + 4 ] = backUvs[ backUvsPointer + 8 ] = aw\n backUvs[ backUvsPointer + 5 ] = backUvs[ backUvsPointer + 9 ] = ah\n backUvs[ backUvsPointer + 10 ] = 0\n backUvs[ backUvsPointer + 11 ] = ah\n backUvsPointer += 12\n }\n } else if (cPrev && cx === round(cPrev.x + cPrev.l) && round(cPrev.y + cPrev.h) > round(cy + ch)) {\n\n // adjacent windows\n // left side quad vertices\n // react to opening z-position\n if (azf > cz) {\n frontVertices[ frontVerticesPointer ] = frontVertices[ frontVerticesPointer + 9 ] = pointer\n frontVertices[ frontVerticesPointer + 1 ] = frontVertices[ frontVerticesPointer + 10 ] = cy + ch\n frontVertices[ frontVerticesPointer + 2 ] = frontVertices[ frontVerticesPointer + 11 ] = cz\n frontVertices[ frontVerticesPointer + 3 ] = pointer\n frontVertices[ frontVerticesPointer + 4 ] = cy + ch\n frontVertices[ frontVerticesPointer + 5 ] = azf\n frontVertices[ frontVerticesPointer + 6 ] = frontVertices[ frontVerticesPointer + 12 ] = pointer\n frontVertices[ frontVerticesPointer + 7 ] = frontVertices[ frontVerticesPointer + 13 ] = cPrev.y + cPrev.h\n frontVertices[ frontVerticesPointer + 8 ] = frontVertices[ frontVerticesPointer + 14 ] = azf\n frontVertices[ frontVerticesPointer + 15 ] = pointer\n frontVertices[ frontVerticesPointer + 16 ] = cPrev.y + cPrev.h\n frontVertices[ frontVerticesPointer + 17 ] = cz\n frontVerticesPointer += 18\n // left side quad uvs\n frontUvs[ frontUvsPointer ] = frontUvs[ frontUvsPointer + 6 ] = 0\n frontUvs[ frontUvsPointer + 1 ] = frontUvs[ frontUvsPointer + 7 ] = cy + ch\n frontUvs[ frontUvsPointer + 2 ] = aw\n frontUvs[ frontUvsPointer + 3 ] = cy + ch\n frontUvs[ frontUvsPointer + 4 ] = frontUvs[ frontUvsPointer + 8 ] = aw\n frontUvs[ frontUvsPointer + 5 ] = frontUvs[ frontUvsPointer + 9 ] = cPrev.y + cPrev.h\n frontUvs[ frontUvsPointer + 10 ] = 0\n frontUvs[ frontUvsPointer + 11 ] = cPrev.y + cPrev.h\n frontUvsPointer += 12\n }\n if (cz > azb){\n backVertices[ backVerticesPointer ] = backVertices[ backVerticesPointer + 9 ] = pointer\n backVertices[ backVerticesPointer + 1 ] = backVertices[ backVerticesPointer + 10 ] = cy + ch\n backVertices[ backVerticesPointer + 2 ] = backVertices[ backVerticesPointer + 11 ] = azb\n backVertices[ backVerticesPointer + 3 ] = pointer\n backVertices[ backVerticesPointer + 4 ] = cy + ch\n backVertices[ backVerticesPointer + 5 ] = cz\n backVertices[ backVerticesPointer + 6 ] = backVertices[ backVerticesPointer + 12 ] = pointer\n backVertices[ backVerticesPointer + 7 ] = backVertices[ backVerticesPointer + 13 ] = cPrev.y + cPrev.h\n backVertices[ backVerticesPointer + 8 ] = backVertices[ backVerticesPointer + 14 ] = cz\n backVertices[ backVerticesPointer + 15 ] = pointer\n backVertices[ backVerticesPointer + 16 ] = cPrev.y + cPrev.h\n backVertices[ backVerticesPointer + 17 ] = azb\n backVerticesPointer += 18\n // left side quad uvs\n backUvs[ backUvsPointer ] = backUvs[ backUvsPointer + 6 ] = 0\n backUvs[ backUvsPointer + 1 ] = backUvs[ backUvsPointer + 7 ] = cy + ch\n backUvs[ backUvsPointer + 2 ] = aw\n backUvs[ backUvsPointer + 3 ] = cy + ch\n backUvs[ backUvsPointer + 4 ] = backUvs[ backUvsPointer + 8 ] = aw\n backUvs[ backUvsPointer + 5 ] = backUvs[ backUvsPointer + 9 ] = cPrev.y + cPrev.h\n backUvs[ backUvsPointer + 10 ] = 0\n backUvs[ backUvsPointer + 11 ] = cPrev.y + cPrev.h\n backUvsPointer += 12\n }\n }\n\n if (round(pointer + cl) >= al) {\n // wall ending with opening\n // top, right side quad vertices\n // react to opening z-position\n if (azf > cz) {\n frontVertices[ frontVerticesPointer ] = frontVertices[ frontVerticesPointer + 9 ] = pointer + cl\n frontVertices[ frontVerticesPointer + 1 ] = frontVertices[ frontVerticesPointer + 10 ] = cy + ch\n frontVertices[ frontVerticesPointer + 2 ] = frontVertices[ frontVerticesPointer + 11 ] = azf\n frontVertices[ frontVerticesPointer + 3 ] = pointer + cl\n frontVertices[ frontVerticesPointer + 4 ] = cy + ch\n frontVertices[ frontVerticesPointer + 5 ] = cz\n frontVertices[ frontVerticesPointer + 6 ] = frontVertices[ frontVerticesPointer + 12 ] = pointer + cl\n frontVertices[ frontVerticesPointer + 7 ] = frontVertices[ frontVerticesPointer + 13 ] = ah\n frontVertices[ frontVerticesPointer + 8 ] = frontVertices[ frontVerticesPointer + 14 ] = cz\n frontVertices[ frontVerticesPointer + 15 ] = pointer + cl\n frontVertices[ frontVerticesPointer + 16 ] = ah\n frontVertices[ frontVerticesPointer + 17 ] = azf\n frontVerticesPointer += 18\n // right side quad uvs\n frontUvs[ frontUvsPointer ] = frontUvs[ frontUvsPointer + 6 ] = aw\n frontUvs[ frontUvsPointer + 1 ] = frontUvs[ frontUvsPointer + 7 ] = cy + ch\n frontUvs[ frontUvsPointer + 2 ] = 0\n frontUvs[ frontUvsPointer + 3 ] = cy + ch\n frontUvs[ frontUvsPointer + 4 ] = frontUvs[ frontUvsPointer + 8 ] = 0\n frontUvs[ frontUvsPointer + 5 ] = frontUvs[ frontUvsPointer + 9 ] = ah\n frontUvs[ frontUvsPointer + 10 ] = aw\n frontUvs[ frontUvsPointer + 11 ] = ah\n frontUvsPointer += 12\n }\n if (cz > azb){\n backVertices[ backVerticesPointer ] = backVertices[ backVerticesPointer + 9 ] = pointer + cl\n backVertices[ backVerticesPointer + 1 ] = backVertices[ backVerticesPointer + 10 ] = cy + ch\n backVertices[ backVerticesPointer + 2 ] = backVertices[ backVerticesPointer + 11 ] = cz\n backVertices[ backVerticesPointer + 3 ] = pointer + cl\n backVertices[ backVerticesPointer + 4 ] = cy + ch\n backVertices[ backVerticesPointer + 5 ] = azb\n backVertices[ backVerticesPointer + 6 ] = backVertices[ backVerticesPointer + 12 ] = pointer + cl\n backVertices[ backVerticesPointer + 7 ] = backVertices[ backVerticesPointer + 13 ] = ah\n backVertices[ backVerticesPointer + 8 ] = backVertices[ backVerticesPointer + 14 ] = azb\n backVertices[ backVerticesPointer + 15 ] = pointer + cl\n backVertices[ backVerticesPointer + 16 ] = ah\n backVertices[ backVerticesPointer + 17 ] = cz\n backVerticesPointer += 18\n // right side quad uvs\n backUvs[ backUvsPointer ] = backUvs[ backUvsPointer + 6 ] = aw\n backUvs[ backUvsPointer + 1 ] = backUvs[ backUvsPointer + 7 ] = cy + ch\n backUvs[ backUvsPointer + 2 ] = 0\n backUvs[ backUvsPointer + 3 ] = cy + ch\n backUvs[ backUvsPointer + 4 ] = backUvs[ backUvsPointer + 8 ] = 0\n backUvs[ backUvsPointer + 5 ] = backUvs[ backUvsPointer + 9 ] = ah\n backUvs[ backUvsPointer + 10 ] = aw\n backUvs[ backUvsPointer + 11 ] = ah\n backUvsPointer += 12\n }\n\n } else if (cNext && round(cx + cl) === cNext.x && round(cNext.y + cNext.h) > round(cy + ch)) {\n // adjacent windows\n // right side quad vertices top\n // react to opening z-position\n if (azf > cz) {\n frontVertices[ frontVerticesPointer ] = frontVertices[ frontVerticesPointer + 9 ] = pointer + cl\n frontVertices[ frontVerticesPointer + 1 ] = frontVertices[ frontVerticesPointer + 10 ] = cy + ch\n frontVertices[ frontVerticesPointer + 2 ] = frontVertices[ frontVerticesPointer + 11 ] = azf\n frontVertices[ frontVerticesPointer + 3 ] = pointer + cl\n frontVertices[ frontVerticesPointer + 4 ] = cy + ch\n frontVertices[ frontVerticesPointer + 5 ] = cz\n frontVertices[ frontVerticesPointer + 6 ] = frontVertices[ frontVerticesPointer + 12 ] = pointer + cl\n frontVertices[ frontVerticesPointer + 7 ] = frontVertices[ frontVerticesPointer + 13 ] = cNext.y + cNext.h\n frontVertices[ frontVerticesPointer + 8 ] = frontVertices[ frontVerticesPointer + 14 ] = cz\n frontVertices[ frontVerticesPointer + 15 ] = pointer + cl\n frontVertices[ frontVerticesPointer + 16 ] = cNext.y + cNext.h\n frontVertices[ frontVerticesPointer + 17 ] = azf\n frontVerticesPointer += 18\n // right side quad uvs\n frontUvs[ frontUvsPointer ] = frontUvs[ frontUvsPointer + 6 ] = aw\n frontUvs[ frontUvsPointer + 1 ] = frontUvs[ frontUvsPointer + 7 ] = cy + ch\n frontUvs[ frontUvsPointer + 2 ] = 0\n frontUvs[ frontUvsPointer + 3 ] = cy + ch\n frontUvs[ frontUvsPointer + 4 ] = frontUvs[ frontUvsPointer + 8 ] = 0\n frontUvs[ frontUvsPointer + 5 ] = frontUvs[ frontUvsPointer + 9 ] = cNext.y + cNext.h\n frontUvs[ frontUvsPointer + 10 ] = aw\n frontUvs[ frontUvsPointer + 11 ] = cNext.y + cNext.h\n frontUvsPointer += 12\n }\n if (cz > azb){\n backVertices[ backVerticesPointer ] = backVertices[ backVerticesPointer + 9 ] = pointer + cl\n backVertices[ backVerticesPointer + 1 ] = backVertices[ backVerticesPointer + 10 ] = cy + ch\n backVertices[ backVerticesPointer + 2 ] = backVertices[ backVerticesPointer + 11 ] = cz\n backVertices[ backVerticesPointer + 3 ] = pointer + cl\n backVertices[ backVerticesPointer + 4 ] = cy + ch\n backVertices[ backVerticesPointer + 5 ] = azb\n backVertices[ backVerticesPointer + 6 ] = backVertices[ backVerticesPointer + 12 ] = pointer + cl\n backVertices[ backVerticesPointer + 7 ] = backVertices[ backVerticesPointer + 13 ] = cNext.y + cNext.h\n backVertices[ backVerticesPointer + 8 ] = backVertices[ backVerticesPointer + 14 ] = azb\n backVertices[ backVerticesPointer + 15 ] = pointer + cl\n backVertices[ backVerticesPointer + 16 ] = cNext.y + cNext.h\n backVertices[ backVerticesPointer + 17 ] = cz\n backVerticesPointer += 18\n // right side quad uvs\n backUvs[ backUvsPointer ] = backUvs[ backUvsPointer + 6 ] = aw\n backUvs[ backUvsPointer + 1 ] = backUvs[ backUvsPointer + 7 ] = cy + ch\n backUvs[ backUvsPointer + 2 ] = 0\n backUvs[ backUvsPointer + 3 ] = cy + ch\n backUvs[ backUvsPointer + 4 ] = backUvs[ backUvsPointer + 8 ] = 0\n backUvs[ backUvsPointer + 5 ] = backUvs[ backUvsPointer + 9 ] = cNext.y + cNext.h\n backUvs[ backUvsPointer + 10 ] = aw\n backUvs[ backUvsPointer + 11 ] = cNext.y + cNext.h\n backUvsPointer += 12\n }\n\n }\n }\n\n pointer += cl // set new pointer position\n\n }\n\n // wall after last children ( or the only wall if there is no children )\n if (pointer < al) {\n\n // front quad vertices\n frontVertices[ frontVerticesPointer ] = frontVertices[ frontVerticesPointer + 9 ] = pointer\n frontVertices[ frontVerticesPointer + 1 ] = frontVertices[ frontVerticesPointer + 10 ] = baseHeightFront\n frontVertices[ frontVerticesPointer + 2 ] = frontVertices[ frontVerticesPointer + 11 ] = azf\n frontVertices[ frontVerticesPointer + 3 ] = al\n frontVertices[ frontVerticesPointer + 4 ] = baseHeightFront\n frontVertices[ frontVerticesPointer + 5 ] = azf\n frontVertices[ frontVerticesPointer + 6 ] = frontVertices[ frontVerticesPointer + 12 ] = al\n frontVertices[ frontVerticesPointer + 7 ] = frontVertices[ frontVerticesPointer + 13 ] = ah\n frontVertices[ frontVerticesPointer + 8 ] = frontVertices[ frontVerticesPointer + 14 ] = azf\n frontVertices[ frontVerticesPointer + 15 ] = pointer\n frontVertices[ frontVerticesPointer + 16 ] = ah\n frontVertices[ frontVerticesPointer + 17 ] = azf\n frontVerticesPointer += 18\n // front quad uvs\n frontUvs[ frontUvsPointer ] = frontUvs[ frontUvsPointer + 6 ] = pointer\n frontUvs[ frontUvsPointer + 1 ] = frontUvs[ frontUvsPointer + 7 ] = baseHeightFront\n frontUvs[ frontUvsPointer + 2 ] = al\n frontUvs[ frontUvsPointer + 3 ] = baseHeightFront\n frontUvs[ frontUvsPointer + 4 ] = frontUvs[ frontUvsPointer + 8 ] = al\n frontUvs[ frontUvsPointer + 5 ] = frontUvs[ frontUvsPointer + 9 ] = ah\n frontUvs[ frontUvsPointer + 10 ] = pointer\n frontUvs[ frontUvsPointer + 11 ] = ah\n frontUvsPointer += 12\n\n if (baseHeightFront) {\n // front baseboard vertices\n baseVertices[ baseVerticesPointer ] = baseVertices[ baseVerticesPointer + 9 ] = pointer\n baseVertices[ baseVerticesPointer + 1 ] = baseVertices[ baseVerticesPointer + 10 ] = 0\n baseVertices[ baseVerticesPointer + 2 ] = baseVertices[ baseVerticesPointer + 11 ] = azf\n baseVertices[ baseVerticesPointer + 3 ] = al\n baseVertices[ baseVerticesPointer + 4 ] = 0\n baseVertices[ baseVerticesPointer + 5 ] = azf\n baseVertices[ baseVerticesPointer + 6 ] = baseVertices[ baseVerticesPointer + 12 ] = al\n baseVertices[ baseVerticesPointer + 7 ] = baseVertices[ baseVerticesPointer + 13 ] = baseHeightFront\n baseVertices[ baseVerticesPointer + 8 ] = baseVertices[ baseVerticesPointer + 14 ] = azf\n baseVertices[ baseVerticesPointer + 15 ] = pointer\n baseVertices[ baseVerticesPointer + 16 ] = baseHeightFront\n baseVertices[ baseVerticesPointer + 17 ] = azf\n baseVerticesPointer += 18\n }\n\n // back quad vertices\n backVertices[ backVerticesPointer ] = backVertices[ backVerticesPointer + 9 ] = pointer\n backVertices[ backVerticesPointer + 1 ] = backVertices[ backVerticesPointer + 10 ] = ah\n backVertices[ backVerticesPointer + 2 ] = backVertices[ backVerticesPointer + 11 ] = azb\n backVertices[ backVerticesPointer + 3 ] = al\n backVertices[ backVerticesPointer + 4 ] = ah\n backVertices[ backVerticesPointer + 5 ] = azb\n backVertices[ backVerticesPointer + 6 ] = backVertices[ backVerticesPointer + 12 ] = al\n backVertices[ backVerticesPointer + 7 ] = backVertices[ backVerticesPointer + 13 ] = baseHeightBack\n backVertices[ backVerticesPointer + 8 ] = backVertices[ backVerticesPointer + 14 ] = azb\n backVertices[ backVerticesPointer + 15 ] = pointer\n backVertices[ backVerticesPointer + 16 ] = baseHeightBack\n backVertices[ backVerticesPointer + 17 ] = azb\n backVerticesPointer += 18\n // back quad uvs\n backUvs[ backUvsPointer ] = backUvs[ backUvsPointer + 6 ] = pointer\n backUvs[ backUvsPointer + 1 ] = backUvs[ backUvsPointer + 7 ] = ah\n backUvs[ backUvsPointer + 2 ] = al\n backUvs[ backUvsPointer + 3 ] = ah\n backUvs[ backUvsPointer + 4 ] = backUvs[ backUvsPointer + 8 ] = al\n backUvs[ backUvsPointer + 5 ] = backUvs[ backUvsPointer + 9 ] = baseHeightBack\n backUvs[ backUvsPointer + 10 ] = pointer\n backUvs[ backUvsPointer + 11 ] = baseHeightBack\n backUvsPointer += 12\n\n if (baseHeightBack) {\n // back baseboard vertices\n baseVertices[ baseVerticesPointer ] = baseVertices[ baseVerticesPointer + 9 ] = pointer\n baseVertices[ baseVerticesPointer + 1 ] = baseVertices[ baseVerticesPointer + 10 ] = baseHeightBack\n baseVertices[ baseVerticesPointer + 2 ] = baseVertices[ baseVerticesPointer + 11 ] = azb\n baseVertices[ baseVerticesPointer + 3 ] = al\n baseVertices[ baseVerticesPointer + 4 ] = baseHeightBack\n baseVertices[ baseVerticesPointer + 5 ] = azb\n baseVertices[ baseVerticesPointer + 6 ] = baseVertices[ baseVerticesPointer + 12 ] = al\n baseVertices[ baseVerticesPointer + 7 ] = baseVertices[ baseVerticesPointer + 13 ] = 0\n baseVertices[ baseVerticesPointer + 8 ] = baseVertices[ baseVerticesPointer + 14 ] = azb\n baseVertices[ baseVerticesPointer + 15 ] = pointer\n baseVertices[ baseVerticesPointer + 16 ] = 0\n baseVertices[ baseVerticesPointer + 17 ] = azb\n baseVerticesPointer += 18\n }\n\n // top quad vertices\n topVertices[ topVerticesPointer ] = topVertices[ topVerticesPointer + 9 ] = pointer\n topVertices[ topVerticesPointer + 1 ] = topVertices[ topVerticesPointer + 10 ] = ah\n topVertices[ topVerticesPointer + 2 ] = topVertices[ topVerticesPointer + 11 ] = azf\n topVertices[ topVerticesPointer + 3 ] = al\n topVertices[ topVerticesPointer + 4 ] = ah\n topVertices[ topVerticesPointer + 5 ] = azf\n topVertices[ topVerticesPointer + 6 ] = topVertices[ topVerticesPointer + 12 ] = al\n topVertices[ topVerticesPointer + 7 ] = topVertices[ topVerticesPointer + 13 ] = ah\n topVertices[ topVerticesPointer + 8 ] = topVertices[ topVerticesPointer + 14 ] = azb\n topVertices[ topVerticesPointer + 15 ] = pointer\n topVertices[ topVerticesPointer + 16 ] = ah\n topVertices[ topVerticesPointer + 17 ] = azb\n topVerticesPointer += 18\n\n if (pointer === 0) {\n // start face for a wall without openings\n // left side quad vertices\n // react to wall controlLine position\n if (azf > 0) {\n frontVertices[ frontVerticesPointer ] = frontVertices[ frontVerticesPointer + 9 ] = pointer\n frontVertices[ frontVerticesPointer + 1 ] = frontVertices[ frontVerticesPointer + 10 ] = baseHeightFront\n frontVertices[ frontVerticesPointer + 2 ] = frontVertices[ frontVerticesPointer + 11 ] = 0\n frontVertices[ frontVerticesPointer + 3 ] = pointer\n frontVertices[ frontVerticesPointer + 4 ] = baseHeightFront\n frontVertices[ frontVerticesPointer + 5 ] = azf\n frontVertices[ frontVerticesPointer + 6 ] = frontVertices[ frontVerticesPointer + 12 ] = pointer\n frontVertices[ frontVerticesPointer + 7 ] = frontVertices[ frontVerticesPointer + 13 ] = ah\n frontVertices[ frontVerticesPointer + 8 ] = frontVertices[ frontVerticesPointer + 14 ] = azf\n frontVertices[ frontVerticesPointer + 15 ] = pointer\n frontVertices[ frontVerticesPointer + 16 ] = ah\n frontVertices[ frontVerticesPointer + 17 ] = 0\n frontVerticesPointer += 18\n // left side quad uvs\n frontUvs[ frontUvsPointer ] = frontUvs[ frontUvsPointer + 6 ] = 0\n frontUvs[ frontUvsPointer + 1 ] = frontUvs[ frontUvsPointer + 7 ] = baseHeightFront\n frontUvs[ frontUvsPointer + 2 ] = azf\n frontUvs[ frontUvsPointer + 3 ] = baseHeightFront\n frontUvs[ frontUvsPointer + 4 ] = frontUvs[ frontUvsPointer + 8 ] = azf\n frontUvs[ frontUvsPointer + 5 ] = frontUvs[ frontUvsPointer + 9 ] = ah\n frontUvs[ frontUvsPointer + 10 ] = 0\n frontUvs[ frontUvsPointer + 11 ] = ah\n frontUvsPointer += 12\n\n if (baseHeightFront) {\n // left side baseboard quad vertices\n baseVertices[ baseVerticesPointer ] = baseVertices[ baseVerticesPointer + 9 ] = pointer\n baseVertices[ baseVerticesPointer + 1 ] = baseVertices[ baseVerticesPointer + 10 ] = 0\n baseVertices[ baseVerticesPointer + 2 ] = baseVertices[ baseVerticesPointer + 11 ] = 0\n baseVertices[ baseVerticesPointer + 3 ] = pointer\n baseVertices[ baseVerticesPointer + 4 ] = 0\n baseVertices[ baseVerticesPointer + 5 ] = azf\n baseVertices[ baseVerticesPointer + 6 ] = baseVertices[ baseVerticesPointer + 12 ] = pointer\n baseVertices[ baseVerticesPointer + 7 ] = baseVertices[ baseVerticesPointer + 13 ] = baseHeightFront\n baseVertices[ baseVerticesPointer + 8 ] = baseVertices[ baseVerticesPointer + 14 ] = azf\n baseVertices[ baseVerticesPointer + 15 ] = pointer\n baseVertices[ baseVerticesPointer + 16 ] = baseHeightFront\n baseVertices[ baseVerticesPointer + 17 ] = 0\n baseVerticesPointer += 18\n }\n }\n if (azb < 0) {\n backVertices[ backVerticesPointer ] = backVertices[ backVerticesPointer + 9 ] = pointer\n backVertices[ backVerticesPointer + 1 ] = backVertices[ backVerticesPointer + 10 ] = baseHeightBack\n backVertices[ backVerticesPointer + 2 ] = backVertices[ backVerticesPointer + 11 ] = azb\n backVertices[ backVerticesPointer + 3 ] = pointer\n backVertices[ backVerticesPointer + 4 ] = baseHeightBack\n backVertices[ backVerticesPointer + 5 ] = 0\n backVertices[ backVerticesPointer + 6 ] = backVertices[ backVerticesPointer + 12 ] = pointer\n backVertices[ backVerticesPointer + 7 ] = backVertices[ backVerticesPointer + 13 ] = ah\n backVertices[ backVerticesPointer + 8 ] = backVertices[ backVerticesPointer + 14 ] = 0\n backVertices[ backVerticesPointer + 15 ] = pointer\n backVertices[ backVerticesPointer + 16 ] = ah\n backVertices[ backVerticesPointer + 17 ] = azb\n backVerticesPointer += 18\n // left side quad uvs\n backUvs[ backUvsPointer ] = backUvs[ backUvsPointer + 6 ] = 0\n backUvs[ backUvsPointer + 1 ] = backUvs[ backUvsPointer + 7 ] = baseHeightBack\n backUvs[ backUvsPointer + 2 ] = azb\n backUvs[ backUvsPointer + 3 ] = baseHeightBack\n backUvs[ backUvsPointer + 4 ] = backUvs[ backUvsPointer + 8 ] = azb\n backUvs[ backUvsPointer + 5 ] = backUvs[ backUvsPointer + 9 ] = ah\n backUvs[ backUvsPointer + 10 ] = 0\n backUvs[ backUvsPointer + 11 ] = ah\n backUvsPointer += 12\n\n if (baseHeightBack) {\n // left side baseboard quad vertices\n baseVertices[ baseVerticesPointer ] = baseVertices[ baseVerticesPointer + 9 ] = pointer\n baseVertices[ baseVerticesPointer + 1 ] = baseVertices[ baseVerticesPointer + 10 ] = 0\n baseVertices[ baseVerticesPointer + 2 ] = baseVertices[ baseVerticesPointer + 11 ] = azb\n baseVertices[ baseVerticesPointer + 3 ] = pointer\n baseVertices[ baseVerticesPointer + 4 ] = 0\n baseVertices[ baseVerticesPointer + 5 ] = 0\n baseVertices[ baseVerticesPointer + 6 ] = baseVertices[ baseVerticesPointer + 12 ] = pointer\n baseVertices[ baseVerticesPointer + 7 ] = baseVertices[ baseVerticesPointer + 13 ] = baseHeightBack\n baseVertices[ baseVerticesPointer + 8 ] = baseVertices[ baseVerticesPointer + 14 ] = 0\n baseVertices[ baseVerticesPointer + 15 ] = pointer\n baseVertices[ baseVerticesPointer + 16 ] = baseHeightBack\n baseVertices[ baseVerticesPointer + 17 ] = azb\n baseVerticesPointer += 18\n }\n }\n }\n\n // end of the wall - full height face\n // react to wall controlLine position\n if (azf > 0) {\n // right side quad vertices\n frontVertices[frontVerticesPointer] = frontVertices[frontVerticesPointer + 9] = al\n frontVertices[frontVerticesPointer + 1] = frontVertices[frontVerticesPointer + 10] = baseHeightFront\n frontVertices[frontVerticesPointer + 2] = frontVertices[frontVerticesPointer + 11] = azf\n frontVertices[frontVerticesPointer + 3] = al\n frontVertices[frontVerticesPointer + 4] = baseHeightFront\n frontVertices[frontVerticesPointer + 5] = 0\n frontVertices[frontVerticesPointer + 6] = frontVertices[frontVerticesPointer + 12] = al\n frontVertices[frontVerticesPointer + 7] = frontVertices[frontVerticesPointer + 13] = ah\n frontVertices[frontVerticesPointer + 8] = frontVertices[frontVerticesPointer + 14] = 0\n frontVertices[frontVerticesPointer + 15] = al\n frontVertices[frontVerticesPointer + 16] = ah\n frontVertices[frontVerticesPointer + 17] = azf\n frontVerticesPointer += 18\n // right side quad uvs\n frontUvs[frontUvsPointer] = frontUvs[frontUvsPointer + 6] = azf\n frontUvs[frontUvsPointer + 1] = frontUvs[frontUvsPointer + 7] = baseHeightFront\n frontUvs[frontUvsPointer + 2] = 0\n frontUvs[frontUvsPointer + 3] = baseHeightFront\n frontUvs[frontUvsPointer + 4] = frontUvs[frontUvsPointer + 8] = 0\n frontUvs[frontUvsPointer + 5] = frontUvs[frontUvsPointer + 9] = ah\n frontUvs[frontUvsPointer + 10] = azf\n frontUvs[frontUvsPointer + 11] = ah\n frontUvsPointer += 12\n\n if (baseHeightFront) {\n // right side baseboard quad\n baseVertices[ baseVerticesPointer ] = baseVertices[ baseVerticesPointer + 9 ] = al\n baseVertices[ baseVerticesPointer + 1 ] = baseVertices[ baseVerticesPointer + 10 ] = 0\n baseVertices[ baseVerticesPointer + 2 ] = baseVertices[ baseVerticesPointer + 11 ] = azf\n baseVertices[ baseVerticesPointer + 3 ] = al\n baseVertices[ baseVerticesPointer + 4 ] = 0\n baseVertices[ baseVerticesPointer + 5 ] = 0\n baseVertices[ baseVerticesPointer + 6 ] = baseVertices[ baseVerticesPointer + 12 ] = al\n baseVertices[ baseVerticesPointer + 7 ] = baseVertices[ baseVerticesPointer + 13 ] = baseHeightFront\n baseVertices[ baseVerticesPointer + 8 ] = baseVertices[ baseVerticesPointer + 14 ] = 0\n baseVertices[ baseVerticesPointer + 15 ] = al\n baseVertices[ baseVerticesPointer + 16 ] = baseHeightFront\n baseVertices[ baseVerticesPointer + 17 ] = azf\n baseVerticesPointer += 18\n }\n }\n if (azb < 0) {\n // right side quad vertices\n backVertices[ backVerticesPointer ] = backVertices[ backVerticesPointer + 9 ] = al\n backVertices[ backVerticesPointer + 1 ] = backVertices[ backVerticesPointer + 10 ] = baseHeightBack\n backVertices[ backVerticesPointer + 2 ] = backVertices[ backVerticesPointer + 11 ] = 0\n backVertices[ backVerticesPointer + 3 ] = al\n backVertices[ backVerticesPointer + 4 ] = baseHeightBack\n backVertices[ backVerticesPointer + 5 ] = azb\n backVertices[ backVerticesPointer + 6 ] = backVertices[ backVerticesPointer + 12 ] = al\n backVertices[ backVerticesPointer + 7 ] = backVertices[ backVerticesPointer + 13 ] = ah\n backVertices[ backVerticesPointer + 8 ] = backVertices[ backVerticesPointer + 14 ] = azb\n backVertices[ backVerticesPointer + 15 ] = al\n backVertices[ backVerticesPointer + 16 ] = ah\n backVertices[ backVerticesPointer + 17 ] = 0\n backVerticesPointer += 18\n // right side quad uvs\n backUvs[ backUvsPointer ] = backUvs[ backUvsPointer + 6 ] = azb\n backUvs[ backUvsPointer + 1 ] = backUvs[ backUvsPointer + 7 ] = baseHeightBack\n backUvs[ backUvsPointer + 2 ] = 0\n backUvs[ backUvsPointer + 3 ] = baseHeightBack\n backUvs[ backUvsPointer + 4 ] = backUvs[ backUvsPointer + 8 ] = 0\n backUvs[ backUvsPointer + 5 ] = backUvs[ backUvsPointer + 9 ] = ah\n backUvs[ backUvsPointer + 10 ] = azb\n backUvs[ backUvsPointer + 11 ] = ah\n backUvsPointer += 12\n\n if (baseHeightBack) {\n // right side baseboard quad\n baseVertices[ baseVerticesPointer ] = baseVertices[ baseVerticesPointer + 9 ] = al\n baseVertices[ baseVerticesPointer + 1 ] = baseVertices[ baseVerticesPointer + 10 ] = 0\n baseVertices[ baseVerticesPointer + 2 ] = baseVertices[ baseVerticesPointer + 11 ] = 0\n baseVertices[ baseVerticesPointer + 3 ] = al\n baseVertices[ baseVerticesPointer + 4 ] = 0\n baseVertices[ baseVerticesPointer + 5 ] = azb\n baseVertices[ baseVerticesPointer + 6 ] = baseVertices[ baseVerticesPointer + 12 ] = al\n baseVertices[ baseVerticesPointer + 7 ] = baseVertices[ baseVerticesPointer + 13 ] = baseHeightBack\n baseVertices[ baseVerticesPointer + 8 ] = baseVertices[ baseVerticesPointer + 14 ] = azb\n baseVertices[ baseVerticesPointer + 15 ] = al\n baseVertices[ baseVerticesPointer + 16 ] = baseHeightBack\n baseVertices[ baseVerticesPointer + 17 ] = 0\n baseVerticesPointer += 18\n }\n }\n }\n\n return {\n front: {\n positions: new Float32Array(frontVertices),\n normals: generateNormals.flat(frontVertices),\n uvs: new Float32Array(frontUvs),\n material: 'front'\n },\n back: {\n positions: new Float32Array(backVertices),\n normals: generateNormals.flat(backVertices),\n uvs: new Float32Array(backUvs),\n material: 'back'\n },\n top: {\n positions: new Float32Array(topVertices),\n normals: generateNormals.flat(topVertices),\n material: 'top'\n },\n base: {\n positions: new Float32Array(baseVertices),\n normals: generateNormals.flat(baseVertices),\n uvs: generateUvs.architectural(baseVertices),\n material: 'base'\n }\n }\n }\n}\n\n// helpers\n\nfunction round (x) {\n return Math.round(x * 1000000) / 1000000\n}","'use strict';\n\n// dependencies\n\nimport getSchema from './common/get-schema.js'\nimport getMaterial from './common/get-material.js'\nimport updateSchema from './common/update-schema.js'\nimport generateNormals from '../../../utils/data3d/buffer/get-normals'\nimport cloneDeep from 'lodash/cloneDeep'\n\nexport default {\n\n schema: getSchema('window'),\n\n init: function () {\n var this_ = this\n // listen to wall parent for updated geometry\n this.el.parentEl.addEventListener('wall-changed', this.updateFromWall)\n // FIXME: check for parent initially - we need to wait till it is available\n setTimeout(function() {\n this_.updateFromWall()\n }, 20)\n },\n\n updateFromWall: function(evt) {\n // if we have no event yet we need to get the attributes directly\n if (!evt) {\n var wallAttributes = this.el.parentEl.getAttribute('io3d-wall')\n if (wallAttributes) {\n // let's make sure we deal with an object\n if (typeof wallAttributes === 'string') wallAttributes = AFRAME.utils.styleParser.parse(wallAttributes)\n this.wallWidth = wallAttributes.w\n this.wallControlLine = wallAttributes.controlLine\n }\n } else {\n this.wallWidth = evt.detail.w\n this.wallControlLine = evt.detail.controlLine\n }\n this.update()\n },\n\n updateSchema: updateSchema,\n\n update: function (oldData) {\n var this_ = this\n var data = this_.data\n\n // remove old mesh\n this.remove()\n\n // get defaults and\n this.attributes = cloneDeep(data)\n\n // get meshes and materials from el3d modules\n var meshes = this.generateMeshes3d()\n\n // remove glass mesh if needed\n var deleteGlass = data.hideGlass === 'true'\n if (deleteGlass) delete meshes.glass\n\n // clean up empty meshes to prevent errors\n var meshKeys = Object.keys(meshes)\n meshKeys.forEach(key => {\n if (!meshes[key].positions || !meshes[key].positions.length) {\n // console.warn('no vertices for mesh', key)\n delete meshes[key]\n }\n })\n\n // setup materials\n // defaults\n var materials = {\n frame: {\n colorDiffuse: [0.85, 0.85, 0.85]\n },\n glass: 'glass'\n }\n\n // check for adapted materials\n var materialKeys = Object.keys(data).filter(function(key) {\n return key.indexOf('material_') > -1\n })\n // add materials to instance\n var props = {}\n materialKeys.forEach(function(key) {\n props[key] = {\n type: 'string'\n }\n\n var mesh = key.replace('material_', '')\n materials[mesh] = data[key]\n })\n\n this_.extendSchema(props)\n\n // fetch materials from mat library\n Object.keys(materials).forEach(mat => {\n materials[mat] = getMaterial(materials[mat])\n })\n\n // construct data3d object\n var data3d = {\n meshes: meshes,\n materials: materials\n }\n\n // create new one\n this_.mesh = new THREE.Object3D()\n this_.data3dView = new io3d.aFrame.three.Data3dView({parent: this_.mesh})\n\n // update view\n this_.data3dView.set(data3d)\n this_.el.setObject3D('mesh', this_.mesh)\n // emit event\n this_.el.emit('mesh-updated');\n },\n\n remove: function () {\n this.el.parentEl.removeEventListener('wall-changed', this.updateFromWall)\n if (this.data3dView) {\n this.data3dView.destroy()\n this.data3dView = null\n }\n if (this.mesh) {\n this.el.removeObject3D('mesh')\n this.mesh = null\n }\n },\n\n generateMeshes3d: function () {\n var a = this.attributes\n var wallWidth = a.w || 0.15\n var wallControlLine = 'back'\n // get parent wall attributes\n if (this.wallWidth || this.wallControlLine) {\n wallWidth = this.wallWidth\n wallControlLine = this.wallControlLine\n }\n\n var wallBackPos = wallControlLine === 'front' ? -wallWidth : wallControlLine === 'center' ? -wallWidth / 2 : 0\n var wallFrontPos = wallWidth + wallBackPos\n\n var rowRatios = a.rowRatios\n var columnRatios = a.columnRatios\n var frameLength = a.frameLength\n var frameWidth = a.frameWidth\n var framePosition = a.side\n\n // set frame position within wall\n var frameBackPos, frameFrontPos\n if (framePosition === 'front') frameBackPos = wallFrontPos - frameWidth\n else if (framePosition === 'center') frameBackPos = wallBackPos + wallWidth / 2 - frameWidth / 2\n else frameBackPos = wallBackPos\n frameFrontPos = frameBackPos + frameWidth\n\n // internals\n\n // initial cursor positions (yCursor at the top, xCursor at the left)\n var yCursor = a.h\n var xCursor = 0\n\n var evenFrameHeight = a.h - frameLength\n var evenFrameLength = a.l - frameLength\n\n var rLen = rowRatios.length\n var cLen\n\n var rowSegments = 0\n var columnSegments = []\n\n var frameFacesCount = rLen * 4 + 18\n var glassFacesCount = 0\n\n for (var r = 0; r < rLen; r++) {\n rowSegments += rowRatios[ r ]\n if (!columnRatios[ r ]) columnRatios[ r ] = [ 1 ]\n columnSegments[ r ] = 0\n cLen = columnRatios[ r ].length\n frameFacesCount += (cLen - 1) * 4 + cLen * 8\n glassFacesCount += cLen * 4\n for (var c = 0; c < cLen; c++) {\n columnSegments[ r ] += columnRatios[ r ][ c ]\n }\n }\n\n var segmentLength\n var segmentHeight = evenFrameHeight / rowSegments\n\n var frameVertices = new Float32Array(frameFacesCount * 9)\n var fvPos = 0\n\n var glassVertices = new Float32Array(glassFacesCount * 9)\n var gvPos = 0\n\n // iterate\n for (var r = 0; r < rLen; r++) {\n\n cLen = columnRatios[ r ].length\n segmentLength = evenFrameLength / columnSegments[ r ]\n\n // horizontal bar quad\n\n frameVertices[ fvPos ] = frameLength\n frameVertices[ fvPos + 1 ] = yCursor\n frameVertices[ fvPos + 2 ] = frameBackPos\n frameVertices[ fvPos + 3 ] = evenFrameLength\n frameVertices[ fvPos + 4 ] = yCursor - frameLength\n frameVertices[ fvPos + 5 ] = frameBackPos\n frameVertices[ fvPos + 6 ] = frameLength\n frameVertices[ fvPos + 7 ] = yCursor - frameLength\n frameVertices[ fvPos + 8 ] = frameBackPos\n\n frameVertices[ fvPos + 9 ] = evenFrameLength\n frameVertices[ fvPos + 10 ] = yCursor - frameLength\n frameVertices[ fvPos + 11 ] = frameBackPos\n frameVertices[ fvPos + 12 ] = frameLength\n frameVertices[ fvPos + 13 ] = yCursor\n frameVertices[ fvPos + 14 ] = frameBackPos\n frameVertices[ fvPos + 15 ] = evenFrameLength\n frameVertices[ fvPos + 16 ] = yCursor\n frameVertices[ fvPos + 17 ] = frameBackPos\n\n frameVertices[ fvPos + 18 ] = frameLength\n frameVertices[ fvPos + 19 ] = yCursor\n frameVertices[ fvPos + 20 ] = frameFrontPos\n frameVertices[ fvPos + 21 ] = frameLength\n frameVertices[ fvPos + 22 ] = yCursor - frameLength\n frameVertices[ fvPos + 23 ] = frameFrontPos\n frameVertices[ fvPos + 24 ] = evenFrameLength\n frameVertices[ fvPos + 25 ] = yCursor - frameLength\n frameVertices[ fvPos + 26 ] = frameFrontPos\n\n frameVertices[ fvPos + 27 ] = evenFrameLength\n frameVertices[ fvPos + 28 ] = yCursor - frameLength\n frameVertices[ fvPos + 29 ] = frameFrontPos\n frameVertices[ fvPos + 30 ] = evenFrameLength\n frameVertices[ fvPos + 31 ] = yCursor\n frameVertices[ fvPos + 32 ] = frameFrontPos\n frameVertices[ fvPos + 33 ] = frameLength\n frameVertices[ fvPos + 34 ] = yCursor\n frameVertices[ fvPos + 35 ] = frameFrontPos\n\n fvPos += 36\n yCursor -= frameLength\n\n // vertical bars\n\n for (var c = 0; c < cLen - 1; c++) {\n\n // move xCursor to the right\n xCursor += segmentLength * columnRatios[ r ][ c ]\n\n // vertical bar quad\n\n frameVertices[ fvPos ] = xCursor\n frameVertices[ fvPos + 1 ] = yCursor\n frameVertices[ fvPos + 2 ] = frameBackPos\n frameVertices[ fvPos + 3 ] = xCursor + frameLength\n frameVertices[ fvPos + 4 ] = yCursor - segmentHeight * rowRatios[ r ] + frameLength\n frameVertices[ fvPos + 5 ] = frameBackPos\n frameVertices[ fvPos + 6 ] = xCursor\n frameVertices[ fvPos + 7 ] = yCursor - segmentHeight * rowRatios[ r ] + frameLength\n frameVertices[ fvPos + 8 ] = frameBackPos\n\n frameVertices[ fvPos + 9 ] = xCursor + frameLength\n frameVertices[ fvPos + 10 ] = yCursor - segmentHeight * rowRatios[ r ] + frameLength\n frameVertices[ fvPos + 11 ] = frameBackPos\n frameVertices[ fvPos + 12 ] = xCursor\n frameVertices[ fvPos + 13 ] = yCursor\n frameVertices[ fvPos + 14 ] = frameBackPos\n frameVertices[ fvPos + 15 ] = xCursor + frameLength\n frameVertices[ fvPos + 16 ] = yCursor\n frameVertices[ fvPos + 17 ] = frameBackPos\n\n frameVertices[ fvPos + 18 ] = xCursor\n frameVertices[ fvPos + 19 ] = yCursor\n frameVertices[ fvPos + 20 ] = frameFrontPos\n frameVertices[ fvPos + 21 ] = xCursor\n frameVertices[ fvPos + 22 ] = yCursor - segmentHeight * rowRatios[ r ] + frameLength\n frameVertices[ fvPos + 23 ] = frameFrontPos\n frameVertices[ fvPos + 24 ] = xCursor + frameLength\n frameVertices[ fvPos + 25 ] = yCursor - segmentHeight * rowRatios[ r ] + frameLength\n frameVertices[ fvPos + 26 ] = frameFrontPos\n\n frameVertices[ fvPos + 27 ] = xCursor + frameLength\n frameVertices[ fvPos + 28 ] = yCursor - segmentHeight * rowRatios[ r ] + frameLength\n frameVertices[ fvPos + 29 ] = frameFrontPos\n frameVertices[ fvPos + 30 ] = xCursor + frameLength\n frameVertices[ fvPos + 31 ] = yCursor\n frameVertices[ fvPos + 32 ] = frameFrontPos\n frameVertices[ fvPos + 33 ] = xCursor\n frameVertices[ fvPos + 34 ] = yCursor\n frameVertices[ fvPos + 35 ] = frameFrontPos\n\n fvPos += 36\n\n }\n\n // glass & extrusions\n xCursor = 0\n for (var c = 0; c < cLen; c++) {\n\n // glass quad\n\n glassVertices[ gvPos ] = xCursor + frameLength\n glassVertices[ gvPos + 1 ] = yCursor\n glassVertices[ gvPos + 2 ] = frameBackPos\n glassVertices[ gvPos + 3 ] = xCursor + frameLength\n glassVertices[ gvPos + 4 ] = yCursor - segmentHeight * rowRatios[ r ] + frameLength\n glassVertices[ gvPos + 5 ] = frameBackPos\n glassVertices[ gvPos + 6 ] = xCursor + segmentLength * columnRatios[ r ][ c ]\n glassVertices[ gvPos + 7 ] = yCursor - segmentHeight * rowRatios[ r ] + frameLength\n glassVertices[ gvPos + 8 ] = frameBackPos\n\n glassVertices[ gvPos + 9 ] = xCursor + segmentLength * columnRatios[ r ][ c ]\n glassVertices[ gvPos + 10 ] = yCursor - segmentHeight * rowRatios[ r ] + frameLength\n glassVertices[ gvPos + 11 ] = frameBackPos\n glassVertices[ gvPos + 12 ] = xCursor + segmentLength * columnRatios[ r ][ c ]\n glassVertices[ gvPos + 13 ] = yCursor\n glassVertices[ gvPos + 14 ] = frameBackPos\n glassVertices[ gvPos + 15 ] = xCursor + frameLength\n glassVertices[ gvPos + 16 ] = yCursor\n glassVertices[ gvPos + 17 ] = frameBackPos\n\n gvPos += 18\n\n glassVertices[ gvPos ] = xCursor + frameLength\n glassVertices[ gvPos + 1 ] = yCursor\n glassVertices[ gvPos + 2 ] = frameBackPos\n glassVertices[ gvPos + 3 ] = xCursor + segmentLength * columnRatios[ r ][ c ]\n glassVertices[ gvPos + 4 ] = yCursor - segmentHeight * rowRatios[ r ] + frameLength\n glassVertices[ gvPos + 5 ] = frameBackPos\n glassVertices[ gvPos + 6 ] = xCursor + frameLength\n glassVertices[ gvPos + 7 ] = yCursor - segmentHeight * rowRatios[ r ] + frameLength\n glassVertices[ gvPos + 8 ] = frameBackPos\n\n glassVertices[ gvPos + 9 ] = xCursor + segmentLength * columnRatios[ r ][ c ]\n glassVertices[ gvPos + 10 ] = yCursor - segmentHeight * rowRatios[ r ] + frameLength\n glassVertices[ gvPos + 11 ] = frameBackPos\n glassVertices[ gvPos + 12 ] = xCursor + frameLength\n glassVertices[ gvPos + 13 ] = yCursor\n glassVertices[ gvPos + 14 ] = frameBackPos\n glassVertices[ gvPos + 15 ] = xCursor + segmentLength * columnRatios[ r ][ c ]\n glassVertices[ gvPos + 16 ] = yCursor\n glassVertices[ gvPos + 17 ] = frameBackPos\n\n gvPos += 18\n\n // left side extrusion\n\n frameVertices[ fvPos ] = xCursor + frameLength\n frameVertices[ fvPos + 1 ] = yCursor\n frameVertices[ fvPos + 2 ] = frameBackPos\n frameVertices[ fvPos + 3 ] = xCursor + frameLength\n frameVertices[ fvPos + 4 ] = yCursor - segmentHeight * rowRatios[ r ] + frameLength\n frameVertices[ fvPos + 5 ] = frameFrontPos\n frameVertices[ fvPos + 6 ] = xCursor + frameLength\n frameVertices[ fvPos + 7 ] = yCursor - segmentHeight * rowRatios[ r ] + frameLength\n frameVertices[ fvPos + 8 ] = frameBackPos\n\n frameVertices[ fvPos + 9 ] = xCursor + frameLength\n frameVertices[ fvPos + 10 ] = yCursor\n frameVertices[ fvPos + 11 ] = frameBackPos\n frameVertices[ fvPos + 12 ] = xCursor + frameLength\n frameVertices[ fvPos + 13 ] = yCursor\n frameVertices[ fvPos + 14 ] = frameFrontPos\n frameVertices[ fvPos + 15 ] = xCursor + frameLength\n frameVertices[ fvPos + 16 ] = yCursor - segmentHeight * rowRatios[ r ] + frameLength\n frameVertices[ fvPos + 17 ] = frameFrontPos\n\n fvPos += 18\n\n // bottom side extrusion\n\n frameVertices[ fvPos ] = xCursor + frameLength\n frameVertices[ fvPos + 1 ] = yCursor - segmentHeight * rowRatios[ r ] + frameLength\n frameVertices[ fvPos + 2 ] = frameBackPos\n frameVertices[ fvPos + 3 ] = xCursor + segmentLength * columnRatios[ r ][ c ]\n frameVertices[ fvPos + 4 ] = yCursor - segmentHeight * rowRatios[ r ] + frameLength\n frameVertices[ fvPos + 5 ] = frameFrontPos\n frameVertices[ fvPos + 6 ] = xCursor + segmentLength * columnRatios[ r ][ c ]\n frameVertices[ fvPos + 7 ] = yCursor - segmentHeight * rowRatios[ r ] + frameLength\n frameVertices[ fvPos + 8 ] = frameBackPos\n\n frameVertices[ fvPos + 9 ] = xCursor + frameLength\n frameVertices[ fvPos + 10 ] = yCursor - segmentHeight * rowRatios[ r ] + frameLength\n frameVertices[ fvPos + 11 ] = frameBackPos\n frameVertices[ fvPos + 12 ] = xCursor + frameLength\n frameVertices[ fvPos + 13 ] = yCursor - segmentHeight * rowRatios[ r ] + frameLength\n frameVertices[ fvPos + 14 ] = frameFrontPos\n frameVertices[ fvPos + 15 ] = xCursor + segmentLength * columnRatios[ r ][ c ]\n frameVertices[ fvPos + 16 ] = yCursor - segmentHeight * rowRatios[ r ] + frameLength\n frameVertices[ fvPos + 17 ] = frameFrontPos\n\n fvPos += 18\n\n // top side extrusion\n\n frameVertices[ fvPos ] = xCursor + frameLength\n frameVertices[ fvPos + 1 ] = yCursor\n frameVertices[ fvPos + 2 ] = frameBackPos\n frameVertices[ fvPos + 3 ] = xCursor + segmentLength * columnRatios[ r ][ c ]\n frameVertices[ fvPos + 4 ] = yCursor\n frameVertices[ fvPos + 5 ] = frameBackPos\n frameVertices[ fvPos + 6 ] = xCursor + segmentLength * columnRatios[ r ][ c ]\n frameVertices[ fvPos + 7 ] = yCursor\n frameVertices[ fvPos + 8 ] = frameFrontPos\n\n frameVertices[ fvPos + 9 ] = xCursor + frameLength\n frameVertices[ fvPos + 10 ] = yCursor\n frameVertices[ fvPos + 11 ] = frameBackPos\n frameVertices[ fvPos + 12 ] = xCursor + segmentLength * columnRatios[ r ][ c ]\n frameVertices[ fvPos + 13 ] = yCursor\n frameVertices[ fvPos + 14 ] = frameFrontPos\n frameVertices[ fvPos + 15 ] = xCursor + frameLength\n frameVertices[ fvPos + 16 ] = yCursor\n frameVertices[ fvPos + 17 ] = frameFrontPos\n\n fvPos += 18\n\n // move xCursor to the right\n xCursor += segmentLength * columnRatios[ r ][ c ]\n\n // right side extrusion\n\n frameVertices[ fvPos ] = xCursor\n frameVertices[ fvPos + 1 ] = yCursor\n frameVertices[ fvPos + 2 ] = frameBackPos\n frameVertices[ fvPos + 3 ] = xCursor\n frameVertices[ fvPos + 4 ] = yCursor - segmentHeight * rowRatios[ r ] + frameLength\n frameVertices[ fvPos + 5 ] = frameBackPos\n frameVertices[ fvPos + 6 ] = xCursor\n frameVertices[ fvPos + 7 ] = yCursor - segmentHeight * rowRatios[ r ] + frameLength\n frameVertices[ fvPos + 8 ] = frameFrontPos\n\n frameVertices[ fvPos + 9 ] = xCursor\n frameVertices[ fvPos + 10 ] = yCursor\n frameVertices[ fvPos + 11 ] = frameBackPos\n frameVertices[ fvPos + 12 ] = xCursor\n frameVertices[ fvPos + 13 ] = yCursor - segmentHeight * rowRatios[ r ] + frameLength\n frameVertices[ fvPos + 14 ] = frameFrontPos\n frameVertices[ fvPos + 15 ] = xCursor\n frameVertices[ fvPos + 16 ] = yCursor\n frameVertices[ fvPos + 17 ] = frameFrontPos\n\n fvPos += 18\n\n }\n\n // reset xCursor, move yCursor downwards\n xCursor = 0\n yCursor -= segmentHeight * rowRatios[ r ] - frameLength\n\n }\n\n // add last horizontal frame bar quad\n\n frameVertices[ fvPos ] = frameLength\n frameVertices[ fvPos + 1 ] = yCursor\n frameVertices[ fvPos + 2 ] = frameBackPos\n frameVertices[ fvPos + 3 ] = evenFrameLength\n frameVertices[ fvPos + 4 ] = yCursor - frameLength\n frameVertices[ fvPos + 5 ] = frameBackPos\n frameVertices[ fvPos + 6 ] = frameLength\n frameVertices[ fvPos + 7 ] = yCursor - frameLength\n frameVertices[ fvPos + 8 ] = frameBackPos\n\n frameVertices[ fvPos + 9 ] = evenFrameLength\n frameVertices[ fvPos + 10 ] = yCursor - frameLength\n frameVertices[ fvPos + 11 ] = frameBackPos\n frameVertices[ fvPos + 12 ] = frameLength\n frameVertices[ fvPos + 13 ] = yCursor\n frameVertices[ fvPos + 14 ] = frameBackPos\n frameVertices[ fvPos + 15 ] = evenFrameLength\n frameVertices[ fvPos + 16 ] = yCursor\n frameVertices[ fvPos + 17 ] = frameBackPos\n\n frameVertices[ fvPos + 18 ] = frameLength\n frameVertices[ fvPos + 19 ] = yCursor\n frameVertices[ fvPos + 20 ] = frameFrontPos\n frameVertices[ fvPos + 21 ] = frameLength\n frameVertices[ fvPos + 22 ] = yCursor - frameLength\n frameVertices[ fvPos + 23 ] = frameFrontPos\n frameVertices[ fvPos + 24 ] = evenFrameLength\n frameVertices[ fvPos + 25 ] = yCursor - frameLength\n frameVertices[ fvPos + 26 ] = frameFrontPos\n\n frameVertices[ fvPos + 27 ] = evenFrameLength\n frameVertices[ fvPos + 28 ] = yCursor - frameLength\n frameVertices[ fvPos + 29 ] = frameFrontPos\n frameVertices[ fvPos + 30 ] = evenFrameLength\n frameVertices[ fvPos + 31 ] = yCursor\n frameVertices[ fvPos + 32 ] = frameFrontPos\n frameVertices[ fvPos + 33 ] = frameLength\n frameVertices[ fvPos + 34 ] = yCursor\n frameVertices[ fvPos + 35 ] = frameFrontPos\n\n fvPos += 36\n\n // add left frame side quad\n\n frameVertices[ fvPos ] = 0\n frameVertices[ fvPos + 1 ] = a.h\n frameVertices[ fvPos + 2 ] = frameBackPos\n frameVertices[ fvPos + 3 ] = frameLength\n frameVertices[ fvPos + 4 ] = 0\n frameVertices[ fvPos + 5 ] = frameBackPos\n frameVertices[ fvPos + 6 ] = 0\n frameVertices[ fvPos + 7 ] = 0\n frameVertices[ fvPos + 8 ] = frameBackPos\n\n frameVertices[ fvPos + 9 ] = frameLength\n frameVertices[ fvPos + 10 ] = 0\n frameVertices[ fvPos + 11 ] = frameBackPos\n frameVertices[ fvPos + 12 ] = 0\n frameVertices[ fvPos + 13 ] = a.h\n frameVertices[ fvPos + 14 ] = frameBackPos\n frameVertices[ fvPos + 15 ] = frameLength\n frameVertices[ fvPos + 16 ] = a.h\n frameVertices[ fvPos + 17 ] = frameBackPos\n\n frameVertices[ fvPos + 18 ] = 0\n frameVertices[ fvPos + 19 ] = a.h\n frameVertices[ fvPos + 20 ] = frameFrontPos\n frameVertices[ fvPos + 21 ] = 0\n frameVertices[ fvPos + 22 ] = 0\n frameVertices[ fvPos + 23 ] = frameFrontPos\n frameVertices[ fvPos + 24 ] = frameLength\n frameVertices[ fvPos + 25 ] = 0\n frameVertices[ fvPos + 26 ] = frameFrontPos\n\n frameVertices[ fvPos + 27 ] = frameLength\n frameVertices[ fvPos + 28 ] = 0\n frameVertices[ fvPos + 29 ] = frameFrontPos\n frameVertices[ fvPos + 30 ] = frameLength\n frameVertices[ fvPos + 31 ] = a.h\n frameVertices[ fvPos + 32 ] = frameFrontPos\n frameVertices[ fvPos + 33 ] = 0\n frameVertices[ fvPos + 34 ] = a.h\n frameVertices[ fvPos + 35 ] = frameFrontPos\n\n fvPos += 36\n\n // add right frame side quad\n\n frameVertices[ fvPos ] = evenFrameLength\n frameVertices[ fvPos + 1 ] = a.h\n frameVertices[ fvPos + 2 ] = frameBackPos\n frameVertices[ fvPos + 3 ] = a.l\n frameVertices[ fvPos + 4 ] = 0\n frameVertices[ fvPos + 5 ] = frameBackPos\n frameVertices[ fvPos + 6 ] = evenFrameLength\n frameVertices[ fvPos + 7 ] = 0\n frameVertices[ fvPos + 8 ] = frameBackPos\n\n frameVertices[ fvPos + 9 ] = a.l\n frameVertices[ fvPos + 10 ] = 0\n frameVertices[ fvPos + 11 ] = frameBackPos\n frameVertices[ fvPos + 12 ] = evenFrameLength\n frameVertices[ fvPos + 13 ] = a.h\n frameVertices[ fvPos + 14 ] = frameBackPos\n frameVertices[ fvPos + 15 ] = a.l\n frameVertices[ fvPos + 16 ] = a.h\n frameVertices[ fvPos + 17 ] = frameBackPos\n\n frameVertices[ fvPos + 18 ] = evenFrameLength\n frameVertices[ fvPos + 19 ] = a.h\n frameVertices[ fvPos + 20 ] = frameFrontPos\n frameVertices[ fvPos + 21 ] = evenFrameLength\n frameVertices[ fvPos + 22 ] = 0\n frameVertices[ fvPos + 23 ] = frameFrontPos\n frameVertices[ fvPos + 24 ] = a.l\n frameVertices[ fvPos + 25 ] = 0\n frameVertices[ fvPos + 26 ] = frameFrontPos\n\n frameVertices[ fvPos + 27 ] = a.l\n frameVertices[ fvPos + 28 ] = 0\n frameVertices[ fvPos + 29 ] = frameFrontPos\n frameVertices[ fvPos + 30 ] = a.l\n frameVertices[ fvPos + 31 ] = a.h\n frameVertices[ fvPos + 32 ] = frameFrontPos\n frameVertices[ fvPos + 33 ] = evenFrameLength\n frameVertices[ fvPos + 34 ] = a.h\n frameVertices[ fvPos + 35 ] = frameFrontPos\n\n fvPos += 36\n\n // add right outer side squad\n\n frameVertices[ fvPos ] = a.l\n frameVertices[ fvPos + 1 ] = a.h\n frameVertices[ fvPos + 2 ] = frameBackPos\n frameVertices[ fvPos + 3 ] = a.l\n frameVertices[ fvPos + 4 ] = 0\n frameVertices[ fvPos + 5 ] = frameFrontPos\n frameVertices[ fvPos + 6 ] = a.l\n frameVertices[ fvPos + 7 ] = 0\n frameVertices[ fvPos + 8 ] = frameBackPos\n\n frameVertices[ fvPos + 9 ] = a.l\n frameVertices[ fvPos + 10 ] = a.h\n frameVertices[ fvPos + 11 ] = frameBackPos\n frameVertices[ fvPos + 12 ] = a.l\n frameVertices[ fvPos + 13 ] = a.h\n frameVertices[ fvPos + 14 ] = frameFrontPos\n frameVertices[ fvPos + 15 ] = a.l\n frameVertices[ fvPos + 16 ] = 0\n frameVertices[ fvPos + 17 ] = frameFrontPos\n\n fvPos += 18\n\n // add right outer side squad\n\n frameVertices[ fvPos ] = 0\n frameVertices[ fvPos + 1 ] = a.h\n frameVertices[ fvPos + 2 ] = frameBackPos\n frameVertices[ fvPos + 3 ] = 0\n frameVertices[ fvPos + 4 ] = 0\n frameVertices[ fvPos + 5 ] = frameBackPos\n frameVertices[ fvPos + 6 ] = 0\n frameVertices[ fvPos + 7 ] = 0\n frameVertices[ fvPos + 8 ] = frameFrontPos\n\n frameVertices[ fvPos + 9 ] = 0\n frameVertices[ fvPos + 10 ] = a.h\n frameVertices[ fvPos + 11 ] = frameBackPos\n frameVertices[ fvPos + 12 ] = 0\n frameVertices[ fvPos + 13 ] = 0\n frameVertices[ fvPos + 14 ] = frameFrontPos\n frameVertices[ fvPos + 15 ] = 0\n frameVertices[ fvPos + 16 ] = a.h\n frameVertices[ fvPos + 17 ] = frameFrontPos\n\n fvPos += 18\n\n // add top outer side squad\n\n frameVertices[ fvPos ] = 0\n frameVertices[ fvPos + 1 ] = a.h\n frameVertices[ fvPos + 2 ] = frameBackPos\n frameVertices[ fvPos + 3 ] = a.l\n frameVertices[ fvPos + 4 ] = a.h\n frameVertices[ fvPos + 5 ] = frameFrontPos\n frameVertices[ fvPos + 6 ] = a.l\n frameVertices[ fvPos + 7 ] = a.h\n frameVertices[ fvPos + 8 ] = frameBackPos\n\n frameVertices[ fvPos + 9 ] = a.l\n frameVertices[ fvPos + 10 ] = a.h\n frameVertices[ fvPos + 11 ] = frameFrontPos\n frameVertices[ fvPos + 12 ] = 0\n frameVertices[ fvPos + 13 ] = a.h\n frameVertices[ fvPos + 14 ] = frameBackPos\n frameVertices[ fvPos + 15 ] = 0\n frameVertices[ fvPos + 16 ] = a.h\n frameVertices[ fvPos + 17 ] = frameFrontPos\n\n // return meshes\n return {\n frame: {\n positions: frameVertices,\n normals: generateNormals.flat(frameVertices),\n material: 'frame'\n },\n glass: {\n positions: glassVertices,\n normals: generateNormals.flat(glassVertices),\n material: 'glass'\n }\n }\n }\n}","import fetchScript from '../utils/io/fetch-script.js'\n\n// internals\n\nvar INSPECTOR_PLUGINS_URL = 'https://dist.3d.io/3dio-inspector-plugins/0.x.x/3dio-inspector-plugins.js'\n\nfunction init() {\n\n if (window.AFRAME && window.AFRAME.INSPECTOR && window.AFRAME.INSPECTOR.opened) {\n // inspector opened: load immediately\n loadPlugins()\n } else {\n // initialize on inspector ready event\n window.addEventListener('inspector-loaded', loadPlugins)\n }\n\n// methods\n\n function loadPlugins () {\n if (window.io3d.aframe.pluginsLoaded) return\n fetchScript(INSPECTOR_PLUGINS_URL).catch(function(error){\n console.error('Could not load inspector plugins: '+error)\n })\n }\n\n}\n\n// expose API\n\nexport default {\n init: init\n}","import Promise from 'bluebird'\n\nvar DDS_MAGIC = 0x20534444;\n\nvar DDSD_CAPS = 0x1,\n DDSD_HEIGHT = 0x2,\n DDSD_WIDTH = 0x4,\n DDSD_PITCH = 0x8,\n DDSD_PIXELFORMAT = 0x1000,\n DDSD_MIPMAPCOUNT = 0x20000,\n DDSD_LINEARSIZE = 0x80000,\n DDSD_DEPTH = 0x800000;\n\nvar DDSCAPS_COMPLEX = 0x8,\n DDSCAPS_MIPMAP = 0x400000,\n DDSCAPS_TEXTURE = 0x1000;\n\nvar DDSCAPS2_CUBEMAP = 0x200,\n DDSCAPS2_CUBEMAP_POSITIVEX = 0x400,\n DDSCAPS2_CUBEMAP_NEGATIVEX = 0x800,\n DDSCAPS2_CUBEMAP_POSITIVEY = 0x1000,\n DDSCAPS2_CUBEMAP_NEGATIVEY = 0x2000,\n DDSCAPS2_CUBEMAP_POSITIVEZ = 0x4000,\n DDSCAPS2_CUBEMAP_NEGATIVEZ = 0x8000,\n DDSCAPS2_VOLUME = 0x200000;\n\nvar DDPF_ALPHAPIXELS = 0x1,\n DDPF_ALPHA = 0x2,\n DDPF_FOURCC = 0x4,\n DDPF_RGB = 0x40,\n DDPF_YUV = 0x200,\n DDPF_LUMINANCE = 0x20000;\n\n// internals\n\nvar FOURCC_DXT1 = fourCCToInt32(\"DXT1\");\nvar FOURCC_DXT3 = fourCCToInt32(\"DXT3\");\nvar FOURCC_DXT5 = fourCCToInt32(\"DXT5\");\n\n// functions\n\nfunction fourCCToInt32 (value) {\n\n return value.charCodeAt(0) +\n (value.charCodeAt(1) << 8) +\n (value.charCodeAt(2) << 16) +\n (value.charCodeAt(3) << 24);\n\n}\n\nfunction int32ToFourCC (value) {\n\n return String.fromCharCode(\n value & 0xff,\n (value >> 8) & 0xff,\n (value >> 16) & 0xff,\n (value >> 24) & 0xff\n );\n}\n\nfunction loadARGBMip (buffer, dataOffset, width, height) {\n var dataLength = width * height * 4;\n var srcBuffer = new Uint8Array(buffer, dataOffset, dataLength);\n var byteArray = new Uint8Array(dataLength);\n var dst = 0;\n var src = 0;\n for (var y = 0; y < height; y++) {\n for (var x = 0; x < width; x++) {\n var b = srcBuffer[ src ];\n src++;\n var g = srcBuffer[ src ];\n src++;\n var r = srcBuffer[ src ];\n src++;\n var a = srcBuffer[ src ];\n src++;\n byteArray[ dst ] = r;\n dst++; //r\n byteArray[ dst ] = g;\n dst++; //g\n byteArray[ dst ] = b;\n dst++; //b\n byteArray[ dst ] = a;\n dst++; //a\n }\n }\n return byteArray;\n}\n\nfunction parse (buffer, loadMipmaps) {\n\n var dds = { mipmaps: [], width: 0, height: 0, format: null, mipmapCount: 1 };\n\n var headerLengthInt = 31; // The header length in 32 bit ints\n\n // Offsets into the header array\n\n var off_magic = 0;\n\n var off_size = 1;\n var off_flags = 2;\n var off_height = 3;\n var off_width = 4;\n\n var off_mipmapCount = 7;\n\n var off_pfFlags = 20;\n var off_pfFourCC = 21;\n var off_RGBBitCount = 22;\n var off_RBitMask = 23;\n var off_GBitMask = 24;\n var off_BBitMask = 25;\n var off_ABitMask = 26;\n\n var off_caps = 27;\n var off_caps2 = 28;\n var off_caps3 = 29;\n var off_caps4 = 30;\n\n // Parse header\n\n var header = new Int32Array(buffer, 0, headerLengthInt);\n\n if (header[ off_magic ] !== DDS_MAGIC) {\n\n console.error('THREE.DDSLoader.parse: Invalid magic number in DDS header.');\n return dds;\n\n }\n\n if (!header[ off_pfFlags ] & DDPF_FOURCC) {\n\n console.error('THREE.DDSLoader.parse: Unsupported format, must contain a FourCC code.');\n return dds;\n\n }\n\n var blockBytes;\n\n var fourCC = header[ off_pfFourCC ];\n\n var isRGBAUncompressed = false;\n\n switch (fourCC) {\n\n case FOURCC_DXT1:\n\n blockBytes = 8;\n dds.format = THREE.RGB_S3TC_DXT1_Format;\n break;\n\n case FOURCC_DXT3:\n\n blockBytes = 16;\n dds.format = THREE.RGBA_S3TC_DXT3_Format;\n break;\n\n case FOURCC_DXT5:\n\n blockBytes = 16;\n dds.format = THREE.RGBA_S3TC_DXT5_Format;\n break;\n\n default:\n\n if (header[ off_RGBBitCount ] == 32\n && header[ off_RBitMask ] & 0xff0000\n && header[ off_GBitMask ] & 0xff00\n && header[ off_BBitMask ] & 0xff\n && header[ off_ABitMask ] & 0xff000000) {\n isRGBAUncompressed = true;\n blockBytes = 64;\n dds.format = THREE.RGBAFormat;\n } else {\n console.error('THREE.DDSLoader.parse: Unsupported FourCC code ', int32ToFourCC(fourCC));\n return dds;\n }\n }\n\n dds.mipmapCount = 1;\n\n if (header[ off_flags ] & DDSD_MIPMAPCOUNT && loadMipmaps !== false) {\n\n dds.mipmapCount = Math.max(1, header[ off_mipmapCount ]);\n\n }\n\n //TODO: Verify that all faces of the cubemap are present with DDSCAPS2_CUBEMAP_POSITIVEX, etc.\n\n dds.isCubemap = header[ off_caps2 ] & DDSCAPS2_CUBEMAP ? true : false;\n\n dds.width = header[ off_width ];\n dds.height = header[ off_height ];\n\n var dataOffset = header[ off_size ] + 4;\n\n // Extract mipmaps buffers\n\n var width = dds.width;\n var height = dds.height;\n\n var faces = dds.isCubemap ? 6 : 1;\n\n for (var face = 0; face < faces; face++) {\n\n for (var i = 0; i < dds.mipmapCount; i++) {\n\n var byteArray, dataLength\n if (isRGBAUncompressed) {\n byteArray = loadARGBMip(buffer, dataOffset, width, height);\n dataLength = byteArray.length;\n } else {\n dataLength = Math.max(4, width) / 4 * Math.max(4, height) / 4 * blockBytes;\n byteArray = new Uint8Array(buffer, dataOffset, dataLength);\n }\n\n var mipmap = { \"data\": byteArray, \"width\": width, \"height\": height };\n dds.mipmaps.push(mipmap);\n\n dataOffset += dataLength;\n\n width = Math.max(width * 0.5, 1);\n height = Math.max(height * 0.5, 1);\n\n }\n\n width = dds.width;\n height = dds.height;\n\n }\n\n return dds;\n\n}\n\nfunction log2 (x) {\n return Math.log(x) / Math.LN2\n}\n\n// load function\n\nexport default function fetchDdsTexture (url) {\n return new Promise(function (resolve, reject) {\n\n var xhr = new XMLHttpRequest()\n\n xhr.onload = function (event) {\n\n if (xhr.status >= 200 && xhr.status < 300) {\n\n var buffer = xhr.response,\n dds\n\n // parse data\n try {\n dds = parse(buffer, true)\n } catch (e) {\n var message = 'Error Loading DDS Texture\\n' + url + '\\n' + e.name + ': ' + e.message\n console.error(message)\n reject(message)\n return\n }\n\n // See OpenGL ES 2.0.25 p. 81 paragraph 1 for the number of required mipmaps.\n var mipmapCount = log2(Math.max(dds.width, dds.height)) + 1\n if (dds.mipmapCount != mipmapCount) {\n console.error('Reading DDS texture failed: ' + url + '\\nmipmaps counted: ' + dds.mipmapCount + ', should be: ' + mipmapCount +\n '\\nPlease make sure you have mipmap generation enabled when creating DDS textures from images.')\n reject('Error parsing DDS. Wrong mipmaps count. ' + url)\n return\n }\n\n // create compressed texture\n var texture = new THREE.CompressedTexture()\n\n texture.format = dds.format\n texture.mipmaps = dds.mipmaps\n texture.image.width = dds.width\n texture.image.height = dds.height\n texture.image.src = url\n texture.sourceFile = url\n texture.url = url\n texture.bufferByteLength = buffer.byteLength\n\n // gl.generateMipmap fails for compressed textures\n // mipmaps must be embedded in the DDS file\n // or texture filters must not use mipmapping\n texture.generateMipmaps = false\n\n resolve(texture)\n\n } else {\n reject({\n message: 'Http Request error',\n url: url,\n status: xhr.status,\n headers: xhr.getAllResponseHeaders(),\n event: event\n })\n }\n\n }\n xhr.onerror = function (event) {\n reject({\n message: 'Http Request error',\n url: url,\n status: xhr.status,\n headers: xhr.getAllResponseHeaders(),\n event: event\n })\n }\n\n xhr.open('GET', url, true)\n xhr.crossOrigin = \"Anonymous\"\n xhr.responseType = 'arraybuffer'\n xhr.send(null)\n\n })\n}","import Promise from 'bluebird'\nimport runtime from '../../../../../core/runtime.js'\n\n// internals\n\n// graphic card max supported texture size\nvar MAX_TEXTURE_SIZE = runtime.has.webGl ? runtime.webGl.maxTextureSize || 2048 : 2048\n\n// helpers\n\nfunction checkPowerOfTwo (value) {\n return ( value & ( value - 1 ) ) === 0 && value !== 0\n}\n\nfunction nearestPowerOfTwoOrMaxTextureSize (n) {\n // max texture size supported by vga\n if (n > MAX_TEXTURE_SIZE) {\n return MAX_TEXTURE_SIZE\n }\n // next best power of two\n var l = Math.log(n) / Math.LN2;\n return Math.pow(2, Math.round(l))\n}\n\nfunction resizeImage (image, url) {\n\n var width = nearestPowerOfTwoOrMaxTextureSize(image.width)\n var height = nearestPowerOfTwoOrMaxTextureSize(image.height)\n\n var canvas = document.createElement('canvas')\n canvas.width = width\n canvas.height = height\n canvas.getContext('2d').drawImage(image, 0, 0, width, height)\n\n console.log('Image size not compatible. Image has been resized from ' + image.width + 'x' + image.height + 'px to ' + canvas.width + 'x' + canvas.height +\n 'px.\\n' + url)\n\n return canvas\n}\n\n// function\n\nexport default function fetchImageTexture (url) {\n return new Promise(function (resolve, reject) {\n\n var image = document.createElement('img')\n image.crossOrigin = 'Anonymous'\n\n image.onload = function () {\n\n var texture = new THREE.Texture()\n\n texture.sourceFile = url\n texture.url = url\n\n // image size compatibility check\n\n var isPowerOfTwo = (checkPowerOfTwo(image.width) && checkPowerOfTwo(image.height))\n var isNotTooBig = (image.width <= MAX_TEXTURE_SIZE && image.height <= MAX_TEXTURE_SIZE)\n\n if (isPowerOfTwo && isNotTooBig) {\n\n // use image as it is\n texture.image = image\n\n } else {\n\n // resize image to make it compatible\n texture.image = resizeImage(image, url)\n // add url reference\n texture.image.src = url\n\n }\n\n resolve(texture)\n\n }\n\n var triedWithCacheBust = false\n image.onerror = function () {\n if(triedWithCacheBust) {\n reject('Error loading texture ' + url)\n } else {\n // try again with cache busting to avoid things like #1510\n triedWithCacheBust = true\n if (url.indexOf('?') === -1) {\n url += '?cacheBust=' + new Date().getTime()\n } else {\n url += '&cacheBust=' + new Date().getTime()\n }\n image.src = url\n }\n }\n\n // initiate image loading\n image.src = url\n\n })\n}","// configs\n\nvar maxConcurrentQueuedRequests = 15 // not queued requests are not limited in running parallel\nvar queuesByPriority = [\n 'architectureGeometries',\n 'architectureTexturesLoRes',\n 'interiorGeometries',\n 'interiorTexturesLoRes',\n 'architectureTexturesHiRes',\n 'interiorTexturesHiRes'\n]\n\nvar queueFences = [\n false,\n false,\n true,\n false,\n false\n]\n\n// internals\n\nvar queues = {}\nvar queueFences = {}\nvar queuesChanged = false\nvar queueInfo = {}\nvar queuesLength = queuesByPriority.length\nvar concurrentRequests = 0\nvar concurrentPerQueue = {}\nvar queueName\nfor (var i = 0, l = queuesLength; i < l; i++) {\n queueName = queuesByPriority[i]\n queues[queueName] = []\n queueFences[queueName] = queueFences[i]\n queueInfo[queueName] = {requestCount: 0}\n concurrentPerQueue[queueName] = 0\n}\n\n// private methods\n\nfunction startRequest(queueName) {\n // Update queue tracking information\n var info = queueInfo[queueName];\n var time = performance.now() / 1000;\n if (info.timeFirst) {\n info.timeFirst = time;\n info.timeLast = time;\n } else\n info.timeLast = time;\n info.requestCount++;\n // Update concurrent request counts\n concurrentPerQueue[queueName] += 1;\n concurrentRequests++;\n // set flag\n queuesChanged = true;\n // Start request\n var queue = queues[queueName];\n var request = queue.shift();\n request.start();\n}\n\nfunction processQueue() {\n var anchorStage = null;\n for (var i = 0; i < queuesLength; i++) {\n var queueName = queuesByPriority[i];\n while (queues[queueName].length > 0 && concurrentRequests < maxConcurrentQueuedRequests)\n startRequest(queueName)\n if (anchorStage === null && concurrentPerQueue[queueName] !== 0)\n anchorStage = i;\n if (anchorStage !== null && (queueFences[queueName] || (i - anchorStage > 0)))\n break;\n }\n}\n\n// public methods\n\nfunction enqueue(queueName, url){\n\n // fallback to first queue\n if (!queues[queueName]) {\n if (queueName) console.error('onknown queue ', queueName)\n queueName = queuesByPriority[0]\n }\n\n // create promise and add to queue\n return new Promise(function(resolve, reject){\n // has to be asynchronous in order to decouple queue processing from synchronous code\n setTimeout(function(){\n var queue = queues[queueName]\n queue[ queue.length ] = { url: url, start: resolve }\n processQueue()\n },1)\n })\n\n}\n\nfunction dequeue(queueName, url) {\n var info = queueInfo[queueName];\n if (!info) {\n if (queueName) console.warn('Queue info not found for queue name \"'+queueName+'\"')\n return\n }\n info.timeLastFinished = performance.now() / 1000;\n concurrentPerQueue[queueName] -= 1\n concurrentRequests -= 1\n queuesChanged = true;\n processQueue()\n}\n\n// expose API\n\nvar queueManager = {\n enqueue: enqueue,\n dequeue: dequeue,\n info: queueInfo\n}\n\nexport default queueManager","import Promise from 'bluebird'\nimport fetchDdsTexture from './fetch-texture/fetch-dds-texture.js'\nimport fetchImageTexture from './fetch-texture/fetch-image-texture.js'\nimport queueManager from '../../../../utils/io/common/queue-manager.js'\nimport PromiseCache from '../../../../utils/promise-cache.js'\n\nvar cache = new PromiseCache()\n\nvar fetchTextureByType = {\n '.dds': fetchDdsTexture,\n '.jpg': fetchImageTexture,\n '.jpeg': fetchImageTexture,\n '.jpe': fetchImageTexture,\n '.png': fetchImageTexture,\n '.gif': fetchImageTexture,\n '.svg': fetchImageTexture\n}\n\nexport default function fetchTexture (url, queueName) {\n \n // internals\n var cacheKey = url\n\n // try cache\n var promiseFromCache = cache.get(cacheKey)\n if (promiseFromCache) return promiseFromCache\n\n // get file extension\n var extSearch = url.match(/\\.[A-Za-z]+(?=\\?|$)/i)\n var type = extSearch ? extSearch[0].toLowerCase() : '.jpg'\n\n if (!fetchTextureByType[type]) {\n // unknown texture type. fallback to JPG\n console.warn('Unknown texture type ' + type + '. Trying to load as JPG.')\n type = '.jpg'\n }\n\n var promise = queueManager.enqueue(queueName, url).then(function(){\n\n return fetchTextureByType[type](url)\n\n }).then(function(texture){\n\n queueManager.dequeue(queueName, url)\n return texture\n\n }).catch(function (error) {\n\n queueManager.dequeue(queueName, url)\n return Promise.reject(error)\n\n })\n\n // add to cache\n cache.add(cacheKey, promise)\n\n return promise\n\n}","/*\n\n PERFORMANCE CRITICAL CODE\n\n readability may suffer from performance optimization\n ask tomas-polach if you have questions\n\n*/\n\nimport fetchTexture from './fetch-texture.js'\nimport Promise from 'bluebird'\n\n// static method, @memberof View\n\n// constants\n\nvar THREEJS_TEXTURE_TYPES_MAP = {\n // hi-res textures\n 'mapDiffuse': 'map',\n 'mapSpecular': 'specularMap',\n 'mapNormal':'normalMap',\n 'mapAlpha':'alphaMap',\n 'mapLight':'lightMap',\n // lo-res textures\n 'mapDiffusePreview': 'map',\n 'mapSpecularPreview': 'specularMap',\n 'mapNormalPreview':'normalMap',\n 'mapAlphaPreview':'alphaMap',\n 'mapLightPreview':'lightMap'\n}\nvar WEBGL_WRAP_TYPES = {\n repeat: 1000,\n mirror: 1002,\n clamp: 1001\n}\n// RepeatWrapping: 1000 / ClampToEdgeWrapping: 1001 / MirroredRepeatWrapping: 1002\n\n// helpers\n\nfunction onError (e) {\n console.error('Texture could not been loaded: ', e)\n}\n\nvar textureRefCount = {}\n\nfunction countTextureReference ( key ) {\n if ( key !== undefined ) {\n if (textureRefCount[ key ]) {\n textureRefCount[ key ]++\n } else {\n textureRefCount[ key ] = 1\n }\n }\n}\n\nfunction disposeIfPossible () {\n var texture3d = this\n var key = this.url\n if (key) {\n if (textureRefCount[ key ]) {\n textureRefCount[ key ]--\n if (textureRefCount[ key ] === 0) {\n// console.log('dispose texture', texture3d.url)\n texture3d.dispose()\n// texture3d.needsUpdate = true\n }\n } else {\n// console.warn('texture not in cache ' + key)\n texture3d.dispose()\n }\n } else {\n texture3d.dispose()\n// texture3d.needsUpdate = true\n }\n}\n\n// class\n\nexport default function loadTextureSet ( queueName, TEXTURE_TYPES, vm, _attributes, material3d, mesh3d, resetTexturesOnLoadStart) {\n \n // new textures\n\n var\n texture3dKeys = [],\n textureKeys = [],\n texturePromises = [],\n textureCount = 0,\n textureS3Key,\n texture3d,\n textureType3d,\n textureType,\n needsUpdate,\n hasUv1Textures = false,\n geometry3d = mesh3d ? mesh3d.geometry : null,\n attributes3d = geometry3d ? geometry3d.attributes : null,\n hasUvVertices = attributes3d && attributes3d.uv && attributes3d.uv.count > 0,\n hasUv2Vertices = attributes3d && attributes3d.uv2 && attributes3d.uv2.count > 0,\n i,\n l\n\n // UV1 textures\n\n for (i = 0, l = TEXTURE_TYPES.UV1.length; i < l; i++) {\n textureType = TEXTURE_TYPES.UV1[ i ]\n textureS3Key = _attributes[ textureType ]\n textureType3d = THREEJS_TEXTURE_TYPES_MAP[ textureType ]\n texture3d = material3d[ textureType3d ]\n\n if (textureS3Key) {\n if (hasUvVertices) {\n hasUv1Textures = true\n } else {\n console.error('Texture ' + textureS3Key + ' could not be assigned because geometry has no UV vertices.')\n continue\n }\n }\n\n if (textureS3Key) {\n\n needsUpdate = true\n\n // update wrap\n wrap = WEBGL_WRAP_TYPES[ _attributes.wrap ] || WEBGL_WRAP_TYPES[ 'repeat' ]\n if (texture3d && wrap !== texture3d.wrapS) {\n texture3d.wrapS = wrap\n texture3d.wrapT = wrap\n texture3d.needsUpdate = true\n }\n\n // don't reload texture if files are of same origin\n if (\n texture3d\n && texture3d.url\n && textureS3Key === texture3d.url\n ) {\n needsUpdate = false\n }\n\n if (needsUpdate && texture3d && resetTexturesOnLoadStart) {\n // dispose old texture\n if (material3d[ textureType3d ] && material3d[ textureType3d ].disposeIfPossible) {\n material3d[ textureType3d ].disposeIfPossible()\n }\n material3d[ textureType3d ] = null\n }\n\n if (needsUpdate) {\n // load new texture\n texturePromises[ textureCount ] = fetchTexture(textureS3Key, queueName).catch(onError)\n textureKeys[ textureCount ] = textureType\n texture3dKeys[ textureCount ] = textureType3d\n textureCount++\n material3d.needsUpdate = true\n }\n\n } else if (material3d[ textureType3d ]) {\n\n // no new texture: just dispose old texture\n if (material3d[ textureType3d ] && material3d[ textureType3d ].disposeIfPossible) {\n material3d[ textureType3d ].disposeIfPossible()\n }\n material3d[ textureType3d ] = null\n material3d.needsUpdate = true\n\n }\n\n }\n\n // UV1 vectors\n\n if (attributes3d) {\n\n // UV channel 1\n\n if (hasUv1Textures) {\n\n // resize UV array\n\n if (_attributes.size) {\n\n var\n targetScaleU = _attributes.size[ 0 ],\n targetScaleV = _attributes.size[ 1 ],\n currentScaleU = attributes3d.uv._scaleU || 1,\n currentScaleV = attributes3d.uv._scaleV || 1\n // check if uv recalculation is needed\n if (targetScaleU !== currentScaleU || targetScaleV !== currentScaleV) {\n // remember original uv array\n if (!attributes3d.uv._source) {\n attributes3d.uv._source = attributes3d.uv.array\n }\n // internals\n var\n sourceUVs = attributes3d.uv._source,\n resizedUVs = new Float32Array(sourceUVs.length)\n // resize array\n for (var i = 0, l = resizedUVs.length; i < l; i += 2) {\n resizedUVs[ i ] = sourceUVs[ i ] / targetScaleU\n resizedUVs[ i + 1 ] = sourceUVs[ i + 1 ] / targetScaleV\n }\n // set resized array\n attributes3d.uv.array = resizedUVs\n // remember size\n attributes3d.uv._scaleU = targetScaleU\n attributes3d.uv._scaleV = targetScaleV\n // set update flag\n attributes3d.uv.needsUpdate = true\n }\n\n }\n\n }\n\n // UV channel 2\n\n if (_attributes[ TEXTURE_TYPES.UV2 ]) {\n\n // check uv count\n if (hasUv2Vertices) {\n\n // everything ok - load lightmap\n textureType = TEXTURE_TYPES.UV2\n textureS3Key = _attributes[ textureType ]\n texturePromises[ textureCount ] = fetchTexture(textureS3Key, queueName).catch(onError)\n textureKeys[ textureCount ] = textureType\n texture3dKeys[ textureCount ] = THREEJS_TEXTURE_TYPES_MAP[ textureType ]\n textureCount++\n\n } else {\n\n console.error('Lightmap ' + _attributes[ TEXTURE_TYPES.UV2 ] + ' could not be assigned because geometry has no lightmap UV (UV2) vertices.')\n\n }\n\n }\n\n }\n\n // load textures\n\n var promise, wrap, isTexture, isTextureToBeLoadedNext\n if (textureCount) {\n\n promise = Promise.all(texturePromises).then(function (textures) {\n\n // assign textures\n wrap = WEBGL_WRAP_TYPES[ _attributes.wrap ] || WEBGL_WRAP_TYPES[ 'repeat' ]\n for (i = 0; i < textureCount; i++) {\n\n // filter texture loading errors\n isTexture = textures[i] instanceof THREE.CompressedTexture || textures[i] instanceof THREE.Texture\n // avoid racing conditions\n isTextureToBeLoadedNext = textures[i] && textures[i].url === material3d._texturesToBeLoaded[textureKeys[i]]\n\n if (!isTexture || !isTextureToBeLoadedNext) continue\n\n // cache\n countTextureReference(textures[ i ].url)\n textures[ i ].disposeIfPossible = disposeIfPossible\n\n // set texture settings\n textures[ i ].wrapS = wrap\n textures[ i ].wrapT = wrap\n textures[ i ].anisotropy = 2\n // dispose previous texture\n if (material3d[ texture3dKeys[ i ] ] && material3d[ texture3dKeys[ i ] ].disposeIfPossible) {\n material3d[ texture3dKeys[ i ] ].disposeIfPossible()\n }\n // add new texture\n material3d[ texture3dKeys[ i ] ] = textures[ i ]\n material3d.uniforms[ texture3dKeys[ i ] ].value = textures[ i ]\n material3d[ texture3dKeys[ i ] ].needsUpdate = true\n\n }\n // update material\n material3d.needsUpdate = true\n\n // to prevent warnings: \"GL ERROR :GL_INVALID_OPERATION : glDrawElements: attempt to access out of range vertices in attribute 1 \"\n // this happens when switching from a material without texture to a material with texture or vice versa\n if ( mesh3d && mesh3d.geometry ) {\n mesh3d.geometry.buffersNeedUpdate = true\n mesh3d.geometry.uvsNeedUpdate = true\n }\n\n // render\n if (vm) vm.viewport.render()\n\n })\n\n } else {\n\n promise = Promise.resolve()\n\n // render\n if (vm) vm.viewport.render()\n\n }\n\n return promise\n\n}\n","/*\n\n PERFORMANCE CRITICAL CODE\n\n readability may suffer from performance optimization\n ask tomas-polach if you have questions\n\n*/\n\nimport loadTextureSet from './set-material/load-texture-set.js'\nimport runtime from '../../../core/runtime.js'\n\n// static method, @memberof View\n\n// constants\n\nvar HI_RES_TEXTURE_TYPES = {\n UV1: [ 'mapDiffuse', 'mapSpecular', 'mapNormal', 'mapAlpha' ],\n UV2: 'mapLight'\n}\nvar LO_RES_TEXTURE_TYPES = {\n UV1: [ 'mapDiffusePreview', 'mapSpecularPreview', 'mapNormalPreview', 'mapAlphaPreview' ],\n UV2: 'mapLightPreview'\n}\n\nvar DEFAULT_LIGHT_MAP_INTENSITY = 1.2\nvar DEFAULT_LIGHT_MAP_EXPOSURE = 0.6\nvar DEFAULT_LIGHT_MAP_FALLOFF = 0\n\n// RepeatWrapping: 1000 / ClampToEdgeWrapping: 1001 / MirroredRepeatWrapping: 1002\n\n// function\n\nexport default function setMaterial (args) {\n\n // Args\n var vm = args.vm\n var material3d = args.material3d\n var mesh3d = args.mesh3d\n var _attributes = args.attributes || {}\n var reset = args.reset !== undefined ? args.reset : true\n var loadingQueuePrefix = args.loadingQueuePrefix\n var onFirstTextureSetLoaded = args.onFirstTextureSetLoaded\n var lightMapIntensity = args.lightMapIntensity\n var lightMapExposure = args.lightMapExposure\n\n\n material3d.userData = material3d.userData || {}\n material3d.userData.data3dMaterial = args.attributes\n\n // opacity\n\n // depth buffer\n // if (material3d.opacity < 1) {\n // material3d.depthWrite = false\n // var alphaTest = material3d.opacity - 0.001\n // if (alphaTest < 0) alphaTest = 0\n // material3d.alphaTest = alphaTest\n // }\n\n if (_attributes.opacity !== undefined && _attributes.opacity < 1) {\n // 0 = fully transparent, 1 = non-transparent\n material3d.transparent = true\n material3d.opacity = _attributes.opacity\n } else if (_attributes.mapAlpha) {\n // has alpha map\n material3d.transparent = true\n material3d.opacity = 1\n } else {\n material3d.transparent = false\n material3d.opacity = 1\n }\n material3d.uniforms.opacity = { value: material3d.opacity }\n\n // normal map factor\n\n if (_attributes.mapNormalFactor !== undefined) {\n material3d.normalScale = new THREE.Vector2( _attributes.mapNormalFactor, _attributes.mapNormalFactor )\n } else {\n material3d.normalScale = new THREE.Vector2( 0.8, 0.8 )\n }\n material3d.uniforms.normalScale.value = material3d.normalScale\n\n // specular coefficient\n\n material3d.shininess = (_attributes.specularCoef !== undefined) ? (_attributes.specularCoef ) : 0.1\n material3d.uniforms.shininess.value = material3d.shininess\n\n // colors\n var diffuse = {}\n if (_attributes.colorDiffuse) {\n diffuse.r = _attributes.colorDiffuse[ 0 ]\n diffuse.g = _attributes.colorDiffuse[ 1 ]\n diffuse.b = _attributes.colorDiffuse[ 2 ]\n } else if (reset) {\n if (_attributes.mapDiffuse ) {\n // has diffuse texture\n diffuse.r = 1\n diffuse.g = 1\n diffuse.b = 1\n } else {\n // has NO diffuse texture\n diffuse.r = 0.85\n diffuse.g = 0.85\n diffuse.b = 0.85\n }\n }\n material3d.color = diffuse\n material3d.uniforms.color.value = new THREE.Color(diffuse.r, diffuse.g, diffuse.b)\n\n // We are not using color ambient\n /*if (_attributes.colorAmbient) {\n // material3d.ambient.r = _attributes.colorAmbient[ 0 ]\n // material3d.ambient.g = _attributes.colorAmbient[ 1 ]\n // material3d.ambient.b = _attributes.colorAmbient[ 2 ]\n } else if (reset) {\n // if (!material3d.ambient) {\n // material3d.ambient = new THREE.Color()\n // }\n // material3d.ambient.r = material3d.color.r\n // material3d.ambient.g = material3d.color.g\n // material3d.ambient.b = material3d.color.b\n }*/\n\n var specular = {}\n if (_attributes.colorSpecular) {\n specular.r = _attributes.colorSpecular[ 0 ]\n specular.g = _attributes.colorSpecular[ 1 ]\n specular.b = _attributes.colorSpecular[ 2 ]\n } else if (reset) {\n specular.r = 0.25\n specular.g = 0.25\n specular.b = 0.25\n }\n material3d.specular = specular\n material3d.uniforms.specular.value = new THREE.Color(specular.r, specular.g, specular.b)\n\n var emissive = {}\n if (_attributes.colorEmissive) {\n emissive.r = _attributes.colorEmissive[ 0 ]\n emissive.g = _attributes.colorEmissive[ 1 ]\n emissive.b = _attributes.colorEmissive[ 2 ]\n } else if (_attributes.lightEmissionCoef) {\n var emissiveIntensity = _attributes.lightEmissionCoef / 10\n if (_attributes.colorDiffuse) {\n emissive.r = _attributes.colorDiffuse[ 0 ]\n emissive.g = _attributes.colorDiffuse[ 1 ]\n emissive.b = _attributes.colorDiffuse[ 2 ]\n } else {\n emissive.r = 1.0\n emissive.g = 1.0\n emissive.b = 1.0\n }\n emissive.r *= emissiveIntensity\n emissive.g *= emissiveIntensity\n emissive.b *= emissiveIntensity\n\n } else if (reset) {\n emissive.r = 0\n emissive.g = 0\n emissive.b = 0\n }\n material3d.emissive = emissive\n material3d.uniforms.emissive.value = new THREE.Color(emissive.r, emissive.g, emissive.b)\n\n // lightmap settings\n if (_attributes.mapLight || _attributes.mapLightPreview) {\n // Fallback lightmap intensity and exposure values\n var lmi = DEFAULT_LIGHT_MAP_INTENSITY\n var lme = DEFAULT_LIGHT_MAP_EXPOSURE\n\n if (lightMapIntensity !== undefined && lightMapIntensity != null && lightMapIntensity !== -100) {\n lmi = lightMapIntensity\n } else if (_attributes.mapLightIntensity !== undefined) {\n lmi = _attributes.mapLightIntensity\n }\n\n if (lightMapExposure !== undefined && lightMapExposure != null && lightMapExposure !== -100) {\n lme = lightMapExposure\n } else if (_attributes.mapLightCenter !== undefined) {\n // in data3d lightMapExposure is mapLightCenter\n lme = _attributes.mapLightCenter\n }\n\n material3d.lightMapIntensity = (lmi >= 0.0) ? lmi : 0.0\n material3d.lightMapExposure = lme\n material3d.lightMapFalloff = (_attributes.mapLightFalloff !== undefined) ? _attributes.mapLightFalloff : DEFAULT_LIGHT_MAP_FALLOFF\n material3d.uniforms.lightMapIntensity.value = material3d.lightMapIntensity\n material3d.uniforms.lightMapExposure.value = material3d.lightMapExposure\n material3d.uniforms.lightMapFalloff.value = material3d.lightMapFalloff\n }\n\n // shadows\n\n if (mesh3d) {\n mesh3d.castShadow = _attributes.castRealTimeShadows;\n mesh3d.receiveShadow = _attributes.receiveRealTimeShadows;\n mesh3d.material.needsUpdate = true // without this, receiveShadow does not become effective\n }\n\n // load textures\n\n // remember current textures (avoiding racing conditions between texture loading and material updates)\n material3d._texturesToBeLoaded = {\n // hires textures\n mapDiffuse: _attributes.mapDiffuse,\n mapSpecular: _attributes.mapSpecular,\n mapNormal: _attributes.mapNormal,\n mapAlpha: _attributes.mapAlpha,\n mapLight: _attributes.mapLight,\n // lores textures\n mapDiffusePreview: _attributes.mapDiffusePreview,\n mapSpecularPreview: _attributes.mapSpecularPreview,\n mapNormalPreview: _attributes.mapNormalPreview,\n mapAlphaPreview: _attributes.mapAlphaPreview,\n mapLightPreview: _attributes.mapLightPreview\n }\n\n var\n loadingTexturesPromise,\n loadingQueueName,\n isLoadingLoResTextures,\n hasLoResTextures = _attributes.mapDiffusePreview || _attributes.mapSpecularPreview || _attributes.mapNormalPreview || _attributes.mapAlphaPreview || _attributes.mapLightPreview,\n // hasHiResTextures = _attributes.mapDiffuse || _attributes.mapSpecular || _attributes.mapNormal || _attributes.mapAlpha || _attributes.mapLight,\n // TODO: readd hiResTextures configs\n // hiResTexturesEnabled = !configs.isMobile && vm.viewport.a.hiResTextures && configs.compatibility.webglCompressedTextures\n hiResTexturesEnabled = !runtime.isMobile && runtime.webGl.supportsDds\n\n if (!hiResTexturesEnabled || (hasLoResTextures && !material3d.firstTextureLoaded)) {\n if (loadingQueuePrefix) {\n loadingQueueName = loadingQueuePrefix + 'TexturesLoRes'\n }\n loadingTexturesPromise = loadTextureSet(loadingQueueName, LO_RES_TEXTURE_TYPES, vm, _attributes, material3d, mesh3d, false)\n isLoadingLoResTextures = true\n } else {\n if (loadingQueuePrefix) {\n loadingQueueName = loadingQueuePrefix + 'TexturesHiRes'\n }\n loadingTexturesPromise = loadTextureSet(loadingQueueName, HI_RES_TEXTURE_TYPES, vm, _attributes, material3d, mesh3d, false)\n isLoadingLoResTextures = false\n }\n\n loadingTexturesPromise.then(function(){\n\n // trigger callback\n if (onFirstTextureSetLoaded) onFirstTextureSetLoaded()\n\n // set onFirstTextureLoaded\n if (hasLoResTextures) material3d.firstTextureLoaded = true\n\n })\n\n // 2. load hi-res textures (if: material has preview texture set, not on mobile, hi-res enabled and supported)\n if (isLoadingLoResTextures && hiResTexturesEnabled) {\n loadingTexturesPromise.then(function(){\n if (loadingQueuePrefix) {\n loadingQueueName = loadingQueuePrefix + 'TexturesHiRes'\n }\n loadTextureSet(loadingQueueName, HI_RES_TEXTURE_TYPES, vm, _attributes, material3d, mesh3d, false)\n })\n }\n\n // return texture loading promise\n\n return loadingTexturesPromise\n}\n","import checkDependencies from '../../check-dependencies.js'\nimport fragmentShader from './io3d-material/fragment.glsl'\nimport vertexShader from './io3d-material/vertex.glsl'\n\nexport default checkDependencies ({\n three: true,\n aframe: false\n}, function makeIo3dMaterial () {\n\n // CONFIGS\n\n var DEFAULT_LIGHT_MAP_INTENSITY = 1.2\n var DEFAULT_LIGHT_MAP_EXPOSURE = 0.6\n var DEFAULT_LIGHT_MAP_FALLOFF = 0\n var DEFAULT_NORMAL_MAP_FACTOR = new THREE.Vector2(0.8, 0.8)\n\n // main\n\n function Io3dMaterial( params ) {\n THREE.ShaderMaterial.call( this, params )\n\n var params = params || {}\n this.lightMapExposure = params.lightMapExposure || DEFAULT_LIGHT_MAP_EXPOSURE\n this.lightMapFalloff = params.lightMapFalloff || DEFAULT_LIGHT_MAP_FALLOFF\n\n this.uniforms = THREE.UniformsUtils.merge( [\n THREE.UniformsLib[ \"lights\" ],\n THREE.UniformsLib[ \"shadowmap\" ],\n { color: { value: params.color || new THREE.Color(1.0, 1.0, 1.0) },\n map: { value: params.map || null },\n specularMap: { value: params.specularMap || null },\n alphaMap: { value: params.alphaMap || null },\n lightMap: { value: params.lightMap || null },\n lightMapIntensity: { value: params.lightMapIntensity || DEFAULT_LIGHT_MAP_INTENSITY },\n lightMapFalloff: { value: params.lightMapFalloff || DEFAULT_LIGHT_MAP_FALLOFF },\n lightMapExposure: { value: params.lightMapExposure || DEFAULT_LIGHT_MAP_EXPOSURE },\n normalMap: { value: params.normalMap || null },\n normalScale: { value: params.normalScale || DEFAULT_NORMAL_MAP_FACTOR },\n shininess: { value: params.shininess || 1.0 },\n specular: { value: params.specular || new THREE.Color(0.25, 0.25, 0.25) },\n emissive: { value: params.emissive || new THREE.Color(0.0, 0.0, 0.0) },\n opacity: { value: params.opacity || 1 },\n offsetRepeat: { value: params.offsetRepeat || new THREE.Vector4( 0, 0, 1, 1) }\n }\n ])\n\n this.vertexShader = vertexShader.text\n this.fragmentShader = fragmentShader.text\n this.lights = true\n }\n\n Io3dMaterial.prototype = Object.create(THREE.ShaderMaterial.prototype)\n Io3dMaterial.prototype.constructor = Io3dMaterial\n\n return Io3dMaterial\n\n})","// TODO: increase performance\n// TODO: decouple from THREEjs\n// TODO: make use of edge case threshold=0 (no need to compare face normals)\n\nexport default function generateWireframeBuffer( positions, thresholdAngle ) {\n\t\n// console.time('calc')\n\n\t// internals\n\tvar thresholdDot = Math.cos( thresholdAngle * Math.PI / 180 )\n\tvar edge = [ 0, 0 ]\n\tvar hash = {}\n\tvar keys = [ 'a', 'b', 'c' ]\n\n\tvar tempGeometry = new THREE.Geometry()\n\tfor (var i = 0, j = 0; i < positions.length / 3; i += 3, j += 9) {\n\t\ttempGeometry.vertices[ tempGeometry.vertices.length ] = new THREE.Vector3( positions[ j ], positions[ j + 1 ], positions[ j + 2 ] )\n\t\ttempGeometry.vertices[ tempGeometry.vertices.length ] = new THREE.Vector3( positions[ j + 3 ], positions[ j + 4 ], positions[ j + 5 ] )\n\t\ttempGeometry.vertices[ tempGeometry.vertices.length ] = new THREE.Vector3( positions[ j + 6 ], positions[ j + 7 ], positions[ j + 8 ] )\n\t\ttempGeometry.faces[ tempGeometry.faces.length ] = new THREE.Face3( i, i + 1, i + 2, [], [] )\n\t}\n\ttempGeometry.mergeVertices()\n\ttempGeometry.computeFaceNormals()\n\n\tvar vertices = tempGeometry.vertices\n\tvar faces = tempGeometry.faces\n\tvar numEdges = 0\n\n\tfor ( var i = 0, l = faces.length; i < l; i ++ ) {\n\t\tvar face = faces[ i ];\n\t\tfor ( var j = 0; j < 3; j ++ ) {\n\n\t\t\tedge[ 0 ] = face[ keys[ j ] ];\n\t\t\tedge[ 1 ] = face[ keys[ ( j + 1 ) % 3 ] ];\n\t\t\tedge.sort( sortFunction );\n\n\t\t\tvar key = edge.toString();\n\n\t\t\tif ( hash[ key ] === undefined ) {\n\t\t\t\thash[ key ] = { vert1: edge[ 0 ], vert2: edge[ 1 ], face1: i, face2: undefined };\n\t\t\t\tnumEdges ++;\n\t\t\t} else {\n\t\t\t\thash[ key ].face2 = i;\n\t\t\t}\n\t\t}\n\t}\n\n\tvar coords = new Float32Array( numEdges * 2 * 3 )\n\tvar index = 0\n\n\tfor ( var key in hash ) {\n\t\tvar h = hash[ key ];\n\t\tif ( h.face2 === undefined || faces[ h.face1 ].normal.dot( faces[ h.face2 ].normal ) <= thresholdDot ) {\n\n\t\t\tvar vertex = vertices[ h.vert1 ];\n\t\t\tcoords[ index ++ ] = vertex.x;\n\t\t\tcoords[ index ++ ] = vertex.y;\n\t\t\tcoords[ index ++ ] = vertex.z;\n\n\t\t\tvertex = vertices[ h.vert2 ];\n\t\t\tcoords[ index ++ ] = vertex.x;\n\t\t\tcoords[ index ++ ] = vertex.y;\n\t\t\tcoords[ index ++ ] = vertex.z;\n\n\t\t}\n\t}\n\n// console.timeEnd('calc')\n\n\treturn coords\n\n}\n\n// helpers\n\nfunction sortFunction ( a, b ) { return a - b }","export default function compareArrays(a, b, precision) {\n\n\tif (a === b) {\n\t\treturn true\n\t} else if (a.length !== b.length) {\n\t\treturn false\n\t} else {\n\t\tprecision = precision === undefined ? 1 : precision\n\t\tvar step = ~~(a.length / (a.length * precision))\n\t\tfor (var i = 0, l = a.length; i 0\n },\n\n setMeshes: function(meshes){\n this.set({\n meshes: meshes\n })\n },\n\n setMaterials: function(materials, options){\n this.set({\n materials: materials\n }, options)\n },\n\n reset: function(){\n\n this.set({\n meshes: {},\n materials: {}\n })\n\n },\n\n destroy: function(){\n\n this.isDestroyed = true\n\n this.reset()\n\n this.threeParent = null\n\n // internals\n this.meshKeys = null\n this.meshes = null\n this.materialKeys = null\n this.materials = null\n this._meshes3d = null\n this._materials3d = null\n\n }\n\n }\n\n// helpers\n\n function createOrReuseGeometry3d( key ) {\n if (key) {\n // use cache\n if (geometry3dCache[ key ]) {\n geometry3dCache[ key ].refCount++\n } else {\n geometry3dCache[ key ] = {\n geometry3d: new THREE.BufferGeometry(),\n refCount: 1\n }\n }\n return geometry3dCache[ key ].geometry3d\n } else {\n // no key no cache\n return new THREE.BufferGeometry()\n }\n }\n\n function disposeGeometry3dIfNotUsedElsewhere( key, geometry3d ) {\n if (key) {\n // involve cache\n if (geometry3dCache[ key ]) {\n geometry3dCache[ key ].refCount--\n if (geometry3dCache[ key ].refCount < 1) {\n geometry3dCache[ key ].geometry3d.dispose()\n delete geometry3dCache[ key ]\n }\n } else {\n // (2017/01/09) See comment in ThreeView.set()\n // if (geometry3d.attributes.pickingColor)\n // delete geometry3d.attributes['pickingColor'];\n geometry3d.dispose()\n }\n } else {\n // no key bo cache\n // (2017/01/09) See comment in ThreeView.set()\n // if (geometry3d.attributes.pickingColor)\n // delete geometry3d.attributes['pickingColor'];\n geometry3d.dispose()\n }\n }\n\n return Data3dView\n\n})","import runtime from './core/runtime.js'\nimport checkDependencies from './aframe/check-dependencies.js'\n// components\nimport data3dComponent from './aframe/component/data3d.js'\nimport furnitureComponent from './aframe/component/furniture.js'\nimport tourComponent from './aframe/component/tour.js'\nimport gBlockComponent from './aframe/component/gblock.js'\nimport lightingComponent from './aframe/component/lighting.js'\nimport minimapComponent from './aframe/component/minimap.js'\n// architectural tookit\nimport closetComponent from './aframe/component/architecture-toolkit/closet.js'\nimport columnComponent from './aframe/component/architecture-toolkit/column.js'\nimport doorComponent from './aframe/component/architecture-toolkit/door.js'\nimport floorComponent from './aframe/component/architecture-toolkit/floor.js'\nimport kitchenComponent from './aframe/component/architecture-toolkit/kitchen.js'\nimport polyFloorComponent from './aframe/component/architecture-toolkit/polyfloor.js'\nimport railingComponent from './aframe/component/architecture-toolkit/railing.js'\nimport stairsComponent from './aframe/component/architecture-toolkit/stairs.js'\nimport wallComponent from './aframe/component/architecture-toolkit/wall.js'\nimport windowComponent from './aframe/component/architecture-toolkit/window.js'\n// other\nimport inspectorPluginsLauncher from './aframe/inspector-plugins-launcher.js'\nimport Data3dView from './aframe/three/data3d-view.js'\n\n// dependency check (for node.js compatibility)\n\ncheckDependencies({\n three: false,\n aframe: true,\n onError: function (){\n // show aframe dependency warning, since it is unexpected to run aframe on server\n if (runtime.isBrowser) console.warn('AFRAME library not found: related features will be disabled.')\n }\n}, function registerComponents () {\n\n // register components\n AFRAME.registerComponent('io3d-data3d', data3dComponent)\n AFRAME.registerComponent('io3d-furniture', furnitureComponent)\n AFRAME.registerComponent('tour', tourComponent)\n AFRAME.registerComponent('io3d-lighting', lightingComponent)\n AFRAME.registerComponent('io3d-minimap', minimapComponent)\n // architectural tookit\n AFRAME.registerComponent('io3d-closet', closetComponent)\n AFRAME.registerComponent('io3d-column', columnComponent)\n AFRAME.registerComponent('io3d-door', doorComponent)\n AFRAME.registerComponent('io3d-floor', floorComponent)\n AFRAME.registerComponent('io3d-kitchen', kitchenComponent)\n AFRAME.registerComponent('io3d-polyfloor', polyFloorComponent)\n AFRAME.registerComponent('io3d-railing', railingComponent)\n AFRAME.registerComponent('io3d-stairs', stairsComponent)\n AFRAME.registerComponent('io3d-wall', wallComponent)\n AFRAME.registerComponent('io3d-window', windowComponent)\n // check if gblock component has already been registered\n if (AFRAME.components.gblock) {\n // legacy warning in case gblock has been registered using https://github.com/archilogic-com/aframe-gblock/\n console.error('3dio.js error: Please remove any other \"