@encorejs/browser-bundles 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +10 -0
- package/README.md +32 -0
- package/dist/core-and-studio.js +42193 -0
- package/dist/core-and-studio.js.map +7 -0
- package/dist/core-only.min.js +15 -0
- package/dist/core-only.min.js.map +7 -0
- package/package.json +32 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../node_modules/lodash-es/isArray.js", "../../../node_modules/lodash-es/_freeGlobal.js", "../../../node_modules/lodash-es/_root.js", "../../../node_modules/lodash-es/_Symbol.js", "../../../node_modules/lodash-es/_getRawTag.js", "../../../node_modules/lodash-es/_objectToString.js", "../../../node_modules/lodash-es/_baseGetTag.js", "../../../node_modules/lodash-es/isObjectLike.js", "../../../node_modules/lodash-es/isSymbol.js", "../../../node_modules/lodash-es/_isKey.js", "../../../node_modules/lodash-es/isObject.js", "../../../node_modules/lodash-es/isFunction.js", "../../../node_modules/lodash-es/_coreJsData.js", "../../../node_modules/lodash-es/_isMasked.js", "../../../node_modules/lodash-es/_toSource.js", "../../../node_modules/lodash-es/_baseIsNative.js", "../../../node_modules/lodash-es/_getValue.js", "../../../node_modules/lodash-es/_getNative.js", "../../../node_modules/lodash-es/_nativeCreate.js", "../../../node_modules/lodash-es/_hashClear.js", "../../../node_modules/lodash-es/_hashDelete.js", "../../../node_modules/lodash-es/_hashGet.js", "../../../node_modules/lodash-es/_hashHas.js", "../../../node_modules/lodash-es/_hashSet.js", "../../../node_modules/lodash-es/_Hash.js", "../../../node_modules/lodash-es/_listCacheClear.js", "../../../node_modules/lodash-es/eq.js", "../../../node_modules/lodash-es/_assocIndexOf.js", "../../../node_modules/lodash-es/_listCacheDelete.js", "../../../node_modules/lodash-es/_listCacheGet.js", "../../../node_modules/lodash-es/_listCacheHas.js", "../../../node_modules/lodash-es/_listCacheSet.js", "../../../node_modules/lodash-es/_ListCache.js", "../../../node_modules/lodash-es/_Map.js", "../../../node_modules/lodash-es/_mapCacheClear.js", "../../../node_modules/lodash-es/_isKeyable.js", "../../../node_modules/lodash-es/_getMapData.js", "../../../node_modules/lodash-es/_mapCacheDelete.js", "../../../node_modules/lodash-es/_mapCacheGet.js", "../../../node_modules/lodash-es/_mapCacheHas.js", "../../../node_modules/lodash-es/_mapCacheSet.js", "../../../node_modules/lodash-es/_MapCache.js", "../../../node_modules/lodash-es/memoize.js", "../../../node_modules/lodash-es/_memoizeCapped.js", "../../../node_modules/lodash-es/_stringToPath.js", "../../../node_modules/lodash-es/_arrayMap.js", "../../../node_modules/lodash-es/_baseToString.js", "../../../node_modules/lodash-es/toString.js", "../../../node_modules/lodash-es/_castPath.js", "../../../node_modules/lodash-es/_toKey.js", "../../../node_modules/lodash-es/_baseGet.js", "../../../node_modules/lodash-es/get.js", "../../../node_modules/lodash-es/_overArg.js", "../../../node_modules/lodash-es/_getPrototype.js", "../../../node_modules/lodash-es/isPlainObject.js", "../../../node_modules/lodash-es/last.js", "../../dataverse/src/pointer.ts", "../../dataverse/src/utils/updateDeep.ts", "../../dataverse/src/utils/Stack.ts", "../../dataverse/src/prism/Interface.ts", "../../dataverse/src/prism/discoveryMechanism.ts", "../../dataverse/src/prism/prism.ts", "../../dataverse/src/Atom.ts", "../../dataverse/src/pointerToPrism.ts", "../../dataverse/src/val.ts", "../../dataverse/src/prism/iterateAndCountTicks.ts", "../../dataverse/src/Ticker.ts", "../../dataverse/src/prism/iterateOver.ts", "../../dataverse/src/PointerProxy.ts", "../../dataverse/src/index.ts", "../../../node_modules/timing-function/lib/UnitBezier.js", "../../../node_modules/levenshtein-edit-distance/index.js", "../../../node_modules/propose/propose.js", "../../../node_modules/fast-deep-equal/index.js", "../../core/src/index.ts", "../../core/src/coreExports.ts", "../../core/src/projects/projectsSingleton.ts", "../../core/src/privateAPIs.ts", "../../utils/src/index.ts", "../../../node_modules/lodash-es/isArray.js", "../../../node_modules/lodash-es/_freeGlobal.js", "../../../node_modules/lodash-es/_root.js", "../../../node_modules/lodash-es/_Symbol.js", "../../../node_modules/lodash-es/_getRawTag.js", "../../../node_modules/lodash-es/_objectToString.js", "../../../node_modules/lodash-es/_baseGetTag.js", "../../../node_modules/lodash-es/isObjectLike.js", "../../../node_modules/lodash-es/isSymbol.js", "../../../node_modules/lodash-es/_isKey.js", "../../../node_modules/lodash-es/isObject.js", "../../../node_modules/lodash-es/isFunction.js", "../../../node_modules/lodash-es/_coreJsData.js", "../../../node_modules/lodash-es/_isMasked.js", "../../../node_modules/lodash-es/_toSource.js", "../../../node_modules/lodash-es/_baseIsNative.js", "../../../node_modules/lodash-es/_getValue.js", "../../../node_modules/lodash-es/_getNative.js", "../../../node_modules/lodash-es/_nativeCreate.js", "../../../node_modules/lodash-es/_hashClear.js", "../../../node_modules/lodash-es/_hashDelete.js", "../../../node_modules/lodash-es/_hashGet.js", "../../../node_modules/lodash-es/_hashHas.js", "../../../node_modules/lodash-es/_hashSet.js", "../../../node_modules/lodash-es/_Hash.js", "../../../node_modules/lodash-es/_listCacheClear.js", "../../../node_modules/lodash-es/eq.js", "../../../node_modules/lodash-es/_assocIndexOf.js", "../../../node_modules/lodash-es/_listCacheDelete.js", "../../../node_modules/lodash-es/_listCacheGet.js", "../../../node_modules/lodash-es/_listCacheHas.js", "../../../node_modules/lodash-es/_listCacheSet.js", "../../../node_modules/lodash-es/_ListCache.js", "../../../node_modules/lodash-es/_Map.js", "../../../node_modules/lodash-es/_mapCacheClear.js", "../../../node_modules/lodash-es/_isKeyable.js", "../../../node_modules/lodash-es/_getMapData.js", "../../../node_modules/lodash-es/_mapCacheDelete.js", "../../../node_modules/lodash-es/_mapCacheGet.js", "../../../node_modules/lodash-es/_mapCacheHas.js", "../../../node_modules/lodash-es/_mapCacheSet.js", "../../../node_modules/lodash-es/_MapCache.js", "../../../node_modules/lodash-es/memoize.js", "../../../node_modules/lodash-es/_memoizeCapped.js", "../../../node_modules/lodash-es/_stringToPath.js", "../../../node_modules/lodash-es/_arrayMap.js", "../../../node_modules/lodash-es/_baseToString.js", "../../../node_modules/lodash-es/toString.js", "../../../node_modules/lodash-es/_castPath.js", "../../../node_modules/lodash-es/_toKey.js", "../../../node_modules/lodash-es/_baseGet.js", "../../../node_modules/lodash-es/get.js", "../../utils/src/getDeep.ts", "../../utils/src/SimpleCache.ts", "../../core/src/sheetObjects/SheetObjectTemplate.ts", "../../../node_modules/lodash-es/_defineProperty.js", "../../../node_modules/lodash-es/_baseAssignValue.js", "../../../node_modules/lodash-es/_assignValue.js", "../../../node_modules/lodash-es/_isIndex.js", "../../../node_modules/lodash-es/_baseSet.js", "../../../node_modules/lodash-es/set.js", "../../core/src/sheetObjects/getPropDefaultsOfSheetObject.ts", "../../core/src/sequences/interpolationTripleAtPosition.ts", "../../core/src/utils/keyframeUtils.ts", "../../utils/src/memoizeFn.ts", "../../../node_modules/lodash-es/_trimmedEndIndex.js", "../../../node_modules/lodash-es/_baseTrim.js", "../../../node_modules/lodash-es/toNumber.js", "../../../node_modules/lodash-es/toFinite.js", "../../../node_modules/lodash-es/toInteger.js", "../../../node_modules/lodash-es/identity.js", "../../../node_modules/lodash-es/_WeakMap.js", "../../../node_modules/lodash-es/_baseCreate.js", "../../../node_modules/lodash-es/_copyArray.js", "../../../node_modules/lodash-es/_arrayEach.js", "../../../node_modules/lodash-es/_copyObject.js", "../../../node_modules/lodash-es/isLength.js", "../../../node_modules/lodash-es/isArrayLike.js", "../../../node_modules/lodash-es/_isPrototype.js", "../../../node_modules/lodash-es/_baseTimes.js", "../../../node_modules/lodash-es/_baseIsArguments.js", "../../../node_modules/lodash-es/isArguments.js", "../../../node_modules/lodash-es/stubFalse.js", "../../../node_modules/lodash-es/isBuffer.js", "../../../node_modules/lodash-es/_baseIsTypedArray.js", "../../../node_modules/lodash-es/_baseUnary.js", "../../../node_modules/lodash-es/_nodeUtil.js", "../../../node_modules/lodash-es/isTypedArray.js", "../../../node_modules/lodash-es/_arrayLikeKeys.js", "../../../node_modules/lodash-es/_overArg.js", "../../../node_modules/lodash-es/_nativeKeys.js", "../../../node_modules/lodash-es/_baseKeys.js", "../../../node_modules/lodash-es/keys.js", "../../../node_modules/lodash-es/_nativeKeysIn.js", "../../../node_modules/lodash-es/_baseKeysIn.js", "../../../node_modules/lodash-es/keysIn.js", "../../../node_modules/lodash-es/_arrayPush.js", "../../../node_modules/lodash-es/_getPrototype.js", "../../../node_modules/lodash-es/isPlainObject.js", "../../../node_modules/lodash-es/_baseSlice.js", "../../../node_modules/lodash-es/_castSlice.js", "../../../node_modules/lodash-es/_hasUnicode.js", "../../../node_modules/lodash-es/_asciiToArray.js", "../../../node_modules/lodash-es/_unicodeToArray.js", "../../../node_modules/lodash-es/_stringToArray.js", "../../../node_modules/lodash-es/_baseClamp.js", "../../../node_modules/lodash-es/clamp.js", "../../../node_modules/lodash-es/_stackClear.js", "../../../node_modules/lodash-es/_stackDelete.js", "../../../node_modules/lodash-es/_stackGet.js", "../../../node_modules/lodash-es/_stackHas.js", "../../../node_modules/lodash-es/_stackSet.js", "../../../node_modules/lodash-es/_Stack.js", "../../../node_modules/lodash-es/_baseAssign.js", "../../../node_modules/lodash-es/_baseAssignIn.js", "../../../node_modules/lodash-es/_cloneBuffer.js", "../../../node_modules/lodash-es/_arrayFilter.js", "../../../node_modules/lodash-es/stubArray.js", "../../../node_modules/lodash-es/_getSymbols.js", "../../../node_modules/lodash-es/_copySymbols.js", "../../../node_modules/lodash-es/_getSymbolsIn.js", "../../../node_modules/lodash-es/_copySymbolsIn.js", "../../../node_modules/lodash-es/_baseGetAllKeys.js", "../../../node_modules/lodash-es/_getAllKeys.js", "../../../node_modules/lodash-es/_getAllKeysIn.js", "../../../node_modules/lodash-es/_DataView.js", "../../../node_modules/lodash-es/_Promise.js", "../../../node_modules/lodash-es/_Set.js", "../../../node_modules/lodash-es/_getTag.js", "../../../node_modules/lodash-es/_initCloneArray.js", "../../../node_modules/lodash-es/_Uint8Array.js", "../../../node_modules/lodash-es/_cloneArrayBuffer.js", "../../../node_modules/lodash-es/_cloneDataView.js", "../../../node_modules/lodash-es/_cloneRegExp.js", "../../../node_modules/lodash-es/_cloneSymbol.js", "../../../node_modules/lodash-es/_cloneTypedArray.js", "../../../node_modules/lodash-es/_initCloneByTag.js", "../../../node_modules/lodash-es/_initCloneObject.js", "../../../node_modules/lodash-es/_baseIsMap.js", "../../../node_modules/lodash-es/isMap.js", "../../../node_modules/lodash-es/_baseIsSet.js", "../../../node_modules/lodash-es/isSet.js", "../../../node_modules/lodash-es/_baseClone.js", "../../../node_modules/lodash-es/cloneDeep.js", "../../../node_modules/lodash-es/_setCacheAdd.js", "../../../node_modules/lodash-es/_setCacheHas.js", "../../../node_modules/lodash-es/_SetCache.js", "../../../node_modules/lodash-es/_arraySome.js", "../../../node_modules/lodash-es/_cacheHas.js", "../../../node_modules/lodash-es/_equalArrays.js", "../../../node_modules/lodash-es/_mapToArray.js", "../../../node_modules/lodash-es/_setToArray.js", "../../../node_modules/lodash-es/_equalByTag.js", "../../../node_modules/lodash-es/_equalObjects.js", "../../../node_modules/lodash-es/_baseIsEqualDeep.js", "../../../node_modules/lodash-es/_baseIsEqual.js", "../../../node_modules/lodash-es/_baseIsMatch.js", "../../../node_modules/lodash-es/_isStrictComparable.js", "../../../node_modules/lodash-es/_getMatchData.js", "../../../node_modules/lodash-es/_matchesStrictComparable.js", "../../../node_modules/lodash-es/_baseMatches.js", "../../../node_modules/lodash-es/_baseHasIn.js", "../../../node_modules/lodash-es/_hasPath.js", "../../../node_modules/lodash-es/hasIn.js", "../../../node_modules/lodash-es/_baseMatchesProperty.js", "../../../node_modules/lodash-es/_baseProperty.js", "../../../node_modules/lodash-es/_basePropertyDeep.js", "../../../node_modules/lodash-es/property.js", "../../../node_modules/lodash-es/_baseIteratee.js", "../../../node_modules/lodash-es/_createBaseFor.js", "../../../node_modules/lodash-es/_baseFor.js", "../../../node_modules/lodash-es/_baseForOwn.js", "../../../node_modules/lodash-es/now.js", "../../../node_modules/lodash-es/debounce.js", "../../../node_modules/lodash-es/last.js", "../../../node_modules/lodash-es/_parent.js", "../../../node_modules/lodash-es/isInteger.js", "../../../node_modules/lodash-es/mapValues.js", "../../../node_modules/lodash-es/_baseUnset.js", "../../../node_modules/lodash-es/_baseRepeat.js", "../../../node_modules/lodash-es/_asciiSize.js", "../../../node_modules/lodash-es/_unicodeSize.js", "../../../node_modules/lodash-es/_stringSize.js", "../../../node_modules/lodash-es/_createPadding.js", "../../../node_modules/lodash-es/padStart.js", "../../../node_modules/lodash-es/unset.js", "../../utils/src/deepMergeWithCache.ts", "../../utils/src/pointerDeep.ts", "../../utils/src/valToAtom.ts", "../../core/src/sheetObjects/SheetObject.ts", "../../core/src/sheetObjects/TheatreSheetObject.ts", "../../core/src/propTypes/utils.ts", "../../core/src/sheetObjects/getOrderingOfPropTypeConfig.ts", "../../core/src/sheets/SheetTemplate.ts", "../../utils/src/pathToProp.ts", "../../utils/src/didYouMean.ts", "../../utils/src/errors.ts", "../../core/src/sequences/Sequence.ts", "../../utils/src/defer.ts", "../../utils/src/noop.ts", "../../core/src/sequences/playbackControllers/DefaultPlaybackController.ts", "../../core/src/sequences/playbackControllers/AudioPlaybackController.ts", "../../core/src/globals.ts", "../../core/src/utils/notify.ts", "../../core/src/rafDrivers.ts", "../../core/src/coreTicker.ts", "../../core/src/sequences/TheatreSequence.ts", "../../core/src/utils/instanceTypes.ts", "../../core/src/propTypes/index.ts", "../../utils/src/ellipsify.ts", "../../utils/src/userReadableTypeOfValue.ts", "../../utils/src/color.ts", "../../core/src/types/public.ts", "../../core/src/propTypes/internals.ts", "../../utils/src/slashedPaths.ts", "../../core/src/sheets/TheatreSheet.ts", "../../core/src/sheets/Sheet.ts", "../../core/src/projects/Project.ts", "../../utils/src/delay.ts", "../../core/src/projects/initialiseProjectState.ts", "../../core/src/projects/TheatreProject.ts", "../../core/src/utils/ids.ts", "../../core/src/env.ts", "../../core/src/CoreBundle.ts", "../src/core-only.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Checks if `value` is classified as an `Array` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array, else `false`.\n * @example\n *\n * _.isArray([1, 2, 3]);\n * // => true\n *\n * _.isArray(document.body.children);\n * // => false\n *\n * _.isArray('abc');\n * // => false\n *\n * _.isArray(_.noop);\n * // => false\n */\nvar isArray = Array.isArray;\n\nexport default isArray;\n", "/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\nexport default freeGlobal;\n", "import freeGlobal from './_freeGlobal.js';\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\nexport default root;\n", "import root from './_root.js';\n\n/** Built-in value references. */\nvar Symbol = root.Symbol;\n\nexport default Symbol;\n", "import Symbol from './_Symbol.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the raw `toStringTag`.\n */\nfunction getRawTag(value) {\n var isOwn = hasOwnProperty.call(value, symToStringTag),\n tag = value[symToStringTag];\n\n try {\n value[symToStringTag] = undefined;\n var unmasked = true;\n } catch (e) {}\n\n var result = nativeObjectToString.call(value);\n if (unmasked) {\n if (isOwn) {\n value[symToStringTag] = tag;\n } else {\n delete value[symToStringTag];\n }\n }\n return result;\n}\n\nexport default getRawTag;\n", "/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/**\n * Converts `value` to a string using `Object.prototype.toString`.\n *\n * @private\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n */\nfunction objectToString(value) {\n return nativeObjectToString.call(value);\n}\n\nexport default objectToString;\n", "import Symbol from './_Symbol.js';\nimport getRawTag from './_getRawTag.js';\nimport objectToString from './_objectToString.js';\n\n/** `Object#toString` result references. */\nvar nullTag = '[object Null]',\n undefinedTag = '[object Undefined]';\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * The base implementation of `getTag` without fallbacks for buggy environments.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nfunction baseGetTag(value) {\n if (value == null) {\n return value === undefined ? undefinedTag : nullTag;\n }\n return (symToStringTag && symToStringTag in Object(value))\n ? getRawTag(value)\n : objectToString(value);\n}\n\nexport default baseGetTag;\n", "/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return value != null && typeof value == 'object';\n}\n\nexport default isObjectLike;\n", "import baseGetTag from './_baseGetTag.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** `Object#toString` result references. */\nvar symbolTag = '[object Symbol]';\n\n/**\n * Checks if `value` is classified as a `Symbol` primitive or object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.\n * @example\n *\n * _.isSymbol(Symbol.iterator);\n * // => true\n *\n * _.isSymbol('abc');\n * // => false\n */\nfunction isSymbol(value) {\n return typeof value == 'symbol' ||\n (isObjectLike(value) && baseGetTag(value) == symbolTag);\n}\n\nexport default isSymbol;\n", "import isArray from './isArray.js';\nimport isSymbol from './isSymbol.js';\n\n/** Used to match property names within property paths. */\nvar reIsDeepProp = /\\.|\\[(?:[^[\\]]*|([\"'])(?:(?!\\1)[^\\\\]|\\\\.)*?\\1)\\]/,\n reIsPlainProp = /^\\w*$/;\n\n/**\n * Checks if `value` is a property name and not a property path.\n *\n * @private\n * @param {*} value The value to check.\n * @param {Object} [object] The object to query keys on.\n * @returns {boolean} Returns `true` if `value` is a property name, else `false`.\n */\nfunction isKey(value, object) {\n if (isArray(value)) {\n return false;\n }\n var type = typeof value;\n if (type == 'number' || type == 'symbol' || type == 'boolean' ||\n value == null || isSymbol(value)) {\n return true;\n }\n return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||\n (object != null && value in Object(object));\n}\n\nexport default isKey;\n", "/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return value != null && (type == 'object' || type == 'function');\n}\n\nexport default isObject;\n", "import baseGetTag from './_baseGetTag.js';\nimport isObject from './isObject.js';\n\n/** `Object#toString` result references. */\nvar asyncTag = '[object AsyncFunction]',\n funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]',\n proxyTag = '[object Proxy]';\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a function, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n if (!isObject(value)) {\n return false;\n }\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in Safari 9 which returns 'object' for typed arrays and other constructors.\n var tag = baseGetTag(value);\n return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;\n}\n\nexport default isFunction;\n", "import root from './_root.js';\n\n/** Used to detect overreaching core-js shims. */\nvar coreJsData = root['__core-js_shared__'];\n\nexport default coreJsData;\n", "import coreJsData from './_coreJsData.js';\n\n/** Used to detect methods masquerading as native. */\nvar maskSrcKey = (function() {\n var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');\n return uid ? ('Symbol(src)_1.' + uid) : '';\n}());\n\n/**\n * Checks if `func` has its source masked.\n *\n * @private\n * @param {Function} func The function to check.\n * @returns {boolean} Returns `true` if `func` is masked, else `false`.\n */\nfunction isMasked(func) {\n return !!maskSrcKey && (maskSrcKey in func);\n}\n\nexport default isMasked;\n", "/** Used for built-in method references. */\nvar funcProto = Function.prototype;\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString = funcProto.toString;\n\n/**\n * Converts `func` to its source code.\n *\n * @private\n * @param {Function} func The function to convert.\n * @returns {string} Returns the source code.\n */\nfunction toSource(func) {\n if (func != null) {\n try {\n return funcToString.call(func);\n } catch (e) {}\n try {\n return (func + '');\n } catch (e) {}\n }\n return '';\n}\n\nexport default toSource;\n", "import isFunction from './isFunction.js';\nimport isMasked from './_isMasked.js';\nimport isObject from './isObject.js';\nimport toSource from './_toSource.js';\n\n/**\n * Used to match `RegExp`\n * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).\n */\nvar reRegExpChar = /[\\\\^$.*+?()[\\]{}|]/g;\n\n/** Used to detect host constructors (Safari). */\nvar reIsHostCtor = /^\\[object .+?Constructor\\]$/;\n\n/** Used for built-in method references. */\nvar funcProto = Function.prototype,\n objectProto = Object.prototype;\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString = funcProto.toString;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/** Used to detect if a method is native. */\nvar reIsNative = RegExp('^' +\n funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\\\$&')\n .replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g, '$1.*?') + '$'\n);\n\n/**\n * The base implementation of `_.isNative` without bad shim checks.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a native function,\n * else `false`.\n */\nfunction baseIsNative(value) {\n if (!isObject(value) || isMasked(value)) {\n return false;\n }\n var pattern = isFunction(value) ? reIsNative : reIsHostCtor;\n return pattern.test(toSource(value));\n}\n\nexport default baseIsNative;\n", "/**\n * Gets the value at `key` of `object`.\n *\n * @private\n * @param {Object} [object] The object to query.\n * @param {string} key The key of the property to get.\n * @returns {*} Returns the property value.\n */\nfunction getValue(object, key) {\n return object == null ? undefined : object[key];\n}\n\nexport default getValue;\n", "import baseIsNative from './_baseIsNative.js';\nimport getValue from './_getValue.js';\n\n/**\n * Gets the native function at `key` of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {string} key The key of the method to get.\n * @returns {*} Returns the function if it's native, else `undefined`.\n */\nfunction getNative(object, key) {\n var value = getValue(object, key);\n return baseIsNative(value) ? value : undefined;\n}\n\nexport default getNative;\n", "import getNative from './_getNative.js';\n\n/* Built-in method references that are verified to be native. */\nvar nativeCreate = getNative(Object, 'create');\n\nexport default nativeCreate;\n", "import nativeCreate from './_nativeCreate.js';\n\n/**\n * Removes all key-value entries from the hash.\n *\n * @private\n * @name clear\n * @memberOf Hash\n */\nfunction hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n}\n\nexport default hashClear;\n", "/**\n * Removes `key` and its value from the hash.\n *\n * @private\n * @name delete\n * @memberOf Hash\n * @param {Object} hash The hash to modify.\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction hashDelete(key) {\n var result = this.has(key) && delete this.__data__[key];\n this.size -= result ? 1 : 0;\n return result;\n}\n\nexport default hashDelete;\n", "import nativeCreate from './_nativeCreate.js';\n\n/** Used to stand-in for `undefined` hash values. */\nvar HASH_UNDEFINED = '__lodash_hash_undefined__';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Gets the hash value for `key`.\n *\n * @private\n * @name get\n * @memberOf Hash\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction hashGet(key) {\n var data = this.__data__;\n if (nativeCreate) {\n var result = data[key];\n return result === HASH_UNDEFINED ? undefined : result;\n }\n return hasOwnProperty.call(data, key) ? data[key] : undefined;\n}\n\nexport default hashGet;\n", "import nativeCreate from './_nativeCreate.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Checks if a hash value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Hash\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction hashHas(key) {\n var data = this.__data__;\n return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);\n}\n\nexport default hashHas;\n", "import nativeCreate from './_nativeCreate.js';\n\n/** Used to stand-in for `undefined` hash values. */\nvar HASH_UNDEFINED = '__lodash_hash_undefined__';\n\n/**\n * Sets the hash `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf Hash\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the hash instance.\n */\nfunction hashSet(key, value) {\n var data = this.__data__;\n this.size += this.has(key) ? 0 : 1;\n data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;\n return this;\n}\n\nexport default hashSet;\n", "import hashClear from './_hashClear.js';\nimport hashDelete from './_hashDelete.js';\nimport hashGet from './_hashGet.js';\nimport hashHas from './_hashHas.js';\nimport hashSet from './_hashSet.js';\n\n/**\n * Creates a hash object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction Hash(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n// Add methods to `Hash`.\nHash.prototype.clear = hashClear;\nHash.prototype['delete'] = hashDelete;\nHash.prototype.get = hashGet;\nHash.prototype.has = hashHas;\nHash.prototype.set = hashSet;\n\nexport default Hash;\n", "/**\n * Removes all key-value entries from the list cache.\n *\n * @private\n * @name clear\n * @memberOf ListCache\n */\nfunction listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n}\n\nexport default listCacheClear;\n", "/**\n * Performs a\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * comparison between two values to determine if they are equivalent.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * var object = { 'a': 1 };\n * var other = { 'a': 1 };\n *\n * _.eq(object, object);\n * // => true\n *\n * _.eq(object, other);\n * // => false\n *\n * _.eq('a', 'a');\n * // => true\n *\n * _.eq('a', Object('a'));\n * // => false\n *\n * _.eq(NaN, NaN);\n * // => true\n */\nfunction eq(value, other) {\n return value === other || (value !== value && other !== other);\n}\n\nexport default eq;\n", "import eq from './eq.js';\n\n/**\n * Gets the index at which the `key` is found in `array` of key-value pairs.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} key The key to search for.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\nfunction assocIndexOf(array, key) {\n var length = array.length;\n while (length--) {\n if (eq(array[length][0], key)) {\n return length;\n }\n }\n return -1;\n}\n\nexport default assocIndexOf;\n", "import assocIndexOf from './_assocIndexOf.js';\n\n/** Used for built-in method references. */\nvar arrayProto = Array.prototype;\n\n/** Built-in value references. */\nvar splice = arrayProto.splice;\n\n/**\n * Removes `key` and its value from the list cache.\n *\n * @private\n * @name delete\n * @memberOf ListCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction listCacheDelete(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n return false;\n }\n var lastIndex = data.length - 1;\n if (index == lastIndex) {\n data.pop();\n } else {\n splice.call(data, index, 1);\n }\n --this.size;\n return true;\n}\n\nexport default listCacheDelete;\n", "import assocIndexOf from './_assocIndexOf.js';\n\n/**\n * Gets the list cache value for `key`.\n *\n * @private\n * @name get\n * @memberOf ListCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction listCacheGet(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n return index < 0 ? undefined : data[index][1];\n}\n\nexport default listCacheGet;\n", "import assocIndexOf from './_assocIndexOf.js';\n\n/**\n * Checks if a list cache value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf ListCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction listCacheHas(key) {\n return assocIndexOf(this.__data__, key) > -1;\n}\n\nexport default listCacheHas;\n", "import assocIndexOf from './_assocIndexOf.js';\n\n/**\n * Sets the list cache `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf ListCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the list cache instance.\n */\nfunction listCacheSet(key, value) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n ++this.size;\n data.push([key, value]);\n } else {\n data[index][1] = value;\n }\n return this;\n}\n\nexport default listCacheSet;\n", "import listCacheClear from './_listCacheClear.js';\nimport listCacheDelete from './_listCacheDelete.js';\nimport listCacheGet from './_listCacheGet.js';\nimport listCacheHas from './_listCacheHas.js';\nimport listCacheSet from './_listCacheSet.js';\n\n/**\n * Creates an list cache object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction ListCache(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n// Add methods to `ListCache`.\nListCache.prototype.clear = listCacheClear;\nListCache.prototype['delete'] = listCacheDelete;\nListCache.prototype.get = listCacheGet;\nListCache.prototype.has = listCacheHas;\nListCache.prototype.set = listCacheSet;\n\nexport default ListCache;\n", "import getNative from './_getNative.js';\nimport root from './_root.js';\n\n/* Built-in method references that are verified to be native. */\nvar Map = getNative(root, 'Map');\n\nexport default Map;\n", "import Hash from './_Hash.js';\nimport ListCache from './_ListCache.js';\nimport Map from './_Map.js';\n\n/**\n * Removes all key-value entries from the map.\n *\n * @private\n * @name clear\n * @memberOf MapCache\n */\nfunction mapCacheClear() {\n this.size = 0;\n this.__data__ = {\n 'hash': new Hash,\n 'map': new (Map || ListCache),\n 'string': new Hash\n };\n}\n\nexport default mapCacheClear;\n", "/**\n * Checks if `value` is suitable for use as unique object key.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is suitable, else `false`.\n */\nfunction isKeyable(value) {\n var type = typeof value;\n return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')\n ? (value !== '__proto__')\n : (value === null);\n}\n\nexport default isKeyable;\n", "import isKeyable from './_isKeyable.js';\n\n/**\n * Gets the data for `map`.\n *\n * @private\n * @param {Object} map The map to query.\n * @param {string} key The reference key.\n * @returns {*} Returns the map data.\n */\nfunction getMapData(map, key) {\n var data = map.__data__;\n return isKeyable(key)\n ? data[typeof key == 'string' ? 'string' : 'hash']\n : data.map;\n}\n\nexport default getMapData;\n", "import getMapData from './_getMapData.js';\n\n/**\n * Removes `key` and its value from the map.\n *\n * @private\n * @name delete\n * @memberOf MapCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction mapCacheDelete(key) {\n var result = getMapData(this, key)['delete'](key);\n this.size -= result ? 1 : 0;\n return result;\n}\n\nexport default mapCacheDelete;\n", "import getMapData from './_getMapData.js';\n\n/**\n * Gets the map value for `key`.\n *\n * @private\n * @name get\n * @memberOf MapCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction mapCacheGet(key) {\n return getMapData(this, key).get(key);\n}\n\nexport default mapCacheGet;\n", "import getMapData from './_getMapData.js';\n\n/**\n * Checks if a map value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf MapCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction mapCacheHas(key) {\n return getMapData(this, key).has(key);\n}\n\nexport default mapCacheHas;\n", "import getMapData from './_getMapData.js';\n\n/**\n * Sets the map `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf MapCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the map cache instance.\n */\nfunction mapCacheSet(key, value) {\n var data = getMapData(this, key),\n size = data.size;\n\n data.set(key, value);\n this.size += data.size == size ? 0 : 1;\n return this;\n}\n\nexport default mapCacheSet;\n", "import mapCacheClear from './_mapCacheClear.js';\nimport mapCacheDelete from './_mapCacheDelete.js';\nimport mapCacheGet from './_mapCacheGet.js';\nimport mapCacheHas from './_mapCacheHas.js';\nimport mapCacheSet from './_mapCacheSet.js';\n\n/**\n * Creates a map cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction MapCache(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n// Add methods to `MapCache`.\nMapCache.prototype.clear = mapCacheClear;\nMapCache.prototype['delete'] = mapCacheDelete;\nMapCache.prototype.get = mapCacheGet;\nMapCache.prototype.has = mapCacheHas;\nMapCache.prototype.set = mapCacheSet;\n\nexport default MapCache;\n", "import MapCache from './_MapCache.js';\n\n/** Error message constants. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/**\n * Creates a function that memoizes the result of `func`. If `resolver` is\n * provided, it determines the cache key for storing the result based on the\n * arguments provided to the memoized function. By default, the first argument\n * provided to the memoized function is used as the map cache key. The `func`\n * is invoked with the `this` binding of the memoized function.\n *\n * **Note:** The cache is exposed as the `cache` property on the memoized\n * function. Its creation may be customized by replacing the `_.memoize.Cache`\n * constructor with one whose instances implement the\n * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)\n * method interface of `clear`, `delete`, `get`, `has`, and `set`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to have its output memoized.\n * @param {Function} [resolver] The function to resolve the cache key.\n * @returns {Function} Returns the new memoized function.\n * @example\n *\n * var object = { 'a': 1, 'b': 2 };\n * var other = { 'c': 3, 'd': 4 };\n *\n * var values = _.memoize(_.values);\n * values(object);\n * // => [1, 2]\n *\n * values(other);\n * // => [3, 4]\n *\n * object.a = 2;\n * values(object);\n * // => [1, 2]\n *\n * // Modify the result cache.\n * values.cache.set(object, ['a', 'b']);\n * values(object);\n * // => ['a', 'b']\n *\n * // Replace `_.memoize.Cache`.\n * _.memoize.Cache = WeakMap;\n */\nfunction memoize(func, resolver) {\n if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n var memoized = function() {\n var args = arguments,\n key = resolver ? resolver.apply(this, args) : args[0],\n cache = memoized.cache;\n\n if (cache.has(key)) {\n return cache.get(key);\n }\n var result = func.apply(this, args);\n memoized.cache = cache.set(key, result) || cache;\n return result;\n };\n memoized.cache = new (memoize.Cache || MapCache);\n return memoized;\n}\n\n// Expose `MapCache`.\nmemoize.Cache = MapCache;\n\nexport default memoize;\n", "import memoize from './memoize.js';\n\n/** Used as the maximum memoize cache size. */\nvar MAX_MEMOIZE_SIZE = 500;\n\n/**\n * A specialized version of `_.memoize` which clears the memoized function's\n * cache when it exceeds `MAX_MEMOIZE_SIZE`.\n *\n * @private\n * @param {Function} func The function to have its output memoized.\n * @returns {Function} Returns the new memoized function.\n */\nfunction memoizeCapped(func) {\n var result = memoize(func, function(key) {\n if (cache.size === MAX_MEMOIZE_SIZE) {\n cache.clear();\n }\n return key;\n });\n\n var cache = result.cache;\n return result;\n}\n\nexport default memoizeCapped;\n", "import memoizeCapped from './_memoizeCapped.js';\n\n/** Used to match property names within property paths. */\nvar rePropName = /[^.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|([\"'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))/g;\n\n/** Used to match backslashes in property paths. */\nvar reEscapeChar = /\\\\(\\\\)?/g;\n\n/**\n * Converts `string` to a property path array.\n *\n * @private\n * @param {string} string The string to convert.\n * @returns {Array} Returns the property path array.\n */\nvar stringToPath = memoizeCapped(function(string) {\n var result = [];\n if (string.charCodeAt(0) === 46 /* . */) {\n result.push('');\n }\n string.replace(rePropName, function(match, number, quote, subString) {\n result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));\n });\n return result;\n});\n\nexport default stringToPath;\n", "/**\n * A specialized version of `_.map` for arrays without support for iteratee\n * shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the new mapped array.\n */\nfunction arrayMap(array, iteratee) {\n var index = -1,\n length = array == null ? 0 : array.length,\n result = Array(length);\n\n while (++index < length) {\n result[index] = iteratee(array[index], index, array);\n }\n return result;\n}\n\nexport default arrayMap;\n", "import Symbol from './_Symbol.js';\nimport arrayMap from './_arrayMap.js';\nimport isArray from './isArray.js';\nimport isSymbol from './isSymbol.js';\n\n/** Used as references for various `Number` constants. */\nvar INFINITY = 1 / 0;\n\n/** Used to convert symbols to primitives and strings. */\nvar symbolProto = Symbol ? Symbol.prototype : undefined,\n symbolToString = symbolProto ? symbolProto.toString : undefined;\n\n/**\n * The base implementation of `_.toString` which doesn't convert nullish\n * values to empty strings.\n *\n * @private\n * @param {*} value The value to process.\n * @returns {string} Returns the string.\n */\nfunction baseToString(value) {\n // Exit early for strings to avoid a performance hit in some environments.\n if (typeof value == 'string') {\n return value;\n }\n if (isArray(value)) {\n // Recursively convert values (susceptible to call stack limits).\n return arrayMap(value, baseToString) + '';\n }\n if (isSymbol(value)) {\n return symbolToString ? symbolToString.call(value) : '';\n }\n var result = (value + '');\n return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;\n}\n\nexport default baseToString;\n", "import baseToString from './_baseToString.js';\n\n/**\n * Converts `value` to a string. An empty string is returned for `null`\n * and `undefined` values. The sign of `-0` is preserved.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n * @example\n *\n * _.toString(null);\n * // => ''\n *\n * _.toString(-0);\n * // => '-0'\n *\n * _.toString([1, 2, 3]);\n * // => '1,2,3'\n */\nfunction toString(value) {\n return value == null ? '' : baseToString(value);\n}\n\nexport default toString;\n", "import isArray from './isArray.js';\nimport isKey from './_isKey.js';\nimport stringToPath from './_stringToPath.js';\nimport toString from './toString.js';\n\n/**\n * Casts `value` to a path array if it's not one.\n *\n * @private\n * @param {*} value The value to inspect.\n * @param {Object} [object] The object to query keys on.\n * @returns {Array} Returns the cast property path array.\n */\nfunction castPath(value, object) {\n if (isArray(value)) {\n return value;\n }\n return isKey(value, object) ? [value] : stringToPath(toString(value));\n}\n\nexport default castPath;\n", "import isSymbol from './isSymbol.js';\n\n/** Used as references for various `Number` constants. */\nvar INFINITY = 1 / 0;\n\n/**\n * Converts `value` to a string key if it's not a string or symbol.\n *\n * @private\n * @param {*} value The value to inspect.\n * @returns {string|symbol} Returns the key.\n */\nfunction toKey(value) {\n if (typeof value == 'string' || isSymbol(value)) {\n return value;\n }\n var result = (value + '');\n return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;\n}\n\nexport default toKey;\n", "import castPath from './_castPath.js';\nimport toKey from './_toKey.js';\n\n/**\n * The base implementation of `_.get` without support for default values.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array|string} path The path of the property to get.\n * @returns {*} Returns the resolved value.\n */\nfunction baseGet(object, path) {\n path = castPath(path, object);\n\n var index = 0,\n length = path.length;\n\n while (object != null && index < length) {\n object = object[toKey(path[index++])];\n }\n return (index && index == length) ? object : undefined;\n}\n\nexport default baseGet;\n", "import baseGet from './_baseGet.js';\n\n/**\n * Gets the value at `path` of `object`. If the resolved value is\n * `undefined`, the `defaultValue` is returned in its place.\n *\n * @static\n * @memberOf _\n * @since 3.7.0\n * @category Object\n * @param {Object} object The object to query.\n * @param {Array|string} path The path of the property to get.\n * @param {*} [defaultValue] The value returned for `undefined` resolved values.\n * @returns {*} Returns the resolved value.\n * @example\n *\n * var object = { 'a': [{ 'b': { 'c': 3 } }] };\n *\n * _.get(object, 'a[0].b.c');\n * // => 3\n *\n * _.get(object, ['a', '0', 'b', 'c']);\n * // => 3\n *\n * _.get(object, 'a.b.c', 'default');\n * // => 'default'\n */\nfunction get(object, path, defaultValue) {\n var result = object == null ? undefined : baseGet(object, path);\n return result === undefined ? defaultValue : result;\n}\n\nexport default get;\n", "/**\n * Creates a unary function that invokes `func` with its argument transformed.\n *\n * @private\n * @param {Function} func The function to wrap.\n * @param {Function} transform The argument transform.\n * @returns {Function} Returns the new function.\n */\nfunction overArg(func, transform) {\n return function(arg) {\n return func(transform(arg));\n };\n}\n\nexport default overArg;\n", "import overArg from './_overArg.js';\n\n/** Built-in value references. */\nvar getPrototype = overArg(Object.getPrototypeOf, Object);\n\nexport default getPrototype;\n", "import baseGetTag from './_baseGetTag.js';\nimport getPrototype from './_getPrototype.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** `Object#toString` result references. */\nvar objectTag = '[object Object]';\n\n/** Used for built-in method references. */\nvar funcProto = Function.prototype,\n objectProto = Object.prototype;\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString = funcProto.toString;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/** Used to infer the `Object` constructor. */\nvar objectCtorString = funcToString.call(Object);\n\n/**\n * Checks if `value` is a plain object, that is, an object created by the\n * `Object` constructor or one with a `[[Prototype]]` of `null`.\n *\n * @static\n * @memberOf _\n * @since 0.8.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * }\n *\n * _.isPlainObject(new Foo);\n * // => false\n *\n * _.isPlainObject([1, 2, 3]);\n * // => false\n *\n * _.isPlainObject({ 'x': 0, 'y': 0 });\n * // => true\n *\n * _.isPlainObject(Object.create(null));\n * // => true\n */\nfunction isPlainObject(value) {\n if (!isObjectLike(value) || baseGetTag(value) != objectTag) {\n return false;\n }\n var proto = getPrototype(value);\n if (proto === null) {\n return true;\n }\n var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;\n return typeof Ctor == 'function' && Ctor instanceof Ctor &&\n funcToString.call(Ctor) == objectCtorString;\n}\n\nexport default isPlainObject;\n", "/**\n * Gets the last element of `array`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to query.\n * @returns {*} Returns the last element of `array`.\n * @example\n *\n * _.last([1, 2, 3]);\n * // => 3\n */\nfunction last(array) {\n var length = array == null ? 0 : array.length;\n return length ? array[length - 1] : undefined;\n}\n\nexport default last;\n", "import type {$IntentionalAny} from './types'\r\n\r\ntype PathToProp = Array<string | number>\r\n\r\nexport type PointerMeta = {\r\n root: {}\r\n path: (string | number)[]\r\n}\r\n\r\n/** We are using an empty object as a WeakMap key for storing pointer meta data */\r\ntype WeakPointerKey = {}\r\n\r\nexport type UnindexableTypesForPointer =\r\n | number\r\n | string\r\n | boolean\r\n | null\r\n | void\r\n | undefined\r\n | Function // eslint-disable-line @typescript-eslint/ban-types\r\n\r\nexport type UnindexablePointer = {\r\n [K in $IntentionalAny]: Pointer<undefined>\r\n}\r\n\r\nconst pointerMetaWeakMap = new WeakMap<WeakPointerKey, PointerMeta>()\r\nconst cachedSubPathPointersWeakMap = new WeakMap<\r\n WeakPointerKey,\r\n Map<string | number, Pointer<unknown>>\r\n>()\r\n\r\n/**\r\n * A wrapper type for the type a `Pointer` points to.\r\n */\r\nexport type PointerType<O> = {\r\n /**\r\n * Only accessible via the type system.\r\n * This is a helper for getting the underlying pointer type\r\n * via the type space.\r\n */\r\n $$__pointer_type: O\r\n}\r\n\r\n/**\r\n * The type of {@link Atom} pointers. See {@link pointer|pointer()} for an\r\n * explanation of pointers.\r\n *\r\n * @see Atom\r\n *\r\n * @remarks\r\n * The Pointer type is quite tricky because it doesn't play well with `any` and other inexact types.\r\n * Here is an example that one would expect to work, but currently doesn't:\r\n * ```ts\r\n * declare function expectAnyPointer(pointer: Pointer<any>): void\r\n *\r\n * expectAnyPointer(null as Pointer<{}>) // this shows as a type error because Pointer<{}> is not assignable to Pointer<any>, even though it should\r\n * ```\r\n *\r\n * The current solution is to just avoid using `any` with pointer-related code (or type-test it well).\r\n * But if you enjoy solving typescript puzzles, consider fixing this :)\r\n * Potentially, [TypeScript variance annotations in 4.7+](https://devblogs.microsoft.com/typescript/announcing-typescript-4-7-beta/#optional-variance-annotations-for-type-parameters)\r\n * might be able to help us.\r\n */\r\nexport type Pointer<O> = PointerType<O> &\r\n // `Exclude<O, undefined>` will remove `undefined` from the first type\r\n // `undefined extends O ? undefined : never` will give us `undefined` if `O` is `... | undefined`\r\n PointerInner<Exclude<O, undefined>, undefined extends O ? undefined : never>\r\n\r\n// By separating the `O` (non-undefined) from the `undefined` or `never`, we\r\n// can properly use `O extends ...` to determine the kind of potential value\r\n// without actually discarding optionality information.\r\ntype PointerInner<O, Optional> = O extends UnindexableTypesForPointer\r\n ? UnindexablePointer\r\n : unknown extends O\r\n ? UnindexablePointer\r\n : O extends (infer T)[]\r\n ? Pointer<T>[]\r\n : O extends {}\r\n ? {\r\n [K in keyof O]-?: Pointer<O[K] | Optional>\r\n }\r\n : UnindexablePointer\r\n\r\nconst pointerMetaSymbol = Symbol('pointerMeta')\r\n\r\nconst proxyHandler = {\r\n get(\r\n pointerKey: WeakPointerKey,\r\n prop: string | typeof pointerMetaSymbol,\r\n ): $IntentionalAny {\r\n if (prop === pointerMetaSymbol) return pointerMetaWeakMap.get(pointerKey)!\r\n\r\n let subPathPointers = cachedSubPathPointersWeakMap.get(pointerKey)\r\n if (!subPathPointers) {\r\n subPathPointers = new Map()\r\n cachedSubPathPointersWeakMap.set(pointerKey, subPathPointers)\r\n }\r\n\r\n const existing = subPathPointers.get(prop)\r\n if (existing !== undefined) return existing\r\n\r\n const meta = pointerMetaWeakMap.get(pointerKey)!\r\n\r\n const subPointer = pointer({root: meta.root, path: [...meta.path, prop]})\r\n subPathPointers.set(prop, subPointer)\r\n return subPointer\r\n },\r\n}\r\n\r\n/**\r\n * Returns the metadata associated with the pointer. Usually the root object and\r\n * the path.\r\n *\r\n * @param p - The pointer.\r\n */\r\nexport const getPointerMeta = <_>(p: PointerType<_>): PointerMeta => {\r\n // @ts-ignore @todo\r\n const meta: PointerMeta = p[\r\n pointerMetaSymbol as unknown as $IntentionalAny\r\n ] as $IntentionalAny\r\n return meta\r\n}\r\n\r\n/**\r\n * Returns the root object and the path of the pointer.\r\n *\r\n * @example\r\n * ```ts\r\n * const {root, path} = getPointerParts(pointer)\r\n * ```\r\n *\r\n * @param p - The pointer.\r\n *\r\n * @returns An object with two properties: `root`-the root object or the pointer, and `path`-the path of the pointer. `path` is an array of the property-chain.\r\n */\r\nexport const getPointerParts = <_>(\r\n p: Pointer<_>,\r\n): {root: {}; path: PathToProp} => {\r\n const {root, path} = getPointerMeta(p)\r\n return {root, path}\r\n}\r\n\r\n/**\r\n * Creates a pointer to a (nested) property of an {@link Atom}.\r\n *\r\n * @remarks\r\n * Pointers are used to make prisms of properties or nested properties of\r\n * {@link Atom|Atoms}.\r\n *\r\n * Pointers also allow easy construction of new pointers pointing to nested members\r\n * of the root object, by simply using property chaining. E.g. `somePointer.a.b` will\r\n * create a new pointer that has `'a'` and `'b'` added to the path of `somePointer`.\r\n *\r\n * @example\r\n * ```ts\r\n * // Here, sum is a prism that updates whenever the a or b prop of someAtom does.\r\n * const sum = prism(() => {\r\n * return val(pointer({root: someAtom, path: ['a']})) + val(pointer({root: someAtom, path: ['b']}));\r\n * });\r\n *\r\n * // Note, atoms have a convenience Atom.pointer property that points to the root,\r\n * // which you would normally use in this situation.\r\n * const sum = prism(() => {\r\n * return val(someAtom.pointer.a) + val(someAtom.pointer.b);\r\n * });\r\n * ```\r\n *\r\n * @param args - The pointer parameters.\r\n *\r\n * @typeParam O - The type of the value being pointed to.\r\n */\r\nfunction pointer<O>(args: {root: {}; path?: Array<string | number>}) {\r\n const meta: PointerMeta = {\r\n root: args.root as $IntentionalAny,\r\n path: args.path ?? [],\r\n }\r\n const pointerKey: WeakPointerKey = {}\r\n pointerMetaWeakMap.set(pointerKey, meta)\r\n return new Proxy(pointerKey, proxyHandler) as Pointer<O>\r\n}\r\n\r\nexport default pointer\r\n\r\n/**\r\n * Returns whether `p` is a pointer.\r\n */\r\nexport const isPointer = (p: $IntentionalAny): p is Pointer<unknown> => {\r\n return p && !!getPointerMeta(p)\r\n}\r\n", "import type {$FixMe, $IntentionalAny} from '../types'\r\n\r\nexport default function updateDeep<S>(\r\n state: S,\r\n path: (string | number | undefined)[],\r\n reducer: (...args: $IntentionalAny[]) => $IntentionalAny,\r\n): S {\r\n if (path.length === 0) return reducer(state)\r\n return hoop(state, path as $IntentionalAny, reducer)\r\n}\r\n\r\nconst hoop = (\r\n s: $FixMe,\r\n path: (string | number)[],\r\n reducer: $FixMe,\r\n): $FixMe => {\r\n if (path.length === 0) {\r\n return reducer(s)\r\n }\r\n if (Array.isArray(s)) {\r\n let [index, ...restOfPath] = path\r\n index = parseInt(String(index), 10)\r\n if (isNaN(index)) index = 0\r\n const oldVal = s[index]\r\n const newVal = hoop(oldVal, restOfPath, reducer)\r\n if (oldVal === newVal) return s\r\n const newS = [...s]\r\n newS.splice(index, 1, newVal)\r\n return newS\r\n } else if (typeof s === 'object' && s !== null) {\r\n const [key, ...restOfPath] = path\r\n const oldVal = s[key]\r\n const newVal = hoop(oldVal, restOfPath, reducer)\r\n if (oldVal === newVal) return s\r\n const newS = {...s, [key]: newVal}\r\n return newS\r\n } else {\r\n const [key, ...restOfPath] = path\r\n\r\n return {[key]: hoop(undefined, restOfPath, reducer)}\r\n }\r\n}\r\n", "interface Node<Data> {\r\n next: undefined | Node<Data>\r\n data: Data\r\n}\r\n\r\n/**\r\n * Just a simple LinkedList\r\n */\r\nexport default class Stack<Data> {\r\n _head: undefined | Node<Data>\r\n\r\n constructor() {\r\n this._head = undefined\r\n }\r\n\r\n peek() {\r\n return this._head && this._head.data\r\n }\r\n\r\n pop() {\r\n const head = this._head\r\n if (!head) {\r\n return undefined\r\n }\r\n this._head = head.next\r\n return head.data\r\n }\r\n\r\n push(data: Data) {\r\n const node = {next: this._head, data}\r\n this._head = node\r\n }\r\n}\r\n", "import type Ticker from '../Ticker'\r\nimport type {$IntentionalAny, VoidFn} from '../types'\r\n\r\ntype IDependent = (msgComingFrom: Prism<$IntentionalAny>) => void\r\n\r\n/**\r\n * Common interface for prisms.\r\n */\r\nexport interface Prism<V> {\r\n /**\r\n * Whether the object is a prism.\r\n */\r\n isPrism: true\r\n\r\n /**\r\n * Whether the prism is hot.\r\n */\r\n isHot: boolean\r\n\r\n /**\r\n * Calls `listener` with a fresh value every time the prism _has_ a new value, throttled by Ticker.\r\n */\r\n onChange(\r\n ticker: Ticker,\r\n listener: (v: V) => void,\r\n immediate?: boolean,\r\n ): VoidFn\r\n\r\n onStale(cb: () => void): VoidFn\r\n\r\n /**\r\n * Keep the prism hot, even if there are no tappers (subscribers).\r\n */\r\n keepHot(): VoidFn\r\n\r\n /**\r\n * Add a prism as a dependent of this prism.\r\n *\r\n * @param d - The prism to be made a dependent of this prism.\r\n *\r\n * @see _removeDependent\r\n *\r\n * @internal\r\n */\r\n _addDependent(d: IDependent): void\r\n\r\n /**\r\n * Remove a prism as a dependent of this prism.\r\n *\r\n * @param d - The prism to be removed from as a dependent of this prism.\r\n *\r\n * @see _addDependent\r\n * @internal\r\n */\r\n _removeDependent(d: IDependent): void\r\n\r\n /**\r\n * Gets the current value of the prism. If the value is stale, it causes the prism to freshen.\r\n */\r\n getValue(): V\r\n}\r\n\r\n/**\r\n * Returns whether `d` is a prism.\r\n */\r\nexport function isPrism(d: any): d is Prism<unknown> {\r\n return !!(d && d.isPrism && d.isPrism === true)\r\n}\r\n", "import type {$IntentionalAny} from '../types'\r\nimport Stack from '../utils/Stack'\r\nimport type {Prism} from './Interface'\r\n\r\nfunction createMechanism() {\r\n const noop = () => {}\r\n\r\n const stack = new Stack<Collector>()\r\n const noopCollector: Collector = noop\r\n\r\n type Collector = (d: Prism<$IntentionalAny>) => void\r\n\r\n const pushCollector = (collector: Collector): void => {\r\n stack.push(collector)\r\n }\r\n\r\n const popCollector = (collector: Collector): void => {\r\n const existing = stack.peek()\r\n if (existing !== collector) {\r\n throw new Error(`Popped collector is not on top of the stack`)\r\n }\r\n stack.pop()\r\n }\r\n\r\n const startIgnoringDependencies = () => {\r\n stack.push(noopCollector)\r\n }\r\n\r\n const stopIgnoringDependencies = () => {\r\n if (stack.peek() !== noopCollector) {\r\n if (process.env.NODE_ENV === 'development') {\r\n console.warn('This should never happen')\r\n }\r\n } else {\r\n stack.pop()\r\n }\r\n }\r\n\r\n const reportResolutionStart = (d: Prism<$IntentionalAny>) => {\r\n const possibleCollector = stack.peek()\r\n if (possibleCollector) {\r\n possibleCollector(d)\r\n }\r\n\r\n stack.push(noopCollector)\r\n }\r\n\r\n const reportResolutionEnd = (_d: Prism<$IntentionalAny>) => {\r\n stack.pop()\r\n }\r\n\r\n return {\r\n type: 'Dataverse_discoveryMechanism' as 'Dataverse_discoveryMechanism',\r\n startIgnoringDependencies,\r\n stopIgnoringDependencies,\r\n reportResolutionStart,\r\n reportResolutionEnd,\r\n pushCollector,\r\n popCollector,\r\n }\r\n}\r\n\r\nfunction getSharedMechanism(): ReturnType<typeof createMechanism> {\r\n const varName = '__dataverse_discoveryMechanism_sharedStack'\r\n const root =\r\n typeof window !== 'undefined'\r\n ? window\r\n : typeof global !== 'undefined'\r\n ? global\r\n : {}\r\n if (root) {\r\n const existingMechanism: ReturnType<typeof createMechanism> | undefined =\r\n // @ts-ignore ignore\r\n root[varName]\r\n if (\r\n existingMechanism &&\r\n typeof existingMechanism === 'object' &&\r\n existingMechanism.type === 'Dataverse_discoveryMechanism'\r\n ) {\r\n return existingMechanism\r\n } else {\r\n const mechanism = createMechanism()\r\n // @ts-ignore ignore\r\n root[varName] = mechanism\r\n return mechanism\r\n }\r\n } else {\r\n return createMechanism()\r\n }\r\n}\r\n\r\nexport const {\r\n startIgnoringDependencies,\r\n stopIgnoringDependencies,\r\n reportResolutionEnd,\r\n reportResolutionStart,\r\n pushCollector,\r\n popCollector,\r\n} = getSharedMechanism()\r\n", "import type Ticker from '../Ticker'\r\nimport type {$IntentionalAny, VoidFn} from '../types'\r\nimport Stack from '../utils/Stack'\r\nimport type {Prism} from './Interface'\r\nimport {isPrism} from './Interface'\r\nimport {\r\n startIgnoringDependencies,\r\n stopIgnoringDependencies,\r\n pushCollector,\r\n popCollector,\r\n reportResolutionStart,\r\n reportResolutionEnd,\r\n} from './discoveryMechanism'\r\n\r\ntype IDependent = (msgComingFrom: Prism<$IntentionalAny>) => void\r\n\r\nconst voidFn = () => {}\r\n\r\nclass HotHandle<V> {\r\n private _didMarkDependentsAsStale: boolean = false\r\n private _isFresh: boolean = false\r\n protected _cacheOfDendencyValues: Map<Prism<unknown>, unknown> = new Map()\r\n\r\n /**\r\n * @internal\r\n */\r\n protected _dependents: Set<IDependent> = new Set()\r\n\r\n /**\r\n * @internal\r\n */\r\n protected _dependencies: Set<Prism<$IntentionalAny>> = new Set()\r\n\r\n protected _possiblyStaleDeps = new Set<Prism<unknown>>()\r\n\r\n private _scope: HotScope = new HotScope(\r\n this as $IntentionalAny as HotHandle<unknown>,\r\n )\r\n\r\n /**\r\n * @internal\r\n */\r\n protected _lastValue: undefined | V = undefined\r\n\r\n /**\r\n * If true, the prism is stale even though its dependencies aren't\r\n * marked as such. This is used by `prism.source()` and `prism.state()`\r\n * to mark the prism as stale.\r\n */\r\n private _forciblySetToStale: boolean = false\r\n\r\n constructor(\r\n private readonly _fn: () => V,\r\n private readonly _prismInstance: PrismInstance<V>,\r\n ) {\r\n for (const d of this._dependencies) {\r\n d._addDependent(this._reactToDependencyGoingStale)\r\n }\r\n\r\n startIgnoringDependencies()\r\n this.getValue()\r\n stopIgnoringDependencies()\r\n }\r\n\r\n get hasDependents(): boolean {\r\n return this._dependents.size > 0\r\n }\r\n removeDependent(d: IDependent) {\r\n this._dependents.delete(d)\r\n }\r\n addDependent(d: IDependent) {\r\n this._dependents.add(d)\r\n }\r\n\r\n destroy() {\r\n for (const d of this._dependencies) {\r\n d._removeDependent(this._reactToDependencyGoingStale)\r\n }\r\n cleanupScopeStack(this._scope)\r\n }\r\n\r\n getValue(): V {\r\n if (!this._isFresh) {\r\n const newValue = this._recalculate()\r\n this._lastValue = newValue\r\n this._isFresh = true\r\n this._didMarkDependentsAsStale = false\r\n this._forciblySetToStale = false\r\n }\r\n return this._lastValue!\r\n }\r\n\r\n _recalculate() {\r\n let value: V\r\n\r\n if (!this._forciblySetToStale) {\r\n if (this._possiblyStaleDeps.size > 0) {\r\n let anActuallyStaleDepWasFound = false\r\n startIgnoringDependencies()\r\n for (const dep of this._possiblyStaleDeps) {\r\n if (this._cacheOfDendencyValues.get(dep) !== dep.getValue()) {\r\n anActuallyStaleDepWasFound = true\r\n break\r\n }\r\n }\r\n stopIgnoringDependencies()\r\n this._possiblyStaleDeps.clear()\r\n if (!anActuallyStaleDepWasFound) {\r\n return this._lastValue!\r\n }\r\n }\r\n }\r\n\r\n const newDeps: Set<Prism<unknown>> = new Set()\r\n this._cacheOfDendencyValues.clear()\r\n\r\n const collector = (observedDep: Prism<unknown>): void => {\r\n newDeps.add(observedDep)\r\n this._addDependency(observedDep)\r\n }\r\n\r\n pushCollector(collector)\r\n\r\n // Reset per-scope `source()` call counters so each recompute re-derives the\r\n // same call-order-based effect keys (see HotScope.source).\r\n this._scope.resetSourceIndices()\r\n hookScopeStack.push(this._scope)\r\n try {\r\n value = this._fn()\r\n } catch (error) {\r\n console.error(error)\r\n } finally {\r\n const topOfTheStack = hookScopeStack.pop()\r\n if (topOfTheStack !== this._scope) {\r\n console.warn(\r\n // @todo guide the user to report the bug in an issue\r\n `The Prism hook stack has slipped. This is a bug.`,\r\n )\r\n }\r\n }\r\n\r\n popCollector(collector)\r\n\r\n for (const dep of this._dependencies) {\r\n if (!newDeps.has(dep)) {\r\n this._removeDependency(dep)\r\n }\r\n }\r\n\r\n this._dependencies = newDeps\r\n\r\n startIgnoringDependencies()\r\n for (const dep of newDeps) {\r\n this._cacheOfDendencyValues.set(dep, dep.getValue())\r\n }\r\n stopIgnoringDependencies()\r\n\r\n return value!\r\n }\r\n\r\n forceStale() {\r\n this._forciblySetToStale = true\r\n this._markAsStale()\r\n }\r\n\r\n protected _reactToDependencyGoingStale = (which: Prism<$IntentionalAny>) => {\r\n this._possiblyStaleDeps.add(which)\r\n\r\n this._markAsStale()\r\n }\r\n\r\n private _markAsStale() {\r\n if (this._didMarkDependentsAsStale) return\r\n\r\n this._didMarkDependentsAsStale = true\r\n this._isFresh = false\r\n\r\n for (const dependent of this._dependents) {\r\n dependent(this._prismInstance)\r\n }\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n protected _addDependency(d: Prism<$IntentionalAny>) {\r\n if (this._dependencies.has(d)) return\r\n this._dependencies.add(d)\r\n d._addDependent(this._reactToDependencyGoingStale)\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n protected _removeDependency(d: Prism<$IntentionalAny>) {\r\n if (!this._dependencies.has(d)) return\r\n this._dependencies.delete(d)\r\n d._removeDependent(this._reactToDependencyGoingStale)\r\n }\r\n}\r\n\r\nconst emptyObject = {}\r\n\r\nclass PrismInstance<V> implements Prism<V> {\r\n /**\r\n * Whether the object is a prism.\r\n */\r\n readonly isPrism: true = true\r\n\r\n private _state:\r\n | {hot: false; handle: undefined}\r\n | {hot: true; handle: HotHandle<V>} = {\r\n hot: false,\r\n handle: undefined,\r\n }\r\n\r\n constructor(private readonly _fn: () => V) {}\r\n\r\n /**\r\n * Whether the prism is hot.\r\n */\r\n get isHot(): boolean {\r\n return this._state.hot\r\n }\r\n\r\n onChange(\r\n ticker: Ticker,\r\n listener: (v: V) => void,\r\n immediate: boolean = false,\r\n ): VoidFn {\r\n // the prism will call this function every time it goes from fresh to stale\r\n const dependent = () => {\r\n // schedule the listener to be called on the next tick, unless\r\n // we're already on a tick, in which case it'll be called on the current tick.\r\n ticker.onThisOrNextTick(refresh)\r\n }\r\n\r\n // let's cache the last value so we don't call the listener if the value hasn't changed\r\n let lastValue: V | typeof emptyObject =\r\n // use an empty object as the initial value so that the listener is called on the first tick.\r\n // if we were to use, say, undefined, and this.getValue() also returned undefined, the listener\r\n // would never be called.\r\n emptyObject\r\n\r\n // this function will be _scheduled_ to be called on the currently running, or next tick,\r\n // after the prism has gone from fresh to stale.\r\n const refresh = () => {\r\n const newValue = this.getValue()\r\n // if the value hasn't changed, don't call the listener\r\n if (newValue === lastValue) return\r\n\r\n // the value has changed - cache it\r\n lastValue = newValue\r\n\r\n // and let the listener know\r\n listener(newValue)\r\n }\r\n\r\n // add the dependent to the prism's list of dependents (which will make it go hot)\r\n this._addDependent(dependent)\r\n\r\n // if the caller wants the listener to be called immediately, call it now\r\n if (immediate) {\r\n lastValue = this.getValue()\r\n listener(lastValue as $IntentionalAny as V)\r\n }\r\n\r\n // the unsubscribe function\r\n const unsubscribe = () => {\r\n // remove the dependent from the prism's list of dependents (and if it was the last dependent, the prism will go cold)\r\n this._removeDependent(dependent)\r\n // in case we're scheduled for a tick, cancel that\r\n ticker.offThisOrNextTick(refresh)\r\n ticker.offNextTick(refresh)\r\n }\r\n\r\n return unsubscribe\r\n }\r\n\r\n /**\r\n * Calls `callback` every time the prism's state goes from `fresh-\\>stale.` Returns an `unsubscribe()` function.\r\n */\r\n onStale(callback: () => void): VoidFn {\r\n const untap = () => {\r\n this._removeDependent(onStaleCallback)\r\n }\r\n const onStaleCallback = () => callback()\r\n this._addDependent(onStaleCallback)\r\n return untap\r\n }\r\n\r\n /**\r\n * Keep the prism hot, even if there are no tappers (subscribers).\r\n */\r\n keepHot() {\r\n return this.onStale(() => {})\r\n }\r\n\r\n /**\r\n * Add a prism as a dependent of this prism.\r\n *\r\n * @param d - The prism to be made a dependent of this prism.\r\n *\r\n * @see _removeDependent\r\n */\r\n _addDependent(d: IDependent) {\r\n if (!this._state.hot) {\r\n this._goHot()\r\n }\r\n this._state.handle!.addDependent(d)\r\n }\r\n\r\n private _goHot() {\r\n const hotHandle = new HotHandle(this._fn, this)\r\n this._state = {\r\n hot: true,\r\n handle: hotHandle,\r\n }\r\n }\r\n\r\n /**\r\n * Remove a prism as a dependent of this prism.\r\n *\r\n * @param d - The prism to be removed from as a dependent of this prism.\r\n *\r\n * @see _addDependent\r\n */\r\n _removeDependent(d: IDependent) {\r\n const state = this._state\r\n if (!state.hot) {\r\n return\r\n }\r\n const handle = state.handle\r\n handle.removeDependent(d)\r\n if (!handle.hasDependents) {\r\n this._state = {hot: false, handle: undefined}\r\n handle.destroy()\r\n }\r\n }\r\n\r\n /**\r\n * Gets the current value of the prism. If the value is stale, it causes the prism to freshen.\r\n */\r\n getValue(): V {\r\n /**\r\n * TODO We should prevent (or warn about) a common mistake users make, which is reading the value of\r\n * a prism in the body of a react component (e.g. `der.getValue()` (often via `val()`) instead of `useVal()`\r\n * or `uesPrism()`).\r\n *\r\n * Although that's the most common example of this mistake, you can also find it outside of react components.\r\n * Basically the user runs `der.getValue()` assuming the read is detected by a wrapping prism when it's not.\r\n *\r\n * Sometiems the prism isn't even hot when the user assumes it is.\r\n *\r\n * We can fix this type of mistake by:\r\n * 1. Warning the user when they call `getValue()` on a cold prism.\r\n * 2. Warning the user about calling `getValue()` on a hot-but-stale prism\r\n * if `getValue()` isn't called by a known mechanism like a `PrismEmitter`.\r\n *\r\n * Design constraints:\r\n * - This fix should not have a perf-penalty in production. Perhaps use a global flag + `process.env.NODE_ENV !== 'production'`\r\n * to enable it.\r\n * - In the case of `onStale()`, we don't control when the user calls\r\n * `getValue()` (as opposed to `onChange()` which calls `getValue()` directly).\r\n * Perhaps we can disable the check in that case.\r\n * - Probably the best place to add this check is right here in this method plus some changes to `reportResulutionStart()`,\r\n * which would have to be changed to let the caller know if there is an actual collector (a prism)\r\n * present in its stack.\r\n */\r\n reportResolutionStart(this)\r\n\r\n const state = this._state\r\n\r\n let val: V\r\n if (state.hot) {\r\n val = state.handle.getValue()\r\n } else {\r\n val = calculateColdPrism(this._fn)\r\n }\r\n\r\n reportResolutionEnd(this)\r\n return val\r\n }\r\n}\r\n\r\ninterface PrismScope {\r\n effect(key: string, cb: () => () => void, deps?: unknown[]): void\r\n memo<T>(\r\n key: string,\r\n fn: () => T,\r\n deps: undefined | $IntentionalAny[] | ReadonlyArray<$IntentionalAny>,\r\n ): T\r\n state<T>(key: string, initialValue: T): [T, (val: T) => void]\r\n ref<T>(key: string, initialValue: T): IRef<T>\r\n sub(key: string): PrismScope\r\n source<V>(subscribe: (fn: (val: V) => void) => VoidFn, getValue: () => V): V\r\n}\r\n\r\nclass HotScope implements PrismScope {\r\n constructor(private readonly _hotHandle: HotHandle<unknown>) {}\r\n\r\n protected readonly _refs: Map<string, IRef<unknown>> = new Map()\r\n ref<T>(key: string, initialValue: T): IRef<T> {\r\n let ref = this._refs.get(key)\r\n if (ref !== undefined) {\r\n return ref as $IntentionalAny as IRef<T>\r\n } else {\r\n const ref = {\r\n current: initialValue,\r\n }\r\n this._refs.set(key, ref)\r\n return ref\r\n }\r\n }\r\n isPrismScope = true\r\n\r\n // NOTE probably not a great idea to eager-allocate all of these objects/maps for every scope,\r\n // especially because most wouldn't get used in the majority of cases. However, back when these\r\n // were stored on weakmaps, they were uncomfortable to inspect in the debugger.\r\n readonly subs: Record<string, HotScope> = {}\r\n readonly effects: Map<string, IEffect> = new Map()\r\n\r\n effect(key: string, cb: () => () => void, deps?: unknown[]): void {\r\n let effect = this.effects.get(key)\r\n if (effect === undefined) {\r\n effect = {\r\n cleanup: voidFn,\r\n deps: undefined,\r\n }\r\n this.effects.set(key, effect)\r\n }\r\n\r\n if (depsHaveChanged(effect.deps, deps)) {\r\n effect.cleanup()\r\n\r\n startIgnoringDependencies()\r\n effect.cleanup = safelyRun(cb, voidFn).value\r\n stopIgnoringDependencies()\r\n effect.deps = deps\r\n }\r\n /**\r\n * TODO: we should cleanup dangling effects too.\r\n * Example:\r\n * ```ts\r\n * let i = 0\r\n * prism(() => {\r\n * if (i === 0) prism.effect(\"this effect will only run once\", () => {}, [])\r\n * i++\r\n * })\r\n * ```\r\n */\r\n }\r\n\r\n readonly memos: Map<string, IMemo> = new Map()\r\n\r\n memo<T>(\r\n key: string,\r\n fn: () => T,\r\n deps: undefined | $IntentionalAny[] | ReadonlyArray<$IntentionalAny>,\r\n ): T {\r\n let memo = this.memos.get(key)\r\n if (memo === undefined) {\r\n memo = {\r\n cachedValue: null,\r\n // undefined will always indicate \"deps have changed\", so we set its initial value as such\r\n deps: undefined,\r\n }\r\n this.memos.set(key, memo)\r\n }\r\n\r\n if (depsHaveChanged(memo.deps, deps)) {\r\n startIgnoringDependencies()\r\n\r\n memo.cachedValue = safelyRun(fn, undefined).value\r\n stopIgnoringDependencies()\r\n memo.deps = deps\r\n }\r\n\r\n return memo.cachedValue as $IntentionalAny as T\r\n }\r\n\r\n state<T>(key: string, initialValue: T): [T, (val: T) => void] {\r\n const {value, setValue} = this.memo(\r\n 'state/' + key,\r\n () => {\r\n const value = {current: initialValue}\r\n const setValue = (newValue: T) => {\r\n value.current = newValue\r\n this._hotHandle.forceStale()\r\n }\r\n return {value, setValue}\r\n },\r\n [],\r\n )\r\n\r\n return [value.current, setValue]\r\n }\r\n\r\n sub(key: string): HotScope {\r\n if (!this.subs[key]) {\r\n this.subs[key] = new HotScope(this._hotHandle)\r\n }\r\n return this.subs[key]\r\n }\r\n\r\n cleanupEffects() {\r\n for (const effect of this.effects.values()) {\r\n safelyRun(effect.cleanup, undefined)\r\n }\r\n this.effects.clear()\r\n }\r\n\r\n // Disambiguates multiple `source()` calls within one scope by call order\r\n // (like React hooks), instead of colliding on a single constant key. Reset to\r\n // 0 at the start of every recompute via resetSourceIndices().\r\n private _sourceIndex = 0\r\n\r\n resetSourceIndices(): void {\r\n this._sourceIndex = 0\r\n for (const sub of Object.values(this.subs)) {\r\n sub.resetSourceIndices()\r\n }\r\n }\r\n\r\n source<V>(subscribe: (fn: (val: V) => void) => VoidFn, getValue: () => V): V {\r\n const sourceKey = '$$source/' + this._sourceIndex++\r\n this.effect(\r\n sourceKey,\r\n () => {\r\n const unsub = subscribe(() => {\r\n this._hotHandle.forceStale()\r\n })\r\n return unsub\r\n },\r\n [subscribe],\r\n )\r\n return getValue()\r\n }\r\n}\r\n\r\nfunction cleanupScopeStack(scope: HotScope) {\r\n for (const sub of Object.values(scope.subs)) {\r\n cleanupScopeStack(sub)\r\n }\r\n scope.cleanupEffects()\r\n}\r\n\r\nfunction safelyRun<T, U>(\r\n fn: () => T,\r\n returnValueInCaseOfError: U,\r\n): {ok: true; value: T} | {ok: false; value: U} {\r\n try {\r\n return {value: fn(), ok: true}\r\n } catch (error) {\r\n // Naming this function can allow the error reporter additional context to the user on where this error came from\r\n setTimeout(function PrismReportThrow() {\r\n // ensure that the error gets reported, but does not crash the current execution scope\r\n throw error\r\n })\r\n return {value: returnValueInCaseOfError, ok: false}\r\n }\r\n}\r\n\r\nconst hookScopeStack = new Stack<PrismScope>()\r\n\r\ntype IRef<T> = {\r\n current: T\r\n}\r\n\r\ntype IEffect = {\r\n deps: undefined | unknown[]\r\n cleanup: VoidFn\r\n}\r\n\r\ntype IMemo = {\r\n deps: undefined | unknown[] | ReadonlyArray<unknown>\r\n cachedValue: unknown\r\n}\r\n\r\n/**\r\n * Just like React's `useRef()`, `prism.ref()` allows us to create a prism that holds a reference to some value.\r\n * The only difference is that `prism.ref()` requires a key to be passed into it, whlie `useRef()` doesn't.\r\n * This means that we can call `prism.ref()` in any order, and we can call it multiple times with the same key.\r\n * @param key - The key for the ref. Should be unique inside of the prism.\r\n * @param initialValue - The initial value for the ref.\r\n * @returns `{current: V}` - The ref object.\r\n *\r\n * Note that the ref object will always return its initial value if the prism is cold. It'll only record\r\n * its current value if the prism is hot (and will forget again if the prism goes cold again).\r\n *\r\n * @example\r\n * ```ts\r\n * const pr = prism(() => {\r\n * const ref1 = prism.ref(\"ref1\", 0)\r\n * console.log(ref1.current) // will print 0, and if the prism is hot, it'll print the current value\r\n * ref1.current++ // changing the current value of the ref\r\n * })\r\n * ```\r\n */\r\nfunction ref<T>(key: string, initialValue: T): IRef<T> {\r\n const scope = hookScopeStack.peek()\r\n if (!scope) {\r\n throw new Error(`prism.ref() is called outside of a prism() call.`)\r\n }\r\n\r\n return scope.ref(key, initialValue)\r\n}\r\n\r\n/**\r\n * An effect hook, similar to React's `useEffect()`, but is not sensitive to call order by using `key`.\r\n *\r\n * @param key - the key for the effect. Should be uniqe inside of the prism.\r\n * @param cb - the callback function. Requires returning a cleanup function.\r\n * @param deps - the dependency array\r\n */\r\nfunction effect(key: string, cb: () => () => void, deps?: unknown[]): void {\r\n const scope = hookScopeStack.peek()\r\n if (!scope) {\r\n throw new Error(`prism.effect() is called outside of a prism() call.`)\r\n }\r\n\r\n return scope.effect(key, cb, deps)\r\n}\r\n\r\nfunction depsHaveChanged(\r\n oldDeps: undefined | unknown[] | ReadonlyArray<unknown>,\r\n newDeps: undefined | unknown[] | ReadonlyArray<unknown>,\r\n): boolean {\r\n if (oldDeps === undefined || newDeps === undefined) {\r\n return true\r\n }\r\n\r\n const len = oldDeps.length\r\n if (len !== newDeps.length) return true\r\n\r\n for (let i = 0; i < len; i++) {\r\n if (oldDeps[i] !== newDeps[i]) return true\r\n }\r\n\r\n return false\r\n}\r\n\r\n/**\r\n * `prism.memo()` works just like React's `useMemo()` hook. It's a way to cache the result of a function call.\r\n * The only difference is that `prism.memo()` requires a key to be passed into it, whlie `useMemo()` doesn't.\r\n * This means that we can call `prism.memo()` in any order, and we can call it multiple times with the same key.\r\n *\r\n * @param key - The key for the memo. Should be unique inside of the prism\r\n * @param fn - The function to memoize\r\n * @param deps - The dependency array. Provide `[]` if you want to the value to be memoized only once and never re-calculated.\r\n * @returns The result of the function call\r\n *\r\n * @example\r\n * ```ts\r\n * const pr = prism(() => {\r\n * const memoizedReturnValueOfExpensiveFn = prism.memo(\"memo1\", expensiveFn, [])\r\n * })\r\n * ```\r\n */\r\nfunction memo<T>(\r\n key: string,\r\n fn: () => T,\r\n deps: undefined | $IntentionalAny[] | ReadonlyArray<$IntentionalAny>,\r\n): T {\r\n const scope = hookScopeStack.peek()\r\n if (!scope) {\r\n throw new Error(`prism.memo() is called outside of a prism() call.`)\r\n }\r\n\r\n return scope.memo(key, fn, deps)\r\n}\r\n\r\n/**\r\n * A state hook, similar to react's `useState()`.\r\n *\r\n * @param key - the key for the state\r\n * @param initialValue - the initial value\r\n * @returns [currentState, setState]\r\n *\r\n * @example\r\n * ```ts\r\n * import {prism} from 'dataverse'\r\n *\r\n * // This prism holds the current mouse position and updates when the mouse moves\r\n * const mousePositionD = prism(() => {\r\n * const [pos, setPos] = prism.state<[x: number, y: number]>('pos', [0, 0])\r\n *\r\n * prism.effect(\r\n * 'setupListeners',\r\n * () => {\r\n * const handleMouseMove = (e: MouseEvent) => {\r\n * setPos([e.screenX, e.screenY])\r\n * }\r\n * document.addEventListener('mousemove', handleMouseMove)\r\n *\r\n * return () => {\r\n * document.removeEventListener('mousemove', handleMouseMove)\r\n * }\r\n * },\r\n * [],\r\n * )\r\n *\r\n * return pos\r\n * })\r\n * ```\r\n */\r\nfunction state<T>(key: string, initialValue: T): [T, (val: T) => void] {\r\n const scope = hookScopeStack.peek()\r\n if (!scope) {\r\n throw new Error(`prism.state() is called outside of a prism() call.`)\r\n }\r\n\r\n return scope.state(key, initialValue)\r\n}\r\n\r\n/**\r\n * This is useful to make sure your code is running inside a `prism()` call.\r\n *\r\n * @example\r\n * ```ts\r\n * import {prism} from '@encorejs/dataverse'\r\n *\r\n * function onlyUsefulInAPrism() {\r\n * prism.ensurePrism()\r\n * }\r\n *\r\n * prism(() => {\r\n * onlyUsefulInAPrism() // will run fine\r\n * })\r\n *\r\n * setTimeout(() => {\r\n * onlyUsefulInAPrism() // throws an error\r\n * console.log('This will never get logged')\r\n * }, 0)\r\n * ```\r\n */\r\nfunction ensurePrism(): void {\r\n const scope = hookScopeStack.peek()\r\n if (!scope) {\r\n throw new Error(`The parent function is called outside of a prism() call.`)\r\n }\r\n}\r\n\r\nfunction scope<T>(key: string, fn: () => T): T {\r\n const parentScope = hookScopeStack.peek()\r\n if (!parentScope) {\r\n throw new Error(`prism.scope() is called outside of a prism() call.`)\r\n }\r\n const subScope = parentScope.sub(key)\r\n hookScopeStack.push(subScope)\r\n const ret = safelyRun(fn, undefined).value\r\n hookScopeStack.pop()\r\n return ret as $IntentionalAny as T\r\n}\r\n\r\n/**\r\n * Just an alias for `prism.memo(key, () => prism(fn), deps).getValue()`. It creates a new prism, memoizes it, and returns the value.\r\n * `prism.sub()` is useful when you want to divide your prism into smaller prisms, each of which\r\n * would _only_ recalculate when _certain_ dependencies change. In other words, it's an optimization tool.\r\n *\r\n * @param key - The key for the memo. Should be unique inside of the prism\r\n * @param fn - The function to run inside the prism\r\n * @param deps - The dependency array. Provide `[]` if you want to the value to be memoized only once and never re-calculated.\r\n * @returns The value of the inner prism\r\n */\r\nfunction sub<T>(\r\n key: string,\r\n fn: () => T,\r\n deps: undefined | $IntentionalAny[],\r\n): T {\r\n return memo(key, () => prism(fn), deps).getValue()\r\n}\r\n\r\n/**\r\n * @returns true if the current function is running inside a `prism()` call.\r\n */\r\nfunction inPrism(): boolean {\r\n return !!hookScopeStack.peek()\r\n}\r\n\r\nconst possiblePrismToValue = <P extends Prism<$IntentionalAny> | unknown>(\r\n input: P,\r\n): P extends Prism<infer T> ? T : P => {\r\n if (isPrism(input)) {\r\n return input.getValue() as $IntentionalAny\r\n } else {\r\n return input as $IntentionalAny\r\n }\r\n}\r\n\r\n/**\r\n * `prism.source()` allow a prism to react to changes in some external source (other than other prisms).\r\n * For example, `Atom.pointerToPrism()` uses `prism.source()` to create a prism that reacts to changes in the atom's value.\r\n \r\n * @param subscribe - The prism will call this function as soon as the prism goes hot. This function should return an unsubscribe function function which the prism will call when it goes cold.\r\n * @param getValue - A function that returns the current value of the external source.\r\n * @returns The current value of the source\r\n * \r\n * Example:\r\n * ```ts\r\n * function prismFromInputElement(input: HTMLInputElement): Prism<string> {\r\n * function listen(cb: (value: string) => void) {\r\n * const listener = () => {\r\n * cb(input.value)\r\n * }\r\n * input.addEventListener('input', listener)\r\n * return () => {\r\n * input.removeEventListener('input', listener)\r\n * }\r\n * }\r\n * \r\n * function get() {\r\n * return input.value\r\n * }\r\n * return prism(() => prism.source(listen, get))\r\n * }\r\n * ```\r\n */\r\nfunction source<V>(\r\n subscribe: (fn: (val: V) => void) => VoidFn,\r\n getValue: () => V,\r\n): V {\r\n const scope = hookScopeStack.peek()\r\n if (!scope) {\r\n throw new Error(`prism.source() is called outside of a prism() call.`)\r\n }\r\n\r\n return scope.source(subscribe, getValue)\r\n}\r\n\r\ntype IPrismFn = {\r\n <T>(fn: () => T): Prism<T>\r\n ref: typeof ref\r\n effect: typeof effect\r\n memo: typeof memo\r\n ensurePrism: typeof ensurePrism\r\n state: typeof state\r\n scope: typeof scope\r\n sub: typeof sub\r\n inPrism: typeof inPrism\r\n source: typeof source\r\n}\r\n\r\n/**\r\n * Creates a prism from the passed function that adds all prisms referenced\r\n * in it as dependencies, and reruns the function when these change.\r\n *\r\n * @param fn - The function to rerun when the prisms referenced in it change.\r\n */\r\nconst prism: IPrismFn = (fn) => {\r\n return new PrismInstance(fn)\r\n}\r\n\r\nclass ColdScope implements PrismScope {\r\n effect(key: string, cb: () => () => void, deps?: unknown[]): void {\r\n console.warn(`prism.effect() does not run in cold prisms`)\r\n }\r\n memo<T>(\r\n key: string,\r\n fn: () => T,\r\n deps: any[] | readonly any[] | undefined,\r\n ): T {\r\n return fn()\r\n }\r\n state<T>(key: string, initialValue: T): [T, (val: T) => void] {\r\n return [initialValue, () => {}]\r\n }\r\n ref<T>(key: string, initialValue: T): IRef<T> {\r\n return {current: initialValue}\r\n }\r\n sub(key: string): ColdScope {\r\n return new ColdScope()\r\n }\r\n source<V>(subscribe: (fn: (val: V) => void) => VoidFn, getValue: () => V): V {\r\n return getValue()\r\n }\r\n}\r\n\r\nfunction calculateColdPrism<V>(fn: () => V): V {\r\n const scope = new ColdScope()\r\n hookScopeStack.push(scope)\r\n let value: V\r\n try {\r\n value = fn()\r\n } catch (error) {\r\n console.error(error)\r\n } finally {\r\n const topOfTheStack = hookScopeStack.pop()\r\n if (topOfTheStack !== scope) {\r\n console.warn(\r\n // @todo guide the user to report the bug in an issue\r\n `The Prism hook stack has slipped. This is a bug.`,\r\n )\r\n }\r\n }\r\n return value!\r\n}\r\n\r\nprism.ref = ref\r\nprism.effect = effect\r\nprism.memo = memo\r\nprism.ensurePrism = ensurePrism\r\nprism.state = state\r\nprism.scope = scope\r\nprism.sub = sub\r\nprism.inPrism = inPrism\r\nprism.source = source\r\n\r\nexport default prism\r\n", "import get from 'lodash-es/get'\r\nimport isPlainObject from 'lodash-es/isPlainObject'\r\nimport last from 'lodash-es/last'\r\nimport type {Prism} from './prism/Interface'\r\nimport type {Pointer} from './pointer'\r\nimport {getPointerParts} from './pointer'\r\nimport {isPointer} from './pointer'\r\nimport pointer from './pointer'\r\nimport type {$FixMe, $IntentionalAny} from './types'\r\nimport updateDeep from './utils/updateDeep'\r\nimport prism from './prism/prism'\r\nimport type {PointerToPrismProvider} from './pointerToPrism'\r\n\r\ntype Listener = (newVal: unknown) => void\r\n\r\nenum ValueTypes {\r\n Dict,\r\n Array,\r\n Other,\r\n}\r\n\r\nconst getTypeOfValue = (v: unknown): ValueTypes => {\r\n if (Array.isArray(v)) return ValueTypes.Array\r\n if (isPlainObject(v)) return ValueTypes.Dict\r\n return ValueTypes.Other\r\n}\r\n\r\nconst getKeyOfValue = (\r\n v: unknown,\r\n key: string | number,\r\n vType: ValueTypes = getTypeOfValue(v),\r\n): unknown => {\r\n if (vType === ValueTypes.Dict && typeof key === 'string') {\r\n return (v as $IntentionalAny)[key]\r\n } else if (vType === ValueTypes.Array && isValidArrayIndex(key)) {\r\n return (v as $IntentionalAny)[key]\r\n } else {\r\n return undefined\r\n }\r\n}\r\n\r\nconst isValidArrayIndex = (key: string | number): boolean => {\r\n const inNumber = typeof key === 'number' ? key : parseInt(key, 10)\r\n return (\r\n !isNaN(inNumber) &&\r\n inNumber >= 0 &&\r\n inNumber < Infinity &&\r\n (inNumber | 0) === inNumber\r\n )\r\n}\r\n\r\nclass Scope {\r\n children: Map<string | number, Scope> = new Map()\r\n identityChangeListeners: Set<Listener> = new Set()\r\n constructor(\r\n readonly _parent: undefined | Scope,\r\n readonly _path: (string | number)[],\r\n ) {}\r\n\r\n addIdentityChangeListener(cb: Listener) {\r\n this.identityChangeListeners.add(cb)\r\n }\r\n\r\n removeIdentityChangeListener(cb: Listener) {\r\n this.identityChangeListeners.delete(cb)\r\n this._checkForGC()\r\n }\r\n\r\n removeChild(key: string | number) {\r\n this.children.delete(key)\r\n this._checkForGC()\r\n }\r\n\r\n getChild(key: string | number) {\r\n return this.children.get(key)\r\n }\r\n\r\n getOrCreateChild(key: string | number) {\r\n let child = this.children.get(key)\r\n if (!child) {\r\n child = child = new Scope(this, this._path.concat([key]))\r\n this.children.set(key, child)\r\n }\r\n return child\r\n }\r\n\r\n _checkForGC() {\r\n if (this.identityChangeListeners.size > 0) return\r\n if (this.children.size > 0) return\r\n\r\n if (this._parent) {\r\n this._parent.removeChild(last(this._path) as string | number)\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Wraps an object whose (sub)properties can be individually tracked.\r\n */\r\nexport default class Atom<State> implements PointerToPrismProvider {\r\n private _currentState: State\r\n /**\r\n * @internal\r\n */\r\n readonly $$isPointerToPrismProvider = true\r\n private readonly _rootScope: Scope\r\n /**\r\n * Convenience property that gives you a pointer to the root of the atom.\r\n *\r\n * @remarks\r\n * Equivalent to `pointer({ root: thisAtom, path: [] })`.\r\n */\r\n readonly pointer: Pointer<State> = pointer({root: this as $FixMe, path: []})\r\n\r\n readonly prism: Prism<State> = this.pointerToPrism(\r\n this.pointer,\r\n ) as $IntentionalAny\r\n\r\n constructor(initialState: State) {\r\n this._currentState = initialState\r\n this._rootScope = new Scope(undefined, [])\r\n }\r\n\r\n /**\r\n * Sets the state of the atom.\r\n *\r\n * @param newState - The new state of the atom.\r\n */\r\n set(newState: State) {\r\n const oldState = this._currentState\r\n this._currentState = newState\r\n\r\n this._checkUpdates(this._rootScope, oldState, newState)\r\n }\r\n\r\n /**\r\n * Returns the current state of the atom.\r\n */\r\n get(): State {\r\n return this._currentState\r\n }\r\n\r\n /**\r\n * Returns the value at the given pointer\r\n *\r\n * @param pointerOrFn - A pointer to the desired path. Could also be a function returning a pointer\r\n *\r\n * Example\r\n * ```ts\r\n * const atom = atom({ a: { b: 1 } })\r\n * atom.getByPointer(atom.pointer.a.b) // 1\r\n * atom.getByPointer((p) => p.a.b) // 1\r\n * ```\r\n */\r\n getByPointer<S>(\r\n pointerOrFn: Pointer<S> | ((p: Pointer<State>) => Pointer<S>),\r\n ): S {\r\n const pointer = isPointer(pointerOrFn)\r\n ? pointerOrFn\r\n : (pointerOrFn as $IntentionalAny)(this.pointer)\r\n\r\n const path = getPointerParts(pointer).path\r\n return this._getIn(path) as S\r\n }\r\n\r\n /**\r\n * Gets the state of the atom at `path`.\r\n */\r\n private _getIn(path: (string | number)[]): unknown {\r\n return path.length === 0 ? this.get() : get(this.get(), path)\r\n }\r\n\r\n reduce(fn: (state: State) => State) {\r\n this.set(fn(this.get()))\r\n }\r\n\r\n /**\r\n * Reduces the value at the given pointer\r\n *\r\n * @param pointerOrFn - A pointer to the desired path. Could also be a function returning a pointer\r\n *\r\n * Example\r\n * ```ts\r\n * const atom = atom({ a: { b: 1 } })\r\n * atom.reduceByPointer(atom.pointer.a.b, (b) => b + 1) // atom.get().a.b === 2\r\n * atom.reduceByPointer((p) => p.a.b, (b) => b + 1) // atom.get().a.b === 2\r\n * ```\r\n */\r\n reduceByPointer<S>(\r\n pointerOrFn: Pointer<S> | ((p: Pointer<State>) => Pointer<S>),\r\n reducer: (s: S) => S,\r\n ) {\r\n const pointer = isPointer(pointerOrFn)\r\n ? pointerOrFn\r\n : (pointerOrFn as $IntentionalAny)(this.pointer)\r\n\r\n const path = getPointerParts(pointer).path\r\n const newState = updateDeep(this.get(), path, reducer)\r\n this.set(newState)\r\n }\r\n\r\n /**\r\n * Sets the value at the given pointer\r\n *\r\n * @param pointerOrFn - A pointer to the desired path. Could also be a function returning a pointer\r\n *\r\n * Example\r\n * ```ts\r\n * const atom = atom({ a: { b: 1 } })\r\n * atom.setByPointer(atom.pointer.a.b, 2) // atom.get().a.b === 2\r\n * atom.setByPointer((p) => p.a.b, 2) // atom.get().a.b === 2\r\n * ```\r\n */\r\n setByPointer<S>(\r\n pointerOrFn: Pointer<S> | ((p: Pointer<State>) => Pointer<S>),\r\n val: S,\r\n ) {\r\n this.reduceByPointer(pointerOrFn, () => val)\r\n }\r\n\r\n private _checkUpdates(scope: Scope, oldState: unknown, newState: unknown) {\r\n if (oldState === newState) return\r\n for (const cb of scope.identityChangeListeners) {\r\n cb(newState)\r\n }\r\n\r\n if (scope.children.size === 0) return\r\n\r\n // @todo we can probably skip checking value types\r\n const oldValueType = getTypeOfValue(oldState)\r\n const newValueType = getTypeOfValue(newState)\r\n\r\n if (oldValueType === ValueTypes.Other && oldValueType === newValueType)\r\n return\r\n\r\n for (const [childKey, childScope] of scope.children) {\r\n const oldChildVal = getKeyOfValue(oldState, childKey, oldValueType)\r\n const newChildVal = getKeyOfValue(newState, childKey, newValueType)\r\n this._checkUpdates(childScope, oldChildVal, newChildVal)\r\n }\r\n }\r\n\r\n private _getOrCreateScopeForPath(path: (string | number)[]): Scope {\r\n let curScope = this._rootScope\r\n for (const pathEl of path) {\r\n curScope = curScope.getOrCreateChild(pathEl)\r\n }\r\n return curScope\r\n }\r\n\r\n /**\r\n * Adds a listener that will be called whenever the value at the given pointer changes.\r\n * @param pointer - The pointer to listen to\r\n * @param cb - The callback to call when the value changes\r\n * @returns A function that can be called to unsubscribe from the listener\r\n *\r\n * **NOTE** Unlike {@link prism}s, `onChangeByPointer` and `onChange()` are traditional event listeners. They don't\r\n * provide any of the benefits of prisms. They don't compose, they can't be coordinated via a Ticker, their derivations\r\n * aren't cached, etc. You're almost always better off using a prism (which will internally use `onChangeByPointer`).\r\n *\r\n * ```ts\r\n * const a = atom({foo: 1})\r\n * const unsubscribe = a.onChangeByPointer(a.pointer.foo, (v) => {\r\n * console.log('foo changed to', v)\r\n * })\r\n * a.setByPointer(a.pointer.foo, 2) // logs 'foo changed to 2'\r\n * a.set({foo: 3}) // logs 'foo changed to 3'\r\n * unsubscribe()\r\n * ```\r\n */\r\n onChangeByPointer = <S>(\r\n pointerOrFn: Pointer<S> | ((p: Pointer<State>) => Pointer<S>),\r\n cb: (v: S) => void,\r\n ): (() => void) => {\r\n const pointer = isPointer(pointerOrFn)\r\n ? pointerOrFn\r\n : (pointerOrFn as $IntentionalAny)(this.pointer)\r\n const {path} = getPointerParts(pointer)\r\n const scope = this._getOrCreateScopeForPath(path)\r\n scope.identityChangeListeners.add(cb as $IntentionalAny)\r\n const unsubscribe = () => {\r\n scope.identityChangeListeners.delete(cb as $IntentionalAny)\r\n }\r\n return unsubscribe\r\n }\r\n\r\n /**\r\n * Adds a listener that will be called whenever the state of the atom changes.\r\n * @param cb - The callback to call when the value changes\r\n * @returns A function that can be called to unsubscribe from the listener\r\n *\r\n * **NOTE** Unlike {@link prism}s, `onChangeByPointer` and `onChange()` are traditional event listeners. They don't\r\n * provide any of the benefits of prisms. They don't compose, they can't be coordinated via a Ticker, their derivations\r\n * aren't cached, etc. You're almost always better off using a prism (which will internally use `onChangeByPointer`).\r\n *\r\n * ```ts\r\n * const a = atom({foo: 1})\r\n * const unsubscribe = a.onChange((v) => {\r\n * console.log('a changed to', v)\r\n * })\r\n * a.set({foo: 3}) // logs 'a changed to {foo: 3}'\r\n * unsubscribe()\r\n * ```\r\n */\r\n onChange(cb: (v: State) => void): () => void {\r\n return this.onChangeByPointer(this.pointer, cb)\r\n }\r\n\r\n /**\r\n * Returns a new prism of the value at the provided path.\r\n *\r\n * @param pointer - The path to create the prism at.\r\n *\r\n * ```ts\r\n * const pr = atom({ a: { b: 1 } }).pointerToPrism(atom.pointer.a.b)\r\n * pr.getValue() // 1\r\n * ```\r\n */\r\n pointerToPrism<P>(pointer: Pointer<P>): Prism<P> {\r\n const {path} = getPointerParts(pointer)\r\n const subscribe = (listener: (val: unknown) => void) =>\r\n this.onChangeByPointer(pointer, listener)\r\n\r\n const getValue = () => this._getIn(path)\r\n\r\n return prism(() => {\r\n return prism.source(subscribe, getValue)\r\n }) as Prism<P>\r\n }\r\n}\r\n", "import type {Prism} from './prism/Interface'\r\nimport type {Pointer, PointerType} from './pointer'\r\nimport {getPointerMeta} from './pointer'\r\nimport type {$IntentionalAny} from './types'\r\n\r\nconst identifyPrismWeakMap = new WeakMap<{}, Prism<unknown>>()\r\n\r\n/**\r\n * Interface for objects that can provide a prism at a certain path.\r\n */\r\nexport interface PointerToPrismProvider {\r\n /**\r\n * @internal\r\n * Future: We could consider using a `Symbol.for(\"dataverse/PointerToPrismProvider\")` as a key here, similar to\r\n * how {@link Iterable} works for `of`.\r\n */\r\n readonly $$isPointerToPrismProvider: true\r\n /**\r\n * Returns a prism of the value at the provided pointer.\r\n */\r\n pointerToPrism<P>(pointer: Pointer<P>): Prism<P>\r\n}\r\n\r\nexport function isPointerToPrismProvider(\r\n val: unknown,\r\n): val is PointerToPrismProvider {\r\n return (\r\n typeof val === 'object' &&\r\n val !== null &&\r\n (val as $IntentionalAny)['$$isPointerToPrismProvider'] === true\r\n )\r\n}\r\n\r\n/**\r\n * Returns a prism of the value at the provided pointer. Prisms are\r\n * cached per pointer.\r\n *\r\n * @param pointer - The pointer to return the prism at.\r\n */\r\n\r\nexport const pointerToPrism = <P extends PointerType<$IntentionalAny>>(\r\n pointer: P,\r\n): Prism<P extends PointerType<infer T> ? T : void> => {\r\n const meta = getPointerMeta(pointer)\r\n\r\n let prismInstance = identifyPrismWeakMap.get(meta)\r\n if (!prismInstance) {\r\n const root = meta.root\r\n if (!isPointerToPrismProvider(root)) {\r\n throw new Error(\r\n `Cannot run pointerToPrism() on a pointer whose root is not an PointerToPrismProvider`,\r\n )\r\n }\r\n prismInstance = root.pointerToPrism(pointer as $IntentionalAny)\r\n identifyPrismWeakMap.set(meta, prismInstance)\r\n }\r\n return prismInstance as $IntentionalAny\r\n}\r\n", "import type {Prism} from './prism/Interface'\r\nimport {isPrism} from './prism/Interface'\r\nimport type {PointerType} from './pointer'\r\nimport {isPointer} from './pointer'\r\nimport type {$IntentionalAny} from './types'\r\nimport {pointerToPrism} from './pointerToPrism'\r\n\r\n/**\r\n * Convenience function that returns a plain value from its argument, whether it\r\n * is a pointer, a prism or a plain value itself.\r\n *\r\n * @remarks\r\n * For pointers, the value is returned by first creating a prism, so it is\r\n * reactive e.g. when used in a `prism`.\r\n *\r\n * @param input - The argument to return a value from.\r\n */\r\n\r\nexport const val = <\r\n P extends\r\n | PointerType<$IntentionalAny>\r\n | Prism<$IntentionalAny>\r\n | undefined\r\n | null,\r\n>(\r\n input: P,\r\n): P extends PointerType<infer T>\r\n ? T\r\n : P extends Prism<infer T>\r\n ? T\r\n : P extends undefined | null\r\n ? P\r\n : unknown => {\r\n if (isPointer(input)) {\r\n return pointerToPrism(input).getValue() as $IntentionalAny\r\n } else if (isPrism(input)) {\r\n return input.getValue() as $IntentionalAny\r\n } else {\r\n return input as $IntentionalAny\r\n }\r\n}\r\n", "import {pointerToPrism} from '../pointerToPrism'\r\nimport type {Pointer} from '../pointer'\r\nimport {isPointer} from '../pointer'\r\nimport type {Prism} from './Interface'\r\nimport {isPrism} from './Interface'\r\n\r\nexport default function* iterateAndCountTicks<V>(\r\n pointerOrPrism: Prism<V> | Pointer<V>,\r\n): Generator<{value: V; ticks: number}, void, void> {\r\n let d\r\n if (isPointer(pointerOrPrism)) {\r\n d = pointerToPrism(pointerOrPrism) as Prism<V>\r\n } else if (isPrism(pointerOrPrism)) {\r\n d = pointerOrPrism\r\n } else {\r\n throw new Error(`Only pointers and prisms are supported`)\r\n }\r\n\r\n let ticksCountedSinceLastYield = 0\r\n const untap = d.onStale(() => {\r\n ticksCountedSinceLastYield++\r\n })\r\n\r\n try {\r\n while (true) {\r\n const ticks = ticksCountedSinceLastYield\r\n ticksCountedSinceLastYield = 0\r\n yield {value: d.getValue(), ticks}\r\n }\r\n } finally {\r\n untap()\r\n }\r\n}\r\n", "type ICallback = (t: number) => void\r\n\r\n/**\r\n * The number of ticks that can pass without any scheduled callbacks before the Ticker goes dormant. This is to prevent\r\n * the Ticker from staying active forever, even if there are no scheduled callbacks.\r\n *\r\n * Perhaps counting ticks vs. time is not the best way to do this. But it's a start.\r\n */\r\nexport const EMPTY_TICKS_BEFORE_GOING_DORMANT = 60 /*fps*/ * 3 /*seconds*/ // on a 60fps screen, 3 seconds should pass before the ticker goes dormant\r\n\r\n/**\r\n * The Ticker class helps schedule callbacks. Scheduled callbacks are executed per tick. Ticks can be triggered by an\r\n * external scheduling strategy, e.g. a raf.\r\n */\r\nexport default class Ticker {\r\n private _scheduledForThisOrNextTick: Set<ICallback>\r\n private _scheduledForNextTick: Set<ICallback>\r\n private _timeAtCurrentTick: number\r\n private _ticking: boolean = false\r\n\r\n /**\r\n * Whether the Ticker is dormant\r\n */\r\n private _dormant: boolean = true\r\n\r\n private _numberOfDormantTicks = 0\r\n\r\n /**\r\n * Whether the Ticker is dormant\r\n */\r\n get dormant(): boolean {\r\n return this._dormant\r\n }\r\n /**\r\n * Counts up for every tick executed.\r\n * Internally, this is used to measure ticks per second.\r\n *\r\n * This is \"public\" to TypeScript, because it's a tool for performance measurements.\r\n * Consider this as experimental, and do not rely on it always being here in future releases.\r\n */\r\n public __ticks = 0\r\n\r\n constructor(\r\n private _conf?: {\r\n /**\r\n * This is called when the Ticker goes dormant.\r\n */\r\n onDormant?: () => void\r\n /**\r\n * This is called when the Ticker goes active.\r\n */\r\n onActive?: () => void\r\n },\r\n ) {\r\n this._scheduledForThisOrNextTick = new Set()\r\n this._scheduledForNextTick = new Set()\r\n this._timeAtCurrentTick = 0\r\n }\r\n\r\n /**\r\n * Registers for fn to be called either on this tick or the next tick.\r\n *\r\n * If `onThisOrNextTick()` is called while `Ticker.tick()` is running, the\r\n * side effect _will_ be called within the running tick. If you don't want this\r\n * behavior, you can use `onNextTick()`.\r\n *\r\n * Note that `fn` will be added to a `Set()`. Which means, if you call `onThisOrNextTick(fn)`\r\n * with the same fn twice in a single tick, it'll only run once.\r\n *\r\n * @param fn - The function to be registered.\r\n *\r\n * @see offThisOrNextTick\r\n */\r\n onThisOrNextTick(fn: ICallback) {\r\n this._scheduledForThisOrNextTick.add(fn)\r\n if (this._dormant) {\r\n this._goActive()\r\n }\r\n }\r\n\r\n /**\r\n * Registers a side effect to be called on the next tick.\r\n *\r\n * @param fn - The function to be registered.\r\n *\r\n * @see onThisOrNextTick\r\n * @see offNextTick\r\n */\r\n onNextTick(fn: ICallback) {\r\n this._scheduledForNextTick.add(fn)\r\n if (this._dormant) {\r\n this._goActive()\r\n }\r\n }\r\n\r\n /**\r\n * De-registers a fn to be called either on this tick or the next tick.\r\n *\r\n * @param fn - The function to be de-registered.\r\n *\r\n * @see onThisOrNextTick\r\n */\r\n offThisOrNextTick(fn: ICallback) {\r\n this._scheduledForThisOrNextTick.delete(fn)\r\n }\r\n\r\n /**\r\n * De-registers a fn to be called on the next tick.\r\n *\r\n * @param fn - The function to be de-registered.\r\n *\r\n * @see onNextTick\r\n */\r\n offNextTick(fn: ICallback) {\r\n this._scheduledForNextTick.delete(fn)\r\n }\r\n\r\n /**\r\n * The time at the start of the current tick if there is a tick in progress, otherwise defaults to\r\n * `performance.now()`.\r\n */\r\n get time() {\r\n if (this._ticking) {\r\n return this._timeAtCurrentTick\r\n } else return performance.now()\r\n }\r\n\r\n private _goActive() {\r\n if (!this._dormant) return\r\n this._dormant = false\r\n this._conf?.onActive?.()\r\n }\r\n\r\n private _goDormant() {\r\n if (this._dormant) return\r\n this._dormant = true\r\n this._numberOfDormantTicks = 0\r\n this._conf?.onDormant?.()\r\n }\r\n\r\n /**\r\n * Triggers a tick which starts executing the callbacks scheduled for this tick.\r\n *\r\n * @param t - The time at the tick.\r\n *\r\n * @see onThisOrNextTick\r\n * @see onNextTick\r\n */\r\n tick(t: number = performance.now()) {\r\n if (process.env.NODE_ENV === 'development') {\r\n if (!(this instanceof Ticker)) {\r\n throw new Error(\r\n 'ticker.tick must be called while bound to the ticker. As in, \"ticker.tick(time)\" or \"requestAnimationFrame((t) => ticker.tick(t))\" for performance.',\r\n )\r\n }\r\n }\r\n\r\n this.__ticks++\r\n\r\n if (!this._dormant) {\r\n if (\r\n this._scheduledForNextTick.size === 0 &&\r\n this._scheduledForThisOrNextTick.size === 0\r\n ) {\r\n this._numberOfDormantTicks++\r\n if (this._numberOfDormantTicks >= EMPTY_TICKS_BEFORE_GOING_DORMANT) {\r\n this._goDormant()\r\n return\r\n }\r\n } else {\r\n // Real work runs this tick, so reset the dormancy counter: dormancy is\r\n // meant to trigger after EMPTY_TICKS_BEFORE_GOING_DORMANT *consecutive*\r\n // idle ticks, not cumulative ones.\r\n this._numberOfDormantTicks = 0\r\n }\r\n }\r\n\r\n this._ticking = true\r\n this._timeAtCurrentTick = t\r\n for (const v of this._scheduledForNextTick) {\r\n this._scheduledForThisOrNextTick.add(v)\r\n }\r\n\r\n this._scheduledForNextTick.clear()\r\n this._tick(0)\r\n this._ticking = false\r\n }\r\n\r\n private _tick(iterationNumber: number): void {\r\n const time = this.time\r\n\r\n if (iterationNumber > 10) {\r\n console.warn('_tick() recursing for 10 times')\r\n }\r\n\r\n if (iterationNumber > 100) {\r\n throw new Error(`Maximum recursion limit for _tick()`)\r\n }\r\n\r\n const oldSet = this._scheduledForThisOrNextTick\r\n this._scheduledForThisOrNextTick = new Set()\r\n for (const fn of oldSet) {\r\n fn(time)\r\n }\r\n\r\n if (this._scheduledForThisOrNextTick.size > 0) {\r\n return this._tick(iterationNumber + 1)\r\n }\r\n }\r\n}\r\n", "import {pointerToPrism} from '../pointerToPrism'\r\nimport type {Pointer} from '../pointer'\r\nimport {isPointer} from '../pointer'\r\nimport Ticker from '../Ticker'\r\nimport type {Prism} from './Interface'\r\nimport {isPrism} from './Interface'\r\n\r\nexport default function* iterateOver<V>(\r\n pointerOrPrism: Prism<V> | Pointer<V>,\r\n): Generator<V, void, void> {\r\n let d\r\n if (isPointer(pointerOrPrism)) {\r\n d = pointerToPrism(pointerOrPrism) as Prism<V>\r\n } else if (isPrism(pointerOrPrism)) {\r\n d = pointerOrPrism\r\n } else {\r\n throw new Error(`Only pointers and prisms are supported`)\r\n }\r\n\r\n const ticker = new Ticker()\r\n\r\n const untap = d.onChange(ticker, (v) => {})\r\n\r\n try {\r\n while (true) {\r\n ticker.tick()\r\n\r\n yield d.getValue()\r\n }\r\n } finally {\r\n untap()\r\n }\r\n}\r\n", "import Atom from './Atom'\r\nimport {val} from './val'\r\nimport type {Pointer} from './pointer'\r\nimport {getPointerMeta} from './pointer'\r\nimport pointer from './pointer'\r\nimport type {$FixMe, $IntentionalAny} from './types'\r\nimport prism from './prism/prism'\r\nimport type {Prism} from './prism/Interface'\r\nimport type {PointerToPrismProvider} from './pointerToPrism'\r\n\r\n/**\r\n * Allows creating pointer-prisms where the pointer can be switched out.\r\n *\r\n * @remarks\r\n * This allows reacting not just to value changes at a certain pointer, but changes\r\n * to the proxied pointer too.\r\n */\r\nexport default class PointerProxy<O extends {}>\r\n implements PointerToPrismProvider\r\n{\r\n /**\r\n * @internal\r\n */\r\n readonly $$isPointerToPrismProvider = true\r\n private readonly _currentPointerBox: Atom<Pointer<O>>\r\n /**\r\n * Convenience pointer pointing to the root of this PointerProxy.\r\n *\r\n * @remarks\r\n * Allows convenient use of {@link pointerToPrism} and {@link val}.\r\n */\r\n readonly pointer: Pointer<O>\r\n\r\n constructor(currentPointer: Pointer<O>) {\r\n this._currentPointerBox = new Atom(currentPointer)\r\n this.pointer = pointer({root: this as $FixMe, path: []})\r\n }\r\n\r\n /**\r\n * Sets the underlying pointer.\r\n * @param p - The pointer to be proxied.\r\n */\r\n setPointer(p: Pointer<O>) {\r\n this._currentPointerBox.set(p)\r\n }\r\n\r\n /**\r\n * Returns a prism of the value at the provided sub-path of the proxied pointer.\r\n *\r\n * @param path - The path to create the prism at.\r\n */\r\n pointerToPrism<P>(pointer: Pointer<P>): Prism<P> {\r\n const {path} = getPointerMeta(pointer)\r\n return prism(() => {\r\n const currentPointer = this._currentPointerBox.prism.getValue()\r\n const subPointer = path.reduce(\r\n (pointerSoFar, pathItem) => (pointerSoFar as $IntentionalAny)[pathItem],\r\n currentPointer,\r\n )\r\n return val(subPointer) as P\r\n })\r\n }\r\n}\r\n", "/**\r\n * The animation-optimized FRP library powering the internals of Encore.\r\n *\r\n * @packageDocumentation\r\n */\r\n\r\nexport type {PointerToPrismProvider} from './pointerToPrism'\r\nexport {default as Atom} from './Atom'\r\nexport {val} from './val'\r\nexport {pointerToPrism} from './pointerToPrism'\r\nexport {isPrism} from './prism/Interface'\r\nexport type {Prism} from './prism/Interface'\r\nexport {default as iterateAndCountTicks} from './prism/iterateAndCountTicks'\r\nexport {default as iterateOver} from './prism/iterateOver'\r\nexport {default as prism} from './prism/prism'\r\nexport {default as pointer, getPointerParts, isPointer} from './pointer'\r\nexport type {Pointer, PointerType, PointerMeta} from './pointer'\r\nexport {default as Ticker} from './Ticker'\r\nexport {default as PointerProxy} from './PointerProxy'\r\n// export {default as asyncIterateOver} from './prism/asyncIterateOver'\r\n", "// Generated by CoffeeScript 1.8.0\n\n/*\n * Source: http://stackoverflow.com/a/11697909/607997\n * http://codepen.io/onedayitwillmake/details/EHDmw\n * by Mario Gonzalez\n */\n\n/*\n * Solver for cubic bezier curve with implicit control points at (0,0) and (1.0, 1.0)\n */\nvar UnitBezier;\n\nmodule.exports = UnitBezier = (function() {\n function UnitBezier(p1x, p1y, p2x, p2y) {\n this.set(p1x, p1y, p2x, p2y);\n }\n\n UnitBezier.prototype.set = function(p1x, p1y, p2x, p2y) {\n this._cx = 3.0 * p1x;\n this._bx = 3.0 * (p2x - p1x) - this._cx;\n this._ax = 1.0 - this._cx - this._bx;\n this._cy = 3.0 * p1y;\n this._by = 3.0 * (p2y - p1y) - this._cy;\n this._ay = 1.0 - this._cy - this._by;\n };\n\n UnitBezier.epsilon = 1e-6;\n\n UnitBezier.prototype._sampleCurveX = function(t) {\n return ((this._ax * t + this._bx) * t + this._cx) * t;\n };\n\n UnitBezier.prototype._sampleCurveY = function(t) {\n return ((this._ay * t + this._by) * t + this._cy) * t;\n };\n\n UnitBezier.prototype._sampleCurveDerivativeX = function(t) {\n return (3.0 * this._ax * t + 2.0 * this._bx) * t + this._cx;\n };\n\n UnitBezier.prototype._solveCurveX = function(x, epsilon) {\n var d2, i, t0, t1, t2, x2;\n t0 = void 0;\n t1 = void 0;\n t2 = void 0;\n x2 = void 0;\n d2 = void 0;\n i = void 0;\n t2 = x;\n i = 0;\n while (i < 8) {\n x2 = this._sampleCurveX(t2) - x;\n if (Math.abs(x2) < epsilon) {\n return t2;\n }\n d2 = this._sampleCurveDerivativeX(t2);\n if (Math.abs(d2) < epsilon) {\n break;\n }\n t2 = t2 - x2 / d2;\n i++;\n }\n t0 = 0.0;\n t1 = 1.0;\n t2 = x;\n if (t2 < t0) {\n return t0;\n }\n if (t2 > t1) {\n return t1;\n }\n while (t0 < t1) {\n x2 = this._sampleCurveX(t2);\n if (Math.abs(x2 - x) < epsilon) {\n return t2;\n }\n if (x > x2) {\n t0 = t2;\n } else {\n t1 = t2;\n }\n t2 = (t1 - t0) * .5 + t0;\n }\n return t2;\n };\n\n UnitBezier.prototype.solve = function(x, epsilon) {\n return this._sampleCurveY(this._solveCurveX(x, epsilon));\n };\n\n UnitBezier.prototype.solveSimple = function(x) {\n return this._sampleCurveY(this._solveCurveX(x, 1e-6));\n };\n\n return UnitBezier;\n\n})();\n", "var cache,\n codes;\n\ncache = [];\ncodes = [];\n\nfunction levenshtein(value, other, insensitive) {\n var length,\n lengthOther,\n code,\n result,\n distance,\n distanceOther,\n index,\n indexOther;\n\n if (value === other) {\n return 0;\n }\n\n length = value.length;\n lengthOther = other.length;\n\n if (length === 0) {\n return lengthOther;\n }\n\n if (lengthOther === 0) {\n return length;\n }\n\n if (insensitive) {\n value = value.toLowerCase();\n other = other.toLowerCase();\n }\n\n index = 0;\n\n while (index < length) {\n codes[index] = value.charCodeAt(index);\n cache[index] = ++index;\n }\n\n indexOther = 0;\n\n while (indexOther < lengthOther) {\n code = other.charCodeAt(indexOther);\n\n result = distance = indexOther++;\n\n index = -1;\n\n while (++index < length) {\n distanceOther = code === codes[index] ? distance : distance + 1;\n\n distance = cache[index];\n\n cache[index] = result = distance > result\n ? distanceOther > result\n ? result + 1\n : distanceOther\n : distanceOther > distance\n ? distance + 1\n : distanceOther;\n }\n }\n\n return result;\n}\n\nmodule.exports = levenshtein;\n", "var levenshtein = require('levenshtein-edit-distance');\r\n\r\nfunction propose() {\r\n var ratio;\r\n var distance;\r\n var proposed;\r\n var threshold;\r\n var ignoreCase;\r\n var max_ratio = 0;\r\n var word = arguments[0];\r\n var dictionary = arguments[1];\r\n var len = dictionary.length;\r\n var options = arguments[2];\r\n\r\n if (options) {\r\n threshold = options.threshold;\r\n ignoreCase = options.ignoreCase;\r\n }\r\n\r\n if (threshold === undefined)\r\n threshold = 0;\r\n\r\n for (var i = 0; i < len; ++i) {\r\n if (ignoreCase)\r\n distance = levenshtein(word, dictionary[i], true);\r\n else\r\n distance = levenshtein(word, dictionary[i]);\r\n\r\n if (distance > word.length)\r\n ratio = 1 - distance / dictionary[i].length;\r\n else\r\n ratio = 1 - distance / word.length;\r\n\r\n if (ratio > max_ratio) {\r\n max_ratio = ratio;\r\n proposed = dictionary[i];\r\n }\r\n }\r\n\r\n if (max_ratio >= threshold)\r\n return proposed;\r\n\r\n return null;\r\n}\r\n\r\nmodule.exports = propose;", "'use strict';\n\n// do not edit .js files directly - edit src/index.jst\n\n\n\nmodule.exports = function equal(a, b) {\n if (a === b) return true;\n\n if (a && b && typeof a == 'object' && typeof b == 'object') {\n if (a.constructor !== b.constructor) return false;\n\n var length, i, keys;\n if (Array.isArray(a)) {\n length = a.length;\n if (length != b.length) return false;\n for (i = length; i-- !== 0;)\n if (!equal(a[i], b[i])) return false;\n return true;\n }\n\n\n\n if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;\n if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();\n if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();\n\n keys = Object.keys(a);\n length = keys.length;\n if (length !== Object.keys(b).length) return false;\n\n for (i = length; i-- !== 0;)\n if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;\n\n for (i = length; i-- !== 0;) {\n var key = keys[i];\n\n if (!equal(a[key], b[key])) return false;\n }\n\n return true;\n }\n\n // true if both NaN, false otherwise\n return a!==a && b!==b;\n};\n", "/**\r\n * The library providing the runtime functionality of Encore.\r\n *\r\n * @packageDocumentation\r\n */\r\n\r\nexport * from './coreExports'\r\nexport * from './types/public'\r\nimport {defer} from '@encorejs/utils/defer'\r\nimport CoreBundle from './CoreBundle'\r\nimport {globalVariableNames} from './globals'\r\nimport type {$____FixmeStudio} from '@encorejs/core/types/public'\r\nimport type {IStudio, InitOpts} from './types/public'\r\n\r\nconst studioDeferred = defer<$____FixmeStudio>()\r\n\r\nexport async function getStudio(): Promise<IStudio> {\r\n return (await studioDeferred.promise).publicApi\r\n}\r\n\r\nexport function getStudioSync(\r\n errorIfNotReady: boolean = false,\r\n): IStudio | undefined {\r\n if (studioDeferred.status !== 'resolved') {\r\n if (errorIfNotReady) throw new Error(`Studio is not ready yet.`)\r\n return undefined\r\n }\r\n return studioDeferred.currentValue!.publicApi\r\n}\r\n\r\nlet initCalled = false\r\nconst initOptsDeferred = defer<InitOpts | undefined>()\r\n\r\nexport async function init(opts?: InitOpts) {\r\n if (initCalled) {\r\n return\r\n }\r\n initCalled = true\r\n initOptsDeferred.resolve(opts)\r\n}\r\n\r\nconst theatre = {getStudio, getStudioSync, init}\r\nexport default theatre\r\n\r\ntype StudioBundle = $____FixmeStudio // todo\r\n\r\nregisterCoreBundle()\r\n\r\n/**\r\n * @remarks\r\n * the studio and core need to communicate with each other somehow, and currently we do that\r\n * by registering each of them as a global variable. This function does the work of registering\r\n * the core bundle (everything exported from `@encorejs/core`) to window.__Encore_CoreBundle.\r\n */\r\nfunction registerCoreBundle() {\r\n // This only works in a browser environment\r\n if (\r\n typeof window == 'undefined' &&\r\n global.__THEATREJS__FORCE_CONNECT_CORE_AND_STUDIO !== true\r\n )\r\n return\r\n\r\n const globalContext = typeof window !== 'undefined' ? window : global\r\n\r\n // another core bundle may already be registered\r\n\r\n const existingBundle: CoreBundle | undefined =\r\n // @ts-ignore ignore\r\n globalContext[globalVariableNames.coreBundle]\r\n\r\n if (typeof existingBundle !== 'undefined') {\r\n if (\r\n typeof existingBundle === 'object' &&\r\n existingBundle &&\r\n typeof existingBundle.version === 'string'\r\n ) {\r\n /*\r\n Another core bundle is registered. This usually means the bundler is not configured correctly and\r\n is bundling `@encorejs/core` multiple times, but, there are legitimate scenarios where a user may want\r\n to include multiple instances of `@encorejs/core` on the same page.\r\n\r\n For example, an article might embed two separate interactive graphics that\r\n are made by different teams (and even different tech stacks -- one in JS, the other in clojurescript).\r\n\r\n If both of those graphics use Encore, our current setup makes them conflict with one another.\r\n\r\n ----------------------\r\n --------------------\r\n ----------------------\r\n -------.\r\n\r\n | /\\_/\\ |\r\n | ( o.o ) | --------> graphic1 made with JS+Encore\r\n | > ^ < |\r\n\r\n ## ---\r\n ----------------------\r\n --------------------\r\n ----------------------\r\n -------.\r\n\r\n | __ _ |\r\n | o'')}____// | --------> graphic2 made with clojurescript+Encore\r\n | `_/ ) |\r\n | (_(_/-(_/ |\r\n \r\n ---------------------\r\n -----\u2665.\r\n\r\n @todo Make it possible to have multiple separate bundles on the same page, but still communicate\r\n that there is more than one bundle so we can warn the user about bundler misconfiguration.\r\n \r\n */\r\n throw new Error(\r\n `It seems that the module '@encorejs/core' is loaded more than once. This could have two possible causes:\\n` +\r\n `1. You might have two separate versions of Encore in node_modules.\\n` +\r\n `2. Or this might be a bundling misconfiguration, in case you're using a bundler like Webpack/ESBuild/Rollup.\\n\\n` +\r\n `Note that it **is okay** to import '@encorejs/core' multiple times. But those imports should point to the same module.`,\r\n )\r\n } else {\r\n throw new Error(\r\n `The variable window.${globalVariableNames.coreBundle} seems to be already set by a module other than @encorejs/core.`,\r\n )\r\n }\r\n }\r\n\r\n const coreBundle = new CoreBundle({\r\n onAttach: (s) => {\r\n void initOptsDeferred.promise.then((opts) => {\r\n s.initialize(opts)\r\n studioDeferred.resolve(s)\r\n })\r\n },\r\n })\r\n\r\n // @ts-ignore ignore\r\n globalContext[globalVariableNames.coreBundle] = coreBundle\r\n\r\n const possibleExistingStudioBundle: undefined | StudioBundle =\r\n // @ts-ignore ignore\r\n globalContext[globalVariableNames.studioBundle]\r\n\r\n if (\r\n possibleExistingStudioBundle &&\r\n possibleExistingStudioBundle !== null &&\r\n possibleExistingStudioBundle.type === 'Theatre_StudioBundle'\r\n ) {\r\n possibleExistingStudioBundle.registerCoreBundle(coreBundle)\r\n }\r\n}\r\n", "import projectsSingleton from './projects/projectsSingleton'\r\nimport TheatreProject from './projects/TheatreProject'\r\nimport * as types from './propTypes'\r\nimport {validateName} from '@encorejs/utils/sanitizers'\r\nimport deepEqual from 'fast-deep-equal'\r\nimport type {PointerType, Prism} from '@encorejs/dataverse'\r\nimport {isPointer} from '@encorejs/dataverse'\r\nimport {isPrism, pointerToPrism} from '@encorejs/dataverse'\r\nimport type {$IntentionalAny, VoidFn} from '@encorejs/core/types/public'\r\nimport type {ProjectId} from '@encorejs/core/types/public'\r\nimport {getCoreTicker} from './coreTicker'\r\nimport {privateAPI} from './privateAPIs'\r\nexport {notify} from '@encorejs/core/utils/notify'\r\nexport {types}\r\nexport {createRafDriver} from './rafDrivers'\r\nimport * as propTypeUtils from './propTypes/utils'\r\nimport * as ids from './utils/ids'\r\nimport * as keyframeUtils from './utils/keyframeUtils'\r\nimport * as instanceTypes from './utils/instanceTypes'\r\nimport {globals} from './globals'\r\nimport {\r\n deepValidateOnDiskState,\r\n shallowValidateOnDiskState,\r\n validateProjectIdOrThrow,\r\n} from './projects/Project'\r\nimport type {IProjectConfig, IProject, IRafDriver} from './types/public'\r\n\r\nexport const __private = {\r\n propTypeUtils,\r\n ids,\r\n instanceTypes,\r\n keyframeUtils,\r\n currentProjectStateDefinitionVersion:\r\n globals.currentProjectStateDefinitionVersion,\r\n}\r\n\r\n/**\r\n * Returns a project of the given id, or creates one if it doesn't already exist.\r\n *\r\n * @remarks\r\n * If \\@encorejs/studio is also loaded, then the state of the project will be managed by the studio.\r\n *\r\n * [Learn more about exporting](https://www.theatrejs.com/docs/latest/manual/projects#state)\r\n *\r\n * @example\r\n * Usage:\r\n * ```ts\r\n * import {getProject} from '@encorejs/core'\r\n * const config = {} // the config can be empty when starting a new project\r\n * const project = getProject(\"a-unique-id\", config)\r\n * ```\r\n *\r\n * @example\r\n * Usage with an explicit state:\r\n * ```ts\r\n * import {getProject} from '@encorejs/core'\r\n * import state from './saved-state.json'\r\n * const config = {state} // here the config contains our saved state\r\n * const project = getProject(\"a-unique-id\", config)\r\n * ```\r\n */\r\nexport function getProject(id: string, config: IProjectConfig = {}): IProject {\r\n const existingProject = projectsSingleton.get(id as ProjectId)\r\n if (existingProject) {\r\n if (process.env.NODE_ENV !== 'production') {\r\n if (!deepEqual(config, existingProject.config)) {\r\n throw new Error(\r\n `You seem to have called Theatre.getProject(\"${id}\", config) twice, with different config objects. ` +\r\n `This is disallowed because changing the config of a project on the fly can lead to hard-to-debug issues.\\n\\n` +\r\n `You can fix this by either calling Theatre.getProject() once per projectId,` +\r\n ` or calling it multiple times but with the exact same config.`,\r\n )\r\n }\r\n }\r\n return existingProject.publicApi\r\n }\r\n\r\n if (process.env.NODE_ENV !== 'production') {\r\n validateName(id, 'projectName in Theatre.getProject(projectName)', true)\r\n validateProjectIdOrThrow(id)\r\n }\r\n\r\n if (config.state) {\r\n if (process.env.NODE_ENV !== 'production') {\r\n shallowValidateOnDiskState(id as ProjectId, config.state)\r\n } else {\r\n deepValidateOnDiskState(id as ProjectId, config.state)\r\n }\r\n } else {\r\n }\r\n\r\n return new TheatreProject(id, config)\r\n}\r\n\r\n/**\r\n * Calls `callback` every time the pointed value of `pointer` changes.\r\n *\r\n * @param pointer - A Pointer (like `object.props.x`)\r\n * @param callback - The callback is called every time the value of pointer changes\r\n * @param rafDriver - (optional) The `rafDriver` to use. Learn how to use `rafDriver`s [from the docs](https://www.theatrejs.com/docs/latest/manual/advanced#rafdrivers).\r\n * @returns An unsubscribe function\r\n *\r\n * @example\r\n * Usage:\r\n * ```ts\r\n * import {getProject, onChange} from '@encorejs/core'\r\n *\r\n * const obj = getProject(\"A project\").sheet(\"Scene\").object(\"Box\", {position: {x: 0}})\r\n *\r\n * const usubscribe = onChange(obj.props.position.x, (x) => {\r\n * console.log('position.x changed to:', x)\r\n * })\r\n *\r\n * setTimeout(usubscribe, 10000) // stop listening to changes after 10 seconds\r\n * ```\r\n */\r\nexport function onChange<\r\n P extends PointerType<$IntentionalAny> | Prism<$IntentionalAny>,\r\n>(\r\n pointer: P,\r\n callback: (\r\n value: P extends PointerType<infer T>\r\n ? T\r\n : P extends Prism<infer T>\r\n ? T\r\n : unknown,\r\n ) => void,\r\n rafDriver?: IRafDriver,\r\n): VoidFn {\r\n const ticker = rafDriver ? privateAPI(rafDriver).ticker : getCoreTicker()\r\n\r\n if (isPointer(pointer)) {\r\n const pr = pointerToPrism(pointer)\r\n return pr.onChange(ticker, callback as $IntentionalAny, true)\r\n } else if (isPrism(pointer)) {\r\n return pointer.onChange(ticker, callback as $IntentionalAny, true)\r\n } else {\r\n throw new Error(\r\n `Called onChange(p) where p is neither a pointer nor a prism.`,\r\n )\r\n }\r\n}\r\n\r\n/**\r\n * Takes a Pointer and returns the value it points to.\r\n *\r\n * @param pointer - A pointer (like `object.props.x`)\r\n * @returns The value the pointer points to\r\n *\r\n * @example\r\n *\r\n * Usage\r\n * ```ts\r\n * import {val, getProject} from '@encorejs/core'\r\n *\r\n * const obj = getProject(\"A project\").sheet(\"Scene\").object(\"Box\", {position: {x: 0}})\r\n *\r\n * console.log(val(obj.props.position.x)) // logs the value of obj.props.x\r\n * ```\r\n */\r\nexport function val<T>(pointer: PointerType<T>): T {\r\n if (isPointer(pointer)) {\r\n return pointerToPrism(pointer).getValue() as $IntentionalAny\r\n } else {\r\n throw new Error(`Called val(p) where p is not a pointer.`)\r\n }\r\n}\r\n", "import {Atom} from '@encorejs/dataverse'\r\nimport type {ProjectId} from '@encorejs/core/types/public'\r\nimport type Project from './Project'\r\n\r\ninterface State {\r\n projects: Record<ProjectId, Project>\r\n}\r\n\r\nclass ProjectsSingleton {\r\n readonly atom = new Atom({projects: {}} as State)\r\n constructor() {}\r\n\r\n /**\r\n * We're trusting here that each project id is unique\r\n */\r\n add(id: ProjectId, project: Project) {\r\n this.atom.setByPointer((p) => p.projects[id], project)\r\n }\r\n\r\n get(id: ProjectId): Project | undefined {\r\n return this.atom.get().projects[id]\r\n }\r\n\r\n has(id: ProjectId) {\r\n return !!this.get(id)\r\n }\r\n}\r\n\r\nconst singleton = new ProjectsSingleton()\r\n\r\nexport default singleton\r\n", "import type Project from '@encorejs/core/projects/Project'\r\nimport type Sequence from '@encorejs/core/sequences/Sequence'\r\nimport type SheetObject from '@encorejs/core/sheetObjects/SheetObject'\r\nimport type Sheet from '@encorejs/core/sheets/Sheet'\r\nimport type {RafDriverPrivateAPI} from './rafDrivers'\r\nimport type {\r\n IProject,\r\n IRafDriver,\r\n ISequence,\r\n ISheet,\r\n ISheetObject,\r\n UnknownShorthandCompoundProps,\r\n} from './types/public'\r\nimport type {$IntentionalAny} from '@encorejs/core/types/public'\r\n\r\nconst publicAPIToPrivateAPIMap = new WeakMap()\r\n\r\n/**\r\n * Given a public API object, returns the corresponding private API object.\r\n */\r\nexport function privateAPI<P extends {type: string}>(\r\n pub: P,\r\n): P extends IProject\r\n ? Project\r\n : P extends ISheet\r\n ? Sheet\r\n : P extends ISheetObject<$IntentionalAny>\r\n ? SheetObject\r\n : P extends ISequence\r\n ? Sequence\r\n : P extends IRafDriver\r\n ? RafDriverPrivateAPI\r\n : never {\r\n return publicAPIToPrivateAPIMap.get(pub)\r\n}\r\n\r\n/**\r\n * Notes the relationship between a public API object and its corresponding private API object,\r\n * so that `privateAPI` can find it.\r\n */\r\nexport function setPrivateAPI(pub: IProject, priv: Project): void\r\nexport function setPrivateAPI(pub: ISheet, priv: Sheet): void\r\nexport function setPrivateAPI(pub: ISequence, priv: Sequence): void\r\nexport function setPrivateAPI(pub: IRafDriver, priv: RafDriverPrivateAPI): void\r\nexport function setPrivateAPI<Props extends UnknownShorthandCompoundProps>(\r\n pub: ISheetObject<Props>,\r\n priv: SheetObject,\r\n): void\r\nexport function setPrivateAPI(pub: {}, priv: {}): void {\r\n publicAPIToPrivateAPIMap.set(pub, priv)\r\n}\r\n", "/**\r\n * This is just an empty object used in place of `{}` when you want to:\r\n * 1. Not create many new objects (less GC pressure)\r\n * 2. Have the empty object be a singleton (so that `===` works), so it can be fed to memoized functions.\r\n */\r\nexport const emptyObject = {}\r\n\r\n/**\r\n * The array equivalent of {@link emptyObject}.\r\n */\r\nexport const emptyArray: ReadonlyArray<unknown> = []\r\n", "/**\n * Checks if `value` is classified as an `Array` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array, else `false`.\n * @example\n *\n * _.isArray([1, 2, 3]);\n * // => true\n *\n * _.isArray(document.body.children);\n * // => false\n *\n * _.isArray('abc');\n * // => false\n *\n * _.isArray(_.noop);\n * // => false\n */\nvar isArray = Array.isArray;\n\nexport default isArray;\n", "/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\nexport default freeGlobal;\n", "import freeGlobal from './_freeGlobal.js';\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\nexport default root;\n", "import root from './_root.js';\n\n/** Built-in value references. */\nvar Symbol = root.Symbol;\n\nexport default Symbol;\n", "import Symbol from './_Symbol.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the raw `toStringTag`.\n */\nfunction getRawTag(value) {\n var isOwn = hasOwnProperty.call(value, symToStringTag),\n tag = value[symToStringTag];\n\n try {\n value[symToStringTag] = undefined;\n var unmasked = true;\n } catch (e) {}\n\n var result = nativeObjectToString.call(value);\n if (unmasked) {\n if (isOwn) {\n value[symToStringTag] = tag;\n } else {\n delete value[symToStringTag];\n }\n }\n return result;\n}\n\nexport default getRawTag;\n", "/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/**\n * Converts `value` to a string using `Object.prototype.toString`.\n *\n * @private\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n */\nfunction objectToString(value) {\n return nativeObjectToString.call(value);\n}\n\nexport default objectToString;\n", "import Symbol from './_Symbol.js';\nimport getRawTag from './_getRawTag.js';\nimport objectToString from './_objectToString.js';\n\n/** `Object#toString` result references. */\nvar nullTag = '[object Null]',\n undefinedTag = '[object Undefined]';\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * The base implementation of `getTag` without fallbacks for buggy environments.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nfunction baseGetTag(value) {\n if (value == null) {\n return value === undefined ? undefinedTag : nullTag;\n }\n return (symToStringTag && symToStringTag in Object(value))\n ? getRawTag(value)\n : objectToString(value);\n}\n\nexport default baseGetTag;\n", "/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return value != null && typeof value == 'object';\n}\n\nexport default isObjectLike;\n", "import baseGetTag from './_baseGetTag.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** `Object#toString` result references. */\nvar symbolTag = '[object Symbol]';\n\n/**\n * Checks if `value` is classified as a `Symbol` primitive or object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.\n * @example\n *\n * _.isSymbol(Symbol.iterator);\n * // => true\n *\n * _.isSymbol('abc');\n * // => false\n */\nfunction isSymbol(value) {\n return typeof value == 'symbol' ||\n (isObjectLike(value) && baseGetTag(value) == symbolTag);\n}\n\nexport default isSymbol;\n", "import isArray from './isArray.js';\nimport isSymbol from './isSymbol.js';\n\n/** Used to match property names within property paths. */\nvar reIsDeepProp = /\\.|\\[(?:[^[\\]]*|([\"'])(?:(?!\\1)[^\\\\]|\\\\.)*?\\1)\\]/,\n reIsPlainProp = /^\\w*$/;\n\n/**\n * Checks if `value` is a property name and not a property path.\n *\n * @private\n * @param {*} value The value to check.\n * @param {Object} [object] The object to query keys on.\n * @returns {boolean} Returns `true` if `value` is a property name, else `false`.\n */\nfunction isKey(value, object) {\n if (isArray(value)) {\n return false;\n }\n var type = typeof value;\n if (type == 'number' || type == 'symbol' || type == 'boolean' ||\n value == null || isSymbol(value)) {\n return true;\n }\n return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||\n (object != null && value in Object(object));\n}\n\nexport default isKey;\n", "/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return value != null && (type == 'object' || type == 'function');\n}\n\nexport default isObject;\n", "import baseGetTag from './_baseGetTag.js';\nimport isObject from './isObject.js';\n\n/** `Object#toString` result references. */\nvar asyncTag = '[object AsyncFunction]',\n funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]',\n proxyTag = '[object Proxy]';\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a function, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n if (!isObject(value)) {\n return false;\n }\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in Safari 9 which returns 'object' for typed arrays and other constructors.\n var tag = baseGetTag(value);\n return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;\n}\n\nexport default isFunction;\n", "import root from './_root.js';\n\n/** Used to detect overreaching core-js shims. */\nvar coreJsData = root['__core-js_shared__'];\n\nexport default coreJsData;\n", "import coreJsData from './_coreJsData.js';\n\n/** Used to detect methods masquerading as native. */\nvar maskSrcKey = (function() {\n var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');\n return uid ? ('Symbol(src)_1.' + uid) : '';\n}());\n\n/**\n * Checks if `func` has its source masked.\n *\n * @private\n * @param {Function} func The function to check.\n * @returns {boolean} Returns `true` if `func` is masked, else `false`.\n */\nfunction isMasked(func) {\n return !!maskSrcKey && (maskSrcKey in func);\n}\n\nexport default isMasked;\n", "/** Used for built-in method references. */\nvar funcProto = Function.prototype;\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString = funcProto.toString;\n\n/**\n * Converts `func` to its source code.\n *\n * @private\n * @param {Function} func The function to convert.\n * @returns {string} Returns the source code.\n */\nfunction toSource(func) {\n if (func != null) {\n try {\n return funcToString.call(func);\n } catch (e) {}\n try {\n return (func + '');\n } catch (e) {}\n }\n return '';\n}\n\nexport default toSource;\n", "import isFunction from './isFunction.js';\nimport isMasked from './_isMasked.js';\nimport isObject from './isObject.js';\nimport toSource from './_toSource.js';\n\n/**\n * Used to match `RegExp`\n * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).\n */\nvar reRegExpChar = /[\\\\^$.*+?()[\\]{}|]/g;\n\n/** Used to detect host constructors (Safari). */\nvar reIsHostCtor = /^\\[object .+?Constructor\\]$/;\n\n/** Used for built-in method references. */\nvar funcProto = Function.prototype,\n objectProto = Object.prototype;\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString = funcProto.toString;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/** Used to detect if a method is native. */\nvar reIsNative = RegExp('^' +\n funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\\\$&')\n .replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g, '$1.*?') + '$'\n);\n\n/**\n * The base implementation of `_.isNative` without bad shim checks.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a native function,\n * else `false`.\n */\nfunction baseIsNative(value) {\n if (!isObject(value) || isMasked(value)) {\n return false;\n }\n var pattern = isFunction(value) ? reIsNative : reIsHostCtor;\n return pattern.test(toSource(value));\n}\n\nexport default baseIsNative;\n", "/**\n * Gets the value at `key` of `object`.\n *\n * @private\n * @param {Object} [object] The object to query.\n * @param {string} key The key of the property to get.\n * @returns {*} Returns the property value.\n */\nfunction getValue(object, key) {\n return object == null ? undefined : object[key];\n}\n\nexport default getValue;\n", "import baseIsNative from './_baseIsNative.js';\nimport getValue from './_getValue.js';\n\n/**\n * Gets the native function at `key` of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {string} key The key of the method to get.\n * @returns {*} Returns the function if it's native, else `undefined`.\n */\nfunction getNative(object, key) {\n var value = getValue(object, key);\n return baseIsNative(value) ? value : undefined;\n}\n\nexport default getNative;\n", "import getNative from './_getNative.js';\n\n/* Built-in method references that are verified to be native. */\nvar nativeCreate = getNative(Object, 'create');\n\nexport default nativeCreate;\n", "import nativeCreate from './_nativeCreate.js';\n\n/**\n * Removes all key-value entries from the hash.\n *\n * @private\n * @name clear\n * @memberOf Hash\n */\nfunction hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n}\n\nexport default hashClear;\n", "/**\n * Removes `key` and its value from the hash.\n *\n * @private\n * @name delete\n * @memberOf Hash\n * @param {Object} hash The hash to modify.\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction hashDelete(key) {\n var result = this.has(key) && delete this.__data__[key];\n this.size -= result ? 1 : 0;\n return result;\n}\n\nexport default hashDelete;\n", "import nativeCreate from './_nativeCreate.js';\n\n/** Used to stand-in for `undefined` hash values. */\nvar HASH_UNDEFINED = '__lodash_hash_undefined__';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Gets the hash value for `key`.\n *\n * @private\n * @name get\n * @memberOf Hash\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction hashGet(key) {\n var data = this.__data__;\n if (nativeCreate) {\n var result = data[key];\n return result === HASH_UNDEFINED ? undefined : result;\n }\n return hasOwnProperty.call(data, key) ? data[key] : undefined;\n}\n\nexport default hashGet;\n", "import nativeCreate from './_nativeCreate.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Checks if a hash value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Hash\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction hashHas(key) {\n var data = this.__data__;\n return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);\n}\n\nexport default hashHas;\n", "import nativeCreate from './_nativeCreate.js';\n\n/** Used to stand-in for `undefined` hash values. */\nvar HASH_UNDEFINED = '__lodash_hash_undefined__';\n\n/**\n * Sets the hash `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf Hash\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the hash instance.\n */\nfunction hashSet(key, value) {\n var data = this.__data__;\n this.size += this.has(key) ? 0 : 1;\n data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;\n return this;\n}\n\nexport default hashSet;\n", "import hashClear from './_hashClear.js';\nimport hashDelete from './_hashDelete.js';\nimport hashGet from './_hashGet.js';\nimport hashHas from './_hashHas.js';\nimport hashSet from './_hashSet.js';\n\n/**\n * Creates a hash object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction Hash(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n// Add methods to `Hash`.\nHash.prototype.clear = hashClear;\nHash.prototype['delete'] = hashDelete;\nHash.prototype.get = hashGet;\nHash.prototype.has = hashHas;\nHash.prototype.set = hashSet;\n\nexport default Hash;\n", "/**\n * Removes all key-value entries from the list cache.\n *\n * @private\n * @name clear\n * @memberOf ListCache\n */\nfunction listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n}\n\nexport default listCacheClear;\n", "/**\n * Performs a\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * comparison between two values to determine if they are equivalent.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * var object = { 'a': 1 };\n * var other = { 'a': 1 };\n *\n * _.eq(object, object);\n * // => true\n *\n * _.eq(object, other);\n * // => false\n *\n * _.eq('a', 'a');\n * // => true\n *\n * _.eq('a', Object('a'));\n * // => false\n *\n * _.eq(NaN, NaN);\n * // => true\n */\nfunction eq(value, other) {\n return value === other || (value !== value && other !== other);\n}\n\nexport default eq;\n", "import eq from './eq.js';\n\n/**\n * Gets the index at which the `key` is found in `array` of key-value pairs.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} key The key to search for.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\nfunction assocIndexOf(array, key) {\n var length = array.length;\n while (length--) {\n if (eq(array[length][0], key)) {\n return length;\n }\n }\n return -1;\n}\n\nexport default assocIndexOf;\n", "import assocIndexOf from './_assocIndexOf.js';\n\n/** Used for built-in method references. */\nvar arrayProto = Array.prototype;\n\n/** Built-in value references. */\nvar splice = arrayProto.splice;\n\n/**\n * Removes `key` and its value from the list cache.\n *\n * @private\n * @name delete\n * @memberOf ListCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction listCacheDelete(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n return false;\n }\n var lastIndex = data.length - 1;\n if (index == lastIndex) {\n data.pop();\n } else {\n splice.call(data, index, 1);\n }\n --this.size;\n return true;\n}\n\nexport default listCacheDelete;\n", "import assocIndexOf from './_assocIndexOf.js';\n\n/**\n * Gets the list cache value for `key`.\n *\n * @private\n * @name get\n * @memberOf ListCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction listCacheGet(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n return index < 0 ? undefined : data[index][1];\n}\n\nexport default listCacheGet;\n", "import assocIndexOf from './_assocIndexOf.js';\n\n/**\n * Checks if a list cache value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf ListCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction listCacheHas(key) {\n return assocIndexOf(this.__data__, key) > -1;\n}\n\nexport default listCacheHas;\n", "import assocIndexOf from './_assocIndexOf.js';\n\n/**\n * Sets the list cache `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf ListCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the list cache instance.\n */\nfunction listCacheSet(key, value) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n ++this.size;\n data.push([key, value]);\n } else {\n data[index][1] = value;\n }\n return this;\n}\n\nexport default listCacheSet;\n", "import listCacheClear from './_listCacheClear.js';\nimport listCacheDelete from './_listCacheDelete.js';\nimport listCacheGet from './_listCacheGet.js';\nimport listCacheHas from './_listCacheHas.js';\nimport listCacheSet from './_listCacheSet.js';\n\n/**\n * Creates an list cache object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction ListCache(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n// Add methods to `ListCache`.\nListCache.prototype.clear = listCacheClear;\nListCache.prototype['delete'] = listCacheDelete;\nListCache.prototype.get = listCacheGet;\nListCache.prototype.has = listCacheHas;\nListCache.prototype.set = listCacheSet;\n\nexport default ListCache;\n", "import getNative from './_getNative.js';\nimport root from './_root.js';\n\n/* Built-in method references that are verified to be native. */\nvar Map = getNative(root, 'Map');\n\nexport default Map;\n", "import Hash from './_Hash.js';\nimport ListCache from './_ListCache.js';\nimport Map from './_Map.js';\n\n/**\n * Removes all key-value entries from the map.\n *\n * @private\n * @name clear\n * @memberOf MapCache\n */\nfunction mapCacheClear() {\n this.size = 0;\n this.__data__ = {\n 'hash': new Hash,\n 'map': new (Map || ListCache),\n 'string': new Hash\n };\n}\n\nexport default mapCacheClear;\n", "/**\n * Checks if `value` is suitable for use as unique object key.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is suitable, else `false`.\n */\nfunction isKeyable(value) {\n var type = typeof value;\n return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')\n ? (value !== '__proto__')\n : (value === null);\n}\n\nexport default isKeyable;\n", "import isKeyable from './_isKeyable.js';\n\n/**\n * Gets the data for `map`.\n *\n * @private\n * @param {Object} map The map to query.\n * @param {string} key The reference key.\n * @returns {*} Returns the map data.\n */\nfunction getMapData(map, key) {\n var data = map.__data__;\n return isKeyable(key)\n ? data[typeof key == 'string' ? 'string' : 'hash']\n : data.map;\n}\n\nexport default getMapData;\n", "import getMapData from './_getMapData.js';\n\n/**\n * Removes `key` and its value from the map.\n *\n * @private\n * @name delete\n * @memberOf MapCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction mapCacheDelete(key) {\n var result = getMapData(this, key)['delete'](key);\n this.size -= result ? 1 : 0;\n return result;\n}\n\nexport default mapCacheDelete;\n", "import getMapData from './_getMapData.js';\n\n/**\n * Gets the map value for `key`.\n *\n * @private\n * @name get\n * @memberOf MapCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction mapCacheGet(key) {\n return getMapData(this, key).get(key);\n}\n\nexport default mapCacheGet;\n", "import getMapData from './_getMapData.js';\n\n/**\n * Checks if a map value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf MapCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction mapCacheHas(key) {\n return getMapData(this, key).has(key);\n}\n\nexport default mapCacheHas;\n", "import getMapData from './_getMapData.js';\n\n/**\n * Sets the map `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf MapCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the map cache instance.\n */\nfunction mapCacheSet(key, value) {\n var data = getMapData(this, key),\n size = data.size;\n\n data.set(key, value);\n this.size += data.size == size ? 0 : 1;\n return this;\n}\n\nexport default mapCacheSet;\n", "import mapCacheClear from './_mapCacheClear.js';\nimport mapCacheDelete from './_mapCacheDelete.js';\nimport mapCacheGet from './_mapCacheGet.js';\nimport mapCacheHas from './_mapCacheHas.js';\nimport mapCacheSet from './_mapCacheSet.js';\n\n/**\n * Creates a map cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction MapCache(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n// Add methods to `MapCache`.\nMapCache.prototype.clear = mapCacheClear;\nMapCache.prototype['delete'] = mapCacheDelete;\nMapCache.prototype.get = mapCacheGet;\nMapCache.prototype.has = mapCacheHas;\nMapCache.prototype.set = mapCacheSet;\n\nexport default MapCache;\n", "import MapCache from './_MapCache.js';\n\n/** Error message constants. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/**\n * Creates a function that memoizes the result of `func`. If `resolver` is\n * provided, it determines the cache key for storing the result based on the\n * arguments provided to the memoized function. By default, the first argument\n * provided to the memoized function is used as the map cache key. The `func`\n * is invoked with the `this` binding of the memoized function.\n *\n * **Note:** The cache is exposed as the `cache` property on the memoized\n * function. Its creation may be customized by replacing the `_.memoize.Cache`\n * constructor with one whose instances implement the\n * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)\n * method interface of `clear`, `delete`, `get`, `has`, and `set`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to have its output memoized.\n * @param {Function} [resolver] The function to resolve the cache key.\n * @returns {Function} Returns the new memoized function.\n * @example\n *\n * var object = { 'a': 1, 'b': 2 };\n * var other = { 'c': 3, 'd': 4 };\n *\n * var values = _.memoize(_.values);\n * values(object);\n * // => [1, 2]\n *\n * values(other);\n * // => [3, 4]\n *\n * object.a = 2;\n * values(object);\n * // => [1, 2]\n *\n * // Modify the result cache.\n * values.cache.set(object, ['a', 'b']);\n * values(object);\n * // => ['a', 'b']\n *\n * // Replace `_.memoize.Cache`.\n * _.memoize.Cache = WeakMap;\n */\nfunction memoize(func, resolver) {\n if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n var memoized = function() {\n var args = arguments,\n key = resolver ? resolver.apply(this, args) : args[0],\n cache = memoized.cache;\n\n if (cache.has(key)) {\n return cache.get(key);\n }\n var result = func.apply(this, args);\n memoized.cache = cache.set(key, result) || cache;\n return result;\n };\n memoized.cache = new (memoize.Cache || MapCache);\n return memoized;\n}\n\n// Expose `MapCache`.\nmemoize.Cache = MapCache;\n\nexport default memoize;\n", "import memoize from './memoize.js';\n\n/** Used as the maximum memoize cache size. */\nvar MAX_MEMOIZE_SIZE = 500;\n\n/**\n * A specialized version of `_.memoize` which clears the memoized function's\n * cache when it exceeds `MAX_MEMOIZE_SIZE`.\n *\n * @private\n * @param {Function} func The function to have its output memoized.\n * @returns {Function} Returns the new memoized function.\n */\nfunction memoizeCapped(func) {\n var result = memoize(func, function(key) {\n if (cache.size === MAX_MEMOIZE_SIZE) {\n cache.clear();\n }\n return key;\n });\n\n var cache = result.cache;\n return result;\n}\n\nexport default memoizeCapped;\n", "import memoizeCapped from './_memoizeCapped.js';\n\n/** Used to match property names within property paths. */\nvar rePropName = /[^.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|([\"'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))/g;\n\n/** Used to match backslashes in property paths. */\nvar reEscapeChar = /\\\\(\\\\)?/g;\n\n/**\n * Converts `string` to a property path array.\n *\n * @private\n * @param {string} string The string to convert.\n * @returns {Array} Returns the property path array.\n */\nvar stringToPath = memoizeCapped(function(string) {\n var result = [];\n if (string.charCodeAt(0) === 46 /* . */) {\n result.push('');\n }\n string.replace(rePropName, function(match, number, quote, subString) {\n result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));\n });\n return result;\n});\n\nexport default stringToPath;\n", "/**\n * A specialized version of `_.map` for arrays without support for iteratee\n * shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the new mapped array.\n */\nfunction arrayMap(array, iteratee) {\n var index = -1,\n length = array == null ? 0 : array.length,\n result = Array(length);\n\n while (++index < length) {\n result[index] = iteratee(array[index], index, array);\n }\n return result;\n}\n\nexport default arrayMap;\n", "import Symbol from './_Symbol.js';\nimport arrayMap from './_arrayMap.js';\nimport isArray from './isArray.js';\nimport isSymbol from './isSymbol.js';\n\n/** Used as references for various `Number` constants. */\nvar INFINITY = 1 / 0;\n\n/** Used to convert symbols to primitives and strings. */\nvar symbolProto = Symbol ? Symbol.prototype : undefined,\n symbolToString = symbolProto ? symbolProto.toString : undefined;\n\n/**\n * The base implementation of `_.toString` which doesn't convert nullish\n * values to empty strings.\n *\n * @private\n * @param {*} value The value to process.\n * @returns {string} Returns the string.\n */\nfunction baseToString(value) {\n // Exit early for strings to avoid a performance hit in some environments.\n if (typeof value == 'string') {\n return value;\n }\n if (isArray(value)) {\n // Recursively convert values (susceptible to call stack limits).\n return arrayMap(value, baseToString) + '';\n }\n if (isSymbol(value)) {\n return symbolToString ? symbolToString.call(value) : '';\n }\n var result = (value + '');\n return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;\n}\n\nexport default baseToString;\n", "import baseToString from './_baseToString.js';\n\n/**\n * Converts `value` to a string. An empty string is returned for `null`\n * and `undefined` values. The sign of `-0` is preserved.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n * @example\n *\n * _.toString(null);\n * // => ''\n *\n * _.toString(-0);\n * // => '-0'\n *\n * _.toString([1, 2, 3]);\n * // => '1,2,3'\n */\nfunction toString(value) {\n return value == null ? '' : baseToString(value);\n}\n\nexport default toString;\n", "import isArray from './isArray.js';\nimport isKey from './_isKey.js';\nimport stringToPath from './_stringToPath.js';\nimport toString from './toString.js';\n\n/**\n * Casts `value` to a path array if it's not one.\n *\n * @private\n * @param {*} value The value to inspect.\n * @param {Object} [object] The object to query keys on.\n * @returns {Array} Returns the cast property path array.\n */\nfunction castPath(value, object) {\n if (isArray(value)) {\n return value;\n }\n return isKey(value, object) ? [value] : stringToPath(toString(value));\n}\n\nexport default castPath;\n", "import isSymbol from './isSymbol.js';\n\n/** Used as references for various `Number` constants. */\nvar INFINITY = 1 / 0;\n\n/**\n * Converts `value` to a string key if it's not a string or symbol.\n *\n * @private\n * @param {*} value The value to inspect.\n * @returns {string|symbol} Returns the key.\n */\nfunction toKey(value) {\n if (typeof value == 'string' || isSymbol(value)) {\n return value;\n }\n var result = (value + '');\n return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;\n}\n\nexport default toKey;\n", "import castPath from './_castPath.js';\nimport toKey from './_toKey.js';\n\n/**\n * The base implementation of `_.get` without support for default values.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array|string} path The path of the property to get.\n * @returns {*} Returns the resolved value.\n */\nfunction baseGet(object, path) {\n path = castPath(path, object);\n\n var index = 0,\n length = path.length;\n\n while (object != null && index < length) {\n object = object[toKey(path[index++])];\n }\n return (index && index == length) ? object : undefined;\n}\n\nexport default baseGet;\n", "import baseGet from './_baseGet.js';\n\n/**\n * Gets the value at `path` of `object`. If the resolved value is\n * `undefined`, the `defaultValue` is returned in its place.\n *\n * @static\n * @memberOf _\n * @since 3.7.0\n * @category Object\n * @param {Object} object The object to query.\n * @param {Array|string} path The path of the property to get.\n * @param {*} [defaultValue] The value returned for `undefined` resolved values.\n * @returns {*} Returns the resolved value.\n * @example\n *\n * var object = { 'a': [{ 'b': { 'c': 3 } }] };\n *\n * _.get(object, 'a[0].b.c');\n * // => 3\n *\n * _.get(object, ['a', '0', 'b', 'c']);\n * // => 3\n *\n * _.get(object, 'a.b.c', 'default');\n * // => 'default'\n */\nfunction get(object, path, defaultValue) {\n var result = object == null ? undefined : baseGet(object, path);\n return result === undefined ? defaultValue : result;\n}\n\nexport default get;\n", "import lodashGet from 'lodash-es/get'\r\nimport type {PathToProp} from '@encorejs/utils/pathToProp'\r\n\r\n/**\r\n * Returns the value at `path` of `v`.\r\n *\r\n * Example:\r\n * ```ts\r\n * getDeep({a: {b: 1}}, ['a', 'b']) // 1\r\n * getDeep({a: {b: 1}}, ['a', 'c']) // undefined\r\n * getDeep({a: {b: 1}}, []) // {a: {b: 1}}\r\n * getDeep('hello', []) // 'hello''\r\n * getDeep('hello', ['a']) // undefined\r\n * ```\r\n */\r\nexport default function getDeep(v: {}, path: PathToProp): unknown {\r\n if (path.length === 0) return v\r\n return lodashGet(v, path)\r\n}\r\n", "import type {$IntentionalAny} from '@encorejs/utils/types'\r\n\r\n/**\r\n * A basic cache\r\n */\r\nexport default class SimpleCache {\r\n /**\r\n * NOTE this could also be a Map.\r\n */\r\n protected _values: Record<string, unknown> = {}\r\n constructor() {}\r\n\r\n /**\r\n * get the cache item at `key` or produce it using `producer` and cache _that_.\r\n *\r\n * Note that this won't work if you change the producer, like `get(key, producer1); get(key, producer2)`.\r\n */\r\n get<T>(key: string, producer: () => T): T {\r\n if (this.has(key)) {\r\n return this._values[key] as $IntentionalAny\r\n } else {\r\n const cachedValue = producer()\r\n this._values[key] = cachedValue\r\n return cachedValue\r\n }\r\n }\r\n\r\n /**\r\n * Returns true if the cache has an item at `key`.\r\n */\r\n has(key: string): boolean {\r\n return this._values.hasOwnProperty(key)\r\n }\r\n}\r\n", "import type Project from '@encorejs/core/projects/Project'\r\nimport type Sheet from '@encorejs/core/sheets/Sheet'\r\nimport type SheetTemplate from '@encorejs/core/sheets/SheetTemplate'\r\nimport {emptyArray} from '@encorejs/utils'\r\nimport type {\r\n SheetObjectAddress,\r\n WithoutSheetInstance,\r\n SerializableMap,\r\n SerializablePrimitive,\r\n SerializableValue,\r\n} from '@encorejs/core/types/public'\r\nimport type {PathToProp} from '@encorejs/utils/pathToProp'\r\nimport getDeep from '@encorejs/utils/getDeep'\r\nimport type {\r\n ObjectAddressKey,\r\n SequenceTrackId,\r\n} from '@encorejs/core/types/public'\r\nimport SimpleCache from '@encorejs/utils/SimpleCache'\r\nimport type {$FixMe, $IntentionalAny} from '@encorejs/core/types/public'\r\nimport type {Prism, Pointer} from '@encorejs/dataverse'\r\nimport {Atom, getPointerParts, prism, val} from '@encorejs/dataverse'\r\nimport set from 'lodash-es/set'\r\nimport getPropDefaultsOfSheetObject from './getPropDefaultsOfSheetObject'\r\nimport SheetObject from './SheetObject'\r\nimport {\r\n getPropConfigByPath,\r\n isPropConfSequencable,\r\n} from '@encorejs/core/propTypes/utils'\r\nimport getOrderingOfPropTypeConfig from './getOrderingOfPropTypeConfig'\r\nimport type {SheetState_Historic} from '@encorejs/core/types/private/core'\r\nimport {cloneDeep, unset} from 'lodash-es'\r\nimport type {\r\n SheetObjectActionsConfig,\r\n SheetObjectPropTypeConfig,\r\n} from '@encorejs/core/types/public'\r\n\r\nfunction isObjectEmpty(obj: unknown): boolean {\r\n return (\r\n typeof obj === 'object' && obj !== null && Object.keys(obj).length === 0\r\n )\r\n}\r\n\r\n/**\r\n * Given an object like: `{transform: {type: 'absolute', position: {x: 0}}}`,\r\n * if both `transform.type` and `transform.position.x` are sequenced, this\r\n * type would look like:\r\n *\r\n * ```ts\r\n * {\r\n * transform: {\r\n * type: 'SDFJSDFJ', // track id of transform.type\r\n * position: {\r\n * x: 'NCXNS' // track id of transform.position.x\r\n * }\r\n * }\r\n * }\r\n * ```\r\n */\r\nexport type IPropPathToTrackIdTree = {\r\n [propName in string]?: SequenceTrackId | IPropPathToTrackIdTree\r\n}\r\n\r\n/**\r\n * TODO: Add documentation, and share examples of sheet objects.\r\n *\r\n * See {@link SheetObject} for more information.\r\n */\r\nexport default class SheetObjectTemplate {\r\n readonly address: WithoutSheetInstance<SheetObjectAddress>\r\n readonly type: 'Theatre_SheetObjectTemplate' = 'Theatre_SheetObjectTemplate'\r\n protected _config: Atom<SheetObjectPropTypeConfig>\r\n readonly _temp_actions_atom: Atom<SheetObjectActionsConfig>\r\n readonly _cache = new SimpleCache()\r\n readonly project: Project\r\n readonly pointerToSheetState: Pointer<SheetState_Historic | undefined>\r\n readonly pointerToStaticOverrides: Pointer<\r\n SerializableMap<SerializablePrimitive> | undefined\r\n >\r\n\r\n get staticConfig() {\r\n return this._config.get()\r\n }\r\n\r\n get configPointer() {\r\n return this._config.pointer\r\n }\r\n\r\n get _temp_actions() {\r\n return this._temp_actions_atom.get()\r\n }\r\n\r\n get _temp_actionsPointer() {\r\n return this._temp_actions_atom.pointer\r\n }\r\n\r\n constructor(\r\n readonly sheetTemplate: SheetTemplate,\r\n objectKey: ObjectAddressKey,\r\n nativeObject: unknown,\r\n config: SheetObjectPropTypeConfig,\r\n _temp_actions: SheetObjectActionsConfig,\r\n ) {\r\n this.address = {...sheetTemplate.address, objectKey}\r\n this._config = new Atom(config)\r\n this._temp_actions_atom = new Atom(_temp_actions)\r\n this.project = sheetTemplate.project\r\n\r\n this.pointerToSheetState =\r\n this.sheetTemplate.project.pointers.historic.sheetsById[\r\n this.address.sheetId\r\n ]\r\n\r\n this.pointerToStaticOverrides =\r\n this.pointerToSheetState.staticOverrides.byObject[this.address.objectKey]\r\n }\r\n\r\n createInstance(\r\n sheet: Sheet,\r\n nativeObject: unknown,\r\n config: SheetObjectPropTypeConfig,\r\n ): SheetObject {\r\n this._config.set(config)\r\n return new SheetObject(sheet, this, nativeObject)\r\n }\r\n\r\n reconfigure(config: SheetObjectPropTypeConfig) {\r\n this._config.set(config)\r\n }\r\n\r\n /**\r\n * The `actions` api is temporary until we implement events.\r\n */\r\n _temp_setActions(actions: SheetObjectActionsConfig) {\r\n this._temp_actions_atom.set(actions)\r\n }\r\n\r\n /**\r\n * Returns the default values (all defaults are read from the config)\r\n */\r\n getDefaultValues(): Prism<SerializableMap> {\r\n return this._cache.get('getDefaultValues()', () =>\r\n prism(() => {\r\n const config = val(this.configPointer)\r\n return getPropDefaultsOfSheetObject(config)\r\n }),\r\n )\r\n }\r\n\r\n /**\r\n * Returns values that are set statically (ie, not sequenced, and not defaults)\r\n */\r\n getStaticValues(): Prism<SerializableMap> {\r\n return this._cache.get('getStaticValues', () =>\r\n prism(() => {\r\n const json = val(this.pointerToStaticOverrides) ?? {}\r\n\r\n const config = val(this.configPointer)\r\n const deserialized = config.deserializeAndSanitize(json) || {}\r\n return deserialized\r\n }),\r\n )\r\n }\r\n\r\n /**\r\n * Filters through the sequenced tracks and returns those tracks who are valid\r\n * according to the object's prop types, then sorted in the same order as the config\r\n *\r\n * Returns an array.\r\n */\r\n getArrayOfValidSequenceTracks(): Prism<\r\n Array<{pathToProp: PathToProp; trackId: SequenceTrackId}>\r\n > {\r\n return this._cache.get('getArrayOfValidSequenceTracks', () =>\r\n prism((): Array<{pathToProp: PathToProp; trackId: SequenceTrackId}> => {\r\n const pointerToSheetState =\r\n this.project.pointers.historic.sheetsById[this.address.sheetId]\r\n\r\n const trackIdByPropPath = val(\r\n pointerToSheetState.sequence.tracksByObject[this.address.objectKey]\r\n .trackIdByPropPath,\r\n )\r\n\r\n if (!trackIdByPropPath) return emptyArray as $IntentionalAny\r\n\r\n const arrayOfIds: Array<{\r\n pathToProp: PathToProp\r\n trackId: SequenceTrackId\r\n }> = []\r\n\r\n if (!trackIdByPropPath) return emptyArray as $IntentionalAny\r\n\r\n const objectConfig = val(this.configPointer)\r\n\r\n const _entries = Object.entries(trackIdByPropPath)\r\n for (const [pathToPropInString, trackId] of _entries) {\r\n const pathToProp = parsePathToProp(pathToPropInString)\r\n if (!pathToProp) continue\r\n\r\n const propConfig = getPropConfigByPath(objectConfig, pathToProp)\r\n\r\n const isSequencable = propConfig && isPropConfSequencable(propConfig)\r\n\r\n if (!isSequencable) continue\r\n\r\n arrayOfIds.push({pathToProp, trackId: trackId!})\r\n }\r\n\r\n const mapping = getOrderingOfPropTypeConfig(objectConfig)\r\n\r\n arrayOfIds.sort((a, b) => {\r\n const pathToPropA = a.pathToProp\r\n const pathToPropB = b.pathToProp\r\n\r\n const indexA = mapping.get(JSON.stringify(pathToPropA))!\r\n const indexB = mapping.get(JSON.stringify(pathToPropB))!\r\n\r\n if (indexA > indexB) {\r\n return 1\r\n }\r\n\r\n return -1\r\n })\r\n\r\n if (arrayOfIds.length === 0) {\r\n return emptyArray as $IntentionalAny\r\n } else {\r\n return arrayOfIds\r\n }\r\n }),\r\n )\r\n }\r\n\r\n /**\r\n * Filters through the sequenced tracks those tracks that are valid\r\n * according to the object's prop types.\r\n *\r\n * Returns a map.\r\n *\r\n * Not available in core.\r\n */\r\n getMapOfValidSequenceTracks_forStudio(): Prism<IPropPathToTrackIdTree> {\r\n return this._cache.get('getMapOfValidSequenceTracks_forStudio', () =>\r\n prism(() => {\r\n const arr = val(this.getArrayOfValidSequenceTracks())\r\n let map = {}\r\n\r\n for (const {pathToProp, trackId} of arr) {\r\n set(map, pathToProp, trackId)\r\n }\r\n\r\n return map\r\n }),\r\n )\r\n }\r\n\r\n /**\r\n * @returns The static overrides that are not sequenced. Returns undefined if there are no static overrides,\r\n * or if all those static overrides are sequenced.\r\n */\r\n getStaticButNotSequencedOverrides(): Prism<SerializableMap | undefined> {\r\n return this._cache.get('getStaticButNotSequencedOverrides', () =>\r\n prism(() => {\r\n const staticOverrides = val(this.getStaticValues())\r\n const arrayOfValidSequenceTracks = val(\r\n this.getArrayOfValidSequenceTracks(),\r\n )\r\n\r\n const staticButNotSequencedOverrides = cloneDeep(staticOverrides)\r\n\r\n for (const {pathToProp} of arrayOfValidSequenceTracks) {\r\n unset(staticButNotSequencedOverrides, pathToProp)\r\n // also unset the parent if it's empty, and so on\r\n let parentPath = pathToProp.slice(0, -1)\r\n while (parentPath.length > 0) {\r\n const parentValue = getDeep(\r\n staticButNotSequencedOverrides,\r\n parentPath,\r\n )\r\n if (!isObjectEmpty(parentValue)) break\r\n unset(staticButNotSequencedOverrides, parentPath)\r\n parentPath = parentPath.slice(0, -1)\r\n }\r\n }\r\n\r\n if (isObjectEmpty(staticButNotSequencedOverrides)) {\r\n return undefined\r\n } else {\r\n return staticButNotSequencedOverrides\r\n }\r\n }),\r\n )\r\n }\r\n\r\n getDefaultsAtPointer(\r\n pointer: Pointer<unknown>,\r\n ): SerializableValue | undefined {\r\n const {path} = getPointerParts(pointer)\r\n const defaults = this.getDefaultValues().getValue()\r\n\r\n const defaultsAtPath = getDeep(defaults, path)\r\n return defaultsAtPath as $FixMe\r\n }\r\n}\r\n\r\nfunction parsePathToProp(\r\n pathToPropInString: string,\r\n): undefined | Array<string | number> {\r\n try {\r\n const pathToProp = JSON.parse(pathToPropInString)\r\n return pathToProp\r\n } catch (e) {\r\n console.warn(\r\n `property ${JSON.stringify(\r\n pathToPropInString,\r\n )} cannot be parsed. Skipping.`,\r\n )\r\n return undefined\r\n }\r\n}\r\n", "import getNative from './_getNative.js';\n\nvar defineProperty = (function() {\n try {\n var func = getNative(Object, 'defineProperty');\n func({}, '', {});\n return func;\n } catch (e) {}\n}());\n\nexport default defineProperty;\n", "import defineProperty from './_defineProperty.js';\n\n/**\n * The base implementation of `assignValue` and `assignMergeValue` without\n * value checks.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\nfunction baseAssignValue(object, key, value) {\n if (key == '__proto__' && defineProperty) {\n defineProperty(object, key, {\n 'configurable': true,\n 'enumerable': true,\n 'value': value,\n 'writable': true\n });\n } else {\n object[key] = value;\n }\n}\n\nexport default baseAssignValue;\n", "import baseAssignValue from './_baseAssignValue.js';\nimport eq from './eq.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Assigns `value` to `key` of `object` if the existing value is not equivalent\n * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\nfunction assignValue(object, key, value) {\n var objValue = object[key];\n if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||\n (value === undefined && !(key in object))) {\n baseAssignValue(object, key, value);\n }\n}\n\nexport default assignValue;\n", "/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/** Used to detect unsigned integer values. */\nvar reIsUint = /^(?:0|[1-9]\\d*)$/;\n\n/**\n * Checks if `value` is a valid array-like index.\n *\n * @private\n * @param {*} value The value to check.\n * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.\n * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.\n */\nfunction isIndex(value, length) {\n var type = typeof value;\n length = length == null ? MAX_SAFE_INTEGER : length;\n\n return !!length &&\n (type == 'number' ||\n (type != 'symbol' && reIsUint.test(value))) &&\n (value > -1 && value % 1 == 0 && value < length);\n}\n\nexport default isIndex;\n", "import assignValue from './_assignValue.js';\nimport castPath from './_castPath.js';\nimport isIndex from './_isIndex.js';\nimport isObject from './isObject.js';\nimport toKey from './_toKey.js';\n\n/**\n * The base implementation of `_.set`.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {Array|string} path The path of the property to set.\n * @param {*} value The value to set.\n * @param {Function} [customizer] The function to customize path creation.\n * @returns {Object} Returns `object`.\n */\nfunction baseSet(object, path, value, customizer) {\n if (!isObject(object)) {\n return object;\n }\n path = castPath(path, object);\n\n var index = -1,\n length = path.length,\n lastIndex = length - 1,\n nested = object;\n\n while (nested != null && ++index < length) {\n var key = toKey(path[index]),\n newValue = value;\n\n if (key === '__proto__' || key === 'constructor' || key === 'prototype') {\n return object;\n }\n\n if (index != lastIndex) {\n var objValue = nested[key];\n newValue = customizer ? customizer(objValue, key, nested) : undefined;\n if (newValue === undefined) {\n newValue = isObject(objValue)\n ? objValue\n : (isIndex(path[index + 1]) ? [] : {});\n }\n }\n assignValue(nested, key, newValue);\n nested = nested[key];\n }\n return object;\n}\n\nexport default baseSet;\n", "import baseSet from './_baseSet.js';\n\n/**\n * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,\n * it's created. Arrays are created for missing index properties while objects\n * are created for all other missing properties. Use `_.setWith` to customize\n * `path` creation.\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @memberOf _\n * @since 3.7.0\n * @category Object\n * @param {Object} object The object to modify.\n * @param {Array|string} path The path of the property to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns `object`.\n * @example\n *\n * var object = { 'a': [{ 'b': { 'c': 3 } }] };\n *\n * _.set(object, 'a[0].b.c', 4);\n * console.log(object.a[0].b.c);\n * // => 4\n *\n * _.set(object, ['x', '0', 'y', 'z'], 5);\n * console.log(object.x[0].y.z);\n * // => 5\n */\nfunction set(object, path, value) {\n return object == null ? object : baseSet(object, path, value);\n}\n\nexport default set;\n", "import type {$FixMe} from '@encorejs/core/types/public'\r\nimport type {\r\n PropTypeConfig,\r\n PropTypeConfig_Compound,\r\n PropTypeConfig_Enum,\r\n SerializableMap,\r\n SerializableValue,\r\n} from '@encorejs/core/types/public'\r\nimport type {SheetObjectPropTypeConfig} from '@encorejs/core/types/public'\r\n\r\nconst cachedDefaults = new WeakMap<PropTypeConfig, SerializableValue>()\r\n\r\n/**\r\n * Generates and caches a default value for the config of a SheetObject.\r\n */\r\nexport default function getPropDefaultsOfSheetObject(\r\n config: SheetObjectPropTypeConfig,\r\n): SerializableMap {\r\n return getDefaultsOfPropTypeConfig(config) as SerializableMap // sheet objects result in non-primitive objects\r\n}\r\n\r\nfunction getDefaultsOfPropTypeConfig(\r\n config: PropTypeConfig,\r\n): SerializableValue {\r\n if (cachedDefaults.has(config)) {\r\n return cachedDefaults.get(config)!\r\n }\r\n\r\n const generated =\r\n config.type === 'compound'\r\n ? generateDefaultsForCompound(config)\r\n : config.type === 'enum'\r\n ? generateDefaultsForEnum(config)\r\n : config.default\r\n\r\n cachedDefaults.set(config, generated)\r\n\r\n return generated\r\n}\r\n\r\nfunction generateDefaultsForEnum(config: PropTypeConfig_Enum) {\r\n const defaults: SerializableMap = {\r\n $case: config.defaultCase,\r\n }\r\n\r\n for (const [case_, caseConf] of Object.entries(config.cases)) {\r\n defaults[case_] = getDefaultsOfPropTypeConfig(caseConf)\r\n }\r\n\r\n return defaults\r\n}\r\n\r\nfunction generateDefaultsForCompound(config: PropTypeConfig_Compound<$FixMe>) {\r\n const defaults: SerializableMap = {}\r\n for (const [key, propConf] of Object.entries(config.props)) {\r\n defaults[key] = getDefaultsOfPropTypeConfig(propConf)\r\n }\r\n\r\n return defaults\r\n}\r\n", "import type {\r\n BasicKeyframedTrack,\r\n TrackData,\r\n} from '@encorejs/core/types/private/core'\r\nimport type {Prism, Pointer} from '@encorejs/dataverse'\r\nimport {prism, val} from '@encorejs/dataverse'\r\nimport UnitBezier from 'timing-function/lib/UnitBezier'\r\nimport type {BasicKeyframe, SerializableValue} from '@encorejs/core'\r\nimport {getSortedKeyframesCached} from '@encorejs/core/utils/keyframeUtils'\r\n\r\n/** `left` and `right` are not necessarily the same type. */\r\nexport type InterpolationTriple = {\r\n /** `left` and `right` are not necessarily the same type. */\r\n left: SerializableValue\r\n /** `left` and `right` are not necessarily the same type. */\r\n right?: SerializableValue\r\n progression: number\r\n}\r\n\r\n// @remarks This new implementation supports sequencing non-numeric props, but it's also heavier\r\n// on the GC. This shouldn't be a problem for the vast majority of users, but it's also a\r\n// low-hanging fruit for perf optimization.\r\n// It can be improved by:\r\n// 1. Not creating a new InterpolationTriple object on every change\r\n// 2. Caching propConfig.deserializeAndSanitize(value)\r\n\r\nexport default function interpolationTripleAtPosition(\r\n trackP: Pointer<TrackData | undefined>,\r\n timeD: Prism<number>,\r\n): Prism<InterpolationTriple | undefined> {\r\n return prism(() => {\r\n const track = val(trackP)\r\n const driverD = prism.memo(\r\n 'driver',\r\n () => {\r\n if (!track) {\r\n return prism(() => undefined)\r\n } else if (track.type === 'BasicKeyframedTrack') {\r\n return _forKeyframedTrack(track, timeD)\r\n } else {\r\n console.error(`Track type not yet supported.`)\r\n return prism(() => undefined)\r\n }\r\n },\r\n [track],\r\n )\r\n\r\n return driverD.getValue()\r\n })\r\n}\r\n\r\ntype IStartedState = {\r\n started: true\r\n validFrom: number\r\n validTo: number\r\n der: Prism<InterpolationTriple | undefined>\r\n}\r\n\r\ntype IState = {started: false} | IStartedState\r\n\r\nfunction _forKeyframedTrack(\r\n track: BasicKeyframedTrack,\r\n timeD: Prism<number>,\r\n): Prism<InterpolationTriple | undefined> {\r\n return prism(() => {\r\n let stateRef = prism.ref<IState>('state', {started: false})\r\n let state = stateRef.current\r\n\r\n const time = timeD.getValue()\r\n\r\n if (!state.started || time < state.validFrom || state.validTo <= time) {\r\n stateRef.current = state = updateState(timeD, track)\r\n }\r\n\r\n return state.der.getValue()\r\n })\r\n}\r\n\r\nconst undefinedConstD = prism(() => undefined)\r\n\r\nfunction updateState(\r\n progressionD: Prism<number>,\r\n track: BasicKeyframedTrack,\r\n): IStartedState {\r\n const keyframes = getSortedKeyframesCached(track.keyframes)\r\n const progression = progressionD.getValue()\r\n if (keyframes.length === 0) {\r\n return {\r\n started: true,\r\n validFrom: -Infinity,\r\n validTo: Infinity,\r\n der: undefinedConstD,\r\n }\r\n }\r\n\r\n let currentKeyframeIndex = 0\r\n\r\n while (true) {\r\n const currentKeyframe = keyframes[currentKeyframeIndex]\r\n\r\n if (!currentKeyframe) {\r\n if (process.env.NODE_ENV !== 'production') {\r\n console.warn(`Bug here`)\r\n }\r\n return states.error\r\n }\r\n\r\n const isLastKeyframe = currentKeyframeIndex === keyframes.length - 1\r\n\r\n if (progression < currentKeyframe.position) {\r\n if (currentKeyframeIndex === 0) {\r\n return states.beforeFirstKeyframe(currentKeyframe)\r\n } else {\r\n if (process.env.NODE_ENV !== 'production') {\r\n console.error(`Bug here`)\r\n }\r\n return states.error\r\n // note: uncomment these if we support starting with currentPointIndex != 0\r\n // currentPointIndex--\r\n // continue\r\n }\r\n } else if (currentKeyframe.position === progression) {\r\n if (isLastKeyframe) {\r\n return states.lastKeyframe(currentKeyframe)\r\n } else {\r\n return states.between(\r\n currentKeyframe,\r\n keyframes[currentKeyframeIndex + 1],\r\n progressionD,\r\n )\r\n }\r\n } else {\r\n // last point\r\n if (currentKeyframeIndex === keyframes.length - 1) {\r\n return states.lastKeyframe(currentKeyframe)\r\n } else {\r\n const nextKeyframeIndex = currentKeyframeIndex + 1\r\n if (keyframes[nextKeyframeIndex].position <= progression) {\r\n currentKeyframeIndex = nextKeyframeIndex\r\n continue\r\n } else {\r\n return states.between(\r\n currentKeyframe,\r\n keyframes[currentKeyframeIndex + 1],\r\n progressionD,\r\n )\r\n }\r\n }\r\n }\r\n }\r\n}\r\n\r\nconst states = {\r\n beforeFirstKeyframe(kf: BasicKeyframe): IStartedState {\r\n return {\r\n started: true,\r\n validFrom: -Infinity,\r\n validTo: kf.position,\r\n der: prism(() => ({left: kf.value, progression: 0})),\r\n }\r\n },\r\n lastKeyframe(kf: BasicKeyframe): IStartedState {\r\n return {\r\n started: true,\r\n validFrom: kf.position,\r\n validTo: Infinity,\r\n der: prism(() => ({left: kf.value, progression: 0})),\r\n }\r\n },\r\n between(\r\n left: BasicKeyframe,\r\n right: BasicKeyframe,\r\n progressionD: Prism<number>,\r\n ): IStartedState {\r\n if (!left.connectedRight) {\r\n return {\r\n started: true,\r\n validFrom: left.position,\r\n validTo: right.position,\r\n der: prism(() => ({left: left.value, progression: 0})),\r\n }\r\n }\r\n\r\n // Two keyframes at the same (or inverted) position would make the\r\n // local-progression denominator zero below, producing NaN/Infinity that\r\n // poisons the interpolation. Collapse a zero-length segment to a hold.\r\n if (right.position - left.position <= 0) {\r\n return {\r\n started: true,\r\n validFrom: left.position,\r\n validTo: right.position,\r\n der: prism(() => ({left: left.value, progression: 0})),\r\n }\r\n }\r\n\r\n const globalProgressionToLocalProgression = (\r\n globalProgression: number,\r\n ): number => {\r\n return (\r\n (globalProgression - left.position) / (right.position - left.position)\r\n )\r\n }\r\n\r\n if (!left.type || left.type === 'bezier') {\r\n const solver = new UnitBezier(\r\n left.handles[2],\r\n left.handles[3],\r\n right.handles[0],\r\n right.handles[1],\r\n )\r\n\r\n const bezierDer = prism(() => {\r\n const progression = globalProgressionToLocalProgression(\r\n progressionD.getValue(),\r\n )\r\n const valueProgression = solver.solveSimple(progression)\r\n\r\n return {\r\n left: left.value,\r\n right: right.value,\r\n progression: valueProgression,\r\n }\r\n })\r\n\r\n return {\r\n started: true,\r\n validFrom: left.position,\r\n validTo: right.position,\r\n der: bezierDer,\r\n }\r\n }\r\n\r\n const holdDer = prism(() => {\r\n const progression = globalProgressionToLocalProgression(\r\n progressionD.getValue(),\r\n )\r\n const valueProgression = Math.floor(progression)\r\n return {\r\n left: left.value,\r\n right: right.value,\r\n progression: valueProgression,\r\n }\r\n })\r\n\r\n return {\r\n started: true,\r\n validFrom: left.position,\r\n validTo: right.position,\r\n der: holdDer,\r\n }\r\n },\r\n error: {\r\n started: true,\r\n validFrom: -Infinity,\r\n validTo: Infinity,\r\n der: undefinedConstD,\r\n } as IStartedState,\r\n}\r\n", "import type {$IntentionalAny} from '@encorejs/core/types/public'\r\nimport type {BasicKeyframedTrack} from '@encorejs/core/types/private/core'\r\nimport memoizeFn from '@encorejs/utils/memoizeFn'\r\nimport {cloneDeep} from 'lodash-es'\r\nimport type {BasicKeyframe} from '@encorejs/core/types/public'\r\n\r\nexport const getSortedKeyframes = (\r\n keyframes: BasicKeyframedTrack['keyframes'],\r\n): BasicKeyframe[] => {\r\n const sorted = Object.values(\r\n keyframes.byId,\r\n ) as $IntentionalAny as BasicKeyframe[]\r\n sorted.sort((a, b) => a.position! - b.position!)\r\n\r\n return cloneDeep(sorted)\r\n}\r\n\r\nexport const getSortedKeyframesCached = memoizeFn(getSortedKeyframes)\r\n\r\nexport const fromArray = (\r\n keyframes: BasicKeyframe[],\r\n): BasicKeyframedTrack['keyframes'] => {\r\n const byId: BasicKeyframedTrack['keyframes']['byId'] = {}\r\n const allIds: BasicKeyframedTrack['keyframes']['allIds'] = {}\r\n\r\n for (const keyframe of keyframes) {\r\n byId[keyframe.id] = keyframe\r\n allIds[keyframe.id] = true\r\n }\r\n\r\n return cloneDeep({byId, allIds})\r\n}\r\n\r\nexport const fromSortedKeyframesCached = memoizeFn(fromArray)\r\n", "/**\r\n * Memoizes a unary function using a simple weakmap. The argument to the unary\r\n * function must be WeakCache-able, which means it must be an object and not a plain\r\n * number/string/boolean/etc.\r\n *\r\n * @example\r\n * ```ts\r\n * const fn = memoizeFn((el) => getBoundingClientRect(el))\r\n *\r\n * const b1 = fn(el)\r\n * const b2 = fn(el)\r\n * assert.equal(b1, b2)\r\n * ```\r\n */\r\nexport default function memoizeFn<K extends {}, V>(\r\n producer: (k: K) => V,\r\n): (k: K) => V {\r\n const cache = new WeakMap<K, V>()\r\n\r\n return (k: K): V => {\r\n if (!cache.has(k)) {\r\n cache.set(k, producer(k))\r\n }\r\n return cache.get(k)!\r\n }\r\n}\r\n", "/** Used to match a single whitespace character. */\nvar reWhitespace = /\\s/;\n\n/**\n * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace\n * character of `string`.\n *\n * @private\n * @param {string} string The string to inspect.\n * @returns {number} Returns the index of the last non-whitespace character.\n */\nfunction trimmedEndIndex(string) {\n var index = string.length;\n\n while (index-- && reWhitespace.test(string.charAt(index))) {}\n return index;\n}\n\nexport default trimmedEndIndex;\n", "import trimmedEndIndex from './_trimmedEndIndex.js';\n\n/** Used to match leading whitespace. */\nvar reTrimStart = /^\\s+/;\n\n/**\n * The base implementation of `_.trim`.\n *\n * @private\n * @param {string} string The string to trim.\n * @returns {string} Returns the trimmed string.\n */\nfunction baseTrim(string) {\n return string\n ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '')\n : string;\n}\n\nexport default baseTrim;\n", "import baseTrim from './_baseTrim.js';\nimport isObject from './isObject.js';\nimport isSymbol from './isSymbol.js';\n\n/** Used as references for various `Number` constants. */\nvar NAN = 0 / 0;\n\n/** Used to detect bad signed hexadecimal string values. */\nvar reIsBadHex = /^[-+]0x[0-9a-f]+$/i;\n\n/** Used to detect binary string values. */\nvar reIsBinary = /^0b[01]+$/i;\n\n/** Used to detect octal string values. */\nvar reIsOctal = /^0o[0-7]+$/i;\n\n/** Built-in method references without a dependency on `root`. */\nvar freeParseInt = parseInt;\n\n/**\n * Converts `value` to a number.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to process.\n * @returns {number} Returns the number.\n * @example\n *\n * _.toNumber(3.2);\n * // => 3.2\n *\n * _.toNumber(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toNumber(Infinity);\n * // => Infinity\n *\n * _.toNumber('3.2');\n * // => 3.2\n */\nfunction toNumber(value) {\n if (typeof value == 'number') {\n return value;\n }\n if (isSymbol(value)) {\n return NAN;\n }\n if (isObject(value)) {\n var other = typeof value.valueOf == 'function' ? value.valueOf() : value;\n value = isObject(other) ? (other + '') : other;\n }\n if (typeof value != 'string') {\n return value === 0 ? value : +value;\n }\n value = baseTrim(value);\n var isBinary = reIsBinary.test(value);\n return (isBinary || reIsOctal.test(value))\n ? freeParseInt(value.slice(2), isBinary ? 2 : 8)\n : (reIsBadHex.test(value) ? NAN : +value);\n}\n\nexport default toNumber;\n", "import toNumber from './toNumber.js';\n\n/** Used as references for various `Number` constants. */\nvar INFINITY = 1 / 0,\n MAX_INTEGER = 1.7976931348623157e+308;\n\n/**\n * Converts `value` to a finite number.\n *\n * @static\n * @memberOf _\n * @since 4.12.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {number} Returns the converted number.\n * @example\n *\n * _.toFinite(3.2);\n * // => 3.2\n *\n * _.toFinite(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toFinite(Infinity);\n * // => 1.7976931348623157e+308\n *\n * _.toFinite('3.2');\n * // => 3.2\n */\nfunction toFinite(value) {\n if (!value) {\n return value === 0 ? value : 0;\n }\n value = toNumber(value);\n if (value === INFINITY || value === -INFINITY) {\n var sign = (value < 0 ? -1 : 1);\n return sign * MAX_INTEGER;\n }\n return value === value ? value : 0;\n}\n\nexport default toFinite;\n", "import toFinite from './toFinite.js';\n\n/**\n * Converts `value` to an integer.\n *\n * **Note:** This method is loosely based on\n * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {number} Returns the converted integer.\n * @example\n *\n * _.toInteger(3.2);\n * // => 3\n *\n * _.toInteger(Number.MIN_VALUE);\n * // => 0\n *\n * _.toInteger(Infinity);\n * // => 1.7976931348623157e+308\n *\n * _.toInteger('3.2');\n * // => 3\n */\nfunction toInteger(value) {\n var result = toFinite(value),\n remainder = result % 1;\n\n return result === result ? (remainder ? result - remainder : result) : 0;\n}\n\nexport default toInteger;\n", "/**\n * This method returns the first argument it receives.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Util\n * @param {*} value Any value.\n * @returns {*} Returns `value`.\n * @example\n *\n * var object = { 'a': 1 };\n *\n * console.log(_.identity(object) === object);\n * // => true\n */\nfunction identity(value) {\n return value;\n}\n\nexport default identity;\n", "import getNative from './_getNative.js';\nimport root from './_root.js';\n\n/* Built-in method references that are verified to be native. */\nvar WeakMap = getNative(root, 'WeakMap');\n\nexport default WeakMap;\n", "import isObject from './isObject.js';\n\n/** Built-in value references. */\nvar objectCreate = Object.create;\n\n/**\n * The base implementation of `_.create` without support for assigning\n * properties to the created object.\n *\n * @private\n * @param {Object} proto The object to inherit from.\n * @returns {Object} Returns the new object.\n */\nvar baseCreate = (function() {\n function object() {}\n return function(proto) {\n if (!isObject(proto)) {\n return {};\n }\n if (objectCreate) {\n return objectCreate(proto);\n }\n object.prototype = proto;\n var result = new object;\n object.prototype = undefined;\n return result;\n };\n}());\n\nexport default baseCreate;\n", "/**\n * Copies the values of `source` to `array`.\n *\n * @private\n * @param {Array} source The array to copy values from.\n * @param {Array} [array=[]] The array to copy values to.\n * @returns {Array} Returns `array`.\n */\nfunction copyArray(source, array) {\n var index = -1,\n length = source.length;\n\n array || (array = Array(length));\n while (++index < length) {\n array[index] = source[index];\n }\n return array;\n}\n\nexport default copyArray;\n", "/**\n * A specialized version of `_.forEach` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns `array`.\n */\nfunction arrayEach(array, iteratee) {\n var index = -1,\n length = array == null ? 0 : array.length;\n\n while (++index < length) {\n if (iteratee(array[index], index, array) === false) {\n break;\n }\n }\n return array;\n}\n\nexport default arrayEach;\n", "import assignValue from './_assignValue.js';\nimport baseAssignValue from './_baseAssignValue.js';\n\n/**\n * Copies properties of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy properties from.\n * @param {Array} props The property identifiers to copy.\n * @param {Object} [object={}] The object to copy properties to.\n * @param {Function} [customizer] The function to customize copied values.\n * @returns {Object} Returns `object`.\n */\nfunction copyObject(source, props, object, customizer) {\n var isNew = !object;\n object || (object = {});\n\n var index = -1,\n length = props.length;\n\n while (++index < length) {\n var key = props[index];\n\n var newValue = customizer\n ? customizer(object[key], source[key], key, object, source)\n : undefined;\n\n if (newValue === undefined) {\n newValue = source[key];\n }\n if (isNew) {\n baseAssignValue(object, key, newValue);\n } else {\n assignValue(object, key, newValue);\n }\n }\n return object;\n}\n\nexport default copyObject;\n", "/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/**\n * Checks if `value` is a valid array-like length.\n *\n * **Note:** This method is loosely based on\n * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n * @example\n *\n * _.isLength(3);\n * // => true\n *\n * _.isLength(Number.MIN_VALUE);\n * // => false\n *\n * _.isLength(Infinity);\n * // => false\n *\n * _.isLength('3');\n * // => false\n */\nfunction isLength(value) {\n return typeof value == 'number' &&\n value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n}\n\nexport default isLength;\n", "import isFunction from './isFunction.js';\nimport isLength from './isLength.js';\n\n/**\n * Checks if `value` is array-like. A value is considered array-like if it's\n * not a function and has a `value.length` that's an integer greater than or\n * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n * @example\n *\n * _.isArrayLike([1, 2, 3]);\n * // => true\n *\n * _.isArrayLike(document.body.children);\n * // => true\n *\n * _.isArrayLike('abc');\n * // => true\n *\n * _.isArrayLike(_.noop);\n * // => false\n */\nfunction isArrayLike(value) {\n return value != null && isLength(value.length) && !isFunction(value);\n}\n\nexport default isArrayLike;\n", "/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Checks if `value` is likely a prototype object.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.\n */\nfunction isPrototype(value) {\n var Ctor = value && value.constructor,\n proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;\n\n return value === proto;\n}\n\nexport default isPrototype;\n", "/**\n * The base implementation of `_.times` without support for iteratee shorthands\n * or max array length checks.\n *\n * @private\n * @param {number} n The number of times to invoke `iteratee`.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the array of results.\n */\nfunction baseTimes(n, iteratee) {\n var index = -1,\n result = Array(n);\n\n while (++index < n) {\n result[index] = iteratee(index);\n }\n return result;\n}\n\nexport default baseTimes;\n", "import baseGetTag from './_baseGetTag.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]';\n\n/**\n * The base implementation of `_.isArguments`.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n */\nfunction baseIsArguments(value) {\n return isObjectLike(value) && baseGetTag(value) == argsTag;\n}\n\nexport default baseIsArguments;\n", "import baseIsArguments from './_baseIsArguments.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/** Built-in value references. */\nvar propertyIsEnumerable = objectProto.propertyIsEnumerable;\n\n/**\n * Checks if `value` is likely an `arguments` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n * else `false`.\n * @example\n *\n * _.isArguments(function() { return arguments; }());\n * // => true\n *\n * _.isArguments([1, 2, 3]);\n * // => false\n */\nvar isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {\n return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&\n !propertyIsEnumerable.call(value, 'callee');\n};\n\nexport default isArguments;\n", "/**\n * This method returns `false`.\n *\n * @static\n * @memberOf _\n * @since 4.13.0\n * @category Util\n * @returns {boolean} Returns `false`.\n * @example\n *\n * _.times(2, _.stubFalse);\n * // => [false, false]\n */\nfunction stubFalse() {\n return false;\n}\n\nexport default stubFalse;\n", "import root from './_root.js';\nimport stubFalse from './stubFalse.js';\n\n/** Detect free variable `exports`. */\nvar freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;\n\n/** Detect free variable `module`. */\nvar freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;\n\n/** Detect the popular CommonJS extension `module.exports`. */\nvar moduleExports = freeModule && freeModule.exports === freeExports;\n\n/** Built-in value references. */\nvar Buffer = moduleExports ? root.Buffer : undefined;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;\n\n/**\n * Checks if `value` is a buffer.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.\n * @example\n *\n * _.isBuffer(new Buffer(2));\n * // => true\n *\n * _.isBuffer(new Uint8Array(2));\n * // => false\n */\nvar isBuffer = nativeIsBuffer || stubFalse;\n\nexport default isBuffer;\n", "import baseGetTag from './_baseGetTag.js';\nimport isLength from './isLength.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]',\n arrayTag = '[object Array]',\n boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n errorTag = '[object Error]',\n funcTag = '[object Function]',\n mapTag = '[object Map]',\n numberTag = '[object Number]',\n objectTag = '[object Object]',\n regexpTag = '[object RegExp]',\n setTag = '[object Set]',\n stringTag = '[object String]',\n weakMapTag = '[object WeakMap]';\n\nvar arrayBufferTag = '[object ArrayBuffer]',\n dataViewTag = '[object DataView]',\n float32Tag = '[object Float32Array]',\n float64Tag = '[object Float64Array]',\n int8Tag = '[object Int8Array]',\n int16Tag = '[object Int16Array]',\n int32Tag = '[object Int32Array]',\n uint8Tag = '[object Uint8Array]',\n uint8ClampedTag = '[object Uint8ClampedArray]',\n uint16Tag = '[object Uint16Array]',\n uint32Tag = '[object Uint32Array]';\n\n/** Used to identify `toStringTag` values of typed arrays. */\nvar typedArrayTags = {};\ntypedArrayTags[float32Tag] = typedArrayTags[float64Tag] =\ntypedArrayTags[int8Tag] = typedArrayTags[int16Tag] =\ntypedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =\ntypedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =\ntypedArrayTags[uint32Tag] = true;\ntypedArrayTags[argsTag] = typedArrayTags[arrayTag] =\ntypedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =\ntypedArrayTags[dataViewTag] = typedArrayTags[dateTag] =\ntypedArrayTags[errorTag] = typedArrayTags[funcTag] =\ntypedArrayTags[mapTag] = typedArrayTags[numberTag] =\ntypedArrayTags[objectTag] = typedArrayTags[regexpTag] =\ntypedArrayTags[setTag] = typedArrayTags[stringTag] =\ntypedArrayTags[weakMapTag] = false;\n\n/**\n * The base implementation of `_.isTypedArray` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.\n */\nfunction baseIsTypedArray(value) {\n return isObjectLike(value) &&\n isLength(value.length) && !!typedArrayTags[baseGetTag(value)];\n}\n\nexport default baseIsTypedArray;\n", "/**\n * The base implementation of `_.unary` without support for storing metadata.\n *\n * @private\n * @param {Function} func The function to cap arguments for.\n * @returns {Function} Returns the new capped function.\n */\nfunction baseUnary(func) {\n return function(value) {\n return func(value);\n };\n}\n\nexport default baseUnary;\n", "import freeGlobal from './_freeGlobal.js';\n\n/** Detect free variable `exports`. */\nvar freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;\n\n/** Detect free variable `module`. */\nvar freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;\n\n/** Detect the popular CommonJS extension `module.exports`. */\nvar moduleExports = freeModule && freeModule.exports === freeExports;\n\n/** Detect free variable `process` from Node.js. */\nvar freeProcess = moduleExports && freeGlobal.process;\n\n/** Used to access faster Node.js helpers. */\nvar nodeUtil = (function() {\n try {\n // Use `util.types` for Node.js 10+.\n var types = freeModule && freeModule.require && freeModule.require('util').types;\n\n if (types) {\n return types;\n }\n\n // Legacy `process.binding('util')` for Node.js < 10.\n return freeProcess && freeProcess.binding && freeProcess.binding('util');\n } catch (e) {}\n}());\n\nexport default nodeUtil;\n", "import baseIsTypedArray from './_baseIsTypedArray.js';\nimport baseUnary from './_baseUnary.js';\nimport nodeUtil from './_nodeUtil.js';\n\n/* Node.js helper references. */\nvar nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;\n\n/**\n * Checks if `value` is classified as a typed array.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.\n * @example\n *\n * _.isTypedArray(new Uint8Array);\n * // => true\n *\n * _.isTypedArray([]);\n * // => false\n */\nvar isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;\n\nexport default isTypedArray;\n", "import baseTimes from './_baseTimes.js';\nimport isArguments from './isArguments.js';\nimport isArray from './isArray.js';\nimport isBuffer from './isBuffer.js';\nimport isIndex from './_isIndex.js';\nimport isTypedArray from './isTypedArray.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Creates an array of the enumerable property names of the array-like `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @param {boolean} inherited Specify returning inherited property names.\n * @returns {Array} Returns the array of property names.\n */\nfunction arrayLikeKeys(value, inherited) {\n var isArr = isArray(value),\n isArg = !isArr && isArguments(value),\n isBuff = !isArr && !isArg && isBuffer(value),\n isType = !isArr && !isArg && !isBuff && isTypedArray(value),\n skipIndexes = isArr || isArg || isBuff || isType,\n result = skipIndexes ? baseTimes(value.length, String) : [],\n length = result.length;\n\n for (var key in value) {\n if ((inherited || hasOwnProperty.call(value, key)) &&\n !(skipIndexes && (\n // Safari 9 has enumerable `arguments.length` in strict mode.\n key == 'length' ||\n // Node.js 0.10 has enumerable non-index properties on buffers.\n (isBuff && (key == 'offset' || key == 'parent')) ||\n // PhantomJS 2 has enumerable non-index properties on typed arrays.\n (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||\n // Skip index properties.\n isIndex(key, length)\n ))) {\n result.push(key);\n }\n }\n return result;\n}\n\nexport default arrayLikeKeys;\n", "/**\n * Creates a unary function that invokes `func` with its argument transformed.\n *\n * @private\n * @param {Function} func The function to wrap.\n * @param {Function} transform The argument transform.\n * @returns {Function} Returns the new function.\n */\nfunction overArg(func, transform) {\n return function(arg) {\n return func(transform(arg));\n };\n}\n\nexport default overArg;\n", "import overArg from './_overArg.js';\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeKeys = overArg(Object.keys, Object);\n\nexport default nativeKeys;\n", "import isPrototype from './_isPrototype.js';\nimport nativeKeys from './_nativeKeys.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction baseKeys(object) {\n if (!isPrototype(object)) {\n return nativeKeys(object);\n }\n var result = [];\n for (var key in Object(object)) {\n if (hasOwnProperty.call(object, key) && key != 'constructor') {\n result.push(key);\n }\n }\n return result;\n}\n\nexport default baseKeys;\n", "import arrayLikeKeys from './_arrayLikeKeys.js';\nimport baseKeys from './_baseKeys.js';\nimport isArrayLike from './isArrayLike.js';\n\n/**\n * Creates an array of the own enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects. See the\n * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)\n * for more details.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keys(new Foo);\n * // => ['a', 'b'] (iteration order is not guaranteed)\n *\n * _.keys('hi');\n * // => ['0', '1']\n */\nfunction keys(object) {\n return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);\n}\n\nexport default keys;\n", "/**\n * This function is like\n * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)\n * except that it includes inherited enumerable properties.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction nativeKeysIn(object) {\n var result = [];\n if (object != null) {\n for (var key in Object(object)) {\n result.push(key);\n }\n }\n return result;\n}\n\nexport default nativeKeysIn;\n", "import isObject from './isObject.js';\nimport isPrototype from './_isPrototype.js';\nimport nativeKeysIn from './_nativeKeysIn.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction baseKeysIn(object) {\n if (!isObject(object)) {\n return nativeKeysIn(object);\n }\n var isProto = isPrototype(object),\n result = [];\n\n for (var key in object) {\n if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {\n result.push(key);\n }\n }\n return result;\n}\n\nexport default baseKeysIn;\n", "import arrayLikeKeys from './_arrayLikeKeys.js';\nimport baseKeysIn from './_baseKeysIn.js';\nimport isArrayLike from './isArrayLike.js';\n\n/**\n * Creates an array of the own and inherited enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keysIn(new Foo);\n * // => ['a', 'b', 'c'] (iteration order is not guaranteed)\n */\nfunction keysIn(object) {\n return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);\n}\n\nexport default keysIn;\n", "/**\n * Appends the elements of `values` to `array`.\n *\n * @private\n * @param {Array} array The array to modify.\n * @param {Array} values The values to append.\n * @returns {Array} Returns `array`.\n */\nfunction arrayPush(array, values) {\n var index = -1,\n length = values.length,\n offset = array.length;\n\n while (++index < length) {\n array[offset + index] = values[index];\n }\n return array;\n}\n\nexport default arrayPush;\n", "import overArg from './_overArg.js';\n\n/** Built-in value references. */\nvar getPrototype = overArg(Object.getPrototypeOf, Object);\n\nexport default getPrototype;\n", "import baseGetTag from './_baseGetTag.js';\nimport getPrototype from './_getPrototype.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** `Object#toString` result references. */\nvar objectTag = '[object Object]';\n\n/** Used for built-in method references. */\nvar funcProto = Function.prototype,\n objectProto = Object.prototype;\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString = funcProto.toString;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/** Used to infer the `Object` constructor. */\nvar objectCtorString = funcToString.call(Object);\n\n/**\n * Checks if `value` is a plain object, that is, an object created by the\n * `Object` constructor or one with a `[[Prototype]]` of `null`.\n *\n * @static\n * @memberOf _\n * @since 0.8.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * }\n *\n * _.isPlainObject(new Foo);\n * // => false\n *\n * _.isPlainObject([1, 2, 3]);\n * // => false\n *\n * _.isPlainObject({ 'x': 0, 'y': 0 });\n * // => true\n *\n * _.isPlainObject(Object.create(null));\n * // => true\n */\nfunction isPlainObject(value) {\n if (!isObjectLike(value) || baseGetTag(value) != objectTag) {\n return false;\n }\n var proto = getPrototype(value);\n if (proto === null) {\n return true;\n }\n var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;\n return typeof Ctor == 'function' && Ctor instanceof Ctor &&\n funcToString.call(Ctor) == objectCtorString;\n}\n\nexport default isPlainObject;\n", "/**\n * The base implementation of `_.slice` without an iteratee call guard.\n *\n * @private\n * @param {Array} array The array to slice.\n * @param {number} [start=0] The start position.\n * @param {number} [end=array.length] The end position.\n * @returns {Array} Returns the slice of `array`.\n */\nfunction baseSlice(array, start, end) {\n var index = -1,\n length = array.length;\n\n if (start < 0) {\n start = -start > length ? 0 : (length + start);\n }\n end = end > length ? length : end;\n if (end < 0) {\n end += length;\n }\n length = start > end ? 0 : ((end - start) >>> 0);\n start >>>= 0;\n\n var result = Array(length);\n while (++index < length) {\n result[index] = array[index + start];\n }\n return result;\n}\n\nexport default baseSlice;\n", "import baseSlice from './_baseSlice.js';\n\n/**\n * Casts `array` to a slice if it's needed.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {number} start The start position.\n * @param {number} [end=array.length] The end position.\n * @returns {Array} Returns the cast slice.\n */\nfunction castSlice(array, start, end) {\n var length = array.length;\n end = end === undefined ? length : end;\n return (!start && end >= length) ? array : baseSlice(array, start, end);\n}\n\nexport default castSlice;\n", "/** Used to compose unicode character classes. */\nvar rsAstralRange = '\\\\ud800-\\\\udfff',\n rsComboMarksRange = '\\\\u0300-\\\\u036f',\n reComboHalfMarksRange = '\\\\ufe20-\\\\ufe2f',\n rsComboSymbolsRange = '\\\\u20d0-\\\\u20ff',\n rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,\n rsVarRange = '\\\\ufe0e\\\\ufe0f';\n\n/** Used to compose unicode capture groups. */\nvar rsZWJ = '\\\\u200d';\n\n/** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */\nvar reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');\n\n/**\n * Checks if `string` contains Unicode symbols.\n *\n * @private\n * @param {string} string The string to inspect.\n * @returns {boolean} Returns `true` if a symbol is found, else `false`.\n */\nfunction hasUnicode(string) {\n return reHasUnicode.test(string);\n}\n\nexport default hasUnicode;\n", "/**\n * Converts an ASCII `string` to an array.\n *\n * @private\n * @param {string} string The string to convert.\n * @returns {Array} Returns the converted array.\n */\nfunction asciiToArray(string) {\n return string.split('');\n}\n\nexport default asciiToArray;\n", "/** Used to compose unicode character classes. */\nvar rsAstralRange = '\\\\ud800-\\\\udfff',\n rsComboMarksRange = '\\\\u0300-\\\\u036f',\n reComboHalfMarksRange = '\\\\ufe20-\\\\ufe2f',\n rsComboSymbolsRange = '\\\\u20d0-\\\\u20ff',\n rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,\n rsVarRange = '\\\\ufe0e\\\\ufe0f';\n\n/** Used to compose unicode capture groups. */\nvar rsAstral = '[' + rsAstralRange + ']',\n rsCombo = '[' + rsComboRange + ']',\n rsFitz = '\\\\ud83c[\\\\udffb-\\\\udfff]',\n rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',\n rsNonAstral = '[^' + rsAstralRange + ']',\n rsRegional = '(?:\\\\ud83c[\\\\udde6-\\\\uddff]){2}',\n rsSurrPair = '[\\\\ud800-\\\\udbff][\\\\udc00-\\\\udfff]',\n rsZWJ = '\\\\u200d';\n\n/** Used to compose unicode regexes. */\nvar reOptMod = rsModifier + '?',\n rsOptVar = '[' + rsVarRange + ']?',\n rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',\n rsSeq = rsOptVar + reOptMod + rsOptJoin,\n rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';\n\n/** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */\nvar reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');\n\n/**\n * Converts a Unicode `string` to an array.\n *\n * @private\n * @param {string} string The string to convert.\n * @returns {Array} Returns the converted array.\n */\nfunction unicodeToArray(string) {\n return string.match(reUnicode) || [];\n}\n\nexport default unicodeToArray;\n", "import asciiToArray from './_asciiToArray.js';\nimport hasUnicode from './_hasUnicode.js';\nimport unicodeToArray from './_unicodeToArray.js';\n\n/**\n * Converts `string` to an array.\n *\n * @private\n * @param {string} string The string to convert.\n * @returns {Array} Returns the converted array.\n */\nfunction stringToArray(string) {\n return hasUnicode(string)\n ? unicodeToArray(string)\n : asciiToArray(string);\n}\n\nexport default stringToArray;\n", "/**\n * The base implementation of `_.clamp` which doesn't coerce arguments.\n *\n * @private\n * @param {number} number The number to clamp.\n * @param {number} [lower] The lower bound.\n * @param {number} upper The upper bound.\n * @returns {number} Returns the clamped number.\n */\nfunction baseClamp(number, lower, upper) {\n if (number === number) {\n if (upper !== undefined) {\n number = number <= upper ? number : upper;\n }\n if (lower !== undefined) {\n number = number >= lower ? number : lower;\n }\n }\n return number;\n}\n\nexport default baseClamp;\n", "import baseClamp from './_baseClamp.js';\nimport toNumber from './toNumber.js';\n\n/**\n * Clamps `number` within the inclusive `lower` and `upper` bounds.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Number\n * @param {number} number The number to clamp.\n * @param {number} [lower] The lower bound.\n * @param {number} upper The upper bound.\n * @returns {number} Returns the clamped number.\n * @example\n *\n * _.clamp(-10, -5, 5);\n * // => -5\n *\n * _.clamp(10, -5, 5);\n * // => 5\n */\nfunction clamp(number, lower, upper) {\n if (upper === undefined) {\n upper = lower;\n lower = undefined;\n }\n if (upper !== undefined) {\n upper = toNumber(upper);\n upper = upper === upper ? upper : 0;\n }\n if (lower !== undefined) {\n lower = toNumber(lower);\n lower = lower === lower ? lower : 0;\n }\n return baseClamp(toNumber(number), lower, upper);\n}\n\nexport default clamp;\n", "import ListCache from './_ListCache.js';\n\n/**\n * Removes all key-value entries from the stack.\n *\n * @private\n * @name clear\n * @memberOf Stack\n */\nfunction stackClear() {\n this.__data__ = new ListCache;\n this.size = 0;\n}\n\nexport default stackClear;\n", "/**\n * Removes `key` and its value from the stack.\n *\n * @private\n * @name delete\n * @memberOf Stack\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction stackDelete(key) {\n var data = this.__data__,\n result = data['delete'](key);\n\n this.size = data.size;\n return result;\n}\n\nexport default stackDelete;\n", "/**\n * Gets the stack value for `key`.\n *\n * @private\n * @name get\n * @memberOf Stack\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction stackGet(key) {\n return this.__data__.get(key);\n}\n\nexport default stackGet;\n", "/**\n * Checks if a stack value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Stack\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction stackHas(key) {\n return this.__data__.has(key);\n}\n\nexport default stackHas;\n", "import ListCache from './_ListCache.js';\nimport Map from './_Map.js';\nimport MapCache from './_MapCache.js';\n\n/** Used as the size to enable large array optimizations. */\nvar LARGE_ARRAY_SIZE = 200;\n\n/**\n * Sets the stack `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf Stack\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the stack cache instance.\n */\nfunction stackSet(key, value) {\n var data = this.__data__;\n if (data instanceof ListCache) {\n var pairs = data.__data__;\n if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {\n pairs.push([key, value]);\n this.size = ++data.size;\n return this;\n }\n data = this.__data__ = new MapCache(pairs);\n }\n data.set(key, value);\n this.size = data.size;\n return this;\n}\n\nexport default stackSet;\n", "import ListCache from './_ListCache.js';\nimport stackClear from './_stackClear.js';\nimport stackDelete from './_stackDelete.js';\nimport stackGet from './_stackGet.js';\nimport stackHas from './_stackHas.js';\nimport stackSet from './_stackSet.js';\n\n/**\n * Creates a stack cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction Stack(entries) {\n var data = this.__data__ = new ListCache(entries);\n this.size = data.size;\n}\n\n// Add methods to `Stack`.\nStack.prototype.clear = stackClear;\nStack.prototype['delete'] = stackDelete;\nStack.prototype.get = stackGet;\nStack.prototype.has = stackHas;\nStack.prototype.set = stackSet;\n\nexport default Stack;\n", "import copyObject from './_copyObject.js';\nimport keys from './keys.js';\n\n/**\n * The base implementation of `_.assign` without support for multiple sources\n * or `customizer` functions.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @returns {Object} Returns `object`.\n */\nfunction baseAssign(object, source) {\n return object && copyObject(source, keys(source), object);\n}\n\nexport default baseAssign;\n", "import copyObject from './_copyObject.js';\nimport keysIn from './keysIn.js';\n\n/**\n * The base implementation of `_.assignIn` without support for multiple sources\n * or `customizer` functions.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @returns {Object} Returns `object`.\n */\nfunction baseAssignIn(object, source) {\n return object && copyObject(source, keysIn(source), object);\n}\n\nexport default baseAssignIn;\n", "import root from './_root.js';\n\n/** Detect free variable `exports`. */\nvar freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;\n\n/** Detect free variable `module`. */\nvar freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;\n\n/** Detect the popular CommonJS extension `module.exports`. */\nvar moduleExports = freeModule && freeModule.exports === freeExports;\n\n/** Built-in value references. */\nvar Buffer = moduleExports ? root.Buffer : undefined,\n allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined;\n\n/**\n * Creates a clone of `buffer`.\n *\n * @private\n * @param {Buffer} buffer The buffer to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Buffer} Returns the cloned buffer.\n */\nfunction cloneBuffer(buffer, isDeep) {\n if (isDeep) {\n return buffer.slice();\n }\n var length = buffer.length,\n result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);\n\n buffer.copy(result);\n return result;\n}\n\nexport default cloneBuffer;\n", "/**\n * A specialized version of `_.filter` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {Array} Returns the new filtered array.\n */\nfunction arrayFilter(array, predicate) {\n var index = -1,\n length = array == null ? 0 : array.length,\n resIndex = 0,\n result = [];\n\n while (++index < length) {\n var value = array[index];\n if (predicate(value, index, array)) {\n result[resIndex++] = value;\n }\n }\n return result;\n}\n\nexport default arrayFilter;\n", "/**\n * This method returns a new empty array.\n *\n * @static\n * @memberOf _\n * @since 4.13.0\n * @category Util\n * @returns {Array} Returns the new empty array.\n * @example\n *\n * var arrays = _.times(2, _.stubArray);\n *\n * console.log(arrays);\n * // => [[], []]\n *\n * console.log(arrays[0] === arrays[1]);\n * // => false\n */\nfunction stubArray() {\n return [];\n}\n\nexport default stubArray;\n", "import arrayFilter from './_arrayFilter.js';\nimport stubArray from './stubArray.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Built-in value references. */\nvar propertyIsEnumerable = objectProto.propertyIsEnumerable;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeGetSymbols = Object.getOwnPropertySymbols;\n\n/**\n * Creates an array of the own enumerable symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of symbols.\n */\nvar getSymbols = !nativeGetSymbols ? stubArray : function(object) {\n if (object == null) {\n return [];\n }\n object = Object(object);\n return arrayFilter(nativeGetSymbols(object), function(symbol) {\n return propertyIsEnumerable.call(object, symbol);\n });\n};\n\nexport default getSymbols;\n", "import copyObject from './_copyObject.js';\nimport getSymbols from './_getSymbols.js';\n\n/**\n * Copies own symbols of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy symbols from.\n * @param {Object} [object={}] The object to copy symbols to.\n * @returns {Object} Returns `object`.\n */\nfunction copySymbols(source, object) {\n return copyObject(source, getSymbols(source), object);\n}\n\nexport default copySymbols;\n", "import arrayPush from './_arrayPush.js';\nimport getPrototype from './_getPrototype.js';\nimport getSymbols from './_getSymbols.js';\nimport stubArray from './stubArray.js';\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeGetSymbols = Object.getOwnPropertySymbols;\n\n/**\n * Creates an array of the own and inherited enumerable symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of symbols.\n */\nvar getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {\n var result = [];\n while (object) {\n arrayPush(result, getSymbols(object));\n object = getPrototype(object);\n }\n return result;\n};\n\nexport default getSymbolsIn;\n", "import copyObject from './_copyObject.js';\nimport getSymbolsIn from './_getSymbolsIn.js';\n\n/**\n * Copies own and inherited symbols of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy symbols from.\n * @param {Object} [object={}] The object to copy symbols to.\n * @returns {Object} Returns `object`.\n */\nfunction copySymbolsIn(source, object) {\n return copyObject(source, getSymbolsIn(source), object);\n}\n\nexport default copySymbolsIn;\n", "import arrayPush from './_arrayPush.js';\nimport isArray from './isArray.js';\n\n/**\n * The base implementation of `getAllKeys` and `getAllKeysIn` which uses\n * `keysFunc` and `symbolsFunc` to get the enumerable property names and\n * symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Function} keysFunc The function to get the keys of `object`.\n * @param {Function} symbolsFunc The function to get the symbols of `object`.\n * @returns {Array} Returns the array of property names and symbols.\n */\nfunction baseGetAllKeys(object, keysFunc, symbolsFunc) {\n var result = keysFunc(object);\n return isArray(object) ? result : arrayPush(result, symbolsFunc(object));\n}\n\nexport default baseGetAllKeys;\n", "import baseGetAllKeys from './_baseGetAllKeys.js';\nimport getSymbols from './_getSymbols.js';\nimport keys from './keys.js';\n\n/**\n * Creates an array of own enumerable property names and symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names and symbols.\n */\nfunction getAllKeys(object) {\n return baseGetAllKeys(object, keys, getSymbols);\n}\n\nexport default getAllKeys;\n", "import baseGetAllKeys from './_baseGetAllKeys.js';\nimport getSymbolsIn from './_getSymbolsIn.js';\nimport keysIn from './keysIn.js';\n\n/**\n * Creates an array of own and inherited enumerable property names and\n * symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names and symbols.\n */\nfunction getAllKeysIn(object) {\n return baseGetAllKeys(object, keysIn, getSymbolsIn);\n}\n\nexport default getAllKeysIn;\n", "import getNative from './_getNative.js';\nimport root from './_root.js';\n\n/* Built-in method references that are verified to be native. */\nvar DataView = getNative(root, 'DataView');\n\nexport default DataView;\n", "import getNative from './_getNative.js';\nimport root from './_root.js';\n\n/* Built-in method references that are verified to be native. */\nvar Promise = getNative(root, 'Promise');\n\nexport default Promise;\n", "import getNative from './_getNative.js';\nimport root from './_root.js';\n\n/* Built-in method references that are verified to be native. */\nvar Set = getNative(root, 'Set');\n\nexport default Set;\n", "import DataView from './_DataView.js';\nimport Map from './_Map.js';\nimport Promise from './_Promise.js';\nimport Set from './_Set.js';\nimport WeakMap from './_WeakMap.js';\nimport baseGetTag from './_baseGetTag.js';\nimport toSource from './_toSource.js';\n\n/** `Object#toString` result references. */\nvar mapTag = '[object Map]',\n objectTag = '[object Object]',\n promiseTag = '[object Promise]',\n setTag = '[object Set]',\n weakMapTag = '[object WeakMap]';\n\nvar dataViewTag = '[object DataView]';\n\n/** Used to detect maps, sets, and weakmaps. */\nvar dataViewCtorString = toSource(DataView),\n mapCtorString = toSource(Map),\n promiseCtorString = toSource(Promise),\n setCtorString = toSource(Set),\n weakMapCtorString = toSource(WeakMap);\n\n/**\n * Gets the `toStringTag` of `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nvar getTag = baseGetTag;\n\n// Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.\nif ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||\n (Map && getTag(new Map) != mapTag) ||\n (Promise && getTag(Promise.resolve()) != promiseTag) ||\n (Set && getTag(new Set) != setTag) ||\n (WeakMap && getTag(new WeakMap) != weakMapTag)) {\n getTag = function(value) {\n var result = baseGetTag(value),\n Ctor = result == objectTag ? value.constructor : undefined,\n ctorString = Ctor ? toSource(Ctor) : '';\n\n if (ctorString) {\n switch (ctorString) {\n case dataViewCtorString: return dataViewTag;\n case mapCtorString: return mapTag;\n case promiseCtorString: return promiseTag;\n case setCtorString: return setTag;\n case weakMapCtorString: return weakMapTag;\n }\n }\n return result;\n };\n}\n\nexport default getTag;\n", "/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Initializes an array clone.\n *\n * @private\n * @param {Array} array The array to clone.\n * @returns {Array} Returns the initialized clone.\n */\nfunction initCloneArray(array) {\n var length = array.length,\n result = new array.constructor(length);\n\n // Add properties assigned by `RegExp#exec`.\n if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {\n result.index = array.index;\n result.input = array.input;\n }\n return result;\n}\n\nexport default initCloneArray;\n", "import root from './_root.js';\n\n/** Built-in value references. */\nvar Uint8Array = root.Uint8Array;\n\nexport default Uint8Array;\n", "import Uint8Array from './_Uint8Array.js';\n\n/**\n * Creates a clone of `arrayBuffer`.\n *\n * @private\n * @param {ArrayBuffer} arrayBuffer The array buffer to clone.\n * @returns {ArrayBuffer} Returns the cloned array buffer.\n */\nfunction cloneArrayBuffer(arrayBuffer) {\n var result = new arrayBuffer.constructor(arrayBuffer.byteLength);\n new Uint8Array(result).set(new Uint8Array(arrayBuffer));\n return result;\n}\n\nexport default cloneArrayBuffer;\n", "import cloneArrayBuffer from './_cloneArrayBuffer.js';\n\n/**\n * Creates a clone of `dataView`.\n *\n * @private\n * @param {Object} dataView The data view to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the cloned data view.\n */\nfunction cloneDataView(dataView, isDeep) {\n var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;\n return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);\n}\n\nexport default cloneDataView;\n", "/** Used to match `RegExp` flags from their coerced string values. */\nvar reFlags = /\\w*$/;\n\n/**\n * Creates a clone of `regexp`.\n *\n * @private\n * @param {Object} regexp The regexp to clone.\n * @returns {Object} Returns the cloned regexp.\n */\nfunction cloneRegExp(regexp) {\n var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));\n result.lastIndex = regexp.lastIndex;\n return result;\n}\n\nexport default cloneRegExp;\n", "import Symbol from './_Symbol.js';\n\n/** Used to convert symbols to primitives and strings. */\nvar symbolProto = Symbol ? Symbol.prototype : undefined,\n symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;\n\n/**\n * Creates a clone of the `symbol` object.\n *\n * @private\n * @param {Object} symbol The symbol object to clone.\n * @returns {Object} Returns the cloned symbol object.\n */\nfunction cloneSymbol(symbol) {\n return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};\n}\n\nexport default cloneSymbol;\n", "import cloneArrayBuffer from './_cloneArrayBuffer.js';\n\n/**\n * Creates a clone of `typedArray`.\n *\n * @private\n * @param {Object} typedArray The typed array to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the cloned typed array.\n */\nfunction cloneTypedArray(typedArray, isDeep) {\n var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;\n return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);\n}\n\nexport default cloneTypedArray;\n", "import cloneArrayBuffer from './_cloneArrayBuffer.js';\nimport cloneDataView from './_cloneDataView.js';\nimport cloneRegExp from './_cloneRegExp.js';\nimport cloneSymbol from './_cloneSymbol.js';\nimport cloneTypedArray from './_cloneTypedArray.js';\n\n/** `Object#toString` result references. */\nvar boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n mapTag = '[object Map]',\n numberTag = '[object Number]',\n regexpTag = '[object RegExp]',\n setTag = '[object Set]',\n stringTag = '[object String]',\n symbolTag = '[object Symbol]';\n\nvar arrayBufferTag = '[object ArrayBuffer]',\n dataViewTag = '[object DataView]',\n float32Tag = '[object Float32Array]',\n float64Tag = '[object Float64Array]',\n int8Tag = '[object Int8Array]',\n int16Tag = '[object Int16Array]',\n int32Tag = '[object Int32Array]',\n uint8Tag = '[object Uint8Array]',\n uint8ClampedTag = '[object Uint8ClampedArray]',\n uint16Tag = '[object Uint16Array]',\n uint32Tag = '[object Uint32Array]';\n\n/**\n * Initializes an object clone based on its `toStringTag`.\n *\n * **Note:** This function only supports cloning values with tags of\n * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.\n *\n * @private\n * @param {Object} object The object to clone.\n * @param {string} tag The `toStringTag` of the object to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the initialized clone.\n */\nfunction initCloneByTag(object, tag, isDeep) {\n var Ctor = object.constructor;\n switch (tag) {\n case arrayBufferTag:\n return cloneArrayBuffer(object);\n\n case boolTag:\n case dateTag:\n return new Ctor(+object);\n\n case dataViewTag:\n return cloneDataView(object, isDeep);\n\n case float32Tag: case float64Tag:\n case int8Tag: case int16Tag: case int32Tag:\n case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:\n return cloneTypedArray(object, isDeep);\n\n case mapTag:\n return new Ctor;\n\n case numberTag:\n case stringTag:\n return new Ctor(object);\n\n case regexpTag:\n return cloneRegExp(object);\n\n case setTag:\n return new Ctor;\n\n case symbolTag:\n return cloneSymbol(object);\n }\n}\n\nexport default initCloneByTag;\n", "import baseCreate from './_baseCreate.js';\nimport getPrototype from './_getPrototype.js';\nimport isPrototype from './_isPrototype.js';\n\n/**\n * Initializes an object clone.\n *\n * @private\n * @param {Object} object The object to clone.\n * @returns {Object} Returns the initialized clone.\n */\nfunction initCloneObject(object) {\n return (typeof object.constructor == 'function' && !isPrototype(object))\n ? baseCreate(getPrototype(object))\n : {};\n}\n\nexport default initCloneObject;\n", "import getTag from './_getTag.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** `Object#toString` result references. */\nvar mapTag = '[object Map]';\n\n/**\n * The base implementation of `_.isMap` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a map, else `false`.\n */\nfunction baseIsMap(value) {\n return isObjectLike(value) && getTag(value) == mapTag;\n}\n\nexport default baseIsMap;\n", "import baseIsMap from './_baseIsMap.js';\nimport baseUnary from './_baseUnary.js';\nimport nodeUtil from './_nodeUtil.js';\n\n/* Node.js helper references. */\nvar nodeIsMap = nodeUtil && nodeUtil.isMap;\n\n/**\n * Checks if `value` is classified as a `Map` object.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a map, else `false`.\n * @example\n *\n * _.isMap(new Map);\n * // => true\n *\n * _.isMap(new WeakMap);\n * // => false\n */\nvar isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;\n\nexport default isMap;\n", "import getTag from './_getTag.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** `Object#toString` result references. */\nvar setTag = '[object Set]';\n\n/**\n * The base implementation of `_.isSet` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a set, else `false`.\n */\nfunction baseIsSet(value) {\n return isObjectLike(value) && getTag(value) == setTag;\n}\n\nexport default baseIsSet;\n", "import baseIsSet from './_baseIsSet.js';\nimport baseUnary from './_baseUnary.js';\nimport nodeUtil from './_nodeUtil.js';\n\n/* Node.js helper references. */\nvar nodeIsSet = nodeUtil && nodeUtil.isSet;\n\n/**\n * Checks if `value` is classified as a `Set` object.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a set, else `false`.\n * @example\n *\n * _.isSet(new Set);\n * // => true\n *\n * _.isSet(new WeakSet);\n * // => false\n */\nvar isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;\n\nexport default isSet;\n", "import Stack from './_Stack.js';\nimport arrayEach from './_arrayEach.js';\nimport assignValue from './_assignValue.js';\nimport baseAssign from './_baseAssign.js';\nimport baseAssignIn from './_baseAssignIn.js';\nimport cloneBuffer from './_cloneBuffer.js';\nimport copyArray from './_copyArray.js';\nimport copySymbols from './_copySymbols.js';\nimport copySymbolsIn from './_copySymbolsIn.js';\nimport getAllKeys from './_getAllKeys.js';\nimport getAllKeysIn from './_getAllKeysIn.js';\nimport getTag from './_getTag.js';\nimport initCloneArray from './_initCloneArray.js';\nimport initCloneByTag from './_initCloneByTag.js';\nimport initCloneObject from './_initCloneObject.js';\nimport isArray from './isArray.js';\nimport isBuffer from './isBuffer.js';\nimport isMap from './isMap.js';\nimport isObject from './isObject.js';\nimport isSet from './isSet.js';\nimport keys from './keys.js';\nimport keysIn from './keysIn.js';\n\n/** Used to compose bitmasks for cloning. */\nvar CLONE_DEEP_FLAG = 1,\n CLONE_FLAT_FLAG = 2,\n CLONE_SYMBOLS_FLAG = 4;\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]',\n arrayTag = '[object Array]',\n boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n errorTag = '[object Error]',\n funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]',\n mapTag = '[object Map]',\n numberTag = '[object Number]',\n objectTag = '[object Object]',\n regexpTag = '[object RegExp]',\n setTag = '[object Set]',\n stringTag = '[object String]',\n symbolTag = '[object Symbol]',\n weakMapTag = '[object WeakMap]';\n\nvar arrayBufferTag = '[object ArrayBuffer]',\n dataViewTag = '[object DataView]',\n float32Tag = '[object Float32Array]',\n float64Tag = '[object Float64Array]',\n int8Tag = '[object Int8Array]',\n int16Tag = '[object Int16Array]',\n int32Tag = '[object Int32Array]',\n uint8Tag = '[object Uint8Array]',\n uint8ClampedTag = '[object Uint8ClampedArray]',\n uint16Tag = '[object Uint16Array]',\n uint32Tag = '[object Uint32Array]';\n\n/** Used to identify `toStringTag` values supported by `_.clone`. */\nvar cloneableTags = {};\ncloneableTags[argsTag] = cloneableTags[arrayTag] =\ncloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =\ncloneableTags[boolTag] = cloneableTags[dateTag] =\ncloneableTags[float32Tag] = cloneableTags[float64Tag] =\ncloneableTags[int8Tag] = cloneableTags[int16Tag] =\ncloneableTags[int32Tag] = cloneableTags[mapTag] =\ncloneableTags[numberTag] = cloneableTags[objectTag] =\ncloneableTags[regexpTag] = cloneableTags[setTag] =\ncloneableTags[stringTag] = cloneableTags[symbolTag] =\ncloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =\ncloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;\ncloneableTags[errorTag] = cloneableTags[funcTag] =\ncloneableTags[weakMapTag] = false;\n\n/**\n * The base implementation of `_.clone` and `_.cloneDeep` which tracks\n * traversed objects.\n *\n * @private\n * @param {*} value The value to clone.\n * @param {boolean} bitmask The bitmask flags.\n * 1 - Deep clone\n * 2 - Flatten inherited properties\n * 4 - Clone symbols\n * @param {Function} [customizer] The function to customize cloning.\n * @param {string} [key] The key of `value`.\n * @param {Object} [object] The parent object of `value`.\n * @param {Object} [stack] Tracks traversed objects and their clone counterparts.\n * @returns {*} Returns the cloned value.\n */\nfunction baseClone(value, bitmask, customizer, key, object, stack) {\n var result,\n isDeep = bitmask & CLONE_DEEP_FLAG,\n isFlat = bitmask & CLONE_FLAT_FLAG,\n isFull = bitmask & CLONE_SYMBOLS_FLAG;\n\n if (customizer) {\n result = object ? customizer(value, key, object, stack) : customizer(value);\n }\n if (result !== undefined) {\n return result;\n }\n if (!isObject(value)) {\n return value;\n }\n var isArr = isArray(value);\n if (isArr) {\n result = initCloneArray(value);\n if (!isDeep) {\n return copyArray(value, result);\n }\n } else {\n var tag = getTag(value),\n isFunc = tag == funcTag || tag == genTag;\n\n if (isBuffer(value)) {\n return cloneBuffer(value, isDeep);\n }\n if (tag == objectTag || tag == argsTag || (isFunc && !object)) {\n result = (isFlat || isFunc) ? {} : initCloneObject(value);\n if (!isDeep) {\n return isFlat\n ? copySymbolsIn(value, baseAssignIn(result, value))\n : copySymbols(value, baseAssign(result, value));\n }\n } else {\n if (!cloneableTags[tag]) {\n return object ? value : {};\n }\n result = initCloneByTag(value, tag, isDeep);\n }\n }\n // Check for circular references and return its corresponding clone.\n stack || (stack = new Stack);\n var stacked = stack.get(value);\n if (stacked) {\n return stacked;\n }\n stack.set(value, result);\n\n if (isSet(value)) {\n value.forEach(function(subValue) {\n result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));\n });\n } else if (isMap(value)) {\n value.forEach(function(subValue, key) {\n result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));\n });\n }\n\n var keysFunc = isFull\n ? (isFlat ? getAllKeysIn : getAllKeys)\n : (isFlat ? keysIn : keys);\n\n var props = isArr ? undefined : keysFunc(value);\n arrayEach(props || value, function(subValue, key) {\n if (props) {\n key = subValue;\n subValue = value[key];\n }\n // Recursively populate clone (susceptible to call stack limits).\n assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));\n });\n return result;\n}\n\nexport default baseClone;\n", "import baseClone from './_baseClone.js';\n\n/** Used to compose bitmasks for cloning. */\nvar CLONE_DEEP_FLAG = 1,\n CLONE_SYMBOLS_FLAG = 4;\n\n/**\n * This method is like `_.clone` except that it recursively clones `value`.\n *\n * @static\n * @memberOf _\n * @since 1.0.0\n * @category Lang\n * @param {*} value The value to recursively clone.\n * @returns {*} Returns the deep cloned value.\n * @see _.clone\n * @example\n *\n * var objects = [{ 'a': 1 }, { 'b': 2 }];\n *\n * var deep = _.cloneDeep(objects);\n * console.log(deep[0] === objects[0]);\n * // => false\n */\nfunction cloneDeep(value) {\n return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);\n}\n\nexport default cloneDeep;\n", "/** Used to stand-in for `undefined` hash values. */\nvar HASH_UNDEFINED = '__lodash_hash_undefined__';\n\n/**\n * Adds `value` to the array cache.\n *\n * @private\n * @name add\n * @memberOf SetCache\n * @alias push\n * @param {*} value The value to cache.\n * @returns {Object} Returns the cache instance.\n */\nfunction setCacheAdd(value) {\n this.__data__.set(value, HASH_UNDEFINED);\n return this;\n}\n\nexport default setCacheAdd;\n", "/**\n * Checks if `value` is in the array cache.\n *\n * @private\n * @name has\n * @memberOf SetCache\n * @param {*} value The value to search for.\n * @returns {number} Returns `true` if `value` is found, else `false`.\n */\nfunction setCacheHas(value) {\n return this.__data__.has(value);\n}\n\nexport default setCacheHas;\n", "import MapCache from './_MapCache.js';\nimport setCacheAdd from './_setCacheAdd.js';\nimport setCacheHas from './_setCacheHas.js';\n\n/**\n *\n * Creates an array cache object to store unique values.\n *\n * @private\n * @constructor\n * @param {Array} [values] The values to cache.\n */\nfunction SetCache(values) {\n var index = -1,\n length = values == null ? 0 : values.length;\n\n this.__data__ = new MapCache;\n while (++index < length) {\n this.add(values[index]);\n }\n}\n\n// Add methods to `SetCache`.\nSetCache.prototype.add = SetCache.prototype.push = setCacheAdd;\nSetCache.prototype.has = setCacheHas;\n\nexport default SetCache;\n", "/**\n * A specialized version of `_.some` for arrays without support for iteratee\n * shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {boolean} Returns `true` if any element passes the predicate check,\n * else `false`.\n */\nfunction arraySome(array, predicate) {\n var index = -1,\n length = array == null ? 0 : array.length;\n\n while (++index < length) {\n if (predicate(array[index], index, array)) {\n return true;\n }\n }\n return false;\n}\n\nexport default arraySome;\n", "/**\n * Checks if a `cache` value for `key` exists.\n *\n * @private\n * @param {Object} cache The cache to query.\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction cacheHas(cache, key) {\n return cache.has(key);\n}\n\nexport default cacheHas;\n", "import SetCache from './_SetCache.js';\nimport arraySome from './_arraySome.js';\nimport cacheHas from './_cacheHas.js';\n\n/** Used to compose bitmasks for value comparisons. */\nvar COMPARE_PARTIAL_FLAG = 1,\n COMPARE_UNORDERED_FLAG = 2;\n\n/**\n * A specialized version of `baseIsEqualDeep` for arrays with support for\n * partial deep comparisons.\n *\n * @private\n * @param {Array} array The array to compare.\n * @param {Array} other The other array to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} stack Tracks traversed `array` and `other` objects.\n * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.\n */\nfunction equalArrays(array, other, bitmask, customizer, equalFunc, stack) {\n var isPartial = bitmask & COMPARE_PARTIAL_FLAG,\n arrLength = array.length,\n othLength = other.length;\n\n if (arrLength != othLength && !(isPartial && othLength > arrLength)) {\n return false;\n }\n // Check that cyclic values are equal.\n var arrStacked = stack.get(array);\n var othStacked = stack.get(other);\n if (arrStacked && othStacked) {\n return arrStacked == other && othStacked == array;\n }\n var index = -1,\n result = true,\n seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;\n\n stack.set(array, other);\n stack.set(other, array);\n\n // Ignore non-index properties.\n while (++index < arrLength) {\n var arrValue = array[index],\n othValue = other[index];\n\n if (customizer) {\n var compared = isPartial\n ? customizer(othValue, arrValue, index, other, array, stack)\n : customizer(arrValue, othValue, index, array, other, stack);\n }\n if (compared !== undefined) {\n if (compared) {\n continue;\n }\n result = false;\n break;\n }\n // Recursively compare arrays (susceptible to call stack limits).\n if (seen) {\n if (!arraySome(other, function(othValue, othIndex) {\n if (!cacheHas(seen, othIndex) &&\n (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {\n return seen.push(othIndex);\n }\n })) {\n result = false;\n break;\n }\n } else if (!(\n arrValue === othValue ||\n equalFunc(arrValue, othValue, bitmask, customizer, stack)\n )) {\n result = false;\n break;\n }\n }\n stack['delete'](array);\n stack['delete'](other);\n return result;\n}\n\nexport default equalArrays;\n", "/**\n * Converts `map` to its key-value pairs.\n *\n * @private\n * @param {Object} map The map to convert.\n * @returns {Array} Returns the key-value pairs.\n */\nfunction mapToArray(map) {\n var index = -1,\n result = Array(map.size);\n\n map.forEach(function(value, key) {\n result[++index] = [key, value];\n });\n return result;\n}\n\nexport default mapToArray;\n", "/**\n * Converts `set` to an array of its values.\n *\n * @private\n * @param {Object} set The set to convert.\n * @returns {Array} Returns the values.\n */\nfunction setToArray(set) {\n var index = -1,\n result = Array(set.size);\n\n set.forEach(function(value) {\n result[++index] = value;\n });\n return result;\n}\n\nexport default setToArray;\n", "import Symbol from './_Symbol.js';\nimport Uint8Array from './_Uint8Array.js';\nimport eq from './eq.js';\nimport equalArrays from './_equalArrays.js';\nimport mapToArray from './_mapToArray.js';\nimport setToArray from './_setToArray.js';\n\n/** Used to compose bitmasks for value comparisons. */\nvar COMPARE_PARTIAL_FLAG = 1,\n COMPARE_UNORDERED_FLAG = 2;\n\n/** `Object#toString` result references. */\nvar boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n errorTag = '[object Error]',\n mapTag = '[object Map]',\n numberTag = '[object Number]',\n regexpTag = '[object RegExp]',\n setTag = '[object Set]',\n stringTag = '[object String]',\n symbolTag = '[object Symbol]';\n\nvar arrayBufferTag = '[object ArrayBuffer]',\n dataViewTag = '[object DataView]';\n\n/** Used to convert symbols to primitives and strings. */\nvar symbolProto = Symbol ? Symbol.prototype : undefined,\n symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;\n\n/**\n * A specialized version of `baseIsEqualDeep` for comparing objects of\n * the same `toStringTag`.\n *\n * **Note:** This function only supports comparing values with tags of\n * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {string} tag The `toStringTag` of the objects to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} stack Tracks traversed `object` and `other` objects.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\nfunction equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {\n switch (tag) {\n case dataViewTag:\n if ((object.byteLength != other.byteLength) ||\n (object.byteOffset != other.byteOffset)) {\n return false;\n }\n object = object.buffer;\n other = other.buffer;\n\n case arrayBufferTag:\n if ((object.byteLength != other.byteLength) ||\n !equalFunc(new Uint8Array(object), new Uint8Array(other))) {\n return false;\n }\n return true;\n\n case boolTag:\n case dateTag:\n case numberTag:\n // Coerce booleans to `1` or `0` and dates to milliseconds.\n // Invalid dates are coerced to `NaN`.\n return eq(+object, +other);\n\n case errorTag:\n return object.name == other.name && object.message == other.message;\n\n case regexpTag:\n case stringTag:\n // Coerce regexes to strings and treat strings, primitives and objects,\n // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring\n // for more details.\n return object == (other + '');\n\n case mapTag:\n var convert = mapToArray;\n\n case setTag:\n var isPartial = bitmask & COMPARE_PARTIAL_FLAG;\n convert || (convert = setToArray);\n\n if (object.size != other.size && !isPartial) {\n return false;\n }\n // Assume cyclic values are equal.\n var stacked = stack.get(object);\n if (stacked) {\n return stacked == other;\n }\n bitmask |= COMPARE_UNORDERED_FLAG;\n\n // Recursively compare objects (susceptible to call stack limits).\n stack.set(object, other);\n var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);\n stack['delete'](object);\n return result;\n\n case symbolTag:\n if (symbolValueOf) {\n return symbolValueOf.call(object) == symbolValueOf.call(other);\n }\n }\n return false;\n}\n\nexport default equalByTag;\n", "import getAllKeys from './_getAllKeys.js';\n\n/** Used to compose bitmasks for value comparisons. */\nvar COMPARE_PARTIAL_FLAG = 1;\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * A specialized version of `baseIsEqualDeep` for objects with support for\n * partial deep comparisons.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} stack Tracks traversed `object` and `other` objects.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\nfunction equalObjects(object, other, bitmask, customizer, equalFunc, stack) {\n var isPartial = bitmask & COMPARE_PARTIAL_FLAG,\n objProps = getAllKeys(object),\n objLength = objProps.length,\n othProps = getAllKeys(other),\n othLength = othProps.length;\n\n if (objLength != othLength && !isPartial) {\n return false;\n }\n var index = objLength;\n while (index--) {\n var key = objProps[index];\n if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {\n return false;\n }\n }\n // Check that cyclic values are equal.\n var objStacked = stack.get(object);\n var othStacked = stack.get(other);\n if (objStacked && othStacked) {\n return objStacked == other && othStacked == object;\n }\n var result = true;\n stack.set(object, other);\n stack.set(other, object);\n\n var skipCtor = isPartial;\n while (++index < objLength) {\n key = objProps[index];\n var objValue = object[key],\n othValue = other[key];\n\n if (customizer) {\n var compared = isPartial\n ? customizer(othValue, objValue, key, other, object, stack)\n : customizer(objValue, othValue, key, object, other, stack);\n }\n // Recursively compare objects (susceptible to call stack limits).\n if (!(compared === undefined\n ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))\n : compared\n )) {\n result = false;\n break;\n }\n skipCtor || (skipCtor = key == 'constructor');\n }\n if (result && !skipCtor) {\n var objCtor = object.constructor,\n othCtor = other.constructor;\n\n // Non `Object` object instances with different constructors are not equal.\n if (objCtor != othCtor &&\n ('constructor' in object && 'constructor' in other) &&\n !(typeof objCtor == 'function' && objCtor instanceof objCtor &&\n typeof othCtor == 'function' && othCtor instanceof othCtor)) {\n result = false;\n }\n }\n stack['delete'](object);\n stack['delete'](other);\n return result;\n}\n\nexport default equalObjects;\n", "import Stack from './_Stack.js';\nimport equalArrays from './_equalArrays.js';\nimport equalByTag from './_equalByTag.js';\nimport equalObjects from './_equalObjects.js';\nimport getTag from './_getTag.js';\nimport isArray from './isArray.js';\nimport isBuffer from './isBuffer.js';\nimport isTypedArray from './isTypedArray.js';\n\n/** Used to compose bitmasks for value comparisons. */\nvar COMPARE_PARTIAL_FLAG = 1;\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]',\n arrayTag = '[object Array]',\n objectTag = '[object Object]';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * A specialized version of `baseIsEqual` for arrays and objects which performs\n * deep comparisons and tracks traversed objects enabling objects with circular\n * references to be compared.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} [stack] Tracks traversed `object` and `other` objects.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\nfunction baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {\n var objIsArr = isArray(object),\n othIsArr = isArray(other),\n objTag = objIsArr ? arrayTag : getTag(object),\n othTag = othIsArr ? arrayTag : getTag(other);\n\n objTag = objTag == argsTag ? objectTag : objTag;\n othTag = othTag == argsTag ? objectTag : othTag;\n\n var objIsObj = objTag == objectTag,\n othIsObj = othTag == objectTag,\n isSameTag = objTag == othTag;\n\n if (isSameTag && isBuffer(object)) {\n if (!isBuffer(other)) {\n return false;\n }\n objIsArr = true;\n objIsObj = false;\n }\n if (isSameTag && !objIsObj) {\n stack || (stack = new Stack);\n return (objIsArr || isTypedArray(object))\n ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)\n : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);\n }\n if (!(bitmask & COMPARE_PARTIAL_FLAG)) {\n var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),\n othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');\n\n if (objIsWrapped || othIsWrapped) {\n var objUnwrapped = objIsWrapped ? object.value() : object,\n othUnwrapped = othIsWrapped ? other.value() : other;\n\n stack || (stack = new Stack);\n return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);\n }\n }\n if (!isSameTag) {\n return false;\n }\n stack || (stack = new Stack);\n return equalObjects(object, other, bitmask, customizer, equalFunc, stack);\n}\n\nexport default baseIsEqualDeep;\n", "import baseIsEqualDeep from './_baseIsEqualDeep.js';\nimport isObjectLike from './isObjectLike.js';\n\n/**\n * The base implementation of `_.isEqual` which supports partial comparisons\n * and tracks traversed objects.\n *\n * @private\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @param {boolean} bitmask The bitmask flags.\n * 1 - Unordered comparison\n * 2 - Partial comparison\n * @param {Function} [customizer] The function to customize comparisons.\n * @param {Object} [stack] Tracks traversed `value` and `other` objects.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n */\nfunction baseIsEqual(value, other, bitmask, customizer, stack) {\n if (value === other) {\n return true;\n }\n if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {\n return value !== value && other !== other;\n }\n return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);\n}\n\nexport default baseIsEqual;\n", "import Stack from './_Stack.js';\nimport baseIsEqual from './_baseIsEqual.js';\n\n/** Used to compose bitmasks for value comparisons. */\nvar COMPARE_PARTIAL_FLAG = 1,\n COMPARE_UNORDERED_FLAG = 2;\n\n/**\n * The base implementation of `_.isMatch` without support for iteratee shorthands.\n *\n * @private\n * @param {Object} object The object to inspect.\n * @param {Object} source The object of property values to match.\n * @param {Array} matchData The property names, values, and compare flags to match.\n * @param {Function} [customizer] The function to customize comparisons.\n * @returns {boolean} Returns `true` if `object` is a match, else `false`.\n */\nfunction baseIsMatch(object, source, matchData, customizer) {\n var index = matchData.length,\n length = index,\n noCustomizer = !customizer;\n\n if (object == null) {\n return !length;\n }\n object = Object(object);\n while (index--) {\n var data = matchData[index];\n if ((noCustomizer && data[2])\n ? data[1] !== object[data[0]]\n : !(data[0] in object)\n ) {\n return false;\n }\n }\n while (++index < length) {\n data = matchData[index];\n var key = data[0],\n objValue = object[key],\n srcValue = data[1];\n\n if (noCustomizer && data[2]) {\n if (objValue === undefined && !(key in object)) {\n return false;\n }\n } else {\n var stack = new Stack;\n if (customizer) {\n var result = customizer(objValue, srcValue, key, object, source, stack);\n }\n if (!(result === undefined\n ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)\n : result\n )) {\n return false;\n }\n }\n }\n return true;\n}\n\nexport default baseIsMatch;\n", "import isObject from './isObject.js';\n\n/**\n * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` if suitable for strict\n * equality comparisons, else `false`.\n */\nfunction isStrictComparable(value) {\n return value === value && !isObject(value);\n}\n\nexport default isStrictComparable;\n", "import isStrictComparable from './_isStrictComparable.js';\nimport keys from './keys.js';\n\n/**\n * Gets the property names, values, and compare flags of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the match data of `object`.\n */\nfunction getMatchData(object) {\n var result = keys(object),\n length = result.length;\n\n while (length--) {\n var key = result[length],\n value = object[key];\n\n result[length] = [key, value, isStrictComparable(value)];\n }\n return result;\n}\n\nexport default getMatchData;\n", "/**\n * A specialized version of `matchesProperty` for source values suitable\n * for strict equality comparisons, i.e. `===`.\n *\n * @private\n * @param {string} key The key of the property to get.\n * @param {*} srcValue The value to match.\n * @returns {Function} Returns the new spec function.\n */\nfunction matchesStrictComparable(key, srcValue) {\n return function(object) {\n if (object == null) {\n return false;\n }\n return object[key] === srcValue &&\n (srcValue !== undefined || (key in Object(object)));\n };\n}\n\nexport default matchesStrictComparable;\n", "import baseIsMatch from './_baseIsMatch.js';\nimport getMatchData from './_getMatchData.js';\nimport matchesStrictComparable from './_matchesStrictComparable.js';\n\n/**\n * The base implementation of `_.matches` which doesn't clone `source`.\n *\n * @private\n * @param {Object} source The object of property values to match.\n * @returns {Function} Returns the new spec function.\n */\nfunction baseMatches(source) {\n var matchData = getMatchData(source);\n if (matchData.length == 1 && matchData[0][2]) {\n return matchesStrictComparable(matchData[0][0], matchData[0][1]);\n }\n return function(object) {\n return object === source || baseIsMatch(object, source, matchData);\n };\n}\n\nexport default baseMatches;\n", "/**\n * The base implementation of `_.hasIn` without support for deep paths.\n *\n * @private\n * @param {Object} [object] The object to query.\n * @param {Array|string} key The key to check.\n * @returns {boolean} Returns `true` if `key` exists, else `false`.\n */\nfunction baseHasIn(object, key) {\n return object != null && key in Object(object);\n}\n\nexport default baseHasIn;\n", "import castPath from './_castPath.js';\nimport isArguments from './isArguments.js';\nimport isArray from './isArray.js';\nimport isIndex from './_isIndex.js';\nimport isLength from './isLength.js';\nimport toKey from './_toKey.js';\n\n/**\n * Checks if `path` exists on `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array|string} path The path to check.\n * @param {Function} hasFunc The function to check properties.\n * @returns {boolean} Returns `true` if `path` exists, else `false`.\n */\nfunction hasPath(object, path, hasFunc) {\n path = castPath(path, object);\n\n var index = -1,\n length = path.length,\n result = false;\n\n while (++index < length) {\n var key = toKey(path[index]);\n if (!(result = object != null && hasFunc(object, key))) {\n break;\n }\n object = object[key];\n }\n if (result || ++index != length) {\n return result;\n }\n length = object == null ? 0 : object.length;\n return !!length && isLength(length) && isIndex(key, length) &&\n (isArray(object) || isArguments(object));\n}\n\nexport default hasPath;\n", "import baseHasIn from './_baseHasIn.js';\nimport hasPath from './_hasPath.js';\n\n/**\n * Checks if `path` is a direct or inherited property of `object`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Object\n * @param {Object} object The object to query.\n * @param {Array|string} path The path to check.\n * @returns {boolean} Returns `true` if `path` exists, else `false`.\n * @example\n *\n * var object = _.create({ 'a': _.create({ 'b': 2 }) });\n *\n * _.hasIn(object, 'a');\n * // => true\n *\n * _.hasIn(object, 'a.b');\n * // => true\n *\n * _.hasIn(object, ['a', 'b']);\n * // => true\n *\n * _.hasIn(object, 'b');\n * // => false\n */\nfunction hasIn(object, path) {\n return object != null && hasPath(object, path, baseHasIn);\n}\n\nexport default hasIn;\n", "import baseIsEqual from './_baseIsEqual.js';\nimport get from './get.js';\nimport hasIn from './hasIn.js';\nimport isKey from './_isKey.js';\nimport isStrictComparable from './_isStrictComparable.js';\nimport matchesStrictComparable from './_matchesStrictComparable.js';\nimport toKey from './_toKey.js';\n\n/** Used to compose bitmasks for value comparisons. */\nvar COMPARE_PARTIAL_FLAG = 1,\n COMPARE_UNORDERED_FLAG = 2;\n\n/**\n * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.\n *\n * @private\n * @param {string} path The path of the property to get.\n * @param {*} srcValue The value to match.\n * @returns {Function} Returns the new spec function.\n */\nfunction baseMatchesProperty(path, srcValue) {\n if (isKey(path) && isStrictComparable(srcValue)) {\n return matchesStrictComparable(toKey(path), srcValue);\n }\n return function(object) {\n var objValue = get(object, path);\n return (objValue === undefined && objValue === srcValue)\n ? hasIn(object, path)\n : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);\n };\n}\n\nexport default baseMatchesProperty;\n", "/**\n * The base implementation of `_.property` without support for deep paths.\n *\n * @private\n * @param {string} key The key of the property to get.\n * @returns {Function} Returns the new accessor function.\n */\nfunction baseProperty(key) {\n return function(object) {\n return object == null ? undefined : object[key];\n };\n}\n\nexport default baseProperty;\n", "import baseGet from './_baseGet.js';\n\n/**\n * A specialized version of `baseProperty` which supports deep paths.\n *\n * @private\n * @param {Array|string} path The path of the property to get.\n * @returns {Function} Returns the new accessor function.\n */\nfunction basePropertyDeep(path) {\n return function(object) {\n return baseGet(object, path);\n };\n}\n\nexport default basePropertyDeep;\n", "import baseProperty from './_baseProperty.js';\nimport basePropertyDeep from './_basePropertyDeep.js';\nimport isKey from './_isKey.js';\nimport toKey from './_toKey.js';\n\n/**\n * Creates a function that returns the value at `path` of a given object.\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Util\n * @param {Array|string} path The path of the property to get.\n * @returns {Function} Returns the new accessor function.\n * @example\n *\n * var objects = [\n * { 'a': { 'b': 2 } },\n * { 'a': { 'b': 1 } }\n * ];\n *\n * _.map(objects, _.property('a.b'));\n * // => [2, 1]\n *\n * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');\n * // => [1, 2]\n */\nfunction property(path) {\n return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);\n}\n\nexport default property;\n", "import baseMatches from './_baseMatches.js';\nimport baseMatchesProperty from './_baseMatchesProperty.js';\nimport identity from './identity.js';\nimport isArray from './isArray.js';\nimport property from './property.js';\n\n/**\n * The base implementation of `_.iteratee`.\n *\n * @private\n * @param {*} [value=_.identity] The value to convert to an iteratee.\n * @returns {Function} Returns the iteratee.\n */\nfunction baseIteratee(value) {\n // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.\n // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.\n if (typeof value == 'function') {\n return value;\n }\n if (value == null) {\n return identity;\n }\n if (typeof value == 'object') {\n return isArray(value)\n ? baseMatchesProperty(value[0], value[1])\n : baseMatches(value);\n }\n return property(value);\n}\n\nexport default baseIteratee;\n", "/**\n * Creates a base function for methods like `_.forIn` and `_.forOwn`.\n *\n * @private\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Function} Returns the new base function.\n */\nfunction createBaseFor(fromRight) {\n return function(object, iteratee, keysFunc) {\n var index = -1,\n iterable = Object(object),\n props = keysFunc(object),\n length = props.length;\n\n while (length--) {\n var key = props[fromRight ? length : ++index];\n if (iteratee(iterable[key], key, iterable) === false) {\n break;\n }\n }\n return object;\n };\n}\n\nexport default createBaseFor;\n", "import createBaseFor from './_createBaseFor.js';\n\n/**\n * The base implementation of `baseForOwn` which iterates over `object`\n * properties returned by `keysFunc` and invokes `iteratee` for each property.\n * Iteratee functions may exit iteration early by explicitly returning `false`.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {Function} keysFunc The function to get the keys of `object`.\n * @returns {Object} Returns `object`.\n */\nvar baseFor = createBaseFor();\n\nexport default baseFor;\n", "import baseFor from './_baseFor.js';\nimport keys from './keys.js';\n\n/**\n * The base implementation of `_.forOwn` without support for iteratee shorthands.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Object} Returns `object`.\n */\nfunction baseForOwn(object, iteratee) {\n return object && baseFor(object, iteratee, keys);\n}\n\nexport default baseForOwn;\n", "import root from './_root.js';\n\n/**\n * Gets the timestamp of the number of milliseconds that have elapsed since\n * the Unix epoch (1 January 1970 00:00:00 UTC).\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Date\n * @returns {number} Returns the timestamp.\n * @example\n *\n * _.defer(function(stamp) {\n * console.log(_.now() - stamp);\n * }, _.now());\n * // => Logs the number of milliseconds it took for the deferred invocation.\n */\nvar now = function() {\n return root.Date.now();\n};\n\nexport default now;\n", "import isObject from './isObject.js';\nimport now from './now.js';\nimport toNumber from './toNumber.js';\n\n/** Error message constants. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max,\n nativeMin = Math.min;\n\n/**\n * Creates a debounced function that delays invoking `func` until after `wait`\n * milliseconds have elapsed since the last time the debounced function was\n * invoked. The debounced function comes with a `cancel` method to cancel\n * delayed `func` invocations and a `flush` method to immediately invoke them.\n * Provide `options` to indicate whether `func` should be invoked on the\n * leading and/or trailing edge of the `wait` timeout. The `func` is invoked\n * with the last arguments provided to the debounced function. Subsequent\n * calls to the debounced function return the result of the last `func`\n * invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is\n * invoked on the trailing edge of the timeout only if the debounced function\n * is invoked more than once during the `wait` timeout.\n *\n * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred\n * until to the next tick, similar to `setTimeout` with a timeout of `0`.\n *\n * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\n * for details over the differences between `_.debounce` and `_.throttle`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to debounce.\n * @param {number} [wait=0] The number of milliseconds to delay.\n * @param {Object} [options={}] The options object.\n * @param {boolean} [options.leading=false]\n * Specify invoking on the leading edge of the timeout.\n * @param {number} [options.maxWait]\n * The maximum time `func` is allowed to be delayed before it's invoked.\n * @param {boolean} [options.trailing=true]\n * Specify invoking on the trailing edge of the timeout.\n * @returns {Function} Returns the new debounced function.\n * @example\n *\n * // Avoid costly calculations while the window size is in flux.\n * jQuery(window).on('resize', _.debounce(calculateLayout, 150));\n *\n * // Invoke `sendMail` when clicked, debouncing subsequent calls.\n * jQuery(element).on('click', _.debounce(sendMail, 300, {\n * 'leading': true,\n * 'trailing': false\n * }));\n *\n * // Ensure `batchLog` is invoked once after 1 second of debounced calls.\n * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });\n * var source = new EventSource('/stream');\n * jQuery(source).on('message', debounced);\n *\n * // Cancel the trailing debounced invocation.\n * jQuery(window).on('popstate', debounced.cancel);\n */\nfunction debounce(func, wait, options) {\n var lastArgs,\n lastThis,\n maxWait,\n result,\n timerId,\n lastCallTime,\n lastInvokeTime = 0,\n leading = false,\n maxing = false,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n wait = toNumber(wait) || 0;\n if (isObject(options)) {\n leading = !!options.leading;\n maxing = 'maxWait' in options;\n maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n\n function invokeFunc(time) {\n var args = lastArgs,\n thisArg = lastThis;\n\n lastArgs = lastThis = undefined;\n lastInvokeTime = time;\n result = func.apply(thisArg, args);\n return result;\n }\n\n function leadingEdge(time) {\n // Reset any `maxWait` timer.\n lastInvokeTime = time;\n // Start the timer for the trailing edge.\n timerId = setTimeout(timerExpired, wait);\n // Invoke the leading edge.\n return leading ? invokeFunc(time) : result;\n }\n\n function remainingWait(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime,\n timeWaiting = wait - timeSinceLastCall;\n\n return maxing\n ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)\n : timeWaiting;\n }\n\n function shouldInvoke(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime;\n\n // Either this is the first call, activity has stopped and we're at the\n // trailing edge, the system time has gone backwards and we're treating\n // it as the trailing edge, or we've hit the `maxWait` limit.\n return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||\n (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));\n }\n\n function timerExpired() {\n var time = now();\n if (shouldInvoke(time)) {\n return trailingEdge(time);\n }\n // Restart the timer.\n timerId = setTimeout(timerExpired, remainingWait(time));\n }\n\n function trailingEdge(time) {\n timerId = undefined;\n\n // Only invoke if we have `lastArgs` which means `func` has been\n // debounced at least once.\n if (trailing && lastArgs) {\n return invokeFunc(time);\n }\n lastArgs = lastThis = undefined;\n return result;\n }\n\n function cancel() {\n if (timerId !== undefined) {\n clearTimeout(timerId);\n }\n lastInvokeTime = 0;\n lastArgs = lastCallTime = lastThis = timerId = undefined;\n }\n\n function flush() {\n return timerId === undefined ? result : trailingEdge(now());\n }\n\n function debounced() {\n var time = now(),\n isInvoking = shouldInvoke(time);\n\n lastArgs = arguments;\n lastThis = this;\n lastCallTime = time;\n\n if (isInvoking) {\n if (timerId === undefined) {\n return leadingEdge(lastCallTime);\n }\n if (maxing) {\n // Handle invocations in a tight loop.\n clearTimeout(timerId);\n timerId = setTimeout(timerExpired, wait);\n return invokeFunc(lastCallTime);\n }\n }\n if (timerId === undefined) {\n timerId = setTimeout(timerExpired, wait);\n }\n return result;\n }\n debounced.cancel = cancel;\n debounced.flush = flush;\n return debounced;\n}\n\nexport default debounce;\n", "/**\n * Gets the last element of `array`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to query.\n * @returns {*} Returns the last element of `array`.\n * @example\n *\n * _.last([1, 2, 3]);\n * // => 3\n */\nfunction last(array) {\n var length = array == null ? 0 : array.length;\n return length ? array[length - 1] : undefined;\n}\n\nexport default last;\n", "import baseGet from './_baseGet.js';\nimport baseSlice from './_baseSlice.js';\n\n/**\n * Gets the parent value at `path` of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array} path The path to get the parent value of.\n * @returns {*} Returns the parent value.\n */\nfunction parent(object, path) {\n return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));\n}\n\nexport default parent;\n", "import toInteger from './toInteger.js';\n\n/**\n * Checks if `value` is an integer.\n *\n * **Note:** This method is based on\n * [`Number.isInteger`](https://mdn.io/Number/isInteger).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an integer, else `false`.\n * @example\n *\n * _.isInteger(3);\n * // => true\n *\n * _.isInteger(Number.MIN_VALUE);\n * // => false\n *\n * _.isInteger(Infinity);\n * // => false\n *\n * _.isInteger('3');\n * // => false\n */\nfunction isInteger(value) {\n return typeof value == 'number' && value == toInteger(value);\n}\n\nexport default isInteger;\n", "import baseAssignValue from './_baseAssignValue.js';\nimport baseForOwn from './_baseForOwn.js';\nimport baseIteratee from './_baseIteratee.js';\n\n/**\n * Creates an object with the same keys as `object` and values generated\n * by running each own enumerable string keyed property of `object` thru\n * `iteratee`. The iteratee is invoked with three arguments:\n * (value, key, object).\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Object\n * @param {Object} object The object to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Object} Returns the new mapped object.\n * @see _.mapKeys\n * @example\n *\n * var users = {\n * 'fred': { 'user': 'fred', 'age': 40 },\n * 'pebbles': { 'user': 'pebbles', 'age': 1 }\n * };\n *\n * _.mapValues(users, function(o) { return o.age; });\n * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)\n *\n * // The `_.property` iteratee shorthand.\n * _.mapValues(users, 'age');\n * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)\n */\nfunction mapValues(object, iteratee) {\n var result = {};\n iteratee = baseIteratee(iteratee, 3);\n\n baseForOwn(object, function(value, key, object) {\n baseAssignValue(result, key, iteratee(value, key, object));\n });\n return result;\n}\n\nexport default mapValues;\n", "import castPath from './_castPath.js';\nimport last from './last.js';\nimport parent from './_parent.js';\nimport toKey from './_toKey.js';\n\n/**\n * The base implementation of `_.unset`.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {Array|string} path The property path to unset.\n * @returns {boolean} Returns `true` if the property is deleted, else `false`.\n */\nfunction baseUnset(object, path) {\n path = castPath(path, object);\n object = parent(object, path);\n return object == null || delete object[toKey(last(path))];\n}\n\nexport default baseUnset;\n", "/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeFloor = Math.floor;\n\n/**\n * The base implementation of `_.repeat` which doesn't coerce arguments.\n *\n * @private\n * @param {string} string The string to repeat.\n * @param {number} n The number of times to repeat the string.\n * @returns {string} Returns the repeated string.\n */\nfunction baseRepeat(string, n) {\n var result = '';\n if (!string || n < 1 || n > MAX_SAFE_INTEGER) {\n return result;\n }\n // Leverage the exponentiation by squaring algorithm for a faster repeat.\n // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.\n do {\n if (n % 2) {\n result += string;\n }\n n = nativeFloor(n / 2);\n if (n) {\n string += string;\n }\n } while (n);\n\n return result;\n}\n\nexport default baseRepeat;\n", "import baseProperty from './_baseProperty.js';\n\n/**\n * Gets the size of an ASCII `string`.\n *\n * @private\n * @param {string} string The string inspect.\n * @returns {number} Returns the string size.\n */\nvar asciiSize = baseProperty('length');\n\nexport default asciiSize;\n", "/** Used to compose unicode character classes. */\nvar rsAstralRange = '\\\\ud800-\\\\udfff',\n rsComboMarksRange = '\\\\u0300-\\\\u036f',\n reComboHalfMarksRange = '\\\\ufe20-\\\\ufe2f',\n rsComboSymbolsRange = '\\\\u20d0-\\\\u20ff',\n rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,\n rsVarRange = '\\\\ufe0e\\\\ufe0f';\n\n/** Used to compose unicode capture groups. */\nvar rsAstral = '[' + rsAstralRange + ']',\n rsCombo = '[' + rsComboRange + ']',\n rsFitz = '\\\\ud83c[\\\\udffb-\\\\udfff]',\n rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',\n rsNonAstral = '[^' + rsAstralRange + ']',\n rsRegional = '(?:\\\\ud83c[\\\\udde6-\\\\uddff]){2}',\n rsSurrPair = '[\\\\ud800-\\\\udbff][\\\\udc00-\\\\udfff]',\n rsZWJ = '\\\\u200d';\n\n/** Used to compose unicode regexes. */\nvar reOptMod = rsModifier + '?',\n rsOptVar = '[' + rsVarRange + ']?',\n rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',\n rsSeq = rsOptVar + reOptMod + rsOptJoin,\n rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';\n\n/** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */\nvar reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');\n\n/**\n * Gets the size of a Unicode `string`.\n *\n * @private\n * @param {string} string The string inspect.\n * @returns {number} Returns the string size.\n */\nfunction unicodeSize(string) {\n var result = reUnicode.lastIndex = 0;\n while (reUnicode.test(string)) {\n ++result;\n }\n return result;\n}\n\nexport default unicodeSize;\n", "import asciiSize from './_asciiSize.js';\nimport hasUnicode from './_hasUnicode.js';\nimport unicodeSize from './_unicodeSize.js';\n\n/**\n * Gets the number of symbols in `string`.\n *\n * @private\n * @param {string} string The string to inspect.\n * @returns {number} Returns the string size.\n */\nfunction stringSize(string) {\n return hasUnicode(string)\n ? unicodeSize(string)\n : asciiSize(string);\n}\n\nexport default stringSize;\n", "import baseRepeat from './_baseRepeat.js';\nimport baseToString from './_baseToString.js';\nimport castSlice from './_castSlice.js';\nimport hasUnicode from './_hasUnicode.js';\nimport stringSize from './_stringSize.js';\nimport stringToArray from './_stringToArray.js';\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeCeil = Math.ceil;\n\n/**\n * Creates the padding for `string` based on `length`. The `chars` string\n * is truncated if the number of characters exceeds `length`.\n *\n * @private\n * @param {number} length The padding length.\n * @param {string} [chars=' '] The string used as padding.\n * @returns {string} Returns the padding for `string`.\n */\nfunction createPadding(length, chars) {\n chars = chars === undefined ? ' ' : baseToString(chars);\n\n var charsLength = chars.length;\n if (charsLength < 2) {\n return charsLength ? baseRepeat(chars, length) : chars;\n }\n var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));\n return hasUnicode(chars)\n ? castSlice(stringToArray(result), 0, length).join('')\n : result.slice(0, length);\n}\n\nexport default createPadding;\n", "import createPadding from './_createPadding.js';\nimport stringSize from './_stringSize.js';\nimport toInteger from './toInteger.js';\nimport toString from './toString.js';\n\n/**\n * Pads `string` on the left side if it's shorter than `length`. Padding\n * characters are truncated if they exceed `length`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category String\n * @param {string} [string=''] The string to pad.\n * @param {number} [length=0] The padding length.\n * @param {string} [chars=' '] The string used as padding.\n * @returns {string} Returns the padded string.\n * @example\n *\n * _.padStart('abc', 6);\n * // => ' abc'\n *\n * _.padStart('abc', 6, '_-');\n * // => '_-_abc'\n *\n * _.padStart('abc', 3);\n * // => 'abc'\n */\nfunction padStart(string, length, chars) {\n string = toString(string);\n length = toInteger(length);\n\n var strLength = length ? stringSize(string) : 0;\n return (length && strLength < length)\n ? (createPadding(length - strLength, chars) + string)\n : string;\n}\n\nexport default padStart;\n", "import baseUnset from './_baseUnset.js';\n\n/**\n * Removes the property at `path` of `object`.\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Object\n * @param {Object} object The object to modify.\n * @param {Array|string} path The path of the property to unset.\n * @returns {boolean} Returns `true` if the property is deleted, else `false`.\n * @example\n *\n * var object = { 'a': [{ 'b': { 'c': 7 } }] };\n * _.unset(object, 'a[0].b.c');\n * // => true\n *\n * console.log(object);\n * // => { 'a': [{ 'b': {} }] };\n *\n * _.unset(object, ['a', '0', 'b', 'c']);\n * // => true\n *\n * console.log(object);\n * // => { 'a': [{ 'b': {} }] };\n */\nfunction unset(object, path) {\n return object == null ? true : baseUnset(object, path);\n}\n\nexport default unset;\n", "import type {$IntentionalAny} from '@encorejs/utils/types'\r\n\r\n/**\r\n * This is like `Object.assign(base, override)`, with the following differences:\r\n *\r\n * 1. It returns a new value, instead of mutating `base`:\r\n * ```js\r\n * const cache = new WeakMap()\r\n * const base = {foo: 1}\r\n * const override = {bar: 1}\r\n * const result = deepMergeWithCache(base, override, cache)\r\n * console.log(result) // {foo: 1, bar: 1}\r\n * console.log(base) // base is not mutated, so: {foo: 1}\r\n * ```\r\n *\r\n * 2. It does a recursive merge for objects:\r\n * ```js\r\n * const cache = new WeakMap()\r\n * const base = {a: {b: 1}}\r\n * const override = {a: {b: 2}}\r\n * const result = deepMergeWithCache(base, override, cache)\r\n * console.log(result) // {a: {b: 2}}\r\n * ```\r\n *\r\n * 2. It uses a WeakMap to cache its results at each level. So merges are referentially stable:\r\n * ```js\r\n * const cache = new WeakMap()\r\n * const base = {a: {b: 1}}\r\n * const override1 = {a: {b: 2}}\r\n * const result1 = deepMergeWithCache(base, override, cache)\r\n * console.log(result1 === deepMergeWithCache(base, override, cache)) // true\r\n *\r\n * const override2 = {...override, c: 1}\r\n * const result2 = deepMergeWithCache(base, override2, cache)\r\n *\r\n * console.log(result1.a === result2.a) // logs true, because override1.a === override2.a\r\n * ```\r\n *\r\n * 4. Both `base` and `override` must be plain JSON values and *NO* arrays, so: `boolean, string, number, undefined, {}`\r\n *\r\n * Rationale: This is used in {@link SheetObject.getValues} to deep-merge static and sequenced\r\n * and other types of overrides. If we were to do a deep-merge without a cache, we'd be creating and discarding\r\n * several JS objects on each frame for every Theatre object, and that would pressure the GC.\r\n * Plus, keeping the values referentially stable helps lib authors optimize how they patch these values\r\n * to the rendering engine.\r\n */\r\nexport default function deepMergeWithCache<T extends {}>(\r\n base: Partial<T>,\r\n override: Partial<T>,\r\n cache: WeakMap<{}, unknown>,\r\n): Partial<T> {\r\n const _cache: WeakMap<\r\n {},\r\n {\r\n override: Partial<T>\r\n merged: Partial<T>\r\n }\r\n > = cache as $IntentionalAny\r\n\r\n const possibleCachedValue = _cache.get(base)\r\n\r\n if (possibleCachedValue && possibleCachedValue.override === override) {\r\n return possibleCachedValue.merged\r\n }\r\n\r\n const merged = {...base}\r\n for (const key of Object.keys(override)) {\r\n const valueInOverride = override[key]\r\n const valueInBase = base[key]\r\n\r\n // @ts-ignore @todo\r\n merged[key] =\r\n // Require both sides to be non-null objects before recursing: `typeof\r\n // null === 'object'`, so without the truthiness guard a null opposite a\r\n // plain object would recurse into null and throw.\r\n valueInOverride &&\r\n valueInBase &&\r\n typeof valueInOverride === 'object' &&\r\n typeof valueInBase === 'object'\r\n ? deepMergeWithCache(valueInBase as {}, valueInOverride as {}, cache)\r\n : valueInOverride === undefined\r\n ? valueInBase\r\n : valueInOverride\r\n }\r\n\r\n cache.set(base, {override, merged})\r\n return merged\r\n}\r\n", "import type {Pointer} from '@encorejs/dataverse'\r\nimport type {PathToProp} from '@encorejs/utils/pathToProp'\r\nimport type {$IntentionalAny} from '@encorejs/utils/types'\r\n\r\n/**\r\n * Points deep into a pointer, using `toAppend` as the path. This is _NOT_ type-safe, so use with caution.\r\n */\r\nexport default function pointerDeep<T>(\r\n base: Pointer<T>,\r\n toAppend: PathToProp,\r\n): Pointer<unknown> {\r\n let p = base as $IntentionalAny\r\n for (const k of toAppend) {\r\n p = p[k]\r\n }\r\n return p\r\n}\r\n", "import {Atom, prism} from '@encorejs/dataverse'\r\n\r\n/**\r\n * A prism hook that converts `val` into an atom, and returns that atom.\r\n */\r\nexport const valToAtom = <T>(key: string, vals: T): Atom<T> => {\r\n const a = prism.memo(key, () => new Atom(vals), [])\r\n a.set(vals)\r\n return a\r\n}\r\n", "import type {InterpolationTriple} from '@encorejs/core/sequences/interpolationTripleAtPosition'\r\nimport interpolationTripleAtPosition from '@encorejs/core/sequences/interpolationTripleAtPosition'\r\nimport type Sheet from '@encorejs/core/sheets/Sheet'\r\nimport type {SheetObjectAddress} from '@encorejs/core/types/public'\r\nimport deepMergeWithCache from '@encorejs/utils/deepMergeWithCache'\r\nimport type {SequenceTrackId} from '@encorejs/core/types/public'\r\nimport pointerDeep from '@encorejs/utils/pointerDeep'\r\nimport SimpleCache from '@encorejs/utils/SimpleCache'\r\nimport type {$FixMe, $IntentionalAny} from '@encorejs/core/types/public'\r\nimport {valToAtom} from '@encorejs/utils/valToAtom'\r\nimport type {PointerToPrismProvider, Prism, Pointer} from '@encorejs/dataverse'\r\nimport {Atom, getPointerParts, pointer, prism, val} from '@encorejs/dataverse'\r\nimport type SheetObjectTemplate from './SheetObjectTemplate'\r\nimport TheatreSheetObject from './TheatreSheetObject'\r\nimport {getPropConfigByPath} from '@encorejs/core/propTypes/utils'\r\nimport type {\r\n Interpolator,\r\n PropTypeConfig,\r\n DeepPartialOfSerializableValue,\r\n SerializableMap,\r\n SerializableValue,\r\n} from '@encorejs/core/types/public'\r\n\r\n/**\r\n * Internally, the sheet's actual configured value is not a specific type, since we\r\n * can change the prop config at will, as such this is an alias of {@link SerializableMap}.\r\n *\r\n * TODO: Incorporate this knowledge into SheetObject & TemplateSheetObject\r\n */\r\ntype SheetObjectPropsValue = SerializableMap\r\n\r\n/**\r\n * An object on a sheet consisting of zero or more properties which can\r\n * be overridden statically or overridden by being sequenced.\r\n *\r\n * Note that this cannot be generic over `Props`, since the user is\r\n * able to change prop configs for the sheet object's properties.\r\n */\r\nexport default class SheetObject implements PointerToPrismProvider {\r\n get type(): 'Theatre_SheetObject' {\r\n return 'Theatre_SheetObject'\r\n }\r\n readonly $$isPointerToPrismProvider: true = true\r\n readonly address: SheetObjectAddress\r\n readonly publicApi: TheatreSheetObject\r\n private readonly _initialValue = new Atom<SheetObjectPropsValue>({})\r\n private readonly _cache = new SimpleCache()\r\n\r\n constructor(\r\n readonly sheet: Sheet,\r\n readonly template: SheetObjectTemplate,\r\n readonly nativeObject: unknown,\r\n ) {\r\n this.address = {\r\n ...template.address,\r\n sheetInstanceId: sheet.address.sheetInstanceId,\r\n }\r\n\r\n this.publicApi = new TheatreSheetObject(this)\r\n }\r\n\r\n getValues(): Prism<Pointer<SheetObjectPropsValue>> {\r\n // Cache the prism because only one is needed per SheetObject.\r\n // Also, if `onValuesChange()` is unsubscribed from, this prism will go cold\r\n // and free its resources. So it's no problem to still keep it on the cache.\r\n return this._cache.get('getValues()', () =>\r\n prism(() => {\r\n /**\r\n * The final value is a deep-merge of defaults + initial + static + sequenced values.\r\n * We calculate each of those separately, and deep merge them one-by-one until\r\n * we get the final value.\r\n *\r\n * Notes on performance: This prism _will_ recalculate every time any value of any prop changes,\r\n * including nested props. In other words, if foo.bar.baz changes, this prism will recalculate. Even more,\r\n * if boo.bar.baz is sequenced and the sequence is playing, this prism will recalculate on every frame.\r\n * This might sound inefficient, but we have a few tricks to make it fast:\r\n *\r\n * First, on each recalculation, most of the prisms that this prism depends on will not have changed,\r\n * and so reading them is cheap. For example, if foo.bar.baz changed due to being sequenced, but\r\n * foo.bar2 hasn't because it is static, reading foo.bar2 will be cheap.\r\n *\r\n * Secondly, as we deep merge each layer, we use a cache to avoid recalculating the same merge over and over.\r\n *\r\n * Third, we have sorted our layers in the order of how likely they are to change. For example, sequenced\r\n * values are likely to change on each frame, so they're layerd on last. Static values seldom change,\r\n * and default values almost never do, so they're layered on first.\r\n *\r\n * All of this means that most the work of this prism is done on the very first calculation, and subsequent\r\n * recalculations are cheap.\r\n *\r\n * Question: What about object.initialValue which _could_ change on every frame, but isn't layerd on last?\r\n * Answer: initialValue is seldom used (it's only used in `@encorejs/r3f` as far as we know). So this won't\r\n * affect the majority of use cases. And in case it _is_ used, it's better for us to implement an alternative\r\n * to `object.getValues()` that does not layer initialValue (and also skips defaultValue too). This is discussed\r\n * in issue [P-208](https://linear.app/theatre/issue/P-208/use-overrides-rather-than-final-values-in-r3f).\r\n */\r\n\r\n /**\r\n * The lowest layer is the default value of the root prop. Since an object's config\r\n * _could_ change, we read it as a prism. Otherwise, we could have just `getDefaultsOfPropTypeConfig(this.template.staticConfig)`.\r\n *\r\n * Note: If studio is not present, there is no known use-case for the config of an object to change on the fly, so\r\n * we could read this value statically.\r\n */\r\n const defaults = val(this.template.getDefaultValues())\r\n\r\n /**\r\n * The second layer is the initialValue, which is what the user sets with `sheetObject.initialValue = someValue`.\r\n */\r\n const initial = val(this._initialValue.pointer)\r\n\r\n /**\r\n * For each deep-merge, we need a separate WeakMap to cache the result of the merge. See {@link deepMergeWithCache}\r\n * to learn how that works.\r\n *\r\n * Here we use a `prism.memo()` so we can re-use our cache.\r\n */\r\n const withInitialCache = prism.memo(\r\n 'withInitialCache',\r\n () => new WeakMap(),\r\n [],\r\n )\r\n\r\n // deep-merge the defaultValues with the initialValues.\r\n const withInitial = deepMergeWithCache(\r\n defaults,\r\n initial,\r\n withInitialCache,\r\n )\r\n\r\n /**\r\n * The third layer are the static values. Since these are (currently) commnon to all instances\r\n * of the same SheetObject, we can read it from the template.\r\n */\r\n const statics = val(this.template.getStaticValues())\r\n\r\n // Similar to above, we need a separate but stable WeakMap to cache the result of merging the static values\r\n const withStaticsCache = prism.memo(\r\n 'withStatics',\r\n () => new WeakMap(),\r\n [],\r\n )\r\n\r\n // deep-merge the static values with the previous layer\r\n const withStatics = deepMergeWithCache(\r\n withInitial,\r\n statics,\r\n withStaticsCache,\r\n )\r\n\r\n /**\r\n * The final values (all layers merged together) will be put inside this variable\r\n */\r\n let final = withStatics\r\n /**\r\n * The sequenced values will be put in this variable\r\n */\r\n let sequenced\r\n\r\n {\r\n // NOTE: we're reading the sequenced values as a prism to a pointer. This should be refactored\r\n // to a simple pointer.\r\n const pointerToSequencedValuesD = prism.memo(\r\n 'seq',\r\n () => this.getSequencedValues(),\r\n [],\r\n )\r\n\r\n // like before, we need a separate but stable WeakMap to cache the result of merging the sequenced values\r\n // on top of the last layer\r\n const withSeqsCache = prism.memo(\r\n 'withSeqsCache',\r\n () => new WeakMap(),\r\n [],\r\n )\r\n\r\n // read the sequenced values\r\n // (val(val(x))) unwraps the pointer and the prism\r\n sequenced = val(val(pointerToSequencedValuesD))\r\n\r\n // deep-merge the sequenced values with the previous layer\r\n const withSeqs = deepMergeWithCache(final, sequenced, withSeqsCache)\r\n final = withSeqs\r\n }\r\n\r\n // Finally, we wrap the final value in an atom, so we can return a pointer to it.\r\n const a = valToAtom<SheetObjectPropsValue>('finalAtom', final)\r\n\r\n // Since we only return a pointer, the value cannot be mutated from outside of this prism.\r\n return a.pointer\r\n }),\r\n )\r\n }\r\n\r\n getValueByPointer<T extends SerializableValue>(pointer: Pointer<T>): T {\r\n const allValuesP = val(this.getValues())\r\n const {path} = getPointerParts(pointer)\r\n\r\n return val(\r\n pointerDeep(allValuesP as $FixMe, path),\r\n ) as SerializableValue as T\r\n }\r\n\r\n pointerToPrism<P>(pointer: Pointer<P>): Prism<P> {\r\n const {path} = getPointerParts(pointer)\r\n /**\r\n * @remarks\r\n * TODO perf: Too much indirection here.\r\n */\r\n return prism(() => {\r\n const allValuesP = val(this.getValues())\r\n return val(pointerDeep(allValuesP as $FixMe, path)) as SerializableMap\r\n }) as $IntentionalAny as Prism<P>\r\n }\r\n\r\n /**\r\n * Returns values of props that are sequenced.\r\n */\r\n getSequencedValues(): Prism<Pointer<SheetObjectPropsValue>> {\r\n return prism(() => {\r\n const tracksToProcessD = prism.memo(\r\n 'tracksToProcess',\r\n () => this.template.getArrayOfValidSequenceTracks(),\r\n [],\r\n )\r\n\r\n const tracksToProcess = val(tracksToProcessD)\r\n const valsAtom = new Atom<SheetObjectPropsValue>({})\r\n const config = val(this.template.configPointer)\r\n\r\n prism.effect(\r\n 'processTracks',\r\n () => {\r\n const untaps: Array<() => void> = []\r\n\r\n for (const {trackId, pathToProp} of tracksToProcess) {\r\n const pr = this._trackIdToPrism(trackId)\r\n const propConfig = getPropConfigByPath(\r\n config,\r\n pathToProp,\r\n )! as Extract<PropTypeConfig, {interpolate: $IntentionalAny}>\r\n\r\n const deserializeAndSanitize = propConfig.deserializeAndSanitize\r\n const interpolate =\r\n propConfig.interpolate! as Interpolator<$IntentionalAny>\r\n\r\n const updateSequenceValueFromItsPrism = () => {\r\n const triple = pr.getValue()\r\n\r\n if (!triple)\r\n return valsAtom.setByPointer(\r\n (p) => pointerDeep(p, pathToProp),\r\n undefined,\r\n )\r\n\r\n const leftDeserialized = deserializeAndSanitize(triple.left)\r\n\r\n const left =\r\n leftDeserialized === undefined\r\n ? propConfig.default\r\n : leftDeserialized\r\n\r\n if (triple.right === undefined)\r\n return valsAtom.setByPointer(\r\n (p) => pointerDeep(p, pathToProp),\r\n left,\r\n )\r\n\r\n const rightDeserialized = deserializeAndSanitize(triple.right)\r\n const right =\r\n rightDeserialized === undefined\r\n ? propConfig.default\r\n : rightDeserialized\r\n\r\n return valsAtom.setByPointer(\r\n (p) => pointerDeep(p, pathToProp),\r\n interpolate(left, right, triple.progression),\r\n )\r\n }\r\n const untap = pr.onStale(updateSequenceValueFromItsPrism)\r\n\r\n updateSequenceValueFromItsPrism()\r\n untaps.push(untap)\r\n }\r\n return () => {\r\n for (const untap of untaps) {\r\n untap()\r\n }\r\n }\r\n },\r\n [config, ...tracksToProcess],\r\n )\r\n\r\n return valsAtom.pointer\r\n })\r\n }\r\n\r\n protected _trackIdToPrism(\r\n trackId: SequenceTrackId,\r\n ): Prism<InterpolationTriple | undefined> {\r\n const trackP =\r\n this.template.project.pointers.historic.sheetsById[this.address.sheetId]\r\n .sequence.tracksByObject[this.address.objectKey].trackData[trackId]\r\n\r\n const timeD = this.sheet.getSequence().positionPrism\r\n\r\n return interpolationTripleAtPosition(trackP, timeD)\r\n }\r\n\r\n get propsP(): Pointer<SheetObjectPropsValue> {\r\n return this._cache.get('propsP', () =>\r\n pointer<{props: {}}>({root: this, path: []}),\r\n ) as $FixMe\r\n }\r\n\r\n validateValue(\r\n pointer: Pointer<SheetObjectPropsValue>,\r\n value: DeepPartialOfSerializableValue<SheetObjectPropsValue>,\r\n ) {\r\n // @todo\r\n }\r\n\r\n setInitialValue(val: DeepPartialOfSerializableValue<SheetObjectPropsValue>) {\r\n this.validateValue(this.propsP, val)\r\n this._initialValue.set(val)\r\n }\r\n}\r\n", "import {privateAPI, setPrivateAPI} from '@encorejs/core/privateAPIs'\r\nimport type {SheetObjectAddress} from '@encorejs/core/types/public'\r\nimport SimpleCache from '@encorejs/utils/SimpleCache'\r\nimport type {$FixMe, VoidFn} from '@encorejs/core/types/public'\r\nimport type {Prism, Pointer} from '@encorejs/dataverse'\r\nimport {prism, val} from '@encorejs/dataverse'\r\nimport type SheetObject from './SheetObject'\r\nimport {debounce} from 'lodash-es'\r\nimport type {DebouncedFunc} from 'lodash-es'\r\nimport type {\r\n IProject,\r\n IRafDriver,\r\n ISheet,\r\n ISheetObject,\r\n PropsValue,\r\n UnknownShorthandCompoundProps,\r\n DeepPartialOfSerializableValue,\r\n} from '@encorejs/core/types/public'\r\nimport {onChange} from '@encorejs/core/coreExports'\r\n\r\n// Enabled for https://linear.app/theatre/issue/P-217/if-objvalue-is-read-make-sure-its-derivation-remains-hot-for-a-while\r\n// Disable to test old behavior\r\nconst KEEP_HOT_FOR_MS: undefined | number = 5 * 1000\r\n\r\nexport default class TheatreSheetObject<\r\n Props extends UnknownShorthandCompoundProps = UnknownShorthandCompoundProps,\r\n> implements ISheetObject<Props>\r\n{\r\n get type(): 'Theatre_SheetObject_PublicAPI' {\r\n return 'Theatre_SheetObject_PublicAPI'\r\n }\r\n private readonly _cache = new SimpleCache()\r\n /** @internal See https://linear.app/theatre/issue/P-217/if-objvalue-is-read-make-sure-its-derivation-remains-hot-for-a-while */\r\n private _keepHotUntapDebounce: undefined | DebouncedFunc<VoidFn> = undefined\r\n\r\n /**\r\n * @internal\r\n */\r\n constructor(internals: SheetObject) {\r\n setPrivateAPI(this, internals)\r\n }\r\n\r\n get props(): Pointer<this['value']> {\r\n return privateAPI(this).propsP as $FixMe\r\n }\r\n\r\n get sheet(): ISheet {\r\n return privateAPI(this).sheet.publicApi\r\n }\r\n\r\n get project(): IProject {\r\n return privateAPI(this).sheet.project.publicApi\r\n }\r\n\r\n get address(): SheetObjectAddress {\r\n return {...privateAPI(this).address}\r\n }\r\n\r\n private _valuesPrism(): Prism<this['value']> {\r\n return this._cache.get('_valuesPrism', () => {\r\n const sheetObject = privateAPI(this)\r\n const d: Prism<PropsValue<Props>> = prism(() => {\r\n return val(sheetObject.getValues().getValue()) as $FixMe\r\n })\r\n return d\r\n })\r\n }\r\n\r\n onValuesChange(\r\n fn: (values: this['value']) => void,\r\n rafDriver?: IRafDriver,\r\n ): VoidFn {\r\n return onChange(this._valuesPrism(), fn, rafDriver)\r\n }\r\n\r\n // internal: Make the deviration keepHot if directly read\r\n get value(): PropsValue<Props> {\r\n const der = this._valuesPrism()\r\n if (KEEP_HOT_FOR_MS != null) {\r\n if (!der.isHot) {\r\n // prism not hot, so keep it hot and set up `_keepHotUntapDebounce`\r\n if (this._keepHotUntapDebounce != null) {\r\n // defensive checks\r\n if (process.env.NODE_ENV === 'development') {\r\n console.warn(\r\n '`sheet.value` keepHot debouncer is set, even though the derivation is not actually hot.',\r\n )\r\n }\r\n // \"flush\" calls the `untap()` for previous `.keepHot()`.\r\n // This is defensive, as this code path is also already an invariant.\r\n // We have to flush though to avoid calling keepHot a second time and introducing two or more debounce fns.\r\n this._keepHotUntapDebounce.flush()\r\n }\r\n\r\n const untap = der.keepHot()\r\n // add a debounced function, so we keep this hot for some period of time that this .value is being read\r\n this._keepHotUntapDebounce = debounce(() => {\r\n untap()\r\n this._keepHotUntapDebounce = undefined\r\n }, KEEP_HOT_FOR_MS)\r\n }\r\n\r\n if (this._keepHotUntapDebounce) {\r\n // we enabled this \"keep hot\" and need to keep refreshing the timer on the debounce\r\n // See https://linear.app/theatre/issue/P-217/if-objvalue-is-read-make-sure-its-derivation-remains-hot-for-a-while\r\n this._keepHotUntapDebounce()\r\n }\r\n }\r\n return der.getValue()\r\n }\r\n\r\n set initialValue(val: DeepPartialOfSerializableValue<this['value']>) {\r\n privateAPI(this).setInitialValue(val)\r\n }\r\n}\r\n", "import type {\r\n IBasePropType,\r\n PropTypeConfig,\r\n PropTypeConfig_AllSimples,\r\n PropTypeConfig_Compound,\r\n PropTypeConfig_Enum,\r\n PathToProp,\r\n $IntentionalAny,\r\n} from '@encorejs/core/types/public'\r\nimport memoizeFn from '@encorejs/utils/memoizeFn'\r\n\r\n/**\r\n * Iterates recursively over all props of an object (which should be a {@link SerializableMap}) and runs `fn`\r\n * on each prop that has a primitive value (string/number/boolean) and is _NOT_ null/undefined.\r\n *\r\n * Example:\r\n * ```ts\r\n * forEachDeep(\r\n * // The object to iterate over. The `fn` is going to be called on `b` and `c`.\r\n * {a: {b: 1, c: 2, d: null, e: undefined}},\r\n * // the function to run on each prop\r\n * (value, pathToValue) => {\r\n * console.log(value, pathToValue)\r\n * },\r\n * // We can optionally pass a path prefix to prepend to the path of each prop\r\n * ['foo', 'bar'])\r\n *\r\n * // The above will log:\r\n * // 1 ['foo', 'bar', 'a', 'b']\r\n * // 2 ['foo', 'bar', 'a', 'c']\r\n * // Note that null and undefined values are skipped.\r\n * // Also note that `a` is also skippped, because it's not a primitive value.\r\n * ```\r\n */\r\nexport function forEachPropDeep<\r\n Primitive extends\r\n | string\r\n | number\r\n | boolean\r\n | PropTypeConfig_AllSimples['valueType'],\r\n>(\r\n m:\r\n | PropTypeConfig_Compound<$IntentionalAny>['valueType']\r\n | Primitive\r\n | undefined\r\n | unknown,\r\n fn: (value: Primitive, path: PathToProp) => void,\r\n startingPath: PathToProp = [],\r\n): void {\r\n if (typeof m === 'object' && m) {\r\n if (isImage(m) || isRGBA(m)) {\r\n fn(m as $IntentionalAny as Primitive, startingPath)\r\n return\r\n }\r\n for (const [key, value] of Object.entries(m)) {\r\n forEachPropDeep(value!, fn, [...startingPath, key])\r\n }\r\n } else if (m === undefined || m === null) {\r\n return\r\n } else {\r\n fn(m as $IntentionalAny as Primitive, startingPath)\r\n }\r\n}\r\n\r\nconst isImage = (value: unknown): value is {type: 'image'; id: string} => {\r\n return (\r\n typeof value === 'object' &&\r\n value !== null &&\r\n Object.hasOwnProperty.call(value, 'type') &&\r\n // @ts-ignore\r\n value.type === 'image' &&\r\n Object.hasOwnProperty.call(value, 'id') &&\r\n // @ts-ignore\r\n typeof value.id === 'string' &&\r\n // @ts-ignore\r\n value.id !== ''\r\n )\r\n}\r\n\r\nconst isRGBA = (\r\n value: unknown,\r\n): value is {r: number; g: number; b: number; a: number} => {\r\n return (\r\n typeof value === 'object' &&\r\n value !== null &&\r\n Object.hasOwnProperty.call(value, 'r') &&\r\n Object.hasOwnProperty.call(value, 'g') &&\r\n Object.hasOwnProperty.call(value, 'b') &&\r\n Object.hasOwnProperty.call(value, 'a') &&\r\n // @ts-ignore\r\n typeof value.r === 'number' &&\r\n // @ts-ignore\r\n typeof value.g === 'number' &&\r\n // @ts-ignore\r\n typeof value.b === 'number' &&\r\n // @ts-ignore\r\n typeof value.a === 'number'\r\n )\r\n}\r\n\r\n/**\r\n * Either compound or enum properties can be considered \"composite\"\r\n * */\r\nexport function isPropConfigComposite(\r\n c: PropTypeConfig,\r\n): c is PropTypeConfig_Compound<{}> | PropTypeConfig_Enum {\r\n return c.type === 'compound' || c.type === 'enum'\r\n}\r\n\r\n/**\r\n * Returns the prop config at the given path. Traverses composite props until\r\n * it reaches the deepest prop config. Returns `undefined` if none is found.\r\n *\r\n * This is _NOT_ type-safe, so use with caution.\r\n */\r\nexport function getPropConfigByPath(\r\n parentConf: PropTypeConfig | undefined,\r\n path: PathToProp,\r\n): undefined | PropTypeConfig {\r\n if (!parentConf) return undefined\r\n const [key, ...rest] = path\r\n if (key === undefined) return parentConf\r\n if (!isPropConfigComposite(parentConf)) return undefined\r\n\r\n const sub =\r\n parentConf.type === 'enum'\r\n ? parentConf.cases[key]\r\n : (parentConf as $IntentionalAny).props[key]\r\n\r\n return getPropConfigByPath(sub, rest)\r\n}\r\n\r\n/**\r\n * @param value - An arbitrary value. May be matching the prop's type or not\r\n * @param propConfig - The configuration object for a prop\r\n * @returns value if it matches the prop's type\r\n * otherwise returns the default value for the prop\r\n */\r\nexport function valueInProp<PropConfig extends PropTypeConfig_AllSimples>(\r\n value: unknown,\r\n propConfig: PropConfig,\r\n): PropConfig extends IBasePropType<$IntentionalAny, $IntentionalAny, infer T>\r\n ? T\r\n : never {\r\n const sanitizedVal = propConfig.deserializeAndSanitize(value)\r\n if (sanitizedVal === undefined) {\r\n return propConfig.default\r\n } else {\r\n return sanitizedVal\r\n }\r\n}\r\n\r\n/**\r\n * Returns true if the prop can be sequenced according to its config. This basically returns false for composite props,\r\n * and true for everything else.\r\n */\r\nexport function isPropConfSequencable(\r\n conf: PropTypeConfig,\r\n): conf is Extract<PropTypeConfig, {interpolate: any}> {\r\n return !isPropConfigComposite(conf) // now all non-compounds are sequencable\r\n}\r\n\r\n/**\r\n * This basically checks of the compound prop has at least one simple prop in its descendants.\r\n * In other words, if the compound props has no subs, or its subs are only compounds that eventually\r\n * don't have simple subs, this will return false.\r\n */\r\nexport const compoundHasSimpleDescendants = memoizeFn(\r\n (conf: PropTypeConfig_Compound<{}> | PropTypeConfig_Enum): boolean => {\r\n if (conf.type === 'enum') {\r\n throw new Error(`Not implemented yet for enums`)\r\n }\r\n\r\n for (const key in conf.props) {\r\n const subConf = conf.props[\r\n key as $IntentionalAny as keyof typeof conf.props\r\n ] as PropTypeConfig\r\n if (isPropConfigComposite(subConf)) {\r\n if (compoundHasSimpleDescendants(subConf)) {\r\n return true\r\n }\r\n } else {\r\n return true\r\n }\r\n }\r\n return false\r\n },\r\n)\r\n\r\n/**\r\n * Iterates recursively over the simple props of a compound prop. Returns a generator.\r\n *\r\n *\r\n * @param conf - The prop config\r\n * @param pathPrefix - The path prefix to prepend to the paths of the props\r\n * @returns A generator that yields the path and the config of each simple prop\r\n *\r\n * * Example:\r\n * ```ts\r\n * const conf = types.compound({a: {b: 1, c: {d: 2}}})\r\n * for (const {path, conf} of iteratePropType(conf, ['foo'])) {\r\n * console.log({path, conf})\r\n * }\r\n * // logs:\r\n * // {path: ['foo', 'a', 'b'], conf: {type: 'number', default: 1}}\r\n * // {path: ['foo', 'a', 'c', 'd'], conf: {type: 'number', default: 2}}\r\n * ```\r\n */\r\nexport function* iteratePropType(\r\n conf: PropTypeConfig,\r\n pathPrefix: PathToProp,\r\n): Generator<{path: PathToProp; conf: PropTypeConfig}, void, void> {\r\n if (conf.type === 'compound') {\r\n for (const key in conf.props) {\r\n yield* iteratePropType(conf.props[key] as PropTypeConfig, [\r\n ...pathPrefix,\r\n key,\r\n ])\r\n }\r\n } else if (conf.type === 'enum') {\r\n throw new Error(`Not implemented yet`)\r\n } else {\r\n return yield {path: pathPrefix, conf}\r\n }\r\n}\r\n", "import type {$IntentionalAny} from '@encorejs/core/types/public'\r\nimport type {\r\n PropTypeConfig,\r\n PropTypeConfig_Compound,\r\n} from '@encorejs/core/types/public'\r\nimport {isPropConfigComposite} from '@encorejs/core/propTypes/utils'\r\n\r\ntype EncodedPropPath = string\r\ntype Order = number\r\n\r\ntype Mapping = Map<EncodedPropPath, Order>\r\n\r\nconst cache = new WeakMap<PropTypeConfig_Compound<$IntentionalAny>, Mapping>()\r\n\r\nexport default function getOrderingOfPropTypeConfig(\r\n config: PropTypeConfig_Compound<$IntentionalAny>,\r\n): Mapping {\r\n const existing = cache.get(config)\r\n if (existing) return existing\r\n\r\n const map: Mapping = new Map()\r\n cache.set(config, map)\r\n\r\n iterateOnCompound([], config, map)\r\n\r\n return map\r\n}\r\n\r\nfunction iterateOnCompound(\r\n path: string[],\r\n config: PropTypeConfig_Compound<$IntentionalAny>,\r\n map: Mapping,\r\n) {\r\n for (const [key, subConf] of Object.entries(config.props)) {\r\n if (!isPropConfigComposite(subConf)) {\r\n const subPath = [...path, key]\r\n map.set(JSON.stringify(subPath), map.size)\r\n iterateOnAny(subPath, subConf, map)\r\n }\r\n }\r\n\r\n for (const [key, subConf] of Object.entries(config.props)) {\r\n if (isPropConfigComposite(subConf)) {\r\n const subPath = [...path, key]\r\n map.set(JSON.stringify(subPath), map.size)\r\n iterateOnAny(subPath, subConf, map)\r\n }\r\n }\r\n}\r\n\r\n// function iterateOnEnum(\r\n// path: string[],\r\n// config: PropTypeConfig_Enum,\r\n// map: Mapping,\r\n// ) {\r\n// for (const [key, subConf] of Object.entries(config.cases)) {\r\n// const subPath = [...path, key]\r\n// map.set(JSON.stringify(subPath), map.size)\r\n// iterateOnAny(subPath, subConf, map)\r\n// }\r\n// }\r\n\r\nfunction iterateOnAny(path: string[], config: PropTypeConfig, map: Mapping) {\r\n if (config.type === 'compound') {\r\n iterateOnCompound(path, config, map)\r\n } else if (config.type === 'enum') {\r\n throw new Error(`Enums aren't supported yet`)\r\n } else {\r\n map.set(JSON.stringify(path), map.size)\r\n }\r\n}\r\n", "import type Project from '@encorejs/core/projects/Project'\r\nimport SheetObjectTemplate from '@encorejs/core/sheetObjects/SheetObjectTemplate'\r\nimport type {\r\n SheetAddress,\r\n WithoutSheetInstance,\r\n} from '@encorejs/core/types/public'\r\nimport {Atom} from '@encorejs/dataverse'\r\nimport type {Pointer} from '@encorejs/dataverse'\r\nimport Sheet from './Sheet'\r\nimport type {ObjectNativeObject} from './Sheet'\r\n\r\nimport type {\r\n ObjectAddressKey,\r\n SheetId,\r\n SheetInstanceId,\r\n} from '@encorejs/core/types/public'\r\nimport type {StrictRecord} from '@encorejs/core/types/public'\r\nimport type {\r\n SheetObjectActionsConfig,\r\n SheetObjectPropTypeConfig,\r\n} from '@encorejs/core/types/public'\r\n\r\ntype SheetTemplateObjectTemplateMap = StrictRecord<\r\n ObjectAddressKey,\r\n SheetObjectTemplate\r\n>\r\n\r\nexport default class SheetTemplate {\r\n readonly type: 'Theatre_SheetTemplate' = 'Theatre_SheetTemplate'\r\n readonly address: WithoutSheetInstance<SheetAddress>\r\n private _instances = new Atom<Record<SheetInstanceId, Sheet>>({})\r\n readonly instancesP: Pointer<Record<SheetInstanceId, Sheet>> =\r\n this._instances.pointer\r\n\r\n private _objectTemplates = new Atom<SheetTemplateObjectTemplateMap>({})\r\n readonly objectTemplatesP = this._objectTemplates.pointer\r\n\r\n constructor(\r\n readonly project: Project,\r\n sheetId: SheetId,\r\n ) {\r\n this.address = {...project.address, sheetId}\r\n }\r\n\r\n getInstance(instanceId: SheetInstanceId): Sheet {\r\n let inst = this._instances.get()[instanceId]\r\n\r\n if (!inst) {\r\n inst = new Sheet(this, instanceId)\r\n this._instances.setByPointer((p) => p[instanceId], inst)\r\n }\r\n\r\n return inst\r\n }\r\n\r\n getObjectTemplate(\r\n objectKey: ObjectAddressKey,\r\n nativeObject: ObjectNativeObject,\r\n config: SheetObjectPropTypeConfig,\r\n actions: SheetObjectActionsConfig,\r\n ): SheetObjectTemplate {\r\n let template = this._objectTemplates.get()[objectKey]\r\n\r\n if (!template) {\r\n template = new SheetObjectTemplate(\r\n this,\r\n objectKey,\r\n nativeObject,\r\n config,\r\n actions,\r\n )\r\n this._objectTemplates.setByPointer((p) => p[objectKey], template)\r\n }\r\n\r\n return template\r\n }\r\n}\r\n", "import memoizeFn from '@encorejs/utils/memoizeFn'\r\nimport type {Nominal} from '@encorejs/utils/Nominal'\r\n\r\n/**\r\n * This is a simple array representing the path to a prop, without specifying the object.\r\n */\r\nexport type PathToProp = Array<string | number>\r\n\r\n/**\r\n * Just like {@link PathToProp}, but encoded as a string. Since this type is nominal,\r\n * it can only be generated using {@link encodePathToProp}.\r\n */\r\nexport type PathToProp_Encoded = Nominal<'PathToProp_Encoded'>\r\n\r\n/**\r\n * Encodes a {@link PathToProp} as a string, and caches the result, so as long\r\n * as the input is the same, the output won't have to be re-generated.\r\n */\r\nexport const encodePathToProp = memoizeFn(\r\n (p: PathToProp): PathToProp_Encoded =>\r\n // we're using JSON.stringify here, but we could use a faster alternative.\r\n // If you happen to do that, first make sure no `PathToProp_Encoded` is ever\r\n // used in the store, otherwise you'll have to write a migration.\r\n JSON.stringify(p) as PathToProp_Encoded,\r\n)\r\n\r\n/**\r\n * The decoder of {@link encodePathToProp}.\r\n */\r\nexport const decodePathToProp = (s: PathToProp_Encoded): PathToProp =>\r\n JSON.parse(s)\r\n\r\n/**\r\n * Returns true if `path` starts with `pathPrefix`.\r\n *\r\n * Example:\r\n * ```ts\r\n * const prefix: PathToProp = ['a', 'b']\r\n * console.log(doesPathStartWith(['a', 'b', 'c'], prefix)) // true\r\n * console.log(doesPathStartWith(['x', 'b', 'c'], prefix)) // false\r\n * ```\r\n */\r\nexport function doesPathStartWith(path: PathToProp, pathPrefix: PathToProp) {\r\n return pathPrefix.every((pathPart, i) => pathPart === path[i])\r\n}\r\n\r\n/**\r\n * Returns true if pathToPropA and pathToPropB are equal.\r\n */\r\nexport function arePathsEqual(\r\n pathToPropA: PathToProp,\r\n pathToPropB: PathToProp,\r\n) {\r\n if (pathToPropA.length !== pathToPropB.length) return false\r\n for (let i = 0; i < pathToPropA.length; i++) {\r\n if (pathToPropA[i] !== pathToPropB[i]) return false\r\n }\r\n return true\r\n}\r\n\r\n/**\r\n * Given an array of `PathToProp`s, returns the longest common prefix.\r\n *\r\n * Example\r\n * ```\r\n * commonRootOfPathsToProps([\r\n * ['a','b','c','d','e'],\r\n * ['a','b','x','y','z'],\r\n * ['a','b','c']\r\n * ]) // = ['a','b']\r\n * ```\r\n */\r\nexport function commonRootOfPathsToProps(pathsToProps: PathToProp[]) {\r\n const commonPathToProp: PathToProp = []\r\n while (true) {\r\n const i = commonPathToProp.length\r\n let candidatePathPart = pathsToProps[0]?.[i]\r\n if (candidatePathPart === undefined) return commonPathToProp\r\n\r\n for (const pathToProp of pathsToProps) {\r\n if (candidatePathPart !== pathToProp[i]) {\r\n return commonPathToProp\r\n }\r\n }\r\n\r\n commonPathToProp.push(candidatePathPart)\r\n }\r\n}\r\n", "import propose from 'propose'\r\n\r\n/**\r\n * Proposes a suggestion to fix a typo in `str`, using the options provided in `dictionary`.\r\n *\r\n * Example:\r\n * ```ts\r\n * didYouMean('helo', ['hello', 'world']) // 'Did you mean \"hello\"?'\r\n * ```\r\n */\r\nexport default function didYouMean(\r\n str: string,\r\n dictionary: string[],\r\n prepend: string = 'Did you mean ',\r\n append: string = '?',\r\n): string {\r\n const p = propose(str, dictionary, {\r\n threshold: 0.7,\r\n })\r\n\r\n if (p) {\r\n return prepend + JSON.stringify(p) + append\r\n } else {\r\n return ''\r\n }\r\n}\r\n", "/**\r\n * All errors thrown to end-users should be an instance of this class.\r\n */\r\nexport class TheatreError extends Error {}\r\n\r\n/**\r\n * If an end-user provided an invalid argument to a public API, the error thrown\r\n * should be an instance of this class.\r\n */\r\nexport class InvalidArgumentError extends TheatreError {}\r\n", "import type Project from '@encorejs/core/projects/Project'\r\nimport type Sheet from '@encorejs/core/sheets/Sheet'\r\nimport {encodePathToProp} from '@encorejs/utils/pathToProp'\r\nimport type {BasicKeyframe, SequenceAddress} from '@encorejs/core/types/public'\r\nimport didYouMean from '@encorejs/utils/didYouMean'\r\nimport {InvalidArgumentError} from '@encorejs/utils/errors'\r\nimport type {\r\n Prism,\r\n Pointer,\r\n Ticker,\r\n PointerToPrismProvider,\r\n} from '@encorejs/dataverse'\r\nimport {getPointerParts} from '@encorejs/dataverse'\r\nimport {Atom} from '@encorejs/dataverse'\r\nimport {pointer} from '@encorejs/dataverse'\r\nimport {prism, val} from '@encorejs/dataverse'\r\nimport {padStart} from 'lodash-es'\r\nimport type {\r\n IPlaybackController,\r\n IPlaybackState,\r\n} from './playbackControllers/DefaultPlaybackController'\r\nimport DefaultPlaybackController from './playbackControllers/DefaultPlaybackController'\r\nimport TheatreSequence from './TheatreSequence'\r\n\r\nimport type {\r\n IPlaybackDirection,\r\n IPlaybackRange,\r\n ISequence,\r\n} from '@encorejs/core/types/public'\r\nimport {notify} from '@encorejs/core/utils/notify'\r\nimport type {$IntentionalAny} from '@encorejs/dataverse/src/types'\r\nimport {isSheetObject} from '@encorejs/core/utils/instanceTypes'\r\nimport {getSortedKeyframesCached} from '@encorejs/core/utils/keyframeUtils'\r\n\r\nconst possibleDirections = [\r\n 'normal',\r\n 'reverse',\r\n 'alternate',\r\n 'alternateReverse',\r\n]\r\n\r\nexport default class Sequence implements PointerToPrismProvider {\r\n public readonly address: SequenceAddress\r\n publicApi: ISequence\r\n\r\n private _playbackControllerBox: Atom<IPlaybackController>\r\n private _prismOfStatePointer: Prism<Pointer<IPlaybackState>>\r\n private _positionD: Prism<number>\r\n private _positionFormatterD: Prism<ISequencePositionFormatter>\r\n _playableRangeD: undefined | Prism<{start: number; end: number}>\r\n\r\n readonly pointer: ISequence['pointer'] = pointer({root: this, path: []})\r\n readonly $$isPointerToPrismProvider = true\r\n\r\n constructor(\r\n readonly _project: Project,\r\n readonly _sheet: Sheet,\r\n readonly _lengthD: Prism<number>,\r\n readonly _subUnitsPerUnitD: Prism<number>,\r\n playbackController?: IPlaybackController,\r\n ) {\r\n this.address = {...this._sheet.address, sequenceName: 'default'}\r\n\r\n this.publicApi = new TheatreSequence(this)\r\n\r\n this._playbackControllerBox = new Atom(\r\n playbackController ?? new DefaultPlaybackController(),\r\n )\r\n\r\n this._prismOfStatePointer = prism(\r\n () => this._playbackControllerBox.prism.getValue().statePointer,\r\n )\r\n\r\n this._positionD = prism(() => {\r\n const statePointer = this._prismOfStatePointer.getValue()\r\n return val(statePointer.position)\r\n })\r\n\r\n this._positionFormatterD = prism(() => {\r\n const subUnitsPerUnit = val(this._subUnitsPerUnitD)\r\n return new TimeBasedPositionFormatter(subUnitsPerUnit)\r\n })\r\n }\r\n\r\n pointerToPrism<V>(pointer: Pointer<V>): Prism<V> {\r\n const {path} = getPointerParts(pointer)\r\n if (path.length === 0) {\r\n return prism((): ISequence['pointer']['$$__pointer_type'] => ({\r\n length: val(this.pointer.length),\r\n playing: val(this.pointer.playing),\r\n position: val(this.pointer.position),\r\n })) as $IntentionalAny as Prism<V>\r\n }\r\n if (path.length > 1) {\r\n return prism(() => undefined) as $IntentionalAny as Prism<V>\r\n }\r\n const [prop] = path\r\n if (prop === 'length') {\r\n return this._lengthD as $IntentionalAny as Prism<V>\r\n } else if (prop === 'position') {\r\n return this._positionD as $IntentionalAny as Prism<V>\r\n } else if (prop === 'playing') {\r\n return prism(() => {\r\n return val(this._prismOfStatePointer.getValue().playing)\r\n }) as $IntentionalAny as Prism<V>\r\n } else {\r\n return prism(() => undefined) as $IntentionalAny as Prism<V>\r\n }\r\n }\r\n\r\n /**\r\n * Takes a pointer to a property of a SheetObject and returns the keyframes of that property.\r\n *\r\n * Theoretically, this method can be called from inside a prism so it can be reactive.\r\n */\r\n getKeyframesOfSimpleProp<V>(prop: Pointer<any>): BasicKeyframe[] {\r\n const {path, root} = getPointerParts(prop)\r\n\r\n if (!isSheetObject(root)) {\r\n throw new InvalidArgumentError(\r\n 'Argument prop must be a pointer to a SheetObject property',\r\n )\r\n }\r\n\r\n const trackP = val(\r\n this._project.pointers.historic.sheetsById[this._sheet.address.sheetId]\r\n .sequence.tracksByObject[root.address.objectKey],\r\n )\r\n\r\n if (!trackP) {\r\n return []\r\n }\r\n\r\n const {trackData, trackIdByPropPath} = trackP\r\n const objectAddress = encodePathToProp(path)\r\n const id = trackIdByPropPath[objectAddress]\r\n\r\n if (!id) {\r\n return []\r\n }\r\n\r\n const track = trackData[id]\r\n\r\n if (!track) {\r\n return []\r\n }\r\n\r\n return getSortedKeyframesCached(track.keyframes)\r\n }\r\n\r\n get positionFormatter(): ISequencePositionFormatter {\r\n return this._positionFormatterD.getValue()\r\n }\r\n\r\n get prismOfStatePointer() {\r\n return this._prismOfStatePointer\r\n }\r\n\r\n get length() {\r\n return this._lengthD.getValue()\r\n }\r\n\r\n get positionPrism() {\r\n return this._positionD\r\n }\r\n\r\n get position() {\r\n return this._playbackControllerBox.get().getCurrentPosition()\r\n }\r\n\r\n get subUnitsPerUnit(): number {\r\n return this._subUnitsPerUnitD.getValue()\r\n }\r\n\r\n get positionSnappedToGrid(): number {\r\n return this.closestGridPosition(this.position)\r\n }\r\n\r\n closestGridPosition = (posInUnitSpace: number): number => {\r\n const subUnitsPerUnit = this.subUnitsPerUnit\r\n const gridLength = 1 / subUnitsPerUnit\r\n\r\n return parseFloat(\r\n (Math.round(posInUnitSpace / gridLength) * gridLength).toFixed(3),\r\n )\r\n }\r\n\r\n set position(requestedPosition: number) {\r\n let position = requestedPosition\r\n this.pause()\r\n if (process.env.NODE_ENV !== 'production') {\r\n if (typeof position !== 'number') {\r\n console.error(\r\n `value t in sequence.position = t must be a number. ${typeof position} given`,\r\n )\r\n position = 0\r\n }\r\n if (position < 0) {\r\n console.error(\r\n `sequence.position must be a positive number. ${position} given`,\r\n )\r\n position = 0\r\n }\r\n }\r\n if (position > this.length) {\r\n position = this.length\r\n }\r\n const dur = this.length\r\n this._playbackControllerBox\r\n .get()\r\n .gotoPosition(position > dur ? dur : position)\r\n }\r\n\r\n getDurationCold() {\r\n return this._lengthD.getValue()\r\n }\r\n\r\n get playing() {\r\n return val(this._playbackControllerBox.get().statePointer.playing)\r\n }\r\n\r\n _makeRangeFromSequenceTemplate(): Prism<IPlaybackRange> {\r\n return prism(() => {\r\n return [0, val(this._lengthD)]\r\n })\r\n }\r\n\r\n /**\r\n * Controls the playback within a range. Repeats infinitely unless stopped.\r\n *\r\n * @remarks\r\n * One use case for this is to play the playback within the focus range.\r\n *\r\n * @param rangeD - The prism that contains the range that will be used for the playback\r\n *\r\n * @returns a promise that resolves (with `false`) when the playback stops for whatever reason\r\n *\r\n */\r\n playDynamicRange(\r\n rangeD: Prism<IPlaybackRange>,\r\n ticker: Ticker,\r\n ): Promise<unknown> {\r\n return this._playbackControllerBox.get().playDynamicRange(rangeD, ticker)\r\n }\r\n\r\n async play(\r\n conf: Partial<{\r\n iterationCount: number\r\n range: IPlaybackRange\r\n rate: number\r\n direction: IPlaybackDirection\r\n }>,\r\n ticker: Ticker,\r\n ): Promise<boolean> {\r\n const sequenceDuration = this.length\r\n const range: IPlaybackRange =\r\n conf && conf.range ? conf.range : [0, sequenceDuration]\r\n\r\n if (process.env.NODE_ENV !== 'production') {\r\n if (typeof range[0] !== 'number' || range[0] < 0) {\r\n throw new InvalidArgumentError(\r\n `Argument conf.range[0] in sequence.play(conf) must be a positive number. ${JSON.stringify(\r\n range[0],\r\n )} given.`,\r\n )\r\n }\r\n if (range[0] >= sequenceDuration) {\r\n throw new InvalidArgumentError(\r\n `Argument conf.range[0] in sequence.play(conf) cannot be longer than the duration of the sequence, which is ${sequenceDuration}s. ${JSON.stringify(\r\n range[0],\r\n )} given.`,\r\n )\r\n }\r\n if (typeof range[1] !== 'number' || range[1] <= 0) {\r\n throw new InvalidArgumentError(\r\n `Argument conf.range[1] in sequence.play(conf) must be a number larger than zero. ${JSON.stringify(\r\n range[1],\r\n )} given.`,\r\n )\r\n }\r\n\r\n if (range[1] > sequenceDuration) {\r\n notify.warning(\r\n \"Couldn't play sequence in given range\",\r\n `Your animation will still play until the end of the sequence, however the argument \\`conf.range[1]\\` given in \\`sequence.play(conf)\\` (${JSON.stringify(\r\n range[1],\r\n )}s) is longer than the duration of the sequence (${sequenceDuration}s).\r\n\r\nTo fix this, either set \\`conf.range[1]\\` to be less the duration of the sequence, or adjust the sequence duration in the UI.`,\r\n [\r\n {\r\n url: 'https://www.theatrejs.com/docs/latest/manual/sequences',\r\n title: 'Sequences',\r\n },\r\n {\r\n url: 'https://www.theatrejs.com/docs/latest/manual/sequences',\r\n title: 'Playback API',\r\n },\r\n ],\r\n )\r\n range[1] = sequenceDuration\r\n }\r\n\r\n if (range[1] <= range[0]) {\r\n throw new InvalidArgumentError(\r\n `Argument conf.range[1] in sequence.play(conf) must be larger than conf.range[0]. ${JSON.stringify(\r\n range,\r\n )} given.`,\r\n )\r\n }\r\n }\r\n\r\n const iterationCount =\r\n conf && typeof conf.iterationCount === 'number' ? conf.iterationCount : 1\r\n if (process.env.NODE_ENV !== 'production') {\r\n if (\r\n !(Number.isInteger(iterationCount) && iterationCount > 0) &&\r\n iterationCount !== Infinity\r\n ) {\r\n throw new InvalidArgumentError(\r\n `Argument conf.iterationCount in sequence.play(conf) must be an integer larger than 0. ${JSON.stringify(\r\n iterationCount,\r\n )} given.`,\r\n )\r\n }\r\n }\r\n\r\n const rate = conf && typeof conf.rate !== 'undefined' ? conf.rate : 1\r\n\r\n if (process.env.NODE_ENV !== 'production') {\r\n if (typeof rate !== 'number' || rate === 0) {\r\n throw new InvalidArgumentError(\r\n `Argument conf.rate in sequence.play(conf) must be a number larger than 0. ${JSON.stringify(\r\n rate,\r\n )} given.`,\r\n )\r\n }\r\n\r\n if (rate < 0) {\r\n throw new InvalidArgumentError(\r\n `Argument conf.rate in sequence.play(conf) must be a number larger than 0. ${JSON.stringify(\r\n rate,\r\n )} given. If you want the animation to play backwards, try setting conf.direction to 'reverse' or 'alternateReverse'.`,\r\n )\r\n }\r\n }\r\n\r\n const direction = conf && conf.direction ? conf.direction : 'normal'\r\n\r\n if (process.env.NODE_ENV !== 'production') {\r\n if (possibleDirections.indexOf(direction) === -1) {\r\n throw new InvalidArgumentError(\r\n `Argument conf.direction in sequence.play(conf) must be one of ${JSON.stringify(\r\n possibleDirections,\r\n )}. ${JSON.stringify(direction)} given. ${didYouMean(\r\n direction,\r\n possibleDirections,\r\n )}`,\r\n )\r\n }\r\n }\r\n\r\n return await this._play(\r\n iterationCount,\r\n [range[0], range[1]],\r\n rate,\r\n direction,\r\n ticker,\r\n )\r\n }\r\n\r\n protected _play(\r\n iterationCount: number,\r\n range: IPlaybackRange,\r\n rate: number,\r\n direction: IPlaybackDirection,\r\n ticker: Ticker,\r\n ): Promise<boolean> {\r\n return this._playbackControllerBox\r\n .get()\r\n .play(iterationCount, range, rate, direction, ticker)\r\n }\r\n\r\n pause() {\r\n this._playbackControllerBox.get().pause()\r\n }\r\n\r\n replacePlaybackController(playbackController: IPlaybackController) {\r\n this.pause()\r\n const oldController = this._playbackControllerBox.get()\r\n this._playbackControllerBox.set(playbackController)\r\n\r\n const time = oldController.getCurrentPosition()\r\n oldController.destroy()\r\n playbackController.gotoPosition(time)\r\n }\r\n}\r\n\r\nexport interface ISequencePositionFormatter {\r\n formatSubUnitForGrid(posInUnitSpace: number): string\r\n formatFullUnitForGrid(posInUnitSpace: number): string\r\n formatForPlayhead(posInUnitSpace: number): string\r\n formatBasic(posInUnitSpace: number): string\r\n}\r\n\r\nclass TimeBasedPositionFormatter implements ISequencePositionFormatter {\r\n constructor(private readonly _fps: number) {}\r\n formatSubUnitForGrid(posInUnitSpace: number): string {\r\n const subSecondPos = posInUnitSpace % 1\r\n const frame = 1 / this._fps\r\n\r\n const frames = Math.round(subSecondPos / frame)\r\n return frames + 'f'\r\n }\r\n\r\n formatFullUnitForGrid(posInUnitSpace: number): string {\r\n let p = posInUnitSpace\r\n\r\n let s = ''\r\n\r\n if (p >= hour) {\r\n const hours = Math.floor(p / hour)\r\n s += hours + 'h'\r\n p = p % hour\r\n }\r\n\r\n if (p >= minute) {\r\n const minutes = Math.floor(p / minute)\r\n s += minutes + 'm'\r\n p = p % minute\r\n }\r\n\r\n if (p >= second) {\r\n const seconds = Math.floor(p / second)\r\n s += seconds + 's'\r\n p = p % second\r\n }\r\n\r\n const frame = 1 / this._fps\r\n\r\n if (p >= frame) {\r\n const frames = Math.floor(p / frame)\r\n s += frames + 'f'\r\n p = p % frame\r\n }\r\n\r\n return s.length === 0 ? '0s' : s\r\n }\r\n\r\n formatForPlayhead(posInUnitSpace: number): string {\r\n let p = posInUnitSpace\r\n\r\n let s = ''\r\n\r\n if (p >= hour) {\r\n const hours = Math.floor(p / hour)\r\n s += padStart(hours.toString(), 2, '0') + 'h'\r\n p = p % hour\r\n }\r\n\r\n if (p >= minute) {\r\n const minutes = Math.floor(p / minute)\r\n s += padStart(minutes.toString(), 2, '0') + 'm'\r\n p = p % minute\r\n } else if (s.length > 0) {\r\n s += '00m'\r\n }\r\n\r\n if (p >= second) {\r\n const seconds = Math.floor(p / second)\r\n s += padStart(seconds.toString(), 2, '0') + 's'\r\n p = p % second\r\n } else {\r\n s += '00s'\r\n }\r\n\r\n const frameLength = 1 / this._fps\r\n\r\n if (p >= frameLength) {\r\n const frames = Math.round(p / frameLength)\r\n s += padStart(frames.toString(), 2, '0') + 'f'\r\n p = p % frameLength\r\n } else if (p / frameLength > 0.98) {\r\n const frames = 1\r\n s += padStart(frames.toString(), 2, '0') + 'f'\r\n p = p % frameLength\r\n } else {\r\n s += '00f'\r\n }\r\n\r\n return s.length === 0 ? '00s00f' : s\r\n }\r\n\r\n formatBasic(posInUnitSpace: number): string {\r\n return posInUnitSpace.toFixed(2) + 's'\r\n }\r\n}\r\n\r\nconst second = 1\r\nconst minute = second * 60\r\nconst hour = minute * 60\r\n", "export interface Deferred<PromiseType> {\r\n resolve: (d: PromiseType) => void\r\n reject: (d: unknown) => void\r\n promise: Promise<PromiseType>\r\n status: 'pending' | 'resolved' | 'rejected'\r\n currentValue: PromiseType | undefined\r\n}\r\n\r\n/**\r\n * A simple imperative API for resolving/rejecting a promise.\r\n *\r\n * Example:\r\n * ```ts\r\n * function doSomethingAsync() {\r\n * const deferred = defer()\r\n *\r\n * setTimeout(() => {\r\n * if (Math.random() > 0.5) {\r\n * deferred.resolve('success')\r\n * } else {\r\n * deferred.reject('Something went wrong')\r\n * }\r\n * }, 1000)\r\n *\r\n * // we're just returning the promise, so that the caller cannot resolve/reject it\r\n * return deferred.promise\r\n * }\r\n *\r\n * ```\r\n */\r\nexport function defer<PromiseType>(): Deferred<PromiseType> {\r\n let resolve: (d: PromiseType) => void\r\n let reject: (d: unknown) => void\r\n const promise = new Promise<PromiseType>((rs, rj) => {\r\n resolve = (v) => {\r\n rs(v)\r\n deferred.status = 'resolved'\r\n deferred.currentValue = v\r\n }\r\n reject = (v) => {\r\n rj(v)\r\n deferred.status = 'rejected'\r\n }\r\n })\r\n\r\n const deferred: Deferred<PromiseType> = {\r\n resolve: resolve!,\r\n reject: reject!,\r\n promise,\r\n status: 'pending',\r\n currentValue: undefined,\r\n }\r\n return deferred\r\n}\r\n", "/**\r\n * Just an empty function\r\n */\r\nconst noop = () => {}\r\n\r\nexport default noop\r\n", "import {defer} from '@encorejs/utils/defer'\r\nimport noop from '@encorejs/utils/noop'\r\nimport type {Prism, Pointer, Ticker} from '@encorejs/dataverse'\r\nimport {Atom} from '@encorejs/dataverse'\r\nimport type {\r\n IPlaybackDirection,\r\n IPlaybackRange,\r\n} from '@encorejs/core/types/public'\r\n\r\nexport interface IPlaybackState {\r\n position: number\r\n playing: boolean\r\n}\r\n\r\nexport interface IPlaybackController {\r\n getCurrentPosition(): number\r\n gotoPosition(position: number): void\r\n readonly statePointer: Pointer<IPlaybackState>\r\n destroy(): void\r\n\r\n play(\r\n iterationCount: number,\r\n range: IPlaybackRange,\r\n rate: number,\r\n direction: IPlaybackDirection,\r\n ticker: Ticker,\r\n ): Promise<boolean>\r\n\r\n /**\r\n * Controls the playback within a range. Repeats infinitely unless stopped.\r\n *\r\n * @remarks\r\n * One use case for this is to play the playback within the focus range.\r\n *\r\n * @param rangeD - The prism that contains the range that will be used for the playback\r\n *\r\n * @returns a promise that resolves (with `false`) when the playback stops for whatever reason\r\n *\r\n */\r\n playDynamicRange(\r\n rangeD: Prism<IPlaybackRange>,\r\n ticker: Ticker,\r\n ): Promise<unknown>\r\n\r\n pause(): void\r\n}\r\n\r\nexport default class DefaultPlaybackController implements IPlaybackController {\r\n _stopPlayCallback: () => void = noop\r\n private _state: Atom<IPlaybackState> = new Atom<IPlaybackState>({\r\n position: 0,\r\n playing: false,\r\n })\r\n readonly statePointer: Pointer<IPlaybackState>\r\n\r\n constructor() {\r\n this.statePointer = this._state.pointer\r\n }\r\n\r\n destroy() {}\r\n\r\n pause() {\r\n this._stopPlayCallback()\r\n this.playing = false\r\n this._stopPlayCallback = noop\r\n }\r\n\r\n gotoPosition(time: number) {\r\n this._updatePositionInState(time)\r\n }\r\n\r\n private _updatePositionInState(time: number) {\r\n this._state.setByPointer((p) => p.position, time)\r\n }\r\n\r\n getCurrentPosition() {\r\n return this._state.get().position\r\n }\r\n\r\n get playing() {\r\n return this._state.get().playing\r\n }\r\n\r\n set playing(playing: boolean) {\r\n this._state.setByPointer((p) => p.playing, playing)\r\n }\r\n\r\n play(\r\n iterationCount: number,\r\n range: IPlaybackRange,\r\n rate: number,\r\n direction: IPlaybackDirection,\r\n ticker: Ticker,\r\n ): Promise<boolean> {\r\n if (this.playing) {\r\n this.pause()\r\n }\r\n\r\n this.playing = true\r\n\r\n const iterationLength = range[1] - range[0]\r\n\r\n {\r\n const startPos = this.getCurrentPosition()\r\n\r\n if (startPos < range[0] || startPos > range[1]) {\r\n if (direction === 'normal' || direction === 'alternate') {\r\n this._updatePositionInState(range[0])\r\n } else if (\r\n direction === 'reverse' ||\r\n direction === 'alternateReverse'\r\n ) {\r\n this._updatePositionInState(range[1])\r\n }\r\n } else if (direction === 'normal' || direction === 'alternate') {\r\n if (startPos === range[1]) {\r\n this._updatePositionInState(range[0])\r\n }\r\n } else {\r\n if (startPos === range[0]) {\r\n this._updatePositionInState(range[1])\r\n }\r\n }\r\n }\r\n\r\n const deferred = defer<boolean>()\r\n const initialTickerTime = ticker.time\r\n const totalPlaybackLength = iterationLength * iterationCount\r\n\r\n let initialElapsedPos = this.getCurrentPosition() - range[0]\r\n\r\n if (direction === 'reverse' || direction === 'alternateReverse') {\r\n initialElapsedPos = range[1] - this.getCurrentPosition()\r\n }\r\n\r\n const tick = (currentTickerTime: number) => {\r\n const elapsedTickerTime = Math.max(\r\n currentTickerTime - initialTickerTime,\r\n 0,\r\n )\r\n const elapsedTickerTimeInSeconds = elapsedTickerTime / 1000\r\n\r\n const elapsedPos = Math.min(\r\n elapsedTickerTimeInSeconds * rate + initialElapsedPos,\r\n totalPlaybackLength,\r\n )\r\n\r\n if (elapsedPos !== totalPlaybackLength) {\r\n const iterationNumber = Math.floor(elapsedPos / iterationLength)\r\n\r\n let currentIterationPos =\r\n ((elapsedPos / iterationLength) % 1) * iterationLength\r\n\r\n if (direction !== 'normal') {\r\n if (direction === 'reverse') {\r\n currentIterationPos = iterationLength - currentIterationPos\r\n } else {\r\n const isCurrentIterationNumberEven = iterationNumber % 2 === 0\r\n if (direction === 'alternate') {\r\n if (!isCurrentIterationNumberEven) {\r\n currentIterationPos = iterationLength - currentIterationPos\r\n }\r\n } else {\r\n if (isCurrentIterationNumberEven) {\r\n currentIterationPos = iterationLength - currentIterationPos\r\n }\r\n }\r\n }\r\n }\r\n\r\n this._updatePositionInState(currentIterationPos + range[0])\r\n requestNextTick()\r\n } else {\r\n if (direction === 'normal') {\r\n this._updatePositionInState(range[1])\r\n } else if (direction === 'reverse') {\r\n this._updatePositionInState(range[0])\r\n } else {\r\n const isLastIterationEven = (iterationCount - 1) % 2 === 0\r\n if (direction === 'alternate') {\r\n if (isLastIterationEven) {\r\n this._updatePositionInState(range[1])\r\n } else {\r\n this._updatePositionInState(range[0])\r\n }\r\n } else {\r\n if (isLastIterationEven) {\r\n this._updatePositionInState(range[0])\r\n } else {\r\n this._updatePositionInState(range[1])\r\n }\r\n }\r\n }\r\n this.playing = false\r\n deferred.resolve(true)\r\n }\r\n }\r\n\r\n this._stopPlayCallback = () => {\r\n ticker.offThisOrNextTick(tick)\r\n ticker.offNextTick(tick)\r\n\r\n if (this.playing) deferred.resolve(false)\r\n }\r\n const requestNextTick = () => ticker.onNextTick(tick)\r\n ticker.onThisOrNextTick(tick)\r\n return deferred.promise\r\n }\r\n\r\n playDynamicRange(\r\n rangeD: Prism<IPlaybackRange>,\r\n ticker: Ticker,\r\n ): Promise<unknown> {\r\n if (this.playing) {\r\n this.pause()\r\n }\r\n\r\n this.playing = true\r\n\r\n const deferred = defer<boolean>()\r\n\r\n // We're keeping the rangeD hot, so we can read from it on every tick without\r\n // causing unnecessary recalculations\r\n const untapFromRangeD = rangeD.keepHot()\r\n // We'll release our subscription once this promise resolves/rejects, for whatever reason\r\n void deferred.promise.then(untapFromRangeD, untapFromRangeD)\r\n\r\n let lastTickerTime = ticker.time\r\n\r\n const tick = (currentTickerTime: number) => {\r\n const elapsedSinceLastTick = Math.max(\r\n currentTickerTime - lastTickerTime,\r\n 0,\r\n )\r\n lastTickerTime = currentTickerTime\r\n const elapsedSinceLastTickInSeconds = elapsedSinceLastTick / 1000\r\n\r\n const lastPosition = this.getCurrentPosition()\r\n\r\n const range = rangeD.getValue()\r\n\r\n if (lastPosition < range[0] || lastPosition > range[1]) {\r\n this.gotoPosition(range[0])\r\n } else {\r\n let newPosition = lastPosition + elapsedSinceLastTickInSeconds\r\n if (newPosition > range[1]) {\r\n const iterationLength = range[1] - range[0]\r\n // Use modulo rather than a single subtraction so a long frame (tab\r\n // throttling, debugger pause) that advances past several iterations\r\n // still wraps back inside the loop range.\r\n newPosition =\r\n iterationLength > 0\r\n ? range[0] + ((newPosition - range[0]) % iterationLength)\r\n : range[0]\r\n }\r\n this.gotoPosition(newPosition)\r\n }\r\n\r\n requestNextTick()\r\n }\r\n\r\n this._stopPlayCallback = () => {\r\n ticker.offThisOrNextTick(tick)\r\n ticker.offNextTick(tick)\r\n\r\n deferred.resolve(false)\r\n }\r\n const requestNextTick = () => ticker.onNextTick(tick)\r\n ticker.onThisOrNextTick(tick)\r\n return deferred.promise\r\n }\r\n}\r\n", "import {defer} from '@encorejs/utils/defer'\r\nimport {InvalidArgumentError} from '@encorejs/utils/errors'\r\nimport noop from '@encorejs/utils/noop'\r\nimport type {Prism, Pointer, Ticker} from '@encorejs/dataverse'\r\nimport {Atom} from '@encorejs/dataverse'\r\nimport type {\r\n IPlaybackController,\r\n IPlaybackState,\r\n} from './DefaultPlaybackController'\r\nimport {notify} from '@encorejs/core/utils/notify'\r\nimport type {\r\n IPlaybackDirection,\r\n IPlaybackRange,\r\n} from '@encorejs/core/types/public'\r\n\r\nexport default class AudioPlaybackController implements IPlaybackController {\r\n _mainGain: GainNode\r\n private _state: Atom<IPlaybackState> = new Atom<IPlaybackState>({\r\n position: 0,\r\n playing: false,\r\n })\r\n readonly statePointer: Pointer<IPlaybackState>\r\n _stopPlayCallback: () => void = noop\r\n\r\n constructor(\r\n private readonly _decodedBuffer: AudioBuffer,\r\n private readonly _audioContext: AudioContext,\r\n private readonly _nodeDestination: AudioNode,\r\n ) {\r\n this.statePointer = this._state.pointer\r\n\r\n this._mainGain = this._audioContext.createGain()\r\n this._mainGain.connect(this._nodeDestination)\r\n }\r\n\r\n playDynamicRange(\r\n rangeD: Prism<IPlaybackRange>,\r\n ticker: Ticker,\r\n ): Promise<unknown> {\r\n const deferred = defer<boolean>()\r\n if (this._playing) this.pause()\r\n\r\n this._playing = true\r\n\r\n let stop: undefined | (() => void) = undefined\r\n\r\n const play = () => {\r\n stop?.()\r\n stop = this._loopInRange(rangeD.getValue(), ticker).stop\r\n }\r\n\r\n // We're keeping the rangeD hot, so we can read from it on every tick without\r\n // causing unnecessary recalculations\r\n const untapFromRangeD = rangeD.onStale(play)\r\n play()\r\n\r\n this._stopPlayCallback = () => {\r\n stop?.()\r\n untapFromRangeD()\r\n deferred.resolve(false)\r\n }\r\n\r\n return deferred.promise\r\n }\r\n\r\n private _loopInRange(\r\n range: IPlaybackRange,\r\n ticker: Ticker,\r\n ): {stop: () => void} {\r\n const rate = 1\r\n let startPos = this.getCurrentPosition()\r\n const iterationLength = range[1] - range[0]\r\n\r\n if (startPos < range[0] || startPos > range[1]) {\r\n // if we're currently out of the range\r\n this._updatePositionInState(range[0])\r\n } else if (startPos === range[1]) {\r\n // if we're currently at the very end of the range\r\n this._updatePositionInState(range[0])\r\n }\r\n startPos = this.getCurrentPosition()\r\n\r\n const currentSource = this._audioContext.createBufferSource()\r\n currentSource.buffer = this._decodedBuffer\r\n currentSource.connect(this._mainGain)\r\n currentSource.playbackRate.value = rate\r\n\r\n currentSource.loop = true\r\n currentSource.loopStart = range[0]\r\n currentSource.loopEnd = range[1]\r\n\r\n const initialTickerTime = ticker.time\r\n let initialElapsedPos = startPos - range[0]\r\n\r\n currentSource.start(0, startPos)\r\n\r\n const tick = (currentTickerTime: number) => {\r\n const elapsedTickerTime = Math.max(\r\n currentTickerTime - initialTickerTime,\r\n 0,\r\n )\r\n const elapsedTickerTimeInSeconds = elapsedTickerTime / 1000\r\n\r\n const elapsedPos = elapsedTickerTimeInSeconds * rate + initialElapsedPos\r\n\r\n let currentIterationPos =\r\n ((elapsedPos / iterationLength) % 1) * iterationLength\r\n\r\n this._updatePositionInState(currentIterationPos + range[0])\r\n requestNextTick()\r\n }\r\n\r\n const requestNextTick = () => ticker.onNextTick(tick)\r\n ticker.onThisOrNextTick(tick)\r\n\r\n const stop = () => {\r\n currentSource.stop()\r\n currentSource.disconnect()\r\n ticker.offThisOrNextTick(tick)\r\n ticker.offNextTick(tick)\r\n }\r\n\r\n return {stop}\r\n }\r\n\r\n private get _playing() {\r\n return this._state.get().playing\r\n }\r\n\r\n private set _playing(playing: boolean) {\r\n this._state.setByPointer((p) => p.playing, playing)\r\n }\r\n\r\n destroy() {}\r\n\r\n pause() {\r\n this._stopPlayCallback()\r\n this._playing = false\r\n this._stopPlayCallback = noop\r\n }\r\n\r\n gotoPosition(time: number) {\r\n this._updatePositionInState(time)\r\n }\r\n\r\n private _updatePositionInState(time: number) {\r\n this._state.reduce((s) => ({...s, position: time}))\r\n }\r\n\r\n getCurrentPosition() {\r\n return this._state.get().position\r\n }\r\n\r\n play(\r\n iterationCount: number,\r\n range: IPlaybackRange,\r\n rate: number,\r\n direction: IPlaybackDirection,\r\n ticker: Ticker,\r\n ): Promise<boolean> {\r\n if (this._playing) {\r\n this.pause()\r\n }\r\n\r\n this._playing = true\r\n\r\n let startPos = this.getCurrentPosition()\r\n const iterationLength = range[1] - range[0]\r\n\r\n if (direction !== 'normal') {\r\n throw new InvalidArgumentError(\r\n `Audio-controlled sequences can only be played in the \"normal\" direction. ` +\r\n `'${direction}' given.`,\r\n )\r\n }\r\n\r\n if (startPos < range[0] || startPos > range[1]) {\r\n // if we're currently out of the range\r\n this._updatePositionInState(range[0])\r\n } else if (startPos === range[1]) {\r\n // if we're currently at the very end of the range\r\n this._updatePositionInState(range[0])\r\n }\r\n startPos = this.getCurrentPosition()\r\n\r\n const deferred = defer<boolean>()\r\n\r\n const currentSource = this._audioContext.createBufferSource()\r\n currentSource.buffer = this._decodedBuffer\r\n currentSource.connect(this._mainGain)\r\n currentSource.playbackRate.value = rate\r\n\r\n if (iterationCount > 1000) {\r\n notify.warning(\r\n \"Can't play sequences with audio more than 1000 times\",\r\n `The sequence will still play, but only 1000 times. The \\`iterationCount: ${iterationCount}\\` provided to \\`sequence.play()\\`\r\nis too high for a sequence with audio.\r\n\r\nTo fix this, either set \\`iterationCount\\` to a lower value, or remove the audio from the sequence.`,\r\n [\r\n {\r\n url: 'https://www.theatrejs.com/docs/latest/manual/audio',\r\n title: 'Using Audio',\r\n },\r\n {\r\n url: 'https://www.theatrejs.com/docs/latest/api/core#sequence.attachaudio',\r\n title: 'Audio API',\r\n },\r\n ],\r\n )\r\n iterationCount = 1000\r\n }\r\n\r\n if (iterationCount > 1) {\r\n currentSource.loop = true\r\n currentSource.loopStart = range[0]\r\n currentSource.loopEnd = range[1]\r\n }\r\n\r\n const initialTickerTime = ticker.time\r\n let initialElapsedPos = startPos - range[0]\r\n const totalPlaybackLength = iterationLength * iterationCount\r\n\r\n currentSource.start(0, startPos, totalPlaybackLength - initialElapsedPos)\r\n\r\n const tick = (currentTickerTime: number) => {\r\n const elapsedTickerTime = Math.max(\r\n currentTickerTime - initialTickerTime,\r\n 0,\r\n )\r\n const elapsedTickerTimeInSeconds = elapsedTickerTime / 1000\r\n\r\n const elapsedPos = Math.min(\r\n elapsedTickerTimeInSeconds * rate + initialElapsedPos,\r\n totalPlaybackLength,\r\n )\r\n\r\n if (elapsedPos !== totalPlaybackLength) {\r\n let currentIterationPos =\r\n ((elapsedPos / iterationLength) % 1) * iterationLength\r\n\r\n this._updatePositionInState(currentIterationPos + range[0])\r\n requestNextTick()\r\n } else {\r\n this._updatePositionInState(range[1])\r\n this._playing = false\r\n cleanup()\r\n deferred.resolve(true)\r\n }\r\n }\r\n\r\n const cleanup = () => {\r\n currentSource.stop()\r\n currentSource.disconnect()\r\n }\r\n\r\n this._stopPlayCallback = () => {\r\n cleanup()\r\n ticker.offThisOrNextTick(tick)\r\n ticker.offNextTick(tick)\r\n\r\n if (this._playing) deferred.resolve(false)\r\n }\r\n const requestNextTick = () => ticker.onNextTick(tick)\r\n ticker.onThisOrNextTick(tick)\r\n return deferred.promise\r\n }\r\n}\r\n", "export const globals = {\r\n /**\r\n * If the schema of the redux store changes in a backwards-incompatible way, then this version number should be incremented.\r\n *\r\n * While this looks like semver, it is not. There are no patch numbers, so any change in this number is a breaking change.\r\n *\r\n * However, as long as the schema of the redux store is backwards-compatible, then we don't have to change this number.\r\n *\r\n * Since the 0.4.0 release, this number has not had to change.\r\n */\r\n currentProjectStateDefinitionVersion: '0.4.0',\r\n}\r\n\r\n/**\r\n * The names of the global variables that the core or studio bundle\r\n * use to store their references.\r\n */\r\nexport const globalVariableNames = {\r\n StudioBundle: '__Encore_StudioBundle',\r\n coreBundle: '__Encore_CoreBundle',\r\n notifications: '__Encore_Notifications',\r\n} as const\r\n\r\n// This type is easier to import by the studio, since studio can only import types from `@encorejs/core/*`\r\nexport type GlobalVariableNames = typeof globalVariableNames\r\n", "import {globalVariableNames} from '@encorejs/core/globals'\r\n\r\nexport type Notification = {title: string; message: string}\r\nexport type NotificationType = 'info' | 'success' | 'warning' | 'error'\r\nexport type Notify = (\r\n /**\r\n * The title of the notification.\r\n */\r\n title: string,\r\n /**\r\n * The message of the notification.\r\n */\r\n message: string,\r\n /**\r\n * An array of doc pages to link to.\r\n */\r\n docs?: {url: string; title: string}[],\r\n /**\r\n * Whether duplicate notifications should be allowed.\r\n */\r\n allowDuplicates?: boolean,\r\n) => void\r\n\r\nexport type Notifiers = {\r\n /**\r\n * Show a success notification.\r\n */\r\n success: Notify\r\n /**\r\n * Show a warning notification.\r\n *\r\n * Say what happened in the title.\r\n * In the message, start with 1) a reassurance, then 2) explain why it happened, and 3) what the user can do about it.\r\n */\r\n warning: Notify\r\n /**\r\n * Show an info notification.\r\n */\r\n info: Notify\r\n /**\r\n * Show an error notification.\r\n */\r\n error: Notify\r\n}\r\n\r\nconst createHandler =\r\n (type: NotificationType): Notify =>\r\n (...args) => {\r\n switch (type) {\r\n case 'success': {\r\n break\r\n }\r\n case 'info': {\r\n console.info(args.slice(0, 2).join('\\n'))\r\n break\r\n }\r\n case 'warning': {\r\n console.warn(args.slice(0, 2).join('\\n'))\r\n break\r\n }\r\n case 'error': {\r\n // don't log errors, they're already logged by the browser\r\n }\r\n }\r\n\r\n return typeof window !== 'undefined'\r\n ? // @ts-ignore\r\n window[globalVariableNames.notifications]?.notify[type](...args)\r\n : undefined\r\n }\r\n\r\nexport const notify: Notifiers = {\r\n warning: createHandler('warning'),\r\n success: createHandler('success'),\r\n info: createHandler('info'),\r\n error: createHandler('error'),\r\n}\r\n\r\nif (typeof window !== 'undefined') {\r\n window.addEventListener('error', (e) => {\r\n notify.error(\r\n `An error occurred`,\r\n `<pre>${e.message}</pre>\\n\\nSee **console** for details.`,\r\n )\r\n })\r\n\r\n window.addEventListener('unhandledrejection', (e) => {\r\n notify.error(\r\n `An error occurred`,\r\n `<pre>${e.reason}</pre>\\n\\nSee **console** for details.`,\r\n )\r\n })\r\n}\r\n", "import {Ticker} from '@encorejs/dataverse'\r\nimport {setPrivateAPI} from './privateAPIs'\r\nimport type {IRafDriver} from './types/public'\r\n\r\nexport interface RafDriverPrivateAPI {\r\n readonly type: 'Theatre_RafDriver_PrivateAPI'\r\n publicApi: IRafDriver\r\n ticker: Ticker\r\n start?: () => void\r\n stop?: () => void\r\n}\r\n\r\nlet lastDriverId = 0\r\n\r\n/**\r\n * Creates a custom raf driver.\r\n * `rafDriver`s allow you to control when and how often computations in Theatre tick forward. (raf stands for [`requestAnimationFrame`](https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame)).\r\n * The default `rafDriver` in Theatre creates a `raf` loop and ticks forward on each frame. You can create your own `rafDriver`, which enables the following use-cases:\r\n *\r\n * 1. When using Encore alongside other animation libs (`@react-three/fiber`/`gsap`/`lenis`/`etc`), you'd want all animation libs to use a single `raf` loop to keep the libraries in sync and also to get better performance.\r\n * 2. In XR sessions, you'd want Theatre to tick forward using [`xr.requestAnimationFrame()`](https://developer.mozilla.org/en-US/docs/Web/API/XRSession/requestAnimationFrame).\r\n * 3. In some advanced cases, you'd just want to manually tick forward (many ticks per frame, or skipping many frames, etc). This is useful for recording an animation, rendering to a file, testing an animation, running benchmarks, etc.\r\n *\r\n * Here is how you'd create a custom `rafDriver`:\r\n *\r\n * ```js\r\n * import { createRafDriver } from '@encorejs/core'\r\n *\r\n * const rafDriver = createRafDriver({ name: 'a custom 5fps raf driver' })\r\n *\r\n * setInterval(() => {\r\n * rafDriver.tick(performance.now())\r\n * }, 200)\r\n * ```\r\n *\r\n * Now, any time you set up an `onChange()` listener, pass your custom `rafDriver`:\r\n *\r\n * ```js\r\n * import { onChange } from '@encorejs/core'\r\n *\r\n * onChange(\r\n * // let's say object is a Theatre object, the one returned from calling `sheet.object()`\r\n * object.props,\r\n * // this callback will now only be called at 5fps (and won't be called if there are no new values)\r\n * // even if `sequence.play()` updates `object.props` at 60fps, this listener is called a maximum of 5fps\r\n * (propValues) => {\r\n * console.log(propValues)\r\n * },\r\n * rafDriver,\r\n * )\r\n *\r\n * // this will update the values of `object.props` at 60fps, but the listener above will still get called a maximum of 5fps\r\n * sheet.sequence.play()\r\n *\r\n * // we can also customize at what resolution the sequence's playhead moves forward\r\n * sheet.sequence.play({ rafDriver }) // the playhead will move forward at 5fps\r\n * ```\r\n *\r\n * You can optionally make studio use this `rafDriver`. This means the parts of the studio that tick based on raf, will now tick at 5fps. This is only useful if you're doing something crazy like running the studio (and not the core) in an XR frame.\r\n *\r\n * ```js\r\n * theatre.init({studio: true,\r\n * __experimental_rafDriver: rafDriver,\r\n * })\r\n * ```\r\n *\r\n * `rafDriver`s can optionally provide a `start/stop` callback. Theatre will call `start()` when it actually has computations scheduled, and will call `stop` if there is nothing to update after a few ticks:\r\n *\r\n * ```js\r\n * import { createRafDriver } from '@encorejs/core'\r\n * import type { IRafDriver } from '@theare/core'\r\n *\r\n * function createBasicRafDriver(): IRafDriver {\r\n * let rafId: number | null = null\r\n * const start = (): void => {\r\n * if (typeof window !== 'undefined') {\r\n * const onAnimationFrame = (t: number) => {\r\n * driver.tick(t)\r\n * rafId = window.requestAnimationFrame(onAnimationFrame)\r\n * }\r\n * rafId = window.requestAnimationFrame(onAnimationFrame)\r\n * } else {\r\n * driver.tick(0)\r\n * setTimeout(() => driver.tick(1), 0)\r\n * }\r\n * }\r\n *\r\n * const stop = (): void => {\r\n * if (typeof window !== 'undefined') {\r\n * if (rafId !== null) {\r\n * window.cancelAnimationFrame(rafId)\r\n * }\r\n * } else {\r\n * // nothing to do in SSR\r\n * }\r\n * }\r\n *\r\n * const driver = createRafDriver({ name: 'DefaultCoreRafDriver', start, stop })\r\n *\r\n * return driver\r\n * }\r\n * ```\r\n */\r\nexport function createRafDriver(conf?: {\r\n name?: string\r\n start?: () => void\r\n stop?: () => void\r\n}): IRafDriver {\r\n const tick = (time: number): void => {\r\n ticker.tick(time)\r\n }\r\n\r\n const ticker = new Ticker({\r\n onActive() {\r\n conf?.start?.()\r\n },\r\n onDormant() {\r\n conf?.stop?.()\r\n },\r\n })\r\n\r\n const driverPublicApi: IRafDriver = {\r\n tick,\r\n id: lastDriverId++,\r\n name: conf?.name ?? `CustomRafDriver-${lastDriverId}`,\r\n type: 'Theatre_RafDriver_PublicAPI',\r\n }\r\n\r\n const driverPrivateApi: RafDriverPrivateAPI = {\r\n type: 'Theatre_RafDriver_PrivateAPI',\r\n publicApi: driverPublicApi,\r\n ticker,\r\n start: conf?.start,\r\n stop: conf?.stop,\r\n }\r\n\r\n setPrivateAPI(driverPublicApi, driverPrivateApi)\r\n\r\n return driverPublicApi\r\n}\r\n", "import type {Ticker} from '@encorejs/dataverse'\r\nimport {privateAPI} from './privateAPIs'\r\nimport type {RafDriverPrivateAPI} from './rafDrivers'\r\nimport {createRafDriver} from './rafDrivers'\r\nimport type {IRafDriver} from './types/public'\r\n\r\n/**\r\n * Creates a rafDrive that uses `window.requestAnimationFrame` in browsers,\r\n * or a single `setTimeout` in SSR.\r\n */\r\nfunction createBasicRafDriver(): IRafDriver {\r\n let rafId: number | null = null\r\n const start = (): void => {\r\n if (typeof window !== 'undefined') {\r\n const onAnimationFrame = (t: number) => {\r\n driver.tick(t)\r\n rafId = window.requestAnimationFrame(onAnimationFrame)\r\n }\r\n rafId = window.requestAnimationFrame(onAnimationFrame)\r\n } else {\r\n driver.tick(0)\r\n setTimeout(() => driver.tick(1), 0)\r\n }\r\n }\r\n\r\n const stop = (): void => {\r\n if (typeof window !== 'undefined') {\r\n if (rafId !== null) {\r\n window.cancelAnimationFrame(rafId)\r\n }\r\n } else {\r\n // nothing to do in SSR\r\n }\r\n }\r\n\r\n const driver = createRafDriver({name: 'DefaultCoreRafDriver', start, stop})\r\n\r\n return driver\r\n}\r\n\r\nlet coreRafDriver: RafDriverPrivateAPI | undefined\r\n\r\n/**\r\n * Returns the rafDriver that is used by the core internally. Creates a new one if it's not set yet.\r\n */\r\nexport function getCoreRafDriver(): RafDriverPrivateAPI {\r\n if (!coreRafDriver) {\r\n setCoreRafDriver(createBasicRafDriver())\r\n }\r\n return coreRafDriver!\r\n}\r\n\r\n/**\r\n *\r\n * @returns The ticker that is used by the core internally.\r\n */\r\nexport function getCoreTicker(): Ticker {\r\n return getCoreRafDriver().ticker\r\n}\r\n\r\n/**\r\n * Sets the rafDriver that is used by the core internally.\r\n */\r\nexport function setCoreRafDriver(driver: IRafDriver) {\r\n if (coreRafDriver) {\r\n throw new Error(`\\`setCoreRafDriver()\\` is already called.`)\r\n }\r\n const driverPrivateApi = privateAPI(driver)\r\n coreRafDriver = driverPrivateApi\r\n}\r\n", "import {privateAPI, setPrivateAPI} from '@encorejs/core/privateAPIs'\r\nimport {defer} from '@encorejs/utils/defer'\r\nimport type Sequence from './Sequence'\r\nimport AudioPlaybackController from './playbackControllers/AudioPlaybackController'\r\nimport {getCoreTicker} from '@encorejs/core/coreTicker'\r\nimport type {Pointer} from '@encorejs/dataverse'\r\nimport {notify} from '@encorejs/core/utils/notify'\r\nimport type {\r\n IAttachAudioArgs,\r\n IPlaybackDirection,\r\n IPlaybackRange,\r\n ISequence,\r\n IRafDriver,\r\n BasicKeyframe,\r\n} from '@encorejs/core/types/public'\r\n\r\nexport default class TheatreSequence implements ISequence {\r\n get type(): 'Theatre_Sequence_PublicAPI' {\r\n return 'Theatre_Sequence_PublicAPI'\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n constructor(seq: Sequence) {\r\n setPrivateAPI(this, seq)\r\n }\r\n\r\n play(\r\n conf?: Partial<{\r\n iterationCount: number\r\n range: IPlaybackRange\r\n rate: number\r\n direction: IPlaybackDirection\r\n rafDriver: IRafDriver\r\n }>,\r\n ): Promise<boolean> {\r\n const priv = privateAPI(this)\r\n if (priv._project.isReady()) {\r\n const ticker = conf?.rafDriver\r\n ? privateAPI(conf.rafDriver).ticker\r\n : getCoreTicker()\r\n return priv.play(conf ?? {}, ticker)\r\n } else {\r\n if (process.env.NODE_ENV !== 'production') {\r\n notify.warning(\r\n \"Sequence can't be played\",\r\n 'You seem to have called `sequence.play()` before the project has finished loading.\\n\\n' +\r\n 'This would **not** a problem in production when using `@encorejs/core`, since Encore loads instantly in core mode. ' +\r\n \"However, when using `@encorejs/studio`, it takes a few milliseconds for it to load your project's state, \" +\r\n `before which your sequences cannot start playing.\\n` +\r\n `\\n` +\r\n 'To fix this, simply defer calling `sequence.play()` until after the project is loaded, like this:\\n\\n' +\r\n '```\\n' +\r\n `project.ready.then(() => {\\n` +\r\n ` sequence.play()\\n` +\r\n `})\\n` +\r\n '```',\r\n [\r\n {\r\n url: 'https://www.theatrejs.com/docs/0.5/api/core#project.ready',\r\n title: 'Project.ready',\r\n },\r\n ],\r\n )\r\n }\r\n const d = defer<boolean>()\r\n d.resolve(true)\r\n return d.promise\r\n }\r\n }\r\n\r\n pause() {\r\n privateAPI(this).pause()\r\n }\r\n\r\n get position() {\r\n return privateAPI(this).position\r\n }\r\n\r\n set position(position: number) {\r\n privateAPI(this).position = position\r\n }\r\n\r\n __experimental_getKeyframes(prop: Pointer<any>): BasicKeyframe[] {\r\n return privateAPI(this).getKeyframesOfSimpleProp(prop)\r\n }\r\n\r\n async attachAudio(args: IAttachAudioArgs): Promise<{\r\n decodedBuffer: AudioBuffer\r\n audioContext: AudioContext\r\n destinationNode: AudioNode\r\n gainNode: GainNode\r\n }> {\r\n const {audioContext, destinationNode, decodedBuffer, gainNode} =\r\n await resolveAudioBuffer(args)\r\n\r\n const playbackController = new AudioPlaybackController(\r\n decodedBuffer,\r\n audioContext,\r\n gainNode,\r\n )\r\n\r\n privateAPI(this).replacePlaybackController(playbackController)\r\n\r\n return {audioContext, destinationNode, decodedBuffer, gainNode}\r\n }\r\n\r\n get pointer(): ISequence['pointer'] {\r\n return privateAPI(this).pointer\r\n }\r\n}\r\n\r\nasync function resolveAudioBuffer(args: IAttachAudioArgs): Promise<{\r\n decodedBuffer: AudioBuffer\r\n audioContext: AudioContext\r\n destinationNode: AudioNode\r\n gainNode: GainNode\r\n}> {\r\n function getAudioContext(): Promise<AudioContext> {\r\n if (args.audioContext) return Promise.resolve(args.audioContext)\r\n const ctx = new AudioContext()\r\n if (ctx.state === 'running') return Promise.resolve(ctx)\r\n\r\n // AudioContext is suspended, probably because the browser\r\n // has blocked it since it is not initiated by a user gesture\r\n\r\n // if in SSR, just resolve the promise, as there is not much more to be done\r\n if (typeof window === 'undefined') {\r\n return Promise.resolve(ctx)\r\n }\r\n return new Promise<AudioContext>((resolve) => {\r\n const listener = () => {\r\n ctx.resume().catch((err) => {\r\n console.error(err)\r\n })\r\n }\r\n\r\n const eventsToHookInto: Array<keyof WindowEventMap> = [\r\n 'mousedown',\r\n 'keydown',\r\n 'touchstart',\r\n ]\r\n\r\n const eventListenerOpts = {capture: true, passive: false}\r\n eventsToHookInto.forEach((eventName) => {\r\n window.addEventListener(eventName, listener, eventListenerOpts)\r\n })\r\n\r\n ctx.addEventListener('statechange', () => {\r\n if (ctx.state === 'running') {\r\n eventsToHookInto.forEach((eventName) => {\r\n window.removeEventListener(eventName, listener, eventListenerOpts)\r\n })\r\n resolve(ctx)\r\n }\r\n })\r\n })\r\n }\r\n\r\n async function getAudioBuffer(): Promise<AudioBuffer> {\r\n if (args.source instanceof AudioBuffer) {\r\n return args.source\r\n }\r\n\r\n const decodedBufferDeferred = defer<AudioBuffer>()\r\n if (typeof args.source !== 'string') {\r\n throw new Error(\r\n `Error validating arguments to sequence.attachAudio(). ` +\r\n `args.source must either be a string or an instance of AudioBuffer.`,\r\n )\r\n }\r\n\r\n let fetchResponse\r\n try {\r\n fetchResponse = await fetch(args.source)\r\n } catch (e) {\r\n console.error(e)\r\n throw new Error(\r\n `Could not fetch '${args.source}'. Network error logged above.`,\r\n )\r\n }\r\n\r\n let arrayBuffer\r\n try {\r\n arrayBuffer = await fetchResponse.arrayBuffer()\r\n } catch (e) {\r\n console.error(e)\r\n throw new Error(`Could not read '${args.source}' as an arrayBuffer.`)\r\n }\r\n\r\n const audioContext = await audioContextPromise\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n audioContext.decodeAudioData(\r\n arrayBuffer,\r\n decodedBufferDeferred.resolve,\r\n decodedBufferDeferred.reject,\r\n )\r\n\r\n let decodedBuffer\r\n try {\r\n decodedBuffer = await decodedBufferDeferred.promise\r\n } catch (e) {\r\n console.error(e)\r\n throw new Error(`Could not decode ${args.source} as an audio file.`)\r\n }\r\n\r\n return decodedBuffer\r\n }\r\n\r\n const audioContextPromise = getAudioContext()\r\n const audioBufferPromise = getAudioBuffer()\r\n\r\n const [audioContext, decodedBuffer] = await Promise.all([\r\n audioContextPromise,\r\n audioBufferPromise,\r\n ])\r\n\r\n const destinationNode = args.destinationNode || audioContext.destination\r\n const gainNode = audioContext.createGain()\r\n gainNode.connect(destinationNode)\r\n\r\n return {\r\n audioContext,\r\n decodedBuffer,\r\n gainNode,\r\n destinationNode,\r\n }\r\n}\r\n", "// eslint-disable-next-line import/no-extraneous-dependencies\r\nimport type {IProject, ISheet, ISheetObject} from '@encorejs/core/types/public'\r\nimport type Project from '@encorejs/core/projects/Project'\r\nimport type SheetObject from '@encorejs/core/sheetObjects/SheetObject'\r\nimport type SheetObjectTemplate from '@encorejs/core/sheetObjects/SheetObjectTemplate'\r\nimport type Sheet from '@encorejs/core/sheets/Sheet'\r\nimport type SheetTemplate from '@encorejs/core/sheets/SheetTemplate'\r\nimport type {$IntentionalAny} from '@encorejs/core/types/public'\r\n\r\n/**\r\n * Since \\@encorejs/core and \\@encorejs/studio are separate bundles,\r\n * they cannot use `x instanceof Y` to detect object types.\r\n *\r\n * The functions in this module are supposed to be a replacement for that.\r\n */\r\n\r\nexport const isProject = typeAsserter<Project>('Theatre_Project')\r\n\r\nexport const isSheet = typeAsserter<Sheet>('Theatre_Sheet')\r\nexport const isSheetTemplate = typeAsserter<SheetTemplate>(\r\n 'Theatre_SheetTemplate',\r\n)\r\n\r\nexport const isSheetObject = typeAsserter<SheetObject>('Theatre_SheetObject')\r\n\r\nexport const isSheetObjectTemplate = typeAsserter<SheetObjectTemplate>(\r\n 'Theatre_SheetObjectTemplate',\r\n)\r\n\r\nexport const isProjectPublicAPI = typeAsserter<IProject>(\r\n 'Theatre_Project_PublicAPI',\r\n)\r\n\r\nexport const isSheetPublicAPI = typeAsserter<ISheet>('Theatre_Sheet_PublicAPI')\r\n\r\nexport const isSheetObjectPublicAPI = typeAsserter<ISheetObject>(\r\n 'Theatre_SheetObject_PublicAPI',\r\n)\r\n\r\nfunction typeAsserter<T extends {type: string}>(\r\n t: T['type'],\r\n): (v: unknown) => v is T {\r\n return (v: unknown): v is T =>\r\n typeof v === 'object' && !!v && (v as $IntentionalAny).type === t\r\n}\r\n", "import type {$FixMe, $IntentionalAny} from '@encorejs/core/types/public'\r\nimport userReadableTypeOfValue from '@encorejs/utils/userReadableTypeOfValue'\r\n\r\nimport {\r\n decorateRgba,\r\n linearSrgbToOklab,\r\n oklabToLinearSrgb,\r\n srgbToLinearSrgb,\r\n linearSrgbToSrgb,\r\n} from '@encorejs/utils/color'\r\nimport {clamp, mapValues} from 'lodash-es'\r\nimport {propTypeSymbol, type NumberNudgeFn} from '@encorejs/core/types/public'\r\nimport {sanitizeCompoundProps} from './internals'\r\n\r\nimport type {\r\n Interpolator,\r\n PropTypeConfig_Boolean,\r\n PropTypeConfig_Compound,\r\n PropTypeConfig_File,\r\n PropTypeConfig_Image,\r\n PropTypeConfig_Number,\r\n PropTypeConfig_Rgba,\r\n PropTypeConfig_String,\r\n PropTypeConfig_StringLiteral,\r\n UnknownShorthandCompoundProps,\r\n ShorthandCompoundPropsToLonghandCompoundProps,\r\n Rgba,\r\n File,\r\n Asset,\r\n} from '@encorejs/core/types/public'\r\n\r\n// Notes on naming:\r\n// As of now, prop types are either `simple` or `composite`.\r\n// The compound type is a composite type. So is the upcoming enum type.\r\n// Composite types are not directly sequenceable yet. Their simple sub/descendent props are.\r\n\r\n/**\r\n * Validates the common options given to all prop types, such as `opts.label`\r\n *\r\n * @param fnCallSignature - See references for examples\r\n * @param opts - The common options of all prop types\r\n * @returns void - will throw if options are invalid\r\n */\r\nconst validateCommonOpts = (fnCallSignature: string, opts?: CommonOpts) => {\r\n if (process.env.NODE_ENV !== 'production') {\r\n if (opts === undefined) return\r\n if (typeof opts !== 'object' || opts === null) {\r\n throw new Error(\r\n `opts in ${fnCallSignature} must either be undefined or an object.`,\r\n )\r\n }\r\n if (Object.prototype.hasOwnProperty.call(opts, 'label')) {\r\n const {label} = opts\r\n if (typeof label !== 'string') {\r\n throw new Error(\r\n `opts.label in ${fnCallSignature} should be a string. ${userReadableTypeOfValue(\r\n label,\r\n )} given.`,\r\n )\r\n }\r\n if (label.trim().length !== label.length) {\r\n throw new Error(\r\n `opts.label in ${fnCallSignature} should not start/end with whitespace. \"${label}\" given.`,\r\n )\r\n }\r\n if (label.length === 0) {\r\n throw new Error(\r\n `opts.label in ${fnCallSignature} should not be an empty string. If you wish to have no label, remove opts.label from opts.`,\r\n )\r\n }\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * A compound prop type (basically a JS object).\r\n *\r\n * @example\r\n * Usage:\r\n * ```ts\r\n * // shorthand\r\n * const position = {\r\n * x: 0,\r\n * y: 0\r\n * }\r\n * assert(sheet.object('some object', position).value.x === 0)\r\n *\r\n * // nesting\r\n * const foo = {bar: {baz: {quo: 0}}}\r\n * assert(sheet.object('some object', foo).value.bar.baz.quo === 0)\r\n *\r\n * // With additional options:\r\n * const position = t.compound(\r\n * {x: 0, y: 0},\r\n * // a custom label for the prop:\r\n * {label: \"Position\"}\r\n * )\r\n * ```\r\n *\r\n */\r\nexport const compound = <Props extends UnknownShorthandCompoundProps>(\r\n props: Props,\r\n opts: CommonOpts = {},\r\n): PropTypeConfig_Compound<\r\n ShorthandCompoundPropsToLonghandCompoundProps<Props>\r\n> => {\r\n validateCommonOpts('t.compound(props, opts)', opts)\r\n const sanitizedProps = sanitizeCompoundProps(props)\r\n const deserializationCache = new WeakMap<{}, unknown>()\r\n const config: PropTypeConfig_Compound<\r\n ShorthandCompoundPropsToLonghandCompoundProps<Props>\r\n > = {\r\n type: 'compound',\r\n props: sanitizedProps as $IntentionalAny,\r\n valueType: null as $IntentionalAny,\r\n [propTypeSymbol]: 'TheatrePropType',\r\n label: opts.label,\r\n default: mapValues(sanitizedProps, (p) => p.default) as $IntentionalAny,\r\n deserializeAndSanitize: (json: unknown) => {\r\n if (typeof json !== 'object' || !json) return undefined\r\n if (deserializationCache.has(json)) {\r\n return deserializationCache.get(json)\r\n }\r\n\r\n // TODO we should probably also check here whether `json` is a pure object rather\r\n // than an instance of a class, just to avoid the possible edge cases of handling\r\n // class instances.\r\n\r\n const deserialized: $FixMe = {}\r\n let atLeastOnePropWasDeserialized = false\r\n for (const [key, propConfig] of Object.entries(sanitizedProps)) {\r\n if (Object.prototype.hasOwnProperty.call(json, key)) {\r\n const deserializedSub = propConfig.deserializeAndSanitize(\r\n (json as $IntentionalAny)[key] as unknown,\r\n )\r\n if (deserializedSub != null) {\r\n atLeastOnePropWasDeserialized = true\r\n deserialized[key] = deserializedSub\r\n }\r\n }\r\n }\r\n deserializationCache.set(json, deserialized)\r\n if (atLeastOnePropWasDeserialized) {\r\n return deserialized\r\n }\r\n },\r\n }\r\n return config\r\n}\r\n\r\n/**\r\n * A file prop type\r\n *\r\n * @example\r\n * Usage:\r\n * ```ts\r\n *\r\n * // with a label:\r\n * const obj = sheet.object('key', {\r\n * url: t.file('My file.glb', {\r\n * label: 'Model'\r\n * })\r\n * })\r\n * ```\r\n *\r\n * @param opts - Options (See usage examples)\r\n */\r\nexport const file = (\r\n // The defaultValue parameter is a string for convenience, but it will be converted to an Asset object\r\n defaultValue: File['id'],\r\n opts: {\r\n label?: string\r\n interpolate?: Interpolator<File['id']>\r\n } = {},\r\n): PropTypeConfig_File => {\r\n if (process.env.NODE_ENV !== 'production') {\r\n validateCommonOpts('t.file(defaultValue, opts)', opts)\r\n }\r\n\r\n const interpolate: Interpolator<File> = (left, right, progression) => {\r\n const stringInterpolate = opts.interpolate ?? leftInterpolate\r\n\r\n return {\r\n type: 'file',\r\n id: stringInterpolate(left.id, right.id, progression),\r\n }\r\n }\r\n\r\n return {\r\n type: 'file',\r\n default: {type: 'file', id: defaultValue},\r\n valueType: null as $IntentionalAny,\r\n [propTypeSymbol]: 'TheatrePropType',\r\n label: opts.label,\r\n interpolate,\r\n deserializeAndSanitize: _ensureFile,\r\n }\r\n}\r\n\r\nconst _ensureFile = (val: unknown): File | undefined => {\r\n if (!val) return undefined\r\n\r\n let valid = true\r\n\r\n if (\r\n typeof (val as $IntentionalAny).id !== 'string' &&\r\n ![null, undefined].includes((val as $IntentionalAny).id)\r\n ) {\r\n valid = false\r\n }\r\n\r\n if ((val as $IntentionalAny).type !== 'file') valid = false\r\n\r\n if (!valid) return undefined\r\n\r\n return val as File\r\n}\r\n\r\n/**\r\n * An image prop type\r\n *\r\n * @example\r\n * Usage:\r\n * ```ts\r\n *\r\n * // with a label:\r\n * const obj = sheet.object('key', {\r\n * url: t.image('My image.png', {\r\n * label: 'texture'\r\n * })\r\n * })\r\n * ```\r\n *\r\n * @param opts - Options (See usage examples)\r\n */\r\nexport const image = (\r\n // The defaultValue parameter is a string for convenience, but it will be converted to an Asset object\r\n defaultValue: Asset['id'],\r\n opts: {\r\n label?: string\r\n interpolate?: Interpolator<Asset['id']>\r\n } = {},\r\n): PropTypeConfig_Image => {\r\n if (process.env.NODE_ENV !== 'production') {\r\n validateCommonOpts('t.image(defaultValue, opts)', opts)\r\n }\r\n\r\n const interpolate: Interpolator<Asset> = (left, right, progression) => {\r\n const stringInterpolate = opts.interpolate ?? leftInterpolate\r\n\r\n return {\r\n type: 'image',\r\n id: stringInterpolate(left.id, right.id, progression),\r\n }\r\n }\r\n\r\n return {\r\n type: 'image',\r\n default: {type: 'image', id: defaultValue},\r\n valueType: null as $IntentionalAny,\r\n [propTypeSymbol]: 'TheatrePropType',\r\n label: opts.label,\r\n interpolate,\r\n deserializeAndSanitize: _ensureImage,\r\n }\r\n}\r\n\r\nconst _ensureImage = (val: unknown): Asset | undefined => {\r\n if (!val) return undefined\r\n\r\n let valid = true\r\n\r\n if (\r\n typeof (val as $IntentionalAny).id !== 'string' &&\r\n ![null, undefined].includes((val as $IntentionalAny).id)\r\n ) {\r\n valid = false\r\n }\r\n\r\n if ((val as $IntentionalAny).type !== 'image') valid = false\r\n\r\n if (!valid) return undefined\r\n\r\n return val as Asset\r\n}\r\n\r\n/**\r\n * A number prop type.\r\n *\r\n * @example\r\n * Usage\r\n * ```ts\r\n * // shorthand:\r\n * const obj = sheet.object('key', {x: 0})\r\n *\r\n * // With options (equal to above)\r\n * const obj = sheet.object('key', {\r\n * x: t.number(0)\r\n * })\r\n *\r\n * // With a range (note that opts.range is just a visual guide, not a validation rule)\r\n * const x = t.number(0, {range: [0, 10]}) // limited to 0 and 10\r\n *\r\n * // With custom nudging\r\n * const x = t.number(0, {nudgeMultiplier: 0.1}) // nudging will happen in 0.1 increments\r\n *\r\n * // With custom nudging function\r\n * const x = t.number({\r\n * nudgeFn: (\r\n * // the mouse movement (in pixels)\r\n * deltaX: number,\r\n * // the movement as a fraction of the width of the number editor's input\r\n * deltaFraction: number,\r\n * // A multiplier that's usually 1, but might be another number if user wants to nudge slower/faster\r\n * magnitude: number,\r\n * // the configuration of the number\r\n * config: {nudgeMultiplier?: number; range?: [number, number]},\r\n * ): number => {\r\n * return deltaX * magnitude\r\n * },\r\n * })\r\n * ```\r\n *\r\n * @param defaultValue - The default value (Must be a finite number)\r\n * @param opts - The options (See usage examples)\r\n * @returns A number prop config\r\n */\r\nexport const number = (\r\n defaultValue: number,\r\n opts: {\r\n nudgeFn?: PropTypeConfig_Number['nudgeFn']\r\n range?: PropTypeConfig_Number['range']\r\n nudgeMultiplier?: number\r\n label?: string\r\n } = {},\r\n): PropTypeConfig_Number => {\r\n if (process.env.NODE_ENV !== 'production') {\r\n validateCommonOpts('t.number(defaultValue, opts)', opts)\r\n if (typeof defaultValue !== 'number' || !isFinite(defaultValue)) {\r\n throw new Error(\r\n `Argument defaultValue in t.number(defaultValue) must be a number. ${userReadableTypeOfValue(\r\n defaultValue,\r\n )} given.`,\r\n )\r\n }\r\n if (typeof opts === 'object' && opts !== null) {\r\n if (Object.prototype.hasOwnProperty.call(opts, 'range')) {\r\n if (!Array.isArray(opts.range)) {\r\n throw new Error(\r\n `opts.range in t.number(defaultValue, opts) must be a tuple of two numbers. ${userReadableTypeOfValue(\r\n opts.range,\r\n )} given.`,\r\n )\r\n }\r\n if (opts.range.length !== 2) {\r\n throw new Error(\r\n `opts.range in t.number(defaultValue, opts) must have two elements. ${opts.range.length} given.`,\r\n )\r\n }\r\n if (!opts.range.every((n) => typeof n === 'number' && !isNaN(n))) {\r\n throw new Error(\r\n `opts.range in t.number(defaultValue, opts) must be a tuple of two numbers.`,\r\n )\r\n }\r\n if (opts.range[0] >= opts.range[1]) {\r\n throw new Error(\r\n `opts.range[0] in t.number(defaultValue, opts) must be smaller than opts.range[1]. Given: ${JSON.stringify(\r\n opts.range,\r\n )}`,\r\n )\r\n }\r\n }\r\n if (Object.prototype.hasOwnProperty.call(opts, 'nudgeMultiplier')) {\r\n if (\r\n typeof opts.nudgeMultiplier !== 'number' ||\r\n !isFinite(opts.nudgeMultiplier)\r\n ) {\r\n throw new Error(\r\n `opts.nudgeMultiplier in t.number(defaultValue, opts) must be a finite number. ${userReadableTypeOfValue(\r\n opts.nudgeMultiplier,\r\n )} given.`,\r\n )\r\n }\r\n }\r\n if (Object.prototype.hasOwnProperty.call(opts, 'nudgeFn')) {\r\n if (typeof opts.nudgeFn !== 'function') {\r\n throw new Error(\r\n `opts.nudgeFn in t.number(defaultValue, opts) must be a function. ${userReadableTypeOfValue(\r\n opts.nudgeFn,\r\n )} given.`,\r\n )\r\n }\r\n }\r\n }\r\n }\r\n\r\n return {\r\n type: 'number',\r\n valueType: 0,\r\n default: defaultValue,\r\n [propTypeSymbol]: 'TheatrePropType',\r\n ...(opts ? opts : {}),\r\n label: opts.label,\r\n nudgeFn: opts.nudgeFn ?? defaultNumberNudgeFn,\r\n nudgeMultiplier:\r\n typeof opts.nudgeMultiplier === 'number'\r\n ? opts.nudgeMultiplier\r\n : undefined,\r\n interpolate: _interpolateNumber,\r\n deserializeAndSanitize: numberDeserializer(opts.range),\r\n }\r\n}\r\n\r\nconst numberDeserializer = (range?: PropTypeConfig_Number['range']) =>\r\n range\r\n ? (json: unknown): undefined | number => {\r\n if (!(typeof json === 'number' && isFinite(json))) return undefined\r\n return clamp(json, range[0], range[1])\r\n }\r\n : _ensureNumber\r\n\r\nconst _ensureNumber = (value: unknown): undefined | number =>\r\n typeof value === 'number' && isFinite(value) ? value : undefined\r\n\r\nconst _interpolateNumber = (\r\n left: number,\r\n right: number,\r\n progression: number,\r\n): number => {\r\n return left + progression * (right - left)\r\n}\r\n\r\nexport const rgba = (\r\n defaultValue: Rgba = {r: 0, g: 0, b: 0, a: 1},\r\n opts: CommonOpts = {},\r\n): PropTypeConfig_Rgba => {\r\n if (process.env.NODE_ENV !== 'production') {\r\n validateCommonOpts('t.rgba(defaultValue, opts)', opts)\r\n\r\n // Lots of duplicated code and stuff that probably shouldn't be here, mostly\r\n // because we are still figuring out how we are doing validation, sanitization,\r\n // decoding, decorating.\r\n\r\n // Validate default value\r\n let valid = true\r\n for (const p of ['r', 'g', 'b', 'a']) {\r\n if (\r\n !Object.prototype.hasOwnProperty.call(defaultValue, p) ||\r\n typeof (defaultValue as $IntentionalAny)[p] !== 'number'\r\n ) {\r\n valid = false\r\n }\r\n }\r\n\r\n if (!valid) {\r\n throw new Error(\r\n `Argument defaultValue in t.rgba(defaultValue) must be of the shape { r: number; g: number, b: number, a: number; }.`,\r\n )\r\n }\r\n }\r\n\r\n // Clamp defaultValue components between 0 and 1\r\n const sanitized = {}\r\n for (const component of ['r', 'g', 'b', 'a']) {\r\n ;(sanitized as $IntentionalAny)[component] = Math.min(\r\n Math.max((defaultValue as $IntentionalAny)[component], 0),\r\n 1,\r\n )\r\n }\r\n\r\n return {\r\n type: 'rgba',\r\n valueType: null as $IntentionalAny,\r\n default: decorateRgba(sanitized as Rgba),\r\n [propTypeSymbol]: 'TheatrePropType',\r\n label: opts.label,\r\n interpolate: _interpolateRgba,\r\n deserializeAndSanitize: _sanitizeRgba,\r\n }\r\n}\r\n\r\nconst _sanitizeRgba = (val: unknown): Rgba | undefined => {\r\n if (!val) return undefined\r\n let valid = true\r\n for (const c of ['r', 'g', 'b', 'a']) {\r\n if (\r\n !Object.prototype.hasOwnProperty.call(val, c) ||\r\n typeof (val as $IntentionalAny)[c] !== 'number'\r\n ) {\r\n valid = false\r\n }\r\n }\r\n\r\n if (!valid) return undefined\r\n\r\n // Clamp defaultValue components between 0 and 1\r\n const sanitized = {}\r\n for (const c of ['r', 'g', 'b', 'a']) {\r\n ;(sanitized as $IntentionalAny)[c] = Math.min(\r\n Math.max((val as $IntentionalAny)[c], 0),\r\n 1,\r\n )\r\n }\r\n\r\n return decorateRgba(sanitized as Rgba)\r\n}\r\n\r\nconst _interpolateRgba = (\r\n left: Rgba,\r\n right: Rgba,\r\n progression: number,\r\n): Rgba => {\r\n const leftLab = linearSrgbToOklab(srgbToLinearSrgb(left))\r\n const rightLab = linearSrgbToOklab(srgbToLinearSrgb(right))\r\n\r\n const interpolatedLab = {\r\n L: (1 - progression) * leftLab.L + progression * rightLab.L,\r\n a: (1 - progression) * leftLab.a + progression * rightLab.a,\r\n b: (1 - progression) * leftLab.b + progression * rightLab.b,\r\n alpha: (1 - progression) * leftLab.alpha + progression * rightLab.alpha,\r\n }\r\n\r\n const interpolatedRgba = linearSrgbToSrgb(oklabToLinearSrgb(interpolatedLab))\r\n\r\n return decorateRgba(interpolatedRgba)\r\n}\r\n\r\n/**\r\n * A boolean prop type\r\n *\r\n * @example\r\n * Usage:\r\n * ```ts\r\n * // shorthand:\r\n * const obj = sheet.object('key', {isOn: true})\r\n *\r\n * // with a label:\r\n * const obj = sheet.object('key', {\r\n * isOn: t.boolean(true, {\r\n * label: 'Enabled'\r\n * })\r\n * })\r\n * ```\r\n *\r\n * @param defaultValue - The default value (must be a boolean)\r\n * @param opts - Options (See usage examples)\r\n */\r\nexport const boolean = (\r\n defaultValue: boolean,\r\n opts: {\r\n label?: string\r\n interpolate?: Interpolator<boolean>\r\n } = {},\r\n): PropTypeConfig_Boolean => {\r\n if (process.env.NODE_ENV !== 'production') {\r\n validateCommonOpts('t.boolean(defaultValue, opts)', opts)\r\n if (typeof defaultValue !== 'boolean') {\r\n throw new Error(\r\n `defaultValue in t.boolean(defaultValue) must be a boolean. ${userReadableTypeOfValue(\r\n defaultValue,\r\n )} given.`,\r\n )\r\n }\r\n }\r\n\r\n return {\r\n type: 'boolean',\r\n default: defaultValue,\r\n valueType: null as $IntentionalAny,\r\n [propTypeSymbol]: 'TheatrePropType',\r\n label: opts.label,\r\n interpolate: opts.interpolate ?? leftInterpolate,\r\n deserializeAndSanitize: _ensureBoolean,\r\n }\r\n}\r\n\r\nconst _ensureBoolean = (val: unknown): boolean | undefined => {\r\n return typeof val === 'boolean' ? val : undefined\r\n}\r\n\r\nfunction leftInterpolate<T>(left: T): T {\r\n return left\r\n}\r\n\r\n/**\r\n * A string prop type\r\n *\r\n * @example\r\n * Usage:\r\n * ```ts\r\n * // shorthand:\r\n * const obj = sheet.object('key', {message: \"Animation loading\"})\r\n *\r\n * // with a label:\r\n * const obj = sheet.object('key', {\r\n * message: t.string(\"Animation Loading\", {\r\n * label: 'The Message'\r\n * })\r\n * })\r\n * ```\r\n *\r\n * @param defaultValue - The default value (must be a string)\r\n * @param opts - The options (See usage examples)\r\n * @returns A string prop type\r\n */\r\nexport const string = (\r\n defaultValue: string,\r\n opts: {\r\n label?: string\r\n interpolate?: Interpolator<string>\r\n } = {},\r\n): PropTypeConfig_String => {\r\n if (process.env.NODE_ENV !== 'production') {\r\n validateCommonOpts('t.string(defaultValue, opts)', opts)\r\n if (typeof defaultValue !== 'string') {\r\n throw new Error(\r\n `defaultValue in t.string(defaultValue) must be a string. ${userReadableTypeOfValue(\r\n defaultValue,\r\n )} given.`,\r\n )\r\n }\r\n }\r\n return {\r\n type: 'string',\r\n default: defaultValue,\r\n valueType: null as $IntentionalAny,\r\n [propTypeSymbol]: 'TheatrePropType',\r\n label: opts.label,\r\n interpolate: opts.interpolate ?? leftInterpolate,\r\n deserializeAndSanitize: _ensureString,\r\n }\r\n}\r\n\r\nfunction _ensureString(s: unknown): string | undefined {\r\n return typeof s === 'string' ? s : undefined\r\n}\r\n\r\n/**\r\n * A stringLiteral prop type, useful for building menus or radio buttons.\r\n *\r\n * @example\r\n * Usage:\r\n * ```ts\r\n * // Basic usage\r\n * const obj = sheet.object('key', {\r\n * light: t.stringLiteral(\"r\", {r: \"Red\", \"g\": \"Green\"})\r\n * })\r\n *\r\n * // Shown as a radio switch with a custom label\r\n * const obj = sheet.object('key', {\r\n * light: t.stringLiteral(\"r\", {r: \"Red\", \"g\": \"Green\"})\r\n * }, {as: \"switch\", label: \"Street Light\"})\r\n * ```\r\n *\r\n * @returns A stringLiteral prop type\r\n *\r\n */\r\nexport function stringLiteral<\r\n ValuesAndLabels extends {[key in string]: string},\r\n>(\r\n /**\r\n * Default value (a string that equals one of the options)\r\n */\r\n defaultValue: Extract<keyof ValuesAndLabels, string>,\r\n /**\r\n * The options. Use the `\"value\": \"Label\"` format.\r\n *\r\n * An object like `{[value]: Label}`. Example: `{r: \"Red\", \"g\": \"Green\"}`\r\n */\r\n valuesAndLabels: ValuesAndLabels,\r\n /**\r\n * opts.as Determines if editor is shown as a menu or a switch. Either 'menu' or 'switch'. Default: 'menu'\r\n */\r\n opts: {\r\n as?: 'menu' | 'switch'\r\n label?: string\r\n interpolate?: Interpolator<Extract<keyof ValuesAndLabels, string>>\r\n } = {},\r\n): PropTypeConfig_StringLiteral<Extract<keyof ValuesAndLabels, string>> {\r\n return {\r\n type: 'stringLiteral',\r\n default: defaultValue,\r\n valuesAndLabels: {...valuesAndLabels},\r\n [propTypeSymbol]: 'TheatrePropType',\r\n valueType: null as $IntentionalAny,\r\n as: opts.as ?? 'menu',\r\n label: opts.label,\r\n interpolate: opts.interpolate ?? leftInterpolate,\r\n deserializeAndSanitize(\r\n json: unknown,\r\n ): undefined | Extract<keyof ValuesAndLabels, string> {\r\n if (typeof json !== 'string') return undefined\r\n if (Object.prototype.hasOwnProperty.call(valuesAndLabels, json)) {\r\n return json as $IntentionalAny\r\n } else {\r\n return undefined\r\n }\r\n },\r\n }\r\n}\r\n\r\n/**\r\n * This is the default nudging behavior. It'll be used if `config.nudgeFn` is empty in {@link number} `types.number(defaultValue, config)`.\r\n *\r\n * Its behavior is as follows:\r\n * - If `config.nudgeMultiplier` is set, then it'll be used as the unit of incrementing/decrementing the prop's value.\r\n * For example, if `types.number(0, {nudgeMultiplier: 0.5})`, then nudging the number will make its value go up/down by 0.5, so: 0, 0.5, 1.0, -0.5, ...\r\n * Note that if the prop's value is, say, 0.1, then nudging it will still make its value go up/down by 0.5, so: 0.6, 1.1, -0.6, ...\r\n * - Otherwise, the amount of nudge will be determined based on whether the number has a range.\r\n *\r\n */\r\nconst defaultNumberNudgeFn: NumberNudgeFn = ({\r\n config,\r\n deltaX,\r\n deltaFraction,\r\n magnitude,\r\n}) => {\r\n const {range} = config\r\n\r\n if (\r\n !config.nudgeMultiplier &&\r\n range &&\r\n !range.includes(Infinity) &&\r\n !range.includes(-Infinity)\r\n ) {\r\n return deltaFraction * (range[1] - range[0]) * magnitude\r\n }\r\n\r\n return deltaX * magnitude * (config.nudgeMultiplier ?? 1)\r\n}\r\n\r\ntype CommonOpts = {\r\n /**\r\n * Each prop type may be given a custom label instead of the name of the sub-prop\r\n * it is in.\r\n *\r\n * @example\r\n * ```ts\r\n * const position = {\r\n * x: t.number(0), // label would be 'x'\r\n * y: t.number(0, {label: 'top'}) // label would be 'top'\r\n * }\r\n * ```\r\n */\r\n label?: string\r\n}\r\n", "/**\r\n * Truncates a string to a given length, adding an ellipsis if it was truncated.\r\n * Example:\r\n * ```ts\r\n * ellipsify('hello world', 5) // 'hello...'\r\n * ellipsify('hello world', 100) // 'hello world'\r\n * ```\r\n */\r\nexport default function ellipsify(str: string, maxLength: number) {\r\n if (str.length <= maxLength) return str\r\n return str.substr(0, maxLength - 3) + '...'\r\n}\r\n", "import ellipsify from './ellipsify'\r\n\r\n/**\r\n * Returns a short, user-readable description of the type of `value`.\r\n * Examples:\r\n * ```ts\r\n * userReadableTypeOfValue(1) // 'number(1)'\r\n * userReadableTypeOfValue(12345678901112) // 'number(1234567...)'\r\n * userReadableTypeOfValue('hello') // 'string(\"hello\")'\r\n * userReadableTypeOfValue('hello world this is a long string') // 'string(\"hello wo...\")'\r\n * userReadableTypeOfValue({a: 1, b: 2}) // 'object'\r\n * userReadableTypeOfValue([1, 2, 3]) // 'array'\r\n * userReadableTypeOfValue(null) // 'null'\r\n * userReadableTypeOfValue(undefined) // 'undefined'\r\n * userReadableTypeOfValue(true) // 'true'\r\n * ```\r\n */\r\nconst userReadableTypeOfValue = (v: unknown): string => {\r\n if (typeof v === 'string') {\r\n return `string(\"${ellipsify(v, 10)}\")`\r\n } else if (typeof v === 'number') {\r\n return `number(${ellipsify(String(v), 10)})`\r\n } else if (v === null) {\r\n return 'null'\r\n } else if (v === undefined) {\r\n return 'undefined'\r\n } else if (typeof v === 'boolean') {\r\n return String(v)\r\n } else if (Array.isArray(v)) {\r\n return 'array'\r\n } else if (typeof v === 'object') {\r\n return 'object'\r\n } else {\r\n return 'unknown'\r\n }\r\n}\r\n\r\nexport default userReadableTypeOfValue\r\n", "import {clamp} from 'lodash-es'\r\nimport memoizeFn from './memoizeFn'\r\n\r\n/**\r\n * Robust check for a valid hex value (without the \"#\") in a string\r\n *\r\n * @remarks\r\n *\r\n * Supports all the syntax variants of <hex-color>\r\n * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/hex-color#syntax}:\r\n *\r\n *\r\n * ```javascript\r\n * #RGB // The three-value syntax\r\n * #RGBA // The four-value syntax\r\n * #RRGGBB // The six-value syntax\r\n * #RRGGBBAA // The eight-value syntax\r\n * ```\r\n */\r\nexport const validHexRegExp = /^#*([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i\r\n\r\nexport function parseRgbaFromHex(rgba: string) {\r\n rgba = rgba.trim().toLowerCase()\r\n\r\n const match = rgba.match(validHexRegExp)\r\n\r\n if (!match) {\r\n return {\r\n r: 0,\r\n g: 0,\r\n b: 0,\r\n a: 1,\r\n }\r\n }\r\n\r\n const hex = _hexInEightValueSyntax(match[1])\r\n\r\n return {\r\n r: parseInt(hex.substr(0, 2), 16) / 255,\r\n g: parseInt(hex.substr(2, 2), 16) / 255,\r\n b: parseInt(hex.substr(4, 2), 16) / 255,\r\n a: parseInt(hex.substr(6, 2), 16) / 255,\r\n }\r\n}\r\n\r\nexport function rgba2hex(\r\n rgba: Rgba,\r\n {\r\n /** Alpha is usually an optional value for most hex inputs, so if it's opaque, we can omit its value. */\r\n removeAlphaIfOpaque = false,\r\n } = {},\r\n) {\r\n const alpha = ((rgba.a * 255) | (1 << 8)).toString(16).slice(1)\r\n\r\n const hex =\r\n ((rgba.r * 255) | (1 << 8)).toString(16).slice(1) +\r\n ((rgba.g * 255) | (1 << 8)).toString(16).slice(1) +\r\n ((rgba.b * 255) | (1 << 8)).toString(16).slice(1) +\r\n (removeAlphaIfOpaque && alpha === 'ff' ? '' : alpha)\r\n\r\n return `#${hex}`\r\n}\r\n\r\n// TODO: We should add a decorate property to the propConfig too.\r\n// Right now, each place that has anything to do with a color is individually\r\n// responsible for defining a toString() function on the object it returns.\r\nexport const decorateRgba = memoizeFn((rgba: Rgba) => {\r\n const obj = {\r\n ...rgba,\r\n // toString: () => rgba2hex(rgba),\r\n }\r\n Object.defineProperty(obj, 'toString', {\r\n value: () => rgba2hex(rgba),\r\n enumerable: false,\r\n writable: false,\r\n configurable: false,\r\n })\r\n return obj\r\n})\r\n\r\nexport function clampRgba(rgba: Rgba) {\r\n return Object.fromEntries(\r\n Object.entries(rgba).map(([key, value]) => [key, clamp(value, 0, 1)]),\r\n ) as Rgba\r\n}\r\n\r\nexport function linearSrgbToSrgb(rgba: Rgba) {\r\n function compress(x: number) {\r\n // This looks funky because sRGB uses a linear scale below 0.0031308 in\r\n // order to avoid an infinite slope, while trying to approximate gamma 2.2\r\n // as closely as possible, hence the branching and the 2.4 exponent.\r\n if (x >= 0.0031308) return 1.055 * x ** (1.0 / 2.4) - 0.055\r\n else return 12.92 * x\r\n }\r\n return clampRgba({\r\n r: compress(rgba.r),\r\n g: compress(rgba.g),\r\n b: compress(rgba.b),\r\n a: rgba.a,\r\n })\r\n}\r\n\r\nexport function srgbToLinearSrgb(rgba: Rgba) {\r\n function expand(x: number) {\r\n if (x >= 0.04045) return ((x + 0.055) / (1 + 0.055)) ** 2.4\r\n else return x / 12.92\r\n }\r\n return {\r\n r: expand(rgba.r),\r\n g: expand(rgba.g),\r\n b: expand(rgba.b),\r\n a: rgba.a,\r\n }\r\n}\r\n\r\nexport function linearSrgbToOklab(rgba: Rgba) {\r\n let l = 0.4122214708 * rgba.r + 0.5363325363 * rgba.g + 0.0514459929 * rgba.b\r\n let m = 0.2119034982 * rgba.r + 0.6806995451 * rgba.g + 0.1073969566 * rgba.b\r\n let s = 0.0883024619 * rgba.r + 0.2817188376 * rgba.g + 0.6299787005 * rgba.b\r\n\r\n let l_ = Math.cbrt(l)\r\n let m_ = Math.cbrt(m)\r\n let s_ = Math.cbrt(s)\r\n\r\n return {\r\n L: 0.2104542553 * l_ + 0.793617785 * m_ - 0.0040720468 * s_,\r\n a: 1.9779984951 * l_ - 2.428592205 * m_ + 0.4505937099 * s_,\r\n b: 0.0259040371 * l_ + 0.7827717662 * m_ - 0.808675766 * s_,\r\n alpha: rgba.a,\r\n }\r\n}\r\n\r\nexport function oklabToLinearSrgb(laba: Laba) {\r\n let l_ = laba.L + 0.3963377774 * laba.a + 0.2158037573 * laba.b\r\n let m_ = laba.L - 0.1055613458 * laba.a - 0.0638541728 * laba.b\r\n let s_ = laba.L - 0.0894841775 * laba.a - 1.291485548 * laba.b\r\n\r\n let l = l_ * l_ * l_\r\n let m = m_ * m_ * m_\r\n let s = s_ * s_ * s_\r\n\r\n return {\r\n r: +4.0767416621 * l - 3.3077115913 * m + 0.2309699292 * s,\r\n g: -1.2684380046 * l + 2.6097574011 * m - 0.3413193965 * s,\r\n b: -0.0041960863 * l - 0.7034186147 * m + 1.707614701 * s,\r\n a: laba.alpha,\r\n }\r\n}\r\n\r\n// let's not export the types, as they're duplicates of those in core/types/public\r\ntype Rgba = {\r\n r: number\r\n g: number\r\n b: number\r\n a: number\r\n}\r\n\r\ntype Laba = {\r\n L: number\r\n a: number\r\n b: number\r\n alpha: number\r\n}\r\n\r\n/**\r\n * Returns a hex string in the eight-value syntax\r\n */\r\nfunction _hexInEightValueSyntax(hex: string): string {\r\n switch (hex.length) {\r\n case 3:\r\n return `${hex.repeat(2)}ff`\r\n case 4:\r\n const rgb = hex.substr(0, 3)\r\n const alpha = hex[3]\r\n return `${rgb.repeat(2)}${alpha.repeat(2)}`\r\n case 6:\r\n return `${hex}ff`\r\n }\r\n\r\n return hex\r\n}\r\n", "import type {Pointer} from '@encorejs/dataverse'\r\n\r\n/** For `any`s that aren't meant to stay `any`*/\r\nexport type $FixMe = any\r\n/** For `any`s that we don't care about */\r\nexport type $IntentionalAny = any\r\n\r\nexport type $____FixmeStudio = any\r\n\r\n/** temporary any type until we move all of studio's types to core */\r\n\r\nexport type PathToProp = Array<string | number>\r\n\r\n/**\r\n * This is equivalent to `Partial<Record<Key, V>>` being used to describe a sort of Map\r\n * where the keys might not have values.\r\n *\r\n * We do not use `Map`s or `Set`s, because they add complexity with converting to\r\n * `JSON.stringify` + pointer types.\r\n */\r\nexport type StrictRecord<Key extends string, V> = {[K in Key]?: V}\r\n\r\nexport type IRange = IPlaybackRange\r\n\r\n/**\r\n * Using a symbol, we can sort of add unique properties to arbitrary other types.\r\n * So, we use this to our advantage to add a \"marker\" of information to strings using\r\n * the {@link Nominal} type.\r\n *\r\n * Can be used with keys in pointers.\r\n * This identifier shows in the expanded {@link Nominal} as `string & {[nominal]:\"SequenceTrackId\"}`,\r\n * So, we're opting to keeping the identifier short.\r\n */\r\nconst nominal = Symbol()\r\n\r\n/**\r\n * This creates an \"opaque\"/\"nominal\" type.\r\n *\r\n * Our primary use case is to be able to use with keys in pointers.\r\n *\r\n * Numbers cannot be added together if they are \"nominal\"\r\n *\r\n * See {@link nominal} for more details.\r\n */\r\ntype Nominal<N extends string> = string & {[nominal]: N}\r\n\r\n/**\r\n * Represents the `x` or `y` value of getBoundingClientRect().\r\n * In other words, represents a distance from 0,0 in screen space.\r\n */\r\nexport type PositionInScreenSpace = number\r\n\r\nexport type VoidFn = () => void\r\n\r\nexport type Asset = {type: 'image'; id: string | undefined}\r\nexport type File = {type: 'file'; id: string | undefined}\r\n\r\n/**\r\n * A `SerializableMap` is a plain JS object that can be safely serialized to JSON.\r\n */\r\nexport type SerializableMap<\r\n Primitives extends SerializablePrimitive = SerializablePrimitive,\r\n> = {[Key in string]?: SerializableValue<Primitives>}\r\n\r\n/*\r\n * TODO: For now the rgba primitive type is hard-coded. We should make it proper.\r\n * What instead we should do is somehow exclude objects where\r\n * object.type !== 'compound'. One way to do this would be\r\n *\r\n * type SerializablePrimitive<T> = T extends {type: 'compound'} ? never : T;\r\n *\r\n * const badStuff = {\r\n * type: 'compound',\r\n * foo: 3,\r\n * } as const\r\n *\r\n * const goodStuff = {\r\n * type: 'literallyanythingelse',\r\n * foo: 3,\r\n * } as const\r\n *\r\n * function serializeStuff<T>(giveMeStuff: SerializablePrimitive<T>) {\r\n * // ...\r\n * }\r\n *\r\n * serializeStuff(badStuff)\r\n * serializeStuff(goodStuff)\r\n *\r\n * However this wouldn't protect against other unserializable stuff, or nested\r\n * unserializable stuff, since using mapped types seem to break it for some reason.\r\n *\r\n * TODO: Consider renaming to `SerializableSimple` if this should be aligned with \"simple props\".\r\n */\r\nexport type SerializablePrimitive =\r\n | string\r\n | number\r\n | boolean\r\n | {r: number; g: number; b: number; a: number}\r\n | Asset\r\n\r\n/**\r\n * This type represents all values that can be safely serialized.\r\n * Also, it's notable that this type is compatible for dataverse pointer traversal (everything\r\n * is path accessible [e.g. `a.b.c`]).\r\n *\r\n * One example usage is for keyframe values or static overrides such as `Rgba`, `string`, `number`, and \"compound values\".\r\n */\r\nexport type SerializableValue<\r\n Primitives extends SerializablePrimitive = SerializablePrimitive,\r\n> = Primitives | SerializableMap\r\n\r\nexport type DeepPartialOfSerializableValue<T extends SerializableValue> =\r\n T extends SerializableMap\r\n ? {\r\n [K in keyof T]?: DeepPartialOfSerializableValue<\r\n Exclude<T[K], undefined>\r\n >\r\n }\r\n : T\r\n\r\nexport type KeyframeId = Nominal<'KeyframeId'>\r\nexport type SequenceTrackId = Nominal<'SequenceTrackId'>\r\nexport type ObjectAddressKey = Nominal<'ObjectAddressKey'>\r\nexport type ProjectId = Nominal<'ProjectId'>\r\nexport type SheetId = Nominal<'SheetId'>\r\nexport type SheetInstanceId = Nominal<'SheetInstanceId'>\r\nexport type PaneInstanceId = Nominal<'PaneInstanceId'>\r\nexport type SequenceMarkerId = Nominal<'SequenceMarkerId'>\r\n\r\n/**\r\n * NOTE: **INTERNAL and UNSTABLE** - This _WILL_ break between minor versions.\r\n *\r\n * This type represents the object returned by `studio.createContnentOfSaveFile()`. It's\r\n * meant for advanced users who want to interact with the state of projects. In the vast\r\n * majority of cases, you __should not__ use this type. Either an API for your use-case\r\n * already exists, or you should open an issue on GitHub: https://github.com/ikanishakm/encore/issues\r\n *\r\n */\r\nexport type __UNSTABLE_Project_OnDiskState = unknown\r\n\r\n/**\r\n * Addresses are used to identify projects, sheets, objects, and other things.\r\n *\r\n * For example, a project's address looks like `{projectId: 'my-project'}`, and a sheet's\r\n * address looks like `{projectId: 'my-project', sheetId: 'my-sheet'}`.\r\n *\r\n * As you see, a Sheet's address is a superset of a Project's address. This is so that we can\r\n * use the same address type for both. All addresses follow the same rule. An object's address\r\n * extends its sheet's address, which extends its project's address.\r\n *\r\n * For example, generating an object's address from a sheet's address is as simple as `{...sheetAddress, objectId: 'my-object'}`.\r\n *\r\n * Also, if you need the projectAddress of an object, you can just re-use the object's address:\r\n * `aFunctionThatRequiresProjectAddress(objectAddress)`.\r\n */\r\n\r\n/**\r\n * Represents the address to a project\r\n */\r\nexport interface ProjectAddress {\r\n projectId: ProjectId\r\n}\r\n\r\n/**\r\n * Represents the address to a specific instance of a Sheet\r\n *\r\n * @example\r\n * ```ts\r\n * const sheet = project.sheet('a sheet', 'some instance id')\r\n * sheet.address.sheetId === 'a sheet'\r\n * sheet.address.sheetInstanceId === 'sheetInstanceId'\r\n * ```\r\n *\r\n * See {@link WithoutSheetInstance} for a type that doesn't include the sheet instance id.\r\n */\r\nexport interface SheetAddress extends ProjectAddress {\r\n sheetId: SheetId\r\n sheetInstanceId: SheetInstanceId\r\n}\r\n\r\n/**\r\n * Removes `sheetInstanceId` from an address, making it refer to\r\n * all instances of a certain `sheetId`.\r\n *\r\n * See {@link SheetAddress} for a type that includes the sheet instance id.\r\n */\r\nexport type WithoutSheetInstance<T extends SheetAddress> = Omit<\r\n T,\r\n 'sheetInstanceId'\r\n>\r\n\r\nexport type SheetInstanceOptional<T extends SheetAddress> =\r\n WithoutSheetInstance<T> & {sheetInstanceId?: SheetInstanceId | undefined}\r\n\r\n/**\r\n * Represents the address to a Sheet's Object.\r\n *\r\n * It includes the sheetInstance, so it's specific to a single instance of a sheet. If you\r\n * would like an address that doesn't include the sheetInstance, use `WithoutSheetInstance<SheetObjectAddress>`.\r\n */\r\nexport interface SheetObjectAddress extends SheetAddress {\r\n /**\r\n * The key of the object.\r\n *\r\n * @example\r\n * ```ts\r\n * const obj = sheet.object('foo', {})\r\n * obj.address.objectKey === 'foo'\r\n * ```\r\n */\r\n objectKey: ObjectAddressKey\r\n}\r\n\r\n/**\r\n * Represents the path to a certain prop of an object\r\n */\r\nexport interface PropAddress extends SheetObjectAddress {\r\n pathToProp: PathToProp\r\n}\r\n\r\n/**\r\n * Represents the address of a certain sequence of a sheet.\r\n *\r\n * Since currently sheets are single-sequence only, `sequenceName` is always `'default'` for now.\r\n */\r\nexport interface SequenceAddress extends SheetAddress {\r\n sequenceName: string\r\n}\r\n\r\n/**\r\n * A project's config object (currently the only point of configuration is the project's state)\r\n */\r\n\r\nexport type IProjectConfig = {\r\n /**\r\n * The state of the project, as [exported](https://www.theatrejs.com/docs/latest/manual/projects#state) by the studio.\r\n */\r\n state?: any // intentional\r\n assets?: {\r\n baseUrl?: string\r\n }\r\n}\r\n/**\r\n * A Encore project\r\n */\r\n\r\nexport interface IProject {\r\n readonly type: 'Theatre_Project_PublicAPI'\r\n /**\r\n * If `@encorejs/studio` is used, this promise would resolve when studio has loaded\r\n * the state of the project into memory.\r\n *\r\n * If `@encorejs/studio` is not used, this promise is already resolved.\r\n */\r\n readonly ready: Promise<void>\r\n /**\r\n * Shows whether the project is ready to be used.\r\n * Better to use {@link IProject.ready}, which is a promise that would\r\n * resolve when the project is ready.\r\n */\r\n readonly isReady: boolean\r\n /**\r\n * The project's address\r\n */\r\n readonly address: ProjectAddress\r\n\r\n /**\r\n * Creates a Sheet under the project\r\n * @param sheetId - Sheets are identified by their `sheetId`, which must be a string longer than 3 characters\r\n * @param instanceId - Optionally provide an `instanceId` if you want to create multiple instances of the same Sheet\r\n * @returns The newly created Sheet\r\n *\r\n * **Docs: https://www.theatrejs.com/docs/latest/manual/sheets**\r\n */\r\n sheet(sheetId: string, instanceId?: string): ISheet\r\n\r\n /**\r\n * Returns the URL for an asset.\r\n *\r\n * @param asset - The asset to get the URL for\r\n * @returns The URL for the asset, or `undefined` if the asset is not found\r\n */\r\n getAssetUrl(asset: Asset | File): string | undefined\r\n}\r\n\r\nexport interface ISheet {\r\n /**\r\n * All sheets have `sheet.type === 'Theatre_Sheet_PublicAPI'`\r\n */\r\n readonly type: 'Theatre_Sheet_PublicAPI'\r\n\r\n /**\r\n * The Project this Sheet belongs to\r\n */\r\n readonly project: IProject\r\n\r\n /**\r\n * The address of the Sheet\r\n */\r\n readonly address: SheetAddress\r\n\r\n /**\r\n * Creates a child object for the sheet\r\n *\r\n * **Docs: https://www.theatrejs.com/docs/latest/manual/objects**\r\n *\r\n * @param key - Each object is identified by a key, which is a non-empty string\r\n * @param props - The props of the object. See examples\r\n * @param options - (Optional) Provide `{reconfigure: true}` to reconfigure an existing object, or `{actions: { ... }}` to add custom buttons to the UI. Read the example below for details.\r\n *\r\n * @returns An Object\r\n *\r\n * @example\r\n * Usage:\r\n * ```ts\r\n * // Create an object named \"a unique key\" with no props\r\n * const obj = sheet.object(\"a unique key\", {})\r\n * obj.address.objectKey // \"a unique key\"\r\n *\r\n *\r\n * // Create an object with {x: 0}\r\n * const obj = sheet.object(\"obj\", {x: 0})\r\n * obj.value.x // returns 0 or the current number that the user has set\r\n *\r\n * // Create an object with nested props\r\n * const obj = sheet.object(\"obj\", {position: {x: 0, y: 0}})\r\n * obj.value.position // {x: 0, y: 0}\r\n *\r\n * // you can also reconfigure an existing object:\r\n * const obj = sheet.object(\"obj\", {foo: 0})\r\n * console.log(object.value.foo) // prints 0\r\n *\r\n * const obj2 = sheet.object(\"obj\", {bar: 0}, {reconfigure: true})\r\n * console.log(object.value.foo) // prints undefined, since we've removed this prop via reconfiguring the object\r\n * console.log(object.value.bar) // prints 0, since we've introduced this prop by reconfiguring the object\r\n *\r\n * assert(obj === obj2) // passes, because reconfiguring the object returns the same object\r\n *\r\n * // you can add custom actions to an object:\r\n * const obj = sheet.object(\"obj\", {foo: 0}, {\r\n * actions: {\r\n * // This will display a button in the UI that will reset the value of `foo` to 0\r\n * Reset: () => {\r\n * studio.transaction((api) => {\r\n * api.set(obj.props.foo, 0)\r\n * })\r\n * }\r\n * }\r\n * })\r\n * ```\r\n */\r\n object<Props extends UnknownShorthandCompoundProps>(\r\n key: string,\r\n props: Props,\r\n options?: {\r\n reconfigure?: boolean\r\n __actions__THIS_API_IS_UNSTABLE_AND_WILL_CHANGE_IN_THE_NEXT_VERSION?: SheetObjectActionsConfig\r\n },\r\n ): ISheetObject<Props>\r\n\r\n /**\r\n * Detaches a previously created child object from the sheet.\r\n *\r\n * If you call `sheet.object(key)` again with the same `key`, the object's values of the object's\r\n * props WILL NOT be reset to their initial values.\r\n *\r\n * @param key - The `key` of the object previously given to `sheet.object(key, ...)`.\r\n */\r\n detachObject(key: string): void\r\n\r\n /**\r\n * The Sequence of this Sheet\r\n */\r\n readonly sequence: ISequence\r\n}\r\n\r\nexport type SheetObjectPropTypeConfig =\r\n PropTypeConfig_Compound<UnknownValidCompoundProps>\r\n\r\nexport type SheetObjectAction = (object: ISheetObject) => void\r\n\r\nexport type SheetObjectActionsConfig = Record<string, SheetObjectAction>\r\n\r\nexport interface ISheetObject<\r\n Props extends UnknownShorthandCompoundProps = UnknownShorthandCompoundProps,\r\n> {\r\n /**\r\n * All Objects will have `object.type === 'Theatre_SheetObject_PublicAPI'`\r\n */\r\n readonly type: 'Theatre_SheetObject_PublicAPI'\r\n\r\n /**\r\n * The current values of the props.\r\n *\r\n * @example\r\n * Usage:\r\n * ```ts\r\n * const obj = sheet.object(\"obj\", {x: 0})\r\n * console.log(obj.value.x) // prints 0 or the current numeric value\r\n * ```\r\n *\r\n * Future: Notice that if the user actually changes the Props config for one of the\r\n * properties, then this type can't be guaranteed accurrate.\r\n * * Right now the user can't change prop configs, but we'll probably enable that\r\n * functionality later via (`object.overrideConfig()`). We need to educate the\r\n * user that they can't rely on static types to know the type of object.value.\r\n */\r\n readonly value: PropsValue<Props>\r\n\r\n /**\r\n * A Pointer to the props of the object.\r\n *\r\n * More documentation soon.\r\n */\r\n readonly props: Pointer<this['value']>\r\n\r\n /**\r\n * The instance of Sheet the Object belongs to\r\n */\r\n readonly sheet: ISheet\r\n\r\n /**\r\n * The Project the project belongs to\r\n */\r\n readonly project: IProject\r\n\r\n /**\r\n * An object representing the address of the Object\r\n */\r\n readonly address: SheetObjectAddress\r\n\r\n /**\r\n * Calls `fn` every time the value of the props change.\r\n *\r\n * @param fn - The callback is called every time the value of the props change, plus once at the beginning.\r\n * @param rafDriver - (optional) The `rafDriver` to use. Learn how to use `rafDriver`s [from the docs](https://www.theatrejs.com/docs/latest/manual/advanced#rafdrivers).\r\n * @returns an Unsubscribe function\r\n *\r\n * @example\r\n * Usage:\r\n * ```ts\r\n * const obj = sheet.object(\"Box\", {position: {x: 0, y: 0}})\r\n * const div = document.getElementById(\"box\")\r\n *\r\n * const unsubscribe = obj.onValuesChange((newValues) => {\r\n * div.style.left = newValues.position.x + 'px'\r\n * div.style.top = newValues.position.y + 'px'\r\n * })\r\n *\r\n * // you can call unsubscribe() to stop listening to changes\r\n * ```\r\n */\r\n onValuesChange(\r\n fn: (values: this['value']) => void,\r\n rafDriver?: IRafDriver,\r\n ): VoidFn\r\n\r\n /**\r\n * Sets the initial value of the object. This value overrides the default\r\n * values defined in the prop types, but would itself be overridden if the user\r\n * overrides it in the UI with a static or animated value.\r\n *\r\n * @example\r\n * Usage:\r\n * ```ts\r\n * const obj = sheet.object(\"obj\", {position: {x: 0, y: 0}})\r\n *\r\n * obj.value // {position: {x: 0, y: 0}}\r\n *\r\n * // here, we only override position.x\r\n * obj.initialValue = {position: {x: 2}}\r\n *\r\n * obj.value // {position: {x: 2, y: 0}}\r\n * ```\r\n */\r\n set initialValue(value: DeepPartialOfSerializableValue<this['value']>)\r\n}\r\n\r\nexport interface IAttachAudioArgs {\r\n /**\r\n * Either a URL to the audio file (eg \"http://localhost:3000/audio.mp3\") or an instance of AudioBuffer\r\n */\r\n source: string | AudioBuffer\r\n /**\r\n * An optional AudioContext. If not provided, one will be created.\r\n */\r\n audioContext?: AudioContext\r\n /**\r\n * An AudioNode to feed the audio into. Will use audioContext.destination if not provided.\r\n */\r\n destinationNode?: AudioNode\r\n}\r\n\r\nexport type KeyframeType = 'bezier' | 'hold'\r\n\r\nexport type BasicKeyframe = {\r\n id: KeyframeId\r\n /** The `value` is the raw value type such as `Rgba` or `number`. See {@link SerializableValue} */\r\n // Future: is there another layer that we may need to be able to store older values on the\r\n // case of a prop config change? As keyframes can technically have their propConfig changed.\r\n value: SerializableValue\r\n position: number\r\n handles: [leftX: number, leftY: number, rightX: number, rightY: number]\r\n connectedRight: boolean\r\n // defaults to 'bezier' to support project states made with theatre0.5.1 or earlier\r\n type?: KeyframeType\r\n}\r\n\r\nexport interface ISequence {\r\n readonly type: 'Theatre_Sequence_PublicAPI'\r\n\r\n /**\r\n * Starts playback of a sequence.\r\n * Returns a promise that either resolves to true when the playback completes,\r\n * or resolves to false if playback gets interrupted (for example by calling sequence.pause())\r\n *\r\n * @returns A promise that resolves when the playback is finished, or rejects if interruped\r\n *\r\n * @example\r\n * Usage:\r\n * ```ts\r\n * // plays the sequence from the current position to sequence.length\r\n * sheet.sequence.play()\r\n *\r\n * // plays the sequence at 2.4x speed\r\n * sheet.sequence.play({rate: 2.4})\r\n *\r\n * // plays the sequence from second 1 to 4\r\n * sheet.sequence.play({range: [1, 4]})\r\n *\r\n * // plays the sequence 4 times\r\n * sheet.sequence.play({iterationCount: 4})\r\n *\r\n * // plays the sequence in reverse\r\n * sheet.sequence.play({direction: 'reverse'})\r\n *\r\n * // plays the sequence back and forth forever (until interrupted)\r\n * sheet.sequence.play({iterationCount: Infinity, direction: 'alternateReverse})\r\n *\r\n * // plays the sequence and logs \"done\" once playback is finished\r\n * sheet.sequence.play().then(() => console.log('done'))\r\n * ```\r\n */\r\n play(conf?: {\r\n /**\r\n * The number of times the animation must run. Must be an integer larger\r\n * than 0. Defaults to 1. Pick Infinity to run forever\r\n */\r\n iterationCount?: number\r\n /**\r\n * Limits the range to be played. Default is [0, sequence.length]\r\n */\r\n range?: IPlaybackRange\r\n /**\r\n * The playback rate. Defaults to 1. Choosing 2 would play the animation\r\n * at twice the speed.\r\n */\r\n rate?: number\r\n /**\r\n * The direction of the playback. Similar to CSS's animation-direction\r\n */\r\n direction?: IPlaybackDirection\r\n\r\n /**\r\n * Optionally provide a rafDriver to use for the playback. It'll default to\r\n * the core driver if not provided, which is a `requestAnimationFrame()` driver.\r\n * Learn how to use `rafDriver`s [from the docs](https://www.theatrejs.com/docs/latest/manual/advanced#rafdrivers).\r\n */\r\n rafDriver?: IRafDriver\r\n }): Promise<boolean>\r\n\r\n /**\r\n * Pauses the currently playing animation\r\n */\r\n pause(): void\r\n\r\n /**\r\n * The current position of the playhead.\r\n * In a time-based sequence, this represents the current time in seconds.\r\n */\r\n position: number\r\n\r\n /**\r\n * A Pointer to the sequence's inner state.\r\n *\r\n * @remarks\r\n * As with any Pointer, you can use this with {@link onChange | onChange()} to listen to its value changes\r\n * or with {@link val | val()} to read its current value.\r\n *\r\n * @example Usage\r\n * ```ts\r\n * import {onChange, val} from '@encorejs/core'\r\n *\r\n * // let's assume `sheet` is a sheet\r\n * const sequence = sheet.sequence\r\n *\r\n * onChange(sequence.pointer.length, (len) => {\r\n * console.log(\"Length of the sequence changed to:\", len)\r\n * })\r\n *\r\n * onChange(sequence.pointer.position, (position) => {\r\n * console.log(\"Position of the sequence changed to:\", position)\r\n * })\r\n *\r\n * onChange(sequence.pointer.playing, (playing) => {\r\n * console.log(playing ? 'playing' : 'paused')\r\n * })\r\n *\r\n * // we can also read the current value of the pointer\r\n * console.log('current length is', val(sequence.pointer.length))\r\n * ```\r\n */\r\n pointer: Pointer<{\r\n playing: boolean\r\n length: number\r\n position: number\r\n }>\r\n\r\n /**\r\n * Given a property, returns a list of keyframes that affect that property.\r\n *\r\n * @example\r\n * Usage:\r\n * ```ts\r\n * // let's assume `sheet` is a sheet and obj is one of its objects\r\n * const keyframes = sheet.sequence.__experimental_getKeyframes(obj.pointer.x)\r\n * console.log(keyframes) // an array of keyframes\r\n * ```\r\n */\r\n __experimental_getKeyframes(prop: Pointer<{}>): BasicKeyframe[]\r\n\r\n /**\r\n * Attaches an audio source to the sequence. Playing the sequence automatically\r\n * plays the audio source and their times are kept in sync.\r\n *\r\n * @returns A promise that resolves once the audio source is loaded and decoded\r\n *\r\n * Learn more [here](https://www.theatrejs.com/docs/latest/manual/audio).\r\n *\r\n * @example\r\n * Usage:\r\n * ```ts\r\n * // Loads and decodes audio from the URL and then attaches it to the sequence\r\n * await sheet.sequence.attachAudio({source: \"http://localhost:3000/audio.mp3\"})\r\n * sheet.sequence.play()\r\n *\r\n * // Providing your own AudioAPI Context, destination, etc\r\n * const audioContext: AudioContext = {...} // create an AudioContext using the Audio API\r\n * const audioBuffer: AudioBuffer = {...} // create an AudioBuffer\r\n * const destinationNode = audioContext.destination\r\n *\r\n * await sheet.sequence.attachAudio({source: audioBuffer, audioContext, destinationNode})\r\n * ```\r\n *\r\n * Note: It's better to provide the `audioContext` rather than allow Encore to create it.\r\n * That's because some browsers [suspend the audioContext](https://developer.chrome.com/blog/autoplay/#webaudio)\r\n * unless it's initiated by a user gesture, like a click. If that happens, Encore will\r\n * wait for a user gesture to resume the audioContext. But that's probably not an\r\n * optimal user experience. It is better to provide a button or some other UI element\r\n * to communicate to the user that they have to initiate the animation.\r\n *\r\n * @example\r\n * Example:\r\n * ```ts\r\n * // html: <button id=\"#start\">start</button>\r\n * const button = document.getElementById('start')\r\n *\r\n * button.addEventListener('click', async () => {\r\n * const audioContext = ...\r\n * await sheet.sequence.attachAudio({audioContext, source: '...'})\r\n * sheet.sequence.play()\r\n * })\r\n * ```\r\n */\r\n attachAudio(args: IAttachAudioArgs): Promise<{\r\n /**\r\n * An {@link https://developer.mozilla.org/en-US/docs/Web/API/AudioBuffer | AudioBuffer}.\r\n * If `args.source` is a URL, then `decodedBuffer` would be the result\r\n * of {@link https://developer.mozilla.org/en-US/docs/Web/API/BaseAudioContext/decodeAudioData | audioContext.decodeAudioData()}\r\n * on the audio file at that URL.\r\n *\r\n * If `args.source` is an `AudioBuffer`, then `decodedBuffer` would be equal to `args.source`\r\n */\r\n decodedBuffer: AudioBuffer\r\n /**\r\n * The `AudioContext`. It is either equal to `source.audioContext` if it is provided, or\r\n * one that's created on the fly.\r\n */\r\n audioContext: AudioContext\r\n /**\r\n * Equals to either `args.destinationNode`, or if none is provided, it equals `audioContext.destinationNode`.\r\n *\r\n * See `gainNode` for more info.\r\n */\r\n destinationNode: AudioNode\r\n\r\n /**\r\n * This is an intermediate GainNode that Encore feeds its audio to. It is by default\r\n * connected to destinationNode, but you can disconnect the gainNode and feed it to your own graph.\r\n *\r\n * @example\r\n * For example:\r\n * ```ts\r\n * const {gainNode, audioContext} = await sequence.attachAudio({source: '/audio.mp3'})\r\n * // disconnect the gainNode (at this point, the sequence's audio track won't be audible)\r\n * gainNode.disconnect()\r\n * // create our own gain node\r\n * const lowerGain = audioContext.createGain()\r\n * // lower its volume to 10%\r\n * lowerGain.gain.setValueAtTime(0.1, audioContext.currentTime)\r\n * // feed the sequence's audio to our lowered gainNode\r\n * gainNode.connect(lowerGain)\r\n * // feed the lowered gainNode to the audioContext's destination\r\n * lowerGain.connect(audioContext.destination)\r\n * // now audio will be audible, with 10% the volume\r\n * ```\r\n */\r\n gainNode: GainNode\r\n }>\r\n}\r\n\r\nexport type IPlaybackRange = [from: number, to: number]\r\n\r\nexport type IPlaybackDirection =\r\n | 'normal'\r\n | 'reverse'\r\n | 'alternate'\r\n | 'alternateReverse'\r\n\r\nexport interface IRafDriver {\r\n /**\r\n * All raf derivers have have `driver.type === 'Theatre_RafDriver_PublicAPI'`\r\n */\r\n readonly type: 'Theatre_RafDriver_PublicAPI'\r\n /**\r\n * The name of the driver. This is used for debugging purposes.\r\n */\r\n name: string\r\n /**\r\n * The id of the driver. This is used for debugging purposes.\r\n * It's guaranteed to be unique.\r\n */\r\n id: number\r\n /**\r\n * This is called by the driver when it's time to tick forward.\r\n * The time param is of the same type returned by `performance.now()`.\r\n */\r\n tick: (time: number) => void\r\n}\r\n\r\n/**\r\n * A linear interpolator for a certain value type.\r\n *\r\n * @param left - the value to interpolate from (beginning)\r\n * @param right - the value to interpolate to (end)\r\n * @param progression - the amount of progression. Starts at 0 and ends at 1. But could overshoot in either direction\r\n *\r\n * @example\r\n * ```ts\r\n * const numberInterpolator: Interpolator<number> = (left, right, progression) => left + progression * (right - left)\r\n *\r\n * numberInterpolator(-50, 50, 0.5) === 0\r\n * numberInterpolator(-50, 50, 0) === -50\r\n * numberInterpolator(-50, 50, 1) === 50\r\n * numberInterpolator(-50, 50, 2) === 150 // overshoot\r\n * ```\r\n */\r\nexport type Interpolator<T> = (left: T, right: T, progression: number) => T\r\n\r\nexport interface IBasePropType<\r\n LiteralIdentifier extends string,\r\n ValueType,\r\n DeserializeType = ValueType,\r\n> {\r\n /**\r\n * Each prop config has a string literal identifying it. For example,\r\n * `assert.equal(t.number(10).type, 'number')`\r\n */\r\n type: LiteralIdentifier\r\n /**\r\n * the `valueType` is only used by typescript. It won't be present in runtime.\r\n */\r\n valueType: ValueType\r\n [propTypeSymbol]: 'TheatrePropType'\r\n /**\r\n * Each prop type may be given a custom label instead of the name of the sub-prop\r\n * it is in.\r\n *\r\n * @example\r\n * ```ts\r\n * const position = {\r\n * x: t.number(0), // label would be 'x'\r\n * y: t.number(0, {label: 'top'}) // label would be 'top'\r\n * }\r\n * ```\r\n */\r\n label: string | undefined\r\n default: ValueType\r\n /**\r\n * Each prop config has a `deserializeAndSanitize()` function that deserializes and sanitizes\r\n * any js value into one that is acceptable by this prop config, or `undefined`.\r\n *\r\n * As a rule, the value returned by this function should not hold any reference to `json` or any\r\n * other value referenced by the descendent props of `json`. This is to ensure that json values\r\n * controlled by the user can never change the values in the store. See `deserializeAndSanitize()` in\r\n * `t.compound()` or `t.rgba()` as examples.\r\n *\r\n * The `DeserializeType` is usually equal to `ValueType`. That is the case with\r\n * all simple prop configs, such as `number`, `string`, or `rgba`. However, composite\r\n * configs such as `compound` or `enum` may deserialize+sanitize into a partial value. For example,\r\n * a prop config of `t.compound({x: t.number(0), y: t.number(0)})` may deserialize+sanitize into `{x: 10}`.\r\n * This behavior is used by {@link SheetObject.getValues} to replace the missing sub-props\r\n * with their default value.\r\n *\r\n * Admittedly, this partial deserialization behavior is not what the word \"deserialize\"\r\n * typically implies in most codebases, so feel free to change this name into a more\r\n * appropriate one.\r\n *\r\n * Additionally, returning an `undefined` allows {@link SheetObject.getValues} to\r\n * replace the `undefined` with the default value of that prop.\r\n */\r\n deserializeAndSanitize: (json: unknown) => undefined | DeserializeType\r\n}\r\n\r\ninterface ISimplePropType<LiteralIdentifier extends string, ValueType>\r\n extends IBasePropType<LiteralIdentifier, ValueType, ValueType> {\r\n interpolate: Interpolator<ValueType>\r\n}\r\n\r\nexport interface PropTypeConfig_Number\r\n extends ISimplePropType<'number', number> {\r\n range?: [min: number, max: number]\r\n nudgeFn: NumberNudgeFn\r\n /**\r\n * See {@link defaultNumberNudgeFn} to see how `nudgeMultiplier` is treated.\r\n */\r\n nudgeMultiplier: number | undefined\r\n}\r\n\r\nexport type NumberNudgeFn = (p: {\r\n deltaX: number\r\n deltaFraction: number\r\n magnitude: number\r\n config: PropTypeConfig_Number\r\n}) => number\r\n\r\nexport interface PropTypeConfig_Boolean\r\n extends ISimplePropType<'boolean', boolean> {}\r\n\r\nexport interface PropTypeConfig_String\r\n extends ISimplePropType<'string', string> {}\r\n\r\nexport interface PropTypeConfig_StringLiteral<T extends string>\r\n extends ISimplePropType<'stringLiteral', T> {\r\n valuesAndLabels: Record<T, string>\r\n as: 'menu' | 'switch'\r\n}\r\n\r\nexport interface PropTypeConfig_Rgba extends ISimplePropType<'rgba', Rgba> {}\r\n\r\nexport interface PropTypeConfig_Image extends ISimplePropType<'image', Asset> {}\r\nexport interface PropTypeConfig_File extends ISimplePropType<'file', File> {}\r\n\r\ntype DeepPartialCompound<Props extends UnknownValidCompoundProps> = {\r\n [K in keyof Props]?: DeepPartial<Props[K]>\r\n}\r\n\r\ntype DeepPartial<Conf extends PropTypeConfig> =\r\n Conf extends PropTypeConfig_AllSimples\r\n ? Conf['valueType']\r\n : Conf extends PropTypeConfig_Compound<infer T>\r\n ? DeepPartialCompound<T>\r\n : never\r\n\r\nexport interface PropTypeConfig_Compound<\r\n Props extends UnknownValidCompoundProps,\r\n> extends IBasePropType<\r\n 'compound',\r\n {[K in keyof Props]: Props[K]['valueType']},\r\n DeepPartialCompound<Props>\r\n > {\r\n props: Record<keyof Props, PropTypeConfig>\r\n}\r\n\r\nexport interface PropTypeConfig_Enum extends IBasePropType<'enum', {}> {\r\n cases: Record<string, PropTypeConfig>\r\n defaultCase: string\r\n}\r\n\r\nexport type PropTypeConfig_AllSimples =\r\n | PropTypeConfig_Number\r\n | PropTypeConfig_Boolean\r\n | PropTypeConfig_String\r\n | PropTypeConfig_StringLiteral<$IntentionalAny>\r\n | PropTypeConfig_Rgba\r\n | PropTypeConfig_Image\r\n | PropTypeConfig_File\r\n\r\nexport type PropTypeConfig =\r\n | PropTypeConfig_AllSimples\r\n | PropTypeConfig_Compound<$IntentionalAny>\r\n | PropTypeConfig_Enum\r\n\r\nexport type UnknownValidCompoundProps = {\r\n [K in string]: PropTypeConfig\r\n}\r\n\r\n/**\r\n *\r\n * This does not include Rgba since Rgba does not have a predictable\r\n * object shape. We prefer to infer that compound props are described as\r\n * `Record<string, IShorthandProp>` for now.\r\n *\r\n * In the future, it might be reasonable to wrap these types up into something\r\n * which would allow us to differentiate between values at runtime\r\n * (e.g. `val.type = \"Rgba\"` vs `val.type = \"Compound\"` etc)\r\n */\r\ntype UnknownShorthandProp =\r\n | string\r\n | number\r\n | boolean\r\n | PropTypeConfig\r\n | UnknownShorthandCompoundProps\r\n\r\n/** Given an object like this, we have enough info to predict the compound prop */\r\nexport type UnknownShorthandCompoundProps = {\r\n [K in string]: UnknownShorthandProp\r\n}\r\n\r\nexport type ShorthandPropToLonghandProp<P extends UnknownShorthandProp> =\r\n P extends string\r\n ? PropTypeConfig_String\r\n : P extends number\r\n ? PropTypeConfig_Number\r\n : P extends boolean\r\n ? PropTypeConfig_Boolean\r\n : P extends PropTypeConfig\r\n ? P\r\n : P extends UnknownShorthandCompoundProps\r\n ? PropTypeConfig_Compound<\r\n ShorthandCompoundPropsToLonghandCompoundProps<P>\r\n >\r\n : never\r\n\r\nexport type ShorthandCompoundPropsToInitialValue<\r\n P extends UnknownShorthandCompoundProps,\r\n> = LonghandCompoundPropsToInitialValue<\r\n ShorthandCompoundPropsToLonghandCompoundProps<P>\r\n>\r\n\r\ntype LonghandCompoundPropsToInitialValue<P extends UnknownValidCompoundProps> =\r\n {\r\n [K in keyof P]: P[K]['valueType']\r\n }\r\n\r\nexport type PropsValue<P> = P extends UnknownValidCompoundProps\r\n ? LonghandCompoundPropsToInitialValue<P>\r\n : P extends UnknownShorthandCompoundProps\r\n ? LonghandCompoundPropsToInitialValue<\r\n ShorthandCompoundPropsToLonghandCompoundProps<P>\r\n >\r\n : never\r\n\r\nexport type ShorthandCompoundPropsToLonghandCompoundProps<\r\n P extends UnknownShorthandCompoundProps,\r\n> = {\r\n [K in keyof P]: ShorthandPropToLonghandProp<P[K]>\r\n}\r\n\r\nexport const propTypeSymbol = Symbol('TheatrePropType_Basic')\r\n\r\nexport type Rgba = {\r\n r: number\r\n g: number\r\n b: number\r\n a: number\r\n}\r\n\r\nexport type Laba = {\r\n L: number\r\n a: number\r\n b: number\r\n alpha: number\r\n}\r\n\r\nexport interface ITransactionAPI {\r\n /**\r\n * Set the value of a prop by its pointer. If the prop is sequenced, the value\r\n * will be a keyframe at the current sequence position.\r\n *\r\n * @example\r\n * Usage:\r\n * ```ts\r\n * const obj = sheet.object(\"box\", {x: 0, y: 0})\r\n * studio.transaction(({set}) => {\r\n * // set a specific prop's value\r\n * set(obj.props.x, 10) // New value is {x: 10, y: 0}\r\n * // values are set partially\r\n * set(obj.props, {y: 11}) // New value is {x: 10, y: 11}\r\n *\r\n * // this will error, as there is no such prop as 'z'\r\n * set(obj.props.z, 10)\r\n * })\r\n * ```\r\n * @param pointer - A Pointer, like object.props\r\n * @param value - The value to override the existing value. This is treated as a deep partial value.\r\n */\r\n set<V>(pointer: Pointer<V>, value: V): void\r\n /**\r\n * Unsets the value of a prop by its pointer.\r\n *\r\n * @example\r\n * Usage:\r\n * ```ts\r\n * const obj = sheet.object(\"box\", {x: 0, y: 0})\r\n * studio.transaction(({set}) => {\r\n * // set props.x to its default value\r\n * unset(obj.props.x)\r\n * // set all props to their default value\r\n * set(obj.props)\r\n * })\r\n * ```\r\n * @param pointer - A pointer, like object.props\r\n */\r\n unset<V>(pointer: Pointer<V>): void\r\n\r\n /**\r\n * EXPERIMENTAL API - this api may be removed without notice.\r\n *\r\n * Makes Theatre forget about this object. This means all the prop overrides and sequenced props\r\n * will be reset, and the object won't show up in the exported state.\r\n */\r\n __experimental_forgetObject(object: ISheetObject): void\r\n\r\n /**\r\n * EXPERIMENTAL API - this api may be removed without notice.\r\n *\r\n * Makes Theatre forget about this sheet.\r\n */\r\n __experimental_forgetSheet(sheet: ISheet): void\r\n\r\n /**\r\n * EXPERIMENTAL API - this api may be removed without notice.\r\n *\r\n * Sequences a track for the\r\n */\r\n __experimental_sequenceProp<V>(pointer: Pointer<V>): void\r\n}\r\n/**\r\n *\r\n */\r\nexport interface PaneClassDefinition {\r\n /**\r\n * Each pane has a `class`, which is a string.\r\n */\r\n class: string\r\n // /**\r\n // * A react component that renders the content of the pane. It is given\r\n // * a single prop, `paneId`, which is a unique identifier for the pane.\r\n // *\r\n // * If you wish to store and persist the state of the pane,\r\n // * simply use a sheet and an object.\r\n // */\r\n // component: React.ComponentType<{\r\n // /**\r\n // * The unique identifier of the pane\r\n // */\r\n // paneId: string\r\n // }>\r\n\r\n mount: (opts: {paneId: string; node: HTMLElement}) => () => void\r\n}\r\n\r\nexport type ToolConfigIcon = {\r\n type: 'Icon'\r\n svgSource: string\r\n title: string\r\n onClick: () => void\r\n}\r\n\r\nexport type ToolConfigOption = {\r\n value: string\r\n label: string\r\n svgSource: string\r\n}\r\n\r\nexport type ToolConfigSwitch = {\r\n type: 'Switch'\r\n value: string\r\n onChange: (value: string) => void\r\n options: ToolConfigOption[]\r\n}\r\n\r\nexport type ToolconfigFlyoutMenuItem = {\r\n label: string\r\n onClick?: () => void\r\n}\r\n\r\nexport type ToolConfigFlyoutMenu = {\r\n /**\r\n * A flyout menu\r\n */\r\n type: 'Flyout'\r\n /**\r\n * The label of the trigger button\r\n */\r\n label: string\r\n items: ToolconfigFlyoutMenuItem[]\r\n}\r\n\r\nexport type ToolConfig =\r\n | ToolConfigIcon\r\n | ToolConfigSwitch\r\n | ToolConfigFlyoutMenu\r\n\r\nexport type ToolsetConfig = Array<ToolConfig>\r\n\r\n/**\r\n * A Encore Studio extension. You can define one either\r\n * in a separate package, or within your project.\r\n */\r\nexport interface IExtension {\r\n /**\r\n * Pick a unique ID for your extension. Ideally the name would be unique if\r\n * the extension was to be published to the npm repository.\r\n */\r\n id: string\r\n /**\r\n * Set this if you'd like to add a component to the global toolbar (on the top)\r\n *\r\n * @example\r\n * TODO\r\n */\r\n toolbars?: {\r\n [key in 'global' | string]: (\r\n set: (config: ToolsetConfig) => void,\r\n studio: IStudio,\r\n ) => () => void\r\n }\r\n\r\n /**\r\n * Introduces new pane types.\r\n * @example\r\n * TODO\r\n */\r\n panes?: Array<PaneClassDefinition>\r\n}\r\n\r\nexport type PaneInstance<ClassName extends string> = {\r\n extensionId: string\r\n instanceId: PaneInstanceId\r\n definition: PaneClassDefinition\r\n}\r\n\r\nexport interface IStudioUI {\r\n /**\r\n * Temporarily hides the studio\r\n */\r\n hide(): void\r\n /**\r\n * Whether the studio is currently visible or hidden\r\n */\r\n readonly isHidden: boolean\r\n /**\r\n * Makes the studio visible again.\r\n */\r\n restore(): void\r\n\r\n renderToolset(toolsetId: string, htmlNode: HTMLElement): () => void\r\n}\r\n\r\nexport interface InitOpts {\r\n studio?: boolean\r\n /**\r\n * The local storage key to use to persist the state.\r\n *\r\n * Default: \"theatrejs:0.4\"\r\n */\r\n persistenceKey?: string\r\n /**\r\n * Whether to persist the changes in the browser's temporary storage.\r\n * It is useful to set this to false in the test environment or when debugging things.\r\n *\r\n * Default: true\r\n */\r\n usePersistentStorage?: boolean\r\n\r\n __experimental_rafDriver?: IRafDriver | undefined\r\n\r\n serverUrl?: string | undefined\r\n}\r\n\r\n/**\r\n * This is the public api of Theatre's studio. It is exposed through:\r\n *\r\n * @example\r\n * Basic usage:\r\n * ```ts\r\n * import theatre from '@encorejs/core'\r\n *\r\n * theatre.init({studio: true})\r\n * ```\r\n *\r\n * @example\r\n * Usage with **tree-shaking**:\r\n * ```ts\r\n * import theatre from '@encorejs/core'\r\n *\r\n * if (process.env.NODE_ENV !== 'production') {\r\n * theatre.init({studio: true})\r\n * }\r\n * ```\r\n */\r\nexport interface IStudio {\r\n readonly ui: IStudioUI\r\n\r\n /**\r\n * Runs an undo-able transaction. Creates a single undo level for all\r\n * the operations inside the transaction.\r\n *\r\n * Will roll back if an error is thrown.\r\n *\r\n * @example\r\n * Usage:\r\n * ```ts\r\n * studio.transaction(({set, unset}) => {\r\n * set(obj.props.x, 10) // set the value of obj.props.x to 10\r\n * unset(obj.props.y) // unset the override at obj.props.y\r\n * })\r\n * ```\r\n */\r\n transaction(fn: (api: ITransactionAPI) => void): void\r\n\r\n /**\r\n * Creates a scrub, which is just like a transaction, except you\r\n * can run it multiple times without creating extra undo levels.\r\n *\r\n * @example\r\n * Usage:\r\n * ```ts\r\n * const scrub = studio.scrub()\r\n * scrub.capture(({set}) => {\r\n * set(obj.props.x, 10) // set the value of obj.props.x to 10\r\n * })\r\n *\r\n * // half a second later...\r\n * scrub.capture(({set}) => {\r\n * set(obj.props.y, 11) // set the value of obj.props.y to 11\r\n * // note that since we're not setting obj.props.x, its value reverts back to its old value (ie. not 10)\r\n * })\r\n *\r\n * // then either:\r\n * scrub.commit() // commits the scrub and creates a single undo level\r\n * // or:\r\n * scrub.reset() // clear all the ops in the scrub so we can run scrub.capture() again\r\n * // or:\r\n * scrub.discard() // clears the ops and destroys it (ie. can't call scrub.capture() anymore)\r\n * ```\r\n */\r\n scrub(): IScrub\r\n\r\n /**\r\n * Creates a debounced scrub, which is just like a normal scrub, but\r\n * automatically runs scrub.commit() after `threshhold` milliseconds have\r\n * passed after the last `scrub.capture`.\r\n *\r\n * @param threshhold - How long to wait before committing the scrub\r\n *\r\n * @example\r\n * Usage:\r\n * ```ts\r\n * // Will create a new undo-level after 2 seconds have passed\r\n * // since the last scrub.capture()\r\n * const scrub = studio.debouncedScrub(2000)\r\n *\r\n * // capture some ops\r\n * scrub.capture(...)\r\n * // wait one second\r\n * await delay(1000)\r\n * // capture more ops but no new undo level is made,\r\n * // because the last scrub.capture() was called less than 2 seconds ago\r\n * scrub.capture(...)\r\n *\r\n * // wait another seonc and half\r\n * await delay(1500)\r\n * // still no new undo level, because less than 2 seconds have passed\r\n * // since the last capture\r\n * scrub.capture(...)\r\n *\r\n * // wait 3 seconds\r\n * await delay(3000) // at this point, one undo level is created.\r\n *\r\n * // this call to capture will start a new undo level\r\n * scrub.capture(...)\r\n * ```\r\n */\r\n debouncedScrub(threshhold: number): Pick<IScrub, 'capture'>\r\n\r\n /**\r\n * Sets the current selection.\r\n *\r\n * @example\r\n * Usage:\r\n * ```ts\r\n * const sheet1: ISheet = ...\r\n * const obj1: ISheetObject<any> = ...\r\n *\r\n * studio.setSelection([sheet1, obj1])\r\n * ```\r\n *\r\n * You can read the current selection from studio.selection\r\n */\r\n setSelection(selection: Array<ISheetObject<any> | ISheet>): void\r\n\r\n /**\r\n * Calls fn every time the current selection changes.\r\n */\r\n onSelectionChange(\r\n fn: (s: Array<ISheetObject<{}> | ISheet>) => void,\r\n ): VoidFunction\r\n\r\n /**\r\n * The current selection, consisting of Sheets and Sheet Objects\r\n *\r\n * @example\r\n * Usage:\r\n * ```ts\r\n * console.log(studio.selection) // => [ISheetObject, ISheet]\r\n * ```\r\n */\r\n readonly selection: Array<ISheetObject<{}> | ISheet>\r\n\r\n /**\r\n * Registers an extension\r\n */\r\n extend(\r\n /**\r\n * The extension's definition\r\n */\r\n extension: IExtension,\r\n opts?: {\r\n /**\r\n * Whether to reconfigure the extension. This is useful if you're\r\n * hot-reloading the extension.\r\n *\r\n * Mind you, that if the old version of the extension defines a pane,\r\n * and the new version doesn't, all instances of that pane will disappear, as expected.\r\n * _However_, if you again reconfigure the extension with the old version, the instances\r\n * of the pane that pane will re-appear.\r\n *\r\n * We're not sure about whether this behavior makes sense or not. If not, let us know\r\n * in the discord server or open an issue on github.\r\n */\r\n __experimental_reconfigure?: boolean\r\n },\r\n ): void\r\n\r\n /**\r\n * Creates a new pane\r\n *\r\n * @param paneClass - The class name of the pane (provided by an extension)\r\n */\r\n createPane<PaneClass extends string>(\r\n paneClass: PaneClass,\r\n ): PaneInstance<PaneClass>\r\n\r\n /**\r\n * Destroys a previously created pane instance\r\n *\r\n * @param paneId - The unique identifier for the pane instance, provided in the 'mount' callback\r\n */\r\n destroyPane(paneId: string): void\r\n\r\n /**\r\n * Returns the Encore project that contains the studio's sheets and objects.\r\n *\r\n * It is useful if you'd like to have sheets/objects that are present only when\r\n * studio is present.\r\n */\r\n getStudioProject(): IProject\r\n\r\n /**\r\n * Creates a JSON object that contains the state of the project. You can use this\r\n * to programmatically save the state of your projects to the storage system of your\r\n * choice, rather than manually clicking on the \"Export\" button in the UI.\r\n *\r\n * @param projectId - same projectId as in `core.getProject(projectId)`\r\n *\r\n * @example\r\n * Usage:\r\n * ```ts\r\n * const projectId = \"project\"\r\n * const json = studio.createContentOfSaveFile(projectId)\r\n * const string = JSON.stringify(json)\r\n * fetch(`/projects/${projectId}/state`, {method: 'POST', body: string}).then(() => {\r\n * console.log(\"Saved\")\r\n * })\r\n * ```\r\n */\r\n createContentOfSaveFile(projectId: string): Record<string, unknown>\r\n\r\n __experimental: {\r\n /**\r\n * Warning: This is an experimental API and will change in the future.\r\n *\r\n * Disables the play/pause keyboard shortcut (spacebar)\r\n * Also see `__experimental_enablePlayPauseKeyboardShortcut()` to re-enable it.\r\n */\r\n __experimental_disablePlayPauseKeyboardShortcut(): void\r\n /**\r\n * Warning: This is an experimental API and will change in the future.\r\n *\r\n * Disables the play/pause keyboard shortcut (spacebar)\r\n */\r\n __experimental_enablePlayPauseKeyboardShortcut(): void\r\n /**\r\n * Clears persistent storage and ensures that the current state will not be\r\n * saved on window unload. Further changes to state will continue writing to\r\n * persistent storage, if enabled during initialization.\r\n *\r\n * @param persistenceKey - same persistencyKey as in `studio.initialize(opts)`, if any\r\n */\r\n __experimental_clearPersistentStorage(persistenceKey?: string): void\r\n\r\n /**\r\n * Warning: This is an experimental API and will change in the future.\r\n *\r\n * This is functionally the same as `studio.createContentOfSaveFile()`, but\r\n * returns a typed object instead of a JSON object.\r\n *\r\n * See {@link __UNSTABLE_Project_OnDiskState} for more information.\r\n */\r\n __experimental_createContentOfSaveFileTyped(\r\n projectId: string,\r\n ): __UNSTABLE_Project_OnDiskState\r\n }\r\n}\r\n\r\n/**\r\n * The scrub API is a simple construct for changing values in Encore in a history-compatible way.\r\n * Primarily, it can be used to create a series of value changes using a temp transaction without\r\n * creating multiple transactions.\r\n *\r\n * The name is inspired by the activity of \"scrubbing\" the value of an input through clicking and\r\n * dragging left and right. But, the API is not limited to chaning a single prop's value.\r\n *\r\n * For now, using the {@link IScrubApi.set} will result in changing the values where the\r\n * playhead is (the `sequence.position`).\r\n */\r\nexport interface IScrubApi {\r\n /**\r\n * Set the value of a prop by its pointer. If the prop is sequenced, the value\r\n * will be a keyframe at the current playhead position (`sequence.position`).\r\n *\r\n * @param pointer - A Pointer, like object.props\r\n * @param value - The value to override the existing value. This is treated as a deep partial value.\r\n *\r\n * @example\r\n * Usage:\r\n * ```ts\r\n * const obj = sheet.object(\"box\", {x: 0, y: 0})\r\n * const scrub = studio.scrub()\r\n * scrub.capture(({set}) => {\r\n * // set a specific prop's value\r\n * set(obj.props.x, 10) // New value is {x: 10, y: 0}\r\n * // values are set partially\r\n * set(obj.props, {y: 11}) // New value is {x: 10, y: 11}\r\n *\r\n * // this will error, as there is no such prop as 'z'\r\n * set(obj.props.z, 10)\r\n * })\r\n * ```\r\n */\r\n set<T>(pointer: Pointer<T>, value: T): void\r\n}\r\n\r\nexport interface IScrub {\r\n /**\r\n * Clears all the ops in the scrub, but keeps the scrub open so you can call\r\n * `scrub.capture()` again.\r\n */\r\n reset(): void\r\n /**\r\n * Commits the scrub and creates a single undo level.\r\n */\r\n commit(): void\r\n /**\r\n * Captures operations for the scrub.\r\n *\r\n * Note that running `scrub.capture()` multiple times means all the older\r\n * calls of `scrub.capture()` will be reset.\r\n *\r\n * @example\r\n * Usage:\r\n * ```ts\r\n * scrub.capture(({set}) => {\r\n * set(obj.props.x, 10) // set the value of obj.props.x to 10\r\n * })\r\n * ```\r\n */\r\n capture(fn: (api: IScrubApi) => void): void\r\n\r\n /**\r\n * Clears the ops of the scrub and destroys it. After calling this,\r\n * you won't be able to call `scrub.capture()` anymore.\r\n */\r\n discard(): void\r\n}\r\n", "import {InvalidArgumentError} from '@encorejs/utils/errors'\r\nimport type {$IntentionalAny} from '@encorejs/core/types/public'\r\nimport userReadableTypeOfValue from '@encorejs/utils/userReadableTypeOfValue'\r\nimport {isPlainObject} from 'lodash-es'\r\nimport {\r\n propTypeSymbol,\r\n type PropTypeConfig,\r\n type UnknownShorthandCompoundProps,\r\n type UnknownValidCompoundProps,\r\n} from '@encorejs/core/types/public'\r\nimport * as t from './index'\r\n\r\nexport function isLonghandPropType(t: unknown): t is PropTypeConfig {\r\n return (\r\n typeof t === 'object' &&\r\n !!t &&\r\n (t as $IntentionalAny)[propTypeSymbol] === 'TheatrePropType'\r\n )\r\n}\r\n\r\nexport function toLonghandProp(p: unknown): PropTypeConfig {\r\n if (typeof p === 'number') {\r\n return t.number(p)\r\n } else if (typeof p === 'boolean') {\r\n return t.boolean(p)\r\n } else if (typeof p === 'string') {\r\n return t.string(p)\r\n } else if (typeof p === 'object' && !!p) {\r\n if (isLonghandPropType(p)) return p\r\n if (isPlainObject(p)) {\r\n return t.compound(p as $IntentionalAny)\r\n } else {\r\n throw new InvalidArgumentError(\r\n `This value is not a valid prop type: ${userReadableTypeOfValue(p)}`,\r\n )\r\n }\r\n } else {\r\n throw new InvalidArgumentError(\r\n `This value is not a valid prop type: ${userReadableTypeOfValue(p)}`,\r\n )\r\n }\r\n}\r\n\r\nexport function sanitizeCompoundProps(\r\n props: UnknownShorthandCompoundProps,\r\n): UnknownValidCompoundProps {\r\n const sanitizedProps: UnknownValidCompoundProps = {}\r\n if (process.env.NODE_ENV !== 'production') {\r\n if (typeof props !== 'object' || !props) {\r\n throw new InvalidArgumentError(\r\n `t.compound() expects an object, like: {x: 10}. ${userReadableTypeOfValue(\r\n props,\r\n )} given.`,\r\n )\r\n }\r\n }\r\n for (const key of Object.keys(props)) {\r\n if (process.env.NODE_ENV !== 'production') {\r\n if (typeof key !== 'string') {\r\n throw new InvalidArgumentError(\r\n `t.compound()'s keys must be all strings. ${userReadableTypeOfValue(\r\n key,\r\n )} given.`,\r\n )\r\n } else if (key.length === 0 || !key.match(/^\\w+$/)) {\r\n throw new InvalidArgumentError(\r\n `compound key ${userReadableTypeOfValue(\r\n key,\r\n )} is invalid. The keys must be alphanumeric and start with a letter.`,\r\n )\r\n } else if (key.length > 64) {\r\n throw new InvalidArgumentError(\r\n `compound key ${userReadableTypeOfValue(key)} is too long.`,\r\n )\r\n }\r\n }\r\n\r\n const val = props[key]\r\n if (isLonghandPropType(val)) {\r\n sanitizedProps[key] = val as $IntentionalAny\r\n } else {\r\n sanitizedProps[key] = toLonghandProp(val) as $IntentionalAny\r\n }\r\n }\r\n return sanitizedProps\r\n}\r\n", "import {InvalidArgumentError} from '@encorejs/utils/errors'\r\n// import {notify} from '@encorejs/shared/notify'\r\n\r\n/**\r\n * Make the given string's \"path\" slashes normalized with preceding and trailing spaces.\r\n *\r\n * - It removes starting and trailing slashes: `/foo/bar/` becomes `foo / bar`\r\n * - It adds wraps each slash with a single space, so that `foo/bar` becomes `foo / bar`\r\n *\r\n */\r\nconst normalizeSlashedPath = (p: string): string =>\r\n p\r\n // remove starting slashes\r\n .replace(/^[\\s\\/]*/, '')\r\n // remove ending slashes\r\n .replace(/[\\s\\/]*$/, '')\r\n // make middle slashes consistent\r\n .replace(/\\s*\\/\\s*/g, ' / ')\r\n\r\nconst getValidationErrorsOfSlashedPath = (p: string): void | string => {\r\n if (typeof p !== 'string') return `it is not a string. (it is a ${typeof p})`\r\n\r\n const components = p.split(/\\//)\r\n if (components.length === 0) return `it is empty.`\r\n\r\n for (let i = 0; i < components.length; i++) {\r\n const component = components[i].trim()\r\n if (component.length === 0) return `the component #${i + 1} is empty.`\r\n if (component.length > 64)\r\n return `the component '${component}' must have 64 characters or less.`\r\n }\r\n}\r\n\r\n/**\r\n * Sanitizes a `path` and warns the user if the input doesn't match the sanitized output.\r\n *\r\n * See {@link normalizeSlashedPath} for examples of how we do sanitization.\r\n */\r\nexport function validateAndSanitiseSlashedPathOrThrow(\r\n unsanitisedPath: string,\r\n fnName: string,\r\n warn: (\r\n /**\r\n * The title of the notification.\r\n */\r\n title: string,\r\n /**\r\n * The message of the notification.\r\n */\r\n message: string,\r\n /**\r\n * An array of doc pages to link to.\r\n */\r\n docs?: {url: string; title: string}[],\r\n /**\r\n * Whether duplicate notifications should be allowed.\r\n */\r\n allowDuplicates?: boolean,\r\n ) => void,\r\n) {\r\n const sanitisedPath = normalizeSlashedPath(unsanitisedPath)\r\n if (process.env.NODE_ENV !== 'development') {\r\n return sanitisedPath\r\n }\r\n const validation = getValidationErrorsOfSlashedPath(sanitisedPath)\r\n if (validation) {\r\n throw new InvalidArgumentError(\r\n `The path in ${fnName}(${\r\n typeof unsanitisedPath === 'string' ? `\"${unsanitisedPath}\"` : ''\r\n }) is invalid because ${validation}`,\r\n )\r\n }\r\n if (unsanitisedPath !== sanitisedPath) {\r\n warn(\r\n 'Invalid path provided to object',\r\n `The path in \\`${fnName}(\"${unsanitisedPath}\")\\` was sanitized to \\`\"${sanitisedPath}\"\\`.\\n\\n` +\r\n 'Please replace the path with the sanitized one, otherwise it will likely break in the future.',\r\n [\r\n {\r\n url: 'https://www.theatrejs.com/docs/latest/manual/objects#creating-sheet-objects',\r\n title: 'Sheet Objects',\r\n },\r\n {\r\n url: 'https://www.theatrejs.com/docs/latest/api/core#sheet.object',\r\n title: 'API',\r\n },\r\n ],\r\n )\r\n }\r\n return sanitisedPath\r\n}\r\n", "import {privateAPI, setPrivateAPI} from '@encorejs/core/privateAPIs'\r\nimport {compound} from '@encorejs/core/propTypes'\r\nimport type Sheet from '@encorejs/core/sheets/Sheet'\r\nimport type {SheetAddress} from '@encorejs/core/types/public'\r\nimport {InvalidArgumentError} from '@encorejs/utils/errors'\r\nimport {validateAndSanitiseSlashedPathOrThrow} from '@encorejs/utils/slashedPaths'\r\nimport type {$FixMe, $IntentionalAny} from '@encorejs/core/types/public'\r\nimport userReadableTypeOfValue from '@encorejs/utils/userReadableTypeOfValue'\r\nimport deepEqual from 'fast-deep-equal'\r\nimport type SheetObject from '@encorejs/core/sheetObjects/SheetObject'\r\nimport type {ObjectAddressKey} from '@encorejs/core/types/public'\r\nimport {notify} from '@encorejs/core/utils/notify'\r\nimport type {\r\n IProject,\r\n ISheet,\r\n SheetObjectActionsConfig,\r\n ISheetObject,\r\n ISequence,\r\n UnknownShorthandCompoundProps,\r\n} from '@encorejs/core/types/public'\r\n\r\nconst weakMapOfUnsanitizedProps = new WeakMap<\r\n SheetObject,\r\n UnknownShorthandCompoundProps\r\n>()\r\n\r\nexport default class TheatreSheet implements ISheet {\r\n get type(): 'Theatre_Sheet_PublicAPI' {\r\n return 'Theatre_Sheet_PublicAPI'\r\n }\r\n /**\r\n * @internal\r\n */\r\n constructor(sheet: Sheet) {\r\n setPrivateAPI(this, sheet)\r\n }\r\n\r\n object<Props extends UnknownShorthandCompoundProps>(\r\n key: string,\r\n config: Props,\r\n opts?: {\r\n reconfigure?: boolean\r\n __actions__THIS_API_IS_UNSTABLE_AND_WILL_CHANGE_IN_THE_NEXT_VERSION?: SheetObjectActionsConfig\r\n },\r\n ): ISheetObject<Props> {\r\n const internal = privateAPI(this)\r\n const sanitizedPath = validateAndSanitiseSlashedPathOrThrow(\r\n key,\r\n `sheet.object`,\r\n notify.warning,\r\n )\r\n\r\n const existingObject = internal.getObject(sanitizedPath as ObjectAddressKey)\r\n\r\n /**\r\n * Future: `nativeObject` Idea is to potentially allow the user to provide their own\r\n * object in to the object call as a way to keep a handle to an underlying object via\r\n * the {@link ISheetObject}.\r\n *\r\n * For example, a THREEjs object or an HTMLElement is passed in.\r\n */\r\n const nativeObject = null\r\n\r\n const actions =\r\n opts?.__actions__THIS_API_IS_UNSTABLE_AND_WILL_CHANGE_IN_THE_NEXT_VERSION\r\n\r\n if (existingObject) {\r\n if (process.env.NODE_ENV !== 'production') {\r\n const prevConfig = weakMapOfUnsanitizedProps.get(existingObject)\r\n if (prevConfig) {\r\n if (!deepEqual(config, prevConfig)) {\r\n if (opts?.reconfigure === true) {\r\n const sanitizedConfig = compound(config)\r\n existingObject.template.reconfigure(sanitizedConfig)\r\n weakMapOfUnsanitizedProps.set(existingObject, config)\r\n return existingObject.publicApi as $IntentionalAny\r\n } else {\r\n throw new Error(\r\n `You seem to have called sheet.object(\"${key}\", config) twice, with different values for \\`config\\`. ` +\r\n `This is disallowed because changing the config of an object on the fly would make it difficult to reason about.\\n\\n` +\r\n `You can fix this by either re-using the existing object, or calling sheet.object(\"${key}\", config) with the same config.\\n\\n` +\r\n `If you mean to reconfigure the object's config, set \\`{reconfigure: true}\\` in sheet.object(\"${key}\", config, {reconfigure: true})`,\r\n )\r\n }\r\n }\r\n }\r\n }\r\n\r\n if (actions) {\r\n existingObject.template._temp_setActions(actions)\r\n }\r\n\r\n return existingObject.publicApi as $IntentionalAny\r\n } else {\r\n const sanitizedConfig = compound(config)\r\n const object = internal.createObject(\r\n sanitizedPath as ObjectAddressKey,\r\n nativeObject,\r\n sanitizedConfig,\r\n actions,\r\n )\r\n if (process.env.NODE_ENV !== 'production') {\r\n weakMapOfUnsanitizedProps.set(object as $FixMe, config)\r\n }\r\n return object.publicApi as $IntentionalAny\r\n }\r\n }\r\n\r\n get sequence(): ISequence {\r\n return privateAPI(this).getSequence().publicApi\r\n }\r\n\r\n get project(): IProject {\r\n return privateAPI(this).project.publicApi\r\n }\r\n\r\n get address(): SheetAddress {\r\n return {...privateAPI(this).address}\r\n }\r\n\r\n detachObject(key: string) {\r\n const internal = privateAPI(this)\r\n const sanitizedPath = validateAndSanitiseSlashedPathOrThrow(\r\n key,\r\n `sheet.deleteObject(\"${key}\")`,\r\n notify.warning,\r\n ) as ObjectAddressKey\r\n\r\n const obj = internal.getObject(sanitizedPath)\r\n if (!obj) {\r\n notify.warning(\r\n `Couldn\\'t delete object \"${sanitizedPath}\"`,\r\n `There is no object with key \"${sanitizedPath}\".\r\n\r\nTo fix this, make sure you are calling \\`sheet.deleteObject(\"${sanitizedPath}\")\\` with the correct key.`,\r\n )\r\n console.warn(`Object key \"${sanitizedPath}\" does not exist.`)\r\n return\r\n }\r\n\r\n internal.deleteObject(sanitizedPath as ObjectAddressKey)\r\n }\r\n}\r\n\r\nconst validateSequenceNameOrThrow = (value: string) => {\r\n if (typeof value !== 'string') {\r\n throw new InvalidArgumentError(\r\n `Argument 'name' in \\`sheet.getSequence(name)\\` must be a string. Instead, it was ${userReadableTypeOfValue(\r\n value,\r\n )}.`,\r\n )\r\n }\r\n\r\n const idTrimmed = value.trim()\r\n if (idTrimmed.length !== value.length) {\r\n throw new InvalidArgumentError(\r\n `Argument 'name' in \\`sheet.getSequence(\"${value}\")\\` should not have surrounding whitespace.`,\r\n )\r\n }\r\n\r\n if (idTrimmed.length < 3) {\r\n throw new InvalidArgumentError(\r\n `Argument 'name' in \\`sheet.getSequence(\"${value}\")\\` should be at least 3 characters long.`,\r\n )\r\n }\r\n}\r\n", "import type Project from '@encorejs/core/projects/Project'\r\nimport Sequence from '@encorejs/core/sequences/Sequence'\r\nimport type SheetObject from '@encorejs/core/sheetObjects/SheetObject'\r\nimport TheatreSheet from '@encorejs/core/sheets/TheatreSheet'\r\nimport type {SheetAddress} from '@encorejs/core/types/public'\r\nimport {Atom, prism, val} from '@encorejs/dataverse'\r\nimport type SheetTemplate from './SheetTemplate'\r\nimport type {\r\n ObjectAddressKey,\r\n SheetInstanceId,\r\n} from '@encorejs/core/types/public'\r\nimport type {StrictRecord} from '@encorejs/core/types/public'\r\nimport {isInteger} from 'lodash-es'\r\nimport type {\r\n SheetObjectActionsConfig,\r\n SheetObjectPropTypeConfig,\r\n} from '@encorejs/core/types/public'\r\n\r\ntype SheetObjectMap = StrictRecord<ObjectAddressKey, SheetObject>\r\n\r\n/**\r\n * Future: `nativeObject` Idea is to potentially allow the user to provide their own\r\n * object in to the object call as a way to keep a handle to an underlying object via\r\n * the {@link ISheetObject}.\r\n *\r\n * For example, a THREEjs object or an HTMLElement is passed in.\r\n */\r\nexport type ObjectNativeObject = unknown\r\n\r\nexport default class Sheet {\r\n private readonly _objects: Atom<SheetObjectMap> = new Atom<SheetObjectMap>({})\r\n private _sequence: undefined | Sequence\r\n readonly address: SheetAddress\r\n readonly publicApi: TheatreSheet\r\n readonly project: Project\r\n readonly objectsP = this._objects.pointer\r\n type: 'Theatre_Sheet' = 'Theatre_Sheet'\r\n\r\n constructor(\r\n readonly template: SheetTemplate,\r\n public readonly instanceId: SheetInstanceId,\r\n ) {\r\n this.project = template.project\r\n this.address = {\r\n ...template.address,\r\n sheetInstanceId: this.instanceId,\r\n }\r\n\r\n this.publicApi = new TheatreSheet(this)\r\n }\r\n\r\n /**\r\n * @remarks At some point, we have to reconcile the concept of \"an object\"\r\n * with that of \"an element.\"\r\n */\r\n createObject(\r\n objectKey: ObjectAddressKey,\r\n nativeObject: ObjectNativeObject,\r\n config: SheetObjectPropTypeConfig,\r\n actions: SheetObjectActionsConfig = {},\r\n ): SheetObject {\r\n const objTemplate = this.template.getObjectTemplate(\r\n objectKey,\r\n nativeObject,\r\n config,\r\n actions,\r\n )\r\n\r\n const object = objTemplate.createInstance(this, nativeObject, config)\r\n\r\n this._objects.setByPointer((p) => p[objectKey], object)\r\n\r\n return object\r\n }\r\n\r\n getObject(key: ObjectAddressKey): SheetObject | undefined {\r\n return this._objects.get()[key]\r\n }\r\n\r\n deleteObject(objectKey: ObjectAddressKey) {\r\n this._objects.reduce((state) => {\r\n const newState = {...state}\r\n delete newState[objectKey]\r\n return newState\r\n })\r\n }\r\n\r\n getSequence(): Sequence {\r\n if (!this._sequence) {\r\n const lengthD = prism(() => {\r\n const unsanitized = val(\r\n this.project.pointers.historic.sheetsById[this.address.sheetId]\r\n .sequence.length,\r\n )\r\n return sanitizeSequenceLength(unsanitized)\r\n })\r\n\r\n const subUnitsPerUnitD = prism(() => {\r\n const unsanitized = val(\r\n this.project.pointers.historic.sheetsById[this.address.sheetId]\r\n .sequence.subUnitsPerUnit,\r\n )\r\n return sanitizeSequenceSubUnitsPerUnit(unsanitized)\r\n })\r\n\r\n this._sequence = new Sequence(\r\n this.template.project,\r\n this,\r\n lengthD,\r\n subUnitsPerUnitD,\r\n )\r\n }\r\n return this._sequence\r\n }\r\n}\r\n\r\nconst sanitizeSequenceLength = (len: number | undefined): number =>\r\n typeof len === 'number' && isFinite(len) && len > 0 ? len : 10\r\n\r\nconst sanitizeSequenceSubUnitsPerUnit = (subs: number | undefined): number =>\r\n typeof subs === 'number' && isInteger(subs) && subs >= 1 && subs <= 1000\r\n ? subs\r\n : 30\r\n", "import type {\r\n OnDiskState,\r\n ProjectEphemeralState,\r\n ProjectState,\r\n} from '@encorejs/core/types/private/core'\r\nimport type TheatreProject from '@encorejs/core/projects/TheatreProject'\r\nimport type Sheet from '@encorejs/core/sheets/Sheet'\r\nimport SheetTemplate from '@encorejs/core/sheets/SheetTemplate'\r\n// import type {Studio} from '@encorejs/studio/Studio'\r\nimport type {ProjectAddress} from '@encorejs/core/types/public'\r\nimport type {Pointer} from '@encorejs/dataverse'\r\nimport {PointerProxy} from '@encorejs/dataverse'\r\nimport {Atom} from '@encorejs/dataverse'\r\nimport initialiseProjectState from './initialiseProjectState'\r\nimport projectsSingleton from './projectsSingleton'\r\nimport type {Deferred} from '@encorejs/utils/defer'\r\nimport {defer} from '@encorejs/utils/defer'\r\nimport {globals} from '@encorejs/core/globals'\r\nimport type {\r\n ProjectId,\r\n SheetId,\r\n SheetInstanceId,\r\n} from '@encorejs/core/types/public'\r\n\r\nimport type {\r\n $IntentionalAny,\r\n $____FixmeStudio,\r\n} from '@encorejs/core/types/public'\r\nimport {InvalidArgumentError} from '@encorejs/utils/errors'\r\nimport userReadableTypeOfValue from '@encorejs/utils/userReadableTypeOfValue'\r\n\r\ntype Studio = $____FixmeStudio\r\n\r\ntype ICoreAssetStorage = {\r\n /** Returns a URL for the provided asset ID */\r\n getAssetUrl: (assetId: string) => string\r\n}\r\n\r\ninterface IStudioAssetStorage extends ICoreAssetStorage {\r\n /** Creates an asset from the provided blob and returns a promise to its ID */\r\n createAsset: (asset: File) => Promise<string | null>\r\n}\r\n\r\nexport type IAssetStorageConfig = {\r\n /**\r\n * An object containing the core asset storage methods.\r\n */\r\n coreAssetStorage: ICoreAssetStorage\r\n}\r\n\r\ntype IAssetConf = {\r\n /** The base URL for assets. */\r\n baseUrl?: string\r\n}\r\n\r\nexport type Conf = Partial<{\r\n state: OnDiskState\r\n assets: IAssetConf\r\n experiments: ExperimentsConf\r\n}>\r\n\r\nexport type ExperimentsConf = Partial<{}>\r\n\r\nexport default class Project {\r\n readonly pointers: {\r\n historic: Pointer<ProjectState['historic'] | undefined>\r\n ephemeral: Pointer<ProjectEphemeralState>\r\n }\r\n\r\n private readonly _pointerProxies: {\r\n historic: PointerProxy<ProjectState['historic']>\r\n ephemeral: PointerProxy<ProjectEphemeralState>\r\n }\r\n\r\n readonly address: ProjectAddress\r\n\r\n private readonly _studioReadyDeferred: Deferred<undefined>\r\n private readonly _assetStorageReadyDeferred: Deferred<undefined>\r\n private readonly _readyPromise: Promise<void>\r\n\r\n private _sheetTemplates = new Atom<{\r\n [sheetId: string]: SheetTemplate | undefined\r\n }>({})\r\n sheetTemplatesP = this._sheetTemplates.pointer\r\n private _studio: Studio | undefined\r\n assetStorage: IStudioAssetStorage\r\n\r\n type: 'Theatre_Project' = 'Theatre_Project'\r\n\r\n constructor(\r\n id: ProjectId,\r\n readonly config: Conf = {},\r\n readonly publicApi: TheatreProject,\r\n ) {\r\n this.address = {projectId: id}\r\n\r\n const onDiskEphemeralAtom = new Atom<ProjectEphemeralState>({\r\n loadingState: {\r\n type: 'loaded',\r\n },\r\n lastExportedObject: null,\r\n })\r\n\r\n const onDiskStateAtom = new Atom<ProjectState>({\r\n historic: config.state ?? {\r\n sheetsById: {},\r\n definitionVersion: globals.currentProjectStateDefinitionVersion,\r\n revisionHistory: [],\r\n },\r\n })\r\n\r\n this._assetStorageReadyDeferred = defer()\r\n this.assetStorage = {\r\n getAssetUrl: (assetId: string) => `${config.assets?.baseUrl}/${assetId}`,\r\n\r\n // Until the asset storage is ready, we'll throw an error when the user tries to use it\r\n createAsset: () => {\r\n throw new Error(`Please wait for Project.ready to use assets.`)\r\n },\r\n }\r\n\r\n this._pointerProxies = {\r\n historic: new PointerProxy(onDiskStateAtom.pointer.historic),\r\n ephemeral: new PointerProxy(onDiskEphemeralAtom.pointer),\r\n }\r\n\r\n this.pointers = {\r\n historic: this._pointerProxies.historic.pointer,\r\n ephemeral: this._pointerProxies.ephemeral.pointer,\r\n }\r\n\r\n projectsSingleton.add(id, this)\r\n\r\n this._studioReadyDeferred = defer()\r\n\r\n this._readyPromise = Promise.all([\r\n this._studioReadyDeferred.promise,\r\n this._assetStorageReadyDeferred.promise,\r\n // hide the array from the user, i.e. make it Promise<void> instead of Promise<[undefined, undefined]>\r\n ]).then(() => {})\r\n\r\n if (config.state) {\r\n setTimeout(() => {\r\n // The user has provided config.state but in case @encorejs/studio is loaded,\r\n // let's give it one tick to attach itself\r\n if (!this._studio) {\r\n this._studioReadyDeferred.resolve(undefined)\r\n this._assetStorageReadyDeferred.resolve(undefined)\r\n }\r\n }, 0)\r\n } else {\r\n if (typeof window === 'undefined') {\r\n if (process.env.NODE_ENV === 'production') {\r\n console.error(\r\n `Argument config.state in Theatre.getProject(\"${id}\", config) is empty. ` +\r\n `You can safely ignore this message if you're developing a Next.js/Remix project in development mode. But if you are shipping to your end-users, ` +\r\n `then you need to set config.state, ` +\r\n `otherwise your project's state will be empty and nothing will animate. Learn more at https://www.theatrejs.com/docs/latest/manual/projects#state`,\r\n )\r\n }\r\n } else {\r\n setTimeout(() => {\r\n if (!this._studio) {\r\n throw new Error(\r\n `Argument config.state in Theatre.getProject(\"${id}\", config) is empty. This is fine ` +\r\n `while you are using @encorejs/core along with @encorejs/studio. But since @encorejs/studio ` +\r\n `is not loaded, the state of project \"${id}\" will be empty.\\n\\n` +\r\n `To fix this, you need to add @encorejs/studio into the bundle and export ` +\r\n `the project's state. Learn how to do that at https://www.theatrejs.com/docs/latest/manual/projects#state\\n`,\r\n )\r\n }\r\n }, 1000)\r\n }\r\n }\r\n }\r\n\r\n attachToStudio(studio: Studio) {\r\n if (this._studio) {\r\n if (this._studio !== studio) {\r\n throw new Error(\r\n `Project ${this.address.projectId} is already attached to studio ${this._studio.address.studioId}`,\r\n )\r\n } else {\r\n console.warn(\r\n `Project ${this.address.projectId} is already attached to studio ${this._studio.address.studioId}`,\r\n )\r\n return\r\n }\r\n }\r\n this._studio = studio\r\n\r\n studio.initialized\r\n .then(async () => {\r\n await initialiseProjectState(studio, this, this.config.state)\r\n\r\n this._pointerProxies.historic.setPointer(\r\n studio.atomP.historic.coreByProject[\r\n this.address.projectId\r\n ] as $IntentionalAny,\r\n )\r\n\r\n this._pointerProxies.ephemeral.setPointer(\r\n studio.ephemeralAtom.pointer.coreByProject[this.address.projectId],\r\n )\r\n\r\n // asset storage has to be initialized after the pointers are set\r\n await studio\r\n .createAssetStorage(this, this.config.assets?.baseUrl)\r\n .then((assetStorage: $____FixmeStudio) => {\r\n this.assetStorage = assetStorage\r\n this._assetStorageReadyDeferred.resolve(undefined)\r\n })\r\n\r\n this._studioReadyDeferred.resolve(undefined)\r\n })\r\n .catch((err: $____FixmeStudio) => {\r\n console.error(err)\r\n throw err\r\n })\r\n }\r\n\r\n get isAttachedToStudio() {\r\n return !!this._studio\r\n }\r\n\r\n get ready() {\r\n return this._readyPromise\r\n }\r\n\r\n isReady() {\r\n return (\r\n this._studioReadyDeferred.status === 'resolved' &&\r\n this._assetStorageReadyDeferred.status === 'resolved'\r\n )\r\n }\r\n\r\n getOrCreateSheet(\r\n sheetId: SheetId,\r\n instanceId: SheetInstanceId = 'default' as SheetInstanceId,\r\n ): Sheet {\r\n let template = this._sheetTemplates.get()[sheetId]\r\n\r\n if (!template) {\r\n template = new SheetTemplate(this, sheetId)\r\n this._sheetTemplates.reduce((s) => ({...s, [sheetId]: template}))\r\n }\r\n\r\n return template.getInstance(instanceId)\r\n }\r\n}\r\n\r\n/**\r\n * Lightweight validator that only makes sure the state's definitionVersion is correct.\r\n * Does not do a thorough validation of the state.\r\n */\r\nexport const shallowValidateOnDiskState = (\r\n projectId: ProjectId,\r\n s: OnDiskState,\r\n) => {\r\n if (\r\n Array.isArray(s) ||\r\n s == null ||\r\n s.definitionVersion !== globals.currentProjectStateDefinitionVersion\r\n ) {\r\n throw new InvalidArgumentError(\r\n `Error validating conf.state in Theatre.getProject(${JSON.stringify(\r\n projectId,\r\n )}, conf). The state seems to be formatted in a way that is unreadable to Encore. Read more at https://www.theatrejs.com/docs/latest/manual/projects#state`,\r\n )\r\n }\r\n}\r\n\r\nexport const deepValidateOnDiskState = (\r\n projectId: ProjectId,\r\n s: OnDiskState,\r\n) => {\r\n shallowValidateOnDiskState(projectId, s)\r\n // @TODO do a deep validation here\r\n}\r\n\r\nexport const validateProjectIdOrThrow = (value: string) => {\r\n if (typeof value !== 'string') {\r\n throw new InvalidArgumentError(\r\n `Argument 'projectId' in \\`Theatre.getProject(projectId, ...)\\` must be a string. Instead, it was ${userReadableTypeOfValue(\r\n value,\r\n )}.`,\r\n )\r\n }\r\n\r\n const idTrimmed = value.trim()\r\n if (idTrimmed.length !== value.length) {\r\n throw new InvalidArgumentError(\r\n `Argument 'projectId' in \\`Theatre.getProject(\"${value}\", ...)\\` should not have surrounding whitespace.`,\r\n )\r\n }\r\n\r\n if (idTrimmed.length < 3) {\r\n throw new InvalidArgumentError(\r\n `Argument 'projectId' in \\`Theatre.getProject(\"${value}\", ...)\\` should be at least 3 characters long.`,\r\n )\r\n }\r\n}\r\n", "const delay = (dur: number, abortSignal?: AbortSignal) =>\r\n abortSignal ? delayWithAbort(dur, abortSignal) : delayWithoutAbort(dur)\r\n\r\nfunction delayWithoutAbort(dur: number) {\r\n return new Promise((resolve) => {\r\n setTimeout(resolve, dur)\r\n })\r\n}\r\n\r\nfunction delayWithAbort(dur: number, abortSignal: AbortSignal) {\r\n return new Promise((resolve, reject) => {\r\n let pending = true\r\n const timeout = setTimeout(() => {\r\n pending = false\r\n resolve(void 0)\r\n }, dur)\r\n\r\n const onAbort = () => {\r\n if (!pending) return\r\n pending = false\r\n clearTimeout(timeout)\r\n reject(new Error('Aborted'))\r\n abortSignal.removeEventListener('abort', onAbort)\r\n }\r\n abortSignal.addEventListener('abort', onAbort)\r\n })\r\n}\r\n\r\nexport default delay\r\n", "// import type {Studio} from '@encorejs/studio/Studio'\r\nimport delay from '@encorejs/utils/delay'\r\nimport type Project from './Project'\r\nimport type {OnDiskState} from '@encorejs/core/types/private/core'\r\nimport {globals} from '@encorejs/core/globals'\r\nimport {val} from '@encorejs/dataverse'\r\nimport type {$____FixmeStudio} from '@encorejs/core/types/public'\r\n\r\ntype Studio = $____FixmeStudio\r\n\r\n/**\r\n * @remarks\r\n * TODO this could be turned into a simple prism, like:\r\n * `editor.isReady: Prism<{isReady: true} | {isReady: false, reason: 'conflictBetweenDiskStateAndBrowserState'}>`\r\n */\r\nexport default async function initialiseProjectState(\r\n studio: Studio,\r\n project: Project,\r\n onDiskState: OnDiskState | undefined,\r\n) {\r\n /*\r\n * If in the future we move to IndexedDB to store the state, we'll have\r\n * to deal with it being async (as opposed to localStorage that is synchronous.)\r\n * so here we're artifically delaying the loading of the state to make sure users\r\n * don't count on the state always being already loaded synchronously\r\n */\r\n await delay(0)\r\n\r\n const projectId = project.address.projectId\r\n\r\n studio.ephemeralAtom.setByPointer(\r\n (p: $____FixmeStudio) => p.coreByProject[projectId],\r\n {\r\n lastExportedObject: null,\r\n loadingState: {type: 'loading'},\r\n },\r\n )\r\n\r\n const browserState = val(studio.atomP.historic.coreByProject[projectId])\r\n\r\n if (!browserState) {\r\n if (!onDiskState) {\r\n useInitialState()\r\n } else {\r\n useOnDiskState(onDiskState)\r\n }\r\n } else {\r\n if (!onDiskState) {\r\n useBrowserState()\r\n } else {\r\n if (\r\n browserState.revisionHistory.indexOf(onDiskState.revisionHistory[0]) ==\r\n -1\r\n ) {\r\n browserStateIsNotBasedOnDiskState(onDiskState)\r\n } else {\r\n useBrowserState()\r\n }\r\n }\r\n }\r\n\r\n function useInitialState() {\r\n studio.transaction(({stateEditors}: $____FixmeStudio) => {\r\n stateEditors.coreByProject.historic.setProjectState({\r\n projectId,\r\n state: {\r\n sheetsById: {},\r\n definitionVersion: globals.currentProjectStateDefinitionVersion,\r\n revisionHistory: [],\r\n },\r\n })\r\n }, false)\r\n studio.ephemeralAtom.setByPointer(\r\n (p: $____FixmeStudio) => p.coreByProject[projectId].loadingState,\r\n {\r\n type: 'loaded',\r\n },\r\n )\r\n }\r\n\r\n function useOnDiskState(state: OnDiskState) {\r\n studio.transaction(({stateEditors}: $____FixmeStudio) => {\r\n stateEditors.coreByProject.historic.setProjectState({\r\n projectId,\r\n state,\r\n })\r\n })\r\n\r\n studio.ephemeralAtom.setByPointer(\r\n (p: $____FixmeStudio) => p.coreByProject[projectId].loadingState,\r\n {\r\n type: 'loaded',\r\n },\r\n )\r\n }\r\n\r\n function useBrowserState() {\r\n studio.ephemeralAtom.setByPointer(\r\n (p: $____FixmeStudio) => p.coreByProject[projectId].loadingState,\r\n {\r\n type: 'loaded',\r\n },\r\n )\r\n }\r\n\r\n function browserStateIsNotBasedOnDiskState(onDiskState: OnDiskState) {\r\n studio.ephemeralAtom.setByPointer(\r\n (p: $____FixmeStudio) => p.coreByProject[projectId].loadingState,\r\n {\r\n type: 'browserStateIsNotBasedOnDiskState',\r\n onDiskState,\r\n },\r\n )\r\n }\r\n}\r\n", "import {privateAPI, setPrivateAPI} from '@encorejs/core/privateAPIs'\r\nimport Project from '@encorejs/core/projects/Project'\r\nimport type {Asset, ProjectAddress} from '@encorejs/core/types/public'\r\nimport type {\r\n ProjectId,\r\n SheetId,\r\n SheetInstanceId,\r\n} from '@encorejs/core/types/public'\r\nimport {validateInstanceId} from '@encorejs/utils/sanitizers'\r\nimport {validateAndSanitiseSlashedPathOrThrow} from '@encorejs/utils/slashedPaths'\r\nimport type {IProject, IProjectConfig, ISheet} from '@encorejs/core/types/public'\r\nimport {notify} from '@encorejs/core/coreExports'\r\n\r\n// export type IProjectConfigExperiments = {\r\n// /**\r\n// * Defaults to using global `console` with style args.\r\n// *\r\n// * (TODO: check for browser environment before using style args)\r\n// */\r\n// /**\r\n// * Defaults:\r\n// * * `production` builds: console - error\r\n// * * `development` builds: console - error, warning\r\n// */\r\n// }\r\n\r\nexport default class TheatreProject implements IProject {\r\n get type(): 'Theatre_Project_PublicAPI' {\r\n return 'Theatre_Project_PublicAPI'\r\n }\r\n /**\r\n * @internal\r\n */\r\n constructor(id: string, config: IProjectConfig = {}) {\r\n setPrivateAPI(this, new Project(id as ProjectId, config, this))\r\n }\r\n\r\n get ready(): Promise<void> {\r\n return privateAPI(this).ready\r\n }\r\n\r\n get isReady(): boolean {\r\n return privateAPI(this).isReady()\r\n }\r\n\r\n get address(): ProjectAddress {\r\n return {...privateAPI(this).address}\r\n }\r\n\r\n getAssetUrl(asset: Asset): string | undefined {\r\n // probably should put this in project.getAssetUrl but this will do for now\r\n if (!this.isReady) {\r\n console.error(\r\n 'Calling `project.getAssetUrl()` before `project.ready` is resolved, will always return `undefined`. ' +\r\n 'Either use `project.ready.then(() => project.getAssetUrl())` or `await project.ready` before calling `project.getAssetUrl()`.',\r\n )\r\n return undefined\r\n }\r\n\r\n return asset.id\r\n ? privateAPI(this).assetStorage.getAssetUrl(asset.id)\r\n : undefined\r\n }\r\n\r\n sheet(sheetId: string, instanceId: string = 'default'): ISheet {\r\n const sanitizedPath = validateAndSanitiseSlashedPathOrThrow(\r\n sheetId,\r\n 'project.sheet',\r\n notify.warning,\r\n )\r\n\r\n if (process.env.NODE_ENV !== 'production') {\r\n validateInstanceId(\r\n instanceId,\r\n 'instanceId in project.sheet(sheetId, instanceId)',\r\n true,\r\n )\r\n }\r\n\r\n return privateAPI(this).getOrCreateSheet(\r\n sanitizedPath as SheetId,\r\n instanceId as SheetInstanceId,\r\n ).publicApi\r\n }\r\n}\r\n", "import type {KeyframeId, SequenceTrackId} from '@encorejs/core/types/public'\r\n\r\nexport function asKeyframeId(s: string): KeyframeId {\r\n return s as KeyframeId\r\n}\r\n\r\nexport function asSequenceTrackId(s: string): SequenceTrackId {\r\n return s as SequenceTrackId\r\n}\r\n", "import type {Env} from './envSchema'\r\n\r\n// process.env is guaranteed to be of type Env, because we validate it in the `devEnv` scripts.\r\nexport const env = process.env as Env\r\n", "// import type {Studio} from '@encorejs/studio/Studio'\r\nimport projectsSingleton from './projects/projectsSingleton'\r\nimport {privateAPI} from './privateAPIs'\r\nimport * as coreExports from './coreExports'\r\nimport {getCoreRafDriver} from './coreTicker'\r\nimport type {$____FixmeStudio} from '@encorejs/core/types/public'\r\nimport {env} from './env'\r\n\r\ntype Studio = $____FixmeStudio\r\n\r\nexport type CoreBits = {\r\n projectsP: typeof projectsSingleton.atom.pointer.projects\r\n privateAPI: typeof privateAPI\r\n coreExports: typeof coreExports\r\n getCoreRafDriver: typeof getCoreRafDriver\r\n}\r\n\r\nexport default class CoreBundle {\r\n private _studio: Studio | undefined = undefined\r\n constructor(private _opts: {onAttach: (studio: Studio) => void}) {}\r\n\r\n get type(): 'Theatre_CoreBundle' {\r\n return 'Theatre_CoreBundle'\r\n }\r\n\r\n get version() {\r\n return env.THEATRE_VERSION\r\n }\r\n\r\n getBitsForStudio(studio: Studio, callback: (bits: CoreBits) => void) {\r\n if (this._studio) {\r\n throw new Error(`@encorejs/core is already attached to @encorejs/studio`)\r\n }\r\n this._studio = studio\r\n const bits: CoreBits = {\r\n projectsP: projectsSingleton.atom.pointer.projects,\r\n privateAPI: privateAPI,\r\n coreExports,\r\n getCoreRafDriver,\r\n }\r\n\r\n callback(bits)\r\n this._opts.onAttach(studio)\r\n }\r\n}\r\n", "import * as core from '@encorejs/core'\r\n\r\n// @ts-ignore\r\nwindow.Encore = core\r\n"],
|
|
5
|
+
"mappings": "uhDAAA,IAuBIA,GAEGC,GAzBPC,GAAAC,EAAA,KAuBIH,GAAU,MAAM,QAEbC,GAAQD,KCzBf,IACII,GAEGC,GAHPC,GAAAC,EAAA,KACIH,GAAa,OAAO,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,OAAU,KACjB,OAAO,6CAA+C,GAEtD,OAEF,IAAMC,EAAgB,OAAO,OAAW,IAAc,OAAS,OAIzDC,EAEJD,EAAchO,GAAoB,UAAU,EAE9C,GAAI,OAAOiO,EAAmB,IAC5B,MACE,OAAOA,GAAmB,UAC1BA,GACA,OAAOA,EAAe,SAAY,SAuC5B,IAAI,MACR,sZAIF,EAEM,IAAI,MACR,uBAAuB,OAAAjO,GAAoB,WAAU,iEAAA,CACvD,EAIJ,IAAMkO,EAAa,IAAIX,GAAW,CAChC,SAAW7M,GAAM,CACVmN,GAAiB,QAAQ,KAAMlG,GAAS,CAC3CjH,EAAE,WAAWiH,CAAI,EACjB+F,GAAe,QAAQhN,CAAC,CAC1B,CAAC,CACH,CACF,CAAC,EAGDsN,EAAchO,GAAoB,UAAU,EAAIkO,EAEhD,IAAMC,EAEJH,EAAchO,GAAoB,YAAY,EAG9CmO,GACAA,IAAiC,MACjCA,EAA6B,OAAS,wBAEtCA,EAA6B,mBAAmBD,CAAU,CAE9D,IqOrJA,IAAAE,GAAsB,SAGtB,OAAO,OAASA",
|
|
6
|
+
"names": ["isArray", "isArray_default", "init_isArray", "__esmMin", "freeGlobal", "freeGlobal_default", "init_freeGlobal", "__esmMin", "freeSelf", "root", "root_default", "init_root", "__esmMin", "init_freeGlobal", "freeGlobal_default", "Symbol", "Symbol_default", "init_Symbol", "__esmMin", "init_root", "root_default", "getRawTag", "value", "isOwn", "hasOwnProperty", "symToStringTag", "tag", "unmasked", "e", "result", "nativeObjectToString", "objectProto", "getRawTag_default", "init_getRawTag", "__esmMin", "init_Symbol", "Symbol_default", "objectToString", "value", "nativeObjectToString", "objectProto", "objectToString_default", "init_objectToString", "__esmMin", "baseGetTag", "value", "undefinedTag", "nullTag", "symToStringTag", "getRawTag_default", "objectToString_default", "baseGetTag_default", "init_baseGetTag", "__esmMin", "init_Symbol", "init_getRawTag", "init_objectToString", "Symbol_default", "isObjectLike", "value", "isObjectLike_default", "init_isObjectLike", "__esmMin", "isSymbol", "value", "isObjectLike_default", "baseGetTag_default", "symbolTag", "isSymbol_default", "init_isSymbol", "__esmMin", "init_baseGetTag", "init_isObjectLike", "isKey", "value", "object", "isArray_default", "type", "isSymbol_default", "reIsPlainProp", "reIsDeepProp", "isKey_default", "init_isKey", "__esmMin", "init_isArray", "init_isSymbol", "isObject", "value", "type", "isObject_default", "init_isObject", "__esmMin", "isFunction", "value", "isObject_default", "tag", "baseGetTag_default", "funcTag", "genTag", "asyncTag", "proxyTag", "isFunction_default", "init_isFunction", "__esmMin", "init_baseGetTag", "init_isObject", "coreJsData", "coreJsData_default", "init_coreJsData", "__esmMin", "init_root", "root_default", "isMasked", "func", "maskSrcKey", "isMasked_default", "init_isMasked", "__esmMin", "init_coreJsData", "uid", "coreJsData_default", "toSource", "func", "funcToString", "e", "funcProto", "toSource_default", "init_toSource", "__esmMin", "baseIsNative", "value", "isObject_default", "isMasked_default", "pattern", "isFunction_default", "reIsNative", "reIsHostCtor", "toSource_default", "reRegExpChar", "funcProto", "objectProto", "funcToString", "hasOwnProperty", "baseIsNative_default", "init_baseIsNative", "__esmMin", "init_isFunction", "init_isMasked", "init_isObject", "init_toSource", "getValue", "object", "key", "getValue_default", "init_getValue", "__esmMin", "getNative", "object", "key", "value", "getValue_default", "baseIsNative_default", "getNative_default", "init_getNative", "__esmMin", "init_baseIsNative", "init_getValue", "nativeCreate", "nativeCreate_default", "init_nativeCreate", "__esmMin", "init_getNative", "getNative_default", "hashClear", "nativeCreate_default", "hashClear_default", "init_hashClear", "__esmMin", "init_nativeCreate", "hashDelete", "key", "result", "hashDelete_default", "init_hashDelete", "__esmMin", "hashGet", "key", "data", "nativeCreate_default", "result", "HASH_UNDEFINED", "hasOwnProperty", "objectProto", "hashGet_default", "init_hashGet", "__esmMin", "init_nativeCreate", "hashHas", "key", "data", "nativeCreate_default", "hasOwnProperty", "objectProto", "hashHas_default", "init_hashHas", "__esmMin", "init_nativeCreate", "hashSet", "key", "value", "data", "nativeCreate_default", "HASH_UNDEFINED", "hashSet_default", "init_hashSet", "__esmMin", "init_nativeCreate", "Hash", "entries", "index", "length", "entry", "Hash_default", "init_Hash", "__esmMin", "init_hashClear", "init_hashDelete", "init_hashGet", "init_hashHas", "init_hashSet", "hashClear_default", "hashDelete_default", "hashGet_default", "hashHas_default", "hashSet_default", "listCacheClear", "listCacheClear_default", "init_listCacheClear", "__esmMin", "eq", "value", "other", "eq_default", "init_eq", "__esmMin", "assocIndexOf", "array", "key", "length", "eq_default", "assocIndexOf_default", "init_assocIndexOf", "__esmMin", "init_eq", "listCacheDelete", "key", "data", "index", "assocIndexOf_default", "lastIndex", "splice", "arrayProto", "listCacheDelete_default", "init_listCacheDelete", "__esmMin", "init_assocIndexOf", "listCacheGet", "key", "data", "index", "assocIndexOf_default", "listCacheGet_default", "init_listCacheGet", "__esmMin", "init_assocIndexOf", "listCacheHas", "key", "assocIndexOf_default", "listCacheHas_default", "init_listCacheHas", "__esmMin", "init_assocIndexOf", "listCacheSet", "key", "value", "data", "index", "assocIndexOf_default", "listCacheSet_default", "init_listCacheSet", "__esmMin", "init_assocIndexOf", "ListCache", "entries", "index", "length", "entry", "ListCache_default", "init_ListCache", "__esmMin", "init_listCacheClear", "init_listCacheDelete", "init_listCacheGet", "init_listCacheHas", "init_listCacheSet", "listCacheClear_default", "listCacheDelete_default", "listCacheGet_default", "listCacheHas_default", "listCacheSet_default", "Map", "Map_default", "init_Map", "__esmMin", "init_getNative", "init_root", "getNative_default", "root_default", "mapCacheClear", "Hash_default", "Map_default", "ListCache_default", "mapCacheClear_default", "init_mapCacheClear", "__esmMin", "init_Hash", "init_ListCache", "init_Map", "isKeyable", "value", "type", "isKeyable_default", "init_isKeyable", "__esmMin", "getMapData", "map", "key", "data", "isKeyable_default", "getMapData_default", "init_getMapData", "__esmMin", "init_isKeyable", "mapCacheDelete", "key", "result", "getMapData_default", "mapCacheDelete_default", "init_mapCacheDelete", "__esmMin", "init_getMapData", "mapCacheGet", "key", "getMapData_default", "mapCacheGet_default", "init_mapCacheGet", "__esmMin", "init_getMapData", "mapCacheHas", "key", "getMapData_default", "mapCacheHas_default", "init_mapCacheHas", "__esmMin", "init_getMapData", "mapCacheSet", "key", "value", "data", "getMapData_default", "size", "mapCacheSet_default", "init_mapCacheSet", "__esmMin", "init_getMapData", "MapCache", "entries", "index", "length", "entry", "MapCache_default", "init_MapCache", "__esmMin", "init_mapCacheClear", "init_mapCacheDelete", "init_mapCacheGet", "init_mapCacheHas", "init_mapCacheSet", "mapCacheClear_default", "mapCacheDelete_default", "mapCacheGet_default", "mapCacheHas_default", "mapCacheSet_default", "memoize", "func", "resolver", "FUNC_ERROR_TEXT", "memoized", "args", "key", "cache", "result", "MapCache_default", "memoize_default", "init_memoize", "__esmMin", "init_MapCache", "memoizeCapped", "func", "result", "memoize_default", "key", "cache", "MAX_MEMOIZE_SIZE", "memoizeCapped_default", "init_memoizeCapped", "__esmMin", "init_memoize", "rePropName", "reEscapeChar", "stringToPath", "stringToPath_default", "init_stringToPath", "__esmMin", "init_memoizeCapped", "memoizeCapped_default", "string", "result", "match", "number", "quote", "subString", "arrayMap", "array", "iteratee", "index", "length", "result", "arrayMap_default", "init_arrayMap", "__esmMin", "baseToString", "value", "isArray_default", "arrayMap_default", "isSymbol_default", "symbolToString", "result", "INFINITY", "symbolProto", "baseToString_default", "init_baseToString", "__esmMin", "init_Symbol", "init_arrayMap", "init_isArray", "init_isSymbol", "Symbol_default", "toString", "value", "baseToString_default", "toString_default", "init_toString", "__esmMin", "init_baseToString", "castPath", "value", "object", "isArray_default", "isKey_default", "stringToPath_default", "toString_default", "castPath_default", "init_castPath", "__esmMin", "init_isArray", "init_isKey", "init_stringToPath", "init_toString", "toKey", "value", "isSymbol_default", "result", "INFINITY", "toKey_default", "init_toKey", "__esmMin", "init_isSymbol", "baseGet", "object", "path", "castPath_default", "index", "length", "toKey_default", "baseGet_default", "init_baseGet", "__esmMin", "init_castPath", "init_toKey", "get", "object", "path", "defaultValue", "result", "baseGet_default", "get_default", "init_get", "__esmMin", "init_baseGet", "overArg", "func", "transform", "arg", "overArg_default", "init_overArg", "__esmMin", "getPrototype", "getPrototype_default", "init_getPrototype", "__esmMin", "init_overArg", "overArg_default", "isPlainObject", "value", "isObjectLike_default", "baseGetTag_default", "objectTag", "proto", "getPrototype_default", "Ctor", "hasOwnProperty", "funcToString", "objectCtorString", "funcProto", "objectProto", "isPlainObject_default", "init_isPlainObject", "__esmMin", "init_baseGetTag", "init_getPrototype", "init_isObjectLike", "last", "array", "length", "last_default", "init_last", "__esmMin", "pointer", "args", "_a", "meta", "pointerKey", "pointerMetaWeakMap", "proxyHandler", "cachedSubPathPointersWeakMap", "pointerMetaSymbol", "getPointerMeta", "getPointerParts", "pointer_default", "isPointer", "init_pointer", "__esmMin", "prop", "subPathPointers", "existing", "subPointer", "p", "root", "path", "updateDeep", "state", "path", "reducer", "hoop", "init_updateDeep", "__esmMin", "s", "index", "restOfPath", "oldVal", "newVal", "newS", "key", "__spreadProps", "__spreadValues", "Stack", "init_Stack", "__esmMin", "head", "data", "node", "isPrism", "d", "init_Interface", "__esmMin", "createMechanism", "noop", "stack", "Stack", "noopCollector", "d", "possibleCollector", "_d", "collector", "getSharedMechanism", "varName", "root", "existingMechanism", "mechanism", "startIgnoringDependencies", "stopIgnoringDependencies", "reportResolutionEnd", "reportResolutionStart", "pushCollector", "popCollector", "init_discoveryMechanism", "__esmMin", "init_Stack", "cleanupScopeStack", "scope", "sub", "safelyRun", "fn", "returnValueInCaseOfError", "error", "ref", "key", "initialValue", "hookScopeStack", "effect", "cb", "deps", "depsHaveChanged", "oldDeps", "newDeps", "len", "i", "memo", "state", "ensurePrism", "parentScope", "subScope", "ret", "prism", "inPrism", "source", "subscribe", "getValue", "calculateColdPrism", "ColdScope", "value", "voidFn", "HotHandle", "emptyObject", "PrismInstance", "HotScope", "prism_default", "init_prism", "__esmMin", "init_Stack", "init_Interface", "init_discoveryMechanism", "_fn", "_prismInstance", "which", "d", "startIgnoringDependencies", "stopIgnoringDependencies", "newValue", "anActuallyStaleDepWasFound", "dep", "collector", "observedDep", "pushCollector", "popCollector", "dependent", "ticker", "listener", "immediate", "refresh", "lastValue", "callback", "untap", "onStaleCallback", "hotHandle", "handle", "reportResolutionStart", "val", "reportResolutionEnd", "_HotScope", "_hotHandle", "setValue", "sourceKey", "Stack", "_ColdScope", "getTypeOfValue", "getKeyOfValue", "isValidArrayIndex", "Scope", "Atom", "init_Atom", "__esmMin", "init_get", "init_isPlainObject", "init_last", "init_pointer", "init_updateDeep", "init_prism", "v", "isPlainObject_default", "key", "vType", "inNumber", "_Scope", "_parent", "_path", "cb", "child", "last_default", "initialState", "pointer_default", "pointerOrFn", "pointer", "isPointer", "path", "getPointerParts", "scope", "newState", "oldState", "get_default", "fn", "reducer", "updateDeep", "val", "oldValueType", "newValueType", "childKey", "childScope", "oldChildVal", "newChildVal", "curScope", "pathEl", "subscribe", "listener", "getValue", "prism_default", "isPointerToPrismProvider", "val", "identifyPrismWeakMap", "pointerToPrism", "init_pointerToPrism", "__esmMin", "init_pointer", "pointer", "meta", "getPointerMeta", "prismInstance", "root", "val", "init_val", "__esmMin", "init_Interface", "init_pointer", "init_pointerToPrism", "input", "isPointer", "pointerToPrism", "isPrism", "iterateAndCountTicks", "pointerOrPrism", "d", "isPointer", "pointerToPrism", "isPrism", "ticksCountedSinceLastYield", "untap", "ticks", "init_iterateAndCountTicks", "__esmMin", "init_pointerToPrism", "init_pointer", "init_Interface", "Ticker", "init_Ticker", "__esmMin", "_conf", "fn", "_a", "_b", "v", "iterationNumber", "time", "oldSet", "iterateOver", "pointerOrPrism", "d", "isPointer", "pointerToPrism", "isPrism", "ticker", "Ticker", "untap", "v", "init_iterateOver", "__esmMin", "init_pointerToPrism", "init_pointer", "init_Ticker", "init_Interface", "PointerProxy", "init_PointerProxy", "__esmMin", "init_Atom", "init_val", "init_pointer", "init_prism", "currentPointer", "Atom", "pointer_default", "p", "pointer", "path", "getPointerMeta", "prism_default", "subPointer", "pointerSoFar", "pathItem", "val", "src_exports", "__export", "Atom", "PointerProxy", "Ticker", "getPointerParts", "isPointer", "isPrism", "iterateAndCountTicks", "iterateOver", "pointer_default", "pointerToPrism", "prism_default", "val", "init_src", "__esmMin", "init_Atom", "init_val", "init_pointerToPrism", "init_Interface", "init_iterateAndCountTicks", "init_iterateOver", "init_prism", "init_pointer", "init_Ticker", "init_PointerProxy", "require_UnitBezier", "__commonJS", "exports", "module", "UnitBezier", "p1x", "p1y", "p2x", "p2y", "t", "x", "epsilon", "d2", "i", "t0", "t1", "t2", "x2", "require_levenshtein_edit_distance", "cache", "codes", "levenshtein", "value", "other", "insensitive", "length", "lengthOther", "code", "result", "distance", "distanceOther", "index", "indexOther", "require_propose", "propose", "ratio", "proposed", "threshold", "ignoreCase", "max_ratio", "word", "dictionary", "len", "options", "require_fast_deep_equal", "equal", "a", "b", "keys", "key", "src_exports", "__export", "__private", "createRafDriver", "src_default", "getProject", "getStudio", "getStudioSync", "init", "notify", "onChange", "propTypeSymbol", "propTypes_exports", "val", "__toCommonJS", "coreExports_exports", "import_dataverse", "ProjectsSingleton", "__publicField", "id", "project", "p", "singleton", "projectsSingleton_default", "publicAPIToPrivateAPIMap", "privateAPI", "pub", "setPrivateAPI", "priv", "emptyArray", "isArray", "isArray_default", "freeGlobal", "freeGlobal_default", "freeSelf", "root", "root_default", "Symbol", "Symbol_default", "objectProto", "hasOwnProperty", "nativeObjectToString", "symToStringTag", "getRawTag", "isOwn", "tag", "unmasked", "e", "getRawTag_default", "objectToString", "objectToString_default", "nullTag", "undefinedTag", "baseGetTag", "baseGetTag_default", "isObjectLike", "isObjectLike_default", "symbolTag", "isSymbol", "isSymbol_default", "reIsDeepProp", "reIsPlainProp", "isKey", "object", "type", "isKey_default", "isObject", "isObject_default", "asyncTag", "funcTag", "genTag", "proxyTag", "isFunction", "isFunction_default", "coreJsData", "coreJsData_default", "maskSrcKey", "uid", "isMasked", "func", "isMasked_default", "funcProto", "funcToString", "toSource", "toSource_default", "reRegExpChar", "reIsHostCtor", "reIsNative", "baseIsNative", "pattern", "baseIsNative_default", "getValue", "getValue_default", "getNative", "getNative_default", "nativeCreate", "nativeCreate_default", "hashClear", "hashClear_default", "hashDelete", "hashDelete_default", "HASH_UNDEFINED", "hashGet", "data", "hashGet_default", "hashHas", "hashHas_default", "hashSet", "hashSet_default", "Hash", "entries", "entry", "Hash_default", "listCacheClear", "listCacheClear_default", "eq", "eq_default", "assocIndexOf", "array", "assocIndexOf_default", "arrayProto", "splice", "listCacheDelete", "lastIndex", "listCacheDelete_default", "listCacheGet", "listCacheGet_default", "listCacheHas", "listCacheHas_default", "listCacheSet", "listCacheSet_default", "ListCache", "ListCache_default", "Map", "Map_default", "mapCacheClear", "mapCacheClear_default", "isKeyable", "isKeyable_default", "getMapData", "map", "getMapData_default", "mapCacheDelete", "mapCacheDelete_default", "mapCacheGet", "mapCacheGet_default", "mapCacheHas", "mapCacheHas_default", "mapCacheSet", "size", "mapCacheSet_default", "MapCache", "MapCache_default", "FUNC_ERROR_TEXT", "memoize", "resolver", "memoized", "args", "memoize_default", "MAX_MEMOIZE_SIZE", "memoizeCapped", "memoizeCapped_default", "rePropName", "reEscapeChar", "stringToPath", "string", "match", "number", "quote", "subString", "stringToPath_default", "arrayMap", "iteratee", "arrayMap_default", "INFINITY", "symbolProto", "symbolToString", "baseToString", "baseToString_default", "toString", "toString_default", "castPath", "castPath_default", "toKey", "toKey_default", "baseGet", "path", "baseGet_default", "get", "defaultValue", "get_default", "getDeep", "v", "SimpleCache", "producer", "cachedValue", "defineProperty", "defineProperty_default", "baseAssignValue", "baseAssignValue_default", "assignValue", "objValue", "assignValue_default", "MAX_SAFE_INTEGER", "reIsUint", "isIndex", "isIndex_default", "baseSet", "customizer", "nested", "newValue", "baseSet_default", "set", "set_default", "cachedDefaults", "getPropDefaultsOfSheetObject", "config", "getDefaultsOfPropTypeConfig", "generated", "generateDefaultsForCompound", "generateDefaultsForEnum", "defaults", "case_", "caseConf", "propConf", "import_UnitBezier", "__toESM", "keyframeUtils_exports", "fromArray", "fromSortedKeyframesCached", "getSortedKeyframes", "getSortedKeyframesCached", "memoizeFn", "k", "reWhitespace", "trimmedEndIndex", "trimmedEndIndex_default", "reTrimStart", "baseTrim", "baseTrim_default", "NAN", "reIsBadHex", "reIsBinary", "reIsOctal", "freeParseInt", "toNumber", "isBinary", "toNumber_default", "MAX_INTEGER", "toFinite", "sign", "toFinite_default", "toInteger", "remainder", "toInteger_default", "identity", "identity_default", "WeakMap", "WeakMap_default", "objectCreate", "baseCreate", "proto", "baseCreate_default", "copyArray", "source", "copyArray_default", "arrayEach", "arrayEach_default", "copyObject", "props", "isNew", "copyObject_default", "isLength", "isLength_default", "isArrayLike", "isArrayLike_default", "isPrototype", "Ctor", "isPrototype_default", "baseTimes", "n", "baseTimes_default", "argsTag", "baseIsArguments", "baseIsArguments_default", "propertyIsEnumerable", "isArguments", "isArguments_default", "stubFalse", "stubFalse_default", "freeExports", "freeModule", "moduleExports", "Buffer", "nativeIsBuffer", "isBuffer", "isBuffer_default", "arrayTag", "boolTag", "dateTag", "errorTag", "mapTag", "numberTag", "objectTag", "regexpTag", "setTag", "stringTag", "weakMapTag", "arrayBufferTag", "dataViewTag", "float32Tag", "float64Tag", "int8Tag", "int16Tag", "int32Tag", "uint8Tag", "uint8ClampedTag", "uint16Tag", "uint32Tag", "typedArrayTags", "baseIsTypedArray", "baseIsTypedArray_default", "baseUnary", "baseUnary_default", "freeProcess", "nodeUtil", "types", "nodeUtil_default", "nodeIsTypedArray", "isTypedArray", "isTypedArray_default", "arrayLikeKeys", "inherited", "isArr", "isArg", "isBuff", "isType", "skipIndexes", "arrayLikeKeys_default", "overArg", "transform", "arg", "overArg_default", "nativeKeys", "nativeKeys_default", "baseKeys", "baseKeys_default", "keys_default", "nativeKeysIn", "nativeKeysIn_default", "baseKeysIn", "isProto", "baseKeysIn_default", "keysIn", "keysIn_default", "arrayPush", "values", "offset", "arrayPush_default", "getPrototype", "getPrototype_default", "objectCtorString", "isPlainObject", "isPlainObject_default", "baseSlice", "start", "end", "baseSlice_default", "castSlice", "castSlice_default", "rsAstralRange", "rsComboMarksRange", "reComboHalfMarksRange", "rsComboSymbolsRange", "rsComboRange", "rsVarRange", "rsZWJ", "reHasUnicode", "hasUnicode", "hasUnicode_default", "asciiToArray", "asciiToArray_default", "rsAstral", "rsCombo", "rsFitz", "rsModifier", "rsNonAstral", "rsRegional", "rsSurrPair", "reOptMod", "rsOptVar", "rsOptJoin", "rsSeq", "rsSymbol", "reUnicode", "unicodeToArray", "unicodeToArray_default", "stringToArray", "stringToArray_default", "baseClamp", "lower", "upper", "baseClamp_default", "clamp", "clamp_default", "stackClear", "stackClear_default", "stackDelete", "stackDelete_default", "stackGet", "stackGet_default", "stackHas", "stackHas_default", "LARGE_ARRAY_SIZE", "stackSet", "pairs", "stackSet_default", "Stack", "Stack_default", "baseAssign", "baseAssign_default", "baseAssignIn", "baseAssignIn_default", "allocUnsafe", "cloneBuffer", "buffer", "isDeep", "cloneBuffer_default", "arrayFilter", "predicate", "resIndex", "arrayFilter_default", "stubArray", "stubArray_default", "nativeGetSymbols", "getSymbols", "symbol", "getSymbols_default", "copySymbols", "copySymbols_default", "getSymbolsIn", "getSymbolsIn_default", "copySymbolsIn", "copySymbolsIn_default", "baseGetAllKeys", "keysFunc", "symbolsFunc", "baseGetAllKeys_default", "getAllKeys", "getAllKeys_default", "getAllKeysIn", "getAllKeysIn_default", "DataView", "DataView_default", "Promise", "Promise_default", "Set", "Set_default", "promiseTag", "dataViewCtorString", "mapCtorString", "promiseCtorString", "setCtorString", "weakMapCtorString", "getTag", "ctorString", "getTag_default", "initCloneArray", "initCloneArray_default", "Uint8Array", "Uint8Array_default", "cloneArrayBuffer", "arrayBuffer", "cloneArrayBuffer_default", "cloneDataView", "dataView", "cloneDataView_default", "reFlags", "cloneRegExp", "regexp", "cloneRegExp_default", "symbolValueOf", "cloneSymbol", "cloneSymbol_default", "cloneTypedArray", "typedArray", "cloneTypedArray_default", "initCloneByTag", "initCloneByTag_default", "initCloneObject", "initCloneObject_default", "baseIsMap", "baseIsMap_default", "nodeIsMap", "isMap", "isMap_default", "baseIsSet", "baseIsSet_default", "nodeIsSet", "isSet", "isSet_default", "CLONE_DEEP_FLAG", "CLONE_FLAT_FLAG", "CLONE_SYMBOLS_FLAG", "cloneableTags", "baseClone", "bitmask", "stack", "isFlat", "isFull", "isFunc", "stacked", "subValue", "baseClone_default", "cloneDeep", "cloneDeep_default", "setCacheAdd", "setCacheAdd_default", "setCacheHas", "setCacheHas_default", "SetCache", "SetCache_default", "arraySome", "arraySome_default", "cacheHas", "cacheHas_default", "COMPARE_PARTIAL_FLAG", "COMPARE_UNORDERED_FLAG", "equalArrays", "equalFunc", "isPartial", "arrLength", "othLength", "arrStacked", "othStacked", "seen", "arrValue", "othValue", "compared", "othIndex", "equalArrays_default", "mapToArray", "mapToArray_default", "setToArray", "setToArray_default", "equalByTag", "convert", "equalByTag_default", "equalObjects", "objProps", "objLength", "othProps", "objStacked", "skipCtor", "objCtor", "othCtor", "equalObjects_default", "baseIsEqualDeep", "objIsArr", "othIsArr", "objTag", "othTag", "objIsObj", "othIsObj", "isSameTag", "objIsWrapped", "othIsWrapped", "objUnwrapped", "othUnwrapped", "baseIsEqualDeep_default", "baseIsEqual", "baseIsEqual_default", "baseIsMatch", "matchData", "noCustomizer", "srcValue", "baseIsMatch_default", "isStrictComparable", "isStrictComparable_default", "getMatchData", "getMatchData_default", "matchesStrictComparable", "matchesStrictComparable_default", "baseMatches", "baseMatches_default", "baseHasIn", "baseHasIn_default", "hasPath", "hasFunc", "hasPath_default", "hasIn", "hasIn_default", "baseMatchesProperty", "baseMatchesProperty_default", "baseProperty", "baseProperty_default", "basePropertyDeep", "basePropertyDeep_default", "property", "property_default", "baseIteratee", "baseIteratee_default", "createBaseFor", "fromRight", "iterable", "createBaseFor_default", "baseFor", "baseFor_default", "baseForOwn", "baseForOwn_default", "now", "now_default", "nativeMax", "nativeMin", "debounce", "wait", "lastArgs", "lastThis", "maxWait", "timerId", "lastCallTime", "lastInvokeTime", "leading", "maxing", "trailing", "invokeFunc", "time", "thisArg", "leadingEdge", "timerExpired", "remainingWait", "timeSinceLastCall", "timeSinceLastInvoke", "timeWaiting", "shouldInvoke", "trailingEdge", "cancel", "flush", "debounced", "isInvoking", "debounce_default", "last", "last_default", "parent", "parent_default", "isInteger", "isInteger_default", "mapValues", "mapValues_default", "baseUnset", "baseUnset_default", "nativeFloor", "baseRepeat", "baseRepeat_default", "asciiSize", "asciiSize_default", "unicodeSize", "unicodeSize_default", "stringSize", "stringSize_default", "nativeCeil", "createPadding", "chars", "charsLength", "createPadding_default", "padStart", "strLength", "padStart_default", "unset", "unset_default", "keyframes", "sorted", "byId", "allIds", "keyframe", "interpolationTripleAtPosition", "trackP", "timeD", "import_dataverse2", "track", "_forKeyframedTrack", "stateRef", "state", "updateState", "undefinedConstD", "progressionD", "progression", "currentKeyframeIndex", "currentKeyframe", "states", "isLastKeyframe", "nextKeyframeIndex", "kf", "left", "right", "globalProgressionToLocalProgression", "globalProgression", "solver", "bezierDer", "valueProgression", "holdDer", "deepMergeWithCache", "base", "override", "possibleCachedValue", "merged", "__spreadValues", "valueInOverride", "valueInBase", "pointerDeep", "toAppend", "valToAtom", "vals", "import_dataverse3", "KEEP_HOT_FOR_MS", "TheatreSheetObject", "internals", "sheetObject", "import_dataverse4", "fn", "rafDriver", "der", "untap", "utils_exports", "compoundHasSimpleDescendants", "forEachPropDeep", "getPropConfigByPath", "isPropConfSequencable", "isPropConfigComposite", "iteratePropType", "valueInProp", "m", "startingPath", "isImage", "isRGBA", "c", "parentConf", "rest", "sub", "propConfig", "sanitizedVal", "conf", "subConf", "pathPrefix", "__yieldStar", "SheetObject", "sheet", "template", "nativeObject", "import_dataverse5", "__spreadProps", "initial", "withInitialCache", "withInitial", "statics", "withStaticsCache", "final", "sequenced", "pointerToSequencedValuesD", "withSeqsCache", "pointer", "allValuesP", "tracksToProcessD", "tracksToProcess", "valsAtom", "untaps", "trackId", "pathToProp", "pr", "deserializeAndSanitize", "interpolate", "updateSequenceValueFromItsPrism", "triple", "leftDeserialized", "rightDeserialized", "getOrderingOfPropTypeConfig", "existing", "iterateOnCompound", "subPath", "iterateOnAny", "isObjectEmpty", "obj", "SheetObjectTemplate", "sheetTemplate", "objectKey", "_temp_actions", "import_dataverse6", "actions", "_a", "json", "pointerToSheetState", "trackIdByPropPath", "arrayOfIds", "objectConfig", "_entries", "pathToPropInString", "parsePathToProp", "mapping", "pathToPropA", "pathToPropB", "indexA", "indexB", "arr", "staticOverrides", "arrayOfValidSequenceTracks", "staticButNotSequencedOverrides", "parentPath", "parentValue", "encodePathToProp", "import_propose", "TheatreError", "InvalidArgumentError", "defer", "resolve", "reject", "promise", "rs", "rj", "deferred", "noop", "noop_default", "DefaultPlaybackController", "import_dataverse7", "playing", "iterationCount", "range", "rate", "direction", "ticker", "iterationLength", "startPos", "initialTickerTime", "totalPlaybackLength", "initialElapsedPos", "tick", "currentTickerTime", "elapsedTickerTimeInSeconds", "elapsedPos", "iterationNumber", "currentIterationPos", "isCurrentIterationNumberEven", "requestNextTick", "isLastIterationEven", "rangeD", "untapFromRangeD", "lastTickerTime", "elapsedSinceLastTick", "elapsedSinceLastTickInSeconds", "lastPosition", "newPosition", "globals", "globalVariableNames", "createHandler", "AudioPlaybackController", "_decodedBuffer", "_audioContext", "_nodeDestination", "import_dataverse8", "stop", "play", "currentSource", "s", "cleanup", "lastDriverId", "import_dataverse9", "driverPublicApi", "driverPrivateApi", "createBasicRafDriver", "rafId", "driver", "onAnimationFrame", "coreRafDriver", "getCoreRafDriver", "setCoreRafDriver", "getCoreTicker", "TheatreSequence", "seq", "d", "position", "prop", "audioContext", "destinationNode", "decodedBuffer", "gainNode", "resolveAudioBuffer", "playbackController", "getAudioContext", "ctx", "listener", "err", "eventsToHookInto", "eventListenerOpts", "eventName", "getAudioBuffer", "decodedBufferDeferred", "fetchResponse", "audioContextPromise", "audioBufferPromise", "instanceTypes_exports", "isProject", "isProjectPublicAPI", "isSheet", "isSheetObject", "isSheetObjectPublicAPI", "isSheetObjectTemplate", "isSheetPublicAPI", "isSheetTemplate", "typeAsserter", "Sequence", "_project", "_sheet", "_lengthD", "_subUnitsPerUnitD", "import_dataverse12", "posInUnitSpace", "gridLength", "import_dataverse11", "import_dataverse13", "statePointer", "subUnitsPerUnit", "TimeBasedPositionFormatter", "import_dataverse10", "trackData", "objectAddress", "requestedPosition", "dur", "sequenceDuration", "oldController", "_fps", "subSecondPos", "frame", "hour", "hours", "minute", "minutes", "second", "seconds", "frames", "frameLength", "boolean", "compound", "file", "image", "rgba", "stringLiteral", "ellipsify", "str", "maxLength", "userReadableTypeOfValue", "userReadableTypeOfValue_default", "rgba2hex", "removeAlphaIfOpaque", "alpha", "hex", "decorateRgba", "clampRgba", "linearSrgbToSrgb", "compress", "srgbToLinearSrgb", "expand", "linearSrgbToOklab", "l", "l_", "m_", "s_", "oklabToLinearSrgb", "laba", "nominal", "isLonghandPropType", "toLonghandProp", "sanitizeCompoundProps", "sanitizedProps", "validateCommonOpts", "fnCallSignature", "opts", "deserializationCache", "deserialized", "atLeastOnePropWasDeserialized", "deserializedSub", "leftInterpolate", "_ensureFile", "valid", "_ensureImage", "defaultNumberNudgeFn", "_interpolateNumber", "numberDeserializer", "_ensureNumber", "sanitized", "component", "_interpolateRgba", "_sanitizeRgba", "leftLab", "rightLab", "interpolatedLab", "interpolatedRgba", "_ensureBoolean", "_ensureString", "valuesAndLabels", "_b", "deltaX", "deltaFraction", "magnitude", "normalizeSlashedPath", "validateAndSanitiseSlashedPathOrThrow", "unsanitisedPath", "fnName", "warn", "import_fast_deep_equal", "TheatreSheet", "internal", "sanitizedPath", "existingObject", "sanitizedConfig", "Sheet", "instanceId", "import_dataverse14", "newState", "lengthD", "unsanitized", "sanitizeSequenceLength", "subUnitsPerUnitD", "sanitizeSequenceSubUnitsPerUnit", "subs", "SheetTemplate", "sheetId", "import_dataverse15", "inst", "delay", "abortSignal", "delayWithAbort", "delayWithoutAbort", "pending", "timeout", "onAbort", "delay_default", "initialiseProjectState", "studio", "onDiskState", "projectId", "browserState", "import_dataverse16", "browserStateIsNotBasedOnDiskState", "useBrowserState", "useOnDiskState", "useInitialState", "stateEditors", "Project", "publicApi", "import_dataverse18", "onDiskEphemeralAtom", "onDiskStateAtom", "assetId", "import_dataverse17", "assetStorage", "shallowValidateOnDiskState", "deepValidateOnDiskState", "TheatreProject", "asset", "ids_exports", "asKeyframeId", "asSequenceTrackId", "existingProject", "callback", "import_dataverse19", "import_dataverse20", "env", "CoreBundle", "_opts", "bits", "studioDeferred", "errorIfNotReady", "initCalled", "initOptsDeferred", "theatre", "registerCoreBundle", "globalContext", "existingBundle", "coreBundle", "possibleExistingStudioBundle", "core"]
|
|
7
|
+
}
|