From ad3e1859f61addf923daaebb8d401d20ccf97c44 Mon Sep 17 00:00:00 2001 From: Mark 'kaosat-dev' Moissette Date: Fri, 26 Aug 2016 13:33:29 +0200 Subject: [PATCH 1/3] fix(touchDrags): added throtling (as a test) to reduce too sensitive ios interactions --- src/interactions/pointers.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/interactions/pointers.js b/src/interactions/pointers.js index 777587a..45d3056 100644 --- a/src/interactions/pointers.js +++ b/src/interactions/pointers.js @@ -349,7 +349,7 @@ export function pointerInteractions (baseInteractions) { // drag move interactions (continuously firing) const dragMoves$ = merge( drags3(mouseDowns$, mouseUps$, mouseMoves$, longPressDelay, deltaSqr), - touchDrags(touchStart$, touchEnd$, touchMoves$) + touchDrags(touchStart$, touchEnd$, touchMoves$).throttle(60).tap(e=>console.log('foo')) ) .takeUntil(longTaps$).repeat() // no drag moves if there is a context action already taking place From c36e6205df6b34363403e4f60fe0f26c9b008380 Mon Sep 17 00:00:00 2001 From: Mark 'kaosat-dev' Moissette Date: Fri, 26 Aug 2016 13:42:46 +0200 Subject: [PATCH 2/3] chore(build): added build with interaction changes, for easier testing --- dist/jam.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dist/jam.js b/dist/jam.js index 0fedc26..a3e3491 100644 --- a/dist/jam.js +++ b/dist/jam.js @@ -9,7 +9,7 @@ },function(module,exports,__webpack_require__){eval("var Processor = __webpack_require__(57).Processor;\nvar Pipe = __webpack_require__(43).Pipe;\nvar DiffContext = __webpack_require__(26).DiffContext;\nvar PatchContext = __webpack_require__(27).PatchContext;\nvar ReverseContext = __webpack_require__(28).ReverseContext;\n\nvar trivial = __webpack_require__(56);\nvar nested = __webpack_require__(54);\nvar arrays = __webpack_require__(51);\nvar dates = __webpack_require__(52);\nvar texts = __webpack_require__(55);\n\nvar DiffPatcher = function DiffPatcher(options) {\n this.processor = new Processor(options);\n this.processor.pipe(new Pipe('diff').append(\n nested.collectChildrenDiffFilter,\n trivial.diffFilter,\n dates.diffFilter,\n texts.diffFilter,\n nested.objectsDiffFilter,\n arrays.diffFilter\n ).shouldHaveResult());\n this.processor.pipe(new Pipe('patch').append(\n nested.collectChildrenPatchFilter,\n arrays.collectChildrenPatchFilter,\n trivial.patchFilter,\n texts.patchFilter,\n nested.patchFilter,\n arrays.patchFilter\n ).shouldHaveResult());\n this.processor.pipe(new Pipe('reverse').append(\n nested.collectChildrenReverseFilter,\n arrays.collectChildrenReverseFilter,\n trivial.reverseFilter,\n texts.reverseFilter,\n nested.reverseFilter,\n arrays.reverseFilter\n ).shouldHaveResult());\n};\n\nDiffPatcher.prototype.options = function() {\n return this.processor.options.apply(this.processor, arguments);\n};\n\nDiffPatcher.prototype.diff = function(left, right) {\n return this.processor.process(new DiffContext(left, right));\n};\n\nDiffPatcher.prototype.patch = function(left, delta) {\n return this.processor.process(new PatchContext(left, delta));\n};\n\nDiffPatcher.prototype.reverse = function(delta) {\n return this.processor.process(new ReverseContext(delta));\n};\n\nDiffPatcher.prototype.unpatch = function(right, delta) {\n return this.patch(right, this.reverse(delta));\n};\n\nexports.DiffPatcher = DiffPatcher;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/jsondiffpatch/src/diffpatcher.js\n ** module id = 50\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/jsondiffpatch/src/diffpatcher.js?")},function(module,exports,__webpack_require__){eval("var DiffContext = __webpack_require__(26).DiffContext;\nvar PatchContext = __webpack_require__(27).PatchContext;\nvar ReverseContext = __webpack_require__(28).ReverseContext;\n\nvar lcs = __webpack_require__(53);\n\nvar ARRAY_MOVE = 3;\n\nvar isArray = (typeof Array.isArray === 'function') ?\n // use native function\n Array.isArray :\n // use instanceof operator\n function(a) {\n return a instanceof Array;\n };\n\nvar arrayIndexOf = typeof Array.prototype.indexOf === 'function' ?\n function(array, item) {\n return array.indexOf(item);\n } : function(array, item) {\n var length = array.length;\n for (var i = 0; i < length; i++) {\n if (array[i] === item) {\n return i;\n }\n }\n return -1;\n };\n\nfunction arraysHaveMatchByRef(array1, array2, len1, len2) {\n for (var index1 = 0; index1 < len1; index1++) {\n var val1 = array1[index1];\n for (var index2 = 0; index2 < len2; index2++) {\n var val2 = array2[index2];\n if (val1 === val2) {\n return true;\n }\n }\n }\n}\n\nfunction matchItems(array1, array2, index1, index2, context) {\n var value1 = array1[index1];\n var value2 = array2[index2];\n if (value1 === value2) {\n return true;\n }\n if (typeof value1 !== 'object' || typeof value2 !== 'object') {\n return false;\n }\n var objectHash = context.objectHash;\n if (!objectHash) {\n // no way to match objects was provided, try match by position\n return context.matchByPosition && index1 === index2;\n }\n var hash1;\n var hash2;\n if (typeof index1 === 'number') {\n context.hashCache1 = context.hashCache1 || [];\n hash1 = context.hashCache1[index1];\n if (typeof hash1 === 'undefined') {\n context.hashCache1[index1] = hash1 = objectHash(value1, index1);\n }\n } else {\n hash1 = objectHash(value1);\n }\n if (typeof hash1 === 'undefined') {\n return false;\n }\n if (typeof index2 === 'number') {\n context.hashCache2 = context.hashCache2 || [];\n hash2 = context.hashCache2[index2];\n if (typeof hash2 === 'undefined') {\n context.hashCache2[index2] = hash2 = objectHash(value2, index2);\n }\n } else {\n hash2 = objectHash(value2);\n }\n if (typeof hash2 === 'undefined') {\n return false;\n }\n return hash1 === hash2;\n}\n\nvar diffFilter = function arraysDiffFilter(context) {\n if (!context.leftIsArray) {\n return;\n }\n\n var matchContext = {\n objectHash: context.options && context.options.objectHash,\n matchByPosition: context.options && context.options.matchByPosition\n };\n var commonHead = 0;\n var commonTail = 0;\n var index;\n var index1;\n var index2;\n var array1 = context.left;\n var array2 = context.right;\n var len1 = array1.length;\n var len2 = array2.length;\n\n var child;\n\n if (len1 > 0 && len2 > 0 && !matchContext.objectHash &&\n typeof matchContext.matchByPosition !== 'boolean') {\n matchContext.matchByPosition = !arraysHaveMatchByRef(array1, array2, len1, len2);\n }\n\n // separate common head\n while (commonHead < len1 && commonHead < len2 &&\n matchItems(array1, array2, commonHead, commonHead, matchContext)) {\n index = commonHead;\n child = new DiffContext(context.left[index], context.right[index]);\n context.push(child, index);\n commonHead++;\n }\n // separate common tail\n while (commonTail + commonHead < len1 && commonTail + commonHead < len2 &&\n matchItems(array1, array2, len1 - 1 - commonTail, len2 - 1 - commonTail, matchContext)) {\n index1 = len1 - 1 - commonTail;\n index2 = len2 - 1 - commonTail;\n child = new DiffContext(context.left[index1], context.right[index2]);\n context.push(child, index2);\n commonTail++;\n }\n var result;\n if (commonHead + commonTail === len1) {\n if (len1 === len2) {\n // arrays are identical\n context.setResult(undefined).exit();\n return;\n }\n // trivial case, a block (1 or more consecutive items) was added\n result = result || {\n _t: 'a'\n };\n for (index = commonHead; index < len2 - commonTail; index++) {\n result[index] = [array2[index]];\n }\n context.setResult(result).exit();\n return;\n }\n if (commonHead + commonTail === len2) {\n // trivial case, a block (1 or more consecutive items) was removed\n result = result || {\n _t: 'a'\n };\n for (index = commonHead; index < len1 - commonTail; index++) {\n result['_' + index] = [array1[index], 0, 0];\n }\n context.setResult(result).exit();\n return;\n }\n // reset hash cache\n delete matchContext.hashCache1;\n delete matchContext.hashCache2;\n\n // diff is not trivial, find the LCS (Longest Common Subsequence)\n var trimmed1 = array1.slice(commonHead, len1 - commonTail);\n var trimmed2 = array2.slice(commonHead, len2 - commonTail);\n var seq = lcs.get(\n trimmed1, trimmed2,\n matchItems,\n matchContext\n );\n var removedItems = [];\n result = result || {\n _t: 'a'\n };\n for (index = commonHead; index < len1 - commonTail; index++) {\n if (arrayIndexOf(seq.indices1, index - commonHead) < 0) {\n // removed\n result['_' + index] = [array1[index], 0, 0];\n removedItems.push(index);\n }\n }\n\n var detectMove = true;\n if (context.options && context.options.arrays && context.options.arrays.detectMove === false) {\n detectMove = false;\n }\n var includeValueOnMove = false;\n if (context.options && context.options.arrays && context.options.arrays.includeValueOnMove) {\n includeValueOnMove = true;\n }\n\n var removedItemsLength = removedItems.length;\n for (index = commonHead; index < len2 - commonTail; index++) {\n var indexOnArray2 = arrayIndexOf(seq.indices2, index - commonHead);\n if (indexOnArray2 < 0) {\n // added, try to match with a removed item and register as position move\n var isMove = false;\n if (detectMove && removedItemsLength > 0) {\n for (var removeItemIndex1 = 0; removeItemIndex1 < removedItemsLength; removeItemIndex1++) {\n index1 = removedItems[removeItemIndex1];\n if (matchItems(trimmed1, trimmed2, index1 - commonHead,\n index - commonHead, matchContext)) {\n // store position move as: [originalValue, newPosition, ARRAY_MOVE]\n result['_' + index1].splice(1, 2, index, ARRAY_MOVE);\n if (!includeValueOnMove) {\n // don't include moved value on diff, to save bytes\n result['_' + index1][0] = '';\n }\n\n index2 = index;\n child = new DiffContext(context.left[index1], context.right[index2]);\n context.push(child, index2);\n removedItems.splice(removeItemIndex1, 1);\n isMove = true;\n break;\n }\n }\n }\n if (!isMove) {\n // added\n result[index] = [array2[index]];\n }\n } else {\n // match, do inner diff\n index1 = seq.indices1[indexOnArray2] + commonHead;\n index2 = seq.indices2[indexOnArray2] + commonHead;\n child = new DiffContext(context.left[index1], context.right[index2]);\n context.push(child, index2);\n }\n }\n\n context.setResult(result).exit();\n\n};\ndiffFilter.filterName = 'arrays';\n\nvar compare = {\n numerically: function(a, b) {\n return a - b;\n },\n numericallyBy: function(name) {\n return function(a, b) {\n return a[name] - b[name];\n };\n }\n};\n\nvar patchFilter = function nestedPatchFilter(context) {\n if (!context.nested) {\n return;\n }\n if (context.delta._t !== 'a') {\n return;\n }\n var index, index1;\n\n var delta = context.delta;\n var array = context.left;\n\n // first, separate removals, insertions and modifications\n var toRemove = [];\n var toInsert = [];\n var toModify = [];\n for (index in delta) {\n if (index !== '_t') {\n if (index[0] === '_') {\n // removed item from original array\n if (delta[index][2] === 0 || delta[index][2] === ARRAY_MOVE) {\n toRemove.push(parseInt(index.slice(1), 10));\n } else {\n throw new Error('only removal or move can be applied at original array indices' +\n ', invalid diff type: ' + delta[index][2]);\n }\n } else {\n if (delta[index].length === 1) {\n // added item at new array\n toInsert.push({\n index: parseInt(index, 10),\n value: delta[index][0]\n });\n } else {\n // modified item at new array\n toModify.push({\n index: parseInt(index, 10),\n delta: delta[index]\n });\n }\n }\n }\n }\n\n // remove items, in reverse order to avoid sawing our own floor\n toRemove = toRemove.sort(compare.numerically);\n for (index = toRemove.length - 1; index >= 0; index--) {\n index1 = toRemove[index];\n var indexDiff = delta['_' + index1];\n var removedValue = array.splice(index1, 1)[0];\n if (indexDiff[2] === ARRAY_MOVE) {\n // reinsert later\n toInsert.push({\n index: indexDiff[1],\n value: removedValue\n });\n }\n }\n\n // insert items, in reverse order to avoid moving our own floor\n toInsert = toInsert.sort(compare.numericallyBy('index'));\n var toInsertLength = toInsert.length;\n for (index = 0; index < toInsertLength; index++) {\n var insertion = toInsert[index];\n array.splice(insertion.index, 0, insertion.value);\n }\n\n // apply modifications\n var toModifyLength = toModify.length;\n var child;\n if (toModifyLength > 0) {\n for (index = 0; index < toModifyLength; index++) {\n var modification = toModify[index];\n child = new PatchContext(context.left[modification.index], modification.delta);\n context.push(child, modification.index);\n }\n }\n\n if (!context.children) {\n context.setResult(context.left).exit();\n return;\n }\n context.exit();\n};\npatchFilter.filterName = 'arrays';\n\nvar collectChildrenPatchFilter = function collectChildrenPatchFilter(context) {\n if (!context || !context.children) {\n return;\n }\n if (context.delta._t !== 'a') {\n return;\n }\n var length = context.children.length;\n var child;\n for (var index = 0; index < length; index++) {\n child = context.children[index];\n context.left[child.childName] = child.result;\n }\n context.setResult(context.left).exit();\n};\ncollectChildrenPatchFilter.filterName = 'arraysCollectChildren';\n\nvar reverseFilter = function arraysReverseFilter(context) {\n if (!context.nested) {\n if (context.delta[2] === ARRAY_MOVE) {\n context.newName = '_' + context.delta[1];\n context.setResult([context.delta[0], parseInt(context.childName.substr(1), 10), ARRAY_MOVE]).exit();\n }\n return;\n }\n if (context.delta._t !== 'a') {\n return;\n }\n var name, child;\n for (name in context.delta) {\n if (name === '_t') {\n continue;\n }\n child = new ReverseContext(context.delta[name]);\n context.push(child, name);\n }\n context.exit();\n};\nreverseFilter.filterName = 'arrays';\n\nvar reverseArrayDeltaIndex = function(delta, index, itemDelta) {\n if (typeof index === 'string' && index[0] === '_') {\n return parseInt(index.substr(1), 10);\n } else if (isArray(itemDelta) && itemDelta[2] === 0) {\n return '_' + index;\n }\n\n var reverseIndex = +index;\n for (var deltaIndex in delta) {\n var deltaItem = delta[deltaIndex];\n if (isArray(deltaItem)) {\n if (deltaItem[2] === ARRAY_MOVE) {\n var moveFromIndex = parseInt(deltaIndex.substr(1), 10);\n var moveToIndex = deltaItem[1];\n if (moveToIndex === +index) {\n return moveFromIndex;\n }\n if (moveFromIndex <= reverseIndex && moveToIndex > reverseIndex) {\n reverseIndex++;\n } else if (moveFromIndex >= reverseIndex && moveToIndex < reverseIndex) {\n reverseIndex--;\n }\n } else if (deltaItem[2] === 0) {\n var deleteIndex = parseInt(deltaIndex.substr(1), 10);\n if (deleteIndex <= reverseIndex) {\n reverseIndex++;\n }\n } else if (deltaItem.length === 1 && deltaIndex <= reverseIndex) {\n reverseIndex--;\n }\n }\n }\n\n return reverseIndex;\n};\n\nvar collectChildrenReverseFilter = function collectChildrenReverseFilter(context) {\n if (!context || !context.children) {\n return;\n }\n if (context.delta._t !== 'a') {\n return;\n }\n var length = context.children.length;\n var child;\n var delta = {\n _t: 'a'\n };\n\n for (var index = 0; index < length; index++) {\n child = context.children[index];\n var name = child.newName;\n if (typeof name === 'undefined') {\n name = reverseArrayDeltaIndex(context.delta, child.childName, child.result);\n }\n if (delta[name] !== child.result) {\n delta[name] = child.result;\n }\n }\n context.setResult(delta).exit();\n};\ncollectChildrenReverseFilter.filterName = 'arraysCollectChildren';\n\nexports.diffFilter = diffFilter;\nexports.patchFilter = patchFilter;\nexports.collectChildrenPatchFilter = collectChildrenPatchFilter;\nexports.reverseFilter = reverseFilter;\nexports.collectChildrenReverseFilter = collectChildrenReverseFilter;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/jsondiffpatch/src/filters/arrays.js\n ** module id = 51\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/jsondiffpatch/src/filters/arrays.js?")},function(module,exports){eval("var diffFilter = function datesDiffFilter(context) {\n if (context.left instanceof Date) {\n if (context.right instanceof Date) {\n if (context.left.getTime() !== context.right.getTime()) {\n context.setResult([context.left, context.right]);\n } else {\n context.setResult(undefined);\n }\n } else {\n context.setResult([context.left, context.right]);\n }\n context.exit();\n } else if (context.right instanceof Date) {\n context.setResult([context.left, context.right]).exit();\n }\n};\ndiffFilter.filterName = 'dates';\n\nexports.diffFilter = diffFilter;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/jsondiffpatch/src/filters/dates.js\n ** module id = 52\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/jsondiffpatch/src/filters/dates.js?")},function(module,exports){eval("/*\n\nLCS implementation that supports arrays or strings\n\nreference: http://en.wikipedia.org/wiki/Longest_common_subsequence_problem\n\n*/\n\nvar defaultMatch = function(array1, array2, index1, index2) {\n return array1[index1] === array2[index2];\n};\n\nvar lengthMatrix = function(array1, array2, match, context) {\n var len1 = array1.length;\n var len2 = array2.length;\n var x, y;\n\n // initialize empty matrix of len1+1 x len2+1\n var matrix = [len1 + 1];\n for (x = 0; x < len1 + 1; x++) {\n matrix[x] = [len2 + 1];\n for (y = 0; y < len2 + 1; y++) {\n matrix[x][y] = 0;\n }\n }\n matrix.match = match;\n // save sequence lengths for each coordinate\n for (x = 1; x < len1 + 1; x++) {\n for (y = 1; y < len2 + 1; y++) {\n if (match(array1, array2, x - 1, y - 1, context)) {\n matrix[x][y] = matrix[x - 1][y - 1] + 1;\n } else {\n matrix[x][y] = Math.max(matrix[x - 1][y], matrix[x][y - 1]);\n }\n }\n }\n return matrix;\n};\n\nvar backtrack = function(matrix, array1, array2, index1, index2, context) {\n if (index1 === 0 || index2 === 0) {\n return {\n sequence: [],\n indices1: [],\n indices2: []\n };\n }\n\n if (matrix.match(array1, array2, index1 - 1, index2 - 1, context)) {\n var subsequence = backtrack(matrix, array1, array2, index1 - 1, index2 - 1, context);\n subsequence.sequence.push(array1[index1 - 1]);\n subsequence.indices1.push(index1 - 1);\n subsequence.indices2.push(index2 - 1);\n return subsequence;\n }\n\n if (matrix[index1][index2 - 1] > matrix[index1 - 1][index2]) {\n return backtrack(matrix, array1, array2, index1, index2 - 1, context);\n } else {\n return backtrack(matrix, array1, array2, index1 - 1, index2, context);\n }\n};\n\nvar get = function(array1, array2, match, context) {\n context = context || {};\n var matrix = lengthMatrix(array1, array2, match || defaultMatch, context);\n var result = backtrack(matrix, array1, array2, array1.length, array2.length, context);\n if (typeof array1 === 'string' && typeof array2 === 'string') {\n result.sequence = result.sequence.join('');\n }\n return result;\n};\n\nexports.get = get;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/jsondiffpatch/src/filters/lcs.js\n ** module id = 53\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/jsondiffpatch/src/filters/lcs.js?")},function(module,exports,__webpack_require__){eval("var DiffContext = __webpack_require__(26).DiffContext;\nvar PatchContext = __webpack_require__(27).PatchContext;\nvar ReverseContext = __webpack_require__(28).ReverseContext;\n\nvar collectChildrenDiffFilter = function collectChildrenDiffFilter(context) {\n if (!context || !context.children) {\n return;\n }\n var length = context.children.length;\n var child;\n var result = context.result;\n for (var index = 0; index < length; index++) {\n child = context.children[index];\n if (typeof child.result === 'undefined') {\n continue;\n }\n result = result || {};\n result[child.childName] = child.result;\n }\n if (result && context.leftIsArray) {\n result._t = 'a';\n }\n context.setResult(result).exit();\n};\ncollectChildrenDiffFilter.filterName = 'collectChildren';\n\nvar objectsDiffFilter = function objectsDiffFilter(context) {\n if (context.leftIsArray || context.leftType !== 'object') {\n return;\n }\n\n var name, child, propertyFilter = context.options.propertyFilter;\n for (name in context.left) {\n if (!Object.prototype.hasOwnProperty.call(context.left, name)) {\n continue;\n }\n if (propertyFilter && !propertyFilter(name, context)) {\n continue;\n }\n child = new DiffContext(context.left[name], context.right[name]);\n context.push(child, name);\n }\n for (name in context.right) {\n if (!Object.prototype.hasOwnProperty.call(context.right, name)) {\n continue;\n }\n if (propertyFilter && !propertyFilter(name, context)) {\n continue;\n }\n if (typeof context.left[name] === 'undefined') {\n child = new DiffContext(undefined, context.right[name]);\n context.push(child, name);\n }\n }\n\n if (!context.children || context.children.length === 0) {\n context.setResult(undefined).exit();\n return;\n }\n context.exit();\n};\nobjectsDiffFilter.filterName = 'objects';\n\nvar patchFilter = function nestedPatchFilter(context) {\n if (!context.nested) {\n return;\n }\n if (context.delta._t) {\n return;\n }\n var name, child;\n for (name in context.delta) {\n child = new PatchContext(context.left[name], context.delta[name]);\n context.push(child, name);\n }\n context.exit();\n};\npatchFilter.filterName = 'objects';\n\nvar collectChildrenPatchFilter = function collectChildrenPatchFilter(context) {\n if (!context || !context.children) {\n return;\n }\n if (context.delta._t) {\n return;\n }\n var length = context.children.length;\n var child;\n for (var index = 0; index < length; index++) {\n child = context.children[index];\n if (Object.prototype.hasOwnProperty.call(context.left, child.childName) && child.result === undefined) {\n delete context.left[child.childName];\n } else if (context.left[child.childName] !== child.result) {\n context.left[child.childName] = child.result;\n }\n }\n context.setResult(context.left).exit();\n};\ncollectChildrenPatchFilter.filterName = 'collectChildren';\n\nvar reverseFilter = function nestedReverseFilter(context) {\n if (!context.nested) {\n return;\n }\n if (context.delta._t) {\n return;\n }\n var name, child;\n for (name in context.delta) {\n child = new ReverseContext(context.delta[name]);\n context.push(child, name);\n }\n context.exit();\n};\nreverseFilter.filterName = 'objects';\n\nvar collectChildrenReverseFilter = function collectChildrenReverseFilter(context) {\n if (!context || !context.children) {\n return;\n }\n if (context.delta._t) {\n return;\n }\n var length = context.children.length;\n var child;\n var delta = {};\n for (var index = 0; index < length; index++) {\n child = context.children[index];\n if (delta[child.childName] !== child.result) {\n delta[child.childName] = child.result;\n }\n }\n context.setResult(delta).exit();\n};\ncollectChildrenReverseFilter.filterName = 'collectChildren';\n\nexports.collectChildrenDiffFilter = collectChildrenDiffFilter;\nexports.objectsDiffFilter = objectsDiffFilter;\nexports.patchFilter = patchFilter;\nexports.collectChildrenPatchFilter = collectChildrenPatchFilter;\nexports.reverseFilter = reverseFilter;\nexports.collectChildrenReverseFilter = collectChildrenReverseFilter;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/jsondiffpatch/src/filters/nested.js\n ** module id = 54\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/jsondiffpatch/src/filters/nested.js?")},function(module,exports,__webpack_require__){eval("/* global diff_match_patch */\nvar TEXT_DIFF = 2;\nvar DEFAULT_MIN_LENGTH = 60;\nvar cachedDiffPatch = null;\n\nvar getDiffMatchPatch = function(required) {\n /*jshint camelcase: false */\n\n if (!cachedDiffPatch) {\n var instance;\n if (typeof diff_match_patch !== 'undefined') {\n // already loaded, probably a browser\n instance = typeof diff_match_patch === 'function' ?\n new diff_match_patch() : new diff_match_patch.diff_match_patch();\n } else if (true) {\n try {\n var dmpModuleName = 'diff_match_patch_uncompressed';\n var dmp = __webpack_require__(272)(\"./\" + dmpModuleName);\n instance = new dmp.diff_match_patch();\n } catch (err) {\n instance = null;\n }\n }\n if (!instance) {\n if (!required) {\n return null;\n }\n var error = new Error('text diff_match_patch library not found');\n error.diff_match_patch_not_found = true;\n throw error;\n }\n cachedDiffPatch = {\n diff: function(txt1, txt2) {\n return instance.patch_toText(instance.patch_make(txt1, txt2));\n },\n patch: function(txt1, patch) {\n var results = instance.patch_apply(instance.patch_fromText(patch), txt1);\n for (var i = 0; i < results[1].length; i++) {\n if (!results[1][i]) {\n var error = new Error('text patch failed');\n error.textPatchFailed = true;\n }\n }\n return results[0];\n }\n };\n }\n return cachedDiffPatch;\n};\n\nvar diffFilter = function textsDiffFilter(context) {\n if (context.leftType !== 'string') {\n return;\n }\n var minLength = (context.options && context.options.textDiff &&\n context.options.textDiff.minLength) || DEFAULT_MIN_LENGTH;\n if (context.left.length < minLength ||\n context.right.length < minLength) {\n context.setResult([context.left, context.right]).exit();\n return;\n }\n // large text, try to use a text-diff algorithm\n var diffMatchPatch = getDiffMatchPatch();\n if (!diffMatchPatch) {\n // diff-match-patch library not available, fallback to regular string replace\n context.setResult([context.left, context.right]).exit();\n return;\n }\n var diff = diffMatchPatch.diff;\n context.setResult([diff(context.left, context.right), 0, TEXT_DIFF]).exit();\n};\ndiffFilter.filterName = 'texts';\n\nvar patchFilter = function textsPatchFilter(context) {\n if (context.nested) {\n return;\n }\n if (context.delta[2] !== TEXT_DIFF) {\n return;\n }\n\n // text-diff, use a text-patch algorithm\n var patch = getDiffMatchPatch(true).patch;\n context.setResult(patch(context.left, context.delta[0])).exit();\n};\npatchFilter.filterName = 'texts';\n\nvar textDeltaReverse = function(delta) {\n var i, l, lines, line, lineTmp, header = null,\n headerRegex = /^@@ +\\-(\\d+),(\\d+) +\\+(\\d+),(\\d+) +@@$/,\n lineHeader, lineAdd, lineRemove;\n lines = delta.split('\\n');\n for (i = 0, l = lines.length; i < l; i++) {\n line = lines[i];\n var lineStart = line.slice(0, 1);\n if (lineStart === '@') {\n header = headerRegex.exec(line);\n lineHeader = i;\n lineAdd = null;\n lineRemove = null;\n\n // fix header\n lines[lineHeader] = '@@ -' + header[3] + ',' + header[4] + ' +' + header[1] + ',' + header[2] + ' @@';\n } else if (lineStart === '+') {\n lineAdd = i;\n lines[i] = '-' + lines[i].slice(1);\n if (lines[i - 1].slice(0, 1) === '+') {\n // swap lines to keep default order (-+)\n lineTmp = lines[i];\n lines[i] = lines[i - 1];\n lines[i - 1] = lineTmp;\n }\n } else if (lineStart === '-') {\n lineRemove = i;\n lines[i] = '+' + lines[i].slice(1);\n }\n }\n return lines.join('\\n');\n};\n\nvar reverseFilter = function textsReverseFilter(context) {\n if (context.nested) {\n return;\n }\n if (context.delta[2] !== TEXT_DIFF) {\n return;\n }\n\n // text-diff, use a text-diff algorithm\n context.setResult([textDeltaReverse(context.delta[0]), 0, TEXT_DIFF]).exit();\n};\nreverseFilter.filterName = 'texts';\n\nexports.diffFilter = diffFilter;\nexports.patchFilter = patchFilter;\nexports.reverseFilter = reverseFilter;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/jsondiffpatch/src/filters/texts.js\n ** module id = 55\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/jsondiffpatch/src/filters/texts.js?")},function(module,exports){eval("var isArray = (typeof Array.isArray === 'function') ?\n // use native function\n Array.isArray :\n // use instanceof operator\n function(a) {\n return a instanceof Array;\n };\n\nvar diffFilter = function trivialMatchesDiffFilter(context) {\n if (context.left === context.right) {\n context.setResult(undefined).exit();\n return;\n }\n if (typeof context.left === 'undefined') {\n if (typeof context.right === 'function') {\n throw new Error('functions are not supported');\n }\n context.setResult([context.right]).exit();\n return;\n }\n if (typeof context.right === 'undefined') {\n context.setResult([context.left, 0, 0]).exit();\n return;\n }\n if (typeof context.left === 'function' || typeof context.right === 'function') {\n throw new Error('functions are not supported');\n }\n context.leftType = context.left === null ? 'null' : typeof context.left;\n context.rightType = context.right === null ? 'null' : typeof context.right;\n if (context.leftType !== context.rightType) {\n context.setResult([context.left, context.right]).exit();\n return;\n }\n if (context.leftType === 'boolean' || context.leftType === 'number') {\n context.setResult([context.left, context.right]).exit();\n return;\n }\n if (context.leftType === 'object') {\n context.leftIsArray = isArray(context.left);\n }\n if (context.rightType === 'object') {\n context.rightIsArray = isArray(context.right);\n }\n if (context.leftIsArray !== context.rightIsArray) {\n context.setResult([context.left, context.right]).exit();\n return;\n }\n};\ndiffFilter.filterName = 'trivial';\n\nvar patchFilter = function trivialMatchesPatchFilter(context) {\n if (typeof context.delta === 'undefined') {\n context.setResult(context.left).exit();\n return;\n }\n context.nested = !isArray(context.delta);\n if (context.nested) {\n return;\n }\n if (context.delta.length === 1) {\n context.setResult(context.delta[0]).exit();\n return;\n }\n if (context.delta.length === 2) {\n context.setResult(context.delta[1]).exit();\n return;\n }\n if (context.delta.length === 3 && context.delta[2] === 0) {\n context.setResult(undefined).exit();\n return;\n }\n};\npatchFilter.filterName = 'trivial';\n\nvar reverseFilter = function trivialReferseFilter(context) {\n if (typeof context.delta === 'undefined') {\n context.setResult(context.delta).exit();\n return;\n }\n context.nested = !isArray(context.delta);\n if (context.nested) {\n return;\n }\n if (context.delta.length === 1) {\n context.setResult([context.delta[0], 0, 0]).exit();\n return;\n }\n if (context.delta.length === 2) {\n context.setResult([context.delta[1], context.delta[0]]).exit();\n return;\n }\n if (context.delta.length === 3 && context.delta[2] === 0) {\n context.setResult([context.delta[0]]).exit();\n return;\n }\n};\nreverseFilter.filterName = 'trivial';\n\nexports.diffFilter = diffFilter;\nexports.patchFilter = patchFilter;\nexports.reverseFilter = reverseFilter;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/jsondiffpatch/src/filters/trivial.js\n ** module id = 56\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/jsondiffpatch/src/filters/trivial.js?")},function(module,exports){eval("\nvar Processor = function Processor(options){\n this.selfOptions = options || {};\n this.pipes = {};\n};\n\nProcessor.prototype.options = function(options) {\n if (options) {\n this.selfOptions = options;\n }\n return this.selfOptions;\n};\n\nProcessor.prototype.pipe = function(name, pipe) {\n if (typeof name === 'string') {\n if (typeof pipe === 'undefined') {\n return this.pipes[name];\n } else {\n this.pipes[name] = pipe;\n }\n }\n if (name && name.name) {\n pipe = name;\n if (pipe.processor === this) { return pipe; }\n this.pipes[pipe.name] = pipe;\n }\n pipe.processor = this;\n return pipe;\n};\n\nProcessor.prototype.process = function(input, pipe) {\n var context = input;\n context.options = this.options();\n var nextPipe = pipe || input.pipe || 'default';\n var lastPipe, lastContext;\n while (nextPipe) {\n if (typeof context.nextAfterChildren !== 'undefined') {\n // children processed and coming back to parent\n context.next = context.nextAfterChildren;\n context.nextAfterChildren = null;\n }\n\n if (typeof nextPipe === 'string') {\n nextPipe = this.pipe(nextPipe);\n }\n nextPipe.process(context);\n lastContext = context;\n lastPipe = nextPipe;\n nextPipe = null;\n if (context) {\n if (context.next) {\n context = context.next;\n nextPipe = lastContext.nextPipe || context.pipe || lastPipe;\n }\n }\n }\n return context.hasResult ? context.result : undefined;\n};\n\nexports.Processor = Processor;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/jsondiffpatch/src/processor.js\n ** module id = 57\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/jsondiffpatch/src/processor.js?"); },function(module,exports){eval("module.exports = function(sel, data, children, text, elm) {\n var key = data === undefined ? undefined : data.key;\n return {sel: sel, data: data, children: children,\n text: text, elm: elm, key: key};\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/snabbdom/vnode.js\n ** module id = 58\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/snabbdom/vnode.js?")},function(module,exports,__webpack_require__){eval("/* WEBPACK VAR INJECTION */(function(Buffer, global) {/*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n */\n/* eslint-disable no-proto */\n\n'use strict'\n\nvar base64 = __webpack_require__(226)\nvar ieee754 = __webpack_require__(306)\nvar isArray = __webpack_require__(307)\n\nexports.Buffer = Buffer\nexports.SlowBuffer = SlowBuffer\nexports.INSPECT_MAX_BYTES = 50\nBuffer.poolSize = 8192 // not used by this implementation\n\nvar rootParent = {}\n\n/**\n * If `Buffer.TYPED_ARRAY_SUPPORT`:\n * === true Use Uint8Array implementation (fastest)\n * === false Use Object implementation (most compatible, even IE6)\n *\n * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,\n * Opera 11.6+, iOS 4.2+.\n *\n * Due to various browser bugs, sometimes the Object implementation will be used even\n * when the browser supports typed arrays.\n *\n * Note:\n *\n * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,\n * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.\n *\n * - Safari 5-7 lacks support for changing the `Object.prototype.constructor` property\n * on objects.\n *\n * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.\n *\n * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of\n * incorrect length in some situations.\n\n * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they\n * get the Object implementation, which is slower but behaves correctly.\n */\nBuffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined\n ? global.TYPED_ARRAY_SUPPORT\n : typedArraySupport()\n\nfunction typedArraySupport () {\n function Bar () {}\n try {\n var arr = new Uint8Array(1)\n arr.foo = function () { return 42 }\n arr.constructor = Bar\n return arr.foo() === 42 && // typed array instances can be augmented\n arr.constructor === Bar && // constructor can be set\n typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`\n arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`\n } catch (e) {\n return false\n }\n}\n\nfunction kMaxLength () {\n return Buffer.TYPED_ARRAY_SUPPORT\n ? 0x7fffffff\n : 0x3fffffff\n}\n\n/**\n * Class: Buffer\n * =============\n *\n * The Buffer constructor returns instances of `Uint8Array` that are augmented\n * with function properties for all the node `Buffer` API functions. We use\n * `Uint8Array` so that square bracket notation works as expected -- it returns\n * a single octet.\n *\n * By augmenting the instances, we can avoid modifying the `Uint8Array`\n * prototype.\n */\nfunction Buffer (arg) {\n if (!(this instanceof Buffer)) {\n // Avoid going through an ArgumentsAdaptorTrampoline in the common case.\n if (arguments.length > 1) return new Buffer(arg, arguments[1])\n return new Buffer(arg)\n }\n\n if (!Buffer.TYPED_ARRAY_SUPPORT) {\n this.length = 0\n this.parent = undefined\n }\n\n // Common case.\n if (typeof arg === 'number') {\n return fromNumber(this, arg)\n }\n\n // Slightly less common case.\n if (typeof arg === 'string') {\n return fromString(this, arg, arguments.length > 1 ? arguments[1] : 'utf8')\n }\n\n // Unusual.\n return fromObject(this, arg)\n}\n\nfunction fromNumber (that, length) {\n that = allocate(that, length < 0 ? 0 : checked(length) | 0)\n if (!Buffer.TYPED_ARRAY_SUPPORT) {\n for (var i = 0; i < length; i++) {\n that[i] = 0\n }\n }\n return that\n}\n\nfunction fromString (that, string, encoding) {\n if (typeof encoding !== 'string' || encoding === '') encoding = 'utf8'\n\n // Assumption: byteLength() return value is always < kMaxLength.\n var length = byteLength(string, encoding) | 0\n that = allocate(that, length)\n\n that.write(string, encoding)\n return that\n}\n\nfunction fromObject (that, object) {\n if (Buffer.isBuffer(object)) return fromBuffer(that, object)\n\n if (isArray(object)) return fromArray(that, object)\n\n if (object == null) {\n throw new TypeError('must start with number, buffer, array or string')\n }\n\n if (typeof ArrayBuffer !== 'undefined') {\n if (object.buffer instanceof ArrayBuffer) {\n return fromTypedArray(that, object)\n }\n if (object instanceof ArrayBuffer) {\n return fromArrayBuffer(that, object)\n }\n }\n\n if (object.length) return fromArrayLike(that, object)\n\n return fromJsonObject(that, object)\n}\n\nfunction fromBuffer (that, buffer) {\n var length = checked(buffer.length) | 0\n that = allocate(that, length)\n buffer.copy(that, 0, 0, length)\n return that\n}\n\nfunction fromArray (that, array) {\n var length = checked(array.length) | 0\n that = allocate(that, length)\n for (var i = 0; i < length; i += 1) {\n that[i] = array[i] & 255\n }\n return that\n}\n\n// Duplicate of fromArray() to keep fromArray() monomorphic.\nfunction fromTypedArray (that, array) {\n var length = checked(array.length) | 0\n that = allocate(that, length)\n // Truncating the elements is probably not what people expect from typed\n // arrays with BYTES_PER_ELEMENT > 1 but it's compatible with the behavior\n // of the old Buffer constructor.\n for (var i = 0; i < length; i += 1) {\n that[i] = array[i] & 255\n }\n return that\n}\n\nfunction fromArrayBuffer (that, array) {\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Return an augmented `Uint8Array` instance, for best performance\n array.byteLength\n that = Buffer._augment(new Uint8Array(array))\n } else {\n // Fallback: Return an object instance of the Buffer class\n that = fromTypedArray(that, new Uint8Array(array))\n }\n return that\n}\n\nfunction fromArrayLike (that, array) {\n var length = checked(array.length) | 0\n that = allocate(that, length)\n for (var i = 0; i < length; i += 1) {\n that[i] = array[i] & 255\n }\n return that\n}\n\n// Deserialize { type: 'Buffer', data: [1,2,3,...] } into a Buffer object.\n// Returns a zero-length buffer for inputs that don't conform to the spec.\nfunction fromJsonObject (that, object) {\n var array\n var length = 0\n\n if (object.type === 'Buffer' && isArray(object.data)) {\n array = object.data\n length = checked(array.length) | 0\n }\n that = allocate(that, length)\n\n for (var i = 0; i < length; i += 1) {\n that[i] = array[i] & 255\n }\n return that\n}\n\nif (Buffer.TYPED_ARRAY_SUPPORT) {\n Buffer.prototype.__proto__ = Uint8Array.prototype\n Buffer.__proto__ = Uint8Array\n} else {\n // pre-set for values that may exist in the future\n Buffer.prototype.length = undefined\n Buffer.prototype.parent = undefined\n}\n\nfunction allocate (that, length) {\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Return an augmented `Uint8Array` instance, for best performance\n that = Buffer._augment(new Uint8Array(length))\n that.__proto__ = Buffer.prototype\n } else {\n // Fallback: Return an object instance of the Buffer class\n that.length = length\n that._isBuffer = true\n }\n\n var fromPool = length !== 0 && length <= Buffer.poolSize >>> 1\n if (fromPool) that.parent = rootParent\n\n return that\n}\n\nfunction checked (length) {\n // Note: cannot use `length < kMaxLength` here because that fails when\n // length is NaN (which is otherwise coerced to zero.)\n if (length >= kMaxLength()) {\n throw new RangeError('Attempt to allocate Buffer larger than maximum ' +\n 'size: 0x' + kMaxLength().toString(16) + ' bytes')\n }\n return length | 0\n}\n\nfunction SlowBuffer (subject, encoding) {\n if (!(this instanceof SlowBuffer)) return new SlowBuffer(subject, encoding)\n\n var buf = new Buffer(subject, encoding)\n delete buf.parent\n return buf\n}\n\nBuffer.isBuffer = function isBuffer (b) {\n return !!(b != null && b._isBuffer)\n}\n\nBuffer.compare = function compare (a, b) {\n if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {\n throw new TypeError('Arguments must be Buffers')\n }\n\n if (a === b) return 0\n\n var x = a.length\n var y = b.length\n\n var i = 0\n var len = Math.min(x, y)\n while (i < len) {\n if (a[i] !== b[i]) break\n\n ++i\n }\n\n if (i !== len) {\n x = a[i]\n y = b[i]\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\nBuffer.isEncoding = function isEncoding (encoding) {\n switch (String(encoding).toLowerCase()) {\n case 'hex':\n case 'utf8':\n case 'utf-8':\n case 'ascii':\n case 'binary':\n case 'base64':\n case 'raw':\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return true\n default:\n return false\n }\n}\n\nBuffer.concat = function concat (list, length) {\n if (!isArray(list)) throw new TypeError('list argument must be an Array of Buffers.')\n\n if (list.length === 0) {\n return new Buffer(0)\n }\n\n var i\n if (length === undefined) {\n length = 0\n for (i = 0; i < list.length; i++) {\n length += list[i].length\n }\n }\n\n var buf = new Buffer(length)\n var pos = 0\n for (i = 0; i < list.length; i++) {\n var item = list[i]\n item.copy(buf, pos)\n pos += item.length\n }\n return buf\n}\n\nfunction byteLength (string, encoding) {\n if (typeof string !== 'string') string = '' + string\n\n var len = string.length\n if (len === 0) return 0\n\n // Use a for loop to avoid recursion\n var loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'ascii':\n case 'binary':\n // Deprecated\n case 'raw':\n case 'raws':\n return len\n case 'utf8':\n case 'utf-8':\n return utf8ToBytes(string).length\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return len * 2\n case 'hex':\n return len >>> 1\n case 'base64':\n return base64ToBytes(string).length\n default:\n if (loweredCase) return utf8ToBytes(string).length // assume utf8\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\nBuffer.byteLength = byteLength\n\nfunction slowToString (encoding, start, end) {\n var loweredCase = false\n\n start = start | 0\n end = end === undefined || end === Infinity ? this.length : end | 0\n\n if (!encoding) encoding = 'utf8'\n if (start < 0) start = 0\n if (end > this.length) end = this.length\n if (end <= start) return ''\n\n while (true) {\n switch (encoding) {\n case 'hex':\n return hexSlice(this, start, end)\n\n case 'utf8':\n case 'utf-8':\n return utf8Slice(this, start, end)\n\n case 'ascii':\n return asciiSlice(this, start, end)\n\n case 'binary':\n return binarySlice(this, start, end)\n\n case 'base64':\n return base64Slice(this, start, end)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return utf16leSlice(this, start, end)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = (encoding + '').toLowerCase()\n loweredCase = true\n }\n }\n}\n\nBuffer.prototype.toString = function toString () {\n var length = this.length | 0\n if (length === 0) return ''\n if (arguments.length === 0) return utf8Slice(this, 0, length)\n return slowToString.apply(this, arguments)\n}\n\nBuffer.prototype.equals = function equals (b) {\n if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n if (this === b) return true\n return Buffer.compare(this, b) === 0\n}\n\nBuffer.prototype.inspect = function inspect () {\n var str = ''\n var max = exports.INSPECT_MAX_BYTES\n if (this.length > 0) {\n str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')\n if (this.length > max) str += ' ... '\n }\n return ''\n}\n\nBuffer.prototype.compare = function compare (b) {\n if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n if (this === b) return 0\n return Buffer.compare(this, b)\n}\n\nBuffer.prototype.indexOf = function indexOf (val, byteOffset) {\n if (byteOffset > 0x7fffffff) byteOffset = 0x7fffffff\n else if (byteOffset < -0x80000000) byteOffset = -0x80000000\n byteOffset >>= 0\n\n if (this.length === 0) return -1\n if (byteOffset >= this.length) return -1\n\n // Negative offsets start from the end of the buffer\n if (byteOffset < 0) byteOffset = Math.max(this.length + byteOffset, 0)\n\n if (typeof val === 'string') {\n if (val.length === 0) return -1 // special case: looking for empty string always fails\n return String.prototype.indexOf.call(this, val, byteOffset)\n }\n if (Buffer.isBuffer(val)) {\n return arrayIndexOf(this, val, byteOffset)\n }\n if (typeof val === 'number') {\n if (Buffer.TYPED_ARRAY_SUPPORT && Uint8Array.prototype.indexOf === 'function') {\n return Uint8Array.prototype.indexOf.call(this, val, byteOffset)\n }\n return arrayIndexOf(this, [ val ], byteOffset)\n }\n\n function arrayIndexOf (arr, val, byteOffset) {\n var foundIndex = -1\n for (var i = 0; byteOffset + i < arr.length; i++) {\n if (arr[byteOffset + i] === val[foundIndex === -1 ? 0 : i - foundIndex]) {\n if (foundIndex === -1) foundIndex = i\n if (i - foundIndex + 1 === val.length) return byteOffset + foundIndex\n } else {\n foundIndex = -1\n }\n }\n return -1\n }\n\n throw new TypeError('val must be string, number or Buffer')\n}\n\n// `get` is deprecated\nBuffer.prototype.get = function get (offset) {\n console.log('.get() is deprecated. Access using array indexes instead.')\n return this.readUInt8(offset)\n}\n\n// `set` is deprecated\nBuffer.prototype.set = function set (v, offset) {\n console.log('.set() is deprecated. Access using array indexes instead.')\n return this.writeUInt8(v, offset)\n}\n\nfunction hexWrite (buf, string, offset, length) {\n offset = Number(offset) || 0\n var remaining = buf.length - offset\n if (!length) {\n length = remaining\n } else {\n length = Number(length)\n if (length > remaining) {\n length = remaining\n }\n }\n\n // must be an even number of digits\n var strLen = string.length\n if (strLen % 2 !== 0) throw new Error('Invalid hex string')\n\n if (length > strLen / 2) {\n length = strLen / 2\n }\n for (var i = 0; i < length; i++) {\n var parsed = parseInt(string.substr(i * 2, 2), 16)\n if (isNaN(parsed)) throw new Error('Invalid hex string')\n buf[offset + i] = parsed\n }\n return i\n}\n\nfunction utf8Write (buf, string, offset, length) {\n return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nfunction asciiWrite (buf, string, offset, length) {\n return blitBuffer(asciiToBytes(string), buf, offset, length)\n}\n\nfunction binaryWrite (buf, string, offset, length) {\n return asciiWrite(buf, string, offset, length)\n}\n\nfunction base64Write (buf, string, offset, length) {\n return blitBuffer(base64ToBytes(string), buf, offset, length)\n}\n\nfunction ucs2Write (buf, string, offset, length) {\n return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nBuffer.prototype.write = function write (string, offset, length, encoding) {\n // Buffer#write(string)\n if (offset === undefined) {\n encoding = 'utf8'\n length = this.length\n offset = 0\n // Buffer#write(string, encoding)\n } else if (length === undefined && typeof offset === 'string') {\n encoding = offset\n length = this.length\n offset = 0\n // Buffer#write(string, offset[, length][, encoding])\n } else if (isFinite(offset)) {\n offset = offset | 0\n if (isFinite(length)) {\n length = length | 0\n if (encoding === undefined) encoding = 'utf8'\n } else {\n encoding = length\n length = undefined\n }\n // legacy write(string, encoding, offset, length) - remove in v0.13\n } else {\n var swap = encoding\n encoding = offset\n offset = length | 0\n length = swap\n }\n\n var remaining = this.length - offset\n if (length === undefined || length > remaining) length = remaining\n\n if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {\n throw new RangeError('attempt to write outside buffer bounds')\n }\n\n if (!encoding) encoding = 'utf8'\n\n var loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'hex':\n return hexWrite(this, string, offset, length)\n\n case 'utf8':\n case 'utf-8':\n return utf8Write(this, string, offset, length)\n\n case 'ascii':\n return asciiWrite(this, string, offset, length)\n\n case 'binary':\n return binaryWrite(this, string, offset, length)\n\n case 'base64':\n // Warning: maxLength not taken into account in base64Write\n return base64Write(this, string, offset, length)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return ucs2Write(this, string, offset, length)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\n\nBuffer.prototype.toJSON = function toJSON () {\n return {\n type: 'Buffer',\n data: Array.prototype.slice.call(this._arr || this, 0)\n }\n}\n\nfunction base64Slice (buf, start, end) {\n if (start === 0 && end === buf.length) {\n return base64.fromByteArray(buf)\n } else {\n return base64.fromByteArray(buf.slice(start, end))\n }\n}\n\nfunction utf8Slice (buf, start, end) {\n end = Math.min(buf.length, end)\n var res = []\n\n var i = start\n while (i < end) {\n var firstByte = buf[i]\n var codePoint = null\n var bytesPerSequence = (firstByte > 0xEF) ? 4\n : (firstByte > 0xDF) ? 3\n : (firstByte > 0xBF) ? 2\n : 1\n\n if (i + bytesPerSequence <= end) {\n var secondByte, thirdByte, fourthByte, tempCodePoint\n\n switch (bytesPerSequence) {\n case 1:\n if (firstByte < 0x80) {\n codePoint = firstByte\n }\n break\n case 2:\n secondByte = buf[i + 1]\n if ((secondByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)\n if (tempCodePoint > 0x7F) {\n codePoint = tempCodePoint\n }\n }\n break\n case 3:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)\n if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {\n codePoint = tempCodePoint\n }\n }\n break\n case 4:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n fourthByte = buf[i + 3]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)\n if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {\n codePoint = tempCodePoint\n }\n }\n }\n }\n\n if (codePoint === null) {\n // we did not generate a valid codePoint so insert a\n // replacement char (U+FFFD) and advance only 1 byte\n codePoint = 0xFFFD\n bytesPerSequence = 1\n } else if (codePoint > 0xFFFF) {\n // encode to utf16 (surrogate pair dance)\n codePoint -= 0x10000\n res.push(codePoint >>> 10 & 0x3FF | 0xD800)\n codePoint = 0xDC00 | codePoint & 0x3FF\n }\n\n res.push(codePoint)\n i += bytesPerSequence\n }\n\n return decodeCodePointsArray(res)\n}\n\n// Based on http://stackoverflow.com/a/22747272/680742, the browser with\n// the lowest limit is Chrome, with 0x10000 args.\n// We go 1 magnitude less, for safety\nvar MAX_ARGUMENTS_LENGTH = 0x1000\n\nfunction decodeCodePointsArray (codePoints) {\n var len = codePoints.length\n if (len <= MAX_ARGUMENTS_LENGTH) {\n return String.fromCharCode.apply(String, codePoints) // avoid extra slice()\n }\n\n // Decode in chunks to avoid \"call stack size exceeded\".\n var res = ''\n var i = 0\n while (i < len) {\n res += String.fromCharCode.apply(\n String,\n codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)\n )\n }\n return res\n}\n\nfunction asciiSlice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; i++) {\n ret += String.fromCharCode(buf[i] & 0x7F)\n }\n return ret\n}\n\nfunction binarySlice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; i++) {\n ret += String.fromCharCode(buf[i])\n }\n return ret\n}\n\nfunction hexSlice (buf, start, end) {\n var len = buf.length\n\n if (!start || start < 0) start = 0\n if (!end || end < 0 || end > len) end = len\n\n var out = ''\n for (var i = start; i < end; i++) {\n out += toHex(buf[i])\n }\n return out\n}\n\nfunction utf16leSlice (buf, start, end) {\n var bytes = buf.slice(start, end)\n var res = ''\n for (var i = 0; i < bytes.length; i += 2) {\n res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)\n }\n return res\n}\n\nBuffer.prototype.slice = function slice (start, end) {\n var len = this.length\n start = ~~start\n end = end === undefined ? len : ~~end\n\n if (start < 0) {\n start += len\n if (start < 0) start = 0\n } else if (start > len) {\n start = len\n }\n\n if (end < 0) {\n end += len\n if (end < 0) end = 0\n } else if (end > len) {\n end = len\n }\n\n if (end < start) end = start\n\n var newBuf\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n newBuf = Buffer._augment(this.subarray(start, end))\n } else {\n var sliceLen = end - start\n newBuf = new Buffer(sliceLen, undefined)\n for (var i = 0; i < sliceLen; i++) {\n newBuf[i] = this[i + start]\n }\n }\n\n if (newBuf.length) newBuf.parent = this.parent || this\n\n return newBuf\n}\n\n/*\n * Need to make sure that buffer isn't trying to write out of bounds.\n */\nfunction checkOffset (offset, ext, length) {\n if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n}\n\nBuffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n checkOffset(offset, byteLength, this.length)\n }\n\n var val = this[offset + --byteLength]\n var mul = 1\n while (byteLength > 0 && (mul *= 0x100)) {\n val += this[offset + --byteLength] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length)\n return this[offset]\n}\n\nBuffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n return this[offset] | (this[offset + 1] << 8)\n}\n\nBuffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n return (this[offset] << 8) | this[offset + 1]\n}\n\nBuffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return ((this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16)) +\n (this[offset + 3] * 0x1000000)\n}\n\nBuffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] * 0x1000000) +\n ((this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n this[offset + 3])\n}\n\nBuffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var i = byteLength\n var mul = 1\n var val = this[offset + --i]\n while (i > 0 && (mul *= 0x100)) {\n val += this[offset + --i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readInt8 = function readInt8 (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length)\n if (!(this[offset] & 0x80)) return (this[offset])\n return ((0xff - this[offset] + 1) * -1)\n}\n\nBuffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset] | (this[offset + 1] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset + 1] | (this[offset] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16) |\n (this[offset + 3] << 24)\n}\n\nBuffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] << 24) |\n (this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n (this[offset + 3])\n}\n\nBuffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, true, 23, 4)\n}\n\nBuffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, false, 23, 4)\n}\n\nBuffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, true, 52, 8)\n}\n\nBuffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, false, 52, 8)\n}\n\nfunction checkInt (buf, value, offset, ext, max, min) {\n if (!Buffer.isBuffer(buf)) throw new TypeError('buffer must be a Buffer instance')\n if (value > max || value < min) throw new RangeError('value is out of bounds')\n if (offset + ext > buf.length) throw new RangeError('index out of range')\n}\n\nBuffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkInt(this, value, offset, byteLength, Math.pow(2, 8 * byteLength), 0)\n\n var mul = 1\n var i = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkInt(this, value, offset, byteLength, Math.pow(2, 8 * byteLength), 0)\n\n var i = byteLength - 1\n var mul = 1\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nfunction objectWriteUInt16 (buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffff + value + 1\n for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; i++) {\n buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>\n (littleEndian ? i : 1 - i) * 8\n }\n}\n\nBuffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n } else {\n objectWriteUInt16(this, value, offset, true)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n } else {\n objectWriteUInt16(this, value, offset, false)\n }\n return offset + 2\n}\n\nfunction objectWriteUInt32 (buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffffffff + value + 1\n for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; i++) {\n buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff\n }\n}\n\nBuffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset + 3] = (value >>> 24)\n this[offset + 2] = (value >>> 16)\n this[offset + 1] = (value >>> 8)\n this[offset] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, true)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, false)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n var i = 0\n var mul = 1\n var sub = value < 0 ? 1 : 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n var i = byteLength - 1\n var mul = 1\n var sub = value < 0 ? 1 : 0\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n if (value < 0) value = 0xff + value + 1\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nBuffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n } else {\n objectWriteUInt16(this, value, offset, true)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n } else {\n objectWriteUInt16(this, value, offset, false)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n this[offset + 2] = (value >>> 16)\n this[offset + 3] = (value >>> 24)\n } else {\n objectWriteUInt32(this, value, offset, true)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (value < 0) value = 0xffffffff + value + 1\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, false)\n }\n return offset + 4\n}\n\nfunction checkIEEE754 (buf, value, offset, ext, max, min) {\n if (value > max || value < min) throw new RangeError('value is out of bounds')\n if (offset + ext > buf.length) throw new RangeError('index out of range')\n if (offset < 0) throw new RangeError('index out of range')\n}\n\nfunction writeFloat (buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)\n }\n ieee754.write(buf, value, offset, littleEndian, 23, 4)\n return offset + 4\n}\n\nBuffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {\n return writeFloat(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {\n return writeFloat(this, value, offset, false, noAssert)\n}\n\nfunction writeDouble (buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)\n }\n ieee754.write(buf, value, offset, littleEndian, 52, 8)\n return offset + 8\n}\n\nBuffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {\n return writeDouble(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {\n return writeDouble(this, value, offset, false, noAssert)\n}\n\n// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)\nBuffer.prototype.copy = function copy (target, targetStart, start, end) {\n if (!start) start = 0\n if (!end && end !== 0) end = this.length\n if (targetStart >= target.length) targetStart = target.length\n if (!targetStart) targetStart = 0\n if (end > 0 && end < start) end = start\n\n // Copy 0 bytes; we're done\n if (end === start) return 0\n if (target.length === 0 || this.length === 0) return 0\n\n // Fatal error conditions\n if (targetStart < 0) {\n throw new RangeError('targetStart out of bounds')\n }\n if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')\n if (end < 0) throw new RangeError('sourceEnd out of bounds')\n\n // Are we oob?\n if (end > this.length) end = this.length\n if (target.length - targetStart < end - start) {\n end = target.length - targetStart + start\n }\n\n var len = end - start\n var i\n\n if (this === target && start < targetStart && targetStart < end) {\n // descending copy from end\n for (i = len - 1; i >= 0; i--) {\n target[i + targetStart] = this[i + start]\n }\n } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {\n // ascending copy from start\n for (i = 0; i < len; i++) {\n target[i + targetStart] = this[i + start]\n }\n } else {\n target._set(this.subarray(start, start + len), targetStart)\n }\n\n return len\n}\n\n// fill(value, start=0, end=buffer.length)\nBuffer.prototype.fill = function fill (value, start, end) {\n if (!value) value = 0\n if (!start) start = 0\n if (!end) end = this.length\n\n if (end < start) throw new RangeError('end < start')\n\n // Fill 0 bytes; we're done\n if (end === start) return\n if (this.length === 0) return\n\n if (start < 0 || start >= this.length) throw new RangeError('start out of bounds')\n if (end < 0 || end > this.length) throw new RangeError('end out of bounds')\n\n var i\n if (typeof value === 'number') {\n for (i = start; i < end; i++) {\n this[i] = value\n }\n } else {\n var bytes = utf8ToBytes(value.toString())\n var len = bytes.length\n for (i = start; i < end; i++) {\n this[i] = bytes[i % len]\n }\n }\n\n return this\n}\n\n/**\n * Creates a new `ArrayBuffer` with the *copied* memory of the buffer instance.\n * Added in Node 0.12. Only available in browsers that support ArrayBuffer.\n */\nBuffer.prototype.toArrayBuffer = function toArrayBuffer () {\n if (typeof Uint8Array !== 'undefined') {\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n return (new Buffer(this)).buffer\n } else {\n var buf = new Uint8Array(this.length)\n for (var i = 0, len = buf.length; i < len; i += 1) {\n buf[i] = this[i]\n }\n return buf.buffer\n }\n } else {\n throw new TypeError('Buffer.toArrayBuffer not supported in this browser')\n }\n}\n\n// HELPER FUNCTIONS\n// ================\n\nvar BP = Buffer.prototype\n\n/**\n * Augment a Uint8Array *instance* (not the Uint8Array class!) with Buffer methods\n */\nBuffer._augment = function _augment (arr) {\n arr.constructor = Buffer\n arr._isBuffer = true\n\n // save reference to original Uint8Array set method before overwriting\n arr._set = arr.set\n\n // deprecated\n arr.get = BP.get\n arr.set = BP.set\n\n arr.write = BP.write\n arr.toString = BP.toString\n arr.toLocaleString = BP.toString\n arr.toJSON = BP.toJSON\n arr.equals = BP.equals\n arr.compare = BP.compare\n arr.indexOf = BP.indexOf\n arr.copy = BP.copy\n arr.slice = BP.slice\n arr.readUIntLE = BP.readUIntLE\n arr.readUIntBE = BP.readUIntBE\n arr.readUInt8 = BP.readUInt8\n arr.readUInt16LE = BP.readUInt16LE\n arr.readUInt16BE = BP.readUInt16BE\n arr.readUInt32LE = BP.readUInt32LE\n arr.readUInt32BE = BP.readUInt32BE\n arr.readIntLE = BP.readIntLE\n arr.readIntBE = BP.readIntBE\n arr.readInt8 = BP.readInt8\n arr.readInt16LE = BP.readInt16LE\n arr.readInt16BE = BP.readInt16BE\n arr.readInt32LE = BP.readInt32LE\n arr.readInt32BE = BP.readInt32BE\n arr.readFloatLE = BP.readFloatLE\n arr.readFloatBE = BP.readFloatBE\n arr.readDoubleLE = BP.readDoubleLE\n arr.readDoubleBE = BP.readDoubleBE\n arr.writeUInt8 = BP.writeUInt8\n arr.writeUIntLE = BP.writeUIntLE\n arr.writeUIntBE = BP.writeUIntBE\n arr.writeUInt16LE = BP.writeUInt16LE\n arr.writeUInt16BE = BP.writeUInt16BE\n arr.writeUInt32LE = BP.writeUInt32LE\n arr.writeUInt32BE = BP.writeUInt32BE\n arr.writeIntLE = BP.writeIntLE\n arr.writeIntBE = BP.writeIntBE\n arr.writeInt8 = BP.writeInt8\n arr.writeInt16LE = BP.writeInt16LE\n arr.writeInt16BE = BP.writeInt16BE\n arr.writeInt32LE = BP.writeInt32LE\n arr.writeInt32BE = BP.writeInt32BE\n arr.writeFloatLE = BP.writeFloatLE\n arr.writeFloatBE = BP.writeFloatBE\n arr.writeDoubleLE = BP.writeDoubleLE\n arr.writeDoubleBE = BP.writeDoubleBE\n arr.fill = BP.fill\n arr.inspect = BP.inspect\n arr.toArrayBuffer = BP.toArrayBuffer\n\n return arr\n}\n\nvar INVALID_BASE64_RE = /[^+\\/0-9A-Za-z-_]/g\n\nfunction base64clean (str) {\n // Node strips out invalid characters like \\n and \\t from the string, base64-js does not\n str = stringtrim(str).replace(INVALID_BASE64_RE, '')\n // Node converts strings with length < 2 to ''\n if (str.length < 2) return ''\n // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not\n while (str.length % 4 !== 0) {\n str = str + '='\n }\n return str\n}\n\nfunction stringtrim (str) {\n if (str.trim) return str.trim()\n return str.replace(/^\\s+|\\s+$/g, '')\n}\n\nfunction toHex (n) {\n if (n < 16) return '0' + n.toString(16)\n return n.toString(16)\n}\n\nfunction utf8ToBytes (string, units) {\n units = units || Infinity\n var codePoint\n var length = string.length\n var leadSurrogate = null\n var bytes = []\n\n for (var i = 0; i < length; i++) {\n codePoint = string.charCodeAt(i)\n\n // is surrogate component\n if (codePoint > 0xD7FF && codePoint < 0xE000) {\n // last char was a lead\n if (!leadSurrogate) {\n // no lead yet\n if (codePoint > 0xDBFF) {\n // unexpected trail\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n } else if (i + 1 === length) {\n // unpaired lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n }\n\n // valid lead\n leadSurrogate = codePoint\n\n continue\n }\n\n // 2 leads in a row\n if (codePoint < 0xDC00) {\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n leadSurrogate = codePoint\n continue\n }\n\n // valid surrogate pair\n codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000\n } else if (leadSurrogate) {\n // valid bmp char, but last char was a lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n }\n\n leadSurrogate = null\n\n // encode utf8\n if (codePoint < 0x80) {\n if ((units -= 1) < 0) break\n bytes.push(codePoint)\n } else if (codePoint < 0x800) {\n if ((units -= 2) < 0) break\n bytes.push(\n codePoint >> 0x6 | 0xC0,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x10000) {\n if ((units -= 3) < 0) break\n bytes.push(\n codePoint >> 0xC | 0xE0,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x110000) {\n if ((units -= 4) < 0) break\n bytes.push(\n codePoint >> 0x12 | 0xF0,\n codePoint >> 0xC & 0x3F | 0x80,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else {\n throw new Error('Invalid code point')\n }\n }\n\n return bytes\n}\n\nfunction asciiToBytes (str) {\n var byteArray = []\n for (var i = 0; i < str.length; i++) {\n // Node's code seems to be doing this and not & 0x7F..\n byteArray.push(str.charCodeAt(i) & 0xFF)\n }\n return byteArray\n}\n\nfunction utf16leToBytes (str, units) {\n var c, hi, lo\n var byteArray = []\n for (var i = 0; i < str.length; i++) {\n if ((units -= 2) < 0) break\n\n c = str.charCodeAt(i)\n hi = c >> 8\n lo = c % 256\n byteArray.push(lo)\n byteArray.push(hi)\n }\n\n return byteArray\n}\n\nfunction base64ToBytes (str) {\n return base64.toByteArray(base64clean(str))\n}\n\nfunction blitBuffer (src, dst, offset, length) {\n for (var i = 0; i < length; i++) {\n if ((i + offset >= dst.length) || (i >= src.length)) break\n dst[i + offset] = src[i]\n }\n return i\n}\n\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(59).Buffer, (function() { return this; }())))\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/buffer/index.js\n ** module id = 59\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/buffer/index.js?"); },function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.annotations = exports.cameraEffects = exports.CamViewControls = exports.meshTools = exports.planes = exports.grids = undefined;\n\nvar _Grids = __webpack_require__(252);\n\nvar grids = _interopRequireWildcard(_Grids);\n\nvar _Planes = __webpack_require__(255);\n\nvar planes = _interopRequireWildcard(_Planes);\n\nvar _CamViewControls = __webpack_require__(263);\n\nvar _CamViewControls2 = _interopRequireDefault(_CamViewControls);\n\nvar _AnnotationVisual = __webpack_require__(22);\n\nvar _AnnotationVisual2 = _interopRequireDefault(_AnnotationVisual);\n\nvar _DistanceVisual = __webpack_require__(258);\n\nvar _DistanceVisual2 = _interopRequireDefault(_DistanceVisual);\n\nvar _NoteVisual = __webpack_require__(259);\n\nvar _NoteVisual2 = _interopRequireDefault(_NoteVisual);\n\nvar _DiameterVisual = __webpack_require__(257);\n\nvar _DiameterVisual2 = _interopRequireDefault(_DiameterVisual);\n\nvar _AngleVisual = __webpack_require__(256);\n\nvar _AngleVisual2 = _interopRequireDefault(_AngleVisual);\n\nvar _ThicknessVisual = __webpack_require__(260);\n\nvar _ThicknessVisual2 = _interopRequireDefault(_ThicknessVisual);\n\nvar _zoomInOn = __webpack_require__(261);\n\nvar _zoomInOn2 = _interopRequireDefault(_zoomInOn);\n\nvar _zoomToFit = __webpack_require__(262);\n\nvar _zoomToFit2 = _interopRequireDefault(_zoomToFit);\n\nvar _centerMesh = __webpack_require__(265);\n\nvar _centerMesh2 = _interopRequireDefault(_centerMesh);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }\n\n//import * as objectEffects from './objectEffects'\n\nvar annotations = { AnnotationVisual: _AnnotationVisual2.default, DistanceVisual: _DistanceVisual2.default, NoteVisual: _NoteVisual2.default, DiameterVisual: _DiameterVisual2.default, AngleVisual: _AngleVisual2.default, ThicknessVisual: _ThicknessVisual2.default };\n\n//import ZoomInOnObject from './objectEffects/zoomInOnObject'\n\nvar cameraEffects = { zoomInOn: _zoomInOn2.default, zoomToFit: _zoomToFit2.default };\n\nvar meshTools = { centerMesh: _centerMesh2.default };\n\nexports.grids = grids;\nexports.planes = planes;\nexports.meshTools = meshTools;\nexports.CamViewControls = _CamViewControls2.default;\nexports.cameraEffects = cameraEffects;\nexports.annotations = annotations;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/glView-helpers/lib/index.js\n ** module id = 60\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/glView-helpers/lib/index.js?")},function(module,exports,__webpack_require__){eval("/* WEBPACK VAR INJECTION */(function(module, global) {/**\n * lodash 3.0.1 (Custom Build) \n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright 2012-2016 The Dojo Foundation \n * Based on Underscore.js 1.8.3 \n * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n * Available under MIT license \n */\n\n/** Used to determine if values are of the language type `Object`. */\nvar objectTypes = {\n 'function': true,\n 'object': true\n};\n\n/** Detect free variable `exports`. */\nvar freeExports = (objectTypes[typeof exports] && exports && !exports.nodeType)\n ? exports\n : undefined;\n\n/** Detect free variable `module`. */\nvar freeModule = (objectTypes[typeof module] && module && !module.nodeType)\n ? module\n : undefined;\n\n/** Detect free variable `global` from Node.js. */\nvar freeGlobal = checkGlobal(freeExports && freeModule && typeof global == 'object' && global);\n\n/** Detect free variable `self`. */\nvar freeSelf = checkGlobal(objectTypes[typeof self] && self);\n\n/** Detect free variable `window`. */\nvar freeWindow = checkGlobal(objectTypes[typeof window] && window);\n\n/** Detect `this` as the global object. */\nvar thisGlobal = checkGlobal(objectTypes[typeof this] && this);\n\n/**\n * Used as a reference to the global object.\n *\n * The `this` value is used if it's the global object to avoid Greasemonkey's\n * restricted `window` object, otherwise the `window` object is used.\n */\nvar root = freeGlobal ||\n ((freeWindow !== (thisGlobal && thisGlobal.window)) && freeWindow) ||\n freeSelf || thisGlobal || Function('return this')();\n\n/**\n * Checks if `value` is a global object.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {null|Object} Returns `value` if it's a global object, else `null`.\n */\nfunction checkGlobal(value) {\n return (value && value.Object === Object) ? value : null;\n}\n\nmodule.exports = root;\n\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(37)(module), (function() { return this; }())))\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash._root/index.js\n ** module id = 61\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/lodash._root/index.js?")},function(module,exports){eval("'use strict';\n\nvar proto = Element.prototype;\nvar vendor = proto.matches\n || proto.matchesSelector\n || proto.webkitMatchesSelector\n || proto.mozMatchesSelector\n || proto.msMatchesSelector\n || proto.oMatchesSelector;\n\nmodule.exports = match;\n\n/**\n * Match `el` to `selector`.\n *\n * @param {Element} el\n * @param {String} selector\n * @return {Boolean}\n * @api public\n */\n\nfunction match(el, selector) {\n if (vendor) return vendor.call(el, selector);\n var nodes = el.parentNode.querySelectorAll(selector);\n for (var i = 0; i < nodes.length; i++) {\n if (nodes[i] == el) return true;\n }\n return false;\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/matches-selector/index.js\n ** module id = 62\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/matches-selector/index.js?")},function(module,exports,__webpack_require__){eval("module.exports = __webpack_require__(96)\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/usco-utils/utils.js\n ** module id = 63\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/usco-utils/utils.js?")},function(module,exports){eval('"use strict";\nvar ScopeChecker = (function () {\n function ScopeChecker(scope, isolateModule) {\n this.scope = scope;\n this.isolateModule = isolateModule;\n }\n ScopeChecker.prototype.isStrictlyInRootScope = function (leaf) {\n for (var el = leaf; el; el = el.parentElement) {\n var scope = this.isolateModule.isIsolatedElement(el);\n if (scope && scope !== this.scope) {\n return false;\n }\n if (scope) {\n return true;\n }\n }\n return true;\n };\n return ScopeChecker;\n}());\nexports.ScopeChecker = ScopeChecker;\n//# sourceMappingURL=ScopeChecker.js.map\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/@cycle/dom/lib/ScopeChecker.js\n ** module id = 64\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/@cycle/dom/lib/ScopeChecker.js?')},function(module,exports,__webpack_require__){eval('"use strict";\nvar xstream_adapter_1 = __webpack_require__(23);\nvar xstream_1 = __webpack_require__(19);\nfunction createVTree(vnode, children) {\n return {\n sel: vnode.sel,\n data: vnode.data,\n text: vnode.text,\n elm: vnode.elm,\n key: vnode.key,\n children: children,\n };\n}\nfunction makeTransposeVNode(runStreamAdapter) {\n return function transposeVNode(vnode) {\n if (!vnode) {\n return null;\n }\n else if (vnode && typeof vnode.data === "object" && vnode.data.static) {\n return xstream_1.default.of(vnode);\n }\n else if (runStreamAdapter.isValidStream(vnode)) {\n var xsStream = xstream_adapter_1.default.adapt(vnode, runStreamAdapter.streamSubscribe);\n return xsStream.map(transposeVNode).flatten();\n }\n else if (typeof vnode === "object") {\n if (!vnode.children || vnode.children.length === 0) {\n return xstream_1.default.of(vnode);\n }\n var vnodeChildren = vnode.children\n .map(transposeVNode)\n .filter(function (x) { return x !== null; });\n if (vnodeChildren.length === 0) {\n return xstream_1.default.of(createVTree(vnode, []));\n }\n else {\n return xstream_1.default.combine.apply(xstream_1.default, vnodeChildren)\n .map(function (children) { return createVTree(vnode, children.slice()); });\n }\n }\n else {\n throw new Error("Unhandled vTree Value");\n }\n };\n}\nexports.makeTransposeVNode = makeTransposeVNode;\n//# sourceMappingURL=transposition.js.map\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/@cycle/dom/lib/transposition.js\n ** module id = 65\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/@cycle/dom/lib/transposition.js?')},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = renderProgressBar;\n\nvar _dom = __webpack_require__(18);\n\n__webpack_require__(342);\n\nfunction renderProgressBar(state) {\n var defaults = {\n progress: 0,\n hideOnDone: true\n };\n\n var _Object$assign = Object.assign({}, defaults, state);\n\n var progress = _Object$assign.progress;\n var hideOnDone = _Object$assign.hideOnDone;\n\n\n var element = hideOnDone && progress === 100 ? (0, _dom.h)('div') : (0, _dom.h)('div.progressBar', [(0, _dom.h)('span.fill', { style: { width: progress + '%' } })]);\n return element;\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/widgets/ProgressBar/index.js\n ** module id = 66\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/widgets/ProgressBar/index.js?")},function(module,exports){eval("'use strict';\n\n/**\n * @author alteredq / http://alteredqualia.com/\n * @author mr.doob / http://mrdoob.com/\n */\n\n/*var window = window || {CanvasRenderingContext2D:false,WebGLRenderingContext:false,Worker:undefined,File:undefined,\nFileReader:undefined,FileList:undefined, Blob:undefined }*/\n\nvar Detector = {\n\n canvas: !!window.CanvasRenderingContext2D,\n webgl: function () {\n try {\n return !!window.WebGLRenderingContext && !!document.createElement('canvas').getContext('experimental-webgl');\n } catch (e) {\n return false;\n }\n }(),\n workers: !!window.Worker,\n fileapi: window.File && window.FileReader && window.FileList && window.Blob\n\n};\n\nmodule.exports = Detector;\n\nfunction getWebGLErrorMessage() {\n\n var domElement = document.createElement('div');\n\n domElement.style.fontFamily = 'monospace';\n domElement.style.fontSize = '13px';\n domElement.style.textAlign = 'center';\n domElement.style.background = '#eee';\n domElement.style.color = '#000';\n domElement.style.padding = '1em';\n domElement.style.width = '475px';\n domElement.style.margin = '5em auto 0';\n\n if (!this.webgl) {\n\n domElement.innerHTML = window.WebGLRenderingContext ? ['Sorry, your graphics card doesn\\'t support WebGL'].join('\\n') : ['Sorry, your browser doesn\\'t support WebGL
', 'Please try with', 'Chrome, ', 'Firefox 4 or', 'Webkit Nightly (Mac)'].join('\\n');\n }\n\n return domElement;\n}\n\nfunction addGetWebGLMessage(parameters) {\n\n var parent, id, domElement;\n\n parameters = parameters || {};\n\n parent = parameters.parent !== undefined ? parameters.parent : document.body;\n id = parameters.id !== undefined ? parameters.id : 'oldie';\n\n domElement = Detector.getWebGLErrorMessage();\n domElement.id = id;\n\n parent.appendChild(domElement);\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/webgl/deps/Detector.js\n ** module id = 67\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/webgl/deps/Detector.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nexports.findSelectionRoot = findSelectionRoot;\nexports.getCoordsFromPosSizeRect = getCoordsFromPosSizeRect;\nexports.pick = pick;\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nvar _Projector = __webpack_require__(148);\n\nvar _Projector2 = _interopRequireDefault(_Projector);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction isRootNode(node) {\n return node.selectTrickleUp === false && node.selectable === true;\n}\n\nfunction walkUp(node, checker) {\n if (node) {\n if (checker(node)) {\n return node;\n }\n if (node.parent) {\n return walkUp(node.parent, checker);\n }\n }\n return undefined;\n}\n\nfunction findSelectionRoot(node) {\n return walkUp(node, isRootNode);\n}\n\nfunction getCoordsFromPosSizeRect(inputs) {\n var pos = inputs.pos;\n var rect = inputs.rect;\n var width = inputs.width;\n var height = inputs.height;\n\n var x = (pos.x - rect.left) / width * 2 - 1;\n var y = -((pos.y - rect.top) / height) * 2 + 1;\n //v = new THREE.Vector3((x / this.viewWidth) * 2 - 1, -(y / this.viewHeight) * 2 + 1, 1)\n return { x: x, y: y };\n}\n\nfunction pick(mouseCoords, camera, hiearchyRoot) {\n var ortho = arguments.length <= 3 || arguments[3] === undefined ? false : arguments[3];\n var precision = arguments.length <= 4 || arguments[4] === undefined ? 10 : arguments[4];\n var x = mouseCoords.x;\n var y = mouseCoords.y;\n\n var mousecoords = new _three2.default.Vector3(x, y, 0.5);\n var v = mousecoords;\n var intersects = [];\n\n if (!ortho) {\n v.unproject(camera);\n var fooV = v.clone();\n var raycaster = new _three2.default.Raycaster(camera.position, v.sub(camera.position).normalize());\n //raycaster.precision = 10\n intersects = raycaster.intersectObjects(hiearchyRoot, true);\n } else {\n // use picking ray since it's an orthographic camera\n //var ray = this.projector.pickingRay( v, this.camera )\n //intersects = ray.intersectObjects( this.hiearchyRoot, true )\n //see here:\n _three2.default.Vector3.prototype.pickingRay = function (camera) {\n var tan = Math.tan(0.5 * _three2.default.Math.degToRad(camera.fov)) / camera.zoom;\n\n this.x *= tan * camera.aspect;\n this.y *= tan;\n this.z = -1;\n return this.transformDirection(camera.matrixWorld);\n };\n\n var _raycaster = new _three2.default.Raycaster();\n v.pickingRay(camera);\n _raycaster.set(camera.position, v);\n intersects = _raycaster.intersectObjects(hiearchyRoot, true);\n }\n\n //remove invisibles, dedupe ??\n //TODO: use transducers.js ?\n intersects = intersects.filter(function (intersect) {\n return intersect.object && intersect.object.visible === true;\n }) //&& intersect.object.pickable)\n .sort(function (a, b) {\n return a.distance - b.distance;\n });\n //.reverse()\n\n return intersects;\n}\n\nvar Selector = function () {\n function Selector() {\n _classCallCheck(this, Selector);\n\n this.projector = new _three2.default.Projector();\n this.camera = undefined;\n //for camera\n this.isOrtho = false;\n }\n\n /*pick(event, rect, width, height, scene){\n event.preventDefault()\n //console.log(\"rect, width, height\",rect, width, height)\n var x = ( (event.clientX - rect.left) / width) * 2 - 1\n var y = - ( (event.clientY - rect.top) / height) * 2 + 1\n this.hiearchyRoot = scene.children\n return this._pickInner( x, y, null, this.camera)\n }*/\n\n _createClass(Selector, [{\n key: 'pickAlt',\n value: function pickAlt(pos, rect, width, height, scene) {\n //console.log(\"rect, width, height\",rect, width, height)\n var x = (pos.x - rect.left) / width * 2 - 1;\n var y = -((pos.y - rect.top) / height) * 2 + 1;\n\n this.hiearchyRoot = scene.children;\n\n return this._pickInner(x, y, null, this.camera);\n }\n }, {\n key: '_pickInner',\n value: function _pickInner(x, y, isOrtho, camera) {\n isOrtho = isOrtho || this.isOrtho;\n camera = camera || this.camera;\n var mousecoords = new _three2.default.Vector3(x, y, 0.5);\n\n var intersects = [];\n //v = new THREE.Vector3((x / this.viewWidth) * 2 - 1, -(y / this.viewHeight) * 2 + 1, 1)\n var v = mousecoords;\n if (!isOrtho) {\n v.unproject(camera);\n var v1 = v.clone();\n var fooV = v.clone();\n var raycaster = new _three2.default.Raycaster(camera.position, v.sub(camera.position).normalize());\n //raycaster.precision = 10\n intersects = raycaster.intersectObjects(this.hiearchyRoot, true);\n } else {\n // use picking ray since it's an orthographic camera\n //var ray = this.projector.pickingRay( v, this.camera )\n //intersects = ray.intersectObjects( this.hiearchyRoot, true )\n //see here:\n _three2.default.Vector3.prototype.pickingRay = function (camera) {\n var tan = Math.tan(0.5 * _three2.default.Math.degToRad(camera.fov)) / camera.zoom;\n\n this.x *= tan * camera.aspect;\n this.y *= tan;\n this.z = -1;\n\n return this.transformDirection(camera.matrixWorld);\n };\n\n var _raycaster2 = new _three2.default.Raycaster();\n v.pickingRay(this.camera);\n _raycaster2.set(this.camera.position, v);\n intersects = _raycaster2.intersectObjects(this.hiearchyRoot, true);\n }\n\n //remove invisibles, dedupe\n //TODO: use transducers.js\n intersects = intersects.sort().filter(function (intersect, pos) {\n return intersect.object && intersect.object.visible === true && !pos || intersect != intersects[pos - 1];\n });\n\n return intersects;\n\n /*\n mousecoords.unproject(camera)\n raycaster.ray.set( camera.position, mousecoords.sub( camera.position ).normalize() )\n var intersections = raycaster.intersectObjects( this._THREEObject3D.children, true )\n var firstintersection = ( intersections.length ) > 0 ? intersections[ 0 ] : null\n if (firstintersection !== null) {\n var pickobject = firstintersection.object\n if (typeof pickobject.userData !== 'undefined' &&\n typeof pickobject.userData.props.onPick === 'function') {\n pickobject.userData.props.onPick(event, firstintersection)\n }\n }*/\n }\n }]);\n\n return Selector;\n}();\n\nexports.default = Selector;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/webgl/deps/Selector.js\n ** module id = 68\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/webgl/deps/Selector.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"]) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); } }; }();\n\nexports.positionFromCoords = positionFromCoords;\nexports.targetObject = targetObject;\nexports.isTransformTool = isTransformTool;\nexports.selectionAt = selectionAt;\nexports.meshFrom = meshFrom;\nexports.makeCamera = makeCamera;\nexports.makeControls = makeControls;\nexports.makeLight = makeLight;\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nvar _OrbitControls = __webpack_require__(147);\n\nvar _OrbitControls2 = _interopRequireDefault(_OrbitControls);\n\nvar _CombinedCamera = __webpack_require__(146);\n\nvar _CombinedCamera2 = _interopRequireDefault(_CombinedCamera);\n\nvar _ramda = __webpack_require__(4);\n\nvar _Selector = __webpack_require__(68);\n\nvar _assign = __webpack_require__(7);\n\nvar _assign2 = _interopRequireDefault(_assign);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n// faster object.assign\n\nfunction positionFromCoords(coords) {\n return { position: { x: coords.x, y: coords.y }, event: coords };\n}\nfunction targetObject(event) {\n return event.target.object;\n}\nfunction isTransformTool(input) {\n return ['translate', 'rotate', 'scale', null, undefined].indexOf(input) > -1;\n}\n\nfunction selectionAt(event, mouseCoords, camera, hiearchyRoot) {\n // log.debug(\"selection at\",event)\n // , container, selector, width, height, rootObject\n\n // let intersects = selector.pickAlt({x:event.clientX,y:event.clientY}, rect, width, height, rootObject)\n var intersects = (0, _Selector.pick)(mouseCoords, camera, hiearchyRoot); // , ortho = false, precision=10)\n\n var outEvent = {};\n outEvent.clientX = event.clientX;\n outEvent.clientY = event.clientY;\n outEvent.offsetX = event.offsetX;\n outEvent.offsetY = event.offsetY;\n outEvent.x = event.x || event.clientX;\n outEvent.y = event.y || event.clientY;\n\n outEvent.detail = {};\n outEvent.detail.pickingInfos = intersects;\n return outEvent;\n}\n\nfunction meshFrom(event) {\n var mesh = void 0;\n if (event && event.detail && event.detail.pickingInfos) {\n var _take = (0, _ramda.take)(1, event.detail.pickingInfos);\n\n var _take2 = _slicedToArray(_take, 1);\n\n var intersect = _take2[0]; // we actually only get the best match => DO NOT MODIFY original object\n\n if (intersect && intersect.object) {\n mesh = (0, _Selector.findSelectionRoot)(intersect.object); // now we make sure that what we have is actually selectable\n }\n }\n return mesh;\n}\n\n// //////////Various \"making\" functions , data/config in, (3d object) instances out\n// yup, like factories ! yikes !\n\n/* create a camera instance from the provided data*/\nfunction makeCamera(cameraData, params) {\n // let cameraData = cameraData//TODO: merge with defaults using object.assign\n var DEFAULTS = {\n width: 320,\n height: 240,\n lens: {\n fov: 45,\n near: 0.1,\n far: 20000\n },\n aspect: 320 / 240,\n up: [0, 0, 1],\n pos: [0, 0, 0]\n };\n cameraData = (0, _assign2.default)({}, DEFAULTS, cameraData);\n\n var camera = new _CombinedCamera2.default(cameraData.width, cameraData.height, cameraData.lens.fov, cameraData.lens.near, cameraData.lens.far, cameraData.lens.near, cameraData.lens.far);\n\n camera.up.fromArray(cameraData.up);\n camera.position.fromArray(cameraData.pos);\n return camera;\n}\n\n/* setup a controls instance from the provided data*/\nfunction makeControls(controlsData) {\n var up = new _three2.default.Vector3().fromArray(controlsData.up);\n\n // controlsData = controlsData//TODO: merge with defaults using object.assign\n var controls = new _OrbitControls2.default(undefined, undefined, up);\n controls.upVector = up;\n\n controls.userPanSpeed = controlsData.panSpeed;\n controls.userZoomSpeed = controlsData.zoomSpeed;\n controls.userRotateSpeed = controlsData.rotateSpeed;\n\n controls.autoRotate = controlsData.autoRotate.enabled;\n controls.autoRotateSpeed = controlsData.autoRotate.speed;\n\n return controls;\n}\n\n/* create a light instance from the provided data*/\nfunction makeLight(lightData) {\n var light = void 0;\n var DEFAULTS = {\n color: '#FFF',\n intensity: 1,\n pos: [0, 0, 0]\n };\n lightData = (0, _assign2.default)({}, DEFAULTS, lightData);\n\n switch (lightData.type) {\n case 'light':\n light = new _three2.default.Light(lightData.color);\n light.intensity = lightData.intensity;\n break;\n case 'hemisphereLight':\n light = new _three2.default.HemisphereLight(lightData.color, lightData.gndColor, lightData.intensity);\n break;\n case 'ambientLight':\n // ambient light does not have intensity, only color\n var newColor = new _three2.default.Color(lightData.color);\n newColor.r *= lightData.intensity;\n newColor.g *= lightData.intensity;\n newColor.b *= lightData.intensity;\n light = new _three2.default.AmbientLight(newColor);\n break;\n case 'directionalLight':\n var dirLightDefaults = {\n castShadow: false,\n onlyShadow: false,\n\n shadowMapWidth: 2048,\n shadowMapHeight: 2048,\n shadowCameraLeft: -500,\n shadowCameraRight: 500,\n shadowCameraTop: 500,\n shadowCameraBottom: -500,\n shadowCameraNear: 1200,\n shadowCameraFar: 5000,\n shadowCameraFov: 50,\n shadowBias: 0.0001,\n shadowDarkness: 0.3,\n shadowCameraVisible: false\n };\n lightData = (0, _assign2.default)({}, dirLightDefaults, lightData);\n light = new _three2.default.DirectionalLight(lightData.color, lightData.intensity);\n for (var key in lightData) {\n if (light.hasOwnProperty(key)) {\n light[key] = lightData[key];\n }\n }\n\n break;\n default:\n throw new Error('could not create light');\n }\n\n light.position.fromArray(lightData.pos);\n\n return light;\n}\n\nfunction cameraWobble3dHint(camera) {\n var time = arguments.length <= 1 || arguments[1] === undefined ? 1500 : arguments[1];\n\n var camPos = camera.position.clone();\n var target = camera.position.clone().add(new _three2.default.Vector3(-5, -10, -5));\n\n var tween = new TWEEN.Tween(camPos).to(target, time).repeat(Infinity).delay(500).yoyo(true).easing(TWEEN.Easing.Cubic.InOut).onUpdate(function () {\n camera.position.copy(camPos);\n }).start();\n\n // let camRot = camera.rotation.clone()\n // let rtarget = camera.rotation.clone().add(new THREE.Vector3(50,50,50))\n\n /* let tween2 = new TWEEN.Tween( camRot )\n .to( rtarget , time )\n .repeat( Infinity )\n .delay( 500 )\n .yoyo(true)\n .easing( TWEEN.Easing.Quadratic.InOut )\n .onUpdate( function () {\n camera.position.copy(camRot)\n } )\n .start()*/\n return tween;\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/webgl/utils2.js\n ** module id = 69\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/webgl/utils2.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.partMesh = partMesh;\nexports.partSource = partSource;\nexports.other = other;\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nvar _utils = __webpack_require__(21);\n\nvar _dragAndDrop = __webpack_require__(216);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar merge = _rx2.default.Observable.merge;\nfunction partMesh(DOM, params) {\n var dragOvers$ = DOM.select(':root').events('dragover');\n var drops$ = DOM.select(':root').events('drop');\n var dnd$ = (0, _dragAndDrop.observableDragAndDrop)(dragOvers$, drops$);\n\n // drag & drop sources\n var dndMeshFiles$ = dnd$.filter(function (e) {\n return e.type === 'file';\n }).pluck('data');\n var dndMeshUris$ = dnd$.filter(function (e) {\n return e.type === 'url';\n }).pluck('data');\n\n return (0, _utils.filterByExtensions)(merge(dndMeshFiles$, dndMeshUris$), params.get('extensions', 'meshes'));\n // .map(data =>( {src:'desktop', uri:data.name} ) )\n}\n\nfunction partSource(DOM, params) {\n var dragOvers$ = DOM.select(':root').events('dragover');\n var drops$ = DOM.select(':root').events('drop');\n var dnd$ = (0, _dragAndDrop.observableDragAndDrop)(dragOvers$, drops$);\n\n // drag & drop sources\n var dndSourceFiles$ = dnd$.filter(function (e) {\n return e.type === 'file';\n }).pluck('data');\n var dndSourceUris$ = dnd$.filter(function (e) {\n return e.type === 'url';\n }).pluck('data');\n\n return (0, _utils.filterByExtensions)(merge(dndSourceFiles$, dndSourceUris$), params.get('extensions', 'sources'));\n // .map(data => ( {src:'desktop', uri:data.name} ) )\n}\n\nfunction other(DOM, params) {\n var dragOvers$ = DOM.select(':root').events('dragover');\n var drops$ = DOM.select(':root').events('drop');\n var dnd$ = (0, _dragAndDrop.observableDragAndDrop)(dragOvers$, drops$);\n\n // drag & drop sources\n var dndOtherFiles$ = dnd$.filter(function (e) {\n return e.type === 'file';\n }).pluck('data');\n var dndOtherUris$ = dnd$.filter(function (e) {\n return e.type === 'url';\n }).pluck('data');\n\n return (0, _utils.filterByExtensions)(merge(dndOtherFiles$, dndOtherUris$), params.get('extensions', 'other'));\n // .map(data => ( {src:'desktop', uri:data.name} ) )\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/sources/DOM.js\n ** module id = 70\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/sources/DOM.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.partMesh = partMesh;\nexports.partSource = partSource;\nexports.other = other;\n\nvar _utils = __webpack_require__(21);\n\nfunction partMesh(addressbar, params) {\n return (0, _utils.filterByExtensions)(addressbar.get('modelUrl'), params.get('extensions', 'meshes'));\n // .map(data => ({src:'http', uri:data}) )\n}\n\nfunction partSource(addressbar, params) {\n return (0, _utils.filterByExtensions)(addressbar.get('sourceUrl'), params.get('extensions', 'sources'));\n // .map(data => ({src:'http', uri:data}) )\n}\n\n// for other formats like gcode etc\nfunction other(addressbar, params) {\n return (0, _utils.filterByExtensions)(addressbar.get('sourceUrl'), params.get('extensions', 'other'));\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/sources/addressbar.js\n ** module id = 71\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/sources/addressbar.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.partMesh = partMesh;\nexports.partSource = partSource;\n\nvar _utils = __webpack_require__(21);\n\nfunction partMesh(postMessage$, params) {\n return (0, _utils.filterByExtensions)(postMessage$.pluck('data').filter(_utils.hasModelUrl).pluck('modelUrl').map(function (data) {\n return [data];\n }) // always return array\n , params.get('extensions', 'meshes')); // we only let actual mesh \"data\" through\n // .map(data => ( {src:'http', uri:data} ) )\n}\n\nfunction partSource(postMessage$, params) {\n return (0, _utils.filterByExtensions)(postMessage$.pluck('data').filter(_utils.hasModelUrl).pluck('sourceUrl').map(function (data) {\n return [data];\n }) // always return array\n\n , params.get('extensions', 'sources')); // we only let actual sources \"data\" through\n // .map(data => ( {src:'http', uri:data} ) )\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/sources/postMessage.js\n ** module id = 72\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/sources/postMessage.js?"); -},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.keycodes = undefined;\nexports.isValidElementEvent = isValidElementEvent;\nexports.preventBackNavigation = preventBackNavigation;\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar keycodes = exports.keycodes = {\n 8: 'backspace', 46: 'delete',\n 48: '0', 49: '1', 50: '2', 51: '3', 52: '4', 53: '5', 54: '6', 55: '7', 56: '8', 57: '9',\n 65: 'a', 66: 'b', 67: 'c', 68: 'd', 69: 'e', 70: 'f', 71: 'g',\n 72: 'h', 73: 'i', 74: 'j', 75: 'k', 76: 'l', 77: 'm', 78: 'n',\n 79: 'o', 80: 'p', 81: 'q', 82: 'r', 83: 's', 84: 't', 85: 'u',\n 86: 'v', 87: 'w', 88: 'x', 89: 'y', 90: 'z'\n};\n\n/*\nfunction setKeyBidings( element ){\n //based on http://qiita.com/jdeseno/items/72e12a5fa815b52f95e2\n */\n\nfunction isValidElementEvent(event) {\n var element = event.target || event.srcElement;\n return !(element.tagName === 'INPUT' || element.tagName === 'SELECT' || element.tagName === 'TEXTAREA' || element.isContentEditable);\n}\n\nfunction preventBackNavigation() {\n // disable backspace navigation for MacOs\n _rx2.default.Observable.fromEvent(document, 'keydown').map(function (e) {\n return { event: e, key: keycodes[e.keyCode] };\n }).filter(function (e) {\n return e.key === 'backspace';\n }).tap(function (_ref) {\n var event = _ref.event;\n\n var d = event.srcElement || event.target;\n var tagName = d.tagName.toUpperCase();\n var type = d.type ? d.type.toUpperCase() : undefined;\n var validElements = ['TEXT', 'PASSWORD', 'FILE', 'SEARCH', 'EMAIL', 'NUMBER', 'DATE'];\n\n if (!(tagName === 'INPUT' && validElements.indexOf(type) > -1 || tagName === 'TEXTAREA')) {\n event.preventDefault();\n return false;\n }\n }).forEach(function (e) {\n return e;\n });\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/interactions/keyboard.js\n ** module id = 73\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/interactions/keyboard.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.clicks = clicks;\nexports.interactionsFromEvents = interactionsFromEvents;\nexports.interactionsFromCEvents = interactionsFromCEvents;\nexports.pointerInteractions = pointerInteractions;\nexports.preventScroll = preventScroll;\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nvar _obsUtils = __webpack_require__(5);\n\nvar _utils = __webpack_require__(217);\n\nvar _assign = __webpack_require__(7);\n\nvar _assign2 = _interopRequireDefault(_assign);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar _Rx$Observable = _rx2.default.Observable;\nvar fromEvent = _Rx$Observable.fromEvent;\nvar merge = _Rx$Observable.merge;\nvar empty = _Rx$Observable.empty;\nvar just = _Rx$Observable.just;\n// faster object.assign\n\n// various helpers\nfunction hasTwoTouchPoints(event) {\n return event.touches && event.touches.length === 2;\n}\n\nfunction getOffset(event) {\n return {\n x: event.offsetX === undefined ? event.layerX : event.offsetX,\n y: event.offsetY === undefined ? event.layerY : event.offsetY\n };\n}\n\nfunction isMoving(moveDelta, deltaSqr) {\n return true;\n /* let distSqr = (moveDelta.x * moveDelta.x + moveDelta.y * moveDelta.y)\n let isMoving = (distSqr > deltaSqr)\n // console.log(\"moving\",isMoving)\n return isMoving*/\n}\n\nfunction isStatic(moveDelta, deltaSqr) {\n return !isMoving(moveDelta);\n}\n\n// TODO ,: regroup / refactor all \"delta\" operation ?\nfunction isShort(elapsed, maxTime) {\n return elapsed < maxTime;\n}\n\nfunction isLong(elapsed, maxTime) {\n return elapsed > maxTime;\n}\n\nfunction clicks(mouseDowns, mouseUps, mouseMoves) {\n var timing = arguments.length <= 3 || arguments[3] === undefined ? 200 : arguments[3];\n var deltaSqr = arguments[4];\n\n /*\n \"pseudo click\" that does not trigger when there was\n a mouse movement\n */\n var fakeClicksOld = mouseDowns.flatMap(function (md) {\n var start = { x: md.clientX, y: md.clientY };\n\n // get only valid moves\n var mMoves = mouseMoves.map(false).bufferWithTimeOrCount(timing, 1).filter(function (x) {\n return x.length === 1;\n }).map(function (x) {\n return x[0];\n });\n\n var __moves = mMoves.merge(just(true)); // default to true\n\n return __moves.combineLatest(mouseUps, function (m, mu) {\n // log.info(m, mu)\n var end = { x: mu.clientX, y: mu.clientY };\n return isStatic({ start: start, end: end }, deltaSqr); // allow for small movement (shaky hands!)\n }).takeUntil(mouseUps).filter(function (x) {\n return x === true;\n });\n });\n\n var fakeClicks = mouseDowns.flatMap(function (downEvent) {\n var target = downEvent.currentTarget;\n return _rx2.default.Observable.amb([\n // Skip if we get a movement before a mouse up\n mouseMoves.take(1).flatMap(function (x) {\n return empty();\n }), mouseUps.take(1)]); // .map(function(event){console.log(event) return event})\n });\n\n return fakeClicks;\n}\n\nfunction altMouseMoves(mouseMoves) {\n return mouseMoves.skip(1).zip(mouseMoves, function (a, b) {\n var data = {\n client: {\n x: a.clientX,\n y: a.clientY\n },\n delta: { x: a.clientX - b.clientX, y: a.clientY - b.clientY }\n };\n\n return (0, _assign2.default)(data, b);\n });\n}\n\n/* alternative \"clicks\" (ie mouseDown -> mouseUp ) implementation, with more fine\ngrained control*/\nfunction taps(mouseDowns, mouseUps, mouseMoves) {\n var longPressDelay = arguments.length <= 3 || arguments[3] === undefined ? 800 : arguments[3];\n var deltaSqr = arguments[4];\n\n // only doing any \"clicks if the time between mDOWN and mUP is below longpressDelay\"\n // any small mouseMove is ignored (shaky hands)\n return mouseDowns.flatMap(function (downEvent) {\n var target = downEvent.currentTarget;\n // const startTime = Date.now()//TODO: use time difference to determine if it was a short or a long tap ?\n\n return _rx2.default.Observable.amb([\n // Skip if we get a movement before a mouse up\n mouseMoves.filter(function (data) {\n return isMoving(data.delta, deltaSqr);\n }) // allow for small movement (shaky hands!)\n .take(1).flatMap(function (x) {\n return empty();\n }).timeInterval(), mouseUps.take(1).timeInterval()]); // .timeout(longPressDelay, empty())\n });\n}\n\n/* this emits events whenever pointers are held */\nfunction holds(mouseDowns, mouseUps, mouseMoves) {\n var longPressDelay = arguments.length <= 3 || arguments[3] === undefined ? 800 : arguments[3];\n var deltaSqr = arguments[4];\n\n return mouseDowns.flatMap(function (downEvent) {\n var target = downEvent.currentTarget;\n return _rx2.default.Observable.amb([\n // Skip if we get a movement before timeout\n mouseMoves.filter(function (data) {\n return isMoving(data.delta, deltaSqr);\n }) // allow for small movement (shaky hands!)\n .take(1).flatMap(function (x) {\n return empty();\n }),\n\n // Skip if we get a mouseup before main timeout\n mouseUps.take(1).flatMap(function (x) {\n return empty();\n }), just(2).delay(longPressDelay).timeout(longPressDelay, just(downEvent))]);\n // .timeout(longPressDelay, empty())\n });\n}\n\n/* function drags(mouseDowns, mouseUps, mouseMoves, longPressDelay=800, deltaSqr){\n return mouseDowns\n .flatMap( function(downEvent){\n let target = downEvent.currentTarget\n //let origin = target.position()\n log.info(\"kldf\")\n return Observable.amb(\n [\n // Skip if we get a mouse up before we move\n mouseUps.take(1).flatMap( x => empty() ),\n\n mouseMoves.take(1).map(function(x){\n return{\n target: target,\n //origin: target.position(),\n drags: mouseMoves.takeUntil(mouseUps).map(function(x){\n return {\n delta: x.delta,\n offset: {\n x: x.client.x - downEvent.clientX,\n y: x.client.y - downEvent.clientY\n }\n }\n })\n }\n })\n\n ])\n\n })\n}\n\n//this one just works by dispatching at the end of the movement\nfunction drags2(mouseDowns, mouseUps, mouseMoves, longPressDelay=800, deltaSqr){\n return mouseDowns.flatMap(function (md) {\n var start = { x: md.clientX, y: md.clientY }\n return mouseMoves.combineLatest(mouseUps, function (mm, mu) {\n //log.info(\"mm\",mm,\"mu\",mu)\n var stop = {x: mu.clientX, y: mu.clientY }\n return {\n start: start,\n end: stop\n }\n })\n //.delay(400)\n .takeUntil(mouseUps)\n })\n}\n*/\n\n// based on http://jsfiddle.net/mattpodwysocki/pfCqq/\nfunction drags3(mouseDowns$, mouseUps, mouseMoves) {\n var longPressDelay = arguments.length <= 3 || arguments[3] === undefined ? 800 : arguments[3];\n var deltaSqr = arguments[4];\n\n return mouseDowns$.flatMap(function (md) {\n // console.log(\"drags3 mousedown\",md)\n // calculate offsets when mouse down\n var startX = md.offsetX;\n var startY = md.offsetY;\n // Calculate delta with mousemove until mouseup\n return mouseMoves.map(function (e) {\n // console.log(\"drags3 mousemove\",mm)\n // (mm.preventDefault) ? mm.preventDefault() : mm.returnValue = false\n var delta = {\n left: e.clientX - startX,\n top: e.clientY - startY\n };\n // console.log(\"delta\",delta)\n return (0, _assign2.default)({}, e, delta);\n }).takeUntil(mouseUps);\n });\n}\n\nfunction touchDrags(touchStart$, touchEnd$, touchMove$) {\n return touchStart$.flatMap(function (ts) {\n var startX = ts.touches[0].pageX;\n var startY = ts.touches[0].pageY;\n\n return touchMove$.map(function (e) {\n var x = (e.touches[0].pageX - startX) / 5.0;\n var y = (e.touches[0].pageY - startY) / 5.0;\n\n var delta = {\n left: x,\n top: y,\n x: x,\n y: y };\n\n var output = (0, _assign2.default)({}, e, { delta: delta });\n return output;\n }).takeUntil(touchEnd$);\n });\n}\n\n// pinch, taken from https://github.com/hugobessaa/rx-react-pinch\nfunction pinches(touchstarts, touchmoves, touchEnds) {\n return touchStarts.do(_obsUtils.preventDefault).takeWhile(hasTwoTouchPoints).flatMap(function () {\n return touchMoves.pluck('scale').takeUntil(touchEnds);\n });\n}\n\nfunction interactionsFromEvents(targetEl) {\n var mouseDowns$ = fromEvent(targetEl, 'mousedown');\n var mouseUps$ = fromEvent(targetEl, 'mouseup');\n var mouseLeaves$ = fromEvent(targetEl, 'mouseleave').merge(fromCEvent(targetEl, 'mouseout'));\n var mouseMoves$ = altMouseMoves(fromEvent(targetEl, 'mousemove')).takeUntil(mouseLeaves$);\n var rightClicks$ = fromEvent(targetEl, 'contextmenu').do(_obsUtils.preventDefault); // disable the context menu / right click\n var zooms$ = fromEvent(targetEl, 'wheel');\n\n var touchStart$ = fromEvent('touchstart'); // dom.touchstart(window)\n var touchMove$ = fromEvent('touchmove'); // dom.touchmove(window)\n var touchEnd$ = fromEvent('touchend'); // dom.touchend(window)\n\n return {\n mouseDowns$: mouseDowns$,\n mouseUps$: mouseUps$,\n mouseMoves$: mouseMoves$,\n rightClicks$: rightClicks$,\n zooms$: zooms$,\n touchStart$: touchStart$,\n touchMoves$: touchMoves$,\n touchEnd$: touchEnd$ };\n}\n\n/* generate a hash of basic pointer/ mouse event observables*/\nfunction interactionsFromCEvents(targetEl) {\n var rTarget = arguments.length <= 1 || arguments[1] === undefined ? 'canvas' : arguments[1];\n\n /* function fromCEvent(targetEl, eventName){\n return targetEl.get(rTarget, eventName)\n }*/\n function fromCEvent(targetEl, eventName) {\n return targetEl.select(rTarget).events(eventName);\n }\n\n var mouseDowns$ = fromCEvent(targetEl, 'mousedown');\n var mouseUps$ = fromCEvent(targetEl, 'mouseup');\n var mouseLeaves$ = fromCEvent(targetEl, 'mouseleave').merge(fromCEvent(targetEl, 'mouseout'));\n var mouseMoves$ = altMouseMoves(fromCEvent(targetEl, 'mousemove')).takeUntil(mouseLeaves$);\n var rightClicks$ = fromCEvent(targetEl, 'contextmenu').do(_obsUtils.preventDefault); // disable the context menu / right click\n var zooms$ = fromCEvent(targetEl, 'wheel');\n\n var touchStart$ = fromCEvent(targetEl, 'touchstart'); // dom.touchstart(window)\n var touchMoves$ = fromCEvent(targetEl, 'touchmove'); // dom.touchmove(window)\n var touchEnd$ = fromCEvent(targetEl, 'touchend'); // dom.touchend(window)\n\n return {\n mouseDowns$: mouseDowns$,\n mouseUps$: mouseUps$,\n mouseMoves$: mouseMoves$,\n rightClicks$: rightClicks$,\n zooms$: zooms$,\n touchStart$: touchStart$,\n touchMoves$: touchMoves$,\n touchEnd$: touchEnd$ };\n}\n\nfunction pointerInteractions(baseInteractions) {\n var multiClickDelay = 250;\n var longPressDelay = 250;\n\n var minDelta = 25; // max 50 pixels delta\n var deltaSqr = minDelta * minDelta;\n\n var mouseDowns$ = baseInteractions.mouseDowns$;\n var mouseUps$ = baseInteractions.mouseUps$;\n var rightclicks$ = baseInteractions.rightclicks$;\n var mouseMoves$ = baseInteractions.mouseMoves$;\n var touchStart$ = baseInteractions.touchStart$;\n var touchMoves$ = baseInteractions.touchMoves$;\n var touchEnd$ = baseInteractions.touchEnd$;\n var zooms$ = baseInteractions.zooms$;\n\n // mouseMoves$.forEach(e=>console.log(\"mousemove\",e))\n\n // /// now setup the more complex interactions\n\n var taps$ = taps(merge(mouseDowns$, touchStart$), // mouse & touch interactions starts\n merge(mouseUps$, touchEnd$), // mouse & touch interactions ends\n mouseMoves$, longPressDelay, deltaSqr).share();\n\n var shortTaps$ = taps$.filter(function (e) {\n return e.interval <= longPressDelay;\n }).map(function (e) {\n return e.value;\n }).filter(function (event) {\n return 'button' in event && event.button === 0;\n }) // FIXME : bad filter !\n .buffer(function () {\n return taps$.debounce(multiClickDelay);\n }).map(function (list) {\n return { list: list, nb: list.length };\n }).share();\n\n // normalize zooms (should this be elsewhere ?)\n zooms$ = zooms$.map(_utils.normalizeWheel);\n\n // we get our custom right clicks\n var rightClicks2 = taps$.filter(function (event) {\n return 'button' in event && event.button === 2;\n });\n var holds$ = holds(mouseDowns$, mouseUps$, mouseMoves$, longPressDelay, deltaSqr);\n\n var shortSingleTaps$ = shortTaps$.filter(function (x) {\n return x.nb === 1;\n }).flatMap(function (e) {\n return e.list;\n });\n var shortDoubleTaps$ = shortTaps$.filter(function (x) {\n return x.nb === 2;\n }).flatMap(function (e) {\n return e.list;\n }).take(1).repeat();\n\n // static , long held taps, for context menus etc\n // longTaps: either HELD leftmouse/pointer or HELD right click //FIXME : needs to be \"UNTIL\" mouseUp\n // and not fire before mouseUp\n var longTaps$ = taps$.filter(function (e) {\n return e.interval > longPressDelay;\n }).map(function (e) {\n return e.value;\n }); // holds$.take(1).repeat()//.timeout(longPressDelay, empty())\n // .tap(e=>console.log(\"taps with LONG timeInterval\",e))\n\n // drag move interactions (continuously firing)\n var dragMoves$ = merge(drags3(mouseDowns$, mouseUps$, mouseMoves$, longPressDelay, deltaSqr), touchDrags(touchStart$, touchEnd$, touchMoves$)).takeUntil(longTaps$).repeat(); // no drag moves if there is a context action already taking place\n\n return {\n taps: taps$.map(function (e) {\n return e.value;\n }),\n shortSingleTaps$: shortSingleTaps$,\n shortDoubleTaps$: shortDoubleTaps$,\n longTaps$: longTaps$,\n dragMoves$: dragMoves$,\n zooms$: zooms$ };\n}\n\n// /////\nfunction preventScroll(targetEl) {\n fromEvent(targetEl, 'mousewheel').forEach(_obsUtils.preventDefault);\n fromEvent(targetEl, 'DOMMouseScroll').forEach(_obsUtils.preventDefault);\n fromEvent(targetEl, 'wheel').forEach(_obsUtils.preventDefault);\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/interactions/pointers.js\n ** module id = 74\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/interactions/pointers.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.windowResizes = windowResizes;\nexports.elementResizes = elementResizes;\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar Observable = _rx2.default.Observable;\nvar fromEvent = Observable.fromEvent;\n__webpack_require__(279);\n\n// window resize event stream, throttled by throttle amount (250ms default)\nfunction windowResizes() {\n var throttle = arguments.length <= 0 || arguments[0] === undefined ? 250 : arguments[0];\n\n // only get the fields we need\n function extractSize(x) {\n x = x.target;\n var bRect = { left: 0, top: 0, bottom: 0, right: 0, width: 0, height: 0 };\n if (x.getBoundingClientRect) bRect = x.getBoundingClientRect();\n\n var res = { width: x.innerWidth, height: x.innerHeight, aspect: x.innerWidth / x.innerHeight, bRect: bRect };\n return res;\n }\n\n var throttledWinResize = fromEvent(window, 'resize').throttle(throttle /* ms */).map(extractSize).startWith({ width: window.innerWidth, height: window.innerHeight, aspect: window.innerWidth / window.innerHeight, bRect: undefined });\n\n return throttledWinResize;\n}\n\nfunction elementResizes(element) {\n var throttle = arguments.length <= 1 || arguments[1] === undefined ? 250 : arguments[1];\n\n function extractSize(x) {\n x = x.target;\n var bRect = { left: 0, top: 0, bottom: 0, right: 0, width: 0, height: 0 };\n if (x.getBoundingClientRect) bRect = x.getBoundingClientRect();\n\n var res = { width: x.innerWidth, height: x.innerHeight, aspect: x.innerWidth / x.innerHeight, bRect: bRect };\n return res;\n }\n\n return _rx2.default.DOM.resize(element).throttle(throttle /* ms */).map(extractSize);\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/interactions/sizing.js\n ** module id = 75\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/interactions/sizing.js?")},function(module,exports,__webpack_require__){eval('\'use strict\';\n\nObject.defineProperty(exports, "__esModule", {\n value: true\n});\nexports.extractChanges = extractChanges;\nexports.extractChangesBetweenArrays = extractChangesBetweenArrays;\nexports.changesFromObservableArrays = changesFromObservableArrays;\nexports.changesFromObservableArrays2 = changesFromObservableArrays2;\nexports.transformEquals = transformEquals;\nexports.colorsEqual = colorsEqual;\nexports.entityVisualComparer = entityVisualComparer;\n\nvar _utils = __webpack_require__(3);\n\nfunction compareHash(obj) {\n if (obj.uuid) return obj.uuid;\n // return JSON.stringify(obj)\n // return typeof(obj)+obj.name\n}\n\nvar jsondiffpatch = __webpack_require__(17).create({ objectHash: compareHash });\n\nfunction extractChanges(prev, cur) {\n var delta = jsondiffpatch.diff(prev, cur);\n // console.log("delta",delta)\n var result = { added: [], removed: [], changed: [] };\n\n if (delta && \'_t\' in delta) {\n (function () {\n var removed = []; // delta["_0"][0]//delta[0][0]\n var added = []; // delta[0][0]//delta[0][1]\n\n Object.keys(delta).map(function (key) {\n // console.log("AAA",key)\n // "_t": "a", Array delta (member names indicate array indices)\n\n if (key[0] === \'_\') {\n if (key !== \'_a\' && key !== \'_t\') {\n removed.push(delta[key][0]);\n }\n } else {\n added.push(delta[key][0]);\n }\n });\n\n result.added = (0, _utils.toArray)(added).filter(function (i) {\n return i !== undefined;\n });\n result.removed = (0, _utils.toArray)(removed).filter(function (i) {\n return i !== undefined;\n });\n\n // console.log("added",result.added)\n // console.log("removed",result.removed)\n })();\n } else if (prev === undefined) {\n // not handled right in the above case for some reason ??\n result.added = cur;\n }\n\n return result;\n}\n\nvar instance = __webpack_require__(17).create({\n objectHash: function objectHash(obj, index) {\n if (typeof obj._id !== \'undefined\') {\n return obj._id;\n }\n if (typeof obj.id !== \'undefined\') {\n return obj.id;\n }\n if (typeof obj.name !== \'undefined\') {\n return obj.name;\n }\n return \'$$index:\' + index;\n }\n});\n// to ignore functions\ninstance.processor.pipes.diff.before(\'trivial\', function ignoreFunctionDiffFilter(context) {\n if (typeof context.left === \'function\' || typeof context.right === \'function\') {\n context.setResult(undefined);\n context.exit();\n }\n});\n\nfunction extractChangesBetweenArrays(prev, cur) {\n var delta = instance.diff(prev, cur);\n // console.log("delta",delta)\n // console.log("diff",delta)//JSON.stringify(delta, null, 2))\n\n var result = { added: [], removed: [], changed: [], upserted: [] };\n\n if (delta && \'_t\' in delta) {\n (function () {\n var removed = []; // delta["_0"][0]//delta[0][0]\n var added = []; // delta[0][0]//delta[0][1]\n var upserted = [];\n\n if (delta[\'_t\'] === \'a\') {\n // array diff\n // "_t": "a", Array delta (member names indicate array indices)\n Object.keys(delta).map(function (key) {\n if (key !== \'_t\') {\n if (key.length > 0 && key.indexOf(\'_\') > -1) {\n var realKey = parseInt(key.replace(\'_\', \'\'), 10);\n // console.log("removed",delta, realKey)//,key,delta)\n removed.push(prev[realKey]);\n } else {\n // added or changed\n // console.log("added or changed",delta, key)\n var _realKey = parseInt(key, 10);\n upserted.push(cur[_realKey]);\n }\n }\n });\n }\n result.added = (0, _utils.toArray)(added).filter(function (i) {\n return i !== undefined;\n });\n result.removed = (0, _utils.toArray)(removed).filter(function (i) {\n return i !== undefined;\n });\n result.upserted = (0, _utils.toArray)(upserted).filter(function (i) {\n return i !== undefined;\n });\n // console.log("added",result.added)\n // console.log("removed",result.removed)\n })();\n } else if (prev === undefined) {\n // not handled right in the above case for some reason ??\n result.upserted = cur;\n }\n\n return result;\n}\n\nfunction changesFromObservableArrays(data$) {\n return data$.scan(function (acc, cur) {\n return { cur: cur, prev: acc.cur };\n }, { prev: undefined, cur: undefined }).map(function (typeData) {\n var cur = typeData.cur;\n var prev = typeData.prev;\n\n var changes = extractChangesBetweenArrays(prev, cur);\n return changes;\n }).share();\n}\n\nfunction changesFromObservableArrays2(data$) {\n return data$.scan(function (acc, x) {\n var cur = x;\n var prev = acc.cur;\n\n cur = Object.keys(cur).map(function (key) {\n return cur[key];\n });\n return { cur: cur, prev: prev };\n }, { prev: undefined, cur: undefined }).map(function (typeData) {\n var cur = typeData.cur;\n var prev = typeData.prev;\n // console.log("diffing",cur,prev)\n\n var changes = extractChanges(prev, cur);\n return changes;\n }).share();\n}\n\nfunction transformEquals(a, b) {\n if (!a || !b) return true;\n for (var j = 0; j < a.length; j++) {\n if (a[j] !== b[j]) {\n return false;\n }\n }\n return true;\n}\n\nfunction colorsEqual(a, b) {\n if (!a || !b) return true;\n return a === b;\n}\n\nfunction entityVisualComparer(prev, cur) {\n // console.log("prev",prev,"cur",cur)\n\n if (!cur) {\n return false;\n }\n\n // compare lengths - can save a lot of time\n if (cur.length !== prev.length) {\n return false;\n }\n\n var sortedCur = cur.sort();\n var sortedPrev = prev.sort();\n for (var i = 0; i < cur.length; i++) {\n if (sortedCur[i].typeUid !== sortedPrev[i].typeUid) {\n return false;\n }\n\n if (sortedCur[i].id !== sortedPrev[i].id) {\n return false;\n }\n\n var curVal = sortedCur[i];\n var preVal = sortedPrev[i];\n\n /*\n sortedCur[i].color === sortedPrev[i].color\n )*/\n\n var posEq = transformEquals(curVal.pos, preVal.pos);\n var rotEq = transformEquals(curVal.rot, preVal.rot);\n var scaEq = transformEquals(curVal.sca, preVal.sca);\n var colEq = colorsEqual(curVal.color, preVal.color);\n var allEqual = posEq && rotEq && scaEq && colEq;\n if (!allEqual) return false;\n }\n\n return true;\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/utils/diffPatchUtils.js\n ** module id = 76\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/utils/diffPatchUtils.js?')},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _loglevel = __webpack_require__(274);\n\nvar _loglevel2 = _interopRequireDefault(_loglevel);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n// polygill for array.includes\nif (![].includes) {\n Array.prototype.includes = function (searchElement /*, fromIndex*/) {\n 'use strict';\n\n var O = Object(this);\n var len = parseInt(O.length) || 0;\n if (len === 0) {\n return false;\n }\n var n = parseInt(arguments[1]) || 0;\n var k;\n if (n >= 0) {\n k = n;\n } else {\n k = len + n;\n if (k < 0) {\n k = 0;\n }\n }\n var currentElement;\n while (k < len) {\n currentElement = O[k];\n if (searchElement === currentElement || searchElement !== searchElement && currentElement !== currentElement) {\n return true;\n }\n k++;\n }\n return false;\n };\n}\n\n// ////////////\nvar logMaker = function logMaker() {\n var prefix = arguments.length <= 0 || arguments[0] === undefined ? '' : arguments[0];\n var strLevel = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1];\n var timeStamp = arguments.length <= 2 || arguments[2] === undefined ? false : arguments[2];\n\n var log = {};\n var loglevel = 'warn';\n log.setLevel = function (level) {\n loglevel = level;\n };\n\n log.trace = function () {\n var context = prefix;\n if (strLevel) context += 'TRACE:';\n if (timeStamp) {\n var tStamp = new Date().toTimeString().slice(0, 8);\n context += tStamp;\n }\n if (!['trace'].includes(loglevel)) return new Function();\n return Function.prototype.bind.call(console.trace, console, context);\n }();\n log.debug = function () {\n var context = prefix;\n if (strLevel) context += 'DEBUG:';\n if (timeStamp) {\n var tStamp = new Date().toTimeString().slice(0, 8);\n context += tStamp;\n }\n if (!['trace', 'debug'].includes(loglevel)) return new Function();\n return Function.prototype.bind.call(console.debug, console, context);\n }();\n\n log.info = function () {\n var context = prefix;\n if (strLevel) context += 'INFO:';\n if (timeStamp) {\n var tStamp = new Date().toTimeString().slice(0, 8);\n context += tStamp;\n }\n if (!['trace', 'debug', 'info'].includes(loglevel)) new Function();\n return Function.prototype.bind.call(console.info, console, context);\n }();\n\n log.warn = function () {\n var context = prefix;\n if (strLevel) context += 'WARN:';\n if (timeStamp) {\n var tStamp = new Date().toTimeString().slice(0, 8);\n context += tStamp;\n }\n if (!['trace', 'debug', 'info', 'warn'].includes(loglevel)) new Function();\n return Function.prototype.bind.call(console.warn, console, context);\n }();\n log.error = function () {\n var context = prefix;\n if (strLevel) context += 'ERROR:';\n if (timeStamp) {\n var tStamp = new Date().toTimeString().slice(0, 8);\n context += tStamp;\n }\n if (!['trace', 'debug', 'info', 'warn', 'error'].includes(loglevel)) new Function();\n return Function.prototype.bind.call(console.error, console, context);\n }();\n\n return log;\n};\n\n// import log from 'loglevel'\n\n/*function makeLog(prefix=\"\"){\n var originalFactory = _log.methodFactory\n _log.methodFactory = function (methodName, logLevel) {\n var rawMethod = originalFactory(methodName, logLevel)\n let tStamp = new Date().toTimeString().slice(0, 8)\n //tStamp = tStamp.getHours() +\":\"+tStamp.getMinutes()+\":\"+tStamp.getSeconds()+\" \"+tStamp.getMilliseconds()\n return function (message) {\n rawMethod(prefix+ tStamp +\" \"+ message)\n }\n }\n return _log\n}*/\n\n/*var originalFactory = log.methodFactory\nlog.methodFactory = function (methodName, logLevel) {\n var rawMethod = originalFactory(methodName, logLevel)\n\n return function (message) {\n rawMethod(\"Newsflash: \" + message)\n }\n}\nlog.setLevel(\"warn\") // Be sure to call setLevel method in order to apply plugin */\n\n/* log.setLevel(\"info\")\n let foo = {sdf:\"dsf\",aa:45}\n log.error(\"too easy\")\n log.error(\"..or is it\",\"blal\",foo)\n log.info(\"..or is it\",\"blal\",foo)\n\n let msg =\" sdfqsdq\"\n log.trace(msg)\n log.debug(msg)\n log.info(msg)\n log.warn(msg)\n log.error(msg)\n\n log.info(\"assetManager\",AssetManager)\n\n log.info(\"This is a test...\");*/\n\n// for now return loglevel\n\nvar logMaker2 = function logMaker2() {\n var prefix = arguments.length <= 0 || arguments[0] === undefined ? '' : arguments[0];\n\n return _loglevel2.default;\n};\n// import logger from './utils/log'\n// let log = logger(\"Jam-Root\")\n// log.setLevel(\"warn\")\nexports.default = logMaker2;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/utils/log.js\n ** module id = 77\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/utils/log.js?")},function(module,exports,__webpack_require__){eval('"use strict";\n\nvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\nObject.defineProperty(exports, "__esModule", {\n value: true\n});\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nvar _BaseHelper2 = __webpack_require__(13);\n\nvar _BaseHelper3 = _interopRequireDefault(_BaseHelper2);\n\nvar _GizmoMaterial = __webpack_require__(12);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn\'t been initialised - super() hasn\'t been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\n/*\n//TODO: make this into a mesh / geometry subclass\n*/\n\nvar CircleHelper = (function (_BaseHelper) {\n _inherits(CircleHelper, _BaseHelper);\n\n function CircleHelper(options) {\n _classCallCheck(this, CircleHelper);\n\n var defaultMaterial = new _GizmoMaterial.GizmoLineMaterial({\n color: "#000",\n depthTest: false,\n depthWrite: false,\n renderDepth: 1e20,\n highlightColor: "#F00"\n });\n\n var DEFAULTS = {\n radius: 0,\n direction: new _three2.default.Vector3(),\n\n color: "#000",\n highlightColor: "#F00",\n\n material: defaultMaterial\n };\n\n options = Object.assign({}, DEFAULTS, options);\n\n var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(CircleHelper).call(this, options));\n\n Object.assign(_this, options);\n\n _this.setRadius(_this.radius);\n return _this;\n }\n\n _createClass(CircleHelper, [{\n key: "setRadius",\n value: function setRadius(radius) {\n var circleRadius = this.radius = radius;\n var circleShape = new _three2.default.Shape();\n circleShape.moveTo(0, 0);\n circleShape.absarc(0, 0, circleRadius, 0, Math.PI * 2, false);\n circleShape.moveTo(0, 0);\n var points = circleShape.createSpacedPointsGeometry(100);\n\n if (this.rCircle) this.remove(this.rCircle);\n\n this.rCircle = new _three2.default.Line(points, this.material);\n this.add(this.rCircle);\n }\n }]);\n\n return CircleHelper;\n})(_BaseHelper3.default);\n\nexports.default = CircleHelper;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/glView-helpers/lib/CircleHelper.js\n ** module id = 78\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/glView-helpers/lib/CircleHelper.js?'); +},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.keycodes = undefined;\nexports.isValidElementEvent = isValidElementEvent;\nexports.preventBackNavigation = preventBackNavigation;\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar keycodes = exports.keycodes = {\n 8: 'backspace', 46: 'delete',\n 48: '0', 49: '1', 50: '2', 51: '3', 52: '4', 53: '5', 54: '6', 55: '7', 56: '8', 57: '9',\n 65: 'a', 66: 'b', 67: 'c', 68: 'd', 69: 'e', 70: 'f', 71: 'g',\n 72: 'h', 73: 'i', 74: 'j', 75: 'k', 76: 'l', 77: 'm', 78: 'n',\n 79: 'o', 80: 'p', 81: 'q', 82: 'r', 83: 's', 84: 't', 85: 'u',\n 86: 'v', 87: 'w', 88: 'x', 89: 'y', 90: 'z'\n};\n\n/*\nfunction setKeyBidings( element ){\n //based on http://qiita.com/jdeseno/items/72e12a5fa815b52f95e2\n */\n\nfunction isValidElementEvent(event) {\n var element = event.target || event.srcElement;\n return !(element.tagName === 'INPUT' || element.tagName === 'SELECT' || element.tagName === 'TEXTAREA' || element.isContentEditable);\n}\n\nfunction preventBackNavigation() {\n // disable backspace navigation for MacOs\n _rx2.default.Observable.fromEvent(document, 'keydown').map(function (e) {\n return { event: e, key: keycodes[e.keyCode] };\n }).filter(function (e) {\n return e.key === 'backspace';\n }).tap(function (_ref) {\n var event = _ref.event;\n\n var d = event.srcElement || event.target;\n var tagName = d.tagName.toUpperCase();\n var type = d.type ? d.type.toUpperCase() : undefined;\n var validElements = ['TEXT', 'PASSWORD', 'FILE', 'SEARCH', 'EMAIL', 'NUMBER', 'DATE'];\n\n if (!(tagName === 'INPUT' && validElements.indexOf(type) > -1 || tagName === 'TEXTAREA')) {\n event.preventDefault();\n return false;\n }\n }).forEach(function (e) {\n return e;\n });\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/interactions/keyboard.js\n ** module id = 73\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/interactions/keyboard.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.clicks = clicks;\nexports.interactionsFromEvents = interactionsFromEvents;\nexports.interactionsFromCEvents = interactionsFromCEvents;\nexports.pointerInteractions = pointerInteractions;\nexports.preventScroll = preventScroll;\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nvar _obsUtils = __webpack_require__(5);\n\nvar _utils = __webpack_require__(217);\n\nvar _assign = __webpack_require__(7);\n\nvar _assign2 = _interopRequireDefault(_assign);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar _Rx$Observable = _rx2.default.Observable;\nvar fromEvent = _Rx$Observable.fromEvent;\nvar merge = _Rx$Observable.merge;\nvar empty = _Rx$Observable.empty;\nvar just = _Rx$Observable.just;\n// faster object.assign\n\n// various helpers\nfunction hasTwoTouchPoints(event) {\n return event.touches && event.touches.length === 2;\n}\n\nfunction getOffset(event) {\n return {\n x: event.offsetX === undefined ? event.layerX : event.offsetX,\n y: event.offsetY === undefined ? event.layerY : event.offsetY\n };\n}\n\nfunction isMoving(moveDelta, deltaSqr) {\n return true;\n /* let distSqr = (moveDelta.x * moveDelta.x + moveDelta.y * moveDelta.y)\n let isMoving = (distSqr > deltaSqr)\n // console.log(\"moving\",isMoving)\n return isMoving*/\n}\n\nfunction isStatic(moveDelta, deltaSqr) {\n return !isMoving(moveDelta);\n}\n\n// TODO ,: regroup / refactor all \"delta\" operation ?\nfunction isShort(elapsed, maxTime) {\n return elapsed < maxTime;\n}\n\nfunction isLong(elapsed, maxTime) {\n return elapsed > maxTime;\n}\n\nfunction clicks(mouseDowns, mouseUps, mouseMoves) {\n var timing = arguments.length <= 3 || arguments[3] === undefined ? 200 : arguments[3];\n var deltaSqr = arguments[4];\n\n /*\n \"pseudo click\" that does not trigger when there was\n a mouse movement\n */\n var fakeClicksOld = mouseDowns.flatMap(function (md) {\n var start = { x: md.clientX, y: md.clientY };\n\n // get only valid moves\n var mMoves = mouseMoves.map(false).bufferWithTimeOrCount(timing, 1).filter(function (x) {\n return x.length === 1;\n }).map(function (x) {\n return x[0];\n });\n\n var __moves = mMoves.merge(just(true)); // default to true\n\n return __moves.combineLatest(mouseUps, function (m, mu) {\n // log.info(m, mu)\n var end = { x: mu.clientX, y: mu.clientY };\n return isStatic({ start: start, end: end }, deltaSqr); // allow for small movement (shaky hands!)\n }).takeUntil(mouseUps).filter(function (x) {\n return x === true;\n });\n });\n\n var fakeClicks = mouseDowns.flatMap(function (downEvent) {\n var target = downEvent.currentTarget;\n return _rx2.default.Observable.amb([\n // Skip if we get a movement before a mouse up\n mouseMoves.take(1).flatMap(function (x) {\n return empty();\n }), mouseUps.take(1)]); // .map(function(event){console.log(event) return event})\n });\n\n return fakeClicks;\n}\n\nfunction altMouseMoves(mouseMoves) {\n return mouseMoves.skip(1).zip(mouseMoves, function (a, b) {\n var data = {\n client: {\n x: a.clientX,\n y: a.clientY\n },\n delta: { x: a.clientX - b.clientX, y: a.clientY - b.clientY }\n };\n\n return (0, _assign2.default)(data, b);\n });\n}\n\n/* alternative \"clicks\" (ie mouseDown -> mouseUp ) implementation, with more fine\ngrained control*/\nfunction taps(mouseDowns, mouseUps, mouseMoves) {\n var longPressDelay = arguments.length <= 3 || arguments[3] === undefined ? 800 : arguments[3];\n var deltaSqr = arguments[4];\n\n // only doing any \"clicks if the time between mDOWN and mUP is below longpressDelay\"\n // any small mouseMove is ignored (shaky hands)\n return mouseDowns.flatMap(function (downEvent) {\n var target = downEvent.currentTarget;\n // const startTime = Date.now()//TODO: use time difference to determine if it was a short or a long tap ?\n\n return _rx2.default.Observable.amb([\n // Skip if we get a movement before a mouse up\n mouseMoves.filter(function (data) {\n return isMoving(data.delta, deltaSqr);\n }) // allow for small movement (shaky hands!)\n .take(1).flatMap(function (x) {\n return empty();\n }).timeInterval(), mouseUps.take(1).timeInterval()]); // .timeout(longPressDelay, empty())\n });\n}\n\n/* this emits events whenever pointers are held */\nfunction holds(mouseDowns, mouseUps, mouseMoves) {\n var longPressDelay = arguments.length <= 3 || arguments[3] === undefined ? 800 : arguments[3];\n var deltaSqr = arguments[4];\n\n return mouseDowns.flatMap(function (downEvent) {\n var target = downEvent.currentTarget;\n return _rx2.default.Observable.amb([\n // Skip if we get a movement before timeout\n mouseMoves.filter(function (data) {\n return isMoving(data.delta, deltaSqr);\n }) // allow for small movement (shaky hands!)\n .take(1).flatMap(function (x) {\n return empty();\n }),\n\n // Skip if we get a mouseup before main timeout\n mouseUps.take(1).flatMap(function (x) {\n return empty();\n }), just(2).delay(longPressDelay).timeout(longPressDelay, just(downEvent))]);\n // .timeout(longPressDelay, empty())\n });\n}\n\n/* function drags(mouseDowns, mouseUps, mouseMoves, longPressDelay=800, deltaSqr){\n return mouseDowns\n .flatMap( function(downEvent){\n let target = downEvent.currentTarget\n //let origin = target.position()\n log.info(\"kldf\")\n return Observable.amb(\n [\n // Skip if we get a mouse up before we move\n mouseUps.take(1).flatMap( x => empty() ),\n\n mouseMoves.take(1).map(function(x){\n return{\n target: target,\n //origin: target.position(),\n drags: mouseMoves.takeUntil(mouseUps).map(function(x){\n return {\n delta: x.delta,\n offset: {\n x: x.client.x - downEvent.clientX,\n y: x.client.y - downEvent.clientY\n }\n }\n })\n }\n })\n\n ])\n\n })\n}\n\n//this one just works by dispatching at the end of the movement\nfunction drags2(mouseDowns, mouseUps, mouseMoves, longPressDelay=800, deltaSqr){\n return mouseDowns.flatMap(function (md) {\n var start = { x: md.clientX, y: md.clientY }\n return mouseMoves.combineLatest(mouseUps, function (mm, mu) {\n //log.info(\"mm\",mm,\"mu\",mu)\n var stop = {x: mu.clientX, y: mu.clientY }\n return {\n start: start,\n end: stop\n }\n })\n //.delay(400)\n .takeUntil(mouseUps)\n })\n}\n*/\n\n// based on http://jsfiddle.net/mattpodwysocki/pfCqq/\nfunction drags3(mouseDowns$, mouseUps, mouseMoves) {\n var longPressDelay = arguments.length <= 3 || arguments[3] === undefined ? 800 : arguments[3];\n var deltaSqr = arguments[4];\n\n return mouseDowns$.flatMap(function (md) {\n // console.log(\"drags3 mousedown\",md)\n // calculate offsets when mouse down\n var startX = md.offsetX;\n var startY = md.offsetY;\n // Calculate delta with mousemove until mouseup\n return mouseMoves.map(function (e) {\n // console.log(\"drags3 mousemove\",mm)\n // (mm.preventDefault) ? mm.preventDefault() : mm.returnValue = false\n var delta = {\n left: e.clientX - startX,\n top: e.clientY - startY\n };\n // console.log(\"delta\",delta)\n return (0, _assign2.default)({}, e, delta);\n }).takeUntil(mouseUps);\n });\n}\n\nfunction touchDrags(touchStart$, touchEnd$, touchMove$) {\n return touchStart$.flatMap(function (ts) {\n var startX = ts.touches[0].pageX;\n var startY = ts.touches[0].pageY;\n\n return touchMove$.map(function (e) {\n var x = (e.touches[0].pageX - startX) / 5.0;\n var y = (e.touches[0].pageY - startY) / 5.0;\n\n var delta = {\n left: x,\n top: y,\n x: x,\n y: y };\n\n var output = (0, _assign2.default)({}, e, { delta: delta });\n return output;\n }).takeUntil(touchEnd$);\n });\n}\n\n// pinch, taken from https://github.com/hugobessaa/rx-react-pinch\nfunction pinches(touchstarts, touchmoves, touchEnds) {\n return touchStarts.do(_obsUtils.preventDefault).takeWhile(hasTwoTouchPoints).flatMap(function () {\n return touchMoves.pluck('scale').takeUntil(touchEnds);\n });\n}\n\nfunction interactionsFromEvents(targetEl) {\n var mouseDowns$ = fromEvent(targetEl, 'mousedown');\n var mouseUps$ = fromEvent(targetEl, 'mouseup');\n var mouseLeaves$ = fromEvent(targetEl, 'mouseleave').merge(fromCEvent(targetEl, 'mouseout'));\n var mouseMoves$ = altMouseMoves(fromEvent(targetEl, 'mousemove')).takeUntil(mouseLeaves$);\n var rightClicks$ = fromEvent(targetEl, 'contextmenu').do(_obsUtils.preventDefault); // disable the context menu / right click\n var zooms$ = fromEvent(targetEl, 'wheel');\n\n var touchStart$ = fromEvent('touchstart'); // dom.touchstart(window)\n var touchMove$ = fromEvent('touchmove'); // dom.touchmove(window)\n var touchEnd$ = fromEvent('touchend'); // dom.touchend(window)\n\n return {\n mouseDowns$: mouseDowns$,\n mouseUps$: mouseUps$,\n mouseMoves$: mouseMoves$,\n rightClicks$: rightClicks$,\n zooms$: zooms$,\n touchStart$: touchStart$,\n touchMoves$: touchMoves$,\n touchEnd$: touchEnd$ };\n}\n\n/* generate a hash of basic pointer/ mouse event observables*/\nfunction interactionsFromCEvents(targetEl) {\n var rTarget = arguments.length <= 1 || arguments[1] === undefined ? 'canvas' : arguments[1];\n\n /* function fromCEvent(targetEl, eventName){\n return targetEl.get(rTarget, eventName)\n }*/\n function fromCEvent(targetEl, eventName) {\n return targetEl.select(rTarget).events(eventName);\n }\n\n var mouseDowns$ = fromCEvent(targetEl, 'mousedown');\n var mouseUps$ = fromCEvent(targetEl, 'mouseup');\n var mouseLeaves$ = fromCEvent(targetEl, 'mouseleave').merge(fromCEvent(targetEl, 'mouseout'));\n var mouseMoves$ = altMouseMoves(fromCEvent(targetEl, 'mousemove')).takeUntil(mouseLeaves$);\n var rightClicks$ = fromCEvent(targetEl, 'contextmenu').do(_obsUtils.preventDefault); // disable the context menu / right click\n var zooms$ = fromCEvent(targetEl, 'wheel');\n\n var touchStart$ = fromCEvent(targetEl, 'touchstart'); // dom.touchstart(window)\n var touchMoves$ = fromCEvent(targetEl, 'touchmove'); // dom.touchmove(window)\n var touchEnd$ = fromCEvent(targetEl, 'touchend'); // dom.touchend(window)\n\n return {\n mouseDowns$: mouseDowns$,\n mouseUps$: mouseUps$,\n mouseMoves$: mouseMoves$,\n rightClicks$: rightClicks$,\n zooms$: zooms$,\n touchStart$: touchStart$,\n touchMoves$: touchMoves$,\n touchEnd$: touchEnd$ };\n}\n\nfunction pointerInteractions(baseInteractions) {\n var multiClickDelay = 250;\n var longPressDelay = 250;\n\n var minDelta = 25; // max 50 pixels delta\n var deltaSqr = minDelta * minDelta;\n\n var mouseDowns$ = baseInteractions.mouseDowns$;\n var mouseUps$ = baseInteractions.mouseUps$;\n var rightclicks$ = baseInteractions.rightclicks$;\n var mouseMoves$ = baseInteractions.mouseMoves$;\n var touchStart$ = baseInteractions.touchStart$;\n var touchMoves$ = baseInteractions.touchMoves$;\n var touchEnd$ = baseInteractions.touchEnd$;\n var zooms$ = baseInteractions.zooms$;\n\n // mouseMoves$.forEach(e=>console.log(\"mousemove\",e))\n\n // /// now setup the more complex interactions\n\n var taps$ = taps(merge(mouseDowns$, touchStart$), // mouse & touch interactions starts\n merge(mouseUps$, touchEnd$), // mouse & touch interactions ends\n mouseMoves$, longPressDelay, deltaSqr).share();\n\n var shortTaps$ = taps$.filter(function (e) {\n return e.interval <= longPressDelay;\n }).map(function (e) {\n return e.value;\n }).filter(function (event) {\n return 'button' in event && event.button === 0;\n }) // FIXME : bad filter !\n .buffer(function () {\n return taps$.debounce(multiClickDelay);\n }).map(function (list) {\n return { list: list, nb: list.length };\n }).share();\n\n // normalize zooms (should this be elsewhere ?)\n zooms$ = zooms$.map(_utils.normalizeWheel);\n\n // we get our custom right clicks\n var rightClicks2 = taps$.filter(function (event) {\n return 'button' in event && event.button === 2;\n });\n var holds$ = holds(mouseDowns$, mouseUps$, mouseMoves$, longPressDelay, deltaSqr);\n\n var shortSingleTaps$ = shortTaps$.filter(function (x) {\n return x.nb === 1;\n }).flatMap(function (e) {\n return e.list;\n });\n var shortDoubleTaps$ = shortTaps$.filter(function (x) {\n return x.nb === 2;\n }).flatMap(function (e) {\n return e.list;\n }).take(1).repeat();\n\n // static , long held taps, for context menus etc\n // longTaps: either HELD leftmouse/pointer or HELD right click //FIXME : needs to be \"UNTIL\" mouseUp\n // and not fire before mouseUp\n var longTaps$ = taps$.filter(function (e) {\n return e.interval > longPressDelay;\n }).map(function (e) {\n return e.value;\n }); // holds$.take(1).repeat()//.timeout(longPressDelay, empty())\n // .tap(e=>console.log(\"taps with LONG timeInterval\",e))\n\n // drag move interactions (continuously firing)\n var dragMoves$ = merge(drags3(mouseDowns$, mouseUps$, mouseMoves$, longPressDelay, deltaSqr), touchDrags(touchStart$, touchEnd$, touchMoves$).throttle(60).tap(function (e) {\n return console.log('foo');\n })).takeUntil(longTaps$).repeat(); // no drag moves if there is a context action already taking place\n\n return {\n taps: taps$.map(function (e) {\n return e.value;\n }),\n shortSingleTaps$: shortSingleTaps$,\n shortDoubleTaps$: shortDoubleTaps$,\n longTaps$: longTaps$,\n dragMoves$: dragMoves$,\n zooms$: zooms$ };\n}\n\n// /////\nfunction preventScroll(targetEl) {\n fromEvent(targetEl, 'mousewheel').forEach(_obsUtils.preventDefault);\n fromEvent(targetEl, 'DOMMouseScroll').forEach(_obsUtils.preventDefault);\n fromEvent(targetEl, 'wheel').forEach(_obsUtils.preventDefault);\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/interactions/pointers.js\n ** module id = 74\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/interactions/pointers.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.windowResizes = windowResizes;\nexports.elementResizes = elementResizes;\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar Observable = _rx2.default.Observable;\nvar fromEvent = Observable.fromEvent;\n__webpack_require__(279);\n\n// window resize event stream, throttled by throttle amount (250ms default)\nfunction windowResizes() {\n var throttle = arguments.length <= 0 || arguments[0] === undefined ? 250 : arguments[0];\n\n // only get the fields we need\n function extractSize(x) {\n x = x.target;\n var bRect = { left: 0, top: 0, bottom: 0, right: 0, width: 0, height: 0 };\n if (x.getBoundingClientRect) bRect = x.getBoundingClientRect();\n\n var res = { width: x.innerWidth, height: x.innerHeight, aspect: x.innerWidth / x.innerHeight, bRect: bRect };\n return res;\n }\n\n var throttledWinResize = fromEvent(window, 'resize').throttle(throttle /* ms */).map(extractSize).startWith({ width: window.innerWidth, height: window.innerHeight, aspect: window.innerWidth / window.innerHeight, bRect: undefined });\n\n return throttledWinResize;\n}\n\nfunction elementResizes(element) {\n var throttle = arguments.length <= 1 || arguments[1] === undefined ? 250 : arguments[1];\n\n function extractSize(x) {\n x = x.target;\n var bRect = { left: 0, top: 0, bottom: 0, right: 0, width: 0, height: 0 };\n if (x.getBoundingClientRect) bRect = x.getBoundingClientRect();\n\n var res = { width: x.innerWidth, height: x.innerHeight, aspect: x.innerWidth / x.innerHeight, bRect: bRect };\n return res;\n }\n\n return _rx2.default.DOM.resize(element).throttle(throttle /* ms */).map(extractSize);\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/interactions/sizing.js\n ** module id = 75\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/interactions/sizing.js?")},function(module,exports,__webpack_require__){eval('\'use strict\';\n\nObject.defineProperty(exports, "__esModule", {\n value: true\n});\nexports.extractChanges = extractChanges;\nexports.extractChangesBetweenArrays = extractChangesBetweenArrays;\nexports.changesFromObservableArrays = changesFromObservableArrays;\nexports.changesFromObservableArrays2 = changesFromObservableArrays2;\nexports.transformEquals = transformEquals;\nexports.colorsEqual = colorsEqual;\nexports.entityVisualComparer = entityVisualComparer;\n\nvar _utils = __webpack_require__(3);\n\nfunction compareHash(obj) {\n if (obj.uuid) return obj.uuid;\n // return JSON.stringify(obj)\n // return typeof(obj)+obj.name\n}\n\nvar jsondiffpatch = __webpack_require__(17).create({ objectHash: compareHash });\n\nfunction extractChanges(prev, cur) {\n var delta = jsondiffpatch.diff(prev, cur);\n // console.log("delta",delta)\n var result = { added: [], removed: [], changed: [] };\n\n if (delta && \'_t\' in delta) {\n (function () {\n var removed = []; // delta["_0"][0]//delta[0][0]\n var added = []; // delta[0][0]//delta[0][1]\n\n Object.keys(delta).map(function (key) {\n // console.log("AAA",key)\n // "_t": "a", Array delta (member names indicate array indices)\n\n if (key[0] === \'_\') {\n if (key !== \'_a\' && key !== \'_t\') {\n removed.push(delta[key][0]);\n }\n } else {\n added.push(delta[key][0]);\n }\n });\n\n result.added = (0, _utils.toArray)(added).filter(function (i) {\n return i !== undefined;\n });\n result.removed = (0, _utils.toArray)(removed).filter(function (i) {\n return i !== undefined;\n });\n\n // console.log("added",result.added)\n // console.log("removed",result.removed)\n })();\n } else if (prev === undefined) {\n // not handled right in the above case for some reason ??\n result.added = cur;\n }\n\n return result;\n}\n\nvar instance = __webpack_require__(17).create({\n objectHash: function objectHash(obj, index) {\n if (typeof obj._id !== \'undefined\') {\n return obj._id;\n }\n if (typeof obj.id !== \'undefined\') {\n return obj.id;\n }\n if (typeof obj.name !== \'undefined\') {\n return obj.name;\n }\n return \'$$index:\' + index;\n }\n});\n// to ignore functions\ninstance.processor.pipes.diff.before(\'trivial\', function ignoreFunctionDiffFilter(context) {\n if (typeof context.left === \'function\' || typeof context.right === \'function\') {\n context.setResult(undefined);\n context.exit();\n }\n});\n\nfunction extractChangesBetweenArrays(prev, cur) {\n var delta = instance.diff(prev, cur);\n // console.log("delta",delta)\n // console.log("diff",delta)//JSON.stringify(delta, null, 2))\n\n var result = { added: [], removed: [], changed: [], upserted: [] };\n\n if (delta && \'_t\' in delta) {\n (function () {\n var removed = []; // delta["_0"][0]//delta[0][0]\n var added = []; // delta[0][0]//delta[0][1]\n var upserted = [];\n\n if (delta[\'_t\'] === \'a\') {\n // array diff\n // "_t": "a", Array delta (member names indicate array indices)\n Object.keys(delta).map(function (key) {\n if (key !== \'_t\') {\n if (key.length > 0 && key.indexOf(\'_\') > -1) {\n var realKey = parseInt(key.replace(\'_\', \'\'), 10);\n // console.log("removed",delta, realKey)//,key,delta)\n removed.push(prev[realKey]);\n } else {\n // added or changed\n // console.log("added or changed",delta, key)\n var _realKey = parseInt(key, 10);\n upserted.push(cur[_realKey]);\n }\n }\n });\n }\n result.added = (0, _utils.toArray)(added).filter(function (i) {\n return i !== undefined;\n });\n result.removed = (0, _utils.toArray)(removed).filter(function (i) {\n return i !== undefined;\n });\n result.upserted = (0, _utils.toArray)(upserted).filter(function (i) {\n return i !== undefined;\n });\n // console.log("added",result.added)\n // console.log("removed",result.removed)\n })();\n } else if (prev === undefined) {\n // not handled right in the above case for some reason ??\n result.upserted = cur;\n }\n\n return result;\n}\n\nfunction changesFromObservableArrays(data$) {\n return data$.scan(function (acc, cur) {\n return { cur: cur, prev: acc.cur };\n }, { prev: undefined, cur: undefined }).map(function (typeData) {\n var cur = typeData.cur;\n var prev = typeData.prev;\n\n var changes = extractChangesBetweenArrays(prev, cur);\n return changes;\n }).share();\n}\n\nfunction changesFromObservableArrays2(data$) {\n return data$.scan(function (acc, x) {\n var cur = x;\n var prev = acc.cur;\n\n cur = Object.keys(cur).map(function (key) {\n return cur[key];\n });\n return { cur: cur, prev: prev };\n }, { prev: undefined, cur: undefined }).map(function (typeData) {\n var cur = typeData.cur;\n var prev = typeData.prev;\n // console.log("diffing",cur,prev)\n\n var changes = extractChanges(prev, cur);\n return changes;\n }).share();\n}\n\nfunction transformEquals(a, b) {\n if (!a || !b) return true;\n for (var j = 0; j < a.length; j++) {\n if (a[j] !== b[j]) {\n return false;\n }\n }\n return true;\n}\n\nfunction colorsEqual(a, b) {\n if (!a || !b) return true;\n return a === b;\n}\n\nfunction entityVisualComparer(prev, cur) {\n // console.log("prev",prev,"cur",cur)\n\n if (!cur) {\n return false;\n }\n\n // compare lengths - can save a lot of time\n if (cur.length !== prev.length) {\n return false;\n }\n\n var sortedCur = cur.sort();\n var sortedPrev = prev.sort();\n for (var i = 0; i < cur.length; i++) {\n if (sortedCur[i].typeUid !== sortedPrev[i].typeUid) {\n return false;\n }\n\n if (sortedCur[i].id !== sortedPrev[i].id) {\n return false;\n }\n\n var curVal = sortedCur[i];\n var preVal = sortedPrev[i];\n\n /*\n sortedCur[i].color === sortedPrev[i].color\n )*/\n\n var posEq = transformEquals(curVal.pos, preVal.pos);\n var rotEq = transformEquals(curVal.rot, preVal.rot);\n var scaEq = transformEquals(curVal.sca, preVal.sca);\n var colEq = colorsEqual(curVal.color, preVal.color);\n var allEqual = posEq && rotEq && scaEq && colEq;\n if (!allEqual) return false;\n }\n\n return true;\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/utils/diffPatchUtils.js\n ** module id = 76\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/utils/diffPatchUtils.js?')},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _loglevel = __webpack_require__(274);\n\nvar _loglevel2 = _interopRequireDefault(_loglevel);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n// polygill for array.includes\nif (![].includes) {\n Array.prototype.includes = function (searchElement /*, fromIndex*/) {\n 'use strict';\n\n var O = Object(this);\n var len = parseInt(O.length) || 0;\n if (len === 0) {\n return false;\n }\n var n = parseInt(arguments[1]) || 0;\n var k;\n if (n >= 0) {\n k = n;\n } else {\n k = len + n;\n if (k < 0) {\n k = 0;\n }\n }\n var currentElement;\n while (k < len) {\n currentElement = O[k];\n if (searchElement === currentElement || searchElement !== searchElement && currentElement !== currentElement) {\n return true;\n }\n k++;\n }\n return false;\n };\n}\n\n// ////////////\nvar logMaker = function logMaker() {\n var prefix = arguments.length <= 0 || arguments[0] === undefined ? '' : arguments[0];\n var strLevel = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1];\n var timeStamp = arguments.length <= 2 || arguments[2] === undefined ? false : arguments[2];\n\n var log = {};\n var loglevel = 'warn';\n log.setLevel = function (level) {\n loglevel = level;\n };\n\n log.trace = function () {\n var context = prefix;\n if (strLevel) context += 'TRACE:';\n if (timeStamp) {\n var tStamp = new Date().toTimeString().slice(0, 8);\n context += tStamp;\n }\n if (!['trace'].includes(loglevel)) return new Function();\n return Function.prototype.bind.call(console.trace, console, context);\n }();\n log.debug = function () {\n var context = prefix;\n if (strLevel) context += 'DEBUG:';\n if (timeStamp) {\n var tStamp = new Date().toTimeString().slice(0, 8);\n context += tStamp;\n }\n if (!['trace', 'debug'].includes(loglevel)) return new Function();\n return Function.prototype.bind.call(console.debug, console, context);\n }();\n\n log.info = function () {\n var context = prefix;\n if (strLevel) context += 'INFO:';\n if (timeStamp) {\n var tStamp = new Date().toTimeString().slice(0, 8);\n context += tStamp;\n }\n if (!['trace', 'debug', 'info'].includes(loglevel)) new Function();\n return Function.prototype.bind.call(console.info, console, context);\n }();\n\n log.warn = function () {\n var context = prefix;\n if (strLevel) context += 'WARN:';\n if (timeStamp) {\n var tStamp = new Date().toTimeString().slice(0, 8);\n context += tStamp;\n }\n if (!['trace', 'debug', 'info', 'warn'].includes(loglevel)) new Function();\n return Function.prototype.bind.call(console.warn, console, context);\n }();\n log.error = function () {\n var context = prefix;\n if (strLevel) context += 'ERROR:';\n if (timeStamp) {\n var tStamp = new Date().toTimeString().slice(0, 8);\n context += tStamp;\n }\n if (!['trace', 'debug', 'info', 'warn', 'error'].includes(loglevel)) new Function();\n return Function.prototype.bind.call(console.error, console, context);\n }();\n\n return log;\n};\n\n// import log from 'loglevel'\n\n/*function makeLog(prefix=\"\"){\n var originalFactory = _log.methodFactory\n _log.methodFactory = function (methodName, logLevel) {\n var rawMethod = originalFactory(methodName, logLevel)\n let tStamp = new Date().toTimeString().slice(0, 8)\n //tStamp = tStamp.getHours() +\":\"+tStamp.getMinutes()+\":\"+tStamp.getSeconds()+\" \"+tStamp.getMilliseconds()\n return function (message) {\n rawMethod(prefix+ tStamp +\" \"+ message)\n }\n }\n return _log\n}*/\n\n/*var originalFactory = log.methodFactory\nlog.methodFactory = function (methodName, logLevel) {\n var rawMethod = originalFactory(methodName, logLevel)\n\n return function (message) {\n rawMethod(\"Newsflash: \" + message)\n }\n}\nlog.setLevel(\"warn\") // Be sure to call setLevel method in order to apply plugin */\n\n/* log.setLevel(\"info\")\n let foo = {sdf:\"dsf\",aa:45}\n log.error(\"too easy\")\n log.error(\"..or is it\",\"blal\",foo)\n log.info(\"..or is it\",\"blal\",foo)\n\n let msg =\" sdfqsdq\"\n log.trace(msg)\n log.debug(msg)\n log.info(msg)\n log.warn(msg)\n log.error(msg)\n\n log.info(\"assetManager\",AssetManager)\n\n log.info(\"This is a test...\");*/\n\n// for now return loglevel\n\nvar logMaker2 = function logMaker2() {\n var prefix = arguments.length <= 0 || arguments[0] === undefined ? '' : arguments[0];\n\n return _loglevel2.default;\n};\n// import logger from './utils/log'\n// let log = logger(\"Jam-Root\")\n// log.setLevel(\"warn\")\nexports.default = logMaker2;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/utils/log.js\n ** module id = 77\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/utils/log.js?")},function(module,exports,__webpack_require__){eval('"use strict";\n\nvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\nObject.defineProperty(exports, "__esModule", {\n value: true\n});\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nvar _BaseHelper2 = __webpack_require__(13);\n\nvar _BaseHelper3 = _interopRequireDefault(_BaseHelper2);\n\nvar _GizmoMaterial = __webpack_require__(12);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn\'t been initialised - super() hasn\'t been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\n/*\n//TODO: make this into a mesh / geometry subclass\n*/\n\nvar CircleHelper = (function (_BaseHelper) {\n _inherits(CircleHelper, _BaseHelper);\n\n function CircleHelper(options) {\n _classCallCheck(this, CircleHelper);\n\n var defaultMaterial = new _GizmoMaterial.GizmoLineMaterial({\n color: "#000",\n depthTest: false,\n depthWrite: false,\n renderDepth: 1e20,\n highlightColor: "#F00"\n });\n\n var DEFAULTS = {\n radius: 0,\n direction: new _three2.default.Vector3(),\n\n color: "#000",\n highlightColor: "#F00",\n\n material: defaultMaterial\n };\n\n options = Object.assign({}, DEFAULTS, options);\n\n var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(CircleHelper).call(this, options));\n\n Object.assign(_this, options);\n\n _this.setRadius(_this.radius);\n return _this;\n }\n\n _createClass(CircleHelper, [{\n key: "setRadius",\n value: function setRadius(radius) {\n var circleRadius = this.radius = radius;\n var circleShape = new _three2.default.Shape();\n circleShape.moveTo(0, 0);\n circleShape.absarc(0, 0, circleRadius, 0, Math.PI * 2, false);\n circleShape.moveTo(0, 0);\n var points = circleShape.createSpacedPointsGeometry(100);\n\n if (this.rCircle) this.remove(this.rCircle);\n\n this.rCircle = new _three2.default.Line(points, this.material);\n this.add(this.rCircle);\n }\n }]);\n\n return CircleHelper;\n})(_BaseHelper3.default);\n\nexports.default = CircleHelper;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/glView-helpers/lib/CircleHelper.js\n ** module id = 78\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/glView-helpers/lib/CircleHelper.js?'); },function(module,exports,__webpack_require__){eval('"use strict";\n\nObject.defineProperty(exports, "__esModule", {\n value: true\n});\nexports.getTargetBoundsData = getTargetBoundsData;\nexports.computeCenterDiaNormalFromThreePoints = computeCenterDiaNormalFromThreePoints;\nexports.getEntryExitThickness = getEntryExitThickness;\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction getTargetBoundsData(targetObject, point) {\n console.log("computing bounds");\n /* -1 /+1 directions on all 3 axis to determine for example WHERE an annotation\n should be placed (left/right, front/back, top/bottom)\n */\n var putSide = [0, 0, 0];\n if (!targetObject) return putSide;\n var bbox = targetObject.boundingBox;\n\n var objectCenter = new _three2.default.Vector3().addVectors(targetObject.boundingBox.min, targetObject.boundingBox.max).divideScalar(2);\n\n //let realCenter = point.clone().sub( objectCenter )\n //console.log("objectCenter",objectCenter,"point", point,foo.normalize())\n\n var axes = ["x", "y", "z"];\n axes.forEach(function (axis, index) {\n var axisOffset = point[axis] - objectCenter[axis];\n axisOffset = Math.round(axisOffset * 100) / 100;\n if (axisOffset > 0) {\n putSide[index] = 1;\n } else if (axisOffset < 0) {\n putSide[index] = -1;\n }\n });\n\n console.log("putSide", putSide);\n putSide = new _three2.default.Vector3().fromArray(putSide);\n return putSide;\n}\n\n//compute center , dia/radius from three 3d points\nfunction computeCenterDiaNormalFromThreePoints(pointA, pointB, pointC) {\n\n var plane = new _three2.default.Plane().setFromCoplanarPoints(pointA, pointB, pointC);\n var center = new _three2.default.Vector3();\n\n //see http://en.wikipedia.org/wiki/Circumscribed_circle\n // triangle "edges"\n var t = pointA.clone().sub(pointB);\n var u = pointB.clone().sub(pointC);\n var v = pointC.clone().sub(pointA);\n var m = pointA.clone().sub(pointC);\n var x = pointB.clone().sub(pointA);\n var z = pointC.clone().sub(pointB);\n\n var foo = t.clone().cross(u).length();\n var bar = 2 * foo;\n var baz = foo * foo;\n var buu = 2 * baz;\n\n var radius = t.length() * u.length() * v.length() / bar;\n\n var alpha = u.lengthSq() * t.clone().dot(m) / buu;\n var beta = m.lengthSq() * x.clone().dot(u) / buu;\n var gamma = t.lengthSq() * v.clone().dot(z) / buu;\n\n center = pointA.clone().multiplyScalar(alpha).add(pointB.clone().multiplyScalar(beta)).add(pointC.clone().multiplyScalar(gamma));\n\n var diameter = radius * 2;\n var normal = plane.normal;\n\n return { center: center, diameter: diameter, normal: normal };\n}\n\nfunction getEntryExitThickness(entryInteresect) {\n var normalType = arguments.length <= 1 || arguments[1] === undefined ? "face" : arguments[1];\n\n var normal = entryInteresect.face.normal.clone();\n switch (normalType) {\n case "face":\n break;\n case "x":\n normal = new _three2.default.Vector3(1, 0, 0);\n break;\n case "y":\n normal = new _three2.default.Vector3(0, 1, 0);\n break;\n case "z":\n normal = new _three2.default.Vector3(0, 0, 1);\n break;\n }\n\n var object = entryInteresect.object;\n if (!object) return undefined;\n\n var entryPoint = entryInteresect.point.clone();\n var flippedNormal = normal.clone().negate();\n var offsetPoint = entryPoint.clone().add(flippedNormal.clone().multiplyScalar(10000));\n\n //get escape entryPoint\n var raycaster = new _three2.default.Raycaster(offsetPoint, normal.clone().normalize());\n var intersects = raycaster.intersectObjects([object], true);\n\n var exitPoint = null;\n var minDist = Infinity;\n\n intersects.map(function (entry) {\n var curPt = entry.point;\n var curLn = curPt.clone().sub(entryPoint).length();\n\n if (curLn < minDist) {\n exitPoint = curPt;\n minDist = curLn;\n }\n });\n\n //FIXME: todo or not ??\n object.worldToLocal(entryPoint);\n object.worldToLocal(exitPoint);\n\n //compute actual thickness\n var endToStart = exitPoint.clone().sub(entryPoint);\n var thickness = endToStart.length();\n\n return { object: object, entryPoint: entryPoint, exitPoint: exitPoint, thickness: thickness };\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/glView-helpers/lib/annotations/utils.js\n ** module id = 79\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/glView-helpers/lib/annotations/utils.js?')},function(module,exports,__webpack_require__){eval('\'use strict\';\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nvar _BaseHelper2 = __webpack_require__(13);\n\nvar _BaseHelper3 = _interopRequireDefault(_BaseHelper2);\n\nvar _CrossHelper = __webpack_require__(16);\n\nvar _CrossHelper2 = _interopRequireDefault(_CrossHelper);\n\nvar _ArrowHelper = __webpack_require__(251);\n\nvar _ArrowHelper2 = _interopRequireDefault(_ArrowHelper);\n\nvar _LabelHelper = __webpack_require__(39);\n\nvar _GizmoMaterial = __webpack_require__(12);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn\'t been initialised - super() hasn\'t been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\n/*\n Visual helper representing leader lines\n*/\n\nvar LeaderLineHelper = (function (_BaseHelper) {\n _inherits(LeaderLineHelper, _BaseHelper);\n\n function LeaderLineHelper(options) {\n _classCallCheck(this, LeaderLineHelper);\n\n var DEFAULTS = {\n distance: 30,\n color: "#000",\n text: "",\n fontFace: "Jura"\n };\n\n options = Object.assign({}, DEFAULTS, options);\n\n var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(LeaderLineHelper).call(this, options));\n\n Object.assign(_this, options);\n\n _this.arrowColor = options.arrowColor !== undefined ? options.arrowColor : 0x000000;\n _this.arrowHeadSize = options.arrowHeadSize !== undefined ? options.arrowHeadSize : 2.0;\n _this.arrowHeadWidth = options.arrowHeadWidth !== undefined ? options.arrowHeadWidth : 0.8;\n _this.arrowHeadType = options.arrowHeadType !== undefined ? options.arrowHeadType : undefined;\n\n _this.linesColor = options.linesColor !== undefined ? options.linesColor : 0x000000;\n _this.lineWidth = options.lineWidth !== undefined ? options.lineWidth : 1;\n\n _this.fontSize = options.fontSize !== undefined ? options.fontSize : 8;\n _this.textColor = options.textColor !== undefined ? options.textColor : "#000";\n _this.textBgColor = options.textBgColor !== undefined ? options.textBgColor : "#fff";\n _this.labelType = options.labelType !== undefined ? options.labelType : "frontFacing";\n\n _this.angle = options.angle !== undefined ? options.angle : 45;\n _this.angleLength = options.angleLength !== undefined ? options.angleLength : 5;\n _this.horizLength = options.horizLength !== undefined ? options.horizLength : 5;\n _this.radius = options.radius !== undefined ? options.radius : 0;\n\n _this.highlightColor = options.highlightColor !== undefined ? options.highlightColor : "#F00";\n\n var angle = _this.angle;\n var radius = _this.radius;\n var angleLength = _this.angleLength;\n var horizLength = _this.horizLength;\n\n var textBorder = options.textBorder || null;\n var material = new _GizmoMaterial.GizmoLineMaterial({\n color: _this.linesColor,\n lineWidth: _this.lineWidth,\n linecap: "miter",\n highlightColor: _this.highlightColor\n });\n //depthTest:false,depthWrite:false})\n\n var rAngle = angle;\n rAngle = rAngle * Math.PI / 180;\n var y = Math.cos(rAngle) * angleLength;\n var x = Math.sin(rAngle) * angleLength;\n var angleEndPoint = new _three2.default.Vector3(x, y, 0);\n angleEndPoint = angleEndPoint.add(angleEndPoint.clone().normalize().multiplyScalar(radius));\n var angleArrowDir = angleEndPoint.clone().normalize();\n angleEndPoint.x = -angleEndPoint.x;\n angleEndPoint.y = -angleEndPoint.y;\n\n _this.angleArrow = new _ArrowHelper2.default(angleArrowDir, angleEndPoint, angleLength, _this.color, _this.arrowHeadSize, _this.arrowHeadWidth, _this.arrowHeadType);\n _this.angleArrow.scale.z = 0.6;\n\n var horizEndPoint = angleEndPoint.clone();\n horizEndPoint.x -= horizLength;\n\n var horizGeom = new _three2.default.Geometry();\n horizGeom.vertices.push(angleEndPoint);\n horizGeom.vertices.push(horizEndPoint);\n\n _this.horizLine = new _three2.default.Line(horizGeom, material);\n\n //draw dimention / text\n switch (_this.labelType) {\n case "flat":\n _this.label = new _LabelHelper.LabelHelperPlane({\n text: _this.text,\n fontSize: _this.fontSize,\n fontFace: _this.fontFace,\n background: _this.textBgColor != null,\n color: _this.textColor,\n bgColor: _this.textBgColor,\n highlightColor: _this.highlightColor\n });\n break;\n case "frontFacing":\n _this.label = new _LabelHelper.LabelHelper3d({\n text: _this.text,\n fontSize: _this.fontSize,\n fontFace: _this.fontFace,\n color: _this.textColor,\n bgColor: _this.textBgColor });\n break;\n }\n _this.label.rotation.z = Math.PI;\n var labelSize = _this.label.textWidth / 2 + 1; //label size, plus some extra\n var labelPosition = horizEndPoint.clone().sub(new _three2.default.Vector3(labelSize, 0, 0));\n _this.label.position.add(labelPosition);\n\n /*\n let precisionLabelPos = new THREE.Vector3().copy( labelPosition )\n precisionLabelPos.x += this.label.width\n \n //TODO: this is both needed in the data structures & in the visuals (here)\n this.precision = 0.12\n this.precisionText = "+"+this.precision+"\\n"+"-"+this.precision\n this.precisionLabel = new LabelHelperPlane({text:this.precisionText,fontSize:this.fontSize/1.5,background:(this.textBgColor!=null),color:this.textColor,bgColor:this.textBgColor})\n this.add( this.precisionLabel )\n \n this.precisionLabel.rotation.z = Math.PI\n this.precisionLabel.position.copy( precisionLabelPos )*/\n\n /*let crossHelper = new CrossHelper({\n size:3\n })\n this.add( crossHelper )*/\n\n if (textBorder) {\n if (textBorder === "circle") {\n var textBorderGeom = new _three2.default.CircleGeometry(labelSize, 32);\n textBorderGeom.vertices.shift();\n var textBorderOutline = new _three2.default.Line(textBorderGeom, material);\n textBorderOutline.position.add(labelPosition);\n _this.add(textBorderOutline);\n }\n if (textBorder === "rectangle") {\n var rectWidth = _this.label.textHeight;\n var rectLength = _this.label.textWidth;\n\n //console.log("textWidth",this.label.textWidth, this.label.width,"textHeight",this.label.textHeight, this.label.height)\n\n var rectShape = new _three2.default.Shape();\n rectShape.moveTo(0, 0);\n rectShape.lineTo(0, rectWidth);\n rectShape.lineTo(rectLength, rectWidth);\n rectShape.lineTo(rectLength, 0);\n rectShape.lineTo(0, 0);\n rectShape.lineTo(0, 0);\n\n var textBorderGeom = new _three2.default.ShapeGeometry(rectShape);\n var textBorderOutline = new _three2.default.Line(textBorderGeom, material);\n textBorderOutline.position.add(labelPosition);\n textBorderOutline.position.add(new _three2.default.Vector3(-rectLength / 2, -rectWidth / 2, 0));\n _this.add(textBorderOutline);\n }\n }\n\n _this.add(_this.angleArrow);\n _this.add(_this.horizLine);\n _this.add(_this.label);\n\n //material settings\n _this.arrowLineMaterial = new _GizmoMaterial.GizmoLineMaterial({\n color: _this.arrowColor,\n lineWidth: _this.lineWidth,\n linecap: "miter",\n highlightColor: _this.highlightColor });\n _this.arrowConeMaterial = new _GizmoMaterial.GizmoMaterial({\n color: _this.arrowColor,\n highlightColor: _this.highlightColor\n });\n\n _this.angleArrow.line.material = _this.arrowLineMaterial;\n _this.angleArrow.head.material = _this.arrowConeMaterial;\n _this.angleArrow.line.material.depthTest = _this.angleArrow.line.material.depthTest = true;\n _this.angleArrow.line.material.depthWrite = _this.angleArrow.line.material.depthWrite = true;\n\n //this.angleArrow.renderDepth = 1e20\n _this.horizLine.renderDepth = 1e20;\n return _this;\n }\n\n return LeaderLineHelper;\n})(_BaseHelper3.default);\n\nmodule.exports = LeaderLineHelper;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/glView-helpers/lib/dimensions/LeaderLineHelper.js\n ** module id = 80\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/glView-helpers/lib/dimensions/LeaderLineHelper.js?')},function(module,exports,__webpack_require__){eval('"use strict";\n\nvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\nObject.defineProperty(exports, "__esModule", {\n value: true\n});\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn\'t been initialised - super() hasn\'t been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\n/*TODO:\n - refactor\n - use label helper\n*/\n\nvar LabeledGrid = (function (_THREE$Object3D) {\n _inherits(LabeledGrid, _THREE$Object3D);\n\n function LabeledGrid() {\n var width = arguments.length <= 0 || arguments[0] === undefined ? 200 : arguments[0];\n var length = arguments.length <= 1 || arguments[1] === undefined ? 200 : arguments[1];\n var step = arguments.length <= 2 || arguments[2] === undefined ? 100 : arguments[2];\n var upVector = arguments.length <= 3 || arguments[3] === undefined ? [0, 1, 0] : arguments[3];\n var color = arguments.length <= 4 || arguments[4] === undefined ? 0x00baff : arguments[4];\n var opacity = arguments.length <= 5 || arguments[5] === undefined ? 0.2 : arguments[5];\n var text = arguments.length <= 6 || arguments[6] === undefined ? true : arguments[6];\n var textColor = arguments.length <= 7 || arguments[7] === undefined ? "#000000" : arguments[7];\n var textLocation = arguments.length <= 8 || arguments[8] === undefined ? "center" : arguments[8];\n\n _classCallCheck(this, LabeledGrid);\n\n var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(LabeledGrid).call(this));\n\n _this.width = width;\n _this.length = length;\n _this.step = step;\n _this.color = color;\n _this.opacity = opacity;\n _this.text = text;\n _this.textColor = textColor;\n _this.textLocation = textLocation;\n _this.upVector = new _three2.default.Vector3().fromArray(upVector);\n\n _this.name = "grid";\n\n //TODO: clean this up\n _this.marginSize = 10;\n _this.stepSubDivisions = 10;\n\n _this._drawGrid();\n\n //default grid orientation is z up, rotate if not the case\n var upVector = _this.upVector;\n _this.up = upVector;\n _this.lookAt(upVector);\n return _this;\n }\n\n _createClass(LabeledGrid, [{\n key: "_drawGrid",\n value: function _drawGrid() {\n var gridGeometry, gridMaterial, mainGridZ, planeFragmentShader, planeGeometry, planeMaterial, subGridGeometry, subGridMaterial, subGridZ;\n\n //offset to avoid z fighting\n mainGridZ = -0.05;\n gridGeometry = new _three2.default.Geometry();\n gridMaterial = new _three2.default.LineBasicMaterial({\n color: new _three2.default.Color().setHex(this.color),\n opacity: this.opacity,\n linewidth: 2,\n transparent: true\n });\n\n subGridZ = -0.05;\n subGridGeometry = new _three2.default.Geometry();\n subGridMaterial = new _three2.default.LineBasicMaterial({\n color: new _three2.default.Color().setHex(this.color),\n opacity: this.opacity / 2,\n transparent: true\n });\n\n var step = this.step;\n var stepSubDivisions = this.stepSubDivisions;\n var width = this.width;\n var length = this.length;\n\n var centerBased = true;\n\n if (centerBased) {\n for (var i = 0; i <= width / 2; i += step / stepSubDivisions) {\n subGridGeometry.vertices.push(new _three2.default.Vector3(-length / 2, i, subGridZ));\n subGridGeometry.vertices.push(new _three2.default.Vector3(length / 2, i, subGridZ));\n\n subGridGeometry.vertices.push(new _three2.default.Vector3(-length / 2, -i, subGridZ));\n subGridGeometry.vertices.push(new _three2.default.Vector3(length / 2, -i, subGridZ));\n\n if (i % step == 0) {\n gridGeometry.vertices.push(new _three2.default.Vector3(-length / 2, i, mainGridZ));\n gridGeometry.vertices.push(new _three2.default.Vector3(length / 2, i, mainGridZ));\n\n gridGeometry.vertices.push(new _three2.default.Vector3(-length / 2, -i, mainGridZ));\n gridGeometry.vertices.push(new _three2.default.Vector3(length / 2, -i, mainGridZ));\n }\n }\n for (var i = 0; i <= length / 2; i += step / stepSubDivisions) {\n subGridGeometry.vertices.push(new _three2.default.Vector3(i, -width / 2, subGridZ));\n subGridGeometry.vertices.push(new _three2.default.Vector3(i, width / 2, subGridZ));\n\n subGridGeometry.vertices.push(new _three2.default.Vector3(-i, -width / 2, subGridZ));\n subGridGeometry.vertices.push(new _three2.default.Vector3(-i, width / 2, subGridZ));\n\n if (i % step == 0) {\n gridGeometry.vertices.push(new _three2.default.Vector3(i, -width / 2, mainGridZ));\n gridGeometry.vertices.push(new _three2.default.Vector3(i, width / 2, mainGridZ));\n\n gridGeometry.vertices.push(new _three2.default.Vector3(-i, -width / 2, mainGridZ));\n gridGeometry.vertices.push(new _three2.default.Vector3(-i, width / 2, mainGridZ));\n }\n }\n } else {\n for (var i = -width / 2; i <= width / 2; i += step / stepSubDivisions) {\n subGridGeometry.vertices.push(new _three2.default.Vector3(-length / 2, i, subGridZ));\n subGridGeometry.vertices.push(new _three2.default.Vector3(length / 2, i, subGridZ));\n\n if (i % step == 0) {\n gridGeometry.vertices.push(new _three2.default.Vector3(-length / 2, i, mainGridZ));\n gridGeometry.vertices.push(new _three2.default.Vector3(length / 2, i, mainGridZ));\n }\n }\n for (var i = -length / 2; i <= length / 2; i += step / stepSubDivisions) {\n subGridGeometry.vertices.push(new _three2.default.Vector3(i, -width / 2, subGridZ));\n subGridGeometry.vertices.push(new _three2.default.Vector3(i, width / 2, subGridZ));\n\n if (i % step == 0) {\n gridGeometry.vertices.push(new _three2.default.Vector3(i, -width / 2, mainGridZ));\n gridGeometry.vertices.push(new _three2.default.Vector3(i, width / 2, mainGridZ));\n }\n }\n }\n\n this.mainGrid = new _three2.default.Line(gridGeometry, gridMaterial, _three2.default.LinePieces);\n //create sub grid geometry object\n this.subGrid = new _three2.default.Line(subGridGeometry, subGridMaterial, _three2.default.LinePieces);\n\n //create margin\n var offsetWidth = width + this.marginSize;\n var offsetLength = length + this.marginSize;\n\n var marginGeometry = new _three2.default.Geometry();\n marginGeometry.vertices.push(new _three2.default.Vector3(-length / 2, -width / 2, subGridZ));\n marginGeometry.vertices.push(new _three2.default.Vector3(length / 2, -width / 2, subGridZ));\n\n marginGeometry.vertices.push(new _three2.default.Vector3(length / 2, -width / 2, subGridZ));\n marginGeometry.vertices.push(new _three2.default.Vector3(length / 2, width / 2, subGridZ));\n\n marginGeometry.vertices.push(new _three2.default.Vector3(length / 2, width / 2, subGridZ));\n marginGeometry.vertices.push(new _three2.default.Vector3(-length / 2, width / 2, subGridZ));\n\n marginGeometry.vertices.push(new _three2.default.Vector3(-length / 2, width / 2, subGridZ));\n marginGeometry.vertices.push(new _three2.default.Vector3(-length / 2, -width / 2, subGridZ));\n\n marginGeometry.vertices.push(new _three2.default.Vector3(-offsetLength / 2, -offsetWidth / 2, subGridZ));\n marginGeometry.vertices.push(new _three2.default.Vector3(offsetLength / 2, -offsetWidth / 2, subGridZ));\n\n marginGeometry.vertices.push(new _three2.default.Vector3(offsetLength / 2, -offsetWidth / 2, subGridZ));\n marginGeometry.vertices.push(new _three2.default.Vector3(offsetLength / 2, offsetWidth / 2, subGridZ));\n\n marginGeometry.vertices.push(new _three2.default.Vector3(offsetLength / 2, offsetWidth / 2, subGridZ));\n marginGeometry.vertices.push(new _three2.default.Vector3(-offsetLength / 2, offsetWidth / 2, subGridZ));\n\n marginGeometry.vertices.push(new _three2.default.Vector3(-offsetLength / 2, offsetWidth / 2, subGridZ));\n marginGeometry.vertices.push(new _three2.default.Vector3(-offsetLength / 2, -offsetWidth / 2, subGridZ));\n\n var strongGridMaterial = new _three2.default.LineBasicMaterial({\n color: new _three2.default.Color().setHex(this.color),\n opacity: this.opacity * 2,\n linewidth: 2,\n transparent: true\n });\n this.margin = new _three2.default.Line(marginGeometry, strongGridMaterial, _three2.default.LinePieces);\n\n //add all grids, subgrids, margins etc\n this.add(this.mainGrid);\n this.add(this.subGrid);\n this.add(this.margin);\n\n this._drawNumbering();\n }\n }, {\n key: "toggle",\n value: function toggle(_toggle) {\n //apply visibility settings to all children\n this.traverse(function (child) {\n child.visible = _toggle;\n });\n }\n }, {\n key: "setOpacity",\n value: function setOpacity(opacity) {\n this.opacity = opacity;\n this.mainGrid.material.opacity = opacity;\n this.subGrid.material.opacity = opacity / 2;\n this.margin.material.opacity = opacity * 2;\n }\n }, {\n key: "setColor",\n value: function setColor(color) {\n this.color = color;\n this.mainGrid.material.color = new _three2.default.Color().setHex(this.color);\n this.subGrid.material.color = new _three2.default.Color().setHex(this.color);\n this.margin.material.color = new _three2.default.Color().setHex(this.color);\n }\n }, {\n key: "toggleText",\n value: function toggleText(toggle) {\n this.text = toggle;\n var labels = this.labels.children;\n for (var i = 0; i < this.labels.children.length; i++) {\n var label = labels[i];\n label.visible = toggle;\n }\n }\n }, {\n key: "setTextColor",\n value: function setTextColor(color) {\n this.textColor = color;\n this._drawNumbering();\n }\n }, {\n key: "setTextLocation",\n value: function setTextLocation(location) {\n this.textLocation = location;\n return this._drawNumbering();\n }\n }, {\n key: "setUp",\n value: function setUp(upVector) {\n this.upVector = upVector;\n this.up = upVector;\n this.lookAt(upVector);\n }\n }, {\n key: "resize",\n value: function resize(width, length) {\n if (width && length) {\n var width = Math.max(width, 10);\n this.width = width;\n\n var length = Math.max(length, 10);\n this.length = length;\n\n this.step = Math.max(this.step, 5);\n\n this.remove(this.mainGrid);\n this.remove(this.subGrid);\n this.remove(this.margin);\n //this.remove(this.plane);\n return this._drawGrid();\n }\n }\n }, {\n key: "_drawNumbering",\n value: function _drawNumbering() {\n var label, sizeLabel, sizeLabel2, xLabelsLeft, xLabelsRight, yLabelsBack, yLabelsFront;\n var step = this.step;\n\n this._labelStore = {};\n\n if (this.labels != null) {\n this.mainGrid.remove(this.labels);\n }\n this.labels = new _three2.default.Object3D();\n\n var width = this.width;\n var length = this.length;\n var numbering = this.numbering = "centerBased";\n\n var labelsFront = new _three2.default.Object3D();\n var labelsSideRight = new _three2.default.Object3D();\n\n if (numbering == "centerBased") {\n for (var i = 0; i <= width / 2; i += step) {\n var sizeLabel = this.drawTextOnPlane("" + i, 32);\n var sizeLabel2 = sizeLabel.clone();\n\n sizeLabel.position.set(length / 2, -i, 0.1);\n sizeLabel.rotation.z = -Math.PI / 2;\n labelsFront.add(sizeLabel);\n\n sizeLabel2.position.set(length / 2, i, 0.1);\n sizeLabel2.rotation.z = -Math.PI / 2;\n labelsFront.add(sizeLabel2);\n }\n\n for (var i = 0; i <= length / 2; i += step) {\n var sizeLabel = this.drawTextOnPlane("" + i, 32);\n var sizeLabel2 = sizeLabel.clone();\n\n sizeLabel.position.set(-i, width / 2, 0.1);\n //sizeLabel.rotation.z = -Math.PI / 2;\n labelsSideRight.add(sizeLabel);\n\n sizeLabel2.position.set(i, width / 2, 0.1);\n //sizeLabel2.rotation.z = -Math.PI / 2;\n labelsSideRight.add(sizeLabel2);\n }\n\n var labelsSideLeft = labelsSideRight.clone();\n labelsSideLeft.rotation.z = -Math.PI;\n //labelsSideLeft = labelsSideRight.clone().translateY(- width );\n\n var labelsBack = labelsFront.clone();\n labelsBack.rotation.z = -Math.PI;\n }\n\n /*if (this.textLocation === "center") {\n yLabelsRight.translateY(- length/ 2);\n xLabelsFront.translateX(- width / 2);\n } else {\n yLabelsLeft = yLabelsRight.clone().translateY( -width );\n xLabelsBack = xLabelsFront.clone().translateX( -length );\n \n this.labels.add( yLabelsLeft );\n this.labels.add( xLabelsBack) ;\n }*/\n //this.labels.add( yLabelsRight );\n this.labels.add(labelsFront);\n this.labels.add(labelsBack);\n\n this.labels.add(labelsSideRight);\n this.labels.add(labelsSideLeft);\n\n //apply visibility settings to all labels\n var textVisible = this.text;\n this.labels.traverse(function (child) {\n child.visible = textVisible;\n });\n\n this.mainGrid.add(this.labels);\n }\n }, {\n key: "drawTextOnPlane",\n value: function drawTextOnPlane(text, size) {\n var canvas, context, material, plane, texture;\n\n if (size == null) {\n size = 256;\n }\n\n if (document) {\n canvas = document.createElement(\'canvas\');\n } else {\n canvas = {};\n }\n\n var size = 128;\n canvas.width = size;\n canvas.height = size;\n context = canvas.getContext(\'2d\');\n context.font = "18px sans-serif";\n context.textAlign = \'center\';\n context.fillStyle = this.textColor;\n context.fillText(text, canvas.width / 2, canvas.height / 2);\n context.strokeStyle = this.textColor;\n context.strokeText(text, canvas.width / 2, canvas.height / 2);\n\n texture = new _three2.default.Texture(canvas);\n texture.needsUpdate = true;\n texture.generateMipmaps = true;\n texture.magFilter = _three2.default.LinearFilter;\n texture.minFilter = _three2.default.LinearFilter;\n\n material = new _three2.default.MeshBasicMaterial({\n map: texture,\n transparent: true,\n color: 0xffffff,\n alphaTest: 0.3\n });\n plane = new _three2.default.Mesh(new _three2.default.PlaneBufferGeometry(size / 8, size / 8), material);\n plane.doubleSided = true;\n plane.overdraw = true;\n\n return plane;\n }\n }]);\n\n return LabeledGrid;\n})(_three2.default.Object3D);\n\n//autoresize, disabled for now\n/*\nupdateGridSize() {\n var max, maxX, maxY, min, minX, minY, size, subchild, _getBounds, _i, _len, _ref,\n _this = this;\n minX = 99999;\n maxX = -99999;\n minY = 99999;\n maxY = -99999;\n _getBounds = function(mesh) {\n var bBox, subchild, _i, _len, _ref, _results;\n if (mesh instanceof THREE.Mesh) {\n mesh.geometry.computeBoundingBox();\n bBox = mesh.geometry.boundingBox;\n minX = Math.min(minX, bBox.min.x);\n maxX = Math.max(maxX, bBox.max.x);\n minY = Math.min(minY, bBox.min.y);\n maxY = Math.max(maxY, bBox.max.y);\n _ref = mesh.children;\n _results = [];\n for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n subchild = _ref[_i];\n _results.push(_getBounds(subchild));\n }\n return _results;\n }\n };\n if (this.rootAssembly != null) {\n _ref = this.rootAssembly.children;\n for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n subchild = _ref[_i];\n if (subchild.name !== "renderSubs" && subchild.name !== "connectors") {\n _getBounds(subchild);\n }\n }\n }\n max = Math.max(Math.max(maxX, maxY), 100);\n min = Math.min(Math.min(minX, minY), -100);\n size = (Math.max(max, Math.abs(min))) * 2;\n size = Math.ceil(size / 10) * 10;\n if (size >= 200) {\n return this.resize(size);\n }\n};\n*/\n\nexports.default = LabeledGrid;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/glView-helpers/lib/grids/LabeledGrid.js\n ** module id = 81\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/glView-helpers/lib/grids/LabeledGrid.js?')},function(module,exports,__webpack_require__){ eval('var map = {\n "./contexts/context": 25,\n "./contexts/context.js": 25,\n "./contexts/diff": 26,\n "./contexts/diff.js": 26,\n "./contexts/patch": 27,\n "./contexts/patch.js": 27,\n "./contexts/reverse": 28,\n "./contexts/reverse.js": 28,\n "./date-reviver": 41,\n "./date-reviver.js": 41,\n "./diffpatcher": 50,\n "./diffpatcher.js": 50,\n "./environment": 29,\n "./environment.js": 29,\n "./filters/arrays": 51,\n "./filters/arrays.js": 51,\n "./filters/dates": 52,\n "./filters/dates.js": 52,\n "./filters/lcs": 53,\n "./filters/lcs.js": 53,\n "./filters/nested": 54,\n "./filters/nested.js": 54,\n "./filters/texts": 55,\n "./filters/texts.js": 55,\n "./filters/trivial": 56,\n "./filters/trivial.js": 56,\n "./formatters/annotated": 30,\n "./formatters/annotated.js": 30,\n "./formatters/base": 14,\n "./formatters/base.js": 14,\n "./formatters/console": 42,\n "./formatters/console.js": 42,\n "./formatters/html": 31,\n "./formatters/html.js": 31,\n "./formatters/index": 35,\n "./formatters/index.js": 35,\n "./formatters/jsonpatch": 32,\n "./formatters/jsonpatch.js": 32,\n "./main": 17,\n "./main-formatters": 83,\n "./main-formatters.js": 83,\n "./main-full": 84,\n "./main-full.js": 84,\n "./main.js": 17,\n "./pipe": 43,\n "./pipe.js": 43,\n "./processor": 57,\n "./processor.js": 57\n};\nfunction webpackContext(req) {\n return __webpack_require__(webpackContextResolve(req));\n};\nfunction webpackContextResolve(req) {\n return map[req] || (function() { throw new Error("Cannot find module \'" + req + "\'.") }());\n};\nwebpackContext.keys = function webpackContextKeys() {\n return Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 82;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/jsondiffpatch/src ^\\.\\/.*$\n ** module id = 82\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/jsondiffpatch/src_^\\.\\/.*$?')},function(module,exports,__webpack_require__){eval("\nmodule.exports = __webpack_require__(35);\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/jsondiffpatch/src/main-formatters.js\n ** module id = 83\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/jsondiffpatch/src/main-formatters.js?")},function(module,exports,__webpack_require__){eval("var environment = __webpack_require__(29);\n\nif (environment.isBrowser) {\n /* global window */\n /* jshint camelcase: false */\n window.diff_match_patch = __webpack_require__(49);\n /* jshint camelcase: true */\n}\n\nmodule.exports = __webpack_require__(17);\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/jsondiffpatch/src/main-full.js\n ** module id = 84\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/jsondiffpatch/src/main-full.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = selectorParser;\n\nvar _browserSplit = __webpack_require__(88);\n\nvar _browserSplit2 = _interopRequireDefault(_browserSplit);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar classIdSplit = /([\\.#]?[a-zA-Z0-9\\u007F-\\uFFFF_:-]+)/;\nvar notClassId = /^\\.|#/;\n\nfunction selectorParser() {\n var selector = arguments.length <= 0 || arguments[0] === undefined ? '' : arguments[0];\n\n var tagName = undefined;\n var id = '';\n var classes = [];\n\n var tagParts = (0, _browserSplit2.default)(selector, classIdSplit);\n\n if (notClassId.test(tagParts[1]) || selector === '') {\n tagName = 'div';\n }\n\n var part = undefined;\n var type = undefined;\n var i = undefined;\n\n for (i = 0; i < tagParts.length; i++) {\n part = tagParts[i];\n\n if (!part) {\n continue;\n }\n\n type = part.charAt(0);\n\n if (!tagName) {\n tagName = part;\n } else if (type === '.') {\n classes.push(part.substring(1, part.length));\n } else if (type === '#') {\n id = part.substring(1, part.length);\n }\n }\n\n return {\n tagName: tagName,\n id: id,\n className: classes.join(' ')\n };\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/snabbdom-selector/lib/selectorParser.js\n ** module id = 85\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/snabbdom-selector/lib/selectorParser.js?")},function(module,exports,__webpack_require__){eval("\n// https://github.com/Matt-Esch/virtual-dom/blob/master/virtual-hyperscript/parse-tag.js\n\nvar split = __webpack_require__(88);\n\nvar classIdSplit = /([\\.#]?[a-zA-Z0-9\\u007F-\\uFFFF_:-]+)/;\nvar notClassId = /^\\.|#/;\n\nmodule.exports = function parseSelector(selector, upper) {\n selector = selector || '';\n var tagName;\n var id = '';\n var classes = [];\n\n var tagParts = split(selector, classIdSplit);\n\n if (notClassId.test(tagParts[1]) || selector === '') {\n tagName = 'div';\n }\n\n var part, type, i;\n\n for (i = 0; i < tagParts.length; i++) {\n part = tagParts[i];\n\n if (!part) {\n continue;\n }\n\n type = part.charAt(0);\n\n if (!tagName) {\n tagName = part;\n } else if (type === '.') {\n classes.push(part.substring(1, part.length));\n } else if (type === '#') {\n id = part.substring(1, part.length);\n }\n }\n\n return {\n tagName: upper === true ? tagName.toUpperCase() : tagName,\n id: id,\n className: classes.join(' ')\n };\n};\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/snabbdom-to-html/lib/parse-selector.js\n ** module id = 86\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/snabbdom-to-html/lib/parse-selector.js?")},function(module,exports){eval("'use strict';\nmodule.exports = function () {\n return /[\\u001b\\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g;\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/ansi-regex/index.js\n ** module id = 87\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/ansi-regex/index.js?")},function(module,exports){eval("/*!\n * Cross-Browser Split 1.1.1\n * Copyright 2007-2012 Steven Levithan \n * Available under the MIT License\n * ECMAScript compliant, uniform cross-browser split method\n */\n\n/**\n * Splits a string into an array of strings using a regex or string separator. Matches of the\n * separator are not included in the result array. However, if `separator` is a regex that contains\n * capturing groups, backreferences are spliced into the result each time `separator` is matched.\n * Fixes browser bugs compared to the native `String.prototype.split` and can be used reliably\n * cross-browser.\n * @param {String} str String to split.\n * @param {RegExp|String} separator Regex or string to use for separating the string.\n * @param {Number} [limit] Maximum number of items to include in the result array.\n * @returns {Array} Array of substrings.\n * @example\n *\n * // Basic use\n * split('a b c d', ' ');\n * // -> ['a', 'b', 'c', 'd']\n *\n * // With limit\n * split('a b c d', ' ', 2);\n * // -> ['a', 'b']\n *\n * // Backreferences in result array\n * split('..word1 word2..', /([a-z]+)(\\d+)/i);\n * // -> ['..', 'word', '1', ' ', 'word', '2', '..']\n */\nmodule.exports = (function split(undef) {\n\n var nativeSplit = String.prototype.split,\n compliantExecNpcg = /()??/.exec(\"\")[1] === undef,\n // NPCG: nonparticipating capturing group\n self;\n\n self = function(str, separator, limit) {\n // If `separator` is not a regex, use `nativeSplit`\n if (Object.prototype.toString.call(separator) !== \"[object RegExp]\") {\n return nativeSplit.call(str, separator, limit);\n }\n var output = [],\n flags = (separator.ignoreCase ? \"i\" : \"\") + (separator.multiline ? \"m\" : \"\") + (separator.extended ? \"x\" : \"\") + // Proposed for ES6\n (separator.sticky ? \"y\" : \"\"),\n // Firefox 3+\n lastLastIndex = 0,\n // Make `global` and avoid `lastIndex` issues by working with a copy\n separator = new RegExp(separator.source, flags + \"g\"),\n separator2, match, lastIndex, lastLength;\n str += \"\"; // Type-convert\n if (!compliantExecNpcg) {\n // Doesn't need flags gy, but they don't hurt\n separator2 = new RegExp(\"^\" + separator.source + \"$(?!\\\\s)\", flags);\n }\n /* Values for `limit`, per the spec:\n * If undefined: 4294967295 // Math.pow(2, 32) - 1\n * If 0, Infinity, or NaN: 0\n * If positive number: limit = Math.floor(limit); if (limit > 4294967295) limit -= 4294967296;\n * If negative number: 4294967296 - Math.floor(Math.abs(limit))\n * If other: Type-convert, then use the above rules\n */\n limit = limit === undef ? -1 >>> 0 : // Math.pow(2, 32) - 1\n limit >>> 0; // ToUint32(limit)\n while (match = separator.exec(str)) {\n // `separator.lastIndex` is not reliable cross-browser\n lastIndex = match.index + match[0].length;\n if (lastIndex > lastLastIndex) {\n output.push(str.slice(lastLastIndex, match.index));\n // Fix browsers whose `exec` methods don't consistently return `undefined` for\n // nonparticipating capturing groups\n if (!compliantExecNpcg && match.length > 1) {\n match[0].replace(separator2, function() {\n for (var i = 1; i < arguments.length - 2; i++) {\n if (arguments[i] === undef) {\n match[i] = undef;\n }\n }\n });\n }\n if (match.length > 1 && match.index < str.length) {\n Array.prototype.push.apply(output, match.slice(1));\n }\n lastLength = match[0].length;\n lastLastIndex = lastIndex;\n if (output.length >= limit) {\n break;\n }\n }\n if (separator.lastIndex === match.index) {\n separator.lastIndex++; // Avoid an infinite loop\n }\n }\n if (lastLastIndex === str.length) {\n if (lastLength || !separator.test(\"\")) {\n output.push(\"\");\n }\n } else {\n output.push(str.slice(lastLastIndex));\n }\n return output.length > limit ? output.slice(0, limit) : output;\n };\n\n return self;\n})();\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/browser-split/index.js\n ** module id = 88\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/browser-split/index.js?")},function(module,exports){eval("/**\n * lodash 3.9.1 (Custom Build) \n * Build: `lodash modern modularize exports=\"npm\" -o ./`\n * Copyright 2012-2015 The Dojo Foundation \n * Based on Underscore.js 1.8.3 \n * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n * Available under MIT license \n */\n\n/** `Object#toString` result references. */\nvar funcTag = '[object Function]';\n\n/** Used to detect host constructors (Safari > 5). */\nvar reIsHostCtor = /^\\[object .+?Constructor\\]$/;\n\n/**\n * Checks if `value` is object-like.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n */\nfunction isObjectLike(value) {\n return !!value && typeof value == 'object';\n}\n\n/** Used for native method references. */\nvar objectProto = Object.prototype;\n\n/** Used to resolve the decompiled source of functions. */\nvar fnToString = Function.prototype.toString;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objToString = objectProto.toString;\n\n/** Used to detect if a method is native. */\nvar reIsNative = RegExp('^' +\n fnToString.call(hasOwnProperty).replace(/[\\\\^$.*+?()[\\]{}|]/g, '\\\\$&')\n .replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g, '$1.*?') + '$'\n);\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 = object == null ? undefined : object[key];\n return isNative(value) ? value : undefined;\n}\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in older versions of Chrome and Safari which return 'function' for regexes\n // and Safari 8 equivalents which return 'object' for typed array constructors.\n return isObject(value) && objToString.call(value) == funcTag;\n}\n\n/**\n * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.\n * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\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(1);\n * // => false\n */\nfunction isObject(value) {\n // Avoid a V8 JIT bug in Chrome 19-20.\n // See https://code.google.com/p/v8/issues/detail?id=2291 for more details.\n var type = typeof value;\n return !!value && (type == 'object' || type == 'function');\n}\n\n/**\n * Checks if `value` is a native function.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a native function, else `false`.\n * @example\n *\n * _.isNative(Array.prototype.push);\n * // => true\n *\n * _.isNative(_);\n * // => false\n */\nfunction isNative(value) {\n if (value == null) {\n return false;\n }\n if (isFunction(value)) {\n return reIsNative.test(fnToString.call(value));\n }\n return isObjectLike(value) && reIsHostCtor.test(value);\n}\n\nmodule.exports = getNative;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash._getnative/index.js\n ** module id = 89\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/lodash._getnative/index.js?")},function(module,exports,__webpack_require__){eval("/**\n * lodash 3.2.0 (Custom Build) \n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright 2012-2016 The Dojo Foundation \n * Based on Underscore.js 1.8.3 \n * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n * Available under MIT license \n */\nvar root = __webpack_require__(61);\n\n/** Used as references for various `Number` constants. */\nvar INFINITY = 1 / 0;\n\n/** `Object#toString` result references. */\nvar symbolTag = '[object Symbol]';\n\n/** Used to match HTML entities and HTML characters. */\nvar reUnescapedHtml = /[&<>\"'`]/g,\n reHasUnescapedHtml = RegExp(reUnescapedHtml.source);\n\n/** Used to map characters to HTML entities. */\nvar htmlEscapes = {\n '&': '&',\n '<': '<',\n '>': '>',\n '\"': '"',\n \"'\": ''',\n '`': '`'\n};\n\n/**\n * Used by `_.escape` to convert characters to HTML entities.\n *\n * @private\n * @param {string} chr The matched character to escape.\n * @returns {string} Returns the escaped character.\n */\nfunction escapeHtmlChar(chr) {\n return htmlEscapes[chr];\n}\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objectToString = objectProto.toString;\n\n/** Built-in value references. */\nvar Symbol = root.Symbol;\n\n/** Used to convert symbols to primitives and strings. */\nvar symbolProto = Symbol ? Symbol.prototype : undefined,\n symbolToString = Symbol ? symbolProto.toString : undefined;\n\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 * @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 && typeof value == 'object';\n}\n\n/**\n * Checks if `value` is classified as a `Symbol` primitive or object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, 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) && objectToString.call(value) == symbolTag);\n}\n\n/**\n * Converts `value` to a string if it's not one. An empty string is returned\n * for `null` and `undefined` values. The sign of `-0` is preserved.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to process.\n * @returns {string} Returns the 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 // Exit early for strings to avoid a performance hit in some environments.\n if (typeof value == 'string') {\n return value;\n }\n if (value == null) {\n return '';\n }\n if (isSymbol(value)) {\n return Symbol ? symbolToString.call(value) : '';\n }\n var result = (value + '');\n return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;\n}\n\n/**\n * Converts the characters \"&\", \"<\", \">\", '\"', \"'\", and \"\\`\" in `string` to\n * their corresponding HTML entities.\n *\n * **Note:** No other characters are escaped. To escape additional\n * characters use a third-party library like [_he_](https://mths.be/he).\n *\n * Though the \">\" character is escaped for symmetry, characters like\n * \">\" and \"/\" don't need escaping in HTML and have no special meaning\n * unless they're part of a tag or unquoted attribute value.\n * See [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)\n * (under \"semi-related fun fact\") for more details.\n *\n * Backticks are escaped because in IE < 9, they can break out of\n * attribute values or HTML comments. See [#59](https://html5sec.org/#59),\n * [#102](https://html5sec.org/#102), [#108](https://html5sec.org/#108), and\n * [#133](https://html5sec.org/#133) of the [HTML5 Security Cheatsheet](https://html5sec.org/)\n * for more details.\n *\n * When working with HTML you should always [quote attribute values](http://wonko.com/post/html-escaping)\n * to reduce XSS vectors.\n *\n * @static\n * @memberOf _\n * @category String\n * @param {string} [string=''] The string to escape.\n * @returns {string} Returns the escaped string.\n * @example\n *\n * _.escape('fred, barney, & pebbles');\n * // => 'fred, barney, & pebbles'\n */\nfunction escape(string) {\n string = toString(string);\n return (string && reHasUnescapedHtml.test(string))\n ? string.replace(reUnescapedHtml, escapeHtmlChar)\n : string;\n}\n\nmodule.exports = escape;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash.escape/index.js\n ** module id = 90\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/lodash.escape/index.js?")},function(module,exports,__webpack_require__){eval("/**\n * lodash 3.0.2 (Custom Build) \n * Build: `lodash modern modularize exports=\"npm\" -o ./`\n * Copyright 2012-2015 The Dojo Foundation \n * Based on Underscore.js 1.8.3 \n * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n * Available under MIT license \n */\nvar baseFor = __webpack_require__(309),\n bindCallback = __webpack_require__(312),\n keys = __webpack_require__(317);\n\n/**\n * The base implementation of `_.forOwn` without support for callback\n * shorthands and `this` binding.\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 baseFor(object, iteratee, keys);\n}\n\n/**\n * Creates a function for `_.forOwn` or `_.forOwnRight`.\n *\n * @private\n * @param {Function} objectFunc The function to iterate over an object.\n * @returns {Function} Returns the new each function.\n */\nfunction createForOwn(objectFunc) {\n return function(object, iteratee, thisArg) {\n if (typeof iteratee != 'function' || thisArg !== undefined) {\n iteratee = bindCallback(iteratee, thisArg, 3);\n }\n return objectFunc(object, iteratee);\n };\n}\n\n/**\n * Iterates over own enumerable properties of an object invoking `iteratee`\n * for each property. The `iteratee` is bound to `thisArg` and invoked with\n * three arguments: (value, key, object). Iteratee functions may exit iteration\n * early by explicitly returning `false`.\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Object} object The object to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @param {*} [thisArg] The `this` binding of `iteratee`.\n * @returns {Object} Returns `object`.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.forOwn(new Foo, function(value, key) {\n * console.log(key);\n * });\n * // => logs 'a' and 'b' (iteration order is not guaranteed)\n */\nvar forOwn = createForOwn(baseForOwn);\n\nmodule.exports = forOwn;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash.forown/index.js\n ** module id = 91\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/lodash.forown/index.js?")},function(module,exports){eval("/**\n * lodash 3.0.8 (Custom Build) \n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright 2012-2016 The Dojo Foundation \n * Based on Underscore.js 1.8.3 \n * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n * Available under MIT license \n */\n\n/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]',\n funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]';\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 [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objectToString = objectProto.toString;\n\n/** Built-in value references. */\nvar propertyIsEnumerable = objectProto.propertyIsEnumerable;\n\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 function.\n */\nfunction baseProperty(key) {\n return function(object) {\n return object == null ? undefined : object[key];\n };\n}\n\n/**\n * Gets the \"length\" property value of `object`.\n *\n * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792)\n * that affects Safari on at least iOS 8.1-8.3 ARM64.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {*} Returns the \"length\" value.\n */\nvar getLength = baseProperty('length');\n\n/**\n * Checks if `value` is likely an `arguments` object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isArguments(function() { return arguments; }());\n * // => true\n *\n * _.isArguments([1, 2, 3]);\n * // => false\n */\nfunction isArguments(value) {\n // Safari 8.1 incorrectly makes `arguments.callee` enumerable in strict mode.\n return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&\n (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);\n}\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 * @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(getLength(value)) && !isFunction(value);\n}\n\n/**\n * This method is like `_.isArrayLike` except that it also checks if `value`\n * is an object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array-like object, else `false`.\n * @example\n *\n * _.isArrayLikeObject([1, 2, 3]);\n * // => true\n *\n * _.isArrayLikeObject(document.body.children);\n * // => true\n *\n * _.isArrayLikeObject('abc');\n * // => false\n *\n * _.isArrayLikeObject(_.noop);\n * // => false\n */\nfunction isArrayLikeObject(value) {\n return isObjectLike(value) && isArrayLike(value);\n}\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in Safari 8 which returns 'object' for typed array and weak map constructors,\n // and PhantomJS 1.9 which returns 'function' for `NodeList` instances.\n var tag = isObject(value) ? objectToString.call(value) : '';\n return tag == funcTag || tag == genTag;\n}\n\n/**\n * Checks if `value` is a valid array-like length.\n *\n * **Note:** This function is loosely based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).\n *\n * @static\n * @memberOf _\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\n/**\n * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.\n * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\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 && (type == 'object' || type == 'function');\n}\n\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 * @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 && typeof value == 'object';\n}\n\nmodule.exports = isArguments;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash.isarguments/index.js\n ** module id = 92\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/lodash.isarguments/index.js?")},function(module,exports){eval("/**\n * lodash 3.0.4 (Custom Build) \n * Build: `lodash modern modularize exports=\"npm\" -o ./`\n * Copyright 2012-2015 The Dojo Foundation \n * Based on Underscore.js 1.8.3 \n * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n * Available under MIT license \n */\n\n/** `Object#toString` result references. */\nvar arrayTag = '[object Array]',\n funcTag = '[object Function]';\n\n/** Used to detect host constructors (Safari > 5). */\nvar reIsHostCtor = /^\\[object .+?Constructor\\]$/;\n\n/**\n * Checks if `value` is object-like.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n */\nfunction isObjectLike(value) {\n return !!value && typeof value == 'object';\n}\n\n/** Used for native method references. */\nvar objectProto = Object.prototype;\n\n/** Used to resolve the decompiled source of functions. */\nvar fnToString = Function.prototype.toString;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objToString = objectProto.toString;\n\n/** Used to detect if a method is native. */\nvar reIsNative = RegExp('^' +\n fnToString.call(hasOwnProperty).replace(/[\\\\^$.*+?()[\\]{}|]/g, '\\\\$&')\n .replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g, '$1.*?') + '$'\n);\n\n/* Native method references for those with the same name as other `lodash` methods. */\nvar nativeIsArray = getNative(Array, 'isArray');\n\n/**\n * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer)\n * of an array-like value.\n */\nvar MAX_SAFE_INTEGER = 9007199254740991;\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 = object == null ? undefined : object[key];\n return isNative(value) ? value : undefined;\n}\n\n/**\n * Checks if `value` is a valid array-like length.\n *\n * **Note:** This function is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n */\nfunction isLength(value) {\n return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n}\n\n/**\n * Checks if `value` is classified as an `Array` object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isArray([1, 2, 3]);\n * // => true\n *\n * _.isArray(function() { return arguments; }());\n * // => false\n */\nvar isArray = nativeIsArray || function(value) {\n return isObjectLike(value) && isLength(value.length) && objToString.call(value) == arrayTag;\n};\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in older versions of Chrome and Safari which return 'function' for regexes\n // and Safari 8 equivalents which return 'object' for typed array constructors.\n return isObject(value) && objToString.call(value) == funcTag;\n}\n\n/**\n * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.\n * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\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(1);\n * // => false\n */\nfunction isObject(value) {\n // Avoid a V8 JIT bug in Chrome 19-20.\n // See https://code.google.com/p/v8/issues/detail?id=2291 for more details.\n var type = typeof value;\n return !!value && (type == 'object' || type == 'function');\n}\n\n/**\n * Checks if `value` is a native function.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a native function, else `false`.\n * @example\n *\n * _.isNative(Array.prototype.push);\n * // => true\n *\n * _.isNative(_);\n * // => false\n */\nfunction isNative(value) {\n if (value == null) {\n return false;\n }\n if (isFunction(value)) {\n return reIsNative.test(fnToString.call(value));\n }\n return isObjectLike(value) && reIsHostCtor.test(value);\n}\n\nmodule.exports = isArray;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash.isarray/index.js\n ** module id = 93\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/lodash.isarray/index.js?"); },function(module,exports){eval("/**\n * Tween.js - Licensed under the MIT license\n * https://github.com/sole/tween.js\n * ----------------------------------------------\n *\n * See https://github.com/sole/tween.js/graphs/contributors for the full list of contributors.\n * Thank you all, you're awesome!\n */\n\n// Date.now shim for (ahem) Internet Explo(d|r)er\nif ( Date.now === undefined ) {\n\n Date.now = function () {\n\n return new Date().valueOf();\n\n };\n\n}\n\nvar TWEEN = TWEEN || ( function () {\n\n var _tweens = [];\n\n return {\n\n REVISION: '14',\n\n getAll: function () {\n\n return _tweens;\n\n },\n\n removeAll: function () {\n\n _tweens = [];\n\n },\n\n add: function ( tween ) {\n\n _tweens.push( tween );\n\n },\n\n remove: function ( tween ) {\n\n var i = _tweens.indexOf( tween );\n\n if ( i !== -1 ) {\n\n _tweens.splice( i, 1 );\n\n }\n\n },\n\n update: function ( time ) {\n\n if ( _tweens.length === 0 ) return false;\n\n var i = 0;\n\n time = time !== undefined ? time : ( typeof window !== 'undefined' && window.performance !== undefined && window.performance.now !== undefined ? window.performance.now() : Date.now() );\n\n while ( i < _tweens.length ) {\n\n if ( _tweens[ i ].update( time ) ) {\n\n i++;\n\n } else {\n\n _tweens.splice( i, 1 );\n\n }\n\n }\n\n return true;\n\n }\n };\n\n} )();\n\nTWEEN.Tween = function ( object ) {\n\n var _object = object;\n var _valuesStart = {};\n var _valuesEnd = {};\n var _valuesStartRepeat = {};\n var _duration = 1000;\n var _repeat = 0;\n var _yoyo = false;\n var _isPlaying = false;\n var _reversed = false;\n var _delayTime = 0;\n var _startTime = null;\n var _easingFunction = TWEEN.Easing.Linear.None;\n var _interpolationFunction = TWEEN.Interpolation.Linear;\n var _chainedTweens = [];\n var _onStartCallback = null;\n var _onStartCallbackFired = false;\n var _onUpdateCallback = null;\n var _onCompleteCallback = null;\n var _onStopCallback = null;\n\n // Set all starting values present on the target object\n for ( var field in object ) {\n\n _valuesStart[ field ] = parseFloat(object[field], 10);\n\n }\n\n this.to = function ( properties, duration ) {\n\n if ( duration !== undefined ) {\n\n _duration = duration;\n\n }\n\n _valuesEnd = properties;\n\n return this;\n\n };\n\n this.start = function ( time ) {\n\n TWEEN.add( this );\n\n _isPlaying = true;\n\n _onStartCallbackFired = false;\n\n _startTime = time !== undefined ? time : ( typeof window !== 'undefined' && window.performance !== undefined && window.performance.now !== undefined ? window.performance.now() : Date.now() );\n _startTime += _delayTime;\n\n for ( var property in _valuesEnd ) {\n\n // check if an Array was provided as property value\n if ( _valuesEnd[ property ] instanceof Array ) {\n\n if ( _valuesEnd[ property ].length === 0 ) {\n\n continue;\n\n }\n\n // create a local copy of the Array with the start value at the front\n _valuesEnd[ property ] = [ _object[ property ] ].concat( _valuesEnd[ property ] );\n\n }\n\n _valuesStart[ property ] = _object[ property ];\n\n if( ( _valuesStart[ property ] instanceof Array ) === false ) {\n _valuesStart[ property ] *= 1.0; // Ensures we're using numbers, not strings\n }\n\n _valuesStartRepeat[ property ] = _valuesStart[ property ] || 0;\n\n }\n\n return this;\n\n };\n\n this.stop = function () {\n\n if ( !_isPlaying ) {\n return this;\n }\n\n TWEEN.remove( this );\n _isPlaying = false;\n\n if ( _onStopCallback !== null ) {\n\n _onStopCallback.call( _object );\n\n }\n\n this.stopChainedTweens();\n return this;\n\n };\n\n this.stopChainedTweens = function () {\n\n for ( var i = 0, numChainedTweens = _chainedTweens.length; i < numChainedTweens; i++ ) {\n\n _chainedTweens[ i ].stop();\n\n }\n\n };\n\n this.delay = function ( amount ) {\n\n _delayTime = amount;\n return this;\n\n };\n\n this.repeat = function ( times ) {\n\n _repeat = times;\n return this;\n\n };\n\n this.yoyo = function( yoyo ) {\n\n _yoyo = yoyo;\n return this;\n\n };\n\n\n this.easing = function ( easing ) {\n\n _easingFunction = easing;\n return this;\n\n };\n\n this.interpolation = function ( interpolation ) {\n\n _interpolationFunction = interpolation;\n return this;\n\n };\n\n this.chain = function () {\n\n _chainedTweens = arguments;\n return this;\n\n };\n\n this.onStart = function ( callback ) {\n\n _onStartCallback = callback;\n return this;\n\n };\n\n this.onUpdate = function ( callback ) {\n\n _onUpdateCallback = callback;\n return this;\n\n };\n\n this.onComplete = function ( callback ) {\n\n _onCompleteCallback = callback;\n return this;\n\n };\n\n this.onStop = function ( callback ) {\n\n _onStopCallback = callback;\n return this;\n\n };\n\n this.update = function ( time ) {\n\n var property;\n\n if ( time < _startTime ) {\n\n return true;\n\n }\n\n if ( _onStartCallbackFired === false ) {\n\n if ( _onStartCallback !== null ) {\n\n _onStartCallback.call( _object );\n\n }\n\n _onStartCallbackFired = true;\n\n }\n\n var elapsed = ( time - _startTime ) / _duration;\n elapsed = elapsed > 1 ? 1 : elapsed;\n\n var value = _easingFunction( elapsed );\n\n for ( property in _valuesEnd ) {\n\n var start = _valuesStart[ property ] || 0;\n var end = _valuesEnd[ property ];\n\n if ( end instanceof Array ) {\n\n _object[ property ] = _interpolationFunction( end, value );\n\n } else {\n\n // Parses relative end values with start as base (e.g.: +10, -3)\n if ( typeof(end) === \"string\" ) {\n end = start + parseFloat(end, 10);\n }\n\n // protect against non numeric properties.\n if ( typeof(end) === \"number\" ) {\n _object[ property ] = start + ( end - start ) * value;\n }\n\n }\n\n }\n\n if ( _onUpdateCallback !== null ) {\n\n _onUpdateCallback.call( _object, value );\n\n }\n\n if ( elapsed == 1 ) {\n\n if ( _repeat > 0 ) {\n\n if( isFinite( _repeat ) ) {\n _repeat--;\n }\n\n // reassign starting values, restart by making startTime = now\n for( property in _valuesStartRepeat ) {\n\n if ( typeof( _valuesEnd[ property ] ) === \"string\" ) {\n _valuesStartRepeat[ property ] = _valuesStartRepeat[ property ] + parseFloat(_valuesEnd[ property ], 10);\n }\n\n if (_yoyo) {\n var tmp = _valuesStartRepeat[ property ];\n _valuesStartRepeat[ property ] = _valuesEnd[ property ];\n _valuesEnd[ property ] = tmp;\n }\n\n _valuesStart[ property ] = _valuesStartRepeat[ property ];\n\n }\n\n if (_yoyo) {\n _reversed = !_reversed;\n }\n\n _startTime = time + _delayTime;\n\n return true;\n\n } else {\n\n if ( _onCompleteCallback !== null ) {\n\n _onCompleteCallback.call( _object );\n\n }\n\n for ( var i = 0, numChainedTweens = _chainedTweens.length; i < numChainedTweens; i++ ) {\n\n _chainedTweens[ i ].start( time );\n\n }\n\n return false;\n\n }\n\n }\n\n return true;\n\n };\n\n};\n\n\nTWEEN.Easing = {\n\n Linear: {\n\n None: function ( k ) {\n\n return k;\n\n }\n\n },\n\n Quadratic: {\n\n In: function ( k ) {\n\n return k * k;\n\n },\n\n Out: function ( k ) {\n\n return k * ( 2 - k );\n\n },\n\n InOut: function ( k ) {\n\n if ( ( k *= 2 ) < 1 ) return 0.5 * k * k;\n return - 0.5 * ( --k * ( k - 2 ) - 1 );\n\n }\n\n },\n\n Cubic: {\n\n In: function ( k ) {\n\n return k * k * k;\n\n },\n\n Out: function ( k ) {\n\n return --k * k * k + 1;\n\n },\n\n InOut: function ( k ) {\n\n if ( ( k *= 2 ) < 1 ) return 0.5 * k * k * k;\n return 0.5 * ( ( k -= 2 ) * k * k + 2 );\n\n }\n\n },\n\n Quartic: {\n\n In: function ( k ) {\n\n return k * k * k * k;\n\n },\n\n Out: function ( k ) {\n\n return 1 - ( --k * k * k * k );\n\n },\n\n InOut: function ( k ) {\n\n if ( ( k *= 2 ) < 1) return 0.5 * k * k * k * k;\n return - 0.5 * ( ( k -= 2 ) * k * k * k - 2 );\n\n }\n\n },\n\n Quintic: {\n\n In: function ( k ) {\n\n return k * k * k * k * k;\n\n },\n\n Out: function ( k ) {\n\n return --k * k * k * k * k + 1;\n\n },\n\n InOut: function ( k ) {\n\n if ( ( k *= 2 ) < 1 ) return 0.5 * k * k * k * k * k;\n return 0.5 * ( ( k -= 2 ) * k * k * k * k + 2 );\n\n }\n\n },\n\n Sinusoidal: {\n\n In: function ( k ) {\n\n return 1 - Math.cos( k * Math.PI / 2 );\n\n },\n\n Out: function ( k ) {\n\n return Math.sin( k * Math.PI / 2 );\n\n },\n\n InOut: function ( k ) {\n\n return 0.5 * ( 1 - Math.cos( Math.PI * k ) );\n\n }\n\n },\n\n Exponential: {\n\n In: function ( k ) {\n\n return k === 0 ? 0 : Math.pow( 1024, k - 1 );\n\n },\n\n Out: function ( k ) {\n\n return k === 1 ? 1 : 1 - Math.pow( 2, - 10 * k );\n\n },\n\n InOut: function ( k ) {\n\n if ( k === 0 ) return 0;\n if ( k === 1 ) return 1;\n if ( ( k *= 2 ) < 1 ) return 0.5 * Math.pow( 1024, k - 1 );\n return 0.5 * ( - Math.pow( 2, - 10 * ( k - 1 ) ) + 2 );\n\n }\n\n },\n\n Circular: {\n\n In: function ( k ) {\n\n return 1 - Math.sqrt( 1 - k * k );\n\n },\n\n Out: function ( k ) {\n\n return Math.sqrt( 1 - ( --k * k ) );\n\n },\n\n InOut: function ( k ) {\n\n if ( ( k *= 2 ) < 1) return - 0.5 * ( Math.sqrt( 1 - k * k) - 1);\n return 0.5 * ( Math.sqrt( 1 - ( k -= 2) * k) + 1);\n\n }\n\n },\n\n Elastic: {\n\n In: function ( k ) {\n\n var s, a = 0.1, p = 0.4;\n if ( k === 0 ) return 0;\n if ( k === 1 ) return 1;\n if ( !a || a < 1 ) { a = 1; s = p / 4; }\n else s = p * Math.asin( 1 / a ) / ( 2 * Math.PI );\n return - ( a * Math.pow( 2, 10 * ( k -= 1 ) ) * Math.sin( ( k - s ) * ( 2 * Math.PI ) / p ) );\n\n },\n\n Out: function ( k ) {\n\n var s, a = 0.1, p = 0.4;\n if ( k === 0 ) return 0;\n if ( k === 1 ) return 1;\n if ( !a || a < 1 ) { a = 1; s = p / 4; }\n else s = p * Math.asin( 1 / a ) / ( 2 * Math.PI );\n return ( a * Math.pow( 2, - 10 * k) * Math.sin( ( k - s ) * ( 2 * Math.PI ) / p ) + 1 );\n\n },\n\n InOut: function ( k ) {\n\n var s, a = 0.1, p = 0.4;\n if ( k === 0 ) return 0;\n if ( k === 1 ) return 1;\n if ( !a || a < 1 ) { a = 1; s = p / 4; }\n else s = p * Math.asin( 1 / a ) / ( 2 * Math.PI );\n if ( ( k *= 2 ) < 1 ) return - 0.5 * ( a * Math.pow( 2, 10 * ( k -= 1 ) ) * Math.sin( ( k - s ) * ( 2 * Math.PI ) / p ) );\n return a * Math.pow( 2, -10 * ( k -= 1 ) ) * Math.sin( ( k - s ) * ( 2 * Math.PI ) / p ) * 0.5 + 1;\n\n }\n\n },\n\n Back: {\n\n In: function ( k ) {\n\n var s = 1.70158;\n return k * k * ( ( s + 1 ) * k - s );\n\n },\n\n Out: function ( k ) {\n\n var s = 1.70158;\n return --k * k * ( ( s + 1 ) * k + s ) + 1;\n\n },\n\n InOut: function ( k ) {\n\n var s = 1.70158 * 1.525;\n if ( ( k *= 2 ) < 1 ) return 0.5 * ( k * k * ( ( s + 1 ) * k - s ) );\n return 0.5 * ( ( k -= 2 ) * k * ( ( s + 1 ) * k + s ) + 2 );\n\n }\n\n },\n\n Bounce: {\n\n In: function ( k ) {\n\n return 1 - TWEEN.Easing.Bounce.Out( 1 - k );\n\n },\n\n Out: function ( k ) {\n\n if ( k < ( 1 / 2.75 ) ) {\n\n return 7.5625 * k * k;\n\n } else if ( k < ( 2 / 2.75 ) ) {\n\n return 7.5625 * ( k -= ( 1.5 / 2.75 ) ) * k + 0.75;\n\n } else if ( k < ( 2.5 / 2.75 ) ) {\n\n return 7.5625 * ( k -= ( 2.25 / 2.75 ) ) * k + 0.9375;\n\n } else {\n\n return 7.5625 * ( k -= ( 2.625 / 2.75 ) ) * k + 0.984375;\n\n }\n\n },\n\n InOut: function ( k ) {\n\n if ( k < 0.5 ) return TWEEN.Easing.Bounce.In( k * 2 ) * 0.5;\n return TWEEN.Easing.Bounce.Out( k * 2 - 1 ) * 0.5 + 0.5;\n\n }\n\n }\n\n};\n\nTWEEN.Interpolation = {\n\n Linear: function ( v, k ) {\n\n var m = v.length - 1, f = m * k, i = Math.floor( f ), fn = TWEEN.Interpolation.Utils.Linear;\n\n if ( k < 0 ) return fn( v[ 0 ], v[ 1 ], f );\n if ( k > 1 ) return fn( v[ m ], v[ m - 1 ], m - f );\n\n return fn( v[ i ], v[ i + 1 > m ? m : i + 1 ], f - i );\n\n },\n\n Bezier: function ( v, k ) {\n\n var b = 0, n = v.length - 1, pw = Math.pow, bn = TWEEN.Interpolation.Utils.Bernstein, i;\n\n for ( i = 0; i <= n; i++ ) {\n b += pw( 1 - k, n - i ) * pw( k, i ) * v[ i ] * bn( n, i );\n }\n\n return b;\n\n },\n\n CatmullRom: function ( v, k ) {\n\n var m = v.length - 1, f = m * k, i = Math.floor( f ), fn = TWEEN.Interpolation.Utils.CatmullRom;\n\n if ( v[ 0 ] === v[ m ] ) {\n\n if ( k < 0 ) i = Math.floor( f = m * ( 1 + k ) );\n\n return fn( v[ ( i - 1 + m ) % m ], v[ i ], v[ ( i + 1 ) % m ], v[ ( i + 2 ) % m ], f - i );\n\n } else {\n\n if ( k < 0 ) return v[ 0 ] - ( fn( v[ 0 ], v[ 0 ], v[ 1 ], v[ 1 ], -f ) - v[ 0 ] );\n if ( k > 1 ) return v[ m ] - ( fn( v[ m ], v[ m ], v[ m - 1 ], v[ m - 1 ], f - m ) - v[ m ] );\n\n return fn( v[ i ? i - 1 : 0 ], v[ i ], v[ m < i + 1 ? m : i + 1 ], v[ m < i + 2 ? m : i + 2 ], f - i );\n\n }\n\n },\n\n Utils: {\n\n Linear: function ( p0, p1, t ) {\n\n return ( p1 - p0 ) * t + p0;\n\n },\n\n Bernstein: function ( n , i ) {\n\n var fc = TWEEN.Interpolation.Utils.Factorial;\n return fc( n ) / fc( i ) / fc( n - i );\n\n },\n\n Factorial: ( function () {\n\n var a = [ 1 ];\n\n return function ( n ) {\n\n var s = 1, i;\n if ( a[ n ] ) return a[ n ];\n for ( i = n; i > 1; i-- ) s *= i;\n return a[ n ] = s;\n\n };\n\n } )(),\n\n CatmullRom: function ( p0, p1, p2, p3, t ) {\n\n var v0 = ( p2 - p0 ) * 0.5, v1 = ( p3 - p1 ) * 0.5, t2 = t * t, t3 = t * t2;\n return ( 2 * p1 - 2 * p2 + v0 + v1 ) * t3 + ( - 3 * p1 + 3 * p2 - 2 * v0 - v1 ) * t2 + v0 * t + p1;\n\n }\n\n }\n\n};\n\nmodule.exports=TWEEN;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/tween.js/index.js\n ** module id = 94\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/tween.js/index.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nvar required = __webpack_require__(323)\n , lolcation = __webpack_require__(344)\n , qs = __webpack_require__(322)\n , relativere = /^\\/(?!\\/)/\n , protocolre = /^([a-z0-9.+-]+:)?(\\/\\/)?(.*)$/i; // actual protocol is first match\n\n/**\n * These are the parse instructions for the URL parsers, it informs the parser\n * about:\n *\n * 0. The char it Needs to parse, if it's a string it should be done using\n * indexOf, RegExp using exec and NaN means set as current value.\n * 1. The property we should set when parsing this value.\n * 2. Indication if it's backwards or forward parsing, when set as number it's\n * the value of extra chars that should be split off.\n * 3. Inherit from location if non existing in the parser.\n * 4. `toLowerCase` the resulting value.\n */\nvar instructions = [\n ['#', 'hash'], // Extract from the back.\n ['?', 'query'], // Extract from the back.\n ['/', 'pathname'], // Extract from the back.\n ['@', 'auth', 1], // Extract from the front.\n [NaN, 'host', undefined, 1, 1], // Set left over value.\n [/\\:(\\d+)$/, 'port'], // RegExp the back.\n [NaN, 'hostname', undefined, 1, 1] // Set left over.\n];\n\n /**\n * @typedef ProtocolExtract\n * @type Object\n * @property {String} protocol Protocol matched in the URL, in lowercase\n * @property {Boolean} slashes Indicates whether the protocol is followed by double slash (\"//\")\n * @property {String} rest Rest of the URL that is not part of the protocol\n */\n\n /**\n * Extract protocol information from a URL with/without double slash (\"//\")\n *\n * @param {String} address URL we want to extract from.\n * @return {ProtocolExtract} Extracted information\n * @private\n */\nfunction extractProtocol(address) {\n var match = protocolre.exec(address);\n return {\n protocol: match[1] ? match[1].toLowerCase() : '',\n slashes: !!match[2],\n rest: match[3] ? match[3] : ''\n };\n}\n\n/**\n * The actual URL instance. Instead of returning an object we've opted-in to\n * create an actual constructor as it's much more memory efficient and\n * faster and it pleases my CDO.\n *\n * @constructor\n * @param {String} address URL we want to parse.\n * @param {Object|String} location Location defaults for relative paths.\n * @param {Boolean|Function} parser Parser for the query string.\n * @api public\n */\nfunction URL(address, location, parser) {\n if (!(this instanceof URL)) {\n return new URL(address, location, parser);\n }\n\n var relative = relativere.test(address)\n , parse, instruction, index, key\n , type = typeof location\n , url = this\n , i = 0;\n\n //\n // The following if statements allows this module two have compatibility with\n // 2 different API:\n //\n // 1. Node.js's `url.parse` api which accepts a URL, boolean as arguments\n // where the boolean indicates that the query string should also be parsed.\n //\n // 2. The `URL` interface of the browser which accepts a URL, object as\n // arguments. The supplied object will be used as default values / fall-back\n // for relative paths.\n //\n if ('object' !== type && 'string' !== type) {\n parser = location;\n location = null;\n }\n\n if (parser && 'function' !== typeof parser) {\n parser = qs.parse;\n }\n\n location = lolcation(location);\n\n // extract protocol information before running the instructions\n var extracted = extractProtocol(address);\n url.protocol = extracted.protocol || location.protocol || '';\n url.slashes = extracted.slashes || location.slashes;\n address = extracted.rest;\n\n for (; i < instructions.length; i++) {\n instruction = instructions[i];\n parse = instruction[0];\n key = instruction[1];\n\n if (parse !== parse) {\n url[key] = address;\n } else if ('string' === typeof parse) {\n if (~(index = address.indexOf(parse))) {\n if ('number' === typeof instruction[2]) {\n url[key] = address.slice(0, index);\n address = address.slice(index + instruction[2]);\n } else {\n url[key] = address.slice(index);\n address = address.slice(0, index);\n }\n }\n } else if (index = parse.exec(address)) {\n url[key] = index[1];\n address = address.slice(0, address.length - index[0].length);\n }\n\n url[key] = url[key] || (instruction[3] || ('port' === key && relative) ? location[key] || '' : '');\n\n //\n // Hostname, host and protocol should be lowercased so they can be used to\n // create a proper `origin`.\n //\n if (instruction[4]) {\n url[key] = url[key].toLowerCase();\n }\n }\n\n //\n // Also parse the supplied query string in to an object. If we're supplied\n // with a custom parser as function use that instead of the default build-in\n // parser.\n //\n if (parser) url.query = parser(url.query);\n\n //\n // We should not add port numbers if they are already the default port number\n // for a given protocol. As the host also contains the port number we're going\n // override it with the hostname which contains no port number.\n //\n if (!required(url.port, url.protocol)) {\n url.host = url.hostname;\n url.port = '';\n }\n\n //\n // Parse down the `auth` for the username and password.\n //\n url.username = url.password = '';\n if (url.auth) {\n instruction = url.auth.split(':');\n url.username = instruction[0] || '';\n url.password = instruction[1] || '';\n }\n\n //\n // The href is just the compiled result.\n //\n url.href = url.toString();\n}\n\n/**\n * This is convenience method for changing properties in the URL instance to\n * insure that they all propagate correctly.\n *\n * @param {String} prop Property we need to adjust.\n * @param {Mixed} value The newly assigned value.\n * @param {Boolean|Function} fn When setting the query, it will be the function used to parse\n * the query.\n * When setting the protocol, double slash will be removed from\n * the final url if it is true.\n * @returns {URL}\n * @api public\n */\nURL.prototype.set = function set(part, value, fn) {\n var url = this;\n\n if ('query' === part) {\n if ('string' === typeof value && value.length) {\n value = (fn || qs.parse)(value);\n }\n\n url[part] = value;\n } else if ('port' === part) {\n url[part] = value;\n\n if (!required(value, url.protocol)) {\n url.host = url.hostname;\n url[part] = '';\n } else if (value) {\n url.host = url.hostname +':'+ value;\n }\n } else if ('hostname' === part) {\n url[part] = value;\n\n if (url.port) value += ':'+ url.port;\n url.host = value;\n } else if ('host' === part) {\n url[part] = value;\n\n if (/\\:\\d+/.test(value)) {\n value = value.split(':');\n url.hostname = value[0];\n url.port = value[1];\n }\n } else if ('protocol' === part) {\n url.protocol = value;\n url.slashes = !fn;\n } else {\n url[part] = value;\n }\n\n url.href = url.toString();\n return url;\n};\n\n/**\n * Transform the properties back in to a valid and full URL string.\n *\n * @param {Function} stringify Optional query stringify function.\n * @returns {String}\n * @api public\n */\nURL.prototype.toString = function toString(stringify) {\n if (!stringify || 'function' !== typeof stringify) stringify = qs.stringify;\n\n var query\n , url = this\n , protocol = url.protocol;\n\n if (protocol && protocol.charAt(protocol.length - 1) !== ':') protocol += ':';\n\n var result = protocol + (url.slashes ? '//' : '');\n\n if (url.username) {\n result += url.username;\n if (url.password) result += ':'+ url.password;\n result += '@';\n }\n\n result += url.hostname;\n if (url.port) result += ':'+ url.port;\n\n result += url.pathname;\n\n query = 'object' === typeof url.query ? stringify(url.query) : url.query;\n if (query) result += '?' !== query.charAt(0) ? '?'+ query : query;\n\n if (url.hash) result += url.hash;\n\n return result;\n};\n\n//\n// Expose the URL parser and some additional properties that might be useful for\n// others.\n//\nURL.qs = qs;\nURL.location = lolcation;\nmodule.exports = URL;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/url-parse/index.js\n ** module id = 95\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/url-parse/index.js?")},function(module,exports){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.trim = trim;\nexports.exists = exists;\nexports.isEmpty = isEmpty;\nexports.itemsEqual = itemsEqual;\nexports.toArray = toArray;\nexports.safeJSONParse = safeJSONParse;\nexports.getExtension = getExtension;\nexports.getNameAndExtension = getNameAndExtension;\nexports.isValidFile = isValidFile;\nexports.isValidUrl = isValidUrl;\nexports.generateUUID = generateUUID;\nexports.stringToBoolean = stringToBoolean;\nexports.remapJson = remapJson;\nexports.coerceTypes = coerceTypes;\nfunction trim(string) {\n return String(string).replace(/^\\s+|\\s+$/g, '');\n}\n\nfunction exists(input) {\n return input !== null && input !== undefined;\n}\n\n// utiity to determine if a string is empty, null, or full of whitespaces\nfunction isEmpty(str) {\n if (!(typeof str === 'string')) return false; // UUUGH bad way of checking not a string\n return !str || /^\\s*$/.test(str) || str.length === 0 || !str.trim();\n}\n\nfunction itemsEqual(a, b) {\n // perhaps an immutable library would not require such horrors?\n if (JSON.stringify(a) === JSON.stringify(b)) {\n return true;\n }\n return false;\n}\n\n/* converts input data to array if it is not already an array*/\nfunction toArray(data) {\n if (!data) return [];\n if (data.constructor !== Array) return [data];\n return data;\n}\n\n/* JSON parse that always returns an object*/\nfunction safeJSONParse(str) {\n try {\n return JSON.parse(str) || {}; // from cycle.js\n } catch (error) {\n throw new Error('Error parsing data', JSON.stringify(str));\n }\n}\n\n// file utils ??\nfunction getExtension(fname) {\n return fname.substr((~ -fname.lastIndexOf('.') >>> 0) + 2).toLowerCase();\n}\n\nfunction getNameAndExtension(uri) {\n var _uriElems = uri.split('?');\n var name = _uriElems.shift().split('/').pop();\n var ext = getExtension(uri);\n return { name: name, ext: ext };\n}\n\nfunction isValidFile(file) {\n return typeof file !== 'undefined' && file !== null && file instanceof File;\n}\n\n// from http://stackoverflow.com/questions/1701898/how-to-detect-whether-a-string-is-in-url-format-using-javascript\nfunction isValidUrl(url) {\n /* var strRegex = \"^((https|http|ftp|rtsp|mms)?://)\"\n + \"?(([0-9a-z_!~*'().&=+$%-]+: )?[0-9a-z_!~*'().&=+$%-]+@)?\" //ftp的user@\n + \"(([0-9]{1,3}\\.){3}[0-9]{1,3}\" // IP形式的URL- 199.194.52.184\n + \"|\" // 允许IP和DOMAIN(域名)\n + \"([0-9a-z_!~*'()-]+\\.)*\" // 域名- www.\n + \"([0-9a-z][0-9a-z-]{0,61})?[0-9a-z]\\.\" // 二级域名\n + \"[a-z]{2,6})\" // first level domain- .com or .museum\n + \"(:[0-9]{1,4})?\" // 端口- :80\n + \"((/?)|\" // a slash isn't required if there is no file name\n + \"(/[0-9a-z_!~*'().;?:@&=+$,%#-]+)+/?)$\"\n var re=new RegExp(strRegex)\n return re.test(url)*/\n var regexp = /(ftp|http|https|localhost):\\/\\/(\\w+:{0,1}\\w*@)?(\\S+)(:[0-9]+)?(\\/|\\/([\\w#!:.?+=&%@!\\-\\/]))?/;\n return regexp.test(url);\n}\n\n// TODO: taken from three.js ,do correct attribution\nfunction generateUUID() {\n // http://www.broofa.com/Tools/Math.uuid.htm\n\n var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split('');\n var uuid = new Array(36);\n var rnd = 0;\n var r = void 0;\n\n return function () {\n for (var i = 0; i < 36; i++) {\n if (i === 8 || i === 13 || i === 18 || i === 23) {\n uuid[i] = '-';\n } else if (i === 14) {\n uuid[i] = '4';\n } else {\n if (rnd <= 0x02) rnd = 0x2000000 + Math.random() * 0x1000000 | 0;\n r = rnd & 0xf;\n rnd = rnd >> 4;\n uuid[i] = chars[i === 19 ? r & 0x3 | 0x8 : r];\n }\n }\n return uuid.join('');\n }();\n}\n\n// convert a string to a boolean\nfunction stringToBoolean(string) {\n switch (string.toLowerCase().trim()) {\n case 'true':case 'yes':case '1':\n return true;\n case 'false':case 'no':case '0':case null:\n return false;\n default:\n return Boolean(string);\n }\n}\n\n/*\nRemap the field from the input object using the\nprovided mapping object (key=>outkey) ie:\ninput = {foo:42}\nremapJson({foo:baz},input) => {baz:42}\n*/\nfunction remapJson(mapping, input) {\n var result = Object.keys(input).reduce(function (obj, key) {\n if (key in mapping) {\n obj[mapping[key]] = input[key];\n } else {\n obj[key] = input[key];\n }\n return obj;\n }, {});\n return result;\n}\n\n/*\nconvert the field from the input object using the\nprovided mapping object (key=>outkey) ie:\ninput = {foo:\"42\"}\nremapJson({foo:parseFloat},input) => {baz:42}\n*/\nfunction coerceTypes(mapping, input) {\n var result = Object.keys(input).reduce(function (obj, key) {\n if (key in mapping && input[key] !== null && input[key] !== undefined) {\n obj[key] = mapping[key](input[key]);\n } else {\n obj[key] = input[key];\n }\n return obj;\n }, {});\n return result;\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/usco-utils/lib/utils.js\n ** module id = 96\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/usco-utils/lib/utils.js?")},function(module,exports,__webpack_require__){eval("module.exports = __webpack_require__(354)\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/usco-utils/obsUtils.js\n ** module id = 97\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/usco-utils/obsUtils.js?")},function(module,exports,__webpack_require__){eval('"use strict";\nvar ScopeChecker_1 = __webpack_require__(64);\nvar utils_1 = __webpack_require__(24);\nvar matchesSelector;\ntry {\n matchesSelector = __webpack_require__(62);\n}\ncatch (e) {\n matchesSelector = Function.prototype;\n}\nfunction toElArray(input) {\n return Array.prototype.slice.call(input);\n}\nvar ElementFinder = (function () {\n function ElementFinder(namespace, isolateModule) {\n this.namespace = namespace;\n this.isolateModule = isolateModule;\n }\n ElementFinder.prototype.call = function (rootElement) {\n var namespace = this.namespace;\n if (namespace.join("") === "") {\n return rootElement;\n }\n var scope = utils_1.getScope(namespace);\n var scopeChecker = new ScopeChecker_1.ScopeChecker(scope, this.isolateModule);\n var selector = utils_1.getSelectors(namespace);\n var topNode = rootElement;\n var topNodeMatches = [];\n if (scope.length > 0) {\n topNode = this.isolateModule.getIsolatedElement(scope) || rootElement;\n if (selector && matchesSelector(topNode, selector)) {\n topNodeMatches.push(topNode);\n }\n }\n return toElArray(topNode.querySelectorAll(selector))\n .filter(scopeChecker.isStrictlyInRootScope, scopeChecker)\n .concat(topNodeMatches);\n };\n return ElementFinder;\n}());\nexports.ElementFinder = ElementFinder;\n//# sourceMappingURL=ElementFinder.js.map\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/@cycle/dom/lib/ElementFinder.js\n ** module id = 98\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/@cycle/dom/lib/ElementFinder.js?')},function(module,exports,__webpack_require__){eval('"use strict";\nvar ScopeChecker_1 = __webpack_require__(64);\nvar utils_1 = __webpack_require__(24);\nvar matchesSelector;\ntry {\n matchesSelector = __webpack_require__(62);\n}\ncatch (e) {\n matchesSelector = Function.prototype;\n}\n/**\n * Attaches an actual event listener to the DOM root element,\n * handles "destinations" (interested DOMSource output subjects), and bubbling.\n */\nvar EventDelegator = (function () {\n function EventDelegator(topElement, eventType, useCapture, isolateModule) {\n var _this = this;\n this.topElement = topElement;\n this.eventType = eventType;\n this.useCapture = useCapture;\n this.isolateModule = isolateModule;\n this.destinations = [];\n this.roof = topElement.parentElement;\n if (useCapture) {\n this.domListener = function (ev) { return _this.capture(ev); };\n }\n else {\n this.domListener = function (ev) { return _this.bubble(ev); };\n }\n topElement.addEventListener(eventType, this.domListener, useCapture);\n }\n EventDelegator.prototype.bubble = function (rawEvent) {\n if (!document.body.contains(rawEvent.currentTarget)) {\n return;\n }\n var ev = this.patchEvent(rawEvent);\n for (var el = ev.target; el && el !== this.roof; el = el.parentElement) {\n if (ev.propagationHasBeenStopped) {\n return;\n }\n this.matchEventAgainstDestinations(el, ev);\n }\n };\n EventDelegator.prototype.matchEventAgainstDestinations = function (el, ev) {\n for (var i = 0, n = this.destinations.length; i < n; i++) {\n var dest = this.destinations[i];\n if (!dest.scopeChecker.isStrictlyInRootScope(el)) {\n continue;\n }\n if (matchesSelector(el, dest.selector)) {\n this.mutateEventCurrentTarget(ev, el);\n dest.subject._n(ev);\n }\n }\n };\n EventDelegator.prototype.capture = function (ev) {\n for (var i = 0, n = this.destinations.length; i < n; i++) {\n var dest = this.destinations[i];\n if (matchesSelector(ev.target, dest.selector)) {\n dest.subject._n(ev);\n }\n }\n };\n EventDelegator.prototype.addDestination = function (subject, namespace) {\n var scope = utils_1.getScope(namespace);\n var selector = utils_1.getSelectors(namespace);\n var scopeChecker = new ScopeChecker_1.ScopeChecker(scope, this.isolateModule);\n this.destinations.push({ subject: subject, scopeChecker: scopeChecker, selector: selector });\n };\n EventDelegator.prototype.patchEvent = function (event) {\n var pEvent = event;\n pEvent.propagationHasBeenStopped = false;\n var oldStopPropagation = pEvent.stopPropagation;\n pEvent.stopPropagation = function stopPropagation() {\n oldStopPropagation.call(this);\n this.propagationHasBeenStopped = true;\n };\n return pEvent;\n };\n EventDelegator.prototype.mutateEventCurrentTarget = function (event, currentTargetElement) {\n try {\n Object.defineProperty(event, "currentTarget", {\n value: currentTargetElement,\n configurable: true,\n });\n }\n catch (err) {\n console.log("please use event.ownerTarget");\n }\n event.ownerTarget = currentTargetElement;\n };\n EventDelegator.prototype.updateTopElement = function (newTopElement) {\n this.topElement.removeEventListener(this.eventType, this.domListener, this.useCapture);\n newTopElement.addEventListener(this.eventType, this.domListener, this.useCapture);\n this.topElement = newTopElement;\n };\n return EventDelegator;\n}());\nexports.EventDelegator = EventDelegator;\n//# sourceMappingURL=EventDelegator.js.map\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/@cycle/dom/lib/EventDelegator.js\n ** module id = 99\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/@cycle/dom/lib/EventDelegator.js?'); From 87360a7b86c82bef85db8ea8b07ed4421ed6d413 Mon Sep 17 00:00:00 2001 From: Mark 'kaosat-dev' Moissette Date: Fri, 26 Aug 2016 15:18:05 +0200 Subject: [PATCH 3/3] feat(ios-interactions): tweaks and adjustements to get better user interactions on mobile - adjusted grid size - adjusted camera speed & decay - etc --- dist/jam.js | 10 +++++----- src/components/webgl/GlView.js | 2 +- src/components/webgl/deps/OrbitControls.js | 2 +- src/components/webgl/presets.js | 2 +- src/interactions/pointers.js | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/dist/jam.js b/dist/jam.js index a3e3491..b5aff4b 100644 --- a/dist/jam.js +++ b/dist/jam.js @@ -9,7 +9,7 @@ },function(module,exports,__webpack_require__){eval("var Processor = __webpack_require__(57).Processor;\nvar Pipe = __webpack_require__(43).Pipe;\nvar DiffContext = __webpack_require__(26).DiffContext;\nvar PatchContext = __webpack_require__(27).PatchContext;\nvar ReverseContext = __webpack_require__(28).ReverseContext;\n\nvar trivial = __webpack_require__(56);\nvar nested = __webpack_require__(54);\nvar arrays = __webpack_require__(51);\nvar dates = __webpack_require__(52);\nvar texts = __webpack_require__(55);\n\nvar DiffPatcher = function DiffPatcher(options) {\n this.processor = new Processor(options);\n this.processor.pipe(new Pipe('diff').append(\n nested.collectChildrenDiffFilter,\n trivial.diffFilter,\n dates.diffFilter,\n texts.diffFilter,\n nested.objectsDiffFilter,\n arrays.diffFilter\n ).shouldHaveResult());\n this.processor.pipe(new Pipe('patch').append(\n nested.collectChildrenPatchFilter,\n arrays.collectChildrenPatchFilter,\n trivial.patchFilter,\n texts.patchFilter,\n nested.patchFilter,\n arrays.patchFilter\n ).shouldHaveResult());\n this.processor.pipe(new Pipe('reverse').append(\n nested.collectChildrenReverseFilter,\n arrays.collectChildrenReverseFilter,\n trivial.reverseFilter,\n texts.reverseFilter,\n nested.reverseFilter,\n arrays.reverseFilter\n ).shouldHaveResult());\n};\n\nDiffPatcher.prototype.options = function() {\n return this.processor.options.apply(this.processor, arguments);\n};\n\nDiffPatcher.prototype.diff = function(left, right) {\n return this.processor.process(new DiffContext(left, right));\n};\n\nDiffPatcher.prototype.patch = function(left, delta) {\n return this.processor.process(new PatchContext(left, delta));\n};\n\nDiffPatcher.prototype.reverse = function(delta) {\n return this.processor.process(new ReverseContext(delta));\n};\n\nDiffPatcher.prototype.unpatch = function(right, delta) {\n return this.patch(right, this.reverse(delta));\n};\n\nexports.DiffPatcher = DiffPatcher;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/jsondiffpatch/src/diffpatcher.js\n ** module id = 50\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/jsondiffpatch/src/diffpatcher.js?")},function(module,exports,__webpack_require__){eval("var DiffContext = __webpack_require__(26).DiffContext;\nvar PatchContext = __webpack_require__(27).PatchContext;\nvar ReverseContext = __webpack_require__(28).ReverseContext;\n\nvar lcs = __webpack_require__(53);\n\nvar ARRAY_MOVE = 3;\n\nvar isArray = (typeof Array.isArray === 'function') ?\n // use native function\n Array.isArray :\n // use instanceof operator\n function(a) {\n return a instanceof Array;\n };\n\nvar arrayIndexOf = typeof Array.prototype.indexOf === 'function' ?\n function(array, item) {\n return array.indexOf(item);\n } : function(array, item) {\n var length = array.length;\n for (var i = 0; i < length; i++) {\n if (array[i] === item) {\n return i;\n }\n }\n return -1;\n };\n\nfunction arraysHaveMatchByRef(array1, array2, len1, len2) {\n for (var index1 = 0; index1 < len1; index1++) {\n var val1 = array1[index1];\n for (var index2 = 0; index2 < len2; index2++) {\n var val2 = array2[index2];\n if (val1 === val2) {\n return true;\n }\n }\n }\n}\n\nfunction matchItems(array1, array2, index1, index2, context) {\n var value1 = array1[index1];\n var value2 = array2[index2];\n if (value1 === value2) {\n return true;\n }\n if (typeof value1 !== 'object' || typeof value2 !== 'object') {\n return false;\n }\n var objectHash = context.objectHash;\n if (!objectHash) {\n // no way to match objects was provided, try match by position\n return context.matchByPosition && index1 === index2;\n }\n var hash1;\n var hash2;\n if (typeof index1 === 'number') {\n context.hashCache1 = context.hashCache1 || [];\n hash1 = context.hashCache1[index1];\n if (typeof hash1 === 'undefined') {\n context.hashCache1[index1] = hash1 = objectHash(value1, index1);\n }\n } else {\n hash1 = objectHash(value1);\n }\n if (typeof hash1 === 'undefined') {\n return false;\n }\n if (typeof index2 === 'number') {\n context.hashCache2 = context.hashCache2 || [];\n hash2 = context.hashCache2[index2];\n if (typeof hash2 === 'undefined') {\n context.hashCache2[index2] = hash2 = objectHash(value2, index2);\n }\n } else {\n hash2 = objectHash(value2);\n }\n if (typeof hash2 === 'undefined') {\n return false;\n }\n return hash1 === hash2;\n}\n\nvar diffFilter = function arraysDiffFilter(context) {\n if (!context.leftIsArray) {\n return;\n }\n\n var matchContext = {\n objectHash: context.options && context.options.objectHash,\n matchByPosition: context.options && context.options.matchByPosition\n };\n var commonHead = 0;\n var commonTail = 0;\n var index;\n var index1;\n var index2;\n var array1 = context.left;\n var array2 = context.right;\n var len1 = array1.length;\n var len2 = array2.length;\n\n var child;\n\n if (len1 > 0 && len2 > 0 && !matchContext.objectHash &&\n typeof matchContext.matchByPosition !== 'boolean') {\n matchContext.matchByPosition = !arraysHaveMatchByRef(array1, array2, len1, len2);\n }\n\n // separate common head\n while (commonHead < len1 && commonHead < len2 &&\n matchItems(array1, array2, commonHead, commonHead, matchContext)) {\n index = commonHead;\n child = new DiffContext(context.left[index], context.right[index]);\n context.push(child, index);\n commonHead++;\n }\n // separate common tail\n while (commonTail + commonHead < len1 && commonTail + commonHead < len2 &&\n matchItems(array1, array2, len1 - 1 - commonTail, len2 - 1 - commonTail, matchContext)) {\n index1 = len1 - 1 - commonTail;\n index2 = len2 - 1 - commonTail;\n child = new DiffContext(context.left[index1], context.right[index2]);\n context.push(child, index2);\n commonTail++;\n }\n var result;\n if (commonHead + commonTail === len1) {\n if (len1 === len2) {\n // arrays are identical\n context.setResult(undefined).exit();\n return;\n }\n // trivial case, a block (1 or more consecutive items) was added\n result = result || {\n _t: 'a'\n };\n for (index = commonHead; index < len2 - commonTail; index++) {\n result[index] = [array2[index]];\n }\n context.setResult(result).exit();\n return;\n }\n if (commonHead + commonTail === len2) {\n // trivial case, a block (1 or more consecutive items) was removed\n result = result || {\n _t: 'a'\n };\n for (index = commonHead; index < len1 - commonTail; index++) {\n result['_' + index] = [array1[index], 0, 0];\n }\n context.setResult(result).exit();\n return;\n }\n // reset hash cache\n delete matchContext.hashCache1;\n delete matchContext.hashCache2;\n\n // diff is not trivial, find the LCS (Longest Common Subsequence)\n var trimmed1 = array1.slice(commonHead, len1 - commonTail);\n var trimmed2 = array2.slice(commonHead, len2 - commonTail);\n var seq = lcs.get(\n trimmed1, trimmed2,\n matchItems,\n matchContext\n );\n var removedItems = [];\n result = result || {\n _t: 'a'\n };\n for (index = commonHead; index < len1 - commonTail; index++) {\n if (arrayIndexOf(seq.indices1, index - commonHead) < 0) {\n // removed\n result['_' + index] = [array1[index], 0, 0];\n removedItems.push(index);\n }\n }\n\n var detectMove = true;\n if (context.options && context.options.arrays && context.options.arrays.detectMove === false) {\n detectMove = false;\n }\n var includeValueOnMove = false;\n if (context.options && context.options.arrays && context.options.arrays.includeValueOnMove) {\n includeValueOnMove = true;\n }\n\n var removedItemsLength = removedItems.length;\n for (index = commonHead; index < len2 - commonTail; index++) {\n var indexOnArray2 = arrayIndexOf(seq.indices2, index - commonHead);\n if (indexOnArray2 < 0) {\n // added, try to match with a removed item and register as position move\n var isMove = false;\n if (detectMove && removedItemsLength > 0) {\n for (var removeItemIndex1 = 0; removeItemIndex1 < removedItemsLength; removeItemIndex1++) {\n index1 = removedItems[removeItemIndex1];\n if (matchItems(trimmed1, trimmed2, index1 - commonHead,\n index - commonHead, matchContext)) {\n // store position move as: [originalValue, newPosition, ARRAY_MOVE]\n result['_' + index1].splice(1, 2, index, ARRAY_MOVE);\n if (!includeValueOnMove) {\n // don't include moved value on diff, to save bytes\n result['_' + index1][0] = '';\n }\n\n index2 = index;\n child = new DiffContext(context.left[index1], context.right[index2]);\n context.push(child, index2);\n removedItems.splice(removeItemIndex1, 1);\n isMove = true;\n break;\n }\n }\n }\n if (!isMove) {\n // added\n result[index] = [array2[index]];\n }\n } else {\n // match, do inner diff\n index1 = seq.indices1[indexOnArray2] + commonHead;\n index2 = seq.indices2[indexOnArray2] + commonHead;\n child = new DiffContext(context.left[index1], context.right[index2]);\n context.push(child, index2);\n }\n }\n\n context.setResult(result).exit();\n\n};\ndiffFilter.filterName = 'arrays';\n\nvar compare = {\n numerically: function(a, b) {\n return a - b;\n },\n numericallyBy: function(name) {\n return function(a, b) {\n return a[name] - b[name];\n };\n }\n};\n\nvar patchFilter = function nestedPatchFilter(context) {\n if (!context.nested) {\n return;\n }\n if (context.delta._t !== 'a') {\n return;\n }\n var index, index1;\n\n var delta = context.delta;\n var array = context.left;\n\n // first, separate removals, insertions and modifications\n var toRemove = [];\n var toInsert = [];\n var toModify = [];\n for (index in delta) {\n if (index !== '_t') {\n if (index[0] === '_') {\n // removed item from original array\n if (delta[index][2] === 0 || delta[index][2] === ARRAY_MOVE) {\n toRemove.push(parseInt(index.slice(1), 10));\n } else {\n throw new Error('only removal or move can be applied at original array indices' +\n ', invalid diff type: ' + delta[index][2]);\n }\n } else {\n if (delta[index].length === 1) {\n // added item at new array\n toInsert.push({\n index: parseInt(index, 10),\n value: delta[index][0]\n });\n } else {\n // modified item at new array\n toModify.push({\n index: parseInt(index, 10),\n delta: delta[index]\n });\n }\n }\n }\n }\n\n // remove items, in reverse order to avoid sawing our own floor\n toRemove = toRemove.sort(compare.numerically);\n for (index = toRemove.length - 1; index >= 0; index--) {\n index1 = toRemove[index];\n var indexDiff = delta['_' + index1];\n var removedValue = array.splice(index1, 1)[0];\n if (indexDiff[2] === ARRAY_MOVE) {\n // reinsert later\n toInsert.push({\n index: indexDiff[1],\n value: removedValue\n });\n }\n }\n\n // insert items, in reverse order to avoid moving our own floor\n toInsert = toInsert.sort(compare.numericallyBy('index'));\n var toInsertLength = toInsert.length;\n for (index = 0; index < toInsertLength; index++) {\n var insertion = toInsert[index];\n array.splice(insertion.index, 0, insertion.value);\n }\n\n // apply modifications\n var toModifyLength = toModify.length;\n var child;\n if (toModifyLength > 0) {\n for (index = 0; index < toModifyLength; index++) {\n var modification = toModify[index];\n child = new PatchContext(context.left[modification.index], modification.delta);\n context.push(child, modification.index);\n }\n }\n\n if (!context.children) {\n context.setResult(context.left).exit();\n return;\n }\n context.exit();\n};\npatchFilter.filterName = 'arrays';\n\nvar collectChildrenPatchFilter = function collectChildrenPatchFilter(context) {\n if (!context || !context.children) {\n return;\n }\n if (context.delta._t !== 'a') {\n return;\n }\n var length = context.children.length;\n var child;\n for (var index = 0; index < length; index++) {\n child = context.children[index];\n context.left[child.childName] = child.result;\n }\n context.setResult(context.left).exit();\n};\ncollectChildrenPatchFilter.filterName = 'arraysCollectChildren';\n\nvar reverseFilter = function arraysReverseFilter(context) {\n if (!context.nested) {\n if (context.delta[2] === ARRAY_MOVE) {\n context.newName = '_' + context.delta[1];\n context.setResult([context.delta[0], parseInt(context.childName.substr(1), 10), ARRAY_MOVE]).exit();\n }\n return;\n }\n if (context.delta._t !== 'a') {\n return;\n }\n var name, child;\n for (name in context.delta) {\n if (name === '_t') {\n continue;\n }\n child = new ReverseContext(context.delta[name]);\n context.push(child, name);\n }\n context.exit();\n};\nreverseFilter.filterName = 'arrays';\n\nvar reverseArrayDeltaIndex = function(delta, index, itemDelta) {\n if (typeof index === 'string' && index[0] === '_') {\n return parseInt(index.substr(1), 10);\n } else if (isArray(itemDelta) && itemDelta[2] === 0) {\n return '_' + index;\n }\n\n var reverseIndex = +index;\n for (var deltaIndex in delta) {\n var deltaItem = delta[deltaIndex];\n if (isArray(deltaItem)) {\n if (deltaItem[2] === ARRAY_MOVE) {\n var moveFromIndex = parseInt(deltaIndex.substr(1), 10);\n var moveToIndex = deltaItem[1];\n if (moveToIndex === +index) {\n return moveFromIndex;\n }\n if (moveFromIndex <= reverseIndex && moveToIndex > reverseIndex) {\n reverseIndex++;\n } else if (moveFromIndex >= reverseIndex && moveToIndex < reverseIndex) {\n reverseIndex--;\n }\n } else if (deltaItem[2] === 0) {\n var deleteIndex = parseInt(deltaIndex.substr(1), 10);\n if (deleteIndex <= reverseIndex) {\n reverseIndex++;\n }\n } else if (deltaItem.length === 1 && deltaIndex <= reverseIndex) {\n reverseIndex--;\n }\n }\n }\n\n return reverseIndex;\n};\n\nvar collectChildrenReverseFilter = function collectChildrenReverseFilter(context) {\n if (!context || !context.children) {\n return;\n }\n if (context.delta._t !== 'a') {\n return;\n }\n var length = context.children.length;\n var child;\n var delta = {\n _t: 'a'\n };\n\n for (var index = 0; index < length; index++) {\n child = context.children[index];\n var name = child.newName;\n if (typeof name === 'undefined') {\n name = reverseArrayDeltaIndex(context.delta, child.childName, child.result);\n }\n if (delta[name] !== child.result) {\n delta[name] = child.result;\n }\n }\n context.setResult(delta).exit();\n};\ncollectChildrenReverseFilter.filterName = 'arraysCollectChildren';\n\nexports.diffFilter = diffFilter;\nexports.patchFilter = patchFilter;\nexports.collectChildrenPatchFilter = collectChildrenPatchFilter;\nexports.reverseFilter = reverseFilter;\nexports.collectChildrenReverseFilter = collectChildrenReverseFilter;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/jsondiffpatch/src/filters/arrays.js\n ** module id = 51\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/jsondiffpatch/src/filters/arrays.js?")},function(module,exports){eval("var diffFilter = function datesDiffFilter(context) {\n if (context.left instanceof Date) {\n if (context.right instanceof Date) {\n if (context.left.getTime() !== context.right.getTime()) {\n context.setResult([context.left, context.right]);\n } else {\n context.setResult(undefined);\n }\n } else {\n context.setResult([context.left, context.right]);\n }\n context.exit();\n } else if (context.right instanceof Date) {\n context.setResult([context.left, context.right]).exit();\n }\n};\ndiffFilter.filterName = 'dates';\n\nexports.diffFilter = diffFilter;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/jsondiffpatch/src/filters/dates.js\n ** module id = 52\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/jsondiffpatch/src/filters/dates.js?")},function(module,exports){eval("/*\n\nLCS implementation that supports arrays or strings\n\nreference: http://en.wikipedia.org/wiki/Longest_common_subsequence_problem\n\n*/\n\nvar defaultMatch = function(array1, array2, index1, index2) {\n return array1[index1] === array2[index2];\n};\n\nvar lengthMatrix = function(array1, array2, match, context) {\n var len1 = array1.length;\n var len2 = array2.length;\n var x, y;\n\n // initialize empty matrix of len1+1 x len2+1\n var matrix = [len1 + 1];\n for (x = 0; x < len1 + 1; x++) {\n matrix[x] = [len2 + 1];\n for (y = 0; y < len2 + 1; y++) {\n matrix[x][y] = 0;\n }\n }\n matrix.match = match;\n // save sequence lengths for each coordinate\n for (x = 1; x < len1 + 1; x++) {\n for (y = 1; y < len2 + 1; y++) {\n if (match(array1, array2, x - 1, y - 1, context)) {\n matrix[x][y] = matrix[x - 1][y - 1] + 1;\n } else {\n matrix[x][y] = Math.max(matrix[x - 1][y], matrix[x][y - 1]);\n }\n }\n }\n return matrix;\n};\n\nvar backtrack = function(matrix, array1, array2, index1, index2, context) {\n if (index1 === 0 || index2 === 0) {\n return {\n sequence: [],\n indices1: [],\n indices2: []\n };\n }\n\n if (matrix.match(array1, array2, index1 - 1, index2 - 1, context)) {\n var subsequence = backtrack(matrix, array1, array2, index1 - 1, index2 - 1, context);\n subsequence.sequence.push(array1[index1 - 1]);\n subsequence.indices1.push(index1 - 1);\n subsequence.indices2.push(index2 - 1);\n return subsequence;\n }\n\n if (matrix[index1][index2 - 1] > matrix[index1 - 1][index2]) {\n return backtrack(matrix, array1, array2, index1, index2 - 1, context);\n } else {\n return backtrack(matrix, array1, array2, index1 - 1, index2, context);\n }\n};\n\nvar get = function(array1, array2, match, context) {\n context = context || {};\n var matrix = lengthMatrix(array1, array2, match || defaultMatch, context);\n var result = backtrack(matrix, array1, array2, array1.length, array2.length, context);\n if (typeof array1 === 'string' && typeof array2 === 'string') {\n result.sequence = result.sequence.join('');\n }\n return result;\n};\n\nexports.get = get;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/jsondiffpatch/src/filters/lcs.js\n ** module id = 53\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/jsondiffpatch/src/filters/lcs.js?")},function(module,exports,__webpack_require__){eval("var DiffContext = __webpack_require__(26).DiffContext;\nvar PatchContext = __webpack_require__(27).PatchContext;\nvar ReverseContext = __webpack_require__(28).ReverseContext;\n\nvar collectChildrenDiffFilter = function collectChildrenDiffFilter(context) {\n if (!context || !context.children) {\n return;\n }\n var length = context.children.length;\n var child;\n var result = context.result;\n for (var index = 0; index < length; index++) {\n child = context.children[index];\n if (typeof child.result === 'undefined') {\n continue;\n }\n result = result || {};\n result[child.childName] = child.result;\n }\n if (result && context.leftIsArray) {\n result._t = 'a';\n }\n context.setResult(result).exit();\n};\ncollectChildrenDiffFilter.filterName = 'collectChildren';\n\nvar objectsDiffFilter = function objectsDiffFilter(context) {\n if (context.leftIsArray || context.leftType !== 'object') {\n return;\n }\n\n var name, child, propertyFilter = context.options.propertyFilter;\n for (name in context.left) {\n if (!Object.prototype.hasOwnProperty.call(context.left, name)) {\n continue;\n }\n if (propertyFilter && !propertyFilter(name, context)) {\n continue;\n }\n child = new DiffContext(context.left[name], context.right[name]);\n context.push(child, name);\n }\n for (name in context.right) {\n if (!Object.prototype.hasOwnProperty.call(context.right, name)) {\n continue;\n }\n if (propertyFilter && !propertyFilter(name, context)) {\n continue;\n }\n if (typeof context.left[name] === 'undefined') {\n child = new DiffContext(undefined, context.right[name]);\n context.push(child, name);\n }\n }\n\n if (!context.children || context.children.length === 0) {\n context.setResult(undefined).exit();\n return;\n }\n context.exit();\n};\nobjectsDiffFilter.filterName = 'objects';\n\nvar patchFilter = function nestedPatchFilter(context) {\n if (!context.nested) {\n return;\n }\n if (context.delta._t) {\n return;\n }\n var name, child;\n for (name in context.delta) {\n child = new PatchContext(context.left[name], context.delta[name]);\n context.push(child, name);\n }\n context.exit();\n};\npatchFilter.filterName = 'objects';\n\nvar collectChildrenPatchFilter = function collectChildrenPatchFilter(context) {\n if (!context || !context.children) {\n return;\n }\n if (context.delta._t) {\n return;\n }\n var length = context.children.length;\n var child;\n for (var index = 0; index < length; index++) {\n child = context.children[index];\n if (Object.prototype.hasOwnProperty.call(context.left, child.childName) && child.result === undefined) {\n delete context.left[child.childName];\n } else if (context.left[child.childName] !== child.result) {\n context.left[child.childName] = child.result;\n }\n }\n context.setResult(context.left).exit();\n};\ncollectChildrenPatchFilter.filterName = 'collectChildren';\n\nvar reverseFilter = function nestedReverseFilter(context) {\n if (!context.nested) {\n return;\n }\n if (context.delta._t) {\n return;\n }\n var name, child;\n for (name in context.delta) {\n child = new ReverseContext(context.delta[name]);\n context.push(child, name);\n }\n context.exit();\n};\nreverseFilter.filterName = 'objects';\n\nvar collectChildrenReverseFilter = function collectChildrenReverseFilter(context) {\n if (!context || !context.children) {\n return;\n }\n if (context.delta._t) {\n return;\n }\n var length = context.children.length;\n var child;\n var delta = {};\n for (var index = 0; index < length; index++) {\n child = context.children[index];\n if (delta[child.childName] !== child.result) {\n delta[child.childName] = child.result;\n }\n }\n context.setResult(delta).exit();\n};\ncollectChildrenReverseFilter.filterName = 'collectChildren';\n\nexports.collectChildrenDiffFilter = collectChildrenDiffFilter;\nexports.objectsDiffFilter = objectsDiffFilter;\nexports.patchFilter = patchFilter;\nexports.collectChildrenPatchFilter = collectChildrenPatchFilter;\nexports.reverseFilter = reverseFilter;\nexports.collectChildrenReverseFilter = collectChildrenReverseFilter;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/jsondiffpatch/src/filters/nested.js\n ** module id = 54\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/jsondiffpatch/src/filters/nested.js?")},function(module,exports,__webpack_require__){eval("/* global diff_match_patch */\nvar TEXT_DIFF = 2;\nvar DEFAULT_MIN_LENGTH = 60;\nvar cachedDiffPatch = null;\n\nvar getDiffMatchPatch = function(required) {\n /*jshint camelcase: false */\n\n if (!cachedDiffPatch) {\n var instance;\n if (typeof diff_match_patch !== 'undefined') {\n // already loaded, probably a browser\n instance = typeof diff_match_patch === 'function' ?\n new diff_match_patch() : new diff_match_patch.diff_match_patch();\n } else if (true) {\n try {\n var dmpModuleName = 'diff_match_patch_uncompressed';\n var dmp = __webpack_require__(272)(\"./\" + dmpModuleName);\n instance = new dmp.diff_match_patch();\n } catch (err) {\n instance = null;\n }\n }\n if (!instance) {\n if (!required) {\n return null;\n }\n var error = new Error('text diff_match_patch library not found');\n error.diff_match_patch_not_found = true;\n throw error;\n }\n cachedDiffPatch = {\n diff: function(txt1, txt2) {\n return instance.patch_toText(instance.patch_make(txt1, txt2));\n },\n patch: function(txt1, patch) {\n var results = instance.patch_apply(instance.patch_fromText(patch), txt1);\n for (var i = 0; i < results[1].length; i++) {\n if (!results[1][i]) {\n var error = new Error('text patch failed');\n error.textPatchFailed = true;\n }\n }\n return results[0];\n }\n };\n }\n return cachedDiffPatch;\n};\n\nvar diffFilter = function textsDiffFilter(context) {\n if (context.leftType !== 'string') {\n return;\n }\n var minLength = (context.options && context.options.textDiff &&\n context.options.textDiff.minLength) || DEFAULT_MIN_LENGTH;\n if (context.left.length < minLength ||\n context.right.length < minLength) {\n context.setResult([context.left, context.right]).exit();\n return;\n }\n // large text, try to use a text-diff algorithm\n var diffMatchPatch = getDiffMatchPatch();\n if (!diffMatchPatch) {\n // diff-match-patch library not available, fallback to regular string replace\n context.setResult([context.left, context.right]).exit();\n return;\n }\n var diff = diffMatchPatch.diff;\n context.setResult([diff(context.left, context.right), 0, TEXT_DIFF]).exit();\n};\ndiffFilter.filterName = 'texts';\n\nvar patchFilter = function textsPatchFilter(context) {\n if (context.nested) {\n return;\n }\n if (context.delta[2] !== TEXT_DIFF) {\n return;\n }\n\n // text-diff, use a text-patch algorithm\n var patch = getDiffMatchPatch(true).patch;\n context.setResult(patch(context.left, context.delta[0])).exit();\n};\npatchFilter.filterName = 'texts';\n\nvar textDeltaReverse = function(delta) {\n var i, l, lines, line, lineTmp, header = null,\n headerRegex = /^@@ +\\-(\\d+),(\\d+) +\\+(\\d+),(\\d+) +@@$/,\n lineHeader, lineAdd, lineRemove;\n lines = delta.split('\\n');\n for (i = 0, l = lines.length; i < l; i++) {\n line = lines[i];\n var lineStart = line.slice(0, 1);\n if (lineStart === '@') {\n header = headerRegex.exec(line);\n lineHeader = i;\n lineAdd = null;\n lineRemove = null;\n\n // fix header\n lines[lineHeader] = '@@ -' + header[3] + ',' + header[4] + ' +' + header[1] + ',' + header[2] + ' @@';\n } else if (lineStart === '+') {\n lineAdd = i;\n lines[i] = '-' + lines[i].slice(1);\n if (lines[i - 1].slice(0, 1) === '+') {\n // swap lines to keep default order (-+)\n lineTmp = lines[i];\n lines[i] = lines[i - 1];\n lines[i - 1] = lineTmp;\n }\n } else if (lineStart === '-') {\n lineRemove = i;\n lines[i] = '+' + lines[i].slice(1);\n }\n }\n return lines.join('\\n');\n};\n\nvar reverseFilter = function textsReverseFilter(context) {\n if (context.nested) {\n return;\n }\n if (context.delta[2] !== TEXT_DIFF) {\n return;\n }\n\n // text-diff, use a text-diff algorithm\n context.setResult([textDeltaReverse(context.delta[0]), 0, TEXT_DIFF]).exit();\n};\nreverseFilter.filterName = 'texts';\n\nexports.diffFilter = diffFilter;\nexports.patchFilter = patchFilter;\nexports.reverseFilter = reverseFilter;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/jsondiffpatch/src/filters/texts.js\n ** module id = 55\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/jsondiffpatch/src/filters/texts.js?")},function(module,exports){eval("var isArray = (typeof Array.isArray === 'function') ?\n // use native function\n Array.isArray :\n // use instanceof operator\n function(a) {\n return a instanceof Array;\n };\n\nvar diffFilter = function trivialMatchesDiffFilter(context) {\n if (context.left === context.right) {\n context.setResult(undefined).exit();\n return;\n }\n if (typeof context.left === 'undefined') {\n if (typeof context.right === 'function') {\n throw new Error('functions are not supported');\n }\n context.setResult([context.right]).exit();\n return;\n }\n if (typeof context.right === 'undefined') {\n context.setResult([context.left, 0, 0]).exit();\n return;\n }\n if (typeof context.left === 'function' || typeof context.right === 'function') {\n throw new Error('functions are not supported');\n }\n context.leftType = context.left === null ? 'null' : typeof context.left;\n context.rightType = context.right === null ? 'null' : typeof context.right;\n if (context.leftType !== context.rightType) {\n context.setResult([context.left, context.right]).exit();\n return;\n }\n if (context.leftType === 'boolean' || context.leftType === 'number') {\n context.setResult([context.left, context.right]).exit();\n return;\n }\n if (context.leftType === 'object') {\n context.leftIsArray = isArray(context.left);\n }\n if (context.rightType === 'object') {\n context.rightIsArray = isArray(context.right);\n }\n if (context.leftIsArray !== context.rightIsArray) {\n context.setResult([context.left, context.right]).exit();\n return;\n }\n};\ndiffFilter.filterName = 'trivial';\n\nvar patchFilter = function trivialMatchesPatchFilter(context) {\n if (typeof context.delta === 'undefined') {\n context.setResult(context.left).exit();\n return;\n }\n context.nested = !isArray(context.delta);\n if (context.nested) {\n return;\n }\n if (context.delta.length === 1) {\n context.setResult(context.delta[0]).exit();\n return;\n }\n if (context.delta.length === 2) {\n context.setResult(context.delta[1]).exit();\n return;\n }\n if (context.delta.length === 3 && context.delta[2] === 0) {\n context.setResult(undefined).exit();\n return;\n }\n};\npatchFilter.filterName = 'trivial';\n\nvar reverseFilter = function trivialReferseFilter(context) {\n if (typeof context.delta === 'undefined') {\n context.setResult(context.delta).exit();\n return;\n }\n context.nested = !isArray(context.delta);\n if (context.nested) {\n return;\n }\n if (context.delta.length === 1) {\n context.setResult([context.delta[0], 0, 0]).exit();\n return;\n }\n if (context.delta.length === 2) {\n context.setResult([context.delta[1], context.delta[0]]).exit();\n return;\n }\n if (context.delta.length === 3 && context.delta[2] === 0) {\n context.setResult([context.delta[0]]).exit();\n return;\n }\n};\nreverseFilter.filterName = 'trivial';\n\nexports.diffFilter = diffFilter;\nexports.patchFilter = patchFilter;\nexports.reverseFilter = reverseFilter;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/jsondiffpatch/src/filters/trivial.js\n ** module id = 56\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/jsondiffpatch/src/filters/trivial.js?")},function(module,exports){eval("\nvar Processor = function Processor(options){\n this.selfOptions = options || {};\n this.pipes = {};\n};\n\nProcessor.prototype.options = function(options) {\n if (options) {\n this.selfOptions = options;\n }\n return this.selfOptions;\n};\n\nProcessor.prototype.pipe = function(name, pipe) {\n if (typeof name === 'string') {\n if (typeof pipe === 'undefined') {\n return this.pipes[name];\n } else {\n this.pipes[name] = pipe;\n }\n }\n if (name && name.name) {\n pipe = name;\n if (pipe.processor === this) { return pipe; }\n this.pipes[pipe.name] = pipe;\n }\n pipe.processor = this;\n return pipe;\n};\n\nProcessor.prototype.process = function(input, pipe) {\n var context = input;\n context.options = this.options();\n var nextPipe = pipe || input.pipe || 'default';\n var lastPipe, lastContext;\n while (nextPipe) {\n if (typeof context.nextAfterChildren !== 'undefined') {\n // children processed and coming back to parent\n context.next = context.nextAfterChildren;\n context.nextAfterChildren = null;\n }\n\n if (typeof nextPipe === 'string') {\n nextPipe = this.pipe(nextPipe);\n }\n nextPipe.process(context);\n lastContext = context;\n lastPipe = nextPipe;\n nextPipe = null;\n if (context) {\n if (context.next) {\n context = context.next;\n nextPipe = lastContext.nextPipe || context.pipe || lastPipe;\n }\n }\n }\n return context.hasResult ? context.result : undefined;\n};\n\nexports.Processor = Processor;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/jsondiffpatch/src/processor.js\n ** module id = 57\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/jsondiffpatch/src/processor.js?"); },function(module,exports){eval("module.exports = function(sel, data, children, text, elm) {\n var key = data === undefined ? undefined : data.key;\n return {sel: sel, data: data, children: children,\n text: text, elm: elm, key: key};\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/snabbdom/vnode.js\n ** module id = 58\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/snabbdom/vnode.js?")},function(module,exports,__webpack_require__){eval("/* WEBPACK VAR INJECTION */(function(Buffer, global) {/*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n */\n/* eslint-disable no-proto */\n\n'use strict'\n\nvar base64 = __webpack_require__(226)\nvar ieee754 = __webpack_require__(306)\nvar isArray = __webpack_require__(307)\n\nexports.Buffer = Buffer\nexports.SlowBuffer = SlowBuffer\nexports.INSPECT_MAX_BYTES = 50\nBuffer.poolSize = 8192 // not used by this implementation\n\nvar rootParent = {}\n\n/**\n * If `Buffer.TYPED_ARRAY_SUPPORT`:\n * === true Use Uint8Array implementation (fastest)\n * === false Use Object implementation (most compatible, even IE6)\n *\n * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,\n * Opera 11.6+, iOS 4.2+.\n *\n * Due to various browser bugs, sometimes the Object implementation will be used even\n * when the browser supports typed arrays.\n *\n * Note:\n *\n * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,\n * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.\n *\n * - Safari 5-7 lacks support for changing the `Object.prototype.constructor` property\n * on objects.\n *\n * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.\n *\n * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of\n * incorrect length in some situations.\n\n * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they\n * get the Object implementation, which is slower but behaves correctly.\n */\nBuffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined\n ? global.TYPED_ARRAY_SUPPORT\n : typedArraySupport()\n\nfunction typedArraySupport () {\n function Bar () {}\n try {\n var arr = new Uint8Array(1)\n arr.foo = function () { return 42 }\n arr.constructor = Bar\n return arr.foo() === 42 && // typed array instances can be augmented\n arr.constructor === Bar && // constructor can be set\n typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`\n arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`\n } catch (e) {\n return false\n }\n}\n\nfunction kMaxLength () {\n return Buffer.TYPED_ARRAY_SUPPORT\n ? 0x7fffffff\n : 0x3fffffff\n}\n\n/**\n * Class: Buffer\n * =============\n *\n * The Buffer constructor returns instances of `Uint8Array` that are augmented\n * with function properties for all the node `Buffer` API functions. We use\n * `Uint8Array` so that square bracket notation works as expected -- it returns\n * a single octet.\n *\n * By augmenting the instances, we can avoid modifying the `Uint8Array`\n * prototype.\n */\nfunction Buffer (arg) {\n if (!(this instanceof Buffer)) {\n // Avoid going through an ArgumentsAdaptorTrampoline in the common case.\n if (arguments.length > 1) return new Buffer(arg, arguments[1])\n return new Buffer(arg)\n }\n\n if (!Buffer.TYPED_ARRAY_SUPPORT) {\n this.length = 0\n this.parent = undefined\n }\n\n // Common case.\n if (typeof arg === 'number') {\n return fromNumber(this, arg)\n }\n\n // Slightly less common case.\n if (typeof arg === 'string') {\n return fromString(this, arg, arguments.length > 1 ? arguments[1] : 'utf8')\n }\n\n // Unusual.\n return fromObject(this, arg)\n}\n\nfunction fromNumber (that, length) {\n that = allocate(that, length < 0 ? 0 : checked(length) | 0)\n if (!Buffer.TYPED_ARRAY_SUPPORT) {\n for (var i = 0; i < length; i++) {\n that[i] = 0\n }\n }\n return that\n}\n\nfunction fromString (that, string, encoding) {\n if (typeof encoding !== 'string' || encoding === '') encoding = 'utf8'\n\n // Assumption: byteLength() return value is always < kMaxLength.\n var length = byteLength(string, encoding) | 0\n that = allocate(that, length)\n\n that.write(string, encoding)\n return that\n}\n\nfunction fromObject (that, object) {\n if (Buffer.isBuffer(object)) return fromBuffer(that, object)\n\n if (isArray(object)) return fromArray(that, object)\n\n if (object == null) {\n throw new TypeError('must start with number, buffer, array or string')\n }\n\n if (typeof ArrayBuffer !== 'undefined') {\n if (object.buffer instanceof ArrayBuffer) {\n return fromTypedArray(that, object)\n }\n if (object instanceof ArrayBuffer) {\n return fromArrayBuffer(that, object)\n }\n }\n\n if (object.length) return fromArrayLike(that, object)\n\n return fromJsonObject(that, object)\n}\n\nfunction fromBuffer (that, buffer) {\n var length = checked(buffer.length) | 0\n that = allocate(that, length)\n buffer.copy(that, 0, 0, length)\n return that\n}\n\nfunction fromArray (that, array) {\n var length = checked(array.length) | 0\n that = allocate(that, length)\n for (var i = 0; i < length; i += 1) {\n that[i] = array[i] & 255\n }\n return that\n}\n\n// Duplicate of fromArray() to keep fromArray() monomorphic.\nfunction fromTypedArray (that, array) {\n var length = checked(array.length) | 0\n that = allocate(that, length)\n // Truncating the elements is probably not what people expect from typed\n // arrays with BYTES_PER_ELEMENT > 1 but it's compatible with the behavior\n // of the old Buffer constructor.\n for (var i = 0; i < length; i += 1) {\n that[i] = array[i] & 255\n }\n return that\n}\n\nfunction fromArrayBuffer (that, array) {\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Return an augmented `Uint8Array` instance, for best performance\n array.byteLength\n that = Buffer._augment(new Uint8Array(array))\n } else {\n // Fallback: Return an object instance of the Buffer class\n that = fromTypedArray(that, new Uint8Array(array))\n }\n return that\n}\n\nfunction fromArrayLike (that, array) {\n var length = checked(array.length) | 0\n that = allocate(that, length)\n for (var i = 0; i < length; i += 1) {\n that[i] = array[i] & 255\n }\n return that\n}\n\n// Deserialize { type: 'Buffer', data: [1,2,3,...] } into a Buffer object.\n// Returns a zero-length buffer for inputs that don't conform to the spec.\nfunction fromJsonObject (that, object) {\n var array\n var length = 0\n\n if (object.type === 'Buffer' && isArray(object.data)) {\n array = object.data\n length = checked(array.length) | 0\n }\n that = allocate(that, length)\n\n for (var i = 0; i < length; i += 1) {\n that[i] = array[i] & 255\n }\n return that\n}\n\nif (Buffer.TYPED_ARRAY_SUPPORT) {\n Buffer.prototype.__proto__ = Uint8Array.prototype\n Buffer.__proto__ = Uint8Array\n} else {\n // pre-set for values that may exist in the future\n Buffer.prototype.length = undefined\n Buffer.prototype.parent = undefined\n}\n\nfunction allocate (that, length) {\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Return an augmented `Uint8Array` instance, for best performance\n that = Buffer._augment(new Uint8Array(length))\n that.__proto__ = Buffer.prototype\n } else {\n // Fallback: Return an object instance of the Buffer class\n that.length = length\n that._isBuffer = true\n }\n\n var fromPool = length !== 0 && length <= Buffer.poolSize >>> 1\n if (fromPool) that.parent = rootParent\n\n return that\n}\n\nfunction checked (length) {\n // Note: cannot use `length < kMaxLength` here because that fails when\n // length is NaN (which is otherwise coerced to zero.)\n if (length >= kMaxLength()) {\n throw new RangeError('Attempt to allocate Buffer larger than maximum ' +\n 'size: 0x' + kMaxLength().toString(16) + ' bytes')\n }\n return length | 0\n}\n\nfunction SlowBuffer (subject, encoding) {\n if (!(this instanceof SlowBuffer)) return new SlowBuffer(subject, encoding)\n\n var buf = new Buffer(subject, encoding)\n delete buf.parent\n return buf\n}\n\nBuffer.isBuffer = function isBuffer (b) {\n return !!(b != null && b._isBuffer)\n}\n\nBuffer.compare = function compare (a, b) {\n if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {\n throw new TypeError('Arguments must be Buffers')\n }\n\n if (a === b) return 0\n\n var x = a.length\n var y = b.length\n\n var i = 0\n var len = Math.min(x, y)\n while (i < len) {\n if (a[i] !== b[i]) break\n\n ++i\n }\n\n if (i !== len) {\n x = a[i]\n y = b[i]\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\nBuffer.isEncoding = function isEncoding (encoding) {\n switch (String(encoding).toLowerCase()) {\n case 'hex':\n case 'utf8':\n case 'utf-8':\n case 'ascii':\n case 'binary':\n case 'base64':\n case 'raw':\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return true\n default:\n return false\n }\n}\n\nBuffer.concat = function concat (list, length) {\n if (!isArray(list)) throw new TypeError('list argument must be an Array of Buffers.')\n\n if (list.length === 0) {\n return new Buffer(0)\n }\n\n var i\n if (length === undefined) {\n length = 0\n for (i = 0; i < list.length; i++) {\n length += list[i].length\n }\n }\n\n var buf = new Buffer(length)\n var pos = 0\n for (i = 0; i < list.length; i++) {\n var item = list[i]\n item.copy(buf, pos)\n pos += item.length\n }\n return buf\n}\n\nfunction byteLength (string, encoding) {\n if (typeof string !== 'string') string = '' + string\n\n var len = string.length\n if (len === 0) return 0\n\n // Use a for loop to avoid recursion\n var loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'ascii':\n case 'binary':\n // Deprecated\n case 'raw':\n case 'raws':\n return len\n case 'utf8':\n case 'utf-8':\n return utf8ToBytes(string).length\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return len * 2\n case 'hex':\n return len >>> 1\n case 'base64':\n return base64ToBytes(string).length\n default:\n if (loweredCase) return utf8ToBytes(string).length // assume utf8\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\nBuffer.byteLength = byteLength\n\nfunction slowToString (encoding, start, end) {\n var loweredCase = false\n\n start = start | 0\n end = end === undefined || end === Infinity ? this.length : end | 0\n\n if (!encoding) encoding = 'utf8'\n if (start < 0) start = 0\n if (end > this.length) end = this.length\n if (end <= start) return ''\n\n while (true) {\n switch (encoding) {\n case 'hex':\n return hexSlice(this, start, end)\n\n case 'utf8':\n case 'utf-8':\n return utf8Slice(this, start, end)\n\n case 'ascii':\n return asciiSlice(this, start, end)\n\n case 'binary':\n return binarySlice(this, start, end)\n\n case 'base64':\n return base64Slice(this, start, end)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return utf16leSlice(this, start, end)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = (encoding + '').toLowerCase()\n loweredCase = true\n }\n }\n}\n\nBuffer.prototype.toString = function toString () {\n var length = this.length | 0\n if (length === 0) return ''\n if (arguments.length === 0) return utf8Slice(this, 0, length)\n return slowToString.apply(this, arguments)\n}\n\nBuffer.prototype.equals = function equals (b) {\n if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n if (this === b) return true\n return Buffer.compare(this, b) === 0\n}\n\nBuffer.prototype.inspect = function inspect () {\n var str = ''\n var max = exports.INSPECT_MAX_BYTES\n if (this.length > 0) {\n str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')\n if (this.length > max) str += ' ... '\n }\n return ''\n}\n\nBuffer.prototype.compare = function compare (b) {\n if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n if (this === b) return 0\n return Buffer.compare(this, b)\n}\n\nBuffer.prototype.indexOf = function indexOf (val, byteOffset) {\n if (byteOffset > 0x7fffffff) byteOffset = 0x7fffffff\n else if (byteOffset < -0x80000000) byteOffset = -0x80000000\n byteOffset >>= 0\n\n if (this.length === 0) return -1\n if (byteOffset >= this.length) return -1\n\n // Negative offsets start from the end of the buffer\n if (byteOffset < 0) byteOffset = Math.max(this.length + byteOffset, 0)\n\n if (typeof val === 'string') {\n if (val.length === 0) return -1 // special case: looking for empty string always fails\n return String.prototype.indexOf.call(this, val, byteOffset)\n }\n if (Buffer.isBuffer(val)) {\n return arrayIndexOf(this, val, byteOffset)\n }\n if (typeof val === 'number') {\n if (Buffer.TYPED_ARRAY_SUPPORT && Uint8Array.prototype.indexOf === 'function') {\n return Uint8Array.prototype.indexOf.call(this, val, byteOffset)\n }\n return arrayIndexOf(this, [ val ], byteOffset)\n }\n\n function arrayIndexOf (arr, val, byteOffset) {\n var foundIndex = -1\n for (var i = 0; byteOffset + i < arr.length; i++) {\n if (arr[byteOffset + i] === val[foundIndex === -1 ? 0 : i - foundIndex]) {\n if (foundIndex === -1) foundIndex = i\n if (i - foundIndex + 1 === val.length) return byteOffset + foundIndex\n } else {\n foundIndex = -1\n }\n }\n return -1\n }\n\n throw new TypeError('val must be string, number or Buffer')\n}\n\n// `get` is deprecated\nBuffer.prototype.get = function get (offset) {\n console.log('.get() is deprecated. Access using array indexes instead.')\n return this.readUInt8(offset)\n}\n\n// `set` is deprecated\nBuffer.prototype.set = function set (v, offset) {\n console.log('.set() is deprecated. Access using array indexes instead.')\n return this.writeUInt8(v, offset)\n}\n\nfunction hexWrite (buf, string, offset, length) {\n offset = Number(offset) || 0\n var remaining = buf.length - offset\n if (!length) {\n length = remaining\n } else {\n length = Number(length)\n if (length > remaining) {\n length = remaining\n }\n }\n\n // must be an even number of digits\n var strLen = string.length\n if (strLen % 2 !== 0) throw new Error('Invalid hex string')\n\n if (length > strLen / 2) {\n length = strLen / 2\n }\n for (var i = 0; i < length; i++) {\n var parsed = parseInt(string.substr(i * 2, 2), 16)\n if (isNaN(parsed)) throw new Error('Invalid hex string')\n buf[offset + i] = parsed\n }\n return i\n}\n\nfunction utf8Write (buf, string, offset, length) {\n return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nfunction asciiWrite (buf, string, offset, length) {\n return blitBuffer(asciiToBytes(string), buf, offset, length)\n}\n\nfunction binaryWrite (buf, string, offset, length) {\n return asciiWrite(buf, string, offset, length)\n}\n\nfunction base64Write (buf, string, offset, length) {\n return blitBuffer(base64ToBytes(string), buf, offset, length)\n}\n\nfunction ucs2Write (buf, string, offset, length) {\n return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nBuffer.prototype.write = function write (string, offset, length, encoding) {\n // Buffer#write(string)\n if (offset === undefined) {\n encoding = 'utf8'\n length = this.length\n offset = 0\n // Buffer#write(string, encoding)\n } else if (length === undefined && typeof offset === 'string') {\n encoding = offset\n length = this.length\n offset = 0\n // Buffer#write(string, offset[, length][, encoding])\n } else if (isFinite(offset)) {\n offset = offset | 0\n if (isFinite(length)) {\n length = length | 0\n if (encoding === undefined) encoding = 'utf8'\n } else {\n encoding = length\n length = undefined\n }\n // legacy write(string, encoding, offset, length) - remove in v0.13\n } else {\n var swap = encoding\n encoding = offset\n offset = length | 0\n length = swap\n }\n\n var remaining = this.length - offset\n if (length === undefined || length > remaining) length = remaining\n\n if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {\n throw new RangeError('attempt to write outside buffer bounds')\n }\n\n if (!encoding) encoding = 'utf8'\n\n var loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'hex':\n return hexWrite(this, string, offset, length)\n\n case 'utf8':\n case 'utf-8':\n return utf8Write(this, string, offset, length)\n\n case 'ascii':\n return asciiWrite(this, string, offset, length)\n\n case 'binary':\n return binaryWrite(this, string, offset, length)\n\n case 'base64':\n // Warning: maxLength not taken into account in base64Write\n return base64Write(this, string, offset, length)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return ucs2Write(this, string, offset, length)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\n\nBuffer.prototype.toJSON = function toJSON () {\n return {\n type: 'Buffer',\n data: Array.prototype.slice.call(this._arr || this, 0)\n }\n}\n\nfunction base64Slice (buf, start, end) {\n if (start === 0 && end === buf.length) {\n return base64.fromByteArray(buf)\n } else {\n return base64.fromByteArray(buf.slice(start, end))\n }\n}\n\nfunction utf8Slice (buf, start, end) {\n end = Math.min(buf.length, end)\n var res = []\n\n var i = start\n while (i < end) {\n var firstByte = buf[i]\n var codePoint = null\n var bytesPerSequence = (firstByte > 0xEF) ? 4\n : (firstByte > 0xDF) ? 3\n : (firstByte > 0xBF) ? 2\n : 1\n\n if (i + bytesPerSequence <= end) {\n var secondByte, thirdByte, fourthByte, tempCodePoint\n\n switch (bytesPerSequence) {\n case 1:\n if (firstByte < 0x80) {\n codePoint = firstByte\n }\n break\n case 2:\n secondByte = buf[i + 1]\n if ((secondByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)\n if (tempCodePoint > 0x7F) {\n codePoint = tempCodePoint\n }\n }\n break\n case 3:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)\n if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {\n codePoint = tempCodePoint\n }\n }\n break\n case 4:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n fourthByte = buf[i + 3]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)\n if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {\n codePoint = tempCodePoint\n }\n }\n }\n }\n\n if (codePoint === null) {\n // we did not generate a valid codePoint so insert a\n // replacement char (U+FFFD) and advance only 1 byte\n codePoint = 0xFFFD\n bytesPerSequence = 1\n } else if (codePoint > 0xFFFF) {\n // encode to utf16 (surrogate pair dance)\n codePoint -= 0x10000\n res.push(codePoint >>> 10 & 0x3FF | 0xD800)\n codePoint = 0xDC00 | codePoint & 0x3FF\n }\n\n res.push(codePoint)\n i += bytesPerSequence\n }\n\n return decodeCodePointsArray(res)\n}\n\n// Based on http://stackoverflow.com/a/22747272/680742, the browser with\n// the lowest limit is Chrome, with 0x10000 args.\n// We go 1 magnitude less, for safety\nvar MAX_ARGUMENTS_LENGTH = 0x1000\n\nfunction decodeCodePointsArray (codePoints) {\n var len = codePoints.length\n if (len <= MAX_ARGUMENTS_LENGTH) {\n return String.fromCharCode.apply(String, codePoints) // avoid extra slice()\n }\n\n // Decode in chunks to avoid \"call stack size exceeded\".\n var res = ''\n var i = 0\n while (i < len) {\n res += String.fromCharCode.apply(\n String,\n codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)\n )\n }\n return res\n}\n\nfunction asciiSlice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; i++) {\n ret += String.fromCharCode(buf[i] & 0x7F)\n }\n return ret\n}\n\nfunction binarySlice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; i++) {\n ret += String.fromCharCode(buf[i])\n }\n return ret\n}\n\nfunction hexSlice (buf, start, end) {\n var len = buf.length\n\n if (!start || start < 0) start = 0\n if (!end || end < 0 || end > len) end = len\n\n var out = ''\n for (var i = start; i < end; i++) {\n out += toHex(buf[i])\n }\n return out\n}\n\nfunction utf16leSlice (buf, start, end) {\n var bytes = buf.slice(start, end)\n var res = ''\n for (var i = 0; i < bytes.length; i += 2) {\n res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)\n }\n return res\n}\n\nBuffer.prototype.slice = function slice (start, end) {\n var len = this.length\n start = ~~start\n end = end === undefined ? len : ~~end\n\n if (start < 0) {\n start += len\n if (start < 0) start = 0\n } else if (start > len) {\n start = len\n }\n\n if (end < 0) {\n end += len\n if (end < 0) end = 0\n } else if (end > len) {\n end = len\n }\n\n if (end < start) end = start\n\n var newBuf\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n newBuf = Buffer._augment(this.subarray(start, end))\n } else {\n var sliceLen = end - start\n newBuf = new Buffer(sliceLen, undefined)\n for (var i = 0; i < sliceLen; i++) {\n newBuf[i] = this[i + start]\n }\n }\n\n if (newBuf.length) newBuf.parent = this.parent || this\n\n return newBuf\n}\n\n/*\n * Need to make sure that buffer isn't trying to write out of bounds.\n */\nfunction checkOffset (offset, ext, length) {\n if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n}\n\nBuffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n checkOffset(offset, byteLength, this.length)\n }\n\n var val = this[offset + --byteLength]\n var mul = 1\n while (byteLength > 0 && (mul *= 0x100)) {\n val += this[offset + --byteLength] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length)\n return this[offset]\n}\n\nBuffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n return this[offset] | (this[offset + 1] << 8)\n}\n\nBuffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n return (this[offset] << 8) | this[offset + 1]\n}\n\nBuffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return ((this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16)) +\n (this[offset + 3] * 0x1000000)\n}\n\nBuffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] * 0x1000000) +\n ((this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n this[offset + 3])\n}\n\nBuffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var i = byteLength\n var mul = 1\n var val = this[offset + --i]\n while (i > 0 && (mul *= 0x100)) {\n val += this[offset + --i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readInt8 = function readInt8 (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length)\n if (!(this[offset] & 0x80)) return (this[offset])\n return ((0xff - this[offset] + 1) * -1)\n}\n\nBuffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset] | (this[offset + 1] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset + 1] | (this[offset] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16) |\n (this[offset + 3] << 24)\n}\n\nBuffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] << 24) |\n (this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n (this[offset + 3])\n}\n\nBuffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, true, 23, 4)\n}\n\nBuffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, false, 23, 4)\n}\n\nBuffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, true, 52, 8)\n}\n\nBuffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, false, 52, 8)\n}\n\nfunction checkInt (buf, value, offset, ext, max, min) {\n if (!Buffer.isBuffer(buf)) throw new TypeError('buffer must be a Buffer instance')\n if (value > max || value < min) throw new RangeError('value is out of bounds')\n if (offset + ext > buf.length) throw new RangeError('index out of range')\n}\n\nBuffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkInt(this, value, offset, byteLength, Math.pow(2, 8 * byteLength), 0)\n\n var mul = 1\n var i = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkInt(this, value, offset, byteLength, Math.pow(2, 8 * byteLength), 0)\n\n var i = byteLength - 1\n var mul = 1\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nfunction objectWriteUInt16 (buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffff + value + 1\n for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; i++) {\n buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>\n (littleEndian ? i : 1 - i) * 8\n }\n}\n\nBuffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n } else {\n objectWriteUInt16(this, value, offset, true)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n } else {\n objectWriteUInt16(this, value, offset, false)\n }\n return offset + 2\n}\n\nfunction objectWriteUInt32 (buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffffffff + value + 1\n for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; i++) {\n buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff\n }\n}\n\nBuffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset + 3] = (value >>> 24)\n this[offset + 2] = (value >>> 16)\n this[offset + 1] = (value >>> 8)\n this[offset] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, true)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, false)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n var i = 0\n var mul = 1\n var sub = value < 0 ? 1 : 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n var i = byteLength - 1\n var mul = 1\n var sub = value < 0 ? 1 : 0\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n if (value < 0) value = 0xff + value + 1\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nBuffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n } else {\n objectWriteUInt16(this, value, offset, true)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n } else {\n objectWriteUInt16(this, value, offset, false)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n this[offset + 2] = (value >>> 16)\n this[offset + 3] = (value >>> 24)\n } else {\n objectWriteUInt32(this, value, offset, true)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (value < 0) value = 0xffffffff + value + 1\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, false)\n }\n return offset + 4\n}\n\nfunction checkIEEE754 (buf, value, offset, ext, max, min) {\n if (value > max || value < min) throw new RangeError('value is out of bounds')\n if (offset + ext > buf.length) throw new RangeError('index out of range')\n if (offset < 0) throw new RangeError('index out of range')\n}\n\nfunction writeFloat (buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)\n }\n ieee754.write(buf, value, offset, littleEndian, 23, 4)\n return offset + 4\n}\n\nBuffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {\n return writeFloat(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {\n return writeFloat(this, value, offset, false, noAssert)\n}\n\nfunction writeDouble (buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)\n }\n ieee754.write(buf, value, offset, littleEndian, 52, 8)\n return offset + 8\n}\n\nBuffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {\n return writeDouble(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {\n return writeDouble(this, value, offset, false, noAssert)\n}\n\n// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)\nBuffer.prototype.copy = function copy (target, targetStart, start, end) {\n if (!start) start = 0\n if (!end && end !== 0) end = this.length\n if (targetStart >= target.length) targetStart = target.length\n if (!targetStart) targetStart = 0\n if (end > 0 && end < start) end = start\n\n // Copy 0 bytes; we're done\n if (end === start) return 0\n if (target.length === 0 || this.length === 0) return 0\n\n // Fatal error conditions\n if (targetStart < 0) {\n throw new RangeError('targetStart out of bounds')\n }\n if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')\n if (end < 0) throw new RangeError('sourceEnd out of bounds')\n\n // Are we oob?\n if (end > this.length) end = this.length\n if (target.length - targetStart < end - start) {\n end = target.length - targetStart + start\n }\n\n var len = end - start\n var i\n\n if (this === target && start < targetStart && targetStart < end) {\n // descending copy from end\n for (i = len - 1; i >= 0; i--) {\n target[i + targetStart] = this[i + start]\n }\n } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {\n // ascending copy from start\n for (i = 0; i < len; i++) {\n target[i + targetStart] = this[i + start]\n }\n } else {\n target._set(this.subarray(start, start + len), targetStart)\n }\n\n return len\n}\n\n// fill(value, start=0, end=buffer.length)\nBuffer.prototype.fill = function fill (value, start, end) {\n if (!value) value = 0\n if (!start) start = 0\n if (!end) end = this.length\n\n if (end < start) throw new RangeError('end < start')\n\n // Fill 0 bytes; we're done\n if (end === start) return\n if (this.length === 0) return\n\n if (start < 0 || start >= this.length) throw new RangeError('start out of bounds')\n if (end < 0 || end > this.length) throw new RangeError('end out of bounds')\n\n var i\n if (typeof value === 'number') {\n for (i = start; i < end; i++) {\n this[i] = value\n }\n } else {\n var bytes = utf8ToBytes(value.toString())\n var len = bytes.length\n for (i = start; i < end; i++) {\n this[i] = bytes[i % len]\n }\n }\n\n return this\n}\n\n/**\n * Creates a new `ArrayBuffer` with the *copied* memory of the buffer instance.\n * Added in Node 0.12. Only available in browsers that support ArrayBuffer.\n */\nBuffer.prototype.toArrayBuffer = function toArrayBuffer () {\n if (typeof Uint8Array !== 'undefined') {\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n return (new Buffer(this)).buffer\n } else {\n var buf = new Uint8Array(this.length)\n for (var i = 0, len = buf.length; i < len; i += 1) {\n buf[i] = this[i]\n }\n return buf.buffer\n }\n } else {\n throw new TypeError('Buffer.toArrayBuffer not supported in this browser')\n }\n}\n\n// HELPER FUNCTIONS\n// ================\n\nvar BP = Buffer.prototype\n\n/**\n * Augment a Uint8Array *instance* (not the Uint8Array class!) with Buffer methods\n */\nBuffer._augment = function _augment (arr) {\n arr.constructor = Buffer\n arr._isBuffer = true\n\n // save reference to original Uint8Array set method before overwriting\n arr._set = arr.set\n\n // deprecated\n arr.get = BP.get\n arr.set = BP.set\n\n arr.write = BP.write\n arr.toString = BP.toString\n arr.toLocaleString = BP.toString\n arr.toJSON = BP.toJSON\n arr.equals = BP.equals\n arr.compare = BP.compare\n arr.indexOf = BP.indexOf\n arr.copy = BP.copy\n arr.slice = BP.slice\n arr.readUIntLE = BP.readUIntLE\n arr.readUIntBE = BP.readUIntBE\n arr.readUInt8 = BP.readUInt8\n arr.readUInt16LE = BP.readUInt16LE\n arr.readUInt16BE = BP.readUInt16BE\n arr.readUInt32LE = BP.readUInt32LE\n arr.readUInt32BE = BP.readUInt32BE\n arr.readIntLE = BP.readIntLE\n arr.readIntBE = BP.readIntBE\n arr.readInt8 = BP.readInt8\n arr.readInt16LE = BP.readInt16LE\n arr.readInt16BE = BP.readInt16BE\n arr.readInt32LE = BP.readInt32LE\n arr.readInt32BE = BP.readInt32BE\n arr.readFloatLE = BP.readFloatLE\n arr.readFloatBE = BP.readFloatBE\n arr.readDoubleLE = BP.readDoubleLE\n arr.readDoubleBE = BP.readDoubleBE\n arr.writeUInt8 = BP.writeUInt8\n arr.writeUIntLE = BP.writeUIntLE\n arr.writeUIntBE = BP.writeUIntBE\n arr.writeUInt16LE = BP.writeUInt16LE\n arr.writeUInt16BE = BP.writeUInt16BE\n arr.writeUInt32LE = BP.writeUInt32LE\n arr.writeUInt32BE = BP.writeUInt32BE\n arr.writeIntLE = BP.writeIntLE\n arr.writeIntBE = BP.writeIntBE\n arr.writeInt8 = BP.writeInt8\n arr.writeInt16LE = BP.writeInt16LE\n arr.writeInt16BE = BP.writeInt16BE\n arr.writeInt32LE = BP.writeInt32LE\n arr.writeInt32BE = BP.writeInt32BE\n arr.writeFloatLE = BP.writeFloatLE\n arr.writeFloatBE = BP.writeFloatBE\n arr.writeDoubleLE = BP.writeDoubleLE\n arr.writeDoubleBE = BP.writeDoubleBE\n arr.fill = BP.fill\n arr.inspect = BP.inspect\n arr.toArrayBuffer = BP.toArrayBuffer\n\n return arr\n}\n\nvar INVALID_BASE64_RE = /[^+\\/0-9A-Za-z-_]/g\n\nfunction base64clean (str) {\n // Node strips out invalid characters like \\n and \\t from the string, base64-js does not\n str = stringtrim(str).replace(INVALID_BASE64_RE, '')\n // Node converts strings with length < 2 to ''\n if (str.length < 2) return ''\n // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not\n while (str.length % 4 !== 0) {\n str = str + '='\n }\n return str\n}\n\nfunction stringtrim (str) {\n if (str.trim) return str.trim()\n return str.replace(/^\\s+|\\s+$/g, '')\n}\n\nfunction toHex (n) {\n if (n < 16) return '0' + n.toString(16)\n return n.toString(16)\n}\n\nfunction utf8ToBytes (string, units) {\n units = units || Infinity\n var codePoint\n var length = string.length\n var leadSurrogate = null\n var bytes = []\n\n for (var i = 0; i < length; i++) {\n codePoint = string.charCodeAt(i)\n\n // is surrogate component\n if (codePoint > 0xD7FF && codePoint < 0xE000) {\n // last char was a lead\n if (!leadSurrogate) {\n // no lead yet\n if (codePoint > 0xDBFF) {\n // unexpected trail\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n } else if (i + 1 === length) {\n // unpaired lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n }\n\n // valid lead\n leadSurrogate = codePoint\n\n continue\n }\n\n // 2 leads in a row\n if (codePoint < 0xDC00) {\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n leadSurrogate = codePoint\n continue\n }\n\n // valid surrogate pair\n codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000\n } else if (leadSurrogate) {\n // valid bmp char, but last char was a lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n }\n\n leadSurrogate = null\n\n // encode utf8\n if (codePoint < 0x80) {\n if ((units -= 1) < 0) break\n bytes.push(codePoint)\n } else if (codePoint < 0x800) {\n if ((units -= 2) < 0) break\n bytes.push(\n codePoint >> 0x6 | 0xC0,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x10000) {\n if ((units -= 3) < 0) break\n bytes.push(\n codePoint >> 0xC | 0xE0,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x110000) {\n if ((units -= 4) < 0) break\n bytes.push(\n codePoint >> 0x12 | 0xF0,\n codePoint >> 0xC & 0x3F | 0x80,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else {\n throw new Error('Invalid code point')\n }\n }\n\n return bytes\n}\n\nfunction asciiToBytes (str) {\n var byteArray = []\n for (var i = 0; i < str.length; i++) {\n // Node's code seems to be doing this and not & 0x7F..\n byteArray.push(str.charCodeAt(i) & 0xFF)\n }\n return byteArray\n}\n\nfunction utf16leToBytes (str, units) {\n var c, hi, lo\n var byteArray = []\n for (var i = 0; i < str.length; i++) {\n if ((units -= 2) < 0) break\n\n c = str.charCodeAt(i)\n hi = c >> 8\n lo = c % 256\n byteArray.push(lo)\n byteArray.push(hi)\n }\n\n return byteArray\n}\n\nfunction base64ToBytes (str) {\n return base64.toByteArray(base64clean(str))\n}\n\nfunction blitBuffer (src, dst, offset, length) {\n for (var i = 0; i < length; i++) {\n if ((i + offset >= dst.length) || (i >= src.length)) break\n dst[i + offset] = src[i]\n }\n return i\n}\n\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(59).Buffer, (function() { return this; }())))\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/buffer/index.js\n ** module id = 59\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/buffer/index.js?"); },function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.annotations = exports.cameraEffects = exports.CamViewControls = exports.meshTools = exports.planes = exports.grids = undefined;\n\nvar _Grids = __webpack_require__(252);\n\nvar grids = _interopRequireWildcard(_Grids);\n\nvar _Planes = __webpack_require__(255);\n\nvar planes = _interopRequireWildcard(_Planes);\n\nvar _CamViewControls = __webpack_require__(263);\n\nvar _CamViewControls2 = _interopRequireDefault(_CamViewControls);\n\nvar _AnnotationVisual = __webpack_require__(22);\n\nvar _AnnotationVisual2 = _interopRequireDefault(_AnnotationVisual);\n\nvar _DistanceVisual = __webpack_require__(258);\n\nvar _DistanceVisual2 = _interopRequireDefault(_DistanceVisual);\n\nvar _NoteVisual = __webpack_require__(259);\n\nvar _NoteVisual2 = _interopRequireDefault(_NoteVisual);\n\nvar _DiameterVisual = __webpack_require__(257);\n\nvar _DiameterVisual2 = _interopRequireDefault(_DiameterVisual);\n\nvar _AngleVisual = __webpack_require__(256);\n\nvar _AngleVisual2 = _interopRequireDefault(_AngleVisual);\n\nvar _ThicknessVisual = __webpack_require__(260);\n\nvar _ThicknessVisual2 = _interopRequireDefault(_ThicknessVisual);\n\nvar _zoomInOn = __webpack_require__(261);\n\nvar _zoomInOn2 = _interopRequireDefault(_zoomInOn);\n\nvar _zoomToFit = __webpack_require__(262);\n\nvar _zoomToFit2 = _interopRequireDefault(_zoomToFit);\n\nvar _centerMesh = __webpack_require__(265);\n\nvar _centerMesh2 = _interopRequireDefault(_centerMesh);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }\n\n//import * as objectEffects from './objectEffects'\n\nvar annotations = { AnnotationVisual: _AnnotationVisual2.default, DistanceVisual: _DistanceVisual2.default, NoteVisual: _NoteVisual2.default, DiameterVisual: _DiameterVisual2.default, AngleVisual: _AngleVisual2.default, ThicknessVisual: _ThicknessVisual2.default };\n\n//import ZoomInOnObject from './objectEffects/zoomInOnObject'\n\nvar cameraEffects = { zoomInOn: _zoomInOn2.default, zoomToFit: _zoomToFit2.default };\n\nvar meshTools = { centerMesh: _centerMesh2.default };\n\nexports.grids = grids;\nexports.planes = planes;\nexports.meshTools = meshTools;\nexports.CamViewControls = _CamViewControls2.default;\nexports.cameraEffects = cameraEffects;\nexports.annotations = annotations;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/glView-helpers/lib/index.js\n ** module id = 60\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/glView-helpers/lib/index.js?")},function(module,exports,__webpack_require__){eval("/* WEBPACK VAR INJECTION */(function(module, global) {/**\n * lodash 3.0.1 (Custom Build) \n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright 2012-2016 The Dojo Foundation \n * Based on Underscore.js 1.8.3 \n * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n * Available under MIT license \n */\n\n/** Used to determine if values are of the language type `Object`. */\nvar objectTypes = {\n 'function': true,\n 'object': true\n};\n\n/** Detect free variable `exports`. */\nvar freeExports = (objectTypes[typeof exports] && exports && !exports.nodeType)\n ? exports\n : undefined;\n\n/** Detect free variable `module`. */\nvar freeModule = (objectTypes[typeof module] && module && !module.nodeType)\n ? module\n : undefined;\n\n/** Detect free variable `global` from Node.js. */\nvar freeGlobal = checkGlobal(freeExports && freeModule && typeof global == 'object' && global);\n\n/** Detect free variable `self`. */\nvar freeSelf = checkGlobal(objectTypes[typeof self] && self);\n\n/** Detect free variable `window`. */\nvar freeWindow = checkGlobal(objectTypes[typeof window] && window);\n\n/** Detect `this` as the global object. */\nvar thisGlobal = checkGlobal(objectTypes[typeof this] && this);\n\n/**\n * Used as a reference to the global object.\n *\n * The `this` value is used if it's the global object to avoid Greasemonkey's\n * restricted `window` object, otherwise the `window` object is used.\n */\nvar root = freeGlobal ||\n ((freeWindow !== (thisGlobal && thisGlobal.window)) && freeWindow) ||\n freeSelf || thisGlobal || Function('return this')();\n\n/**\n * Checks if `value` is a global object.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {null|Object} Returns `value` if it's a global object, else `null`.\n */\nfunction checkGlobal(value) {\n return (value && value.Object === Object) ? value : null;\n}\n\nmodule.exports = root;\n\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(37)(module), (function() { return this; }())))\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash._root/index.js\n ** module id = 61\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/lodash._root/index.js?")},function(module,exports){eval("'use strict';\n\nvar proto = Element.prototype;\nvar vendor = proto.matches\n || proto.matchesSelector\n || proto.webkitMatchesSelector\n || proto.mozMatchesSelector\n || proto.msMatchesSelector\n || proto.oMatchesSelector;\n\nmodule.exports = match;\n\n/**\n * Match `el` to `selector`.\n *\n * @param {Element} el\n * @param {String} selector\n * @return {Boolean}\n * @api public\n */\n\nfunction match(el, selector) {\n if (vendor) return vendor.call(el, selector);\n var nodes = el.parentNode.querySelectorAll(selector);\n for (var i = 0; i < nodes.length; i++) {\n if (nodes[i] == el) return true;\n }\n return false;\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/matches-selector/index.js\n ** module id = 62\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/matches-selector/index.js?")},function(module,exports,__webpack_require__){eval("module.exports = __webpack_require__(96)\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/usco-utils/utils.js\n ** module id = 63\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/usco-utils/utils.js?")},function(module,exports){eval('"use strict";\nvar ScopeChecker = (function () {\n function ScopeChecker(scope, isolateModule) {\n this.scope = scope;\n this.isolateModule = isolateModule;\n }\n ScopeChecker.prototype.isStrictlyInRootScope = function (leaf) {\n for (var el = leaf; el; el = el.parentElement) {\n var scope = this.isolateModule.isIsolatedElement(el);\n if (scope && scope !== this.scope) {\n return false;\n }\n if (scope) {\n return true;\n }\n }\n return true;\n };\n return ScopeChecker;\n}());\nexports.ScopeChecker = ScopeChecker;\n//# sourceMappingURL=ScopeChecker.js.map\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/@cycle/dom/lib/ScopeChecker.js\n ** module id = 64\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/@cycle/dom/lib/ScopeChecker.js?')},function(module,exports,__webpack_require__){eval('"use strict";\nvar xstream_adapter_1 = __webpack_require__(23);\nvar xstream_1 = __webpack_require__(19);\nfunction createVTree(vnode, children) {\n return {\n sel: vnode.sel,\n data: vnode.data,\n text: vnode.text,\n elm: vnode.elm,\n key: vnode.key,\n children: children,\n };\n}\nfunction makeTransposeVNode(runStreamAdapter) {\n return function transposeVNode(vnode) {\n if (!vnode) {\n return null;\n }\n else if (vnode && typeof vnode.data === "object" && vnode.data.static) {\n return xstream_1.default.of(vnode);\n }\n else if (runStreamAdapter.isValidStream(vnode)) {\n var xsStream = xstream_adapter_1.default.adapt(vnode, runStreamAdapter.streamSubscribe);\n return xsStream.map(transposeVNode).flatten();\n }\n else if (typeof vnode === "object") {\n if (!vnode.children || vnode.children.length === 0) {\n return xstream_1.default.of(vnode);\n }\n var vnodeChildren = vnode.children\n .map(transposeVNode)\n .filter(function (x) { return x !== null; });\n if (vnodeChildren.length === 0) {\n return xstream_1.default.of(createVTree(vnode, []));\n }\n else {\n return xstream_1.default.combine.apply(xstream_1.default, vnodeChildren)\n .map(function (children) { return createVTree(vnode, children.slice()); });\n }\n }\n else {\n throw new Error("Unhandled vTree Value");\n }\n };\n}\nexports.makeTransposeVNode = makeTransposeVNode;\n//# sourceMappingURL=transposition.js.map\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/@cycle/dom/lib/transposition.js\n ** module id = 65\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/@cycle/dom/lib/transposition.js?')},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = renderProgressBar;\n\nvar _dom = __webpack_require__(18);\n\n__webpack_require__(342);\n\nfunction renderProgressBar(state) {\n var defaults = {\n progress: 0,\n hideOnDone: true\n };\n\n var _Object$assign = Object.assign({}, defaults, state);\n\n var progress = _Object$assign.progress;\n var hideOnDone = _Object$assign.hideOnDone;\n\n\n var element = hideOnDone && progress === 100 ? (0, _dom.h)('div') : (0, _dom.h)('div.progressBar', [(0, _dom.h)('span.fill', { style: { width: progress + '%' } })]);\n return element;\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/widgets/ProgressBar/index.js\n ** module id = 66\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/widgets/ProgressBar/index.js?")},function(module,exports){eval("'use strict';\n\n/**\n * @author alteredq / http://alteredqualia.com/\n * @author mr.doob / http://mrdoob.com/\n */\n\n/*var window = window || {CanvasRenderingContext2D:false,WebGLRenderingContext:false,Worker:undefined,File:undefined,\nFileReader:undefined,FileList:undefined, Blob:undefined }*/\n\nvar Detector = {\n\n canvas: !!window.CanvasRenderingContext2D,\n webgl: function () {\n try {\n return !!window.WebGLRenderingContext && !!document.createElement('canvas').getContext('experimental-webgl');\n } catch (e) {\n return false;\n }\n }(),\n workers: !!window.Worker,\n fileapi: window.File && window.FileReader && window.FileList && window.Blob\n\n};\n\nmodule.exports = Detector;\n\nfunction getWebGLErrorMessage() {\n\n var domElement = document.createElement('div');\n\n domElement.style.fontFamily = 'monospace';\n domElement.style.fontSize = '13px';\n domElement.style.textAlign = 'center';\n domElement.style.background = '#eee';\n domElement.style.color = '#000';\n domElement.style.padding = '1em';\n domElement.style.width = '475px';\n domElement.style.margin = '5em auto 0';\n\n if (!this.webgl) {\n\n domElement.innerHTML = window.WebGLRenderingContext ? ['Sorry, your graphics card doesn\\'t support WebGL'].join('\\n') : ['Sorry, your browser doesn\\'t support WebGL
', 'Please try with', 'Chrome, ', 'Firefox 4 or', 'Webkit Nightly (Mac)'].join('\\n');\n }\n\n return domElement;\n}\n\nfunction addGetWebGLMessage(parameters) {\n\n var parent, id, domElement;\n\n parameters = parameters || {};\n\n parent = parameters.parent !== undefined ? parameters.parent : document.body;\n id = parameters.id !== undefined ? parameters.id : 'oldie';\n\n domElement = Detector.getWebGLErrorMessage();\n domElement.id = id;\n\n parent.appendChild(domElement);\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/webgl/deps/Detector.js\n ** module id = 67\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/webgl/deps/Detector.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nexports.findSelectionRoot = findSelectionRoot;\nexports.getCoordsFromPosSizeRect = getCoordsFromPosSizeRect;\nexports.pick = pick;\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nvar _Projector = __webpack_require__(148);\n\nvar _Projector2 = _interopRequireDefault(_Projector);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction isRootNode(node) {\n return node.selectTrickleUp === false && node.selectable === true;\n}\n\nfunction walkUp(node, checker) {\n if (node) {\n if (checker(node)) {\n return node;\n }\n if (node.parent) {\n return walkUp(node.parent, checker);\n }\n }\n return undefined;\n}\n\nfunction findSelectionRoot(node) {\n return walkUp(node, isRootNode);\n}\n\nfunction getCoordsFromPosSizeRect(inputs) {\n var pos = inputs.pos;\n var rect = inputs.rect;\n var width = inputs.width;\n var height = inputs.height;\n\n var x = (pos.x - rect.left) / width * 2 - 1;\n var y = -((pos.y - rect.top) / height) * 2 + 1;\n //v = new THREE.Vector3((x / this.viewWidth) * 2 - 1, -(y / this.viewHeight) * 2 + 1, 1)\n return { x: x, y: y };\n}\n\nfunction pick(mouseCoords, camera, hiearchyRoot) {\n var ortho = arguments.length <= 3 || arguments[3] === undefined ? false : arguments[3];\n var precision = arguments.length <= 4 || arguments[4] === undefined ? 10 : arguments[4];\n var x = mouseCoords.x;\n var y = mouseCoords.y;\n\n var mousecoords = new _three2.default.Vector3(x, y, 0.5);\n var v = mousecoords;\n var intersects = [];\n\n if (!ortho) {\n v.unproject(camera);\n var fooV = v.clone();\n var raycaster = new _three2.default.Raycaster(camera.position, v.sub(camera.position).normalize());\n //raycaster.precision = 10\n intersects = raycaster.intersectObjects(hiearchyRoot, true);\n } else {\n // use picking ray since it's an orthographic camera\n //var ray = this.projector.pickingRay( v, this.camera )\n //intersects = ray.intersectObjects( this.hiearchyRoot, true )\n //see here:\n _three2.default.Vector3.prototype.pickingRay = function (camera) {\n var tan = Math.tan(0.5 * _three2.default.Math.degToRad(camera.fov)) / camera.zoom;\n\n this.x *= tan * camera.aspect;\n this.y *= tan;\n this.z = -1;\n return this.transformDirection(camera.matrixWorld);\n };\n\n var _raycaster = new _three2.default.Raycaster();\n v.pickingRay(camera);\n _raycaster.set(camera.position, v);\n intersects = _raycaster.intersectObjects(hiearchyRoot, true);\n }\n\n //remove invisibles, dedupe ??\n //TODO: use transducers.js ?\n intersects = intersects.filter(function (intersect) {\n return intersect.object && intersect.object.visible === true;\n }) //&& intersect.object.pickable)\n .sort(function (a, b) {\n return a.distance - b.distance;\n });\n //.reverse()\n\n return intersects;\n}\n\nvar Selector = function () {\n function Selector() {\n _classCallCheck(this, Selector);\n\n this.projector = new _three2.default.Projector();\n this.camera = undefined;\n //for camera\n this.isOrtho = false;\n }\n\n /*pick(event, rect, width, height, scene){\n event.preventDefault()\n //console.log(\"rect, width, height\",rect, width, height)\n var x = ( (event.clientX - rect.left) / width) * 2 - 1\n var y = - ( (event.clientY - rect.top) / height) * 2 + 1\n this.hiearchyRoot = scene.children\n return this._pickInner( x, y, null, this.camera)\n }*/\n\n _createClass(Selector, [{\n key: 'pickAlt',\n value: function pickAlt(pos, rect, width, height, scene) {\n //console.log(\"rect, width, height\",rect, width, height)\n var x = (pos.x - rect.left) / width * 2 - 1;\n var y = -((pos.y - rect.top) / height) * 2 + 1;\n\n this.hiearchyRoot = scene.children;\n\n return this._pickInner(x, y, null, this.camera);\n }\n }, {\n key: '_pickInner',\n value: function _pickInner(x, y, isOrtho, camera) {\n isOrtho = isOrtho || this.isOrtho;\n camera = camera || this.camera;\n var mousecoords = new _three2.default.Vector3(x, y, 0.5);\n\n var intersects = [];\n //v = new THREE.Vector3((x / this.viewWidth) * 2 - 1, -(y / this.viewHeight) * 2 + 1, 1)\n var v = mousecoords;\n if (!isOrtho) {\n v.unproject(camera);\n var v1 = v.clone();\n var fooV = v.clone();\n var raycaster = new _three2.default.Raycaster(camera.position, v.sub(camera.position).normalize());\n //raycaster.precision = 10\n intersects = raycaster.intersectObjects(this.hiearchyRoot, true);\n } else {\n // use picking ray since it's an orthographic camera\n //var ray = this.projector.pickingRay( v, this.camera )\n //intersects = ray.intersectObjects( this.hiearchyRoot, true )\n //see here:\n _three2.default.Vector3.prototype.pickingRay = function (camera) {\n var tan = Math.tan(0.5 * _three2.default.Math.degToRad(camera.fov)) / camera.zoom;\n\n this.x *= tan * camera.aspect;\n this.y *= tan;\n this.z = -1;\n\n return this.transformDirection(camera.matrixWorld);\n };\n\n var _raycaster2 = new _three2.default.Raycaster();\n v.pickingRay(this.camera);\n _raycaster2.set(this.camera.position, v);\n intersects = _raycaster2.intersectObjects(this.hiearchyRoot, true);\n }\n\n //remove invisibles, dedupe\n //TODO: use transducers.js\n intersects = intersects.sort().filter(function (intersect, pos) {\n return intersect.object && intersect.object.visible === true && !pos || intersect != intersects[pos - 1];\n });\n\n return intersects;\n\n /*\n mousecoords.unproject(camera)\n raycaster.ray.set( camera.position, mousecoords.sub( camera.position ).normalize() )\n var intersections = raycaster.intersectObjects( this._THREEObject3D.children, true )\n var firstintersection = ( intersections.length ) > 0 ? intersections[ 0 ] : null\n if (firstintersection !== null) {\n var pickobject = firstintersection.object\n if (typeof pickobject.userData !== 'undefined' &&\n typeof pickobject.userData.props.onPick === 'function') {\n pickobject.userData.props.onPick(event, firstintersection)\n }\n }*/\n }\n }]);\n\n return Selector;\n}();\n\nexports.default = Selector;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/webgl/deps/Selector.js\n ** module id = 68\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/webgl/deps/Selector.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"]) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); } }; }();\n\nexports.positionFromCoords = positionFromCoords;\nexports.targetObject = targetObject;\nexports.isTransformTool = isTransformTool;\nexports.selectionAt = selectionAt;\nexports.meshFrom = meshFrom;\nexports.makeCamera = makeCamera;\nexports.makeControls = makeControls;\nexports.makeLight = makeLight;\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nvar _OrbitControls = __webpack_require__(147);\n\nvar _OrbitControls2 = _interopRequireDefault(_OrbitControls);\n\nvar _CombinedCamera = __webpack_require__(146);\n\nvar _CombinedCamera2 = _interopRequireDefault(_CombinedCamera);\n\nvar _ramda = __webpack_require__(4);\n\nvar _Selector = __webpack_require__(68);\n\nvar _assign = __webpack_require__(7);\n\nvar _assign2 = _interopRequireDefault(_assign);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n// faster object.assign\n\nfunction positionFromCoords(coords) {\n return { position: { x: coords.x, y: coords.y }, event: coords };\n}\nfunction targetObject(event) {\n return event.target.object;\n}\nfunction isTransformTool(input) {\n return ['translate', 'rotate', 'scale', null, undefined].indexOf(input) > -1;\n}\n\nfunction selectionAt(event, mouseCoords, camera, hiearchyRoot) {\n // log.debug(\"selection at\",event)\n // , container, selector, width, height, rootObject\n\n // let intersects = selector.pickAlt({x:event.clientX,y:event.clientY}, rect, width, height, rootObject)\n var intersects = (0, _Selector.pick)(mouseCoords, camera, hiearchyRoot); // , ortho = false, precision=10)\n\n var outEvent = {};\n outEvent.clientX = event.clientX;\n outEvent.clientY = event.clientY;\n outEvent.offsetX = event.offsetX;\n outEvent.offsetY = event.offsetY;\n outEvent.x = event.x || event.clientX;\n outEvent.y = event.y || event.clientY;\n\n outEvent.detail = {};\n outEvent.detail.pickingInfos = intersects;\n return outEvent;\n}\n\nfunction meshFrom(event) {\n var mesh = void 0;\n if (event && event.detail && event.detail.pickingInfos) {\n var _take = (0, _ramda.take)(1, event.detail.pickingInfos);\n\n var _take2 = _slicedToArray(_take, 1);\n\n var intersect = _take2[0]; // we actually only get the best match => DO NOT MODIFY original object\n\n if (intersect && intersect.object) {\n mesh = (0, _Selector.findSelectionRoot)(intersect.object); // now we make sure that what we have is actually selectable\n }\n }\n return mesh;\n}\n\n// //////////Various \"making\" functions , data/config in, (3d object) instances out\n// yup, like factories ! yikes !\n\n/* create a camera instance from the provided data*/\nfunction makeCamera(cameraData, params) {\n // let cameraData = cameraData//TODO: merge with defaults using object.assign\n var DEFAULTS = {\n width: 320,\n height: 240,\n lens: {\n fov: 45,\n near: 0.1,\n far: 20000\n },\n aspect: 320 / 240,\n up: [0, 0, 1],\n pos: [0, 0, 0]\n };\n cameraData = (0, _assign2.default)({}, DEFAULTS, cameraData);\n\n var camera = new _CombinedCamera2.default(cameraData.width, cameraData.height, cameraData.lens.fov, cameraData.lens.near, cameraData.lens.far, cameraData.lens.near, cameraData.lens.far);\n\n camera.up.fromArray(cameraData.up);\n camera.position.fromArray(cameraData.pos);\n return camera;\n}\n\n/* setup a controls instance from the provided data*/\nfunction makeControls(controlsData) {\n var up = new _three2.default.Vector3().fromArray(controlsData.up);\n\n // controlsData = controlsData//TODO: merge with defaults using object.assign\n var controls = new _OrbitControls2.default(undefined, undefined, up);\n controls.upVector = up;\n\n controls.userPanSpeed = controlsData.panSpeed;\n controls.userZoomSpeed = controlsData.zoomSpeed;\n controls.userRotateSpeed = controlsData.rotateSpeed;\n\n controls.autoRotate = controlsData.autoRotate.enabled;\n controls.autoRotateSpeed = controlsData.autoRotate.speed;\n\n return controls;\n}\n\n/* create a light instance from the provided data*/\nfunction makeLight(lightData) {\n var light = void 0;\n var DEFAULTS = {\n color: '#FFF',\n intensity: 1,\n pos: [0, 0, 0]\n };\n lightData = (0, _assign2.default)({}, DEFAULTS, lightData);\n\n switch (lightData.type) {\n case 'light':\n light = new _three2.default.Light(lightData.color);\n light.intensity = lightData.intensity;\n break;\n case 'hemisphereLight':\n light = new _three2.default.HemisphereLight(lightData.color, lightData.gndColor, lightData.intensity);\n break;\n case 'ambientLight':\n // ambient light does not have intensity, only color\n var newColor = new _three2.default.Color(lightData.color);\n newColor.r *= lightData.intensity;\n newColor.g *= lightData.intensity;\n newColor.b *= lightData.intensity;\n light = new _three2.default.AmbientLight(newColor);\n break;\n case 'directionalLight':\n var dirLightDefaults = {\n castShadow: false,\n onlyShadow: false,\n\n shadowMapWidth: 2048,\n shadowMapHeight: 2048,\n shadowCameraLeft: -500,\n shadowCameraRight: 500,\n shadowCameraTop: 500,\n shadowCameraBottom: -500,\n shadowCameraNear: 1200,\n shadowCameraFar: 5000,\n shadowCameraFov: 50,\n shadowBias: 0.0001,\n shadowDarkness: 0.3,\n shadowCameraVisible: false\n };\n lightData = (0, _assign2.default)({}, dirLightDefaults, lightData);\n light = new _three2.default.DirectionalLight(lightData.color, lightData.intensity);\n for (var key in lightData) {\n if (light.hasOwnProperty(key)) {\n light[key] = lightData[key];\n }\n }\n\n break;\n default:\n throw new Error('could not create light');\n }\n\n light.position.fromArray(lightData.pos);\n\n return light;\n}\n\nfunction cameraWobble3dHint(camera) {\n var time = arguments.length <= 1 || arguments[1] === undefined ? 1500 : arguments[1];\n\n var camPos = camera.position.clone();\n var target = camera.position.clone().add(new _three2.default.Vector3(-5, -10, -5));\n\n var tween = new TWEEN.Tween(camPos).to(target, time).repeat(Infinity).delay(500).yoyo(true).easing(TWEEN.Easing.Cubic.InOut).onUpdate(function () {\n camera.position.copy(camPos);\n }).start();\n\n // let camRot = camera.rotation.clone()\n // let rtarget = camera.rotation.clone().add(new THREE.Vector3(50,50,50))\n\n /* let tween2 = new TWEEN.Tween( camRot )\n .to( rtarget , time )\n .repeat( Infinity )\n .delay( 500 )\n .yoyo(true)\n .easing( TWEEN.Easing.Quadratic.InOut )\n .onUpdate( function () {\n camera.position.copy(camRot)\n } )\n .start()*/\n return tween;\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/webgl/utils2.js\n ** module id = 69\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/webgl/utils2.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.partMesh = partMesh;\nexports.partSource = partSource;\nexports.other = other;\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nvar _utils = __webpack_require__(21);\n\nvar _dragAndDrop = __webpack_require__(216);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar merge = _rx2.default.Observable.merge;\nfunction partMesh(DOM, params) {\n var dragOvers$ = DOM.select(':root').events('dragover');\n var drops$ = DOM.select(':root').events('drop');\n var dnd$ = (0, _dragAndDrop.observableDragAndDrop)(dragOvers$, drops$);\n\n // drag & drop sources\n var dndMeshFiles$ = dnd$.filter(function (e) {\n return e.type === 'file';\n }).pluck('data');\n var dndMeshUris$ = dnd$.filter(function (e) {\n return e.type === 'url';\n }).pluck('data');\n\n return (0, _utils.filterByExtensions)(merge(dndMeshFiles$, dndMeshUris$), params.get('extensions', 'meshes'));\n // .map(data =>( {src:'desktop', uri:data.name} ) )\n}\n\nfunction partSource(DOM, params) {\n var dragOvers$ = DOM.select(':root').events('dragover');\n var drops$ = DOM.select(':root').events('drop');\n var dnd$ = (0, _dragAndDrop.observableDragAndDrop)(dragOvers$, drops$);\n\n // drag & drop sources\n var dndSourceFiles$ = dnd$.filter(function (e) {\n return e.type === 'file';\n }).pluck('data');\n var dndSourceUris$ = dnd$.filter(function (e) {\n return e.type === 'url';\n }).pluck('data');\n\n return (0, _utils.filterByExtensions)(merge(dndSourceFiles$, dndSourceUris$), params.get('extensions', 'sources'));\n // .map(data => ( {src:'desktop', uri:data.name} ) )\n}\n\nfunction other(DOM, params) {\n var dragOvers$ = DOM.select(':root').events('dragover');\n var drops$ = DOM.select(':root').events('drop');\n var dnd$ = (0, _dragAndDrop.observableDragAndDrop)(dragOvers$, drops$);\n\n // drag & drop sources\n var dndOtherFiles$ = dnd$.filter(function (e) {\n return e.type === 'file';\n }).pluck('data');\n var dndOtherUris$ = dnd$.filter(function (e) {\n return e.type === 'url';\n }).pluck('data');\n\n return (0, _utils.filterByExtensions)(merge(dndOtherFiles$, dndOtherUris$), params.get('extensions', 'other'));\n // .map(data => ( {src:'desktop', uri:data.name} ) )\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/sources/DOM.js\n ** module id = 70\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/sources/DOM.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.partMesh = partMesh;\nexports.partSource = partSource;\nexports.other = other;\n\nvar _utils = __webpack_require__(21);\n\nfunction partMesh(addressbar, params) {\n return (0, _utils.filterByExtensions)(addressbar.get('modelUrl'), params.get('extensions', 'meshes'));\n // .map(data => ({src:'http', uri:data}) )\n}\n\nfunction partSource(addressbar, params) {\n return (0, _utils.filterByExtensions)(addressbar.get('sourceUrl'), params.get('extensions', 'sources'));\n // .map(data => ({src:'http', uri:data}) )\n}\n\n// for other formats like gcode etc\nfunction other(addressbar, params) {\n return (0, _utils.filterByExtensions)(addressbar.get('sourceUrl'), params.get('extensions', 'other'));\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/sources/addressbar.js\n ** module id = 71\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/sources/addressbar.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.partMesh = partMesh;\nexports.partSource = partSource;\n\nvar _utils = __webpack_require__(21);\n\nfunction partMesh(postMessage$, params) {\n return (0, _utils.filterByExtensions)(postMessage$.pluck('data').filter(_utils.hasModelUrl).pluck('modelUrl').map(function (data) {\n return [data];\n }) // always return array\n , params.get('extensions', 'meshes')); // we only let actual mesh \"data\" through\n // .map(data => ( {src:'http', uri:data} ) )\n}\n\nfunction partSource(postMessage$, params) {\n return (0, _utils.filterByExtensions)(postMessage$.pluck('data').filter(_utils.hasModelUrl).pluck('sourceUrl').map(function (data) {\n return [data];\n }) // always return array\n\n , params.get('extensions', 'sources')); // we only let actual sources \"data\" through\n // .map(data => ( {src:'http', uri:data} ) )\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/sources/postMessage.js\n ** module id = 72\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/sources/postMessage.js?"); -},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.keycodes = undefined;\nexports.isValidElementEvent = isValidElementEvent;\nexports.preventBackNavigation = preventBackNavigation;\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar keycodes = exports.keycodes = {\n 8: 'backspace', 46: 'delete',\n 48: '0', 49: '1', 50: '2', 51: '3', 52: '4', 53: '5', 54: '6', 55: '7', 56: '8', 57: '9',\n 65: 'a', 66: 'b', 67: 'c', 68: 'd', 69: 'e', 70: 'f', 71: 'g',\n 72: 'h', 73: 'i', 74: 'j', 75: 'k', 76: 'l', 77: 'm', 78: 'n',\n 79: 'o', 80: 'p', 81: 'q', 82: 'r', 83: 's', 84: 't', 85: 'u',\n 86: 'v', 87: 'w', 88: 'x', 89: 'y', 90: 'z'\n};\n\n/*\nfunction setKeyBidings( element ){\n //based on http://qiita.com/jdeseno/items/72e12a5fa815b52f95e2\n */\n\nfunction isValidElementEvent(event) {\n var element = event.target || event.srcElement;\n return !(element.tagName === 'INPUT' || element.tagName === 'SELECT' || element.tagName === 'TEXTAREA' || element.isContentEditable);\n}\n\nfunction preventBackNavigation() {\n // disable backspace navigation for MacOs\n _rx2.default.Observable.fromEvent(document, 'keydown').map(function (e) {\n return { event: e, key: keycodes[e.keyCode] };\n }).filter(function (e) {\n return e.key === 'backspace';\n }).tap(function (_ref) {\n var event = _ref.event;\n\n var d = event.srcElement || event.target;\n var tagName = d.tagName.toUpperCase();\n var type = d.type ? d.type.toUpperCase() : undefined;\n var validElements = ['TEXT', 'PASSWORD', 'FILE', 'SEARCH', 'EMAIL', 'NUMBER', 'DATE'];\n\n if (!(tagName === 'INPUT' && validElements.indexOf(type) > -1 || tagName === 'TEXTAREA')) {\n event.preventDefault();\n return false;\n }\n }).forEach(function (e) {\n return e;\n });\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/interactions/keyboard.js\n ** module id = 73\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/interactions/keyboard.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.clicks = clicks;\nexports.interactionsFromEvents = interactionsFromEvents;\nexports.interactionsFromCEvents = interactionsFromCEvents;\nexports.pointerInteractions = pointerInteractions;\nexports.preventScroll = preventScroll;\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nvar _obsUtils = __webpack_require__(5);\n\nvar _utils = __webpack_require__(217);\n\nvar _assign = __webpack_require__(7);\n\nvar _assign2 = _interopRequireDefault(_assign);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar _Rx$Observable = _rx2.default.Observable;\nvar fromEvent = _Rx$Observable.fromEvent;\nvar merge = _Rx$Observable.merge;\nvar empty = _Rx$Observable.empty;\nvar just = _Rx$Observable.just;\n// faster object.assign\n\n// various helpers\nfunction hasTwoTouchPoints(event) {\n return event.touches && event.touches.length === 2;\n}\n\nfunction getOffset(event) {\n return {\n x: event.offsetX === undefined ? event.layerX : event.offsetX,\n y: event.offsetY === undefined ? event.layerY : event.offsetY\n };\n}\n\nfunction isMoving(moveDelta, deltaSqr) {\n return true;\n /* let distSqr = (moveDelta.x * moveDelta.x + moveDelta.y * moveDelta.y)\n let isMoving = (distSqr > deltaSqr)\n // console.log(\"moving\",isMoving)\n return isMoving*/\n}\n\nfunction isStatic(moveDelta, deltaSqr) {\n return !isMoving(moveDelta);\n}\n\n// TODO ,: regroup / refactor all \"delta\" operation ?\nfunction isShort(elapsed, maxTime) {\n return elapsed < maxTime;\n}\n\nfunction isLong(elapsed, maxTime) {\n return elapsed > maxTime;\n}\n\nfunction clicks(mouseDowns, mouseUps, mouseMoves) {\n var timing = arguments.length <= 3 || arguments[3] === undefined ? 200 : arguments[3];\n var deltaSqr = arguments[4];\n\n /*\n \"pseudo click\" that does not trigger when there was\n a mouse movement\n */\n var fakeClicksOld = mouseDowns.flatMap(function (md) {\n var start = { x: md.clientX, y: md.clientY };\n\n // get only valid moves\n var mMoves = mouseMoves.map(false).bufferWithTimeOrCount(timing, 1).filter(function (x) {\n return x.length === 1;\n }).map(function (x) {\n return x[0];\n });\n\n var __moves = mMoves.merge(just(true)); // default to true\n\n return __moves.combineLatest(mouseUps, function (m, mu) {\n // log.info(m, mu)\n var end = { x: mu.clientX, y: mu.clientY };\n return isStatic({ start: start, end: end }, deltaSqr); // allow for small movement (shaky hands!)\n }).takeUntil(mouseUps).filter(function (x) {\n return x === true;\n });\n });\n\n var fakeClicks = mouseDowns.flatMap(function (downEvent) {\n var target = downEvent.currentTarget;\n return _rx2.default.Observable.amb([\n // Skip if we get a movement before a mouse up\n mouseMoves.take(1).flatMap(function (x) {\n return empty();\n }), mouseUps.take(1)]); // .map(function(event){console.log(event) return event})\n });\n\n return fakeClicks;\n}\n\nfunction altMouseMoves(mouseMoves) {\n return mouseMoves.skip(1).zip(mouseMoves, function (a, b) {\n var data = {\n client: {\n x: a.clientX,\n y: a.clientY\n },\n delta: { x: a.clientX - b.clientX, y: a.clientY - b.clientY }\n };\n\n return (0, _assign2.default)(data, b);\n });\n}\n\n/* alternative \"clicks\" (ie mouseDown -> mouseUp ) implementation, with more fine\ngrained control*/\nfunction taps(mouseDowns, mouseUps, mouseMoves) {\n var longPressDelay = arguments.length <= 3 || arguments[3] === undefined ? 800 : arguments[3];\n var deltaSqr = arguments[4];\n\n // only doing any \"clicks if the time between mDOWN and mUP is below longpressDelay\"\n // any small mouseMove is ignored (shaky hands)\n return mouseDowns.flatMap(function (downEvent) {\n var target = downEvent.currentTarget;\n // const startTime = Date.now()//TODO: use time difference to determine if it was a short or a long tap ?\n\n return _rx2.default.Observable.amb([\n // Skip if we get a movement before a mouse up\n mouseMoves.filter(function (data) {\n return isMoving(data.delta, deltaSqr);\n }) // allow for small movement (shaky hands!)\n .take(1).flatMap(function (x) {\n return empty();\n }).timeInterval(), mouseUps.take(1).timeInterval()]); // .timeout(longPressDelay, empty())\n });\n}\n\n/* this emits events whenever pointers are held */\nfunction holds(mouseDowns, mouseUps, mouseMoves) {\n var longPressDelay = arguments.length <= 3 || arguments[3] === undefined ? 800 : arguments[3];\n var deltaSqr = arguments[4];\n\n return mouseDowns.flatMap(function (downEvent) {\n var target = downEvent.currentTarget;\n return _rx2.default.Observable.amb([\n // Skip if we get a movement before timeout\n mouseMoves.filter(function (data) {\n return isMoving(data.delta, deltaSqr);\n }) // allow for small movement (shaky hands!)\n .take(1).flatMap(function (x) {\n return empty();\n }),\n\n // Skip if we get a mouseup before main timeout\n mouseUps.take(1).flatMap(function (x) {\n return empty();\n }), just(2).delay(longPressDelay).timeout(longPressDelay, just(downEvent))]);\n // .timeout(longPressDelay, empty())\n });\n}\n\n/* function drags(mouseDowns, mouseUps, mouseMoves, longPressDelay=800, deltaSqr){\n return mouseDowns\n .flatMap( function(downEvent){\n let target = downEvent.currentTarget\n //let origin = target.position()\n log.info(\"kldf\")\n return Observable.amb(\n [\n // Skip if we get a mouse up before we move\n mouseUps.take(1).flatMap( x => empty() ),\n\n mouseMoves.take(1).map(function(x){\n return{\n target: target,\n //origin: target.position(),\n drags: mouseMoves.takeUntil(mouseUps).map(function(x){\n return {\n delta: x.delta,\n offset: {\n x: x.client.x - downEvent.clientX,\n y: x.client.y - downEvent.clientY\n }\n }\n })\n }\n })\n\n ])\n\n })\n}\n\n//this one just works by dispatching at the end of the movement\nfunction drags2(mouseDowns, mouseUps, mouseMoves, longPressDelay=800, deltaSqr){\n return mouseDowns.flatMap(function (md) {\n var start = { x: md.clientX, y: md.clientY }\n return mouseMoves.combineLatest(mouseUps, function (mm, mu) {\n //log.info(\"mm\",mm,\"mu\",mu)\n var stop = {x: mu.clientX, y: mu.clientY }\n return {\n start: start,\n end: stop\n }\n })\n //.delay(400)\n .takeUntil(mouseUps)\n })\n}\n*/\n\n// based on http://jsfiddle.net/mattpodwysocki/pfCqq/\nfunction drags3(mouseDowns$, mouseUps, mouseMoves) {\n var longPressDelay = arguments.length <= 3 || arguments[3] === undefined ? 800 : arguments[3];\n var deltaSqr = arguments[4];\n\n return mouseDowns$.flatMap(function (md) {\n // console.log(\"drags3 mousedown\",md)\n // calculate offsets when mouse down\n var startX = md.offsetX;\n var startY = md.offsetY;\n // Calculate delta with mousemove until mouseup\n return mouseMoves.map(function (e) {\n // console.log(\"drags3 mousemove\",mm)\n // (mm.preventDefault) ? mm.preventDefault() : mm.returnValue = false\n var delta = {\n left: e.clientX - startX,\n top: e.clientY - startY\n };\n // console.log(\"delta\",delta)\n return (0, _assign2.default)({}, e, delta);\n }).takeUntil(mouseUps);\n });\n}\n\nfunction touchDrags(touchStart$, touchEnd$, touchMove$) {\n return touchStart$.flatMap(function (ts) {\n var startX = ts.touches[0].pageX;\n var startY = ts.touches[0].pageY;\n\n return touchMove$.map(function (e) {\n var x = (e.touches[0].pageX - startX) / 5.0;\n var y = (e.touches[0].pageY - startY) / 5.0;\n\n var delta = {\n left: x,\n top: y,\n x: x,\n y: y };\n\n var output = (0, _assign2.default)({}, e, { delta: delta });\n return output;\n }).takeUntil(touchEnd$);\n });\n}\n\n// pinch, taken from https://github.com/hugobessaa/rx-react-pinch\nfunction pinches(touchstarts, touchmoves, touchEnds) {\n return touchStarts.do(_obsUtils.preventDefault).takeWhile(hasTwoTouchPoints).flatMap(function () {\n return touchMoves.pluck('scale').takeUntil(touchEnds);\n });\n}\n\nfunction interactionsFromEvents(targetEl) {\n var mouseDowns$ = fromEvent(targetEl, 'mousedown');\n var mouseUps$ = fromEvent(targetEl, 'mouseup');\n var mouseLeaves$ = fromEvent(targetEl, 'mouseleave').merge(fromCEvent(targetEl, 'mouseout'));\n var mouseMoves$ = altMouseMoves(fromEvent(targetEl, 'mousemove')).takeUntil(mouseLeaves$);\n var rightClicks$ = fromEvent(targetEl, 'contextmenu').do(_obsUtils.preventDefault); // disable the context menu / right click\n var zooms$ = fromEvent(targetEl, 'wheel');\n\n var touchStart$ = fromEvent('touchstart'); // dom.touchstart(window)\n var touchMove$ = fromEvent('touchmove'); // dom.touchmove(window)\n var touchEnd$ = fromEvent('touchend'); // dom.touchend(window)\n\n return {\n mouseDowns$: mouseDowns$,\n mouseUps$: mouseUps$,\n mouseMoves$: mouseMoves$,\n rightClicks$: rightClicks$,\n zooms$: zooms$,\n touchStart$: touchStart$,\n touchMoves$: touchMoves$,\n touchEnd$: touchEnd$ };\n}\n\n/* generate a hash of basic pointer/ mouse event observables*/\nfunction interactionsFromCEvents(targetEl) {\n var rTarget = arguments.length <= 1 || arguments[1] === undefined ? 'canvas' : arguments[1];\n\n /* function fromCEvent(targetEl, eventName){\n return targetEl.get(rTarget, eventName)\n }*/\n function fromCEvent(targetEl, eventName) {\n return targetEl.select(rTarget).events(eventName);\n }\n\n var mouseDowns$ = fromCEvent(targetEl, 'mousedown');\n var mouseUps$ = fromCEvent(targetEl, 'mouseup');\n var mouseLeaves$ = fromCEvent(targetEl, 'mouseleave').merge(fromCEvent(targetEl, 'mouseout'));\n var mouseMoves$ = altMouseMoves(fromCEvent(targetEl, 'mousemove')).takeUntil(mouseLeaves$);\n var rightClicks$ = fromCEvent(targetEl, 'contextmenu').do(_obsUtils.preventDefault); // disable the context menu / right click\n var zooms$ = fromCEvent(targetEl, 'wheel');\n\n var touchStart$ = fromCEvent(targetEl, 'touchstart'); // dom.touchstart(window)\n var touchMoves$ = fromCEvent(targetEl, 'touchmove'); // dom.touchmove(window)\n var touchEnd$ = fromCEvent(targetEl, 'touchend'); // dom.touchend(window)\n\n return {\n mouseDowns$: mouseDowns$,\n mouseUps$: mouseUps$,\n mouseMoves$: mouseMoves$,\n rightClicks$: rightClicks$,\n zooms$: zooms$,\n touchStart$: touchStart$,\n touchMoves$: touchMoves$,\n touchEnd$: touchEnd$ };\n}\n\nfunction pointerInteractions(baseInteractions) {\n var multiClickDelay = 250;\n var longPressDelay = 250;\n\n var minDelta = 25; // max 50 pixels delta\n var deltaSqr = minDelta * minDelta;\n\n var mouseDowns$ = baseInteractions.mouseDowns$;\n var mouseUps$ = baseInteractions.mouseUps$;\n var rightclicks$ = baseInteractions.rightclicks$;\n var mouseMoves$ = baseInteractions.mouseMoves$;\n var touchStart$ = baseInteractions.touchStart$;\n var touchMoves$ = baseInteractions.touchMoves$;\n var touchEnd$ = baseInteractions.touchEnd$;\n var zooms$ = baseInteractions.zooms$;\n\n // mouseMoves$.forEach(e=>console.log(\"mousemove\",e))\n\n // /// now setup the more complex interactions\n\n var taps$ = taps(merge(mouseDowns$, touchStart$), // mouse & touch interactions starts\n merge(mouseUps$, touchEnd$), // mouse & touch interactions ends\n mouseMoves$, longPressDelay, deltaSqr).share();\n\n var shortTaps$ = taps$.filter(function (e) {\n return e.interval <= longPressDelay;\n }).map(function (e) {\n return e.value;\n }).filter(function (event) {\n return 'button' in event && event.button === 0;\n }) // FIXME : bad filter !\n .buffer(function () {\n return taps$.debounce(multiClickDelay);\n }).map(function (list) {\n return { list: list, nb: list.length };\n }).share();\n\n // normalize zooms (should this be elsewhere ?)\n zooms$ = zooms$.map(_utils.normalizeWheel);\n\n // we get our custom right clicks\n var rightClicks2 = taps$.filter(function (event) {\n return 'button' in event && event.button === 2;\n });\n var holds$ = holds(mouseDowns$, mouseUps$, mouseMoves$, longPressDelay, deltaSqr);\n\n var shortSingleTaps$ = shortTaps$.filter(function (x) {\n return x.nb === 1;\n }).flatMap(function (e) {\n return e.list;\n });\n var shortDoubleTaps$ = shortTaps$.filter(function (x) {\n return x.nb === 2;\n }).flatMap(function (e) {\n return e.list;\n }).take(1).repeat();\n\n // static , long held taps, for context menus etc\n // longTaps: either HELD leftmouse/pointer or HELD right click //FIXME : needs to be \"UNTIL\" mouseUp\n // and not fire before mouseUp\n var longTaps$ = taps$.filter(function (e) {\n return e.interval > longPressDelay;\n }).map(function (e) {\n return e.value;\n }); // holds$.take(1).repeat()//.timeout(longPressDelay, empty())\n // .tap(e=>console.log(\"taps with LONG timeInterval\",e))\n\n // drag move interactions (continuously firing)\n var dragMoves$ = merge(drags3(mouseDowns$, mouseUps$, mouseMoves$, longPressDelay, deltaSqr), touchDrags(touchStart$, touchEnd$, touchMoves$).throttle(60).tap(function (e) {\n return console.log('foo');\n })).takeUntil(longTaps$).repeat(); // no drag moves if there is a context action already taking place\n\n return {\n taps: taps$.map(function (e) {\n return e.value;\n }),\n shortSingleTaps$: shortSingleTaps$,\n shortDoubleTaps$: shortDoubleTaps$,\n longTaps$: longTaps$,\n dragMoves$: dragMoves$,\n zooms$: zooms$ };\n}\n\n// /////\nfunction preventScroll(targetEl) {\n fromEvent(targetEl, 'mousewheel').forEach(_obsUtils.preventDefault);\n fromEvent(targetEl, 'DOMMouseScroll').forEach(_obsUtils.preventDefault);\n fromEvent(targetEl, 'wheel').forEach(_obsUtils.preventDefault);\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/interactions/pointers.js\n ** module id = 74\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/interactions/pointers.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.windowResizes = windowResizes;\nexports.elementResizes = elementResizes;\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar Observable = _rx2.default.Observable;\nvar fromEvent = Observable.fromEvent;\n__webpack_require__(279);\n\n// window resize event stream, throttled by throttle amount (250ms default)\nfunction windowResizes() {\n var throttle = arguments.length <= 0 || arguments[0] === undefined ? 250 : arguments[0];\n\n // only get the fields we need\n function extractSize(x) {\n x = x.target;\n var bRect = { left: 0, top: 0, bottom: 0, right: 0, width: 0, height: 0 };\n if (x.getBoundingClientRect) bRect = x.getBoundingClientRect();\n\n var res = { width: x.innerWidth, height: x.innerHeight, aspect: x.innerWidth / x.innerHeight, bRect: bRect };\n return res;\n }\n\n var throttledWinResize = fromEvent(window, 'resize').throttle(throttle /* ms */).map(extractSize).startWith({ width: window.innerWidth, height: window.innerHeight, aspect: window.innerWidth / window.innerHeight, bRect: undefined });\n\n return throttledWinResize;\n}\n\nfunction elementResizes(element) {\n var throttle = arguments.length <= 1 || arguments[1] === undefined ? 250 : arguments[1];\n\n function extractSize(x) {\n x = x.target;\n var bRect = { left: 0, top: 0, bottom: 0, right: 0, width: 0, height: 0 };\n if (x.getBoundingClientRect) bRect = x.getBoundingClientRect();\n\n var res = { width: x.innerWidth, height: x.innerHeight, aspect: x.innerWidth / x.innerHeight, bRect: bRect };\n return res;\n }\n\n return _rx2.default.DOM.resize(element).throttle(throttle /* ms */).map(extractSize);\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/interactions/sizing.js\n ** module id = 75\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/interactions/sizing.js?")},function(module,exports,__webpack_require__){eval('\'use strict\';\n\nObject.defineProperty(exports, "__esModule", {\n value: true\n});\nexports.extractChanges = extractChanges;\nexports.extractChangesBetweenArrays = extractChangesBetweenArrays;\nexports.changesFromObservableArrays = changesFromObservableArrays;\nexports.changesFromObservableArrays2 = changesFromObservableArrays2;\nexports.transformEquals = transformEquals;\nexports.colorsEqual = colorsEqual;\nexports.entityVisualComparer = entityVisualComparer;\n\nvar _utils = __webpack_require__(3);\n\nfunction compareHash(obj) {\n if (obj.uuid) return obj.uuid;\n // return JSON.stringify(obj)\n // return typeof(obj)+obj.name\n}\n\nvar jsondiffpatch = __webpack_require__(17).create({ objectHash: compareHash });\n\nfunction extractChanges(prev, cur) {\n var delta = jsondiffpatch.diff(prev, cur);\n // console.log("delta",delta)\n var result = { added: [], removed: [], changed: [] };\n\n if (delta && \'_t\' in delta) {\n (function () {\n var removed = []; // delta["_0"][0]//delta[0][0]\n var added = []; // delta[0][0]//delta[0][1]\n\n Object.keys(delta).map(function (key) {\n // console.log("AAA",key)\n // "_t": "a", Array delta (member names indicate array indices)\n\n if (key[0] === \'_\') {\n if (key !== \'_a\' && key !== \'_t\') {\n removed.push(delta[key][0]);\n }\n } else {\n added.push(delta[key][0]);\n }\n });\n\n result.added = (0, _utils.toArray)(added).filter(function (i) {\n return i !== undefined;\n });\n result.removed = (0, _utils.toArray)(removed).filter(function (i) {\n return i !== undefined;\n });\n\n // console.log("added",result.added)\n // console.log("removed",result.removed)\n })();\n } else if (prev === undefined) {\n // not handled right in the above case for some reason ??\n result.added = cur;\n }\n\n return result;\n}\n\nvar instance = __webpack_require__(17).create({\n objectHash: function objectHash(obj, index) {\n if (typeof obj._id !== \'undefined\') {\n return obj._id;\n }\n if (typeof obj.id !== \'undefined\') {\n return obj.id;\n }\n if (typeof obj.name !== \'undefined\') {\n return obj.name;\n }\n return \'$$index:\' + index;\n }\n});\n// to ignore functions\ninstance.processor.pipes.diff.before(\'trivial\', function ignoreFunctionDiffFilter(context) {\n if (typeof context.left === \'function\' || typeof context.right === \'function\') {\n context.setResult(undefined);\n context.exit();\n }\n});\n\nfunction extractChangesBetweenArrays(prev, cur) {\n var delta = instance.diff(prev, cur);\n // console.log("delta",delta)\n // console.log("diff",delta)//JSON.stringify(delta, null, 2))\n\n var result = { added: [], removed: [], changed: [], upserted: [] };\n\n if (delta && \'_t\' in delta) {\n (function () {\n var removed = []; // delta["_0"][0]//delta[0][0]\n var added = []; // delta[0][0]//delta[0][1]\n var upserted = [];\n\n if (delta[\'_t\'] === \'a\') {\n // array diff\n // "_t": "a", Array delta (member names indicate array indices)\n Object.keys(delta).map(function (key) {\n if (key !== \'_t\') {\n if (key.length > 0 && key.indexOf(\'_\') > -1) {\n var realKey = parseInt(key.replace(\'_\', \'\'), 10);\n // console.log("removed",delta, realKey)//,key,delta)\n removed.push(prev[realKey]);\n } else {\n // added or changed\n // console.log("added or changed",delta, key)\n var _realKey = parseInt(key, 10);\n upserted.push(cur[_realKey]);\n }\n }\n });\n }\n result.added = (0, _utils.toArray)(added).filter(function (i) {\n return i !== undefined;\n });\n result.removed = (0, _utils.toArray)(removed).filter(function (i) {\n return i !== undefined;\n });\n result.upserted = (0, _utils.toArray)(upserted).filter(function (i) {\n return i !== undefined;\n });\n // console.log("added",result.added)\n // console.log("removed",result.removed)\n })();\n } else if (prev === undefined) {\n // not handled right in the above case for some reason ??\n result.upserted = cur;\n }\n\n return result;\n}\n\nfunction changesFromObservableArrays(data$) {\n return data$.scan(function (acc, cur) {\n return { cur: cur, prev: acc.cur };\n }, { prev: undefined, cur: undefined }).map(function (typeData) {\n var cur = typeData.cur;\n var prev = typeData.prev;\n\n var changes = extractChangesBetweenArrays(prev, cur);\n return changes;\n }).share();\n}\n\nfunction changesFromObservableArrays2(data$) {\n return data$.scan(function (acc, x) {\n var cur = x;\n var prev = acc.cur;\n\n cur = Object.keys(cur).map(function (key) {\n return cur[key];\n });\n return { cur: cur, prev: prev };\n }, { prev: undefined, cur: undefined }).map(function (typeData) {\n var cur = typeData.cur;\n var prev = typeData.prev;\n // console.log("diffing",cur,prev)\n\n var changes = extractChanges(prev, cur);\n return changes;\n }).share();\n}\n\nfunction transformEquals(a, b) {\n if (!a || !b) return true;\n for (var j = 0; j < a.length; j++) {\n if (a[j] !== b[j]) {\n return false;\n }\n }\n return true;\n}\n\nfunction colorsEqual(a, b) {\n if (!a || !b) return true;\n return a === b;\n}\n\nfunction entityVisualComparer(prev, cur) {\n // console.log("prev",prev,"cur",cur)\n\n if (!cur) {\n return false;\n }\n\n // compare lengths - can save a lot of time\n if (cur.length !== prev.length) {\n return false;\n }\n\n var sortedCur = cur.sort();\n var sortedPrev = prev.sort();\n for (var i = 0; i < cur.length; i++) {\n if (sortedCur[i].typeUid !== sortedPrev[i].typeUid) {\n return false;\n }\n\n if (sortedCur[i].id !== sortedPrev[i].id) {\n return false;\n }\n\n var curVal = sortedCur[i];\n var preVal = sortedPrev[i];\n\n /*\n sortedCur[i].color === sortedPrev[i].color\n )*/\n\n var posEq = transformEquals(curVal.pos, preVal.pos);\n var rotEq = transformEquals(curVal.rot, preVal.rot);\n var scaEq = transformEquals(curVal.sca, preVal.sca);\n var colEq = colorsEqual(curVal.color, preVal.color);\n var allEqual = posEq && rotEq && scaEq && colEq;\n if (!allEqual) return false;\n }\n\n return true;\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/utils/diffPatchUtils.js\n ** module id = 76\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/utils/diffPatchUtils.js?')},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _loglevel = __webpack_require__(274);\n\nvar _loglevel2 = _interopRequireDefault(_loglevel);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n// polygill for array.includes\nif (![].includes) {\n Array.prototype.includes = function (searchElement /*, fromIndex*/) {\n 'use strict';\n\n var O = Object(this);\n var len = parseInt(O.length) || 0;\n if (len === 0) {\n return false;\n }\n var n = parseInt(arguments[1]) || 0;\n var k;\n if (n >= 0) {\n k = n;\n } else {\n k = len + n;\n if (k < 0) {\n k = 0;\n }\n }\n var currentElement;\n while (k < len) {\n currentElement = O[k];\n if (searchElement === currentElement || searchElement !== searchElement && currentElement !== currentElement) {\n return true;\n }\n k++;\n }\n return false;\n };\n}\n\n// ////////////\nvar logMaker = function logMaker() {\n var prefix = arguments.length <= 0 || arguments[0] === undefined ? '' : arguments[0];\n var strLevel = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1];\n var timeStamp = arguments.length <= 2 || arguments[2] === undefined ? false : arguments[2];\n\n var log = {};\n var loglevel = 'warn';\n log.setLevel = function (level) {\n loglevel = level;\n };\n\n log.trace = function () {\n var context = prefix;\n if (strLevel) context += 'TRACE:';\n if (timeStamp) {\n var tStamp = new Date().toTimeString().slice(0, 8);\n context += tStamp;\n }\n if (!['trace'].includes(loglevel)) return new Function();\n return Function.prototype.bind.call(console.trace, console, context);\n }();\n log.debug = function () {\n var context = prefix;\n if (strLevel) context += 'DEBUG:';\n if (timeStamp) {\n var tStamp = new Date().toTimeString().slice(0, 8);\n context += tStamp;\n }\n if (!['trace', 'debug'].includes(loglevel)) return new Function();\n return Function.prototype.bind.call(console.debug, console, context);\n }();\n\n log.info = function () {\n var context = prefix;\n if (strLevel) context += 'INFO:';\n if (timeStamp) {\n var tStamp = new Date().toTimeString().slice(0, 8);\n context += tStamp;\n }\n if (!['trace', 'debug', 'info'].includes(loglevel)) new Function();\n return Function.prototype.bind.call(console.info, console, context);\n }();\n\n log.warn = function () {\n var context = prefix;\n if (strLevel) context += 'WARN:';\n if (timeStamp) {\n var tStamp = new Date().toTimeString().slice(0, 8);\n context += tStamp;\n }\n if (!['trace', 'debug', 'info', 'warn'].includes(loglevel)) new Function();\n return Function.prototype.bind.call(console.warn, console, context);\n }();\n log.error = function () {\n var context = prefix;\n if (strLevel) context += 'ERROR:';\n if (timeStamp) {\n var tStamp = new Date().toTimeString().slice(0, 8);\n context += tStamp;\n }\n if (!['trace', 'debug', 'info', 'warn', 'error'].includes(loglevel)) new Function();\n return Function.prototype.bind.call(console.error, console, context);\n }();\n\n return log;\n};\n\n// import log from 'loglevel'\n\n/*function makeLog(prefix=\"\"){\n var originalFactory = _log.methodFactory\n _log.methodFactory = function (methodName, logLevel) {\n var rawMethod = originalFactory(methodName, logLevel)\n let tStamp = new Date().toTimeString().slice(0, 8)\n //tStamp = tStamp.getHours() +\":\"+tStamp.getMinutes()+\":\"+tStamp.getSeconds()+\" \"+tStamp.getMilliseconds()\n return function (message) {\n rawMethod(prefix+ tStamp +\" \"+ message)\n }\n }\n return _log\n}*/\n\n/*var originalFactory = log.methodFactory\nlog.methodFactory = function (methodName, logLevel) {\n var rawMethod = originalFactory(methodName, logLevel)\n\n return function (message) {\n rawMethod(\"Newsflash: \" + message)\n }\n}\nlog.setLevel(\"warn\") // Be sure to call setLevel method in order to apply plugin */\n\n/* log.setLevel(\"info\")\n let foo = {sdf:\"dsf\",aa:45}\n log.error(\"too easy\")\n log.error(\"..or is it\",\"blal\",foo)\n log.info(\"..or is it\",\"blal\",foo)\n\n let msg =\" sdfqsdq\"\n log.trace(msg)\n log.debug(msg)\n log.info(msg)\n log.warn(msg)\n log.error(msg)\n\n log.info(\"assetManager\",AssetManager)\n\n log.info(\"This is a test...\");*/\n\n// for now return loglevel\n\nvar logMaker2 = function logMaker2() {\n var prefix = arguments.length <= 0 || arguments[0] === undefined ? '' : arguments[0];\n\n return _loglevel2.default;\n};\n// import logger from './utils/log'\n// let log = logger(\"Jam-Root\")\n// log.setLevel(\"warn\")\nexports.default = logMaker2;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/utils/log.js\n ** module id = 77\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/utils/log.js?")},function(module,exports,__webpack_require__){eval('"use strict";\n\nvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\nObject.defineProperty(exports, "__esModule", {\n value: true\n});\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nvar _BaseHelper2 = __webpack_require__(13);\n\nvar _BaseHelper3 = _interopRequireDefault(_BaseHelper2);\n\nvar _GizmoMaterial = __webpack_require__(12);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn\'t been initialised - super() hasn\'t been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\n/*\n//TODO: make this into a mesh / geometry subclass\n*/\n\nvar CircleHelper = (function (_BaseHelper) {\n _inherits(CircleHelper, _BaseHelper);\n\n function CircleHelper(options) {\n _classCallCheck(this, CircleHelper);\n\n var defaultMaterial = new _GizmoMaterial.GizmoLineMaterial({\n color: "#000",\n depthTest: false,\n depthWrite: false,\n renderDepth: 1e20,\n highlightColor: "#F00"\n });\n\n var DEFAULTS = {\n radius: 0,\n direction: new _three2.default.Vector3(),\n\n color: "#000",\n highlightColor: "#F00",\n\n material: defaultMaterial\n };\n\n options = Object.assign({}, DEFAULTS, options);\n\n var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(CircleHelper).call(this, options));\n\n Object.assign(_this, options);\n\n _this.setRadius(_this.radius);\n return _this;\n }\n\n _createClass(CircleHelper, [{\n key: "setRadius",\n value: function setRadius(radius) {\n var circleRadius = this.radius = radius;\n var circleShape = new _three2.default.Shape();\n circleShape.moveTo(0, 0);\n circleShape.absarc(0, 0, circleRadius, 0, Math.PI * 2, false);\n circleShape.moveTo(0, 0);\n var points = circleShape.createSpacedPointsGeometry(100);\n\n if (this.rCircle) this.remove(this.rCircle);\n\n this.rCircle = new _three2.default.Line(points, this.material);\n this.add(this.rCircle);\n }\n }]);\n\n return CircleHelper;\n})(_BaseHelper3.default);\n\nexports.default = CircleHelper;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/glView-helpers/lib/CircleHelper.js\n ** module id = 78\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/glView-helpers/lib/CircleHelper.js?'); +},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.keycodes = undefined;\nexports.isValidElementEvent = isValidElementEvent;\nexports.preventBackNavigation = preventBackNavigation;\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar keycodes = exports.keycodes = {\n 8: 'backspace', 46: 'delete',\n 48: '0', 49: '1', 50: '2', 51: '3', 52: '4', 53: '5', 54: '6', 55: '7', 56: '8', 57: '9',\n 65: 'a', 66: 'b', 67: 'c', 68: 'd', 69: 'e', 70: 'f', 71: 'g',\n 72: 'h', 73: 'i', 74: 'j', 75: 'k', 76: 'l', 77: 'm', 78: 'n',\n 79: 'o', 80: 'p', 81: 'q', 82: 'r', 83: 's', 84: 't', 85: 'u',\n 86: 'v', 87: 'w', 88: 'x', 89: 'y', 90: 'z'\n};\n\n/*\nfunction setKeyBidings( element ){\n //based on http://qiita.com/jdeseno/items/72e12a5fa815b52f95e2\n */\n\nfunction isValidElementEvent(event) {\n var element = event.target || event.srcElement;\n return !(element.tagName === 'INPUT' || element.tagName === 'SELECT' || element.tagName === 'TEXTAREA' || element.isContentEditable);\n}\n\nfunction preventBackNavigation() {\n // disable backspace navigation for MacOs\n _rx2.default.Observable.fromEvent(document, 'keydown').map(function (e) {\n return { event: e, key: keycodes[e.keyCode] };\n }).filter(function (e) {\n return e.key === 'backspace';\n }).tap(function (_ref) {\n var event = _ref.event;\n\n var d = event.srcElement || event.target;\n var tagName = d.tagName.toUpperCase();\n var type = d.type ? d.type.toUpperCase() : undefined;\n var validElements = ['TEXT', 'PASSWORD', 'FILE', 'SEARCH', 'EMAIL', 'NUMBER', 'DATE'];\n\n if (!(tagName === 'INPUT' && validElements.indexOf(type) > -1 || tagName === 'TEXTAREA')) {\n event.preventDefault();\n return false;\n }\n }).forEach(function (e) {\n return e;\n });\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/interactions/keyboard.js\n ** module id = 73\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/interactions/keyboard.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.clicks = clicks;\nexports.interactionsFromEvents = interactionsFromEvents;\nexports.interactionsFromCEvents = interactionsFromCEvents;\nexports.pointerInteractions = pointerInteractions;\nexports.preventScroll = preventScroll;\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nvar _obsUtils = __webpack_require__(5);\n\nvar _utils = __webpack_require__(217);\n\nvar _assign = __webpack_require__(7);\n\nvar _assign2 = _interopRequireDefault(_assign);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar _Rx$Observable = _rx2.default.Observable;\nvar fromEvent = _Rx$Observable.fromEvent;\nvar merge = _Rx$Observable.merge;\nvar empty = _Rx$Observable.empty;\nvar just = _Rx$Observable.just;\n// faster object.assign\n\n// various helpers\nfunction hasTwoTouchPoints(event) {\n return event.touches && event.touches.length === 2;\n}\n\nfunction getOffset(event) {\n return {\n x: event.offsetX === undefined ? event.layerX : event.offsetX,\n y: event.offsetY === undefined ? event.layerY : event.offsetY\n };\n}\n\nfunction isMoving(moveDelta, deltaSqr) {\n return true;\n /* let distSqr = (moveDelta.x * moveDelta.x + moveDelta.y * moveDelta.y)\n let isMoving = (distSqr > deltaSqr)\n // console.log(\"moving\",isMoving)\n return isMoving*/\n}\n\nfunction isStatic(moveDelta, deltaSqr) {\n return !isMoving(moveDelta);\n}\n\n// TODO ,: regroup / refactor all \"delta\" operation ?\nfunction isShort(elapsed, maxTime) {\n return elapsed < maxTime;\n}\n\nfunction isLong(elapsed, maxTime) {\n return elapsed > maxTime;\n}\n\nfunction clicks(mouseDowns, mouseUps, mouseMoves) {\n var timing = arguments.length <= 3 || arguments[3] === undefined ? 200 : arguments[3];\n var deltaSqr = arguments[4];\n\n /*\n \"pseudo click\" that does not trigger when there was\n a mouse movement\n */\n var fakeClicksOld = mouseDowns.flatMap(function (md) {\n var start = { x: md.clientX, y: md.clientY };\n\n // get only valid moves\n var mMoves = mouseMoves.map(false).bufferWithTimeOrCount(timing, 1).filter(function (x) {\n return x.length === 1;\n }).map(function (x) {\n return x[0];\n });\n\n var __moves = mMoves.merge(just(true)); // default to true\n\n return __moves.combineLatest(mouseUps, function (m, mu) {\n // log.info(m, mu)\n var end = { x: mu.clientX, y: mu.clientY };\n return isStatic({ start: start, end: end }, deltaSqr); // allow for small movement (shaky hands!)\n }).takeUntil(mouseUps).filter(function (x) {\n return x === true;\n });\n });\n\n var fakeClicks = mouseDowns.flatMap(function (downEvent) {\n var target = downEvent.currentTarget;\n return _rx2.default.Observable.amb([\n // Skip if we get a movement before a mouse up\n mouseMoves.take(1).flatMap(function (x) {\n return empty();\n }), mouseUps.take(1)]); // .map(function(event){console.log(event) return event})\n });\n\n return fakeClicks;\n}\n\nfunction altMouseMoves(mouseMoves) {\n return mouseMoves.skip(1).zip(mouseMoves, function (a, b) {\n var data = {\n client: {\n x: a.clientX,\n y: a.clientY\n },\n delta: { x: a.clientX - b.clientX, y: a.clientY - b.clientY }\n };\n\n return (0, _assign2.default)(data, b);\n });\n}\n\n/* alternative \"clicks\" (ie mouseDown -> mouseUp ) implementation, with more fine\ngrained control*/\nfunction taps(mouseDowns, mouseUps, mouseMoves) {\n var longPressDelay = arguments.length <= 3 || arguments[3] === undefined ? 800 : arguments[3];\n var deltaSqr = arguments[4];\n\n // only doing any \"clicks if the time between mDOWN and mUP is below longpressDelay\"\n // any small mouseMove is ignored (shaky hands)\n return mouseDowns.flatMap(function (downEvent) {\n var target = downEvent.currentTarget;\n // const startTime = Date.now()//TODO: use time difference to determine if it was a short or a long tap ?\n\n return _rx2.default.Observable.amb([\n // Skip if we get a movement before a mouse up\n mouseMoves.filter(function (data) {\n return isMoving(data.delta, deltaSqr);\n }) // allow for small movement (shaky hands!)\n .take(1).flatMap(function (x) {\n return empty();\n }).timeInterval(), mouseUps.take(1).timeInterval()]); // .timeout(longPressDelay, empty())\n });\n}\n\n/* this emits events whenever pointers are held */\nfunction holds(mouseDowns, mouseUps, mouseMoves) {\n var longPressDelay = arguments.length <= 3 || arguments[3] === undefined ? 800 : arguments[3];\n var deltaSqr = arguments[4];\n\n return mouseDowns.flatMap(function (downEvent) {\n var target = downEvent.currentTarget;\n return _rx2.default.Observable.amb([\n // Skip if we get a movement before timeout\n mouseMoves.filter(function (data) {\n return isMoving(data.delta, deltaSqr);\n }) // allow for small movement (shaky hands!)\n .take(1).flatMap(function (x) {\n return empty();\n }),\n\n // Skip if we get a mouseup before main timeout\n mouseUps.take(1).flatMap(function (x) {\n return empty();\n }), just(2).delay(longPressDelay).timeout(longPressDelay, just(downEvent))]);\n // .timeout(longPressDelay, empty())\n });\n}\n\n/* function drags(mouseDowns, mouseUps, mouseMoves, longPressDelay=800, deltaSqr){\n return mouseDowns\n .flatMap( function(downEvent){\n let target = downEvent.currentTarget\n //let origin = target.position()\n log.info(\"kldf\")\n return Observable.amb(\n [\n // Skip if we get a mouse up before we move\n mouseUps.take(1).flatMap( x => empty() ),\n\n mouseMoves.take(1).map(function(x){\n return{\n target: target,\n //origin: target.position(),\n drags: mouseMoves.takeUntil(mouseUps).map(function(x){\n return {\n delta: x.delta,\n offset: {\n x: x.client.x - downEvent.clientX,\n y: x.client.y - downEvent.clientY\n }\n }\n })\n }\n })\n\n ])\n\n })\n}\n\n//this one just works by dispatching at the end of the movement\nfunction drags2(mouseDowns, mouseUps, mouseMoves, longPressDelay=800, deltaSqr){\n return mouseDowns.flatMap(function (md) {\n var start = { x: md.clientX, y: md.clientY }\n return mouseMoves.combineLatest(mouseUps, function (mm, mu) {\n //log.info(\"mm\",mm,\"mu\",mu)\n var stop = {x: mu.clientX, y: mu.clientY }\n return {\n start: start,\n end: stop\n }\n })\n //.delay(400)\n .takeUntil(mouseUps)\n })\n}\n*/\n\n// based on http://jsfiddle.net/mattpodwysocki/pfCqq/\nfunction drags3(mouseDowns$, mouseUps, mouseMoves) {\n var longPressDelay = arguments.length <= 3 || arguments[3] === undefined ? 800 : arguments[3];\n var deltaSqr = arguments[4];\n\n return mouseDowns$.flatMap(function (md) {\n // console.log(\"drags3 mousedown\",md)\n // calculate offsets when mouse down\n var startX = md.offsetX;\n var startY = md.offsetY;\n // Calculate delta with mousemove until mouseup\n return mouseMoves.map(function (e) {\n // console.log(\"drags3 mousemove\",mm)\n // (mm.preventDefault) ? mm.preventDefault() : mm.returnValue = false\n var delta = {\n left: e.clientX - startX,\n top: e.clientY - startY\n };\n // console.log(\"delta\",delta)\n return (0, _assign2.default)({}, e, delta);\n }).takeUntil(mouseUps);\n });\n}\n\nfunction touchDrags(touchStart$, touchEnd$, touchMove$) {\n return touchStart$.flatMap(function (ts) {\n var startX = ts.touches[0].pageX;\n var startY = ts.touches[0].pageY;\n\n return touchMove$.map(function (e) {\n var x = (e.touches[0].pageX - startX) / 5.0;\n var y = (e.touches[0].pageY - startY) / 5.0;\n\n var delta = {\n left: x,\n top: y,\n x: x,\n y: y };\n\n var output = (0, _assign2.default)({}, e, { delta: delta });\n return output;\n }).takeUntil(touchEnd$);\n });\n}\n\n// pinch, taken from https://github.com/hugobessaa/rx-react-pinch\nfunction pinches(touchstarts, touchmoves, touchEnds) {\n return touchStarts.do(_obsUtils.preventDefault).takeWhile(hasTwoTouchPoints).flatMap(function () {\n return touchMoves.pluck('scale').takeUntil(touchEnds);\n });\n}\n\nfunction interactionsFromEvents(targetEl) {\n var mouseDowns$ = fromEvent(targetEl, 'mousedown');\n var mouseUps$ = fromEvent(targetEl, 'mouseup');\n var mouseLeaves$ = fromEvent(targetEl, 'mouseleave').merge(fromCEvent(targetEl, 'mouseout'));\n var mouseMoves$ = altMouseMoves(fromEvent(targetEl, 'mousemove')).takeUntil(mouseLeaves$);\n var rightClicks$ = fromEvent(targetEl, 'contextmenu').do(_obsUtils.preventDefault); // disable the context menu / right click\n var zooms$ = fromEvent(targetEl, 'wheel');\n\n var touchStart$ = fromEvent('touchstart'); // dom.touchstart(window)\n var touchMove$ = fromEvent('touchmove'); // dom.touchmove(window)\n var touchEnd$ = fromEvent('touchend'); // dom.touchend(window)\n\n document.addEventListener(\"touchstart\", function (event) {\n return event.preventDefault();\n });\n\n return {\n mouseDowns$: mouseDowns$,\n mouseUps$: mouseUps$,\n mouseMoves$: mouseMoves$,\n rightClicks$: rightClicks$,\n zooms$: zooms$,\n touchStart$: touchStart$,\n touchMoves$: touchMoves$,\n touchEnd$: touchEnd$ };\n}\n\n/* generate a hash of basic pointer/ mouse event observables*/\nfunction interactionsFromCEvents(targetEl) {\n var rTarget = arguments.length <= 1 || arguments[1] === undefined ? 'canvas' : arguments[1];\n\n /* function fromCEvent(targetEl, eventName){\n return targetEl.get(rTarget, eventName)\n }*/\n function fromCEvent(targetEl, eventName) {\n return targetEl.select(rTarget).events(eventName);\n }\n\n var mouseDowns$ = fromCEvent(targetEl, 'mousedown');\n var mouseUps$ = fromCEvent(targetEl, 'mouseup');\n var mouseLeaves$ = fromCEvent(targetEl, 'mouseleave').merge(fromCEvent(targetEl, 'mouseout'));\n var mouseMoves$ = altMouseMoves(fromCEvent(targetEl, 'mousemove')).takeUntil(mouseLeaves$);\n var rightClicks$ = fromCEvent(targetEl, 'contextmenu').do(_obsUtils.preventDefault); // disable the context menu / right click\n var zooms$ = fromCEvent(targetEl, 'wheel');\n\n var touchStart$ = fromCEvent(targetEl, 'touchstart'); // dom.touchstart(window)\n var touchMoves$ = fromCEvent(targetEl, 'touchmove'); // dom.touchmove(window)\n var touchEnd$ = fromCEvent(targetEl, 'touchend'); // dom.touchend(window)\n\n return {\n mouseDowns$: mouseDowns$,\n mouseUps$: mouseUps$,\n mouseMoves$: mouseMoves$,\n rightClicks$: rightClicks$,\n zooms$: zooms$,\n touchStart$: touchStart$,\n touchMoves$: touchMoves$,\n touchEnd$: touchEnd$ };\n}\n\nfunction pointerInteractions(baseInteractions) {\n var multiClickDelay = 250;\n var longPressDelay = 250;\n\n var minDelta = 25; // max 50 pixels delta\n var deltaSqr = minDelta * minDelta;\n\n var mouseDowns$ = baseInteractions.mouseDowns$;\n var mouseUps$ = baseInteractions.mouseUps$;\n var rightclicks$ = baseInteractions.rightclicks$;\n var mouseMoves$ = baseInteractions.mouseMoves$;\n var touchStart$ = baseInteractions.touchStart$;\n var touchMoves$ = baseInteractions.touchMoves$;\n var touchEnd$ = baseInteractions.touchEnd$;\n var zooms$ = baseInteractions.zooms$;\n\n // mouseMoves$.forEach(e=>console.log(\"mousemove\",e))\n\n // /// now setup the more complex interactions\n\n var taps$ = taps(merge(mouseDowns$, touchStart$), // mouse & touch interactions starts\n merge(mouseUps$, touchEnd$), // mouse & touch interactions ends\n mouseMoves$, longPressDelay, deltaSqr).share();\n\n var shortTaps$ = taps$.filter(function (e) {\n return e.interval <= longPressDelay;\n }).map(function (e) {\n return e.value;\n }).filter(function (event) {\n return 'button' in event && event.button === 0;\n }) // FIXME : bad filter !\n .buffer(function () {\n return taps$.debounce(multiClickDelay);\n }).map(function (list) {\n return { list: list, nb: list.length };\n }).share();\n\n // normalize zooms (should this be elsewhere ?)\n zooms$ = zooms$.map(_utils.normalizeWheel);\n\n // we get our custom right clicks\n var rightClicks2 = taps$.filter(function (event) {\n return 'button' in event && event.button === 2;\n });\n var holds$ = holds(mouseDowns$, mouseUps$, mouseMoves$, longPressDelay, deltaSqr);\n\n var shortSingleTaps$ = shortTaps$.filter(function (x) {\n return x.nb === 1;\n }).flatMap(function (e) {\n return e.list;\n });\n var shortDoubleTaps$ = shortTaps$.filter(function (x) {\n return x.nb === 2;\n }).flatMap(function (e) {\n return e.list;\n }).take(1).repeat();\n\n // static , long held taps, for context menus etc\n // longTaps: either HELD leftmouse/pointer or HELD right click //FIXME : needs to be \"UNTIL\" mouseUp\n // and not fire before mouseUp\n var longTaps$ = taps$.filter(function (e) {\n return e.interval > longPressDelay;\n }).map(function (e) {\n return e.value;\n }); // holds$.take(1).repeat()//.timeout(longPressDelay, empty())\n // .tap(e=>console.log(\"taps with LONG timeInterval\",e))\n\n // drag move interactions (continuously firing)\n var dragMoves$ = merge(drags3(mouseDowns$, mouseUps$, mouseMoves$, longPressDelay, deltaSqr), touchDrags(touchStart$, touchEnd$, touchMoves$).throttle(40).tap(function (e) {\n return console.log('foo');\n })).takeUntil(longTaps$).repeat(); // no drag moves if there is a context action already taking place\n\n return {\n taps: taps$.map(function (e) {\n return e.value;\n }),\n shortSingleTaps$: shortSingleTaps$,\n shortDoubleTaps$: shortDoubleTaps$,\n longTaps$: longTaps$,\n dragMoves$: dragMoves$,\n zooms$: zooms$ };\n}\n\n// /////\nfunction preventScroll(targetEl) {\n fromEvent(targetEl, 'mousewheel').forEach(_obsUtils.preventDefault);\n fromEvent(targetEl, 'DOMMouseScroll').forEach(_obsUtils.preventDefault);\n fromEvent(targetEl, 'wheel').forEach(_obsUtils.preventDefault);\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/interactions/pointers.js\n ** module id = 74\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/interactions/pointers.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.windowResizes = windowResizes;\nexports.elementResizes = elementResizes;\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar Observable = _rx2.default.Observable;\nvar fromEvent = Observable.fromEvent;\n__webpack_require__(279);\n\n// window resize event stream, throttled by throttle amount (250ms default)\nfunction windowResizes() {\n var throttle = arguments.length <= 0 || arguments[0] === undefined ? 250 : arguments[0];\n\n // only get the fields we need\n function extractSize(x) {\n x = x.target;\n var bRect = { left: 0, top: 0, bottom: 0, right: 0, width: 0, height: 0 };\n if (x.getBoundingClientRect) bRect = x.getBoundingClientRect();\n\n var res = { width: x.innerWidth, height: x.innerHeight, aspect: x.innerWidth / x.innerHeight, bRect: bRect };\n return res;\n }\n\n var throttledWinResize = fromEvent(window, 'resize').throttle(throttle /* ms */).map(extractSize).startWith({ width: window.innerWidth, height: window.innerHeight, aspect: window.innerWidth / window.innerHeight, bRect: undefined });\n\n return throttledWinResize;\n}\n\nfunction elementResizes(element) {\n var throttle = arguments.length <= 1 || arguments[1] === undefined ? 250 : arguments[1];\n\n function extractSize(x) {\n x = x.target;\n var bRect = { left: 0, top: 0, bottom: 0, right: 0, width: 0, height: 0 };\n if (x.getBoundingClientRect) bRect = x.getBoundingClientRect();\n\n var res = { width: x.innerWidth, height: x.innerHeight, aspect: x.innerWidth / x.innerHeight, bRect: bRect };\n return res;\n }\n\n return _rx2.default.DOM.resize(element).throttle(throttle /* ms */).map(extractSize);\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/interactions/sizing.js\n ** module id = 75\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/interactions/sizing.js?")},function(module,exports,__webpack_require__){eval('\'use strict\';\n\nObject.defineProperty(exports, "__esModule", {\n value: true\n});\nexports.extractChanges = extractChanges;\nexports.extractChangesBetweenArrays = extractChangesBetweenArrays;\nexports.changesFromObservableArrays = changesFromObservableArrays;\nexports.changesFromObservableArrays2 = changesFromObservableArrays2;\nexports.transformEquals = transformEquals;\nexports.colorsEqual = colorsEqual;\nexports.entityVisualComparer = entityVisualComparer;\n\nvar _utils = __webpack_require__(3);\n\nfunction compareHash(obj) {\n if (obj.uuid) return obj.uuid;\n // return JSON.stringify(obj)\n // return typeof(obj)+obj.name\n}\n\nvar jsondiffpatch = __webpack_require__(17).create({ objectHash: compareHash });\n\nfunction extractChanges(prev, cur) {\n var delta = jsondiffpatch.diff(prev, cur);\n // console.log("delta",delta)\n var result = { added: [], removed: [], changed: [] };\n\n if (delta && \'_t\' in delta) {\n (function () {\n var removed = []; // delta["_0"][0]//delta[0][0]\n var added = []; // delta[0][0]//delta[0][1]\n\n Object.keys(delta).map(function (key) {\n // console.log("AAA",key)\n // "_t": "a", Array delta (member names indicate array indices)\n\n if (key[0] === \'_\') {\n if (key !== \'_a\' && key !== \'_t\') {\n removed.push(delta[key][0]);\n }\n } else {\n added.push(delta[key][0]);\n }\n });\n\n result.added = (0, _utils.toArray)(added).filter(function (i) {\n return i !== undefined;\n });\n result.removed = (0, _utils.toArray)(removed).filter(function (i) {\n return i !== undefined;\n });\n\n // console.log("added",result.added)\n // console.log("removed",result.removed)\n })();\n } else if (prev === undefined) {\n // not handled right in the above case for some reason ??\n result.added = cur;\n }\n\n return result;\n}\n\nvar instance = __webpack_require__(17).create({\n objectHash: function objectHash(obj, index) {\n if (typeof obj._id !== \'undefined\') {\n return obj._id;\n }\n if (typeof obj.id !== \'undefined\') {\n return obj.id;\n }\n if (typeof obj.name !== \'undefined\') {\n return obj.name;\n }\n return \'$$index:\' + index;\n }\n});\n// to ignore functions\ninstance.processor.pipes.diff.before(\'trivial\', function ignoreFunctionDiffFilter(context) {\n if (typeof context.left === \'function\' || typeof context.right === \'function\') {\n context.setResult(undefined);\n context.exit();\n }\n});\n\nfunction extractChangesBetweenArrays(prev, cur) {\n var delta = instance.diff(prev, cur);\n // console.log("delta",delta)\n // console.log("diff",delta)//JSON.stringify(delta, null, 2))\n\n var result = { added: [], removed: [], changed: [], upserted: [] };\n\n if (delta && \'_t\' in delta) {\n (function () {\n var removed = []; // delta["_0"][0]//delta[0][0]\n var added = []; // delta[0][0]//delta[0][1]\n var upserted = [];\n\n if (delta[\'_t\'] === \'a\') {\n // array diff\n // "_t": "a", Array delta (member names indicate array indices)\n Object.keys(delta).map(function (key) {\n if (key !== \'_t\') {\n if (key.length > 0 && key.indexOf(\'_\') > -1) {\n var realKey = parseInt(key.replace(\'_\', \'\'), 10);\n // console.log("removed",delta, realKey)//,key,delta)\n removed.push(prev[realKey]);\n } else {\n // added or changed\n // console.log("added or changed",delta, key)\n var _realKey = parseInt(key, 10);\n upserted.push(cur[_realKey]);\n }\n }\n });\n }\n result.added = (0, _utils.toArray)(added).filter(function (i) {\n return i !== undefined;\n });\n result.removed = (0, _utils.toArray)(removed).filter(function (i) {\n return i !== undefined;\n });\n result.upserted = (0, _utils.toArray)(upserted).filter(function (i) {\n return i !== undefined;\n });\n // console.log("added",result.added)\n // console.log("removed",result.removed)\n })();\n } else if (prev === undefined) {\n // not handled right in the above case for some reason ??\n result.upserted = cur;\n }\n\n return result;\n}\n\nfunction changesFromObservableArrays(data$) {\n return data$.scan(function (acc, cur) {\n return { cur: cur, prev: acc.cur };\n }, { prev: undefined, cur: undefined }).map(function (typeData) {\n var cur = typeData.cur;\n var prev = typeData.prev;\n\n var changes = extractChangesBetweenArrays(prev, cur);\n return changes;\n }).share();\n}\n\nfunction changesFromObservableArrays2(data$) {\n return data$.scan(function (acc, x) {\n var cur = x;\n var prev = acc.cur;\n\n cur = Object.keys(cur).map(function (key) {\n return cur[key];\n });\n return { cur: cur, prev: prev };\n }, { prev: undefined, cur: undefined }).map(function (typeData) {\n var cur = typeData.cur;\n var prev = typeData.prev;\n // console.log("diffing",cur,prev)\n\n var changes = extractChanges(prev, cur);\n return changes;\n }).share();\n}\n\nfunction transformEquals(a, b) {\n if (!a || !b) return true;\n for (var j = 0; j < a.length; j++) {\n if (a[j] !== b[j]) {\n return false;\n }\n }\n return true;\n}\n\nfunction colorsEqual(a, b) {\n if (!a || !b) return true;\n return a === b;\n}\n\nfunction entityVisualComparer(prev, cur) {\n // console.log("prev",prev,"cur",cur)\n\n if (!cur) {\n return false;\n }\n\n // compare lengths - can save a lot of time\n if (cur.length !== prev.length) {\n return false;\n }\n\n var sortedCur = cur.sort();\n var sortedPrev = prev.sort();\n for (var i = 0; i < cur.length; i++) {\n if (sortedCur[i].typeUid !== sortedPrev[i].typeUid) {\n return false;\n }\n\n if (sortedCur[i].id !== sortedPrev[i].id) {\n return false;\n }\n\n var curVal = sortedCur[i];\n var preVal = sortedPrev[i];\n\n /*\n sortedCur[i].color === sortedPrev[i].color\n )*/\n\n var posEq = transformEquals(curVal.pos, preVal.pos);\n var rotEq = transformEquals(curVal.rot, preVal.rot);\n var scaEq = transformEquals(curVal.sca, preVal.sca);\n var colEq = colorsEqual(curVal.color, preVal.color);\n var allEqual = posEq && rotEq && scaEq && colEq;\n if (!allEqual) return false;\n }\n\n return true;\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/utils/diffPatchUtils.js\n ** module id = 76\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/utils/diffPatchUtils.js?')},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _loglevel = __webpack_require__(274);\n\nvar _loglevel2 = _interopRequireDefault(_loglevel);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n// polygill for array.includes\nif (![].includes) {\n Array.prototype.includes = function (searchElement /*, fromIndex*/) {\n 'use strict';\n\n var O = Object(this);\n var len = parseInt(O.length) || 0;\n if (len === 0) {\n return false;\n }\n var n = parseInt(arguments[1]) || 0;\n var k;\n if (n >= 0) {\n k = n;\n } else {\n k = len + n;\n if (k < 0) {\n k = 0;\n }\n }\n var currentElement;\n while (k < len) {\n currentElement = O[k];\n if (searchElement === currentElement || searchElement !== searchElement && currentElement !== currentElement) {\n return true;\n }\n k++;\n }\n return false;\n };\n}\n\n// ////////////\nvar logMaker = function logMaker() {\n var prefix = arguments.length <= 0 || arguments[0] === undefined ? '' : arguments[0];\n var strLevel = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1];\n var timeStamp = arguments.length <= 2 || arguments[2] === undefined ? false : arguments[2];\n\n var log = {};\n var loglevel = 'warn';\n log.setLevel = function (level) {\n loglevel = level;\n };\n\n log.trace = function () {\n var context = prefix;\n if (strLevel) context += 'TRACE:';\n if (timeStamp) {\n var tStamp = new Date().toTimeString().slice(0, 8);\n context += tStamp;\n }\n if (!['trace'].includes(loglevel)) return new Function();\n return Function.prototype.bind.call(console.trace, console, context);\n }();\n log.debug = function () {\n var context = prefix;\n if (strLevel) context += 'DEBUG:';\n if (timeStamp) {\n var tStamp = new Date().toTimeString().slice(0, 8);\n context += tStamp;\n }\n if (!['trace', 'debug'].includes(loglevel)) return new Function();\n return Function.prototype.bind.call(console.debug, console, context);\n }();\n\n log.info = function () {\n var context = prefix;\n if (strLevel) context += 'INFO:';\n if (timeStamp) {\n var tStamp = new Date().toTimeString().slice(0, 8);\n context += tStamp;\n }\n if (!['trace', 'debug', 'info'].includes(loglevel)) new Function();\n return Function.prototype.bind.call(console.info, console, context);\n }();\n\n log.warn = function () {\n var context = prefix;\n if (strLevel) context += 'WARN:';\n if (timeStamp) {\n var tStamp = new Date().toTimeString().slice(0, 8);\n context += tStamp;\n }\n if (!['trace', 'debug', 'info', 'warn'].includes(loglevel)) new Function();\n return Function.prototype.bind.call(console.warn, console, context);\n }();\n log.error = function () {\n var context = prefix;\n if (strLevel) context += 'ERROR:';\n if (timeStamp) {\n var tStamp = new Date().toTimeString().slice(0, 8);\n context += tStamp;\n }\n if (!['trace', 'debug', 'info', 'warn', 'error'].includes(loglevel)) new Function();\n return Function.prototype.bind.call(console.error, console, context);\n }();\n\n return log;\n};\n\n// import log from 'loglevel'\n\n/*function makeLog(prefix=\"\"){\n var originalFactory = _log.methodFactory\n _log.methodFactory = function (methodName, logLevel) {\n var rawMethod = originalFactory(methodName, logLevel)\n let tStamp = new Date().toTimeString().slice(0, 8)\n //tStamp = tStamp.getHours() +\":\"+tStamp.getMinutes()+\":\"+tStamp.getSeconds()+\" \"+tStamp.getMilliseconds()\n return function (message) {\n rawMethod(prefix+ tStamp +\" \"+ message)\n }\n }\n return _log\n}*/\n\n/*var originalFactory = log.methodFactory\nlog.methodFactory = function (methodName, logLevel) {\n var rawMethod = originalFactory(methodName, logLevel)\n\n return function (message) {\n rawMethod(\"Newsflash: \" + message)\n }\n}\nlog.setLevel(\"warn\") // Be sure to call setLevel method in order to apply plugin */\n\n/* log.setLevel(\"info\")\n let foo = {sdf:\"dsf\",aa:45}\n log.error(\"too easy\")\n log.error(\"..or is it\",\"blal\",foo)\n log.info(\"..or is it\",\"blal\",foo)\n\n let msg =\" sdfqsdq\"\n log.trace(msg)\n log.debug(msg)\n log.info(msg)\n log.warn(msg)\n log.error(msg)\n\n log.info(\"assetManager\",AssetManager)\n\n log.info(\"This is a test...\");*/\n\n// for now return loglevel\n\nvar logMaker2 = function logMaker2() {\n var prefix = arguments.length <= 0 || arguments[0] === undefined ? '' : arguments[0];\n\n return _loglevel2.default;\n};\n// import logger from './utils/log'\n// let log = logger(\"Jam-Root\")\n// log.setLevel(\"warn\")\nexports.default = logMaker2;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/utils/log.js\n ** module id = 77\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/utils/log.js?")},function(module,exports,__webpack_require__){eval('"use strict";\n\nvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\nObject.defineProperty(exports, "__esModule", {\n value: true\n});\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nvar _BaseHelper2 = __webpack_require__(13);\n\nvar _BaseHelper3 = _interopRequireDefault(_BaseHelper2);\n\nvar _GizmoMaterial = __webpack_require__(12);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn\'t been initialised - super() hasn\'t been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\n/*\n//TODO: make this into a mesh / geometry subclass\n*/\n\nvar CircleHelper = (function (_BaseHelper) {\n _inherits(CircleHelper, _BaseHelper);\n\n function CircleHelper(options) {\n _classCallCheck(this, CircleHelper);\n\n var defaultMaterial = new _GizmoMaterial.GizmoLineMaterial({\n color: "#000",\n depthTest: false,\n depthWrite: false,\n renderDepth: 1e20,\n highlightColor: "#F00"\n });\n\n var DEFAULTS = {\n radius: 0,\n direction: new _three2.default.Vector3(),\n\n color: "#000",\n highlightColor: "#F00",\n\n material: defaultMaterial\n };\n\n options = Object.assign({}, DEFAULTS, options);\n\n var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(CircleHelper).call(this, options));\n\n Object.assign(_this, options);\n\n _this.setRadius(_this.radius);\n return _this;\n }\n\n _createClass(CircleHelper, [{\n key: "setRadius",\n value: function setRadius(radius) {\n var circleRadius = this.radius = radius;\n var circleShape = new _three2.default.Shape();\n circleShape.moveTo(0, 0);\n circleShape.absarc(0, 0, circleRadius, 0, Math.PI * 2, false);\n circleShape.moveTo(0, 0);\n var points = circleShape.createSpacedPointsGeometry(100);\n\n if (this.rCircle) this.remove(this.rCircle);\n\n this.rCircle = new _three2.default.Line(points, this.material);\n this.add(this.rCircle);\n }\n }]);\n\n return CircleHelper;\n})(_BaseHelper3.default);\n\nexports.default = CircleHelper;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/glView-helpers/lib/CircleHelper.js\n ** module id = 78\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/glView-helpers/lib/CircleHelper.js?'); },function(module,exports,__webpack_require__){eval('"use strict";\n\nObject.defineProperty(exports, "__esModule", {\n value: true\n});\nexports.getTargetBoundsData = getTargetBoundsData;\nexports.computeCenterDiaNormalFromThreePoints = computeCenterDiaNormalFromThreePoints;\nexports.getEntryExitThickness = getEntryExitThickness;\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction getTargetBoundsData(targetObject, point) {\n console.log("computing bounds");\n /* -1 /+1 directions on all 3 axis to determine for example WHERE an annotation\n should be placed (left/right, front/back, top/bottom)\n */\n var putSide = [0, 0, 0];\n if (!targetObject) return putSide;\n var bbox = targetObject.boundingBox;\n\n var objectCenter = new _three2.default.Vector3().addVectors(targetObject.boundingBox.min, targetObject.boundingBox.max).divideScalar(2);\n\n //let realCenter = point.clone().sub( objectCenter )\n //console.log("objectCenter",objectCenter,"point", point,foo.normalize())\n\n var axes = ["x", "y", "z"];\n axes.forEach(function (axis, index) {\n var axisOffset = point[axis] - objectCenter[axis];\n axisOffset = Math.round(axisOffset * 100) / 100;\n if (axisOffset > 0) {\n putSide[index] = 1;\n } else if (axisOffset < 0) {\n putSide[index] = -1;\n }\n });\n\n console.log("putSide", putSide);\n putSide = new _three2.default.Vector3().fromArray(putSide);\n return putSide;\n}\n\n//compute center , dia/radius from three 3d points\nfunction computeCenterDiaNormalFromThreePoints(pointA, pointB, pointC) {\n\n var plane = new _three2.default.Plane().setFromCoplanarPoints(pointA, pointB, pointC);\n var center = new _three2.default.Vector3();\n\n //see http://en.wikipedia.org/wiki/Circumscribed_circle\n // triangle "edges"\n var t = pointA.clone().sub(pointB);\n var u = pointB.clone().sub(pointC);\n var v = pointC.clone().sub(pointA);\n var m = pointA.clone().sub(pointC);\n var x = pointB.clone().sub(pointA);\n var z = pointC.clone().sub(pointB);\n\n var foo = t.clone().cross(u).length();\n var bar = 2 * foo;\n var baz = foo * foo;\n var buu = 2 * baz;\n\n var radius = t.length() * u.length() * v.length() / bar;\n\n var alpha = u.lengthSq() * t.clone().dot(m) / buu;\n var beta = m.lengthSq() * x.clone().dot(u) / buu;\n var gamma = t.lengthSq() * v.clone().dot(z) / buu;\n\n center = pointA.clone().multiplyScalar(alpha).add(pointB.clone().multiplyScalar(beta)).add(pointC.clone().multiplyScalar(gamma));\n\n var diameter = radius * 2;\n var normal = plane.normal;\n\n return { center: center, diameter: diameter, normal: normal };\n}\n\nfunction getEntryExitThickness(entryInteresect) {\n var normalType = arguments.length <= 1 || arguments[1] === undefined ? "face" : arguments[1];\n\n var normal = entryInteresect.face.normal.clone();\n switch (normalType) {\n case "face":\n break;\n case "x":\n normal = new _three2.default.Vector3(1, 0, 0);\n break;\n case "y":\n normal = new _three2.default.Vector3(0, 1, 0);\n break;\n case "z":\n normal = new _three2.default.Vector3(0, 0, 1);\n break;\n }\n\n var object = entryInteresect.object;\n if (!object) return undefined;\n\n var entryPoint = entryInteresect.point.clone();\n var flippedNormal = normal.clone().negate();\n var offsetPoint = entryPoint.clone().add(flippedNormal.clone().multiplyScalar(10000));\n\n //get escape entryPoint\n var raycaster = new _three2.default.Raycaster(offsetPoint, normal.clone().normalize());\n var intersects = raycaster.intersectObjects([object], true);\n\n var exitPoint = null;\n var minDist = Infinity;\n\n intersects.map(function (entry) {\n var curPt = entry.point;\n var curLn = curPt.clone().sub(entryPoint).length();\n\n if (curLn < minDist) {\n exitPoint = curPt;\n minDist = curLn;\n }\n });\n\n //FIXME: todo or not ??\n object.worldToLocal(entryPoint);\n object.worldToLocal(exitPoint);\n\n //compute actual thickness\n var endToStart = exitPoint.clone().sub(entryPoint);\n var thickness = endToStart.length();\n\n return { object: object, entryPoint: entryPoint, exitPoint: exitPoint, thickness: thickness };\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/glView-helpers/lib/annotations/utils.js\n ** module id = 79\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/glView-helpers/lib/annotations/utils.js?')},function(module,exports,__webpack_require__){eval('\'use strict\';\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nvar _BaseHelper2 = __webpack_require__(13);\n\nvar _BaseHelper3 = _interopRequireDefault(_BaseHelper2);\n\nvar _CrossHelper = __webpack_require__(16);\n\nvar _CrossHelper2 = _interopRequireDefault(_CrossHelper);\n\nvar _ArrowHelper = __webpack_require__(251);\n\nvar _ArrowHelper2 = _interopRequireDefault(_ArrowHelper);\n\nvar _LabelHelper = __webpack_require__(39);\n\nvar _GizmoMaterial = __webpack_require__(12);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn\'t been initialised - super() hasn\'t been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\n/*\n Visual helper representing leader lines\n*/\n\nvar LeaderLineHelper = (function (_BaseHelper) {\n _inherits(LeaderLineHelper, _BaseHelper);\n\n function LeaderLineHelper(options) {\n _classCallCheck(this, LeaderLineHelper);\n\n var DEFAULTS = {\n distance: 30,\n color: "#000",\n text: "",\n fontFace: "Jura"\n };\n\n options = Object.assign({}, DEFAULTS, options);\n\n var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(LeaderLineHelper).call(this, options));\n\n Object.assign(_this, options);\n\n _this.arrowColor = options.arrowColor !== undefined ? options.arrowColor : 0x000000;\n _this.arrowHeadSize = options.arrowHeadSize !== undefined ? options.arrowHeadSize : 2.0;\n _this.arrowHeadWidth = options.arrowHeadWidth !== undefined ? options.arrowHeadWidth : 0.8;\n _this.arrowHeadType = options.arrowHeadType !== undefined ? options.arrowHeadType : undefined;\n\n _this.linesColor = options.linesColor !== undefined ? options.linesColor : 0x000000;\n _this.lineWidth = options.lineWidth !== undefined ? options.lineWidth : 1;\n\n _this.fontSize = options.fontSize !== undefined ? options.fontSize : 8;\n _this.textColor = options.textColor !== undefined ? options.textColor : "#000";\n _this.textBgColor = options.textBgColor !== undefined ? options.textBgColor : "#fff";\n _this.labelType = options.labelType !== undefined ? options.labelType : "frontFacing";\n\n _this.angle = options.angle !== undefined ? options.angle : 45;\n _this.angleLength = options.angleLength !== undefined ? options.angleLength : 5;\n _this.horizLength = options.horizLength !== undefined ? options.horizLength : 5;\n _this.radius = options.radius !== undefined ? options.radius : 0;\n\n _this.highlightColor = options.highlightColor !== undefined ? options.highlightColor : "#F00";\n\n var angle = _this.angle;\n var radius = _this.radius;\n var angleLength = _this.angleLength;\n var horizLength = _this.horizLength;\n\n var textBorder = options.textBorder || null;\n var material = new _GizmoMaterial.GizmoLineMaterial({\n color: _this.linesColor,\n lineWidth: _this.lineWidth,\n linecap: "miter",\n highlightColor: _this.highlightColor\n });\n //depthTest:false,depthWrite:false})\n\n var rAngle = angle;\n rAngle = rAngle * Math.PI / 180;\n var y = Math.cos(rAngle) * angleLength;\n var x = Math.sin(rAngle) * angleLength;\n var angleEndPoint = new _three2.default.Vector3(x, y, 0);\n angleEndPoint = angleEndPoint.add(angleEndPoint.clone().normalize().multiplyScalar(radius));\n var angleArrowDir = angleEndPoint.clone().normalize();\n angleEndPoint.x = -angleEndPoint.x;\n angleEndPoint.y = -angleEndPoint.y;\n\n _this.angleArrow = new _ArrowHelper2.default(angleArrowDir, angleEndPoint, angleLength, _this.color, _this.arrowHeadSize, _this.arrowHeadWidth, _this.arrowHeadType);\n _this.angleArrow.scale.z = 0.6;\n\n var horizEndPoint = angleEndPoint.clone();\n horizEndPoint.x -= horizLength;\n\n var horizGeom = new _three2.default.Geometry();\n horizGeom.vertices.push(angleEndPoint);\n horizGeom.vertices.push(horizEndPoint);\n\n _this.horizLine = new _three2.default.Line(horizGeom, material);\n\n //draw dimention / text\n switch (_this.labelType) {\n case "flat":\n _this.label = new _LabelHelper.LabelHelperPlane({\n text: _this.text,\n fontSize: _this.fontSize,\n fontFace: _this.fontFace,\n background: _this.textBgColor != null,\n color: _this.textColor,\n bgColor: _this.textBgColor,\n highlightColor: _this.highlightColor\n });\n break;\n case "frontFacing":\n _this.label = new _LabelHelper.LabelHelper3d({\n text: _this.text,\n fontSize: _this.fontSize,\n fontFace: _this.fontFace,\n color: _this.textColor,\n bgColor: _this.textBgColor });\n break;\n }\n _this.label.rotation.z = Math.PI;\n var labelSize = _this.label.textWidth / 2 + 1; //label size, plus some extra\n var labelPosition = horizEndPoint.clone().sub(new _three2.default.Vector3(labelSize, 0, 0));\n _this.label.position.add(labelPosition);\n\n /*\n let precisionLabelPos = new THREE.Vector3().copy( labelPosition )\n precisionLabelPos.x += this.label.width\n \n //TODO: this is both needed in the data structures & in the visuals (here)\n this.precision = 0.12\n this.precisionText = "+"+this.precision+"\\n"+"-"+this.precision\n this.precisionLabel = new LabelHelperPlane({text:this.precisionText,fontSize:this.fontSize/1.5,background:(this.textBgColor!=null),color:this.textColor,bgColor:this.textBgColor})\n this.add( this.precisionLabel )\n \n this.precisionLabel.rotation.z = Math.PI\n this.precisionLabel.position.copy( precisionLabelPos )*/\n\n /*let crossHelper = new CrossHelper({\n size:3\n })\n this.add( crossHelper )*/\n\n if (textBorder) {\n if (textBorder === "circle") {\n var textBorderGeom = new _three2.default.CircleGeometry(labelSize, 32);\n textBorderGeom.vertices.shift();\n var textBorderOutline = new _three2.default.Line(textBorderGeom, material);\n textBorderOutline.position.add(labelPosition);\n _this.add(textBorderOutline);\n }\n if (textBorder === "rectangle") {\n var rectWidth = _this.label.textHeight;\n var rectLength = _this.label.textWidth;\n\n //console.log("textWidth",this.label.textWidth, this.label.width,"textHeight",this.label.textHeight, this.label.height)\n\n var rectShape = new _three2.default.Shape();\n rectShape.moveTo(0, 0);\n rectShape.lineTo(0, rectWidth);\n rectShape.lineTo(rectLength, rectWidth);\n rectShape.lineTo(rectLength, 0);\n rectShape.lineTo(0, 0);\n rectShape.lineTo(0, 0);\n\n var textBorderGeom = new _three2.default.ShapeGeometry(rectShape);\n var textBorderOutline = new _three2.default.Line(textBorderGeom, material);\n textBorderOutline.position.add(labelPosition);\n textBorderOutline.position.add(new _three2.default.Vector3(-rectLength / 2, -rectWidth / 2, 0));\n _this.add(textBorderOutline);\n }\n }\n\n _this.add(_this.angleArrow);\n _this.add(_this.horizLine);\n _this.add(_this.label);\n\n //material settings\n _this.arrowLineMaterial = new _GizmoMaterial.GizmoLineMaterial({\n color: _this.arrowColor,\n lineWidth: _this.lineWidth,\n linecap: "miter",\n highlightColor: _this.highlightColor });\n _this.arrowConeMaterial = new _GizmoMaterial.GizmoMaterial({\n color: _this.arrowColor,\n highlightColor: _this.highlightColor\n });\n\n _this.angleArrow.line.material = _this.arrowLineMaterial;\n _this.angleArrow.head.material = _this.arrowConeMaterial;\n _this.angleArrow.line.material.depthTest = _this.angleArrow.line.material.depthTest = true;\n _this.angleArrow.line.material.depthWrite = _this.angleArrow.line.material.depthWrite = true;\n\n //this.angleArrow.renderDepth = 1e20\n _this.horizLine.renderDepth = 1e20;\n return _this;\n }\n\n return LeaderLineHelper;\n})(_BaseHelper3.default);\n\nmodule.exports = LeaderLineHelper;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/glView-helpers/lib/dimensions/LeaderLineHelper.js\n ** module id = 80\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/glView-helpers/lib/dimensions/LeaderLineHelper.js?')},function(module,exports,__webpack_require__){eval('"use strict";\n\nvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\nObject.defineProperty(exports, "__esModule", {\n value: true\n});\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn\'t been initialised - super() hasn\'t been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\n/*TODO:\n - refactor\n - use label helper\n*/\n\nvar LabeledGrid = (function (_THREE$Object3D) {\n _inherits(LabeledGrid, _THREE$Object3D);\n\n function LabeledGrid() {\n var width = arguments.length <= 0 || arguments[0] === undefined ? 200 : arguments[0];\n var length = arguments.length <= 1 || arguments[1] === undefined ? 200 : arguments[1];\n var step = arguments.length <= 2 || arguments[2] === undefined ? 100 : arguments[2];\n var upVector = arguments.length <= 3 || arguments[3] === undefined ? [0, 1, 0] : arguments[3];\n var color = arguments.length <= 4 || arguments[4] === undefined ? 0x00baff : arguments[4];\n var opacity = arguments.length <= 5 || arguments[5] === undefined ? 0.2 : arguments[5];\n var text = arguments.length <= 6 || arguments[6] === undefined ? true : arguments[6];\n var textColor = arguments.length <= 7 || arguments[7] === undefined ? "#000000" : arguments[7];\n var textLocation = arguments.length <= 8 || arguments[8] === undefined ? "center" : arguments[8];\n\n _classCallCheck(this, LabeledGrid);\n\n var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(LabeledGrid).call(this));\n\n _this.width = width;\n _this.length = length;\n _this.step = step;\n _this.color = color;\n _this.opacity = opacity;\n _this.text = text;\n _this.textColor = textColor;\n _this.textLocation = textLocation;\n _this.upVector = new _three2.default.Vector3().fromArray(upVector);\n\n _this.name = "grid";\n\n //TODO: clean this up\n _this.marginSize = 10;\n _this.stepSubDivisions = 10;\n\n _this._drawGrid();\n\n //default grid orientation is z up, rotate if not the case\n var upVector = _this.upVector;\n _this.up = upVector;\n _this.lookAt(upVector);\n return _this;\n }\n\n _createClass(LabeledGrid, [{\n key: "_drawGrid",\n value: function _drawGrid() {\n var gridGeometry, gridMaterial, mainGridZ, planeFragmentShader, planeGeometry, planeMaterial, subGridGeometry, subGridMaterial, subGridZ;\n\n //offset to avoid z fighting\n mainGridZ = -0.05;\n gridGeometry = new _three2.default.Geometry();\n gridMaterial = new _three2.default.LineBasicMaterial({\n color: new _three2.default.Color().setHex(this.color),\n opacity: this.opacity,\n linewidth: 2,\n transparent: true\n });\n\n subGridZ = -0.05;\n subGridGeometry = new _three2.default.Geometry();\n subGridMaterial = new _three2.default.LineBasicMaterial({\n color: new _three2.default.Color().setHex(this.color),\n opacity: this.opacity / 2,\n transparent: true\n });\n\n var step = this.step;\n var stepSubDivisions = this.stepSubDivisions;\n var width = this.width;\n var length = this.length;\n\n var centerBased = true;\n\n if (centerBased) {\n for (var i = 0; i <= width / 2; i += step / stepSubDivisions) {\n subGridGeometry.vertices.push(new _three2.default.Vector3(-length / 2, i, subGridZ));\n subGridGeometry.vertices.push(new _three2.default.Vector3(length / 2, i, subGridZ));\n\n subGridGeometry.vertices.push(new _three2.default.Vector3(-length / 2, -i, subGridZ));\n subGridGeometry.vertices.push(new _three2.default.Vector3(length / 2, -i, subGridZ));\n\n if (i % step == 0) {\n gridGeometry.vertices.push(new _three2.default.Vector3(-length / 2, i, mainGridZ));\n gridGeometry.vertices.push(new _three2.default.Vector3(length / 2, i, mainGridZ));\n\n gridGeometry.vertices.push(new _three2.default.Vector3(-length / 2, -i, mainGridZ));\n gridGeometry.vertices.push(new _three2.default.Vector3(length / 2, -i, mainGridZ));\n }\n }\n for (var i = 0; i <= length / 2; i += step / stepSubDivisions) {\n subGridGeometry.vertices.push(new _three2.default.Vector3(i, -width / 2, subGridZ));\n subGridGeometry.vertices.push(new _three2.default.Vector3(i, width / 2, subGridZ));\n\n subGridGeometry.vertices.push(new _three2.default.Vector3(-i, -width / 2, subGridZ));\n subGridGeometry.vertices.push(new _three2.default.Vector3(-i, width / 2, subGridZ));\n\n if (i % step == 0) {\n gridGeometry.vertices.push(new _three2.default.Vector3(i, -width / 2, mainGridZ));\n gridGeometry.vertices.push(new _three2.default.Vector3(i, width / 2, mainGridZ));\n\n gridGeometry.vertices.push(new _three2.default.Vector3(-i, -width / 2, mainGridZ));\n gridGeometry.vertices.push(new _three2.default.Vector3(-i, width / 2, mainGridZ));\n }\n }\n } else {\n for (var i = -width / 2; i <= width / 2; i += step / stepSubDivisions) {\n subGridGeometry.vertices.push(new _three2.default.Vector3(-length / 2, i, subGridZ));\n subGridGeometry.vertices.push(new _three2.default.Vector3(length / 2, i, subGridZ));\n\n if (i % step == 0) {\n gridGeometry.vertices.push(new _three2.default.Vector3(-length / 2, i, mainGridZ));\n gridGeometry.vertices.push(new _three2.default.Vector3(length / 2, i, mainGridZ));\n }\n }\n for (var i = -length / 2; i <= length / 2; i += step / stepSubDivisions) {\n subGridGeometry.vertices.push(new _three2.default.Vector3(i, -width / 2, subGridZ));\n subGridGeometry.vertices.push(new _three2.default.Vector3(i, width / 2, subGridZ));\n\n if (i % step == 0) {\n gridGeometry.vertices.push(new _three2.default.Vector3(i, -width / 2, mainGridZ));\n gridGeometry.vertices.push(new _three2.default.Vector3(i, width / 2, mainGridZ));\n }\n }\n }\n\n this.mainGrid = new _three2.default.Line(gridGeometry, gridMaterial, _three2.default.LinePieces);\n //create sub grid geometry object\n this.subGrid = new _three2.default.Line(subGridGeometry, subGridMaterial, _three2.default.LinePieces);\n\n //create margin\n var offsetWidth = width + this.marginSize;\n var offsetLength = length + this.marginSize;\n\n var marginGeometry = new _three2.default.Geometry();\n marginGeometry.vertices.push(new _three2.default.Vector3(-length / 2, -width / 2, subGridZ));\n marginGeometry.vertices.push(new _three2.default.Vector3(length / 2, -width / 2, subGridZ));\n\n marginGeometry.vertices.push(new _three2.default.Vector3(length / 2, -width / 2, subGridZ));\n marginGeometry.vertices.push(new _three2.default.Vector3(length / 2, width / 2, subGridZ));\n\n marginGeometry.vertices.push(new _three2.default.Vector3(length / 2, width / 2, subGridZ));\n marginGeometry.vertices.push(new _three2.default.Vector3(-length / 2, width / 2, subGridZ));\n\n marginGeometry.vertices.push(new _three2.default.Vector3(-length / 2, width / 2, subGridZ));\n marginGeometry.vertices.push(new _three2.default.Vector3(-length / 2, -width / 2, subGridZ));\n\n marginGeometry.vertices.push(new _three2.default.Vector3(-offsetLength / 2, -offsetWidth / 2, subGridZ));\n marginGeometry.vertices.push(new _three2.default.Vector3(offsetLength / 2, -offsetWidth / 2, subGridZ));\n\n marginGeometry.vertices.push(new _three2.default.Vector3(offsetLength / 2, -offsetWidth / 2, subGridZ));\n marginGeometry.vertices.push(new _three2.default.Vector3(offsetLength / 2, offsetWidth / 2, subGridZ));\n\n marginGeometry.vertices.push(new _three2.default.Vector3(offsetLength / 2, offsetWidth / 2, subGridZ));\n marginGeometry.vertices.push(new _three2.default.Vector3(-offsetLength / 2, offsetWidth / 2, subGridZ));\n\n marginGeometry.vertices.push(new _three2.default.Vector3(-offsetLength / 2, offsetWidth / 2, subGridZ));\n marginGeometry.vertices.push(new _three2.default.Vector3(-offsetLength / 2, -offsetWidth / 2, subGridZ));\n\n var strongGridMaterial = new _three2.default.LineBasicMaterial({\n color: new _three2.default.Color().setHex(this.color),\n opacity: this.opacity * 2,\n linewidth: 2,\n transparent: true\n });\n this.margin = new _three2.default.Line(marginGeometry, strongGridMaterial, _three2.default.LinePieces);\n\n //add all grids, subgrids, margins etc\n this.add(this.mainGrid);\n this.add(this.subGrid);\n this.add(this.margin);\n\n this._drawNumbering();\n }\n }, {\n key: "toggle",\n value: function toggle(_toggle) {\n //apply visibility settings to all children\n this.traverse(function (child) {\n child.visible = _toggle;\n });\n }\n }, {\n key: "setOpacity",\n value: function setOpacity(opacity) {\n this.opacity = opacity;\n this.mainGrid.material.opacity = opacity;\n this.subGrid.material.opacity = opacity / 2;\n this.margin.material.opacity = opacity * 2;\n }\n }, {\n key: "setColor",\n value: function setColor(color) {\n this.color = color;\n this.mainGrid.material.color = new _three2.default.Color().setHex(this.color);\n this.subGrid.material.color = new _three2.default.Color().setHex(this.color);\n this.margin.material.color = new _three2.default.Color().setHex(this.color);\n }\n }, {\n key: "toggleText",\n value: function toggleText(toggle) {\n this.text = toggle;\n var labels = this.labels.children;\n for (var i = 0; i < this.labels.children.length; i++) {\n var label = labels[i];\n label.visible = toggle;\n }\n }\n }, {\n key: "setTextColor",\n value: function setTextColor(color) {\n this.textColor = color;\n this._drawNumbering();\n }\n }, {\n key: "setTextLocation",\n value: function setTextLocation(location) {\n this.textLocation = location;\n return this._drawNumbering();\n }\n }, {\n key: "setUp",\n value: function setUp(upVector) {\n this.upVector = upVector;\n this.up = upVector;\n this.lookAt(upVector);\n }\n }, {\n key: "resize",\n value: function resize(width, length) {\n if (width && length) {\n var width = Math.max(width, 10);\n this.width = width;\n\n var length = Math.max(length, 10);\n this.length = length;\n\n this.step = Math.max(this.step, 5);\n\n this.remove(this.mainGrid);\n this.remove(this.subGrid);\n this.remove(this.margin);\n //this.remove(this.plane);\n return this._drawGrid();\n }\n }\n }, {\n key: "_drawNumbering",\n value: function _drawNumbering() {\n var label, sizeLabel, sizeLabel2, xLabelsLeft, xLabelsRight, yLabelsBack, yLabelsFront;\n var step = this.step;\n\n this._labelStore = {};\n\n if (this.labels != null) {\n this.mainGrid.remove(this.labels);\n }\n this.labels = new _three2.default.Object3D();\n\n var width = this.width;\n var length = this.length;\n var numbering = this.numbering = "centerBased";\n\n var labelsFront = new _three2.default.Object3D();\n var labelsSideRight = new _three2.default.Object3D();\n\n if (numbering == "centerBased") {\n for (var i = 0; i <= width / 2; i += step) {\n var sizeLabel = this.drawTextOnPlane("" + i, 32);\n var sizeLabel2 = sizeLabel.clone();\n\n sizeLabel.position.set(length / 2, -i, 0.1);\n sizeLabel.rotation.z = -Math.PI / 2;\n labelsFront.add(sizeLabel);\n\n sizeLabel2.position.set(length / 2, i, 0.1);\n sizeLabel2.rotation.z = -Math.PI / 2;\n labelsFront.add(sizeLabel2);\n }\n\n for (var i = 0; i <= length / 2; i += step) {\n var sizeLabel = this.drawTextOnPlane("" + i, 32);\n var sizeLabel2 = sizeLabel.clone();\n\n sizeLabel.position.set(-i, width / 2, 0.1);\n //sizeLabel.rotation.z = -Math.PI / 2;\n labelsSideRight.add(sizeLabel);\n\n sizeLabel2.position.set(i, width / 2, 0.1);\n //sizeLabel2.rotation.z = -Math.PI / 2;\n labelsSideRight.add(sizeLabel2);\n }\n\n var labelsSideLeft = labelsSideRight.clone();\n labelsSideLeft.rotation.z = -Math.PI;\n //labelsSideLeft = labelsSideRight.clone().translateY(- width );\n\n var labelsBack = labelsFront.clone();\n labelsBack.rotation.z = -Math.PI;\n }\n\n /*if (this.textLocation === "center") {\n yLabelsRight.translateY(- length/ 2);\n xLabelsFront.translateX(- width / 2);\n } else {\n yLabelsLeft = yLabelsRight.clone().translateY( -width );\n xLabelsBack = xLabelsFront.clone().translateX( -length );\n \n this.labels.add( yLabelsLeft );\n this.labels.add( xLabelsBack) ;\n }*/\n //this.labels.add( yLabelsRight );\n this.labels.add(labelsFront);\n this.labels.add(labelsBack);\n\n this.labels.add(labelsSideRight);\n this.labels.add(labelsSideLeft);\n\n //apply visibility settings to all labels\n var textVisible = this.text;\n this.labels.traverse(function (child) {\n child.visible = textVisible;\n });\n\n this.mainGrid.add(this.labels);\n }\n }, {\n key: "drawTextOnPlane",\n value: function drawTextOnPlane(text, size) {\n var canvas, context, material, plane, texture;\n\n if (size == null) {\n size = 256;\n }\n\n if (document) {\n canvas = document.createElement(\'canvas\');\n } else {\n canvas = {};\n }\n\n var size = 128;\n canvas.width = size;\n canvas.height = size;\n context = canvas.getContext(\'2d\');\n context.font = "18px sans-serif";\n context.textAlign = \'center\';\n context.fillStyle = this.textColor;\n context.fillText(text, canvas.width / 2, canvas.height / 2);\n context.strokeStyle = this.textColor;\n context.strokeText(text, canvas.width / 2, canvas.height / 2);\n\n texture = new _three2.default.Texture(canvas);\n texture.needsUpdate = true;\n texture.generateMipmaps = true;\n texture.magFilter = _three2.default.LinearFilter;\n texture.minFilter = _three2.default.LinearFilter;\n\n material = new _three2.default.MeshBasicMaterial({\n map: texture,\n transparent: true,\n color: 0xffffff,\n alphaTest: 0.3\n });\n plane = new _three2.default.Mesh(new _three2.default.PlaneBufferGeometry(size / 8, size / 8), material);\n plane.doubleSided = true;\n plane.overdraw = true;\n\n return plane;\n }\n }]);\n\n return LabeledGrid;\n})(_three2.default.Object3D);\n\n//autoresize, disabled for now\n/*\nupdateGridSize() {\n var max, maxX, maxY, min, minX, minY, size, subchild, _getBounds, _i, _len, _ref,\n _this = this;\n minX = 99999;\n maxX = -99999;\n minY = 99999;\n maxY = -99999;\n _getBounds = function(mesh) {\n var bBox, subchild, _i, _len, _ref, _results;\n if (mesh instanceof THREE.Mesh) {\n mesh.geometry.computeBoundingBox();\n bBox = mesh.geometry.boundingBox;\n minX = Math.min(minX, bBox.min.x);\n maxX = Math.max(maxX, bBox.max.x);\n minY = Math.min(minY, bBox.min.y);\n maxY = Math.max(maxY, bBox.max.y);\n _ref = mesh.children;\n _results = [];\n for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n subchild = _ref[_i];\n _results.push(_getBounds(subchild));\n }\n return _results;\n }\n };\n if (this.rootAssembly != null) {\n _ref = this.rootAssembly.children;\n for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n subchild = _ref[_i];\n if (subchild.name !== "renderSubs" && subchild.name !== "connectors") {\n _getBounds(subchild);\n }\n }\n }\n max = Math.max(Math.max(maxX, maxY), 100);\n min = Math.min(Math.min(minX, minY), -100);\n size = (Math.max(max, Math.abs(min))) * 2;\n size = Math.ceil(size / 10) * 10;\n if (size >= 200) {\n return this.resize(size);\n }\n};\n*/\n\nexports.default = LabeledGrid;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/glView-helpers/lib/grids/LabeledGrid.js\n ** module id = 81\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/glView-helpers/lib/grids/LabeledGrid.js?')},function(module,exports,__webpack_require__){ eval('var map = {\n "./contexts/context": 25,\n "./contexts/context.js": 25,\n "./contexts/diff": 26,\n "./contexts/diff.js": 26,\n "./contexts/patch": 27,\n "./contexts/patch.js": 27,\n "./contexts/reverse": 28,\n "./contexts/reverse.js": 28,\n "./date-reviver": 41,\n "./date-reviver.js": 41,\n "./diffpatcher": 50,\n "./diffpatcher.js": 50,\n "./environment": 29,\n "./environment.js": 29,\n "./filters/arrays": 51,\n "./filters/arrays.js": 51,\n "./filters/dates": 52,\n "./filters/dates.js": 52,\n "./filters/lcs": 53,\n "./filters/lcs.js": 53,\n "./filters/nested": 54,\n "./filters/nested.js": 54,\n "./filters/texts": 55,\n "./filters/texts.js": 55,\n "./filters/trivial": 56,\n "./filters/trivial.js": 56,\n "./formatters/annotated": 30,\n "./formatters/annotated.js": 30,\n "./formatters/base": 14,\n "./formatters/base.js": 14,\n "./formatters/console": 42,\n "./formatters/console.js": 42,\n "./formatters/html": 31,\n "./formatters/html.js": 31,\n "./formatters/index": 35,\n "./formatters/index.js": 35,\n "./formatters/jsonpatch": 32,\n "./formatters/jsonpatch.js": 32,\n "./main": 17,\n "./main-formatters": 83,\n "./main-formatters.js": 83,\n "./main-full": 84,\n "./main-full.js": 84,\n "./main.js": 17,\n "./pipe": 43,\n "./pipe.js": 43,\n "./processor": 57,\n "./processor.js": 57\n};\nfunction webpackContext(req) {\n return __webpack_require__(webpackContextResolve(req));\n};\nfunction webpackContextResolve(req) {\n return map[req] || (function() { throw new Error("Cannot find module \'" + req + "\'.") }());\n};\nwebpackContext.keys = function webpackContextKeys() {\n return Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 82;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/jsondiffpatch/src ^\\.\\/.*$\n ** module id = 82\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/jsondiffpatch/src_^\\.\\/.*$?')},function(module,exports,__webpack_require__){eval("\nmodule.exports = __webpack_require__(35);\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/jsondiffpatch/src/main-formatters.js\n ** module id = 83\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/jsondiffpatch/src/main-formatters.js?")},function(module,exports,__webpack_require__){eval("var environment = __webpack_require__(29);\n\nif (environment.isBrowser) {\n /* global window */\n /* jshint camelcase: false */\n window.diff_match_patch = __webpack_require__(49);\n /* jshint camelcase: true */\n}\n\nmodule.exports = __webpack_require__(17);\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/jsondiffpatch/src/main-full.js\n ** module id = 84\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/jsondiffpatch/src/main-full.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = selectorParser;\n\nvar _browserSplit = __webpack_require__(88);\n\nvar _browserSplit2 = _interopRequireDefault(_browserSplit);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar classIdSplit = /([\\.#]?[a-zA-Z0-9\\u007F-\\uFFFF_:-]+)/;\nvar notClassId = /^\\.|#/;\n\nfunction selectorParser() {\n var selector = arguments.length <= 0 || arguments[0] === undefined ? '' : arguments[0];\n\n var tagName = undefined;\n var id = '';\n var classes = [];\n\n var tagParts = (0, _browserSplit2.default)(selector, classIdSplit);\n\n if (notClassId.test(tagParts[1]) || selector === '') {\n tagName = 'div';\n }\n\n var part = undefined;\n var type = undefined;\n var i = undefined;\n\n for (i = 0; i < tagParts.length; i++) {\n part = tagParts[i];\n\n if (!part) {\n continue;\n }\n\n type = part.charAt(0);\n\n if (!tagName) {\n tagName = part;\n } else if (type === '.') {\n classes.push(part.substring(1, part.length));\n } else if (type === '#') {\n id = part.substring(1, part.length);\n }\n }\n\n return {\n tagName: tagName,\n id: id,\n className: classes.join(' ')\n };\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/snabbdom-selector/lib/selectorParser.js\n ** module id = 85\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/snabbdom-selector/lib/selectorParser.js?")},function(module,exports,__webpack_require__){eval("\n// https://github.com/Matt-Esch/virtual-dom/blob/master/virtual-hyperscript/parse-tag.js\n\nvar split = __webpack_require__(88);\n\nvar classIdSplit = /([\\.#]?[a-zA-Z0-9\\u007F-\\uFFFF_:-]+)/;\nvar notClassId = /^\\.|#/;\n\nmodule.exports = function parseSelector(selector, upper) {\n selector = selector || '';\n var tagName;\n var id = '';\n var classes = [];\n\n var tagParts = split(selector, classIdSplit);\n\n if (notClassId.test(tagParts[1]) || selector === '') {\n tagName = 'div';\n }\n\n var part, type, i;\n\n for (i = 0; i < tagParts.length; i++) {\n part = tagParts[i];\n\n if (!part) {\n continue;\n }\n\n type = part.charAt(0);\n\n if (!tagName) {\n tagName = part;\n } else if (type === '.') {\n classes.push(part.substring(1, part.length));\n } else if (type === '#') {\n id = part.substring(1, part.length);\n }\n }\n\n return {\n tagName: upper === true ? tagName.toUpperCase() : tagName,\n id: id,\n className: classes.join(' ')\n };\n};\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/snabbdom-to-html/lib/parse-selector.js\n ** module id = 86\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/snabbdom-to-html/lib/parse-selector.js?")},function(module,exports){eval("'use strict';\nmodule.exports = function () {\n return /[\\u001b\\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g;\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/ansi-regex/index.js\n ** module id = 87\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/ansi-regex/index.js?")},function(module,exports){eval("/*!\n * Cross-Browser Split 1.1.1\n * Copyright 2007-2012 Steven Levithan \n * Available under the MIT License\n * ECMAScript compliant, uniform cross-browser split method\n */\n\n/**\n * Splits a string into an array of strings using a regex or string separator. Matches of the\n * separator are not included in the result array. However, if `separator` is a regex that contains\n * capturing groups, backreferences are spliced into the result each time `separator` is matched.\n * Fixes browser bugs compared to the native `String.prototype.split` and can be used reliably\n * cross-browser.\n * @param {String} str String to split.\n * @param {RegExp|String} separator Regex or string to use for separating the string.\n * @param {Number} [limit] Maximum number of items to include in the result array.\n * @returns {Array} Array of substrings.\n * @example\n *\n * // Basic use\n * split('a b c d', ' ');\n * // -> ['a', 'b', 'c', 'd']\n *\n * // With limit\n * split('a b c d', ' ', 2);\n * // -> ['a', 'b']\n *\n * // Backreferences in result array\n * split('..word1 word2..', /([a-z]+)(\\d+)/i);\n * // -> ['..', 'word', '1', ' ', 'word', '2', '..']\n */\nmodule.exports = (function split(undef) {\n\n var nativeSplit = String.prototype.split,\n compliantExecNpcg = /()??/.exec(\"\")[1] === undef,\n // NPCG: nonparticipating capturing group\n self;\n\n self = function(str, separator, limit) {\n // If `separator` is not a regex, use `nativeSplit`\n if (Object.prototype.toString.call(separator) !== \"[object RegExp]\") {\n return nativeSplit.call(str, separator, limit);\n }\n var output = [],\n flags = (separator.ignoreCase ? \"i\" : \"\") + (separator.multiline ? \"m\" : \"\") + (separator.extended ? \"x\" : \"\") + // Proposed for ES6\n (separator.sticky ? \"y\" : \"\"),\n // Firefox 3+\n lastLastIndex = 0,\n // Make `global` and avoid `lastIndex` issues by working with a copy\n separator = new RegExp(separator.source, flags + \"g\"),\n separator2, match, lastIndex, lastLength;\n str += \"\"; // Type-convert\n if (!compliantExecNpcg) {\n // Doesn't need flags gy, but they don't hurt\n separator2 = new RegExp(\"^\" + separator.source + \"$(?!\\\\s)\", flags);\n }\n /* Values for `limit`, per the spec:\n * If undefined: 4294967295 // Math.pow(2, 32) - 1\n * If 0, Infinity, or NaN: 0\n * If positive number: limit = Math.floor(limit); if (limit > 4294967295) limit -= 4294967296;\n * If negative number: 4294967296 - Math.floor(Math.abs(limit))\n * If other: Type-convert, then use the above rules\n */\n limit = limit === undef ? -1 >>> 0 : // Math.pow(2, 32) - 1\n limit >>> 0; // ToUint32(limit)\n while (match = separator.exec(str)) {\n // `separator.lastIndex` is not reliable cross-browser\n lastIndex = match.index + match[0].length;\n if (lastIndex > lastLastIndex) {\n output.push(str.slice(lastLastIndex, match.index));\n // Fix browsers whose `exec` methods don't consistently return `undefined` for\n // nonparticipating capturing groups\n if (!compliantExecNpcg && match.length > 1) {\n match[0].replace(separator2, function() {\n for (var i = 1; i < arguments.length - 2; i++) {\n if (arguments[i] === undef) {\n match[i] = undef;\n }\n }\n });\n }\n if (match.length > 1 && match.index < str.length) {\n Array.prototype.push.apply(output, match.slice(1));\n }\n lastLength = match[0].length;\n lastLastIndex = lastIndex;\n if (output.length >= limit) {\n break;\n }\n }\n if (separator.lastIndex === match.index) {\n separator.lastIndex++; // Avoid an infinite loop\n }\n }\n if (lastLastIndex === str.length) {\n if (lastLength || !separator.test(\"\")) {\n output.push(\"\");\n }\n } else {\n output.push(str.slice(lastLastIndex));\n }\n return output.length > limit ? output.slice(0, limit) : output;\n };\n\n return self;\n})();\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/browser-split/index.js\n ** module id = 88\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/browser-split/index.js?")},function(module,exports){eval("/**\n * lodash 3.9.1 (Custom Build) \n * Build: `lodash modern modularize exports=\"npm\" -o ./`\n * Copyright 2012-2015 The Dojo Foundation \n * Based on Underscore.js 1.8.3 \n * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n * Available under MIT license \n */\n\n/** `Object#toString` result references. */\nvar funcTag = '[object Function]';\n\n/** Used to detect host constructors (Safari > 5). */\nvar reIsHostCtor = /^\\[object .+?Constructor\\]$/;\n\n/**\n * Checks if `value` is object-like.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n */\nfunction isObjectLike(value) {\n return !!value && typeof value == 'object';\n}\n\n/** Used for native method references. */\nvar objectProto = Object.prototype;\n\n/** Used to resolve the decompiled source of functions. */\nvar fnToString = Function.prototype.toString;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objToString = objectProto.toString;\n\n/** Used to detect if a method is native. */\nvar reIsNative = RegExp('^' +\n fnToString.call(hasOwnProperty).replace(/[\\\\^$.*+?()[\\]{}|]/g, '\\\\$&')\n .replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g, '$1.*?') + '$'\n);\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 = object == null ? undefined : object[key];\n return isNative(value) ? value : undefined;\n}\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in older versions of Chrome and Safari which return 'function' for regexes\n // and Safari 8 equivalents which return 'object' for typed array constructors.\n return isObject(value) && objToString.call(value) == funcTag;\n}\n\n/**\n * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.\n * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\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(1);\n * // => false\n */\nfunction isObject(value) {\n // Avoid a V8 JIT bug in Chrome 19-20.\n // See https://code.google.com/p/v8/issues/detail?id=2291 for more details.\n var type = typeof value;\n return !!value && (type == 'object' || type == 'function');\n}\n\n/**\n * Checks if `value` is a native function.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a native function, else `false`.\n * @example\n *\n * _.isNative(Array.prototype.push);\n * // => true\n *\n * _.isNative(_);\n * // => false\n */\nfunction isNative(value) {\n if (value == null) {\n return false;\n }\n if (isFunction(value)) {\n return reIsNative.test(fnToString.call(value));\n }\n return isObjectLike(value) && reIsHostCtor.test(value);\n}\n\nmodule.exports = getNative;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash._getnative/index.js\n ** module id = 89\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/lodash._getnative/index.js?")},function(module,exports,__webpack_require__){eval("/**\n * lodash 3.2.0 (Custom Build) \n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright 2012-2016 The Dojo Foundation \n * Based on Underscore.js 1.8.3 \n * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n * Available under MIT license \n */\nvar root = __webpack_require__(61);\n\n/** Used as references for various `Number` constants. */\nvar INFINITY = 1 / 0;\n\n/** `Object#toString` result references. */\nvar symbolTag = '[object Symbol]';\n\n/** Used to match HTML entities and HTML characters. */\nvar reUnescapedHtml = /[&<>\"'`]/g,\n reHasUnescapedHtml = RegExp(reUnescapedHtml.source);\n\n/** Used to map characters to HTML entities. */\nvar htmlEscapes = {\n '&': '&',\n '<': '<',\n '>': '>',\n '\"': '"',\n \"'\": ''',\n '`': '`'\n};\n\n/**\n * Used by `_.escape` to convert characters to HTML entities.\n *\n * @private\n * @param {string} chr The matched character to escape.\n * @returns {string} Returns the escaped character.\n */\nfunction escapeHtmlChar(chr) {\n return htmlEscapes[chr];\n}\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objectToString = objectProto.toString;\n\n/** Built-in value references. */\nvar Symbol = root.Symbol;\n\n/** Used to convert symbols to primitives and strings. */\nvar symbolProto = Symbol ? Symbol.prototype : undefined,\n symbolToString = Symbol ? symbolProto.toString : undefined;\n\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 * @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 && typeof value == 'object';\n}\n\n/**\n * Checks if `value` is classified as a `Symbol` primitive or object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, 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) && objectToString.call(value) == symbolTag);\n}\n\n/**\n * Converts `value` to a string if it's not one. An empty string is returned\n * for `null` and `undefined` values. The sign of `-0` is preserved.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to process.\n * @returns {string} Returns the 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 // Exit early for strings to avoid a performance hit in some environments.\n if (typeof value == 'string') {\n return value;\n }\n if (value == null) {\n return '';\n }\n if (isSymbol(value)) {\n return Symbol ? symbolToString.call(value) : '';\n }\n var result = (value + '');\n return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;\n}\n\n/**\n * Converts the characters \"&\", \"<\", \">\", '\"', \"'\", and \"\\`\" in `string` to\n * their corresponding HTML entities.\n *\n * **Note:** No other characters are escaped. To escape additional\n * characters use a third-party library like [_he_](https://mths.be/he).\n *\n * Though the \">\" character is escaped for symmetry, characters like\n * \">\" and \"/\" don't need escaping in HTML and have no special meaning\n * unless they're part of a tag or unquoted attribute value.\n * See [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)\n * (under \"semi-related fun fact\") for more details.\n *\n * Backticks are escaped because in IE < 9, they can break out of\n * attribute values or HTML comments. See [#59](https://html5sec.org/#59),\n * [#102](https://html5sec.org/#102), [#108](https://html5sec.org/#108), and\n * [#133](https://html5sec.org/#133) of the [HTML5 Security Cheatsheet](https://html5sec.org/)\n * for more details.\n *\n * When working with HTML you should always [quote attribute values](http://wonko.com/post/html-escaping)\n * to reduce XSS vectors.\n *\n * @static\n * @memberOf _\n * @category String\n * @param {string} [string=''] The string to escape.\n * @returns {string} Returns the escaped string.\n * @example\n *\n * _.escape('fred, barney, & pebbles');\n * // => 'fred, barney, & pebbles'\n */\nfunction escape(string) {\n string = toString(string);\n return (string && reHasUnescapedHtml.test(string))\n ? string.replace(reUnescapedHtml, escapeHtmlChar)\n : string;\n}\n\nmodule.exports = escape;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash.escape/index.js\n ** module id = 90\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/lodash.escape/index.js?")},function(module,exports,__webpack_require__){eval("/**\n * lodash 3.0.2 (Custom Build) \n * Build: `lodash modern modularize exports=\"npm\" -o ./`\n * Copyright 2012-2015 The Dojo Foundation \n * Based on Underscore.js 1.8.3 \n * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n * Available under MIT license \n */\nvar baseFor = __webpack_require__(309),\n bindCallback = __webpack_require__(312),\n keys = __webpack_require__(317);\n\n/**\n * The base implementation of `_.forOwn` without support for callback\n * shorthands and `this` binding.\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 baseFor(object, iteratee, keys);\n}\n\n/**\n * Creates a function for `_.forOwn` or `_.forOwnRight`.\n *\n * @private\n * @param {Function} objectFunc The function to iterate over an object.\n * @returns {Function} Returns the new each function.\n */\nfunction createForOwn(objectFunc) {\n return function(object, iteratee, thisArg) {\n if (typeof iteratee != 'function' || thisArg !== undefined) {\n iteratee = bindCallback(iteratee, thisArg, 3);\n }\n return objectFunc(object, iteratee);\n };\n}\n\n/**\n * Iterates over own enumerable properties of an object invoking `iteratee`\n * for each property. The `iteratee` is bound to `thisArg` and invoked with\n * three arguments: (value, key, object). Iteratee functions may exit iteration\n * early by explicitly returning `false`.\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Object} object The object to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @param {*} [thisArg] The `this` binding of `iteratee`.\n * @returns {Object} Returns `object`.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.forOwn(new Foo, function(value, key) {\n * console.log(key);\n * });\n * // => logs 'a' and 'b' (iteration order is not guaranteed)\n */\nvar forOwn = createForOwn(baseForOwn);\n\nmodule.exports = forOwn;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash.forown/index.js\n ** module id = 91\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/lodash.forown/index.js?")},function(module,exports){eval("/**\n * lodash 3.0.8 (Custom Build) \n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright 2012-2016 The Dojo Foundation \n * Based on Underscore.js 1.8.3 \n * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n * Available under MIT license \n */\n\n/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]',\n funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]';\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 [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objectToString = objectProto.toString;\n\n/** Built-in value references. */\nvar propertyIsEnumerable = objectProto.propertyIsEnumerable;\n\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 function.\n */\nfunction baseProperty(key) {\n return function(object) {\n return object == null ? undefined : object[key];\n };\n}\n\n/**\n * Gets the \"length\" property value of `object`.\n *\n * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792)\n * that affects Safari on at least iOS 8.1-8.3 ARM64.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {*} Returns the \"length\" value.\n */\nvar getLength = baseProperty('length');\n\n/**\n * Checks if `value` is likely an `arguments` object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isArguments(function() { return arguments; }());\n * // => true\n *\n * _.isArguments([1, 2, 3]);\n * // => false\n */\nfunction isArguments(value) {\n // Safari 8.1 incorrectly makes `arguments.callee` enumerable in strict mode.\n return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&\n (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);\n}\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 * @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(getLength(value)) && !isFunction(value);\n}\n\n/**\n * This method is like `_.isArrayLike` except that it also checks if `value`\n * is an object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array-like object, else `false`.\n * @example\n *\n * _.isArrayLikeObject([1, 2, 3]);\n * // => true\n *\n * _.isArrayLikeObject(document.body.children);\n * // => true\n *\n * _.isArrayLikeObject('abc');\n * // => false\n *\n * _.isArrayLikeObject(_.noop);\n * // => false\n */\nfunction isArrayLikeObject(value) {\n return isObjectLike(value) && isArrayLike(value);\n}\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in Safari 8 which returns 'object' for typed array and weak map constructors,\n // and PhantomJS 1.9 which returns 'function' for `NodeList` instances.\n var tag = isObject(value) ? objectToString.call(value) : '';\n return tag == funcTag || tag == genTag;\n}\n\n/**\n * Checks if `value` is a valid array-like length.\n *\n * **Note:** This function is loosely based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).\n *\n * @static\n * @memberOf _\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\n/**\n * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.\n * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\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 && (type == 'object' || type == 'function');\n}\n\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 * @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 && typeof value == 'object';\n}\n\nmodule.exports = isArguments;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash.isarguments/index.js\n ** module id = 92\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/lodash.isarguments/index.js?")},function(module,exports){eval("/**\n * lodash 3.0.4 (Custom Build) \n * Build: `lodash modern modularize exports=\"npm\" -o ./`\n * Copyright 2012-2015 The Dojo Foundation \n * Based on Underscore.js 1.8.3 \n * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n * Available under MIT license \n */\n\n/** `Object#toString` result references. */\nvar arrayTag = '[object Array]',\n funcTag = '[object Function]';\n\n/** Used to detect host constructors (Safari > 5). */\nvar reIsHostCtor = /^\\[object .+?Constructor\\]$/;\n\n/**\n * Checks if `value` is object-like.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n */\nfunction isObjectLike(value) {\n return !!value && typeof value == 'object';\n}\n\n/** Used for native method references. */\nvar objectProto = Object.prototype;\n\n/** Used to resolve the decompiled source of functions. */\nvar fnToString = Function.prototype.toString;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objToString = objectProto.toString;\n\n/** Used to detect if a method is native. */\nvar reIsNative = RegExp('^' +\n fnToString.call(hasOwnProperty).replace(/[\\\\^$.*+?()[\\]{}|]/g, '\\\\$&')\n .replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g, '$1.*?') + '$'\n);\n\n/* Native method references for those with the same name as other `lodash` methods. */\nvar nativeIsArray = getNative(Array, 'isArray');\n\n/**\n * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer)\n * of an array-like value.\n */\nvar MAX_SAFE_INTEGER = 9007199254740991;\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 = object == null ? undefined : object[key];\n return isNative(value) ? value : undefined;\n}\n\n/**\n * Checks if `value` is a valid array-like length.\n *\n * **Note:** This function is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n */\nfunction isLength(value) {\n return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n}\n\n/**\n * Checks if `value` is classified as an `Array` object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isArray([1, 2, 3]);\n * // => true\n *\n * _.isArray(function() { return arguments; }());\n * // => false\n */\nvar isArray = nativeIsArray || function(value) {\n return isObjectLike(value) && isLength(value.length) && objToString.call(value) == arrayTag;\n};\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in older versions of Chrome and Safari which return 'function' for regexes\n // and Safari 8 equivalents which return 'object' for typed array constructors.\n return isObject(value) && objToString.call(value) == funcTag;\n}\n\n/**\n * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.\n * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\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(1);\n * // => false\n */\nfunction isObject(value) {\n // Avoid a V8 JIT bug in Chrome 19-20.\n // See https://code.google.com/p/v8/issues/detail?id=2291 for more details.\n var type = typeof value;\n return !!value && (type == 'object' || type == 'function');\n}\n\n/**\n * Checks if `value` is a native function.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a native function, else `false`.\n * @example\n *\n * _.isNative(Array.prototype.push);\n * // => true\n *\n * _.isNative(_);\n * // => false\n */\nfunction isNative(value) {\n if (value == null) {\n return false;\n }\n if (isFunction(value)) {\n return reIsNative.test(fnToString.call(value));\n }\n return isObjectLike(value) && reIsHostCtor.test(value);\n}\n\nmodule.exports = isArray;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash.isarray/index.js\n ** module id = 93\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/lodash.isarray/index.js?"); },function(module,exports){eval("/**\n * Tween.js - Licensed under the MIT license\n * https://github.com/sole/tween.js\n * ----------------------------------------------\n *\n * See https://github.com/sole/tween.js/graphs/contributors for the full list of contributors.\n * Thank you all, you're awesome!\n */\n\n// Date.now shim for (ahem) Internet Explo(d|r)er\nif ( Date.now === undefined ) {\n\n Date.now = function () {\n\n return new Date().valueOf();\n\n };\n\n}\n\nvar TWEEN = TWEEN || ( function () {\n\n var _tweens = [];\n\n return {\n\n REVISION: '14',\n\n getAll: function () {\n\n return _tweens;\n\n },\n\n removeAll: function () {\n\n _tweens = [];\n\n },\n\n add: function ( tween ) {\n\n _tweens.push( tween );\n\n },\n\n remove: function ( tween ) {\n\n var i = _tweens.indexOf( tween );\n\n if ( i !== -1 ) {\n\n _tweens.splice( i, 1 );\n\n }\n\n },\n\n update: function ( time ) {\n\n if ( _tweens.length === 0 ) return false;\n\n var i = 0;\n\n time = time !== undefined ? time : ( typeof window !== 'undefined' && window.performance !== undefined && window.performance.now !== undefined ? window.performance.now() : Date.now() );\n\n while ( i < _tweens.length ) {\n\n if ( _tweens[ i ].update( time ) ) {\n\n i++;\n\n } else {\n\n _tweens.splice( i, 1 );\n\n }\n\n }\n\n return true;\n\n }\n };\n\n} )();\n\nTWEEN.Tween = function ( object ) {\n\n var _object = object;\n var _valuesStart = {};\n var _valuesEnd = {};\n var _valuesStartRepeat = {};\n var _duration = 1000;\n var _repeat = 0;\n var _yoyo = false;\n var _isPlaying = false;\n var _reversed = false;\n var _delayTime = 0;\n var _startTime = null;\n var _easingFunction = TWEEN.Easing.Linear.None;\n var _interpolationFunction = TWEEN.Interpolation.Linear;\n var _chainedTweens = [];\n var _onStartCallback = null;\n var _onStartCallbackFired = false;\n var _onUpdateCallback = null;\n var _onCompleteCallback = null;\n var _onStopCallback = null;\n\n // Set all starting values present on the target object\n for ( var field in object ) {\n\n _valuesStart[ field ] = parseFloat(object[field], 10);\n\n }\n\n this.to = function ( properties, duration ) {\n\n if ( duration !== undefined ) {\n\n _duration = duration;\n\n }\n\n _valuesEnd = properties;\n\n return this;\n\n };\n\n this.start = function ( time ) {\n\n TWEEN.add( this );\n\n _isPlaying = true;\n\n _onStartCallbackFired = false;\n\n _startTime = time !== undefined ? time : ( typeof window !== 'undefined' && window.performance !== undefined && window.performance.now !== undefined ? window.performance.now() : Date.now() );\n _startTime += _delayTime;\n\n for ( var property in _valuesEnd ) {\n\n // check if an Array was provided as property value\n if ( _valuesEnd[ property ] instanceof Array ) {\n\n if ( _valuesEnd[ property ].length === 0 ) {\n\n continue;\n\n }\n\n // create a local copy of the Array with the start value at the front\n _valuesEnd[ property ] = [ _object[ property ] ].concat( _valuesEnd[ property ] );\n\n }\n\n _valuesStart[ property ] = _object[ property ];\n\n if( ( _valuesStart[ property ] instanceof Array ) === false ) {\n _valuesStart[ property ] *= 1.0; // Ensures we're using numbers, not strings\n }\n\n _valuesStartRepeat[ property ] = _valuesStart[ property ] || 0;\n\n }\n\n return this;\n\n };\n\n this.stop = function () {\n\n if ( !_isPlaying ) {\n return this;\n }\n\n TWEEN.remove( this );\n _isPlaying = false;\n\n if ( _onStopCallback !== null ) {\n\n _onStopCallback.call( _object );\n\n }\n\n this.stopChainedTweens();\n return this;\n\n };\n\n this.stopChainedTweens = function () {\n\n for ( var i = 0, numChainedTweens = _chainedTweens.length; i < numChainedTweens; i++ ) {\n\n _chainedTweens[ i ].stop();\n\n }\n\n };\n\n this.delay = function ( amount ) {\n\n _delayTime = amount;\n return this;\n\n };\n\n this.repeat = function ( times ) {\n\n _repeat = times;\n return this;\n\n };\n\n this.yoyo = function( yoyo ) {\n\n _yoyo = yoyo;\n return this;\n\n };\n\n\n this.easing = function ( easing ) {\n\n _easingFunction = easing;\n return this;\n\n };\n\n this.interpolation = function ( interpolation ) {\n\n _interpolationFunction = interpolation;\n return this;\n\n };\n\n this.chain = function () {\n\n _chainedTweens = arguments;\n return this;\n\n };\n\n this.onStart = function ( callback ) {\n\n _onStartCallback = callback;\n return this;\n\n };\n\n this.onUpdate = function ( callback ) {\n\n _onUpdateCallback = callback;\n return this;\n\n };\n\n this.onComplete = function ( callback ) {\n\n _onCompleteCallback = callback;\n return this;\n\n };\n\n this.onStop = function ( callback ) {\n\n _onStopCallback = callback;\n return this;\n\n };\n\n this.update = function ( time ) {\n\n var property;\n\n if ( time < _startTime ) {\n\n return true;\n\n }\n\n if ( _onStartCallbackFired === false ) {\n\n if ( _onStartCallback !== null ) {\n\n _onStartCallback.call( _object );\n\n }\n\n _onStartCallbackFired = true;\n\n }\n\n var elapsed = ( time - _startTime ) / _duration;\n elapsed = elapsed > 1 ? 1 : elapsed;\n\n var value = _easingFunction( elapsed );\n\n for ( property in _valuesEnd ) {\n\n var start = _valuesStart[ property ] || 0;\n var end = _valuesEnd[ property ];\n\n if ( end instanceof Array ) {\n\n _object[ property ] = _interpolationFunction( end, value );\n\n } else {\n\n // Parses relative end values with start as base (e.g.: +10, -3)\n if ( typeof(end) === \"string\" ) {\n end = start + parseFloat(end, 10);\n }\n\n // protect against non numeric properties.\n if ( typeof(end) === \"number\" ) {\n _object[ property ] = start + ( end - start ) * value;\n }\n\n }\n\n }\n\n if ( _onUpdateCallback !== null ) {\n\n _onUpdateCallback.call( _object, value );\n\n }\n\n if ( elapsed == 1 ) {\n\n if ( _repeat > 0 ) {\n\n if( isFinite( _repeat ) ) {\n _repeat--;\n }\n\n // reassign starting values, restart by making startTime = now\n for( property in _valuesStartRepeat ) {\n\n if ( typeof( _valuesEnd[ property ] ) === \"string\" ) {\n _valuesStartRepeat[ property ] = _valuesStartRepeat[ property ] + parseFloat(_valuesEnd[ property ], 10);\n }\n\n if (_yoyo) {\n var tmp = _valuesStartRepeat[ property ];\n _valuesStartRepeat[ property ] = _valuesEnd[ property ];\n _valuesEnd[ property ] = tmp;\n }\n\n _valuesStart[ property ] = _valuesStartRepeat[ property ];\n\n }\n\n if (_yoyo) {\n _reversed = !_reversed;\n }\n\n _startTime = time + _delayTime;\n\n return true;\n\n } else {\n\n if ( _onCompleteCallback !== null ) {\n\n _onCompleteCallback.call( _object );\n\n }\n\n for ( var i = 0, numChainedTweens = _chainedTweens.length; i < numChainedTweens; i++ ) {\n\n _chainedTweens[ i ].start( time );\n\n }\n\n return false;\n\n }\n\n }\n\n return true;\n\n };\n\n};\n\n\nTWEEN.Easing = {\n\n Linear: {\n\n None: function ( k ) {\n\n return k;\n\n }\n\n },\n\n Quadratic: {\n\n In: function ( k ) {\n\n return k * k;\n\n },\n\n Out: function ( k ) {\n\n return k * ( 2 - k );\n\n },\n\n InOut: function ( k ) {\n\n if ( ( k *= 2 ) < 1 ) return 0.5 * k * k;\n return - 0.5 * ( --k * ( k - 2 ) - 1 );\n\n }\n\n },\n\n Cubic: {\n\n In: function ( k ) {\n\n return k * k * k;\n\n },\n\n Out: function ( k ) {\n\n return --k * k * k + 1;\n\n },\n\n InOut: function ( k ) {\n\n if ( ( k *= 2 ) < 1 ) return 0.5 * k * k * k;\n return 0.5 * ( ( k -= 2 ) * k * k + 2 );\n\n }\n\n },\n\n Quartic: {\n\n In: function ( k ) {\n\n return k * k * k * k;\n\n },\n\n Out: function ( k ) {\n\n return 1 - ( --k * k * k * k );\n\n },\n\n InOut: function ( k ) {\n\n if ( ( k *= 2 ) < 1) return 0.5 * k * k * k * k;\n return - 0.5 * ( ( k -= 2 ) * k * k * k - 2 );\n\n }\n\n },\n\n Quintic: {\n\n In: function ( k ) {\n\n return k * k * k * k * k;\n\n },\n\n Out: function ( k ) {\n\n return --k * k * k * k * k + 1;\n\n },\n\n InOut: function ( k ) {\n\n if ( ( k *= 2 ) < 1 ) return 0.5 * k * k * k * k * k;\n return 0.5 * ( ( k -= 2 ) * k * k * k * k + 2 );\n\n }\n\n },\n\n Sinusoidal: {\n\n In: function ( k ) {\n\n return 1 - Math.cos( k * Math.PI / 2 );\n\n },\n\n Out: function ( k ) {\n\n return Math.sin( k * Math.PI / 2 );\n\n },\n\n InOut: function ( k ) {\n\n return 0.5 * ( 1 - Math.cos( Math.PI * k ) );\n\n }\n\n },\n\n Exponential: {\n\n In: function ( k ) {\n\n return k === 0 ? 0 : Math.pow( 1024, k - 1 );\n\n },\n\n Out: function ( k ) {\n\n return k === 1 ? 1 : 1 - Math.pow( 2, - 10 * k );\n\n },\n\n InOut: function ( k ) {\n\n if ( k === 0 ) return 0;\n if ( k === 1 ) return 1;\n if ( ( k *= 2 ) < 1 ) return 0.5 * Math.pow( 1024, k - 1 );\n return 0.5 * ( - Math.pow( 2, - 10 * ( k - 1 ) ) + 2 );\n\n }\n\n },\n\n Circular: {\n\n In: function ( k ) {\n\n return 1 - Math.sqrt( 1 - k * k );\n\n },\n\n Out: function ( k ) {\n\n return Math.sqrt( 1 - ( --k * k ) );\n\n },\n\n InOut: function ( k ) {\n\n if ( ( k *= 2 ) < 1) return - 0.5 * ( Math.sqrt( 1 - k * k) - 1);\n return 0.5 * ( Math.sqrt( 1 - ( k -= 2) * k) + 1);\n\n }\n\n },\n\n Elastic: {\n\n In: function ( k ) {\n\n var s, a = 0.1, p = 0.4;\n if ( k === 0 ) return 0;\n if ( k === 1 ) return 1;\n if ( !a || a < 1 ) { a = 1; s = p / 4; }\n else s = p * Math.asin( 1 / a ) / ( 2 * Math.PI );\n return - ( a * Math.pow( 2, 10 * ( k -= 1 ) ) * Math.sin( ( k - s ) * ( 2 * Math.PI ) / p ) );\n\n },\n\n Out: function ( k ) {\n\n var s, a = 0.1, p = 0.4;\n if ( k === 0 ) return 0;\n if ( k === 1 ) return 1;\n if ( !a || a < 1 ) { a = 1; s = p / 4; }\n else s = p * Math.asin( 1 / a ) / ( 2 * Math.PI );\n return ( a * Math.pow( 2, - 10 * k) * Math.sin( ( k - s ) * ( 2 * Math.PI ) / p ) + 1 );\n\n },\n\n InOut: function ( k ) {\n\n var s, a = 0.1, p = 0.4;\n if ( k === 0 ) return 0;\n if ( k === 1 ) return 1;\n if ( !a || a < 1 ) { a = 1; s = p / 4; }\n else s = p * Math.asin( 1 / a ) / ( 2 * Math.PI );\n if ( ( k *= 2 ) < 1 ) return - 0.5 * ( a * Math.pow( 2, 10 * ( k -= 1 ) ) * Math.sin( ( k - s ) * ( 2 * Math.PI ) / p ) );\n return a * Math.pow( 2, -10 * ( k -= 1 ) ) * Math.sin( ( k - s ) * ( 2 * Math.PI ) / p ) * 0.5 + 1;\n\n }\n\n },\n\n Back: {\n\n In: function ( k ) {\n\n var s = 1.70158;\n return k * k * ( ( s + 1 ) * k - s );\n\n },\n\n Out: function ( k ) {\n\n var s = 1.70158;\n return --k * k * ( ( s + 1 ) * k + s ) + 1;\n\n },\n\n InOut: function ( k ) {\n\n var s = 1.70158 * 1.525;\n if ( ( k *= 2 ) < 1 ) return 0.5 * ( k * k * ( ( s + 1 ) * k - s ) );\n return 0.5 * ( ( k -= 2 ) * k * ( ( s + 1 ) * k + s ) + 2 );\n\n }\n\n },\n\n Bounce: {\n\n In: function ( k ) {\n\n return 1 - TWEEN.Easing.Bounce.Out( 1 - k );\n\n },\n\n Out: function ( k ) {\n\n if ( k < ( 1 / 2.75 ) ) {\n\n return 7.5625 * k * k;\n\n } else if ( k < ( 2 / 2.75 ) ) {\n\n return 7.5625 * ( k -= ( 1.5 / 2.75 ) ) * k + 0.75;\n\n } else if ( k < ( 2.5 / 2.75 ) ) {\n\n return 7.5625 * ( k -= ( 2.25 / 2.75 ) ) * k + 0.9375;\n\n } else {\n\n return 7.5625 * ( k -= ( 2.625 / 2.75 ) ) * k + 0.984375;\n\n }\n\n },\n\n InOut: function ( k ) {\n\n if ( k < 0.5 ) return TWEEN.Easing.Bounce.In( k * 2 ) * 0.5;\n return TWEEN.Easing.Bounce.Out( k * 2 - 1 ) * 0.5 + 0.5;\n\n }\n\n }\n\n};\n\nTWEEN.Interpolation = {\n\n Linear: function ( v, k ) {\n\n var m = v.length - 1, f = m * k, i = Math.floor( f ), fn = TWEEN.Interpolation.Utils.Linear;\n\n if ( k < 0 ) return fn( v[ 0 ], v[ 1 ], f );\n if ( k > 1 ) return fn( v[ m ], v[ m - 1 ], m - f );\n\n return fn( v[ i ], v[ i + 1 > m ? m : i + 1 ], f - i );\n\n },\n\n Bezier: function ( v, k ) {\n\n var b = 0, n = v.length - 1, pw = Math.pow, bn = TWEEN.Interpolation.Utils.Bernstein, i;\n\n for ( i = 0; i <= n; i++ ) {\n b += pw( 1 - k, n - i ) * pw( k, i ) * v[ i ] * bn( n, i );\n }\n\n return b;\n\n },\n\n CatmullRom: function ( v, k ) {\n\n var m = v.length - 1, f = m * k, i = Math.floor( f ), fn = TWEEN.Interpolation.Utils.CatmullRom;\n\n if ( v[ 0 ] === v[ m ] ) {\n\n if ( k < 0 ) i = Math.floor( f = m * ( 1 + k ) );\n\n return fn( v[ ( i - 1 + m ) % m ], v[ i ], v[ ( i + 1 ) % m ], v[ ( i + 2 ) % m ], f - i );\n\n } else {\n\n if ( k < 0 ) return v[ 0 ] - ( fn( v[ 0 ], v[ 0 ], v[ 1 ], v[ 1 ], -f ) - v[ 0 ] );\n if ( k > 1 ) return v[ m ] - ( fn( v[ m ], v[ m ], v[ m - 1 ], v[ m - 1 ], f - m ) - v[ m ] );\n\n return fn( v[ i ? i - 1 : 0 ], v[ i ], v[ m < i + 1 ? m : i + 1 ], v[ m < i + 2 ? m : i + 2 ], f - i );\n\n }\n\n },\n\n Utils: {\n\n Linear: function ( p0, p1, t ) {\n\n return ( p1 - p0 ) * t + p0;\n\n },\n\n Bernstein: function ( n , i ) {\n\n var fc = TWEEN.Interpolation.Utils.Factorial;\n return fc( n ) / fc( i ) / fc( n - i );\n\n },\n\n Factorial: ( function () {\n\n var a = [ 1 ];\n\n return function ( n ) {\n\n var s = 1, i;\n if ( a[ n ] ) return a[ n ];\n for ( i = n; i > 1; i-- ) s *= i;\n return a[ n ] = s;\n\n };\n\n } )(),\n\n CatmullRom: function ( p0, p1, p2, p3, t ) {\n\n var v0 = ( p2 - p0 ) * 0.5, v1 = ( p3 - p1 ) * 0.5, t2 = t * t, t3 = t * t2;\n return ( 2 * p1 - 2 * p2 + v0 + v1 ) * t3 + ( - 3 * p1 + 3 * p2 - 2 * v0 - v1 ) * t2 + v0 * t + p1;\n\n }\n\n }\n\n};\n\nmodule.exports=TWEEN;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/tween.js/index.js\n ** module id = 94\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/tween.js/index.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nvar required = __webpack_require__(323)\n , lolcation = __webpack_require__(344)\n , qs = __webpack_require__(322)\n , relativere = /^\\/(?!\\/)/\n , protocolre = /^([a-z0-9.+-]+:)?(\\/\\/)?(.*)$/i; // actual protocol is first match\n\n/**\n * These are the parse instructions for the URL parsers, it informs the parser\n * about:\n *\n * 0. The char it Needs to parse, if it's a string it should be done using\n * indexOf, RegExp using exec and NaN means set as current value.\n * 1. The property we should set when parsing this value.\n * 2. Indication if it's backwards or forward parsing, when set as number it's\n * the value of extra chars that should be split off.\n * 3. Inherit from location if non existing in the parser.\n * 4. `toLowerCase` the resulting value.\n */\nvar instructions = [\n ['#', 'hash'], // Extract from the back.\n ['?', 'query'], // Extract from the back.\n ['/', 'pathname'], // Extract from the back.\n ['@', 'auth', 1], // Extract from the front.\n [NaN, 'host', undefined, 1, 1], // Set left over value.\n [/\\:(\\d+)$/, 'port'], // RegExp the back.\n [NaN, 'hostname', undefined, 1, 1] // Set left over.\n];\n\n /**\n * @typedef ProtocolExtract\n * @type Object\n * @property {String} protocol Protocol matched in the URL, in lowercase\n * @property {Boolean} slashes Indicates whether the protocol is followed by double slash (\"//\")\n * @property {String} rest Rest of the URL that is not part of the protocol\n */\n\n /**\n * Extract protocol information from a URL with/without double slash (\"//\")\n *\n * @param {String} address URL we want to extract from.\n * @return {ProtocolExtract} Extracted information\n * @private\n */\nfunction extractProtocol(address) {\n var match = protocolre.exec(address);\n return {\n protocol: match[1] ? match[1].toLowerCase() : '',\n slashes: !!match[2],\n rest: match[3] ? match[3] : ''\n };\n}\n\n/**\n * The actual URL instance. Instead of returning an object we've opted-in to\n * create an actual constructor as it's much more memory efficient and\n * faster and it pleases my CDO.\n *\n * @constructor\n * @param {String} address URL we want to parse.\n * @param {Object|String} location Location defaults for relative paths.\n * @param {Boolean|Function} parser Parser for the query string.\n * @api public\n */\nfunction URL(address, location, parser) {\n if (!(this instanceof URL)) {\n return new URL(address, location, parser);\n }\n\n var relative = relativere.test(address)\n , parse, instruction, index, key\n , type = typeof location\n , url = this\n , i = 0;\n\n //\n // The following if statements allows this module two have compatibility with\n // 2 different API:\n //\n // 1. Node.js's `url.parse` api which accepts a URL, boolean as arguments\n // where the boolean indicates that the query string should also be parsed.\n //\n // 2. The `URL` interface of the browser which accepts a URL, object as\n // arguments. The supplied object will be used as default values / fall-back\n // for relative paths.\n //\n if ('object' !== type && 'string' !== type) {\n parser = location;\n location = null;\n }\n\n if (parser && 'function' !== typeof parser) {\n parser = qs.parse;\n }\n\n location = lolcation(location);\n\n // extract protocol information before running the instructions\n var extracted = extractProtocol(address);\n url.protocol = extracted.protocol || location.protocol || '';\n url.slashes = extracted.slashes || location.slashes;\n address = extracted.rest;\n\n for (; i < instructions.length; i++) {\n instruction = instructions[i];\n parse = instruction[0];\n key = instruction[1];\n\n if (parse !== parse) {\n url[key] = address;\n } else if ('string' === typeof parse) {\n if (~(index = address.indexOf(parse))) {\n if ('number' === typeof instruction[2]) {\n url[key] = address.slice(0, index);\n address = address.slice(index + instruction[2]);\n } else {\n url[key] = address.slice(index);\n address = address.slice(0, index);\n }\n }\n } else if (index = parse.exec(address)) {\n url[key] = index[1];\n address = address.slice(0, address.length - index[0].length);\n }\n\n url[key] = url[key] || (instruction[3] || ('port' === key && relative) ? location[key] || '' : '');\n\n //\n // Hostname, host and protocol should be lowercased so they can be used to\n // create a proper `origin`.\n //\n if (instruction[4]) {\n url[key] = url[key].toLowerCase();\n }\n }\n\n //\n // Also parse the supplied query string in to an object. If we're supplied\n // with a custom parser as function use that instead of the default build-in\n // parser.\n //\n if (parser) url.query = parser(url.query);\n\n //\n // We should not add port numbers if they are already the default port number\n // for a given protocol. As the host also contains the port number we're going\n // override it with the hostname which contains no port number.\n //\n if (!required(url.port, url.protocol)) {\n url.host = url.hostname;\n url.port = '';\n }\n\n //\n // Parse down the `auth` for the username and password.\n //\n url.username = url.password = '';\n if (url.auth) {\n instruction = url.auth.split(':');\n url.username = instruction[0] || '';\n url.password = instruction[1] || '';\n }\n\n //\n // The href is just the compiled result.\n //\n url.href = url.toString();\n}\n\n/**\n * This is convenience method for changing properties in the URL instance to\n * insure that they all propagate correctly.\n *\n * @param {String} prop Property we need to adjust.\n * @param {Mixed} value The newly assigned value.\n * @param {Boolean|Function} fn When setting the query, it will be the function used to parse\n * the query.\n * When setting the protocol, double slash will be removed from\n * the final url if it is true.\n * @returns {URL}\n * @api public\n */\nURL.prototype.set = function set(part, value, fn) {\n var url = this;\n\n if ('query' === part) {\n if ('string' === typeof value && value.length) {\n value = (fn || qs.parse)(value);\n }\n\n url[part] = value;\n } else if ('port' === part) {\n url[part] = value;\n\n if (!required(value, url.protocol)) {\n url.host = url.hostname;\n url[part] = '';\n } else if (value) {\n url.host = url.hostname +':'+ value;\n }\n } else if ('hostname' === part) {\n url[part] = value;\n\n if (url.port) value += ':'+ url.port;\n url.host = value;\n } else if ('host' === part) {\n url[part] = value;\n\n if (/\\:\\d+/.test(value)) {\n value = value.split(':');\n url.hostname = value[0];\n url.port = value[1];\n }\n } else if ('protocol' === part) {\n url.protocol = value;\n url.slashes = !fn;\n } else {\n url[part] = value;\n }\n\n url.href = url.toString();\n return url;\n};\n\n/**\n * Transform the properties back in to a valid and full URL string.\n *\n * @param {Function} stringify Optional query stringify function.\n * @returns {String}\n * @api public\n */\nURL.prototype.toString = function toString(stringify) {\n if (!stringify || 'function' !== typeof stringify) stringify = qs.stringify;\n\n var query\n , url = this\n , protocol = url.protocol;\n\n if (protocol && protocol.charAt(protocol.length - 1) !== ':') protocol += ':';\n\n var result = protocol + (url.slashes ? '//' : '');\n\n if (url.username) {\n result += url.username;\n if (url.password) result += ':'+ url.password;\n result += '@';\n }\n\n result += url.hostname;\n if (url.port) result += ':'+ url.port;\n\n result += url.pathname;\n\n query = 'object' === typeof url.query ? stringify(url.query) : url.query;\n if (query) result += '?' !== query.charAt(0) ? '?'+ query : query;\n\n if (url.hash) result += url.hash;\n\n return result;\n};\n\n//\n// Expose the URL parser and some additional properties that might be useful for\n// others.\n//\nURL.qs = qs;\nURL.location = lolcation;\nmodule.exports = URL;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/url-parse/index.js\n ** module id = 95\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/url-parse/index.js?")},function(module,exports){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.trim = trim;\nexports.exists = exists;\nexports.isEmpty = isEmpty;\nexports.itemsEqual = itemsEqual;\nexports.toArray = toArray;\nexports.safeJSONParse = safeJSONParse;\nexports.getExtension = getExtension;\nexports.getNameAndExtension = getNameAndExtension;\nexports.isValidFile = isValidFile;\nexports.isValidUrl = isValidUrl;\nexports.generateUUID = generateUUID;\nexports.stringToBoolean = stringToBoolean;\nexports.remapJson = remapJson;\nexports.coerceTypes = coerceTypes;\nfunction trim(string) {\n return String(string).replace(/^\\s+|\\s+$/g, '');\n}\n\nfunction exists(input) {\n return input !== null && input !== undefined;\n}\n\n// utiity to determine if a string is empty, null, or full of whitespaces\nfunction isEmpty(str) {\n if (!(typeof str === 'string')) return false; // UUUGH bad way of checking not a string\n return !str || /^\\s*$/.test(str) || str.length === 0 || !str.trim();\n}\n\nfunction itemsEqual(a, b) {\n // perhaps an immutable library would not require such horrors?\n if (JSON.stringify(a) === JSON.stringify(b)) {\n return true;\n }\n return false;\n}\n\n/* converts input data to array if it is not already an array*/\nfunction toArray(data) {\n if (!data) return [];\n if (data.constructor !== Array) return [data];\n return data;\n}\n\n/* JSON parse that always returns an object*/\nfunction safeJSONParse(str) {\n try {\n return JSON.parse(str) || {}; // from cycle.js\n } catch (error) {\n throw new Error('Error parsing data', JSON.stringify(str));\n }\n}\n\n// file utils ??\nfunction getExtension(fname) {\n return fname.substr((~ -fname.lastIndexOf('.') >>> 0) + 2).toLowerCase();\n}\n\nfunction getNameAndExtension(uri) {\n var _uriElems = uri.split('?');\n var name = _uriElems.shift().split('/').pop();\n var ext = getExtension(uri);\n return { name: name, ext: ext };\n}\n\nfunction isValidFile(file) {\n return typeof file !== 'undefined' && file !== null && file instanceof File;\n}\n\n// from http://stackoverflow.com/questions/1701898/how-to-detect-whether-a-string-is-in-url-format-using-javascript\nfunction isValidUrl(url) {\n /* var strRegex = \"^((https|http|ftp|rtsp|mms)?://)\"\n + \"?(([0-9a-z_!~*'().&=+$%-]+: )?[0-9a-z_!~*'().&=+$%-]+@)?\" //ftp的user@\n + \"(([0-9]{1,3}\\.){3}[0-9]{1,3}\" // IP形式的URL- 199.194.52.184\n + \"|\" // 允许IP和DOMAIN(域名)\n + \"([0-9a-z_!~*'()-]+\\.)*\" // 域名- www.\n + \"([0-9a-z][0-9a-z-]{0,61})?[0-9a-z]\\.\" // 二级域名\n + \"[a-z]{2,6})\" // first level domain- .com or .museum\n + \"(:[0-9]{1,4})?\" // 端口- :80\n + \"((/?)|\" // a slash isn't required if there is no file name\n + \"(/[0-9a-z_!~*'().;?:@&=+$,%#-]+)+/?)$\"\n var re=new RegExp(strRegex)\n return re.test(url)*/\n var regexp = /(ftp|http|https|localhost):\\/\\/(\\w+:{0,1}\\w*@)?(\\S+)(:[0-9]+)?(\\/|\\/([\\w#!:.?+=&%@!\\-\\/]))?/;\n return regexp.test(url);\n}\n\n// TODO: taken from three.js ,do correct attribution\nfunction generateUUID() {\n // http://www.broofa.com/Tools/Math.uuid.htm\n\n var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split('');\n var uuid = new Array(36);\n var rnd = 0;\n var r = void 0;\n\n return function () {\n for (var i = 0; i < 36; i++) {\n if (i === 8 || i === 13 || i === 18 || i === 23) {\n uuid[i] = '-';\n } else if (i === 14) {\n uuid[i] = '4';\n } else {\n if (rnd <= 0x02) rnd = 0x2000000 + Math.random() * 0x1000000 | 0;\n r = rnd & 0xf;\n rnd = rnd >> 4;\n uuid[i] = chars[i === 19 ? r & 0x3 | 0x8 : r];\n }\n }\n return uuid.join('');\n }();\n}\n\n// convert a string to a boolean\nfunction stringToBoolean(string) {\n switch (string.toLowerCase().trim()) {\n case 'true':case 'yes':case '1':\n return true;\n case 'false':case 'no':case '0':case null:\n return false;\n default:\n return Boolean(string);\n }\n}\n\n/*\nRemap the field from the input object using the\nprovided mapping object (key=>outkey) ie:\ninput = {foo:42}\nremapJson({foo:baz},input) => {baz:42}\n*/\nfunction remapJson(mapping, input) {\n var result = Object.keys(input).reduce(function (obj, key) {\n if (key in mapping) {\n obj[mapping[key]] = input[key];\n } else {\n obj[key] = input[key];\n }\n return obj;\n }, {});\n return result;\n}\n\n/*\nconvert the field from the input object using the\nprovided mapping object (key=>outkey) ie:\ninput = {foo:\"42\"}\nremapJson({foo:parseFloat},input) => {baz:42}\n*/\nfunction coerceTypes(mapping, input) {\n var result = Object.keys(input).reduce(function (obj, key) {\n if (key in mapping && input[key] !== null && input[key] !== undefined) {\n obj[key] = mapping[key](input[key]);\n } else {\n obj[key] = input[key];\n }\n return obj;\n }, {});\n return result;\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/usco-utils/lib/utils.js\n ** module id = 96\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/usco-utils/lib/utils.js?")},function(module,exports,__webpack_require__){eval("module.exports = __webpack_require__(354)\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/usco-utils/obsUtils.js\n ** module id = 97\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/usco-utils/obsUtils.js?")},function(module,exports,__webpack_require__){eval('"use strict";\nvar ScopeChecker_1 = __webpack_require__(64);\nvar utils_1 = __webpack_require__(24);\nvar matchesSelector;\ntry {\n matchesSelector = __webpack_require__(62);\n}\ncatch (e) {\n matchesSelector = Function.prototype;\n}\nfunction toElArray(input) {\n return Array.prototype.slice.call(input);\n}\nvar ElementFinder = (function () {\n function ElementFinder(namespace, isolateModule) {\n this.namespace = namespace;\n this.isolateModule = isolateModule;\n }\n ElementFinder.prototype.call = function (rootElement) {\n var namespace = this.namespace;\n if (namespace.join("") === "") {\n return rootElement;\n }\n var scope = utils_1.getScope(namespace);\n var scopeChecker = new ScopeChecker_1.ScopeChecker(scope, this.isolateModule);\n var selector = utils_1.getSelectors(namespace);\n var topNode = rootElement;\n var topNodeMatches = [];\n if (scope.length > 0) {\n topNode = this.isolateModule.getIsolatedElement(scope) || rootElement;\n if (selector && matchesSelector(topNode, selector)) {\n topNodeMatches.push(topNode);\n }\n }\n return toElArray(topNode.querySelectorAll(selector))\n .filter(scopeChecker.isStrictlyInRootScope, scopeChecker)\n .concat(topNodeMatches);\n };\n return ElementFinder;\n}());\nexports.ElementFinder = ElementFinder;\n//# sourceMappingURL=ElementFinder.js.map\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/@cycle/dom/lib/ElementFinder.js\n ** module id = 98\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/@cycle/dom/lib/ElementFinder.js?')},function(module,exports,__webpack_require__){eval('"use strict";\nvar ScopeChecker_1 = __webpack_require__(64);\nvar utils_1 = __webpack_require__(24);\nvar matchesSelector;\ntry {\n matchesSelector = __webpack_require__(62);\n}\ncatch (e) {\n matchesSelector = Function.prototype;\n}\n/**\n * Attaches an actual event listener to the DOM root element,\n * handles "destinations" (interested DOMSource output subjects), and bubbling.\n */\nvar EventDelegator = (function () {\n function EventDelegator(topElement, eventType, useCapture, isolateModule) {\n var _this = this;\n this.topElement = topElement;\n this.eventType = eventType;\n this.useCapture = useCapture;\n this.isolateModule = isolateModule;\n this.destinations = [];\n this.roof = topElement.parentElement;\n if (useCapture) {\n this.domListener = function (ev) { return _this.capture(ev); };\n }\n else {\n this.domListener = function (ev) { return _this.bubble(ev); };\n }\n topElement.addEventListener(eventType, this.domListener, useCapture);\n }\n EventDelegator.prototype.bubble = function (rawEvent) {\n if (!document.body.contains(rawEvent.currentTarget)) {\n return;\n }\n var ev = this.patchEvent(rawEvent);\n for (var el = ev.target; el && el !== this.roof; el = el.parentElement) {\n if (ev.propagationHasBeenStopped) {\n return;\n }\n this.matchEventAgainstDestinations(el, ev);\n }\n };\n EventDelegator.prototype.matchEventAgainstDestinations = function (el, ev) {\n for (var i = 0, n = this.destinations.length; i < n; i++) {\n var dest = this.destinations[i];\n if (!dest.scopeChecker.isStrictlyInRootScope(el)) {\n continue;\n }\n if (matchesSelector(el, dest.selector)) {\n this.mutateEventCurrentTarget(ev, el);\n dest.subject._n(ev);\n }\n }\n };\n EventDelegator.prototype.capture = function (ev) {\n for (var i = 0, n = this.destinations.length; i < n; i++) {\n var dest = this.destinations[i];\n if (matchesSelector(ev.target, dest.selector)) {\n dest.subject._n(ev);\n }\n }\n };\n EventDelegator.prototype.addDestination = function (subject, namespace) {\n var scope = utils_1.getScope(namespace);\n var selector = utils_1.getSelectors(namespace);\n var scopeChecker = new ScopeChecker_1.ScopeChecker(scope, this.isolateModule);\n this.destinations.push({ subject: subject, scopeChecker: scopeChecker, selector: selector });\n };\n EventDelegator.prototype.patchEvent = function (event) {\n var pEvent = event;\n pEvent.propagationHasBeenStopped = false;\n var oldStopPropagation = pEvent.stopPropagation;\n pEvent.stopPropagation = function stopPropagation() {\n oldStopPropagation.call(this);\n this.propagationHasBeenStopped = true;\n };\n return pEvent;\n };\n EventDelegator.prototype.mutateEventCurrentTarget = function (event, currentTargetElement) {\n try {\n Object.defineProperty(event, "currentTarget", {\n value: currentTargetElement,\n configurable: true,\n });\n }\n catch (err) {\n console.log("please use event.ownerTarget");\n }\n event.ownerTarget = currentTargetElement;\n };\n EventDelegator.prototype.updateTopElement = function (newTopElement) {\n this.topElement.removeEventListener(this.eventType, this.domListener, this.useCapture);\n newTopElement.addEventListener(this.eventType, this.domListener, this.useCapture);\n this.topElement = newTopElement;\n };\n return EventDelegator;\n}());\nexports.EventDelegator = EventDelegator;\n//# sourceMappingURL=EventDelegator.js.map\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/@cycle/dom/lib/EventDelegator.js\n ** module id = 99\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/@cycle/dom/lib/EventDelegator.js?'); @@ -18,10 +18,10 @@ eval('var map = {\n "./contexts/context": 25,\n "./contexts/context.js": 25,\n " },function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = intent;\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar merge = _rx2.default.Observable.merge;\n\nfunction intent(DOM) {\n var toggle$ = DOM.select('.commentsToggler').events('click').map(true).scan(function (acc, val) {\n return !acc;\n });\n\n var newCommentContent$ = merge( // stream containing new comment, if any\n DOM.select('.newCommentContent').events('input')\n // ,DOM.select(\".newCommentContent\").events(\"keyup\")\n ).map(function (e) {\n return e.target.value;\n }).startWith('').distinctUntilChanged().shareReplay(1);\n\n var addComment$ = DOM.select('.add').events('click').withLatestFrom(newCommentContent$, function (nC, newCommentContent) {\n return newCommentContent;\n });\n\n return {\n addComment$: addComment$,\n newCommentContent$: newCommentContent$,\n toggle$: toggle$ };\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/Comments/intent.js\n ** module id = 122\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/Comments/intent.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = model;\n\nvar _obsUtils = __webpack_require__(5);\n\nfunction model(props$, actions) {\n var comments$ = props$.pluck('comments');\n var entity$ = props$.pluck('entity');\n var toggled$ = actions.toggle$.startWith(false);\n\n var newCommentContent$ = actions.addComment$.map(function () {\n return '';\n }) // if new comment has been submited, reset to empty field\n .startWith(undefined);\n\n var state$ = (0, _obsUtils.combineLatestObj)({\n comments$: comments$,\n newCommentContent$: newCommentContent$,\n entity$: entity$,\n toggled$: toggled$ }).distinctUntilChanged();\n\n return state$;\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/Comments/model.js\n ** module id = 123\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/Comments/model.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = view;\n\nvar _snabbdomJsx = __webpack_require__(9);\n\nvar _ramda = __webpack_require__(4);\n\nvar _Menu = __webpack_require__(11);\n\nvar _Menu2 = _interopRequireDefault(_Menu);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n__webpack_require__(329);\n\nfunction renderCommentsList(comments) {\n var iconSvg = '\\n \\n ';\n\n var listElements = comments.map(function (comment) {\n return (0, _snabbdomJsx.html)(\n 'li',\n { className: 'item' },\n (0, _snabbdomJsx.html)(\n 'header',\n null,\n (0, _snabbdomJsx.html)('span', { innerHTML: iconSvg }),\n (0, _snabbdomJsx.html)(\n 'span',\n { className: 'author' },\n comment.author\n ),\n ' ',\n (0, _snabbdomJsx.html)(\n 'span',\n null,\n 'commented 0.5h ago'\n )\n ),\n (0, _snabbdomJsx.html)(\n 'div',\n { className: 'content' },\n comment.text\n )\n );\n });\n return (0, _snabbdomJsx.html)(\n 'ul',\n { className: 'commentsList' },\n listElements\n );\n}\n\n/* */\n\nfunction renderCommentCreator(newCommentContent) {\n var iconSvg = '\\n \\n \\n ';\n\n return (0, _snabbdomJsx.html)(\n 'div',\n { className: 'item new' },\n (0, _snabbdomJsx.html)(\n 'header',\n { innerHTML: iconSvg },\n 'Leave a comment'\n ),\n (0, _snabbdomJsx.html)(\n 'div',\n { className: 'content' },\n (0, _snabbdomJsx.html)('textarea', {\n name: 'textarea',\n className: 'newCommentContent',\n placeholder: 'What are your thoughts...',\n value: newCommentContent })\n ),\n (0, _snabbdomJsx.html)(\n 'button',\n { className: 'add' },\n 'Add comment'\n )\n );\n}\n\n/* \n \n \n See/add comments\n \n */\n\nfunction renderComments(toggled, comments, entity, newCommentContent) {\n var commentDetails = null;\n var commentsList = [];\n\n function bykey(key) {\n // key = Immutable(key)\n return comments.data.filter(function (e) {\n // e.key === key\n var equal = (0, _ramda.equals)(e.key, key);\n return equal;\n });\n }\n\n var iconSvg = '\\n \\n \\n ';\n\n if (toggled) {\n var key = [undefined, undefined]; // at design level ie :no entity selected\n if (entity) {\n key = [entity.id, entity.typeUid];\n }\n\n commentsList = bykey(key);\n commentsList = commentsList.asMutable();\n // console.log('entity', entity, 'key',key,'commentsList',commentsList)\n if (!commentsList) {\n commentsList = [];\n }\n\n commentDetails = (0, _snabbdomJsx.html)(\n 'div',\n { className: 'commentDetails fadesIn visible' },\n (0, _snabbdomJsx.html)(\n 'span',\n null,\n renderCommentsList(commentsList),\n ' ',\n renderCommentCreator(newCommentContent)\n )\n );\n }\n\n return (0, _snabbdomJsx.html)(\n 'div',\n { className: 'comments' },\n (0, _Menu2.default)(toggled, iconSvg, 'commentsToggler', 'comments', 'top'),\n commentDetails\n );\n}\n\nfunction view(state$) {\n return state$.map(function (_ref) {\n var comments = _ref.comments;\n var entity = _ref.entity;\n var toggled = _ref.toggled;\n var newCommentContent = _ref.newCommentContent;\n\n /* let fakeComments = {\n bykey:{}\n }\n fakeComments.bykey[[undefined,undefined]] = [\n {\n text: 'foo bar baz'\n ,author:'DR WhoBrown'}\n ,\n {\n text: 'indeed'\n ,author:'Roborbarbar'}\n ]*/\n\n return renderComments(toggled, comments, entity, newCommentContent);\n });\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/Comments/view.js\n ** module id = 124\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/Comments/view.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"]) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); } }; }();\n\nexports.default = intent;\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nvar _formatters = __webpack_require__(15);\n\nvar _utils = __webpack_require__(3);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar merge = _rx2.default.Observable.merge;\n\n\nfunction isNumber(obj) {\n return !isNaN(parseFloat(obj));\n}\n\nfunction intent(DOM) {\n // const addComment$ = DOM.select('.comments').events('addComment$').pluck('detail')\n\n var changeName$ = merge(DOM.select('.nameInput').events('change'), DOM.select('.nameInput').events('input')).map(function (e) {\n return e.target.value;\n }).distinctUntilChanged().debounce(20).shareReplay(1);\n\n var changeColor$ = merge(DOM.select('.colorInput').events('change'), DOM.select('.colorInput').events('input')).map(function (e) {\n return e.target.value;\n }).distinctUntilChanged().debounce(20).shareReplay(1);\n\n /*const baseStream$ = merge(\n DOM.select('.transformsInput').events('change'),\n DOM.select('.transformsInput').events('blur'),\n DOM.select('.transformsInput').events('input'),\n //special one for scaling\n DOM.select('.transformsInputPercent').events('change'),\n DOM.select('.transformsInputPercent').events('blur'),\n DOM.select('.transformsInputPercent').events('input')\n )\n .map(function (e) {\n let val = parseFloat(e.target.value)\n const attributes = e.target.dataset\n let dtrans = attributes.transform\n let [trans, idx, extra] = dtrans.split('_')\n if (trans === 'rot') { // convert rotated values back from degrees to radians\n val = toRadian(val)\n }\n if(trans === 'sca') {\n if(extra === 'percent'){\n val = val / 100\n console.log('scale',val, extra)\n }\n else{\n return undefined\n }\n }\n if(trans === 'pos') {\n //we are dealing with offsets, NOT absolute positions\n }\n console.log('there', val, idx)\n return {val, trans, idx: parseInt(idx, 10)}\n })\n .filter(exists)\n .filter(data => isNumber(data.val))\n const changeTransforms$ = baseStream$\n .bufferWithCount(2,1)\n .map(function(buffer){\n const [first, second] = buffer\n return {val: second.val - first.val, trans: second.trans, idx: second.idx}\n })\n .merge(baseStream$.take(1))\n .tap(function(acc){\n console.log('changeTransformsDiff',acc)\n })*/\n\n var changeTransforms$ = merge(DOM.select('.transformsInput').events('change'), DOM.select('.transformsInput').events('blur'), DOM.select('.transformsInput').events('input'),\n\n //special one for scaling\n DOM.select('.transformsInputPercent').events('change'), DOM.select('.transformsInputPercent').events('blur'), DOM.select('.transformsInputPercent').events('input')).map(function (e) {\n var val = parseFloat(e.target.value);\n var attributes = e.target.dataset;\n //console.log('attributes', attributes)\n var dtrans = attributes.transform;\n\n var _dtrans$split = dtrans.split('_');\n\n var _dtrans$split2 = _slicedToArray(_dtrans$split, 3);\n\n var trans = _dtrans$split2[0];\n var idx = _dtrans$split2[1];\n var extra = _dtrans$split2[2];\n\n if (trans === 'rot') {\n // convert rotated values back from degrees to radians\n val = (0, _formatters.toRadian)(val);\n }\n\n if (trans === 'sca') {\n if (extra === 'percent') {\n val = val / 100;\n //console.log('scale',val, extra)\n } else {\n return undefined;\n }\n }\n if (trans === 'pos') {}\n //we are dealing with offsets, NOT absolute positions\n\n //console.log('there', val, idx)\n\n return { val: val, trans: trans, idx: parseInt(idx, 10) };\n //return {}\n }).filter(_utils.exists).filter(function (data) {\n return isNumber(data.val);\n }).distinctUntilChanged()\n // .debounce(20)\n .shareReplay(1);\n\n //output[changed.trans][changed.idx] = changed.val\n\n var changeMeta$ = merge(changeName$.map(function (value) {\n return { name: value };\n }), changeColor$.map(function (value) {\n return { color: value };\n }));\n\n var resetScaling$ = DOM.select('.resetScaling').events('click');\n\n return {\n changeMeta$: changeMeta$,\n changeTransforms$: changeTransforms$,\n resetScaling$: resetScaling$\n };\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/EntityInfos/intent.js\n ** module id = 125\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/EntityInfos/intent.js?")},function(module,exports,__webpack_require__){eval('\'use strict\';\n\nObject.defineProperty(exports, "__esModule", {\n value: true\n});\nexports.renderMirroringUi = renderMirroringUi;\nexports.view = view;\n\nvar _snabbdomJsx = __webpack_require__(9);\n\nvar _Menu = __webpack_require__(11);\n\nvar _Menu2 = _interopRequireDefault(_Menu);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar mainIcon = \'\\n \\n mirror\\n Created with Sketch.\\n \\n \\n \\n \\n\';\n\nvar mirrorXIcon = \'\\n \\n mirror-x\\n Created with Sketch.\\n \\n \\n \\n \\n \\n \\n \\n\';\n\nvar mirrorYIcon = \'\\n \\n mirror-y\\n Created with Sketch.\\n \\n \\n \\n \\n \\n \\n \\n\';\n\nvar mirrorZIcon = \'\\n \\n mirror-z\\n Created with Sketch.\\n \\n \\n \\n \\n \\n \\n \\n\';\n\nfunction renderMirroringUi(state) {\n var activeTool = state.settings.activeTool;\n var mirrorModeToggled = activeTool === \'mirror\';\n\n var subTools = (0, _snabbdomJsx.html)(\n \'span\',\n null,\n (0, _Menu2.default)({ icon: mirrorXIcon, klass: \'mirror-x\', tooltip: \'mirror along x axis\', tooltipPos: \'bottom\' }),\n (0, _Menu2.default)({ icon: mirrorYIcon, klass: \'mirror-y\', tooltip: \'mirror along y axis\', tooltipPos: \'bottom\' }),\n (0, _Menu2.default)({ icon: mirrorZIcon, klass: \'mirror-z\', tooltip: \'mirror along z axis\', tooltipPos: \'bottom\' })\n );\n\n return (0, _Menu2.default)({ toggled: mirrorModeToggled, icon: mainIcon, klass: \'toMirrorMode\',\n tooltip: \'mirror\', tooltipPos: \'bottom\', content: subTools, subItems: true });\n}\n\nfunction view(state$) {\n return state$.map(renderMirroringUi);\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/EntityInfos/mirroring.js\n ** module id = 126\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/EntityInfos/mirroring.js?')},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.renderNameAndColorUi = renderNameAndColorUi;\nexports.view = view;\n\nvar _snabbdomJsx = __webpack_require__(9);\n\nvar _Menu = __webpack_require__(11);\n\nvar _Menu2 = _interopRequireDefault(_Menu);\n\nvar _Checkbox = __webpack_require__(20);\n\nvar _Checkbox2 = _interopRequireDefault(_Checkbox);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar icon = '\\n \\n color\\n Created with Sketch.\\n \\n \\n \\n \\n \\n \\n \\n \\n';\n\nfunction renderNameAndColorUi(state) {\n var settings = state.settings;\n var activeTool = settings.activeTool;\n var toggled = activeTool === 'nameAndColor';\n\n var data = state.selections.instIds.reduce(function (acc, id) {\n acc['transforms'].push(state.transforms[id]);\n acc['meta'].push(state.meta[id]);\n return acc;\n }, { transforms: [], meta: [], settings: settings });\n\n var meta = data.meta.length > 0 ? data.meta[0] : data.meta;\n meta = meta || { name: undefined, color: '#FFFFFF' };\n\n var subTools = (0, _snabbdomJsx.html)(\n 'span',\n { className: 'nameAndColorSubTools' },\n (0, _snabbdomJsx.html)(\n 'div',\n { className: 'formGroup' },\n (0, _snabbdomJsx.html)(\n 'span',\n null,\n (0, _snabbdomJsx.html)(\n 'label',\n { htmlfor: 'entityName' },\n ' Name: '\n ),\n (0, _snabbdomJsx.html)(\n 'span',\n { className: 'inputWrapper' },\n (0, _snabbdomJsx.html)('input', { type: 'text', name: 'entityName', value: meta.name, className: 'nameInput', placeholder: 'Type name here...' })\n )\n ),\n (0, _snabbdomJsx.html)(\n 'span',\n null,\n (0, _snabbdomJsx.html)(\n 'label',\n { htmlfor: 'entityColor' },\n ' Color: '\n ),\n (0, _snabbdomJsx.html)(\n 'span',\n { className: 'inputWrapper', style: { 'backgroundColor': meta.color } },\n (0, _snabbdomJsx.html)('input', { type: 'color', name: 'entityColor', value: meta.color, className: 'colorInput' })\n )\n )\n )\n );\n\n return (0, _Menu2.default)({ toggled: toggled, icon: icon, klass: 'toNameAndColorMode',\n tooltip: 'set name & color of part', tooltipPos: 'bottom', content: subTools });\n}\n\nfunction view(state$) {\n return state$.map(renderNameAndColorUi);\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/EntityInfos/nameAndColor.js\n ** module id = 127\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/EntityInfos/nameAndColor.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.renderPositionUi = renderPositionUi;\nexports.view = view;\n\nvar _snabbdomJsx = __webpack_require__(9);\n\nvar _Menu = __webpack_require__(11);\n\nvar _Menu2 = _interopRequireDefault(_Menu);\n\nvar _Checkbox = __webpack_require__(20);\n\nvar _Checkbox2 = _interopRequireDefault(_Checkbox);\n\nvar _helpers = __webpack_require__(46);\n\nvar _ramda = __webpack_require__(4);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar icon = '\\n \\n move\\n Created with Sketch.\\n \\n \\n \\n \\n';\n\nfunction renderPositionUi(state) {\n var settings = state.settings;\n var activeTool = settings.activeTool;\n var toggled = activeTool === 'translate';\n\n var transformStep = 0.1;\n var precision = 2;\n\n var data = state.selections.instIds.reduce(function (acc, id) {\n acc['transforms'].push(state.transforms[id]);\n acc['meta'].push(state.meta[id]);\n acc['ids'].push(id);\n return acc;\n }, { transforms: [], meta: [], settings: settings, ids: [] });\n\n var transforms = data.transforms;\n var ids = data.ids;\n\n if (transforms.length > 0) transforms = transforms[0];\n\n // compute the average position\n var avg = (0, _ramda.pluck)('pos')(data.transforms).reduce(function (acc, cur) {\n if (!acc) return cur;\n return [acc[0] + cur[0], acc[1] + cur[1], acc[2] + cur[2]].map(function (x) {\n return x * 0.5;\n });\n }, undefined);\n\n var values = avg || [0, 0, 0];\n\n var subTools = (0, _snabbdomJsx.html)(\n 'span',\n { className: 'movingSubTools' },\n (0, _snabbdomJsx.html)(\n 'div',\n { className: 'transformsGroup' },\n (0, _helpers.transformInputs)({ fieldName: 'pos', unit: '', step: transformStep, values: values, precision: precision })\n ),\n (0, _snabbdomJsx.html)(\n 'div',\n { className: 'optionsGroup' },\n (0, _snabbdomJsx.html)(\n 'label',\n { className: 'menuContent' },\n (0, _Checkbox2.default)({ id: 'snapTranslation', className: 'snapTranslation', checked: state.settings.snapRotation }),\n 'snap translation'\n )\n )\n );\n\n return (0, _Menu2.default)({ toggled: toggled, icon: icon, klass: 'toTranslateMode',\n tooltip: 'move', tooltipPos: 'bottom', content: subTools });\n}\n\nfunction view(state$) {\n return state$.map(renderPositionUi);\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/EntityInfos/position.js\n ** module id = 128\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/EntityInfos/position.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.renderRotationUi = renderRotationUi;\nexports.view = view;\n\nvar _snabbdomJsx = __webpack_require__(9);\n\nvar _Menu = __webpack_require__(11);\n\nvar _Menu2 = _interopRequireDefault(_Menu);\n\nvar _Checkbox = __webpack_require__(20);\n\nvar _Checkbox2 = _interopRequireDefault(_Checkbox);\n\nvar _helpers = __webpack_require__(46);\n\nvar _formatters = __webpack_require__(15);\n\nvar _ramda = __webpack_require__(4);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar icon = '\\n \\n rotate\\n Created with Sketch.\\n \\n \\n \\n \\n';\n\nfunction renderRotationUi(state) {\n var settings = state.settings;\n var activeTool = state.settings.activeTool;\n var toggled = activeTool === 'rotate';\n\n var snapDefaults = 10; // snap rotation snaps to tens of degrees\n var transformStep = settings.snapRotation ? snapDefaults : 0.5;\n var precision = 2;\n\n var data = state.selections.instIds.reduce(function (acc, id) {\n acc['transforms'].push(state.transforms[id]);\n acc['meta'].push(state.meta[id]);\n return acc;\n }, { transforms: [], meta: [], settings: settings });\n\n var transforms = data.transforms;\n\n if (transforms.length > 0) transforms = transforms[0];\n\n // compute the average rotation\n var avg = (0, _ramda.pluck)('rot')(data.transforms).reduce(function (acc, cur) {\n if (!acc) return cur;\n return [acc[0] + cur[0], acc[1] + cur[1], acc[2] + cur[2]].map(function (x) {\n return x * 0.5;\n });\n }, undefined);\n\n var values = (avg || [0, 0, 0]).map(_formatters.toDegree); // convert to degrees\n\n var subTools = (0, _snabbdomJsx.html)(\n 'span',\n { className: 'rotationSubTools' },\n (0, _snabbdomJsx.html)(\n 'div',\n { className: 'transformsGroup' },\n (0, _helpers.transformInputs)({ fieldName: 'rot', unit: 'deg', step: transformStep, values: values, precision: precision })\n ),\n (0, _snabbdomJsx.html)(\n 'div',\n { className: 'optionsGroup' },\n (0, _snabbdomJsx.html)(\n 'label',\n { className: 'menuContent' },\n (0, _Checkbox2.default)({ id: 'snapRotation', className: 'snapRotation', checked: state.settings.snapRotation }),\n 'snap rotation'\n )\n )\n );\n\n return (0, _Menu2.default)({ toggled: toggled, icon: icon, klass: 'toRotateMode',\n tooltip: 'rotate', tooltipPos: 'bottom', content: subTools });\n}\n\nfunction view(state$) {\n return state$.map(renderRotationUi);\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/EntityInfos/rotation.js\n ** module id = 129\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/EntityInfos/rotation.js?"); },function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.renderScaleUi = renderScaleUi;\nexports.view = view;\n\nvar _snabbdomJsx = __webpack_require__(9);\n\nvar _Menu = __webpack_require__(11);\n\nvar _Menu2 = _interopRequireDefault(_Menu);\n\nvar _Checkbox = __webpack_require__(20);\n\nvar _Checkbox2 = _interopRequireDefault(_Checkbox);\n\nvar _helpers = __webpack_require__(46);\n\nvar _formatters = __webpack_require__(15);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar icon = '\\n \\n scale\\n Created with Sketch.\\n \\n \\n \\n \\n';\n\nfunction renderScaleUi(state) {\n var settings = state.settings;\n var activeTool = settings.activeTool;\n var toggled = activeTool === 'scale';\n\n var snapDefaults = 0.1; // snap scaling snaps to tens of percentages\n var transformStep = settings.snapScaling ? snapDefaults : 0.1;\n var precision = 2;\n var min = 0.01;\n\n var data = state.selections.instIds.reduce(function (acc, id) {\n acc['transforms'].push(state.transforms[id]);\n acc['meta'].push(state.meta[id]);\n acc['bounds'].push(state.meshes[id]);\n return acc;\n }, { transforms: [], meta: [], bounds: [], settings: settings }); // FIXME: should be based on bounds component, not meshes\n\n var transforms = data.transforms;\n var bounds = data.bounds;\n\n if (transforms.length > 0) transforms = transforms[0];\n if (bounds.length >= 0) {\n if (bounds.length > 0) {\n bounds = bounds[0];\n }\n try {\n var bbox = bounds.geometry.boundingBox;\n var bsph = bounds.geometry.boundingSphere;\n bounds = {\n dia: bounds.geometry.boundingSphere.radius * 2,\n center: bounds.geometry.boundingSphere.center.toArray(),\n min: bounds.geometry.boundingBox.min.toArray(),\n max: bounds.geometry.boundingBox.max.toArray()\n };\n bounds.size = [bounds.max[0] - bounds.min[0], bounds.max[1] - bounds.min[1], bounds.max[2] - bounds.min[2]];\n //bound.size = bound.size.map((x, index) => x * transforms.sca[index])\n } catch (error) {}\n }\n\n var valuePercents = (transforms.sca || [0, 0, 0]).map(function (x) {\n return x * 100;\n });\n var values = (bounds.size || [0, 0, 0]).map(function (x, index) {\n return x * valuePercents[index] / 100;\n });\n\n var subTools = (0, _snabbdomJsx.html)(\n 'span',\n { className: 'scalingSubTools twoColumns' },\n (0, _snabbdomJsx.html)(\n 'div',\n { className: 'transformsGroup' },\n (0, _helpers.transformInputs)({ fieldName: 'sca', showPercents: true, step: transformStep, values: values, valuePercents: valuePercents, precision: precision, min: min,\n disabled: true })\n ),\n (0, _snabbdomJsx.html)(\n 'div',\n { className: 'optionsGroup' },\n (0, _snabbdomJsx.html)(\n 'label',\n { className: 'menuContent' },\n (0, _Checkbox2.default)({ id: 'snapScaling', className: 'snapScaling', checked: state.settings.snapScaling }),\n 'snap scaling'\n ),\n (0, _snabbdomJsx.html)(\n 'label',\n { className: 'menuContent' },\n (0, _Checkbox2.default)({ id: 'uniformScaling', className: 'uniformScaling', checked: state.settings.uniformScaling }),\n 'uniform scaling'\n )\n ),\n (0, _snabbdomJsx.html)(\n 'div',\n { className: 'defaultsGroup' },\n (0, _snabbdomJsx.html)(\n 'label',\n { className: 'resetScaling' },\n (0, _snabbdomJsx.html)(\n 'a',\n { className: 'textLink' },\n 'Reset Scaling'\n )\n )\n )\n );\n\n return (0, _Menu2.default)({ toggled: toggled, icon: icon, klass: 'toScaleMode',\n tooltip: 'scale', tooltipPos: 'bottom', content: subTools });\n}\n\nfunction view(state$) {\n return state$.map(renderScaleUi);\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/EntityInfos/scale.js\n ** module id = 130\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/EntityInfos/scale.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol ? \"symbol\" : typeof obj; };\n\nexports.default = view;\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nvar _snabbdomJsx = __webpack_require__(9);\n\nvar _formatters = __webpack_require__(15);\n\nvar _utils = __webpack_require__(3);\n\nvar _assign = __webpack_require__(7);\n\nvar _assign2 = _interopRequireDefault(_assign);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n__webpack_require__(330);\nvar just = _rx2.default.Observable.just;\n// //////\n\n// faster object.assign\n\nfunction absSizeInput(entity, controlsStep, numberPrecision, changeHandler) {\n /* display / control object transforms: posistion,rotation,scale etc\n in doubt about change handler\n onChange={self.handleChange.bind(self,'pos',index)}\n onChange={self.handleSizeChange.bind(self,index)}\n */\n\n // TODO : do the 'safing' of values better( no divisions by zero, nothing under 0 )\n /* var minScale = 0.0001\n if(!value) return minScale\n if(value <= 0) value = minScale\n //var foo = this.meshSize[axis]\n var map = {'l':'x','w':'y','h':'z'}\n var mapped = map[axis]\n var axisScale = this.selectedObject.scale[ mapped ]\n if( axisScale <= minScale ) axisScale = minScale\n var scaling = 1/ axisScale\n var meshSize = this.meshSize[axis]\n if(meshSize <= minScale) meshSize = minScale\n var originalSize = meshSize * scaling\n var targetScale = value/(originalSize)\n if(targetScale <= minScale) targetScale = minScale\n if(this.meshSize[axis] <= minScale) this.meshSize[axis] = minScale\n this.selectedObject.scale[mapped] = targetScale\n return targetScale\n absSize = originalSize * scale\n scale =\n */\n\n if (entity && entity['sca']) {\n var _ret = function () {\n // this one is for absolute sizing\n\n var innerChangeHandler = function innerChangeHandler(fieldName, index, absSize, event) {\n var value = event.target.value;\n var originalValue = absSize[index];\n var scaleChange = value / originalValue;\n // console.log('changeHandler for absSize fieldName',fieldName,'index',index,'value',value,'originalValue',originalValue ,'absSize', absSize )\n console.log('value', value, 'originalValue', originalValue, scaleChange);\n\n changeHandler('sca', index, { target: { value: value } });\n };\n\n var absSizeInputs = [];\n if (entity.bbox) {\n var absSize = (0, _formatters.absSizeFromBBox)(entity.bbox);\n absSize = absSize || { w: 0, l: 0, h: 0 };\n // convert to array to keep logic the same for all fields\n absSize = [absSize.l, absSize.w, absSize.h];\n // onChange={innerChangeHandler.bind(null,'absSize',index ,absSize)}\n\n absSize.forEach(function (entry, index) {\n entry = (0, _formatters.formatNumberTo)(entry, numberPrecision);\n absSizeInputs.push((0, _snabbdomJsx.html)('input', {\n type: 'number',\n value: entry,\n step: controlsStep,\n onChange: changeHandler.bind(null, 'absSize', index) }));\n });\n }\n\n return {\n v: (0, _snabbdomJsx.html)(\n 'span',\n null,\n (0, _snabbdomJsx.html)(\n 'span',\n null,\n 'D:'\n ),\n absSizeInputs\n )\n };\n }();\n\n if ((typeof _ret === 'undefined' ? 'undefined' : _typeof(_ret)) === \"object\") return _ret.v;\n }\n}\n\nfunction nameInput(meta) {\n if (meta && 'name' in meta) {\n var name = meta.name;\n if ((0, _utils.isEmpty)(name)) {\n name = undefined;\n }\n return (0, _snabbdomJsx.html)(\n 'span',\n { className: 'inputWrapper' },\n (0, _snabbdomJsx.html)('input', {\n type: 'text',\n value: name,\n placeholder: 'Type name here...',\n className: 'nameInput' })\n );\n }\n}\n\nfunction colorInput(meta) {\n if (meta && 'color' in meta) {\n return (0, _snabbdomJsx.html)(\n 'span',\n null,\n (0, _snabbdomJsx.html)('input', { type: 'color', value: meta.color, className: 'colorInput' })\n );\n }\n}\n\n// TODO : this is a duplicate, refactor\nvar translateIconSvg = '\\n \\n';\n\nvar rotateIconSvg = '\\n \\n';\n\nvar scaleIconSvg = '\\n \\n Untitled\\n Created with Sketch.\\n \\n \\n \\n \\n';\n\nfunction transformInputs(transforms, fieldName, displayName, controlsStep, numberPrecision) {\n var inputs = [];\n var iconsPerTransform = {\n 'pos': translateIconSvg,\n 'rot': rotateIconSvg,\n 'sca': scaleIconSvg\n };\n if (transforms && transforms[fieldName]) {\n transforms[fieldName].slice(0, 3) // we only want x,y,z values, nothing else\n .forEach(function (value, index) {\n if (fieldName === 'rot') // convert rotation information to degree\n {\n value = (0, _formatters.toDegree)(value);\n }\n value = (0, _formatters.formatNumberTo)(value, numberPrecision);\n inputs.push((0, _snabbdomJsx.html)('input', {\n type: 'number',\n lang: 'en',\n value: value,\n step: controlsStep,\n className: 'transformsInput',\n attributes: { 'data-transform': fieldName + '_' + index } }));\n });\n\n var iconSvg = iconsPerTransform[fieldName];\n return (0, _snabbdomJsx.html)(\n 'span',\n { className: 'transformInput' },\n (0, _snabbdomJsx.html)(\n 'span',\n { innerHTML: iconSvg },\n displayName\n ),\n inputs\n );\n }\n}\n\nfunction getControlStep(transformType, settings) {\n // , snapping) {\n var snapScaling = settings.snapScaling;\n var snapRotation = settings.snapRotation; // please replace this with actual settings\n\n var snapDefaults = {\n rot: 10, // snap rotation snaps to tens of degrees\n sca: 0.1 // snap scaling snaps to tens of percentages\n };\n\n var rotateStep = settings.snapRotation ? snapDefaults.rot : 0.5;\n var scaleStep = settings.snapScaling ? snapDefaults.sca : 0.01;\n\n switch (transformType) {\n case 'pos':\n return 0.1;\n case 'rot':\n return rotateStep;\n break;\n case 'sca':\n return scaleStep;\n break;\n default:\n return 0.4;\n }\n}\n\nfunction view(state$, colorPicker) {\n var numberPrecision = 2;\n\n // {colorPicker}\n return state$.map(function (state) {\n var meta = state.meta;\n var transforms = state.transforms;\n var settings = state.settings;\n\n\n if (!meta || !transforms || !settings) {\n return undefined;\n }\n if (transforms.length > 0) transforms = transforms[0];\n if (meta.length > 0) meta = meta[0];\n\n // console.log('meta,transforms',meta,transforms)\n\n return '';\n\n var res = (0, _snabbdomJsx.html)(\n 'div',\n { className: 'toolBarBottom entityInfos' },\n colorInput(meta),\n nameInput(meta),\n transformInputs(transforms, 'pos', undefined, getControlStep('pos', settings), numberPrecision),\n transformInputs(transforms, 'rot', undefined, getControlStep('rot', settings), numberPrecision),\n transformInputs(transforms, 'sca', undefined, getControlStep('sca', settings), numberPrecision)\n );\n });\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/EntityInfos/view.js\n ** module id = 131\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/EntityInfos/view.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = intent;\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar fromEvent = _rx2.default.Observable.fromEvent;\n\nfunction intent(DOM) {\n // any outside taps close the settings\n var outsideTaps$ = fromEvent(window, 'click').map(function (e) {\n return e.target;\n }).map(function (target) {\n return document.querySelector('.settings').contains(target);\n }).filter(function (x) {\n return x === false;\n }); // we only care if it was clicked outside, not in\n\n var toggle$ = DOM.select('.settingsToggler').events('click').map(true).scan(function (acc, val) {\n return !acc;\n }).merge(outsideTaps$).takeUntil(outsideTaps$).repeat();\n\n return {\n toggle$: toggle$\n };\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/Settings/intent.js\n ** module id = 132\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/Settings/intent.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = model;\n\nvar _obsUtils = __webpack_require__(5);\n\nfunction model(props$, actions) {\n var settings$ = props$.pluck('settings');\n var schema$ = props$.pluck('schema').startWith({});\n\n var toggled$ = actions.toggle$.startWith(false);\n\n return (0, _obsUtils.combineLatestObj)({ settings$: settings$, toggled$: toggled$ });\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/Settings/model.js\n ** module id = 133\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/Settings/model.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = view;\n\nvar _snabbdomJsx = __webpack_require__(9);\n\nvar _classnames = __webpack_require__(34);\n\nvar _classnames2 = _interopRequireDefault(_classnames);\n\nvar _Menu = __webpack_require__(11);\n\nvar _Menu2 = _interopRequireDefault(_Menu);\n\nvar _Checkbox = __webpack_require__(20);\n\nvar _Checkbox2 = _interopRequireDefault(_Checkbox);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n__webpack_require__(331);\n\nfunction view(state$) {\n return state$.map(function (_ref) {\n var settings = _ref.settings;\n var toggled = _ref.toggled;\n\n var fields = void 0;\n var showGrid = settings.grid.show;\n // let showAnnot = settings.annotations.show\n var autoRotate = settings.camera.autoRotate;\n\n fields = (0, _snabbdomJsx.html)(\n 'div',\n { className: 'settingsView' },\n (0, _snabbdomJsx.html)(\n 'section',\n { className: 'settingEntry' },\n (0, _Checkbox2.default)({ id: 'showGrid', className: 'showGrid', checked: showGrid }),\n (0, _snabbdomJsx.html)(\n 'label',\n { htmlFor: 'showGrid' },\n 'Show grid'\n )\n ),\n (0, _snabbdomJsx.html)(\n 'section',\n { className: 'settingEntry' },\n (0, _Checkbox2.default)({ id: 'autoRotate', className: 'autoRotate', checked: autoRotate }),\n (0, _snabbdomJsx.html)(\n 'label',\n { htmlFor: 'autoRotate' },\n 'Auto rotate camera'\n )\n )\n );\n\n var content = (0, _snabbdomJsx.html)(\n 'section',\n { className: (0, _classnames2.default)('content', { toggled: toggled }) },\n fields\n );\n\n var icon = '\\n \\n settings\\n Created with Sketch.\\n \\n \\n \\n \\n \\n \\n \\n';\n\n return (0, _snabbdomJsx.html)(\n 'div',\n { className: 'settings' },\n (0, _Menu2.default)({ toggled: toggled, icon: icon, klass: 'containerToggler settingsToggler', tooltip: 'settings', tooltipPos: 'top',\n content: content, contentPosition: 'top', arrow: false\n })\n );\n });\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/Settings/view.js\n ** module id = 134\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/Settings/view.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = formatDataForFileStorage;\n\nvar _ramda = __webpack_require__(4);\n\nvar _utils = __webpack_require__(3);\n\nfunction formatDataForFileStorage(_ref, bom) {\n var sources = _ref.sources;\n var state$ = _ref.state$;\n\n var fieldNames = ['part_uuid', 'name', 'qty', 'phys_qty', 'unit', 'printable']; // , 'version' ]\n var mapping = {\n 'id': 'part_uuid'\n };\n\n function formatBomAsPlainText(data) {\n var result = // 'Bill Of Materials:\\n' +\n data.map(function (entry) {\n var phys_qty = entry.phys_qty > 0 ? entry.phys_qty + ' ' : '';\n var unit = entry.unit === 'EA' ? '' : entry.unit + ' ';\n return '- ' + entry.qty + ' X ' + phys_qty + unit + entry.name + ' (Part Id : ' + entry.part_uuid + ')';\n }).join('\\r');\n\n return result;\n }\n\n var bomJsonOutput$ = bom.fileStorage.exportBOMAsJson$.withLatestFrom(state$.pluck('bom'), function (_, bom) {\n return bom;\n }).map(function (bom) {\n return bom.map(function (entry) {\n return (0, _ramda.pick)(fieldNames, (0, _utils.remapJson)(mapping, entry));\n });\n }).map(JSON.stringify).map(function (bom) {\n return { data: bom, type: 'json', name: 'bom.json' };\n });\n\n var bomTextOutput$ = bom.fileStorage.exportBOMAsText$.withLatestFrom(state$.pluck('bom'), function (_, bom) {\n return bom;\n }).map(function (bom) {\n return bom.map(function (entry) {\n return (0, _ramda.pick)(fieldNames, (0, _utils.remapJson)(mapping, entry));\n });\n }).map(formatBomAsPlainText).map(function (bom) {\n return { data: bom, type: 'text', name: 'bom.md' };\n });\n\n return bomJsonOutput$.merge(bomTextOutput$);\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/main/dataFormating/formatDataForFileStorage.js\n ** module id = 135\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/main/dataFormating/formatDataForFileStorage.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = formatDataForLocalStorage;\n\nvar _ramda = __webpack_require__(4);\n\nfunction formatDataForLocalStorage(_ref) {\n var sources = _ref.sources;\n var state$ = _ref.state$;\n\n return state$ // output to localStorage\n .pluck('settings') // in this case, settings\n .map(function (settings) {\n return (0, _ramda.omit)(['autoSave', 'autoLoad', 'toolSets'], settings); // here put any settings that should NOT be saved\n }).map(function (s) {\n return { 'jam!-settings': JSON.stringify(s) };\n });\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/main/dataFormating/formatDataForLocalStorage.js\n ** module id = 136\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/main/dataFormating/formatDataForLocalStorage.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = formatDataForYMStorage;\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nvar _ramda = __webpack_require__(4);\n\nvar _utils = __webpack_require__(3);\n\nvar _obsUtils = __webpack_require__(5);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar _Rx$Observable = _rx2.default.Observable;\nvar merge = _Rx$Observable.merge;\nvar just = _Rx$Observable.just;\nfunction formatDataForYMStorage(_ref) {\n var sources = _ref.sources;\n var state$ = _ref.state$;\n\n var apiEndpoint$ = sources.addressbar.get('apiEndpoint').map(_ramda.head).filter(_utils.exists).shareReplay(1);\n\n // this are responses from ym\n var waitForLoadNeeded$ = state$.pluck('settings', 'autoLoad') // do we need to wait for data to be loaded?\n .map(function (data) {\n return !data;\n });\n\n var loadAllDone$ = sources.ym.data.filter(function (res$) {\n return res$.request.type === 'ymLoad';\n }) // handle errors etc\n .flatMap(function (data) {\n var responseWrapper$ = data.catch(function (e) {\n console.log('caught error in loading data', e);\n return _rx2.default.Observable.empty();\n });\n var request$ = just(data.request);\n var response$ = responseWrapper$.pluck('response');\n return (0, _obsUtils.combineLatestObj)({ response$: response$, request$: request$ }); // .materialize()//FIXME: still do not get this one\n }).scan(function (acc, data) {\n acc.push(data.request.typeDetail);\n return acc;\n }, []).map(function (data) {\n // TODO: we need a way to check what the design actually has\n // we recieved all 3 types of data, we are gold !\n return (0, _ramda.contains)('parts', data) && (0, _ramda.contains)('bom', data) && (0, _ramda.contains)('assemblyEntries', data);\n }).merge(waitForLoadNeeded$) // here we combine with autoLoad/autoSave settings : if autoLoad is false but autoSave is true, just save\n .filter(function (d) {\n return d === true;\n }).tap(function (e) {\n return console.log('loading done, we got it all');\n });\n\n var designExists$ = sources.ym.data.tap(function (e) {\n return console.log('responses from ym', e);\n }).filter(function (res) {\n return res.request.method === 'get' && res.request.type === 'ymLoad' && res.request.typeDetail === 'designExists';\n }).flatMap(function (data) {\n return data.catch(function (_) {\n return just({ error: true });\n });\n }) // flag errors\n .filter(function (e) {\n return !e.progress;\n }) // filter out progress data\n .map(function (data) {\n return data.error ? false : true;\n }); // if we have an error return false, true otherwise\n // .forEach(e=>console.log(\"designExists: \",e))\n\n // OUTPUT to ym\n var bomToYm = state$.pluck('bom');\n var entityMetaToYm = state$.pluck('meta');\n var entityTransformsToYm = state$.pluck('transforms');\n var entitymeshesToYm = state$.pluck('meshes');\n var parts = state$.pluck('types');\n var design = state$.pluck('design');\n var authData = state$.pluck('authData');\n var assembly = state$.pluck('assembly');\n\n // send simple query to determine if design already exists\n var queryDesignExists$ = (0, _obsUtils.combineLatestObj)({ design: design, authData: authData, apiEndpoint$: apiEndpoint$ }).filter(function (data) {\n return data.design.synched;\n }) // data.authData.token !== undefined && only try to save anything when the design is in \"synch mode\" aka has a ur\n .map(function (data) {\n return { data: data, query: 'designExists' };\n }).take(1);\n\n // saving should NOT take place before load is complete IFAND ONLY IF , we are reloading a design\n var saveDesigntoYm$ = state$.filter(function (state) {\n return state.settings.autoSave === true;\n }) // do not save anything if not in save mode\n .filter(function (state) {\n return state.design.synched;\n }) // && state.authData.token !== undefined only try to save anything when the design is in \"synch mode\" aka has a ur\n .skipUntil(loadAllDone$)\n //.tap(e => console.log('we are all done loading so SAVE', e))\n .flatMap(function (_) {\n return (0, _obsUtils.combineLatestObj)({\n bom: bomToYm,\n parts: parts,\n eMetas: entityMetaToYm,\n eTrans: entityTransformsToYm,\n eMeshs: entitymeshesToYm,\n design: design,\n authData: authData,\n assembly: assembly,\n\n apiEndpoint$: apiEndpoint$ });\n }).map(function (data) {\n return { method: 'save', data: data, type: 'design' };\n }).distinctUntilChanged(null, _ramda.equals);\n\n // if the design exists, load data, otherwise...whataver\n var loadDesignFromYm$ = designExists$ // actions.loadDesign\n .withLatestFrom(state$.pluck('settings', 'autoLoad'), function (designExists, autoLoad) {\n return designExists && autoLoad;\n }).filter(function (e) {\n return e === true;\n }) // filter out non existing designs (we cannot load those , duh')\n .flatMap(function (_) {\n return (0, _obsUtils.combineLatestObj)({ design: design, authData: authData, apiEndpoint$: apiEndpoint$ });\n }) // we inject design & authData\n .map(function (data) {\n return { method: 'load', data: data, type: 'design' };\n }) // create our query/request\n .throttle(5).distinctUntilChanged(null, _ramda.equals).take(1).tap(function (e) {\n return console.log('loadDesignFromYm', e);\n });\n\n var ymStorage$ = merge(queryDesignExists$, saveDesigntoYm$, loadDesignFromYm$).distinctUntilChanged(null, _ramda.equals);\n\n return ymStorage$;\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/main/dataFormating/formatDataForYMStorage.js\n ** module id = 137\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/main/dataFormating/formatDataForYMStorage.js?"); },function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = intent;\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nvar _ramda = __webpack_require__(4);\n\nvar _modelUtils = __webpack_require__(6);\n\nvar _keyboard = __webpack_require__(73);\n\nvar _intents = __webpack_require__(167);\n\nvar _intents2 = _interopRequireDefault(_intents);\n\nvar _intents3 = __webpack_require__(181);\n\nvar _intents4 = _interopRequireDefault(_intents3);\n\nvar _intents5 = __webpack_require__(170);\n\nvar _intents6 = _interopRequireDefault(_intents5);\n\nvar _intents7 = __webpack_require__(194);\n\nvar _intents8 = _interopRequireDefault(_intents7);\n\nvar _intents9 = __webpack_require__(205);\n\nvar _intents10 = _interopRequireDefault(_intents9);\n\nvar _intents11 = __webpack_require__(176);\n\nvar _intents12 = _interopRequireDefault(_intents11);\n\nvar _assetManager = __webpack_require__(218);\n\nvar _assetRequests = __webpack_require__(219);\n\nvar _assetRequests2 = _interopRequireDefault(_assetRequests);\n\nvar _utils = __webpack_require__(21);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction intent(sources) {\n // disable backspace navigation for MacOs\n (0, _keyboard.preventBackNavigation)();\n\n // FIXME: damned relative paths ! actual path (relative to THIS module) is '../../core/sources/' , relative to the loader it is '.'\n var refinedSourceData$ = (0, _utils.normalizeData)((0, _utils.extractDataFromRawSources)(sources, '.')); // q.tap(e=>console.log(\"foo\",e))\n // .tap(e=>console.log(\"refinedSourceData$\",e))\n\n // const actions = actionsFromSources(sources, path.resolve(__dirname,'./actions')+'/' )\n var _resources = (0, _assetManager.resources)(sources);\n // special case for gcode etc\n var visualResources$ = _resources.parsed$.filter(function (e) {\n return e.progress === 1;\n }).pluck('data').filter(function (data) {\n return !(0, _ramda.has)('meshOnly', data);\n });\n\n // we also require resources as a source\n sources = (0, _modelUtils.mergeData)(sources, { resources: _resources });\n\n // design\n var designActions = (0, _intents4.default)(sources);\n // entities\n var entityActions = (0, _intents8.default)(sources);\n // settings\n var settingActions = (0, _intents10.default)(sources);\n // auth\n var authActions = (0, _intents6.default)(sources);\n // comments\n var commentActions = (0, _intents12.default)(sources);\n\n // API\n var apiActions = (0, _intents2.default)(sources);\n\n // OUTbound requests to various sources\n var requests = (0, _assetRequests2.default)(refinedSourceData$);\n requests.desktop$ = requests.desktop$.merge(entityActions.desktopRequests$);\n requests.http$ = requests.http$.merge(entityActions.requests$);\n\n return {\n settingActions: settingActions,\n // ,selectionActions\n designActions: designActions,\n authActions: authActions,\n entityActions: entityActions,\n commentActions: commentActions,\n annotationsActions: { creationStep$: _rx2.default.Observable.never() },\n apiActions: apiActions,\n progress: _resources,\n requests: requests,\n\n visualResources: visualResources$\n };\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/main/intent.js\n ** module id = 138\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/main/intent.js?")},function(module,exports,__webpack_require__){eval('\'use strict\';\n\nObject.defineProperty(exports, "__esModule", {\n value: true\n});\nexports.renderMeasurementsUi = renderMeasurementsUi;\nexports.view = view;\n\nvar _snabbdomJsx = __webpack_require__(9);\n\nvar _Menu = __webpack_require__(11);\n\nvar _Menu2 = _interopRequireDefault(_Menu);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar mainIcon = \'\\n \\n measurement\\n Created with Sketch.\\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n\';\n\nvar addNoteIcon = \'\\n\\n\';\n\nvar measureDistanceIcon = \'\\n \\n ruler\\n Created with Sketch.\\n \\n \\n \\n \\n\';\n\nvar measureThicknessIcon = \'\\n \\n thickness\\n Created with Sketch.\\n \\n \\n \\n \\n\';\n\nvar measureDiameterIcon = \'\\n \\n diameter\\n Created with Sketch.\\n \\n \\n \\n \\n \\n \\n \\n\';\n\nvar measureAngleIcon = \'\\n Untitled\\n Created with Sketch.\\n \\n \\n \\n \\n\';\n\n/*
\n {Menu({toggled: activeTool === \'addNote\', icon: addNoteIconSvg, klass: \'addNote\',\n tooltip: \'add note\', tooltipPos: \'bottom\'})}\n\n {Menu({toggled: activeTool === \'measureDistance\', icon: measureDistanceIconSvg, klass: \'measureDistance\',\n tooltip: \'measure distance\', tooltipPos: \'bottom\'})}\n\n {Menu({toggled: activeTool === \'measureThickness\', icon: measureThicknessIconSvg, klass: \'measureThickness\',\n tooltip: \'measure thickness\', tooltipPos: \'bottom\'})}\n\n {Menu({toggled: activeTool === \'measureDiameter\', icon: measureDiameterIconSvg, klass: \'measureDiameter\',\n tooltip: \'measure diameter\', tooltipPos: \'bottom\'})}\n\n {Menu({toggled: activeTool === \'measureAngle\', icon: measureAngleIconSvg, klass: \'measureAngle\',\n tooltip: \'measure angle\', tooltipPos: \'bottom\'})}*/\n\nfunction renderMeasurementsUi(state) {\n var activeTool = state.settings.activeTool;\n var toggled = activeTool === \'measure\';\n\n /*{Menu({toggled: activeTool === \'addNote\', icon: addNoteIconSvg, klass: \'addNote\',\n tooltip: \'add note\', tooltipPos: \'bottom\'})}*/\n var subTools = (0, _snabbdomJsx.html)(\n \'span\',\n null,\n (0, _Menu2.default)({ toggled: activeTool === \'measureDistance\', icon: measureDistanceIcon, klass: \'measureDistance\',\n tooltip: \'measure distance\', tooltipPos: \'bottom\' }),\n (0, _Menu2.default)({ toggled: activeTool === \'measureThickness\', icon: measureThicknessIcon, klass: \'measureThickness\',\n tooltip: \'measure thickness\', tooltipPos: \'bottom\' }),\n (0, _Menu2.default)({ toggled: activeTool === \'measureDiameter\', icon: measureDiameterIcon, klass: \'measureDiameter\',\n tooltip: \'measure diameter\', tooltipPos: \'bottom\' }),\n (0, _Menu2.default)({ toggled: activeTool === \'measureAngle\', icon: measureAngleIcon, klass: \'measureAngle\',\n tooltip: \'measure angle\', tooltipPos: \'bottom\' })\n );\n\n return (0, _Menu2.default)({ toggled: toggled, icon: mainIcon, klass: \'toMeasureMode\',\n tooltip: \'measure & annotate\', tooltipPos: \'bottom\', content: subTools, subItems: true });\n}\n\nfunction view(state$) {\n return state$.map(renderMeasurementsUi);\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/main/measurements.js\n ** module id = 139\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/main/measurements.js?')},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = model;\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nvar _obsUtils = __webpack_require__(5);\n\nvar _utils = __webpack_require__(3);\n\nvar _meta = __webpack_require__(191);\n\nvar _transforms = __webpack_require__(192);\n\nvar _mesh = __webpack_require__(190);\n\nvar _bounds = __webpack_require__(189);\n\nvar _annotations = __webpack_require__(187);\n\nvar _utils2 = __webpack_require__(197);\n\nvar _intents = __webpack_require__(199);\n\nvar _intents2 = _interopRequireDefault(_intents);\n\nvar _design = __webpack_require__(180);\n\nvar _design2 = _interopRequireDefault(_design);\n\nvar _auth = __webpack_require__(169);\n\nvar _auth2 = _interopRequireDefault(_auth);\n\nvar _settings = __webpack_require__(206);\n\nvar _settings2 = _interopRequireDefault(_settings);\n\nvar _comments = __webpack_require__(175);\n\nvar _comments2 = _interopRequireDefault(_comments);\n\nvar _selections = __webpack_require__(200);\n\nvar _selections2 = _interopRequireDefault(_selections);\n\nvar _types = __webpack_require__(196);\n\nvar _types2 = _interopRequireDefault(_types);\n\nvar _assemblies = __webpack_require__(188);\n\nvar _assemblies2 = _interopRequireDefault(_assemblies);\n\nvar _typeInstanceMapping = __webpack_require__(195);\n\nvar _typeInstanceMapping2 = _interopRequireDefault(_typeInstanceMapping);\n\nvar _entitiesExtra2 = __webpack_require__(193);\n\nvar _entitiesExtra3 = _interopRequireDefault(_entitiesExtra2);\n\nvar _index = __webpack_require__(118);\n\nvar _index2 = _interopRequireDefault(_index);\n\nvar _intents3 = __webpack_require__(173);\n\nvar _intents4 = _interopRequireDefault(_intents3);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n// entity components\nfunction model(props$, actions, sources) {\n var entityActions = actions.entityActions;\n\n var design$ = (0, _design2.default)(actions.designActions);\n var authData$ = (0, _auth2.default)(actions.authActions); // authentification data, if any\n var settings$ = (0, _settings2.default)(actions.settingActions);\n\n var types$ = (0, _types2.default)(actions.entityActions);\n var assembly$ = (0, _assemblies2.default)(actions.entityActions).pluck('currentAssembly');\n var comments$ = (0, _comments2.default)(actions.commentActions);\n\n var _entitiesExtra = (0, _entitiesExtra3.default)(actions, types$, assembly$);\n\n var createMeshComponents$ = _entitiesExtra.createMeshComponents$;\n var componentBase$ = _entitiesExtra.componentBase$;\n\n entityActions.createMeshComponents$ = createMeshComponents$;\n\n // annotations\n var addAnnotations$ = (0, _annotations.addAnnotation)(actions.annotationsActions, settings$).map(_utils.toArray);\n\n var proxySelections$ = new _rx2.default.ReplaySubject(1);\n\n entityActions = (0, _utils2.remapEntityActions)(entityActions, proxySelections$);\n console.log('entityActions', entityActions);\n\n var metaActions = (0, _utils2.remapMetaActions)(entityActions, componentBase$, proxySelections$, addAnnotations$);\n var meshActions = (0, _utils2.remapMeshActions)(entityActions, componentBase$);\n var transformActions = (0, _utils2.remapTransformActions)(entityActions, componentBase$, settings$);\n var boundActions = (0, _utils2.remapBoundsActions)(entityActions, componentBase$);\n\n var _makeMetaSystem = (0, _meta.makeMetaSystem)(metaActions);\n\n var meta$ = _makeMetaSystem.meta$;\n\n var _makeMeshSystem = (0, _mesh.makeMeshSystem)(meshActions);\n\n var meshes$ = _makeMeshSystem.meshes$;\n\n var _makeTransformsSystem = (0, _transforms.makeTransformsSystem)(transformActions);\n\n var transforms$ = _makeTransformsSystem.transforms$;\n\n var _makeBoundingSystem = (0, _bounds.makeBoundingSystem)(boundActions);\n\n var bounds$ = _makeBoundingSystem.bounds$;\n\n // selections => only for real time view\n\n var typesInstancesRegistry$ = (0, _typeInstanceMapping2.default)(meta$, types$);\n var selections$ = (0, _selections2.default)((0, _intents2.default)(sources, { idsMapper$: typesInstancesRegistry$, removeInstances$: entityActions.deleteInstances$, removeTypes$: entityActions.removeTypes$ }));\n //.merge(entityActions.deleteInstances$.map(a => ({instIds: [], bomIds: []}))) // after an instance is removed, unselect\n\n var currentSelections$ = selections$.withLatestFrom(typesInstancesRegistry$, function (selections, registry) {\n return selections.instIds.map(function (id) {\n var typeUid = registry.typeUidFromInstUid[id];\n return { id: id, typeUid: typeUid };\n });\n }).distinctUntilChanged().shareReplay(1);\n\n // close some cycles\n (0, _obsUtils.replicateStream)(currentSelections$, proxySelections$);\n\n //FIXME : must find a way to get it out of here\n var bomActions = (0, _intents4.default)(sources, types$, metaActions, entityActions);\n var bom$ = (0, _index2.default)(bomActions);\n\n //saveNotifications\n var saveNotifications$ = sources.ym.progress.pluck('saveInProgress').filter(function (d) {\n return d === true;\n }).flatMap(function (data) {\n return _rx2.default.Observable.just(data).merge(_rx2.default.Observable.timer(300).map(false));\n });\n\n // not entirely sure, we need a way to observe any fetch/updload etc operation\n var operationsInProgress$ = actions.progress.combinedProgress$.merge(saveNotifications$.map(function (data) {\n return data ? 0.99999 : 1;\n })).startWith(undefined);\n var notifications$ = saveNotifications$.map(function (data) {\n return data ? 'All changes have been saved' : undefined;\n })\n //.map(data => undefined)\n .startWith(undefined).distinctUntilChanged();\n\n // ////other data\n var appData$ = sources.appMeta;\n\n //\n var visualResources$ = actions.visualResources.startWith([]);\n //.forEach(e=>console.log('visualResources',e))\n\n // combine all the above to get our dynamic state\n var state$ = (0, _obsUtils.combineLatestObj)({\n selections$: selections$,\n bom$: bom$,\n comments$: comments$,\n // entity components\n meta$: meta$,\n transforms$: transforms$,\n meshes$: meshes$,\n types$: types$,\n // app level data, meta data , settings etc\n operationsInProgress$: operationsInProgress$,\n notifications$: notifications$,\n appData$: appData$,\n settings$: settings$,\n // infos about current design etc\n design$: design$,\n assembly$: assembly$,\n authData$: authData$,\n\n // FIXME temporary\n visualResources$: visualResources$\n }).shareReplay(1);\n\n return state$;\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/main/model.js\n ** module id = 140\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/main/model.js?")},function(module,exports,__webpack_require__){eval('\'use strict\';\n\nObject.defineProperty(exports, "__esModule", {\n value: true\n});\nexports.default = view;\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nvar _snabbdomJsx = __webpack_require__(9);\n\nvar _dom = __webpack_require__(18);\n\nvar _classnames = __webpack_require__(34);\n\nvar _classnames2 = _interopRequireDefault(_classnames);\n\nvar _obsUtils = __webpack_require__(5);\n\nvar _utils = __webpack_require__(3);\n\nvar _Menu = __webpack_require__(11);\n\nvar _Menu2 = _interopRequireDefault(_Menu);\n\nvar _nameAndColor = __webpack_require__(127);\n\nvar _position = __webpack_require__(128);\n\nvar _rotation = __webpack_require__(129);\n\nvar _scale = __webpack_require__(130);\n\nvar _mirroring = __webpack_require__(126);\n\nvar _ProgressBar = __webpack_require__(66);\n\nvar _ProgressBar2 = _interopRequireDefault(_ProgressBar);\n\nvar _measurements = __webpack_require__(139);\n\nvar _ramda = __webpack_require__(4);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar combineLatest = _rx2.default.Observable.combineLatest;\n\n__webpack_require__(332);\n__webpack_require__(334);\n__webpack_require__(337);\n__webpack_require__(333);\n\n__webpack_require__(336);\n__webpack_require__(335);\n__webpack_require__(343);\n\n/*\nfunction renderWebglError(){\n return (\n
\n \n
\n

Whoops, it seems you do not have a WebGL capable browser, sorry!

\n
\n \n
\n
\n )\n}*/\n\nvar duplicateIcon = \'\\n \\n duplicate\\n Created with Sketch.\\n \\n \\n \\n \\n \\n \\n \\n\';\n\nvar deleteIcon = \'\\n \\n remove\\n Created with Sketch.\\n \\n \\n \\n \\n \\n \\n \\n \\n\';\n\nfunction renderLeftToolbar(state) {\n var selections = state.selections;\n var activeTool = state.settings.activeTool;\n var toggleControls = selections && selections.instIds.length > 0;\n\n var viewIcons = [];\n\n var editIcons = [(0, _snabbdomJsx.html)(\n \'section\',\n null,\n (0, _nameAndColor.renderNameAndColorUi)(state),\n (0, _position.renderPositionUi)(state),\n (0, _rotation.renderRotationUi)(state),\n (0, _scale.renderScaleUi)(state),\n (0, _mirroring.renderMirroringUi)(state)\n ), (0, _snabbdomJsx.html)(\n \'section\',\n null,\n (0, _Menu2.default)({ icon: duplicateIcon, klass: \'duplicate\',\n tooltip: \'duplicate\', tooltipPos: \'bottom\', disabledCondition: !toggleControls }),\n (0, _Menu2.default)({ icon: deleteIcon, klass: \'delete\',\n tooltip: \'delete\', tooltipPos: \'bottom\', disabledCondition: !toggleControls })\n )];\n var annotIcons = [(0, _snabbdomJsx.html)(\n \'section\',\n null,\n (0, _measurements.renderMeasurementsUi)(state)\n )];\n\n var iconSets = {\n \'view\': viewIcons,\n \'edit\': editIcons,\n \'annotate\': annotIcons,\n \'bom\': undefined\n };\n\n var icons = state.settings.toolSets.map(function (toolSet) {\n return iconSets[toolSet];\n }).filter(_utils.exists);\n\n return (0, _dom.h)(\'section#leftToolbar\', (0, _ramda.flatten)([icons]));\n}\n\nfunction renderRightToolbar(state, _ref) {\n var bom = _ref.bom;\n\n var widgetSets = {\n \'bom\': bom\n };\n\n var widgetsNames = (0, _ramda.uniq)((0, _ramda.flatten)(state.settings.toolSets.map(function (toolSet) {\n return widgetNamesByToolSet(toolSet);\n }).filter(_utils.exists)));\n var widgets = widgetsNames.map(function (wName) {\n return widgetSets[wName];\n });\n\n return (0, _dom.h)(\'section#rightToolbar\', widgets);\n}\n\nfunction renderTopToolbar(state) {\n var progressBar = (0, _ProgressBar2.default)({ progress: state.operationsInProgress * 100 });\n return (0, _dom.h)(\'section#topToolBar\', [(0, _dom.h)(\'section.notifications\', [state.notifications]), progressBar]);\n}\n\nfunction renderUiElements(uiElements) {\n var state = uiElements.state;\n var settings = uiElements.settings;\n var fsToggler = uiElements.fsToggler;\n var bom = uiElements.bom;\n var gl = uiElements.gl;\n var entityInfos = uiElements.entityInfos;\n var help = uiElements.help;\n\n\n var widgetsMapping = {\n //\'comments\': comments,\n \'entityInfos\': entityInfos,\n \'bom\': bom\n };\n\n var widgetsNames = (0, _ramda.uniq)((0, _ramda.flatten)(state.settings.toolSets.map(function (toolSet) {\n return widgetNamesByToolSet(toolSet);\n }).filter(_utils.exists)));\n var widgets = widgetsNames.map(function (wName) {\n return widgetsMapping[wName];\n });\n\n var leftToolbar = renderLeftToolbar(state);\n var rightToolbar = renderRightToolbar(state, uiElements);\n var bottomToolBar = (0, _dom.h)(\'section#bottomToolBar\', [settings, help, fsToggler]);\n var topToolbar = renderTopToolbar(state);\n\n return (0, _dom.h)(\'div.jam\', (0, _ramda.flatten)([gl, leftToolbar, rightToolbar, topToolbar, bottomToolBar]));\n}\n\nfunction widgetNamesByToolSet(toolset) {\n var mappings = {\n \'view\': [],\n \'bom\': [\'bom\'],\n \'edit\': [\'entityInfos\', \'bom\'],\n \'annot\': [\'comments\']\n };\n return mappings[toolset];\n}\n\nfunction view(state$, settings$, fsToggler$, bom$, gl$, entityInfos$, comment$, help$) {\n\n return (0, _obsUtils.combineLatestObj)({ state$: state$, settings$: settings$, fsToggler$: fsToggler$, bom$: bom$, gl$: gl$, entityInfos$: entityInfos$, comment$: comment$, help$: help$ }).map(renderUiElements);\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/main/view.js\n ** module id = 141\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/main/view.js?')},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.EntityInfosWrapper = EntityInfosWrapper;\nexports.BOMWrapper = BOMWrapper;\nexports.GLWrapper = GLWrapper;\nexports.CommentsWrapper = CommentsWrapper;\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nvar _utils = __webpack_require__(3);\n\nvar _ramda = __webpack_require__(4);\n\nvar _obsUtils = __webpack_require__(5);\n\nvar _Bom = __webpack_require__(111);\n\nvar _Bom2 = _interopRequireDefault(_Bom);\n\nvar _GlView = __webpack_require__(143);\n\nvar _GlView2 = _interopRequireDefault(_GlView);\n\nvar _Comments = __webpack_require__(112);\n\nvar _Comments2 = _interopRequireDefault(_Comments);\n\nvar _EntityInfos = __webpack_require__(113);\n\nvar _EntityInfos2 = _interopRequireDefault(_EntityInfos);\n\nvar _ProgressBar = __webpack_require__(66);\n\nvar _ProgressBar2 = _interopRequireDefault(_ProgressBar);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar just = _rx2.default.Observable.just;\n\n// nested dialogues etc\n\n\n// for settings\n/* just({\n ,schema : {\n showGrid:{type:\"checkbox\",path:\"grid.show\"}\n ,autoRotate:{type:\"checkbox\",path:\"camera.autoRotate\"}\n //,annotations:{type:\"checkbox\",path:\"grid.show\"}\n }\n })*/\nfunction EntityInfosWrapper(state$, DOM) {\n\n function makeEntityInfosProps(state$) {\n var selectedInstIds$ = state$.pluck('selections').map(function (s) {\n return s.instIds;\n }).filter(function (s) {\n return s !== undefined;\n }).distinctUntilChanged(null, _ramda.equals);\n\n return selectedInstIds$.combineLatest(state$, function (ids, state) {\n var transforms = ids.map(function (id) {\n return state.transforms[id];\n });\n\n var meta = ids.map(function (id) {\n return state.meta[id];\n });\n\n var selections = ids;\n\n return { transforms: transforms, meta: meta, settings: state.settings, selections: selections };\n }).shareReplay(1);\n }\n var props$ = makeEntityInfosProps(state$);\n\n /*const props$ = state$.map(function(state){\n const data = state.selections.instIds.reduce(function (acc, id) {\n acc['transforms'].push(state.transforms[id])\n acc['meta'].push(state.meta[id])\n return acc\n }, {transforms: [], meta: [], settings})\n return assign({}, state, {__data: data})\n })*/\n\n // entity infos\n return (0, _EntityInfos2.default)({ DOM: DOM, props$: props$ });\n}\n\nfunction BOMWrapper(state$, DOM) {\n function makeBomProps(state$) {\n var fieldNames = ['name', 'qty', 'phys_qty', 'unit', 'printable'];\n var sortableFields = ['id', 'name', 'qty', 'unit', 'printable'];\n var editableFields = ['name', 'qty', 'phys_qty'];\n var fieldDescriptions = {\n 'name': 'name of the parts',\n 'qty': 'quantities of this parts',\n 'phys_qty': 'physical quantity: ie 10 cm',\n 'unit': 'use EA for \"each\", or SI/ imperial units',\n 'printable': 'is this a printable part?'\n };\n var fieldTypes = {\n 'name': 'text',\n 'qty': 'number',\n 'phys_qty': 'number',\n 'unit': 'list',\n 'printable': 'boolean'\n };\n\n var fieldNames$ = just(fieldNames);\n var editableFields$ = just(editableFields);\n var sortableFields$ = just(sortableFields);\n var selectedEntries$ = state$.pluck('selections').pluck('bomIds');\n var fieldDescriptions$ = just(fieldDescriptions);\n var fieldTypes$ = just(fieldTypes);\n var units$ = just(['EA', 'm', 'in', 'kg', 'lb', 'l']);\n // let show$ = state$.pluck(\"settings\").pluck(\"appMode\").map(mode=> mode !=='viewer')\n var entries$ = state$.map(function (s) {\n return s.bom;\n }).distinctUntilChanged();\n var readOnly$ = state$.pluck('settings').map(function (s) {\n return !(s.toolSets.indexOf('edit') !== -1);\n });\n\n var bomProps$ = (0, _obsUtils.combineLatestObj)({\n fieldNames$: fieldNames$,\n sortableFields$: sortableFields$,\n editableFields$: editableFields$,\n entries$: entries$,\n selectedEntries$: selectedEntries$,\n fieldDescriptions$: fieldDescriptions$,\n fieldTypes$: fieldTypes$,\n units$: units$,\n readOnly$: readOnly$ });\n\n return bomProps$;\n }\n return (0, _Bom2.default)({ DOM: DOM, props$: makeBomProps(state$) });\n}\n\nfunction GLWrapper(state$, drivers) {\n var selectedInstIds$ = state$.pluck('selections').map(function (s) {\n return s.instIds;\n }).filter(function (s) {\n return s !== undefined;\n }).distinctUntilChanged(null, _ramda.equals);\n\n var selections$ = selectedInstIds$.withLatestFrom(state$, function (ids, state) {\n return ids.map(function (id) {\n return state.meta[id];\n });\n }).shareReplay(1);\n\n var focusedEntities$ = state$.pluck('selections').map(function (s) {\n return s.focusInstIds;\n }).filter(function (s) {\n return s !== undefined;\n });\n\n var glProps$ = (0, _obsUtils.combineLatestObj)({\n settings: state$.pluck('settings'),\n selections$: selections$,\n focusedEntities$: focusedEntities$,\n meta: state$.pluck('meta'),\n meshes: state$.pluck('meshes'),\n transforms: state$.pluck('transforms'),\n rawVisuals: state$.pluck('visualResources')\n });\n\n var glUi = (0, _GlView2.default)({ drivers: drivers, props$: glProps$ });\n return glUi;\n}\n\nfunction CommentsWrapper(state$, DOM) {\n var selectedInstIds$ = state$.pluck('selections').map(function (s) {\n return s.instIds;\n }).filter(function (s) {\n return s !== undefined;\n }).distinctUntilChanged(null, _ramda.equals);\n\n var selections$ = selectedInstIds$.combineLatest(state$, function (ids, state) {\n // console.log(\"gnagna gna\")\n var meta = ids.map(function (id) {\n return state.meta[id];\n });\n return meta;\n }).map(getFirstsData).shareReplay(1);\n\n function getFirstsData(list) {\n if (list.length === 0) return undefined;\n if (!list[0]) return undefined;\n\n return { id: list[0].id, typeUid: list[0].typeUid };\n }\n\n var props$ = (0, _obsUtils.combineLatestObj)({\n entity: selections$, comments: state$.pluck('comments')\n });\n\n return (0, _Comments2.default)({ DOM: DOM, props$: props$ });\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/main/wrappers.js\n ** module id = 142\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/main/wrappers.js?"); -},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nvar _tween = __webpack_require__(94);\n\nvar _tween2 = _interopRequireDefault(_tween);\n\nvar _Detector = __webpack_require__(67);\n\nvar _Detector2 = _interopRequireDefault(_Detector);\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nvar _dom = __webpack_require__(18);\n\nvar _pointers = __webpack_require__(74);\n\nvar _sizing = __webpack_require__(75);\n\nvar _obsUtils = __webpack_require__(5);\n\nvar _diffPatchUtils = __webpack_require__(76);\n\nvar _TransformControls = __webpack_require__(162);\n\nvar _TransformControls2 = _interopRequireDefault(_TransformControls);\n\nvar _glViewHelpers = __webpack_require__(60);\n\nvar _LabeledGrid = __webpack_require__(81);\n\nvar _LabeledGrid2 = _interopRequireDefault(_LabeledGrid);\n\nvar _cameraUtils = __webpack_require__(144);\n\nvar _cameraUtils2 = _interopRequireDefault(_cameraUtils);\n\nvar _computeBounds = __webpack_require__(145);\n\nvar _utils = __webpack_require__(69);\n\nvar _presets = __webpack_require__(161);\n\nvar _EffectComposer = __webpack_require__(152);\n\nvar _EffectComposer2 = _interopRequireDefault(_EffectComposer);\n\nvar _ShaderPass = __webpack_require__(157);\n\nvar _ShaderPass2 = _interopRequireDefault(_ShaderPass);\n\nvar _RenderPass = __webpack_require__(156);\n\nvar _RenderPass2 = _interopRequireDefault(_RenderPass);\n\nvar _MaskPass = __webpack_require__(154);\n\nvar _CopyShader = __webpack_require__(150);\n\nvar _CopyShader2 = _interopRequireDefault(_CopyShader);\n\nvar _FXAAShader = __webpack_require__(153);\n\nvar _FXAAShader2 = _interopRequireDefault(_FXAAShader);\n\nvar _vignetteShader = __webpack_require__(158);\n\nvar _vignetteShader2 = _interopRequireDefault(_vignetteShader);\n\nvar _EdgeShader = __webpack_require__(151);\n\nvar _EdgeShader2 = _interopRequireDefault(_EdgeShader);\n\nvar _AdditiveBlendShader = __webpack_require__(149);\n\nvar _AdditiveBlendShader2 = _interopRequireDefault(_AdditiveBlendShader);\n\nvar _intent = __webpack_require__(159);\n\nvar _intent2 = _interopRequireDefault(_intent);\n\nvar _model = __webpack_require__(160);\n\nvar _model2 = _interopRequireDefault(_model);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar fromEvent = _rx2.default.Observable.fromEvent;\nvar merge = _rx2.default.Observable.merge;\n\n// console.log('helpers.planes',planes,objectEffects)\n// let LabeledGrid = helpers.grids.LabeledGrid\nvar ShadowPlane = _glViewHelpers.planes.ShadowPlane.default; // ugh FIXME: bloody babel6\n// let annotations = annotations\nvar zoomInOn = _glViewHelpers.cameraEffects.zoomInOn;\nvar zoomToFit = _glViewHelpers.cameraEffects.zoomToFit; // default configuration for lighting, cameras etc\n\nfunction setupPostProcess(camera, renderer, scene) {\n // console.log('setupPostProcess')\n // //////post processing\n var renderTargetParameters = {\n minFilter: _three2.default.LinearFilter,\n magFilter: _three2.default.LinearFilter,\n format: _three2.default.RGBAFormat,\n stencilBuffer: true\n };\n\n var outScene = new _three2.default.Scene();\n var maskScene = new _three2.default.Scene();\n\n var renderTarget = new _three2.default.WebGLRenderTarget(window.innerWidth, window.innerHeight, renderTargetParameters);\n\n var uniforms = {\n offset: {\n type: 'f',\n value: 0.9\n },\n color: {\n type: 'c',\n value: new _three2.default.Color('#000000') // #ff2500')//[1.0,0.0,0.0]\n }\n };\n\n var shader = __webpack_require__(155).default;\n var outShader = shader['outline'];\n\n var outlineMaterial = new _three2.default.ShaderMaterial({\n uniforms: uniforms,\n vertexShader: outShader.vertex_shader,\n fragmentShader: outShader.fragment_shader\n });\n outlineMaterial.depthTest = false;\n // new THREE.MeshBasicMaterial({color:0xFF0000,transparent:true,opacity:0.5})\n\n var maskMaterial = new _three2.default.MeshBasicMaterial({ color: 0xffffff });\n\n // setup composer\n var composer = new _EffectComposer2.default(renderer);\n composer.renderTarget1.stencilBuffer = true;\n composer.renderTarget2.stencilBuffer = true;\n\n var normal = new _RenderPass2.default(scene, camera);\n var outline = new _RenderPass2.default(outScene, camera, outlineMaterial);\n var maskPass = new _three2.default.MaskPass(maskScene, camera, maskMaterial);\n maskPass.inverse = true;\n var clearMask = new _three2.default.ClearMaskPass();\n var copyPass = new _three2.default.ShaderPass(_three2.default.CopyShader);\n var fxaaPass = new _three2.default.ShaderPass(_three2.default.FXAAShader);\n var vignettePass = new _three2.default.ShaderPass(_three2.default.VignetteShader);\n\n fxaaPass.uniforms['resolution'].value.set(1 / window.innerWidth * window.devicePixelRatio, 1 / window.innerHeight * window.devicePixelRatio);\n vignettePass.uniforms['offset'].value = 0.95;\n vignettePass.uniforms['darkness'].value = 0.9;\n\n // /////////////////////////////////\n\n renderer.autoClear = false;\n // renderer.autoClearStencil = false\n\n outline.clear = false;\n // normal.clear = false\n\n composer.addPass(normal);\n composer.addPass(maskPass);\n composer.addPass(outline);\n\n composer.addPass(clearMask);\n // composer.addPass(vignettePass)\n // composer.addPass(fxaaPass)\n composer.addPass(copyPass);\n\n var lastPass = composer.passes[composer.passes.length - 1];\n lastPass.renderToScreen = true;\n\n return { composers: [composer], fxaaPass: fxaaPass, outScene: outScene, maskScene: maskScene };\n\n // return {composer:finalComposer, fxaaPass, outScene, maskScene, composers:[normalComposer,depthComposer,finalComposer]}\n}\n\n// //////////\nfunction GLView(_ref) {\n var drivers = _ref.drivers;\n var props$ = _ref.props$;\n var DOM = drivers.DOM;\n var postMessage = drivers.postMessage;\n\n\n var config = _presets.presets;\n\n var initialized$ = new _rx2.default.BehaviorSubject(false);\n var update$ = _rx2.default.Observable.interval(16, 66666666667);\n\n var settings$ = props$.pluck('settings');\n // every time either activeTool or selection changes, reset/update transform controls\n var activeTool$ = settings$.pluck('activeTool').startWith(undefined);\n\n var renderer = null;\n\n var composer = null;\n var composers = [];\n var fxaaPass = null;\n var outScene = null;\n var maskScene = null;\n\n var scene = new _three2.default.Scene();\n var dynamicInjector = new _three2.default.Object3D(); // all dynamic mapped objects reside here\n scene.dynamicInjector = dynamicInjector;\n scene.add(dynamicInjector);\n\n var selectionsContainer = new _three2.default.Scene(); // unfortunate way to handle things in three.js\n\n var camera = (0, _utils.makeCamera)(config.cameras[0]);\n var controls = (0, _utils.makeControls)(config.controls[0]); // create 'orbit' controls\n var transformControls = new _TransformControls2.default(camera);\n\n var grid = new _LabeledGrid2.default(200, 200, 10, config.cameras[0].up);\n var shadowPlane = new ShadowPlane(2000, 2000, null, config.cameras[0].up);\n\n var actions = (0, _intent2.default)({ DOM: DOM, events: drivers.events }, { camera: camera, scene: scene, transformControls: transformControls, props$: props$, settings$: settings$ });\n var state$ = (0, _model2.default)(props$, actions);\n\n // FIXME: proxies for now, not sure how to deal with them\n var meshAddedToScene$ = new _rx2.default.ReplaySubject(1);\n var meshRemovedFromScene$ = new _rx2.default.ReplaySubject(1);\n\n var outlineSelections$ = settings$.filter(function (s) {\n return !(s.toolSets.indexOf('view') !== -1 && s.toolSets.length === 1);\n }) // in all but view only mode\n .combineLatest(state$, function (settings, state) {\n return state;\n });\n\n var focusedMeshesFromFocusedEntities$ = state$.pluck('focusedMeshesFromFocusedEntities').startWith([]);\n\n var zoomToFit$ = settings$.filter(function (s) {\n return s.toolSets.indexOf('edit') === -1 && s.toolSets.length === 1;\n }) // only in view only mode\n .combineLatest(state$.pluck('items'), function (settings, items) {\n return items;\n }).merge(focusedMeshesFromFocusedEntities$).filter(_obsUtils.exists).filter(function (i) {\n return i.length > 0;\n }).distinctUntilChanged();\n\n /*\n const zoomToFit$ = meshAddedToScene$ //alternative implementation\n .combineLatest(settings$.filter(s=> s.appMode === 'viewer'), function(mesh, settings){\n return [dynamicInjector]\n })\n .distinctUntilChanged()*/\n\n // react to actions\n actions.zoomInOnPoint$.forEach(function (oAndP) {\n return zoomInOn(oAndP.object, camera, { position: oAndP.point });\n });\n\n zoomToFit$.map(function (meshesToFocus) {\n var wrapperObject = new _three2.default.Object3D();\n wrapperObject.boundingBox = (0, _computeBounds.computeBoundingBox)(wrapperObject, meshesToFocus);\n wrapperObject.boundingSphere = wrapperObject.boundingBox.getBoundingSphere();\n var center = new _three2.default.Vector3().subVectors(wrapperObject.boundingBox.max, wrapperObject.boundingBox.min).multiplyScalar(0.5);\n return { focusMesh: wrapperObject, center: center };\n }).forEach(function (_ref2) {\n var focusMesh = _ref2.focusMesh;\n var center = _ref2.center;\n return (0, _cameraUtils2.default)(focusMesh, camera, center);\n });\n\n var windowResizes$ = (0, _sizing.windowResizes)(1); // get from intents/interactions ?\n\n function clearScene() {\n if (scene) {\n if (scene.dynamicInjector) {\n scene.remove(scene.dynamicInjector);\n }\n var _dynamicInjector = new _three2.default.Object3D();\n scene.dynamicInjector = _dynamicInjector;\n\n scene.add(_dynamicInjector);\n }\n }\n\n function addToScene(object) {\n scene.dynamicInjector.add(object);\n }\n function removeFromScene(object) {\n scene.dynamicInjector.remove(object);\n }\n\n function setupScene() {\n config.scenes['main']\n // TODO , update to be more generic\n .map(function (light) {\n return (0, _utils.makeLight)(light);\n }).forEach(function (light) {\n return scene.add(light);\n });\n }\n\n function render(scene, camera) {\n composers.forEach(function (c) {\n return c.render();\n });\n // composer.passes[composer.passes.length-1].uniforms[ 'tDiffuse2' ].value = composers[0].renderTarget2\n // composer.passes[composer.passes.length-1].uniforms[ 'tDiffuse3' ].value = composers[1].renderTarget2\n }\n\n function update() {\n controls.update();\n transformControls.update();\n _tween2.default.update();\n // if(camViewControls) camViewControls.update()\n }\n\n function configure(container) {\n // log.debug('initializing into container', container)\n\n if (!_Detector2.default.webgl) {\n // TODO: handle lacking webgl\n } else {\n renderer = new _three2.default.WebGLRenderer({\n antialias: false,\n preserveDrawingBuffer: true\n });\n }\n\n renderer.setClearColor('#fff');\n Object.keys(config.renderer).map(function (key) {\n // TODO add hasOwnProp check\n renderer[key] = config.renderer[key];\n });\n\n var pixelRatio = window.devicePixelRatio || 1;\n renderer.setPixelRatio(pixelRatio);\n\n container.appendChild(renderer.domElement);\n // prevents zooming the 3d view from scrolling the window\n (0, _pointers.preventScroll)(container);\n\n transformControls.setDomElement(container);\n\n // more init\n controls.setObservables(actions.filteredInteractions$);\n controls.addObject(camera);\n\n scene.add(camera);\n scene.add(shadowPlane);\n scene.add(transformControls);\n\n var ppData = setupPostProcess(camera, renderer, scene);\n // composer = ppData.composer\n composers = ppData.composers;\n fxaaPass = ppData.fxaaPass;\n outScene = ppData.outScene;\n maskScene = ppData.maskScene;\n\n initialized$.onNext(true);\n }\n\n // side effect ?\n function handleResize(sizeInfos) {\n // log.debug('setting glView size',sizeInfos)\n var width = sizeInfos.width;\n var height = sizeInfos.height;\n var aspect = sizeInfos.aspect;\n\n\n if (width > 0 && height > 0 && camera && renderer) {\n (function () {\n renderer.setSize(width, height);\n camera.aspect = aspect;\n camera.setSize(width, height);\n camera.updateProjectionMatrix();\n\n var pixelRatio = window.devicePixelRatio || 1;\n fxaaPass.uniforms['resolution'].value.set(1 / (width * pixelRatio), 1 / (height * pixelRatio));\n\n composers.forEach(function (c) {\n c.reset();\n c.setSize(width * pixelRatio, height * pixelRatio);\n });\n })();\n }\n }\n\n // combine All needed components to apply any 'transforms' to their visuals\n var items$ = state$.pluck('items'); // .distinctUntilChanged()\n // TODO : we DO want distinctUntilChanged() to prevent spamming here at any state change\n // TODO we want to zoomToFit only when mode is viewer && we just recieved the FIRST model ??\n /* settings$\n .filter(s=> s.mode === 'viewer')\n .forEach(e=>console.log('settings',e))*/\n\n // do diffing to find what was added/changed\n var itemChanges$ = items$.scan(function (acc, x) {\n var cur = x;\n var prev = acc.cur;\n return { cur: cur, prev: prev };\n }, { prev: undefined, cur: undefined }).map(function (typeData) {\n var cur = typeData.cur;\n var prev = typeData.prev;\n\n var changes = (0, _diffPatchUtils.extractChanges)(prev, cur);\n // console.log('changes', changes)\n return changes;\n });\n\n // experimenting with selections effects\n //FIXME : use data, not mesh level things\n outlineSelections$.pluck('selectedMeshesFromSelections').distinctUntilChanged().filter(_obsUtils.exists).forEach(function (selectedMeshes) {\n if (outScene) {\n var sceneItems = selectedMeshes.filter(_obsUtils.exists);\n outScene.children = sceneItems;\n maskScene.children = sceneItems;\n }\n });\n\n // transformControls handling\n // we modify the transformControls mode based on the active tool\n // every time either activeTool or selection changes, reset/update transform controls\n var selectedMeshesChanges$ = state$.pluck('selectedMeshes').distinctUntilChanged().scan(function (acc, x) {\n var cur = x;\n var prev = acc.cur;\n return { cur: cur, prev: prev };\n }, { prev: [], cur: [] }).map(function (typeData) {\n var cur = typeData.cur;\n var prev = typeData.prev;\n\n var changes = (0, _diffPatchUtils.extractChanges)(prev, cur);\n return changes;\n }).distinctUntilChanged().shareReplay(1);\n\n (0, _obsUtils.combineLatestObj)({\n selections: selectedMeshesChanges$,\n tool: activeTool$.distinctUntilChanged()\n }).forEach(function (_ref3) {\n var selections = _ref3.selections;\n var tool = _ref3.tool;\n\n // console.log('updating transformControls',selections,tool)\n // remove transformControls from removed meshes\n selections.removed.map(function (mesh) {\n return transformControls.detach(mesh);\n });\n\n selections.added.map(function (mesh) {\n if (tool && mesh && ['translate', 'rotate', 'scale'].indexOf(tool) > -1) {\n transformControls.attach(mesh);\n transformControls.setMode(tool);\n } else if (!tool && mesh || ['translate', 'rotate', 'scale'].indexOf(tool) === -1) {\n // tool is undefined, but we still had selections\n transformControls.detach(mesh);\n }\n });\n });\n\n // hande all the cases where events require re-rendering\n var reRender$ = merge(initialized$.filter(function (i) {\n return i === true;\n }).do(function (i) {\n return handleResize({\n width: window.innerWidth,\n height: window.innerHeight,\n aspect: window.innerWidth / window.innerHeight\n });\n }), fromEvent(controls, 'change'), fromEvent(transformControls, 'change'), state$.pluck('selectedMeshes'), windowResizes$.do(handleResize) // we need the resize to take place before we render\n ).shareReplay(1);\n\n // /////////\n setupScene();\n\n update$.forEach(update);\n reRender$.forEach(render);\n\n // settings handling\n settings$ = settings$.filter(_obsUtils.exists).distinctUntilChanged();\n\n settings$.map(function (s) {\n return s.camera.autoRotate;\n }).forEach(function (autoRotate) {\n return controls.autoRotate = autoRotate;\n });\n\n settings$.map(function (s) {\n return s.grid.show;\n }).forEach(function (showGrid) {\n scene.remove(grid);\n if (showGrid) {\n scene.add(grid);\n }\n });\n\n // react based on diffs\n itemChanges$.do(function (changes) {\n // console.log('reacting to changes', changes)\n changes.added.map(function (mesh) {\n addToScene(mesh);\n meshAddedToScene$.onNext(mesh);\n });\n changes.removed.map(function (mesh) {\n removeFromScene(mesh);\n meshRemovedFromScene$.onNext(mesh);\n });\n }).do(function (e) {\n return render();\n }).forEach(function (e) {\n return e;\n });\n\n // we do not want to change our container (DOM) but the contents (gl)\n var vtree$ = _rx2.default.Observable.just((0, _dom.h)('div.glView', [(0, _dom.h)('div.container', {\n //key: someUniqueKey,\n hook: {\n insert: function insert(vnode) {\n console.log('vnode', vnode);configure(vnode.elm);\n } //movie.elmHeight = vnode.elm.offsetHeight;\n }\n })]));\n\n // screencapture test\n /* postMessage\n .filter(e=>e.hasOwnProperty('captureScreen'))\n .flatMap(e=>{\n let img = domElementToImage(renderer.domElement)\n let resolutions = e.captureScreen\n let images$ = resolutions.map(function(resolution){\n let [width,height] = resolution\n console.log('resolution',resolution)\n let obs = new Rx.Subject()\n aspectResize(img, width, height, e=>{\n obs.onNext(e)\n obs.onCompleted()})\n return obs\n })\n let results$ = Rx.Observable.forkJoin(images$)\n return results$\n })\n .forEach(e=>{\n e.map(img=>console.log(img))\n })*/\n\n return {\n DOM: vtree$,\n events: {\n // initialized:initialized$,\n shortSingleTaps$: actions.shortSingleTapsWPicking$,\n shortDoubleTaps$: actions.shortDoubleTapsWPicking$,\n longTaps$: actions.longTapsWPicking$,\n selectionsTransforms$: actions.selectionsTransforms$,\n selectedMeshes$: actions.selectMeshes$\n }\n };\n}\n\nexports.default = GLView;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/webgl/GlView.js\n ** module id = 143\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/webgl/GlView.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = zoomToFitBounds;\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction zoomToFitBounds(object, camera, target) {\n var bbox = object.boundingBox;\n if (bbox.empty()) {\n return;\n }\n\n target = bbox.center();\n\n var radius = object.boundingSphere.radius;\n var center = object.boundingSphere.center;\n var targetOffset = new _three2.default.Vector3().subVectors(center, camera.target);\n\n // move camera to base position\n camera.position.add(targetOffset);\n camera.target.copy(center);\n\n // and move it away from the boundingSphere of the object\n var vec = new _three2.default.Vector3();\n vec.subVectors(camera.position, camera.target);\n vec.normalize();\n vec.setLength(center.distanceTo(camera.position) - radius * 4);\n camera.position.sub(vec);\n\n camera.updateProjectionMatrix();\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/webgl/cameraUtils2.js\n ** module id = 144\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/webgl/cameraUtils2.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.computeBoundingBox = computeBoundingBox;\nexports.computeBoundingSphere = computeBoundingSphere;\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n// FIXME : very temporary , until moving to regl/gl-matrix\n\nfunction computeBoundingBox(object, children, force) {\n var force = force === undefined ? false : force;\n\n if (object.geometry === undefined) {\n var bbox = new _three2.default.Box3();\n } else {\n if (!object.geometry.boundingBox || force) {\n object.geometry.computeBoundingBox();\n }\n var bbox = object.geometry.boundingBox.clone();\n }\n\n children.forEach(function (rootChild) {\n rootChild.traverse(function (child) {\n if (child instanceof _three2.default.Mesh) {\n if (child.geometry !== undefined) {\n if (!child.geometry.boundingBox || force) {\n child.geometry.computeBoundingBox();\n }\n var childBox = child.geometry.boundingBox.clone();\n childBox.translate(child.localToWorld(new _three2.default.Vector3()));\n bbox.union(childBox);\n }\n }\n });\n });\n\n object.boundingBox = bbox;\n return bbox;\n}\n\nfunction computeBoundingSphere(object, children, force) {\n var bbox = new _three2.default.Box3().setFromObject(object);\n\n if (object.boundingBox) object.boundingBox.copy(bbox);\n if (!object.boundingBox) object.boundingBox = bbox;\n var boundingSphere = bbox.getBoundingSphere();\n return boundingSphere;\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/webgl/computeBounds2.js\n ** module id = 145\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/webgl/computeBounds2.js?")},function(module,exports,__webpack_require__){eval('"use strict";\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/*\n * @author zz85 / http://twitter.com/blurspline / http://www.lab4games.net/zz85/blog\n *\n * A general perpose camera, for setting FOV, Lens Focal Length,\n * and switching between perspective and orthographic views easily.\n * Use this only if you do not wish to manage\n * both a Orthographic and Perspective Camera\n *\n * some additional changes by kaosat-dev\n */\n\nvar CombinedCamera = function CombinedCamera(width, height, fov, near, far, orthoNear, orthoFar) {\n\n _three2.default.Camera.call(this);\n\n this.fov = fov;\n\n this.left = -width / 2;\n this.right = width / 2;\n this.top = height / 2;\n this.bottom = -height / 2;\n\n // We could also handle the projectionMatrix internally, but just wanted to test nested camera objects\n\n this.cameraO = new _three2.default.OrthographicCamera(width / -2, width / 2, height / 2, height / -2, orthoNear, orthoFar);\n this.cameraP = new _three2.default.PerspectiveCamera(fov, width / height, near, far);\n\n this.zoom = 1;\n\n this.toPerspective();\n\n var aspect = width / height;\n\n this.target = new _three2.default.Vector3();\n this.defaultPosition = new _three2.default.Vector3();\n\n /**\n Orientations:\n front: +x \n back: -x\n top/above : +z\n bottom/under : -z\n left: +y\n right: -y \n */\n this.orientationMap = {\n "F": new _three2.default.Vector3(1, 0, 0),\n "B": new _three2.default.Vector3(-1, 0, 0),\n\n "A": new _three2.default.Vector3(0, 0, 1),\n "U": new _three2.default.Vector3(0, 0, -1),\n\n "L": new _three2.default.Vector3(0, 1, 0),\n "R": new _three2.default.Vector3(0, -1, 0)\n };\n\n //we generate methods for each an every possible case\n var orientationNameMap = {\n "F": "Front",\n "B": "Back",\n "L": "Left",\n "R": "Right",\n "A": "Top",\n "U": "Bottom",\n\n "FL": "FrontLeft",\n "FR": "FrontRight",\n "FA": "FrontTop",\n "FU": "FrontBottom",\n\n "BL": "BackLeft",\n "BR": "BackRight",\n "BA": "BackTop",\n "BU": "BackBottom",\n\n "LA": "LeftTop",\n "LU": "LeftBottom",\n "RA": "RightTop",\n "RU": "RightBottom",\n\n "FAL": "FrontTopLeft",\n "FAR": "FrontTopRight",\n "FUL": "FrontBottomLeft",\n "FUR": "FrontBottomRight",\n\n "BAL": "BackTopLeft",\n "BAR": "BackTopRight",\n "BUL": "BackBottomLeft",\n "BUR": "BackBottomRight"\n };\n\n var self = this;\n function createOrientationFunct(methodName, orCode) {\n self[methodName] = function () {\n self.orientationGenerator(orCode);\n };\n }\n\n for (var shortOrientationName in orientationNameMap) {\n var orientation = orientationNameMap[shortOrientationName];\n var methodName = "to" + orientation.charAt(0).toUpperCase() + orientation.slice(1) + "View";\n createOrientationFunct(methodName, shortOrientationName);\n }\n};\n\nCombinedCamera.prototype = Object.create(_three2.default.Camera.prototype);\n\nCombinedCamera.prototype.lookAt = function () {\n\n // This routine does not support cameras with rotated and/or translated parent(s)\n\n var m1 = new _three2.default.Matrix4();\n\n return function (vector) {\n this.target = vector;\n if (this.inOrthographicMode === true) {\n this.toOrthographic();\n }\n\n m1.lookAt(this.position, vector, this.up);\n\n this.quaternion.setFromRotationMatrix(m1);\n };\n}();\n\nCombinedCamera.prototype.toPerspective = function () {\n\n // Switches to the Perspective Camera\n\n this.near = this.cameraP.near;\n this.far = this.cameraP.far;\n\n this.cameraP.fov = this.fov / this.zoom;\n\n this.cameraP.updateProjectionMatrix();\n\n this.projectionMatrix = this.cameraP.projectionMatrix;\n\n this.inPerspectiveMode = true;\n this.inOrthographicMode = false;\n};\n\nCombinedCamera.prototype.toOrthographic = function () {\n\n // Switches to the Orthographic camera estimating viewport from Perspective\n\n var fov = this.fov;\n var aspect = this.cameraP.aspect;\n var near = this.cameraP.near;\n var far = this.cameraP.far;\n\n //set the orthographic view rectangle to 0,0,width,height\n //see here : http://stackoverflow.com/questions/13483775/set-zoomvalue-of-a-perspective-equal-to-perspective\n if (this.target === null) {\n this.target = new _three2.default.Vector3();\n }\n var distance = new _three2.default.Vector3().subVectors(this.position, this.target).length() * 0.3;\n var width = Math.tan(fov) * distance * aspect;\n var height = Math.tan(fov) * distance;\n\n var halfWidth = width;\n var halfHeight = height;\n\n this.cameraO.left = halfWidth;\n this.cameraO.right = -halfWidth;\n this.cameraO.top = -halfHeight;\n this.cameraO.bottom = halfHeight;\n\n this.cameraO.updateProjectionMatrix();\n\n this.near = this.cameraO.near;\n this.far = this.cameraO.far;\n this.projectionMatrix = this.cameraO.projectionMatrix;\n\n this.inPerspectiveMode = false;\n this.inOrthographicMode = true;\n};\n\nCombinedCamera.prototype.setSize = function (width, height) {\n\n this.cameraP.aspect = width / height;\n this.left = -width / 2;\n this.right = width / 2;\n this.top = height / 2;\n this.bottom = -height / 2;\n};\n\nCombinedCamera.prototype.setFov = function (fov) {\n\n this.fov = fov;\n\n if (this.inPerspectiveMode) {\n\n this.toPerspective();\n } else {\n\n this.toOrthographic();\n }\n};\n\n// For mantaining similar API with PerspectiveCamera\n\nCombinedCamera.prototype.updateProjectionMatrix = function () {\n\n if (this.inPerspectiveMode) {\n\n this.toPerspective();\n } else {\n\n this.toPerspective();\n this.toOrthographic();\n }\n};\n\n/*\n* Uses Focal Length (in mm) to estimate and set FOV\n* 35mm (fullframe) camera is used if frame size is not specified;\n* Formula based on http://www.bobatkins.com/photography/technical/field_of_view.html\n*/\nCombinedCamera.prototype.setLens = function (focalLength, frameHeight) {\n\n if (frameHeight === undefined) frameHeight = 24;\n\n var fov = 2 * _three2.default.Math.radToDeg(Math.atan(frameHeight / (focalLength * 2)));\n\n this.setFov(fov);\n\n return fov;\n};\n\nCombinedCamera.prototype.setZoom = function (zoom) {\n\n this.zoom = zoom;\n\n if (this.inPerspectiveMode) {\n this.toPerspective();\n } else {\n this.toOrthographic();\n }\n};\n\nCombinedCamera.prototype.toDiagonalView = function () {\n this.position.copy(this.defaultPosition);\n this.target = new _three2.default.Vector3();\n this.lookAt(this.target);\n};\n\nCombinedCamera.prototype.orientationGenerator = function (name) {\n\n //name is a string of letters of length 1 to 3 representing\n // the desired orientation : ex : a: above, r: right, ar: above right\n //, flb: front left bottom\n\n var offset = this.position.clone().sub(this.target);\n var components = name;\n //console.log("offset distance",offset.length());\n\n var combinedTransform = new _three2.default.Vector3();\n for (var i = 0; i < components.length; i++) {\n //console.log("handling", components[i] );\n var component = components[i];\n var nPost = this.orientationMap[component].clone(); //.multiplyScalar( offset.length() );\n\n combinedTransform.add(nPost);\n }\n combinedTransform.setLength(offset.length());\n //console.log("offset disance 2",combinedTransform.length() );\n this.position.copy(combinedTransform);\n\n //console.log("offset disance 3",this.position.clone().sub(this.target).length() );\n this.lookAt(this.target);\n //console.log("offset disance 4",this.position.clone().sub(this.target).length() );\n};\n\n/*CombinedCamera.prototype.toFrontView = function() {\n \n var offset = this.position.clone().sub( this.target );\n var nPost = new THREE.Vector3();\n nPost.y = -offset.length();\n this.position.copy( nPost );\n this.lookAt( this.target );\n};\n\nCombinedCamera.prototype.toFrontLeftView = function() {\n //TODO: check posisitoning\n var offset = this.position.clone().sub( this.target );\n var nPost = new THREE.Vector3();\n nPost.y = -offset.length();\n nPost.x = -offset.length();\n this.position.copy( nPost );\n this.lookAt( this.target );\n};\n\nCombinedCamera.prototype.toFrontRightView = function() {\n //TODO: check posisitoning\n var offset = this.position.clone().sub( this.target );\n var nPost = new THREE.Vector3();\n nPost.y = -offset.length();\n nPost.x = offset.length();\n this.position.copy( nPost );\n this.lookAt( this.target );\n};\n\nCombinedCamera.prototype.toFrontTopView = function() {\n //TODO: check posisitoning\n var offset = this.position.clone().sub( this.target );\n var nPost = new THREE.Vector3();\n nPost.y = -offset.length();\n nPost.z = offset.length();\n this.position.copy( nPost );\n this.lookAt( this.target );\n};\n\nCombinedCamera.prototype.toFrontBottomView = function() {\n //TODO: check posisitoning\n var offset = this.position.clone().sub( this.target );\n var nPost = new THREE.Vector3();\n nPost.y = -offset.length();\n nPost.z = -offset.length();\n this.position.copy( nPost );\n this.lookAt( this.target );\n};\n\nCombinedCamera.prototype.toBackView = function() {\n\n var offset = this.position.clone().sub(this.target);\n var nPost = new THREE.Vector3();\n nPost.y = offset.length();\n this.position.copy(nPost);\n this.lookAt(this.target);\n};\n\nCombinedCamera.prototype.toLeftView = function() {\n \n var offset = this.position.clone().sub(this.target);\n var nPost = new THREE.Vector3();\n nPost.x = offset.length();\n this.position.copy(nPost);\n this.lookAt(this.target);\n \n};\n\nCombinedCamera.prototype.toRightView = function() {\n var offset = this.position.clone().sub(this.target);\n var nPost = new THREE.Vector3();\n nPost.x = -offset.length();\n this.position.copy( nPost );\n this.lookAt(this.target );\n};\n\nCombinedCamera.prototype.toTopView = function() {\n this.orientationGenerator( "a" );\n};\n\nCombinedCamera.prototype.toBottomView = function() {\n var offset = this.position.clone().sub(this.target);\n var nPost = new THREE.Vector3();\n nPost.z = -offset.length();\n this.position.copy( nPost );\n this.lookAt( this.target );\n};*/\n\nCombinedCamera.prototype.centerView = function () {\n //var offset = new THREE.Vector3().sub(this.target.clone());\n //this.position= new THREE.Vector3(100,100,200);\n //this.target = new THREE.Vector3();\n\n this.position.copy(this.defaultPosition);\n this.lookAt(this.target);\n};\n\nCombinedCamera.prototype.resetView = function () {\n this.position.copy(this.defaultPosition);\n this.target.copy(new _three2.default.Vector3());\n};\n\n//export default CombinedCamera;\nmodule.exports = CombinedCamera;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/webgl/deps/CombinedCamera.js\n ** module id = 146\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/webgl/deps/CombinedCamera.js?'); -},function(module,exports,__webpack_require__){eval('\'use strict\';\n\nObject.defineProperty(exports, "__esModule", {\n value: true\n});\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nvar _assign = __webpack_require__(7);\n\nvar _assign2 = _interopRequireDefault(_assign);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n//faster object.assign\n/**\n * @author kaosat-dev\n * @author qiao / https://github.com/qiao\n * @author mrdoob / http://mrdoob.com\n * @author alteredq / http://alteredqualia.com/\n * @author WestLangley / http://github.com/WestLangley\n */\nvar OrbitControls = function OrbitControls(object, domElement, upVector) {\n\n //this.object = object\n this.objects = [];\n this.objectOptions = [];\n this.camStates = [];\n\n this.domElement = domElement !== undefined ? domElement : document;\n this.upVector = upVector || new _three2.default.Vector3(0, 1, 0);\n\n // API\n this.enabled = true;\n\n //this.center = new THREE.Vector3()\n this.centers = [];\n\n this.userZoom = true;\n this.userZoomSpeed = 1.0;\n\n this.userRotate = true;\n this.userRotateSpeed = 1.0;\n\n this.userPan = true;\n this.userPanSpeed = 2.0;\n\n this.autoRotate = false;\n this.autoRotateSpeed = 2.0; // 30 seconds per round when fps is 60\n\n this.minPolarAngle = 0; // radians\n this.maxPolarAngle = Math.PI; // radians\n\n this.minDistance = 0.2;\n this.maxDistance = 1400;\n\n this.active = false;\n this.mainPointerPressed = false;\n\n // internals\n\n var scope = this;\n\n var EPS = 0.000001;\n var PIXELS_PER_ROUND = 1800;\n\n var phiDelta = 0;\n var thetaDelta = 0;\n var scale = 1;\n\n var origPhiDelta = phiDelta;\n var origThetaDelta = thetaDelta;\n var origScale = scale;\n\n //to add control of multiple cameras\n this.addObject = function (object) {\n var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];\n\n if (this.objects.indexOf(object) != -1) return;\n var DEFAULTS = { userZoom: true, userPan: true, userRotate: true };\n options = (0, _assign2.default)({}, DEFAULTS, options);\n\n this.objects.push(object);\n this.objectOptions.push(options);\n this.centers.push(new _three2.default.Vector3());\n this.camStates.push({ phiDelta: 0, thetaDelta: 0, scale: 1, lastPosition: new _three2.default.Vector3() });\n };\n\n // events\n var changeEvent = { type: \'change\' };\n\n this.update = function (dt) {\n //this is a modified version, with inverted Y and Z (since we use camera.z => up)\n //we also allow multiple objects/cameras\n for (var i = 0; i < this.objects.length; i++) {\n var object = this.objects[i];\n var center = this.centers[i];\n var camState = this.camStates[i];\n\n var curThetaDelta = camState.thetaDelta;\n var curPhiDelta = camState.phiDelta;\n var curScale = camState.scale;\n\n var lastPosition = camState.lastPosition;\n\n var position = object.position;\n var offset = position.clone().sub(center);\n\n if (this.upVector.z == 1) {\n // angle from z-axis around y-axis, upVector : z\n var theta = Math.atan2(offset.x, offset.y);\n // angle from y-axis\n var phi = Math.atan2(Math.sqrt(offset.x * offset.x + offset.y * offset.y), offset.z);\n } else {\n //in case of y up\n var theta = Math.atan2(offset.x, offset.z);\n var phi = Math.atan2(Math.sqrt(offset.x * offset.x + offset.z * offset.z), offset.y);\n curThetaDelta = -curThetaDelta;\n }\n\n if (this.autoRotate) {\n //this.rotateLeft( getAutoRotationAngle() )\n //PER camera\n this.objects.map(function (object, index) {\n if (scope.objectOptions[index].userRotate) {\n scope.camStates[index].thetaDelta += getAutoRotationAngle();\n }\n });\n }\n\n theta += curThetaDelta;\n phi += curPhiDelta;\n\n // restrict phi to be between desired limits\n phi = Math.max(this.minPolarAngle, Math.min(this.maxPolarAngle, phi));\n // restrict phi to be betwee EPS and PI-EPS\n phi = Math.max(EPS, Math.min(Math.PI - EPS, phi));\n //multiply by scaling effect\n var radius = offset.length() * curScale;\n // restrict radius to be between desired limits\n radius = Math.max(this.minDistance, Math.min(this.maxDistance, radius));\n\n if (this.upVector.z == 1) {\n offset.x = radius * Math.sin(phi) * Math.sin(theta);\n offset.z = radius * Math.cos(phi);\n offset.y = radius * Math.sin(phi) * Math.cos(theta);\n } else {\n offset.x = radius * Math.sin(phi) * Math.sin(theta);\n offset.y = radius * Math.cos(phi);\n offset.z = radius * Math.sin(phi) * Math.cos(theta);\n }\n\n //\n position.copy(center).add(offset);\n object.lookAt(center);\n\n if (lastPosition.distanceTo(object.position) > 0) {\n //this.active = true\n this.dispatchEvent(changeEvent);\n\n lastPosition.copy(object.position);\n } else {\n //fireDeActivated()\n }\n\n camState.thetaDelta /= 1.5;\n camState.phiDelta /= 1.5;\n camState.scale = 1;\n }\n };\n\n function getAutoRotationAngle() {\n return 2 * Math.PI / 60 / 60 * scope.autoRotateSpeed;\n }\n\n function getZoomScale() {\n return Math.pow(0.95, scope.userZoomSpeed);\n }\n\n this.enable = function () {\n scope.enabled = true;\n this.enabled = true;\n };\n\n this.disable = function () {\n scope.enabled = false;\n this.enabled = false;\n };\n\n this.reset = function () {\n for (var i = 0; i < this.objects.length; i++) {\n var center = this.centers[i];\n center = new _three2.default.Vector3();\n }\n this.objects.map(function (object, index) {\n var center = this.centers[index];\n center = new _three2.default.Vector3();\n this.camStates[index].phiDelta = origPhiDelta;\n this.camStates[index].thetaDelta = origThetaDelta;\n this.camStates[index].scale = origScale = scale;\n });\n\n this.update();\n };\n\n this.setObservables = function (observables) {\n var dragMoves$ = observables.dragMoves$;\n var zooms$ = observables.zooms$;\n\n\n var self = this;\n\n /* are these useful ?\n scope.userZoomSpeed = 0.6\n onPinch\n */\n function zoom(zoomDir, zoomScale, cameras) {\n\n if (scope.enabled === false) return;\n if (scope.userZoom === false) return;\n\n //PER camera\n cameras.map(function (object, index) {\n if (scope.objectOptions[index].userZoom) {\n\n if (zoomDir < 0) scope.camStates[index].scale /= zoomScale;\n if (zoomDir > 0) scope.camStates[index].scale *= zoomScale;\n }\n });\n }\n\n function rotate(cameras, angle) {\n\n if (scope.enabled === false) return;\n if (scope.userRotate === false) return;\n\n //PER camera\n cameras.map(function (object, index) {\n if (scope.objectOptions[index].userRotate) {\n scope.camStates[index].thetaDelta += angle.x;\n scope.camStates[index].phiDelta += angle.y;\n }\n });\n }\n\n //TODO: implement\n function pan(cameras, offset) {\n //console.log(event)\n var _origDist = distance.clone();\n\n //do this PER camera\n cameras.map(function (object, index) {\n if (scope.objectOptions[index].userPan) {\n var _distance = _origDist.clone();\n _distance.transformDirection(object.matrix);\n _distance.multiplyScalar(scope.userPanSpeed);\n\n object.position.add(_distance);\n scope.centers[index].add(_distance);\n }\n });\n }\n\n dragMoves$.subscribe(function (e) {\n var delta = e.delta;\n\n /*if ( angle === undefined ) {\n angle = 2 * Math.PI /180 * scope.userRotateSpeed\n }*/\n var angle = { x: 0, y: 0 };\n angle.x = 2 * Math.PI * delta.x / PIXELS_PER_ROUND * scope.userRotateSpeed;\n angle.y = -2 * Math.PI * delta.y / PIXELS_PER_ROUND * scope.userRotateSpeed;\n\n //console.log("rotate by angle",angle)\n /*if ( angle === undefined ) {\n angle = 2 * Math.PI /180 * scope.userRotateSpeed\n } */\n rotate(self.objects, angle);\n });\n //.subscribe(e=>e)//console.log("dragMoves",e.delta))\n\n zooms$.subscribe(function (delta) {\n var zoomScale = undefined;\n if (!zoomScale) {\n zoomScale = getZoomScale();\n }\n zoom(delta, zoomScale, self.objects);\n });\n //.subscribe(e=>e)//console.log("zoom",e))\n };\n};\n\nOrbitControls.prototype = Object.create(_three2.default.EventDispatcher.prototype);\n\nexports.default = OrbitControls;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/webgl/deps/OrbitControls.js\n ** module id = 147\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/webgl/deps/OrbitControls.js?')},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n//var THREE = require(\"three\"); //until it is done via the import syntax everywhere we have to use this\n\n_three2.default.RenderableObject = function () {\n\n this.id = 0;\n\n this.object = null;\n this.z = 0;\n};\n\n//\n\n/**\n * @author mrdoob / http://mrdoob.com/\n * @author supereggbert / http://www.paulbrunt.co.uk/\n * @author julianwa / https://github.com/julianwa\n */\n_three2.default.RenderableFace = function () {\n\n this.id = 0;\n\n this.v1 = new _three2.default.RenderableVertex();\n this.v2 = new _three2.default.RenderableVertex();\n this.v3 = new _three2.default.RenderableVertex();\n\n this.normalModel = new _three2.default.Vector3();\n\n this.vertexNormalsModel = [new _three2.default.Vector3(), new _three2.default.Vector3(), new _three2.default.Vector3()];\n this.vertexNormalsLength = 0;\n\n this.color = new _three2.default.Color();\n this.material = null;\n this.uvs = [new _three2.default.Vector2(), new _three2.default.Vector2(), new _three2.default.Vector2()];\n\n this.z = 0;\n};\n\n//\n\n_three2.default.RenderableVertex = function () {\n\n this.position = new _three2.default.Vector3();\n this.positionWorld = new _three2.default.Vector3();\n this.positionScreen = new _three2.default.Vector4();\n\n this.visible = true;\n};\n\n_three2.default.RenderableVertex.prototype.copy = function (vertex) {\n\n this.positionWorld.copy(vertex.positionWorld);\n this.positionScreen.copy(vertex.positionScreen);\n};\n\n//\n\n_three2.default.RenderableLine = function () {\n\n this.id = 0;\n\n this.v1 = new _three2.default.RenderableVertex();\n this.v2 = new _three2.default.RenderableVertex();\n\n this.vertexColors = [new _three2.default.Color(), new _three2.default.Color()];\n this.material = null;\n\n this.z = 0;\n};\n\n//\n\n_three2.default.RenderableSprite = function () {\n\n this.id = 0;\n\n this.object = null;\n\n this.x = 0;\n this.y = 0;\n this.z = 0;\n\n this.rotation = 0;\n this.scale = new _three2.default.Vector2();\n\n this.material = null;\n};\n\n//\n\n_three2.default.Projector = function () {\n\n var _object,\n _objectCount,\n _objectPool = [],\n _objectPoolLength = 0,\n _vertex,\n _vertexCount,\n _vertexPool = [],\n _vertexPoolLength = 0,\n _face,\n _faceCount,\n _facePool = [],\n _facePoolLength = 0,\n _line,\n _lineCount,\n _linePool = [],\n _linePoolLength = 0,\n _sprite,\n _spriteCount,\n _spritePool = [],\n _spritePoolLength = 0,\n _renderData = { objects: [], lights: [], elements: [] },\n _vA = new _three2.default.Vector3(),\n _vB = new _three2.default.Vector3(),\n _vC = new _three2.default.Vector3(),\n _vector3 = new _three2.default.Vector3(),\n _vector4 = new _three2.default.Vector4(),\n _clipBox = new _three2.default.Box3(new _three2.default.Vector3(-1, -1, -1), new _three2.default.Vector3(1, 1, 1)),\n _boundingBox = new _three2.default.Box3(),\n _points3 = new Array(3),\n _points4 = new Array(4),\n _viewMatrix = new _three2.default.Matrix4(),\n _viewProjectionMatrix = new _three2.default.Matrix4(),\n _modelMatrix,\n _modelViewProjectionMatrix = new _three2.default.Matrix4(),\n _normalMatrix = new _three2.default.Matrix3(),\n _frustum = new _three2.default.Frustum(),\n _clippedVertex1PositionScreen = new _three2.default.Vector4(),\n _clippedVertex2PositionScreen = new _three2.default.Vector4();\n\n //\n\n this.projectVector = function (vector, camera) {\n\n console.warn('THREE.Projector: .projectVector() is now vector.project().');\n vector.project(camera);\n };\n\n this.unprojectVector = function (vector, camera) {\n\n console.warn('THREE.Projector: .unprojectVector() is now vector.unproject().');\n vector.unproject(camera);\n };\n\n this.pickingRay = function (vector, camera) {\n\n console.error('THREE.Projector: .pickingRay() has been removed.');\n };\n\n //\n\n var RenderList = function RenderList() {\n\n var normals = [];\n var uvs = [];\n\n var object = null;\n var material = null;\n\n var normalMatrix = new _three2.default.Matrix3();\n\n var setObject = function setObject(value) {\n\n object = value;\n material = object.material;\n\n normalMatrix.getNormalMatrix(object.matrixWorld);\n\n normals.length = 0;\n uvs.length = 0;\n };\n\n var projectVertex = function projectVertex(vertex) {\n\n var position = vertex.position;\n var positionWorld = vertex.positionWorld;\n var positionScreen = vertex.positionScreen;\n\n positionWorld.copy(position).applyMatrix4(_modelMatrix);\n positionScreen.copy(positionWorld).applyMatrix4(_viewProjectionMatrix);\n\n var invW = 1 / positionScreen.w;\n\n positionScreen.x *= invW;\n positionScreen.y *= invW;\n positionScreen.z *= invW;\n\n vertex.visible = positionScreen.x >= -1 && positionScreen.x <= 1 && positionScreen.y >= -1 && positionScreen.y <= 1 && positionScreen.z >= -1 && positionScreen.z <= 1;\n };\n\n var pushVertex = function pushVertex(x, y, z) {\n\n _vertex = getNextVertexInPool();\n _vertex.position.set(x, y, z);\n\n projectVertex(_vertex);\n };\n\n var pushNormal = function pushNormal(x, y, z) {\n\n normals.push(x, y, z);\n };\n\n var pushUv = function pushUv(x, y) {\n\n uvs.push(x, y);\n };\n\n var checkTriangleVisibility = function checkTriangleVisibility(v1, v2, v3) {\n\n if (v1.visible === true || v2.visible === true || v3.visible === true) return true;\n\n _points3[0] = v1.positionScreen;\n _points3[1] = v2.positionScreen;\n _points3[2] = v3.positionScreen;\n\n return _clipBox.isIntersectionBox(_boundingBox.setFromPoints(_points3));\n };\n\n var checkBackfaceCulling = function checkBackfaceCulling(v1, v2, v3) {\n\n return (v3.positionScreen.x - v1.positionScreen.x) * (v2.positionScreen.y - v1.positionScreen.y) - (v3.positionScreen.y - v1.positionScreen.y) * (v2.positionScreen.x - v1.positionScreen.x) < 0;\n };\n\n var pushLine = function pushLine(a, b) {\n\n var v1 = _vertexPool[a];\n var v2 = _vertexPool[b];\n\n _line = getNextLineInPool();\n\n _line.id = object.id;\n _line.v1.copy(v1);\n _line.v2.copy(v2);\n _line.z = (v1.positionScreen.z + v2.positionScreen.z) / 2;\n\n _line.material = object.material;\n\n _renderData.elements.push(_line);\n };\n\n var pushTriangle = function pushTriangle(a, b, c) {\n\n var v1 = _vertexPool[a];\n var v2 = _vertexPool[b];\n var v3 = _vertexPool[c];\n\n if (checkTriangleVisibility(v1, v2, v3) === false) return;\n\n if (material.side === _three2.default.DoubleSide || checkBackfaceCulling(v1, v2, v3) === true) {\n\n _face = getNextFaceInPool();\n\n _face.id = object.id;\n _face.v1.copy(v1);\n _face.v2.copy(v2);\n _face.v3.copy(v3);\n _face.z = (v1.positionScreen.z + v2.positionScreen.z + v3.positionScreen.z) / 3;\n\n for (var i = 0; i < 3; i++) {\n\n var offset = arguments[i] * 3;\n var normal = _face.vertexNormalsModel[i];\n\n normal.set(normals[offset], normals[offset + 1], normals[offset + 2]);\n normal.applyMatrix3(normalMatrix).normalize();\n\n var offset2 = arguments[i] * 2;\n\n var uv = _face.uvs[i];\n uv.set(uvs[offset2], uvs[offset2 + 1]);\n }\n\n _face.vertexNormalsLength = 3;\n\n _face.material = object.material;\n\n _renderData.elements.push(_face);\n }\n };\n\n return {\n setObject: setObject,\n projectVertex: projectVertex,\n checkTriangleVisibility: checkTriangleVisibility,\n checkBackfaceCulling: checkBackfaceCulling,\n pushVertex: pushVertex,\n pushNormal: pushNormal,\n pushUv: pushUv,\n pushLine: pushLine,\n pushTriangle: pushTriangle\n };\n };\n\n var renderList = new RenderList();\n\n this.projectScene = function (scene, camera, sortObjects, sortElements) {\n\n _faceCount = 0;\n _lineCount = 0;\n _spriteCount = 0;\n\n _renderData.elements.length = 0;\n\n if (scene.autoUpdate === true) scene.updateMatrixWorld();\n if (camera.parent === undefined) camera.updateMatrixWorld();\n\n _viewMatrix.copy(camera.matrixWorldInverse.getInverse(camera.matrixWorld));\n _viewProjectionMatrix.multiplyMatrices(camera.projectionMatrix, _viewMatrix);\n\n _frustum.setFromMatrix(_viewProjectionMatrix);\n\n //\n\n _objectCount = 0;\n\n _renderData.objects.length = 0;\n _renderData.lights.length = 0;\n\n scene.traverseVisible(function (object) {\n\n if (object instanceof _three2.default.Light) {\n\n _renderData.lights.push(object);\n } else if (object instanceof _three2.default.Mesh || object instanceof _three2.default.Line || object instanceof _three2.default.Sprite) {\n\n if (object.material.visible === false) return;\n\n if (object.frustumCulled === false || _frustum.intersectsObject(object) === true) {\n\n _object = getNextObjectInPool();\n _object.id = object.id;\n _object.object = object;\n\n if (object.renderDepth !== null) {\n\n _object.z = object.renderDepth;\n } else {\n\n _vector3.setFromMatrixPosition(object.matrixWorld);\n _vector3.applyProjection(_viewProjectionMatrix);\n _object.z = _vector3.z;\n }\n\n _renderData.objects.push(_object);\n }\n }\n });\n\n if (sortObjects === true) {\n\n _renderData.objects.sort(painterSort);\n }\n\n //\n\n for (var o = 0, ol = _renderData.objects.length; o < ol; o++) {\n\n var object = _renderData.objects[o].object;\n var geometry = object.geometry;\n\n renderList.setObject(object);\n\n _modelMatrix = object.matrixWorld;\n\n _vertexCount = 0;\n\n if (object instanceof _three2.default.Mesh) {\n\n if (geometry instanceof _three2.default.BufferGeometry) {\n\n var attributes = geometry.attributes;\n var offsets = geometry.offsets;\n\n if (attributes.position === undefined) continue;\n\n var positions = attributes.position.array;\n\n for (var i = 0, l = positions.length; i < l; i += 3) {\n\n renderList.pushVertex(positions[i], positions[i + 1], positions[i + 2]);\n }\n\n if (attributes.normal !== undefined) {\n\n var normals = attributes.normal.array;\n\n for (var i = 0, l = normals.length; i < l; i += 3) {\n\n renderList.pushNormal(normals[i], normals[i + 1], normals[i + 2]);\n }\n }\n\n if (attributes.uv !== undefined) {\n\n var uvs = attributes.uv.array;\n\n for (var i = 0, l = uvs.length; i < l; i += 2) {\n\n renderList.pushUv(uvs[i], uvs[i + 1]);\n }\n }\n\n if (attributes.index !== undefined) {\n\n var indices = attributes.index.array;\n\n if (offsets.length > 0) {\n\n for (var o = 0; o < offsets.length; o++) {\n\n var offset = offsets[o];\n var index = offset.index;\n\n for (var i = offset.start, l = offset.start + offset.count; i < l; i += 3) {\n\n renderList.pushTriangle(indices[i] + index, indices[i + 1] + index, indices[i + 2] + index);\n }\n }\n } else {\n\n for (var i = 0, l = indices.length; i < l; i += 3) {\n\n renderList.pushTriangle(indices[i], indices[i + 1], indices[i + 2]);\n }\n }\n } else {\n\n for (var i = 0, l = positions.length / 3; i < l; i += 3) {\n\n renderList.pushTriangle(i, i + 1, i + 2);\n }\n }\n } else if (geometry instanceof _three2.default.Geometry) {\n\n var vertices = geometry.vertices;\n var faces = geometry.faces;\n var faceVertexUvs = geometry.faceVertexUvs[0];\n\n _normalMatrix.getNormalMatrix(_modelMatrix);\n\n var isFaceMaterial = object.material instanceof _three2.default.MeshFaceMaterial;\n var objectMaterials = isFaceMaterial === true ? object.material : null;\n\n for (var v = 0, vl = vertices.length; v < vl; v++) {\n\n var vertex = vertices[v];\n renderList.pushVertex(vertex.x, vertex.y, vertex.z);\n }\n\n for (var f = 0, fl = faces.length; f < fl; f++) {\n\n var face = faces[f];\n\n var material = isFaceMaterial === true ? objectMaterials.materials[face.materialIndex] : object.material;\n\n if (material === undefined) continue;\n\n var side = material.side;\n\n var v1 = _vertexPool[face.a];\n var v2 = _vertexPool[face.b];\n var v3 = _vertexPool[face.c];\n\n if (material.morphTargets === true) {\n\n var morphTargets = geometry.morphTargets;\n var morphInfluences = object.morphTargetInfluences;\n\n var v1p = v1.position;\n var v2p = v2.position;\n var v3p = v3.position;\n\n _vA.set(0, 0, 0);\n _vB.set(0, 0, 0);\n _vC.set(0, 0, 0);\n\n for (var t = 0, tl = morphTargets.length; t < tl; t++) {\n\n var influence = morphInfluences[t];\n\n if (influence === 0) continue;\n\n var targets = morphTargets[t].vertices;\n\n _vA.x += (targets[face.a].x - v1p.x) * influence;\n _vA.y += (targets[face.a].y - v1p.y) * influence;\n _vA.z += (targets[face.a].z - v1p.z) * influence;\n\n _vB.x += (targets[face.b].x - v2p.x) * influence;\n _vB.y += (targets[face.b].y - v2p.y) * influence;\n _vB.z += (targets[face.b].z - v2p.z) * influence;\n\n _vC.x += (targets[face.c].x - v3p.x) * influence;\n _vC.y += (targets[face.c].y - v3p.y) * influence;\n _vC.z += (targets[face.c].z - v3p.z) * influence;\n }\n\n v1.position.add(_vA);\n v2.position.add(_vB);\n v3.position.add(_vC);\n\n renderList.projectVertex(v1);\n renderList.projectVertex(v2);\n renderList.projectVertex(v3);\n }\n\n if (renderList.checkTriangleVisibility(v1, v2, v3) === false) continue;\n\n var visible = renderList.checkBackfaceCulling(v1, v2, v3);\n\n if (side !== _three2.default.DoubleSide) {\n if (side === _three2.default.FrontSide && visible === false) continue;\n if (side === _three2.default.BackSide && visible === true) continue;\n }\n\n _face = getNextFaceInPool();\n\n _face.id = object.id;\n _face.v1.copy(v1);\n _face.v2.copy(v2);\n _face.v3.copy(v3);\n\n _face.normalModel.copy(face.normal);\n\n if (visible === false && (side === _three2.default.BackSide || side === _three2.default.DoubleSide)) {\n\n _face.normalModel.negate();\n }\n\n _face.normalModel.applyMatrix3(_normalMatrix).normalize();\n\n var faceVertexNormals = face.vertexNormals;\n\n for (var n = 0, nl = Math.min(faceVertexNormals.length, 3); n < nl; n++) {\n\n var normalModel = _face.vertexNormalsModel[n];\n normalModel.copy(faceVertexNormals[n]);\n\n if (visible === false && (side === _three2.default.BackSide || side === _three2.default.DoubleSide)) {\n\n normalModel.negate();\n }\n\n normalModel.applyMatrix3(_normalMatrix).normalize();\n }\n\n _face.vertexNormalsLength = faceVertexNormals.length;\n\n var vertexUvs = faceVertexUvs[f];\n\n if (vertexUvs !== undefined) {\n\n for (var u = 0; u < 3; u++) {\n\n _face.uvs[u].copy(vertexUvs[u]);\n }\n }\n\n _face.color = face.color;\n _face.material = material;\n\n _face.z = (v1.positionScreen.z + v2.positionScreen.z + v3.positionScreen.z) / 3;\n\n _renderData.elements.push(_face);\n }\n }\n } else if (object instanceof _three2.default.Line) {\n\n if (geometry instanceof _three2.default.BufferGeometry) {\n\n var attributes = geometry.attributes;\n\n if (attributes.position !== undefined) {\n\n var positions = attributes.position.array;\n\n for (var i = 0, l = positions.length; i < l; i += 3) {\n\n renderList.pushVertex(positions[i], positions[i + 1], positions[i + 2]);\n }\n\n if (attributes.index !== undefined) {\n\n var indices = attributes.index.array;\n\n for (var i = 0, l = indices.length; i < l; i += 2) {\n\n renderList.pushLine(indices[i], indices[i + 1]);\n }\n } else {\n\n var step = object.mode === _three2.default.LinePieces ? 2 : 1;\n\n for (var i = 0, l = positions.length / 3 - 1; i < l; i += step) {\n\n renderList.pushLine(i, i + 1);\n }\n }\n }\n } else if (geometry instanceof _three2.default.Geometry) {\n\n _modelViewProjectionMatrix.multiplyMatrices(_viewProjectionMatrix, _modelMatrix);\n\n var vertices = object.geometry.vertices;\n\n if (vertices.length === 0) continue;\n\n v1 = getNextVertexInPool();\n v1.positionScreen.copy(vertices[0]).applyMatrix4(_modelViewProjectionMatrix);\n\n // Handle LineStrip and LinePieces\n var step = object.mode === _three2.default.LinePieces ? 2 : 1;\n\n for (var v = 1, vl = vertices.length; v < vl; v++) {\n\n v1 = getNextVertexInPool();\n v1.positionScreen.copy(vertices[v]).applyMatrix4(_modelViewProjectionMatrix);\n\n if ((v + 1) % step > 0) continue;\n\n v2 = _vertexPool[_vertexCount - 2];\n\n _clippedVertex1PositionScreen.copy(v1.positionScreen);\n _clippedVertex2PositionScreen.copy(v2.positionScreen);\n\n if (clipLine(_clippedVertex1PositionScreen, _clippedVertex2PositionScreen) === true) {\n\n // Perform the perspective divide\n _clippedVertex1PositionScreen.multiplyScalar(1 / _clippedVertex1PositionScreen.w);\n _clippedVertex2PositionScreen.multiplyScalar(1 / _clippedVertex2PositionScreen.w);\n\n _line = getNextLineInPool();\n\n _line.id = object.id;\n _line.v1.positionScreen.copy(_clippedVertex1PositionScreen);\n _line.v2.positionScreen.copy(_clippedVertex2PositionScreen);\n\n _line.z = Math.max(_clippedVertex1PositionScreen.z, _clippedVertex2PositionScreen.z);\n\n _line.material = object.material;\n\n if (object.material.vertexColors === _three2.default.VertexColors) {\n\n _line.vertexColors[0].copy(object.geometry.colors[v]);\n _line.vertexColors[1].copy(object.geometry.colors[v - 1]);\n }\n\n _renderData.elements.push(_line);\n }\n }\n }\n } else if (object instanceof _three2.default.Sprite) {\n\n _vector4.set(_modelMatrix.elements[12], _modelMatrix.elements[13], _modelMatrix.elements[14], 1);\n _vector4.applyMatrix4(_viewProjectionMatrix);\n\n var invW = 1 / _vector4.w;\n\n _vector4.z *= invW;\n\n if (_vector4.z >= -1 && _vector4.z <= 1) {\n\n _sprite = getNextSpriteInPool();\n _sprite.id = object.id;\n _sprite.x = _vector4.x * invW;\n _sprite.y = _vector4.y * invW;\n _sprite.z = _vector4.z;\n _sprite.object = object;\n\n _sprite.rotation = object.rotation;\n\n _sprite.scale.x = object.scale.x * Math.abs(_sprite.x - (_vector4.x + camera.projectionMatrix.elements[0]) / (_vector4.w + camera.projectionMatrix.elements[12]));\n _sprite.scale.y = object.scale.y * Math.abs(_sprite.y - (_vector4.y + camera.projectionMatrix.elements[5]) / (_vector4.w + camera.projectionMatrix.elements[13]));\n\n _sprite.material = object.material;\n\n _renderData.elements.push(_sprite);\n }\n }\n }\n\n if (sortElements === true) {\n\n _renderData.elements.sort(painterSort);\n }\n\n return _renderData;\n };\n\n // Pools\n\n function getNextObjectInPool() {\n\n if (_objectCount === _objectPoolLength) {\n\n var object = new _three2.default.RenderableObject();\n _objectPool.push(object);\n _objectPoolLength++;\n _objectCount++;\n return object;\n }\n\n return _objectPool[_objectCount++];\n }\n\n function getNextVertexInPool() {\n\n if (_vertexCount === _vertexPoolLength) {\n\n var vertex = new _three2.default.RenderableVertex();\n _vertexPool.push(vertex);\n _vertexPoolLength++;\n _vertexCount++;\n return vertex;\n }\n\n return _vertexPool[_vertexCount++];\n }\n\n function getNextFaceInPool() {\n\n if (_faceCount === _facePoolLength) {\n\n var face = new _three2.default.RenderableFace();\n _facePool.push(face);\n _facePoolLength++;\n _faceCount++;\n return face;\n }\n\n return _facePool[_faceCount++];\n }\n\n function getNextLineInPool() {\n\n if (_lineCount === _linePoolLength) {\n\n var line = new _three2.default.RenderableLine();\n _linePool.push(line);\n _linePoolLength++;\n _lineCount++;\n return line;\n }\n\n return _linePool[_lineCount++];\n }\n\n function getNextSpriteInPool() {\n\n if (_spriteCount === _spritePoolLength) {\n\n var sprite = new _three2.default.RenderableSprite();\n _spritePool.push(sprite);\n _spritePoolLength++;\n _spriteCount++;\n return sprite;\n }\n\n return _spritePool[_spriteCount++];\n }\n\n //\n\n function painterSort(a, b) {\n\n if (a.z !== b.z) {\n\n return b.z - a.z;\n } else if (a.id !== b.id) {\n\n return a.id - b.id;\n } else {\n\n return 0;\n }\n }\n\n function clipLine(s1, s2) {\n\n var alpha1 = 0,\n alpha2 = 1,\n\n\n // Calculate the boundary coordinate of each vertex for the near and far clip planes,\n // Z = -1 and Z = +1, respectively.\n bc1near = s1.z + s1.w,\n bc2near = s2.z + s2.w,\n bc1far = -s1.z + s1.w,\n bc2far = -s2.z + s2.w;\n\n if (bc1near >= 0 && bc2near >= 0 && bc1far >= 0 && bc2far >= 0) {\n\n // Both vertices lie entirely within all clip planes.\n return true;\n } else if (bc1near < 0 && bc2near < 0 || bc1far < 0 && bc2far < 0) {\n\n // Both vertices lie entirely outside one of the clip planes.\n return false;\n } else {\n\n // The line segment spans at least one clip plane.\n\n if (bc1near < 0) {\n\n // v1 lies outside the near plane, v2 inside\n alpha1 = Math.max(alpha1, bc1near / (bc1near - bc2near));\n } else if (bc2near < 0) {\n\n // v2 lies outside the near plane, v1 inside\n alpha2 = Math.min(alpha2, bc1near / (bc1near - bc2near));\n }\n\n if (bc1far < 0) {\n\n // v1 lies outside the far plane, v2 inside\n alpha1 = Math.max(alpha1, bc1far / (bc1far - bc2far));\n } else if (bc2far < 0) {\n\n // v2 lies outside the far plane, v2 inside\n alpha2 = Math.min(alpha2, bc1far / (bc1far - bc2far));\n }\n\n if (alpha2 < alpha1) {\n\n // The line segment spans two boundaries, but is outside both of them.\n // (This can't happen when we're only clipping against just near/far but good\n // to leave the check here for future usage if other clip planes are added.)\n return false;\n } else {\n\n // Update the s1 and s2 vertices to match the clipped line segment.\n s1.lerp(s2, alpha1);\n s2.lerp(s1, 1 - alpha2);\n\n return true;\n }\n }\n }\n};\n\n//module.exports = THREE.Projector;\nexports.default = _three2.default.Projector;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/webgl/deps/Projector.js\n ** module id = 148\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/webgl/deps/Projector.js?"); -},function(module,exports,__webpack_require__){eval('"use strict";\n\nObject.defineProperty(exports, "__esModule", {\n value: true\n});\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/**\n * original @author stemkoski / http://github.com/stemkoski\n * modified by @kaosat-dev / http://github.com/kaosat-dev\n * Blend three textures additively\n * texel1 + texel2\n * + vec4(0.5, 0.75, 1.0, 1.0)\n */\n\nvar AdditiveBlendShader = {\n\n uniforms: {\n\n "tDiffuse1": { type: "t", value: null },\n "tDiffuse2": { type: "t", value: null },\n "tDiffuse3": { type: "t", value: null },\n "normalThreshold": { type: "f", value: 0.1 },\n "depthThreshold": { type: "f", value: 0.05 },\n "strengh": { type: "f", value: 0.4 },\n "color": { type: "c", value: new _three2.default.Color(0x000002) }\n },\n\n vertexShader: ["varying vec2 vUv;", "void main() {", "vUv = uv;", "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", "}"].join("\\n"),\n\n fragmentShader: ["uniform sampler2D tDiffuse1;", "uniform sampler2D tDiffuse2;", "uniform sampler2D tDiffuse3;", "uniform float normalThreshold;", "uniform float depthThreshold;", "uniform float strengh;", "uniform vec3 color;", "varying vec2 vUv;", "void main() {", "vec4 colorTexel = texture2D( tDiffuse1, vUv );", "vec4 normalTexel = texture2D( tDiffuse2, vUv );", "vec4 depthTexel = texture2D( tDiffuse3, vUv );", "gl_FragColor = colorTexel;", "if( normalTexel.r >= normalThreshold || depthTexel.r >=depthThreshold) {", "gl_FragColor= colorTexel*(1.0-strengh) + vec4(color[0], color[1], color[2],1);", "}", "}"].join("\\n")\n\n};\n\nexports.default = AdditiveBlendShader;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/webgl/deps/post-process/AdditiveBlendShader.js\n ** module id = 149\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/webgl/deps/post-process/AdditiveBlendShader.js?')},function(module,exports,__webpack_require__){eval('"use strict";\n\nObject.defineProperty(exports, "__esModule", {\n value: true\n});\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/**\n * @author alteredq / http://alteredqualia.com/\n *\n * Full-screen textured quad shader\n */\n\n_three2.default.CopyShader = {\n\n uniforms: {\n\n "tDiffuse": { type: "t", value: null },\n "opacity": { type: "f", value: 1.0 }\n\n },\n\n vertexShader: ["varying vec2 vUv;", "void main() {", "vUv = uv;", "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", "}"].join("\\n"),\n\n fragmentShader: ["uniform float opacity;", "uniform sampler2D tDiffuse;", "varying vec2 vUv;", "void main() {", "vec4 texel = texture2D( tDiffuse, vUv );", "gl_FragColor = opacity * texel;", "}"].join("\\n")\n\n};\n\nexports.default = _three2.default.CopyShader;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/webgl/deps/post-process/CopyShader.js\n ** module id = 150\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/webgl/deps/post-process/CopyShader.js?')},function(module,exports,__webpack_require__){eval('"use strict";\n\nObject.defineProperty(exports, "__esModule", {\n value: true\n});\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/**\n * @author zz85 / https://github.com/zz85 | https://www.lab4games.net/zz85/blog\n *\n * Edge Detection Shader using Sobel filter\n * Based on http://rastergrid.com/blog/2011/01/frei-chen-edge-detector\n *\n * aspect: vec2 of (1/width, 1/height)\n */\n\nvar EdgeShader3 = {\n\n uniforms: {\n\n "tDiffuse": { type: "t", value: null },\n "aspect": { type: "v2", value: new _three2.default.Vector2(512, 512) }\n },\n\n vertexShader: ["varying vec2 vUv;", "void main() {", "vUv = uv;", "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", "}"].join("\\n"),\n\n fragmentShader: ["uniform sampler2D tDiffuse;", "varying vec2 vUv;", "uniform vec2 aspect;", "vec2 texel = vec2(1.0 / aspect.x, 1.0 / aspect.y);", "mat3 G[2];", "const mat3 g0 = mat3( 1.0, 2.0, 1.0, 0.0, 0.0, 0.0, -1.0, -2.0, -1.0 );", "const mat3 g1 = mat3( 1.0, 0.0, -1.0, 2.0, 0.0, -2.0, 1.0, 0.0, -1.0 );", "void main(void)", "{", "mat3 I;", "float cnv[2];", "vec3 sample;", "G[0] = g0;", "G[1] = g1;",\n\n /* fetch the 3x3 neighbourhood and use the RGB vector\'s length as intensity value */\n "for (float i=0.0; i<3.0; i++)", "for (float j=0.0; j<3.0; j++) {", "sample = texture2D( tDiffuse, vUv + texel * vec2(i-1.0,j-1.0) ).rgb;", "I[int(i)][int(j)] = length(sample);", "}",\n\n /* calculate the convolution values for all the masks */\n "for (int i=0; i<2; i++) {", "float dp3 = dot(G[i][0], I[0]) + dot(G[i][1], I[1]) + dot(G[i][2], I[2]);", "cnv[i] = dp3 * dp3; ", "}", "gl_FragColor = vec4(0.5 * sqrt(cnv[0]*cnv[0]+cnv[1]*cnv[1]));", "} "].join("\\n")\n\n};\n\nexports.default = EdgeShader3;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/webgl/deps/post-process/EdgeShader3.js\n ** module id = 151\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/webgl/deps/post-process/EdgeShader3.js?')},function(module,exports,__webpack_require__){eval('"use strict";\n\nObject.defineProperty(exports, "__esModule", {\n value: true\n});\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/**\n * @author alteredq / http://alteredqualia.com/\n */\n\n_three2.default.EffectComposer = function (renderer, renderTarget) {\n\n this.renderer = renderer;\n\n if (renderTarget === undefined) {\n\n var pixelRatio = renderer.getPixelRatio();\n\n var width = Math.floor(renderer.context.canvas.width / pixelRatio) || 1;\n var height = Math.floor(renderer.context.canvas.height / pixelRatio) || 1;\n var parameters = { minFilter: _three2.default.LinearFilter, magFilter: _three2.default.LinearFilter, format: _three2.default.RGBFormat, stencilBuffer: false };\n\n renderTarget = new _three2.default.WebGLRenderTarget(width, height, parameters);\n }\n\n this.renderTarget1 = renderTarget;\n this.renderTarget2 = renderTarget.clone();\n\n this.writeBuffer = this.renderTarget1;\n this.readBuffer = this.renderTarget2;\n\n this.passes = [];\n\n if (_three2.default.CopyShader === undefined) console.error("THREE.EffectComposer relies on THREE.CopyShader");\n\n this.copyPass = new _three2.default.ShaderPass(_three2.default.CopyShader);\n};\n\n_three2.default.EffectComposer.prototype = {\n\n swapBuffers: function swapBuffers() {\n\n var tmp = this.readBuffer;\n this.readBuffer = this.writeBuffer;\n this.writeBuffer = tmp;\n },\n\n addPass: function addPass(pass) {\n\n this.passes.push(pass);\n },\n\n insertPass: function insertPass(pass, index) {\n\n this.passes.splice(index, 0, pass);\n },\n\n render: function render(delta) {\n\n this.writeBuffer = this.renderTarget1;\n this.readBuffer = this.renderTarget2;\n\n var maskActive = false;\n\n var pass,\n i,\n il = this.passes.length;\n\n for (i = 0; i < il; i++) {\n\n pass = this.passes[i];\n\n if (!pass.enabled) continue;\n\n pass.render(this.renderer, this.writeBuffer, this.readBuffer, delta, maskActive);\n\n if (pass.needsSwap) {\n\n if (maskActive) {\n\n var context = this.renderer.context;\n\n context.stencilFunc(context.NOTEQUAL, 1, 0xffffffff);\n\n this.copyPass.render(this.renderer, this.writeBuffer, this.readBuffer, delta);\n\n context.stencilFunc(context.EQUAL, 1, 0xffffffff);\n }\n\n this.swapBuffers();\n }\n\n if (pass instanceof _three2.default.MaskPass) {\n\n maskActive = true;\n } else if (pass instanceof _three2.default.ClearMaskPass) {\n\n maskActive = false;\n }\n }\n },\n\n reset: function reset(renderTarget) {\n\n if (renderTarget === undefined) {\n\n renderTarget = this.renderTarget1.clone();\n\n var pixelRatio = this.renderer.getPixelRatio();\n\n renderTarget.width = Math.floor(this.renderer.context.canvas.width / pixelRatio);\n renderTarget.height = Math.floor(this.renderer.context.canvas.height / pixelRatio);\n }\n\n this.renderTarget1 = renderTarget;\n this.renderTarget2 = renderTarget.clone();\n\n this.writeBuffer = this.renderTarget1;\n this.readBuffer = this.renderTarget2;\n },\n\n setSize: function setSize(width, height) {\n\n var renderTarget = this.renderTarget1.clone();\n\n renderTarget.width = width;\n renderTarget.height = height;\n\n this.reset(renderTarget);\n }\n\n};\nexports.default = _three2.default.EffectComposer;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/webgl/deps/post-process/EffectComposer.js\n ** module id = 152\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/webgl/deps/post-process/EffectComposer.js?')},function(module,exports,__webpack_require__){eval('"use strict";\n\nObject.defineProperty(exports, "__esModule", {\n value: true\n});\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/**\n * @author alteredq / http://alteredqualia.com/\n * @author davidedc / http://www.sketchpatch.net/\n *\n * NVIDIA FXAA by Timothy Lottes\n * http://timothylottes.blogspot.com/2011/06/fxaa3-source-released.html\n * - WebGL port by @supereggbert\n * http://www.glge.org/demos/fxaa/\n */\n\n_three2.default.FXAAShader = {\n\n uniforms: {\n\n "tDiffuse": { type: "t", value: null },\n "resolution": { type: "v2", value: new _three2.default.Vector2(1 / 1024, 1 / 512) }\n\n },\n\n vertexShader: ["void main() {", "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", "}"].join("\\n"),\n\n fragmentShader: ["uniform sampler2D tDiffuse;", "uniform vec2 resolution;", "#define FXAA_REDUCE_MIN (1.0/128.0)", "#define FXAA_REDUCE_MUL (1.0/8.0)", "#define FXAA_SPAN_MAX 8.0", "void main() {", "vec3 rgbNW = texture2D( tDiffuse, ( gl_FragCoord.xy + vec2( -1.0, -1.0 ) ) * resolution ).xyz;", "vec3 rgbNE = texture2D( tDiffuse, ( gl_FragCoord.xy + vec2( 1.0, -1.0 ) ) * resolution ).xyz;", "vec3 rgbSW = texture2D( tDiffuse, ( gl_FragCoord.xy + vec2( -1.0, 1.0 ) ) * resolution ).xyz;", "vec3 rgbSE = texture2D( tDiffuse, ( gl_FragCoord.xy + vec2( 1.0, 1.0 ) ) * resolution ).xyz;", "vec4 rgbaM = texture2D( tDiffuse, gl_FragCoord.xy * resolution );", "vec3 rgbM = rgbaM.xyz;", "vec3 luma = vec3( 0.299, 0.587, 0.114 );", "float lumaNW = dot( rgbNW, luma );", "float lumaNE = dot( rgbNE, luma );", "float lumaSW = dot( rgbSW, luma );", "float lumaSE = dot( rgbSE, luma );", "float lumaM = dot( rgbM, luma );", "float lumaMin = min( lumaM, min( min( lumaNW, lumaNE ), min( lumaSW, lumaSE ) ) );", "float lumaMax = max( lumaM, max( max( lumaNW, lumaNE) , max( lumaSW, lumaSE ) ) );", "vec2 dir;", "dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));", "dir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE));", "float dirReduce = max( ( lumaNW + lumaNE + lumaSW + lumaSE ) * ( 0.25 * FXAA_REDUCE_MUL ), FXAA_REDUCE_MIN );", "float rcpDirMin = 1.0 / ( min( abs( dir.x ), abs( dir.y ) ) + dirReduce );", "dir = min( vec2( FXAA_SPAN_MAX, FXAA_SPAN_MAX),", "max( vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX),", "dir * rcpDirMin)) * resolution;", "vec4 rgbA = (1.0/2.0) * (", "texture2D(tDiffuse, gl_FragCoord.xy * resolution + dir * (1.0/3.0 - 0.5)) +", "texture2D(tDiffuse, gl_FragCoord.xy * resolution + dir * (2.0/3.0 - 0.5)));", "vec4 rgbB = rgbA * (1.0/2.0) + (1.0/4.0) * (", "texture2D(tDiffuse, gl_FragCoord.xy * resolution + dir * (0.0/3.0 - 0.5)) +", "texture2D(tDiffuse, gl_FragCoord.xy * resolution + dir * (3.0/3.0 - 0.5)));", "float lumaB = dot(rgbB, vec4(luma, 0.0));", "if ( ( lumaB < lumaMin ) || ( lumaB > lumaMax ) ) {", "gl_FragColor = rgbA;", "} else {", "gl_FragColor = rgbB;", "}", "}"].join("\\n")\n\n};\n\nexports.default = _three2.default.FXAAShader;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/webgl/deps/post-process/FXAAShader.js\n ** module id = 153\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/webgl/deps/post-process/FXAAShader.js?')},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.ClearMaskPass = exports.MaskPass = undefined;\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/**\n * @author alteredq / http://alteredqualia.com/\n */\n\n_three2.default.MaskPass = function (scene, camera) {\n\n this.scene = scene;\n this.camera = camera;\n\n this.enabled = true;\n this.clear = true;\n this.needsSwap = false;\n\n this.inverse = false;\n};\n\n_three2.default.MaskPass.prototype = {\n\n render: function render(renderer, writeBuffer, readBuffer, delta) {\n\n var context = renderer.context;\n\n // don't update color or depth\n\n context.colorMask(false, false, false, false);\n context.depthMask(false);\n\n // set up stencil\n\n var writeValue, clearValue;\n\n if (this.inverse) {\n\n writeValue = 0;\n clearValue = 1;\n } else {\n\n writeValue = 1;\n clearValue = 0;\n }\n\n context.enable(context.STENCIL_TEST);\n context.stencilOp(context.REPLACE, context.REPLACE, context.REPLACE);\n context.stencilFunc(context.ALWAYS, writeValue, 0xffffffff);\n context.clearStencil(clearValue);\n\n // draw into the stencil buffer\n\n renderer.render(this.scene, this.camera, readBuffer, this.clear);\n renderer.render(this.scene, this.camera, writeBuffer, this.clear);\n\n // re-enable update of color and depth\n\n context.colorMask(true, true, true, true);\n context.depthMask(true);\n\n // only render where stencil is set to 1\n\n context.stencilFunc(context.EQUAL, 1, 0xffffffff); // draw if == 1\n context.stencilOp(context.KEEP, context.KEEP, context.KEEP);\n }\n\n};\n\n_three2.default.ClearMaskPass = function () {\n\n this.enabled = true;\n};\n\n_three2.default.ClearMaskPass.prototype = {\n\n render: function render(renderer, writeBuffer, readBuffer, delta) {\n\n var context = renderer.context;\n\n context.disable(context.STENCIL_TEST);\n }\n\n};\n\nvar MaskPass = _three2.default.MaskPass;\nvar ClearMaskPass = _three2.default.ClearMaskPass;\nexports.MaskPass = MaskPass;\nexports.ClearMaskPass = ClearMaskPass;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/webgl/deps/post-process/MaskPass.js\n ** module id = 154\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/webgl/deps/post-process/MaskPass.js?")},function(module,exports){eval('"use strict";\n\nObject.defineProperty(exports, "__esModule", {\n value: true\n});\nvar shader = {\n \'outline\': {\n vertex_shader: ["uniform float offset;", "void main() {", "vec4 pos = vec4( position + normal * offset/2.0, 1.0 );", "gl_Position = projectionMatrix * modelViewMatrix * pos;", "}"].join("\\n"),\n\n fragment_shader: ["uniform vec3 color;", "void main(){", "gl_FragColor = vec4(color,1.0); //vec4( 1.0, 0.0, 0.0, 1.0 );", "}"].join("\\n")\n }\n};\n\nexports.default = shader;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/webgl/deps/post-process/OutlineShader.js\n ** module id = 155\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/webgl/deps/post-process/OutlineShader.js?')},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/**\n * @author alteredq / http://alteredqualia.com/\n */\n\n_three2.default.RenderPass = function (scene, camera, overrideMaterial, clearColor, clearAlpha) {\n\n this.scene = scene;\n this.camera = camera;\n\n this.overrideMaterial = overrideMaterial;\n\n this.clearColor = clearColor;\n this.clearAlpha = clearAlpha !== undefined ? clearAlpha : 1;\n\n this.oldClearColor = new _three2.default.Color();\n this.oldClearAlpha = 1;\n\n this.enabled = true;\n this.clear = true;\n this.needsSwap = false;\n};\n\n_three2.default.RenderPass.prototype = {\n\n render: function render(renderer, writeBuffer, readBuffer, delta) {\n\n this.scene.overrideMaterial = this.overrideMaterial;\n\n if (this.clearColor) {\n\n this.oldClearColor.copy(renderer.getClearColor());\n this.oldClearAlpha = renderer.getClearAlpha();\n\n renderer.setClearColor(this.clearColor, this.clearAlpha);\n }\n\n renderer.render(this.scene, this.camera, readBuffer, this.clear);\n\n if (this.clearColor) {\n\n renderer.setClearColor(this.oldClearColor, this.oldClearAlpha);\n }\n\n this.scene.overrideMaterial = null;\n }\n\n};\n\nexports.default = _three2.default.RenderPass;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/webgl/deps/post-process/RenderPass.js\n ** module id = 156\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/webgl/deps/post-process/RenderPass.js?")},function(module,exports,__webpack_require__){eval('"use strict";\n\nObject.defineProperty(exports, "__esModule", {\n value: true\n});\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/**\n * @author alteredq / http://alteredqualia.com/\n */\n\n_three2.default.ShaderPass = function (shader, textureID) {\n\n this.textureID = textureID !== undefined ? textureID : "tDiffuse";\n\n this.uniforms = _three2.default.UniformsUtils.clone(shader.uniforms);\n\n this.material = new _three2.default.ShaderMaterial({\n\n defines: shader.defines || {},\n uniforms: this.uniforms,\n vertexShader: shader.vertexShader,\n fragmentShader: shader.fragmentShader\n\n });\n\n this.renderToScreen = false;\n\n this.enabled = true;\n this.needsSwap = true;\n this.clear = false;\n\n this.camera = new _three2.default.OrthographicCamera(-1, 1, 1, -1, 0, 1);\n this.scene = new _three2.default.Scene();\n\n this.quad = new _three2.default.Mesh(new _three2.default.PlaneBufferGeometry(2, 2), null);\n this.scene.add(this.quad);\n};\n\n_three2.default.ShaderPass.prototype = {\n\n render: function render(renderer, writeBuffer, readBuffer, delta) {\n\n if (this.uniforms[this.textureID]) {\n\n this.uniforms[this.textureID].value = readBuffer;\n }\n\n this.quad.material = this.material;\n\n if (this.renderToScreen) {\n\n renderer.render(this.scene, this.camera);\n } else {\n\n renderer.render(this.scene, this.camera, writeBuffer, this.clear);\n }\n }\n\n};\n\nexports.default = _three2.default.ShaderPass;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/webgl/deps/post-process/ShaderPass.js\n ** module id = 157\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/webgl/deps/post-process/ShaderPass.js?')},function(module,exports,__webpack_require__){eval('"use strict";\n\nObject.defineProperty(exports, "__esModule", {\n value: true\n});\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/**\n * @author alteredq / http://alteredqualia.com/\n *\n * Vignette shader\n * based on PaintEffect postprocess from ro.me\n * http://code.google.com/p/3-dreams-of-black/source/browse/deploy/js/effects/PaintEffect.js\n */\n\n_three2.default.VignetteShader = {\n\n uniforms: {\n\n "tDiffuse": { type: "t", value: null },\n "offset": { type: "f", value: 1.0 },\n "darkness": { type: "f", value: 1.0 }\n\n },\n\n vertexShader: ["varying vec2 vUv;", "void main() {", "vUv = uv;", "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", "}"].join("\\n"),\n\n fragmentShader: ["uniform float offset;", "uniform float darkness;", "uniform sampler2D tDiffuse;", "varying vec2 vUv;", "void main() {",\n\n // Eskil\'s vignette\n\n "vec4 texel = texture2D( tDiffuse, vUv );", "vec2 uv = ( vUv - vec2( 0.5 ) ) * vec2( offset );", "gl_FragColor = vec4( mix( texel.rgb, vec3( 1.0 - darkness ), dot( uv, uv ) ), texel.a );",\n\n /*\n // alternative version from glfx.js\n // this one makes more "dusty" look (as opposed to "burned")\n "vec4 color = texture2D( tDiffuse, vUv );",\n "float dist = distance( vUv, vec2( 0.5 ) );",\n "color.rgb *= smoothstep( 0.8, offset * 0.799, dist *( darkness + offset ) );",\n "gl_FragColor = color;",\n */\n\n "}"].join("\\n")\n\n};\n\nexports.default = _three2.default.VignetteShader;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/webgl/deps/post-process/vignetteShader.js\n ** module id = 158\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/webgl/deps/post-process/vignetteShader.js?')},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = intent;\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nvar _pointers = __webpack_require__(74);\n\nvar _sizing = __webpack_require__(75);\n\nvar _obsUtils = __webpack_require__(5);\n\nvar _utils = __webpack_require__(69);\n\nvar _utils2 = __webpack_require__(3);\n\nvar _Selector = __webpack_require__(68);\n\nvar _ramda = __webpack_require__(4);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar _Rx$Observable = _rx2.default.Observable;\nvar fromEvent = _Rx$Observable.fromEvent;\nvar merge = _Rx$Observable.merge;\n\n\n// get original data + picking infos\nfunction addPickingInfos(inStream$, containerResizes$, camera, scene) {\n return inStream$.withLatestFrom(containerResizes$, function (event, clientRect) {\n if (event) {\n var input = document.querySelector('.container'); // canvas\n var _clientRect = input.getBoundingClientRect();\n\n var data = {\n pos: {\n x: event.clientX,\n y: event.clientY },\n rect: _clientRect,\n width: _clientRect.width,\n height: _clientRect.height,\n event: event };\n var mouseCoords = (0, _Selector.getCoordsFromPosSizeRect)(data);\n return (0, _utils.selectionAt)(event, mouseCoords, camera, scene.children);\n } else {\n return {};\n }\n });\n}\n\n// extract the object & position from a pickingInfo data\nfunction objectAndPosition(pickingInfo) {\n return { object: pickingInfo.object, point: pickingInfo.point };\n}\n\nfunction intent(sources, data) {\n var DOM = sources.DOM;\n var camera = data.camera;\n var scene = data.scene;\n var transformControls = data.transformControls;\n var props$ = data.props$;\n var settings$ = data.settings$;\n\n\n var windowResizes$ = (0, _sizing.windowResizes)(1); // get from intents/interactions ?\n var elementResizes$ = (0, _sizing.elementResizes)('.container', 1);\n\n var _pointerInteractions = (0, _pointers.pointerInteractions)((0, _pointers.interactionsFromCEvents)(DOM));\n\n var shortSingleTaps$ = _pointerInteractions.shortSingleTaps$;\n var shortDoubleTaps$ = _pointerInteractions.shortDoubleTaps$;\n var longTaps$ = _pointerInteractions.longTaps$;\n var zooms$ = _pointerInteractions.zooms$;\n var dragMoves$ = _pointerInteractions.dragMoves$;\n\n // FIXME : needs to be done in a more coherent, reusable way\n // shut down \"wobble effect if ANY user interaction takes place\"\n\n var userAction$ = merge(shortSingleTaps$, shortDoubleTaps$, longTaps$, zooms$, dragMoves$); // .subscribe(e=>wobble.stop())\n\n // Prevent contextmenu for all of the gl canvas FIXME: side effect ?\n DOM.select('canvas').events('contextmenu').subscribe(function (e) {\n return (0, _obsUtils.preventDefault)(e);\n });\n\n // stream of container resize events\n var containerResizes$ = windowResizes$.map(function () {\n var input = document.querySelector('.container'); // canvas\n if (input) return input.getBoundingClientRect();\n }).filter(_obsUtils.exists).startWith({ width: window.innerWidth, height: window.innerHeight, aspect: window.innerWidth / window.innerHeight, bRect: undefined });\n\n // are the transform controls active : ie we are dragging, rotating, scaling an object\n var tControlsActive$ = merge(fromEvent(transformControls, 'mouseDown').map(true), fromEvent(transformControls, 'mouseUp').map(false)).startWith(false);\n // .tap(e=>console.log( \"transform controls active\",e ))\n\n var shortSingleTapsWPicking$ = addPickingInfos(shortSingleTaps$, windowResizes$, camera, scene).shareReplay(1);\n var shortDoubleTapsWPicking$ = addPickingInfos(shortDoubleTaps$, windowResizes$, camera, scene).shareReplay(1);\n var longTapsWPicking$ = addPickingInfos(longTaps$, windowResizes$, camera, scene).withLatestFrom(tControlsActive$, function (longTaps, tCActive) {\n // disable long taps in case we are manipulating an object\n if (tCActive) return undefined;\n return longTaps;\n }).filter(_obsUtils.exists).shareReplay(1);\n\n // contextmenu observable should return undifined when any other basic interaction\n // took place (to cancel displaying context menu , etc)\n /* longTapsWPicking$ = longTapsWPicking$\n .merge(\n shortSingleTapsWPicking$.map(undefined),\n shortDoubleTapsWPicking$.map(undefined),\n dragMoves$.map(undefined)\n )*/\n\n // zoom action intent\n var zoomInOnPoint$ = shortDoubleTapsWPicking$.map(function (e) {\n return e.detail.pickingInfos.shift();\n }).filter(_obsUtils.exists).map(objectAndPosition);\n\n var zoomToFit$ = _rx2.default.Observable.just(true); // DOM.select('#zoomToFit').events(\"click\")\n\n // Stream of selected meshes\n var selectMeshes$ = merge(shortSingleTapsWPicking$.map(_utils.meshFrom), longTapsWPicking$.map(_utils.meshFrom)).map(_utils2.toArray) // important !! consumers expect arrays\n // .distinctUntilChanged()\n .shareReplay(1);\n\n // if transformControls are active\n // filter out dragMove gestures: ie prevent camera from moving/rotating\n var fDragMoves$ = dragMoves$.withLatestFrom(tControlsActive$, function (dragMoves, tCActive) {\n if (tCActive) return undefined;\n return dragMoves;\n }).filter(_obsUtils.exists);\n\n // actual stream used for camera controls: dragMove gestures + zoom gestures\n var filteredInteractions$ = { dragMoves$: fDragMoves$, zooms$: zooms$ };\n\n var selections$ = props$.pluck('selections').startWith([]).filter(_obsUtils.exists).distinctUntilChanged().map(function (x) {\n return x.map(function (y) {\n return y.id;\n });\n }); // we just need the ids\n var transforms$ = props$.pluck('meshes'); //.withLatestFrom(selections$,function(transforms, selections))\n var activeTool$ = settings$.pluck('activeTool').startWith(undefined).distinctUntilChanged();\n\n // stream of transformations done on the current selection\n var selectionsTransforms$ = fromEvent(transformControls, 'objectChange')\n //.tap(e=>console.log('sdfsdf',e))\n .map(_utils.targetObject).withLatestFrom(selections$, activeTool$, transforms$, function (t, selections, activeTool, _transforms) {\n var transform = { 'translate': 'pos', 'rotate': 'rot', 'scale': 'sca' }[activeTool];\n\n /*FIXME: horrid, we have to deal with transforms on the meshes (horrors of OOP & mutability)\n //FIXME: also we need to do this whole thing since only ONE object is actually transformed\n by transformcontrols, so we first compute the average of all mesh positions, then we get the\n position of the updated position, do a difference between the avg & modified one, and add it to the changed value\n HORRIBLY Convoluted, but will not be the case anymore with regl/functional opengl/webgl\n */\n function valueMap(mesh, transform) {\n var mapper = {\n pos: mesh.position.toArray().slice(0, 3),\n rot: mesh.rotation.toArray().slice(0, 3),\n sca: mesh.scale.toArray().slice(0, 3).map(function (val, index) {\n return mesh.flipped && mesh.flipped[index] === 1 ? val * -1 : val;\n }) //to handle negative scaling/mirrored data, as the transformControls always return values >0\n };\n return mapper[transform];\n }\n\n //FIXME : only needed if data storage is a hash\n _transforms = selections.map(function (input) {\n return _transforms[input];\n }) // get only needed ones\n .map(function (mesh) {\n var res = {};\n res[transform] = valueMap(mesh, transform);\n return res;\n });\n\n var avg = (0, _ramda.pluck)(transform)(_transforms).reduce(function (acc, cur) {\n if (!acc) return cur;\n return [acc[0] + cur[0], acc[1] + cur[1], acc[2] + cur[2]].map(function (x) {\n return x * 0.5;\n });\n }, undefined);\n\n var tranformedValue = valueMap(t, transform);\n var diff = [avg[0] - tranformedValue[0], avg[1] - tranformedValue[1], avg[2] - tranformedValue[2]];\n var value = [diff[0] + tranformedValue[0], diff[1] + tranformedValue[1], diff[2] + tranformedValue[2]];\n\n //const realValue =\n return { value: value, trans: transform, ids: selections };\n }).map(function (data) {\n // format data so that we have an array of changes, by id\n var value = data.value;\n var trans = data.trans;\n var ids = data.ids;\n\n return ids.map(function (id) {\n return { value: value, trans: trans, id: id };\n });\n });\n\n return {\n userAction$: userAction$,\n zoomInOnPoint$: zoomInOnPoint$,\n zoomToFit$: zoomToFit$,\n selectMeshes$: selectMeshes$,\n shortSingleTapsWPicking$: shortSingleTapsWPicking$,\n shortDoubleTapsWPicking$: shortDoubleTapsWPicking$,\n longTapsWPicking$: longTapsWPicking$,\n filteredInteractions$: filteredInteractions$,\n selectionsTransforms$: selectionsTransforms$ };\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/webgl/intent.js\n ** module id = 159\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/webgl/intent.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol ? \"symbol\" : typeof obj; };\n\nexports.default = model;\n\nvar _obsUtils = __webpack_require__(5);\n\nvar _ramda = __webpack_require__(4);\n\nvar _visualMakers = __webpack_require__(164);\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n// let requestAnimationFrameScheduler = Rx.Scheduler.requestAnimationFrame\n// problem : this fires BEFORE the rest is ready\n// activeTool$.skip(1).filter(isTransformTool).subscribe(transformControls.setMode)\n\nfunction setFlags(mesh) {\n mesh.selectable = true;\n mesh.selectTrickleUp = false;\n mesh.transformable = true;\n // FIXME: not sure, these are very specific for visuals\n mesh.castShadow = true;\n return mesh;\n}\n\nfunction makeRemoteMeshVisual(meta, transform, mesh) {\n if (meta && transform && mesh) {\n var _ret = function () {\n\n // this is for mirroring\n\n var isOdd = function isOdd(num) {\n return num % 2;\n };\n\n var handleMirroring = function handleMirroring() {\n var flipped = mesh.flipped || [0, 0, 0];\n var mS = new _three2.default.Matrix4().identity();\n var conv = [0, 5, 10];\n\n transform.sca.map(function (val) {\n return val < 0;\n }).forEach(function (val, index) {\n if (val && flipped[index] === 0) {\n mS.elements[conv[index]] = -1;\n flipped[index] = 1;\n }\n // flip back\n if (!val && flipped[index] === 1) {\n mS.elements[conv[index]] = -1;\n flipped[index] = 0;\n }\n });\n mesh.geometry.applyMatrix(mS);\n mesh.flipped = flipped;\n var inversions = flipped.reduce(function (prev, curr) {\n return prev + curr;\n });\n mesh.material.side = isOdd(inversions) ? _three2.default.BackSide : 0;\n };\n\n // only apply changes to mesh IF the current transform is different ?\n // console.log(\"transforms\",transform)\n if (!(0, _ramda.equals)(mesh.position.toArray(), transform.pos)) {\n mesh.position.fromArray(transform.pos);\n }\n if (!(0, _ramda.equals)(mesh.rotation.toArray(), transform.rot)) {\n mesh.rotation.fromArray(transform.rot);\n }\n if (!(0, _ramda.equals)(mesh.scale.toArray(), transform.sca)) {\n mesh.scale.fromArray(transform.sca.map(Math.abs));\n }\n // color is stored in meta component\n mesh.material.color.set(meta.color);\n handleMirroring();\n\n return {\n v: setFlags(mesh)\n };\n }();\n\n if ((typeof _ret === 'undefined' ? 'undefined' : _typeof(_ret)) === \"object\") return _ret.v;\n }\n}\n\nfunction getVisual(components) {\n var meta = components.meta; // {components}\n\n var keys = Object.keys(meta);\n var metas = meta;\n\n return keys.map(function (key) {\n var meta = metas[key];\n var transform = components.transforms[key];\n var mesh = components.meshes[key];\n\n // TODO: refactor this horror\n if (meta.typeUid === 'A1') {\n // typeUid:\"A1\"=> notes\n return (0, _visualMakers.makeNoteVisual)(meta, components.meshes);\n } else if (meta.typeUid === 'A2') {\n return (0, _visualMakers.makeThicknessVisual)(meta, components.meshes);\n } else if (meta.typeUid === 'A3') {\n return (0, _visualMakers.makeDiameterVisual)(meta, components.meshes);\n } else if (meta.typeUid === 'A4') {\n return (0, _visualMakers.makeDistanceVisual)(meta, components.meshes);\n } else if (meta.typeUid === 'A5') {\n return (0, _visualMakers.makeAngleVisual)(meta, components.meshes);\n } else {\n return makeRemoteMeshVisual(meta, transform, mesh);\n }\n }).filter(function (m) {\n return m !== undefined;\n });\n}\n\nfunction model(props$, actions) {\n var settings$ = props$.pluck('settings');\n var selections$ = props$.pluck('selections').startWith([]).filter(_obsUtils.exists).distinctUntilChanged();\n var activeTool$ = settings$.pluck('activeTool').startWith(undefined);\n // every time either activeTool or selection changes, reset/update transform controls\n\n // composite data\n var meta$ = props$.pluck('meta').distinctUntilChanged();\n var transforms$ = props$.pluck('transforms'); // .distinctUntilChanged()\n var meshes$ = props$.pluck('meshes').filter(_obsUtils.exists).distinctUntilChanged(function (m) {\n return Object.keys(m);\n });\n // this is for any NON composite data , so pure mesh /visuals withouth any metadata, transformsetc\n var rawVisuals$ = props$.pluck('rawVisuals').startWith(undefined).distinctUntilChanged().tap(function (e) {\n return console.log('rawVisuals', e);\n });\n\n // FIXME: items is emiting WAAY too much values, look into why it does so\n // combine All needed components to apply any \"transforms\" to their visuals\n var items0$ = (0, _obsUtils.combineLatestObj)({ meta$: meta$, transforms$: transforms$, meshes$: meshes$ }).debounce(1) // ignore if we have too fast changes in any of the 3 components\n // .distinctUntilChanged()\n .map(getVisual)\n // .sample(0, requestAnimationFrameScheduler)\n // .distinctUntilChanged()\n // .tap(e => console.log('DONE with items in GLView', e))\n .combineLatest(rawVisuals$, function (composites, raw) {\n // console.log('composites', composites,'raw',raw)\n return composites;\n }).filter(_obsUtils.exists).tap(function (e) {\n return console.log('items', e);\n }).shareReplay(1);\n\n var items$ = props$.debounce(1).map(function (props) {\n var meta = props.meta;\n var transforms = props.transforms;\n var meshes = props.meshes;\n var visual = getVisual({ meta: meta, transforms: transforms, meshes: meshes });\n return visual.concat(props.rawVisuals);\n }).startWith(undefined).filter(_obsUtils.exists)\n // .tap(e => console.log('items2', e))\n .shareReplay(1);\n\n // \"external\" selected meshes\n var selectedMeshesFromSelections$ = selections$.withLatestFrom(meshes$, function (selections, meshes) {\n return selections.filter(_obsUtils.exists).map(function (s) {\n return meshes[s.id];\n });\n }).distinctUntilChanged().startWith([]).shareReplay(1);\n\n var selectedMeshes$ = actions.selectMeshes$ // these are only selections made WITHIN the GL view\n .merge(selectedMeshesFromSelections$)\n // this limits \"selectability\" to transforms & default\n .withLatestFrom(activeTool$, function (meshes, tool) {\n var idx = ['translate', 'rotate', 'scale', undefined].indexOf(tool);\n var result = idx > -1 ? meshes : [];\n\n return result;\n }).distinctUntilChanged().startWith([]);\n\n var focusedMeshesFromFocusedEntities$ = props$.pluck('focusedEntities').startWith([]).filter(_obsUtils.exists).distinctUntilChanged().withLatestFrom(meshes$, function (selections, meshes) {\n return selections.filter(_obsUtils.exists).map(function (id) {\n return meshes[id];\n });\n }).merge(actions.selectMeshes$.filter(function (sm) {\n return sm.length === 0;\n })) //we want to be able to reset selections to nothing\n .tap(function (e) {\n return console.log('selections in glView', e);\n }).distinctUntilChanged().startWith([]);\n\n return (0, _obsUtils.combineLatestObj)({\n items$: items$,\n selectedMeshes$: selectedMeshes$,\n selectedMeshesFromSelections$: selectedMeshesFromSelections$,\n focusedMeshesFromFocusedEntities$: focusedMeshesFromFocusedEntities$\n });\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/webgl/model.js\n ** module id = 160\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/webgl/model.js?"); -},function(module,exports){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nvar presets = exports.presets = {\n renderer: {\n shadowMapEnabled: true,\n shadowMapAutoUpdate: true,\n shadowMapSoft: true,\n shadowMapType: undefined, // THREE.PCFSoftShadowMap,//THREE.PCFSoftShadowMap,//PCFShadowMap\n autoUpdateScene: true, // Default ?\n physicallyBasedShading: false, // Default ?\n autoClear: true, // Default ?\n gammaInput: false,\n gammaOutput: false\n },\n cameras: [{\n name: 'mainCamera',\n pos: [75, 75, 145], // [100,-100,100]\n up: [0, 0, 1],\n lens: {\n fov: 45,\n near: 0.1,\n far: 20000\n }\n }],\n controls: [{\n up: [0, 0, 1],\n rotateSpeed: 2.0,\n panSpeed: 2.0,\n zoomSpeed: 2.0,\n autoRotate: {\n enabled: false,\n speed: 0.2\n },\n _enabled: true,\n _active: true\n }],\n scenes: {\n 'main': [\n // { type:\"hemisphereLight\", color:\"#FFFF33\", gndColor:\"#FF9480\", pos:[0, 0, 500], intensity:0.6 },\n { type: 'hemisphereLight', color: '#FFEEEE', gndColor: '#FFFFEE', pos: [0, 1200, 1500], intensity: 0.8 }, { type: 'ambientLight', color: '#0x252525', intensity: 0.03 }, { type: 'directionalLight', color: '#262525', intensity: 0.2, pos: [150, 150, 1500], castShadow: true, onlyShadow: true }\n // { type:\"directionalLight\", color:\"#FFFFFF\", intensity:0.2 , pos:[150,150,1500], castShadow:true, onlyShadow:true}\n ],\n 'helpers': [{ type: 'LabeledGrid' }]\n }\n};\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/webgl/presets.js\n ** module id = 161\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/webgl/presets.js?")},function(module,exports,__webpack_require__){eval('"use strict";\n\nObject.defineProperty(exports, "__esModule", {\n value: true\n});\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar GizmoMaterial = function GizmoMaterial(parameters) {\n\n _three2.default.MeshBasicMaterial.call(this);\n\n this.depthTest = false;\n this.depthWrite = false;\n this.side = _three2.default.FrontSide;\n this.transparent = true;\n\n this.setValues(parameters);\n\n this.oldColor = this.color.clone();\n this.oldOpacity = this.opacity;\n\n this.highlight = function (highlighted) {\n\n if (highlighted) {\n\n this.color.setRGB(1, 1, 0);\n this.opacity = 1;\n } else {\n\n this.color.copy(this.oldColor);\n this.opacity = this.oldOpacity;\n }\n };\n}; /**\n * @author arodic / https://github.com/arodic\n */\n/*jshint sub:true*/\n\n\nGizmoMaterial.prototype = Object.create(_three2.default.MeshBasicMaterial.prototype);\n\nvar GizmoLineMaterial = function GizmoLineMaterial(parameters) {\n\n _three2.default.LineBasicMaterial.call(this);\n\n this.depthTest = false;\n this.depthWrite = false;\n this.transparent = true;\n this.linewidth = 1;\n\n this.setValues(parameters);\n\n this.oldColor = this.color.clone();\n this.oldOpacity = this.opacity;\n\n this.highlight = function (highlighted) {\n\n if (highlighted) {\n\n this.color.setRGB(1, 1, 0);\n this.opacity = 1;\n } else {\n\n this.color.copy(this.oldColor);\n this.opacity = this.oldOpacity;\n }\n };\n};\n\nGizmoLineMaterial.prototype = Object.create(_three2.default.LineBasicMaterial.prototype);\n\n_three2.default.TransformGizmo = function () {\n\n var scope = this;\n var showPickers = false; //debug\n var showActivePlane = false; //debug\n\n this.init = function () {\n\n _three2.default.Object3D.call(this);\n\n this.handles = new _three2.default.Object3D();\n this.pickers = new _three2.default.Object3D();\n this.planes = new _three2.default.Object3D();\n\n this.add(this.handles);\n this.add(this.pickers);\n this.add(this.planes);\n\n //// PLANES\n\n var planeGeometry = new _three2.default.PlaneGeometry(50, 50, 2, 2);\n var planeMaterial = new _three2.default.MeshBasicMaterial({ wireframe: true });\n planeMaterial.side = _three2.default.DoubleSide;\n\n var planes = {\n "XY": new _three2.default.Mesh(planeGeometry, planeMaterial),\n "YZ": new _three2.default.Mesh(planeGeometry, planeMaterial),\n "XZ": new _three2.default.Mesh(planeGeometry, planeMaterial),\n "XYZE": new _three2.default.Mesh(planeGeometry, planeMaterial)\n };\n\n this.activePlane = planes["XYZE"];\n\n planes["YZ"].rotation.set(0, Math.PI / 2, 0);\n planes["XZ"].rotation.set(-Math.PI / 2, 0, 0);\n\n for (var i in planes) {\n planes[i].name = i;\n this.planes.add(planes[i]);\n this.planes[i] = planes[i];\n planes[i].visible = false;\n }\n\n //// HANDLES AND PICKERS\n\n var setupGizmos = function setupGizmos(gizmoMap, parent) {\n\n for (var name in gizmoMap) {\n\n for (i = gizmoMap[name].length; i--;) {\n\n var object = gizmoMap[name][i][0];\n var position = gizmoMap[name][i][1];\n var rotation = gizmoMap[name][i][2];\n\n object.name = name;\n\n if (position) object.position.set(position[0], position[1], position[2]);\n if (rotation) object.rotation.set(rotation[0], rotation[1], rotation[2]);\n\n parent.add(object);\n }\n }\n };\n\n setupGizmos(this.handleGizmos, this.handles);\n setupGizmos(this.pickerGizmos, this.pickers);\n\n // reset Transformations\n\n this.traverse(function (child) {\n if (child instanceof _three2.default.Mesh) {\n child.updateMatrix();\n\n var tempGeometry = new _three2.default.Geometry();\n tempGeometry.merge(child.geometry, child.matrix);\n\n child.geometry = tempGeometry;\n child.position.set(0, 0, 0);\n child.rotation.set(0, 0, 0);\n child.scale.set(1, 1, 1);\n }\n });\n };\n\n this.hide = function () {\n this.traverse(function (child) {\n child.visible = false;\n });\n };\n\n this.show = function () {\n this.traverse(function (child) {\n child.visible = true;\n if (child.parent == scope.pickers) child.visible = showPickers;\n if (child.parent == scope.planes) child.visible = false;\n });\n this.activePlane.visible = showActivePlane;\n };\n\n this.highlight = function (axis) {\n this.traverse(function (child) {\n if (child.material && child.material.highlight) {\n if (child.name == axis) {\n child.material.highlight(true);\n } else {\n child.material.highlight(false);\n }\n }\n });\n };\n};\n\n_three2.default.TransformGizmo.prototype = Object.create(_three2.default.Object3D.prototype);\n\n_three2.default.TransformGizmo.prototype.update = function (rotation, eye) {\n\n var vec1 = new _three2.default.Vector3(0, 0, 0);\n var vec2 = new _three2.default.Vector3(0, 1, 0);\n var lookAtMatrix = new _three2.default.Matrix4();\n\n this.traverse(function (child) {\n if (child.name.search("E") != -1) {\n child.quaternion.setFromRotationMatrix(lookAtMatrix.lookAt(eye, vec1, vec2));\n } else if (child.name.search("X") != -1 || child.name.search("Y") != -1 || child.name.search("Z") != -1) {\n child.quaternion.setFromEuler(rotation);\n }\n });\n};\n\n_three2.default.TransformGizmoTranslate = function () {\n\n _three2.default.TransformGizmo.call(this);\n\n var arrowGeometry = new _three2.default.Geometry();\n var mesh = new _three2.default.Mesh(new _three2.default.CylinderGeometry(0, 0.05, 0.2, 12, 1, false));\n mesh.position.y = 0.5;\n mesh.updateMatrix();\n\n arrowGeometry.merge(mesh.geometry, mesh.matrix);\n\n var lineXGeometry = new _three2.default.Geometry();\n lineXGeometry.vertices.push(new _three2.default.Vector3(0, 0, 0), new _three2.default.Vector3(1, 0, 0));\n\n var lineYGeometry = new _three2.default.Geometry();\n lineYGeometry.vertices.push(new _three2.default.Vector3(0, 0, 0), new _three2.default.Vector3(0, 1, 0));\n\n var lineZGeometry = new _three2.default.Geometry();\n lineZGeometry.vertices.push(new _three2.default.Vector3(0, 0, 0), new _three2.default.Vector3(0, 0, 1));\n\n this.handleGizmos = {\n X: [[new _three2.default.Mesh(arrowGeometry, new GizmoMaterial({ color: 0xff0000 })), [0.5, 0, 0], [0, 0, -Math.PI / 2]], [new _three2.default.Line(lineXGeometry, new GizmoLineMaterial({ color: 0xff0000 }))]],\n Y: [[new _three2.default.Mesh(arrowGeometry, new GizmoMaterial({ color: 0x00ff00 })), [0, 0.5, 0]], [new _three2.default.Line(lineYGeometry, new GizmoLineMaterial({ color: 0x00ff00 }))]],\n Z: [[new _three2.default.Mesh(arrowGeometry, new GizmoMaterial({ color: 0x0000ff })), [0, 0, 0.5], [Math.PI / 2, 0, 0]], [new _three2.default.Line(lineZGeometry, new GizmoLineMaterial({ color: 0x0000ff }))]],\n XYZ: [[new _three2.default.Mesh(new _three2.default.OctahedronGeometry(0.1, 0), new GizmoMaterial({ color: 0xffffff, opacity: 0.25 })), [0, 0, 0], [0, 0, 0]]],\n XY: [[new _three2.default.Mesh(new _three2.default.PlaneGeometry(0.29, 0.29), new GizmoMaterial({ color: 0xffff00, opacity: 0.25 })), [0.15, 0.15, 0]]],\n YZ: [[new _three2.default.Mesh(new _three2.default.PlaneGeometry(0.29, 0.29), new GizmoMaterial({ color: 0x00ffff, opacity: 0.25 })), [0, 0.15, 0.15], [0, Math.PI / 2, 0]]],\n XZ: [[new _three2.default.Mesh(new _three2.default.PlaneGeometry(0.29, 0.29), new GizmoMaterial({ color: 0xff00ff, opacity: 0.25 })), [0.15, 0, 0.15], [-Math.PI / 2, 0, 0]]]\n };\n\n this.pickerGizmos = {\n X: [[new _three2.default.Mesh(new _three2.default.CylinderGeometry(0.2, 0, 1, 4, 1, false), new GizmoMaterial({ color: 0xff0000, opacity: 0.25 })), [0.6, 0, 0], [0, 0, -Math.PI / 2]]],\n Y: [[new _three2.default.Mesh(new _three2.default.CylinderGeometry(0.2, 0, 1, 4, 1, false), new GizmoMaterial({ color: 0x00ff00, opacity: 0.25 })), [0, 0.6, 0]]],\n Z: [[new _three2.default.Mesh(new _three2.default.CylinderGeometry(0.2, 0, 1, 4, 1, false), new GizmoMaterial({ color: 0x0000ff, opacity: 0.25 })), [0, 0, 0.6], [Math.PI / 2, 0, 0]]],\n XYZ: [[new _three2.default.Mesh(new _three2.default.OctahedronGeometry(0.2, 0), new GizmoMaterial({ color: 0xffffff, opacity: 0.25 }))]],\n XY: [[new _three2.default.Mesh(new _three2.default.PlaneGeometry(0.4, 0.4), new GizmoMaterial({ color: 0xffff00, opacity: 0.25 })), [0.2, 0.2, 0]]],\n YZ: [[new _three2.default.Mesh(new _three2.default.PlaneGeometry(0.4, 0.4), new GizmoMaterial({ color: 0x00ffff, opacity: 0.25 })), [0, 0.2, 0.2], [0, Math.PI / 2, 0]]],\n XZ: [[new _three2.default.Mesh(new _three2.default.PlaneGeometry(0.4, 0.4), new GizmoMaterial({ color: 0xff00ff, opacity: 0.25 })), [0.2, 0, 0.2], [-Math.PI / 2, 0, 0]]]\n };\n\n this.setActivePlane = function (axis, eye) {\n\n var tempMatrix = new _three2.default.Matrix4();\n eye.applyMatrix4(tempMatrix.getInverse(tempMatrix.extractRotation(this.planes["XY"].matrixWorld)));\n\n if (axis == "X") {\n this.activePlane = this.planes["XY"];\n if (Math.abs(eye.y) > Math.abs(eye.z)) this.activePlane = this.planes["XZ"];\n }\n\n if (axis == "Y") {\n this.activePlane = this.planes["XY"];\n if (Math.abs(eye.x) > Math.abs(eye.z)) this.activePlane = this.planes["YZ"];\n }\n\n if (axis == "Z") {\n this.activePlane = this.planes["XZ"];\n if (Math.abs(eye.x) > Math.abs(eye.y)) this.activePlane = this.planes["YZ"];\n }\n\n if (axis == "XYZ") this.activePlane = this.planes["XYZE"];\n\n if (axis == "XY") this.activePlane = this.planes["XY"];\n\n if (axis == "YZ") this.activePlane = this.planes["YZ"];\n\n if (axis == "XZ") this.activePlane = this.planes["XZ"];\n\n this.hide();\n this.show();\n };\n\n this.init();\n};\n\n_three2.default.TransformGizmoTranslate.prototype = Object.create(_three2.default.TransformGizmo.prototype);\n\n_three2.default.TransformGizmoRotate = function () {\n\n _three2.default.TransformGizmo.call(this);\n\n var CircleGeometry = function CircleGeometry(radius, facing, arc) {\n\n var geometry = new _three2.default.Geometry();\n arc = arc ? arc : 1;\n for (var i = 0; i <= 64 * arc; ++i) {\n if (facing == \'x\') geometry.vertices.push(new _three2.default.Vector3(0, Math.cos(i / 32 * Math.PI), Math.sin(i / 32 * Math.PI)).multiplyScalar(radius));\n if (facing == \'y\') geometry.vertices.push(new _three2.default.Vector3(Math.cos(i / 32 * Math.PI), 0, Math.sin(i / 32 * Math.PI)).multiplyScalar(radius));\n if (facing == \'z\') geometry.vertices.push(new _three2.default.Vector3(Math.sin(i / 32 * Math.PI), Math.cos(i / 32 * Math.PI), 0).multiplyScalar(radius));\n }\n\n return geometry;\n };\n\n this.handleGizmos = {\n X: [[new _three2.default.Line(new CircleGeometry(1, \'x\', 0.5), new GizmoLineMaterial({ color: 0xff0000 }))]],\n Y: [[new _three2.default.Line(new CircleGeometry(1, \'y\', 0.5), new GizmoLineMaterial({ color: 0x00ff00 }))]],\n Z: [[new _three2.default.Line(new CircleGeometry(1, \'z\', 0.5), new GizmoLineMaterial({ color: 0x0000ff }))]],\n E: [[new _three2.default.Line(new CircleGeometry(1.25, \'z\', 1), new GizmoLineMaterial({ color: 0xcccc00 }))]],\n XYZE: [[new _three2.default.Line(new CircleGeometry(1, \'z\', 1), new GizmoLineMaterial({ color: 0x787878 }))]]\n };\n\n this.pickerGizmos = {\n X: [[new _three2.default.Mesh(new _three2.default.TorusGeometry(1, 0.12, 4, 12, Math.PI), new GizmoMaterial({ color: 0xff0000, opacity: 0.25 })), [0, 0, 0], [0, -Math.PI / 2, -Math.PI / 2]]],\n Y: [[new _three2.default.Mesh(new _three2.default.TorusGeometry(1, 0.12, 4, 12, Math.PI), new GizmoMaterial({ color: 0x00ff00, opacity: 0.25 })), [0, 0, 0], [Math.PI / 2, 0, 0]]],\n Z: [[new _three2.default.Mesh(new _three2.default.TorusGeometry(1, 0.12, 4, 12, Math.PI), new GizmoMaterial({ color: 0x0000ff, opacity: 0.25 })), [0, 0, 0], [0, 0, -Math.PI / 2]]],\n E: [[new _three2.default.Mesh(new _three2.default.TorusGeometry(1.25, 0.12, 2, 24), new GizmoMaterial({ color: 0xffff00, opacity: 0.25 }))]],\n XYZE: [[new _three2.default.Mesh(new _three2.default.Geometry())] // TODO\n ]\n };\n\n this.setActivePlane = function (axis) {\n\n if (axis == "E") this.activePlane = this.planes["XYZE"];\n\n if (axis == "X") this.activePlane = this.planes["YZ"];\n\n if (axis == "Y") this.activePlane = this.planes["XZ"];\n\n if (axis == "Z") this.activePlane = this.planes["XY"];\n\n this.hide();\n this.show();\n };\n\n this.update = function (rotation, eye2) {\n\n _three2.default.TransformGizmo.prototype.update.apply(this, arguments);\n\n var group = {\n handles: this["handles"],\n pickers: this["pickers"]\n };\n\n var tempMatrix = new _three2.default.Matrix4();\n var worldRotation = new _three2.default.Euler(0, 0, 1);\n var tempQuaternion = new _three2.default.Quaternion();\n var unitX = new _three2.default.Vector3(1, 0, 0);\n var unitY = new _three2.default.Vector3(0, 1, 0);\n var unitZ = new _three2.default.Vector3(0, 0, 1);\n var quaternionX = new _three2.default.Quaternion();\n var quaternionY = new _three2.default.Quaternion();\n var quaternionZ = new _three2.default.Quaternion();\n var eye = eye2.clone();\n\n worldRotation.copy(this.planes["XY"].rotation);\n tempQuaternion.setFromEuler(worldRotation);\n\n tempMatrix.makeRotationFromQuaternion(tempQuaternion).getInverse(tempMatrix);\n eye.applyMatrix4(tempMatrix);\n\n this.traverse(function (child) {\n\n tempQuaternion.setFromEuler(worldRotation);\n\n if (child.name == "X") {\n quaternionX.setFromAxisAngle(unitX, Math.atan2(-eye.y, eye.z));\n tempQuaternion.multiplyQuaternions(tempQuaternion, quaternionX);\n child.quaternion.copy(tempQuaternion);\n }\n\n if (child.name == "Y") {\n quaternionY.setFromAxisAngle(unitY, Math.atan2(eye.x, eye.z));\n tempQuaternion.multiplyQuaternions(tempQuaternion, quaternionY);\n child.quaternion.copy(tempQuaternion);\n }\n\n if (child.name == "Z") {\n quaternionZ.setFromAxisAngle(unitZ, Math.atan2(eye.y, eye.x));\n tempQuaternion.multiplyQuaternions(tempQuaternion, quaternionZ);\n child.quaternion.copy(tempQuaternion);\n }\n });\n };\n\n this.init();\n};\n\n_three2.default.TransformGizmoRotate.prototype = Object.create(_three2.default.TransformGizmo.prototype);\n\n_three2.default.TransformGizmoScale = function () {\n\n _three2.default.TransformGizmo.call(this);\n\n var arrowGeometry = new _three2.default.Geometry();\n var mesh = new _three2.default.Mesh(new _three2.default.BoxGeometry(0.125, 0.125, 0.125));\n mesh.position.y = 0.5;\n mesh.updateMatrix();\n\n arrowGeometry.merge(mesh.geometry, mesh.matrix);\n\n var lineXGeometry = new _three2.default.Geometry();\n lineXGeometry.vertices.push(new _three2.default.Vector3(0, 0, 0), new _three2.default.Vector3(1, 0, 0));\n\n var lineYGeometry = new _three2.default.Geometry();\n lineYGeometry.vertices.push(new _three2.default.Vector3(0, 0, 0), new _three2.default.Vector3(0, 1, 0));\n\n var lineZGeometry = new _three2.default.Geometry();\n lineZGeometry.vertices.push(new _three2.default.Vector3(0, 0, 0), new _three2.default.Vector3(0, 0, 1));\n\n this.handleGizmos = {\n X: [[new _three2.default.Mesh(arrowGeometry, new GizmoMaterial({ color: 0xff0000 })), [0.5, 0, 0], [0, 0, -Math.PI / 2]], [new _three2.default.Line(lineXGeometry, new GizmoLineMaterial({ color: 0xff0000 }))]],\n Y: [[new _three2.default.Mesh(arrowGeometry, new GizmoMaterial({ color: 0x00ff00 })), [0, 0.5, 0]], [new _three2.default.Line(lineYGeometry, new GizmoLineMaterial({ color: 0x00ff00 }))]],\n Z: [[new _three2.default.Mesh(arrowGeometry, new GizmoMaterial({ color: 0x0000ff })), [0, 0, 0.5], [Math.PI / 2, 0, 0]], [new _three2.default.Line(lineZGeometry, new GizmoLineMaterial({ color: 0x0000ff }))]],\n XYZ: [[new _three2.default.Mesh(new _three2.default.BoxGeometry(0.125, 0.125, 0.125), new GizmoMaterial({ color: 0xffffff, opacity: 0.25 }))]]\n };\n\n this.pickerGizmos = {\n X: [[new _three2.default.Mesh(new _three2.default.CylinderGeometry(0.2, 0, 1, 4, 1, false), new GizmoMaterial({ color: 0xff0000, opacity: 0.25 })), [0.6, 0, 0], [0, 0, -Math.PI / 2]]],\n Y: [[new _three2.default.Mesh(new _three2.default.CylinderGeometry(0.2, 0, 1, 4, 1, false), new GizmoMaterial({ color: 0x00ff00, opacity: 0.25 })), [0, 0.6, 0]]],\n Z: [[new _three2.default.Mesh(new _three2.default.CylinderGeometry(0.2, 0, 1, 4, 1, false), new GizmoMaterial({ color: 0x0000ff, opacity: 0.25 })), [0, 0, 0.6], [Math.PI / 2, 0, 0]]],\n XYZ: [[new _three2.default.Mesh(new _three2.default.BoxGeometry(0.4, 0.4, 0.4), new GizmoMaterial({ color: 0xffffff, opacity: 0.25 }))]]\n };\n\n this.setActivePlane = function (axis, eye) {\n\n var tempMatrix = new _three2.default.Matrix4();\n eye.applyMatrix4(tempMatrix.getInverse(tempMatrix.extractRotation(this.planes["XY"].matrixWorld)));\n\n if (axis == "X") {\n this.activePlane = this.planes["XY"];\n if (Math.abs(eye.y) > Math.abs(eye.z)) this.activePlane = this.planes["XZ"];\n }\n\n if (axis == "Y") {\n this.activePlane = this.planes["XY"];\n if (Math.abs(eye.x) > Math.abs(eye.z)) this.activePlane = this.planes["YZ"];\n }\n\n if (axis == "Z") {\n this.activePlane = this.planes["XZ"];\n if (Math.abs(eye.x) > Math.abs(eye.y)) this.activePlane = this.planes["YZ"];\n }\n\n if (axis == "XYZ") this.activePlane = this.planes["XYZE"];\n\n this.hide();\n this.show();\n };\n\n this.init();\n};\n\n_three2.default.TransformGizmoScale.prototype = Object.create(_three2.default.TransformGizmo.prototype);\n\nvar TransformControls = function TransformControls(camera, domElement) {\n\n // TODO: Make non-uniform scale and rotate play nice in hierarchies\n // TODO: ADD RXYZ contol\n\n _three2.default.Object3D.call(this);\n\n //domElement = ( domElement !== undefined ) ? domElement : document;\n //console.log("attaching TransformControls to",domElement);\n\n this.gizmo = {};\n this.gizmo["translate"] = new _three2.default.TransformGizmoTranslate();\n this.gizmo["rotate"] = new _three2.default.TransformGizmoRotate();\n this.gizmo["scale"] = new _three2.default.TransformGizmoScale();\n\n this.add(this.gizmo["translate"]);\n this.add(this.gizmo["rotate"]);\n this.add(this.gizmo["scale"]);\n\n this.gizmo["translate"].hide();\n this.gizmo["rotate"].hide();\n this.gizmo["scale"].hide();\n\n this.object = undefined;\n this.snap = null;\n this.space = "world";\n this.size = 1;\n this.axis = null;\n\n this.enabled = true;\n\n var scope = this;\n\n var _dragging = false;\n var _mode = "translate";\n var _plane = "XY";\n\n var changeEvent = { type: "change" };\n var mouseDownEvent = { type: "mouseDown" };\n var mouseUpEvent = { type: "mouseUp", mode: _mode };\n var objectChangeEvent = { type: "objectChange" };\n\n var ray = new _three2.default.Raycaster();\n var pointerVector = new _three2.default.Vector3();\n\n var point = new _three2.default.Vector3();\n var offset = new _three2.default.Vector3();\n\n var rotation = new _three2.default.Vector3();\n var offsetRotation = new _three2.default.Vector3();\n var scale = 1;\n\n var lookAtMatrix = new _three2.default.Matrix4();\n var eye = new _three2.default.Vector3();\n\n var tempMatrix = new _three2.default.Matrix4();\n var tempVector = new _three2.default.Vector3();\n var tempQuaternion = new _three2.default.Quaternion();\n var unitX = new _three2.default.Vector3(1, 0, 0);\n var unitY = new _three2.default.Vector3(0, 1, 0);\n var unitZ = new _three2.default.Vector3(0, 0, 1);\n\n var quaternionXYZ = new _three2.default.Quaternion();\n var quaternionX = new _three2.default.Quaternion();\n var quaternionY = new _three2.default.Quaternion();\n var quaternionZ = new _three2.default.Quaternion();\n var quaternionE = new _three2.default.Quaternion();\n\n var oldPosition = new _three2.default.Vector3();\n var oldScale = new _three2.default.Vector3();\n var oldRotationMatrix = new _three2.default.Matrix4();\n\n var parentRotationMatrix = new _three2.default.Matrix4();\n var parentScale = new _three2.default.Vector3();\n\n var worldPosition = new _three2.default.Vector3();\n var worldRotation = new _three2.default.Euler();\n var worldRotationMatrix = new _three2.default.Matrix4();\n var camPosition = new _three2.default.Vector3();\n var camRotation = new _three2.default.Euler();\n\n /*domElement.addEventListener( "mousedown", onPointerDown, false );\n domElement.addEventListener( "touchstart", onPointerDown, false );\n domElement.addEventListener( "mousemove", onPointerHover, false );\n domElement.addEventListener( "touchmove", onPointerHover, false );\n domElement.addEventListener( "mousemove", onPointerMove, false );\n domElement.addEventListener( "touchmove", onPointerMove, false );\n domElement.addEventListener( "mouseup", onPointerUp, true );\n domElement.addEventListener( "mouseout", onPointerUp, true );\n domElement.addEventListener( "touchend", onPointerUp, true );\n domElement.addEventListener( "touchcancel", onPointerUp, true );\n domElement.addEventListener( "touchleave", onPointerUp, true );*/\n\n this.setDomElement = function (domElement) {\n scope.domElement = domElement !== undefined ? domElement : document;\n\n domElement.addEventListener("mousedown", onPointerDown, false);\n domElement.addEventListener("touchstart", onPointerDown, false);\n\n domElement.addEventListener("mousemove", onPointerHover, false);\n domElement.addEventListener("touchmove", onPointerHover, false);\n\n domElement.addEventListener("mousemove", onPointerMove, false);\n domElement.addEventListener("touchmove", onPointerMove, false);\n\n domElement.addEventListener("mouseup", onPointerUp, true);\n domElement.addEventListener("mouseout", onPointerUp, true);\n domElement.addEventListener("touchend", onPointerUp, true);\n domElement.addEventListener("touchcancel", onPointerUp, true);\n domElement.addEventListener("touchleave", onPointerUp, true);\n };\n\n this.setObservables = function (observables) {\n console.log("setting observables");\n var dragMoves$ = observables.dragMoves$;\n var zooms$ = observables.zooms$;\n };\n\n this.attach = function (object) {\n scope.object = object;\n\n this.gizmo["translate"].hide();\n this.gizmo["rotate"].hide();\n this.gizmo["scale"].hide();\n this.gizmo[_mode].show();\n\n scope.update();\n };\n\n this.detach = function (object) {\n scope.object = undefined;\n this.axis = null;\n\n this.gizmo["translate"].hide();\n this.gizmo["rotate"].hide();\n this.gizmo["scale"].hide();\n };\n\n this.setMode = function (mode) {\n\n _mode = mode ? mode : _mode;\n //_mode = mode\n\n if (_mode == "scale") scope.space = "local";\n\n this.gizmo["translate"].hide();\n this.gizmo["rotate"].hide();\n this.gizmo["scale"].hide();\n //if(_mode)\n this.gizmo[_mode].show();\n\n this.update();\n scope.dispatchEvent(changeEvent);\n };\n\n this.setSnap = function (snap) {\n\n scope.snap = snap;\n };\n\n this.setSize = function (size) {\n\n scope.size = size;\n this.update();\n scope.dispatchEvent(changeEvent);\n };\n\n this.setSpace = function (space) {\n\n scope.space = space;\n this.update();\n scope.dispatchEvent(changeEvent);\n };\n\n this.update = function () {\n\n if (scope.object === undefined) return;\n if (!scope.enabled) return;\n\n scope.object.updateMatrixWorld();\n worldPosition.setFromMatrixPosition(scope.object.matrixWorld);\n worldRotation.setFromRotationMatrix(tempMatrix.extractRotation(scope.object.matrixWorld));\n\n camera.updateMatrixWorld();\n camPosition.setFromMatrixPosition(camera.matrixWorld);\n camRotation.setFromRotationMatrix(tempMatrix.extractRotation(camera.matrixWorld));\n\n scale = worldPosition.distanceTo(camPosition) / 6 * scope.size;\n this.position.copy(worldPosition);\n this.scale.set(scale, scale, scale);\n\n eye.copy(camPosition).sub(worldPosition).normalize();\n\n if (scope.space == "local") this.gizmo[_mode].update(worldRotation, eye);else if (scope.space == "world") this.gizmo[_mode].update(new _three2.default.Euler(), eye);\n\n this.gizmo[_mode].highlight(scope.axis);\n };\n\n function onPointerHover(event) {\n // console.log("pointer move in Transform controls");\n if (scope.object === undefined || _dragging === true) return;\n\n event.preventDefault();\n\n var pointer = event.changedTouches ? event.changedTouches[0] : event;\n\n var intersect = intersectObjects(pointer, scope.gizmo[_mode].pickers.children);\n\n var axis = null;\n\n if (intersect) {\n\n axis = intersect.object.name;\n }\n\n if (scope.axis !== axis) {\n\n scope.axis = axis;\n scope.update();\n scope.dispatchEvent(changeEvent);\n }\n }\n\n function onPointerDown(event) {\n //console.log("pointer down in Transform controls");\n if (scope.object === undefined || _dragging === true) return;\n\n event.preventDefault();\n //event.stopPropagation();\n\n var pointer = event.changedTouches ? event.changedTouches[0] : event;\n\n //console.log("pointer",pointer.button)\n\n if (pointer.button === 0 || pointer.button === 2 || pointer.button === undefined) {\n\n var intersect = intersectObjects(pointer, scope.gizmo[_mode].pickers.children);\n\n if (intersect) {\n\n //console.log("intersected")\n scope.dispatchEvent(mouseDownEvent);\n\n scope.axis = intersect.object.name;\n\n scope.update();\n\n eye.copy(camPosition).sub(worldPosition).normalize();\n\n scope.gizmo[_mode].setActivePlane(scope.axis, eye);\n\n var planeIntersect = intersectObjects(pointer, [scope.gizmo[_mode].activePlane]);\n\n oldPosition.copy(scope.object.position);\n oldScale.copy(scope.object.scale);\n\n oldRotationMatrix.extractRotation(scope.object.matrix);\n worldRotationMatrix.extractRotation(scope.object.matrixWorld);\n\n parentRotationMatrix.extractRotation(scope.object.parent.matrixWorld);\n parentScale.setFromMatrixScale(tempMatrix.getInverse(scope.object.parent.matrixWorld));\n\n offset.copy(planeIntersect.point);\n }\n }\n\n _dragging = true;\n }\n\n function onPointerMove(event) {\n\n if (scope.object === undefined || scope.axis === null || _dragging === false) return;\n\n event.preventDefault();\n //event.stopPropagation();\n\n var pointer = event.changedTouches ? event.changedTouches[0] : event;\n\n var planeIntersect = intersectObjects(pointer, [scope.gizmo[_mode].activePlane]);\n\n point.copy(planeIntersect.point);\n\n if (_mode == "translate") {\n\n point.sub(offset);\n point.multiply(parentScale);\n\n if (scope.space == "local") {\n\n point.applyMatrix4(tempMatrix.getInverse(worldRotationMatrix));\n\n if (scope.axis.search("X") == -1) point.x = 0;\n if (scope.axis.search("Y") == -1) point.y = 0;\n if (scope.axis.search("Z") == -1) point.z = 0;\n\n point.applyMatrix4(oldRotationMatrix);\n\n scope.object.position.copy(oldPosition);\n scope.object.position.add(point);\n }\n\n if (scope.space == "world" || scope.axis.search("XYZ") != -1) {\n\n if (scope.axis.search("X") == -1) point.x = 0;\n if (scope.axis.search("Y") == -1) point.y = 0;\n if (scope.axis.search("Z") == -1) point.z = 0;\n\n point.applyMatrix4(tempMatrix.getInverse(parentRotationMatrix));\n\n scope.object.position.copy(oldPosition);\n scope.object.position.add(point);\n }\n\n if (scope.snap !== null) {\n\n if (scope.axis.search("X") != -1) scope.object.position.x = Math.round(scope.object.position.x / scope.snap) * scope.snap;\n if (scope.axis.search("Y") != -1) scope.object.position.y = Math.round(scope.object.position.y / scope.snap) * scope.snap;\n if (scope.axis.search("Z") != -1) scope.object.position.z = Math.round(scope.object.position.z / scope.snap) * scope.snap;\n }\n } else if (_mode == "scale") {\n\n point.sub(offset);\n point.multiply(parentScale);\n\n if (scope.space == "local") {\n\n if (scope.axis == "XYZ") {\n\n scale = 1 + point.y / 50;\n\n scope.object.scale.x = oldScale.x * scale;\n scope.object.scale.y = oldScale.y * scale;\n scope.object.scale.z = oldScale.z * scale;\n } else {\n\n point.applyMatrix4(tempMatrix.getInverse(worldRotationMatrix));\n\n if (scope.axis == "X") scope.object.scale.x = oldScale.x * (1 + point.x / 50);\n if (scope.axis == "Y") scope.object.scale.y = oldScale.y * (1 + point.y / 50);\n if (scope.axis == "Z") scope.object.scale.z = oldScale.z * (1 + point.z / 50);\n }\n }\n } else if (_mode == "rotate") {\n\n point.sub(worldPosition);\n point.multiply(parentScale);\n tempVector.copy(offset).sub(worldPosition);\n tempVector.multiply(parentScale);\n\n if (scope.axis == "E") {\n\n point.applyMatrix4(tempMatrix.getInverse(lookAtMatrix));\n tempVector.applyMatrix4(tempMatrix.getInverse(lookAtMatrix));\n\n rotation.set(Math.atan2(point.z, point.y), Math.atan2(point.x, point.z), Math.atan2(point.y, point.x));\n offsetRotation.set(Math.atan2(tempVector.z, tempVector.y), Math.atan2(tempVector.x, tempVector.z), Math.atan2(tempVector.y, tempVector.x));\n\n tempQuaternion.setFromRotationMatrix(tempMatrix.getInverse(parentRotationMatrix));\n\n quaternionE.setFromAxisAngle(eye, rotation.z - offsetRotation.z);\n quaternionXYZ.setFromRotationMatrix(worldRotationMatrix);\n\n tempQuaternion.multiplyQuaternions(tempQuaternion, quaternionE);\n tempQuaternion.multiplyQuaternions(tempQuaternion, quaternionXYZ);\n\n scope.object.quaternion.copy(tempQuaternion);\n } else if (scope.axis == "XYZE") {\n\n quaternionE.setFromEuler(point.clone().cross(tempVector).normalize()); // rotation axis\n\n tempQuaternion.setFromRotationMatrix(tempMatrix.getInverse(parentRotationMatrix));\n quaternionX.setFromAxisAngle(quaternionE, -point.clone().angleTo(tempVector));\n quaternionXYZ.setFromRotationMatrix(worldRotationMatrix);\n\n tempQuaternion.multiplyQuaternions(tempQuaternion, quaternionX);\n tempQuaternion.multiplyQuaternions(tempQuaternion, quaternionXYZ);\n\n scope.object.quaternion.copy(tempQuaternion);\n } else if (scope.space == "local") {\n\n point.applyMatrix4(tempMatrix.getInverse(worldRotationMatrix));\n\n tempVector.applyMatrix4(tempMatrix.getInverse(worldRotationMatrix));\n\n rotation.set(Math.atan2(point.z, point.y), Math.atan2(point.x, point.z), Math.atan2(point.y, point.x));\n offsetRotation.set(Math.atan2(tempVector.z, tempVector.y), Math.atan2(tempVector.x, tempVector.z), Math.atan2(tempVector.y, tempVector.x));\n\n quaternionXYZ.setFromRotationMatrix(oldRotationMatrix);\n quaternionX.setFromAxisAngle(unitX, rotation.x - offsetRotation.x);\n quaternionY.setFromAxisAngle(unitY, rotation.y - offsetRotation.y);\n quaternionZ.setFromAxisAngle(unitZ, rotation.z - offsetRotation.z);\n\n if (scope.axis == "X") quaternionXYZ.multiplyQuaternions(quaternionXYZ, quaternionX);\n if (scope.axis == "Y") quaternionXYZ.multiplyQuaternions(quaternionXYZ, quaternionY);\n if (scope.axis == "Z") quaternionXYZ.multiplyQuaternions(quaternionXYZ, quaternionZ);\n\n scope.object.quaternion.copy(quaternionXYZ);\n } else if (scope.space == "world") {\n\n rotation.set(Math.atan2(point.z, point.y), Math.atan2(point.x, point.z), Math.atan2(point.y, point.x));\n offsetRotation.set(Math.atan2(tempVector.z, tempVector.y), Math.atan2(tempVector.x, tempVector.z), Math.atan2(tempVector.y, tempVector.x));\n\n tempQuaternion.setFromRotationMatrix(tempMatrix.getInverse(parentRotationMatrix));\n\n quaternionX.setFromAxisAngle(unitX, rotation.x - offsetRotation.x);\n quaternionY.setFromAxisAngle(unitY, rotation.y - offsetRotation.y);\n quaternionZ.setFromAxisAngle(unitZ, rotation.z - offsetRotation.z);\n quaternionXYZ.setFromRotationMatrix(worldRotationMatrix);\n\n if (scope.axis == "X") tempQuaternion.multiplyQuaternions(tempQuaternion, quaternionX);\n if (scope.axis == "Y") tempQuaternion.multiplyQuaternions(tempQuaternion, quaternionY);\n if (scope.axis == "Z") tempQuaternion.multiplyQuaternions(tempQuaternion, quaternionZ);\n\n tempQuaternion.multiplyQuaternions(tempQuaternion, quaternionXYZ);\n\n scope.object.quaternion.copy(tempQuaternion);\n }\n }\n\n scope.update();\n scope.dispatchEvent(changeEvent);\n scope.dispatchEvent(objectChangeEvent);\n }\n\n function onPointerUp(event) {\n //console.log("pointer up in transform controls");\n if (_dragging && scope.axis !== null) {\n mouseUpEvent.mode = _mode;\n scope.dispatchEvent(mouseUpEvent);\n /*event.preventDefault();\n event.stopPropagation();\n event.stopImmediatePropagation();*/\n }\n _dragging = false;\n onPointerHover(event);\n }\n\n function intersectObjects(pointer, objects) {\n\n var rect = scope.domElement.getBoundingClientRect();\n var x = (pointer.clientX - rect.left) / rect.width;\n var y = (pointer.clientY - rect.top) / rect.height;\n\n pointerVector.set(x * 2 - 1, -(y * 2) + 1, 0.5);\n pointerVector.unproject(camera);\n\n ray.set(camPosition, pointerVector.sub(camPosition).normalize());\n\n var intersections = ray.intersectObjects(objects, true);\n return intersections[0] ? intersections[0] : false;\n }\n};\n\nTransformControls.prototype = Object.create(_three2.default.Object3D.prototype);\n\nexports.default = TransformControls;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/webgl/transforms/TransformControls.js\n ** module id = 162\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/webgl/transforms/TransformControls.js?'); +},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nvar _tween = __webpack_require__(94);\n\nvar _tween2 = _interopRequireDefault(_tween);\n\nvar _Detector = __webpack_require__(67);\n\nvar _Detector2 = _interopRequireDefault(_Detector);\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nvar _dom = __webpack_require__(18);\n\nvar _pointers = __webpack_require__(74);\n\nvar _sizing = __webpack_require__(75);\n\nvar _obsUtils = __webpack_require__(5);\n\nvar _diffPatchUtils = __webpack_require__(76);\n\nvar _TransformControls = __webpack_require__(162);\n\nvar _TransformControls2 = _interopRequireDefault(_TransformControls);\n\nvar _glViewHelpers = __webpack_require__(60);\n\nvar _LabeledGrid = __webpack_require__(81);\n\nvar _LabeledGrid2 = _interopRequireDefault(_LabeledGrid);\n\nvar _cameraUtils = __webpack_require__(144);\n\nvar _cameraUtils2 = _interopRequireDefault(_cameraUtils);\n\nvar _computeBounds = __webpack_require__(145);\n\nvar _utils = __webpack_require__(69);\n\nvar _presets = __webpack_require__(161);\n\nvar _EffectComposer = __webpack_require__(152);\n\nvar _EffectComposer2 = _interopRequireDefault(_EffectComposer);\n\nvar _ShaderPass = __webpack_require__(157);\n\nvar _ShaderPass2 = _interopRequireDefault(_ShaderPass);\n\nvar _RenderPass = __webpack_require__(156);\n\nvar _RenderPass2 = _interopRequireDefault(_RenderPass);\n\nvar _MaskPass = __webpack_require__(154);\n\nvar _CopyShader = __webpack_require__(150);\n\nvar _CopyShader2 = _interopRequireDefault(_CopyShader);\n\nvar _FXAAShader = __webpack_require__(153);\n\nvar _FXAAShader2 = _interopRequireDefault(_FXAAShader);\n\nvar _vignetteShader = __webpack_require__(158);\n\nvar _vignetteShader2 = _interopRequireDefault(_vignetteShader);\n\nvar _EdgeShader = __webpack_require__(151);\n\nvar _EdgeShader2 = _interopRequireDefault(_EdgeShader);\n\nvar _AdditiveBlendShader = __webpack_require__(149);\n\nvar _AdditiveBlendShader2 = _interopRequireDefault(_AdditiveBlendShader);\n\nvar _intent = __webpack_require__(159);\n\nvar _intent2 = _interopRequireDefault(_intent);\n\nvar _model = __webpack_require__(160);\n\nvar _model2 = _interopRequireDefault(_model);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar fromEvent = _rx2.default.Observable.fromEvent;\nvar merge = _rx2.default.Observable.merge;\n\n// console.log('helpers.planes',planes,objectEffects)\n// let LabeledGrid = helpers.grids.LabeledGrid\nvar ShadowPlane = _glViewHelpers.planes.ShadowPlane.default; // ugh FIXME: bloody babel6\n// let annotations = annotations\nvar zoomInOn = _glViewHelpers.cameraEffects.zoomInOn;\nvar zoomToFit = _glViewHelpers.cameraEffects.zoomToFit; // default configuration for lighting, cameras etc\n\nfunction setupPostProcess(camera, renderer, scene) {\n // console.log('setupPostProcess')\n // //////post processing\n var renderTargetParameters = {\n minFilter: _three2.default.LinearFilter,\n magFilter: _three2.default.LinearFilter,\n format: _three2.default.RGBAFormat,\n stencilBuffer: true\n };\n\n var outScene = new _three2.default.Scene();\n var maskScene = new _three2.default.Scene();\n\n var renderTarget = new _three2.default.WebGLRenderTarget(window.innerWidth, window.innerHeight, renderTargetParameters);\n\n var uniforms = {\n offset: {\n type: 'f',\n value: 0.9\n },\n color: {\n type: 'c',\n value: new _three2.default.Color('#000000') // #ff2500')//[1.0,0.0,0.0]\n }\n };\n\n var shader = __webpack_require__(155).default;\n var outShader = shader['outline'];\n\n var outlineMaterial = new _three2.default.ShaderMaterial({\n uniforms: uniforms,\n vertexShader: outShader.vertex_shader,\n fragmentShader: outShader.fragment_shader\n });\n outlineMaterial.depthTest = false;\n // new THREE.MeshBasicMaterial({color:0xFF0000,transparent:true,opacity:0.5})\n\n var maskMaterial = new _three2.default.MeshBasicMaterial({ color: 0xffffff });\n\n // setup composer\n var composer = new _EffectComposer2.default(renderer);\n composer.renderTarget1.stencilBuffer = true;\n composer.renderTarget2.stencilBuffer = true;\n\n var normal = new _RenderPass2.default(scene, camera);\n var outline = new _RenderPass2.default(outScene, camera, outlineMaterial);\n var maskPass = new _three2.default.MaskPass(maskScene, camera, maskMaterial);\n maskPass.inverse = true;\n var clearMask = new _three2.default.ClearMaskPass();\n var copyPass = new _three2.default.ShaderPass(_three2.default.CopyShader);\n var fxaaPass = new _three2.default.ShaderPass(_three2.default.FXAAShader);\n var vignettePass = new _three2.default.ShaderPass(_three2.default.VignetteShader);\n\n fxaaPass.uniforms['resolution'].value.set(1 / window.innerWidth * window.devicePixelRatio, 1 / window.innerHeight * window.devicePixelRatio);\n vignettePass.uniforms['offset'].value = 0.95;\n vignettePass.uniforms['darkness'].value = 0.9;\n\n // /////////////////////////////////\n\n renderer.autoClear = false;\n // renderer.autoClearStencil = false\n\n outline.clear = false;\n // normal.clear = false\n\n composer.addPass(normal);\n composer.addPass(maskPass);\n composer.addPass(outline);\n\n composer.addPass(clearMask);\n // composer.addPass(vignettePass)\n // composer.addPass(fxaaPass)\n composer.addPass(copyPass);\n\n var lastPass = composer.passes[composer.passes.length - 1];\n lastPass.renderToScreen = true;\n\n return { composers: [composer], fxaaPass: fxaaPass, outScene: outScene, maskScene: maskScene };\n\n // return {composer:finalComposer, fxaaPass, outScene, maskScene, composers:[normalComposer,depthComposer,finalComposer]}\n}\n\n// //////////\nfunction GLView(_ref) {\n var drivers = _ref.drivers;\n var props$ = _ref.props$;\n var DOM = drivers.DOM;\n var postMessage = drivers.postMessage;\n\n\n var config = _presets.presets;\n\n var initialized$ = new _rx2.default.BehaviorSubject(false);\n var update$ = _rx2.default.Observable.interval(16, 66666666667);\n\n var settings$ = props$.pluck('settings');\n // every time either activeTool or selection changes, reset/update transform controls\n var activeTool$ = settings$.pluck('activeTool').startWith(undefined);\n\n var renderer = null;\n\n var composer = null;\n var composers = [];\n var fxaaPass = null;\n var outScene = null;\n var maskScene = null;\n\n var scene = new _three2.default.Scene();\n var dynamicInjector = new _three2.default.Object3D(); // all dynamic mapped objects reside here\n scene.dynamicInjector = dynamicInjector;\n scene.add(dynamicInjector);\n\n var selectionsContainer = new _three2.default.Scene(); // unfortunate way to handle things in three.js\n\n var camera = (0, _utils.makeCamera)(config.cameras[0]);\n var controls = (0, _utils.makeControls)(config.controls[0]); // create 'orbit' controls\n var transformControls = new _TransformControls2.default(camera);\n\n var grid = new _LabeledGrid2.default(215, 215, 10, config.cameras[0].up);\n var shadowPlane = new ShadowPlane(2000, 2000, null, config.cameras[0].up);\n\n var actions = (0, _intent2.default)({ DOM: DOM, events: drivers.events }, { camera: camera, scene: scene, transformControls: transformControls, props$: props$, settings$: settings$ });\n var state$ = (0, _model2.default)(props$, actions);\n\n // FIXME: proxies for now, not sure how to deal with them\n var meshAddedToScene$ = new _rx2.default.ReplaySubject(1);\n var meshRemovedFromScene$ = new _rx2.default.ReplaySubject(1);\n\n var outlineSelections$ = settings$.filter(function (s) {\n return !(s.toolSets.indexOf('view') !== -1 && s.toolSets.length === 1);\n }) // in all but view only mode\n .combineLatest(state$, function (settings, state) {\n return state;\n });\n\n var focusedMeshesFromFocusedEntities$ = state$.pluck('focusedMeshesFromFocusedEntities').startWith([]);\n\n var zoomToFit$ = settings$.filter(function (s) {\n return s.toolSets.indexOf('edit') === -1 && s.toolSets.length === 1;\n }) // only in view only mode\n .combineLatest(state$.pluck('items'), function (settings, items) {\n return items;\n }).merge(focusedMeshesFromFocusedEntities$).filter(_obsUtils.exists).filter(function (i) {\n return i.length > 0;\n }).distinctUntilChanged();\n\n /*\n const zoomToFit$ = meshAddedToScene$ //alternative implementation\n .combineLatest(settings$.filter(s=> s.appMode === 'viewer'), function(mesh, settings){\n return [dynamicInjector]\n })\n .distinctUntilChanged()*/\n\n // react to actions\n actions.zoomInOnPoint$.forEach(function (oAndP) {\n return zoomInOn(oAndP.object, camera, { position: oAndP.point });\n });\n\n zoomToFit$.map(function (meshesToFocus) {\n var wrapperObject = new _three2.default.Object3D();\n wrapperObject.boundingBox = (0, _computeBounds.computeBoundingBox)(wrapperObject, meshesToFocus);\n wrapperObject.boundingSphere = wrapperObject.boundingBox.getBoundingSphere();\n var center = new _three2.default.Vector3().subVectors(wrapperObject.boundingBox.max, wrapperObject.boundingBox.min).multiplyScalar(0.5);\n return { focusMesh: wrapperObject, center: center };\n }).forEach(function (_ref2) {\n var focusMesh = _ref2.focusMesh;\n var center = _ref2.center;\n return (0, _cameraUtils2.default)(focusMesh, camera, center);\n });\n\n var windowResizes$ = (0, _sizing.windowResizes)(1); // get from intents/interactions ?\n\n function clearScene() {\n if (scene) {\n if (scene.dynamicInjector) {\n scene.remove(scene.dynamicInjector);\n }\n var _dynamicInjector = new _three2.default.Object3D();\n scene.dynamicInjector = _dynamicInjector;\n\n scene.add(_dynamicInjector);\n }\n }\n\n function addToScene(object) {\n scene.dynamicInjector.add(object);\n }\n function removeFromScene(object) {\n scene.dynamicInjector.remove(object);\n }\n\n function setupScene() {\n config.scenes['main']\n // TODO , update to be more generic\n .map(function (light) {\n return (0, _utils.makeLight)(light);\n }).forEach(function (light) {\n return scene.add(light);\n });\n }\n\n function render(scene, camera) {\n composers.forEach(function (c) {\n return c.render();\n });\n // composer.passes[composer.passes.length-1].uniforms[ 'tDiffuse2' ].value = composers[0].renderTarget2\n // composer.passes[composer.passes.length-1].uniforms[ 'tDiffuse3' ].value = composers[1].renderTarget2\n }\n\n function update() {\n controls.update();\n transformControls.update();\n _tween2.default.update();\n // if(camViewControls) camViewControls.update()\n }\n\n function configure(container) {\n // log.debug('initializing into container', container)\n\n if (!_Detector2.default.webgl) {\n // TODO: handle lacking webgl\n } else {\n renderer = new _three2.default.WebGLRenderer({\n antialias: false,\n preserveDrawingBuffer: true\n });\n }\n\n renderer.setClearColor('#fff');\n Object.keys(config.renderer).map(function (key) {\n // TODO add hasOwnProp check\n renderer[key] = config.renderer[key];\n });\n\n var pixelRatio = window.devicePixelRatio || 1;\n renderer.setPixelRatio(pixelRatio);\n\n container.appendChild(renderer.domElement);\n // prevents zooming the 3d view from scrolling the window\n (0, _pointers.preventScroll)(container);\n\n transformControls.setDomElement(container);\n\n // more init\n controls.setObservables(actions.filteredInteractions$);\n controls.addObject(camera);\n\n scene.add(camera);\n scene.add(shadowPlane);\n scene.add(transformControls);\n\n var ppData = setupPostProcess(camera, renderer, scene);\n // composer = ppData.composer\n composers = ppData.composers;\n fxaaPass = ppData.fxaaPass;\n outScene = ppData.outScene;\n maskScene = ppData.maskScene;\n\n initialized$.onNext(true);\n }\n\n // side effect ?\n function handleResize(sizeInfos) {\n // log.debug('setting glView size',sizeInfos)\n var width = sizeInfos.width;\n var height = sizeInfos.height;\n var aspect = sizeInfos.aspect;\n\n\n if (width > 0 && height > 0 && camera && renderer) {\n (function () {\n renderer.setSize(width, height);\n camera.aspect = aspect;\n camera.setSize(width, height);\n camera.updateProjectionMatrix();\n\n var pixelRatio = window.devicePixelRatio || 1;\n fxaaPass.uniforms['resolution'].value.set(1 / (width * pixelRatio), 1 / (height * pixelRatio));\n\n composers.forEach(function (c) {\n c.reset();\n c.setSize(width * pixelRatio, height * pixelRatio);\n });\n })();\n }\n }\n\n // combine All needed components to apply any 'transforms' to their visuals\n var items$ = state$.pluck('items'); // .distinctUntilChanged()\n // TODO : we DO want distinctUntilChanged() to prevent spamming here at any state change\n // TODO we want to zoomToFit only when mode is viewer && we just recieved the FIRST model ??\n /* settings$\n .filter(s=> s.mode === 'viewer')\n .forEach(e=>console.log('settings',e))*/\n\n // do diffing to find what was added/changed\n var itemChanges$ = items$.scan(function (acc, x) {\n var cur = x;\n var prev = acc.cur;\n return { cur: cur, prev: prev };\n }, { prev: undefined, cur: undefined }).map(function (typeData) {\n var cur = typeData.cur;\n var prev = typeData.prev;\n\n var changes = (0, _diffPatchUtils.extractChanges)(prev, cur);\n // console.log('changes', changes)\n return changes;\n });\n\n // experimenting with selections effects\n //FIXME : use data, not mesh level things\n outlineSelections$.pluck('selectedMeshesFromSelections').distinctUntilChanged().filter(_obsUtils.exists).forEach(function (selectedMeshes) {\n if (outScene) {\n var sceneItems = selectedMeshes.filter(_obsUtils.exists);\n outScene.children = sceneItems;\n maskScene.children = sceneItems;\n }\n });\n\n // transformControls handling\n // we modify the transformControls mode based on the active tool\n // every time either activeTool or selection changes, reset/update transform controls\n var selectedMeshesChanges$ = state$.pluck('selectedMeshes').distinctUntilChanged().scan(function (acc, x) {\n var cur = x;\n var prev = acc.cur;\n return { cur: cur, prev: prev };\n }, { prev: [], cur: [] }).map(function (typeData) {\n var cur = typeData.cur;\n var prev = typeData.prev;\n\n var changes = (0, _diffPatchUtils.extractChanges)(prev, cur);\n return changes;\n }).distinctUntilChanged().shareReplay(1);\n\n (0, _obsUtils.combineLatestObj)({\n selections: selectedMeshesChanges$,\n tool: activeTool$.distinctUntilChanged()\n }).forEach(function (_ref3) {\n var selections = _ref3.selections;\n var tool = _ref3.tool;\n\n // console.log('updating transformControls',selections,tool)\n // remove transformControls from removed meshes\n selections.removed.map(function (mesh) {\n return transformControls.detach(mesh);\n });\n\n selections.added.map(function (mesh) {\n if (tool && mesh && ['translate', 'rotate', 'scale'].indexOf(tool) > -1) {\n transformControls.attach(mesh);\n transformControls.setMode(tool);\n } else if (!tool && mesh || ['translate', 'rotate', 'scale'].indexOf(tool) === -1) {\n // tool is undefined, but we still had selections\n transformControls.detach(mesh);\n }\n });\n });\n\n // hande all the cases where events require re-rendering\n var reRender$ = merge(initialized$.filter(function (i) {\n return i === true;\n }).do(function (i) {\n return handleResize({\n width: window.innerWidth,\n height: window.innerHeight,\n aspect: window.innerWidth / window.innerHeight\n });\n }), fromEvent(controls, 'change'), fromEvent(transformControls, 'change'), state$.pluck('selectedMeshes'), windowResizes$.do(handleResize) // we need the resize to take place before we render\n ).shareReplay(1);\n\n // /////////\n setupScene();\n\n update$.forEach(update);\n reRender$.forEach(render);\n\n // settings handling\n settings$ = settings$.filter(_obsUtils.exists).distinctUntilChanged();\n\n settings$.map(function (s) {\n return s.camera.autoRotate;\n }).forEach(function (autoRotate) {\n return controls.autoRotate = autoRotate;\n });\n\n settings$.map(function (s) {\n return s.grid.show;\n }).forEach(function (showGrid) {\n scene.remove(grid);\n if (showGrid) {\n scene.add(grid);\n }\n });\n\n // react based on diffs\n itemChanges$.do(function (changes) {\n // console.log('reacting to changes', changes)\n changes.added.map(function (mesh) {\n addToScene(mesh);\n meshAddedToScene$.onNext(mesh);\n });\n changes.removed.map(function (mesh) {\n removeFromScene(mesh);\n meshRemovedFromScene$.onNext(mesh);\n });\n }).do(function (e) {\n return render();\n }).forEach(function (e) {\n return e;\n });\n\n // we do not want to change our container (DOM) but the contents (gl)\n var vtree$ = _rx2.default.Observable.just((0, _dom.h)('div.glView', [(0, _dom.h)('div.container', {\n //key: someUniqueKey,\n hook: {\n insert: function insert(vnode) {\n console.log('vnode', vnode);configure(vnode.elm);\n } //movie.elmHeight = vnode.elm.offsetHeight;\n }\n })]));\n\n // screencapture test\n /* postMessage\n .filter(e=>e.hasOwnProperty('captureScreen'))\n .flatMap(e=>{\n let img = domElementToImage(renderer.domElement)\n let resolutions = e.captureScreen\n let images$ = resolutions.map(function(resolution){\n let [width,height] = resolution\n console.log('resolution',resolution)\n let obs = new Rx.Subject()\n aspectResize(img, width, height, e=>{\n obs.onNext(e)\n obs.onCompleted()})\n return obs\n })\n let results$ = Rx.Observable.forkJoin(images$)\n return results$\n })\n .forEach(e=>{\n e.map(img=>console.log(img))\n })*/\n\n return {\n DOM: vtree$,\n events: {\n // initialized:initialized$,\n shortSingleTaps$: actions.shortSingleTapsWPicking$,\n shortDoubleTaps$: actions.shortDoubleTapsWPicking$,\n longTaps$: actions.longTapsWPicking$,\n selectionsTransforms$: actions.selectionsTransforms$,\n selectedMeshes$: actions.selectMeshes$\n }\n };\n}\n\nexports.default = GLView;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/webgl/GlView.js\n ** module id = 143\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/webgl/GlView.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = zoomToFitBounds;\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction zoomToFitBounds(object, camera, target) {\n var bbox = object.boundingBox;\n if (bbox.empty()) {\n return;\n }\n\n target = bbox.center();\n\n var radius = object.boundingSphere.radius;\n var center = object.boundingSphere.center;\n var targetOffset = new _three2.default.Vector3().subVectors(center, camera.target);\n\n // move camera to base position\n camera.position.add(targetOffset);\n camera.target.copy(center);\n\n // and move it away from the boundingSphere of the object\n var vec = new _three2.default.Vector3();\n vec.subVectors(camera.position, camera.target);\n vec.normalize();\n vec.setLength(center.distanceTo(camera.position) - radius * 4);\n camera.position.sub(vec);\n\n camera.updateProjectionMatrix();\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/webgl/cameraUtils2.js\n ** module id = 144\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/webgl/cameraUtils2.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.computeBoundingBox = computeBoundingBox;\nexports.computeBoundingSphere = computeBoundingSphere;\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n// FIXME : very temporary , until moving to regl/gl-matrix\n\nfunction computeBoundingBox(object, children, force) {\n var force = force === undefined ? false : force;\n\n if (object.geometry === undefined) {\n var bbox = new _three2.default.Box3();\n } else {\n if (!object.geometry.boundingBox || force) {\n object.geometry.computeBoundingBox();\n }\n var bbox = object.geometry.boundingBox.clone();\n }\n\n children.forEach(function (rootChild) {\n rootChild.traverse(function (child) {\n if (child instanceof _three2.default.Mesh) {\n if (child.geometry !== undefined) {\n if (!child.geometry.boundingBox || force) {\n child.geometry.computeBoundingBox();\n }\n var childBox = child.geometry.boundingBox.clone();\n childBox.translate(child.localToWorld(new _three2.default.Vector3()));\n bbox.union(childBox);\n }\n }\n });\n });\n\n object.boundingBox = bbox;\n return bbox;\n}\n\nfunction computeBoundingSphere(object, children, force) {\n var bbox = new _three2.default.Box3().setFromObject(object);\n\n if (object.boundingBox) object.boundingBox.copy(bbox);\n if (!object.boundingBox) object.boundingBox = bbox;\n var boundingSphere = bbox.getBoundingSphere();\n return boundingSphere;\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/webgl/computeBounds2.js\n ** module id = 145\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/webgl/computeBounds2.js?")},function(module,exports,__webpack_require__){eval('"use strict";\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/*\n * @author zz85 / http://twitter.com/blurspline / http://www.lab4games.net/zz85/blog\n *\n * A general perpose camera, for setting FOV, Lens Focal Length,\n * and switching between perspective and orthographic views easily.\n * Use this only if you do not wish to manage\n * both a Orthographic and Perspective Camera\n *\n * some additional changes by kaosat-dev\n */\n\nvar CombinedCamera = function CombinedCamera(width, height, fov, near, far, orthoNear, orthoFar) {\n\n _three2.default.Camera.call(this);\n\n this.fov = fov;\n\n this.left = -width / 2;\n this.right = width / 2;\n this.top = height / 2;\n this.bottom = -height / 2;\n\n // We could also handle the projectionMatrix internally, but just wanted to test nested camera objects\n\n this.cameraO = new _three2.default.OrthographicCamera(width / -2, width / 2, height / 2, height / -2, orthoNear, orthoFar);\n this.cameraP = new _three2.default.PerspectiveCamera(fov, width / height, near, far);\n\n this.zoom = 1;\n\n this.toPerspective();\n\n var aspect = width / height;\n\n this.target = new _three2.default.Vector3();\n this.defaultPosition = new _three2.default.Vector3();\n\n /**\n Orientations:\n front: +x \n back: -x\n top/above : +z\n bottom/under : -z\n left: +y\n right: -y \n */\n this.orientationMap = {\n "F": new _three2.default.Vector3(1, 0, 0),\n "B": new _three2.default.Vector3(-1, 0, 0),\n\n "A": new _three2.default.Vector3(0, 0, 1),\n "U": new _three2.default.Vector3(0, 0, -1),\n\n "L": new _three2.default.Vector3(0, 1, 0),\n "R": new _three2.default.Vector3(0, -1, 0)\n };\n\n //we generate methods for each an every possible case\n var orientationNameMap = {\n "F": "Front",\n "B": "Back",\n "L": "Left",\n "R": "Right",\n "A": "Top",\n "U": "Bottom",\n\n "FL": "FrontLeft",\n "FR": "FrontRight",\n "FA": "FrontTop",\n "FU": "FrontBottom",\n\n "BL": "BackLeft",\n "BR": "BackRight",\n "BA": "BackTop",\n "BU": "BackBottom",\n\n "LA": "LeftTop",\n "LU": "LeftBottom",\n "RA": "RightTop",\n "RU": "RightBottom",\n\n "FAL": "FrontTopLeft",\n "FAR": "FrontTopRight",\n "FUL": "FrontBottomLeft",\n "FUR": "FrontBottomRight",\n\n "BAL": "BackTopLeft",\n "BAR": "BackTopRight",\n "BUL": "BackBottomLeft",\n "BUR": "BackBottomRight"\n };\n\n var self = this;\n function createOrientationFunct(methodName, orCode) {\n self[methodName] = function () {\n self.orientationGenerator(orCode);\n };\n }\n\n for (var shortOrientationName in orientationNameMap) {\n var orientation = orientationNameMap[shortOrientationName];\n var methodName = "to" + orientation.charAt(0).toUpperCase() + orientation.slice(1) + "View";\n createOrientationFunct(methodName, shortOrientationName);\n }\n};\n\nCombinedCamera.prototype = Object.create(_three2.default.Camera.prototype);\n\nCombinedCamera.prototype.lookAt = function () {\n\n // This routine does not support cameras with rotated and/or translated parent(s)\n\n var m1 = new _three2.default.Matrix4();\n\n return function (vector) {\n this.target = vector;\n if (this.inOrthographicMode === true) {\n this.toOrthographic();\n }\n\n m1.lookAt(this.position, vector, this.up);\n\n this.quaternion.setFromRotationMatrix(m1);\n };\n}();\n\nCombinedCamera.prototype.toPerspective = function () {\n\n // Switches to the Perspective Camera\n\n this.near = this.cameraP.near;\n this.far = this.cameraP.far;\n\n this.cameraP.fov = this.fov / this.zoom;\n\n this.cameraP.updateProjectionMatrix();\n\n this.projectionMatrix = this.cameraP.projectionMatrix;\n\n this.inPerspectiveMode = true;\n this.inOrthographicMode = false;\n};\n\nCombinedCamera.prototype.toOrthographic = function () {\n\n // Switches to the Orthographic camera estimating viewport from Perspective\n\n var fov = this.fov;\n var aspect = this.cameraP.aspect;\n var near = this.cameraP.near;\n var far = this.cameraP.far;\n\n //set the orthographic view rectangle to 0,0,width,height\n //see here : http://stackoverflow.com/questions/13483775/set-zoomvalue-of-a-perspective-equal-to-perspective\n if (this.target === null) {\n this.target = new _three2.default.Vector3();\n }\n var distance = new _three2.default.Vector3().subVectors(this.position, this.target).length() * 0.3;\n var width = Math.tan(fov) * distance * aspect;\n var height = Math.tan(fov) * distance;\n\n var halfWidth = width;\n var halfHeight = height;\n\n this.cameraO.left = halfWidth;\n this.cameraO.right = -halfWidth;\n this.cameraO.top = -halfHeight;\n this.cameraO.bottom = halfHeight;\n\n this.cameraO.updateProjectionMatrix();\n\n this.near = this.cameraO.near;\n this.far = this.cameraO.far;\n this.projectionMatrix = this.cameraO.projectionMatrix;\n\n this.inPerspectiveMode = false;\n this.inOrthographicMode = true;\n};\n\nCombinedCamera.prototype.setSize = function (width, height) {\n\n this.cameraP.aspect = width / height;\n this.left = -width / 2;\n this.right = width / 2;\n this.top = height / 2;\n this.bottom = -height / 2;\n};\n\nCombinedCamera.prototype.setFov = function (fov) {\n\n this.fov = fov;\n\n if (this.inPerspectiveMode) {\n\n this.toPerspective();\n } else {\n\n this.toOrthographic();\n }\n};\n\n// For mantaining similar API with PerspectiveCamera\n\nCombinedCamera.prototype.updateProjectionMatrix = function () {\n\n if (this.inPerspectiveMode) {\n\n this.toPerspective();\n } else {\n\n this.toPerspective();\n this.toOrthographic();\n }\n};\n\n/*\n* Uses Focal Length (in mm) to estimate and set FOV\n* 35mm (fullframe) camera is used if frame size is not specified;\n* Formula based on http://www.bobatkins.com/photography/technical/field_of_view.html\n*/\nCombinedCamera.prototype.setLens = function (focalLength, frameHeight) {\n\n if (frameHeight === undefined) frameHeight = 24;\n\n var fov = 2 * _three2.default.Math.radToDeg(Math.atan(frameHeight / (focalLength * 2)));\n\n this.setFov(fov);\n\n return fov;\n};\n\nCombinedCamera.prototype.setZoom = function (zoom) {\n\n this.zoom = zoom;\n\n if (this.inPerspectiveMode) {\n this.toPerspective();\n } else {\n this.toOrthographic();\n }\n};\n\nCombinedCamera.prototype.toDiagonalView = function () {\n this.position.copy(this.defaultPosition);\n this.target = new _three2.default.Vector3();\n this.lookAt(this.target);\n};\n\nCombinedCamera.prototype.orientationGenerator = function (name) {\n\n //name is a string of letters of length 1 to 3 representing\n // the desired orientation : ex : a: above, r: right, ar: above right\n //, flb: front left bottom\n\n var offset = this.position.clone().sub(this.target);\n var components = name;\n //console.log("offset distance",offset.length());\n\n var combinedTransform = new _three2.default.Vector3();\n for (var i = 0; i < components.length; i++) {\n //console.log("handling", components[i] );\n var component = components[i];\n var nPost = this.orientationMap[component].clone(); //.multiplyScalar( offset.length() );\n\n combinedTransform.add(nPost);\n }\n combinedTransform.setLength(offset.length());\n //console.log("offset disance 2",combinedTransform.length() );\n this.position.copy(combinedTransform);\n\n //console.log("offset disance 3",this.position.clone().sub(this.target).length() );\n this.lookAt(this.target);\n //console.log("offset disance 4",this.position.clone().sub(this.target).length() );\n};\n\n/*CombinedCamera.prototype.toFrontView = function() {\n \n var offset = this.position.clone().sub( this.target );\n var nPost = new THREE.Vector3();\n nPost.y = -offset.length();\n this.position.copy( nPost );\n this.lookAt( this.target );\n};\n\nCombinedCamera.prototype.toFrontLeftView = function() {\n //TODO: check posisitoning\n var offset = this.position.clone().sub( this.target );\n var nPost = new THREE.Vector3();\n nPost.y = -offset.length();\n nPost.x = -offset.length();\n this.position.copy( nPost );\n this.lookAt( this.target );\n};\n\nCombinedCamera.prototype.toFrontRightView = function() {\n //TODO: check posisitoning\n var offset = this.position.clone().sub( this.target );\n var nPost = new THREE.Vector3();\n nPost.y = -offset.length();\n nPost.x = offset.length();\n this.position.copy( nPost );\n this.lookAt( this.target );\n};\n\nCombinedCamera.prototype.toFrontTopView = function() {\n //TODO: check posisitoning\n var offset = this.position.clone().sub( this.target );\n var nPost = new THREE.Vector3();\n nPost.y = -offset.length();\n nPost.z = offset.length();\n this.position.copy( nPost );\n this.lookAt( this.target );\n};\n\nCombinedCamera.prototype.toFrontBottomView = function() {\n //TODO: check posisitoning\n var offset = this.position.clone().sub( this.target );\n var nPost = new THREE.Vector3();\n nPost.y = -offset.length();\n nPost.z = -offset.length();\n this.position.copy( nPost );\n this.lookAt( this.target );\n};\n\nCombinedCamera.prototype.toBackView = function() {\n\n var offset = this.position.clone().sub(this.target);\n var nPost = new THREE.Vector3();\n nPost.y = offset.length();\n this.position.copy(nPost);\n this.lookAt(this.target);\n};\n\nCombinedCamera.prototype.toLeftView = function() {\n \n var offset = this.position.clone().sub(this.target);\n var nPost = new THREE.Vector3();\n nPost.x = offset.length();\n this.position.copy(nPost);\n this.lookAt(this.target);\n \n};\n\nCombinedCamera.prototype.toRightView = function() {\n var offset = this.position.clone().sub(this.target);\n var nPost = new THREE.Vector3();\n nPost.x = -offset.length();\n this.position.copy( nPost );\n this.lookAt(this.target );\n};\n\nCombinedCamera.prototype.toTopView = function() {\n this.orientationGenerator( "a" );\n};\n\nCombinedCamera.prototype.toBottomView = function() {\n var offset = this.position.clone().sub(this.target);\n var nPost = new THREE.Vector3();\n nPost.z = -offset.length();\n this.position.copy( nPost );\n this.lookAt( this.target );\n};*/\n\nCombinedCamera.prototype.centerView = function () {\n //var offset = new THREE.Vector3().sub(this.target.clone());\n //this.position= new THREE.Vector3(100,100,200);\n //this.target = new THREE.Vector3();\n\n this.position.copy(this.defaultPosition);\n this.lookAt(this.target);\n};\n\nCombinedCamera.prototype.resetView = function () {\n this.position.copy(this.defaultPosition);\n this.target.copy(new _three2.default.Vector3());\n};\n\n//export default CombinedCamera;\nmodule.exports = CombinedCamera;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/webgl/deps/CombinedCamera.js\n ** module id = 146\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/webgl/deps/CombinedCamera.js?'); +},function(module,exports,__webpack_require__){eval('\'use strict\';\n\nObject.defineProperty(exports, "__esModule", {\n value: true\n});\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nvar _assign = __webpack_require__(7);\n\nvar _assign2 = _interopRequireDefault(_assign);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n//faster object.assign\n/**\n * @author kaosat-dev\n * @author qiao / https://github.com/qiao\n * @author mrdoob / http://mrdoob.com\n * @author alteredq / http://alteredqualia.com/\n * @author WestLangley / http://github.com/WestLangley\n */\nvar OrbitControls = function OrbitControls(object, domElement, upVector) {\n\n //this.object = object\n this.objects = [];\n this.objectOptions = [];\n this.camStates = [];\n\n this.domElement = domElement !== undefined ? domElement : document;\n this.upVector = upVector || new _three2.default.Vector3(0, 1, 0);\n\n // API\n this.enabled = true;\n\n //this.center = new THREE.Vector3()\n this.centers = [];\n\n this.userZoom = true;\n this.userZoomSpeed = 1.0;\n\n this.userRotate = true;\n this.userRotateSpeed = 1.0;\n\n this.userPan = true;\n this.userPanSpeed = 2.0;\n\n this.autoRotate = false;\n this.autoRotateSpeed = 2.0; // 30 seconds per round when fps is 60\n\n this.minPolarAngle = 0; // radians\n this.maxPolarAngle = Math.PI; // radians\n\n this.minDistance = 0.2;\n this.maxDistance = 1400;\n\n this.active = false;\n this.mainPointerPressed = false;\n\n // internals\n\n var scope = this;\n\n var EPS = 0.000001;\n var PIXELS_PER_ROUND = 1800;\n\n var phiDelta = 0;\n var thetaDelta = 0;\n var scale = 1;\n\n var origPhiDelta = phiDelta;\n var origThetaDelta = thetaDelta;\n var origScale = scale;\n\n //to add control of multiple cameras\n this.addObject = function (object) {\n var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];\n\n if (this.objects.indexOf(object) != -1) return;\n var DEFAULTS = { userZoom: true, userPan: true, userRotate: true };\n options = (0, _assign2.default)({}, DEFAULTS, options);\n\n this.objects.push(object);\n this.objectOptions.push(options);\n this.centers.push(new _three2.default.Vector3());\n this.camStates.push({ phiDelta: 0, thetaDelta: 0, scale: 1, lastPosition: new _three2.default.Vector3() });\n };\n\n // events\n var changeEvent = { type: \'change\' };\n\n this.update = function (dt) {\n //this is a modified version, with inverted Y and Z (since we use camera.z => up)\n //we also allow multiple objects/cameras\n for (var i = 0; i < this.objects.length; i++) {\n var object = this.objects[i];\n var center = this.centers[i];\n var camState = this.camStates[i];\n\n var curThetaDelta = camState.thetaDelta;\n var curPhiDelta = camState.phiDelta;\n var curScale = camState.scale;\n\n var lastPosition = camState.lastPosition;\n\n var position = object.position;\n var offset = position.clone().sub(center);\n\n if (this.upVector.z == 1) {\n // angle from z-axis around y-axis, upVector : z\n var theta = Math.atan2(offset.x, offset.y);\n // angle from y-axis\n var phi = Math.atan2(Math.sqrt(offset.x * offset.x + offset.y * offset.y), offset.z);\n } else {\n //in case of y up\n var theta = Math.atan2(offset.x, offset.z);\n var phi = Math.atan2(Math.sqrt(offset.x * offset.x + offset.z * offset.z), offset.y);\n curThetaDelta = -curThetaDelta;\n }\n\n if (this.autoRotate) {\n //this.rotateLeft( getAutoRotationAngle() )\n //PER camera\n this.objects.map(function (object, index) {\n if (scope.objectOptions[index].userRotate) {\n scope.camStates[index].thetaDelta += getAutoRotationAngle();\n }\n });\n }\n\n theta += curThetaDelta;\n phi += curPhiDelta;\n\n // restrict phi to be between desired limits\n phi = Math.max(this.minPolarAngle, Math.min(this.maxPolarAngle, phi));\n // restrict phi to be betwee EPS and PI-EPS\n phi = Math.max(EPS, Math.min(Math.PI - EPS, phi));\n //multiply by scaling effect\n var radius = offset.length() * curScale;\n // restrict radius to be between desired limits\n radius = Math.max(this.minDistance, Math.min(this.maxDistance, radius));\n\n if (this.upVector.z == 1) {\n offset.x = radius * Math.sin(phi) * Math.sin(theta);\n offset.z = radius * Math.cos(phi);\n offset.y = radius * Math.sin(phi) * Math.cos(theta);\n } else {\n offset.x = radius * Math.sin(phi) * Math.sin(theta);\n offset.y = radius * Math.cos(phi);\n offset.z = radius * Math.sin(phi) * Math.cos(theta);\n }\n\n //\n position.copy(center).add(offset);\n object.lookAt(center);\n\n if (lastPosition.distanceTo(object.position) > 0) {\n //this.active = true\n this.dispatchEvent(changeEvent);\n\n lastPosition.copy(object.position);\n } else {\n //fireDeActivated()\n }\n\n camState.thetaDelta /= 1.9;\n camState.phiDelta /= 1.5;\n camState.scale = 1;\n }\n };\n\n function getAutoRotationAngle() {\n return 2 * Math.PI / 60 / 60 * scope.autoRotateSpeed;\n }\n\n function getZoomScale() {\n return Math.pow(0.95, scope.userZoomSpeed);\n }\n\n this.enable = function () {\n scope.enabled = true;\n this.enabled = true;\n };\n\n this.disable = function () {\n scope.enabled = false;\n this.enabled = false;\n };\n\n this.reset = function () {\n for (var i = 0; i < this.objects.length; i++) {\n var center = this.centers[i];\n center = new _three2.default.Vector3();\n }\n this.objects.map(function (object, index) {\n var center = this.centers[index];\n center = new _three2.default.Vector3();\n this.camStates[index].phiDelta = origPhiDelta;\n this.camStates[index].thetaDelta = origThetaDelta;\n this.camStates[index].scale = origScale = scale;\n });\n\n this.update();\n };\n\n this.setObservables = function (observables) {\n var dragMoves$ = observables.dragMoves$;\n var zooms$ = observables.zooms$;\n\n\n var self = this;\n\n /* are these useful ?\n scope.userZoomSpeed = 0.6\n onPinch\n */\n function zoom(zoomDir, zoomScale, cameras) {\n\n if (scope.enabled === false) return;\n if (scope.userZoom === false) return;\n\n //PER camera\n cameras.map(function (object, index) {\n if (scope.objectOptions[index].userZoom) {\n\n if (zoomDir < 0) scope.camStates[index].scale /= zoomScale;\n if (zoomDir > 0) scope.camStates[index].scale *= zoomScale;\n }\n });\n }\n\n function rotate(cameras, angle) {\n\n if (scope.enabled === false) return;\n if (scope.userRotate === false) return;\n\n //PER camera\n cameras.map(function (object, index) {\n if (scope.objectOptions[index].userRotate) {\n scope.camStates[index].thetaDelta += angle.x;\n scope.camStates[index].phiDelta += angle.y;\n }\n });\n }\n\n //TODO: implement\n function pan(cameras, offset) {\n //console.log(event)\n var _origDist = distance.clone();\n\n //do this PER camera\n cameras.map(function (object, index) {\n if (scope.objectOptions[index].userPan) {\n var _distance = _origDist.clone();\n _distance.transformDirection(object.matrix);\n _distance.multiplyScalar(scope.userPanSpeed);\n\n object.position.add(_distance);\n scope.centers[index].add(_distance);\n }\n });\n }\n\n dragMoves$.subscribe(function (e) {\n var delta = e.delta;\n\n /*if ( angle === undefined ) {\n angle = 2 * Math.PI /180 * scope.userRotateSpeed\n }*/\n var angle = { x: 0, y: 0 };\n angle.x = 2 * Math.PI * delta.x / PIXELS_PER_ROUND * scope.userRotateSpeed;\n angle.y = -2 * Math.PI * delta.y / PIXELS_PER_ROUND * scope.userRotateSpeed;\n\n //console.log("rotate by angle",angle)\n /*if ( angle === undefined ) {\n angle = 2 * Math.PI /180 * scope.userRotateSpeed\n } */\n rotate(self.objects, angle);\n });\n //.subscribe(e=>e)//console.log("dragMoves",e.delta))\n\n zooms$.subscribe(function (delta) {\n var zoomScale = undefined;\n if (!zoomScale) {\n zoomScale = getZoomScale();\n }\n zoom(delta, zoomScale, self.objects);\n });\n //.subscribe(e=>e)//console.log("zoom",e))\n };\n};\n\nOrbitControls.prototype = Object.create(_three2.default.EventDispatcher.prototype);\n\nexports.default = OrbitControls;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/webgl/deps/OrbitControls.js\n ** module id = 147\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/webgl/deps/OrbitControls.js?')},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n//var THREE = require(\"three\"); //until it is done via the import syntax everywhere we have to use this\n\n_three2.default.RenderableObject = function () {\n\n this.id = 0;\n\n this.object = null;\n this.z = 0;\n};\n\n//\n\n/**\n * @author mrdoob / http://mrdoob.com/\n * @author supereggbert / http://www.paulbrunt.co.uk/\n * @author julianwa / https://github.com/julianwa\n */\n_three2.default.RenderableFace = function () {\n\n this.id = 0;\n\n this.v1 = new _three2.default.RenderableVertex();\n this.v2 = new _three2.default.RenderableVertex();\n this.v3 = new _three2.default.RenderableVertex();\n\n this.normalModel = new _three2.default.Vector3();\n\n this.vertexNormalsModel = [new _three2.default.Vector3(), new _three2.default.Vector3(), new _three2.default.Vector3()];\n this.vertexNormalsLength = 0;\n\n this.color = new _three2.default.Color();\n this.material = null;\n this.uvs = [new _three2.default.Vector2(), new _three2.default.Vector2(), new _three2.default.Vector2()];\n\n this.z = 0;\n};\n\n//\n\n_three2.default.RenderableVertex = function () {\n\n this.position = new _three2.default.Vector3();\n this.positionWorld = new _three2.default.Vector3();\n this.positionScreen = new _three2.default.Vector4();\n\n this.visible = true;\n};\n\n_three2.default.RenderableVertex.prototype.copy = function (vertex) {\n\n this.positionWorld.copy(vertex.positionWorld);\n this.positionScreen.copy(vertex.positionScreen);\n};\n\n//\n\n_three2.default.RenderableLine = function () {\n\n this.id = 0;\n\n this.v1 = new _three2.default.RenderableVertex();\n this.v2 = new _three2.default.RenderableVertex();\n\n this.vertexColors = [new _three2.default.Color(), new _three2.default.Color()];\n this.material = null;\n\n this.z = 0;\n};\n\n//\n\n_three2.default.RenderableSprite = function () {\n\n this.id = 0;\n\n this.object = null;\n\n this.x = 0;\n this.y = 0;\n this.z = 0;\n\n this.rotation = 0;\n this.scale = new _three2.default.Vector2();\n\n this.material = null;\n};\n\n//\n\n_three2.default.Projector = function () {\n\n var _object,\n _objectCount,\n _objectPool = [],\n _objectPoolLength = 0,\n _vertex,\n _vertexCount,\n _vertexPool = [],\n _vertexPoolLength = 0,\n _face,\n _faceCount,\n _facePool = [],\n _facePoolLength = 0,\n _line,\n _lineCount,\n _linePool = [],\n _linePoolLength = 0,\n _sprite,\n _spriteCount,\n _spritePool = [],\n _spritePoolLength = 0,\n _renderData = { objects: [], lights: [], elements: [] },\n _vA = new _three2.default.Vector3(),\n _vB = new _three2.default.Vector3(),\n _vC = new _three2.default.Vector3(),\n _vector3 = new _three2.default.Vector3(),\n _vector4 = new _three2.default.Vector4(),\n _clipBox = new _three2.default.Box3(new _three2.default.Vector3(-1, -1, -1), new _three2.default.Vector3(1, 1, 1)),\n _boundingBox = new _three2.default.Box3(),\n _points3 = new Array(3),\n _points4 = new Array(4),\n _viewMatrix = new _three2.default.Matrix4(),\n _viewProjectionMatrix = new _three2.default.Matrix4(),\n _modelMatrix,\n _modelViewProjectionMatrix = new _three2.default.Matrix4(),\n _normalMatrix = new _three2.default.Matrix3(),\n _frustum = new _three2.default.Frustum(),\n _clippedVertex1PositionScreen = new _three2.default.Vector4(),\n _clippedVertex2PositionScreen = new _three2.default.Vector4();\n\n //\n\n this.projectVector = function (vector, camera) {\n\n console.warn('THREE.Projector: .projectVector() is now vector.project().');\n vector.project(camera);\n };\n\n this.unprojectVector = function (vector, camera) {\n\n console.warn('THREE.Projector: .unprojectVector() is now vector.unproject().');\n vector.unproject(camera);\n };\n\n this.pickingRay = function (vector, camera) {\n\n console.error('THREE.Projector: .pickingRay() has been removed.');\n };\n\n //\n\n var RenderList = function RenderList() {\n\n var normals = [];\n var uvs = [];\n\n var object = null;\n var material = null;\n\n var normalMatrix = new _three2.default.Matrix3();\n\n var setObject = function setObject(value) {\n\n object = value;\n material = object.material;\n\n normalMatrix.getNormalMatrix(object.matrixWorld);\n\n normals.length = 0;\n uvs.length = 0;\n };\n\n var projectVertex = function projectVertex(vertex) {\n\n var position = vertex.position;\n var positionWorld = vertex.positionWorld;\n var positionScreen = vertex.positionScreen;\n\n positionWorld.copy(position).applyMatrix4(_modelMatrix);\n positionScreen.copy(positionWorld).applyMatrix4(_viewProjectionMatrix);\n\n var invW = 1 / positionScreen.w;\n\n positionScreen.x *= invW;\n positionScreen.y *= invW;\n positionScreen.z *= invW;\n\n vertex.visible = positionScreen.x >= -1 && positionScreen.x <= 1 && positionScreen.y >= -1 && positionScreen.y <= 1 && positionScreen.z >= -1 && positionScreen.z <= 1;\n };\n\n var pushVertex = function pushVertex(x, y, z) {\n\n _vertex = getNextVertexInPool();\n _vertex.position.set(x, y, z);\n\n projectVertex(_vertex);\n };\n\n var pushNormal = function pushNormal(x, y, z) {\n\n normals.push(x, y, z);\n };\n\n var pushUv = function pushUv(x, y) {\n\n uvs.push(x, y);\n };\n\n var checkTriangleVisibility = function checkTriangleVisibility(v1, v2, v3) {\n\n if (v1.visible === true || v2.visible === true || v3.visible === true) return true;\n\n _points3[0] = v1.positionScreen;\n _points3[1] = v2.positionScreen;\n _points3[2] = v3.positionScreen;\n\n return _clipBox.isIntersectionBox(_boundingBox.setFromPoints(_points3));\n };\n\n var checkBackfaceCulling = function checkBackfaceCulling(v1, v2, v3) {\n\n return (v3.positionScreen.x - v1.positionScreen.x) * (v2.positionScreen.y - v1.positionScreen.y) - (v3.positionScreen.y - v1.positionScreen.y) * (v2.positionScreen.x - v1.positionScreen.x) < 0;\n };\n\n var pushLine = function pushLine(a, b) {\n\n var v1 = _vertexPool[a];\n var v2 = _vertexPool[b];\n\n _line = getNextLineInPool();\n\n _line.id = object.id;\n _line.v1.copy(v1);\n _line.v2.copy(v2);\n _line.z = (v1.positionScreen.z + v2.positionScreen.z) / 2;\n\n _line.material = object.material;\n\n _renderData.elements.push(_line);\n };\n\n var pushTriangle = function pushTriangle(a, b, c) {\n\n var v1 = _vertexPool[a];\n var v2 = _vertexPool[b];\n var v3 = _vertexPool[c];\n\n if (checkTriangleVisibility(v1, v2, v3) === false) return;\n\n if (material.side === _three2.default.DoubleSide || checkBackfaceCulling(v1, v2, v3) === true) {\n\n _face = getNextFaceInPool();\n\n _face.id = object.id;\n _face.v1.copy(v1);\n _face.v2.copy(v2);\n _face.v3.copy(v3);\n _face.z = (v1.positionScreen.z + v2.positionScreen.z + v3.positionScreen.z) / 3;\n\n for (var i = 0; i < 3; i++) {\n\n var offset = arguments[i] * 3;\n var normal = _face.vertexNormalsModel[i];\n\n normal.set(normals[offset], normals[offset + 1], normals[offset + 2]);\n normal.applyMatrix3(normalMatrix).normalize();\n\n var offset2 = arguments[i] * 2;\n\n var uv = _face.uvs[i];\n uv.set(uvs[offset2], uvs[offset2 + 1]);\n }\n\n _face.vertexNormalsLength = 3;\n\n _face.material = object.material;\n\n _renderData.elements.push(_face);\n }\n };\n\n return {\n setObject: setObject,\n projectVertex: projectVertex,\n checkTriangleVisibility: checkTriangleVisibility,\n checkBackfaceCulling: checkBackfaceCulling,\n pushVertex: pushVertex,\n pushNormal: pushNormal,\n pushUv: pushUv,\n pushLine: pushLine,\n pushTriangle: pushTriangle\n };\n };\n\n var renderList = new RenderList();\n\n this.projectScene = function (scene, camera, sortObjects, sortElements) {\n\n _faceCount = 0;\n _lineCount = 0;\n _spriteCount = 0;\n\n _renderData.elements.length = 0;\n\n if (scene.autoUpdate === true) scene.updateMatrixWorld();\n if (camera.parent === undefined) camera.updateMatrixWorld();\n\n _viewMatrix.copy(camera.matrixWorldInverse.getInverse(camera.matrixWorld));\n _viewProjectionMatrix.multiplyMatrices(camera.projectionMatrix, _viewMatrix);\n\n _frustum.setFromMatrix(_viewProjectionMatrix);\n\n //\n\n _objectCount = 0;\n\n _renderData.objects.length = 0;\n _renderData.lights.length = 0;\n\n scene.traverseVisible(function (object) {\n\n if (object instanceof _three2.default.Light) {\n\n _renderData.lights.push(object);\n } else if (object instanceof _three2.default.Mesh || object instanceof _three2.default.Line || object instanceof _three2.default.Sprite) {\n\n if (object.material.visible === false) return;\n\n if (object.frustumCulled === false || _frustum.intersectsObject(object) === true) {\n\n _object = getNextObjectInPool();\n _object.id = object.id;\n _object.object = object;\n\n if (object.renderDepth !== null) {\n\n _object.z = object.renderDepth;\n } else {\n\n _vector3.setFromMatrixPosition(object.matrixWorld);\n _vector3.applyProjection(_viewProjectionMatrix);\n _object.z = _vector3.z;\n }\n\n _renderData.objects.push(_object);\n }\n }\n });\n\n if (sortObjects === true) {\n\n _renderData.objects.sort(painterSort);\n }\n\n //\n\n for (var o = 0, ol = _renderData.objects.length; o < ol; o++) {\n\n var object = _renderData.objects[o].object;\n var geometry = object.geometry;\n\n renderList.setObject(object);\n\n _modelMatrix = object.matrixWorld;\n\n _vertexCount = 0;\n\n if (object instanceof _three2.default.Mesh) {\n\n if (geometry instanceof _three2.default.BufferGeometry) {\n\n var attributes = geometry.attributes;\n var offsets = geometry.offsets;\n\n if (attributes.position === undefined) continue;\n\n var positions = attributes.position.array;\n\n for (var i = 0, l = positions.length; i < l; i += 3) {\n\n renderList.pushVertex(positions[i], positions[i + 1], positions[i + 2]);\n }\n\n if (attributes.normal !== undefined) {\n\n var normals = attributes.normal.array;\n\n for (var i = 0, l = normals.length; i < l; i += 3) {\n\n renderList.pushNormal(normals[i], normals[i + 1], normals[i + 2]);\n }\n }\n\n if (attributes.uv !== undefined) {\n\n var uvs = attributes.uv.array;\n\n for (var i = 0, l = uvs.length; i < l; i += 2) {\n\n renderList.pushUv(uvs[i], uvs[i + 1]);\n }\n }\n\n if (attributes.index !== undefined) {\n\n var indices = attributes.index.array;\n\n if (offsets.length > 0) {\n\n for (var o = 0; o < offsets.length; o++) {\n\n var offset = offsets[o];\n var index = offset.index;\n\n for (var i = offset.start, l = offset.start + offset.count; i < l; i += 3) {\n\n renderList.pushTriangle(indices[i] + index, indices[i + 1] + index, indices[i + 2] + index);\n }\n }\n } else {\n\n for (var i = 0, l = indices.length; i < l; i += 3) {\n\n renderList.pushTriangle(indices[i], indices[i + 1], indices[i + 2]);\n }\n }\n } else {\n\n for (var i = 0, l = positions.length / 3; i < l; i += 3) {\n\n renderList.pushTriangle(i, i + 1, i + 2);\n }\n }\n } else if (geometry instanceof _three2.default.Geometry) {\n\n var vertices = geometry.vertices;\n var faces = geometry.faces;\n var faceVertexUvs = geometry.faceVertexUvs[0];\n\n _normalMatrix.getNormalMatrix(_modelMatrix);\n\n var isFaceMaterial = object.material instanceof _three2.default.MeshFaceMaterial;\n var objectMaterials = isFaceMaterial === true ? object.material : null;\n\n for (var v = 0, vl = vertices.length; v < vl; v++) {\n\n var vertex = vertices[v];\n renderList.pushVertex(vertex.x, vertex.y, vertex.z);\n }\n\n for (var f = 0, fl = faces.length; f < fl; f++) {\n\n var face = faces[f];\n\n var material = isFaceMaterial === true ? objectMaterials.materials[face.materialIndex] : object.material;\n\n if (material === undefined) continue;\n\n var side = material.side;\n\n var v1 = _vertexPool[face.a];\n var v2 = _vertexPool[face.b];\n var v3 = _vertexPool[face.c];\n\n if (material.morphTargets === true) {\n\n var morphTargets = geometry.morphTargets;\n var morphInfluences = object.morphTargetInfluences;\n\n var v1p = v1.position;\n var v2p = v2.position;\n var v3p = v3.position;\n\n _vA.set(0, 0, 0);\n _vB.set(0, 0, 0);\n _vC.set(0, 0, 0);\n\n for (var t = 0, tl = morphTargets.length; t < tl; t++) {\n\n var influence = morphInfluences[t];\n\n if (influence === 0) continue;\n\n var targets = morphTargets[t].vertices;\n\n _vA.x += (targets[face.a].x - v1p.x) * influence;\n _vA.y += (targets[face.a].y - v1p.y) * influence;\n _vA.z += (targets[face.a].z - v1p.z) * influence;\n\n _vB.x += (targets[face.b].x - v2p.x) * influence;\n _vB.y += (targets[face.b].y - v2p.y) * influence;\n _vB.z += (targets[face.b].z - v2p.z) * influence;\n\n _vC.x += (targets[face.c].x - v3p.x) * influence;\n _vC.y += (targets[face.c].y - v3p.y) * influence;\n _vC.z += (targets[face.c].z - v3p.z) * influence;\n }\n\n v1.position.add(_vA);\n v2.position.add(_vB);\n v3.position.add(_vC);\n\n renderList.projectVertex(v1);\n renderList.projectVertex(v2);\n renderList.projectVertex(v3);\n }\n\n if (renderList.checkTriangleVisibility(v1, v2, v3) === false) continue;\n\n var visible = renderList.checkBackfaceCulling(v1, v2, v3);\n\n if (side !== _three2.default.DoubleSide) {\n if (side === _three2.default.FrontSide && visible === false) continue;\n if (side === _three2.default.BackSide && visible === true) continue;\n }\n\n _face = getNextFaceInPool();\n\n _face.id = object.id;\n _face.v1.copy(v1);\n _face.v2.copy(v2);\n _face.v3.copy(v3);\n\n _face.normalModel.copy(face.normal);\n\n if (visible === false && (side === _three2.default.BackSide || side === _three2.default.DoubleSide)) {\n\n _face.normalModel.negate();\n }\n\n _face.normalModel.applyMatrix3(_normalMatrix).normalize();\n\n var faceVertexNormals = face.vertexNormals;\n\n for (var n = 0, nl = Math.min(faceVertexNormals.length, 3); n < nl; n++) {\n\n var normalModel = _face.vertexNormalsModel[n];\n normalModel.copy(faceVertexNormals[n]);\n\n if (visible === false && (side === _three2.default.BackSide || side === _three2.default.DoubleSide)) {\n\n normalModel.negate();\n }\n\n normalModel.applyMatrix3(_normalMatrix).normalize();\n }\n\n _face.vertexNormalsLength = faceVertexNormals.length;\n\n var vertexUvs = faceVertexUvs[f];\n\n if (vertexUvs !== undefined) {\n\n for (var u = 0; u < 3; u++) {\n\n _face.uvs[u].copy(vertexUvs[u]);\n }\n }\n\n _face.color = face.color;\n _face.material = material;\n\n _face.z = (v1.positionScreen.z + v2.positionScreen.z + v3.positionScreen.z) / 3;\n\n _renderData.elements.push(_face);\n }\n }\n } else if (object instanceof _three2.default.Line) {\n\n if (geometry instanceof _three2.default.BufferGeometry) {\n\n var attributes = geometry.attributes;\n\n if (attributes.position !== undefined) {\n\n var positions = attributes.position.array;\n\n for (var i = 0, l = positions.length; i < l; i += 3) {\n\n renderList.pushVertex(positions[i], positions[i + 1], positions[i + 2]);\n }\n\n if (attributes.index !== undefined) {\n\n var indices = attributes.index.array;\n\n for (var i = 0, l = indices.length; i < l; i += 2) {\n\n renderList.pushLine(indices[i], indices[i + 1]);\n }\n } else {\n\n var step = object.mode === _three2.default.LinePieces ? 2 : 1;\n\n for (var i = 0, l = positions.length / 3 - 1; i < l; i += step) {\n\n renderList.pushLine(i, i + 1);\n }\n }\n }\n } else if (geometry instanceof _three2.default.Geometry) {\n\n _modelViewProjectionMatrix.multiplyMatrices(_viewProjectionMatrix, _modelMatrix);\n\n var vertices = object.geometry.vertices;\n\n if (vertices.length === 0) continue;\n\n v1 = getNextVertexInPool();\n v1.positionScreen.copy(vertices[0]).applyMatrix4(_modelViewProjectionMatrix);\n\n // Handle LineStrip and LinePieces\n var step = object.mode === _three2.default.LinePieces ? 2 : 1;\n\n for (var v = 1, vl = vertices.length; v < vl; v++) {\n\n v1 = getNextVertexInPool();\n v1.positionScreen.copy(vertices[v]).applyMatrix4(_modelViewProjectionMatrix);\n\n if ((v + 1) % step > 0) continue;\n\n v2 = _vertexPool[_vertexCount - 2];\n\n _clippedVertex1PositionScreen.copy(v1.positionScreen);\n _clippedVertex2PositionScreen.copy(v2.positionScreen);\n\n if (clipLine(_clippedVertex1PositionScreen, _clippedVertex2PositionScreen) === true) {\n\n // Perform the perspective divide\n _clippedVertex1PositionScreen.multiplyScalar(1 / _clippedVertex1PositionScreen.w);\n _clippedVertex2PositionScreen.multiplyScalar(1 / _clippedVertex2PositionScreen.w);\n\n _line = getNextLineInPool();\n\n _line.id = object.id;\n _line.v1.positionScreen.copy(_clippedVertex1PositionScreen);\n _line.v2.positionScreen.copy(_clippedVertex2PositionScreen);\n\n _line.z = Math.max(_clippedVertex1PositionScreen.z, _clippedVertex2PositionScreen.z);\n\n _line.material = object.material;\n\n if (object.material.vertexColors === _three2.default.VertexColors) {\n\n _line.vertexColors[0].copy(object.geometry.colors[v]);\n _line.vertexColors[1].copy(object.geometry.colors[v - 1]);\n }\n\n _renderData.elements.push(_line);\n }\n }\n }\n } else if (object instanceof _three2.default.Sprite) {\n\n _vector4.set(_modelMatrix.elements[12], _modelMatrix.elements[13], _modelMatrix.elements[14], 1);\n _vector4.applyMatrix4(_viewProjectionMatrix);\n\n var invW = 1 / _vector4.w;\n\n _vector4.z *= invW;\n\n if (_vector4.z >= -1 && _vector4.z <= 1) {\n\n _sprite = getNextSpriteInPool();\n _sprite.id = object.id;\n _sprite.x = _vector4.x * invW;\n _sprite.y = _vector4.y * invW;\n _sprite.z = _vector4.z;\n _sprite.object = object;\n\n _sprite.rotation = object.rotation;\n\n _sprite.scale.x = object.scale.x * Math.abs(_sprite.x - (_vector4.x + camera.projectionMatrix.elements[0]) / (_vector4.w + camera.projectionMatrix.elements[12]));\n _sprite.scale.y = object.scale.y * Math.abs(_sprite.y - (_vector4.y + camera.projectionMatrix.elements[5]) / (_vector4.w + camera.projectionMatrix.elements[13]));\n\n _sprite.material = object.material;\n\n _renderData.elements.push(_sprite);\n }\n }\n }\n\n if (sortElements === true) {\n\n _renderData.elements.sort(painterSort);\n }\n\n return _renderData;\n };\n\n // Pools\n\n function getNextObjectInPool() {\n\n if (_objectCount === _objectPoolLength) {\n\n var object = new _three2.default.RenderableObject();\n _objectPool.push(object);\n _objectPoolLength++;\n _objectCount++;\n return object;\n }\n\n return _objectPool[_objectCount++];\n }\n\n function getNextVertexInPool() {\n\n if (_vertexCount === _vertexPoolLength) {\n\n var vertex = new _three2.default.RenderableVertex();\n _vertexPool.push(vertex);\n _vertexPoolLength++;\n _vertexCount++;\n return vertex;\n }\n\n return _vertexPool[_vertexCount++];\n }\n\n function getNextFaceInPool() {\n\n if (_faceCount === _facePoolLength) {\n\n var face = new _three2.default.RenderableFace();\n _facePool.push(face);\n _facePoolLength++;\n _faceCount++;\n return face;\n }\n\n return _facePool[_faceCount++];\n }\n\n function getNextLineInPool() {\n\n if (_lineCount === _linePoolLength) {\n\n var line = new _three2.default.RenderableLine();\n _linePool.push(line);\n _linePoolLength++;\n _lineCount++;\n return line;\n }\n\n return _linePool[_lineCount++];\n }\n\n function getNextSpriteInPool() {\n\n if (_spriteCount === _spritePoolLength) {\n\n var sprite = new _three2.default.RenderableSprite();\n _spritePool.push(sprite);\n _spritePoolLength++;\n _spriteCount++;\n return sprite;\n }\n\n return _spritePool[_spriteCount++];\n }\n\n //\n\n function painterSort(a, b) {\n\n if (a.z !== b.z) {\n\n return b.z - a.z;\n } else if (a.id !== b.id) {\n\n return a.id - b.id;\n } else {\n\n return 0;\n }\n }\n\n function clipLine(s1, s2) {\n\n var alpha1 = 0,\n alpha2 = 1,\n\n\n // Calculate the boundary coordinate of each vertex for the near and far clip planes,\n // Z = -1 and Z = +1, respectively.\n bc1near = s1.z + s1.w,\n bc2near = s2.z + s2.w,\n bc1far = -s1.z + s1.w,\n bc2far = -s2.z + s2.w;\n\n if (bc1near >= 0 && bc2near >= 0 && bc1far >= 0 && bc2far >= 0) {\n\n // Both vertices lie entirely within all clip planes.\n return true;\n } else if (bc1near < 0 && bc2near < 0 || bc1far < 0 && bc2far < 0) {\n\n // Both vertices lie entirely outside one of the clip planes.\n return false;\n } else {\n\n // The line segment spans at least one clip plane.\n\n if (bc1near < 0) {\n\n // v1 lies outside the near plane, v2 inside\n alpha1 = Math.max(alpha1, bc1near / (bc1near - bc2near));\n } else if (bc2near < 0) {\n\n // v2 lies outside the near plane, v1 inside\n alpha2 = Math.min(alpha2, bc1near / (bc1near - bc2near));\n }\n\n if (bc1far < 0) {\n\n // v1 lies outside the far plane, v2 inside\n alpha1 = Math.max(alpha1, bc1far / (bc1far - bc2far));\n } else if (bc2far < 0) {\n\n // v2 lies outside the far plane, v2 inside\n alpha2 = Math.min(alpha2, bc1far / (bc1far - bc2far));\n }\n\n if (alpha2 < alpha1) {\n\n // The line segment spans two boundaries, but is outside both of them.\n // (This can't happen when we're only clipping against just near/far but good\n // to leave the check here for future usage if other clip planes are added.)\n return false;\n } else {\n\n // Update the s1 and s2 vertices to match the clipped line segment.\n s1.lerp(s2, alpha1);\n s2.lerp(s1, 1 - alpha2);\n\n return true;\n }\n }\n }\n};\n\n//module.exports = THREE.Projector;\nexports.default = _three2.default.Projector;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/webgl/deps/Projector.js\n ** module id = 148\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/webgl/deps/Projector.js?"); +},function(module,exports,__webpack_require__){eval('"use strict";\n\nObject.defineProperty(exports, "__esModule", {\n value: true\n});\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/**\n * original @author stemkoski / http://github.com/stemkoski\n * modified by @kaosat-dev / http://github.com/kaosat-dev\n * Blend three textures additively\n * texel1 + texel2\n * + vec4(0.5, 0.75, 1.0, 1.0)\n */\n\nvar AdditiveBlendShader = {\n\n uniforms: {\n\n "tDiffuse1": { type: "t", value: null },\n "tDiffuse2": { type: "t", value: null },\n "tDiffuse3": { type: "t", value: null },\n "normalThreshold": { type: "f", value: 0.1 },\n "depthThreshold": { type: "f", value: 0.05 },\n "strengh": { type: "f", value: 0.4 },\n "color": { type: "c", value: new _three2.default.Color(0x000002) }\n },\n\n vertexShader: ["varying vec2 vUv;", "void main() {", "vUv = uv;", "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", "}"].join("\\n"),\n\n fragmentShader: ["uniform sampler2D tDiffuse1;", "uniform sampler2D tDiffuse2;", "uniform sampler2D tDiffuse3;", "uniform float normalThreshold;", "uniform float depthThreshold;", "uniform float strengh;", "uniform vec3 color;", "varying vec2 vUv;", "void main() {", "vec4 colorTexel = texture2D( tDiffuse1, vUv );", "vec4 normalTexel = texture2D( tDiffuse2, vUv );", "vec4 depthTexel = texture2D( tDiffuse3, vUv );", "gl_FragColor = colorTexel;", "if( normalTexel.r >= normalThreshold || depthTexel.r >=depthThreshold) {", "gl_FragColor= colorTexel*(1.0-strengh) + vec4(color[0], color[1], color[2],1);", "}", "}"].join("\\n")\n\n};\n\nexports.default = AdditiveBlendShader;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/webgl/deps/post-process/AdditiveBlendShader.js\n ** module id = 149\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/webgl/deps/post-process/AdditiveBlendShader.js?')},function(module,exports,__webpack_require__){eval('"use strict";\n\nObject.defineProperty(exports, "__esModule", {\n value: true\n});\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/**\n * @author alteredq / http://alteredqualia.com/\n *\n * Full-screen textured quad shader\n */\n\n_three2.default.CopyShader = {\n\n uniforms: {\n\n "tDiffuse": { type: "t", value: null },\n "opacity": { type: "f", value: 1.0 }\n\n },\n\n vertexShader: ["varying vec2 vUv;", "void main() {", "vUv = uv;", "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", "}"].join("\\n"),\n\n fragmentShader: ["uniform float opacity;", "uniform sampler2D tDiffuse;", "varying vec2 vUv;", "void main() {", "vec4 texel = texture2D( tDiffuse, vUv );", "gl_FragColor = opacity * texel;", "}"].join("\\n")\n\n};\n\nexports.default = _three2.default.CopyShader;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/webgl/deps/post-process/CopyShader.js\n ** module id = 150\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/webgl/deps/post-process/CopyShader.js?')},function(module,exports,__webpack_require__){eval('"use strict";\n\nObject.defineProperty(exports, "__esModule", {\n value: true\n});\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/**\n * @author zz85 / https://github.com/zz85 | https://www.lab4games.net/zz85/blog\n *\n * Edge Detection Shader using Sobel filter\n * Based on http://rastergrid.com/blog/2011/01/frei-chen-edge-detector\n *\n * aspect: vec2 of (1/width, 1/height)\n */\n\nvar EdgeShader3 = {\n\n uniforms: {\n\n "tDiffuse": { type: "t", value: null },\n "aspect": { type: "v2", value: new _three2.default.Vector2(512, 512) }\n },\n\n vertexShader: ["varying vec2 vUv;", "void main() {", "vUv = uv;", "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", "}"].join("\\n"),\n\n fragmentShader: ["uniform sampler2D tDiffuse;", "varying vec2 vUv;", "uniform vec2 aspect;", "vec2 texel = vec2(1.0 / aspect.x, 1.0 / aspect.y);", "mat3 G[2];", "const mat3 g0 = mat3( 1.0, 2.0, 1.0, 0.0, 0.0, 0.0, -1.0, -2.0, -1.0 );", "const mat3 g1 = mat3( 1.0, 0.0, -1.0, 2.0, 0.0, -2.0, 1.0, 0.0, -1.0 );", "void main(void)", "{", "mat3 I;", "float cnv[2];", "vec3 sample;", "G[0] = g0;", "G[1] = g1;",\n\n /* fetch the 3x3 neighbourhood and use the RGB vector\'s length as intensity value */\n "for (float i=0.0; i<3.0; i++)", "for (float j=0.0; j<3.0; j++) {", "sample = texture2D( tDiffuse, vUv + texel * vec2(i-1.0,j-1.0) ).rgb;", "I[int(i)][int(j)] = length(sample);", "}",\n\n /* calculate the convolution values for all the masks */\n "for (int i=0; i<2; i++) {", "float dp3 = dot(G[i][0], I[0]) + dot(G[i][1], I[1]) + dot(G[i][2], I[2]);", "cnv[i] = dp3 * dp3; ", "}", "gl_FragColor = vec4(0.5 * sqrt(cnv[0]*cnv[0]+cnv[1]*cnv[1]));", "} "].join("\\n")\n\n};\n\nexports.default = EdgeShader3;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/webgl/deps/post-process/EdgeShader3.js\n ** module id = 151\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/webgl/deps/post-process/EdgeShader3.js?')},function(module,exports,__webpack_require__){eval('"use strict";\n\nObject.defineProperty(exports, "__esModule", {\n value: true\n});\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/**\n * @author alteredq / http://alteredqualia.com/\n */\n\n_three2.default.EffectComposer = function (renderer, renderTarget) {\n\n this.renderer = renderer;\n\n if (renderTarget === undefined) {\n\n var pixelRatio = renderer.getPixelRatio();\n\n var width = Math.floor(renderer.context.canvas.width / pixelRatio) || 1;\n var height = Math.floor(renderer.context.canvas.height / pixelRatio) || 1;\n var parameters = { minFilter: _three2.default.LinearFilter, magFilter: _three2.default.LinearFilter, format: _three2.default.RGBFormat, stencilBuffer: false };\n\n renderTarget = new _three2.default.WebGLRenderTarget(width, height, parameters);\n }\n\n this.renderTarget1 = renderTarget;\n this.renderTarget2 = renderTarget.clone();\n\n this.writeBuffer = this.renderTarget1;\n this.readBuffer = this.renderTarget2;\n\n this.passes = [];\n\n if (_three2.default.CopyShader === undefined) console.error("THREE.EffectComposer relies on THREE.CopyShader");\n\n this.copyPass = new _three2.default.ShaderPass(_three2.default.CopyShader);\n};\n\n_three2.default.EffectComposer.prototype = {\n\n swapBuffers: function swapBuffers() {\n\n var tmp = this.readBuffer;\n this.readBuffer = this.writeBuffer;\n this.writeBuffer = tmp;\n },\n\n addPass: function addPass(pass) {\n\n this.passes.push(pass);\n },\n\n insertPass: function insertPass(pass, index) {\n\n this.passes.splice(index, 0, pass);\n },\n\n render: function render(delta) {\n\n this.writeBuffer = this.renderTarget1;\n this.readBuffer = this.renderTarget2;\n\n var maskActive = false;\n\n var pass,\n i,\n il = this.passes.length;\n\n for (i = 0; i < il; i++) {\n\n pass = this.passes[i];\n\n if (!pass.enabled) continue;\n\n pass.render(this.renderer, this.writeBuffer, this.readBuffer, delta, maskActive);\n\n if (pass.needsSwap) {\n\n if (maskActive) {\n\n var context = this.renderer.context;\n\n context.stencilFunc(context.NOTEQUAL, 1, 0xffffffff);\n\n this.copyPass.render(this.renderer, this.writeBuffer, this.readBuffer, delta);\n\n context.stencilFunc(context.EQUAL, 1, 0xffffffff);\n }\n\n this.swapBuffers();\n }\n\n if (pass instanceof _three2.default.MaskPass) {\n\n maskActive = true;\n } else if (pass instanceof _three2.default.ClearMaskPass) {\n\n maskActive = false;\n }\n }\n },\n\n reset: function reset(renderTarget) {\n\n if (renderTarget === undefined) {\n\n renderTarget = this.renderTarget1.clone();\n\n var pixelRatio = this.renderer.getPixelRatio();\n\n renderTarget.width = Math.floor(this.renderer.context.canvas.width / pixelRatio);\n renderTarget.height = Math.floor(this.renderer.context.canvas.height / pixelRatio);\n }\n\n this.renderTarget1 = renderTarget;\n this.renderTarget2 = renderTarget.clone();\n\n this.writeBuffer = this.renderTarget1;\n this.readBuffer = this.renderTarget2;\n },\n\n setSize: function setSize(width, height) {\n\n var renderTarget = this.renderTarget1.clone();\n\n renderTarget.width = width;\n renderTarget.height = height;\n\n this.reset(renderTarget);\n }\n\n};\nexports.default = _three2.default.EffectComposer;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/webgl/deps/post-process/EffectComposer.js\n ** module id = 152\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/webgl/deps/post-process/EffectComposer.js?')},function(module,exports,__webpack_require__){eval('"use strict";\n\nObject.defineProperty(exports, "__esModule", {\n value: true\n});\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/**\n * @author alteredq / http://alteredqualia.com/\n * @author davidedc / http://www.sketchpatch.net/\n *\n * NVIDIA FXAA by Timothy Lottes\n * http://timothylottes.blogspot.com/2011/06/fxaa3-source-released.html\n * - WebGL port by @supereggbert\n * http://www.glge.org/demos/fxaa/\n */\n\n_three2.default.FXAAShader = {\n\n uniforms: {\n\n "tDiffuse": { type: "t", value: null },\n "resolution": { type: "v2", value: new _three2.default.Vector2(1 / 1024, 1 / 512) }\n\n },\n\n vertexShader: ["void main() {", "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", "}"].join("\\n"),\n\n fragmentShader: ["uniform sampler2D tDiffuse;", "uniform vec2 resolution;", "#define FXAA_REDUCE_MIN (1.0/128.0)", "#define FXAA_REDUCE_MUL (1.0/8.0)", "#define FXAA_SPAN_MAX 8.0", "void main() {", "vec3 rgbNW = texture2D( tDiffuse, ( gl_FragCoord.xy + vec2( -1.0, -1.0 ) ) * resolution ).xyz;", "vec3 rgbNE = texture2D( tDiffuse, ( gl_FragCoord.xy + vec2( 1.0, -1.0 ) ) * resolution ).xyz;", "vec3 rgbSW = texture2D( tDiffuse, ( gl_FragCoord.xy + vec2( -1.0, 1.0 ) ) * resolution ).xyz;", "vec3 rgbSE = texture2D( tDiffuse, ( gl_FragCoord.xy + vec2( 1.0, 1.0 ) ) * resolution ).xyz;", "vec4 rgbaM = texture2D( tDiffuse, gl_FragCoord.xy * resolution );", "vec3 rgbM = rgbaM.xyz;", "vec3 luma = vec3( 0.299, 0.587, 0.114 );", "float lumaNW = dot( rgbNW, luma );", "float lumaNE = dot( rgbNE, luma );", "float lumaSW = dot( rgbSW, luma );", "float lumaSE = dot( rgbSE, luma );", "float lumaM = dot( rgbM, luma );", "float lumaMin = min( lumaM, min( min( lumaNW, lumaNE ), min( lumaSW, lumaSE ) ) );", "float lumaMax = max( lumaM, max( max( lumaNW, lumaNE) , max( lumaSW, lumaSE ) ) );", "vec2 dir;", "dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));", "dir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE));", "float dirReduce = max( ( lumaNW + lumaNE + lumaSW + lumaSE ) * ( 0.25 * FXAA_REDUCE_MUL ), FXAA_REDUCE_MIN );", "float rcpDirMin = 1.0 / ( min( abs( dir.x ), abs( dir.y ) ) + dirReduce );", "dir = min( vec2( FXAA_SPAN_MAX, FXAA_SPAN_MAX),", "max( vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX),", "dir * rcpDirMin)) * resolution;", "vec4 rgbA = (1.0/2.0) * (", "texture2D(tDiffuse, gl_FragCoord.xy * resolution + dir * (1.0/3.0 - 0.5)) +", "texture2D(tDiffuse, gl_FragCoord.xy * resolution + dir * (2.0/3.0 - 0.5)));", "vec4 rgbB = rgbA * (1.0/2.0) + (1.0/4.0) * (", "texture2D(tDiffuse, gl_FragCoord.xy * resolution + dir * (0.0/3.0 - 0.5)) +", "texture2D(tDiffuse, gl_FragCoord.xy * resolution + dir * (3.0/3.0 - 0.5)));", "float lumaB = dot(rgbB, vec4(luma, 0.0));", "if ( ( lumaB < lumaMin ) || ( lumaB > lumaMax ) ) {", "gl_FragColor = rgbA;", "} else {", "gl_FragColor = rgbB;", "}", "}"].join("\\n")\n\n};\n\nexports.default = _three2.default.FXAAShader;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/webgl/deps/post-process/FXAAShader.js\n ** module id = 153\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/webgl/deps/post-process/FXAAShader.js?')},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.ClearMaskPass = exports.MaskPass = undefined;\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/**\n * @author alteredq / http://alteredqualia.com/\n */\n\n_three2.default.MaskPass = function (scene, camera) {\n\n this.scene = scene;\n this.camera = camera;\n\n this.enabled = true;\n this.clear = true;\n this.needsSwap = false;\n\n this.inverse = false;\n};\n\n_three2.default.MaskPass.prototype = {\n\n render: function render(renderer, writeBuffer, readBuffer, delta) {\n\n var context = renderer.context;\n\n // don't update color or depth\n\n context.colorMask(false, false, false, false);\n context.depthMask(false);\n\n // set up stencil\n\n var writeValue, clearValue;\n\n if (this.inverse) {\n\n writeValue = 0;\n clearValue = 1;\n } else {\n\n writeValue = 1;\n clearValue = 0;\n }\n\n context.enable(context.STENCIL_TEST);\n context.stencilOp(context.REPLACE, context.REPLACE, context.REPLACE);\n context.stencilFunc(context.ALWAYS, writeValue, 0xffffffff);\n context.clearStencil(clearValue);\n\n // draw into the stencil buffer\n\n renderer.render(this.scene, this.camera, readBuffer, this.clear);\n renderer.render(this.scene, this.camera, writeBuffer, this.clear);\n\n // re-enable update of color and depth\n\n context.colorMask(true, true, true, true);\n context.depthMask(true);\n\n // only render where stencil is set to 1\n\n context.stencilFunc(context.EQUAL, 1, 0xffffffff); // draw if == 1\n context.stencilOp(context.KEEP, context.KEEP, context.KEEP);\n }\n\n};\n\n_three2.default.ClearMaskPass = function () {\n\n this.enabled = true;\n};\n\n_three2.default.ClearMaskPass.prototype = {\n\n render: function render(renderer, writeBuffer, readBuffer, delta) {\n\n var context = renderer.context;\n\n context.disable(context.STENCIL_TEST);\n }\n\n};\n\nvar MaskPass = _three2.default.MaskPass;\nvar ClearMaskPass = _three2.default.ClearMaskPass;\nexports.MaskPass = MaskPass;\nexports.ClearMaskPass = ClearMaskPass;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/webgl/deps/post-process/MaskPass.js\n ** module id = 154\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/webgl/deps/post-process/MaskPass.js?")},function(module,exports){eval('"use strict";\n\nObject.defineProperty(exports, "__esModule", {\n value: true\n});\nvar shader = {\n \'outline\': {\n vertex_shader: ["uniform float offset;", "void main() {", "vec4 pos = vec4( position + normal * offset/2.0, 1.0 );", "gl_Position = projectionMatrix * modelViewMatrix * pos;", "}"].join("\\n"),\n\n fragment_shader: ["uniform vec3 color;", "void main(){", "gl_FragColor = vec4(color,1.0); //vec4( 1.0, 0.0, 0.0, 1.0 );", "}"].join("\\n")\n }\n};\n\nexports.default = shader;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/webgl/deps/post-process/OutlineShader.js\n ** module id = 155\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/webgl/deps/post-process/OutlineShader.js?')},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/**\n * @author alteredq / http://alteredqualia.com/\n */\n\n_three2.default.RenderPass = function (scene, camera, overrideMaterial, clearColor, clearAlpha) {\n\n this.scene = scene;\n this.camera = camera;\n\n this.overrideMaterial = overrideMaterial;\n\n this.clearColor = clearColor;\n this.clearAlpha = clearAlpha !== undefined ? clearAlpha : 1;\n\n this.oldClearColor = new _three2.default.Color();\n this.oldClearAlpha = 1;\n\n this.enabled = true;\n this.clear = true;\n this.needsSwap = false;\n};\n\n_three2.default.RenderPass.prototype = {\n\n render: function render(renderer, writeBuffer, readBuffer, delta) {\n\n this.scene.overrideMaterial = this.overrideMaterial;\n\n if (this.clearColor) {\n\n this.oldClearColor.copy(renderer.getClearColor());\n this.oldClearAlpha = renderer.getClearAlpha();\n\n renderer.setClearColor(this.clearColor, this.clearAlpha);\n }\n\n renderer.render(this.scene, this.camera, readBuffer, this.clear);\n\n if (this.clearColor) {\n\n renderer.setClearColor(this.oldClearColor, this.oldClearAlpha);\n }\n\n this.scene.overrideMaterial = null;\n }\n\n};\n\nexports.default = _three2.default.RenderPass;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/webgl/deps/post-process/RenderPass.js\n ** module id = 156\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/webgl/deps/post-process/RenderPass.js?")},function(module,exports,__webpack_require__){eval('"use strict";\n\nObject.defineProperty(exports, "__esModule", {\n value: true\n});\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/**\n * @author alteredq / http://alteredqualia.com/\n */\n\n_three2.default.ShaderPass = function (shader, textureID) {\n\n this.textureID = textureID !== undefined ? textureID : "tDiffuse";\n\n this.uniforms = _three2.default.UniformsUtils.clone(shader.uniforms);\n\n this.material = new _three2.default.ShaderMaterial({\n\n defines: shader.defines || {},\n uniforms: this.uniforms,\n vertexShader: shader.vertexShader,\n fragmentShader: shader.fragmentShader\n\n });\n\n this.renderToScreen = false;\n\n this.enabled = true;\n this.needsSwap = true;\n this.clear = false;\n\n this.camera = new _three2.default.OrthographicCamera(-1, 1, 1, -1, 0, 1);\n this.scene = new _three2.default.Scene();\n\n this.quad = new _three2.default.Mesh(new _three2.default.PlaneBufferGeometry(2, 2), null);\n this.scene.add(this.quad);\n};\n\n_three2.default.ShaderPass.prototype = {\n\n render: function render(renderer, writeBuffer, readBuffer, delta) {\n\n if (this.uniforms[this.textureID]) {\n\n this.uniforms[this.textureID].value = readBuffer;\n }\n\n this.quad.material = this.material;\n\n if (this.renderToScreen) {\n\n renderer.render(this.scene, this.camera);\n } else {\n\n renderer.render(this.scene, this.camera, writeBuffer, this.clear);\n }\n }\n\n};\n\nexports.default = _three2.default.ShaderPass;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/webgl/deps/post-process/ShaderPass.js\n ** module id = 157\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/webgl/deps/post-process/ShaderPass.js?')},function(module,exports,__webpack_require__){eval('"use strict";\n\nObject.defineProperty(exports, "__esModule", {\n value: true\n});\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/**\n * @author alteredq / http://alteredqualia.com/\n *\n * Vignette shader\n * based on PaintEffect postprocess from ro.me\n * http://code.google.com/p/3-dreams-of-black/source/browse/deploy/js/effects/PaintEffect.js\n */\n\n_three2.default.VignetteShader = {\n\n uniforms: {\n\n "tDiffuse": { type: "t", value: null },\n "offset": { type: "f", value: 1.0 },\n "darkness": { type: "f", value: 1.0 }\n\n },\n\n vertexShader: ["varying vec2 vUv;", "void main() {", "vUv = uv;", "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", "}"].join("\\n"),\n\n fragmentShader: ["uniform float offset;", "uniform float darkness;", "uniform sampler2D tDiffuse;", "varying vec2 vUv;", "void main() {",\n\n // Eskil\'s vignette\n\n "vec4 texel = texture2D( tDiffuse, vUv );", "vec2 uv = ( vUv - vec2( 0.5 ) ) * vec2( offset );", "gl_FragColor = vec4( mix( texel.rgb, vec3( 1.0 - darkness ), dot( uv, uv ) ), texel.a );",\n\n /*\n // alternative version from glfx.js\n // this one makes more "dusty" look (as opposed to "burned")\n "vec4 color = texture2D( tDiffuse, vUv );",\n "float dist = distance( vUv, vec2( 0.5 ) );",\n "color.rgb *= smoothstep( 0.8, offset * 0.799, dist *( darkness + offset ) );",\n "gl_FragColor = color;",\n */\n\n "}"].join("\\n")\n\n};\n\nexports.default = _three2.default.VignetteShader;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/webgl/deps/post-process/vignetteShader.js\n ** module id = 158\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/webgl/deps/post-process/vignetteShader.js?')},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = intent;\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nvar _pointers = __webpack_require__(74);\n\nvar _sizing = __webpack_require__(75);\n\nvar _obsUtils = __webpack_require__(5);\n\nvar _utils = __webpack_require__(69);\n\nvar _utils2 = __webpack_require__(3);\n\nvar _Selector = __webpack_require__(68);\n\nvar _ramda = __webpack_require__(4);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar _Rx$Observable = _rx2.default.Observable;\nvar fromEvent = _Rx$Observable.fromEvent;\nvar merge = _Rx$Observable.merge;\n\n\n// get original data + picking infos\nfunction addPickingInfos(inStream$, containerResizes$, camera, scene) {\n return inStream$.withLatestFrom(containerResizes$, function (event, clientRect) {\n if (event) {\n var input = document.querySelector('.container'); // canvas\n var _clientRect = input.getBoundingClientRect();\n\n var data = {\n pos: {\n x: event.clientX,\n y: event.clientY },\n rect: _clientRect,\n width: _clientRect.width,\n height: _clientRect.height,\n event: event };\n var mouseCoords = (0, _Selector.getCoordsFromPosSizeRect)(data);\n return (0, _utils.selectionAt)(event, mouseCoords, camera, scene.children);\n } else {\n return {};\n }\n });\n}\n\n// extract the object & position from a pickingInfo data\nfunction objectAndPosition(pickingInfo) {\n return { object: pickingInfo.object, point: pickingInfo.point };\n}\n\nfunction intent(sources, data) {\n var DOM = sources.DOM;\n var camera = data.camera;\n var scene = data.scene;\n var transformControls = data.transformControls;\n var props$ = data.props$;\n var settings$ = data.settings$;\n\n\n var windowResizes$ = (0, _sizing.windowResizes)(1); // get from intents/interactions ?\n var elementResizes$ = (0, _sizing.elementResizes)('.container', 1);\n\n var _pointerInteractions = (0, _pointers.pointerInteractions)((0, _pointers.interactionsFromCEvents)(DOM));\n\n var shortSingleTaps$ = _pointerInteractions.shortSingleTaps$;\n var shortDoubleTaps$ = _pointerInteractions.shortDoubleTaps$;\n var longTaps$ = _pointerInteractions.longTaps$;\n var zooms$ = _pointerInteractions.zooms$;\n var dragMoves$ = _pointerInteractions.dragMoves$;\n\n // FIXME : needs to be done in a more coherent, reusable way\n // shut down \"wobble effect if ANY user interaction takes place\"\n\n var userAction$ = merge(shortSingleTaps$, shortDoubleTaps$, longTaps$, zooms$, dragMoves$); // .subscribe(e=>wobble.stop())\n\n // Prevent contextmenu for all of the gl canvas FIXME: side effect ?\n DOM.select('canvas').events('contextmenu').subscribe(function (e) {\n return (0, _obsUtils.preventDefault)(e);\n });\n\n // stream of container resize events\n var containerResizes$ = windowResizes$.map(function () {\n var input = document.querySelector('.container'); // canvas\n if (input) return input.getBoundingClientRect();\n }).filter(_obsUtils.exists).startWith({ width: window.innerWidth, height: window.innerHeight, aspect: window.innerWidth / window.innerHeight, bRect: undefined });\n\n // are the transform controls active : ie we are dragging, rotating, scaling an object\n var tControlsActive$ = merge(fromEvent(transformControls, 'mouseDown').map(true), fromEvent(transformControls, 'mouseUp').map(false)).startWith(false);\n // .tap(e=>console.log( \"transform controls active\",e ))\n\n var shortSingleTapsWPicking$ = addPickingInfos(shortSingleTaps$, windowResizes$, camera, scene).shareReplay(1);\n var shortDoubleTapsWPicking$ = addPickingInfos(shortDoubleTaps$, windowResizes$, camera, scene).shareReplay(1);\n var longTapsWPicking$ = addPickingInfos(longTaps$, windowResizes$, camera, scene).withLatestFrom(tControlsActive$, function (longTaps, tCActive) {\n // disable long taps in case we are manipulating an object\n if (tCActive) return undefined;\n return longTaps;\n }).filter(_obsUtils.exists).shareReplay(1);\n\n // contextmenu observable should return undifined when any other basic interaction\n // took place (to cancel displaying context menu , etc)\n /* longTapsWPicking$ = longTapsWPicking$\n .merge(\n shortSingleTapsWPicking$.map(undefined),\n shortDoubleTapsWPicking$.map(undefined),\n dragMoves$.map(undefined)\n )*/\n\n // zoom action intent\n var zoomInOnPoint$ = shortDoubleTapsWPicking$.map(function (e) {\n return e.detail.pickingInfos.shift();\n }).filter(_obsUtils.exists).map(objectAndPosition).tap(function (e) {\n return console.log('zoomInOnPoint');\n });\n\n var zoomToFit$ = _rx2.default.Observable.just(true); // DOM.select('#zoomToFit').events(\"click\")\n\n // Stream of selected meshes\n var selectMeshes$ = merge(shortSingleTapsWPicking$.map(_utils.meshFrom), longTapsWPicking$.map(_utils.meshFrom)).map(_utils2.toArray) // important !! consumers expect arrays\n // .distinctUntilChanged()\n .shareReplay(1);\n\n // if transformControls are active\n // filter out dragMove gestures: ie prevent camera from moving/rotating\n var fDragMoves$ = dragMoves$.withLatestFrom(tControlsActive$, function (dragMoves, tCActive) {\n if (tCActive) return undefined;\n return dragMoves;\n }).filter(_obsUtils.exists);\n\n // actual stream used for camera controls: dragMove gestures + zoom gestures\n var filteredInteractions$ = { dragMoves$: fDragMoves$, zooms$: zooms$ };\n\n var selections$ = props$.pluck('selections').startWith([]).filter(_obsUtils.exists).distinctUntilChanged().map(function (x) {\n return x.map(function (y) {\n return y.id;\n });\n }); // we just need the ids\n var transforms$ = props$.pluck('meshes'); //.withLatestFrom(selections$,function(transforms, selections))\n var activeTool$ = settings$.pluck('activeTool').startWith(undefined).distinctUntilChanged();\n\n // stream of transformations done on the current selection\n var selectionsTransforms$ = fromEvent(transformControls, 'objectChange')\n //.tap(e=>console.log('sdfsdf',e))\n .map(_utils.targetObject).withLatestFrom(selections$, activeTool$, transforms$, function (t, selections, activeTool, _transforms) {\n var transform = { 'translate': 'pos', 'rotate': 'rot', 'scale': 'sca' }[activeTool];\n\n /*FIXME: horrid, we have to deal with transforms on the meshes (horrors of OOP & mutability)\n //FIXME: also we need to do this whole thing since only ONE object is actually transformed\n by transformcontrols, so we first compute the average of all mesh positions, then we get the\n position of the updated position, do a difference between the avg & modified one, and add it to the changed value\n HORRIBLY Convoluted, but will not be the case anymore with regl/functional opengl/webgl\n */\n function valueMap(mesh, transform) {\n var mapper = {\n pos: mesh.position.toArray().slice(0, 3),\n rot: mesh.rotation.toArray().slice(0, 3),\n sca: mesh.scale.toArray().slice(0, 3).map(function (val, index) {\n return mesh.flipped && mesh.flipped[index] === 1 ? val * -1 : val;\n }) //to handle negative scaling/mirrored data, as the transformControls always return values >0\n };\n return mapper[transform];\n }\n\n //FIXME : only needed if data storage is a hash\n _transforms = selections.map(function (input) {\n return _transforms[input];\n }) // get only needed ones\n .map(function (mesh) {\n var res = {};\n res[transform] = valueMap(mesh, transform);\n return res;\n });\n\n var avg = (0, _ramda.pluck)(transform)(_transforms).reduce(function (acc, cur) {\n if (!acc) return cur;\n return [acc[0] + cur[0], acc[1] + cur[1], acc[2] + cur[2]].map(function (x) {\n return x * 0.5;\n });\n }, undefined);\n\n var tranformedValue = valueMap(t, transform);\n var diff = [avg[0] - tranformedValue[0], avg[1] - tranformedValue[1], avg[2] - tranformedValue[2]];\n var value = [diff[0] + tranformedValue[0], diff[1] + tranformedValue[1], diff[2] + tranformedValue[2]];\n\n //const realValue =\n return { value: value, trans: transform, ids: selections };\n }).map(function (data) {\n // format data so that we have an array of changes, by id\n var value = data.value;\n var trans = data.trans;\n var ids = data.ids;\n\n return ids.map(function (id) {\n return { value: value, trans: trans, id: id };\n });\n });\n\n return {\n userAction$: userAction$,\n zoomInOnPoint$: zoomInOnPoint$,\n zoomToFit$: zoomToFit$,\n selectMeshes$: selectMeshes$,\n shortSingleTapsWPicking$: shortSingleTapsWPicking$,\n shortDoubleTapsWPicking$: shortDoubleTapsWPicking$,\n longTapsWPicking$: longTapsWPicking$,\n filteredInteractions$: filteredInteractions$,\n selectionsTransforms$: selectionsTransforms$ };\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/webgl/intent.js\n ** module id = 159\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/webgl/intent.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol ? \"symbol\" : typeof obj; };\n\nexports.default = model;\n\nvar _obsUtils = __webpack_require__(5);\n\nvar _ramda = __webpack_require__(4);\n\nvar _visualMakers = __webpack_require__(164);\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n// let requestAnimationFrameScheduler = Rx.Scheduler.requestAnimationFrame\n// problem : this fires BEFORE the rest is ready\n// activeTool$.skip(1).filter(isTransformTool).subscribe(transformControls.setMode)\n\nfunction setFlags(mesh) {\n mesh.selectable = true;\n mesh.selectTrickleUp = false;\n mesh.transformable = true;\n // FIXME: not sure, these are very specific for visuals\n mesh.castShadow = true;\n return mesh;\n}\n\nfunction makeRemoteMeshVisual(meta, transform, mesh) {\n if (meta && transform && mesh) {\n var _ret = function () {\n\n // this is for mirroring\n\n var isOdd = function isOdd(num) {\n return num % 2;\n };\n\n var handleMirroring = function handleMirroring() {\n var flipped = mesh.flipped || [0, 0, 0];\n var mS = new _three2.default.Matrix4().identity();\n var conv = [0, 5, 10];\n\n transform.sca.map(function (val) {\n return val < 0;\n }).forEach(function (val, index) {\n if (val && flipped[index] === 0) {\n mS.elements[conv[index]] = -1;\n flipped[index] = 1;\n }\n // flip back\n if (!val && flipped[index] === 1) {\n mS.elements[conv[index]] = -1;\n flipped[index] = 0;\n }\n });\n mesh.geometry.applyMatrix(mS);\n mesh.flipped = flipped;\n var inversions = flipped.reduce(function (prev, curr) {\n return prev + curr;\n });\n mesh.material.side = isOdd(inversions) ? _three2.default.BackSide : 0;\n };\n\n // only apply changes to mesh IF the current transform is different ?\n // console.log(\"transforms\",transform)\n if (!(0, _ramda.equals)(mesh.position.toArray(), transform.pos)) {\n mesh.position.fromArray(transform.pos);\n }\n if (!(0, _ramda.equals)(mesh.rotation.toArray(), transform.rot)) {\n mesh.rotation.fromArray(transform.rot);\n }\n if (!(0, _ramda.equals)(mesh.scale.toArray(), transform.sca)) {\n mesh.scale.fromArray(transform.sca.map(Math.abs));\n }\n // color is stored in meta component\n mesh.material.color.set(meta.color);\n handleMirroring();\n\n return {\n v: setFlags(mesh)\n };\n }();\n\n if ((typeof _ret === 'undefined' ? 'undefined' : _typeof(_ret)) === \"object\") return _ret.v;\n }\n}\n\nfunction getVisual(components) {\n var meta = components.meta; // {components}\n\n var keys = Object.keys(meta);\n var metas = meta;\n\n return keys.map(function (key) {\n var meta = metas[key];\n var transform = components.transforms[key];\n var mesh = components.meshes[key];\n\n // TODO: refactor this horror\n if (meta.typeUid === 'A1') {\n // typeUid:\"A1\"=> notes\n return (0, _visualMakers.makeNoteVisual)(meta, components.meshes);\n } else if (meta.typeUid === 'A2') {\n return (0, _visualMakers.makeThicknessVisual)(meta, components.meshes);\n } else if (meta.typeUid === 'A3') {\n return (0, _visualMakers.makeDiameterVisual)(meta, components.meshes);\n } else if (meta.typeUid === 'A4') {\n return (0, _visualMakers.makeDistanceVisual)(meta, components.meshes);\n } else if (meta.typeUid === 'A5') {\n return (0, _visualMakers.makeAngleVisual)(meta, components.meshes);\n } else {\n return makeRemoteMeshVisual(meta, transform, mesh);\n }\n }).filter(function (m) {\n return m !== undefined;\n });\n}\n\nfunction model(props$, actions) {\n var settings$ = props$.pluck('settings');\n var selections$ = props$.pluck('selections').startWith([]).filter(_obsUtils.exists).distinctUntilChanged();\n var activeTool$ = settings$.pluck('activeTool').startWith(undefined);\n // every time either activeTool or selection changes, reset/update transform controls\n\n // composite data\n var meta$ = props$.pluck('meta').distinctUntilChanged();\n var transforms$ = props$.pluck('transforms'); // .distinctUntilChanged()\n var meshes$ = props$.pluck('meshes').filter(_obsUtils.exists).distinctUntilChanged(function (m) {\n return Object.keys(m);\n });\n // this is for any NON composite data , so pure mesh /visuals withouth any metadata, transformsetc\n var rawVisuals$ = props$.pluck('rawVisuals').startWith(undefined).distinctUntilChanged().tap(function (e) {\n return console.log('rawVisuals', e);\n });\n\n // FIXME: items is emiting WAAY too much values, look into why it does so\n // combine All needed components to apply any \"transforms\" to their visuals\n var items0$ = (0, _obsUtils.combineLatestObj)({ meta$: meta$, transforms$: transforms$, meshes$: meshes$ }).debounce(1) // ignore if we have too fast changes in any of the 3 components\n // .distinctUntilChanged()\n .map(getVisual)\n // .sample(0, requestAnimationFrameScheduler)\n // .distinctUntilChanged()\n // .tap(e => console.log('DONE with items in GLView', e))\n .combineLatest(rawVisuals$, function (composites, raw) {\n // console.log('composites', composites,'raw',raw)\n return composites;\n }).filter(_obsUtils.exists).tap(function (e) {\n return console.log('items', e);\n }).shareReplay(1);\n\n var items$ = props$.debounce(1).map(function (props) {\n var meta = props.meta;\n var transforms = props.transforms;\n var meshes = props.meshes;\n var visual = getVisual({ meta: meta, transforms: transforms, meshes: meshes });\n return visual.concat(props.rawVisuals);\n }).startWith(undefined).filter(_obsUtils.exists)\n // .tap(e => console.log('items2', e))\n .shareReplay(1);\n\n // \"external\" selected meshes\n var selectedMeshesFromSelections$ = selections$.withLatestFrom(meshes$, function (selections, meshes) {\n return selections.filter(_obsUtils.exists).map(function (s) {\n return meshes[s.id];\n });\n }).distinctUntilChanged().startWith([]).shareReplay(1);\n\n var selectedMeshes$ = actions.selectMeshes$ // these are only selections made WITHIN the GL view\n .merge(selectedMeshesFromSelections$)\n // this limits \"selectability\" to transforms & default\n .withLatestFrom(activeTool$, function (meshes, tool) {\n var idx = ['translate', 'rotate', 'scale', undefined].indexOf(tool);\n var result = idx > -1 ? meshes : [];\n\n return result;\n }).distinctUntilChanged().startWith([]);\n\n var focusedMeshesFromFocusedEntities$ = props$.pluck('focusedEntities').startWith([]).filter(_obsUtils.exists).distinctUntilChanged().withLatestFrom(meshes$, function (selections, meshes) {\n return selections.filter(_obsUtils.exists).map(function (id) {\n return meshes[id];\n });\n }).merge(actions.selectMeshes$.filter(function (sm) {\n return sm.length === 0;\n })) //we want to be able to reset selections to nothing\n .tap(function (e) {\n return console.log('selections in glView', e);\n }).distinctUntilChanged().startWith([]);\n\n return (0, _obsUtils.combineLatestObj)({\n items$: items$,\n selectedMeshes$: selectedMeshes$,\n selectedMeshesFromSelections$: selectedMeshesFromSelections$,\n focusedMeshesFromFocusedEntities$: focusedMeshesFromFocusedEntities$\n });\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/webgl/model.js\n ** module id = 160\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/webgl/model.js?"); +},function(module,exports){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nvar presets = exports.presets = {\n renderer: {\n shadowMapEnabled: true,\n shadowMapAutoUpdate: true,\n shadowMapSoft: true,\n shadowMapType: undefined, // THREE.PCFSoftShadowMap,//THREE.PCFSoftShadowMap,//PCFShadowMap\n autoUpdateScene: true, // Default ?\n physicallyBasedShading: false, // Default ?\n autoClear: true, // Default ?\n gammaInput: false,\n gammaOutput: false\n },\n cameras: [{\n name: 'mainCamera',\n pos: [75, 75, 145], // [100,-100,100]\n up: [0, 0, 1],\n lens: {\n fov: 45,\n near: 0.1,\n far: 20000\n }\n }],\n controls: [{\n up: [0, 0, 1],\n rotateSpeed: 0.7,\n panSpeed: 2.0,\n zoomSpeed: 2.0,\n autoRotate: {\n enabled: false,\n speed: 0.2\n },\n _enabled: true,\n _active: true\n }],\n scenes: {\n 'main': [\n // { type:\"hemisphereLight\", color:\"#FFFF33\", gndColor:\"#FF9480\", pos:[0, 0, 500], intensity:0.6 },\n { type: 'hemisphereLight', color: '#FFEEEE', gndColor: '#FFFFEE', pos: [0, 1200, 1500], intensity: 0.8 }, { type: 'ambientLight', color: '#0x252525', intensity: 0.03 }, { type: 'directionalLight', color: '#262525', intensity: 0.2, pos: [150, 150, 1500], castShadow: true, onlyShadow: true }\n // { type:\"directionalLight\", color:\"#FFFFFF\", intensity:0.2 , pos:[150,150,1500], castShadow:true, onlyShadow:true}\n ],\n 'helpers': [{ type: 'LabeledGrid' }]\n }\n};\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/webgl/presets.js\n ** module id = 161\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/webgl/presets.js?")},function(module,exports,__webpack_require__){eval('"use strict";\n\nObject.defineProperty(exports, "__esModule", {\n value: true\n});\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar GizmoMaterial = function GizmoMaterial(parameters) {\n\n _three2.default.MeshBasicMaterial.call(this);\n\n this.depthTest = false;\n this.depthWrite = false;\n this.side = _three2.default.FrontSide;\n this.transparent = true;\n\n this.setValues(parameters);\n\n this.oldColor = this.color.clone();\n this.oldOpacity = this.opacity;\n\n this.highlight = function (highlighted) {\n\n if (highlighted) {\n\n this.color.setRGB(1, 1, 0);\n this.opacity = 1;\n } else {\n\n this.color.copy(this.oldColor);\n this.opacity = this.oldOpacity;\n }\n };\n}; /**\n * @author arodic / https://github.com/arodic\n */\n/*jshint sub:true*/\n\n\nGizmoMaterial.prototype = Object.create(_three2.default.MeshBasicMaterial.prototype);\n\nvar GizmoLineMaterial = function GizmoLineMaterial(parameters) {\n\n _three2.default.LineBasicMaterial.call(this);\n\n this.depthTest = false;\n this.depthWrite = false;\n this.transparent = true;\n this.linewidth = 1;\n\n this.setValues(parameters);\n\n this.oldColor = this.color.clone();\n this.oldOpacity = this.opacity;\n\n this.highlight = function (highlighted) {\n\n if (highlighted) {\n\n this.color.setRGB(1, 1, 0);\n this.opacity = 1;\n } else {\n\n this.color.copy(this.oldColor);\n this.opacity = this.oldOpacity;\n }\n };\n};\n\nGizmoLineMaterial.prototype = Object.create(_three2.default.LineBasicMaterial.prototype);\n\n_three2.default.TransformGizmo = function () {\n\n var scope = this;\n var showPickers = false; //debug\n var showActivePlane = false; //debug\n\n this.init = function () {\n\n _three2.default.Object3D.call(this);\n\n this.handles = new _three2.default.Object3D();\n this.pickers = new _three2.default.Object3D();\n this.planes = new _three2.default.Object3D();\n\n this.add(this.handles);\n this.add(this.pickers);\n this.add(this.planes);\n\n //// PLANES\n\n var planeGeometry = new _three2.default.PlaneGeometry(50, 50, 2, 2);\n var planeMaterial = new _three2.default.MeshBasicMaterial({ wireframe: true });\n planeMaterial.side = _three2.default.DoubleSide;\n\n var planes = {\n "XY": new _three2.default.Mesh(planeGeometry, planeMaterial),\n "YZ": new _three2.default.Mesh(planeGeometry, planeMaterial),\n "XZ": new _three2.default.Mesh(planeGeometry, planeMaterial),\n "XYZE": new _three2.default.Mesh(planeGeometry, planeMaterial)\n };\n\n this.activePlane = planes["XYZE"];\n\n planes["YZ"].rotation.set(0, Math.PI / 2, 0);\n planes["XZ"].rotation.set(-Math.PI / 2, 0, 0);\n\n for (var i in planes) {\n planes[i].name = i;\n this.planes.add(planes[i]);\n this.planes[i] = planes[i];\n planes[i].visible = false;\n }\n\n //// HANDLES AND PICKERS\n\n var setupGizmos = function setupGizmos(gizmoMap, parent) {\n\n for (var name in gizmoMap) {\n\n for (i = gizmoMap[name].length; i--;) {\n\n var object = gizmoMap[name][i][0];\n var position = gizmoMap[name][i][1];\n var rotation = gizmoMap[name][i][2];\n\n object.name = name;\n\n if (position) object.position.set(position[0], position[1], position[2]);\n if (rotation) object.rotation.set(rotation[0], rotation[1], rotation[2]);\n\n parent.add(object);\n }\n }\n };\n\n setupGizmos(this.handleGizmos, this.handles);\n setupGizmos(this.pickerGizmos, this.pickers);\n\n // reset Transformations\n\n this.traverse(function (child) {\n if (child instanceof _three2.default.Mesh) {\n child.updateMatrix();\n\n var tempGeometry = new _three2.default.Geometry();\n tempGeometry.merge(child.geometry, child.matrix);\n\n child.geometry = tempGeometry;\n child.position.set(0, 0, 0);\n child.rotation.set(0, 0, 0);\n child.scale.set(1, 1, 1);\n }\n });\n };\n\n this.hide = function () {\n this.traverse(function (child) {\n child.visible = false;\n });\n };\n\n this.show = function () {\n this.traverse(function (child) {\n child.visible = true;\n if (child.parent == scope.pickers) child.visible = showPickers;\n if (child.parent == scope.planes) child.visible = false;\n });\n this.activePlane.visible = showActivePlane;\n };\n\n this.highlight = function (axis) {\n this.traverse(function (child) {\n if (child.material && child.material.highlight) {\n if (child.name == axis) {\n child.material.highlight(true);\n } else {\n child.material.highlight(false);\n }\n }\n });\n };\n};\n\n_three2.default.TransformGizmo.prototype = Object.create(_three2.default.Object3D.prototype);\n\n_three2.default.TransformGizmo.prototype.update = function (rotation, eye) {\n\n var vec1 = new _three2.default.Vector3(0, 0, 0);\n var vec2 = new _three2.default.Vector3(0, 1, 0);\n var lookAtMatrix = new _three2.default.Matrix4();\n\n this.traverse(function (child) {\n if (child.name.search("E") != -1) {\n child.quaternion.setFromRotationMatrix(lookAtMatrix.lookAt(eye, vec1, vec2));\n } else if (child.name.search("X") != -1 || child.name.search("Y") != -1 || child.name.search("Z") != -1) {\n child.quaternion.setFromEuler(rotation);\n }\n });\n};\n\n_three2.default.TransformGizmoTranslate = function () {\n\n _three2.default.TransformGizmo.call(this);\n\n var arrowGeometry = new _three2.default.Geometry();\n var mesh = new _three2.default.Mesh(new _three2.default.CylinderGeometry(0, 0.05, 0.2, 12, 1, false));\n mesh.position.y = 0.5;\n mesh.updateMatrix();\n\n arrowGeometry.merge(mesh.geometry, mesh.matrix);\n\n var lineXGeometry = new _three2.default.Geometry();\n lineXGeometry.vertices.push(new _three2.default.Vector3(0, 0, 0), new _three2.default.Vector3(1, 0, 0));\n\n var lineYGeometry = new _three2.default.Geometry();\n lineYGeometry.vertices.push(new _three2.default.Vector3(0, 0, 0), new _three2.default.Vector3(0, 1, 0));\n\n var lineZGeometry = new _three2.default.Geometry();\n lineZGeometry.vertices.push(new _three2.default.Vector3(0, 0, 0), new _three2.default.Vector3(0, 0, 1));\n\n this.handleGizmos = {\n X: [[new _three2.default.Mesh(arrowGeometry, new GizmoMaterial({ color: 0xff0000 })), [0.5, 0, 0], [0, 0, -Math.PI / 2]], [new _three2.default.Line(lineXGeometry, new GizmoLineMaterial({ color: 0xff0000 }))]],\n Y: [[new _three2.default.Mesh(arrowGeometry, new GizmoMaterial({ color: 0x00ff00 })), [0, 0.5, 0]], [new _three2.default.Line(lineYGeometry, new GizmoLineMaterial({ color: 0x00ff00 }))]],\n Z: [[new _three2.default.Mesh(arrowGeometry, new GizmoMaterial({ color: 0x0000ff })), [0, 0, 0.5], [Math.PI / 2, 0, 0]], [new _three2.default.Line(lineZGeometry, new GizmoLineMaterial({ color: 0x0000ff }))]],\n XYZ: [[new _three2.default.Mesh(new _three2.default.OctahedronGeometry(0.1, 0), new GizmoMaterial({ color: 0xffffff, opacity: 0.25 })), [0, 0, 0], [0, 0, 0]]],\n XY: [[new _three2.default.Mesh(new _three2.default.PlaneGeometry(0.29, 0.29), new GizmoMaterial({ color: 0xffff00, opacity: 0.25 })), [0.15, 0.15, 0]]],\n YZ: [[new _three2.default.Mesh(new _three2.default.PlaneGeometry(0.29, 0.29), new GizmoMaterial({ color: 0x00ffff, opacity: 0.25 })), [0, 0.15, 0.15], [0, Math.PI / 2, 0]]],\n XZ: [[new _three2.default.Mesh(new _three2.default.PlaneGeometry(0.29, 0.29), new GizmoMaterial({ color: 0xff00ff, opacity: 0.25 })), [0.15, 0, 0.15], [-Math.PI / 2, 0, 0]]]\n };\n\n this.pickerGizmos = {\n X: [[new _three2.default.Mesh(new _three2.default.CylinderGeometry(0.2, 0, 1, 4, 1, false), new GizmoMaterial({ color: 0xff0000, opacity: 0.25 })), [0.6, 0, 0], [0, 0, -Math.PI / 2]]],\n Y: [[new _three2.default.Mesh(new _three2.default.CylinderGeometry(0.2, 0, 1, 4, 1, false), new GizmoMaterial({ color: 0x00ff00, opacity: 0.25 })), [0, 0.6, 0]]],\n Z: [[new _three2.default.Mesh(new _three2.default.CylinderGeometry(0.2, 0, 1, 4, 1, false), new GizmoMaterial({ color: 0x0000ff, opacity: 0.25 })), [0, 0, 0.6], [Math.PI / 2, 0, 0]]],\n XYZ: [[new _three2.default.Mesh(new _three2.default.OctahedronGeometry(0.2, 0), new GizmoMaterial({ color: 0xffffff, opacity: 0.25 }))]],\n XY: [[new _three2.default.Mesh(new _three2.default.PlaneGeometry(0.4, 0.4), new GizmoMaterial({ color: 0xffff00, opacity: 0.25 })), [0.2, 0.2, 0]]],\n YZ: [[new _three2.default.Mesh(new _three2.default.PlaneGeometry(0.4, 0.4), new GizmoMaterial({ color: 0x00ffff, opacity: 0.25 })), [0, 0.2, 0.2], [0, Math.PI / 2, 0]]],\n XZ: [[new _three2.default.Mesh(new _three2.default.PlaneGeometry(0.4, 0.4), new GizmoMaterial({ color: 0xff00ff, opacity: 0.25 })), [0.2, 0, 0.2], [-Math.PI / 2, 0, 0]]]\n };\n\n this.setActivePlane = function (axis, eye) {\n\n var tempMatrix = new _three2.default.Matrix4();\n eye.applyMatrix4(tempMatrix.getInverse(tempMatrix.extractRotation(this.planes["XY"].matrixWorld)));\n\n if (axis == "X") {\n this.activePlane = this.planes["XY"];\n if (Math.abs(eye.y) > Math.abs(eye.z)) this.activePlane = this.planes["XZ"];\n }\n\n if (axis == "Y") {\n this.activePlane = this.planes["XY"];\n if (Math.abs(eye.x) > Math.abs(eye.z)) this.activePlane = this.planes["YZ"];\n }\n\n if (axis == "Z") {\n this.activePlane = this.planes["XZ"];\n if (Math.abs(eye.x) > Math.abs(eye.y)) this.activePlane = this.planes["YZ"];\n }\n\n if (axis == "XYZ") this.activePlane = this.planes["XYZE"];\n\n if (axis == "XY") this.activePlane = this.planes["XY"];\n\n if (axis == "YZ") this.activePlane = this.planes["YZ"];\n\n if (axis == "XZ") this.activePlane = this.planes["XZ"];\n\n this.hide();\n this.show();\n };\n\n this.init();\n};\n\n_three2.default.TransformGizmoTranslate.prototype = Object.create(_three2.default.TransformGizmo.prototype);\n\n_three2.default.TransformGizmoRotate = function () {\n\n _three2.default.TransformGizmo.call(this);\n\n var CircleGeometry = function CircleGeometry(radius, facing, arc) {\n\n var geometry = new _three2.default.Geometry();\n arc = arc ? arc : 1;\n for (var i = 0; i <= 64 * arc; ++i) {\n if (facing == \'x\') geometry.vertices.push(new _three2.default.Vector3(0, Math.cos(i / 32 * Math.PI), Math.sin(i / 32 * Math.PI)).multiplyScalar(radius));\n if (facing == \'y\') geometry.vertices.push(new _three2.default.Vector3(Math.cos(i / 32 * Math.PI), 0, Math.sin(i / 32 * Math.PI)).multiplyScalar(radius));\n if (facing == \'z\') geometry.vertices.push(new _three2.default.Vector3(Math.sin(i / 32 * Math.PI), Math.cos(i / 32 * Math.PI), 0).multiplyScalar(radius));\n }\n\n return geometry;\n };\n\n this.handleGizmos = {\n X: [[new _three2.default.Line(new CircleGeometry(1, \'x\', 0.5), new GizmoLineMaterial({ color: 0xff0000 }))]],\n Y: [[new _three2.default.Line(new CircleGeometry(1, \'y\', 0.5), new GizmoLineMaterial({ color: 0x00ff00 }))]],\n Z: [[new _three2.default.Line(new CircleGeometry(1, \'z\', 0.5), new GizmoLineMaterial({ color: 0x0000ff }))]],\n E: [[new _three2.default.Line(new CircleGeometry(1.25, \'z\', 1), new GizmoLineMaterial({ color: 0xcccc00 }))]],\n XYZE: [[new _three2.default.Line(new CircleGeometry(1, \'z\', 1), new GizmoLineMaterial({ color: 0x787878 }))]]\n };\n\n this.pickerGizmos = {\n X: [[new _three2.default.Mesh(new _three2.default.TorusGeometry(1, 0.12, 4, 12, Math.PI), new GizmoMaterial({ color: 0xff0000, opacity: 0.25 })), [0, 0, 0], [0, -Math.PI / 2, -Math.PI / 2]]],\n Y: [[new _three2.default.Mesh(new _three2.default.TorusGeometry(1, 0.12, 4, 12, Math.PI), new GizmoMaterial({ color: 0x00ff00, opacity: 0.25 })), [0, 0, 0], [Math.PI / 2, 0, 0]]],\n Z: [[new _three2.default.Mesh(new _three2.default.TorusGeometry(1, 0.12, 4, 12, Math.PI), new GizmoMaterial({ color: 0x0000ff, opacity: 0.25 })), [0, 0, 0], [0, 0, -Math.PI / 2]]],\n E: [[new _three2.default.Mesh(new _three2.default.TorusGeometry(1.25, 0.12, 2, 24), new GizmoMaterial({ color: 0xffff00, opacity: 0.25 }))]],\n XYZE: [[new _three2.default.Mesh(new _three2.default.Geometry())] // TODO\n ]\n };\n\n this.setActivePlane = function (axis) {\n\n if (axis == "E") this.activePlane = this.planes["XYZE"];\n\n if (axis == "X") this.activePlane = this.planes["YZ"];\n\n if (axis == "Y") this.activePlane = this.planes["XZ"];\n\n if (axis == "Z") this.activePlane = this.planes["XY"];\n\n this.hide();\n this.show();\n };\n\n this.update = function (rotation, eye2) {\n\n _three2.default.TransformGizmo.prototype.update.apply(this, arguments);\n\n var group = {\n handles: this["handles"],\n pickers: this["pickers"]\n };\n\n var tempMatrix = new _three2.default.Matrix4();\n var worldRotation = new _three2.default.Euler(0, 0, 1);\n var tempQuaternion = new _three2.default.Quaternion();\n var unitX = new _three2.default.Vector3(1, 0, 0);\n var unitY = new _three2.default.Vector3(0, 1, 0);\n var unitZ = new _three2.default.Vector3(0, 0, 1);\n var quaternionX = new _three2.default.Quaternion();\n var quaternionY = new _three2.default.Quaternion();\n var quaternionZ = new _three2.default.Quaternion();\n var eye = eye2.clone();\n\n worldRotation.copy(this.planes["XY"].rotation);\n tempQuaternion.setFromEuler(worldRotation);\n\n tempMatrix.makeRotationFromQuaternion(tempQuaternion).getInverse(tempMatrix);\n eye.applyMatrix4(tempMatrix);\n\n this.traverse(function (child) {\n\n tempQuaternion.setFromEuler(worldRotation);\n\n if (child.name == "X") {\n quaternionX.setFromAxisAngle(unitX, Math.atan2(-eye.y, eye.z));\n tempQuaternion.multiplyQuaternions(tempQuaternion, quaternionX);\n child.quaternion.copy(tempQuaternion);\n }\n\n if (child.name == "Y") {\n quaternionY.setFromAxisAngle(unitY, Math.atan2(eye.x, eye.z));\n tempQuaternion.multiplyQuaternions(tempQuaternion, quaternionY);\n child.quaternion.copy(tempQuaternion);\n }\n\n if (child.name == "Z") {\n quaternionZ.setFromAxisAngle(unitZ, Math.atan2(eye.y, eye.x));\n tempQuaternion.multiplyQuaternions(tempQuaternion, quaternionZ);\n child.quaternion.copy(tempQuaternion);\n }\n });\n };\n\n this.init();\n};\n\n_three2.default.TransformGizmoRotate.prototype = Object.create(_three2.default.TransformGizmo.prototype);\n\n_three2.default.TransformGizmoScale = function () {\n\n _three2.default.TransformGizmo.call(this);\n\n var arrowGeometry = new _three2.default.Geometry();\n var mesh = new _three2.default.Mesh(new _three2.default.BoxGeometry(0.125, 0.125, 0.125));\n mesh.position.y = 0.5;\n mesh.updateMatrix();\n\n arrowGeometry.merge(mesh.geometry, mesh.matrix);\n\n var lineXGeometry = new _three2.default.Geometry();\n lineXGeometry.vertices.push(new _three2.default.Vector3(0, 0, 0), new _three2.default.Vector3(1, 0, 0));\n\n var lineYGeometry = new _three2.default.Geometry();\n lineYGeometry.vertices.push(new _three2.default.Vector3(0, 0, 0), new _three2.default.Vector3(0, 1, 0));\n\n var lineZGeometry = new _three2.default.Geometry();\n lineZGeometry.vertices.push(new _three2.default.Vector3(0, 0, 0), new _three2.default.Vector3(0, 0, 1));\n\n this.handleGizmos = {\n X: [[new _three2.default.Mesh(arrowGeometry, new GizmoMaterial({ color: 0xff0000 })), [0.5, 0, 0], [0, 0, -Math.PI / 2]], [new _three2.default.Line(lineXGeometry, new GizmoLineMaterial({ color: 0xff0000 }))]],\n Y: [[new _three2.default.Mesh(arrowGeometry, new GizmoMaterial({ color: 0x00ff00 })), [0, 0.5, 0]], [new _three2.default.Line(lineYGeometry, new GizmoLineMaterial({ color: 0x00ff00 }))]],\n Z: [[new _three2.default.Mesh(arrowGeometry, new GizmoMaterial({ color: 0x0000ff })), [0, 0, 0.5], [Math.PI / 2, 0, 0]], [new _three2.default.Line(lineZGeometry, new GizmoLineMaterial({ color: 0x0000ff }))]],\n XYZ: [[new _three2.default.Mesh(new _three2.default.BoxGeometry(0.125, 0.125, 0.125), new GizmoMaterial({ color: 0xffffff, opacity: 0.25 }))]]\n };\n\n this.pickerGizmos = {\n X: [[new _three2.default.Mesh(new _three2.default.CylinderGeometry(0.2, 0, 1, 4, 1, false), new GizmoMaterial({ color: 0xff0000, opacity: 0.25 })), [0.6, 0, 0], [0, 0, -Math.PI / 2]]],\n Y: [[new _three2.default.Mesh(new _three2.default.CylinderGeometry(0.2, 0, 1, 4, 1, false), new GizmoMaterial({ color: 0x00ff00, opacity: 0.25 })), [0, 0.6, 0]]],\n Z: [[new _three2.default.Mesh(new _three2.default.CylinderGeometry(0.2, 0, 1, 4, 1, false), new GizmoMaterial({ color: 0x0000ff, opacity: 0.25 })), [0, 0, 0.6], [Math.PI / 2, 0, 0]]],\n XYZ: [[new _three2.default.Mesh(new _three2.default.BoxGeometry(0.4, 0.4, 0.4), new GizmoMaterial({ color: 0xffffff, opacity: 0.25 }))]]\n };\n\n this.setActivePlane = function (axis, eye) {\n\n var tempMatrix = new _three2.default.Matrix4();\n eye.applyMatrix4(tempMatrix.getInverse(tempMatrix.extractRotation(this.planes["XY"].matrixWorld)));\n\n if (axis == "X") {\n this.activePlane = this.planes["XY"];\n if (Math.abs(eye.y) > Math.abs(eye.z)) this.activePlane = this.planes["XZ"];\n }\n\n if (axis == "Y") {\n this.activePlane = this.planes["XY"];\n if (Math.abs(eye.x) > Math.abs(eye.z)) this.activePlane = this.planes["YZ"];\n }\n\n if (axis == "Z") {\n this.activePlane = this.planes["XZ"];\n if (Math.abs(eye.x) > Math.abs(eye.y)) this.activePlane = this.planes["YZ"];\n }\n\n if (axis == "XYZ") this.activePlane = this.planes["XYZE"];\n\n this.hide();\n this.show();\n };\n\n this.init();\n};\n\n_three2.default.TransformGizmoScale.prototype = Object.create(_three2.default.TransformGizmo.prototype);\n\nvar TransformControls = function TransformControls(camera, domElement) {\n\n // TODO: Make non-uniform scale and rotate play nice in hierarchies\n // TODO: ADD RXYZ contol\n\n _three2.default.Object3D.call(this);\n\n //domElement = ( domElement !== undefined ) ? domElement : document;\n //console.log("attaching TransformControls to",domElement);\n\n this.gizmo = {};\n this.gizmo["translate"] = new _three2.default.TransformGizmoTranslate();\n this.gizmo["rotate"] = new _three2.default.TransformGizmoRotate();\n this.gizmo["scale"] = new _three2.default.TransformGizmoScale();\n\n this.add(this.gizmo["translate"]);\n this.add(this.gizmo["rotate"]);\n this.add(this.gizmo["scale"]);\n\n this.gizmo["translate"].hide();\n this.gizmo["rotate"].hide();\n this.gizmo["scale"].hide();\n\n this.object = undefined;\n this.snap = null;\n this.space = "world";\n this.size = 1;\n this.axis = null;\n\n this.enabled = true;\n\n var scope = this;\n\n var _dragging = false;\n var _mode = "translate";\n var _plane = "XY";\n\n var changeEvent = { type: "change" };\n var mouseDownEvent = { type: "mouseDown" };\n var mouseUpEvent = { type: "mouseUp", mode: _mode };\n var objectChangeEvent = { type: "objectChange" };\n\n var ray = new _three2.default.Raycaster();\n var pointerVector = new _three2.default.Vector3();\n\n var point = new _three2.default.Vector3();\n var offset = new _three2.default.Vector3();\n\n var rotation = new _three2.default.Vector3();\n var offsetRotation = new _three2.default.Vector3();\n var scale = 1;\n\n var lookAtMatrix = new _three2.default.Matrix4();\n var eye = new _three2.default.Vector3();\n\n var tempMatrix = new _three2.default.Matrix4();\n var tempVector = new _three2.default.Vector3();\n var tempQuaternion = new _three2.default.Quaternion();\n var unitX = new _three2.default.Vector3(1, 0, 0);\n var unitY = new _three2.default.Vector3(0, 1, 0);\n var unitZ = new _three2.default.Vector3(0, 0, 1);\n\n var quaternionXYZ = new _three2.default.Quaternion();\n var quaternionX = new _three2.default.Quaternion();\n var quaternionY = new _three2.default.Quaternion();\n var quaternionZ = new _three2.default.Quaternion();\n var quaternionE = new _three2.default.Quaternion();\n\n var oldPosition = new _three2.default.Vector3();\n var oldScale = new _three2.default.Vector3();\n var oldRotationMatrix = new _three2.default.Matrix4();\n\n var parentRotationMatrix = new _three2.default.Matrix4();\n var parentScale = new _three2.default.Vector3();\n\n var worldPosition = new _three2.default.Vector3();\n var worldRotation = new _three2.default.Euler();\n var worldRotationMatrix = new _three2.default.Matrix4();\n var camPosition = new _three2.default.Vector3();\n var camRotation = new _three2.default.Euler();\n\n /*domElement.addEventListener( "mousedown", onPointerDown, false );\n domElement.addEventListener( "touchstart", onPointerDown, false );\n domElement.addEventListener( "mousemove", onPointerHover, false );\n domElement.addEventListener( "touchmove", onPointerHover, false );\n domElement.addEventListener( "mousemove", onPointerMove, false );\n domElement.addEventListener( "touchmove", onPointerMove, false );\n domElement.addEventListener( "mouseup", onPointerUp, true );\n domElement.addEventListener( "mouseout", onPointerUp, true );\n domElement.addEventListener( "touchend", onPointerUp, true );\n domElement.addEventListener( "touchcancel", onPointerUp, true );\n domElement.addEventListener( "touchleave", onPointerUp, true );*/\n\n this.setDomElement = function (domElement) {\n scope.domElement = domElement !== undefined ? domElement : document;\n\n domElement.addEventListener("mousedown", onPointerDown, false);\n domElement.addEventListener("touchstart", onPointerDown, false);\n\n domElement.addEventListener("mousemove", onPointerHover, false);\n domElement.addEventListener("touchmove", onPointerHover, false);\n\n domElement.addEventListener("mousemove", onPointerMove, false);\n domElement.addEventListener("touchmove", onPointerMove, false);\n\n domElement.addEventListener("mouseup", onPointerUp, true);\n domElement.addEventListener("mouseout", onPointerUp, true);\n domElement.addEventListener("touchend", onPointerUp, true);\n domElement.addEventListener("touchcancel", onPointerUp, true);\n domElement.addEventListener("touchleave", onPointerUp, true);\n };\n\n this.setObservables = function (observables) {\n console.log("setting observables");\n var dragMoves$ = observables.dragMoves$;\n var zooms$ = observables.zooms$;\n };\n\n this.attach = function (object) {\n scope.object = object;\n\n this.gizmo["translate"].hide();\n this.gizmo["rotate"].hide();\n this.gizmo["scale"].hide();\n this.gizmo[_mode].show();\n\n scope.update();\n };\n\n this.detach = function (object) {\n scope.object = undefined;\n this.axis = null;\n\n this.gizmo["translate"].hide();\n this.gizmo["rotate"].hide();\n this.gizmo["scale"].hide();\n };\n\n this.setMode = function (mode) {\n\n _mode = mode ? mode : _mode;\n //_mode = mode\n\n if (_mode == "scale") scope.space = "local";\n\n this.gizmo["translate"].hide();\n this.gizmo["rotate"].hide();\n this.gizmo["scale"].hide();\n //if(_mode)\n this.gizmo[_mode].show();\n\n this.update();\n scope.dispatchEvent(changeEvent);\n };\n\n this.setSnap = function (snap) {\n\n scope.snap = snap;\n };\n\n this.setSize = function (size) {\n\n scope.size = size;\n this.update();\n scope.dispatchEvent(changeEvent);\n };\n\n this.setSpace = function (space) {\n\n scope.space = space;\n this.update();\n scope.dispatchEvent(changeEvent);\n };\n\n this.update = function () {\n\n if (scope.object === undefined) return;\n if (!scope.enabled) return;\n\n scope.object.updateMatrixWorld();\n worldPosition.setFromMatrixPosition(scope.object.matrixWorld);\n worldRotation.setFromRotationMatrix(tempMatrix.extractRotation(scope.object.matrixWorld));\n\n camera.updateMatrixWorld();\n camPosition.setFromMatrixPosition(camera.matrixWorld);\n camRotation.setFromRotationMatrix(tempMatrix.extractRotation(camera.matrixWorld));\n\n scale = worldPosition.distanceTo(camPosition) / 6 * scope.size;\n this.position.copy(worldPosition);\n this.scale.set(scale, scale, scale);\n\n eye.copy(camPosition).sub(worldPosition).normalize();\n\n if (scope.space == "local") this.gizmo[_mode].update(worldRotation, eye);else if (scope.space == "world") this.gizmo[_mode].update(new _three2.default.Euler(), eye);\n\n this.gizmo[_mode].highlight(scope.axis);\n };\n\n function onPointerHover(event) {\n // console.log("pointer move in Transform controls");\n if (scope.object === undefined || _dragging === true) return;\n\n event.preventDefault();\n\n var pointer = event.changedTouches ? event.changedTouches[0] : event;\n\n var intersect = intersectObjects(pointer, scope.gizmo[_mode].pickers.children);\n\n var axis = null;\n\n if (intersect) {\n\n axis = intersect.object.name;\n }\n\n if (scope.axis !== axis) {\n\n scope.axis = axis;\n scope.update();\n scope.dispatchEvent(changeEvent);\n }\n }\n\n function onPointerDown(event) {\n //console.log("pointer down in Transform controls");\n if (scope.object === undefined || _dragging === true) return;\n\n event.preventDefault();\n //event.stopPropagation();\n\n var pointer = event.changedTouches ? event.changedTouches[0] : event;\n\n //console.log("pointer",pointer.button)\n\n if (pointer.button === 0 || pointer.button === 2 || pointer.button === undefined) {\n\n var intersect = intersectObjects(pointer, scope.gizmo[_mode].pickers.children);\n\n if (intersect) {\n\n //console.log("intersected")\n scope.dispatchEvent(mouseDownEvent);\n\n scope.axis = intersect.object.name;\n\n scope.update();\n\n eye.copy(camPosition).sub(worldPosition).normalize();\n\n scope.gizmo[_mode].setActivePlane(scope.axis, eye);\n\n var planeIntersect = intersectObjects(pointer, [scope.gizmo[_mode].activePlane]);\n\n oldPosition.copy(scope.object.position);\n oldScale.copy(scope.object.scale);\n\n oldRotationMatrix.extractRotation(scope.object.matrix);\n worldRotationMatrix.extractRotation(scope.object.matrixWorld);\n\n parentRotationMatrix.extractRotation(scope.object.parent.matrixWorld);\n parentScale.setFromMatrixScale(tempMatrix.getInverse(scope.object.parent.matrixWorld));\n\n offset.copy(planeIntersect.point);\n }\n }\n\n _dragging = true;\n }\n\n function onPointerMove(event) {\n\n if (scope.object === undefined || scope.axis === null || _dragging === false) return;\n\n event.preventDefault();\n //event.stopPropagation();\n\n var pointer = event.changedTouches ? event.changedTouches[0] : event;\n\n var planeIntersect = intersectObjects(pointer, [scope.gizmo[_mode].activePlane]);\n\n point.copy(planeIntersect.point);\n\n if (_mode == "translate") {\n\n point.sub(offset);\n point.multiply(parentScale);\n\n if (scope.space == "local") {\n\n point.applyMatrix4(tempMatrix.getInverse(worldRotationMatrix));\n\n if (scope.axis.search("X") == -1) point.x = 0;\n if (scope.axis.search("Y") == -1) point.y = 0;\n if (scope.axis.search("Z") == -1) point.z = 0;\n\n point.applyMatrix4(oldRotationMatrix);\n\n scope.object.position.copy(oldPosition);\n scope.object.position.add(point);\n }\n\n if (scope.space == "world" || scope.axis.search("XYZ") != -1) {\n\n if (scope.axis.search("X") == -1) point.x = 0;\n if (scope.axis.search("Y") == -1) point.y = 0;\n if (scope.axis.search("Z") == -1) point.z = 0;\n\n point.applyMatrix4(tempMatrix.getInverse(parentRotationMatrix));\n\n scope.object.position.copy(oldPosition);\n scope.object.position.add(point);\n }\n\n if (scope.snap !== null) {\n\n if (scope.axis.search("X") != -1) scope.object.position.x = Math.round(scope.object.position.x / scope.snap) * scope.snap;\n if (scope.axis.search("Y") != -1) scope.object.position.y = Math.round(scope.object.position.y / scope.snap) * scope.snap;\n if (scope.axis.search("Z") != -1) scope.object.position.z = Math.round(scope.object.position.z / scope.snap) * scope.snap;\n }\n } else if (_mode == "scale") {\n\n point.sub(offset);\n point.multiply(parentScale);\n\n if (scope.space == "local") {\n\n if (scope.axis == "XYZ") {\n\n scale = 1 + point.y / 50;\n\n scope.object.scale.x = oldScale.x * scale;\n scope.object.scale.y = oldScale.y * scale;\n scope.object.scale.z = oldScale.z * scale;\n } else {\n\n point.applyMatrix4(tempMatrix.getInverse(worldRotationMatrix));\n\n if (scope.axis == "X") scope.object.scale.x = oldScale.x * (1 + point.x / 50);\n if (scope.axis == "Y") scope.object.scale.y = oldScale.y * (1 + point.y / 50);\n if (scope.axis == "Z") scope.object.scale.z = oldScale.z * (1 + point.z / 50);\n }\n }\n } else if (_mode == "rotate") {\n\n point.sub(worldPosition);\n point.multiply(parentScale);\n tempVector.copy(offset).sub(worldPosition);\n tempVector.multiply(parentScale);\n\n if (scope.axis == "E") {\n\n point.applyMatrix4(tempMatrix.getInverse(lookAtMatrix));\n tempVector.applyMatrix4(tempMatrix.getInverse(lookAtMatrix));\n\n rotation.set(Math.atan2(point.z, point.y), Math.atan2(point.x, point.z), Math.atan2(point.y, point.x));\n offsetRotation.set(Math.atan2(tempVector.z, tempVector.y), Math.atan2(tempVector.x, tempVector.z), Math.atan2(tempVector.y, tempVector.x));\n\n tempQuaternion.setFromRotationMatrix(tempMatrix.getInverse(parentRotationMatrix));\n\n quaternionE.setFromAxisAngle(eye, rotation.z - offsetRotation.z);\n quaternionXYZ.setFromRotationMatrix(worldRotationMatrix);\n\n tempQuaternion.multiplyQuaternions(tempQuaternion, quaternionE);\n tempQuaternion.multiplyQuaternions(tempQuaternion, quaternionXYZ);\n\n scope.object.quaternion.copy(tempQuaternion);\n } else if (scope.axis == "XYZE") {\n\n quaternionE.setFromEuler(point.clone().cross(tempVector).normalize()); // rotation axis\n\n tempQuaternion.setFromRotationMatrix(tempMatrix.getInverse(parentRotationMatrix));\n quaternionX.setFromAxisAngle(quaternionE, -point.clone().angleTo(tempVector));\n quaternionXYZ.setFromRotationMatrix(worldRotationMatrix);\n\n tempQuaternion.multiplyQuaternions(tempQuaternion, quaternionX);\n tempQuaternion.multiplyQuaternions(tempQuaternion, quaternionXYZ);\n\n scope.object.quaternion.copy(tempQuaternion);\n } else if (scope.space == "local") {\n\n point.applyMatrix4(tempMatrix.getInverse(worldRotationMatrix));\n\n tempVector.applyMatrix4(tempMatrix.getInverse(worldRotationMatrix));\n\n rotation.set(Math.atan2(point.z, point.y), Math.atan2(point.x, point.z), Math.atan2(point.y, point.x));\n offsetRotation.set(Math.atan2(tempVector.z, tempVector.y), Math.atan2(tempVector.x, tempVector.z), Math.atan2(tempVector.y, tempVector.x));\n\n quaternionXYZ.setFromRotationMatrix(oldRotationMatrix);\n quaternionX.setFromAxisAngle(unitX, rotation.x - offsetRotation.x);\n quaternionY.setFromAxisAngle(unitY, rotation.y - offsetRotation.y);\n quaternionZ.setFromAxisAngle(unitZ, rotation.z - offsetRotation.z);\n\n if (scope.axis == "X") quaternionXYZ.multiplyQuaternions(quaternionXYZ, quaternionX);\n if (scope.axis == "Y") quaternionXYZ.multiplyQuaternions(quaternionXYZ, quaternionY);\n if (scope.axis == "Z") quaternionXYZ.multiplyQuaternions(quaternionXYZ, quaternionZ);\n\n scope.object.quaternion.copy(quaternionXYZ);\n } else if (scope.space == "world") {\n\n rotation.set(Math.atan2(point.z, point.y), Math.atan2(point.x, point.z), Math.atan2(point.y, point.x));\n offsetRotation.set(Math.atan2(tempVector.z, tempVector.y), Math.atan2(tempVector.x, tempVector.z), Math.atan2(tempVector.y, tempVector.x));\n\n tempQuaternion.setFromRotationMatrix(tempMatrix.getInverse(parentRotationMatrix));\n\n quaternionX.setFromAxisAngle(unitX, rotation.x - offsetRotation.x);\n quaternionY.setFromAxisAngle(unitY, rotation.y - offsetRotation.y);\n quaternionZ.setFromAxisAngle(unitZ, rotation.z - offsetRotation.z);\n quaternionXYZ.setFromRotationMatrix(worldRotationMatrix);\n\n if (scope.axis == "X") tempQuaternion.multiplyQuaternions(tempQuaternion, quaternionX);\n if (scope.axis == "Y") tempQuaternion.multiplyQuaternions(tempQuaternion, quaternionY);\n if (scope.axis == "Z") tempQuaternion.multiplyQuaternions(tempQuaternion, quaternionZ);\n\n tempQuaternion.multiplyQuaternions(tempQuaternion, quaternionXYZ);\n\n scope.object.quaternion.copy(tempQuaternion);\n }\n }\n\n scope.update();\n scope.dispatchEvent(changeEvent);\n scope.dispatchEvent(objectChangeEvent);\n }\n\n function onPointerUp(event) {\n //console.log("pointer up in transform controls");\n if (_dragging && scope.axis !== null) {\n mouseUpEvent.mode = _mode;\n scope.dispatchEvent(mouseUpEvent);\n /*event.preventDefault();\n event.stopPropagation();\n event.stopImmediatePropagation();*/\n }\n _dragging = false;\n onPointerHover(event);\n }\n\n function intersectObjects(pointer, objects) {\n\n var rect = scope.domElement.getBoundingClientRect();\n var x = (pointer.clientX - rect.left) / rect.width;\n var y = (pointer.clientY - rect.top) / rect.height;\n\n pointerVector.set(x * 2 - 1, -(y * 2) + 1, 0.5);\n pointerVector.unproject(camera);\n\n ray.set(camPosition, pointerVector.sub(camPosition).normalize());\n\n var intersections = ray.intersectObjects(objects, true);\n return intersections[0] ? intersections[0] : false;\n }\n};\n\nTransformControls.prototype = Object.create(_three2.default.Object3D.prototype);\n\nexports.default = TransformControls;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/webgl/transforms/TransformControls.js\n ** module id = 162\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/webgl/transforms/TransformControls.js?'); },function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.getEntryExitThickness = getEntryExitThickness;\nexports.getObjectPointNormal = getObjectPointNormal;\nexports.getDistanceFromStartEnd = getDistanceFromStartEnd;\nexports.computeCenterDiaNormalFromThreePoints = computeCenterDiaNormalFromThreePoints;\nexports.computeAngleFromThreePoints = computeAngleFromThreePoints;\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction getEntryExitThickness(entryInteresect) {\n var normalType = arguments.length <= 1 || arguments[1] === undefined ? 'face' : arguments[1];\n\n var normal = entryInteresect.face.normal.clone();\n switch (normalType) {\n case 'face':\n break;\n case 'x':\n normal = new _three2.default.Vector3(1, 0, 0);\n break;\n case 'y':\n normal = new _three2.default.Vector3(0, 1, 0);\n break;\n case 'z':\n normal = new _three2.default.Vector3(0, 0, 1);\n break;\n }\n\n var object = entryInteresect.object;\n if (!object) return undefined;\n\n var entryPoint = entryInteresect.point.clone();\n var flippedNormal = normal.clone().negate();\n var offsetPoint = entryPoint.clone().add(flippedNormal.clone().multiplyScalar(10000));\n\n // get escape entryPoint\n var raycaster = new _three2.default.Raycaster(offsetPoint, normal.clone().normalize());\n var intersects = raycaster.intersectObjects([object], true);\n\n var exitPoint = null;\n var minDist = Infinity;\n\n intersects.map(function (entry) {\n var curPt = entry.point;\n var curLn = curPt.clone().sub(entryPoint).length();\n\n if (curLn < minDist) {\n exitPoint = curPt;\n minDist = curLn;\n }\n });\n\n // FIXME: todo or not ??\n object.worldToLocal(entryPoint);\n\n object.worldToLocal(exitPoint);\n\n // compute actual thickness\n var endToStart = exitPoint.clone().sub(entryPoint);\n var thickness = endToStart.length();\n\n return { object: object, entryPoint: entryPoint, exitPoint: exitPoint, thickness: thickness };\n}\n\nfunction getObjectPointNormal(pickingInfos) {\n var point = pickingInfos.point; // closest point\n var object = pickingInfos.object; // closest point\n var face = pickingInfos.face; // closest face\n var normal = face.normal;\n\n // set point coordinates to be local , not global\n // FIXME: are we sure about this?\n object.worldToLocal(point);\n\n return { object: object, point: point, normal: normal };\n}\n\nfunction getDistanceFromStartEnd(start, end) {\n var endToStart = end.clone().sub(start);\n var distance = endToStart.length();\n return distance;\n}\n\n// compute center , dia/radius from three 3d points\nfunction computeCenterDiaNormalFromThreePoints(pointA, pointB, pointC) {\n var plane = new _three2.default.Plane().setFromCoplanarPoints(pointA, pointB, pointC);\n var center = new _three2.default.Vector3();\n\n // see http://en.wikipedia.org/wiki/Circumscribed_circle\n // triangle \"edges\"\n var t = pointA.clone().sub(pointB);\n var u = pointB.clone().sub(pointC);\n var v = pointC.clone().sub(pointA);\n var m = pointA.clone().sub(pointC);\n var x = pointB.clone().sub(pointA);\n var z = pointC.clone().sub(pointB);\n\n var foo = t.clone().cross(u).length();\n var bar = 2 * foo;\n var baz = foo * foo;\n var buu = 2 * baz;\n\n var radius = t.length() * u.length() * v.length() / bar;\n\n var alpha = u.lengthSq() * t.clone().dot(m) / buu;\n var beta = m.lengthSq() * x.clone().dot(u) / buu;\n var gamma = t.lengthSq() * v.clone().dot(z) / buu;\n\n center = pointA.clone().multiplyScalar(alpha).add(pointB.clone().multiplyScalar(beta)).add(pointC.clone().multiplyScalar(gamma));\n\n var diameter = radius * 2;\n var normal = plane.normal;\n\n return { center: center, diameter: diameter, normal: normal };\n}\n\nfunction computeAngleFromThreePoints(pointA, pointB, pointC) {\n var v1 = pointA.clone().sub(pointB);\n var v2 = pointC.clone().sub(pointB);\n var angle = v1.angleTo(v2);\n return angle;\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/webgl/utils.js\n ** module id = 163\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/webgl/utils.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"]) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); } }; }();\n// const annotations = helpers.annotations\n// faster object.assign\n\n\nexports.makeNoteVisual = makeNoteVisual;\nexports.makeDistanceVisual = makeDistanceVisual;\nexports.makeThicknessVisual = makeThicknessVisual;\nexports.makeDiameterVisual = makeDiameterVisual;\nexports.makeAngleVisual = makeAngleVisual;\n\nvar _glViewHelpers = __webpack_require__(60);\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nvar _assign = __webpack_require__(7);\n\nvar _assign2 = _interopRequireDefault(_assign);\n\nvar _modelUtils = __webpack_require__(6);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar annotStyle = {\n crossColor: '#000',\n textColor: '#000',\n lineColor: '#000',\n arrowColor: '#000',\n lineWidth: 2.2,\n highlightColor: '#60C4F8', // \"#00F\",\n fontFace: 'Open Sans'\n};\n\nfunction resolveMeshes(deps, meshes) {\n return deps.map(function (dep) {\n return meshes[dep];\n }).filter(function (x) {\n return x !== undefined;\n });\n}\n\nfunction addMetaData(meta, visual) {\n visual.userData.entity = { id: meta.id };\n // special attributes\n visual.pickable = true;\n return visual;\n}\n\nfunction combineData(meta, deps, meshes, makeVisual) {\n var depMeshes = resolveMeshes(deps, meshes);\n var visual = makeVisual(depMeshes);\n return addMetaData(meta, visual);\n}\n\n// actual visual makers\n\nfunction makeNoteVisual(meta, meshes) {\n console.log('makeNoteVisual', meta, meshes);\n var point = meta.target.point;\n var deps = [meta.target.id];\n\n function makeVisual(_ref) {\n var _ref2 = _slicedToArray(_ref, 1);\n\n var object = _ref2[0];\n\n // mesh.updateMatrix()\n // mesh.updateMatrixWorld()\n var pt = new _three2.default.Vector3().fromArray(point); // .add(mesh.position)\n pt = object.localToWorld(pt);\n\n var params = {\n point: pt,\n object: object\n };\n params = (0, _modelUtils.mergeData)(params, annotStyle);\n\n return new _glViewHelpers.annotations.NoteVisual(params);\n }\n\n return combineData(meta, deps, meshes, makeVisual);\n}\n\nfunction makeDistanceVisual(meta, meshes) {\n var start = meta.target.start;\n var end = meta.target.end;\n\n var deps = [start.id, end.id];\n\n function makeVisual(_ref3) {\n var _ref4 = _slicedToArray(_ref3, 2);\n\n var startMesh = _ref4[0];\n var endMesh = _ref4[1];\n\n var startPt = new _three2.default.Vector3().fromArray(start.point);\n var endPt = new _three2.default.Vector3().fromArray(end.point);\n startMesh.localToWorld(startPt);\n endMesh.localToWorld(endPt);\n // startMesh.worldToLocal(startPt)\n // endMesh.worldToLocal(endPt)\n\n var params = {\n start: startPt,\n startObject: startMesh,\n end: endPt,\n endObject: endMesh\n };\n params = (0, _modelUtils.mergeData)(params, annotStyle);\n\n return new _glViewHelpers.annotations.DistanceVisual(params);\n }\n\n return combineData(meta, deps, meshes, makeVisual);\n}\n\nfunction makeThicknessVisual(meta, meshes) {\n var deps = [meta.target.id];\n var entryPoint = meta.target.entryPoint;\n var exitPoint = meta.target.exitPoint;\n\n function makeVisual(_ref5) {\n var _ref6 = _slicedToArray(_ref5, 1);\n\n var object = _ref6[0];\n\n entryPoint = new _three2.default.Vector3().fromArray(entryPoint);\n exitPoint = new _three2.default.Vector3().fromArray(exitPoint);\n entryPoint = object.localToWorld(entryPoint);\n exitPoint = object.localToWorld(exitPoint);\n\n var params = {\n entryPoint: entryPoint,\n exitPoint: exitPoint,\n object: object\n };\n params = (0, _modelUtils.mergeData)(params, annotStyle);\n return new _glViewHelpers.annotations.ThicknessVisual(params);\n }\n\n return combineData(meta, deps, meshes, makeVisual);\n}\n\nfunction makeDiameterVisual(meta, meshes) {\n var point = meta.target.point;\n var normal = meta.target.normal;\n var diameter = meta.value;\n var deps = [meta.target.id];\n\n function makeVisual(_ref7) {\n var _ref8 = _slicedToArray(_ref7, 1);\n\n var mesh = _ref8[0];\n\n point = new _three2.default.Vector3().fromArray(point);\n normal = new _three2.default.Vector3().fromArray(normal);\n // mesh.updateMatrix()\n // mesh.updateMatrixWorld()\n point = mesh.localToWorld(point);\n\n var params = {\n center: point,\n diameter: diameter,\n orientation: normal\n };\n params = (0, _assign2.default)(params, annotStyle);\n\n return new _glViewHelpers.annotations.DiameterVisual(params);\n }\n\n return combineData(meta, deps, meshes, makeVisual);\n}\n\nfunction makeAngleVisual(meta, meshes) {\n var start = meta.target.start;\n var mid = meta.target.mid;\n var end = meta.target.end;\n var angle = meta.value;\n\n var deps = [start, mid, end].map(function (d) {\n return d.id;\n });\n\n function makeVisual(_ref9) {\n var _ref10 = _slicedToArray(_ref9, 3);\n\n var startObject = _ref10[0];\n var midObject = _ref10[1];\n var endObject = _ref10[2];\n\n var startPt = new _three2.default.Vector3().fromArray(start.point);\n var midPt = new _three2.default.Vector3().fromArray(mid.point);\n var endPt = new _three2.default.Vector3().fromArray(end.point);\n\n var params = {\n start: startPt,\n mid: midPt,\n end: endPt,\n startObject: startObject,\n midObject: midObject,\n endObject: endObject,\n angle: angle };\n params = (0, _assign2.default)(params, annotStyle);\n\n return new _glViewHelpers.annotations.AngleVisual(params);\n }\n\n return combineData(meta, deps, meshes, makeVisual);\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/components/webgl/visualMakers.js\n ** module id = 164\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/components/webgl/visualMakers.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = intents;\n\nvar _utils = __webpack_require__(3);\n\nfunction intents(postMessage) {\n var postMessage$ = postMessage.filter(_utils.exists).filter(function (p) {\n return p.hasOwnProperty('data');\n });\n\n var captureScreen$ = postMessage$.filter(function (p) {\n return p.data.hasOwnProperty('captureScreen');\n });\n /* .withLatestFrom(drivers.DOM.select(\".glView .container canvas\").observable,function(request,element){\n element = element[0]\n return {request,element}\n })*/\n\n // this one might need refactoring\n var getTransforms$ = postMessage$.filter(function (p) {\n return p.data.hasOwnProperty('getTransforms');\n });\n\n var getStatus$ = postMessage$.filter(function (p) {\n return p.data.hasOwnProperty('getStatus');\n });\n\n return {\n captureScreen$: captureScreen$,\n getTransforms$: getTransforms$,\n getStatus$: getStatus$\n };\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/api/actions/fromPostMessage.js\n ** module id = 165\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/api/actions/fromPostMessage.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = api;\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nvar _assign = __webpack_require__(7);\n\nvar _assign2 = _interopRequireDefault(_assign);\n\nvar _imgUtils = __webpack_require__(222);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar merge = _rx2.default.Observable.merge; // faster object.assign\n\nfunction api(actions, state$) {\n var transforms$ = actions.apiActions.getTransforms$.withLatestFrom(state$.pluck('transforms'), function (request, transforms) {\n // console.log(\"getTransforms\",request,transforms)\n var transformsList = Object.keys(transforms).reduce(function (acc, key) {\n var trs = (0, _assign2.default)({}, transforms[key], { id: key });\n var out = acc.concat([trs]);\n return out;\n }, []);\n return {\n request: request,\n response: transformsList,\n requestName: 'getTransforms'\n };\n });\n\n var status$ = actions.apiActions.getStatus$.withLatestFrom(state$.pluck('settings'), function (request, settings) {\n var response = {\n activeTool: settings.activeTool\n };\n return { request: request, response: response, requestName: 'getStatus' };\n });\n\n var screenCapture$ = actions.apiActions.captureScreen$.map(function (data) {\n var request = data.request;\n var element = data.element;\n\n var img = (0, _imgUtils.domElementToImage)(element);\n return { request: request, response: img, requestName: 'captureScreen' };\n });\n\n var apiOutputs$ = merge(transforms$, status$, screenCapture$);\n\n // for now stop gap solution\n // specific sinks, this requires us knowing the origin of the actions ...\n // ie TODO!!!\n var postMsg$ = apiOutputs$.map(function (data) {\n var request = data.request;\n var response = data.response;\n var requestName = data.requestName;\n\n return { target: request.source, message: response, targetOrigin: request.origin, requestName: requestName };\n });\n\n return { outputs$: apiOutputs$, postMsg$: postMsg$ };\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/api/api.js\n ** module id = 166\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/api/api.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = intents;\n\nvar _obsUtils = __webpack_require__(5);\n\nvar _fromPostMessage = __webpack_require__(165);\n\nvar _fromPostMessage2 = _interopRequireDefault(_fromPostMessage);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction intents(sources) {\n var actionsSources = [(0, _fromPostMessage2.default)(sources.postMessage)];\n return (0, _obsUtils.mergeActionsByName)(actionsSources);\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/api/intents.js\n ** module id = 167\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/api/intents.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = intent;\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nvar _utils = __webpack_require__(3);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar fromArray = _rx2.default.Observable.fromArray;\nfunction intent(addressbar, params) {\n var setAuthToken$ = addressbar.get('authToken').flatMap(fromArray).filter(_utils.exists);\n\n return {\n setAuthToken$: setAuthToken$\n };\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/auth/actions/fromAddressbar.js\n ** module id = 168\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/auth/actions/fromAddressbar.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = auth;\n\nvar _modelUtils = __webpack_require__(6);\n\nfunction setAuthToken(state, input) {\n var output = (0, _modelUtils.mergeData)(state, { token: input });\n return output;\n}\n\nfunction auth(actions, source) {\n // /defaults, what else ?\n var defaults = { token: undefined };\n\n var updateFns = { setAuthToken: setAuthToken };\n return (0, _modelUtils.makeModel)(defaults, updateFns, actions, source);\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/auth/auth.js\n ** module id = 169\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/auth/auth.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = intents;\n\nvar _obsUtils = __webpack_require__(5);\n\nvar _fromAddressbar = __webpack_require__(168);\n\nvar _fromAddressbar2 = _interopRequireDefault(_fromAddressbar);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction intents(sources) {\n var actionsSources = [(0, _fromAddressbar2.default)(sources.addressbar)];\n return (0, _obsUtils.mergeActionsByName)(actionsSources);\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/auth/intents.js\n ** module id = 170\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/auth/intents.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = intent;\n\nvar _utils = __webpack_require__(3);\n\nfunction intent(events, params) {\n var updateBomEntries$ = events.select('bom').events('editEntry$').map(_utils.toArray);\n\n var upsertBomEntries$ = events.select('bom').events('addEntry$')\n /* .map(function(data){//inject extra data\n return mergeData({},data,{id:generateUUID()})\n })*/\n .map(function (data) {\n return { id: data.id, data: data };\n }) // convert data structure to something the BOM model can deal with\n .map(_utils.toArray);\n\n /* const removeBomEntries$ = events\n .select('bom').events('removeEntry$')\n .map(toArray) */\n\n /*\n function hasClear(data){\n if(data && data.hasOwnProperty(\"clear\")) return true\n return false\n }\n const clearBomEntries$ = merge(\n drivers.DOM.select('.clearAll').events('click')\n , drivers.DOM.select('.reset').events('click')//DEBUG ONLY\n , drivers.postMessage\n .filter(hasClear)\n )*/\n\n return {\n updateBomEntries$: updateBomEntries$,\n upsertBomEntries$: upsertBomEntries$\n // ,removeBomEntries$\n };\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/bom/actions/fromEvents.js\n ** module id = 171\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/bom/actions/fromEvents.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = intent;\n\nvar _utils = __webpack_require__(3);\n\nvar _ramda = __webpack_require__(4);\n\nfunction intent(ym, params) {\n var bom$ = ym.data.filter(function (res) {\n return res.request.method === 'get' && res.request.type === 'ymLoad' && res.request.typeDetail === 'bom';\n }).mergeAll().pluck('response');\n\n var upsertBomEntries$ = bom$.map(function (data) {\n return data.map(function (entry) {\n var mapping = {\n 'part_uuid': 'id',\n 'part_version': 'version'\n };\n var typeMapping = {\n 'qty': parseFloat,\n 'phys_qty': parseFloat\n };\n var fieldNames = ['id', 'part_parameters', 'qty', 'phys_qty', 'unit', 'printable'];\n var data = (0, _ramda.pick)(fieldNames, (0, _utils.coerceTypes)(typeMapping, (0, _utils.remapJson)(mapping, entry)));\n // FIXME: coerceTypes should be doing this !!\n\n return { id: data.id, data: data };\n });\n });\n // .tap(e => console.log('upsertBomEntries (from ym)', e))\n\n return {\n upsertBomEntries$: upsertBomEntries$\n };\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/bom/actions/fromYm.js\n ** module id = 172\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/bom/actions/fromYm.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = bomIntent;\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nvar _modelUtils = __webpack_require__(6);\n\nvar _diffPatchUtils = __webpack_require__(76);\n\nvar _obsUtils = __webpack_require__(5);\n\nvar _fromEvents = __webpack_require__(171);\n\nvar _fromEvents2 = _interopRequireDefault(_fromEvents);\n\nvar _fromYm = __webpack_require__(172);\n\nvar _fromYm2 = _interopRequireDefault(_fromYm);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar merge = _rx2.default.Observable.merge;\nfunction bomIntent(sources, entityTypes$, metaActions, entityActions) {\n var typeChanges$ = (0, _diffPatchUtils.changesFromObservableArrays)(entityTypes$).share();\n\n // BOM\n var upsertBomEntries$ = typeChanges$.pluck('upserted') // \"a new type was added\"\n .filter(function (e) {\n return e.length > 0;\n }).tap(function (e) {\n return console.log('type added', e);\n }).map(function (typeDatas) {\n return typeDatas.filter(function (x) {\n return x.id !== undefined;\n }) // we can only deal with data with actual ids\n .map(function (_ref) {\n var id = _ref.id;\n var name = _ref.name;\n\n // const data = {id, name, qty:0, phys_qty:0, version:\"0.0.1\", unit:\"QA\", printable:true}\n var data = { id: id, name: name };\n return { id: id, data: data };\n });\n });\n\n var removeBomEntries$ = typeChanges$.pluck('removed').filter(function (e) {\n return e.length > 0;\n }).tap(function (e) {\n return console.log('type removed', e);\n }).map(function (typeDatas) {\n return typeDatas.map(function (_ref2) {\n var id = _ref2.id;\n\n return { id: id };\n });\n });\n\n var increaseBomEntries$ = metaActions.createComponents$\n // .filter(exists)\n .tap(function (e) {\n return console.log('increaseBomEntries(from createComponents)', e);\n }).map(function (data) {\n return data.filter(function (dat) {\n return dat.value.typeUid !== undefined;\n }).map(function (dat) {\n return { offset: 1, id: dat.value.typeUid };\n });\n }).merge(metaActions.duplicateComponents$.tap(function (e) {\n return console.log('increaseBomEntries (from duplicateComponents)', e);\n })\n // .filter(exists)\n .map(function (data) {\n return data.filter(function (dat) {\n return dat.typeUid !== undefined || dat.value.typeUid !== undefined;\n }).map(function (dat) {\n return { offset: 1, id: dat.typeUid };\n });\n }));\n\n var decreaseBomEntries$ = entityActions.deleteInstances$.tap(function (e) {\n return console.log('deleteInstances A1', e);\n }).map(function (data) {\n return data.filter(function (d) {\n return d.id !== undefined || d.typeUid !== undefined;\n }).map(function (dat) {\n return {\n offset: -1,\n id: dat.typeUid\n };\n });\n }).tap(function (e) {\n return console.log('decreaseBomEntries', e);\n });\n\n var updateBomEntriesCount$ = merge(increaseBomEntries$, decreaseBomEntries$);\n\n var clearBomEntries$ = merge(entityActions.clearDesign$);\n\n var settingActionSources = [(0, _fromEvents2.default)(sources.events), (0, _fromYm2.default)(sources.ym)];\n var extraActions = (0, _obsUtils.mergeActionsByName)(settingActionSources);\n\n var upsertBomEntriesAll$ = extraActions.upsertBomEntries$.merge(upsertBomEntries$);\n var updateBomEntries$ = extraActions.updateBomEntries$;\n var removeBomEntriesAll$ = removeBomEntries$; // extraActions.removeBomEntries$.merge(removeBomEntries$)\n\n var bomActions = (0, _modelUtils.mergeData)({\n // upsertBomEntries$,\n upsertBomEntries$: upsertBomEntriesAll$,\n updateBomEntriesCount$: updateBomEntriesCount$,\n updateBomEntries$: updateBomEntries$,\n clearBomEntries$: clearBomEntries$,\n removeBomEntries$: removeBomEntriesAll$\n });\n\n return bomActions;\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/bom/intents.js\n ** module id = 173\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/bom/intents.js?")},function(module,exports){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = intent;\nfunction intent(events, params) {\n var addComments$ = events.select('comments').events('addComment$');\n\n return {\n addComments$: addComments$\n };\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/comments/actions/fromEvents.js\n ** module id = 174\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/comments/actions/fromEvents.js?")},function(module,exports,__webpack_require__){eval('\'use strict\';\n\nObject.defineProperty(exports, "__esModule", {\n value: true\n});\n\nvar _log = __webpack_require__(77);\n\nvar _log2 = _interopRequireDefault(_log);\n\nvar _utils = __webpack_require__(3);\n\nvar _modelUtils = __webpack_require__(6);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar log = (0, _log2.default)(\'comments\');\nlog.setLevel(\'info\');\n\n// "comments" system\n// helper function to get data by key\n/*\nfunction bykey(key){\n return comments.data.filter(function(e){\n let equal = equals(e.key , key)\n return equal\n })\n}*/\n\nfunction addComments(state, input) {\n log.info(\'adding comments\', input);\n var newComments = (0, _utils.toArray)(input);\n\n var comments = state.data.concat(newComments.map(function (comment) {\n var _comment$target = comment.target;\n var id = _comment$target.id;\n var typeUid = _comment$target.typeUid;\n\n var text = comment.text;\n var author = \'jon doe\'; // FIXME: how to deal with authors ?\n\n var key = [id, typeUid];\n var entry = { text: text, author: author, key: key };\n return entry;\n }));\n var updatedState = {\n data: comments\n };\n return updatedState;\n}\n\nfunction comments(actions, source) {\n // /defaults, what else ?\n var defaults = {\n data: [\n /* {text:"bla bla details",author:"foo"},\n {text:"oh yes cool ",author:"bar"},*/\n ]\n };\n\n var updateFns = { addComments: addComments };\n return (0, _modelUtils.makeModel)(defaults, updateFns, actions, source, { doApplyTransform: true });\n}\n\nexports.default = comments;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/comments/comments.js\n ** module id = 175\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/comments/comments.js?')},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = intents;\n\nvar _obsUtils = __webpack_require__(5);\n\nvar _fromEvents = __webpack_require__(174);\n\nvar _fromEvents2 = _interopRequireDefault(_fromEvents);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction intents(sources) {\n var actionsSources = [(0, _fromEvents2.default)(sources.events)];\n return (0, _obsUtils.mergeActionsByName)(actionsSources);\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/comments/intents.js\n ** module id = 176\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/comments/intents.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = intent;\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nvar _utils = __webpack_require__(3);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar fromArray = _rx2.default.Observable.fromArray;\nfunction intent(addressbar, params) {\n var loadDesign$ = addressbar.get('designId').flatMap(fromArray).filter(_utils.exists);\n // .filter(isEmpty)\n\n var setAuthToken$ = addressbar.get('authToken');\n /*\n export function authToken(addressbar, params){\n return addressbar.get('authToken')\n //.tap(e=>console.log(\"authToken\",e))\n }*/\n\n return {\n loadDesign$: loadDesign$\n // ,setAuthToken$\n };\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/design/actions/fromAddressbar.js\n ** module id = 177\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/design/actions/fromAddressbar.js?")},function(module,exports){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = intent;\nfunction intent(DOM, params) {\n var clearDesign$ = DOM.select('.reset').events('click');\n\n return {\n clearDesign$: clearDesign$\n };\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/design/actions/fromDOM.js\n ** module id = 178\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/design/actions/fromDOM.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = intent;\n\nvar _utils = __webpack_require__(3);\n\nfunction intent(postMessage, params) {\n var postMessage$ = postMessage.filter(_utils.exists).filter(function (p) {\n return p.hasOwnProperty('data');\n });\n\n var loadDesign$ = postMessage$.filter(function (p) {\n return p.data.hasOwnProperty('designId');\n }).map(function (data) {\n return data.data.designId;\n });\n\n var clearDesign$ = postMessage$.filter(function (p) {\n return p.data.hasOwnProperty('clear');\n });\n\n return {\n loadDesign$: loadDesign$,\n clearDesign$: clearDesign$\n };\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/design/actions/fromPostMessage.js\n ** module id = 179\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/design/actions/fromPostMessage.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = design;\n\nvar _modelUtils = __webpack_require__(6);\n\nvar _assign = __webpack_require__(7);\n\nvar _assign2 = _interopRequireDefault(_assign);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n// faster object.assign\n\nvar defaults = {\n /* name : undefined\n ,description: undefined\n ,version : undefined//\"0.0.0\",\n ,authors : []\n ,tags : []\n ,licenses : []\n ,meta : undefined\n ,id : undefined\n ,uri : undefined*/\n\n id: undefined,\n ns: undefined,\n synched: false\n};\n\nfunction newDesign(state, input) {\n var design = (0, _assign2.default)({}, defaults);\n return design;\n}\n\nfunction updateDesign(state, input) {\n // log.info('setting design data', input)\n var design = (0, _assign2.default)({}, state, input);\n return design;\n}\n\nfunction loadDesign(state, input) {\n console.log('designInfos', input);\n return { synched: true, id: input, ns: 'ym' };\n}\n\nfunction clearDesign(state, input) {\n return defaults;\n}\n\nfunction design(actions, source) {\n console.log('design');\n var updateFns = { newDesign: newDesign, updateDesign: updateDesign, loadDesign: loadDesign, clearDesign: clearDesign };\n return (0, _modelUtils.makeModel)(defaults, updateFns, actions, source);\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/design/design.js\n ** module id = 180\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/design/design.js?"); },function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = intents;\n\nvar _obsUtils = __webpack_require__(5);\n\nvar _fromDOM = __webpack_require__(178);\n\nvar _fromDOM2 = _interopRequireDefault(_fromDOM);\n\nvar _fromAddressbar = __webpack_require__(177);\n\nvar _fromAddressbar2 = _interopRequireDefault(_fromAddressbar);\n\nvar _fromPostMessage = __webpack_require__(179);\n\nvar _fromPostMessage2 = _interopRequireDefault(_fromPostMessage);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction intents(sources) {\n var actionsSources = [(0, _fromDOM2.default)(sources.DOM), (0, _fromAddressbar2.default)(sources.addressbar), (0, _fromPostMessage2.default)(sources.postMessage)];\n return (0, _obsUtils.mergeActionsByName)(actionsSources);\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/design/intents.js\n ** module id = 181\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/design/intents.js?")},function(module,exports){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = intent;\nfunction intent(DOM, params) {\n // const clearDesign$= DOM.select('.reset').events(\"click\")\n var deleteInstances$ = DOM.select('.delete').events('click').map(undefined);\n var duplicateInstances$ = DOM.select('.duplicate').events('click');\n var mirrorInstances$ = DOM.select('.mirror-x').events('click').map(function (d) {\n return { axis: 0 };\n }).merge(DOM.select('.mirror-Y').events('click').map(function (d) {\n return { axis: 1 };\n })).merge(DOM.select('.mirror-Z').events('click').map(function (d) {\n return { axis: 2 };\n }));\n\n return {\n deleteInstances$: deleteInstances$,\n duplicateInstances$: duplicateInstances$,\n mirrorInstances$: mirrorInstances$\n };\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/entities/actions/fromDOM.js\n ** module id = 182\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/entities/actions/fromDOM.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = intent;\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nvar _otherUtils = __webpack_require__(47);\n\nvar _utils = __webpack_require__(3);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar merge = _rx2.default.Observable.merge;\nfunction intent(events, params) {\n // entities/components\n var updateMetaComponent$ = events.select('entityInfos').events('changeMeta$').map(function (c) {\n return { target: 'meta', data: c };\n });\n\n var updateTransformComponent$ = events.select('entityInfos').events('changeTransforms$').merge(events.select('gl').events('selectionsTransforms$').debounce(20)).map(function (c) {\n return { target: 'transforms', data: c };\n });\n\n var updateComponent$ = merge(updateMetaComponent$, updateTransformComponent$);\n\n var resetScaling$ = events.select('entityInfos').events('resetScaling$');\n\n // measurements & annotations\n var shortSingleTaps$ = events.select('gl').events('shortSingleTaps$');\n\n var createAnnotationStep$ = shortSingleTaps$.map(function (event) {\n return event.detail.pickingInfos;\n }).filter(function (pickingInfos) {\n return pickingInfos.length > 0;\n }).map(_otherUtils.first).share();\n\n var removePartData$ = events // same as removeBomEntries\n .select('bom').events('removeEntry$').map(_utils.toArray);\n\n var removeTypes$ = removePartData$.tap(function (e) {\n return console.log('removeTypes(fromEvent:bom)', e);\n });\n\n var deleteInstances$ = removePartData$.map(function (data) {\n return data.map(function (entry) {\n return { typeUid: entry.id };\n });\n }).tap(function (e) {\n return console.log('deleteInstances (fromEvent:bom)', e);\n });\n\n /* const annotationsActions = {\n creationStep$: actionsFromEvents.createAnnotationStep$\n }*/\n\n var addTypes$ = events // from bom\n .select('bom').events('addEntry$').map(function (data) {\n return { id: data.id, meta: data };\n }); // convert data structure to something the BOM model can deal with\n // .map(toArray)\n\n return {\n addTypes$: addTypes$,\n removeTypes$: removeTypes$,\n deleteInstances$: deleteInstances$,\n updateComponent$: updateComponent$,\n createAnnotationStep$: createAnnotationStep$,\n resetScaling$: resetScaling$\n };\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/entities/actions/fromEvents.js\n ** module id = 183\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/entities/actions/fromEvents.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = intent;\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nvar _utils = __webpack_require__(3);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar fromArray = _rx2.default.Observable.fromArray;\nfunction intent(postMessage, params) {\n var postMessage$ = postMessage.filter(_utils.exists).filter(function (p) {\n return p.hasOwnProperty('data');\n });\n\n var addPartData$ = postMessage$.filter(function (p) {\n return p.data.hasOwnProperty('addPartData');\n }).map(function (data) {\n return data.data.addPartData;\n }).map(_utils.toArray).tap(function (e) {\n return console.log('addPartData (fromPostMessage)', e);\n });\n\n var removePartData$ = postMessage$.filter(function (p) {\n return p.data.hasOwnProperty('removePartData');\n }).map(function (data) {\n return data.data.removePartData;\n })\n // .map(entry=>({id:entry.uuid}))\n .map(_utils.toArray);\n\n var removeTypes$ = removePartData$.map(function (data) {\n return data.map(function (entry) {\n return { id: entry.uuid };\n });\n }).tap(function (e) {\n return console.log('removeTypes (fromPostMessage)', e);\n });\n\n var deleteInstances$ = removePartData$.map(function (data) {\n return data.map(function (entry) {\n return { typeUid: entry.uuid };\n });\n }).tap(function (e) {\n return console.log('deleteInstances (fromPostMessage)', e);\n });\n\n // we create special \"read an html5 file \" requests with added id\n var desktopRequests$ = addPartData$.map(function (data) {\n return data.map(function (entry) {\n return {\n id: entry.uuid,\n uri: entry.file.name, // name of the html5 File object\n method: 'get',\n data: entry.file,\n // url:req.uri,\n src: 'desktop',\n type: 'resource'\n };\n });\n }).flatMap(fromArray).tap(function (e) {\n return console.log('desktopRequests (fromPostMessage)', e);\n });\n\n return {\n addPartData$: addPartData$,\n removePartData$: removePartData$,\n\n removeTypes$: removeTypes$,\n deleteInstances$: deleteInstances$,\n\n // UGH\n desktopRequests$: desktopRequests$\n };\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/entities/actions/fromPostMessage.js\n ** module id = 184\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/entities/actions/fromPostMessage.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = intentsFromResources;\nexports.default = intents;\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nvar _formatters = __webpack_require__(15);\n\nvar _modelUtils = __webpack_require__(6);\n\nvar _ramda = __webpack_require__(4);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n// helper function to extract certain & infer data\nfunction intentsFromResources(rawParsedData$) {\n var data$ = rawParsedData$.share();\n\n var candidates$ = data$ // for these we need to infer type , metadata etc\n .filter(function (d) {\n return d.data.meshOnly === true;\n }).map(function (_ref) {\n var meta = _ref.meta;\n var data = _ref.data;\n return { data: (0, _ramda.head)(data.typesMeshes).mesh, meta: meta };\n }).tap(function (e) {\n return console.log('entityCandidates', e);\n });\n\n // these MIGHT become instances, or something else, we just are not 100% sure\n var certains$ = data$ // for these we also have type, metadata etc, so we are CERTAIN of their data\n .filter(function (d) {\n return d.data.meshOnly === false;\n }).tap(function (e) {\n return console.log('entityCertains', e);\n });\n\n return {\n candidates$: candidates$,\n certains$: certains$\n };\n}\n\nfunction intents(resources, params) {\n var _intentsFromResources = intentsFromResources(resources);\n\n var certains$ = _intentsFromResources.certains$;\n var candidates$ = _intentsFromResources.candidates$;\n\n\n var addInstanceCandidates$ = candidates$.filter(function (data) {\n return data.meta.flags !== 'noInfer';\n }).tap(function (e) {\n return console.log('entityCandidates', e);\n });\n\n // components\n var createMetaComponents$ = certains$.map(function (data) {\n return data.data.instMeta;\n })\n // NOTE :we are doing these to make them compatible with remapMetaActions helpers, not sure this is the best\n .map(function (datas) {\n return datas.map(function (_ref2) {\n var instUid = _ref2.instUid;\n var typeUid = _ref2.typeUid;\n var name = _ref2.name;\n var color = _ref2.color;\n\n return { id: instUid, value: { id: instUid, typeUid: typeUid, name: name, color: color } };\n });\n });\n var createTransformComponents$ = certains$.map(function (data) {\n return data.data.instTransforms;\n }).map(function (datas) {\n return datas.map(function (_ref3) {\n var instUid = _ref3.instUid;\n var transforms = _ref3.transforms;\n\n return { id: instUid, value: { pos: [transforms[11], transforms[10], transforms[9]] } };\n });\n });\n var createMeshComponents$ = certains$.map(function (data) {\n return data.data.instMeta.map(function (instMeta) {\n var meshData = (0, _ramda.head)(data.data.typesMeshes.filter(function (mesh) {\n return mesh.typeUid === instMeta.typeUid;\n }));\n return {\n id: instMeta.instUid,\n value: { mesh: meshData.mesh.clone() } // TODO: check if this is redundant\n };\n });\n });\n\n // types handling\n\n // infered 'possible' type: for example when drag & droping an stl file etc\n var addTypeCandidate$ = candidates$.filter(function (data) {\n return data.meta.id === undefined;\n }).map(function (data) {\n var name = (0, _formatters.nameCleanup)(data.meta.name);\n return (0, _modelUtils.mergeData)(data, { meta: { name: name } });\n }).tap(function (e) {\n return console.log('adding type fromResource (candidate)', e);\n });\n\n // TODO : this would need to be filtered based on pre-existing type data\n // this one is used for example for 3mf files or any other formats where the type is KNOWN\n var addTypes$ = certains$.map(function (data) {\n return data.data.typesMeta.map(function (typeMeta, index) {\n if (typeMeta.name === undefined) {\n // we want type names in any case, so we infer this base on \"file\" name\n typeMeta.name = (0, _formatters.nameCleanup)(data.meta.name);\n if (index > 0) {\n typeMeta.name = typeMeta.name + index;\n }\n }\n var result = (0, _modelUtils.mergeData)(typeMeta, { meta: typeMeta });\n\n // extract mesh information\n var _data = data.data.typesMeshes[index];\n if (data) {\n result = (0, _modelUtils.mergeData)(result, { data: _data.mesh });\n }\n return result;\n });\n }).tap(function (e) {\n return console.log('adding type fromResource (certain)', e);\n }).flatMap(function (items) {\n return _rx2.default.Observable.from(items);\n });\n\n var alreadyExistingTypeMeshData$ = resources.filter(function (data) {\n return data.meta.id !== undefined;\n }).filter(function (data) {\n return data.meta.flags !== 'noInfer';\n }).tap(function (e) {\n return console.log('alreadyExistingTypeMeshData', e);\n });\n\n // DO NOT cleanup the name/remove the extension, the entity types model takes care of that\n // create new part type from basic type data & mesh data\n var addTypeFromTypeAndMeshData$ = alreadyExistingTypeMeshData$.map(function (entry) {\n var data = entry.data.typesMeshes[0].mesh;\n var meta = {\n name: (0, _formatters.nameCleanup)(entry.meta.name),\n id: entry.meta.id\n };\n return { id: entry.meta.id, data: data, meta: meta };\n }).tap(function (e) {\n return console.log('addEntityTypesFromResource', e);\n });\n\n return {\n addTypes$: addTypes$.merge(addTypeFromTypeAndMeshData$), // FIXME: is this one needed ? cause empty types/ bom entries when loading data from ym\n addTypeCandidate$: addTypeCandidate$,\n addInstanceCandidates$: addInstanceCandidates$,\n createMetaComponents$: createMetaComponents$,\n createTransformComponents$: createTransformComponents$,\n createMeshComponents$: createMeshComponents$\n };\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/entities/actions/fromResources.js\n ** module id = 185\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/entities/actions/fromResources.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = intent;\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nvar _ramda = __webpack_require__(4);\n\nvar _utils = __webpack_require__(3);\n\nvar _modelUtils = __webpack_require__(6);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar fromArray = _rx2.default.Observable.fromArray;\n\n\nfunction rawData(ym) {\n var parts = ym.data.filter(function (res) {\n return res.request.method === 'get' && res.request.type === 'ymLoad' && res.request.typeDetail === 'parts';\n }).mergeAll().pluck('response');\n // .tap(e=>console.log(\"in parts: \",e))\n\n var assemblies = ym.data.filter(function (res) {\n return res.request.method === 'get' && res.request.type === 'ymLoad' && res.request.typeDetail === 'assemblyEntries';\n })\n // .mergeAll()\n .flatMap(function (data) {\n var response$ = data.pluck('response');\n return response$.map(function (entries) {\n return entries.map(function (entry) {\n return (0, _modelUtils.mergeData)(entry, { assemblyId: data.request.assemblyId });\n });\n });\n });\n //.tap(e => console.log('in assemblies: ', e))\n\n return {\n parts: parts,\n assemblies: assemblies\n };\n}\n\nfunction intent(_ref, params) {\n var ym = _ref.ym;\n var resources = _ref.resources;\n\n var data = rawData(ym);\n\n var partsData$ = data.parts.share();\n\n var assemblyData$ = data.assemblies.share();\n\n var createMetaComponents$ = assemblyData$.map(function (datas) {\n return datas.map(function (entry) {\n var mapping = {\n 'uuid': 'id',\n 'part_uuid': 'typeUid'\n };\n // NOTE :we are doing these to make them compatible with remapMetaActions helpers, not sure this is the best\n var fieldNames = ['name', 'color', 'id', 'typeUid', 'assemblyId'];\n var data = (0, _ramda.pick)(fieldNames, (0, _utils.remapJson)(mapping, entry));\n return {\n id: data.id,\n value: data\n };\n });\n }).tap(function (e) {\n return console.log('createMetaComponents (fromYm)', e);\n });\n\n var createTransformComponents$ = assemblyData$.map(function (datas) {\n return datas.map(function (entry) {\n var mapping = {\n 'uuid': 'id',\n 'part_uuid': 'typeUid'\n };\n var fieldNames = ['name', 'id', 'typeUid', 'pos', 'rot', 'sca'];\n var data = (0, _ramda.pick)(fieldNames, (0, _utils.remapJson)(mapping, entry));\n\n data.pos = data.pos.map(parseFloat);\n data.rot = data.rot.map(parseFloat);\n data.sca = data.sca.map(parseFloat);\n // NOTE :we are doing these to make them compatible with remapMetaActions helpers, not sure this is the best\n return {\n id: data.id,\n value: data\n };\n });\n });\n // .tap(e=>console.log(\"transforms\",e))\n /* ext: \"stl\"\n flags: \"noInfer\"\n id: \"1535f856dd0iT\"\n name: \"UM2CableChain_BedEnd.STL\"\n uri: \"*/\n\n // this makes sure that meshes ALWAYS get resolved, regardless of the order\n // that mesh information and metadata gets recieved\n function combineAndWaitUntil(meshesData$, assemblyData$) {\n var obs = new _rx2.default.ReplaySubject();\n\n var metas = [];\n var meshes = {};\n var dones = [];\n\n function matchAttempt(id) {\n metas.forEach(function (data) {\n var mesh = meshes[data.typeUid];\n if (mesh !== undefined) {\n // mesh.userData = {}\n if (dones.indexOf(data.id) === -1) {\n var result = (0, _modelUtils.mergeData)(data, { value: { mesh: mesh } });\n obs.onNext(result); // ONLY emit data when we have a match\n dones.push(data.id);\n }\n }\n });\n }\n\n meshesData$.forEach(function (meshData) {\n var mesh = meshData.data.typesMeshes[0].mesh;\n meshes[meshData.meta.id] = mesh;\n matchAttempt(meshData.meta.id);\n });\n\n assemblyData$.flatMap(fromArray).forEach(function (data) {\n metas.push(data);\n matchAttempt(data.typeUid);\n });\n\n return obs;\n }\n\n var meshComponentMeshes$ = resources.filter(function (data) {\n return data.meta.id !== undefined;\n });\n\n var meshComponentAssemblyData$ = assemblyData$.map(function (datas) {\n return datas.map(function (entry) {\n var mapping = {\n 'uuid': 'id',\n 'part_uuid': 'typeUid'\n };\n var fieldNames = ['id', 'typeUid', 'assemblyId'];\n var data = (0, _ramda.pick)(fieldNames, (0, _utils.remapJson)(mapping, entry));\n return { id: data.id, typeUid: data.typeUid, value: undefined };\n });\n });\n\n var createMeshComponents$ = combineAndWaitUntil(meshComponentMeshes$, meshComponentAssemblyData$).map(_utils.toArray).tap(function (e) {\n return console.log('createMeshComponents', e);\n });\n\n // TODO : this would need to be filtered based on pre-existing type data ?\n var addTypes$ = partsData$.map(function (data) {\n return data.map(function (entry) {\n var mapping = {\n 'uuid': 'id'\n };\n var fieldNames = ['id', 'name', 'description', 'binary_document_id', 'binary_document_url', 'source_document_id', 'source_document_url'];\n var data = (0, _ramda.pick)(fieldNames, (0, _utils.remapJson)(mapping, entry));\n return { id: data.id, data: undefined, meta: data };\n });\n }).flatMap(fromArray);\n // .forEach(e=>console.log(\"addEntityTypes\", e))\n\n // send out requests to fetch data for meshes\n var meshRequests$ = partsData$.map(function (data) {\n return data.map(function (entry) {\n var mapping = {\n 'uuid': 'id'\n };\n var fieldNames = ['id', 'name', 'description', 'binary_document_id', 'binary_document_url', 'source_document_id', 'source_document_url'];\n var data = (0, _ramda.pick)(fieldNames, (0, _utils.remapJson)(mapping, entry));\n\n return { src: 'http', method: 'get', uri: data.binary_document_url, url: data.binary_document_url, id: data.id, type: 'resource', flags: 'noInfer' };\n });\n }).flatMap(fromArray).filter(function (req) {\n return req.uri !== undefined && req.uri !== '';\n });\n // .tap(e => console.log('meshRequests', e))\n\n // set active assembly\n var setActiveAssembly$ = assemblyData$.take(1).map(function (data) {\n return (0, _ramda.head)(data);\n }).filter(_utils.exists).pluck('assemblyId').distinctUntilChanged();\n // .tap(e => console.log('setActiveAssembly', e))\n\n return {\n addTypes$: addTypes$,\n createMetaComponents$: createMetaComponents$,\n createTransformComponents$: createTransformComponents$,\n createMeshComponents$: createMeshComponents$,\n\n requests$: meshRequests$,\n setActiveAssembly$: setActiveAssembly$\n };\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/entities/actions/fromYm.js\n ** module id = 186\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/entities/actions/fromYm.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"]) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); } }; }();\n\nexports.addAnnotation = addAnnotation;\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nvar _utils = __webpack_require__(163);\n\nvar _otherUtils = __webpack_require__(47);\n\nvar _utils2 = __webpack_require__(3);\n\nvar _log = __webpack_require__(77);\n\nvar _log2 = _interopRequireDefault(_log);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar Observable = _rx2.default.Observable;\nvar merge = Observable.merge;\n\n// import {clearActiveTool$} from\n\nvar log = (0, _log2.default)('annotations');\nlog.setLevel('error');\n\n// utilities\n/* generate note annotation data from input*/\nfunction generateNoteData(data) {\n console.log('hey yo, add a note', data);\n var object = data.object;\n var point = data.point;\n var normal = data.normal;\n\n\n var annotation = {\n typeUid: 'A1',\n id: (0, _utils2.generateUUID)(),\n cid: 1,\n name: 'note',\n target: {\n point: point.toArray(),\n normal: normal.toArray(),\n typeUid: undefined,\n id: object.userData.entity.id // here we could toggle, instance vs type\n }\n };\n\n return annotation;\n}\n\n/* generate thickness annotation data from input*/\nfunction generateThicknessData(data) {\n console.log('hey yo, add a thickness', data);\n\n var object = data.object;\n var entryPoint = data.entryPoint;\n var exitPoint = data.exitPoint;\n var thickness = data.thickness;\n\n\n entryPoint = entryPoint.toArray();\n exitPoint = exitPoint.toArray();\n\n var annotation = {\n typeUid: 'A2',\n id: (0, _utils2.generateUUID)(),\n cid: 2,\n name: 'thickness',\n value: thickness,\n target: {\n entryPoint: entryPoint,\n exitPoint: exitPoint,\n normal: undefined,\n typeUid: undefined,\n id: object.userData.entity.id // here we could toggle, instance vs type\n }\n };\n\n return annotation;\n}\n\n/* generate distance annotation data from input*/\nfunction generateDistanceData(data) {\n console.log('hey yo, add a distance', data);\n\n var _data = _slicedToArray(data, 2);\n\n var start = _data[0];\n var end = _data[1];\n\n\n var distance = (0, _utils.getDistanceFromStartEnd)(start.point, end.point);\n\n var annotation = {\n typeUid: 'A4',\n id: (0, _utils2.generateUUID)(),\n cid: 3, // categoryId\n name: 'distance',\n value: distance,\n target: {\n start: {\n point: start.point.toArray(),\n typeUid: undefined,\n id: start.object.userData.entity.id\n },\n end: {\n point: end.point.toArray(),\n typeUid: undefined,\n id: end.object.userData.entity.id\n }\n }\n };\n return annotation;\n}\n\n/* generate diameter annotation data from input*/\nfunction generateDiameterData(data) {\n console.log('hey yo, add a diameter', data);\n\n var _data2 = _slicedToArray(data, 3);\n\n var start = _data2[0];\n var mid = _data2[1];\n var end = _data2[2];\n\n var _computeCenterDiaNorm = (0, _utils.computeCenterDiaNormalFromThreePoints)(start.point, mid.point, end.point);\n\n var center = _computeCenterDiaNorm.center;\n var diameter = _computeCenterDiaNorm.diameter;\n var normal = _computeCenterDiaNorm.normal;\n\n\n var annotation = {\n typeUid: 'A3',\n id: (0, _utils2.generateUUID)(),\n cid: 4, // categoryId\n name: 'diameter',\n value: diameter,\n target: {\n normal: normal.toArray(),\n point: center.toArray(),\n typeUid: undefined,\n id: start.object.userData.entity.id\n }\n };\n\n return annotation;\n}\n\n/* generate angle annotation data from input*/\nfunction generateAngleData(data) {\n console.log('hey yo, add an angle', data);\n\n var _data3 = _slicedToArray(data, 3);\n\n var start = _data3[0];\n var mid = _data3[1];\n var end = _data3[2];\n\n var angle = (0, _utils.computeAngleFromThreePoints)(start.point, mid.point, end.point);\n angle = angle * 180 / Math.PI;\n\n var annotation = {\n typeUid: 'A5',\n id: (0, _utils2.generateUUID)(),\n cid: 5, // categoryId\n name: 'angle',\n value: angle,\n target: {\n start: {\n point: start.point.toArray(),\n typeUid: undefined,\n id: start.object.userData.entity.id\n },\n mid: {\n point: mid.point.toArray(),\n typeUid: undefined,\n id: mid.object.userData.entity.id\n },\n end: {\n point: end.point.toArray(),\n typeUid: undefined,\n id: end.object.userData.entity.id\n }\n }\n };\n\n return annotation;\n}\n\n// /////////////\n// FIXME: where do these belong ? they are not really model side, so actions ?\n// also, they are indepdendant from other aspects, but they are \"sinks\"\n// also, perhaps each tool type shouls specify what cursor it wants ?\n/* toggleNote$\n .map(function(val){\n console.log(\"cursor\",val)\n return val\n })\n .subscribe((toggled)=>toggleCursor(toggled,\"crosshair\"))\n\ntoggleThicknessAnnot$\n .subscribe((toggled)=>toggleCursor(toggled,\"crosshair\"))\n\ntoggleDistanceAnnot$\n .subscribe((toggled)=>toggleCursor(toggled,\"crosshair\"))\n\ntoggleDiameterAnnot$\n .subscribe((toggled)=>toggleCursor(toggled,\"crosshair\"))\n\ntoggleAngleAnnot$\n .subscribe((toggled)=>toggleCursor(toggled,\"crosshair\"))*/\n// temporary hack for cursor\nfunction handleCursor(input) {\n input.pluck('activeTool').subscribe(function (activeTool) {\n /* switch(activeTool){\n case :\n }*/\n if (activeTool !== undefined) {\n (0, _otherUtils.toggleCursor)(true, 'crosshair');\n }\n });\n\n // document.getElementById(\"mydiv\").style.cursor=\"move\"\n}\n\nfunction hasEntity(data) {\n return data.object.userData.entity && data.object.userData.entity.id;\n}\n\n// /////////////\nfunction addAnnotation(actions, settings$) {\n function dataOnly(entry) {\n return entry.data;\n }\n\n var activeTool$ = settings$.pluck('activeTool');\n var baseStream$ = actions.creationStep$.withLatestFrom(activeTool$, function (data, activeTool) {\n return { data: data, activeTool: activeTool };\n });\n\n var noteAnnot$ = baseStream$.filter(function (data) {\n return data.activeTool === 'addNote';\n }).map(dataOnly).map(_utils.getObjectPointNormal).filter(hasEntity) // we need data to have entity infos\n .map(generateNoteData);\n\n var thickessAnnot$ = baseStream$.filter(function (data) {\n return data.activeTool === 'measureThickness';\n }).map(dataOnly).map(_utils.getEntryExitThickness).filter(hasEntity) // we need data to have entity infos\n .map(generateThicknessData);\n\n var distanceAnnot$ = baseStream$.filter(function (data) {\n return data.activeTool === 'measureDistance';\n }).map(dataOnly).map(_utils.getObjectPointNormal).filter(hasEntity) // we need data to have entity infos\n .bufferWithCount(2) // we need 2 data points to generate a distance\n .do(function (e) {\n return console.log('measuring distance', e);\n }).map(generateDistanceData);\n\n var diameterAnnot$ = baseStream$.filter(function (data) {\n return data.activeTool === 'measureDiameter';\n }).map(dataOnly).map(_utils.getObjectPointNormal).filter(hasEntity) // we need data to have entity infos\n .bufferWithCount(3) // we need 3 data points to generate a diameter\n .map(generateDiameterData);\n\n var angleAnnot$ = baseStream$.filter(function (data) {\n return data.activeTool === 'measureAngle';\n }).map(dataOnly).map(_utils.getObjectPointNormal).filter(hasEntity) // we need data to have entity infos\n .bufferWithCount(3) // we need 3 data points to generate an angle\n .map(generateAngleData);\n\n var additions$ = merge(noteAnnot$, thickessAnnot$, distanceAnnot$, diameterAnnot$, angleAnnot$).share();\n\n return additions$;\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/entities/annotations/annotations.js\n ** module id = 187\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/entities/annotations/annotations.js?")},function(module,exports,__webpack_require__){eval('\'use strict\';\n\nObject.defineProperty(exports, "__esModule", {\n value: true\n});\nexports.default = types;\n\nvar _modelUtils = __webpack_require__(6);\n\nvar _utils = __webpack_require__(3);\n\n// one typical entry\n/*\n{\n "uuid": "xxxxx-xxxx-xxx-x",\n "name": "some assembly",\n "description": "test"\n }*/\n\n// actual api functions\n// TODO: if all we deal with is pseudo \'selection\' ie, active assembly, we\n// should move this to selections perhaps ?\n\nfunction setActiveAssembly(state, input) {\n return (0, _modelUtils.mergeData)(state, { currentAssembly: input });\n}\n\nfunction types(actions, source) {\n var defaults = { currentAssembly: (0, _utils.generateUUID)() };\n\n var updateFns = { setActiveAssembly: setActiveAssembly };\n return (0, _modelUtils.makeModel)(defaults, updateFns, actions);\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/entities/assemblies.js\n ** module id = 188\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/entities/assemblies.js?')},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.makeBoundingSystem = makeBoundingSystem;\n\nvar _common = __webpack_require__(38);\n\nvar _modelUtils = __webpack_require__(6);\n\n// //BoundingBox//////\nfunction makeBoundingSystem(actions) {\n var defaults = {};\n\n var boundsDefaults = {\n min: [0, 0, 0],\n max: [0, 0, 0]\n };\n\n var updateFns = {\n createComponents: _common.createComponents.bind(null, boundsDefaults),\n duplicateComponents: _common.duplicateComponents,\n removeComponents: _common.removeComponents\n };\n\n if (!actions) {\n actions = (0, _common.makeActionsFromApiFns)(updateFns);\n }\n\n var bounds$ = (0, _modelUtils.makeModel)(defaults, updateFns, actions);\n\n return {\n bounds$: bounds$,\n boundActions: actions\n };\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/entities/components/bounds.js\n ** module id = 189\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/entities/components/bounds.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.makeMeshSystem = makeMeshSystem;\n\nvar _common = __webpack_require__(38);\n\nvar _modelUtils = __webpack_require__(6);\n\nvar _three = __webpack_require__(1);\n\nvar _three2 = _interopRequireDefault(_three);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n// //Mesh//////\nfunction makeMeshSystem(actions) {\n var defaults = {};\n\n function createComponentsMesh(defaults, state, inputs) {\n // console.log('createComponents for mesh', inputs)\n\n return inputs.reduce(function (state, input) {\n var inputValue = {};\n if (input && input.value) {\n inputValue = input.value;\n }\n\n var mesh = inputValue.mesh.clone(); // meh ?//FIXME : make sure there are no multiple clones\n mesh.material = mesh.material.clone(); // {mesh: inputValue.mesh }// mergeData(defaults,inputValue)\n var id = input.id;\n\n mesh.userData.entity = { id: id };\n mesh.pickable = true;\n\n state = (0, _modelUtils.mergeData)({}, state);\n state[id] = mesh;\n // FIXME big hack, use immutability !!!\n\n // console.log('done createComponents (mesh)', state)\n return state;\n }, state);\n }\n\n // TODO: should defaults be something like a stand in cube ?\n var updateFns = {\n createComponents: createComponentsMesh.bind(null, undefined),\n duplicateComponents: _common.duplicateComponents,\n removeComponents: _common.removeComponents\n };\n\n if (!actions) {\n actions = (0, _common.makeActionsFromApiFns)(updateFns);\n }\n\n var meshes$ = (0, _modelUtils.makeModel)(defaults, updateFns, actions, undefined, { doApplyTransform: false }); // last flag set to false because we\n // do not want immutable data for meshes ?\n\n return {\n meshes$: meshes$,\n meshActions: actions\n };\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/entities/components/mesh.js\n ** module id = 190\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/entities/components/mesh.js?"); },function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.makeMetaSystem = makeMetaSystem;\n\nvar _common = __webpack_require__(38);\n\nvar _modelUtils = __webpack_require__(6);\n\n// //Entity Meta//////\nfunction makeMetaSystem(actions) {\n var defaults = {};\n\n // defaults for each component in this system\n var componentDefaults = {\n name: undefined,\n id: undefined,\n typeUid: undefined,\n assemblyId: undefined,\n color: '#07a9ff'\n };\n\n function updateComponents(state, inputs) {\n console.log('update meta attributes', inputs); // , metaChanges, instIds)\n\n return inputs.reduce(function (state, input) {\n var id = input.id;\n\n var newAttrs = input.value;\n var orig = state[id];\n\n state = (0, _modelUtils.mergeData)({}, state);\n // FIXME big hack, use mutability\n state[id] = (0, _modelUtils.mergeData)(orig, newAttrs);\n return state;\n }, state);\n }\n\n function clone(state, input) {\n var id = input.id;\n\n var newId = input.value;\n var orig = state[id];\n\n var cloneInst = (0, _modelUtils.mergeData)({}, orig);\n cloneInst.id = newId;\n\n state = (0, _modelUtils.mergeData)({}, state);\n // FIXME big hack, use mutability\n state[newId] = cloneInst;\n\n return state;\n }\n\n function clear(state, input) {\n console.log('clearing meta');\n return {};\n }\n\n var updateFns = {\n updateComponents: updateComponents, // clone,\n createComponents: _common.createComponents.bind(null, componentDefaults),\n duplicateComponents: _common.duplicateComponents,\n removeComponents: _common.removeComponents,\n clear: clear\n };\n\n if (!actions) {\n actions = (0, _common.makeActionsFromApiFns)(updateFns);\n }\n\n var meta$ = (0, _modelUtils.makeModel)(defaults, updateFns, actions);\n\n return {\n meta$: meta$,\n metaActions: actions\n };\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/entities/components/meta.js\n ** module id = 191\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/entities/components/meta.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.mirrorComponents = mirrorComponents;\nexports.resetScaling = resetScaling;\nexports.updateComponents = updateComponents;\nexports.makeTransformsSystem = makeTransformsSystem;\n\nvar _ramda = __webpack_require__(4);\n\nvar _common = __webpack_require__(38);\n\nvar _modelUtils = __webpack_require__(6);\n\n// //Transforms//////\n\nfunction applySnapping(transformValues, stepSize) {\n var mapValue = arguments.length <= 2 || arguments[2] === undefined ? undefined : arguments[2];\n\n // applies snapping for both rotation and scaling\n // maps the rotationtransformValues from to degrees and back\n var numberToRoundTo = 1 / stepSize;\n for (var i = 0; i < transformValues.length; i++) {\n var roundedNumber = transformValues[i];\n roundedNumber = mapValue ? roundedNumber * (180 / Math.PI) : roundedNumber;\n roundedNumber = Math.round(roundedNumber * numberToRoundTo) / numberToRoundTo;\n if (mapValue) {\n roundedNumber = roundedNumber * (Math.PI / 180);\n }\n transformValues[i] = roundedNumber;\n }\n return transformValues;\n}\n\nfunction applyUniformScaling(transformDefaults, transformValues) {\n // sorts the values and sees which is different, because this is the changes\n // then applies the new value to all dimension in respect to the minussign because this is added by mirroring\n var sortedValues = JSON.parse(JSON.stringify(transformValues)); // deepcopy\n sortedValues.forEach(function (part, i) {\n if (sortedValues[i].isNaN) {\n transformValues = sortedValues = transformDefaults.sca;\n } // safety catch\n sortedValues[i] = Math.abs(part);\n });\n sortedValues = sortedValues.slice().sort();\n for (var i = 0; i < sortedValues.length; i++) {\n if (sortedValues[i] === sortedValues[i + 1]) {\n sortedValues.splice(i, 2);\n }\n }\n var newValue = sortedValues[0];\n for (var _i = 0; _i < transformValues.length; _i++) {\n if (transformValues[_i] < 0) {\n transformValues[_i] = -newValue;\n } else {\n transformValues[_i] = newValue;\n }\n }\n return transformValues;\n}\n\nfunction applySnapAndUniformScaling(transformDefaults, transformationType, transformation, settings) {\n var snapDefaults = {\n pos: 0.1, // snap translation snaps to 0.1 units\n rot: 10, // snap rotation snaps to tens of degrees\n sca: 0.1 // snap scaling snaps to tens of percentages\n };\n //console.log('applySnapAndUniformScaling', transformation)\n var uniformScaling = settings.uniformScaling;\n var snapScaling = settings.snapScaling;\n var snapRotation = settings.snapRotation;\n var snapTranslation = settings.snapTranslation;\n\n\n if (uniformScaling && transformationType === 'sca') {\n transformation = applyUniformScaling(transformDefaults, transformation);\n }\n if (snapScaling && transformationType === 'sca') {\n transformation = applySnapping(transformation, snapDefaults[transformationType]);\n }\n if (snapTranslation && transformationType === 'pos') {\n transformation = applySnapping(transformation, snapDefaults[transformationType]);\n }\n if (snapRotation && transformationType === 'rot') {\n transformation = applySnapping(transformation, snapDefaults[transformationType], 2 * Math.PI);\n }\n return transformation;\n}\n\nfunction mirrorComponents(transformDefaults, state, inputs) {\n console.log('mirroring transforms', inputs);\n\n return inputs.reduce(function (state, input) {\n var id = input.id;\n\n\n var sca = state[id].sca.map(function (d) {\n return d;\n }); // DO NOT REMOVE ! a lot of code relies on diffing, and if you mutate the original scale, it breaks !\n sca[input.axis] *= -1;\n\n var orig = state[id] || transformDefaults;\n\n state = (0, _modelUtils.mergeData)({}, state);\n // FIXME big hack, use mutability\n state[id] = (0, _modelUtils.mergeData)({}, orig, { sca: sca });\n\n return state;\n }, state);\n}\n\nfunction resetScaling(transformDefaults, state, inputs) {\n return inputs.reduce(function (state, input) {\n var id = input.id;\n\n\n var sca = state[id].sca.map(function (d) {\n return d;\n }); // DO NOT REMOVE ! a lot of code relies on diffing, and if you mutate the original scale, it breaks !\n sca = transformDefaults.sca;\n\n var orig = state[id] || transformDefaults;\n\n state = (0, _modelUtils.mergeData)({}, state);\n // FIXME big hack, use mutability\n state[id] = (0, _modelUtils.mergeData)({}, orig, { sca: sca });\n\n return state;\n }, state);\n}\n\nfunction updateComponents(transformDefaults, state, inputs) {\n var currentStateFlat = inputs.map(function (input) {\n return state[input.id];\n });\n\n var transform = (0, _ramda.head)(inputs)['trans'];\n var currentAvg = (0, _ramda.pluck)(transform)(currentStateFlat).reduce(function (acc, cur) {\n if (!acc) return cur;\n return [acc[0] + cur[0], acc[1] + cur[1], acc[2] + cur[2]].map(function (x) {\n return x * 0.5;\n });\n }, undefined);\n\n return inputs.reduce(function (state, input) {\n state = (0, _modelUtils.mergeData)({}, state);\n var id = input.id;\n\n\n var diff = [input.value[0] - currentAvg[0], input.value[1] - currentAvg[1], input.value[2] - currentAvg[2]];\n\n var transformation = diff.map(function (value, index) {\n return state[id][input.trans][index] + value;\n }) || transformDefaults;\n\n state[id][input.trans] = applySnapAndUniformScaling(transformDefaults, input.trans, transformation, input.settings);\n //console.log('state', state, input)\n return state;\n }, state);\n}\n\nfunction makeTransformsSystem(actions) {\n var defaults = {};\n\n var transformDefaults = {\n pos: [0, 0, 0],\n rot: [0, 0, 0],\n sca: [1, 1, 1]\n };\n\n function updatePosition(state, input) {\n console.log('updatePosition');\n var id = input.id;\n var pos = input.value || [0, 0, Math.random()];\n var orig = state[id] || transformDefaults;\n\n state = (0, _modelUtils.mergeData)({}, state);\n // FIXME big hack, use mutability\n state[id] = (0, _modelUtils.mergeData)({}, orig, { pos: pos });\n return state;\n }\n\n function updateRotation(state, input) {\n console.log('updateRotation');\n var id = input.id;\n\n var rot = input.value || [0, 0, Math.random()];\n var orig = state[id] || transformDefaults;\n\n state = (0, _modelUtils.mergeData)({}, state);\n // FIXME big hack, use mutability\n state[id] = (0, _modelUtils.mergeData)({}, orig, { rot: rot });\n return state;\n }\n\n function updateScale(state, input) {\n console.log('updateScale');\n var id = input.id;\n\n var sca = input.value || [1, 1, Math.random()];\n var orig = state[id] || transformDefaults;\n\n state = (0, _modelUtils.mergeData)({}, state);\n // FIXME big hack, use mutability\n state[id] = (0, _modelUtils.mergeData)({}, orig, { sca: sca });\n return state;\n }\n\n var updateFns = {\n updateRotation: updateRotation,\n updatePosition: updatePosition,\n updateScale: updateScale,\n resetScaling: resetScaling.bind(null, transformDefaults),\n mirrorComponents: mirrorComponents.bind(null, transformDefaults),\n updateComponents: updateComponents.bind(null, transformDefaults),\n createComponents: _common.createComponents.bind(null, transformDefaults),\n duplicateComponents: _common.duplicateComponents,\n removeComponents: _common.removeComponents\n };\n\n if (!actions) {\n actions = (0, _common.makeActionsFromApiFns)(updateFns);\n }\n\n var transforms$ = (0, _modelUtils.makeModel)(defaults, updateFns, actions);\n\n return {\n transforms$: transforms$,\n transformActions: actions\n };\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/entities/components/transforms.js\n ** module id = 192\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/entities/components/transforms.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nexports.default = function (actions, entityTypes$, assembly$) {\n /*\n //addInstanceCandidates => -------------------------\n //addType => --T----------------------\n */\n\n var addInstancesCandidates$ = actions.entityActions.addInstanceCandidates$\n // .filter(data=>data.meta.id === undefined)\n .combineLatest(entityTypes$, function (candidateData, types) {\n var meshName = (0, _formatters.nameCleanup)(candidateData.meta.name);\n return (0, _ramda.find)((0, _ramda.propEq)('name', meshName))(types);\n }).filter(_utils.exists).filter(function (candidate) {\n return candidate.mesh !== undefined;\n })\n // .tap(e=>console.log(\"addInstancesCandidates\",e))\n .map(_utils.toArray).take(1).repeat();\n\n // create various components' baseis\n\n var componentBase$ = addInstancesCandidates$.combineLatest(assembly$, function (newTypes, assemblyId) {\n return { newTypes: newTypes, assemblyId: assemblyId };\n }).map(function (_ref) {\n var newTypes = _ref.newTypes;\n var assemblyId = _ref.assemblyId;\n\n return newTypes.map(function (typeData) {\n var instUid = (0, _utils.generateUUID)();\n var typeUid = typeData.id;\n var instName = typeData.name + '_' + instUid;\n\n var instanceData = {\n id: instUid,\n typeUid: typeUid,\n name: instName,\n assemblyId: assemblyId\n };\n return instanceData;\n });\n }).withLatestFrom(entityTypes$, function (instances, types) {\n var data = instances.map(function (instance) {\n var instUid = instance.id;\n var typeUid = instance.typeUid;\n var assemblyId = instance.assemblyId;\n\n // is this a hack?\n var entry = (0, _ramda.find)((0, _ramda.propEq)('id', typeUid))(types);\n var mesh = entry.mesh;\n var bbox = mesh.boundingBox;\n var zOffset = bbox.max.clone().sub(bbox.min);\n zOffset = zOffset.z / 2;\n bbox = { min: bbox.min.toArray(), max: bbox.max.toArray() };\n\n // injecting data like this is the right way ?\n mesh.material = mesh.material.clone();\n mesh = mesh.clone();\n\n return {\n instUid: instUid,\n typeUid: typeUid,\n assemblyId: assemblyId,\n instance: instance,\n mesh: mesh,\n zOffset: zOffset,\n bbox: bbox\n };\n });\n\n return data;\n }).shareReplay(1);\n\n var createMeshComponents$ = actions.entityActions.createMeshComponents$.combineLatest(entityTypes$, function (meshComponents, types) {\n return meshComponents.map(function (component) {\n if (component.data) {\n return component;\n } else {\n var typeUid = component.typeUid;\n\n var entry = (0, _ramda.find)((0, _ramda.propEq)('id', typeUid))(types);\n if (entry && entry.mesh) {\n var mesh = entry.mesh;\n // let bbox = mesh.boundingBox\n // let zOffset = bbox.max.clone().sub(bbox.min)\n // zOffset = zOffset.z/2\n // bbox = { min:bbox.min.toArray(), max:bbox.max.toArray() }\n\n // injecting data like this is the right way ?\n mesh.material = mesh.material.clone();\n mesh = mesh.clone();\n return (0, _modelUtils.mergeData)({}, component, { value: { mesh: mesh } });\n } else {\n return component;\n }\n }\n }).filter(function (data) {\n return data.value !== undefined;\n });\n });\n\n return {\n componentBase$: componentBase$,\n createMeshComponents$: createMeshComponents$,\n assembly$: assembly$\n };\n};\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nvar _ramda = __webpack_require__(4);\n\nvar _formatters = __webpack_require__(15);\n\nvar _utils = __webpack_require__(3);\n\nvar _modelUtils = __webpack_require__(6);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar just = _rx2.default.Observable.just;\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/entities/entitiesExtra.js\n ** module id = 193\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/entities/entitiesExtra.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = intents;\n\nvar _obsUtils = __webpack_require__(5);\n\nvar _fromDOM = __webpack_require__(182);\n\nvar _fromDOM2 = _interopRequireDefault(_fromDOM);\n\nvar _fromEvents = __webpack_require__(183);\n\nvar _fromEvents2 = _interopRequireDefault(_fromEvents);\n\nvar _fromPostMessage = __webpack_require__(184);\n\nvar _fromPostMessage2 = _interopRequireDefault(_fromPostMessage);\n\nvar _fromYm = __webpack_require__(186);\n\nvar _fromYm2 = _interopRequireDefault(_fromYm);\n\nvar _fromResources = __webpack_require__(185);\n\nvar _fromResources2 = _interopRequireDefault(_fromResources);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction intents(sources) {\n console.log('here', sources);\n var actionsSources = [(0, _fromDOM2.default)(sources.DOM), (0, _fromEvents2.default)(sources.events), (0, _fromPostMessage2.default)(sources.postMessage),\n\n // special cases\n (0, _fromResources2.default)(sources.resources.parsed$), (0, _fromYm2.default)({ ym: sources.ym, resources: sources.resources.parsed$ }) // special signature\n ];\n\n return (0, _obsUtils.mergeActionsByName)(actionsSources);\n // returns the original actions, validate PLUS\n // return validate(mergeActionsByName(actionsSources))\n}\n\n/* const entityActionNames = [\n 'reset'\n\n ,'addTypes'\n ,'addTypeCandidate'\n ,'removeTypes'\n\n ,'addInstanceCandidates'\n ,'deleteInstances'\n ,'duplicateInstances'\n\n ,'updateComponent'\n ,'createMetaComponents'\n ,'createTransformComponents'\n ,'createMeshComponents'\n]\n\nconst actionsSources = [\n entityActionsFromDom, actionsFromPostMessage,\n entityActionsFromResources, actionsFromEvents,\n entityActionsFromYm, extras]\nconst entityActions = mergeActionsByName(actionsSources, entityActionNames)*/\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/entities/intents.js\n ** module id = 194\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/entities/intents.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = makeTypeInstanceMapping;\n\nvar _obsUtils = __webpack_require__(5);\n\nfunction makeTypeInstanceMapping(instances$, types$) {\n // register type=> instance & vice versa\n // let base = {typeUidFromInstUid: {}, instUidFromTypeUid: {}}\n\n instances$ = instances$.map(function (instances) {\n var res = [];\n Object.keys(instances).map(function (key) {\n res.push(instances[key]);\n });\n return res;\n });\n\n return (0, _obsUtils.combineLatestObj)({ instances$: instances$, types$: types$ }).map(function (_ref) {\n var instances = _ref.instances;\n var types = _ref.types;\n\n var instUidFromTypeUid = instances.reduce(function (prev, instance) {\n if (!prev[instance.typeUid]) {\n prev[instance.typeUid] = []; // instance.id\n }\n\n prev[instance.typeUid].push(instance.id);\n return prev;\n }, {});\n\n var typeUidFromInstUid = instances.reduce(function (prev, instance) {\n prev[instance.id] = instance.typeUid;\n return prev;\n }, {});\n\n return { instUidFromTypeUid: instUidFromTypeUid, typeUidFromInstUid: typeUidFromInstUid };\n });\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/entities/typeInstanceMapping.js\n ** module id = 195\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/entities/typeInstanceMapping.js?")},function(module,exports,__webpack_require__){eval('\'use strict\';\n\nObject.defineProperty(exports, "__esModule", {\n value: true\n});\nexports.default = types;\n\nvar _ramda = __webpack_require__(4);\n\nvar _utils = __webpack_require__(3);\n\nvar _formatters = __webpack_require__(15);\n\nvar _computeBounds = __webpack_require__(48);\n\nvar _modelUtils = __webpack_require__(6);\n\nfunction _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }\n\n// one typical entry\n/*\n{\n "uuid": "a1",\n "name": "FavoritePart",\n "description": "test",\n "binary_document_id": 38546,\n "binary_document_url": "xxx/38546/UM2CableChain_BedEnd.STL",\n "source_document_id": null,\n "source_document_url": "",\n }*/\n\n// actual api functions\nfunction upsertTypes(state, input, index) {\n var _input$meta = input.meta;\n var id = _input$meta.id;\n var name = _input$meta.name; // names are expected to be already \'cleaned up\' ie without extension\n\n var mesh = input.data;\n\n if (index === -1) {\n // if we have a mesh that is not yet registered\n if (mesh) {\n (0, _computeBounds.computeBoundingSphere)(mesh);\n (0, _computeBounds.computeBoundingBox)(mesh);\n }\n id = id || (0, _utils.generateUUID)();\n } else {\n id = state[index].id || (0, _utils.generateUUID)();\n }\n var entry = { id: id, name: name, mesh: mesh };\n\n if (index === -1) {\n state = state.concat((0, _utils.toArray)(entry));\n } else {\n var newEntry = (0, _modelUtils.mergeData)(state[index], entry);\n state = [].concat(_toConsumableArray(state.slice(0, index)), [newEntry], _toConsumableArray(state.slice(index + 1)));\n }\n return state;\n}\n\nfunction addTypes(state, input) {\n console.log(\'addTypes\', state, input);\n // we have an id , we use that to search for pre-existing data\n var index = (0, _ramda.findIndex)((0, _ramda.propEq)(\'id\', input.meta.id))(state);\n return upsertTypes(state, input, index);\n}\n\n// create/infer a new type based on mesh + metadata\nfunction addTypeCandidate(state, input) {\n console.log(\'addTypeCandidate\', state, input);\n // we have a mesh name , we use that to search for pre-existing data\n var index = (0, _ramda.findIndex)((0, _ramda.propEq)(\'name\', (0, _formatters.nameCleanup)(input.meta.name)))(state);\n return upsertTypes(state, input, index);\n}\n\nfunction removeTypes(state, inputs) {\n console.log(\'remove types\', state, inputs);\n state = inputs.reduce(function (state, input) {\n var index = (0, _ramda.findIndex)((0, _ramda.propEq)(\'id\', input.id))(state);\n state = [].concat(_toConsumableArray(state.slice(0, index)), _toConsumableArray(state.slice(index + 1)));\n return state;\n }, state);\n return state;\n}\n\nfunction clearTypes(state, input) {\n // log.info("New design, clearing registry",regData)\n return [];\n}\n\nfunction types(actions, source) {\n var defaults = [];\n\n var updateFns = { addTypes: addTypes, addTypeCandidate: addTypeCandidate, removeTypes: removeTypes, clearTypes: clearTypes };\n return (0, _modelUtils.makeModel)(defaults, updateFns, actions); // since we store THREE.js meshes, we cannot use actual immutable data\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/entities/types.js\n ** module id = 196\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/entities/types.js?')},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.remapEntityActions = remapEntityActions;\nexports.remapMetaActions = remapMetaActions;\nexports.remapMeshActions = remapMeshActions;\nexports.remapTransformActions = remapTransformActions;\nexports.remapBoundsActions = remapBoundsActions;\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nvar _utils = __webpack_require__(3);\n\nvar _modelUtils = __webpack_require__(6);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar merge = _rx2.default.Observable.merge;\n\n\n// function to add extra data to all entity component actions\nfunction remapEntityActions(entityActions, currentSelections$) {\n var duplicateInstances$ = entityActions.duplicateInstances$.withLatestFrom(currentSelections$, function (_, selections) {\n // console.log(\"selections to duplicate\",selections)\n var newId = (0, _utils.generateUUID)();\n return selections.map(function (s) {\n return (0, _modelUtils.mergeData)(s, { newId: newId });\n });\n }).share();\n\n var deleteInstances$ = entityActions.deleteInstances$.withLatestFrom(currentSelections$, function (deleteInfos, selections) {\n // console.log(\"I am asked to delete instances\",deleteInfos,selections)\n if (deleteInfos === undefined) {\n // delete by id, based on selections\n return selections;\n } else {\n // delete by typeUid, based on input data\n return deleteInfos;\n }\n }).tap(function (e) {\n return console.log('I am going to delete instances', e);\n }).share();\n\n var mirrorInstances$ = entityActions.mirrorInstances$.withLatestFrom(currentSelections$, function (mirrorInfos, selections) {\n return selections.map(function (s) {\n return (0, _modelUtils.mergeData)(s, mirrorInfos);\n });\n }).share();\n\n return (0, _modelUtils.mergeData)(entityActions, {\n duplicateInstances$: duplicateInstances$,\n deleteInstances$: deleteInstances$,\n mirrorInstances$: mirrorInstances$\n });\n}\n\n// function to add extra data to meta component actions\nfunction remapMetaActions(entityActions, componentBase$, currentSelections$, annotationCreations$) {\n var createComponentsFromBase$ = componentBase$.filter(function (c) {\n return c.length > 0;\n }).map(function (datas) {\n return datas.map(function (_ref) {\n var instUid = _ref.instUid;\n var typeUid = _ref.typeUid;\n var assemblyId = _ref.assemblyId;\n var instance = _ref.instance;\n\n return {\n id: instUid,\n value: { id: instUid, typeUid: typeUid, name: instance.name, assemblyId: assemblyId }\n };\n });\n });\n\n var createComponentsFromAnnots$ = annotationCreations$.filter(function (c) {\n return c.length > 0;\n }).map(function (datas) {\n return datas.map(function (data) {\n console.log('annotation data', data);\n return { id: data.id, value: data };\n });\n });\n\n var createComponents$ = merge(createComponentsFromBase$, createComponentsFromAnnots$, entityActions.createMetaComponents$ // not infered\n ).share();\n // .tap(e=>console.log(\"creating meta component\",e))\n\n var updateComponents$ = entityActions.updateComponent$.filter(function (u) {\n return u.target === 'meta';\n }).pluck('data').withLatestFrom(currentSelections$.map(function (s) {\n return s.map(function (s) {\n return s.id;\n });\n }), function (metaChanges, instIds) {\n return instIds.map(function (instId) {\n return { id: instId, value: metaChanges };\n });\n });\n\n return {\n createComponents$: createComponents$,\n updateComponents$: updateComponents$,\n duplicateComponents$: entityActions.duplicateInstances$,\n removeComponents$: entityActions.deleteInstances$,\n clearDesign$: entityActions.clearDesign$\n };\n}\n\n// function to add extra data to mesh component actions\nfunction remapMeshActions(entityActions, componentBase$) {\n var createComponents$ = componentBase$.filter(function (c) {\n return c.length > 0;\n }).map(function (datas) {\n return datas.map(function (_ref2) {\n var instUid = _ref2.instUid;\n var mesh = _ref2.mesh;\n\n return { id: instUid, value: { mesh: mesh } };\n });\n }).merge(entityActions.createMeshComponents$); // not infered\n // .tap(e=>console.log(\"creating mesh component\",e))\n\n return {\n createComponents$: createComponents$,\n duplicateComponents$: entityActions.duplicateInstances$,\n removeComponents$: entityActions.deleteInstances$,\n clearDesign$: entityActions.clearDesign$\n };\n}\n\n// function to add extra data to transform component actions\nfunction remapTransformActions(entityActions, componentBase$, settings$, currentSelections$) {\n var createComponents$ = componentBase$.filter(function (c) {\n return c.length > 0;\n }).map(function (datas) {\n return datas.map(function (_ref3) {\n var instUid = _ref3.instUid;\n var zOffset = _ref3.zOffset;\n\n return { id: instUid, value: { pos: [0, 0, zOffset] } };\n });\n }).merge(entityActions.createTransformComponents$);\n // .tap(e=>console.log(\"creating transforms component\",e))\n\n var updateComponents$ = entityActions.updateComponent$.filter(function (u) {\n return u.target === 'transforms';\n }).pluck('data').map(_utils.toArray) // we always expect arrays of data\n /*.withLatestFrom(settings$, function (transforms, settings) {\n return transforms.map(function (transform, index) {\n return {id: transform.id, value: transform || transforms[0], settings}\n })\n })*/\n .withLatestFrom(settings$, function (transforms, settings) {\n return transforms.map(function (transform, index) {\n return (0, _modelUtils.mergeData)({}, transform, { settings: settings });\n //return {id: transform.id, value: transform.value || transforms[0].value, settings}\n });\n });\n\n return {\n createComponents$: createComponents$,\n updateComponents$: updateComponents$,\n resetScaling$: entityActions.resetScaling$,\n mirrorComponents$: entityActions.mirrorInstances$,\n duplicateComponents$: entityActions.duplicateInstances$,\n removeComponents$: entityActions.deleteInstances$,\n clearDesign$: entityActions.clearDesign$\n };\n}\n\n// function to add extra data to bounds component actions\nfunction remapBoundsActions(entityActions, componentBase$) {\n var createComponents$ = componentBase$.filter(function (c) {\n return c.length > 0;\n }).map(function (datas) {\n return datas.map(function (_ref4) {\n var instUid = _ref4.instUid;\n var bbox = _ref4.bbox;\n\n return { id: instUid, value: bbox };\n });\n });\n\n return {\n createComponents$: createComponents$,\n duplicateComponents$: entityActions.duplicateInstances$,\n removeComponents$: entityActions.deleteInstances$,\n clearDesign$: entityActions.clearDesign$\n };\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/entities/utils.js\n ** module id = 197\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/entities/utils.js?")},function(module,exports,__webpack_require__){eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = intent;\n\nvar _rx = __webpack_require__(2);\n\nvar _rx2 = _interopRequireDefault(_rx);\n\nvar _utils = __webpack_require__(3);\n\nvar _entityUtils = __webpack_require__(220);\n\nvar _ramda = __webpack_require__(4);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction intent(events, params) {\n var selectEntities$ = events.select('gl').events('selectedMeshes$').map(extractEntities).map(_utils.toArray).shareReplay(1);\n\n var selectBomEntries$ = events.select('bom').events('entryTapped$').map(_utils.toArray).shareReplay(1);\n\n var focusOnEntities$ = events.select('bom').events('entryDoubleTapped$').map(_utils.toArray).shareReplay(1);\n\n var setMultiSelectMode$ = events.select('gl').events('longTaps$').map(function (event) {\n return event.detail.pickingInfos;\n }).filter(function (pickingInfos) {\n return pickingInfos.length > 0;\n }).map(_ramda.head).filter(_utils.exists).pluck('object').filter(_entityUtils.hasEntity).map(_entityUtils.getEntity).map(function (e) {\n return e.id;\n }).merge(events.select('bom').events('entryLongTapped$').pluck('value').filter(_utils.exists).filter(function (x) {\n return x.target && x.target.dataset && Object.keys(x.target.dataset).length > 0;\n }).map(function (e) {\n return { id: e.target.dataset.id, selected: (0, _utils.stringToBoolean)(e.target.dataset.selected) };\n })) //.tap(e=>console.log('fsf',e)))\n\n .map(function (e) {\n return true;\n }).shareReplay(1);\n //.forEach(e=>console.log('setMultiSelectMode', e))\n\n return reverseSelections({\n selectEntities$: selectEntities$,\n selectBomEntries$: selectBomEntries$,\n focusOnEntities$: focusOnEntities$,\n setMultiSelectMode$: setMultiSelectMode$\n }, params);\n}\n\nfunction extractEntities(data) {\n return data.filter(_entityUtils.hasEntity).map(_entityUtils.getEntity).map(function (e) {\n return e.id;\n });\n}\n\nfunction reverseSelections(intents, params) {\n var idsMapper$ = params.idsMapper$;\n var removeTypes$ = params.removeTypes$;\n var removeInstances$ = params.removeInstances$;\n\n // what we want is actually typeUid!\n // select bom entries from entities\n\n var selectBomEntries$ = intents.selectEntities$\n // .do(e=>console.log(\"reversing instance selections to selectBomEntries\"))\n .withLatestFrom(idsMapper$, function (entityIds, idsMapper) {\n return {\n ids: (0, _ramda.flatten)(entityIds.map(function (id) {\n return idsMapper.typeUidFromInstUid[id];\n })).filter(_utils.exists),\n idsMapper: idsMapper\n };\n }).merge(intents.selectBomEntries$.map(function (x) {\n return { ids: (0, _ramda.pluck)('id')(x) };\n }));\n\n // select entities from bom entries\n var selectEntities$ = intents.selectBomEntries$\n // .do(e=>console.log(\"reversing BOM selections to selectEntities\"))\n .withLatestFrom(idsMapper$, function (bomIds, idsMapper) {\n return {\n //if the bom entrys are already selected we want to UNSELECT\n ids: bomIds[0].selected ? [] : (0, _ramda.flatten)(bomIds.map(function (_ref) {\n var id = _ref.id;\n return idsMapper.instUidFromTypeUid[id];\n })).filter(_utils.exists),\n override: true,\n idsMapper: idsMapper\n };\n })\n // .do(e=>console.log(\"selectedEntities\",e))\n //.merge(intents.selectEntities$.map(x => ({ ids: x })))\n .merge(intents.selectEntities$.withLatestFrom(idsMapper$, function (ids, idsMapper) {\n return {\n ids: ids,\n idsMapper: idsMapper\n };\n }));\n\n ///////////\n var selectBomEntries2$ = intents.selectBomEntries$.withLatestFrom(idsMapper$, function (ids, idsMapper) {\n return {\n ids: (0, _ramda.pluck)('id')(ids),\n idsMapper: idsMapper,\n type: 'types'\n };\n });\n\n var selectEntities2$ = intents.selectEntities$.withLatestFrom(idsMapper$, function (ids, idsMapper) {\n return {\n ids: ids,\n idsMapper: idsMapper,\n type: 'instances'\n };\n });\n\n var selectInstancesAndTypes$ = selectEntities2$.merge(selectBomEntries2$);\n\n var focusOnEntities$ = intents.focusOnEntities$.withLatestFrom(idsMapper$, function (bomIds, idsMapper) {\n return (0, _ramda.flatten)(bomIds.map(function (id) {\n return idsMapper.instUidFromTypeUid[id];\n })).filter(_utils.exists);\n }).distinctUntilChanged(null, _ramda.equals);\n\n return {\n focusOnEntities$: focusOnEntities$,\n selectInstancesAndTypes$: selectInstancesAndTypes$,\n removeInstances$: removeInstances$.tap(function (e) {\n return console.log('mlkmkll', e);\n }),\n removeTypes$: removeTypes$,\n setMultiSelectMode$: intents.setMultiSelectMode$\n };\n}\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/core/selections/actions/fromEvents.js\n ** module id = 198\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/core/selections/actions/fromEvents.js?"); diff --git a/src/components/webgl/GlView.js b/src/components/webgl/GlView.js index 8ff457e..0b0c56a 100644 --- a/src/components/webgl/GlView.js +++ b/src/components/webgl/GlView.js @@ -163,7 +163,7 @@ function GLView ({drivers, props$}) { let controls = makeControls(config.controls[0]) // create 'orbit' controls let transformControls = new TransformControls(camera) - let grid = new LabeledGrid(200, 200, 10, config.cameras[0].up) + let grid = new LabeledGrid(215, 215, 10, config.cameras[0].up) let shadowPlane = new ShadowPlane(2000, 2000, null, config.cameras[0].up) const actions = intent({DOM, events: drivers.events}, {camera, scene, transformControls, props$, settings$}) diff --git a/src/components/webgl/deps/OrbitControls.js b/src/components/webgl/deps/OrbitControls.js index c696faa..fc501ec 100644 --- a/src/components/webgl/deps/OrbitControls.js +++ b/src/components/webgl/deps/OrbitControls.js @@ -159,7 +159,7 @@ var OrbitControls = function ( object, domElement, upVector ) { //fireDeActivated() } - camState.thetaDelta /= 1.5 + camState.thetaDelta /= 1.9 camState.phiDelta /= 1.5 camState.scale = 1 } diff --git a/src/components/webgl/presets.js b/src/components/webgl/presets.js index 4b7cfa7..a2fcd67 100644 --- a/src/components/webgl/presets.js +++ b/src/components/webgl/presets.js @@ -25,7 +25,7 @@ export const presets = { controls: [ { up: [0, 0, 1], - rotateSpeed: 2.0, + rotateSpeed: 0.7, panSpeed: 2.0, zoomSpeed: 2.0, autoRotate: { diff --git a/src/interactions/pointers.js b/src/interactions/pointers.js index 45d3056..e349974 100644 --- a/src/interactions/pointers.js +++ b/src/interactions/pointers.js @@ -349,7 +349,7 @@ export function pointerInteractions (baseInteractions) { // drag move interactions (continuously firing) const dragMoves$ = merge( drags3(mouseDowns$, mouseUps$, mouseMoves$, longPressDelay, deltaSqr), - touchDrags(touchStart$, touchEnd$, touchMoves$).throttle(60).tap(e=>console.log('foo')) + touchDrags(touchStart$, touchEnd$, touchMoves$).throttle(40).tap(e=>console.log('foo')) ) .takeUntil(longTaps$).repeat() // no drag moves if there is a context action already taking place