From 1662afac8bcdc4790a027570dcc53172606276fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E5=86=AC=E6=9D=B0?= Date: Mon, 9 Aug 2021 11:06:25 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=A1=B9=E7=9B=AE=E5=BC=80?= =?UTF-8?q?=E5=8F=91=E4=BD=93=E9=AA=8C=20(#90)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * run examples dev server by vite * update examples --- .gitignore | 1 + dist/cdn/EVA.js | 5068 --- dist/cdn/EVA.plugin.EVAX.js | 2822 -- dist/cdn/EVA.plugin.a11y.js | 3132 -- dist/cdn/EVA.plugin.matterjs.js | 11131 ------ dist/cdn/EVA.plugin.renderer.dragonbone.js | 19361 ----------- dist/cdn/EVA.plugin.renderer.event.js | 226 - dist/cdn/EVA.plugin.renderer.graphics.js | 91 - dist/cdn/EVA.plugin.renderer.img.js | 134 - dist/cdn/EVA.plugin.renderer.js | 2764 -- dist/cdn/EVA.plugin.renderer.lottie.js | 331 - dist/cdn/EVA.plugin.renderer.mask.js | 279 - dist/cdn/EVA.plugin.renderer.matterjs.js | 11086 ------ dist/cdn/EVA.plugin.renderer.ninePatch.js | 166 - dist/cdn/EVA.plugin.renderer.render.js | 144 - dist/cdn/EVA.plugin.renderer.spine.js | 9494 ----- dist/cdn/EVA.plugin.renderer.spine38.js | 9287 ----- dist/cdn/EVA.plugin.renderer.sprite.js | 199 - .../EVA.plugin.renderer.spriteAnimation.js | 259 - dist/cdn/EVA.plugin.renderer.text.js | 139 - dist/cdn/EVA.plugin.renderer.tilingSprite.js | 151 - dist/cdn/EVA.plugin.sound.js | 403 - dist/cdn/EVA.plugin.stats.js | 148 - dist/cdn/EVA.plugin.transition.js | 988 - dist/cdn/EVA.rendererAdapter.js | 142 - dist/cdn/min/EVA.min.js | 1 - dist/cdn/min/EVA.plugin.EVAX.min.js | 1 - dist/cdn/min/EVA.plugin.a11y.min.js | 1 - dist/cdn/min/EVA.plugin.matterjs.min.js | 1 - .../min/EVA.plugin.renderer.dragonbone.min.js | 1 - dist/cdn/min/EVA.plugin.renderer.event.min.js | 1 - .../min/EVA.plugin.renderer.graphics.min.js | 1 - dist/cdn/min/EVA.plugin.renderer.img.min.js | 1 - .../cdn/min/EVA.plugin.renderer.lottie.min.js | 1 - dist/cdn/min/EVA.plugin.renderer.mask.min.js | 1 - .../min/EVA.plugin.renderer.matterjs.min.js | 1 - dist/cdn/min/EVA.plugin.renderer.min.js | 975 - .../min/EVA.plugin.renderer.ninePatch.min.js | 1 - .../cdn/min/EVA.plugin.renderer.render.min.js | 1 - dist/cdn/min/EVA.plugin.renderer.spine.min.js | 1 - .../min/EVA.plugin.renderer.spine38.min.js | 1 - .../cdn/min/EVA.plugin.renderer.sprite.min.js | 1 - ...EVA.plugin.renderer.spriteAnimation.min.js | 1 - dist/cdn/min/EVA.plugin.renderer.text.min.js | 1 - .../EVA.plugin.renderer.tilingSprite.min.js | 1 - dist/cdn/min/EVA.plugin.sound.min.js | 1 - dist/cdn/min/EVA.plugin.stats.min.js | 1 - dist/cdn/min/EVA.plugin.transition.min.js | 1 - dist/cdn/min/EVA.rendererAdapter.min.js | 1 - dist/eva.js.d.ts | 382 - dist/miniprogram-adapter.d.ts | 6 - dist/miniprogram-pixi.d.ts | 4 - dist/plugin-a11y.d.ts | 91 - dist/plugin-evax.d.ts | 57 - dist/plugin-matterjs.d.ts | 35 - dist/plugin-renderer-dragonbone.d.ts | 64 - dist/plugin-renderer-event.d.ts | 55 - dist/plugin-renderer-graphics.d.ts | 25 - dist/plugin-renderer-img.d.ts | 34 - dist/plugin-renderer-lottie.d.ts | 69 - dist/plugin-renderer-mask.d.ts | 71 - dist/plugin-renderer-nine-patch.d.ts | 46 - dist/plugin-renderer-render.d.ts | 41 - dist/plugin-renderer-spine.d.ts | 49 - dist/plugin-renderer-spine38.d.ts | 49 - dist/plugin-renderer-sprite-animation.d.ts | 63 - dist/plugin-renderer-sprite.d.ts | 36 - dist/plugin-renderer-text.d.ts | 70 - dist/plugin-renderer-tiling-sprite.d.ts | 44 - dist/plugin-renderer.d.ts | 105 - dist/plugin-sound.d.ts | 84 - dist/plugin-stats.d.ts | 37 - dist/plugin-transition.d.ts | 42 - dist/renderer-adapter.d.ts | 65 - vite-test/README.MD => examples/README.md | 2 +- examples/a11y/index.html | 49 - examples/a11y/index.js | 106 - examples/a11y/loadResource.js | 278 - examples/bench/.gitkeep | 0 examples/component.html | 171 - examples/dragonbone.html | 83 - examples/event.html | 101 - examples/graphics.html | 76 - examples/image.html | 68 - examples/index.html | 43 +- examples/index.ts | 40 + examples/lottie.html | 159 - examples/mars.html | 79 - examples/mask.html | 141 - examples/matterjs.html | 475 - examples/multi-canvas.html | 104 - examples/ninePatch.html | 97 - .../public/person.astc.ktx | Bin {vite-test => examples}/public/person.etc.ktx | Bin .../public/person.pvrtc.ktx | Bin .../public/person.s3tc.ktx | Bin .../public/shannon.astc.ktx | Bin .../public/shannon.etc.ktx | Bin {vite-test => examples}/public/shannon.png | Bin .../public/shannon.pvrtc.ktx | Bin .../public/shannon.s3tc.ktx | Bin .../public/yanhua.astc.ktx | Bin {vite-test => examples}/public/yanhua.etc.ktx | Bin {vite-test => examples}/public/yanhua.png | Bin .../public/yanhua.pvrtc.ktx | Bin .../public/yanhua.s3tc.ktx | Bin examples/sound.html | 251 - examples/spine.html | 80 - examples/sprite.html | 134 - examples/spriteAnimation.html | 79 - {vite-test/ts => examples/src}/a11y.ts | 0 {vite-test/ts => examples/src}/component.ts | 0 examples/src/compressed-texture.ts | 71 + {vite-test/ts => examples/src}/dragonbone.ts | 0 {vite-test/ts => examples/src}/event.ts | 0 {vite-test/ts => examples/src}/graphics.ts | 0 {vite-test/ts => examples/src}/image.ts | 0 {vite-test/ts => examples/src}/loader.ts | 0 {vite-test/ts => examples/src}/lottie.ts | 0 {vite-test/ts => examples/src}/mask.ts | 0 {vite-test/ts => examples/src}/matter.ts | 0 .../ts => examples/src}/multi-canvas.ts | 0 {vite-test/ts => examples/src}/ninePatch.ts | 0 {vite-test/ts => examples/src}/sound.ts | 0 {vite-test/ts => examples/src}/spine.ts | 0 {vite-test/ts => examples/src}/sprite.ts | 0 .../ts => examples/src}/spriteAnimation.ts | 36 +- {vite-test/ts => examples/src}/text.ts | 0 .../ts => examples/src}/tilingSprite.ts | 0 {vite-test/ts => examples/src}/transition.ts | 0 examples/text.html | 82 - examples/tilingSprite.html | 62 - examples/transition.html | 157 - examples/vite-env.d.ts | 1 + jest.config.js | 5 +- package-lock.json | 28550 ---------------- package.json | 30 +- .../__tests__/componentObserver.spec.ts | 13 +- packages/eva.js/lib/loader/Resource.ts | 2 +- packages/plugin-a11y/lib/A11ySystem.ts | 105 +- packages/plugin-a11y/lib/constant.ts | 29 +- packages/plugin-matterjs/package-lock.json | 158 + packages/plugin-matterjs/package.json | 3 +- .../plugin-renderer-dragonbone/lib/index.ts | 7 +- packages/plugin-renderer-event/lib/index.ts | 7 +- packages/plugin-renderer-img/lib/index.ts | 7 +- packages/plugin-renderer-lottie/lib/index.ts | 10 +- packages/plugin-renderer-mask/lib/index.ts | 7 +- .../plugin-renderer-nine-patch/lib/index.ts | 7 +- packages/plugin-renderer-render/lib/index.ts | 7 +- packages/plugin-renderer-spine/lib/index.ts | 7 +- packages/plugin-renderer-spine38/lib/index.ts | 6 +- .../plugin-renderer-spine38/package-lock.json | 162 + .../lib/index.ts | 7 +- packages/plugin-renderer-sprite/lib/index.ts | 7 +- packages/plugin-renderer-test/lib/index.ts | 8 +- packages/plugin-renderer-text/lib/index.ts | 7 +- .../lib/index.ts | 7 +- packages/plugin-sound/lib/index.ts | 6 +- packages/plugin-stats/lib/index.ts | 8 +- packages/plugin-transition/lib/index.ts | 5 +- packages/renderer-adapter/lib/index.ts | 27 +- rollup.config.dev.js | 16 - rollup.config.js | 64 +- scripts/build.js | 2 +- scripts/dev.js | 27 - scripts/setupJestEnv.ts | 8 +- test/.gitkeep | 0 tsconfig.json | 71 +- vite-test/index.html | 47 - vite-test/index.ts | 39 - vite-test/ts/compressed-texture.ts | 75 - vite.config.ts | 22 +- 173 files changed, 614 insertions(+), 112554 deletions(-) delete mode 100644 dist/cdn/EVA.js delete mode 100644 dist/cdn/EVA.plugin.EVAX.js delete mode 100644 dist/cdn/EVA.plugin.a11y.js delete mode 100644 dist/cdn/EVA.plugin.matterjs.js delete mode 100644 dist/cdn/EVA.plugin.renderer.dragonbone.js delete mode 100644 dist/cdn/EVA.plugin.renderer.event.js delete mode 100644 dist/cdn/EVA.plugin.renderer.graphics.js delete mode 100644 dist/cdn/EVA.plugin.renderer.img.js delete mode 100644 dist/cdn/EVA.plugin.renderer.js delete mode 100644 dist/cdn/EVA.plugin.renderer.lottie.js delete mode 100644 dist/cdn/EVA.plugin.renderer.mask.js delete mode 100644 dist/cdn/EVA.plugin.renderer.matterjs.js delete mode 100644 dist/cdn/EVA.plugin.renderer.ninePatch.js delete mode 100644 dist/cdn/EVA.plugin.renderer.render.js delete mode 100644 dist/cdn/EVA.plugin.renderer.spine.js delete mode 100644 dist/cdn/EVA.plugin.renderer.spine38.js delete mode 100644 dist/cdn/EVA.plugin.renderer.sprite.js delete mode 100644 dist/cdn/EVA.plugin.renderer.spriteAnimation.js delete mode 100644 dist/cdn/EVA.plugin.renderer.text.js delete mode 100644 dist/cdn/EVA.plugin.renderer.tilingSprite.js delete mode 100644 dist/cdn/EVA.plugin.sound.js delete mode 100644 dist/cdn/EVA.plugin.stats.js delete mode 100644 dist/cdn/EVA.plugin.transition.js delete mode 100644 dist/cdn/EVA.rendererAdapter.js delete mode 100644 dist/cdn/min/EVA.min.js delete mode 100644 dist/cdn/min/EVA.plugin.EVAX.min.js delete mode 100644 dist/cdn/min/EVA.plugin.a11y.min.js delete mode 100644 dist/cdn/min/EVA.plugin.matterjs.min.js delete mode 100644 dist/cdn/min/EVA.plugin.renderer.dragonbone.min.js delete mode 100644 dist/cdn/min/EVA.plugin.renderer.event.min.js delete mode 100644 dist/cdn/min/EVA.plugin.renderer.graphics.min.js delete mode 100644 dist/cdn/min/EVA.plugin.renderer.img.min.js delete mode 100644 dist/cdn/min/EVA.plugin.renderer.lottie.min.js delete mode 100644 dist/cdn/min/EVA.plugin.renderer.mask.min.js delete mode 100644 dist/cdn/min/EVA.plugin.renderer.matterjs.min.js delete mode 100644 dist/cdn/min/EVA.plugin.renderer.min.js delete mode 100644 dist/cdn/min/EVA.plugin.renderer.ninePatch.min.js delete mode 100644 dist/cdn/min/EVA.plugin.renderer.render.min.js delete mode 100644 dist/cdn/min/EVA.plugin.renderer.spine.min.js delete mode 100644 dist/cdn/min/EVA.plugin.renderer.spine38.min.js delete mode 100644 dist/cdn/min/EVA.plugin.renderer.sprite.min.js delete mode 100644 dist/cdn/min/EVA.plugin.renderer.spriteAnimation.min.js delete mode 100644 dist/cdn/min/EVA.plugin.renderer.text.min.js delete mode 100644 dist/cdn/min/EVA.plugin.renderer.tilingSprite.min.js delete mode 100644 dist/cdn/min/EVA.plugin.sound.min.js delete mode 100644 dist/cdn/min/EVA.plugin.stats.min.js delete mode 100644 dist/cdn/min/EVA.plugin.transition.min.js delete mode 100644 dist/cdn/min/EVA.rendererAdapter.min.js delete mode 100644 dist/eva.js.d.ts delete mode 100644 dist/miniprogram-adapter.d.ts delete mode 100644 dist/miniprogram-pixi.d.ts delete mode 100644 dist/plugin-a11y.d.ts delete mode 100644 dist/plugin-evax.d.ts delete mode 100644 dist/plugin-matterjs.d.ts delete mode 100644 dist/plugin-renderer-dragonbone.d.ts delete mode 100644 dist/plugin-renderer-event.d.ts delete mode 100644 dist/plugin-renderer-graphics.d.ts delete mode 100644 dist/plugin-renderer-img.d.ts delete mode 100644 dist/plugin-renderer-lottie.d.ts delete mode 100644 dist/plugin-renderer-mask.d.ts delete mode 100644 dist/plugin-renderer-nine-patch.d.ts delete mode 100644 dist/plugin-renderer-render.d.ts delete mode 100644 dist/plugin-renderer-spine.d.ts delete mode 100644 dist/plugin-renderer-spine38.d.ts delete mode 100644 dist/plugin-renderer-sprite-animation.d.ts delete mode 100644 dist/plugin-renderer-sprite.d.ts delete mode 100644 dist/plugin-renderer-text.d.ts delete mode 100644 dist/plugin-renderer-tiling-sprite.d.ts delete mode 100644 dist/plugin-renderer.d.ts delete mode 100644 dist/plugin-sound.d.ts delete mode 100644 dist/plugin-stats.d.ts delete mode 100644 dist/plugin-transition.d.ts delete mode 100644 dist/renderer-adapter.d.ts rename vite-test/README.MD => examples/README.md (70%) delete mode 100644 examples/a11y/index.html delete mode 100644 examples/a11y/index.js delete mode 100644 examples/a11y/loadResource.js delete mode 100644 examples/bench/.gitkeep delete mode 100644 examples/component.html delete mode 100644 examples/dragonbone.html delete mode 100644 examples/event.html delete mode 100644 examples/graphics.html delete mode 100644 examples/image.html create mode 100644 examples/index.ts delete mode 100644 examples/lottie.html delete mode 100644 examples/mars.html delete mode 100644 examples/mask.html delete mode 100644 examples/matterjs.html delete mode 100644 examples/multi-canvas.html delete mode 100644 examples/ninePatch.html rename {vite-test => examples}/public/person.astc.ktx (100%) rename {vite-test => examples}/public/person.etc.ktx (100%) rename {vite-test => examples}/public/person.pvrtc.ktx (100%) rename {vite-test => examples}/public/person.s3tc.ktx (100%) rename {vite-test => examples}/public/shannon.astc.ktx (100%) rename {vite-test => examples}/public/shannon.etc.ktx (100%) rename {vite-test => examples}/public/shannon.png (100%) rename {vite-test => examples}/public/shannon.pvrtc.ktx (100%) rename {vite-test => examples}/public/shannon.s3tc.ktx (100%) rename {vite-test => examples}/public/yanhua.astc.ktx (100%) rename {vite-test => examples}/public/yanhua.etc.ktx (100%) rename {vite-test => examples}/public/yanhua.png (100%) rename {vite-test => examples}/public/yanhua.pvrtc.ktx (100%) rename {vite-test => examples}/public/yanhua.s3tc.ktx (100%) delete mode 100644 examples/sound.html delete mode 100644 examples/spine.html delete mode 100644 examples/sprite.html delete mode 100644 examples/spriteAnimation.html rename {vite-test/ts => examples/src}/a11y.ts (100%) rename {vite-test/ts => examples/src}/component.ts (100%) create mode 100644 examples/src/compressed-texture.ts rename {vite-test/ts => examples/src}/dragonbone.ts (100%) rename {vite-test/ts => examples/src}/event.ts (100%) rename {vite-test/ts => examples/src}/graphics.ts (100%) rename {vite-test/ts => examples/src}/image.ts (100%) rename {vite-test/ts => examples/src}/loader.ts (100%) rename {vite-test/ts => examples/src}/lottie.ts (100%) rename {vite-test/ts => examples/src}/mask.ts (100%) rename {vite-test/ts => examples/src}/matter.ts (100%) rename {vite-test/ts => examples/src}/multi-canvas.ts (100%) rename {vite-test/ts => examples/src}/ninePatch.ts (100%) rename {vite-test/ts => examples/src}/sound.ts (100%) rename {vite-test/ts => examples/src}/spine.ts (100%) rename {vite-test/ts => examples/src}/sprite.ts (100%) rename {vite-test/ts => examples/src}/spriteAnimation.ts (61%) rename {vite-test/ts => examples/src}/text.ts (100%) rename {vite-test/ts => examples/src}/tilingSprite.ts (100%) rename {vite-test/ts => examples/src}/transition.ts (100%) delete mode 100644 examples/text.html delete mode 100644 examples/tilingSprite.html delete mode 100644 examples/transition.html create mode 100644 examples/vite-env.d.ts delete mode 100644 package-lock.json create mode 100644 packages/plugin-matterjs/package-lock.json create mode 100644 packages/plugin-renderer-spine38/package-lock.json delete mode 100644 rollup.config.dev.js delete mode 100644 scripts/dev.js delete mode 100644 test/.gitkeep delete mode 100644 vite-test/index.html delete mode 100644 vite-test/index.ts delete mode 100644 vite-test/ts/compressed-texture.ts diff --git a/.gitignore b/.gitignore index 3212be0f..32e4bcf3 100644 --- a/.gitignore +++ b/.gitignore @@ -20,6 +20,7 @@ selenium-debug.log /_* # Distribution +dist/ coverage/ types/ packages/**/dist/ diff --git a/dist/cdn/EVA.js b/dist/cdn/EVA.js deleted file mode 100644 index 2df489c9..00000000 --- a/dist/cdn/EVA.js +++ /dev/null @@ -1,5068 +0,0 @@ -(function (l, r) { - if (l.getElementById('livereloadscript')) return; - r = l.createElement('script'); - r.async = 1; - r.src = '//' + (window.location.host || 'localhost').split(':')[0] + ':35729/livereload.js?snipver=1'; - r.id = 'livereloadscript'; - l.getElementsByTagName('head')[0].appendChild(r); -})(window.document); -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - ? factory(exports) - : typeof define === 'function' && define.amd - ? define(['exports'], factory) - : ((global = typeof globalThis !== 'undefined' ? globalThis : global || self), factory((global.EVA = {}))); -})(this, function (exports) { - 'use strict'; - - function createCommonjsModule(fn) { - var module = {exports: {}}; - return fn(module, module.exports), module.exports; - } - - var eventemitter3 = createCommonjsModule(function (module) { - var has = Object.prototype.hasOwnProperty, - prefix = '~'; - - /** - * Constructor to create a storage for our `EE` objects. - * An `Events` instance is a plain object whose properties are event names. - * - * @constructor - * @private - */ - function Events() {} - - // - // We try to not inherit from `Object.prototype`. In some engines creating an - // instance in this way is faster than calling `Object.create(null)` directly. - // If `Object.create(null)` is not supported we prefix the event names with a - // character to make sure that the built-in object properties are not - // overridden or used as an attack vector. - // - if (Object.create) { - Events.prototype = Object.create(null); - - // - // This hack is needed because the `__proto__` property is still inherited in - // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5. - // - if (!new Events().__proto__) prefix = false; - } - - /** - * Representation of a single event listener. - * - * @param {Function} fn The listener function. - * @param {*} context The context to invoke the listener with. - * @param {Boolean} [once=false] Specify if the listener is a one-time listener. - * @constructor - * @private - */ - function EE(fn, context, once) { - this.fn = fn; - this.context = context; - this.once = once || false; - } - - /** - * Add a listener for a given event. - * - * @param {EventEmitter} emitter Reference to the `EventEmitter` instance. - * @param {(String|Symbol)} event The event name. - * @param {Function} fn The listener function. - * @param {*} context The context to invoke the listener with. - * @param {Boolean} once Specify if the listener is a one-time listener. - * @returns {EventEmitter} - * @private - */ - function addListener(emitter, event, fn, context, once) { - if (typeof fn !== 'function') { - throw new TypeError('The listener must be a function'); - } - - var listener = new EE(fn, context || emitter, once), - evt = prefix ? prefix + event : event; - - if (!emitter._events[evt]) (emitter._events[evt] = listener), emitter._eventsCount++; - else if (!emitter._events[evt].fn) emitter._events[evt].push(listener); - else emitter._events[evt] = [emitter._events[evt], listener]; - - return emitter; - } - - /** - * Clear event by name. - * - * @param {EventEmitter} emitter Reference to the `EventEmitter` instance. - * @param {(String|Symbol)} evt The Event name. - * @private - */ - function clearEvent(emitter, evt) { - if (--emitter._eventsCount === 0) emitter._events = new Events(); - else delete emitter._events[evt]; - } - - /** - * Minimal `EventEmitter` interface that is molded against the Node.js - * `EventEmitter` interface. - * - * @constructor - * @public - */ - function EventEmitter() { - this._events = new Events(); - this._eventsCount = 0; - } - - /** - * Return an array listing the events for which the emitter has registered - * listeners. - * - * @returns {Array} - * @public - */ - EventEmitter.prototype.eventNames = function eventNames() { - var names = [], - events, - name; - - if (this._eventsCount === 0) return names; - - for (name in (events = this._events)) { - if (has.call(events, name)) names.push(prefix ? name.slice(1) : name); - } - - if (Object.getOwnPropertySymbols) { - return names.concat(Object.getOwnPropertySymbols(events)); - } - - return names; - }; - - /** - * Return the listeners registered for a given event. - * - * @param {(String|Symbol)} event The event name. - * @returns {Array} The registered listeners. - * @public - */ - EventEmitter.prototype.listeners = function listeners(event) { - var evt = prefix ? prefix + event : event, - handlers = this._events[evt]; - - if (!handlers) return []; - if (handlers.fn) return [handlers.fn]; - - for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) { - ee[i] = handlers[i].fn; - } - - return ee; - }; - - /** - * Return the number of listeners listening to a given event. - * - * @param {(String|Symbol)} event The event name. - * @returns {Number} The number of listeners. - * @public - */ - EventEmitter.prototype.listenerCount = function listenerCount(event) { - var evt = prefix ? prefix + event : event, - listeners = this._events[evt]; - - if (!listeners) return 0; - if (listeners.fn) return 1; - return listeners.length; - }; - - /** - * Calls each of the listeners registered for a given event. - * - * @param {(String|Symbol)} event The event name. - * @returns {Boolean} `true` if the event had listeners, else `false`. - * @public - */ - EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) { - var evt = prefix ? prefix + event : event; - - if (!this._events[evt]) return false; - - var listeners = this._events[evt], - len = arguments.length, - args, - i; - - if (listeners.fn) { - if (listeners.once) this.removeListener(event, listeners.fn, undefined, true); - - switch (len) { - case 1: - return listeners.fn.call(listeners.context), true; - case 2: - return listeners.fn.call(listeners.context, a1), true; - case 3: - return listeners.fn.call(listeners.context, a1, a2), true; - case 4: - return listeners.fn.call(listeners.context, a1, a2, a3), true; - case 5: - return listeners.fn.call(listeners.context, a1, a2, a3, a4), true; - case 6: - return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true; - } - - for (i = 1, args = new Array(len - 1); i < len; i++) { - args[i - 1] = arguments[i]; - } - - listeners.fn.apply(listeners.context, args); - } else { - var length = listeners.length, - j; - - for (i = 0; i < length; i++) { - if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true); - - switch (len) { - case 1: - listeners[i].fn.call(listeners[i].context); - break; - case 2: - listeners[i].fn.call(listeners[i].context, a1); - break; - case 3: - listeners[i].fn.call(listeners[i].context, a1, a2); - break; - case 4: - listeners[i].fn.call(listeners[i].context, a1, a2, a3); - break; - default: - if (!args) - for (j = 1, args = new Array(len - 1); j < len; j++) { - args[j - 1] = arguments[j]; - } - - listeners[i].fn.apply(listeners[i].context, args); - } - } - } - - return true; - }; - - /** - * Add a listener for a given event. - * - * @param {(String|Symbol)} event The event name. - * @param {Function} fn The listener function. - * @param {*} [context=this] The context to invoke the listener with. - * @returns {EventEmitter} `this`. - * @public - */ - EventEmitter.prototype.on = function on(event, fn, context) { - return addListener(this, event, fn, context, false); - }; - - /** - * Add a one-time listener for a given event. - * - * @param {(String|Symbol)} event The event name. - * @param {Function} fn The listener function. - * @param {*} [context=this] The context to invoke the listener with. - * @returns {EventEmitter} `this`. - * @public - */ - EventEmitter.prototype.once = function once(event, fn, context) { - return addListener(this, event, fn, context, true); - }; - - /** - * Remove the listeners of a given event. - * - * @param {(String|Symbol)} event The event name. - * @param {Function} fn Only remove the listeners that match this function. - * @param {*} context Only remove the listeners that have this context. - * @param {Boolean} once Only remove one-time listeners. - * @returns {EventEmitter} `this`. - * @public - */ - EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) { - var evt = prefix ? prefix + event : event; - - if (!this._events[evt]) return this; - if (!fn) { - clearEvent(this, evt); - return this; - } - - var listeners = this._events[evt]; - - if (listeners.fn) { - if (listeners.fn === fn && (!once || listeners.once) && (!context || listeners.context === context)) { - clearEvent(this, evt); - } - } else { - for (var i = 0, events = [], length = listeners.length; i < length; i++) { - if (listeners[i].fn !== fn || (once && !listeners[i].once) || (context && listeners[i].context !== context)) { - events.push(listeners[i]); - } - } - - // - // Reset the array, or remove it completely if we have no more listeners. - // - if (events.length) this._events[evt] = events.length === 1 ? events[0] : events; - else clearEvent(this, evt); - } - - return this; - }; - - /** - * Remove all listeners, or those of the specified event. - * - * @param {(String|Symbol)} [event] The event name. - * @returns {EventEmitter} `this`. - * @public - */ - EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) { - var evt; - - if (event) { - evt = prefix ? prefix + event : event; - if (this._events[evt]) clearEvent(this, evt); - } else { - this._events = new Events(); - this._eventsCount = 0; - } - - return this; - }; - - // - // Alias methods names because people roll like that. - // - EventEmitter.prototype.off = EventEmitter.prototype.removeListener; - EventEmitter.prototype.addListener = EventEmitter.prototype.on; - - // - // Expose the prefix. - // - EventEmitter.prefixed = prefix; - - // - // Allow `EventEmitter` to be imported as module namespace. - // - EventEmitter.EventEmitter = EventEmitter; - - // - // Expose the module. - // - { - module.exports = EventEmitter; - } - }); - - function getComponentName(component) { - if (component instanceof Component) { - return component.name; - } else if (component instanceof Function) { - return component.componentName; - } - } - class Component extends eventemitter3 { - constructor(params) { - super(); - this.started = false; - this.name = this.constructor.componentName; - this.__componentDefaultParams = params; - } - } - - /** Detect free variable `global` from Node.js. */ - var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; - - /** Detect free variable `self`. */ - var freeSelf = typeof self == 'object' && self && self.Object === Object && self; - - /** Used as a reference to the global object. */ - var root = freeGlobal || freeSelf || Function('return this')(); - - /** Built-in value references. */ - var Symbol$1 = root.Symbol; - - /** Used for built-in method references. */ - var objectProto$b = Object.prototype; - - /** Used to check objects for own properties. */ - var hasOwnProperty$8 = objectProto$b.hasOwnProperty; - - /** - * Used to resolve the - * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) - * of values. - */ - var nativeObjectToString$1 = objectProto$b.toString; - - /** Built-in value references. */ - var symToStringTag$1 = Symbol$1 ? Symbol$1.toStringTag : undefined; - - /** - * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values. - * - * @private - * @param {*} value The value to query. - * @returns {string} Returns the raw `toStringTag`. - */ - function getRawTag(value) { - var isOwn = hasOwnProperty$8.call(value, symToStringTag$1), - tag = value[symToStringTag$1]; - - try { - value[symToStringTag$1] = undefined; - var unmasked = true; - } catch (e) {} - - var result = nativeObjectToString$1.call(value); - if (unmasked) { - if (isOwn) { - value[symToStringTag$1] = tag; - } else { - delete value[symToStringTag$1]; - } - } - return result; - } - - /** Used for built-in method references. */ - var objectProto$a = Object.prototype; - - /** - * Used to resolve the - * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) - * of values. - */ - var nativeObjectToString = objectProto$a.toString; - - /** - * Converts `value` to a string using `Object.prototype.toString`. - * - * @private - * @param {*} value The value to convert. - * @returns {string} Returns the converted string. - */ - function objectToString(value) { - return nativeObjectToString.call(value); - } - - /** `Object#toString` result references. */ - var nullTag = '[object Null]', - undefinedTag = '[object Undefined]'; - - /** Built-in value references. */ - var symToStringTag = Symbol$1 ? Symbol$1.toStringTag : undefined; - - /** - * The base implementation of `getTag` without fallbacks for buggy environments. - * - * @private - * @param {*} value The value to query. - * @returns {string} Returns the `toStringTag`. - */ - function baseGetTag(value) { - if (value == null) { - return value === undefined ? undefinedTag : nullTag; - } - return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value); - } - - /** - * Checks if `value` is object-like. A value is object-like if it's not `null` - * and has a `typeof` result of "object". - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is object-like, else `false`. - * @example - * - * _.isObjectLike({}); - * // => true - * - * _.isObjectLike([1, 2, 3]); - * // => true - * - * _.isObjectLike(_.noop); - * // => false - * - * _.isObjectLike(null); - * // => false - */ - function isObjectLike(value) { - return value != null && typeof value == 'object'; - } - - /** - * Checks if `value` is classified as an `Array` object. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an array, else `false`. - * @example - * - * _.isArray([1, 2, 3]); - * // => true - * - * _.isArray(document.body.children); - * // => false - * - * _.isArray('abc'); - * // => false - * - * _.isArray(_.noop); - * // => false - */ - var isArray = Array.isArray; - - /** - * Checks if `value` is the - * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) - * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(_.noop); - * // => true - * - * _.isObject(null); - * // => false - */ - function isObject(value) { - var type = typeof value; - return value != null && (type == 'object' || type == 'function'); - } - - /** `Object#toString` result references. */ - var asyncTag = '[object AsyncFunction]', - funcTag$1 = '[object Function]', - genTag = '[object GeneratorFunction]', - proxyTag = '[object Proxy]'; - - /** - * Checks if `value` is classified as a `Function` object. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a function, else `false`. - * @example - * - * _.isFunction(_); - * // => true - * - * _.isFunction(/abc/); - * // => false - */ - function isFunction(value) { - if (!isObject(value)) { - return false; - } - // The use of `Object#toString` avoids issues with the `typeof` operator - // in Safari 9 which returns 'object' for typed arrays and other constructors. - var tag = baseGetTag(value); - return tag == funcTag$1 || tag == genTag || tag == asyncTag || tag == proxyTag; - } - - /** Used to detect overreaching core-js shims. */ - var coreJsData = root['__core-js_shared__']; - - /** Used to detect methods masquerading as native. */ - var maskSrcKey = (function () { - var uid = /[^.]+$/.exec((coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO) || ''); - return uid ? 'Symbol(src)_1.' + uid : ''; - })(); - - /** - * Checks if `func` has its source masked. - * - * @private - * @param {Function} func The function to check. - * @returns {boolean} Returns `true` if `func` is masked, else `false`. - */ - function isMasked(func) { - return !!maskSrcKey && maskSrcKey in func; - } - - /** Used for built-in method references. */ - var funcProto$1 = Function.prototype; - - /** Used to resolve the decompiled source of functions. */ - var funcToString$1 = funcProto$1.toString; - - /** - * Converts `func` to its source code. - * - * @private - * @param {Function} func The function to convert. - * @returns {string} Returns the source code. - */ - function toSource(func) { - if (func != null) { - try { - return funcToString$1.call(func); - } catch (e) {} - try { - return func + ''; - } catch (e) {} - } - return ''; - } - - /** - * Used to match `RegExp` - * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). - */ - var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; - - /** Used to detect host constructors (Safari). */ - var reIsHostCtor = /^\[object .+?Constructor\]$/; - - /** Used for built-in method references. */ - var funcProto = Function.prototype, - objectProto$9 = Object.prototype; - - /** Used to resolve the decompiled source of functions. */ - var funcToString = funcProto.toString; - - /** Used to check objects for own properties. */ - var hasOwnProperty$7 = objectProto$9.hasOwnProperty; - - /** Used to detect if a method is native. */ - var reIsNative = RegExp( - '^' + - funcToString - .call(hasOwnProperty$7) - .replace(reRegExpChar, '\\$&') - .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + - '$', - ); - - /** - * The base implementation of `_.isNative` without bad shim checks. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a native function, - * else `false`. - */ - function baseIsNative(value) { - if (!isObject(value) || isMasked(value)) { - return false; - } - var pattern = isFunction(value) ? reIsNative : reIsHostCtor; - return pattern.test(toSource(value)); - } - - /** - * Gets the value at `key` of `object`. - * - * @private - * @param {Object} [object] The object to query. - * @param {string} key The key of the property to get. - * @returns {*} Returns the property value. - */ - function getValue(object, key) { - return object == null ? undefined : object[key]; - } - - /** - * Gets the native function at `key` of `object`. - * - * @private - * @param {Object} object The object to query. - * @param {string} key The key of the method to get. - * @returns {*} Returns the function if it's native, else `undefined`. - */ - function getNative(object, key) { - var value = getValue(object, key); - return baseIsNative(value) ? value : undefined; - } - - /* Built-in method references that are verified to be native. */ - var WeakMap = getNative(root, 'WeakMap'); - - /** Used as references for various `Number` constants. */ - var MAX_SAFE_INTEGER$1 = 9007199254740991; - - /** Used to detect unsigned integer values. */ - var reIsUint = /^(?:0|[1-9]\d*)$/; - - /** - * Checks if `value` is a valid array-like index. - * - * @private - * @param {*} value The value to check. - * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. - * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. - */ - function isIndex(value, length) { - var type = typeof value; - length = length == null ? MAX_SAFE_INTEGER$1 : length; - - return ( - !!length && - (type == 'number' || (type != 'symbol' && reIsUint.test(value))) && - value > -1 && - value % 1 == 0 && - value < length - ); - } - - /** - * Performs a - * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) - * comparison between two values to determine if they are equivalent. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @returns {boolean} Returns `true` if the values are equivalent, else `false`. - * @example - * - * var object = { 'a': 1 }; - * var other = { 'a': 1 }; - * - * _.eq(object, object); - * // => true - * - * _.eq(object, other); - * // => false - * - * _.eq('a', 'a'); - * // => true - * - * _.eq('a', Object('a')); - * // => false - * - * _.eq(NaN, NaN); - * // => true - */ - function eq(value, other) { - return value === other || (value !== value && other !== other); - } - - /** Used as references for various `Number` constants. */ - var MAX_SAFE_INTEGER = 9007199254740991; - - /** - * Checks if `value` is a valid array-like length. - * - * **Note:** This method is loosely based on - * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. - * @example - * - * _.isLength(3); - * // => true - * - * _.isLength(Number.MIN_VALUE); - * // => false - * - * _.isLength(Infinity); - * // => false - * - * _.isLength('3'); - * // => false - */ - function isLength(value) { - return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; - } - - /** - * Checks if `value` is array-like. A value is considered array-like if it's - * not a function and has a `value.length` that's an integer greater than or - * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is array-like, else `false`. - * @example - * - * _.isArrayLike([1, 2, 3]); - * // => true - * - * _.isArrayLike(document.body.children); - * // => true - * - * _.isArrayLike('abc'); - * // => true - * - * _.isArrayLike(_.noop); - * // => false - */ - function isArrayLike(value) { - return value != null && isLength(value.length) && !isFunction(value); - } - - /** Used for built-in method references. */ - var objectProto$8 = Object.prototype; - - /** - * Checks if `value` is likely a prototype object. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a prototype, else `false`. - */ - function isPrototype(value) { - var Ctor = value && value.constructor, - proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto$8; - - return value === proto; - } - - /** - * The base implementation of `_.times` without support for iteratee shorthands - * or max array length checks. - * - * @private - * @param {number} n The number of times to invoke `iteratee`. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Array} Returns the array of results. - */ - function baseTimes(n, iteratee) { - var index = -1, - result = Array(n); - - while (++index < n) { - result[index] = iteratee(index); - } - return result; - } - - /** `Object#toString` result references. */ - var argsTag$2 = '[object Arguments]'; - - /** - * The base implementation of `_.isArguments`. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an `arguments` object, - */ - function baseIsArguments(value) { - return isObjectLike(value) && baseGetTag(value) == argsTag$2; - } - - /** Used for built-in method references. */ - var objectProto$7 = Object.prototype; - - /** Used to check objects for own properties. */ - var hasOwnProperty$6 = objectProto$7.hasOwnProperty; - - /** Built-in value references. */ - var propertyIsEnumerable$1 = objectProto$7.propertyIsEnumerable; - - /** - * Checks if `value` is likely an `arguments` object. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an `arguments` object, - * else `false`. - * @example - * - * _.isArguments(function() { return arguments; }()); - * // => true - * - * _.isArguments([1, 2, 3]); - * // => false - */ - var isArguments = baseIsArguments( - (function () { - return arguments; - })(), - ) - ? baseIsArguments - : function (value) { - return isObjectLike(value) && hasOwnProperty$6.call(value, 'callee') && !propertyIsEnumerable$1.call(value, 'callee'); - }; - - /** - * This method returns `false`. - * - * @static - * @memberOf _ - * @since 4.13.0 - * @category Util - * @returns {boolean} Returns `false`. - * @example - * - * _.times(2, _.stubFalse); - * // => [false, false] - */ - function stubFalse() { - return false; - } - - /** Detect free variable `exports`. */ - var freeExports$1 = typeof exports == 'object' && exports && !exports.nodeType && exports; - - /** Detect free variable `module`. */ - var freeModule$1 = freeExports$1 && typeof module == 'object' && module && !module.nodeType && module; - - /** Detect the popular CommonJS extension `module.exports`. */ - var moduleExports$1 = freeModule$1 && freeModule$1.exports === freeExports$1; - - /** Built-in value references. */ - var Buffer = moduleExports$1 ? root.Buffer : undefined; - - /* Built-in method references for those with the same name as other `lodash` methods. */ - var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined; - - /** - * Checks if `value` is a buffer. - * - * @static - * @memberOf _ - * @since 4.3.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a buffer, else `false`. - * @example - * - * _.isBuffer(new Buffer(2)); - * // => true - * - * _.isBuffer(new Uint8Array(2)); - * // => false - */ - var isBuffer = nativeIsBuffer || stubFalse; - - /** `Object#toString` result references. */ - var argsTag$1 = '[object Arguments]', - arrayTag$1 = '[object Array]', - boolTag$1 = '[object Boolean]', - dateTag$1 = '[object Date]', - errorTag$1 = '[object Error]', - funcTag = '[object Function]', - mapTag$2 = '[object Map]', - numberTag$1 = '[object Number]', - objectTag$2 = '[object Object]', - regexpTag$1 = '[object RegExp]', - setTag$2 = '[object Set]', - stringTag$1 = '[object String]', - weakMapTag$1 = '[object WeakMap]'; - - var arrayBufferTag$1 = '[object ArrayBuffer]', - dataViewTag$2 = '[object DataView]', - float32Tag = '[object Float32Array]', - float64Tag = '[object Float64Array]', - int8Tag = '[object Int8Array]', - int16Tag = '[object Int16Array]', - int32Tag = '[object Int32Array]', - uint8Tag = '[object Uint8Array]', - uint8ClampedTag = '[object Uint8ClampedArray]', - uint16Tag = '[object Uint16Array]', - uint32Tag = '[object Uint32Array]'; - - /** Used to identify `toStringTag` values of typed arrays. */ - var typedArrayTags = {}; - typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[ - int32Tag - ] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true; - typedArrayTags[argsTag$1] = typedArrayTags[arrayTag$1] = typedArrayTags[arrayBufferTag$1] = typedArrayTags[ - boolTag$1 - ] = typedArrayTags[dataViewTag$2] = typedArrayTags[dateTag$1] = typedArrayTags[errorTag$1] = typedArrayTags[ - funcTag - ] = typedArrayTags[mapTag$2] = typedArrayTags[numberTag$1] = typedArrayTags[objectTag$2] = typedArrayTags[ - regexpTag$1 - ] = typedArrayTags[setTag$2] = typedArrayTags[stringTag$1] = typedArrayTags[weakMapTag$1] = false; - - /** - * The base implementation of `_.isTypedArray` without Node.js optimizations. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. - */ - function baseIsTypedArray(value) { - return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)]; - } - - /** - * The base implementation of `_.unary` without support for storing metadata. - * - * @private - * @param {Function} func The function to cap arguments for. - * @returns {Function} Returns the new capped function. - */ - function baseUnary(func) { - return function (value) { - return func(value); - }; - } - - /** Detect free variable `exports`. */ - var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports; - - /** Detect free variable `module`. */ - var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module; - - /** Detect the popular CommonJS extension `module.exports`. */ - var moduleExports = freeModule && freeModule.exports === freeExports; - - /** Detect free variable `process` from Node.js. */ - var freeProcess = moduleExports && freeGlobal.process; - - /** Used to access faster Node.js helpers. */ - var nodeUtil = (function () { - try { - // Use `util.types` for Node.js 10+. - var types = freeModule && freeModule.require && freeModule.require('util').types; - - if (types) { - return types; - } - - // Legacy `process.binding('util')` for Node.js < 10. - return freeProcess && freeProcess.binding && freeProcess.binding('util'); - } catch (e) {} - })(); - - /* Node.js helper references. */ - var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray; - - /** - * Checks if `value` is classified as a typed array. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. - * @example - * - * _.isTypedArray(new Uint8Array); - * // => true - * - * _.isTypedArray([]); - * // => false - */ - var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray; - - /** Used for built-in method references. */ - var objectProto$6 = Object.prototype; - - /** Used to check objects for own properties. */ - var hasOwnProperty$5 = objectProto$6.hasOwnProperty; - - /** - * Creates an array of the enumerable property names of the array-like `value`. - * - * @private - * @param {*} value The value to query. - * @param {boolean} inherited Specify returning inherited property names. - * @returns {Array} Returns the array of property names. - */ - function arrayLikeKeys(value, inherited) { - var isArr = isArray(value), - isArg = !isArr && isArguments(value), - isBuff = !isArr && !isArg && isBuffer(value), - isType = !isArr && !isArg && !isBuff && isTypedArray(value), - skipIndexes = isArr || isArg || isBuff || isType, - result = skipIndexes ? baseTimes(value.length, String) : [], - length = result.length; - - for (var key in value) { - if ( - (inherited || hasOwnProperty$5.call(value, key)) && - !( - skipIndexes && - // Safari 9 has enumerable `arguments.length` in strict mode. - (key == 'length' || - // Node.js 0.10 has enumerable non-index properties on buffers. - (isBuff && (key == 'offset' || key == 'parent')) || - // PhantomJS 2 has enumerable non-index properties on typed arrays. - (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) || - // Skip index properties. - isIndex(key, length)) - ) - ) { - result.push(key); - } - } - return result; - } - - /** - * Creates a unary function that invokes `func` with its argument transformed. - * - * @private - * @param {Function} func The function to wrap. - * @param {Function} transform The argument transform. - * @returns {Function} Returns the new function. - */ - function overArg(func, transform) { - return function (arg) { - return func(transform(arg)); - }; - } - - /* Built-in method references for those with the same name as other `lodash` methods. */ - var nativeKeys = overArg(Object.keys, Object); - - /** Used for built-in method references. */ - var objectProto$5 = Object.prototype; - - /** Used to check objects for own properties. */ - var hasOwnProperty$4 = objectProto$5.hasOwnProperty; - - /** - * The base implementation of `_.keys` which doesn't treat sparse arrays as dense. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names. - */ - function baseKeys(object) { - if (!isPrototype(object)) { - return nativeKeys(object); - } - var result = []; - for (var key in Object(object)) { - if (hasOwnProperty$4.call(object, key) && key != 'constructor') { - result.push(key); - } - } - return result; - } - - /** - * Creates an array of the own enumerable property names of `object`. - * - * **Note:** Non-object values are coerced to objects. See the - * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) - * for more details. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Object - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names. - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.keys(new Foo); - * // => ['a', 'b'] (iteration order is not guaranteed) - * - * _.keys('hi'); - * // => ['0', '1'] - */ - function keys(object) { - return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object); - } - - /* Built-in method references that are verified to be native. */ - var nativeCreate = getNative(Object, 'create'); - - /** - * Removes all key-value entries from the hash. - * - * @private - * @name clear - * @memberOf Hash - */ - function hashClear() { - this.__data__ = nativeCreate ? nativeCreate(null) : {}; - this.size = 0; - } - - /** - * Removes `key` and its value from the hash. - * - * @private - * @name delete - * @memberOf Hash - * @param {Object} hash The hash to modify. - * @param {string} key The key of the value to remove. - * @returns {boolean} Returns `true` if the entry was removed, else `false`. - */ - function hashDelete(key) { - var result = this.has(key) && delete this.__data__[key]; - this.size -= result ? 1 : 0; - return result; - } - - /** Used to stand-in for `undefined` hash values. */ - var HASH_UNDEFINED$2 = '__lodash_hash_undefined__'; - - /** Used for built-in method references. */ - var objectProto$4 = Object.prototype; - - /** Used to check objects for own properties. */ - var hasOwnProperty$3 = objectProto$4.hasOwnProperty; - - /** - * Gets the hash value for `key`. - * - * @private - * @name get - * @memberOf Hash - * @param {string} key The key of the value to get. - * @returns {*} Returns the entry value. - */ - function hashGet(key) { - var data = this.__data__; - if (nativeCreate) { - var result = data[key]; - return result === HASH_UNDEFINED$2 ? undefined : result; - } - return hasOwnProperty$3.call(data, key) ? data[key] : undefined; - } - - /** Used for built-in method references. */ - var objectProto$3 = Object.prototype; - - /** Used to check objects for own properties. */ - var hasOwnProperty$2 = objectProto$3.hasOwnProperty; - - /** - * Checks if a hash value for `key` exists. - * - * @private - * @name has - * @memberOf Hash - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ - function hashHas(key) { - var data = this.__data__; - return nativeCreate ? data[key] !== undefined : hasOwnProperty$2.call(data, key); - } - - /** Used to stand-in for `undefined` hash values. */ - var HASH_UNDEFINED$1 = '__lodash_hash_undefined__'; - - /** - * Sets the hash `key` to `value`. - * - * @private - * @name set - * @memberOf Hash - * @param {string} key The key of the value to set. - * @param {*} value The value to set. - * @returns {Object} Returns the hash instance. - */ - function hashSet(key, value) { - var data = this.__data__; - this.size += this.has(key) ? 0 : 1; - data[key] = nativeCreate && value === undefined ? HASH_UNDEFINED$1 : value; - return this; - } - - /** - * Creates a hash object. - * - * @private - * @constructor - * @param {Array} [entries] The key-value pairs to cache. - */ - function Hash(entries) { - var index = -1, - length = entries == null ? 0 : entries.length; - - this.clear(); - while (++index < length) { - var entry = entries[index]; - this.set(entry[0], entry[1]); - } - } - - // Add methods to `Hash`. - Hash.prototype.clear = hashClear; - Hash.prototype['delete'] = hashDelete; - Hash.prototype.get = hashGet; - Hash.prototype.has = hashHas; - Hash.prototype.set = hashSet; - - /** - * Removes all key-value entries from the list cache. - * - * @private - * @name clear - * @memberOf ListCache - */ - function listCacheClear() { - this.__data__ = []; - this.size = 0; - } - - /** - * Gets the index at which the `key` is found in `array` of key-value pairs. - * - * @private - * @param {Array} array The array to inspect. - * @param {*} key The key to search for. - * @returns {number} Returns the index of the matched value, else `-1`. - */ - function assocIndexOf(array, key) { - var length = array.length; - while (length--) { - if (eq(array[length][0], key)) { - return length; - } - } - return -1; - } - - /** Used for built-in method references. */ - var arrayProto = Array.prototype; - - /** Built-in value references. */ - var splice = arrayProto.splice; - - /** - * Removes `key` and its value from the list cache. - * - * @private - * @name delete - * @memberOf ListCache - * @param {string} key The key of the value to remove. - * @returns {boolean} Returns `true` if the entry was removed, else `false`. - */ - function listCacheDelete(key) { - var data = this.__data__, - index = assocIndexOf(data, key); - - if (index < 0) { - return false; - } - var lastIndex = data.length - 1; - if (index == lastIndex) { - data.pop(); - } else { - splice.call(data, index, 1); - } - --this.size; - return true; - } - - /** - * Gets the list cache value for `key`. - * - * @private - * @name get - * @memberOf ListCache - * @param {string} key The key of the value to get. - * @returns {*} Returns the entry value. - */ - function listCacheGet(key) { - var data = this.__data__, - index = assocIndexOf(data, key); - - return index < 0 ? undefined : data[index][1]; - } - - /** - * Checks if a list cache value for `key` exists. - * - * @private - * @name has - * @memberOf ListCache - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ - function listCacheHas(key) { - return assocIndexOf(this.__data__, key) > -1; - } - - /** - * Sets the list cache `key` to `value`. - * - * @private - * @name set - * @memberOf ListCache - * @param {string} key The key of the value to set. - * @param {*} value The value to set. - * @returns {Object} Returns the list cache instance. - */ - function listCacheSet(key, value) { - var data = this.__data__, - index = assocIndexOf(data, key); - - if (index < 0) { - ++this.size; - data.push([key, value]); - } else { - data[index][1] = value; - } - return this; - } - - /** - * Creates an list cache object. - * - * @private - * @constructor - * @param {Array} [entries] The key-value pairs to cache. - */ - function ListCache(entries) { - var index = -1, - length = entries == null ? 0 : entries.length; - - this.clear(); - while (++index < length) { - var entry = entries[index]; - this.set(entry[0], entry[1]); - } - } - - // Add methods to `ListCache`. - ListCache.prototype.clear = listCacheClear; - ListCache.prototype['delete'] = listCacheDelete; - ListCache.prototype.get = listCacheGet; - ListCache.prototype.has = listCacheHas; - ListCache.prototype.set = listCacheSet; - - /* Built-in method references that are verified to be native. */ - var Map$1 = getNative(root, 'Map'); - - /** - * Removes all key-value entries from the map. - * - * @private - * @name clear - * @memberOf MapCache - */ - function mapCacheClear() { - this.size = 0; - this.__data__ = { - hash: new Hash(), - map: new (Map$1 || ListCache)(), - string: new Hash(), - }; - } - - /** - * Checks if `value` is suitable for use as unique object key. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is suitable, else `false`. - */ - function isKeyable(value) { - var type = typeof value; - return type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean' ? value !== '__proto__' : value === null; - } - - /** - * Gets the data for `map`. - * - * @private - * @param {Object} map The map to query. - * @param {string} key The reference key. - * @returns {*} Returns the map data. - */ - function getMapData(map, key) { - var data = map.__data__; - return isKeyable(key) ? data[typeof key == 'string' ? 'string' : 'hash'] : data.map; - } - - /** - * Removes `key` and its value from the map. - * - * @private - * @name delete - * @memberOf MapCache - * @param {string} key The key of the value to remove. - * @returns {boolean} Returns `true` if the entry was removed, else `false`. - */ - function mapCacheDelete(key) { - var result = getMapData(this, key)['delete'](key); - this.size -= result ? 1 : 0; - return result; - } - - /** - * Gets the map value for `key`. - * - * @private - * @name get - * @memberOf MapCache - * @param {string} key The key of the value to get. - * @returns {*} Returns the entry value. - */ - function mapCacheGet(key) { - return getMapData(this, key).get(key); - } - - /** - * Checks if a map value for `key` exists. - * - * @private - * @name has - * @memberOf MapCache - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ - function mapCacheHas(key) { - return getMapData(this, key).has(key); - } - - /** - * Sets the map `key` to `value`. - * - * @private - * @name set - * @memberOf MapCache - * @param {string} key The key of the value to set. - * @param {*} value The value to set. - * @returns {Object} Returns the map cache instance. - */ - function mapCacheSet(key, value) { - var data = getMapData(this, key), - size = data.size; - - data.set(key, value); - this.size += data.size == size ? 0 : 1; - return this; - } - - /** - * Creates a map cache object to store key-value pairs. - * - * @private - * @constructor - * @param {Array} [entries] The key-value pairs to cache. - */ - function MapCache(entries) { - var index = -1, - length = entries == null ? 0 : entries.length; - - this.clear(); - while (++index < length) { - var entry = entries[index]; - this.set(entry[0], entry[1]); - } - } - - // Add methods to `MapCache`. - MapCache.prototype.clear = mapCacheClear; - MapCache.prototype['delete'] = mapCacheDelete; - MapCache.prototype.get = mapCacheGet; - MapCache.prototype.has = mapCacheHas; - MapCache.prototype.set = mapCacheSet; - - /** - * Appends the elements of `values` to `array`. - * - * @private - * @param {Array} array The array to modify. - * @param {Array} values The values to append. - * @returns {Array} Returns `array`. - */ - function arrayPush(array, values) { - var index = -1, - length = values.length, - offset = array.length; - - while (++index < length) { - array[offset + index] = values[index]; - } - return array; - } - - /** - * Removes all key-value entries from the stack. - * - * @private - * @name clear - * @memberOf Stack - */ - function stackClear() { - this.__data__ = new ListCache(); - this.size = 0; - } - - /** - * Removes `key` and its value from the stack. - * - * @private - * @name delete - * @memberOf Stack - * @param {string} key The key of the value to remove. - * @returns {boolean} Returns `true` if the entry was removed, else `false`. - */ - function stackDelete(key) { - var data = this.__data__, - result = data['delete'](key); - - this.size = data.size; - return result; - } - - /** - * Gets the stack value for `key`. - * - * @private - * @name get - * @memberOf Stack - * @param {string} key The key of the value to get. - * @returns {*} Returns the entry value. - */ - function stackGet(key) { - return this.__data__.get(key); - } - - /** - * Checks if a stack value for `key` exists. - * - * @private - * @name has - * @memberOf Stack - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ - function stackHas(key) { - return this.__data__.has(key); - } - - /** Used as the size to enable large array optimizations. */ - var LARGE_ARRAY_SIZE = 200; - - /** - * Sets the stack `key` to `value`. - * - * @private - * @name set - * @memberOf Stack - * @param {string} key The key of the value to set. - * @param {*} value The value to set. - * @returns {Object} Returns the stack cache instance. - */ - function stackSet(key, value) { - var data = this.__data__; - if (data instanceof ListCache) { - var pairs = data.__data__; - if (!Map$1 || pairs.length < LARGE_ARRAY_SIZE - 1) { - pairs.push([key, value]); - this.size = ++data.size; - return this; - } - data = this.__data__ = new MapCache(pairs); - } - data.set(key, value); - this.size = data.size; - return this; - } - - /** - * Creates a stack cache object to store key-value pairs. - * - * @private - * @constructor - * @param {Array} [entries] The key-value pairs to cache. - */ - function Stack(entries) { - var data = (this.__data__ = new ListCache(entries)); - this.size = data.size; - } - - // Add methods to `Stack`. - Stack.prototype.clear = stackClear; - Stack.prototype['delete'] = stackDelete; - Stack.prototype.get = stackGet; - Stack.prototype.has = stackHas; - Stack.prototype.set = stackSet; - - /** - * A specialized version of `_.filter` for arrays without support for - * iteratee shorthands. - * - * @private - * @param {Array} [array] The array to iterate over. - * @param {Function} predicate The function invoked per iteration. - * @returns {Array} Returns the new filtered array. - */ - function arrayFilter(array, predicate) { - var index = -1, - length = array == null ? 0 : array.length, - resIndex = 0, - result = []; - - while (++index < length) { - var value = array[index]; - if (predicate(value, index, array)) { - result[resIndex++] = value; - } - } - return result; - } - - /** - * This method returns a new empty array. - * - * @static - * @memberOf _ - * @since 4.13.0 - * @category Util - * @returns {Array} Returns the new empty array. - * @example - * - * var arrays = _.times(2, _.stubArray); - * - * console.log(arrays); - * // => [[], []] - * - * console.log(arrays[0] === arrays[1]); - * // => false - */ - function stubArray() { - return []; - } - - /** Used for built-in method references. */ - var objectProto$2 = Object.prototype; - - /** Built-in value references. */ - var propertyIsEnumerable = objectProto$2.propertyIsEnumerable; - - /* Built-in method references for those with the same name as other `lodash` methods. */ - var nativeGetSymbols = Object.getOwnPropertySymbols; - - /** - * Creates an array of the own enumerable symbols of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the array of symbols. - */ - var getSymbols = !nativeGetSymbols - ? stubArray - : function (object) { - if (object == null) { - return []; - } - object = Object(object); - return arrayFilter(nativeGetSymbols(object), function (symbol) { - return propertyIsEnumerable.call(object, symbol); - }); - }; - - /** - * The base implementation of `getAllKeys` and `getAllKeysIn` which uses - * `keysFunc` and `symbolsFunc` to get the enumerable property names and - * symbols of `object`. - * - * @private - * @param {Object} object The object to query. - * @param {Function} keysFunc The function to get the keys of `object`. - * @param {Function} symbolsFunc The function to get the symbols of `object`. - * @returns {Array} Returns the array of property names and symbols. - */ - function baseGetAllKeys(object, keysFunc, symbolsFunc) { - var result = keysFunc(object); - return isArray(object) ? result : arrayPush(result, symbolsFunc(object)); - } - - /** - * Creates an array of own enumerable property names and symbols of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names and symbols. - */ - function getAllKeys(object) { - return baseGetAllKeys(object, keys, getSymbols); - } - - /* Built-in method references that are verified to be native. */ - var DataView = getNative(root, 'DataView'); - - /* Built-in method references that are verified to be native. */ - var Promise$1 = getNative(root, 'Promise'); - - /* Built-in method references that are verified to be native. */ - var Set$1 = getNative(root, 'Set'); - - /** `Object#toString` result references. */ - var mapTag$1 = '[object Map]', - objectTag$1 = '[object Object]', - promiseTag = '[object Promise]', - setTag$1 = '[object Set]', - weakMapTag = '[object WeakMap]'; - - var dataViewTag$1 = '[object DataView]'; - - /** Used to detect maps, sets, and weakmaps. */ - var dataViewCtorString = toSource(DataView), - mapCtorString = toSource(Map$1), - promiseCtorString = toSource(Promise$1), - setCtorString = toSource(Set$1), - weakMapCtorString = toSource(WeakMap); - - /** - * Gets the `toStringTag` of `value`. - * - * @private - * @param {*} value The value to query. - * @returns {string} Returns the `toStringTag`. - */ - var getTag = baseGetTag; - - // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6. - if ( - (DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag$1) || - (Map$1 && getTag(new Map$1()) != mapTag$1) || - (Promise$1 && getTag(Promise$1.resolve()) != promiseTag) || - (Set$1 && getTag(new Set$1()) != setTag$1) || - (WeakMap && getTag(new WeakMap()) != weakMapTag) - ) { - getTag = function (value) { - var result = baseGetTag(value), - Ctor = result == objectTag$1 ? value.constructor : undefined, - ctorString = Ctor ? toSource(Ctor) : ''; - - if (ctorString) { - switch (ctorString) { - case dataViewCtorString: - return dataViewTag$1; - case mapCtorString: - return mapTag$1; - case promiseCtorString: - return promiseTag; - case setCtorString: - return setTag$1; - case weakMapCtorString: - return weakMapTag; - } - } - return result; - }; - } - - var getTag$1 = getTag; - - /** Built-in value references. */ - var Uint8Array = root.Uint8Array; - - /** Used to stand-in for `undefined` hash values. */ - var HASH_UNDEFINED = '__lodash_hash_undefined__'; - - /** - * Adds `value` to the array cache. - * - * @private - * @name add - * @memberOf SetCache - * @alias push - * @param {*} value The value to cache. - * @returns {Object} Returns the cache instance. - */ - function setCacheAdd(value) { - this.__data__.set(value, HASH_UNDEFINED); - return this; - } - - /** - * Checks if `value` is in the array cache. - * - * @private - * @name has - * @memberOf SetCache - * @param {*} value The value to search for. - * @returns {number} Returns `true` if `value` is found, else `false`. - */ - function setCacheHas(value) { - return this.__data__.has(value); - } - - /** - * - * Creates an array cache object to store unique values. - * - * @private - * @constructor - * @param {Array} [values] The values to cache. - */ - function SetCache(values) { - var index = -1, - length = values == null ? 0 : values.length; - - this.__data__ = new MapCache(); - while (++index < length) { - this.add(values[index]); - } - } - - // Add methods to `SetCache`. - SetCache.prototype.add = SetCache.prototype.push = setCacheAdd; - SetCache.prototype.has = setCacheHas; - - /** - * A specialized version of `_.some` for arrays without support for iteratee - * shorthands. - * - * @private - * @param {Array} [array] The array to iterate over. - * @param {Function} predicate The function invoked per iteration. - * @returns {boolean} Returns `true` if any element passes the predicate check, - * else `false`. - */ - function arraySome(array, predicate) { - var index = -1, - length = array == null ? 0 : array.length; - - while (++index < length) { - if (predicate(array[index], index, array)) { - return true; - } - } - return false; - } - - /** - * Checks if a `cache` value for `key` exists. - * - * @private - * @param {Object} cache The cache to query. - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ - function cacheHas(cache, key) { - return cache.has(key); - } - - /** Used to compose bitmasks for value comparisons. */ - var COMPARE_PARTIAL_FLAG$3 = 1, - COMPARE_UNORDERED_FLAG$1 = 2; - - /** - * A specialized version of `baseIsEqualDeep` for arrays with support for - * partial deep comparisons. - * - * @private - * @param {Array} array The array to compare. - * @param {Array} other The other array to compare. - * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. - * @param {Function} customizer The function to customize comparisons. - * @param {Function} equalFunc The function to determine equivalents of values. - * @param {Object} stack Tracks traversed `array` and `other` objects. - * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`. - */ - function equalArrays(array, other, bitmask, customizer, equalFunc, stack) { - var isPartial = bitmask & COMPARE_PARTIAL_FLAG$3, - arrLength = array.length, - othLength = other.length; - - if (arrLength != othLength && !(isPartial && othLength > arrLength)) { - return false; - } - // Check that cyclic values are equal. - var arrStacked = stack.get(array); - var othStacked = stack.get(other); - if (arrStacked && othStacked) { - return arrStacked == other && othStacked == array; - } - var index = -1, - result = true, - seen = bitmask & COMPARE_UNORDERED_FLAG$1 ? new SetCache() : undefined; - - stack.set(array, other); - stack.set(other, array); - - // Ignore non-index properties. - while (++index < arrLength) { - var arrValue = array[index], - othValue = other[index]; - - if (customizer) { - var compared = isPartial - ? customizer(othValue, arrValue, index, other, array, stack) - : customizer(arrValue, othValue, index, array, other, stack); - } - if (compared !== undefined) { - if (compared) { - continue; - } - result = false; - break; - } - // Recursively compare arrays (susceptible to call stack limits). - if (seen) { - if ( - !arraySome(other, function (othValue, othIndex) { - if ( - !cacheHas(seen, othIndex) && - (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack)) - ) { - return seen.push(othIndex); - } - }) - ) { - result = false; - break; - } - } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) { - result = false; - break; - } - } - stack['delete'](array); - stack['delete'](other); - return result; - } - - /** - * Converts `map` to its key-value pairs. - * - * @private - * @param {Object} map The map to convert. - * @returns {Array} Returns the key-value pairs. - */ - function mapToArray(map) { - var index = -1, - result = Array(map.size); - - map.forEach(function (value, key) { - result[++index] = [key, value]; - }); - return result; - } - - /** - * Converts `set` to an array of its values. - * - * @private - * @param {Object} set The set to convert. - * @returns {Array} Returns the values. - */ - function setToArray(set) { - var index = -1, - result = Array(set.size); - - set.forEach(function (value) { - result[++index] = value; - }); - return result; - } - - /** Used to compose bitmasks for value comparisons. */ - var COMPARE_PARTIAL_FLAG$2 = 1, - COMPARE_UNORDERED_FLAG = 2; - - /** `Object#toString` result references. */ - var boolTag = '[object Boolean]', - dateTag = '[object Date]', - errorTag = '[object Error]', - mapTag = '[object Map]', - numberTag = '[object Number]', - regexpTag = '[object RegExp]', - setTag = '[object Set]', - stringTag = '[object String]', - symbolTag = '[object Symbol]'; - - var arrayBufferTag = '[object ArrayBuffer]', - dataViewTag = '[object DataView]'; - - /** Used to convert symbols to primitives and strings. */ - var symbolProto = Symbol$1 ? Symbol$1.prototype : undefined, - symbolValueOf = symbolProto ? symbolProto.valueOf : undefined; - - /** - * A specialized version of `baseIsEqualDeep` for comparing objects of - * the same `toStringTag`. - * - * **Note:** This function only supports comparing values with tags of - * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`. - * - * @private - * @param {Object} object The object to compare. - * @param {Object} other The other object to compare. - * @param {string} tag The `toStringTag` of the objects to compare. - * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. - * @param {Function} customizer The function to customize comparisons. - * @param {Function} equalFunc The function to determine equivalents of values. - * @param {Object} stack Tracks traversed `object` and `other` objects. - * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. - */ - function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) { - switch (tag) { - case dataViewTag: - if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) { - return false; - } - object = object.buffer; - other = other.buffer; - - case arrayBufferTag: - if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array(object), new Uint8Array(other))) { - return false; - } - return true; - - case boolTag: - case dateTag: - case numberTag: - // Coerce booleans to `1` or `0` and dates to milliseconds. - // Invalid dates are coerced to `NaN`. - return eq(+object, +other); - - case errorTag: - return object.name == other.name && object.message == other.message; - - case regexpTag: - case stringTag: - // Coerce regexes to strings and treat strings, primitives and objects, - // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring - // for more details. - return object == other + ''; - - case mapTag: - var convert = mapToArray; - - case setTag: - var isPartial = bitmask & COMPARE_PARTIAL_FLAG$2; - convert || (convert = setToArray); - - if (object.size != other.size && !isPartial) { - return false; - } - // Assume cyclic values are equal. - var stacked = stack.get(object); - if (stacked) { - return stacked == other; - } - bitmask |= COMPARE_UNORDERED_FLAG; - - // Recursively compare objects (susceptible to call stack limits). - stack.set(object, other); - var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack); - stack['delete'](object); - return result; - - case symbolTag: - if (symbolValueOf) { - return symbolValueOf.call(object) == symbolValueOf.call(other); - } - } - return false; - } - - /** Used to compose bitmasks for value comparisons. */ - var COMPARE_PARTIAL_FLAG$1 = 1; - - /** Used for built-in method references. */ - var objectProto$1 = Object.prototype; - - /** Used to check objects for own properties. */ - var hasOwnProperty$1 = objectProto$1.hasOwnProperty; - - /** - * A specialized version of `baseIsEqualDeep` for objects with support for - * partial deep comparisons. - * - * @private - * @param {Object} object The object to compare. - * @param {Object} other The other object to compare. - * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. - * @param {Function} customizer The function to customize comparisons. - * @param {Function} equalFunc The function to determine equivalents of values. - * @param {Object} stack Tracks traversed `object` and `other` objects. - * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. - */ - function equalObjects(object, other, bitmask, customizer, equalFunc, stack) { - var isPartial = bitmask & COMPARE_PARTIAL_FLAG$1, - objProps = getAllKeys(object), - objLength = objProps.length, - othProps = getAllKeys(other), - othLength = othProps.length; - - if (objLength != othLength && !isPartial) { - return false; - } - var index = objLength; - while (index--) { - var key = objProps[index]; - if (!(isPartial ? key in other : hasOwnProperty$1.call(other, key))) { - return false; - } - } - // Check that cyclic values are equal. - var objStacked = stack.get(object); - var othStacked = stack.get(other); - if (objStacked && othStacked) { - return objStacked == other && othStacked == object; - } - var result = true; - stack.set(object, other); - stack.set(other, object); - - var skipCtor = isPartial; - while (++index < objLength) { - key = objProps[index]; - var objValue = object[key], - othValue = other[key]; - - if (customizer) { - var compared = isPartial - ? customizer(othValue, objValue, key, other, object, stack) - : customizer(objValue, othValue, key, object, other, stack); - } - // Recursively compare objects (susceptible to call stack limits). - if ( - !(compared === undefined ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared) - ) { - result = false; - break; - } - skipCtor || (skipCtor = key == 'constructor'); - } - if (result && !skipCtor) { - var objCtor = object.constructor, - othCtor = other.constructor; - - // Non `Object` object instances with different constructors are not equal. - if ( - objCtor != othCtor && - 'constructor' in object && - 'constructor' in other && - !( - typeof objCtor == 'function' && - objCtor instanceof objCtor && - typeof othCtor == 'function' && - othCtor instanceof othCtor - ) - ) { - result = false; - } - } - stack['delete'](object); - stack['delete'](other); - return result; - } - - /** Used to compose bitmasks for value comparisons. */ - var COMPARE_PARTIAL_FLAG = 1; - - /** `Object#toString` result references. */ - var argsTag = '[object Arguments]', - arrayTag = '[object Array]', - objectTag = '[object Object]'; - - /** Used for built-in method references. */ - var objectProto = Object.prototype; - - /** Used to check objects for own properties. */ - var hasOwnProperty = objectProto.hasOwnProperty; - - /** - * A specialized version of `baseIsEqual` for arrays and objects which performs - * deep comparisons and tracks traversed objects enabling objects with circular - * references to be compared. - * - * @private - * @param {Object} object The object to compare. - * @param {Object} other The other object to compare. - * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. - * @param {Function} customizer The function to customize comparisons. - * @param {Function} equalFunc The function to determine equivalents of values. - * @param {Object} [stack] Tracks traversed `object` and `other` objects. - * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. - */ - function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) { - var objIsArr = isArray(object), - othIsArr = isArray(other), - objTag = objIsArr ? arrayTag : getTag$1(object), - othTag = othIsArr ? arrayTag : getTag$1(other); - - objTag = objTag == argsTag ? objectTag : objTag; - othTag = othTag == argsTag ? objectTag : othTag; - - var objIsObj = objTag == objectTag, - othIsObj = othTag == objectTag, - isSameTag = objTag == othTag; - - if (isSameTag && isBuffer(object)) { - if (!isBuffer(other)) { - return false; - } - objIsArr = true; - objIsObj = false; - } - if (isSameTag && !objIsObj) { - stack || (stack = new Stack()); - return objIsArr || isTypedArray(object) - ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) - : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack); - } - if (!(bitmask & COMPARE_PARTIAL_FLAG)) { - var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'), - othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__'); - - if (objIsWrapped || othIsWrapped) { - var objUnwrapped = objIsWrapped ? object.value() : object, - othUnwrapped = othIsWrapped ? other.value() : other; - - stack || (stack = new Stack()); - return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack); - } - } - if (!isSameTag) { - return false; - } - stack || (stack = new Stack()); - return equalObjects(object, other, bitmask, customizer, equalFunc, stack); - } - - /** - * The base implementation of `_.isEqual` which supports partial comparisons - * and tracks traversed objects. - * - * @private - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @param {boolean} bitmask The bitmask flags. - * 1 - Unordered comparison - * 2 - Partial comparison - * @param {Function} [customizer] The function to customize comparisons. - * @param {Object} [stack] Tracks traversed `value` and `other` objects. - * @returns {boolean} Returns `true` if the values are equivalent, else `false`. - */ - function baseIsEqual(value, other, bitmask, customizer, stack) { - if (value === other) { - return true; - } - if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) { - return value !== value && other !== other; - } - return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack); - } - - /** - * Performs a deep comparison between two values to determine if they are - * equivalent. - * - * **Note:** This method supports comparing arrays, array buffers, booleans, - * date objects, error objects, maps, numbers, `Object` objects, regexes, - * sets, strings, symbols, and typed arrays. `Object` objects are compared - * by their own, not inherited, enumerable properties. Functions and DOM - * nodes are compared by strict equality, i.e. `===`. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @returns {boolean} Returns `true` if the values are equivalent, else `false`. - * @example - * - * var object = { 'a': 1 }; - * var other = { 'a': 1 }; - * - * _.isEqual(object, other); - * // => true - * - * object === other; - * // => false - */ - function isEqual(value, other) { - return baseIsEqual(value, other); - } - - exports.OBSERVER_TYPE = void 0; - (function (ObserverType) { - ObserverType['ADD'] = 'ADD'; - ObserverType['REMOVE'] = 'REMOVE'; - ObserverType['CHANGE'] = 'CHANGE'; - })(exports.OBSERVER_TYPE || (exports.OBSERVER_TYPE = {})); - const objectCache = {}; - const systemInstance = {}; - const observerInfos = {}; - const componentProps = {}; - function getObjectCache(component, keys) { - if (!objectCache[component.gameObject.id]) { - objectCache[component.gameObject.id] = {}; - } - const cache = objectCache[component.gameObject.id]; - const key = component.name + '_' + keys.join(','); - if (cache[key]) { - return cache[key]; - } - const keyIndex = keys.length - 1; - let property = component; - for (let i = 0; i < keyIndex; i++) { - property = property[keys[i]]; - } - cache[key] = {property, key: keys[keyIndex]}; - return cache[key]; - } - function removeObjectCache(component) { - if (component.gameObject) { - delete objectCache[component.gameObject.id]; - } - } - function addObserver({systemName, componentName, component, prop, type}) { - systemInstance[systemName].componentObserver.add({ - component, - prop, - type, - componentName, - }); - } - function pushToQueue({prop, component, componentName}) { - for (const systemName in observerInfos) { - const observerInfo = observerInfos[systemName] || {}; - const info = observerInfo[componentName]; - if (!info) continue; - const index = info.findIndex(p => { - return isEqual(p, prop); - }); - if (index > -1) { - addObserver({ - systemName, - componentName, - component, - prop, - type: exports.OBSERVER_TYPE.CHANGE, - }); - } - } - } - function defineProperty({obj, key, prop, component, componentName}) { - if (obj === undefined) { - return; - } - if (!(key in obj)) { - console.error(`prop ${key} not in component: ${componentName}, Can not observer`); - return; - } - Object.defineProperty(obj, `_${key}`, { - enumerable: false, - writable: true, - value: obj[key], - }); - if (prop.deep && isObject(obj[key])) { - for (const childKey of Object.keys(obj[key])) { - defineProperty({ - obj: obj[key], - key: childKey, - prop, - component, - componentName, - }); - } - } - Object.defineProperty(obj, key, { - enumerable: true, - set(val) { - if (obj[`_${key}`] === val) return; - obj[`_${key}`] = val; - pushToQueue({prop, component, componentName}); - }, - get() { - return obj[`_${key}`]; - }, - }); - } - function isComponent(comp) { - return comp && comp.constructor && 'componentName' in comp.constructor; - } - function initObserver(Systems) { - const Ss = []; - if (Systems instanceof Array) { - Ss.push(...Systems); - } else { - Ss.push(Systems); - } - for (const S of Ss) { - for (const componentName in S.observerInfo) { - componentProps[componentName] = componentProps[componentName] || []; - const props = componentProps[componentName]; - for (const prop of S.observerInfo[componentName]) { - const index = props.findIndex(p => { - return isEqual(p, prop); - }); - if (index === -1) { - componentProps[componentName].push(prop); - } - } - } - } - } - function observer(component, componentName = component.name) { - if (!componentName || !componentProps[componentName]) { - return; - } - if (!component || !isComponent(component)) { - throw new Error('component param must be an instance of Component'); - } - if (!component.gameObject || !component.gameObject.id) { - throw new Error('component should be add to a gameObject'); - } - for (const item of componentProps[componentName]) { - const {property, key} = getObjectCache(component, item.prop); - defineProperty({ - obj: property, - key, - prop: item, - component, - componentName, - }); - } - } - function observerAdded(component, componentName = component.name) { - for (const systemName in observerInfos) { - const observerInfo = observerInfos[systemName] || {}; - const info = observerInfo[componentName]; - if (info) { - systemInstance[systemName].componentObserver.add({ - component, - type: exports.OBSERVER_TYPE.ADD, - componentName, - }); - } - } - } - function observerRemoved(component, componentName = component.name) { - for (const systemName in observerInfos) { - const observerInfo = observerInfos[systemName] || {}; - const info = observerInfo[componentName]; - if (info) { - systemInstance[systemName].componentObserver.add({ - component, - type: exports.OBSERVER_TYPE.REMOVE, - componentName, - }); - } - } - removeObjectCache(component); - } - function setSystemObserver(system, S) { - observerInfos[S.systemName] = S.observerInfo; - systemInstance[S.systemName] = system; - } - - /*! ***************************************************************************** - Copyright (c) Microsoft Corporation. - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. - ***************************************************************************** */ - - function __decorate(decorators, target, key, desc) { - var c = arguments.length, - r = c < 3 ? target : desc === null ? (desc = Object.getOwnPropertyDescriptor(target, key)) : desc, - d; - if (typeof Reflect === 'object' && typeof Reflect.decorate === 'function') - r = Reflect.decorate(decorators, target, key, desc); - else - for (var i = decorators.length - 1; i >= 0; i--) - if ((d = decorators[i])) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; - } - - function __awaiter(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P - ? value - : new P(function (resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator['throw'](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - } - - function IDEProp(target, propertyKey) { - if (!target.constructor.IDEProps) { - target.constructor.IDEProps = []; - } - target.constructor.IDEProps.push(propertyKey); - } - - class Transform extends Component { - constructor() { - super(...arguments); - this.name = 'Transform'; - this._parent = null; - this.inScene = false; - this.children = []; - this.position = {x: 0, y: 0}; - this.size = {width: 0, height: 0}; - this.origin = {x: 0, y: 0}; - this.anchor = {x: 0, y: 0}; - this.scale = {x: 1, y: 1}; - this.skew = {x: 0, y: 0}; - this.rotation = 0; - } - init(params = {}) { - const props = ['position', 'size', 'origin', 'anchor', 'scale', 'skew']; - for (const key of props) { - Object.assign(this[key], params[key]); - } - this.rotation = params.rotation || this.rotation; - } - set parent(val) { - if (val) { - val.addChild(this); - } else if (this.parent) { - this.parent.removeChild(this); - } - } - get parent() { - return this._parent; - } - addChild(child) { - if (child.parent === this) { - const index = this.children.findIndex(item => item === child); - this.children.splice(index, 1); - } else if (child.parent) { - child.parent.removeChild(child); - } - child._parent = this; - this.children.push(child); - } - removeChild(child) { - const index = this.children.findIndex(item => item === child); - if (index > -1) { - this.children.splice(index, 1); - child._parent = null; - } - } - clearChildren() { - this.children.length = 0; - } - } - Transform.componentName = 'Transform'; - __decorate([IDEProp], Transform.prototype, 'position', void 0); - __decorate([IDEProp], Transform.prototype, 'size', void 0); - __decorate([IDEProp], Transform.prototype, 'origin', void 0); - __decorate([IDEProp], Transform.prototype, 'anchor', void 0); - __decorate([IDEProp], Transform.prototype, 'scale', void 0); - __decorate([IDEProp], Transform.prototype, 'skew', void 0); - __decorate([IDEProp], Transform.prototype, 'rotation', void 0); - - let _id = 0; - function getId() { - return ++_id; - } - class GameObject { - constructor(name, obj) { - this._componentCache = {}; - this.components = []; - this._name = name; - this.id = getId(); - this.addComponent(Transform, obj); - } - get transform() { - return this.getComponent(Transform); - } - get parent() { - return this.transform && this.transform.parent && this.transform.parent.gameObject; - } - get name() { - return this._name; - } - set scene(val) { - if (this._scene === val) return; - const scene = this._scene; - this._scene = val; - if (this.transform && this.transform.children) { - for (const child of this.transform.children) { - child.gameObject.scene = val; - } - } - if (val) { - val.addGameObject(this); - } else { - scene && scene.removeGameObject(this); - } - } - get scene() { - return this._scene; - } - addChild(gameObject) { - if (!gameObject || !gameObject.transform || gameObject === this) return; - if (!(gameObject instanceof GameObject)) { - throw new Error('addChild only receive GameObject'); - } - if (!this.transform) { - throw new Error(`gameObject '${this.name}' has been destroy`); - } - gameObject.transform.parent = this.transform; - gameObject.scene = this.scene; - } - removeChild(gameObject) { - if (!(gameObject instanceof GameObject) || !gameObject.parent || gameObject.parent !== this) { - return gameObject; - } - gameObject.transform.parent = null; - gameObject.scene = null; - return gameObject; - } - addComponent(C, obj) { - const componentName = getComponentName(C); - if (this._componentCache[componentName]) return; - let component; - if (C instanceof Function) { - component = new C(obj); - } else if (C instanceof Component) { - component = C; - } else { - throw new Error('addComponent recieve Component and Component Constructor'); - } - if (component.gameObject) { - throw new Error(`component has been added on gameObject ${component.gameObject.name}`); - } - component.gameObject = this; - component.init && component.init(component.__componentDefaultParams); - observerAdded(component, component.name); - observer(component, component.name); - this.components.push(component); - this._componentCache[componentName] = component; - component.awake && component.awake(); - return component; - } - removeComponent(c) { - let componentName; - if (typeof c === 'string') { - componentName = c; - } else if (c instanceof Component) { - componentName = c.name; - } else if (c.componentName) { - componentName = c.componentName; - } - if (componentName === 'Transform') { - throw new Error("Transform can't be removed"); - } - return this._removeComponent(componentName); - } - _removeComponent(componentName) { - const index = this.components.findIndex(({name}) => name === componentName); - if (index === -1) return; - const component = this.components.splice(index, 1)[0]; - delete this._componentCache[componentName]; - delete component.__componentDefaultParams; - component.onDestroy && component.onDestroy(); - observerRemoved(component, componentName); - component.gameObject = undefined; - return component; - } - getComponent(c) { - let componentName; - if (typeof c === 'string') { - componentName = c; - } else if (c instanceof Component) { - componentName = c.name; - } else if (c.componentName) { - componentName = c.componentName; - } - if (typeof this._componentCache[componentName] !== 'undefined') { - return this._componentCache[componentName]; - } else { - return; - } - } - remove() { - if (this.parent) return this.parent.removeChild(this); - } - destroy() { - Array.from(this.transform.children).forEach(({gameObject}) => { - gameObject.destroy(); - }); - this.remove(); - this.transform.clearChildren(); - for (const key in this._componentCache) { - this._removeComponent(key); - } - this.components.length = 0; - } - } - - class ComponentObserver { - constructor() { - this.events = []; - } - add({component, prop, type, componentName}) { - if (type === exports.OBSERVER_TYPE.REMOVE) { - this.events = this.events.filter(changed => changed.component !== component); - } - const index = this.events.findIndex( - changed => changed.component === component && isEqual(changed.prop, prop) && changed.type === type, - ); - if (index > -1) { - this.events.splice(index, 1); - } - this.events.push({ - gameObject: component.gameObject, - component, - prop: prop, - type, - componentName, - }); - } - getChanged() { - return this.events; - } - get changed() { - return this.events; - } - clear() { - const events = this.events; - this.events = []; - return events; - } - } - - class System { - constructor(params) { - this.started = false; - this.componentObserver = new ComponentObserver(); - this.__systemDefaultParams = params; - this.name = this.constructor.systemName; - } - destroy() { - var _a; - this.componentObserver = null; - this.__systemDefaultParams = null; - (_a = this.onDestroy) === null || _a === void 0 ? void 0 : _a.call(this); - } - } - - function createNowTime(syncLocker = true) { - let nowtime = null; - if (Date.now) { - nowtime = Date.now; - } else { - nowtime = () => new Date().getTime(); - } - - return nowtime; - } - - /* - delay = 100 -> delay = {delay: 100} - delay = {entropy: 100} -> delay = {delay: 100, isEntropy: true} - */ - function formatDelay(delay) { - if (typeof delay === 'number') { - delay = {delay}; - } else if ('entropy' in delay) { - delay = {delay: delay.entropy, isEntropy: true}; - } - return delay; - } - - const _nowtime = createNowTime(); - - const defaultOptions$1 = { - originTime: 0, - playbackRate: 1.0, - }; - - const _timeMark = Symbol('timeMark'), - _playbackRate = Symbol('playbackRate'), - _timers = Symbol('timers'), - _originTime = Symbol('originTime'), - _setTimer = Symbol('setTimer'), - _parent = Symbol('parent'); - - class Timeline { - constructor(options, parent) { - if (options instanceof Timeline) { - parent = options; - options = {}; - } - - options = Object.assign({}, defaultOptions$1, options); - - if (parent) { - this[_parent] = parent; - } - - const nowtime = options.nowtime || _nowtime; - if (!parent) { - const createTime = nowtime(); - Object.defineProperty(this, 'globalTime', { - get() { - return nowtime() - createTime; - }, - }); - } else { - Object.defineProperty(this, 'globalTime', { - get() { - return parent.currentTime; - }, - }); - } - - // timeMark records the reference points on timeline - // Each time we change the playbackRate or currentTime or entropy - // A new timeMark will be generated - // timeMark sorted by entropy - // If you reset entropy, all the timeMarks behind the new entropy - // should be dropped - this[_timeMark] = [ - { - globalTime: this.globalTime, - localTime: -options.originTime, - entropy: -options.originTime, - playbackRate: options.playbackRate, - globalEntropy: 0, - }, - ]; - - if (this[_parent]) { - this[_timeMark][0].globalEntropy = this[_parent].entropy; - } - - this[_originTime] = options.originTime; - this[_playbackRate] = options.playbackRate; - this[_timers] = new Map(); - } - - get parent() { - return this[_parent]; - } - - get lastTimeMark() { - return this[_timeMark][this[_timeMark].length - 1]; - } - - markTime({time = this.currentTime, entropy = this.entropy, playbackRate = this.playbackRate} = {}) { - const timeMark = { - globalTime: this.globalTime, - localTime: time, - entropy, - playbackRate, - globalEntropy: this.globalEntropy, - }; - this[_timeMark].push(timeMark); - } - - get currentTime() { - const {localTime, globalTime} = this.lastTimeMark; - return localTime + (this.globalTime - globalTime) * this.playbackRate; - } - - set currentTime(time) { - const from = this.currentTime, - to = time, - timers = this[_timers]; - - this.markTime({time}); - Array.from(Object.entries(timers)).forEach(([id, timer]) => { - if (!timers.has(id)) return; // Need check because it maybe clearTimeout by former handler(). - const {isEntropy, delay, heading} = timer.time, - {handler, startTime} = timer; - - if (!isEntropy) { - const endTime = startTime + delay; - if ( - delay === 0 || - (heading !== false && (to - from) * delay <= 0) || - (from <= endTime && endTime <= to) || - (from >= endTime && endTime >= to) - ) { - handler(); - this.clearTimeout(id); - } - } else if (delay === 0) { - handler(); - this.clearTimeout(id); - } - }); - this.updateTimers(); - } - - // Both currentTime and entropy should be influenced by playbackRate. - // If current playbackRate is negative, the currentTime should go backwards - // while the entropy remain to go forwards. - // Both of the initial values is set to -originTime - get entropy() { - const {entropy, globalEntropy} = this.lastTimeMark; - return entropy + Math.abs((this.globalEntropy - globalEntropy) * this.playbackRate); - } - - get globalEntropy() { - return this[_parent] ? this[_parent].entropy : this.globalTime; - } - - // get globalTime() { - // if(this[_parent]) { - // return this[_parent].currentTime; - // } - - // return nowtime(); - // } - - // change entropy will NOT cause currentTime changing but may influence the pass - // and the future of the timeline. (It may change the result of seek***Time) - // While entropy is set, all the marks behind will be droped - // eslint-disable-next-line @typescript-eslint/adjacent-overload-signatures - set entropy(entropy) { - if (this.entropy > entropy) { - const idx = this.seekTimeMark(entropy); - this[_timeMark].length = idx + 1; - } - this.markTime({entropy}); - this.updateTimers(); - } - - fork(options) { - return new Timeline(options, this); - } - - seekGlobalTime(seekEntropy) { - const idx = this.seekTimeMark(seekEntropy), - timeMark = this[_timeMark][idx]; - - const {entropy, playbackRate, globalTime} = timeMark; - - return globalTime + (seekEntropy - entropy) / Math.abs(playbackRate); - } - - seekLocalTime(seekEntropy) { - const idx = this.seekTimeMark(seekEntropy), - timeMark = this[_timeMark][idx]; - - const {localTime, entropy, playbackRate} = timeMark; - - if (playbackRate > 0) { - return localTime + (seekEntropy - entropy); - } - return localTime - (seekEntropy - entropy); - } - - seekTimeMark(entropy) { - const timeMark = this[_timeMark]; - - let l = 0, - r = timeMark.length - 1; - - if (entropy <= timeMark[l].entropy) { - return l; - } - if (entropy >= timeMark[r].entropy) { - return r; - } - - let m = Math.floor((l + r) / 2); // binary search - - while (m > l && m < r) { - if (entropy === timeMark[m].entropy) { - return m; - } - if (entropy < timeMark[m].entropy) { - r = m; - } else if (entropy > timeMark[m].entropy) { - l = m; - } - m = Math.floor((l + r) / 2); - } - - return l; - } - - get playbackRate() { - return this[_playbackRate]; - } - - set playbackRate(rate) { - if (rate !== this.playbackRate) { - this.markTime({playbackRate: rate}); - this[_playbackRate] = rate; - this.updateTimers(); - } - } - - get paused() { - if (this.playbackRate === 0) return true; - let parent = this.parent; - while (parent) { - if (parent.playbackRate === 0) return true; - parent = parent.parent; - } - return false; - } - - updateTimers() { - const timers = Array.from(this[_timers].entries()); - timers.forEach(([id, timer]) => { - this[_setTimer](timer.handler, timer.time, id); - }); - } - - clearTimeout(id) { - const timer = this[_timers].get(id); - - if (timer && timer.timerID != null) { - if (this[_parent]) { - this[_parent].clearTimeout(timer.timerID); - } else { - clearTimeout(timer.timerID); - } - } - this[_timers].delete(id); - } - - clearInterval(id) { - return this.clearTimeout(id); - } - - clear() { - // clear all running timers - const timers = this[_timers]; - Array.from(Object.keys(timers)).forEach(id => { - this.clearTimeout(id); - }); - } - - /* - setTimeout(func, {delay: 100, isEntropy: true}) - setTimeout(func, {entropy: 100}) - setTimeout(func, 100}) - */ - setTimeout(handler, time = {delay: 0}) { - return this[_setTimer](handler, time); - } - - setInterval(handler, time = {delay: 0}) { - const that = this; - const id = this[_setTimer](function step() { - // reset timer before handler cause we may clearTimeout in handler() - that[_setTimer](step, time, id); - handler(); - }, time); - - return id; - } - - [_setTimer](handler, time, id = Symbol('timerID')) { - time = formatDelay(time); - - const timer = this[_timers].get(id); - let delay, - timerID = null, - startTime, - startEntropy; - - if (timer) { - this.clearTimeout(id); - if (time.isEntropy) { - delay = (time.delay - (this.entropy - timer.startEntropy)) / Math.abs(this.playbackRate); - } else { - delay = (time.delay - (this.currentTime - timer.startTime)) / this.playbackRate; - } - startTime = timer.startTime; - startEntropy = timer.startEntropy; - } else { - delay = time.delay / (time.isEntropy ? Math.abs(this.playbackRate) : this.playbackRate); - startTime = this.currentTime; - startEntropy = this.entropy; - } - - const parent = this[_parent], - globalTimeout = parent ? parent.setTimeout.bind(parent) : setTimeout; - - const heading = time.heading; - // console.log(heading, parent, delay) - if (!parent && heading === false && delay < 0) { - delay = Infinity; - } - - // if playbackRate is zero, delay will be infinity. - // For wxapp bugs, cannot use Number.isFinite yet. - if (isFinite(delay) || parent) { - // eslint-disable-line no-restricted-globals - delay = Math.ceil(delay); - if (globalTimeout !== setTimeout) { - delay = {delay, heading}; - } - timerID = globalTimeout(() => { - this[_timers].delete(id); - handler(); - }, delay); - } - - this[_timers].set(id, { - timerID, - handler, - time, - startTime, - startEntropy, - }); - - return id; - } - } - - const defaultOptions = { - autoStart: true, - frameRate: 60, - }; - class Ticker { - constructor(options) { - options = Object.assign({}, defaultOptions, options); - this._frameCount = 0; - this._frameDuration = 1000 / options.frameRate; - this.autoStart = options.autoStart; - this.frameRate = options.frameRate; - this.timeline = new Timeline({originTime: 0, playbackRate: 1.0}); - this._lastFrameTime = this.timeline.currentTime; - this._tickers = new Set(); - this._requestId = null; - this._ticker = () => { - if (this._started) { - this._requestId = requestAnimationFrame(this._ticker); - this.update(); - } - }; - if (this.autoStart) { - this.start(); - } - } - update() { - const currentTime = this.timeline.currentTime; - const durationTime = currentTime - this._lastFrameTime; - if (durationTime >= this._frameDuration) { - const frameTime = currentTime - (durationTime % this._frameDuration); - const deltaTime = frameTime - this._lastFrameTime; - this._lastFrameTime = frameTime; - const options = { - deltaTime, - time: currentTime, - currentTime: currentTime, - frameCount: ++this._frameCount, - fps: Math.round(1000 / deltaTime), - }; - for (const func of this._tickers) { - if (typeof func === 'function') { - func(options); - } - } - } - } - add(fn) { - this._tickers.add(fn); - } - remove(fn) { - this._tickers.delete(fn); - } - start() { - if (this._started) return; - this._started = true; - this.timeline.playbackRate = 1.0; - this._requestId = requestAnimationFrame(this._ticker); - } - pause() { - this._started = false; - this.timeline.playbackRate = 0; - } - } - - class Scene extends GameObject { - constructor(name, obj) { - super(name, obj); - this.gameObjects = []; - this.scene = this; - } - addGameObject(gameObject) { - this.gameObjects.push(gameObject); - if (gameObject.transform) { - gameObject.transform.inScene = true; - } - } - removeGameObject(gameObject) { - const index = this.gameObjects.indexOf(gameObject); - if (index === -1) return; - if (gameObject.transform) { - gameObject.transform.inScene = false; - } - this.gameObjects.splice(index, 1); - } - destroy() { - this.scene = null; - super.destroy(); - this.gameObjects = null; - this.canvas = null; - } - } - - exports.LOAD_SCENE_MODE = void 0; - (function (LOAD_SCENE_MODE) { - LOAD_SCENE_MODE['SINGLE'] = 'SINGLE'; - LOAD_SCENE_MODE['MULTI_CANVAS'] = 'MULTI_CANVAS'; - })(exports.LOAD_SCENE_MODE || (exports.LOAD_SCENE_MODE = {})); - const triggerStart = obj => { - if (!(obj instanceof System) && !(obj instanceof Component)) return; - if (obj.started) return; - obj.started = true; - try { - obj.start && obj.start(); - } catch (e) { - if (obj instanceof Component) { - console.error(`${obj.constructor.componentName} start error`, e); - } else { - console.error(`${obj.constructor.systemName} start error`, e); - } - } - }; - const getAllGameObjects = game => { - var _a; - const mainSceneGameObjects = - ((_a = game === null || game === void 0 ? void 0 : game.scene) === null || _a === void 0 ? void 0 : _a.gameObjects) || []; - const gameObjectsArray = game === null || game === void 0 ? void 0 : game.multiScenes.map(({gameObjects}) => gameObjects); - let otherSceneGameObjects = []; - for (const gameObjects of gameObjectsArray) { - otherSceneGameObjects = [...otherSceneGameObjects, ...gameObjects]; - } - return [...mainSceneGameObjects, ...otherSceneGameObjects]; - }; - const gameObjectLoop = (e, gameObjects = []) => { - for (const gameObject of gameObjects) { - for (const component of gameObject.components) { - try { - triggerStart(component); - component.update && component.update(e); - } catch (e) { - console.error(`gameObject: ${gameObject.name} ${component.name} update error`, e); - } - } - } - for (const gameObject of gameObjects) { - for (const component of gameObject.components) { - try { - component.lateUpdate && component.lateUpdate(e); - } catch (e) { - console.error(`gameObject: ${gameObject.name} ${component.name} lateUpdate error`, e); - } - } - } - }; - const gameObjectResume = gameObjects => { - for (const gameObject of gameObjects) { - for (const component of gameObject.components) { - try { - component.onResume && component.onResume(); - } catch (e) { - console.error(`gameObject: ${gameObject.name}, ${component.name}, onResume error`, e); - } - } - } - }; - const gameObjectPause = gameObjects => { - for (const gameObject of gameObjects) { - for (const component of gameObject.components) { - try { - component.onPause && component.onPause(); - } catch (e) { - console.error(`gameObject: ${gameObject.name}, ${component.name}, onResume error`, e); - } - } - } - }; - class Game extends eventemitter3 { - constructor({systems, frameRate = 60, autoStart = true, needScene = true} = {}) { - super(); - this.playing = false; - this.started = false; - this.multiScenes = []; - this.systems = []; - this.ticker = new Ticker({autoStart: false, frameRate}); - this.initTicker(); - if (systems && systems.length) { - for (const system of systems) { - this.addSystem(system); - } - } - if (needScene) { - this.loadScene(new Scene('scene')); - } - if (autoStart) { - this.start(); - } - } - get scene() { - return this._scene; - } - set scene(scene) { - this._scene = scene; - } - get gameObjects() { - return getAllGameObjects(this); - } - addSystem(S, obj) { - let system; - if (S instanceof Function) { - system = new S(obj); - } else if (S instanceof System) { - system = S; - } else { - console.warn('can only add System'); - return; - } - const hasTheSystem = this.systems.find(item => { - return item.constructor === system.constructor; - }); - if (hasTheSystem) { - console.warn(`${system.constructor.systemName} System has been added`); - return; - } - system.game = this; - system.init && system.init(system.__systemDefaultParams); - setSystemObserver(system, system.constructor); - initObserver(system.constructor); - try { - system.awake && system.awake(); - } catch (e) { - console.error(`${system.constructor.systemName} awake error`, e); - } - this.systems.push(system); - return system; - } - removeSystem(system) { - if (!system) return; - let index = -1; - if (typeof system === 'string') { - index = this.systems.findIndex(s => s.name === system); - } else if (system instanceof Function) { - index = this.systems.findIndex(s => s.constructor === system); - } else if (system instanceof System) { - index = this.systems.findIndex(s => s === system); - } - if (index > -1) { - this.systems[index].destroy && this.systems[index].destroy(); - this.systems.splice(index, 1); - } - } - getSystem(S) { - return this.systems.find(system => { - if (typeof S === 'string') { - return system.name === S; - } else { - return system instanceof S; - } - }); - } - pause() { - if (!this.playing) return; - this.playing = false; - this.ticker.pause(); - this.triggerPause(); - } - start() { - if (this.playing) return; - this.playing = true; - this.started = true; - this.ticker.start(); - } - resume() { - if (this.playing) return; - this.playing = true; - this.ticker.start(); - this.triggerResume(); - } - initTicker() { - this.ticker.add(e => { - this.scene && gameObjectLoop(e, this.gameObjects); - for (const system of this.systems) { - try { - triggerStart(system); - system.update && system.update(e); - } catch (e) { - console.error(`${system.constructor.systemName} update error`, e); - } - } - for (const system of this.systems) { - try { - system.lateUpdate && system.lateUpdate(e); - } catch (e) { - console.error(`${system.constructor.systemName} lateUpdate error`, e); - } - } - }); - } - triggerResume() { - gameObjectResume(this.gameObjects); - for (const system of this.systems) { - try { - system.onResume && system.onResume(); - } catch (e) { - console.error(`${system.constructor.systemName}, onResume error`, e); - } - } - } - triggerPause() { - gameObjectPause(this.gameObjects); - for (const system of this.systems) { - try { - system.onPause && system.onPause(); - } catch (e) { - console.error(`${system.constructor.systemName}, onPause error`, e); - } - } - } - destroySystems() { - for (const system of [...this.systems]) { - this.removeSystem(system); - } - this.systems.length = 0; - } - destroy() { - this.removeAllListeners(); - this.pause(); - this.scene.destroy(); - this.destroySystems(); - this.ticker = null; - this.scene = null; - this.canvas = null; - this.multiScenes = null; - } - loadScene({scene, mode = exports.LOAD_SCENE_MODE.SINGLE, params = {}}) { - if (!scene) { - return; - } - switch (mode) { - case exports.LOAD_SCENE_MODE.SINGLE: - this.scene = scene; - break; - case exports.LOAD_SCENE_MODE.MULTI_CANVAS: - this.multiScenes.push(scene); - break; - } - this.emit('sceneChanged', {scene, mode, params}); - } - } - - function componentObserver(observerInfo = {}) { - return function (constructor) { - if (!constructor.observerInfo) { - for (const key in observerInfo) { - for (const index in observerInfo[key]) { - if (typeof observerInfo[key][index] === 'string') { - observerInfo[key][index] = [observerInfo[key][index]]; - } - let observerProp; - if (Array.isArray(observerInfo[key][index])) { - observerProp = { - prop: observerInfo[key][index], - deep: false, - }; - observerInfo[key][index] = observerProp; - } - observerProp = observerInfo[key][index]; - if (typeof observerProp.prop === 'string') { - observerProp.prop = [observerProp.prop]; - } - } - } - constructor.observerInfo = observerInfo; - } - }; - } - - /*! - * type-signals - v1.1.0 - * https://github.com/englercj/type-signals - * Compiled Wed, 22 Apr 2020 17:58:58 UTC - * - * type-signals is licensed under the MIT license. - * http://www.opensource.org/licenses/mit-license - */ - var SignalBindingImpl = (function () { - function SignalBindingImpl(fn, once, thisArg) { - if (once === void 0) { - once = false; - } - this.next = null; - this.prev = null; - this.owner = null; - this.fn = fn; - this.once = once; - this.thisArg = thisArg; - } - SignalBindingImpl.prototype.detach = function () { - if (this.owner === null) return false; - this.owner.detach(this); - return true; - }; - SignalBindingImpl.prototype.dispose = function () { - this.detach(); - }; - return SignalBindingImpl; - })(); - var Signal = (function () { - function Signal() { - this._head = null; - this._tail = null; - this._filter = null; - } - Signal.prototype.handlers = function () { - var node = this._head; - var handlers = []; - while (node) { - handlers.push(node); - node = node.next; - } - return handlers; - }; - Signal.prototype.hasAny = function () { - return !!this._head; - }; - Signal.prototype.has = function (node) { - return node.owner === this; - }; - Signal.prototype.dispatch = function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - var node = this._head; - if (!node) return false; - if (this._filter && !this._filter.apply(this, args)) return false; - while (node) { - if (node.once) this.detach(node); - node.fn.apply(node.thisArg, args); - node = node.next; - } - return true; - }; - Signal.prototype.add = function (fn, thisArg) { - if (thisArg === void 0) { - thisArg = null; - } - return this._addSignalBinding(new SignalBindingImpl(fn, false, thisArg)); - }; - Signal.prototype.once = function (fn, thisArg) { - if (thisArg === void 0) { - thisArg = null; - } - return this._addSignalBinding(new SignalBindingImpl(fn, true, thisArg)); - }; - Signal.prototype.detach = function (node_) { - var node = node_; - if (node.owner !== this) return this; - if (node.prev) node.prev.next = node.next; - if (node.next) node.next.prev = node.prev; - if (node === this._head) { - this._head = node.next; - if (node.next === null) { - this._tail = null; - } - } else if (node === this._tail) { - this._tail = node.prev; - if (this._tail) this._tail.next = null; - } - node.owner = null; - return this; - }; - Signal.prototype.detachAll = function () { - var node = this._head; - if (!node) return this; - this._head = null; - this._tail = null; - while (node) { - node.owner = null; - node = node.next; - } - return this; - }; - Signal.prototype.filter = function (filter) { - this._filter = filter; - }; - Signal.prototype.proxy = function () { - var _this = this; - var signals = []; - for (var _i = 0; _i < arguments.length; _i++) { - signals[_i] = arguments[_i]; - } - var fn = function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - return _this.dispatch.apply(_this, args); - }; - for (var i = 0; i < signals.length; ++i) { - signals[i].add(fn); - } - return this; - }; - Signal.prototype._addSignalBinding = function (node_) { - var node = node_; - if (!this._head) { - this._head = node; - this._tail = node; - } else { - if (this._tail) this._tail.next = node; - node.prev = this._tail; - this._tail = node; - } - node.owner = this; - return node; - }; - return Signal; - })(); - - function parseURI(str, opts) { - if (!str) return undefined; - - opts = opts || {}; - - var o = { - key: [ - 'source', - 'protocol', - 'authority', - 'userInfo', - 'user', - 'password', - 'host', - 'port', - 'relative', - 'path', - 'directory', - 'file', - 'query', - 'anchor', - ], - q: { - name: 'queryKey', - parser: /(?:^|&)([^&=]*)=?([^&]*)/g, - }, - parser: { - strict: /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/, - loose: /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/, - }, - }; - - var m = o.parser[opts.strictMode ? 'strict' : 'loose'].exec(str); - var uri = {}; - var i = 14; - - while (i--) uri[o.key[i]] = m[i] || ''; - - uri[o.q.name] = {}; - uri[o.key[12]].replace(o.q.parser, function ($0, $1, $2) { - if ($1) uri[o.q.name][$1] = $2; - }); - - return uri; - } - - var parseUri = parseURI; - - /*! - * resource-loader - v4.0.0-rc4 - * https://github.com/englercj/resource-loader - * Compiled Sun, 08 Mar 2020 16:55:29 UTC - * - * resource-loader is licensed under the MIT license. - * http://www.opensource.org/licenses/mit-license - */ - - var AbstractLoadStrategy = (function () { - function AbstractLoadStrategy(config) { - this.config = config; - this.onError = new Signal(); - this.onComplete = new Signal(); - this.onProgress = new Signal(); - } - return AbstractLoadStrategy; - })(); - - /*! ***************************************************************************** - Copyright (c) Microsoft Corporation. All rights reserved. - Licensed under the Apache License, Version 2.0 (the "License"); you may not use - this file except in compliance with the License. You may obtain a copy of the - License at http://www.apache.org/licenses/LICENSE-2.0 - - THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED - WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, - MERCHANTABLITY OR NON-INFRINGEMENT. - - See the Apache Version 2.0 License for specific language governing permissions - and limitations under the License. - ***************************************************************************** */ - /* global Reflect, Promise */ - - var extendStatics = function (d, b) { - extendStatics = - Object.setPrototypeOf || - ({__proto__: []} instanceof Array && - function (d, b) { - d.__proto__ = b; - }) || - function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - }; - return extendStatics(d, b); - }; - - function __extends(d, b) { - extendStatics(d, b); - function __() { - this.constructor = d; - } - d.prototype = b === null ? Object.create(b) : ((__.prototype = b.prototype), new __()); - } - - function __spreadArrays() { - for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; - for (var r = Array(s), k = 0, i = 0; i < il; i++) - for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) r[k] = a[j]; - return r; - } - - function getExtension(url) { - var isDataUrl = url.indexOf('data:') === 0; - var ext = ''; - if (isDataUrl) { - var slashIndex = url.indexOf('/'); - ext = url.substring(slashIndex + 1, url.indexOf(';', slashIndex)); - } else { - var queryStart = url.indexOf('?'); - var hashStart = url.indexOf('#'); - var index = Math.min(queryStart > -1 ? queryStart : url.length, hashStart > -1 ? hashStart : url.length); - url = url.substring(0, index); - ext = url.substring(url.lastIndexOf('.') + 1); - } - return ext.toLowerCase(); - } - function assertNever(x) { - throw new Error('Unexpected value. Should have been never.'); - } - - var ResourceType; - (function (ResourceType) { - ResourceType[(ResourceType['Unknown'] = 0)] = 'Unknown'; - ResourceType[(ResourceType['Buffer'] = 1)] = 'Buffer'; - ResourceType[(ResourceType['Blob'] = 2)] = 'Blob'; - ResourceType[(ResourceType['Json'] = 3)] = 'Json'; - ResourceType[(ResourceType['Xml'] = 4)] = 'Xml'; - ResourceType[(ResourceType['Image'] = 5)] = 'Image'; - ResourceType[(ResourceType['Audio'] = 6)] = 'Audio'; - ResourceType[(ResourceType['Video'] = 7)] = 'Video'; - ResourceType[(ResourceType['Text'] = 8)] = 'Text'; - })(ResourceType || (ResourceType = {})); - var ResourceState; - (function (ResourceState) { - ResourceState[(ResourceState['NotStarted'] = 0)] = 'NotStarted'; - ResourceState[(ResourceState['Loading'] = 1)] = 'Loading'; - ResourceState[(ResourceState['Complete'] = 2)] = 'Complete'; - })(ResourceState || (ResourceState = {})); - - var MediaElementLoadStrategy = (function (_super) { - __extends(MediaElementLoadStrategy, _super); - function MediaElementLoadStrategy(config, elementType) { - var _this = _super.call(this, config) || this; - _this.elementType = elementType; - _this._boundOnLoad = _this._onLoad.bind(_this); - _this._boundOnError = _this._onError.bind(_this); - _this._boundOnTimeout = _this._onTimeout.bind(_this); - _this._element = _this._createElement(); - _this._elementTimer = 0; - return _this; - } - MediaElementLoadStrategy.prototype.load = function () { - var config = this.config; - if (config.crossOrigin) this._element.crossOrigin = config.crossOrigin; - var urls = config.sourceSet || [config.url]; - if (navigator.isCocoonJS) { - this._element.src = urls[0]; - } else { - for (var i = 0; i < urls.length; ++i) { - var url = urls[i]; - var mimeType = config.mimeTypes ? config.mimeTypes[i] : undefined; - if (!mimeType) mimeType = this.elementType + '/' + getExtension(url); - var source = document.createElement('source'); - source.src = url; - source.type = mimeType; - this._element.appendChild(source); - } - } - this._element.addEventListener('load', this._boundOnLoad, false); - this._element.addEventListener('canplaythrough', this._boundOnLoad, false); - this._element.addEventListener('error', this._boundOnError, false); - this._element.load(); - if (config.timeout) this._elementTimer = window.setTimeout(this._boundOnTimeout, config.timeout); - }; - MediaElementLoadStrategy.prototype.abort = function () { - this._clearEvents(); - while (this._element.firstChild) { - this._element.removeChild(this._element.firstChild); - } - this._error(this.elementType + ' load aborted by the user.'); - }; - MediaElementLoadStrategy.prototype._createElement = function () { - if (this.config.loadElement) return this.config.loadElement; - else return document.createElement(this.elementType); - }; - MediaElementLoadStrategy.prototype._clearEvents = function () { - clearTimeout(this._elementTimer); - this._element.removeEventListener('load', this._boundOnLoad, false); - this._element.removeEventListener('canplaythrough', this._boundOnLoad, false); - this._element.removeEventListener('error', this._boundOnError, false); - }; - MediaElementLoadStrategy.prototype._error = function (errMessage) { - this._clearEvents(); - this.onError.dispatch(errMessage); - }; - MediaElementLoadStrategy.prototype._complete = function () { - this._clearEvents(); - var resourceType = ResourceType.Unknown; - switch (this.elementType) { - case 'audio': - resourceType = ResourceType.Audio; - break; - case 'video': - resourceType = ResourceType.Video; - break; - default: - assertNever(this.elementType); - } - this.onComplete.dispatch(resourceType, this._element); - }; - MediaElementLoadStrategy.prototype._onLoad = function () { - this._complete(); - }; - MediaElementLoadStrategy.prototype._onError = function () { - this._error(this.elementType + ' failed to load.'); - }; - MediaElementLoadStrategy.prototype._onTimeout = function () { - this._error(this.elementType + ' load timed out.'); - }; - return MediaElementLoadStrategy; - })(AbstractLoadStrategy); - - var AudioLoadStrategy = (function (_super) { - __extends(AudioLoadStrategy, _super); - function AudioLoadStrategy(config) { - return _super.call(this, config, 'audio') || this; - } - return AudioLoadStrategy; - })(MediaElementLoadStrategy); - - var EMPTY_GIF = 'data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=='; - var ImageLoadStrategy = (function (_super) { - __extends(ImageLoadStrategy, _super); - function ImageLoadStrategy() { - var _this = (_super !== null && _super.apply(this, arguments)) || this; - _this._boundOnLoad = _this._onLoad.bind(_this); - _this._boundOnError = _this._onError.bind(_this); - _this._boundOnTimeout = _this._onTimeout.bind(_this); - _this._element = _this._createElement(); - _this._elementTimer = 0; - return _this; - } - ImageLoadStrategy.prototype.load = function () { - var config = this.config; - if (config.crossOrigin) this._element.crossOrigin = config.crossOrigin; - this._element.src = config.url; - this._element.addEventListener('load', this._boundOnLoad, false); - this._element.addEventListener('error', this._boundOnError, false); - if (config.timeout) this._elementTimer = window.setTimeout(this._boundOnTimeout, config.timeout); - }; - ImageLoadStrategy.prototype.abort = function () { - this._clearEvents(); - this._element.src = EMPTY_GIF; - this._error('Image load aborted by the user.'); - }; - ImageLoadStrategy.prototype._createElement = function () { - if (this.config.loadElement) return this.config.loadElement; - else return document.createElement('img'); - }; - ImageLoadStrategy.prototype._clearEvents = function () { - clearTimeout(this._elementTimer); - this._element.removeEventListener('load', this._boundOnLoad, false); - this._element.removeEventListener('error', this._boundOnError, false); - }; - ImageLoadStrategy.prototype._error = function (errMessage) { - this._clearEvents(); - this.onError.dispatch(errMessage); - }; - ImageLoadStrategy.prototype._complete = function () { - this._clearEvents(); - this.onComplete.dispatch(ResourceType.Image, this._element); - }; - ImageLoadStrategy.prototype._onLoad = function () { - this._complete(); - }; - ImageLoadStrategy.prototype._onError = function () { - this._error('Image failed to load.'); - }; - ImageLoadStrategy.prototype._onTimeout = function () { - this._error('Image load timed out.'); - }; - return ImageLoadStrategy; - })(AbstractLoadStrategy); - - var VideoLoadStrategy = (function (_super) { - __extends(VideoLoadStrategy, _super); - function VideoLoadStrategy(config) { - return _super.call(this, config, 'video') || this; - } - return VideoLoadStrategy; - })(MediaElementLoadStrategy); - - var useXdr = !!(window.XDomainRequest && !('withCredentials' in new XMLHttpRequest())); - var XhrResponseType; - (function (XhrResponseType) { - XhrResponseType['Default'] = 'text'; - XhrResponseType['Buffer'] = 'arraybuffer'; - XhrResponseType['Blob'] = 'blob'; - XhrResponseType['Document'] = 'document'; - XhrResponseType['Json'] = 'json'; - XhrResponseType['Text'] = 'text'; - })(XhrResponseType || (XhrResponseType = {})); - function reqType(xhr) { - return xhr.toString().replace('object ', ''); - } - var XhrLoadStrategy = (function (_super) { - __extends(XhrLoadStrategy, _super); - function XhrLoadStrategy() { - var _this = (_super !== null && _super.apply(this, arguments)) || this; - _this._boundOnLoad = _this._onLoad.bind(_this); - _this._boundOnAbort = _this._onAbort.bind(_this); - _this._boundOnError = _this._onError.bind(_this); - _this._boundOnTimeout = _this._onTimeout.bind(_this); - _this._boundOnProgress = _this._onProgress.bind(_this); - _this._xhr = _this._createRequest(); - _this._xhrType = XhrResponseType.Default; - return _this; - } - XhrLoadStrategy.prototype.load = function () { - var config = this.config; - var ext = getExtension(config.url); - if (typeof config.xhrType !== 'string') { - config.xhrType = this._determineXhrType(ext); - } - var xhr = this._xhr; - this._xhrType = config.xhrType || XhrResponseType.Default; - if (useXdr) { - xhr.timeout = config.timeout || 5000; - xhr.onload = this._boundOnLoad; - xhr.onerror = this._boundOnError; - xhr.ontimeout = this._boundOnTimeout; - xhr.onprogress = this._boundOnProgress; - xhr.open('GET', config.url, true); - setTimeout(function () { - xhr.send(); - }, 0); - } else { - xhr.open('GET', config.url, true); - if (config.timeout) xhr.timeout = config.timeout; - if (config.xhrType === XhrResponseType.Json || config.xhrType === XhrResponseType.Document) - xhr.responseType = XhrResponseType.Text; - else xhr.responseType = config.xhrType; - xhr.addEventListener('load', this._boundOnLoad, false); - xhr.addEventListener('abort', this._boundOnAbort, false); - xhr.addEventListener('error', this._boundOnError, false); - xhr.addEventListener('timeout', this._boundOnTimeout, false); - xhr.addEventListener('progress', this._boundOnProgress, false); - xhr.send(); - } - }; - XhrLoadStrategy.prototype.abort = function () { - if (useXdr) { - this._clearEvents(); - this._xhr.abort(); - this._onAbort(); - } else { - this._xhr.abort(); - } - }; - XhrLoadStrategy.prototype._createRequest = function () { - if (useXdr) return new window.XDomainRequest(); - else return new XMLHttpRequest(); - }; - XhrLoadStrategy.prototype._determineXhrType = function (ext) { - return XhrLoadStrategy._xhrTypeMap[ext] || XhrResponseType.Default; - }; - XhrLoadStrategy.prototype._clearEvents = function () { - if (useXdr) { - this._xhr.onload = null; - this._xhr.onerror = null; - this._xhr.ontimeout = null; - this._xhr.onprogress = null; - } else { - this._xhr.removeEventListener('load', this._boundOnLoad, false); - this._xhr.removeEventListener('abort', this._boundOnAbort, false); - this._xhr.removeEventListener('error', this._boundOnError, false); - this._xhr.removeEventListener('timeout', this._boundOnTimeout, false); - this._xhr.removeEventListener('progress', this._boundOnProgress, false); - } - }; - XhrLoadStrategy.prototype._error = function (errMessage) { - this._clearEvents(); - this.onError.dispatch(errMessage); - }; - XhrLoadStrategy.prototype._complete = function (type, data) { - this._clearEvents(); - this.onComplete.dispatch(type, data); - }; - XhrLoadStrategy.prototype._onLoad = function () { - var xhr = this._xhr; - var text = ''; - var status = typeof xhr.status === 'undefined' ? 200 : xhr.status; - if (typeof xhr.responseType === 'undefined' || xhr.responseType === '' || xhr.responseType === 'text') { - text = xhr.responseText; - } - if (status === 0 && (text.length > 0 || xhr.responseType === XhrResponseType.Buffer)) { - status = 200; - } else if (status === 1223) { - status = 204; - } - var flattenedStatus = Math.floor(status / 100) * 100; - if (flattenedStatus !== 200) { - this._error('[' + xhr.status + '] ' + xhr.statusText + ': ' + xhr.responseURL); - return; - } - switch (this._xhrType) { - case XhrResponseType.Buffer: - console.warn(ResourceType.Buffer, xhr.response); - this._complete(ResourceType.Buffer, xhr.response); - break; - case XhrResponseType.Blob: - this._complete(ResourceType.Blob, xhr.response); - break; - case XhrResponseType.Document: - this._parseDocument(text); - break; - case XhrResponseType.Json: - this._parseJson(text); - break; - case XhrResponseType.Default: - case XhrResponseType.Text: - this._complete(ResourceType.Text, text); - break; - default: - assertNever(this._xhrType); - } - }; - XhrLoadStrategy.prototype._parseDocument = function (text) { - try { - if (window.DOMParser) { - var parser = new DOMParser(); - var data = parser.parseFromString(text, 'text/xml'); - this._complete(ResourceType.Xml, data); - } else { - var div = document.createElement('div'); - div.innerHTML = text; - this._complete(ResourceType.Xml, div); - } - } catch (e) { - this._error('Error trying to parse loaded xml: ' + e); - } - }; - XhrLoadStrategy.prototype._parseJson = function (text) { - try { - var data = JSON.parse(text); - this._complete(ResourceType.Json, data); - } catch (e) { - this._error('Error trying to parse loaded json: ' + e); - } - }; - XhrLoadStrategy.prototype._onAbort = function () { - var xhr = this._xhr; - this._error(reqType(xhr) + ' Request was aborted by the user.'); - }; - XhrLoadStrategy.prototype._onError = function () { - var xhr = this._xhr; - this._error(reqType(xhr) + ' Request failed. Status: ' + xhr.status + ', text: "' + xhr.statusText + '"'); - }; - XhrLoadStrategy.prototype._onTimeout = function () { - var xhr = this._xhr; - this._error(reqType(xhr) + ' Request timed out.'); - }; - XhrLoadStrategy.prototype._onProgress = function (event) { - if (event && event.lengthComputable) { - this.onProgress.dispatch(event.loaded / event.total); - } - }; - XhrLoadStrategy.setExtensionXhrType = function (extname, xhrType) { - if (extname && extname.indexOf('.') === 0) extname = extname.substring(1); - if (!extname) return; - XhrLoadStrategy._xhrTypeMap[extname] = xhrType; - }; - XhrLoadStrategy.ResponseType = XhrResponseType; - XhrLoadStrategy._xhrTypeMap = { - xhtml: XhrResponseType.Document, - html: XhrResponseType.Document, - htm: XhrResponseType.Document, - xml: XhrResponseType.Document, - tmx: XhrResponseType.Document, - svg: XhrResponseType.Document, - tsx: XhrResponseType.Document, - gif: XhrResponseType.Blob, - png: XhrResponseType.Blob, - bmp: XhrResponseType.Blob, - jpg: XhrResponseType.Blob, - jpeg: XhrResponseType.Blob, - tif: XhrResponseType.Blob, - tiff: XhrResponseType.Blob, - webp: XhrResponseType.Blob, - tga: XhrResponseType.Blob, - json: XhrResponseType.Json, - text: XhrResponseType.Text, - txt: XhrResponseType.Text, - ttf: XhrResponseType.Buffer, - otf: XhrResponseType.Buffer, - }; - return XhrLoadStrategy; - })(AbstractLoadStrategy); - - function onlyOnce(func) { - var fn = func; - return function onceWrapper() { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - if (fn === null) throw new Error('Callback was already called.'); - var callFn = fn; - fn = null; - return callFn.apply(this, args); - }; - } - var AsyncQueue = (function () { - function AsyncQueue(worker, concurrency) { - if (concurrency === void 0) { - concurrency = 1; - } - this.worker = worker; - this.concurrency = concurrency; - this.workers = 0; - this.buffer = 0; - this.paused = false; - this._started = false; - this._tasks = []; - this.onSaturated = new Signal(); - this.onUnsaturated = new Signal(); - this.onEmpty = new Signal(); - this.onDrain = new Signal(); - this.onError = new Signal(); - if (concurrency === 0) throw new Error('Concurrency must not be zero'); - this.buffer = concurrency / 4; - } - Object.defineProperty(AsyncQueue.prototype, 'started', { - get: function () { - return this._started; - }, - enumerable: true, - configurable: true, - }); - AsyncQueue.prototype.reset = function () { - this.onDrain.detachAll(); - this.workers = 0; - this._started = false; - this._tasks = []; - }; - AsyncQueue.prototype.push = function (data, callback) { - this._insert(data, false, callback); - }; - AsyncQueue.prototype.unshift = function (data, callback) { - this._insert(data, true, callback); - }; - AsyncQueue.prototype.process = function () { - while (!this.paused && this.workers < this.concurrency && this._tasks.length) { - var task = this._tasks.shift(); - if (this._tasks.length === 0) this.onEmpty.dispatch(); - this.workers += 1; - if (this.workers === this.concurrency) this.onSaturated.dispatch(); - this.worker(task.data, onlyOnce(this._next(task))); - } - }; - AsyncQueue.prototype.length = function () { - return this._tasks.length; - }; - AsyncQueue.prototype.running = function () { - return this.workers; - }; - AsyncQueue.prototype.idle = function () { - return this._tasks.length + this.workers === 0; - }; - AsyncQueue.prototype.pause = function () { - if (this.paused === true) return; - this.paused = true; - }; - AsyncQueue.prototype.resume = function () { - if (this.paused === false) return; - this.paused = false; - for (var w = 1; w <= this.concurrency; w++) { - this.process(); - } - }; - AsyncQueue.prototype.getTask = function (index) { - return this._tasks[index]; - }; - AsyncQueue.prototype._insert = function (data, insertAtFront, callback) { - var _this = this; - if (callback != null && typeof callback !== 'function') { - throw new Error('task callback must be a function'); - } - this._started = true; - if (data == null && this.idle()) { - setTimeout(function () { - return _this.onDrain.dispatch(); - }, 1); - return; - } - var task = {data: data, callback: callback}; - if (insertAtFront) this._tasks.unshift(task); - else this._tasks.push(task); - setTimeout(function () { - return _this.process(); - }, 1); - }; - AsyncQueue.prototype._next = function (task) { - var _this = this; - return function (err) { - var args = []; - for (var _i = 1; _i < arguments.length; _i++) { - args[_i - 1] = arguments[_i]; - } - _this.workers -= 1; - if (task.callback) task.callback.apply(task, __spreadArrays([err], args)); - if (err) _this.onError.dispatch(err, task.data); - if (_this.workers <= _this.concurrency - _this.buffer) _this.onUnsaturated.dispatch(); - if (_this.idle()) _this.onDrain.dispatch(); - _this.process(); - }; - }; - return AsyncQueue; - })(); - - var Resource$1 = (function () { - function Resource(name, options) { - this.children = []; - this.onStart = new Signal(); - this.onProgress = new Signal(); - this.onComplete = new Signal(); - this.onAfterMiddleware = new Signal(); - this.data = null; - this.type = ResourceType.Unknown; - this.error = ''; - this.progressChunk = 0; - this._dequeue = function () {}; - this._onCompleteBinding = null; - this._state = ResourceState.NotStarted; - this.name = name; - this.metadata = options.metadata; - if (typeof options.crossOrigin !== 'string') options.crossOrigin = this._determineCrossOrigin(options.url); - if (options.strategy && typeof options.strategy !== 'function') { - this._strategy = options.strategy; - this._strategy.config = options; - } else { - var StrategyCtor = options.strategy; - if (!StrategyCtor) StrategyCtor = Resource._loadStrategyMap[getExtension(options.url)]; - if (!StrategyCtor) StrategyCtor = Resource._defaultLoadStrategy; - this._strategy = new StrategyCtor(options); - } - this._strategy.onError.add(this._error, this); - this._strategy.onComplete.add(this._complete, this); - this._strategy.onProgress.add(this._progress, this); - } - Resource.setDefaultLoadStrategy = function (strategy) { - Resource._defaultLoadStrategy = strategy; - }; - Resource.setLoadStrategy = function (extname, strategy) { - if (extname && extname.indexOf('.') === 0) extname = extname.substring(1); - if (!extname) return; - Resource._loadStrategyMap[extname] = strategy; - }; - Object.defineProperty(Resource.prototype, 'strategy', { - get: function () { - return this._strategy; - }, - enumerable: true, - configurable: true, - }); - Object.defineProperty(Resource.prototype, 'url', { - get: function () { - return this._strategy.config.url; - }, - enumerable: true, - configurable: true, - }); - Object.defineProperty(Resource.prototype, 'isLoading', { - get: function () { - return this._state === ResourceState.Loading; - }, - enumerable: true, - configurable: true, - }); - Object.defineProperty(Resource.prototype, 'isComplete', { - get: function () { - return this._state === ResourceState.Complete; - }, - enumerable: true, - configurable: true, - }); - Resource.prototype.abort = function () { - this._strategy.abort(); - }; - Resource.prototype.load = function () { - this._state = ResourceState.Loading; - this.onStart.dispatch(this); - this._strategy.load(); - }; - Resource.prototype._error = function (errMessage) { - this._state = ResourceState.Complete; - this.error = errMessage; - this.onComplete.dispatch(this); - }; - Resource.prototype._complete = function (type, data) { - this._state = ResourceState.Complete; - this.type = type; - this.data = data; - this.onComplete.dispatch(this); - }; - Resource.prototype._progress = function (percent) { - this.onProgress.dispatch(this, percent); - }; - Resource.prototype._determineCrossOrigin = function (url, loc) { - if (loc === void 0) { - loc = window.location; - } - if (url.indexOf('data:') === 0 || url.indexOf('javascript:') === 0) return ''; - if (window.origin !== window.location.origin) return 'anonymous'; - if (!Resource._tempAnchor) Resource._tempAnchor = document.createElement('a'); - Resource._tempAnchor.href = url; - var parsed = parseUri(Resource._tempAnchor.href, {strictMode: true}); - var samePort = (!parsed.port && loc.port === '') || parsed.port === loc.port; - var protocol = parsed.protocol ? parsed.protocol + ':' : ''; - if (parsed.host !== loc.hostname || !samePort || protocol !== loc.protocol) return 'anonymous'; - return ''; - }; - Resource._tempAnchor = null; - Resource._defaultLoadStrategy = XhrLoadStrategy; - Resource._loadStrategyMap = { - gif: ImageLoadStrategy, - png: ImageLoadStrategy, - bmp: ImageLoadStrategy, - jpg: ImageLoadStrategy, - jpeg: ImageLoadStrategy, - tif: ImageLoadStrategy, - tiff: ImageLoadStrategy, - webp: ImageLoadStrategy, - tga: ImageLoadStrategy, - svg: ImageLoadStrategy, - 'svg+xml': ImageLoadStrategy, - mp3: AudioLoadStrategy, - ogg: AudioLoadStrategy, - wav: AudioLoadStrategy, - mp4: VideoLoadStrategy, - webm: VideoLoadStrategy, - mov: VideoLoadStrategy, - }; - return Resource; - })(); - - function eachSeries(array, iterator, callback, deferNext) { - if (deferNext === void 0) { - deferNext = false; - } - var i = 0; - var len = array.length; - (function next(err) { - if (err || i === len) { - if (callback) callback(err); - return; - } - if (deferNext) - setTimeout(function () { - return iterator(array[i++], next); - }, 1); - else iterator(array[i++], next); - })(); - } - - var MAX_PROGRESS = 100; - var rgxExtractUrlHash = /(#[\w-]+)?$/; - var Loader = (function () { - function Loader(baseUrl, concurrency) { - if (baseUrl === void 0) { - baseUrl = ''; - } - if (concurrency === void 0) { - concurrency = 10; - } - this.progress = 0; - this.loading = false; - this.defaultQueryString = ''; - this.resources = {}; - this.onError = new Signal(); - this.onLoad = new Signal(); - this.onStart = new Signal(); - this.onComplete = new Signal(); - this.onProgress = new Signal(); - this._baseUrl = ''; - this._urlResolvers = []; - this._middleware = []; - this._resourcesParsing = []; - this._boundLoadResource = this._loadResource.bind(this); - this.baseUrl = baseUrl; - this._queue = new AsyncQueue(this._boundLoadResource, concurrency); - this._queue.pause(); - this._middleware = Loader._defaultMiddleware.slice(); - } - Object.defineProperty(Loader.prototype, 'baseUrl', { - get: function () { - return this._baseUrl; - }, - set: function (url) { - while (url.length && url.charAt(url.length - 1) === '/') { - url = url.slice(0, -1); - } - this._baseUrl = url; - }, - enumerable: true, - configurable: true, - }); - Loader.prototype.add = function (options, url_) { - if (Array.isArray(options)) { - for (var i = 0; i < options.length; ++i) { - this.add(options[i]); - } - return this; - } - var url = ''; - var name = ''; - var baseUrl = this._baseUrl; - var resOptions = {url: ''}; - if (typeof options === 'object') { - url = options.url; - name = options.name || options.url; - baseUrl = options.baseUrl || baseUrl; - resOptions = options; - } else { - name = options; - if (typeof url_ === 'string') url = url_; - else url = name; - } - if (!url) throw new Error('You must specify the `url` property.'); - if (this.loading && !resOptions.parentResource) { - throw new Error('Cannot add root resources while the loader is running.'); - } - if (this.resources[name]) { - throw new Error('Resource named "' + name + '" already exists.'); - } - url = this._prepareUrl(url, baseUrl); - resOptions.url = url; - var resource = new Resource$1(name, resOptions); - this.resources[name] = resource; - if (typeof resOptions.onComplete === 'function') { - resource.onAfterMiddleware.once(resOptions.onComplete); - } - if (this.loading) { - var parent_1 = resOptions.parentResource; - var incompleteChildren = []; - for (var i = 0; i < parent_1.children.length; ++i) { - if (!parent_1.children[i].isComplete) { - incompleteChildren.push(parent_1.children[i]); - } - } - var fullChunk = parent_1.progressChunk * (incompleteChildren.length + 1); - var eachChunk = fullChunk / (incompleteChildren.length + 2); - parent_1.children.push(resource); - parent_1.progressChunk = eachChunk; - for (var i = 0; i < incompleteChildren.length; ++i) { - incompleteChildren[i].progressChunk = eachChunk; - } - resource.progressChunk = eachChunk; - } - this._queue.push(resource); - return this; - }; - Loader.prototype.use = function (fn, priority) { - if (priority === void 0) { - priority = Loader.DefaultMiddlewarePriority; - } - this._middleware.push({fn: fn, priority: priority}); - this._middleware.sort(function (a, b) { - return a.priority - b.priority; - }); - return this; - }; - Loader.prototype.reset = function () { - this.progress = 0; - this.loading = false; - this._queue.reset(); - this._queue.pause(); - for (var k in this.resources) { - var res = this.resources[k]; - if (!res) continue; - if (res._onCompleteBinding) res._onCompleteBinding.detach(); - if (res.isLoading) res.abort(); - } - this.resources = {}; - return this; - }; - Loader.prototype.load = function (cb) { - if (typeof cb === 'function') this.onComplete.once(cb); - if (this.loading) return this; - if (this._queue.idle()) { - this._onStart(); - this._onComplete(); - } else { - var numTasks = this._queue.length(); - var chunk = MAX_PROGRESS / numTasks; - for (var i = 0; i < this._queue.length(); ++i) { - this._queue.getTask(i).data.progressChunk = chunk; - } - this._onStart(); - this._queue.resume(); - } - return this; - }; - Object.defineProperty(Loader.prototype, 'concurrency', { - get: function () { - return this._queue.concurrency; - }, - set: function (concurrency) { - this._queue.concurrency = concurrency; - }, - enumerable: true, - configurable: true, - }); - Loader.prototype.addUrlResolver = function (func) { - this._urlResolvers.push(func); - return this; - }; - Loader.prototype._prepareUrl = function (url, baseUrl) { - var parsed = parseUri(url, {strictMode: true}); - this._urlResolvers.forEach(function (resolver) { - url = resolver(url, parsed); - parsed = parseUri(url, {strictMode: true}); - }); - if (!parsed.protocol && url.indexOf('//') !== 0) { - if (baseUrl.length && url.charAt(0) !== '/') url = baseUrl + '/' + url; - else url = baseUrl + url; - } - if (this.defaultQueryString) { - var match = rgxExtractUrlHash.exec(url); - if (match) { - var hash = match[0]; - url = url.substr(0, url.length - hash.length); - if (url.indexOf('?') !== -1) url += '&' + this.defaultQueryString; - else url += '?' + this.defaultQueryString; - url += hash; - } - } - return url; - }; - Loader.prototype._loadResource = function (resource, dequeue) { - resource._dequeue = dequeue; - resource._onCompleteBinding = resource.onComplete.once(this._onLoad, this); - resource.load(); - }; - Loader.prototype._onStart = function () { - this.progress = 0; - this.loading = true; - this.onStart.dispatch(this); - }; - Loader.prototype._onComplete = function () { - this.progress = MAX_PROGRESS; - this.loading = false; - this.onComplete.dispatch(this, this.resources); - }; - Loader.prototype._onLoad = function (resource) { - var _this = this; - resource._onCompleteBinding = null; - this._resourcesParsing.push(resource); - resource._dequeue(); - eachSeries( - this._middleware, - function (middleware, next) { - middleware.fn.call(_this, resource, next); - }, - function () { - resource.onAfterMiddleware.dispatch(resource); - _this.progress = Math.min(MAX_PROGRESS, _this.progress + resource.progressChunk); - _this.onProgress.dispatch(_this, resource); - if (resource.error) _this.onError.dispatch(resource.error, _this, resource); - else _this.onLoad.dispatch(_this, resource); - _this._resourcesParsing.splice(_this._resourcesParsing.indexOf(resource), 1); - if (_this._queue.idle() && _this._resourcesParsing.length === 0) _this._onComplete(); - }, - true, - ); - }; - Loader.use = function (fn, priority) { - if (priority === void 0) { - priority = Loader.DefaultMiddlewarePriority; - } - Loader._defaultMiddleware.push({fn: fn, priority: priority}); - Loader._defaultMiddleware.sort(function (a, b) { - return a.priority - b.priority; - }); - return Loader; - }; - Loader.DefaultMiddlewarePriority = 50; - Loader._defaultMiddleware = []; - return Loader; - })(); - - class Progress extends eventemitter3 { - constructor({resource, resourceTotal}) { - super(); - this.progress = 0; - this.resourceTotal = 0; - this.resourceLoadedCount = 0; - this.resource = resource; - this.resourceTotal = resourceTotal; - if (resourceTotal === 0) { - this.resource.emit(exports.LOAD_EVENT.COMPLETE, this); - } - } - onStart() { - this.resource.emit(exports.LOAD_EVENT.START, this); - } - onProgress(param) { - this.resourceLoadedCount++; - this.progress = Math.floor((this.resourceLoadedCount / this.resourceTotal) * 100) / 100; - if (param.success) { - this.resource.emit(exports.LOAD_EVENT.LOADED, this, param); - } else { - this.resource.emit(exports.LOAD_EVENT.ERROR, this, param); - } - this.resource.emit(exports.LOAD_EVENT.PROGRESS, this, param); - if (this.resourceLoadedCount === this.resourceTotal) { - this.resource.emit(exports.LOAD_EVENT.COMPLETE, this); - } - } - } - - exports.LOAD_EVENT = void 0; - (function (LOAD_EVENT) { - LOAD_EVENT['START'] = 'start'; - LOAD_EVENT['PROGRESS'] = 'progress'; - LOAD_EVENT['LOADED'] = 'loaded'; - LOAD_EVENT['COMPLETE'] = 'complete'; - LOAD_EVENT['ERROR'] = 'error'; - })(exports.LOAD_EVENT || (exports.LOAD_EVENT = {})); - exports.RESOURCE_TYPE = void 0; - (function (RESOURCE_TYPE) { - RESOURCE_TYPE['IMAGE'] = 'IMAGE'; - RESOURCE_TYPE['SPRITE'] = 'SPRITE'; - RESOURCE_TYPE['SPRITE_ANIMATION'] = 'SPRITE_ANIMATION'; - RESOURCE_TYPE['DRAGONBONE'] = 'DRAGONBONE'; - RESOURCE_TYPE['SPINE'] = 'SPINE'; - RESOURCE_TYPE['AUDIO'] = 'AUDIO'; - RESOURCE_TYPE['VIDEO'] = 'VIDEO'; - })(exports.RESOURCE_TYPE || (exports.RESOURCE_TYPE = {})); - XhrLoadStrategy.setExtensionXhrType('json', XhrResponseType.Json); - XhrLoadStrategy.setExtensionXhrType('tex', XhrResponseType.Json); - XhrLoadStrategy.setExtensionXhrType('ske', XhrResponseType.Json); - XhrLoadStrategy.setExtensionXhrType('mp3', XhrResponseType.Buffer); - XhrLoadStrategy.setExtensionXhrType('wav', XhrResponseType.Buffer); - XhrLoadStrategy.setExtensionXhrType('aac', XhrResponseType.Buffer); - XhrLoadStrategy.setExtensionXhrType('ogg', XhrResponseType.Buffer); - const STRATEGY = { - png: ImageLoadStrategy, - jpg: ImageLoadStrategy, - jpeg: ImageLoadStrategy, - webp: ImageLoadStrategy, - json: XhrLoadStrategy, - tex: XhrLoadStrategy, - ske: XhrLoadStrategy, - audio: XhrLoadStrategy, - video: VideoLoadStrategy, - }; - class Resource extends eventemitter3 { - constructor(options) { - super(); - this.timeout = 6000; - this.resourcesMap = {}; - this.makeInstanceFunctions = {}; - this.destroyInstanceFunctions = {}; - this.promiseMap = {}; - this.loaders = []; - if (options && typeof options.timeout === 'number') { - this.timeout = options.timeout; - } - } - loadConfig(resources) { - this.addResource(resources); - this.preload(); - } - loadSingle(resource) { - this.addResource([resource]); - return this.getResource(resource.name); - } - addResource(resources) { - if (!resources || resources.length < 1) { - console.warn('no resources'); - return; - } - for (const res of resources) { - if (this.resourcesMap[res.name]) { - console.warn(res.name + ' was already added'); - continue; - } - this.resourcesMap[res.name] = res; - this.resourcesMap[res.name].data = {}; - } - } - preload() { - const names = Object.values(this.resourcesMap) - .filter(({preload}) => preload) - .map(({name}) => name); - this.progress = new Progress({ - resource: this, - resourceTotal: names.length, - }); - this.loadResource({names, preload: true}); - } - getResource(name) { - return __awaiter(this, void 0, void 0, function* () { - this.loadResource({names: [name]}); - return this.promiseMap[name] || Promise.resolve({}); - }); - } - instance(name) { - return __awaiter(this, void 0, void 0, function* () { - const res = this.resourcesMap[name]; - return this.makeInstanceFunctions[res.type] && (yield this.makeInstanceFunctions[res.type](res)); - }); - } - destroy(name) { - return __awaiter(this, void 0, void 0, function* () { - yield this._destroy(name); - }); - } - _destroy(name, loadError = false) { - return __awaiter(this, void 0, void 0, function* () { - const resource = this.resourcesMap[name]; - if (!resource) return; - if (!loadError) { - try { - if (this.destroyInstanceFunctions[resource.type]) { - yield this.destroyInstanceFunctions[resource.type](resource); - } - } catch (e) { - console.warn(`destroy resource ${resource.name} error with '${e.message}'`); - } - } - delete this.promiseMap[name]; - resource.data = {}; - resource.complete = false; - resource.instance = undefined; - }); - } - registerInstance(type, callback) { - this.makeInstanceFunctions[type] = callback; - } - registerDestroy(type, callback) { - this.destroyInstanceFunctions[type] = callback; - } - loadResource({names = [], preload = false}) { - const unLoadNames = names.filter(name => !this.promiseMap[name] && this.resourcesMap[name]); - if (!unLoadNames.length) return; - const resolves = {}; - const loader = this.getLoader(preload); - unLoadNames.forEach(name => { - this.promiseMap[name] = new Promise(r => (resolves[name] = r)); - const res = this.resourcesMap[name]; - for (const key in res.src) { - const resourceType = res.src[key].type; - if (resourceType === 'data') { - res.data[key] = res.src[key].data; - this.doComplete(name, resolves[name], preload); - } else { - loader.add({ - url: res.src[key].url, - name: `${res.name}_${key}`, - strategy: STRATEGY[resourceType], - metadata: { - key, - name: res.name, - resolves, - }, - }); - } - } - }); - loader.load(); - } - doComplete(name, resolve, preload = false) { - return __awaiter(this, void 0, void 0, function* () { - const res = this.resourcesMap[name]; - const param = { - name, - resource: this.resourcesMap[name], - success: true, - }; - if (this.checkAllLoaded(name)) { - try { - res.instance = yield this.instance(name); - res.complete = true; - if (preload) { - this.progress.onProgress(param); - } - resolve(res); - } catch (err) { - res.complete = false; - if (preload) { - param.errMsg = err.message; - param.success = false; - this.progress.onProgress(param); - } - resolve({}); - } - } - }); - } - checkAllLoaded(name) { - const res = this.resourcesMap[name]; - return Array.from(Object.keys(res.src)).every(resourceKey => res.data[resourceKey]); - } - getLoader(preload = false) { - let loader = this.loaders.find(({loading}) => !loading); - if (!loader) { - loader = new Loader(); - this.loaders.push(loader); - } - if (preload) { - loader.onStart.once(() => { - this.progress.onStart(); - }); - } - loader.onLoad.add((_, resource) => { - this.onLoad({preload, resource}); - }); - loader.onError.add((errMsg, _, resource) => { - this.onError({errMsg, resource, preload}); - }); - loader.onComplete.once(() => { - loader.onLoad.detachAll(); - loader.onError.detachAll(); - loader.reset(); - }); - return loader; - } - onLoad({preload = false, resource}) { - return __awaiter(this, void 0, void 0, function* () { - const { - metadata: {key, name, resolves}, - data, - } = resource; - const res = this.resourcesMap[name]; - res.data[key] = data; - this.doComplete(name, resolves[name], preload); - }); - } - onError({errMsg, preload = false, resource}) { - return __awaiter(this, void 0, void 0, function* () { - const { - metadata: {name, resolves}, - } = resource; - this._destroy(name, true); - resolves[name]({}); - if (preload) { - const param = { - name, - resource: this.resourcesMap[name], - success: false, - errMsg, - }; - this.progress.onProgress(param); - } - }); - } - } - const resource = new Resource(); - - const decorators = { - IDEProp, - componentObserver, - }; - - exports.Component = Component; - exports.Game = Game; - exports.GameObject = GameObject; - exports.IDEProp = IDEProp; - exports.Scene = Scene; - exports.System = System; - exports.Transform = Transform; - exports.componentObserver = componentObserver; - exports.decorators = decorators; - exports.resource = resource; - - Object.defineProperty(exports, '__esModule', {value: true}); -}); diff --git a/dist/cdn/EVA.plugin.EVAX.js b/dist/cdn/EVA.plugin.EVAX.js deleted file mode 100644 index 41d62e2a..00000000 --- a/dist/cdn/EVA.plugin.EVAX.js +++ /dev/null @@ -1,2822 +0,0 @@ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@eva/eva.js')) : - typeof define === 'function' && define.amd ? define(['exports', '@eva/eva.js'], factory) : - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.EVA = global.EVA || {}, global.EVA.plugin = global.EVA.plugin || {}, global.EVA.plugin.EVAX = {}), global.EVA)); -}(this, (function (exports, eva_js) { 'use strict'; - - /*! ***************************************************************************** - Copyright (c) Microsoft Corporation. - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. - ***************************************************************************** */ - - function __decorate(decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; - } - - class EvaXComponent extends eva_js.Component { - constructor(gameObject) { - super(gameObject); - this.events = {}; - } - init(option = { events: {} }) { - const { events } = option; - this.events = events || {}; - } - } - EvaXComponent.componentName = 'EvaX'; - __decorate([ - eva_js.decorators.IDEProp - ], EvaXComponent.prototype, "events", void 0); - - function createCommonjsModule(fn) { - var module = { exports: {} }; - return fn(module, module.exports), module.exports; - } - - var eventemitter3 = createCommonjsModule(function (module) { - - var has = Object.prototype.hasOwnProperty - , prefix = '~'; - - /** - * Constructor to create a storage for our `EE` objects. - * An `Events` instance is a plain object whose properties are event names. - * - * @constructor - * @private - */ - function Events() {} - - // - // We try to not inherit from `Object.prototype`. In some engines creating an - // instance in this way is faster than calling `Object.create(null)` directly. - // If `Object.create(null)` is not supported we prefix the event names with a - // character to make sure that the built-in object properties are not - // overridden or used as an attack vector. - // - if (Object.create) { - Events.prototype = Object.create(null); - - // - // This hack is needed because the `__proto__` property is still inherited in - // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5. - // - if (!new Events().__proto__) prefix = false; - } - - /** - * Representation of a single event listener. - * - * @param {Function} fn The listener function. - * @param {*} context The context to invoke the listener with. - * @param {Boolean} [once=false] Specify if the listener is a one-time listener. - * @constructor - * @private - */ - function EE(fn, context, once) { - this.fn = fn; - this.context = context; - this.once = once || false; - } - - /** - * Add a listener for a given event. - * - * @param {EventEmitter} emitter Reference to the `EventEmitter` instance. - * @param {(String|Symbol)} event The event name. - * @param {Function} fn The listener function. - * @param {*} context The context to invoke the listener with. - * @param {Boolean} once Specify if the listener is a one-time listener. - * @returns {EventEmitter} - * @private - */ - function addListener(emitter, event, fn, context, once) { - if (typeof fn !== 'function') { - throw new TypeError('The listener must be a function'); - } - - var listener = new EE(fn, context || emitter, once) - , evt = prefix ? prefix + event : event; - - if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++; - else if (!emitter._events[evt].fn) emitter._events[evt].push(listener); - else emitter._events[evt] = [emitter._events[evt], listener]; - - return emitter; - } - - /** - * Clear event by name. - * - * @param {EventEmitter} emitter Reference to the `EventEmitter` instance. - * @param {(String|Symbol)} evt The Event name. - * @private - */ - function clearEvent(emitter, evt) { - if (--emitter._eventsCount === 0) emitter._events = new Events(); - else delete emitter._events[evt]; - } - - /** - * Minimal `EventEmitter` interface that is molded against the Node.js - * `EventEmitter` interface. - * - * @constructor - * @public - */ - function EventEmitter() { - this._events = new Events(); - this._eventsCount = 0; - } - - /** - * Return an array listing the events for which the emitter has registered - * listeners. - * - * @returns {Array} - * @public - */ - EventEmitter.prototype.eventNames = function eventNames() { - var names = [] - , events - , name; - - if (this._eventsCount === 0) return names; - - for (name in (events = this._events)) { - if (has.call(events, name)) names.push(prefix ? name.slice(1) : name); - } - - if (Object.getOwnPropertySymbols) { - return names.concat(Object.getOwnPropertySymbols(events)); - } - - return names; - }; - - /** - * Return the listeners registered for a given event. - * - * @param {(String|Symbol)} event The event name. - * @returns {Array} The registered listeners. - * @public - */ - EventEmitter.prototype.listeners = function listeners(event) { - var evt = prefix ? prefix + event : event - , handlers = this._events[evt]; - - if (!handlers) return []; - if (handlers.fn) return [handlers.fn]; - - for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) { - ee[i] = handlers[i].fn; - } - - return ee; - }; - - /** - * Return the number of listeners listening to a given event. - * - * @param {(String|Symbol)} event The event name. - * @returns {Number} The number of listeners. - * @public - */ - EventEmitter.prototype.listenerCount = function listenerCount(event) { - var evt = prefix ? prefix + event : event - , listeners = this._events[evt]; - - if (!listeners) return 0; - if (listeners.fn) return 1; - return listeners.length; - }; - - /** - * Calls each of the listeners registered for a given event. - * - * @param {(String|Symbol)} event The event name. - * @returns {Boolean} `true` if the event had listeners, else `false`. - * @public - */ - EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) { - var evt = prefix ? prefix + event : event; - - if (!this._events[evt]) return false; - - var listeners = this._events[evt] - , len = arguments.length - , args - , i; - - if (listeners.fn) { - if (listeners.once) this.removeListener(event, listeners.fn, undefined, true); - - switch (len) { - case 1: return listeners.fn.call(listeners.context), true; - case 2: return listeners.fn.call(listeners.context, a1), true; - case 3: return listeners.fn.call(listeners.context, a1, a2), true; - case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true; - case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true; - case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true; - } - - for (i = 1, args = new Array(len -1); i < len; i++) { - args[i - 1] = arguments[i]; - } - - listeners.fn.apply(listeners.context, args); - } else { - var length = listeners.length - , j; - - for (i = 0; i < length; i++) { - if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true); - - switch (len) { - case 1: listeners[i].fn.call(listeners[i].context); break; - case 2: listeners[i].fn.call(listeners[i].context, a1); break; - case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break; - case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break; - default: - if (!args) for (j = 1, args = new Array(len -1); j < len; j++) { - args[j - 1] = arguments[j]; - } - - listeners[i].fn.apply(listeners[i].context, args); - } - } - } - - return true; - }; - - /** - * Add a listener for a given event. - * - * @param {(String|Symbol)} event The event name. - * @param {Function} fn The listener function. - * @param {*} [context=this] The context to invoke the listener with. - * @returns {EventEmitter} `this`. - * @public - */ - EventEmitter.prototype.on = function on(event, fn, context) { - return addListener(this, event, fn, context, false); - }; - - /** - * Add a one-time listener for a given event. - * - * @param {(String|Symbol)} event The event name. - * @param {Function} fn The listener function. - * @param {*} [context=this] The context to invoke the listener with. - * @returns {EventEmitter} `this`. - * @public - */ - EventEmitter.prototype.once = function once(event, fn, context) { - return addListener(this, event, fn, context, true); - }; - - /** - * Remove the listeners of a given event. - * - * @param {(String|Symbol)} event The event name. - * @param {Function} fn Only remove the listeners that match this function. - * @param {*} context Only remove the listeners that have this context. - * @param {Boolean} once Only remove one-time listeners. - * @returns {EventEmitter} `this`. - * @public - */ - EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) { - var evt = prefix ? prefix + event : event; - - if (!this._events[evt]) return this; - if (!fn) { - clearEvent(this, evt); - return this; - } - - var listeners = this._events[evt]; - - if (listeners.fn) { - if ( - listeners.fn === fn && - (!once || listeners.once) && - (!context || listeners.context === context) - ) { - clearEvent(this, evt); - } - } else { - for (var i = 0, events = [], length = listeners.length; i < length; i++) { - if ( - listeners[i].fn !== fn || - (once && !listeners[i].once) || - (context && listeners[i].context !== context) - ) { - events.push(listeners[i]); - } - } - - // - // Reset the array, or remove it completely if we have no more listeners. - // - if (events.length) this._events[evt] = events.length === 1 ? events[0] : events; - else clearEvent(this, evt); - } - - return this; - }; - - /** - * Remove all listeners, or those of the specified event. - * - * @param {(String|Symbol)} [event] The event name. - * @returns {EventEmitter} `this`. - * @public - */ - EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) { - var evt; - - if (event) { - evt = prefix ? prefix + event : event; - if (this._events[evt]) clearEvent(this, evt); - } else { - this._events = new Events(); - this._eventsCount = 0; - } - - return this; - }; - - // - // Alias methods names because people roll like that. - // - EventEmitter.prototype.off = EventEmitter.prototype.removeListener; - EventEmitter.prototype.addListener = EventEmitter.prototype.on; - - // - // Expose the prefix. - // - EventEmitter.prefixed = prefix; - - // - // Allow `EventEmitter` to be imported as module namespace. - // - EventEmitter.EventEmitter = EventEmitter; - - // - // Expose the module. - // - { - module.exports = EventEmitter; - } - }); - - /** - * Removes all key-value entries from the list cache. - * - * @private - * @name clear - * @memberOf ListCache - */ - function listCacheClear() { - this.__data__ = []; - this.size = 0; - } - - /** - * Performs a - * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) - * comparison between two values to determine if they are equivalent. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @returns {boolean} Returns `true` if the values are equivalent, else `false`. - * @example - * - * var object = { 'a': 1 }; - * var other = { 'a': 1 }; - * - * _.eq(object, object); - * // => true - * - * _.eq(object, other); - * // => false - * - * _.eq('a', 'a'); - * // => true - * - * _.eq('a', Object('a')); - * // => false - * - * _.eq(NaN, NaN); - * // => true - */ - function eq(value, other) { - return value === other || (value !== value && other !== other); - } - - /** - * Gets the index at which the `key` is found in `array` of key-value pairs. - * - * @private - * @param {Array} array The array to inspect. - * @param {*} key The key to search for. - * @returns {number} Returns the index of the matched value, else `-1`. - */ - function assocIndexOf(array, key) { - var length = array.length; - while (length--) { - if (eq(array[length][0], key)) { - return length; - } - } - return -1; - } - - /** Used for built-in method references. */ - var arrayProto = Array.prototype; - - /** Built-in value references. */ - var splice = arrayProto.splice; - - /** - * Removes `key` and its value from the list cache. - * - * @private - * @name delete - * @memberOf ListCache - * @param {string} key The key of the value to remove. - * @returns {boolean} Returns `true` if the entry was removed, else `false`. - */ - function listCacheDelete(key) { - var data = this.__data__, - index = assocIndexOf(data, key); - - if (index < 0) { - return false; - } - var lastIndex = data.length - 1; - if (index == lastIndex) { - data.pop(); - } else { - splice.call(data, index, 1); - } - --this.size; - return true; - } - - /** - * Gets the list cache value for `key`. - * - * @private - * @name get - * @memberOf ListCache - * @param {string} key The key of the value to get. - * @returns {*} Returns the entry value. - */ - function listCacheGet(key) { - var data = this.__data__, - index = assocIndexOf(data, key); - - return index < 0 ? undefined : data[index][1]; - } - - /** - * Checks if a list cache value for `key` exists. - * - * @private - * @name has - * @memberOf ListCache - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ - function listCacheHas(key) { - return assocIndexOf(this.__data__, key) > -1; - } - - /** - * Sets the list cache `key` to `value`. - * - * @private - * @name set - * @memberOf ListCache - * @param {string} key The key of the value to set. - * @param {*} value The value to set. - * @returns {Object} Returns the list cache instance. - */ - function listCacheSet(key, value) { - var data = this.__data__, - index = assocIndexOf(data, key); - - if (index < 0) { - ++this.size; - data.push([key, value]); - } else { - data[index][1] = value; - } - return this; - } - - /** - * Creates an list cache object. - * - * @private - * @constructor - * @param {Array} [entries] The key-value pairs to cache. - */ - function ListCache(entries) { - var index = -1, - length = entries == null ? 0 : entries.length; - - this.clear(); - while (++index < length) { - var entry = entries[index]; - this.set(entry[0], entry[1]); - } - } - - // Add methods to `ListCache`. - ListCache.prototype.clear = listCacheClear; - ListCache.prototype['delete'] = listCacheDelete; - ListCache.prototype.get = listCacheGet; - ListCache.prototype.has = listCacheHas; - ListCache.prototype.set = listCacheSet; - - /** - * Removes all key-value entries from the stack. - * - * @private - * @name clear - * @memberOf Stack - */ - function stackClear() { - this.__data__ = new ListCache; - this.size = 0; - } - - /** - * Removes `key` and its value from the stack. - * - * @private - * @name delete - * @memberOf Stack - * @param {string} key The key of the value to remove. - * @returns {boolean} Returns `true` if the entry was removed, else `false`. - */ - function stackDelete(key) { - var data = this.__data__, - result = data['delete'](key); - - this.size = data.size; - return result; - } - - /** - * Gets the stack value for `key`. - * - * @private - * @name get - * @memberOf Stack - * @param {string} key The key of the value to get. - * @returns {*} Returns the entry value. - */ - function stackGet(key) { - return this.__data__.get(key); - } - - /** - * Checks if a stack value for `key` exists. - * - * @private - * @name has - * @memberOf Stack - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ - function stackHas(key) { - return this.__data__.has(key); - } - - /** Detect free variable `global` from Node.js. */ - var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; - - /** Detect free variable `self`. */ - var freeSelf = typeof self == 'object' && self && self.Object === Object && self; - - /** Used as a reference to the global object. */ - var root = freeGlobal || freeSelf || Function('return this')(); - - /** Built-in value references. */ - var Symbol = root.Symbol; - - /** Used for built-in method references. */ - var objectProto$c = Object.prototype; - - /** Used to check objects for own properties. */ - var hasOwnProperty$9 = objectProto$c.hasOwnProperty; - - /** - * Used to resolve the - * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) - * of values. - */ - var nativeObjectToString$1 = objectProto$c.toString; - - /** Built-in value references. */ - var symToStringTag$1 = Symbol ? Symbol.toStringTag : undefined; - - /** - * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values. - * - * @private - * @param {*} value The value to query. - * @returns {string} Returns the raw `toStringTag`. - */ - function getRawTag(value) { - var isOwn = hasOwnProperty$9.call(value, symToStringTag$1), - tag = value[symToStringTag$1]; - - try { - value[symToStringTag$1] = undefined; - var unmasked = true; - } catch (e) {} - - var result = nativeObjectToString$1.call(value); - if (unmasked) { - if (isOwn) { - value[symToStringTag$1] = tag; - } else { - delete value[symToStringTag$1]; - } - } - return result; - } - - /** Used for built-in method references. */ - var objectProto$b = Object.prototype; - - /** - * Used to resolve the - * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) - * of values. - */ - var nativeObjectToString = objectProto$b.toString; - - /** - * Converts `value` to a string using `Object.prototype.toString`. - * - * @private - * @param {*} value The value to convert. - * @returns {string} Returns the converted string. - */ - function objectToString(value) { - return nativeObjectToString.call(value); - } - - /** `Object#toString` result references. */ - var nullTag = '[object Null]', - undefinedTag = '[object Undefined]'; - - /** Built-in value references. */ - var symToStringTag = Symbol ? Symbol.toStringTag : undefined; - - /** - * The base implementation of `getTag` without fallbacks for buggy environments. - * - * @private - * @param {*} value The value to query. - * @returns {string} Returns the `toStringTag`. - */ - function baseGetTag(value) { - if (value == null) { - return value === undefined ? undefinedTag : nullTag; - } - return (symToStringTag && symToStringTag in Object(value)) - ? getRawTag(value) - : objectToString(value); - } - - /** - * Checks if `value` is the - * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) - * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(_.noop); - * // => true - * - * _.isObject(null); - * // => false - */ - function isObject(value) { - var type = typeof value; - return value != null && (type == 'object' || type == 'function'); - } - - /** `Object#toString` result references. */ - var asyncTag = '[object AsyncFunction]', - funcTag$2 = '[object Function]', - genTag$1 = '[object GeneratorFunction]', - proxyTag = '[object Proxy]'; - - /** - * Checks if `value` is classified as a `Function` object. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a function, else `false`. - * @example - * - * _.isFunction(_); - * // => true - * - * _.isFunction(/abc/); - * // => false - */ - function isFunction(value) { - if (!isObject(value)) { - return false; - } - // The use of `Object#toString` avoids issues with the `typeof` operator - // in Safari 9 which returns 'object' for typed arrays and other constructors. - var tag = baseGetTag(value); - return tag == funcTag$2 || tag == genTag$1 || tag == asyncTag || tag == proxyTag; - } - - /** Used to detect overreaching core-js shims. */ - var coreJsData = root['__core-js_shared__']; - - /** Used to detect methods masquerading as native. */ - var maskSrcKey = (function() { - var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ''); - return uid ? ('Symbol(src)_1.' + uid) : ''; - }()); - - /** - * Checks if `func` has its source masked. - * - * @private - * @param {Function} func The function to check. - * @returns {boolean} Returns `true` if `func` is masked, else `false`. - */ - function isMasked(func) { - return !!maskSrcKey && (maskSrcKey in func); - } - - /** Used for built-in method references. */ - var funcProto$1 = Function.prototype; - - /** Used to resolve the decompiled source of functions. */ - var funcToString$1 = funcProto$1.toString; - - /** - * Converts `func` to its source code. - * - * @private - * @param {Function} func The function to convert. - * @returns {string} Returns the source code. - */ - function toSource(func) { - if (func != null) { - try { - return funcToString$1.call(func); - } catch (e) {} - try { - return (func + ''); - } catch (e) {} - } - return ''; - } - - /** - * Used to match `RegExp` - * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). - */ - var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; - - /** Used to detect host constructors (Safari). */ - var reIsHostCtor = /^\[object .+?Constructor\]$/; - - /** Used for built-in method references. */ - var funcProto = Function.prototype, - objectProto$a = Object.prototype; - - /** Used to resolve the decompiled source of functions. */ - var funcToString = funcProto.toString; - - /** Used to check objects for own properties. */ - var hasOwnProperty$8 = objectProto$a.hasOwnProperty; - - /** Used to detect if a method is native. */ - var reIsNative = RegExp('^' + - funcToString.call(hasOwnProperty$8).replace(reRegExpChar, '\\$&') - .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' - ); - - /** - * The base implementation of `_.isNative` without bad shim checks. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a native function, - * else `false`. - */ - function baseIsNative(value) { - if (!isObject(value) || isMasked(value)) { - return false; - } - var pattern = isFunction(value) ? reIsNative : reIsHostCtor; - return pattern.test(toSource(value)); - } - - /** - * Gets the value at `key` of `object`. - * - * @private - * @param {Object} [object] The object to query. - * @param {string} key The key of the property to get. - * @returns {*} Returns the property value. - */ - function getValue(object, key) { - return object == null ? undefined : object[key]; - } - - /** - * Gets the native function at `key` of `object`. - * - * @private - * @param {Object} object The object to query. - * @param {string} key The key of the method to get. - * @returns {*} Returns the function if it's native, else `undefined`. - */ - function getNative(object, key) { - var value = getValue(object, key); - return baseIsNative(value) ? value : undefined; - } - - /* Built-in method references that are verified to be native. */ - var Map$1 = getNative(root, 'Map'); - - /* Built-in method references that are verified to be native. */ - var nativeCreate = getNative(Object, 'create'); - - /** - * Removes all key-value entries from the hash. - * - * @private - * @name clear - * @memberOf Hash - */ - function hashClear() { - this.__data__ = nativeCreate ? nativeCreate(null) : {}; - this.size = 0; - } - - /** - * Removes `key` and its value from the hash. - * - * @private - * @name delete - * @memberOf Hash - * @param {Object} hash The hash to modify. - * @param {string} key The key of the value to remove. - * @returns {boolean} Returns `true` if the entry was removed, else `false`. - */ - function hashDelete(key) { - var result = this.has(key) && delete this.__data__[key]; - this.size -= result ? 1 : 0; - return result; - } - - /** Used to stand-in for `undefined` hash values. */ - var HASH_UNDEFINED$1 = '__lodash_hash_undefined__'; - - /** Used for built-in method references. */ - var objectProto$9 = Object.prototype; - - /** Used to check objects for own properties. */ - var hasOwnProperty$7 = objectProto$9.hasOwnProperty; - - /** - * Gets the hash value for `key`. - * - * @private - * @name get - * @memberOf Hash - * @param {string} key The key of the value to get. - * @returns {*} Returns the entry value. - */ - function hashGet(key) { - var data = this.__data__; - if (nativeCreate) { - var result = data[key]; - return result === HASH_UNDEFINED$1 ? undefined : result; - } - return hasOwnProperty$7.call(data, key) ? data[key] : undefined; - } - - /** Used for built-in method references. */ - var objectProto$8 = Object.prototype; - - /** Used to check objects for own properties. */ - var hasOwnProperty$6 = objectProto$8.hasOwnProperty; - - /** - * Checks if a hash value for `key` exists. - * - * @private - * @name has - * @memberOf Hash - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ - function hashHas(key) { - var data = this.__data__; - return nativeCreate ? (data[key] !== undefined) : hasOwnProperty$6.call(data, key); - } - - /** Used to stand-in for `undefined` hash values. */ - var HASH_UNDEFINED = '__lodash_hash_undefined__'; - - /** - * Sets the hash `key` to `value`. - * - * @private - * @name set - * @memberOf Hash - * @param {string} key The key of the value to set. - * @param {*} value The value to set. - * @returns {Object} Returns the hash instance. - */ - function hashSet(key, value) { - var data = this.__data__; - this.size += this.has(key) ? 0 : 1; - data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value; - return this; - } - - /** - * Creates a hash object. - * - * @private - * @constructor - * @param {Array} [entries] The key-value pairs to cache. - */ - function Hash(entries) { - var index = -1, - length = entries == null ? 0 : entries.length; - - this.clear(); - while (++index < length) { - var entry = entries[index]; - this.set(entry[0], entry[1]); - } - } - - // Add methods to `Hash`. - Hash.prototype.clear = hashClear; - Hash.prototype['delete'] = hashDelete; - Hash.prototype.get = hashGet; - Hash.prototype.has = hashHas; - Hash.prototype.set = hashSet; - - /** - * Removes all key-value entries from the map. - * - * @private - * @name clear - * @memberOf MapCache - */ - function mapCacheClear() { - this.size = 0; - this.__data__ = { - 'hash': new Hash, - 'map': new (Map$1 || ListCache), - 'string': new Hash - }; - } - - /** - * Checks if `value` is suitable for use as unique object key. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is suitable, else `false`. - */ - function isKeyable(value) { - var type = typeof value; - return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean') - ? (value !== '__proto__') - : (value === null); - } - - /** - * Gets the data for `map`. - * - * @private - * @param {Object} map The map to query. - * @param {string} key The reference key. - * @returns {*} Returns the map data. - */ - function getMapData(map, key) { - var data = map.__data__; - return isKeyable(key) - ? data[typeof key == 'string' ? 'string' : 'hash'] - : data.map; - } - - /** - * Removes `key` and its value from the map. - * - * @private - * @name delete - * @memberOf MapCache - * @param {string} key The key of the value to remove. - * @returns {boolean} Returns `true` if the entry was removed, else `false`. - */ - function mapCacheDelete(key) { - var result = getMapData(this, key)['delete'](key); - this.size -= result ? 1 : 0; - return result; - } - - /** - * Gets the map value for `key`. - * - * @private - * @name get - * @memberOf MapCache - * @param {string} key The key of the value to get. - * @returns {*} Returns the entry value. - */ - function mapCacheGet(key) { - return getMapData(this, key).get(key); - } - - /** - * Checks if a map value for `key` exists. - * - * @private - * @name has - * @memberOf MapCache - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ - function mapCacheHas(key) { - return getMapData(this, key).has(key); - } - - /** - * Sets the map `key` to `value`. - * - * @private - * @name set - * @memberOf MapCache - * @param {string} key The key of the value to set. - * @param {*} value The value to set. - * @returns {Object} Returns the map cache instance. - */ - function mapCacheSet(key, value) { - var data = getMapData(this, key), - size = data.size; - - data.set(key, value); - this.size += data.size == size ? 0 : 1; - return this; - } - - /** - * Creates a map cache object to store key-value pairs. - * - * @private - * @constructor - * @param {Array} [entries] The key-value pairs to cache. - */ - function MapCache(entries) { - var index = -1, - length = entries == null ? 0 : entries.length; - - this.clear(); - while (++index < length) { - var entry = entries[index]; - this.set(entry[0], entry[1]); - } - } - - // Add methods to `MapCache`. - MapCache.prototype.clear = mapCacheClear; - MapCache.prototype['delete'] = mapCacheDelete; - MapCache.prototype.get = mapCacheGet; - MapCache.prototype.has = mapCacheHas; - MapCache.prototype.set = mapCacheSet; - - /** Used as the size to enable large array optimizations. */ - var LARGE_ARRAY_SIZE = 200; - - /** - * Sets the stack `key` to `value`. - * - * @private - * @name set - * @memberOf Stack - * @param {string} key The key of the value to set. - * @param {*} value The value to set. - * @returns {Object} Returns the stack cache instance. - */ - function stackSet(key, value) { - var data = this.__data__; - if (data instanceof ListCache) { - var pairs = data.__data__; - if (!Map$1 || (pairs.length < LARGE_ARRAY_SIZE - 1)) { - pairs.push([key, value]); - this.size = ++data.size; - return this; - } - data = this.__data__ = new MapCache(pairs); - } - data.set(key, value); - this.size = data.size; - return this; - } - - /** - * Creates a stack cache object to store key-value pairs. - * - * @private - * @constructor - * @param {Array} [entries] The key-value pairs to cache. - */ - function Stack(entries) { - var data = this.__data__ = new ListCache(entries); - this.size = data.size; - } - - // Add methods to `Stack`. - Stack.prototype.clear = stackClear; - Stack.prototype['delete'] = stackDelete; - Stack.prototype.get = stackGet; - Stack.prototype.has = stackHas; - Stack.prototype.set = stackSet; - - /** - * A specialized version of `_.forEach` for arrays without support for - * iteratee shorthands. - * - * @private - * @param {Array} [array] The array to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Array} Returns `array`. - */ - function arrayEach(array, iteratee) { - var index = -1, - length = array == null ? 0 : array.length; - - while (++index < length) { - if (iteratee(array[index], index, array) === false) { - break; - } - } - return array; - } - - var defineProperty$1 = (function() { - try { - var func = getNative(Object, 'defineProperty'); - func({}, '', {}); - return func; - } catch (e) {} - }()); - - /** - * The base implementation of `assignValue` and `assignMergeValue` without - * value checks. - * - * @private - * @param {Object} object The object to modify. - * @param {string} key The key of the property to assign. - * @param {*} value The value to assign. - */ - function baseAssignValue(object, key, value) { - if (key == '__proto__' && defineProperty$1) { - defineProperty$1(object, key, { - 'configurable': true, - 'enumerable': true, - 'value': value, - 'writable': true - }); - } else { - object[key] = value; - } - } - - /** Used for built-in method references. */ - var objectProto$7 = Object.prototype; - - /** Used to check objects for own properties. */ - var hasOwnProperty$5 = objectProto$7.hasOwnProperty; - - /** - * Assigns `value` to `key` of `object` if the existing value is not equivalent - * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) - * for equality comparisons. - * - * @private - * @param {Object} object The object to modify. - * @param {string} key The key of the property to assign. - * @param {*} value The value to assign. - */ - function assignValue(object, key, value) { - var objValue = object[key]; - if (!(hasOwnProperty$5.call(object, key) && eq(objValue, value)) || - (value === undefined && !(key in object))) { - baseAssignValue(object, key, value); - } - } - - /** - * Copies properties of `source` to `object`. - * - * @private - * @param {Object} source The object to copy properties from. - * @param {Array} props The property identifiers to copy. - * @param {Object} [object={}] The object to copy properties to. - * @param {Function} [customizer] The function to customize copied values. - * @returns {Object} Returns `object`. - */ - function copyObject(source, props, object, customizer) { - var isNew = !object; - object || (object = {}); - - var index = -1, - length = props.length; - - while (++index < length) { - var key = props[index]; - - var newValue = customizer - ? customizer(object[key], source[key], key, object, source) - : undefined; - - if (newValue === undefined) { - newValue = source[key]; - } - if (isNew) { - baseAssignValue(object, key, newValue); - } else { - assignValue(object, key, newValue); - } - } - return object; - } - - /** - * The base implementation of `_.times` without support for iteratee shorthands - * or max array length checks. - * - * @private - * @param {number} n The number of times to invoke `iteratee`. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Array} Returns the array of results. - */ - function baseTimes(n, iteratee) { - var index = -1, - result = Array(n); - - while (++index < n) { - result[index] = iteratee(index); - } - return result; - } - - /** - * Checks if `value` is object-like. A value is object-like if it's not `null` - * and has a `typeof` result of "object". - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is object-like, else `false`. - * @example - * - * _.isObjectLike({}); - * // => true - * - * _.isObjectLike([1, 2, 3]); - * // => true - * - * _.isObjectLike(_.noop); - * // => false - * - * _.isObjectLike(null); - * // => false - */ - function isObjectLike(value) { - return value != null && typeof value == 'object'; - } - - /** `Object#toString` result references. */ - var argsTag$2 = '[object Arguments]'; - - /** - * The base implementation of `_.isArguments`. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an `arguments` object, - */ - function baseIsArguments(value) { - return isObjectLike(value) && baseGetTag(value) == argsTag$2; - } - - /** Used for built-in method references. */ - var objectProto$6 = Object.prototype; - - /** Used to check objects for own properties. */ - var hasOwnProperty$4 = objectProto$6.hasOwnProperty; - - /** Built-in value references. */ - var propertyIsEnumerable$1 = objectProto$6.propertyIsEnumerable; - - /** - * Checks if `value` is likely an `arguments` object. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an `arguments` object, - * else `false`. - * @example - * - * _.isArguments(function() { return arguments; }()); - * // => true - * - * _.isArguments([1, 2, 3]); - * // => false - */ - var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) { - return isObjectLike(value) && hasOwnProperty$4.call(value, 'callee') && - !propertyIsEnumerable$1.call(value, 'callee'); - }; - - /** - * Checks if `value` is classified as an `Array` object. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an array, else `false`. - * @example - * - * _.isArray([1, 2, 3]); - * // => true - * - * _.isArray(document.body.children); - * // => false - * - * _.isArray('abc'); - * // => false - * - * _.isArray(_.noop); - * // => false - */ - var isArray = Array.isArray; - - /** - * This method returns `false`. - * - * @static - * @memberOf _ - * @since 4.13.0 - * @category Util - * @returns {boolean} Returns `false`. - * @example - * - * _.times(2, _.stubFalse); - * // => [false, false] - */ - function stubFalse() { - return false; - } - - /** Detect free variable `exports`. */ - var freeExports$2 = typeof exports == 'object' && exports && !exports.nodeType && exports; - - /** Detect free variable `module`. */ - var freeModule$2 = freeExports$2 && typeof module == 'object' && module && !module.nodeType && module; - - /** Detect the popular CommonJS extension `module.exports`. */ - var moduleExports$2 = freeModule$2 && freeModule$2.exports === freeExports$2; - - /** Built-in value references. */ - var Buffer$1 = moduleExports$2 ? root.Buffer : undefined; - - /* Built-in method references for those with the same name as other `lodash` methods. */ - var nativeIsBuffer = Buffer$1 ? Buffer$1.isBuffer : undefined; - - /** - * Checks if `value` is a buffer. - * - * @static - * @memberOf _ - * @since 4.3.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a buffer, else `false`. - * @example - * - * _.isBuffer(new Buffer(2)); - * // => true - * - * _.isBuffer(new Uint8Array(2)); - * // => false - */ - var isBuffer = nativeIsBuffer || stubFalse; - - /** Used as references for various `Number` constants. */ - var MAX_SAFE_INTEGER$1 = 9007199254740991; - - /** Used to detect unsigned integer values. */ - var reIsUint = /^(?:0|[1-9]\d*)$/; - - /** - * Checks if `value` is a valid array-like index. - * - * @private - * @param {*} value The value to check. - * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. - * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. - */ - function isIndex(value, length) { - var type = typeof value; - length = length == null ? MAX_SAFE_INTEGER$1 : length; - - return !!length && - (type == 'number' || - (type != 'symbol' && reIsUint.test(value))) && - (value > -1 && value % 1 == 0 && value < length); - } - - /** Used as references for various `Number` constants. */ - var MAX_SAFE_INTEGER = 9007199254740991; - - /** - * Checks if `value` is a valid array-like length. - * - * **Note:** This method is loosely based on - * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. - * @example - * - * _.isLength(3); - * // => true - * - * _.isLength(Number.MIN_VALUE); - * // => false - * - * _.isLength(Infinity); - * // => false - * - * _.isLength('3'); - * // => false - */ - function isLength(value) { - return typeof value == 'number' && - value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; - } - - /** `Object#toString` result references. */ - var argsTag$1 = '[object Arguments]', - arrayTag$1 = '[object Array]', - boolTag$2 = '[object Boolean]', - dateTag$2 = '[object Date]', - errorTag$1 = '[object Error]', - funcTag$1 = '[object Function]', - mapTag$4 = '[object Map]', - numberTag$2 = '[object Number]', - objectTag$2 = '[object Object]', - regexpTag$2 = '[object RegExp]', - setTag$4 = '[object Set]', - stringTag$2 = '[object String]', - weakMapTag$2 = '[object WeakMap]'; - - var arrayBufferTag$2 = '[object ArrayBuffer]', - dataViewTag$3 = '[object DataView]', - float32Tag$2 = '[object Float32Array]', - float64Tag$2 = '[object Float64Array]', - int8Tag$2 = '[object Int8Array]', - int16Tag$2 = '[object Int16Array]', - int32Tag$2 = '[object Int32Array]', - uint8Tag$2 = '[object Uint8Array]', - uint8ClampedTag$2 = '[object Uint8ClampedArray]', - uint16Tag$2 = '[object Uint16Array]', - uint32Tag$2 = '[object Uint32Array]'; - - /** Used to identify `toStringTag` values of typed arrays. */ - var typedArrayTags = {}; - typedArrayTags[float32Tag$2] = typedArrayTags[float64Tag$2] = - typedArrayTags[int8Tag$2] = typedArrayTags[int16Tag$2] = - typedArrayTags[int32Tag$2] = typedArrayTags[uint8Tag$2] = - typedArrayTags[uint8ClampedTag$2] = typedArrayTags[uint16Tag$2] = - typedArrayTags[uint32Tag$2] = true; - typedArrayTags[argsTag$1] = typedArrayTags[arrayTag$1] = - typedArrayTags[arrayBufferTag$2] = typedArrayTags[boolTag$2] = - typedArrayTags[dataViewTag$3] = typedArrayTags[dateTag$2] = - typedArrayTags[errorTag$1] = typedArrayTags[funcTag$1] = - typedArrayTags[mapTag$4] = typedArrayTags[numberTag$2] = - typedArrayTags[objectTag$2] = typedArrayTags[regexpTag$2] = - typedArrayTags[setTag$4] = typedArrayTags[stringTag$2] = - typedArrayTags[weakMapTag$2] = false; - - /** - * The base implementation of `_.isTypedArray` without Node.js optimizations. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. - */ - function baseIsTypedArray(value) { - return isObjectLike(value) && - isLength(value.length) && !!typedArrayTags[baseGetTag(value)]; - } - - /** - * The base implementation of `_.unary` without support for storing metadata. - * - * @private - * @param {Function} func The function to cap arguments for. - * @returns {Function} Returns the new capped function. - */ - function baseUnary(func) { - return function(value) { - return func(value); - }; - } - - /** Detect free variable `exports`. */ - var freeExports$1 = typeof exports == 'object' && exports && !exports.nodeType && exports; - - /** Detect free variable `module`. */ - var freeModule$1 = freeExports$1 && typeof module == 'object' && module && !module.nodeType && module; - - /** Detect the popular CommonJS extension `module.exports`. */ - var moduleExports$1 = freeModule$1 && freeModule$1.exports === freeExports$1; - - /** Detect free variable `process` from Node.js. */ - var freeProcess = moduleExports$1 && freeGlobal.process; - - /** Used to access faster Node.js helpers. */ - var nodeUtil = (function() { - try { - // Use `util.types` for Node.js 10+. - var types = freeModule$1 && freeModule$1.require && freeModule$1.require('util').types; - - if (types) { - return types; - } - - // Legacy `process.binding('util')` for Node.js < 10. - return freeProcess && freeProcess.binding && freeProcess.binding('util'); - } catch (e) {} - }()); - - /* Node.js helper references. */ - var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray; - - /** - * Checks if `value` is classified as a typed array. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. - * @example - * - * _.isTypedArray(new Uint8Array); - * // => true - * - * _.isTypedArray([]); - * // => false - */ - var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray; - - /** Used for built-in method references. */ - var objectProto$5 = Object.prototype; - - /** Used to check objects for own properties. */ - var hasOwnProperty$3 = objectProto$5.hasOwnProperty; - - /** - * Creates an array of the enumerable property names of the array-like `value`. - * - * @private - * @param {*} value The value to query. - * @param {boolean} inherited Specify returning inherited property names. - * @returns {Array} Returns the array of property names. - */ - function arrayLikeKeys(value, inherited) { - var isArr = isArray(value), - isArg = !isArr && isArguments(value), - isBuff = !isArr && !isArg && isBuffer(value), - isType = !isArr && !isArg && !isBuff && isTypedArray(value), - skipIndexes = isArr || isArg || isBuff || isType, - result = skipIndexes ? baseTimes(value.length, String) : [], - length = result.length; - - for (var key in value) { - if ((inherited || hasOwnProperty$3.call(value, key)) && - !(skipIndexes && ( - // Safari 9 has enumerable `arguments.length` in strict mode. - key == 'length' || - // Node.js 0.10 has enumerable non-index properties on buffers. - (isBuff && (key == 'offset' || key == 'parent')) || - // PhantomJS 2 has enumerable non-index properties on typed arrays. - (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) || - // Skip index properties. - isIndex(key, length) - ))) { - result.push(key); - } - } - return result; - } - - /** Used for built-in method references. */ - var objectProto$4 = Object.prototype; - - /** - * Checks if `value` is likely a prototype object. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a prototype, else `false`. - */ - function isPrototype(value) { - var Ctor = value && value.constructor, - proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto$4; - - return value === proto; - } - - /** - * Creates a unary function that invokes `func` with its argument transformed. - * - * @private - * @param {Function} func The function to wrap. - * @param {Function} transform The argument transform. - * @returns {Function} Returns the new function. - */ - function overArg(func, transform) { - return function(arg) { - return func(transform(arg)); - }; - } - - /* Built-in method references for those with the same name as other `lodash` methods. */ - var nativeKeys = overArg(Object.keys, Object); - - /** Used for built-in method references. */ - var objectProto$3 = Object.prototype; - - /** Used to check objects for own properties. */ - var hasOwnProperty$2 = objectProto$3.hasOwnProperty; - - /** - * The base implementation of `_.keys` which doesn't treat sparse arrays as dense. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names. - */ - function baseKeys(object) { - if (!isPrototype(object)) { - return nativeKeys(object); - } - var result = []; - for (var key in Object(object)) { - if (hasOwnProperty$2.call(object, key) && key != 'constructor') { - result.push(key); - } - } - return result; - } - - /** - * Checks if `value` is array-like. A value is considered array-like if it's - * not a function and has a `value.length` that's an integer greater than or - * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is array-like, else `false`. - * @example - * - * _.isArrayLike([1, 2, 3]); - * // => true - * - * _.isArrayLike(document.body.children); - * // => true - * - * _.isArrayLike('abc'); - * // => true - * - * _.isArrayLike(_.noop); - * // => false - */ - function isArrayLike(value) { - return value != null && isLength(value.length) && !isFunction(value); - } - - /** - * Creates an array of the own enumerable property names of `object`. - * - * **Note:** Non-object values are coerced to objects. See the - * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) - * for more details. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Object - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names. - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.keys(new Foo); - * // => ['a', 'b'] (iteration order is not guaranteed) - * - * _.keys('hi'); - * // => ['0', '1'] - */ - function keys(object) { - return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object); - } - - /** - * The base implementation of `_.assign` without support for multiple sources - * or `customizer` functions. - * - * @private - * @param {Object} object The destination object. - * @param {Object} source The source object. - * @returns {Object} Returns `object`. - */ - function baseAssign(object, source) { - return object && copyObject(source, keys(source), object); - } - - /** - * This function is like - * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) - * except that it includes inherited enumerable properties. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names. - */ - function nativeKeysIn(object) { - var result = []; - if (object != null) { - for (var key in Object(object)) { - result.push(key); - } - } - return result; - } - - /** Used for built-in method references. */ - var objectProto$2 = Object.prototype; - - /** Used to check objects for own properties. */ - var hasOwnProperty$1 = objectProto$2.hasOwnProperty; - - /** - * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names. - */ - function baseKeysIn(object) { - if (!isObject(object)) { - return nativeKeysIn(object); - } - var isProto = isPrototype(object), - result = []; - - for (var key in object) { - if (!(key == 'constructor' && (isProto || !hasOwnProperty$1.call(object, key)))) { - result.push(key); - } - } - return result; - } - - /** - * Creates an array of the own and inherited enumerable property names of `object`. - * - * **Note:** Non-object values are coerced to objects. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Object - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names. - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.keysIn(new Foo); - * // => ['a', 'b', 'c'] (iteration order is not guaranteed) - */ - function keysIn(object) { - return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object); - } - - /** - * The base implementation of `_.assignIn` without support for multiple sources - * or `customizer` functions. - * - * @private - * @param {Object} object The destination object. - * @param {Object} source The source object. - * @returns {Object} Returns `object`. - */ - function baseAssignIn(object, source) { - return object && copyObject(source, keysIn(source), object); - } - - /** Detect free variable `exports`. */ - var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports; - - /** Detect free variable `module`. */ - var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module; - - /** Detect the popular CommonJS extension `module.exports`. */ - var moduleExports = freeModule && freeModule.exports === freeExports; - - /** Built-in value references. */ - var Buffer = moduleExports ? root.Buffer : undefined, - allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined; - - /** - * Creates a clone of `buffer`. - * - * @private - * @param {Buffer} buffer The buffer to clone. - * @param {boolean} [isDeep] Specify a deep clone. - * @returns {Buffer} Returns the cloned buffer. - */ - function cloneBuffer(buffer, isDeep) { - if (isDeep) { - return buffer.slice(); - } - var length = buffer.length, - result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length); - - buffer.copy(result); - return result; - } - - /** - * Copies the values of `source` to `array`. - * - * @private - * @param {Array} source The array to copy values from. - * @param {Array} [array=[]] The array to copy values to. - * @returns {Array} Returns `array`. - */ - function copyArray(source, array) { - var index = -1, - length = source.length; - - array || (array = Array(length)); - while (++index < length) { - array[index] = source[index]; - } - return array; - } - - /** - * A specialized version of `_.filter` for arrays without support for - * iteratee shorthands. - * - * @private - * @param {Array} [array] The array to iterate over. - * @param {Function} predicate The function invoked per iteration. - * @returns {Array} Returns the new filtered array. - */ - function arrayFilter(array, predicate) { - var index = -1, - length = array == null ? 0 : array.length, - resIndex = 0, - result = []; - - while (++index < length) { - var value = array[index]; - if (predicate(value, index, array)) { - result[resIndex++] = value; - } - } - return result; - } - - /** - * This method returns a new empty array. - * - * @static - * @memberOf _ - * @since 4.13.0 - * @category Util - * @returns {Array} Returns the new empty array. - * @example - * - * var arrays = _.times(2, _.stubArray); - * - * console.log(arrays); - * // => [[], []] - * - * console.log(arrays[0] === arrays[1]); - * // => false - */ - function stubArray() { - return []; - } - - /** Used for built-in method references. */ - var objectProto$1 = Object.prototype; - - /** Built-in value references. */ - var propertyIsEnumerable = objectProto$1.propertyIsEnumerable; - - /* Built-in method references for those with the same name as other `lodash` methods. */ - var nativeGetSymbols$1 = Object.getOwnPropertySymbols; - - /** - * Creates an array of the own enumerable symbols of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the array of symbols. - */ - var getSymbols = !nativeGetSymbols$1 ? stubArray : function(object) { - if (object == null) { - return []; - } - object = Object(object); - return arrayFilter(nativeGetSymbols$1(object), function(symbol) { - return propertyIsEnumerable.call(object, symbol); - }); - }; - - /** - * Copies own symbols of `source` to `object`. - * - * @private - * @param {Object} source The object to copy symbols from. - * @param {Object} [object={}] The object to copy symbols to. - * @returns {Object} Returns `object`. - */ - function copySymbols(source, object) { - return copyObject(source, getSymbols(source), object); - } - - /** - * Appends the elements of `values` to `array`. - * - * @private - * @param {Array} array The array to modify. - * @param {Array} values The values to append. - * @returns {Array} Returns `array`. - */ - function arrayPush(array, values) { - var index = -1, - length = values.length, - offset = array.length; - - while (++index < length) { - array[offset + index] = values[index]; - } - return array; - } - - /** Built-in value references. */ - var getPrototype = overArg(Object.getPrototypeOf, Object); - - /* Built-in method references for those with the same name as other `lodash` methods. */ - var nativeGetSymbols = Object.getOwnPropertySymbols; - - /** - * Creates an array of the own and inherited enumerable symbols of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the array of symbols. - */ - var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) { - var result = []; - while (object) { - arrayPush(result, getSymbols(object)); - object = getPrototype(object); - } - return result; - }; - - /** - * Copies own and inherited symbols of `source` to `object`. - * - * @private - * @param {Object} source The object to copy symbols from. - * @param {Object} [object={}] The object to copy symbols to. - * @returns {Object} Returns `object`. - */ - function copySymbolsIn(source, object) { - return copyObject(source, getSymbolsIn(source), object); - } - - /** - * The base implementation of `getAllKeys` and `getAllKeysIn` which uses - * `keysFunc` and `symbolsFunc` to get the enumerable property names and - * symbols of `object`. - * - * @private - * @param {Object} object The object to query. - * @param {Function} keysFunc The function to get the keys of `object`. - * @param {Function} symbolsFunc The function to get the symbols of `object`. - * @returns {Array} Returns the array of property names and symbols. - */ - function baseGetAllKeys(object, keysFunc, symbolsFunc) { - var result = keysFunc(object); - return isArray(object) ? result : arrayPush(result, symbolsFunc(object)); - } - - /** - * Creates an array of own enumerable property names and symbols of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names and symbols. - */ - function getAllKeys(object) { - return baseGetAllKeys(object, keys, getSymbols); - } - - /** - * Creates an array of own and inherited enumerable property names and - * symbols of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names and symbols. - */ - function getAllKeysIn(object) { - return baseGetAllKeys(object, keysIn, getSymbolsIn); - } - - /* Built-in method references that are verified to be native. */ - var DataView = getNative(root, 'DataView'); - - /* Built-in method references that are verified to be native. */ - var Promise$1 = getNative(root, 'Promise'); - - /* Built-in method references that are verified to be native. */ - var Set = getNative(root, 'Set'); - - /* Built-in method references that are verified to be native. */ - var WeakMap = getNative(root, 'WeakMap'); - - /** `Object#toString` result references. */ - var mapTag$3 = '[object Map]', - objectTag$1 = '[object Object]', - promiseTag = '[object Promise]', - setTag$3 = '[object Set]', - weakMapTag$1 = '[object WeakMap]'; - - var dataViewTag$2 = '[object DataView]'; - - /** Used to detect maps, sets, and weakmaps. */ - var dataViewCtorString = toSource(DataView), - mapCtorString = toSource(Map$1), - promiseCtorString = toSource(Promise$1), - setCtorString = toSource(Set), - weakMapCtorString = toSource(WeakMap); - - /** - * Gets the `toStringTag` of `value`. - * - * @private - * @param {*} value The value to query. - * @returns {string} Returns the `toStringTag`. - */ - var getTag = baseGetTag; - - // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6. - if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag$2) || - (Map$1 && getTag(new Map$1) != mapTag$3) || - (Promise$1 && getTag(Promise$1.resolve()) != promiseTag) || - (Set && getTag(new Set) != setTag$3) || - (WeakMap && getTag(new WeakMap) != weakMapTag$1)) { - getTag = function(value) { - var result = baseGetTag(value), - Ctor = result == objectTag$1 ? value.constructor : undefined, - ctorString = Ctor ? toSource(Ctor) : ''; - - if (ctorString) { - switch (ctorString) { - case dataViewCtorString: return dataViewTag$2; - case mapCtorString: return mapTag$3; - case promiseCtorString: return promiseTag; - case setCtorString: return setTag$3; - case weakMapCtorString: return weakMapTag$1; - } - } - return result; - }; - } - - var getTag$1 = getTag; - - /** Used for built-in method references. */ - var objectProto = Object.prototype; - - /** Used to check objects for own properties. */ - var hasOwnProperty = objectProto.hasOwnProperty; - - /** - * Initializes an array clone. - * - * @private - * @param {Array} array The array to clone. - * @returns {Array} Returns the initialized clone. - */ - function initCloneArray(array) { - var length = array.length, - result = new array.constructor(length); - - // Add properties assigned by `RegExp#exec`. - if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) { - result.index = array.index; - result.input = array.input; - } - return result; - } - - /** Built-in value references. */ - var Uint8Array = root.Uint8Array; - - /** - * Creates a clone of `arrayBuffer`. - * - * @private - * @param {ArrayBuffer} arrayBuffer The array buffer to clone. - * @returns {ArrayBuffer} Returns the cloned array buffer. - */ - function cloneArrayBuffer(arrayBuffer) { - var result = new arrayBuffer.constructor(arrayBuffer.byteLength); - new Uint8Array(result).set(new Uint8Array(arrayBuffer)); - return result; - } - - /** - * Creates a clone of `dataView`. - * - * @private - * @param {Object} dataView The data view to clone. - * @param {boolean} [isDeep] Specify a deep clone. - * @returns {Object} Returns the cloned data view. - */ - function cloneDataView(dataView, isDeep) { - var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer; - return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength); - } - - /** Used to match `RegExp` flags from their coerced string values. */ - var reFlags = /\w*$/; - - /** - * Creates a clone of `regexp`. - * - * @private - * @param {Object} regexp The regexp to clone. - * @returns {Object} Returns the cloned regexp. - */ - function cloneRegExp(regexp) { - var result = new regexp.constructor(regexp.source, reFlags.exec(regexp)); - result.lastIndex = regexp.lastIndex; - return result; - } - - /** Used to convert symbols to primitives and strings. */ - var symbolProto = Symbol ? Symbol.prototype : undefined, - symbolValueOf = symbolProto ? symbolProto.valueOf : undefined; - - /** - * Creates a clone of the `symbol` object. - * - * @private - * @param {Object} symbol The symbol object to clone. - * @returns {Object} Returns the cloned symbol object. - */ - function cloneSymbol(symbol) { - return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {}; - } - - /** - * Creates a clone of `typedArray`. - * - * @private - * @param {Object} typedArray The typed array to clone. - * @param {boolean} [isDeep] Specify a deep clone. - * @returns {Object} Returns the cloned typed array. - */ - function cloneTypedArray(typedArray, isDeep) { - var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer; - return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length); - } - - /** `Object#toString` result references. */ - var boolTag$1 = '[object Boolean]', - dateTag$1 = '[object Date]', - mapTag$2 = '[object Map]', - numberTag$1 = '[object Number]', - regexpTag$1 = '[object RegExp]', - setTag$2 = '[object Set]', - stringTag$1 = '[object String]', - symbolTag$1 = '[object Symbol]'; - - var arrayBufferTag$1 = '[object ArrayBuffer]', - dataViewTag$1 = '[object DataView]', - float32Tag$1 = '[object Float32Array]', - float64Tag$1 = '[object Float64Array]', - int8Tag$1 = '[object Int8Array]', - int16Tag$1 = '[object Int16Array]', - int32Tag$1 = '[object Int32Array]', - uint8Tag$1 = '[object Uint8Array]', - uint8ClampedTag$1 = '[object Uint8ClampedArray]', - uint16Tag$1 = '[object Uint16Array]', - uint32Tag$1 = '[object Uint32Array]'; - - /** - * Initializes an object clone based on its `toStringTag`. - * - * **Note:** This function only supports cloning values with tags of - * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`. - * - * @private - * @param {Object} object The object to clone. - * @param {string} tag The `toStringTag` of the object to clone. - * @param {boolean} [isDeep] Specify a deep clone. - * @returns {Object} Returns the initialized clone. - */ - function initCloneByTag(object, tag, isDeep) { - var Ctor = object.constructor; - switch (tag) { - case arrayBufferTag$1: - return cloneArrayBuffer(object); - - case boolTag$1: - case dateTag$1: - return new Ctor(+object); - - case dataViewTag$1: - return cloneDataView(object, isDeep); - - case float32Tag$1: case float64Tag$1: - case int8Tag$1: case int16Tag$1: case int32Tag$1: - case uint8Tag$1: case uint8ClampedTag$1: case uint16Tag$1: case uint32Tag$1: - return cloneTypedArray(object, isDeep); - - case mapTag$2: - return new Ctor; - - case numberTag$1: - case stringTag$1: - return new Ctor(object); - - case regexpTag$1: - return cloneRegExp(object); - - case setTag$2: - return new Ctor; - - case symbolTag$1: - return cloneSymbol(object); - } - } - - /** Built-in value references. */ - var objectCreate = Object.create; - - /** - * The base implementation of `_.create` without support for assigning - * properties to the created object. - * - * @private - * @param {Object} proto The object to inherit from. - * @returns {Object} Returns the new object. - */ - var baseCreate = (function() { - function object() {} - return function(proto) { - if (!isObject(proto)) { - return {}; - } - if (objectCreate) { - return objectCreate(proto); - } - object.prototype = proto; - var result = new object; - object.prototype = undefined; - return result; - }; - }()); - - /** - * Initializes an object clone. - * - * @private - * @param {Object} object The object to clone. - * @returns {Object} Returns the initialized clone. - */ - function initCloneObject(object) { - return (typeof object.constructor == 'function' && !isPrototype(object)) - ? baseCreate(getPrototype(object)) - : {}; - } - - /** `Object#toString` result references. */ - var mapTag$1 = '[object Map]'; - - /** - * The base implementation of `_.isMap` without Node.js optimizations. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a map, else `false`. - */ - function baseIsMap(value) { - return isObjectLike(value) && getTag$1(value) == mapTag$1; - } - - /* Node.js helper references. */ - var nodeIsMap = nodeUtil && nodeUtil.isMap; - - /** - * Checks if `value` is classified as a `Map` object. - * - * @static - * @memberOf _ - * @since 4.3.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a map, else `false`. - * @example - * - * _.isMap(new Map); - * // => true - * - * _.isMap(new WeakMap); - * // => false - */ - var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap; - - /** `Object#toString` result references. */ - var setTag$1 = '[object Set]'; - - /** - * The base implementation of `_.isSet` without Node.js optimizations. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a set, else `false`. - */ - function baseIsSet(value) { - return isObjectLike(value) && getTag$1(value) == setTag$1; - } - - /* Node.js helper references. */ - var nodeIsSet = nodeUtil && nodeUtil.isSet; - - /** - * Checks if `value` is classified as a `Set` object. - * - * @static - * @memberOf _ - * @since 4.3.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a set, else `false`. - * @example - * - * _.isSet(new Set); - * // => true - * - * _.isSet(new WeakSet); - * // => false - */ - var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet; - - /** Used to compose bitmasks for cloning. */ - var CLONE_DEEP_FLAG$1 = 1, - CLONE_FLAT_FLAG = 2, - CLONE_SYMBOLS_FLAG$1 = 4; - - /** `Object#toString` result references. */ - var argsTag = '[object Arguments]', - arrayTag = '[object Array]', - boolTag = '[object Boolean]', - dateTag = '[object Date]', - errorTag = '[object Error]', - funcTag = '[object Function]', - genTag = '[object GeneratorFunction]', - mapTag = '[object Map]', - numberTag = '[object Number]', - objectTag = '[object Object]', - regexpTag = '[object RegExp]', - setTag = '[object Set]', - stringTag = '[object String]', - symbolTag = '[object Symbol]', - weakMapTag = '[object WeakMap]'; - - var arrayBufferTag = '[object ArrayBuffer]', - dataViewTag = '[object DataView]', - float32Tag = '[object Float32Array]', - float64Tag = '[object Float64Array]', - int8Tag = '[object Int8Array]', - int16Tag = '[object Int16Array]', - int32Tag = '[object Int32Array]', - uint8Tag = '[object Uint8Array]', - uint8ClampedTag = '[object Uint8ClampedArray]', - uint16Tag = '[object Uint16Array]', - uint32Tag = '[object Uint32Array]'; - - /** Used to identify `toStringTag` values supported by `_.clone`. */ - var cloneableTags = {}; - cloneableTags[argsTag] = cloneableTags[arrayTag] = - cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = - cloneableTags[boolTag] = cloneableTags[dateTag] = - cloneableTags[float32Tag] = cloneableTags[float64Tag] = - cloneableTags[int8Tag] = cloneableTags[int16Tag] = - cloneableTags[int32Tag] = cloneableTags[mapTag] = - cloneableTags[numberTag] = cloneableTags[objectTag] = - cloneableTags[regexpTag] = cloneableTags[setTag] = - cloneableTags[stringTag] = cloneableTags[symbolTag] = - cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = - cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true; - cloneableTags[errorTag] = cloneableTags[funcTag] = - cloneableTags[weakMapTag] = false; - - /** - * The base implementation of `_.clone` and `_.cloneDeep` which tracks - * traversed objects. - * - * @private - * @param {*} value The value to clone. - * @param {boolean} bitmask The bitmask flags. - * 1 - Deep clone - * 2 - Flatten inherited properties - * 4 - Clone symbols - * @param {Function} [customizer] The function to customize cloning. - * @param {string} [key] The key of `value`. - * @param {Object} [object] The parent object of `value`. - * @param {Object} [stack] Tracks traversed objects and their clone counterparts. - * @returns {*} Returns the cloned value. - */ - function baseClone(value, bitmask, customizer, key, object, stack) { - var result, - isDeep = bitmask & CLONE_DEEP_FLAG$1, - isFlat = bitmask & CLONE_FLAT_FLAG, - isFull = bitmask & CLONE_SYMBOLS_FLAG$1; - - if (customizer) { - result = object ? customizer(value, key, object, stack) : customizer(value); - } - if (result !== undefined) { - return result; - } - if (!isObject(value)) { - return value; - } - var isArr = isArray(value); - if (isArr) { - result = initCloneArray(value); - if (!isDeep) { - return copyArray(value, result); - } - } else { - var tag = getTag$1(value), - isFunc = tag == funcTag || tag == genTag; - - if (isBuffer(value)) { - return cloneBuffer(value, isDeep); - } - if (tag == objectTag || tag == argsTag || (isFunc && !object)) { - result = (isFlat || isFunc) ? {} : initCloneObject(value); - if (!isDeep) { - return isFlat - ? copySymbolsIn(value, baseAssignIn(result, value)) - : copySymbols(value, baseAssign(result, value)); - } - } else { - if (!cloneableTags[tag]) { - return object ? value : {}; - } - result = initCloneByTag(value, tag, isDeep); - } - } - // Check for circular references and return its corresponding clone. - stack || (stack = new Stack); - var stacked = stack.get(value); - if (stacked) { - return stacked; - } - stack.set(value, result); - - if (isSet(value)) { - value.forEach(function(subValue) { - result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack)); - }); - } else if (isMap(value)) { - value.forEach(function(subValue, key) { - result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack)); - }); - } - - var keysFunc = isFull - ? (isFlat ? getAllKeysIn : getAllKeys) - : (isFlat ? keysIn : keys); - - var props = isArr ? undefined : keysFunc(value); - arrayEach(props || value, function(subValue, key) { - if (props) { - key = subValue; - subValue = value[key]; - } - // Recursively populate clone (susceptible to call stack limits). - assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack)); - }); - return result; - } - - /** Used to compose bitmasks for cloning. */ - var CLONE_DEEP_FLAG = 1, - CLONE_SYMBOLS_FLAG = 4; - - /** - * This method is like `_.clone` except that it recursively clones `value`. - * - * @static - * @memberOf _ - * @since 1.0.0 - * @category Lang - * @param {*} value The value to recursively clone. - * @returns {*} Returns the deep cloned value. - * @see _.clone - * @example - * - * var objects = [{ 'a': 1 }, { 'b': 2 }]; - * - * var deep = _.cloneDeep(objects); - * console.log(deep[0] === objects[0]); - * // => false - */ - function cloneDeep(value) { - return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG); - } - - const _defineCache = new Map(); - function defineProperty(key, deep, store, originKey, originStore, callback) { - if (!_defineCache.has(store)) { - _defineCache.set(store, []); - } - if (_defineCache.get(store).indexOf(key) > -1) { - return; - } - _defineCache.get(store).push(key); - const props = key.split('.'); - let obj = store; - const length = props.length; - for (let i = 0; i < length - 1; i++) { - if (obj[props[i]] === undefined) { - return; - } - obj = obj[props[i]]; - } - const value = obj[props[length - 1]]; - if (deep && isObject(value)) { - for (const key in value) { - defineProperty(key, deep, value, originKey, originStore, callback); - } - } - const _key = `_${props[length - 1]}`; - obj[_key] = value; - Object.defineProperty(obj, _key, { - enumerable: false, - }); - Object.defineProperty(obj, props[length - 1], { - set(val) { - const oldStore = cloneDeep(originStore); - obj[`_${props[length - 1]}`] = val; - callback(originKey, oldStore); - if (deep && isObject(val)) { - _defineCache.delete(obj); - for (const key in val) { - defineProperty(key, deep, val, originKey, originStore, callback); - } - } - }, - get() { - return obj[`_${props[length - 1]}`]; - }, - }); - } - function updateStore(store, newStore, force) { - for (const key in store) { - if (!(key in newStore)) { - continue; - } - if (typeof store[key] === 'object') { - updateStore(store[key], newStore[key], force); - } - else { - if (force || store[key] !== newStore[key]) { - store[key] = newStore[key]; - } - } - } - } - - let EvaXSystem = class EvaXSystem extends eva_js.System { - constructor() { - super(...arguments); - this.changeList = []; - } - init({ store = {} } = { store: {} }) { - this.ee = new eventemitter3(); - this.store = store; - this.bindDefaultListener(); - } - bindDefaultListener() { - this.ee.on('evax.updateStore', store => { - this.updateStore(store); - }); - this.ee.on('evax.forceUpdateStore', store => { - this.forceUpdateStore(store); - }); - } - changeCallback(key, oldStore) { - this.changeList.push({ - key: key, - oldStore: oldStore, - }); - } - updateStore(store) { - updateStore(this.store, store, false); - } - forceUpdateStore(store) { - updateStore(this.store, store, true); - } - bindListener(key, deep) { - if (key.indexOf('store.') === -1) { - return; - } - const realKey = key.split('.').slice(1).join('.'); - defineProperty(realKey, deep, this.store, key, this.store, (key, oldStore) => this.changeCallback(key, oldStore)); - } - update() { - const changes = this.componentObserver.clear(); - for (const changed of changes) { - switch (changed.type) { - case eva_js.OBSERVER_TYPE.ADD: - this.add(changed); - break; - case eva_js.OBSERVER_TYPE.REMOVE: - this.remove(changed); - break; - } - } - } - lateUpdate() { - for (const item of this.changeList) { - this.ee.emit(item.key, this.store, item.oldStore); - } - this.changeList = []; - } - add(changed) { - const component = changed.component; - component.evax = this; - for (const key in component.events) { - if (component.events[key]) { - this.bindListener(key, !!component.events[key].deep); - let func; - if (component.events[key] instanceof Function) { - func = component.events[key]; - } - else { - func = component.events[key].handler; - } - this.ee.on(key, func.bind(component)); - } - } - } - remove(changed) { - const component = changed.component; - for (const key in component.events) { - if (component.events[key] instanceof Function) { - this.ee.off(key, component.events[key].bind(component)); - } - } - } - on(eventName, func) { - return this.ee.on(eventName, func, this); - } - off(eventName, func) { - return this.ee.off(eventName, func); - } - emit(eventName, ...args) { - return this.ee.emit(eventName, ...args); - } - onDestroy() { } - }; - EvaXSystem.systemName = 'EvaX'; - EvaXSystem = __decorate([ - eva_js.decorators.componentObserver({ - EvaX: [], - }) - ], EvaXSystem); - var EvaXSystem$1 = EvaXSystem; - - var index = { - Components: [EvaXComponent], - Systems: [EvaXSystem$1], - }; - - exports.EvaX = EvaXComponent; - exports.EvaXSystem = EvaXSystem$1; - exports.default = index; - - Object.defineProperty(exports, '__esModule', { value: true }); - -}))); diff --git a/dist/cdn/EVA.plugin.a11y.js b/dist/cdn/EVA.plugin.a11y.js deleted file mode 100644 index 21731a85..00000000 --- a/dist/cdn/EVA.plugin.a11y.js +++ /dev/null @@ -1,3132 +0,0 @@ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@eva/eva.js'), require('pixi.js')) : - typeof define === 'function' && define.amd ? define(['exports', '@eva/eva.js', 'pixi.js'], factory) : - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.EVA = global.EVA || {}, global.EVA.plugin = global.EVA.plugin || {}, global.EVA.plugin.a11y = {}), global.EVA, global.PIXI)); -}(this, (function (exports, eva_js, pixi_js) { 'use strict'; - - /*! ***************************************************************************** - Copyright (c) Microsoft Corporation. - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. - ***************************************************************************** */ - - function __decorate(decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; - } - - function __awaiter(thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - } - - function uuid(len) { - let chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split(''); - let uuid = []; - let radix = chars.length; - for (let i = 0; i < len; i++) - uuid[i] = chars[0 | (Math.random() * radix)]; - return uuid.join(''); - } - const setStyle = (element, style) => { - const { width, height, position, left = 0, top = 0, zIndex, pointerEvents, background, } = style; - element.style.width = `${width}px`; - element.style.height = `${height}px`; - element.style.position = position; - element.style.left = `${left}`; - element.style.top = `${top}`; - element.style.zIndex = `${zIndex}`; - element.style.pointerEvents = pointerEvents; - element.style.background = background; - element.style.border = 'none'; - element.style.overflow = 'hidden'; - }; - const setTransform = (element, transform, ratioX, ratioY) => { - const { worldTransform } = transform; - const { a, b, c, d, tx, ty } = worldTransform; - const matrix = `matrix(${a}, ${b}, ${c}, ${d}, ${tx * ratioX}, ${ty * ratioY})`; - element.style.transform = `${matrix}`; - element.style.webkitTransform = `${matrix}`; - element.style.transformOrigin = 'left top'; - element.style.webkitTransformOrigin = 'left top'; - }; - - class A11y extends eva_js.Component { - constructor(param) { - super(); - Object.assign(this, param); - const { hint = '', event, delay = 0, attr = {}, role = '', props = {}, state = {}, } = param; - this.hint = hint; - this.event = event; - this.delay = delay; - this.attr = attr; - this.role = role; - this.props = props; - this.state = state; - this.a11yId = `_${uuid(6)}`; - } - } - A11y.componentName = 'A11y'; - __decorate([ - eva_js.decorators.IDEProp - ], A11y.prototype, "interactive", void 0); - __decorate([ - eva_js.decorators.IDEProp - ], A11y.prototype, "hint", void 0); - __decorate([ - eva_js.decorators.IDEProp - ], A11y.prototype, "event", void 0); - __decorate([ - eva_js.decorators.IDEProp - ], A11y.prototype, "delay", void 0); - __decorate([ - eva_js.decorators.IDEProp - ], A11y.prototype, "role", void 0); - __decorate([ - eva_js.decorators.IDEProp - ], A11y.prototype, "props", void 0); - __decorate([ - eva_js.decorators.IDEProp - ], A11y.prototype, "state", void 0); - __decorate([ - eva_js.decorators.IDEProp - ], A11y.prototype, "attr", void 0); - __decorate([ - eva_js.decorators.IDEProp - ], A11y.prototype, "a11yId", void 0); - - const POSITION = 'absolute'; - const ZINDEX = 3; - exports.A11yActivate = void 0; - (function (A11yActivate) { - A11yActivate[A11yActivate["ENABLE"] = 0] = "ENABLE"; - A11yActivate[A11yActivate["DISABLE"] = 1] = "DISABLE"; - A11yActivate[A11yActivate["CHECK"] = 2] = "CHECK"; - })(exports.A11yActivate || (exports.A11yActivate = {})); - var PointerEvents; - (function (PointerEvents) { - PointerEvents["NONE"] = "none"; - PointerEvents["AUTO"] = "auto"; - })(PointerEvents || (PointerEvents = {})); - var MaskBackground; - (function (MaskBackground) { - MaskBackground["DEBUG"] = "rgba(255,0,0,0.5)"; - MaskBackground["NONE"] = "transparent"; - })(MaskBackground || (MaskBackground = {})); - var ElementType; - (function (ElementType) { - ElementType["BUTTON"] = "button"; - ElementType["DIV"] = "div"; - })(ElementType || (ElementType = {})); - - class Application extends pixi_js.Application { - constructor(params) { - params.autoStart = false; - super(params); - } - } - - class Container extends pixi_js.Container { - } - - class NinePatch extends pixi_js.mesh.NineSlicePlane { - constructor(img, leftWidth, topHeight, rightWidth, bottomHeight) { - let texture; - if (img === 'string') { - texture = pixi_js.Texture.fromFrame(img); - } - else { - texture = pixi_js.Texture.from(img); - } - super(texture, leftWidth, topHeight, rightWidth, bottomHeight); - } - } - - pixi_js.extras.TilingSprite; - - /** - * Removes all key-value entries from the list cache. - * - * @private - * @name clear - * @memberOf ListCache - */ - function listCacheClear() { - this.__data__ = []; - this.size = 0; - } - - /** - * Performs a - * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) - * comparison between two values to determine if they are equivalent. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @returns {boolean} Returns `true` if the values are equivalent, else `false`. - * @example - * - * var object = { 'a': 1 }; - * var other = { 'a': 1 }; - * - * _.eq(object, object); - * // => true - * - * _.eq(object, other); - * // => false - * - * _.eq('a', 'a'); - * // => true - * - * _.eq('a', Object('a')); - * // => false - * - * _.eq(NaN, NaN); - * // => true - */ - function eq(value, other) { - return value === other || (value !== value && other !== other); - } - - /** - * Gets the index at which the `key` is found in `array` of key-value pairs. - * - * @private - * @param {Array} array The array to inspect. - * @param {*} key The key to search for. - * @returns {number} Returns the index of the matched value, else `-1`. - */ - function assocIndexOf(array, key) { - var length = array.length; - while (length--) { - if (eq(array[length][0], key)) { - return length; - } - } - return -1; - } - - /** Used for built-in method references. */ - var arrayProto = Array.prototype; - - /** Built-in value references. */ - var splice = arrayProto.splice; - - /** - * Removes `key` and its value from the list cache. - * - * @private - * @name delete - * @memberOf ListCache - * @param {string} key The key of the value to remove. - * @returns {boolean} Returns `true` if the entry was removed, else `false`. - */ - function listCacheDelete(key) { - var data = this.__data__, - index = assocIndexOf(data, key); - - if (index < 0) { - return false; - } - var lastIndex = data.length - 1; - if (index == lastIndex) { - data.pop(); - } else { - splice.call(data, index, 1); - } - --this.size; - return true; - } - - /** - * Gets the list cache value for `key`. - * - * @private - * @name get - * @memberOf ListCache - * @param {string} key The key of the value to get. - * @returns {*} Returns the entry value. - */ - function listCacheGet(key) { - var data = this.__data__, - index = assocIndexOf(data, key); - - return index < 0 ? undefined : data[index][1]; - } - - /** - * Checks if a list cache value for `key` exists. - * - * @private - * @name has - * @memberOf ListCache - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ - function listCacheHas(key) { - return assocIndexOf(this.__data__, key) > -1; - } - - /** - * Sets the list cache `key` to `value`. - * - * @private - * @name set - * @memberOf ListCache - * @param {string} key The key of the value to set. - * @param {*} value The value to set. - * @returns {Object} Returns the list cache instance. - */ - function listCacheSet(key, value) { - var data = this.__data__, - index = assocIndexOf(data, key); - - if (index < 0) { - ++this.size; - data.push([key, value]); - } else { - data[index][1] = value; - } - return this; - } - - /** - * Creates an list cache object. - * - * @private - * @constructor - * @param {Array} [entries] The key-value pairs to cache. - */ - function ListCache(entries) { - var index = -1, - length = entries == null ? 0 : entries.length; - - this.clear(); - while (++index < length) { - var entry = entries[index]; - this.set(entry[0], entry[1]); - } - } - - // Add methods to `ListCache`. - ListCache.prototype.clear = listCacheClear; - ListCache.prototype['delete'] = listCacheDelete; - ListCache.prototype.get = listCacheGet; - ListCache.prototype.has = listCacheHas; - ListCache.prototype.set = listCacheSet; - - /** - * Removes all key-value entries from the stack. - * - * @private - * @name clear - * @memberOf Stack - */ - function stackClear() { - this.__data__ = new ListCache; - this.size = 0; - } - - /** - * Removes `key` and its value from the stack. - * - * @private - * @name delete - * @memberOf Stack - * @param {string} key The key of the value to remove. - * @returns {boolean} Returns `true` if the entry was removed, else `false`. - */ - function stackDelete(key) { - var data = this.__data__, - result = data['delete'](key); - - this.size = data.size; - return result; - } - - /** - * Gets the stack value for `key`. - * - * @private - * @name get - * @memberOf Stack - * @param {string} key The key of the value to get. - * @returns {*} Returns the entry value. - */ - function stackGet(key) { - return this.__data__.get(key); - } - - /** - * Checks if a stack value for `key` exists. - * - * @private - * @name has - * @memberOf Stack - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ - function stackHas(key) { - return this.__data__.has(key); - } - - /** Detect free variable `global` from Node.js. */ - var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; - - /** Detect free variable `self`. */ - var freeSelf = typeof self == 'object' && self && self.Object === Object && self; - - /** Used as a reference to the global object. */ - var root = freeGlobal || freeSelf || Function('return this')(); - - /** Built-in value references. */ - var Symbol = root.Symbol; - - /** Used for built-in method references. */ - var objectProto$b = Object.prototype; - - /** Used to check objects for own properties. */ - var hasOwnProperty$8 = objectProto$b.hasOwnProperty; - - /** - * Used to resolve the - * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) - * of values. - */ - var nativeObjectToString$1 = objectProto$b.toString; - - /** Built-in value references. */ - var symToStringTag$1 = Symbol ? Symbol.toStringTag : undefined; - - /** - * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values. - * - * @private - * @param {*} value The value to query. - * @returns {string} Returns the raw `toStringTag`. - */ - function getRawTag(value) { - var isOwn = hasOwnProperty$8.call(value, symToStringTag$1), - tag = value[symToStringTag$1]; - - try { - value[symToStringTag$1] = undefined; - var unmasked = true; - } catch (e) {} - - var result = nativeObjectToString$1.call(value); - if (unmasked) { - if (isOwn) { - value[symToStringTag$1] = tag; - } else { - delete value[symToStringTag$1]; - } - } - return result; - } - - /** Used for built-in method references. */ - var objectProto$a = Object.prototype; - - /** - * Used to resolve the - * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) - * of values. - */ - var nativeObjectToString = objectProto$a.toString; - - /** - * Converts `value` to a string using `Object.prototype.toString`. - * - * @private - * @param {*} value The value to convert. - * @returns {string} Returns the converted string. - */ - function objectToString(value) { - return nativeObjectToString.call(value); - } - - /** `Object#toString` result references. */ - var nullTag = '[object Null]', - undefinedTag = '[object Undefined]'; - - /** Built-in value references. */ - var symToStringTag = Symbol ? Symbol.toStringTag : undefined; - - /** - * The base implementation of `getTag` without fallbacks for buggy environments. - * - * @private - * @param {*} value The value to query. - * @returns {string} Returns the `toStringTag`. - */ - function baseGetTag(value) { - if (value == null) { - return value === undefined ? undefinedTag : nullTag; - } - return (symToStringTag && symToStringTag in Object(value)) - ? getRawTag(value) - : objectToString(value); - } - - /** - * Checks if `value` is the - * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) - * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(_.noop); - * // => true - * - * _.isObject(null); - * // => false - */ - function isObject(value) { - var type = typeof value; - return value != null && (type == 'object' || type == 'function'); - } - - /** `Object#toString` result references. */ - var asyncTag = '[object AsyncFunction]', - funcTag$1 = '[object Function]', - genTag = '[object GeneratorFunction]', - proxyTag = '[object Proxy]'; - - /** - * Checks if `value` is classified as a `Function` object. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a function, else `false`. - * @example - * - * _.isFunction(_); - * // => true - * - * _.isFunction(/abc/); - * // => false - */ - function isFunction(value) { - if (!isObject(value)) { - return false; - } - // The use of `Object#toString` avoids issues with the `typeof` operator - // in Safari 9 which returns 'object' for typed arrays and other constructors. - var tag = baseGetTag(value); - return tag == funcTag$1 || tag == genTag || tag == asyncTag || tag == proxyTag; - } - - /** Used to detect overreaching core-js shims. */ - var coreJsData = root['__core-js_shared__']; - - /** Used to detect methods masquerading as native. */ - var maskSrcKey = (function() { - var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ''); - return uid ? ('Symbol(src)_1.' + uid) : ''; - }()); - - /** - * Checks if `func` has its source masked. - * - * @private - * @param {Function} func The function to check. - * @returns {boolean} Returns `true` if `func` is masked, else `false`. - */ - function isMasked(func) { - return !!maskSrcKey && (maskSrcKey in func); - } - - /** Used for built-in method references. */ - var funcProto$1 = Function.prototype; - - /** Used to resolve the decompiled source of functions. */ - var funcToString$1 = funcProto$1.toString; - - /** - * Converts `func` to its source code. - * - * @private - * @param {Function} func The function to convert. - * @returns {string} Returns the source code. - */ - function toSource(func) { - if (func != null) { - try { - return funcToString$1.call(func); - } catch (e) {} - try { - return (func + ''); - } catch (e) {} - } - return ''; - } - - /** - * Used to match `RegExp` - * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). - */ - var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; - - /** Used to detect host constructors (Safari). */ - var reIsHostCtor = /^\[object .+?Constructor\]$/; - - /** Used for built-in method references. */ - var funcProto = Function.prototype, - objectProto$9 = Object.prototype; - - /** Used to resolve the decompiled source of functions. */ - var funcToString = funcProto.toString; - - /** Used to check objects for own properties. */ - var hasOwnProperty$7 = objectProto$9.hasOwnProperty; - - /** Used to detect if a method is native. */ - var reIsNative = RegExp('^' + - funcToString.call(hasOwnProperty$7).replace(reRegExpChar, '\\$&') - .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' - ); - - /** - * The base implementation of `_.isNative` without bad shim checks. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a native function, - * else `false`. - */ - function baseIsNative(value) { - if (!isObject(value) || isMasked(value)) { - return false; - } - var pattern = isFunction(value) ? reIsNative : reIsHostCtor; - return pattern.test(toSource(value)); - } - - /** - * Gets the value at `key` of `object`. - * - * @private - * @param {Object} [object] The object to query. - * @param {string} key The key of the property to get. - * @returns {*} Returns the property value. - */ - function getValue(object, key) { - return object == null ? undefined : object[key]; - } - - /** - * Gets the native function at `key` of `object`. - * - * @private - * @param {Object} object The object to query. - * @param {string} key The key of the method to get. - * @returns {*} Returns the function if it's native, else `undefined`. - */ - function getNative(object, key) { - var value = getValue(object, key); - return baseIsNative(value) ? value : undefined; - } - - /* Built-in method references that are verified to be native. */ - var Map$1 = getNative(root, 'Map'); - - /* Built-in method references that are verified to be native. */ - var nativeCreate = getNative(Object, 'create'); - - /** - * Removes all key-value entries from the hash. - * - * @private - * @name clear - * @memberOf Hash - */ - function hashClear() { - this.__data__ = nativeCreate ? nativeCreate(null) : {}; - this.size = 0; - } - - /** - * Removes `key` and its value from the hash. - * - * @private - * @name delete - * @memberOf Hash - * @param {Object} hash The hash to modify. - * @param {string} key The key of the value to remove. - * @returns {boolean} Returns `true` if the entry was removed, else `false`. - */ - function hashDelete(key) { - var result = this.has(key) && delete this.__data__[key]; - this.size -= result ? 1 : 0; - return result; - } - - /** Used to stand-in for `undefined` hash values. */ - var HASH_UNDEFINED$2 = '__lodash_hash_undefined__'; - - /** Used for built-in method references. */ - var objectProto$8 = Object.prototype; - - /** Used to check objects for own properties. */ - var hasOwnProperty$6 = objectProto$8.hasOwnProperty; - - /** - * Gets the hash value for `key`. - * - * @private - * @name get - * @memberOf Hash - * @param {string} key The key of the value to get. - * @returns {*} Returns the entry value. - */ - function hashGet(key) { - var data = this.__data__; - if (nativeCreate) { - var result = data[key]; - return result === HASH_UNDEFINED$2 ? undefined : result; - } - return hasOwnProperty$6.call(data, key) ? data[key] : undefined; - } - - /** Used for built-in method references. */ - var objectProto$7 = Object.prototype; - - /** Used to check objects for own properties. */ - var hasOwnProperty$5 = objectProto$7.hasOwnProperty; - - /** - * Checks if a hash value for `key` exists. - * - * @private - * @name has - * @memberOf Hash - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ - function hashHas(key) { - var data = this.__data__; - return nativeCreate ? (data[key] !== undefined) : hasOwnProperty$5.call(data, key); - } - - /** Used to stand-in for `undefined` hash values. */ - var HASH_UNDEFINED$1 = '__lodash_hash_undefined__'; - - /** - * Sets the hash `key` to `value`. - * - * @private - * @name set - * @memberOf Hash - * @param {string} key The key of the value to set. - * @param {*} value The value to set. - * @returns {Object} Returns the hash instance. - */ - function hashSet(key, value) { - var data = this.__data__; - this.size += this.has(key) ? 0 : 1; - data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED$1 : value; - return this; - } - - /** - * Creates a hash object. - * - * @private - * @constructor - * @param {Array} [entries] The key-value pairs to cache. - */ - function Hash(entries) { - var index = -1, - length = entries == null ? 0 : entries.length; - - this.clear(); - while (++index < length) { - var entry = entries[index]; - this.set(entry[0], entry[1]); - } - } - - // Add methods to `Hash`. - Hash.prototype.clear = hashClear; - Hash.prototype['delete'] = hashDelete; - Hash.prototype.get = hashGet; - Hash.prototype.has = hashHas; - Hash.prototype.set = hashSet; - - /** - * Removes all key-value entries from the map. - * - * @private - * @name clear - * @memberOf MapCache - */ - function mapCacheClear() { - this.size = 0; - this.__data__ = { - 'hash': new Hash, - 'map': new (Map$1 || ListCache), - 'string': new Hash - }; - } - - /** - * Checks if `value` is suitable for use as unique object key. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is suitable, else `false`. - */ - function isKeyable(value) { - var type = typeof value; - return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean') - ? (value !== '__proto__') - : (value === null); - } - - /** - * Gets the data for `map`. - * - * @private - * @param {Object} map The map to query. - * @param {string} key The reference key. - * @returns {*} Returns the map data. - */ - function getMapData(map, key) { - var data = map.__data__; - return isKeyable(key) - ? data[typeof key == 'string' ? 'string' : 'hash'] - : data.map; - } - - /** - * Removes `key` and its value from the map. - * - * @private - * @name delete - * @memberOf MapCache - * @param {string} key The key of the value to remove. - * @returns {boolean} Returns `true` if the entry was removed, else `false`. - */ - function mapCacheDelete(key) { - var result = getMapData(this, key)['delete'](key); - this.size -= result ? 1 : 0; - return result; - } - - /** - * Gets the map value for `key`. - * - * @private - * @name get - * @memberOf MapCache - * @param {string} key The key of the value to get. - * @returns {*} Returns the entry value. - */ - function mapCacheGet(key) { - return getMapData(this, key).get(key); - } - - /** - * Checks if a map value for `key` exists. - * - * @private - * @name has - * @memberOf MapCache - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ - function mapCacheHas(key) { - return getMapData(this, key).has(key); - } - - /** - * Sets the map `key` to `value`. - * - * @private - * @name set - * @memberOf MapCache - * @param {string} key The key of the value to set. - * @param {*} value The value to set. - * @returns {Object} Returns the map cache instance. - */ - function mapCacheSet(key, value) { - var data = getMapData(this, key), - size = data.size; - - data.set(key, value); - this.size += data.size == size ? 0 : 1; - return this; - } - - /** - * Creates a map cache object to store key-value pairs. - * - * @private - * @constructor - * @param {Array} [entries] The key-value pairs to cache. - */ - function MapCache(entries) { - var index = -1, - length = entries == null ? 0 : entries.length; - - this.clear(); - while (++index < length) { - var entry = entries[index]; - this.set(entry[0], entry[1]); - } - } - - // Add methods to `MapCache`. - MapCache.prototype.clear = mapCacheClear; - MapCache.prototype['delete'] = mapCacheDelete; - MapCache.prototype.get = mapCacheGet; - MapCache.prototype.has = mapCacheHas; - MapCache.prototype.set = mapCacheSet; - - /** Used as the size to enable large array optimizations. */ - var LARGE_ARRAY_SIZE = 200; - - /** - * Sets the stack `key` to `value`. - * - * @private - * @name set - * @memberOf Stack - * @param {string} key The key of the value to set. - * @param {*} value The value to set. - * @returns {Object} Returns the stack cache instance. - */ - function stackSet(key, value) { - var data = this.__data__; - if (data instanceof ListCache) { - var pairs = data.__data__; - if (!Map$1 || (pairs.length < LARGE_ARRAY_SIZE - 1)) { - pairs.push([key, value]); - this.size = ++data.size; - return this; - } - data = this.__data__ = new MapCache(pairs); - } - data.set(key, value); - this.size = data.size; - return this; - } - - /** - * Creates a stack cache object to store key-value pairs. - * - * @private - * @constructor - * @param {Array} [entries] The key-value pairs to cache. - */ - function Stack(entries) { - var data = this.__data__ = new ListCache(entries); - this.size = data.size; - } - - // Add methods to `Stack`. - Stack.prototype.clear = stackClear; - Stack.prototype['delete'] = stackDelete; - Stack.prototype.get = stackGet; - Stack.prototype.has = stackHas; - Stack.prototype.set = stackSet; - - /** Used to stand-in for `undefined` hash values. */ - var HASH_UNDEFINED = '__lodash_hash_undefined__'; - - /** - * Adds `value` to the array cache. - * - * @private - * @name add - * @memberOf SetCache - * @alias push - * @param {*} value The value to cache. - * @returns {Object} Returns the cache instance. - */ - function setCacheAdd(value) { - this.__data__.set(value, HASH_UNDEFINED); - return this; - } - - /** - * Checks if `value` is in the array cache. - * - * @private - * @name has - * @memberOf SetCache - * @param {*} value The value to search for. - * @returns {number} Returns `true` if `value` is found, else `false`. - */ - function setCacheHas(value) { - return this.__data__.has(value); - } - - /** - * - * Creates an array cache object to store unique values. - * - * @private - * @constructor - * @param {Array} [values] The values to cache. - */ - function SetCache(values) { - var index = -1, - length = values == null ? 0 : values.length; - - this.__data__ = new MapCache; - while (++index < length) { - this.add(values[index]); - } - } - - // Add methods to `SetCache`. - SetCache.prototype.add = SetCache.prototype.push = setCacheAdd; - SetCache.prototype.has = setCacheHas; - - /** - * A specialized version of `_.some` for arrays without support for iteratee - * shorthands. - * - * @private - * @param {Array} [array] The array to iterate over. - * @param {Function} predicate The function invoked per iteration. - * @returns {boolean} Returns `true` if any element passes the predicate check, - * else `false`. - */ - function arraySome(array, predicate) { - var index = -1, - length = array == null ? 0 : array.length; - - while (++index < length) { - if (predicate(array[index], index, array)) { - return true; - } - } - return false; - } - - /** - * Checks if a `cache` value for `key` exists. - * - * @private - * @param {Object} cache The cache to query. - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ - function cacheHas(cache, key) { - return cache.has(key); - } - - /** Used to compose bitmasks for value comparisons. */ - var COMPARE_PARTIAL_FLAG$3 = 1, - COMPARE_UNORDERED_FLAG$1 = 2; - - /** - * A specialized version of `baseIsEqualDeep` for arrays with support for - * partial deep comparisons. - * - * @private - * @param {Array} array The array to compare. - * @param {Array} other The other array to compare. - * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. - * @param {Function} customizer The function to customize comparisons. - * @param {Function} equalFunc The function to determine equivalents of values. - * @param {Object} stack Tracks traversed `array` and `other` objects. - * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`. - */ - function equalArrays(array, other, bitmask, customizer, equalFunc, stack) { - var isPartial = bitmask & COMPARE_PARTIAL_FLAG$3, - arrLength = array.length, - othLength = other.length; - - if (arrLength != othLength && !(isPartial && othLength > arrLength)) { - return false; - } - // Check that cyclic values are equal. - var arrStacked = stack.get(array); - var othStacked = stack.get(other); - if (arrStacked && othStacked) { - return arrStacked == other && othStacked == array; - } - var index = -1, - result = true, - seen = (bitmask & COMPARE_UNORDERED_FLAG$1) ? new SetCache : undefined; - - stack.set(array, other); - stack.set(other, array); - - // Ignore non-index properties. - while (++index < arrLength) { - var arrValue = array[index], - othValue = other[index]; - - if (customizer) { - var compared = isPartial - ? customizer(othValue, arrValue, index, other, array, stack) - : customizer(arrValue, othValue, index, array, other, stack); - } - if (compared !== undefined) { - if (compared) { - continue; - } - result = false; - break; - } - // Recursively compare arrays (susceptible to call stack limits). - if (seen) { - if (!arraySome(other, function(othValue, othIndex) { - if (!cacheHas(seen, othIndex) && - (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) { - return seen.push(othIndex); - } - })) { - result = false; - break; - } - } else if (!( - arrValue === othValue || - equalFunc(arrValue, othValue, bitmask, customizer, stack) - )) { - result = false; - break; - } - } - stack['delete'](array); - stack['delete'](other); - return result; - } - - /** Built-in value references. */ - var Uint8Array = root.Uint8Array; - - /** - * Converts `map` to its key-value pairs. - * - * @private - * @param {Object} map The map to convert. - * @returns {Array} Returns the key-value pairs. - */ - function mapToArray(map) { - var index = -1, - result = Array(map.size); - - map.forEach(function(value, key) { - result[++index] = [key, value]; - }); - return result; - } - - /** - * Converts `set` to an array of its values. - * - * @private - * @param {Object} set The set to convert. - * @returns {Array} Returns the values. - */ - function setToArray(set) { - var index = -1, - result = Array(set.size); - - set.forEach(function(value) { - result[++index] = value; - }); - return result; - } - - /** Used to compose bitmasks for value comparisons. */ - var COMPARE_PARTIAL_FLAG$2 = 1, - COMPARE_UNORDERED_FLAG = 2; - - /** `Object#toString` result references. */ - var boolTag$1 = '[object Boolean]', - dateTag$1 = '[object Date]', - errorTag$1 = '[object Error]', - mapTag$2 = '[object Map]', - numberTag$1 = '[object Number]', - regexpTag$1 = '[object RegExp]', - setTag$2 = '[object Set]', - stringTag$1 = '[object String]', - symbolTag = '[object Symbol]'; - - var arrayBufferTag$1 = '[object ArrayBuffer]', - dataViewTag$2 = '[object DataView]'; - - /** Used to convert symbols to primitives and strings. */ - var symbolProto = Symbol ? Symbol.prototype : undefined, - symbolValueOf = symbolProto ? symbolProto.valueOf : undefined; - - /** - * A specialized version of `baseIsEqualDeep` for comparing objects of - * the same `toStringTag`. - * - * **Note:** This function only supports comparing values with tags of - * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`. - * - * @private - * @param {Object} object The object to compare. - * @param {Object} other The other object to compare. - * @param {string} tag The `toStringTag` of the objects to compare. - * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. - * @param {Function} customizer The function to customize comparisons. - * @param {Function} equalFunc The function to determine equivalents of values. - * @param {Object} stack Tracks traversed `object` and `other` objects. - * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. - */ - function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) { - switch (tag) { - case dataViewTag$2: - if ((object.byteLength != other.byteLength) || - (object.byteOffset != other.byteOffset)) { - return false; - } - object = object.buffer; - other = other.buffer; - - case arrayBufferTag$1: - if ((object.byteLength != other.byteLength) || - !equalFunc(new Uint8Array(object), new Uint8Array(other))) { - return false; - } - return true; - - case boolTag$1: - case dateTag$1: - case numberTag$1: - // Coerce booleans to `1` or `0` and dates to milliseconds. - // Invalid dates are coerced to `NaN`. - return eq(+object, +other); - - case errorTag$1: - return object.name == other.name && object.message == other.message; - - case regexpTag$1: - case stringTag$1: - // Coerce regexes to strings and treat strings, primitives and objects, - // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring - // for more details. - return object == (other + ''); - - case mapTag$2: - var convert = mapToArray; - - case setTag$2: - var isPartial = bitmask & COMPARE_PARTIAL_FLAG$2; - convert || (convert = setToArray); - - if (object.size != other.size && !isPartial) { - return false; - } - // Assume cyclic values are equal. - var stacked = stack.get(object); - if (stacked) { - return stacked == other; - } - bitmask |= COMPARE_UNORDERED_FLAG; - - // Recursively compare objects (susceptible to call stack limits). - stack.set(object, other); - var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack); - stack['delete'](object); - return result; - - case symbolTag: - if (symbolValueOf) { - return symbolValueOf.call(object) == symbolValueOf.call(other); - } - } - return false; - } - - /** - * Appends the elements of `values` to `array`. - * - * @private - * @param {Array} array The array to modify. - * @param {Array} values The values to append. - * @returns {Array} Returns `array`. - */ - function arrayPush(array, values) { - var index = -1, - length = values.length, - offset = array.length; - - while (++index < length) { - array[offset + index] = values[index]; - } - return array; - } - - /** - * Checks if `value` is classified as an `Array` object. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an array, else `false`. - * @example - * - * _.isArray([1, 2, 3]); - * // => true - * - * _.isArray(document.body.children); - * // => false - * - * _.isArray('abc'); - * // => false - * - * _.isArray(_.noop); - * // => false - */ - var isArray = Array.isArray; - - /** - * The base implementation of `getAllKeys` and `getAllKeysIn` which uses - * `keysFunc` and `symbolsFunc` to get the enumerable property names and - * symbols of `object`. - * - * @private - * @param {Object} object The object to query. - * @param {Function} keysFunc The function to get the keys of `object`. - * @param {Function} symbolsFunc The function to get the symbols of `object`. - * @returns {Array} Returns the array of property names and symbols. - */ - function baseGetAllKeys(object, keysFunc, symbolsFunc) { - var result = keysFunc(object); - return isArray(object) ? result : arrayPush(result, symbolsFunc(object)); - } - - /** - * A specialized version of `_.filter` for arrays without support for - * iteratee shorthands. - * - * @private - * @param {Array} [array] The array to iterate over. - * @param {Function} predicate The function invoked per iteration. - * @returns {Array} Returns the new filtered array. - */ - function arrayFilter(array, predicate) { - var index = -1, - length = array == null ? 0 : array.length, - resIndex = 0, - result = []; - - while (++index < length) { - var value = array[index]; - if (predicate(value, index, array)) { - result[resIndex++] = value; - } - } - return result; - } - - /** - * This method returns a new empty array. - * - * @static - * @memberOf _ - * @since 4.13.0 - * @category Util - * @returns {Array} Returns the new empty array. - * @example - * - * var arrays = _.times(2, _.stubArray); - * - * console.log(arrays); - * // => [[], []] - * - * console.log(arrays[0] === arrays[1]); - * // => false - */ - function stubArray() { - return []; - } - - /** Used for built-in method references. */ - var objectProto$6 = Object.prototype; - - /** Built-in value references. */ - var propertyIsEnumerable$1 = objectProto$6.propertyIsEnumerable; - - /* Built-in method references for those with the same name as other `lodash` methods. */ - var nativeGetSymbols = Object.getOwnPropertySymbols; - - /** - * Creates an array of the own enumerable symbols of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the array of symbols. - */ - var getSymbols = !nativeGetSymbols ? stubArray : function(object) { - if (object == null) { - return []; - } - object = Object(object); - return arrayFilter(nativeGetSymbols(object), function(symbol) { - return propertyIsEnumerable$1.call(object, symbol); - }); - }; - - /** - * The base implementation of `_.times` without support for iteratee shorthands - * or max array length checks. - * - * @private - * @param {number} n The number of times to invoke `iteratee`. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Array} Returns the array of results. - */ - function baseTimes(n, iteratee) { - var index = -1, - result = Array(n); - - while (++index < n) { - result[index] = iteratee(index); - } - return result; - } - - /** - * Checks if `value` is object-like. A value is object-like if it's not `null` - * and has a `typeof` result of "object". - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is object-like, else `false`. - * @example - * - * _.isObjectLike({}); - * // => true - * - * _.isObjectLike([1, 2, 3]); - * // => true - * - * _.isObjectLike(_.noop); - * // => false - * - * _.isObjectLike(null); - * // => false - */ - function isObjectLike(value) { - return value != null && typeof value == 'object'; - } - - /** `Object#toString` result references. */ - var argsTag$2 = '[object Arguments]'; - - /** - * The base implementation of `_.isArguments`. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an `arguments` object, - */ - function baseIsArguments(value) { - return isObjectLike(value) && baseGetTag(value) == argsTag$2; - } - - /** Used for built-in method references. */ - var objectProto$5 = Object.prototype; - - /** Used to check objects for own properties. */ - var hasOwnProperty$4 = objectProto$5.hasOwnProperty; - - /** Built-in value references. */ - var propertyIsEnumerable = objectProto$5.propertyIsEnumerable; - - /** - * Checks if `value` is likely an `arguments` object. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an `arguments` object, - * else `false`. - * @example - * - * _.isArguments(function() { return arguments; }()); - * // => true - * - * _.isArguments([1, 2, 3]); - * // => false - */ - var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) { - return isObjectLike(value) && hasOwnProperty$4.call(value, 'callee') && - !propertyIsEnumerable.call(value, 'callee'); - }; - - /** - * This method returns `false`. - * - * @static - * @memberOf _ - * @since 4.13.0 - * @category Util - * @returns {boolean} Returns `false`. - * @example - * - * _.times(2, _.stubFalse); - * // => [false, false] - */ - function stubFalse() { - return false; - } - - /** Detect free variable `exports`. */ - var freeExports$1 = typeof exports == 'object' && exports && !exports.nodeType && exports; - - /** Detect free variable `module`. */ - var freeModule$1 = freeExports$1 && typeof module == 'object' && module && !module.nodeType && module; - - /** Detect the popular CommonJS extension `module.exports`. */ - var moduleExports$1 = freeModule$1 && freeModule$1.exports === freeExports$1; - - /** Built-in value references. */ - var Buffer = moduleExports$1 ? root.Buffer : undefined; - - /* Built-in method references for those with the same name as other `lodash` methods. */ - var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined; - - /** - * Checks if `value` is a buffer. - * - * @static - * @memberOf _ - * @since 4.3.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a buffer, else `false`. - * @example - * - * _.isBuffer(new Buffer(2)); - * // => true - * - * _.isBuffer(new Uint8Array(2)); - * // => false - */ - var isBuffer = nativeIsBuffer || stubFalse; - - /** Used as references for various `Number` constants. */ - var MAX_SAFE_INTEGER$1 = 9007199254740991; - - /** Used to detect unsigned integer values. */ - var reIsUint = /^(?:0|[1-9]\d*)$/; - - /** - * Checks if `value` is a valid array-like index. - * - * @private - * @param {*} value The value to check. - * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. - * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. - */ - function isIndex(value, length) { - var type = typeof value; - length = length == null ? MAX_SAFE_INTEGER$1 : length; - - return !!length && - (type == 'number' || - (type != 'symbol' && reIsUint.test(value))) && - (value > -1 && value % 1 == 0 && value < length); - } - - /** Used as references for various `Number` constants. */ - var MAX_SAFE_INTEGER = 9007199254740991; - - /** - * Checks if `value` is a valid array-like length. - * - * **Note:** This method is loosely based on - * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. - * @example - * - * _.isLength(3); - * // => true - * - * _.isLength(Number.MIN_VALUE); - * // => false - * - * _.isLength(Infinity); - * // => false - * - * _.isLength('3'); - * // => false - */ - function isLength(value) { - return typeof value == 'number' && - value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; - } - - /** `Object#toString` result references. */ - var argsTag$1 = '[object Arguments]', - arrayTag$1 = '[object Array]', - boolTag = '[object Boolean]', - dateTag = '[object Date]', - errorTag = '[object Error]', - funcTag = '[object Function]', - mapTag$1 = '[object Map]', - numberTag = '[object Number]', - objectTag$2 = '[object Object]', - regexpTag = '[object RegExp]', - setTag$1 = '[object Set]', - stringTag = '[object String]', - weakMapTag$1 = '[object WeakMap]'; - - var arrayBufferTag = '[object ArrayBuffer]', - dataViewTag$1 = '[object DataView]', - float32Tag = '[object Float32Array]', - float64Tag = '[object Float64Array]', - int8Tag = '[object Int8Array]', - int16Tag = '[object Int16Array]', - int32Tag = '[object Int32Array]', - uint8Tag = '[object Uint8Array]', - uint8ClampedTag = '[object Uint8ClampedArray]', - uint16Tag = '[object Uint16Array]', - uint32Tag = '[object Uint32Array]'; - - /** Used to identify `toStringTag` values of typed arrays. */ - var typedArrayTags = {}; - typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = - typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = - typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = - typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = - typedArrayTags[uint32Tag] = true; - typedArrayTags[argsTag$1] = typedArrayTags[arrayTag$1] = - typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = - typedArrayTags[dataViewTag$1] = typedArrayTags[dateTag] = - typedArrayTags[errorTag] = typedArrayTags[funcTag] = - typedArrayTags[mapTag$1] = typedArrayTags[numberTag] = - typedArrayTags[objectTag$2] = typedArrayTags[regexpTag] = - typedArrayTags[setTag$1] = typedArrayTags[stringTag] = - typedArrayTags[weakMapTag$1] = false; - - /** - * The base implementation of `_.isTypedArray` without Node.js optimizations. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. - */ - function baseIsTypedArray(value) { - return isObjectLike(value) && - isLength(value.length) && !!typedArrayTags[baseGetTag(value)]; - } - - /** - * The base implementation of `_.unary` without support for storing metadata. - * - * @private - * @param {Function} func The function to cap arguments for. - * @returns {Function} Returns the new capped function. - */ - function baseUnary(func) { - return function(value) { - return func(value); - }; - } - - /** Detect free variable `exports`. */ - var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports; - - /** Detect free variable `module`. */ - var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module; - - /** Detect the popular CommonJS extension `module.exports`. */ - var moduleExports = freeModule && freeModule.exports === freeExports; - - /** Detect free variable `process` from Node.js. */ - var freeProcess = moduleExports && freeGlobal.process; - - /** Used to access faster Node.js helpers. */ - var nodeUtil = (function() { - try { - // Use `util.types` for Node.js 10+. - var types = freeModule && freeModule.require && freeModule.require('util').types; - - if (types) { - return types; - } - - // Legacy `process.binding('util')` for Node.js < 10. - return freeProcess && freeProcess.binding && freeProcess.binding('util'); - } catch (e) {} - }()); - - /* Node.js helper references. */ - var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray; - - /** - * Checks if `value` is classified as a typed array. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. - * @example - * - * _.isTypedArray(new Uint8Array); - * // => true - * - * _.isTypedArray([]); - * // => false - */ - var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray; - - /** Used for built-in method references. */ - var objectProto$4 = Object.prototype; - - /** Used to check objects for own properties. */ - var hasOwnProperty$3 = objectProto$4.hasOwnProperty; - - /** - * Creates an array of the enumerable property names of the array-like `value`. - * - * @private - * @param {*} value The value to query. - * @param {boolean} inherited Specify returning inherited property names. - * @returns {Array} Returns the array of property names. - */ - function arrayLikeKeys(value, inherited) { - var isArr = isArray(value), - isArg = !isArr && isArguments(value), - isBuff = !isArr && !isArg && isBuffer(value), - isType = !isArr && !isArg && !isBuff && isTypedArray(value), - skipIndexes = isArr || isArg || isBuff || isType, - result = skipIndexes ? baseTimes(value.length, String) : [], - length = result.length; - - for (var key in value) { - if ((inherited || hasOwnProperty$3.call(value, key)) && - !(skipIndexes && ( - // Safari 9 has enumerable `arguments.length` in strict mode. - key == 'length' || - // Node.js 0.10 has enumerable non-index properties on buffers. - (isBuff && (key == 'offset' || key == 'parent')) || - // PhantomJS 2 has enumerable non-index properties on typed arrays. - (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) || - // Skip index properties. - isIndex(key, length) - ))) { - result.push(key); - } - } - return result; - } - - /** Used for built-in method references. */ - var objectProto$3 = Object.prototype; - - /** - * Checks if `value` is likely a prototype object. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a prototype, else `false`. - */ - function isPrototype(value) { - var Ctor = value && value.constructor, - proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto$3; - - return value === proto; - } - - /** - * Creates a unary function that invokes `func` with its argument transformed. - * - * @private - * @param {Function} func The function to wrap. - * @param {Function} transform The argument transform. - * @returns {Function} Returns the new function. - */ - function overArg(func, transform) { - return function(arg) { - return func(transform(arg)); - }; - } - - /* Built-in method references for those with the same name as other `lodash` methods. */ - var nativeKeys = overArg(Object.keys, Object); - - /** Used for built-in method references. */ - var objectProto$2 = Object.prototype; - - /** Used to check objects for own properties. */ - var hasOwnProperty$2 = objectProto$2.hasOwnProperty; - - /** - * The base implementation of `_.keys` which doesn't treat sparse arrays as dense. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names. - */ - function baseKeys(object) { - if (!isPrototype(object)) { - return nativeKeys(object); - } - var result = []; - for (var key in Object(object)) { - if (hasOwnProperty$2.call(object, key) && key != 'constructor') { - result.push(key); - } - } - return result; - } - - /** - * Checks if `value` is array-like. A value is considered array-like if it's - * not a function and has a `value.length` that's an integer greater than or - * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is array-like, else `false`. - * @example - * - * _.isArrayLike([1, 2, 3]); - * // => true - * - * _.isArrayLike(document.body.children); - * // => true - * - * _.isArrayLike('abc'); - * // => true - * - * _.isArrayLike(_.noop); - * // => false - */ - function isArrayLike(value) { - return value != null && isLength(value.length) && !isFunction(value); - } - - /** - * Creates an array of the own enumerable property names of `object`. - * - * **Note:** Non-object values are coerced to objects. See the - * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) - * for more details. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Object - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names. - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.keys(new Foo); - * // => ['a', 'b'] (iteration order is not guaranteed) - * - * _.keys('hi'); - * // => ['0', '1'] - */ - function keys(object) { - return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object); - } - - /** - * Creates an array of own enumerable property names and symbols of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names and symbols. - */ - function getAllKeys(object) { - return baseGetAllKeys(object, keys, getSymbols); - } - - /** Used to compose bitmasks for value comparisons. */ - var COMPARE_PARTIAL_FLAG$1 = 1; - - /** Used for built-in method references. */ - var objectProto$1 = Object.prototype; - - /** Used to check objects for own properties. */ - var hasOwnProperty$1 = objectProto$1.hasOwnProperty; - - /** - * A specialized version of `baseIsEqualDeep` for objects with support for - * partial deep comparisons. - * - * @private - * @param {Object} object The object to compare. - * @param {Object} other The other object to compare. - * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. - * @param {Function} customizer The function to customize comparisons. - * @param {Function} equalFunc The function to determine equivalents of values. - * @param {Object} stack Tracks traversed `object` and `other` objects. - * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. - */ - function equalObjects(object, other, bitmask, customizer, equalFunc, stack) { - var isPartial = bitmask & COMPARE_PARTIAL_FLAG$1, - objProps = getAllKeys(object), - objLength = objProps.length, - othProps = getAllKeys(other), - othLength = othProps.length; - - if (objLength != othLength && !isPartial) { - return false; - } - var index = objLength; - while (index--) { - var key = objProps[index]; - if (!(isPartial ? key in other : hasOwnProperty$1.call(other, key))) { - return false; - } - } - // Check that cyclic values are equal. - var objStacked = stack.get(object); - var othStacked = stack.get(other); - if (objStacked && othStacked) { - return objStacked == other && othStacked == object; - } - var result = true; - stack.set(object, other); - stack.set(other, object); - - var skipCtor = isPartial; - while (++index < objLength) { - key = objProps[index]; - var objValue = object[key], - othValue = other[key]; - - if (customizer) { - var compared = isPartial - ? customizer(othValue, objValue, key, other, object, stack) - : customizer(objValue, othValue, key, object, other, stack); - } - // Recursively compare objects (susceptible to call stack limits). - if (!(compared === undefined - ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack)) - : compared - )) { - result = false; - break; - } - skipCtor || (skipCtor = key == 'constructor'); - } - if (result && !skipCtor) { - var objCtor = object.constructor, - othCtor = other.constructor; - - // Non `Object` object instances with different constructors are not equal. - if (objCtor != othCtor && - ('constructor' in object && 'constructor' in other) && - !(typeof objCtor == 'function' && objCtor instanceof objCtor && - typeof othCtor == 'function' && othCtor instanceof othCtor)) { - result = false; - } - } - stack['delete'](object); - stack['delete'](other); - return result; - } - - /* Built-in method references that are verified to be native. */ - var DataView = getNative(root, 'DataView'); - - /* Built-in method references that are verified to be native. */ - var Promise$1 = getNative(root, 'Promise'); - - /* Built-in method references that are verified to be native. */ - var Set = getNative(root, 'Set'); - - /* Built-in method references that are verified to be native. */ - var WeakMap = getNative(root, 'WeakMap'); - - /** `Object#toString` result references. */ - var mapTag = '[object Map]', - objectTag$1 = '[object Object]', - promiseTag = '[object Promise]', - setTag = '[object Set]', - weakMapTag = '[object WeakMap]'; - - var dataViewTag = '[object DataView]'; - - /** Used to detect maps, sets, and weakmaps. */ - var dataViewCtorString = toSource(DataView), - mapCtorString = toSource(Map$1), - promiseCtorString = toSource(Promise$1), - setCtorString = toSource(Set), - weakMapCtorString = toSource(WeakMap); - - /** - * Gets the `toStringTag` of `value`. - * - * @private - * @param {*} value The value to query. - * @returns {string} Returns the `toStringTag`. - */ - var getTag = baseGetTag; - - // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6. - if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) || - (Map$1 && getTag(new Map$1) != mapTag) || - (Promise$1 && getTag(Promise$1.resolve()) != promiseTag) || - (Set && getTag(new Set) != setTag) || - (WeakMap && getTag(new WeakMap) != weakMapTag)) { - getTag = function(value) { - var result = baseGetTag(value), - Ctor = result == objectTag$1 ? value.constructor : undefined, - ctorString = Ctor ? toSource(Ctor) : ''; - - if (ctorString) { - switch (ctorString) { - case dataViewCtorString: return dataViewTag; - case mapCtorString: return mapTag; - case promiseCtorString: return promiseTag; - case setCtorString: return setTag; - case weakMapCtorString: return weakMapTag; - } - } - return result; - }; - } - - var getTag$1 = getTag; - - /** Used to compose bitmasks for value comparisons. */ - var COMPARE_PARTIAL_FLAG = 1; - - /** `Object#toString` result references. */ - var argsTag = '[object Arguments]', - arrayTag = '[object Array]', - objectTag = '[object Object]'; - - /** Used for built-in method references. */ - var objectProto = Object.prototype; - - /** Used to check objects for own properties. */ - var hasOwnProperty = objectProto.hasOwnProperty; - - /** - * A specialized version of `baseIsEqual` for arrays and objects which performs - * deep comparisons and tracks traversed objects enabling objects with circular - * references to be compared. - * - * @private - * @param {Object} object The object to compare. - * @param {Object} other The other object to compare. - * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. - * @param {Function} customizer The function to customize comparisons. - * @param {Function} equalFunc The function to determine equivalents of values. - * @param {Object} [stack] Tracks traversed `object` and `other` objects. - * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. - */ - function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) { - var objIsArr = isArray(object), - othIsArr = isArray(other), - objTag = objIsArr ? arrayTag : getTag$1(object), - othTag = othIsArr ? arrayTag : getTag$1(other); - - objTag = objTag == argsTag ? objectTag : objTag; - othTag = othTag == argsTag ? objectTag : othTag; - - var objIsObj = objTag == objectTag, - othIsObj = othTag == objectTag, - isSameTag = objTag == othTag; - - if (isSameTag && isBuffer(object)) { - if (!isBuffer(other)) { - return false; - } - objIsArr = true; - objIsObj = false; - } - if (isSameTag && !objIsObj) { - stack || (stack = new Stack); - return (objIsArr || isTypedArray(object)) - ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) - : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack); - } - if (!(bitmask & COMPARE_PARTIAL_FLAG)) { - var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'), - othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__'); - - if (objIsWrapped || othIsWrapped) { - var objUnwrapped = objIsWrapped ? object.value() : object, - othUnwrapped = othIsWrapped ? other.value() : other; - - stack || (stack = new Stack); - return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack); - } - } - if (!isSameTag) { - return false; - } - stack || (stack = new Stack); - return equalObjects(object, other, bitmask, customizer, equalFunc, stack); - } - - /** - * The base implementation of `_.isEqual` which supports partial comparisons - * and tracks traversed objects. - * - * @private - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @param {boolean} bitmask The bitmask flags. - * 1 - Unordered comparison - * 2 - Partial comparison - * @param {Function} [customizer] The function to customize comparisons. - * @param {Object} [stack] Tracks traversed `value` and `other` objects. - * @returns {boolean} Returns `true` if the values are equivalent, else `false`. - */ - function baseIsEqual(value, other, bitmask, customizer, stack) { - if (value === other) { - return true; - } - if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) { - return value !== value && other !== other; - } - return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack); - } - - /** - * Performs a deep comparison between two values to determine if they are - * equivalent. - * - * **Note:** This method supports comparing arrays, array buffers, booleans, - * date objects, error objects, maps, numbers, `Object` objects, regexes, - * sets, strings, symbols, and typed arrays. `Object` objects are compared - * by their own, not inherited, enumerable properties. Functions and DOM - * nodes are compared by strict equality, i.e. `===`. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @returns {boolean} Returns `true` if the values are equivalent, else `false`. - * @example - * - * var object = { 'a': 1 }; - * var other = { 'a': 1 }; - * - * _.isEqual(object, other); - * // => true - * - * object === other; - * // => false - */ - function isEqual(value, other) { - return baseIsEqual(value, other); - } - - class RendererManager { - constructor({ game, rendererSystem }) { - this.renderers = []; - this.game = game; - this.rendererSystem = rendererSystem; - } - register(...renderers) { - for (const renderer of renderers) { - renderer.game = this.game; - renderer.rendererManager = this.rendererSystem.rendererManager; - renderer.containerManager = this.rendererSystem.containerManager; - this.renderers.push(renderer); - } - } - componentChanged(changes) { - for (const changed of changes) { - for (const renderer of this.renderers) { - const props = renderer.observerInfo[changed.componentName]; - if (props) { - if ([eva_js.OBSERVER_TYPE.ADD, eva_js.OBSERVER_TYPE.REMOVE].indexOf(changed.type) > -1) { - try { - renderer.componentChanged && renderer.componentChanged(changed); - } - catch (e) { - console.error(`gameObject: ${changed.gameObject.name}, ${changed.componentName} is error.`, changed, e); - } - continue; - } - const index = props.findIndex(prop => { - return isEqual(prop, changed.prop); - }); - if (index > -1) { - try { - renderer.componentChanged && renderer.componentChanged(changed); - } - catch (e) { - console.error(`gameObject: ${changed.gameObject && changed.gameObject.name}, ${changed.componentName} is componentChanged error.`, changed, e); - } - } - } - } - } - } - update(gameObject) { - for (const component of gameObject.components) { - for (const renderer of this.renderers) { - const cache = []; - const props = renderer.observerInfo[component.name]; - if (props && cache.indexOf(gameObject) === -1) { - cache.push(gameObject); - try { - renderer.rendererUpdate && renderer.rendererUpdate(gameObject); - } - catch (e) { - console.info(`gameObject: ${gameObject.name}, ${component.name} is update error`, e); - } - } - } - } - } - } - - class ContainerManager { - constructor() { - this.containerMap = {}; - } - addContainer({ name, container }) { - this.containerMap[name] = container; - } - getContainer(name) { - return this.containerMap[name]; - } - removeContainer(name) { - var _a; - (_a = this.containerMap[name]) === null || _a === void 0 ? void 0 : _a.destroy(true); - delete this.containerMap[name]; - } - updateTransform({ name, transform }) { - const container = this.containerMap[name]; - if (!container) - return; - const { anchor, origin, position, rotation, scale, size, skew } = transform; - container.rotation = rotation; - container.scale = scale; - container.pivot.x = size.width * origin.x; - container.pivot.y = size.height * origin.y; - container.skew = skew; - let x = position.x; - let y = position.y; - if (transform.parent) { - const parent = transform.parent; - x = x + parent.size.width * anchor.x; - y = y + parent.size.height * anchor.y; - } - container.position = { x, y }; - } - } - - function createCommonjsModule(fn) { - var module = { exports: {} }; - return fn(module, module.exports), module.exports; - } - - var eventemitter3 = createCommonjsModule(function (module) { - - var has = Object.prototype.hasOwnProperty - , prefix = '~'; - - /** - * Constructor to create a storage for our `EE` objects. - * An `Events` instance is a plain object whose properties are event names. - * - * @constructor - * @private - */ - function Events() {} - - // - // We try to not inherit from `Object.prototype`. In some engines creating an - // instance in this way is faster than calling `Object.create(null)` directly. - // If `Object.create(null)` is not supported we prefix the event names with a - // character to make sure that the built-in object properties are not - // overridden or used as an attack vector. - // - if (Object.create) { - Events.prototype = Object.create(null); - - // - // This hack is needed because the `__proto__` property is still inherited in - // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5. - // - if (!new Events().__proto__) prefix = false; - } - - /** - * Representation of a single event listener. - * - * @param {Function} fn The listener function. - * @param {*} context The context to invoke the listener with. - * @param {Boolean} [once=false] Specify if the listener is a one-time listener. - * @constructor - * @private - */ - function EE(fn, context, once) { - this.fn = fn; - this.context = context; - this.once = once || false; - } - - /** - * Add a listener for a given event. - * - * @param {EventEmitter} emitter Reference to the `EventEmitter` instance. - * @param {(String|Symbol)} event The event name. - * @param {Function} fn The listener function. - * @param {*} context The context to invoke the listener with. - * @param {Boolean} once Specify if the listener is a one-time listener. - * @returns {EventEmitter} - * @private - */ - function addListener(emitter, event, fn, context, once) { - if (typeof fn !== 'function') { - throw new TypeError('The listener must be a function'); - } - - var listener = new EE(fn, context || emitter, once) - , evt = prefix ? prefix + event : event; - - if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++; - else if (!emitter._events[evt].fn) emitter._events[evt].push(listener); - else emitter._events[evt] = [emitter._events[evt], listener]; - - return emitter; - } - - /** - * Clear event by name. - * - * @param {EventEmitter} emitter Reference to the `EventEmitter` instance. - * @param {(String|Symbol)} evt The Event name. - * @private - */ - function clearEvent(emitter, evt) { - if (--emitter._eventsCount === 0) emitter._events = new Events(); - else delete emitter._events[evt]; - } - - /** - * Minimal `EventEmitter` interface that is molded against the Node.js - * `EventEmitter` interface. - * - * @constructor - * @public - */ - function EventEmitter() { - this._events = new Events(); - this._eventsCount = 0; - } - - /** - * Return an array listing the events for which the emitter has registered - * listeners. - * - * @returns {Array} - * @public - */ - EventEmitter.prototype.eventNames = function eventNames() { - var names = [] - , events - , name; - - if (this._eventsCount === 0) return names; - - for (name in (events = this._events)) { - if (has.call(events, name)) names.push(prefix ? name.slice(1) : name); - } - - if (Object.getOwnPropertySymbols) { - return names.concat(Object.getOwnPropertySymbols(events)); - } - - return names; - }; - - /** - * Return the listeners registered for a given event. - * - * @param {(String|Symbol)} event The event name. - * @returns {Array} The registered listeners. - * @public - */ - EventEmitter.prototype.listeners = function listeners(event) { - var evt = prefix ? prefix + event : event - , handlers = this._events[evt]; - - if (!handlers) return []; - if (handlers.fn) return [handlers.fn]; - - for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) { - ee[i] = handlers[i].fn; - } - - return ee; - }; - - /** - * Return the number of listeners listening to a given event. - * - * @param {(String|Symbol)} event The event name. - * @returns {Number} The number of listeners. - * @public - */ - EventEmitter.prototype.listenerCount = function listenerCount(event) { - var evt = prefix ? prefix + event : event - , listeners = this._events[evt]; - - if (!listeners) return 0; - if (listeners.fn) return 1; - return listeners.length; - }; - - /** - * Calls each of the listeners registered for a given event. - * - * @param {(String|Symbol)} event The event name. - * @returns {Boolean} `true` if the event had listeners, else `false`. - * @public - */ - EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) { - var evt = prefix ? prefix + event : event; - - if (!this._events[evt]) return false; - - var listeners = this._events[evt] - , len = arguments.length - , args - , i; - - if (listeners.fn) { - if (listeners.once) this.removeListener(event, listeners.fn, undefined, true); - - switch (len) { - case 1: return listeners.fn.call(listeners.context), true; - case 2: return listeners.fn.call(listeners.context, a1), true; - case 3: return listeners.fn.call(listeners.context, a1, a2), true; - case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true; - case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true; - case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true; - } - - for (i = 1, args = new Array(len -1); i < len; i++) { - args[i - 1] = arguments[i]; - } - - listeners.fn.apply(listeners.context, args); - } else { - var length = listeners.length - , j; - - for (i = 0; i < length; i++) { - if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true); - - switch (len) { - case 1: listeners[i].fn.call(listeners[i].context); break; - case 2: listeners[i].fn.call(listeners[i].context, a1); break; - case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break; - case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break; - default: - if (!args) for (j = 1, args = new Array(len -1); j < len; j++) { - args[j - 1] = arguments[j]; - } - - listeners[i].fn.apply(listeners[i].context, args); - } - } - } - - return true; - }; - - /** - * Add a listener for a given event. - * - * @param {(String|Symbol)} event The event name. - * @param {Function} fn The listener function. - * @param {*} [context=this] The context to invoke the listener with. - * @returns {EventEmitter} `this`. - * @public - */ - EventEmitter.prototype.on = function on(event, fn, context) { - return addListener(this, event, fn, context, false); - }; - - /** - * Add a one-time listener for a given event. - * - * @param {(String|Symbol)} event The event name. - * @param {Function} fn The listener function. - * @param {*} [context=this] The context to invoke the listener with. - * @returns {EventEmitter} `this`. - * @public - */ - EventEmitter.prototype.once = function once(event, fn, context) { - return addListener(this, event, fn, context, true); - }; - - /** - * Remove the listeners of a given event. - * - * @param {(String|Symbol)} event The event name. - * @param {Function} fn Only remove the listeners that match this function. - * @param {*} context Only remove the listeners that have this context. - * @param {Boolean} once Only remove one-time listeners. - * @returns {EventEmitter} `this`. - * @public - */ - EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) { - var evt = prefix ? prefix + event : event; - - if (!this._events[evt]) return this; - if (!fn) { - clearEvent(this, evt); - return this; - } - - var listeners = this._events[evt]; - - if (listeners.fn) { - if ( - listeners.fn === fn && - (!once || listeners.once) && - (!context || listeners.context === context) - ) { - clearEvent(this, evt); - } - } else { - for (var i = 0, events = [], length = listeners.length; i < length; i++) { - if ( - listeners[i].fn !== fn || - (once && !listeners[i].once) || - (context && listeners[i].context !== context) - ) { - events.push(listeners[i]); - } - } - - // - // Reset the array, or remove it completely if we have no more listeners. - // - if (events.length) this._events[evt] = events.length === 1 ? events[0] : events; - else clearEvent(this, evt); - } - - return this; - }; - - /** - * Remove all listeners, or those of the specified event. - * - * @param {(String|Symbol)} [event] The event name. - * @returns {EventEmitter} `this`. - * @public - */ - EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) { - var evt; - - if (event) { - evt = prefix ? prefix + event : event; - if (this._events[evt]) clearEvent(this, evt); - } else { - this._events = new Events(); - this._eventsCount = 0; - } - - return this; - }; - - // - // Alias methods names because people roll like that. - // - EventEmitter.prototype.off = EventEmitter.prototype.removeListener; - EventEmitter.prototype.addListener = EventEmitter.prototype.on; - - // - // Expose the prefix. - // - EventEmitter.prefixed = prefix; - - // - // Allow `EventEmitter` to be imported as module namespace. - // - EventEmitter.EventEmitter = EventEmitter; - - // - // Expose the module. - // - { - module.exports = EventEmitter; - } - }); - - let Transform = class Transform extends eventemitter3 { - constructor({ system, containerManager }) { - super(); - this.name = 'Transform'; - this.waitRemoveIds = []; - this.waitChangeScenes = []; - this.containerManager = containerManager; - this.init(system); - } - init(system) { - this.system = system; - this.on('changeScene', ({ scene, mode, application }) => { - this.waitChangeScenes.push({ scene, mode, application }); - }); - } - update() { - for (const id of this.waitRemoveIds) { - this.containerManager.removeContainer(id); - } - this.waitRemoveIds = []; - for (const sceneInfo of this.waitChangeScenes) { - const container = this.containerManager.getContainer(sceneInfo.scene.id); - if (container) { - sceneInfo.application.stage.removeChildren(); - sceneInfo.application.stage.addChild(container); - } - } - this.waitChangeScenes = []; - } - componentChanged(changed) { - if (changed.type === eva_js.OBSERVER_TYPE.ADD) { - this.addContainer(changed); - } - else if (changed.type === eva_js.OBSERVER_TYPE.CHANGE) { - this.change(changed); - } - else if (changed.type === eva_js.OBSERVER_TYPE.REMOVE) { - this.waitRemoveIds.push(changed.gameObject.id); - } - } - addContainer(changed) { - const container = new Container(); - container.name = changed.gameObject.name; - this.containerManager.addContainer({ - name: changed.gameObject.id, - container, - }); - const transform = changed.component; - transform.worldTransform = container.transform.worldTransform; - } - change(changed) { - const transform = changed.component; - if (transform.parent) { - const parentContainer = this.containerManager.getContainer(transform.parent.gameObject.id); - parentContainer.addChild(this.containerManager.getContainer(changed.gameObject.id)); - const render = changed.gameObject.transform.parent && - changed.gameObject.transform.parent.gameObject.getComponent('Render'); - if (render) { - render.sortDirty = true; - } - } - else { - const container = this.containerManager.getContainer(changed.gameObject.id); - delete transform.worldTransform; - container.parent && container.parent.removeChild(container); - } - } - destroy() { - this.removeAllListeners(); - this.waitRemoveIds = null; - this.waitChangeScenes = null; - this.system = null; - this.containerManager = null; - } - }; - Transform = __decorate([ - eva_js.decorators.componentObserver({ - Transform: ['_parent'], - }) - ], Transform); - var Transform$1 = Transform; - - var RENDERER_TYPE; - (function (RENDERER_TYPE) { - RENDERER_TYPE[RENDERER_TYPE["UNKNOWN"] = 0] = "UNKNOWN"; - RENDERER_TYPE[RENDERER_TYPE["WEBGL"] = 1] = "WEBGL"; - RENDERER_TYPE[RENDERER_TYPE["CANVAS"] = 2] = "CANVAS"; - })(RENDERER_TYPE || (RENDERER_TYPE = {})); - const disableScroll = renderer => { - renderer.plugins.interaction.autoPreventDefault = true; - renderer.view.style.touchAction = 'none'; - }; - const enableScroll = renderer => { - renderer.plugins.interaction.autoPreventDefault = false; - renderer.view.style.touchAction = 'auto'; - }; - let Renderer = class Renderer extends eva_js.System { - constructor() { - super(...arguments); - this.multiApps = []; - } - init(params) { - this.params = params; - this.application = this.createApplication(params); - this.containerManager = new ContainerManager(); - this.rendererManager = new RendererManager({ - game: this.game, - rendererSystem: this, - }); - this.game.canvas = this.application.view; - this.transform = new Transform$1({ - system: this, - containerManager: this.containerManager, - }); - this.game.on('sceneChanged', ({ scene, mode, params }) => { - let application; - switch (mode) { - case eva_js.LOAD_SCENE_MODE.SINGLE: - application = this.application; - break; - case eva_js.LOAD_SCENE_MODE.MULTI_CANVAS: - application = this.createMultiApplication({ params }); - break; - } - scene.canvas = application.view; - this.transform.emit('changeScene', { - scene, - mode, - application, - }); - }); - } - registerObserver(observerInfo) { - const thisObserverInfo = this.constructor.observerInfo; - for (const key in observerInfo) { - if (!thisObserverInfo[key]) { - thisObserverInfo[key] = []; - } - thisObserverInfo[key].push(...observerInfo[key]); - } - } - createMultiApplication({ params }) { - const app = this.createApplication(params); - this.multiApps.push(app); - return app; - } - createApplication(params) { - params.view = params.canvas; - if (params.renderType === RENDERER_TYPE.CANVAS) { - params.forceCanvas = true; - } - pixi_js.ticker.shared.autoStart = false; - pixi_js.ticker.shared.stop(); - const app = new Application(Object.assign({ sharedTicker: true }, params)); - if (params.preventScroll !== undefined) { - console.warn('PreventScroll property will deprecate at next major version, please use enableEnable instead. https://eva.js.org/#/tutorials/game'); - params.preventScroll ? enableScroll(app.renderer) : disableScroll(app.renderer); - } - if (params.enableScroll !== undefined) { - params.enableScroll ? enableScroll(app.renderer) : disableScroll(app.renderer); - } - if (params.preventScroll === undefined && params.enableScroll === undefined) { - enableScroll(app.renderer); - } - return app; - } - update() { - const changes = this.componentObserver.clear(); - for (const changed of changes) { - this.transform.componentChanged(changed); - } - for (const gameObject of this.game.gameObjects) { - this.containerManager.updateTransform({ - name: gameObject.id, - transform: gameObject.transform, - }); - this.rendererManager.update(gameObject); - } - } - lateUpdate(e) { - this.transform.update(); - this.application.ticker.update(e.time); - } - onDestroy() { - this.application.destroy(); - for (const app of this.multiApps) { - app && app.destroy(); - } - this.transform.destroy(); - this.transform = null; - this.params = null; - this.rendererManager = null; - this.containerManager = null; - this.application = null; - this.game = null; - this.multiApps = null; - } - resize(width, height) { - this.params.width = width; - this.params.height = height; - this.application.renderer.resize(width, height); - } - }; - Renderer.systemName = 'Renderer'; - Renderer = __decorate([ - eva_js.decorators.componentObserver({ - Transform: ['_parent'], - }) - ], Renderer); - var RendererSystem = Renderer; - - const notAttr = [ - 'hint', - 'event', - 'delay', - 'attr', - 'role', - 'props', - 'state', - 'a11yId', - 'name', - ]; - const getEventFunc = function (event, gameObject, e) { - ['touchstart', 'touchend', 'tap'].forEach(name => { - event.emit(name, { - stopPropagation: () => e.stopPropagation(), - data: { - position: this.eventPosition, - }, - gameObject, - }); - }); - }; - let A11ySystem = class A11ySystem extends eva_js.System { - constructor(opt) { - super(opt); - this.cache = new Map(); - this.eventCache = new Map(); - } - get ratioX() { - if (this._ratioX) { - return this._ratioX; - } - else { - const success = this.setRatio(); - if (success) { - return this._ratioX; - } - else { - return 0; - } - } - } - get ratioY() { - if (this._ratioY) { - return this._ratioY; - } - else { - const success = this.setRatio(); - if (success) { - return this._ratioY; - } - else { - return 0; - } - } - } - init(opt = {}) { - return __awaiter(this, void 0, void 0, function* () { - const { activate = exports.A11yActivate.CHECK, delay = 100, checkA11yOpen = () => Promise.resolve(false), } = opt; - this.delay = delay; - switch (activate) { - case exports.A11yActivate.CHECK: - try { - this.activate = yield checkA11yOpen(); - } - catch (error) { - this.activate = false; - } - break; - case exports.A11yActivate.DISABLE: - this.activate = false; - break; - case exports.A11yActivate.ENABLE: - this.activate = true; - break; - } - this.debug = opt.debug || false; - if (this.debug) { - this.activate = true; - } - if (!this.activate) - return; - const div = document.createElement('div'); - this.div = div; - if (this.game.canvas.parentNode) { - this.game.canvas.parentNode.appendChild(this.div); - } - }); - } - setRatio() { - const { width, height } = this.getCanvasBoundingClientRect(); - const { renderWidth, renderHeight } = this.getRenderRect(); - this._ratioX = width / renderWidth; - this._ratioY = height / renderHeight; - if (width || height) { - this.initDiv(); - return true; - } - else { - return false; - } - } - getRenderRect() { - const { params } = this.game.getSystem(RendererSystem) || { width: 300, height: 300 }; - const { height: renderHeight, width: renderWidth } = params; - return { renderWidth, renderHeight }; - } - getCanvasBoundingClientRect() { - const { width, height, left, top } = this.game.canvas.getBoundingClientRect(); - return { width, height, left, top }; - } - initDiv() { - const { pageXOffset, pageYOffset } = window; - const { width, height, left, top } = this.getCanvasBoundingClientRect(); - const style = { - width, - height, - left: `${left + pageXOffset}px`, - top: `${top + pageYOffset}px`, - position: POSITION, - zIndex: ZINDEX, - pointerEvents: PointerEvents.NONE, - background: MaskBackground.NONE, - }; - setStyle(this.div, style); - this.div.addEventListener('click', e => { - const currentTarget = e.currentTarget; - const { left, top } = currentTarget.getBoundingClientRect(); - const x = (e.pageX - left) / this.ratioX; - const y = (e.pageY - top) / this.ratioY; - this.eventPosition = { x, y }; - }, true); - } - update() { - return __awaiter(this, void 0, void 0, function* () { - const changes = this.componentObserver.clear(); - if (!this.activate) { - return; - } - for (const changed of changes) { - switch (changed.type) { - case eva_js.OBSERVER_TYPE.ADD: - changed.componentName === 'Event' && - this.addEvent(changed.gameObject); - changed.componentName === 'A11y' && this.add(changed); - break; - case eva_js.OBSERVER_TYPE.CHANGE: - changed.componentName === 'Transform' && - this.transformChange(changed); - break; - case eva_js.OBSERVER_TYPE.REMOVE: - changed.componentName === 'Event' && this.removeEvent(changed); - changed.componentName === 'A11y' && this.remove(changed); - } - } - }); - } - remove(changed) { - const component = changed.component; - if (!component) - return; - const { a11yId } = component; - const element = this.div.querySelector(`#${a11yId}`); - element && this.div.removeChild(element); - this.cache.delete(a11yId); - } - add(changed) { - if (!this.activate) - return; - const component = changed.component; - const { gameObject } = changed; - const { delay, a11yId: id } = component; - let { event } = component; - if (!gameObject) - return; - const { transform } = gameObject; - if (!transform) - return; - const element = document.createElement('div'); - this.cache.set(id, element); - if (!event) { - event = gameObject.getComponent('Event'); - } - setTimeout(() => { - this.setPosition(element, transform); - this.setA11yAttr(element, component); - if (event) { - this.addEvent(gameObject); - } - if (gameObject.scene) { - this.div.appendChild(element); - } - }, delay || this.delay); - } - transformChange(changed) { - const component = changed.component; - const { gameObject } = changed; - const a11yComponent = gameObject.getComponent(A11y); - if (!a11yComponent) - return; - const { a11yId } = a11yComponent; - if (!component.inScene) { - const dom = this.div.querySelector(`#${a11yId}`); - dom && this.div.removeChild(dom); - } - else { - if (this.cache.has(a11yId)) { - const addDom = this.cache.get(a11yId); - addDom && this.div.appendChild(addDom); - } - } - } - setEvent(element, event, gameObject, id) { - if (!event) { - return; - } - const func = getEventFunc.bind(this, event, gameObject); - this.eventCache.set(id, func); - element.addEventListener('click', func); - } - addEvent(gameObject) { - const a11y = gameObject.getComponent(A11y); - if (!a11y) - return; - const event = gameObject.getComponent('Event'); - if (!event) - return; - const element = this.cache.get(a11y.a11yId); - element && this.setEvent(element, event, gameObject, a11y.a11yId); - } - removeEvent(changed) { - const { gameObject } = changed; - const a11y = gameObject.getComponent(A11y); - if (!a11y) - return; - const event = changed.component; - if (!event) - return; - const { a11yId } = a11y; - const func = this.eventCache.get(a11yId); - const element = this.cache.get(a11yId); - element && element.removeEventListener('click', func); - } - setA11yAttr(element, component) { - const { hint, props = {}, state = {}, role, a11yId: id } = component; - const realRole = role || 'text'; - element.setAttribute('role', realRole); - element.setAttribute('aria-label', hint); - element.id = id; - const ariaProps = Object.keys(props); - for (const key of ariaProps) { - element.setAttribute(key, props[key]); - } - const ariaState = Object.keys(state); - for (const key of ariaState) { - element.setAttribute(key, state[key]); - } - for (let key of Object.keys(component)) { - if (typeof component[key] === 'string' && - notAttr.indexOf(key) === -1 && - key.indexOf('_') !== 1) { - element.setAttribute(key, component[key]); - } - } - } - setPosition(element, transform) { - const { width, height } = transform.size; - const style = { - width: width === 0 ? 1 : width * this.ratioX, - height: height === 0 ? 1 : height * this.ratioY, - position: POSITION, - zIndex: ZINDEX, - pointerEvents: PointerEvents.AUTO, - background: this.debug ? MaskBackground.DEBUG : MaskBackground.NONE, - }; - const transformProps = Object.assign({}, transform); - setStyle(element, style); - setTransform(element, transformProps, this.ratioX, this.ratioY); - } - onDestroy() { - this.div.parentElement.removeChild(this.div); - this.cache = null; - this.eventCache = null; - } - }; - A11ySystem.systemName = 'A11ySystem'; - A11ySystem = __decorate([ - eva_js.decorators.componentObserver({ - A11y: [], - Transform: ['inScene'], - Event: [], - }) - ], A11ySystem); - var A11ySystem$1 = A11ySystem; - - exports.A11y = A11y; - exports.A11ySystem = A11ySystem$1; - - Object.defineProperty(exports, '__esModule', { value: true }); - -}))); diff --git a/dist/cdn/EVA.plugin.matterjs.js b/dist/cdn/EVA.plugin.matterjs.js deleted file mode 100644 index 364fae59..00000000 --- a/dist/cdn/EVA.plugin.matterjs.js +++ /dev/null @@ -1,11131 +0,0 @@ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@eva/eva.js')) : - typeof define === 'function' && define.amd ? define(['exports', '@eva/eva.js'], factory) : - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.EVA = global.EVA || {}, global.EVA.plugin = global.EVA.plugin || {}, global.EVA.plugin.matterjs = {}), global.EVA)); -}(this, (function (exports, eva_js) { 'use strict'; - - /*! ***************************************************************************** - Copyright (c) Microsoft Corporation. - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. - ***************************************************************************** */ - /* global Reflect, Promise */ - - var extendStatics = function(d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - - function __extends(d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - } - - function __decorate(decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; - } - - function __values(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); - } - - var global$1 = (typeof global !== "undefined" ? global : - typeof self !== "undefined" ? self : - typeof window !== "undefined" ? window : {}); - - /*! - 基于matter-js 修改, API保留了matter-js的api: http://brm.io/matter-js - */ - function __WEBPACK_EXTERNAL_MODULE__27__() { - try { - return require('poly-decomp'); - } catch (e) {} - } - - const main = function () { - return /******/ (function (modules) { - // webpackBootstrap - /******/ // The module cache - /******/ var installedModules = {}; // The require function - /******/ - /******/ /******/ function __webpack_require__(moduleId) { - /******/ - /******/ // Check if module is in cache - /******/ if (installedModules[moduleId]) { - /******/ return installedModules[moduleId].exports; - /******/ - } // Create a new module (and put it into the cache) - /******/ /******/ var module = (installedModules[moduleId] = { - /******/ i: moduleId, - /******/ l: false, - /******/ exports: {}, - /******/ - }); // Execute the module function - /******/ - /******/ /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); // Flag the module as loaded - /******/ - /******/ /******/ module.l = true; // Return the exports of the module - /******/ - /******/ /******/ return module.exports; - /******/ - } // expose the modules object (__webpack_modules__) - /******/ - /******/ - /******/ /******/ __webpack_require__.m = modules; // expose the module cache - /******/ - /******/ /******/ __webpack_require__.c = installedModules; // define getter function for harmony exports - /******/ - /******/ /******/ __webpack_require__.d = function (exports, name, getter) { - /******/ if (!__webpack_require__.o(exports, name)) { - /******/ Object.defineProperty(exports, name, {enumerable: true, get: getter}); - /******/ - } - /******/ - }; // define __esModule on exports - /******/ - /******/ /******/ __webpack_require__.r = function (exports) { - /******/ if (typeof Symbol !== 'undefined' && Symbol.toStringTag) { - /******/ Object.defineProperty(exports, Symbol.toStringTag, {value: 'Module'}); - /******/ - } - /******/ Object.defineProperty(exports, '__esModule', {value: true}); - /******/ - }; // create a fake namespace object // mode & 1: value is a module id, require it // mode & 2: merge all properties of value into the ns // mode & 4: return value when already ns object // mode & 8|1: behave like require - /******/ - /******/ /******/ /******/ /******/ /******/ /******/ __webpack_require__.t = function (value, mode) { - /******/ if (mode & 1) value = __webpack_require__(value); - /******/ if (mode & 8) return value; - /******/ if (mode & 4 && typeof value === 'object' && value && value.__esModule) return value; - /******/ var ns = Object.create(null); - /******/ __webpack_require__.r(ns); - /******/ Object.defineProperty(ns, 'default', {enumerable: true, value: value}); - /******/ if (mode & 2 && typeof value != 'string') - for (var key in value) - __webpack_require__.d( - ns, - key, - function (key) { - return value[key]; - }.bind(null, key), - ); - /******/ return ns; - /******/ - }; // getDefaultExport function for compatibility with non-harmony modules - /******/ - /******/ /******/ __webpack_require__.n = function (module) { - /******/ var getter = - module && module.__esModule - ? /******/ function getDefault() { - return module['default']; - } - : /******/ function getModuleExports() { - return module; - }; - /******/ __webpack_require__.d(getter, 'a', getter); - /******/ return getter; - /******/ - }; // Object.prototype.hasOwnProperty.call - /******/ - /******/ /******/ __webpack_require__.o = function (object, property) { - return Object.prototype.hasOwnProperty.call(object, property); - }; // __webpack_public_path__ - /******/ - /******/ /******/ __webpack_require__.p = ''; // Load entry module and return exports - /******/ - /******/ - /******/ /******/ return __webpack_require__((__webpack_require__.s = 24)); - /******/ - })( - /************************************************************************/ - /******/ [ - /* 0 */ - /***/ function (module, exports) { - /** - * The `Matter.Common` module contains utility functions that are common to all modules. - * - * @class Common - */ - - var Common = {}; - - module.exports = Common; - - (function () { - Common._nextId = 0; - Common._seed = 0; - Common._nowStartTime = +new Date(); - - /** - * Extends the object in the first argument using the object in the second argument. - * @method extend - * @param {} obj - * @param {boolean} deep - * @return {} obj extended - */ - Common.extend = function (obj, deep) { - var argsStart, deepClone; - - if (typeof deep === 'boolean') { - argsStart = 2; - deepClone = deep; - } else { - argsStart = 1; - deepClone = true; - } - - for (var i = argsStart; i < arguments.length; i++) { - var source = arguments[i]; - - if (source) { - for (var prop in source) { - if (deepClone && source[prop] && source[prop].constructor === Object) { - if (!obj[prop] || obj[prop].constructor === Object) { - obj[prop] = obj[prop] || {}; - Common.extend(obj[prop], deepClone, source[prop]); - } else { - obj[prop] = source[prop]; - } - } else { - obj[prop] = source[prop]; - } - } - } - } - - return obj; - }; - - /** - * Creates a new clone of the object, if deep is true references will also be cloned. - * @method clone - * @param {} obj - * @param {bool} deep - * @return {} obj cloned - */ - Common.clone = function (obj, deep) { - return Common.extend({}, deep, obj); - }; - - /** - * Returns the list of keys for the given object. - * @method keys - * @param {} obj - * @return {string[]} keys - */ - Common.keys = function (obj) { - if (Object.keys) return Object.keys(obj); - - // avoid hasOwnProperty for performance - var keys = []; - for (var key in obj) keys.push(key); - return keys; - }; - - /** - * Returns the list of values for the given object. - * @method values - * @param {} obj - * @return {array} Array of the objects property values - */ - Common.values = function (obj) { - var values = []; - - if (Object.keys) { - var keys = Object.keys(obj); - for (var i = 0; i < keys.length; i++) { - values.push(obj[keys[i]]); - } - return values; - } - - // avoid hasOwnProperty for performance - for (var key in obj) values.push(obj[key]); - return values; - }; - - /** - * Gets a value from `base` relative to the `path` string. - * @method get - * @param {} obj The base object - * @param {string} path The path relative to `base`, e.g. 'Foo.Bar.baz' - * @param {number} [begin] Path slice begin - * @param {number} [end] Path slice end - * @return {} The object at the given path - */ - Common.get = function (obj, path, begin, end) { - path = path.split('.').slice(begin, end); - - for (var i = 0; i < path.length; i += 1) { - obj = obj[path[i]]; - } - - return obj; - }; - - /** - * Sets a value on `base` relative to the given `path` string. - * @method set - * @param {} obj The base object - * @param {string} path The path relative to `base`, e.g. 'Foo.Bar.baz' - * @param {} val The value to set - * @param {number} [begin] Path slice begin - * @param {number} [end] Path slice end - * @return {} Pass through `val` for chaining - */ - Common.set = function (obj, path, val, begin, end) { - var parts = path.split('.').slice(begin, end); - Common.get(obj, path, 0, -1)[parts[parts.length - 1]] = val; - return val; - }; - - /** - * Shuffles the given array in-place. - * The function uses a seeded random generator. - * @method shuffle - * @param {array} array - * @return {array} array shuffled randomly - */ - Common.shuffle = function (array) { - for (var i = array.length - 1; i > 0; i--) { - var j = Math.floor(Common.random() * (i + 1)); - var temp = array[i]; - array[i] = array[j]; - array[j] = temp; - } - return array; - }; - - /** - * Randomly chooses a value from a list with equal probability. - * The function uses a seeded random generator. - * @method choose - * @param {array} choices - * @return {object} A random choice object from the array - */ - Common.choose = function (choices) { - return choices[Math.floor(Common.random() * choices.length)]; - }; - - /** - * Returns true if the object is a HTMLElement, otherwise false. - * @method isElement - * @param {object} obj - * @return {boolean} True if the object is a HTMLElement, otherwise false - */ - Common.isElement = function (obj) { - if (typeof HTMLElement !== 'undefined') { - return obj instanceof HTMLElement; - } - - return !!(obj && obj.nodeType && obj.nodeName); - }; - - /** - * Returns true if the object is an array. - * @method isArray - * @param {object} obj - * @return {boolean} True if the object is an array, otherwise false - */ - Common.isArray = function (obj) { - return Object.prototype.toString.call(obj) === '[object Array]'; - }; - - /** - * Returns true if the object is a function. - * @method isFunction - * @param {object} obj - * @return {boolean} True if the object is a function, otherwise false - */ - Common.isFunction = function (obj) { - return typeof obj === 'function'; - }; - - /** - * Returns true if the object is a plain object. - * @method isPlainObject - * @param {object} obj - * @return {boolean} True if the object is a plain object, otherwise false - */ - Common.isPlainObject = function (obj) { - return typeof obj === 'object' && obj.constructor === Object; - }; - - /** - * Returns true if the object is a string. - * @method isString - * @param {object} obj - * @return {boolean} True if the object is a string, otherwise false - */ - Common.isString = function (obj) { - return toString.call(obj) === '[object String]'; - }; - - /** - * Returns the given value clamped between a minimum and maximum value. - * @method clamp - * @param {number} value - * @param {number} min - * @param {number} max - * @return {number} The value clamped between min and max inclusive - */ - Common.clamp = function (value, min, max) { - if (value < min) return min; - if (value > max) return max; - return value; - }; - - /** - * Returns the sign of the given value. - * @method sign - * @param {number} value - * @return {number} -1 if negative, +1 if 0 or positive - */ - Common.sign = function (value) { - return value < 0 ? -1 : 1; - }; - - /** - * Returns the current timestamp since the time origin (e.g. from page load). - * The result will be high-resolution including decimal places if available. - * @method now - * @return {number} the current timestamp - */ - Common.now = function () { - if (typeof window !== 'undefined' && window.performance) { - if (window.performance.now) { - return window.performance.now(); - } else if (window.performance.webkitNow) { - return window.performance.webkitNow(); - } - } - - return new Date() - Common._nowStartTime; - }; - - /** - * Returns a random value between a minimum and a maximum value inclusive. - * The function uses a seeded random generator. - * @method random - * @param {number} min - * @param {number} max - * @return {number} A random number between min and max inclusive - */ - Common.random = function (min, max) { - min = typeof min !== 'undefined' ? min : 0; - max = typeof max !== 'undefined' ? max : 1; - return min + _seededRandom() * (max - min); - }; - - var _seededRandom = function () { - // https://en.wikipedia.org/wiki/Linear_congruential_generator - Common._seed = (Common._seed * 9301 + 49297) % 233280; - return Common._seed / 233280; - }; - - /** - * Converts a CSS hex colour string into an integer. - * @method colorToNumber - * @param {string} colorString - * @return {number} An integer representing the CSS hex string - */ - Common.colorToNumber = function (colorString) { - colorString = colorString.replace('#', ''); - - if (colorString.length == 3) { - colorString = - colorString.charAt(0) + - colorString.charAt(0) + - colorString.charAt(1) + - colorString.charAt(1) + - colorString.charAt(2) + - colorString.charAt(2); - } - - return parseInt(colorString, 16); - }; - - /** - * The console logging level to use, where each level includes all levels above and excludes the levels below. - * The default level is 'debug' which shows all console messages. - * - * Possible level values are: - * - 0 = None - * - 1 = Debug - * - 2 = Info - * - 3 = Warn - * - 4 = Error - * @property Common.logLevel - * @type {Number} - * @default 1 - */ - Common.logLevel = 1; - - /** - * Shows a `console.log` message only if the current `Common.logLevel` allows it. - * The message will be prefixed with 'matter-js' to make it easily identifiable. - * @method log - * @param ...objs {} The objects to log. - */ - Common.log = function () { - if (console && Common.logLevel > 0 && Common.logLevel <= 3) { - console.log.apply(console, ['matter-js:'].concat(Array.prototype.slice.call(arguments))); - } - }; - - /** - * Shows a `console.info` message only if the current `Common.logLevel` allows it. - * The message will be prefixed with 'matter-js' to make it easily identifiable. - * @method info - * @param ...objs {} The objects to log. - */ - Common.info = function () { - if (console && Common.logLevel > 0 && Common.logLevel <= 2) { - console.info.apply(console, ['matter-js:'].concat(Array.prototype.slice.call(arguments))); - } - }; - - /** - * Shows a `console.warn` message only if the current `Common.logLevel` allows it. - * The message will be prefixed with 'matter-js' to make it easily identifiable. - * @method warn - * @param ...objs {} The objects to log. - */ - Common.warn = function () { - if (console && Common.logLevel > 0 && Common.logLevel <= 3) { - console.warn.apply(console, ['matter-js:'].concat(Array.prototype.slice.call(arguments))); - } - }; - - /** - * Returns the next unique sequential ID. - * @method nextId - * @return {Number} Unique sequential ID - */ - Common.nextId = function () { - return Common._nextId++; - }; - - /** - * A cross browser compatible indexOf implementation. - * @method indexOf - * @param {array} haystack - * @param {object} needle - * @return {number} The position of needle in haystack, otherwise -1. - */ - Common.indexOf = function (haystack, needle) { - if (haystack.indexOf) return haystack.indexOf(needle); - - for (var i = 0; i < haystack.length; i++) { - if (haystack[i] === needle) return i; - } - - return -1; - }; - - /** - * A cross browser compatible array map implementation. - * @method map - * @param {array} list - * @param {function} func - * @return {array} Values from list transformed by func. - */ - Common.map = function (list, func) { - if (list.map) { - return list.map(func); - } - - var mapped = []; - - for (var i = 0; i < list.length; i += 1) { - mapped.push(func(list[i])); - } - - return mapped; - }; - - /** - * Takes a directed graph and returns the partially ordered set of vertices in topological order. - * Circular dependencies are allowed. - * @method topologicalSort - * @param {object} graph - * @return {array} Partially ordered set of vertices in topological order. - */ - Common.topologicalSort = function (graph) { - // https://github.com/mgechev/javascript-algorithms - // Copyright (c) Minko Gechev (MIT license) - // Modifications: tidy formatting and naming - var result = [], - visited = [], - temp = []; - - for (var node in graph) { - if (!visited[node] && !temp[node]) { - Common._topologicalSort(node, visited, temp, graph, result); - } - } - - return result; - }; - - Common._topologicalSort = function (node, visited, temp, graph, result) { - var neighbors = graph[node] || []; - temp[node] = true; - - for (var i = 0; i < neighbors.length; i += 1) { - var neighbor = neighbors[i]; - - if (temp[neighbor]) { - // skip circular dependencies - continue; - } - - if (!visited[neighbor]) { - Common._topologicalSort(neighbor, visited, temp, graph, result); - } - } - - temp[node] = false; - visited[node] = true; - - result.push(node); - }; - - /** - * Takes _n_ functions as arguments and returns a new function that calls them in order. - * The arguments applied when calling the new function will also be applied to every function passed. - * The value of `this` refers to the last value returned in the chain that was not `undefined`. - * Therefore if a passed function does not return a value, the previously returned value is maintained. - * After all passed functions have been called the new function returns the last returned value (if any). - * If any of the passed functions are a chain, then the chain will be flattened. - * @method chain - * @param ...funcs {function} The functions to chain. - * @return {function} A new function that calls the passed functions in order. - */ - Common.chain = function () { - var funcs = []; - - for (var i = 0; i < arguments.length; i += 1) { - var func = arguments[i]; - - if (func._chained) { - // flatten already chained functions - funcs.push.apply(funcs, func._chained); - } else { - funcs.push(func); - } - } - - var chain = function () { - // https://github.com/GoogleChrome/devtools-docs/issues/53#issuecomment-51941358 - var lastResult, - args = new Array(arguments.length); - - for (var i = 0, l = arguments.length; i < l; i++) { - args[i] = arguments[i]; - } - - for (i = 0; i < funcs.length; i += 1) { - var result = funcs[i].apply(lastResult, args); - - if (typeof result !== 'undefined') { - lastResult = result; - } - } - - return lastResult; - }; - - chain._chained = funcs; - - return chain; - }; - - /** - * Chains a function to excute before the original function on the given `path` relative to `base`. - * See also docs for `Common.chain`. - * @method chainPathBefore - * @param {} base The base object - * @param {string} path The path relative to `base` - * @param {function} func The function to chain before the original - * @return {function} The chained function that replaced the original - */ - Common.chainPathBefore = function (base, path, func) { - return Common.set(base, path, Common.chain(func, Common.get(base, path))); - }; - - /** - * Chains a function to excute after the original function on the given `path` relative to `base`. - * See also docs for `Common.chain`. - * @method chainPathAfter - * @param {} base The base object - * @param {string} path The path relative to `base` - * @param {function} func The function to chain after the original - * @return {function} The chained function that replaced the original - */ - Common.chainPathAfter = function (base, path, func) { - return Common.set(base, path, Common.chain(Common.get(base, path), func)); - }; - })(); - - /***/ - }, - /* 1 */ - /***/ function (module, exports) { - /** - * The `Matter.Bounds` module contains methods for creating and manipulating axis-aligned bounding boxes (AABB). - * - * @class Bounds - */ - - var Bounds = {}; - - module.exports = Bounds; - - (function () { - /** - * Creates a new axis-aligned bounding box (AABB) for the given vertices. - * @method create - * @param {vertices} vertices - * @return {bounds} A new bounds object - */ - Bounds.create = function (vertices) { - var bounds = { - min: {x: 0, y: 0}, - max: {x: 0, y: 0}, - }; - - if (vertices) Bounds.update(bounds, vertices); - - return bounds; - }; - - /** - * Updates bounds using the given vertices and extends the bounds given a velocity. - * @method update - * @param {bounds} bounds - * @param {vertices} vertices - * @param {vector} velocity - */ - Bounds.update = function (bounds, vertices, velocity) { - bounds.min.x = Infinity; - bounds.max.x = -Infinity; - bounds.min.y = Infinity; - bounds.max.y = -Infinity; - - for (var i = 0; i < vertices.length; i++) { - var vertex = vertices[i]; - if (vertex.x > bounds.max.x) bounds.max.x = vertex.x; - if (vertex.x < bounds.min.x) bounds.min.x = vertex.x; - if (vertex.y > bounds.max.y) bounds.max.y = vertex.y; - if (vertex.y < bounds.min.y) bounds.min.y = vertex.y; - } - - if (velocity) { - if (velocity.x > 0) { - bounds.max.x += velocity.x; - } else { - bounds.min.x += velocity.x; - } - - if (velocity.y > 0) { - bounds.max.y += velocity.y; - } else { - bounds.min.y += velocity.y; - } - } - }; - - /** - * Returns true if the bounds contains the given point. - * @method contains - * @param {bounds} bounds - * @param {vector} point - * @return {boolean} True if the bounds contain the point, otherwise false - */ - Bounds.contains = function (bounds, point) { - return ( - point.x >= bounds.min.x && point.x <= bounds.max.x && point.y >= bounds.min.y && point.y <= bounds.max.y - ); - }; - - /** - * Returns true if the two bounds intersect. - * @method overlaps - * @param {bounds} boundsA - * @param {bounds} boundsB - * @return {boolean} True if the bounds overlap, otherwise false - */ - Bounds.overlaps = function (boundsA, boundsB) { - return ( - boundsA.min.x <= boundsB.max.x && - boundsA.max.x >= boundsB.min.x && - boundsA.max.y >= boundsB.min.y && - boundsA.min.y <= boundsB.max.y - ); - }; - - /** - * Translates the bounds by the given vector. - * @method translate - * @param {bounds} bounds - * @param {vector} vector - */ - Bounds.translate = function (bounds, vector) { - bounds.min.x += vector.x; - bounds.max.x += vector.x; - bounds.min.y += vector.y; - bounds.max.y += vector.y; - }; - - /** - * Shifts the bounds to the given position. - * @method shift - * @param {bounds} bounds - * @param {vector} position - */ - Bounds.shift = function (bounds, position) { - var deltaX = bounds.max.x - bounds.min.x, - deltaY = bounds.max.y - bounds.min.y; - - bounds.min.x = position.x; - bounds.max.x = position.x + deltaX; - bounds.min.y = position.y; - bounds.max.y = position.y + deltaY; - }; - })(); - - /***/ - }, - /* 2 */ - /***/ function (module, exports) { - /** - * The `Matter.Vector` module contains methods for creating and manipulating vectors. - * Vectors are the basis of all the geometry related operations in the engine. - * A `Matter.Vector` object is of the form `{ x: 0, y: 0 }`. - * - * See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples). - * - * @class Vector - */ - - // TODO: consider params for reusing vector objects - - var Vector = {}; - - module.exports = Vector; - - (function () { - /** - * Creates a new vector. - * @method create - * @param {number} x - * @param {number} y - * @return {vector} A new vector - */ - Vector.create = function (x, y) { - return {x: x || 0, y: y || 0}; - }; - - /** - * Returns a new vector with `x` and `y` copied from the given `vector`. - * @method clone - * @param {vector} vector - * @return {vector} A new cloned vector - */ - Vector.clone = function (vector) { - return {x: vector.x, y: vector.y}; - }; - - /** - * Returns the magnitude (length) of a vector. - * @method magnitude - * @param {vector} vector - * @return {number} The magnitude of the vector - */ - Vector.magnitude = function (vector) { - return Math.sqrt(vector.x * vector.x + vector.y * vector.y); - }; - - /** - * Returns the magnitude (length) of a vector (therefore saving a `sqrt` operation). - * @method magnitudeSquared - * @param {vector} vector - * @return {number} The squared magnitude of the vector - */ - Vector.magnitudeSquared = function (vector) { - return vector.x * vector.x + vector.y * vector.y; - }; - - /** - * Rotates the vector about (0, 0) by specified angle. - * @method rotate - * @param {vector} vector - * @param {number} angle - * @param {vector} [output] - * @return {vector} The vector rotated about (0, 0) - */ - Vector.rotate = function (vector, angle, output) { - var cos = Math.cos(angle), - sin = Math.sin(angle); - if (!output) output = {}; - var x = vector.x * cos - vector.y * sin; - output.y = vector.x * sin + vector.y * cos; - output.x = x; - return output; - }; - - /** - * Rotates the vector about a specified point by specified angle. - * @method rotateAbout - * @param {vector} vector - * @param {number} angle - * @param {vector} point - * @param {vector} [output] - * @return {vector} A new vector rotated about the point - */ - Vector.rotateAbout = function (vector, angle, point, output) { - var cos = Math.cos(angle), - sin = Math.sin(angle); - if (!output) output = {}; - var x = point.x + ((vector.x - point.x) * cos - (vector.y - point.y) * sin); - output.y = point.y + ((vector.x - point.x) * sin + (vector.y - point.y) * cos); - output.x = x; - return output; - }; - - /** - * Normalises a vector (such that its magnitude is `1`). - * @method normalise - * @param {vector} vector - * @return {vector} A new vector normalised - */ - Vector.normalise = function (vector) { - var magnitude = Vector.magnitude(vector); - if (magnitude === 0) return {x: 0, y: 0}; - return {x: vector.x / magnitude, y: vector.y / magnitude}; - }; - - /** - * Returns the dot-product of two vectors. - * @method dot - * @param {vector} vectorA - * @param {vector} vectorB - * @return {number} The dot product of the two vectors - */ - Vector.dot = function (vectorA, vectorB) { - return vectorA.x * vectorB.x + vectorA.y * vectorB.y; - }; - - /** - * Returns the cross-product of two vectors. - * @method cross - * @param {vector} vectorA - * @param {vector} vectorB - * @return {number} The cross product of the two vectors - */ - Vector.cross = function (vectorA, vectorB) { - return vectorA.x * vectorB.y - vectorA.y * vectorB.x; - }; - - /** - * Returns the cross-product of three vectors. - * @method cross3 - * @param {vector} vectorA - * @param {vector} vectorB - * @param {vector} vectorC - * @return {number} The cross product of the three vectors - */ - Vector.cross3 = function (vectorA, vectorB, vectorC) { - return ( - (vectorB.x - vectorA.x) * (vectorC.y - vectorA.y) - (vectorB.y - vectorA.y) * (vectorC.x - vectorA.x) - ); - }; - - /** - * Adds the two vectors. - * @method add - * @param {vector} vectorA - * @param {vector} vectorB - * @param {vector} [output] - * @return {vector} A new vector of vectorA and vectorB added - */ - Vector.add = function (vectorA, vectorB, output) { - if (!output) output = {}; - output.x = vectorA.x + vectorB.x; - output.y = vectorA.y + vectorB.y; - return output; - }; - - /** - * Subtracts the two vectors. - * @method sub - * @param {vector} vectorA - * @param {vector} vectorB - * @param {vector} [output] - * @return {vector} A new vector of vectorA and vectorB subtracted - */ - Vector.sub = function (vectorA, vectorB, output) { - if (!output) output = {}; - output.x = vectorA.x - vectorB.x; - output.y = vectorA.y - vectorB.y; - return output; - }; - - /** - * Multiplies a vector and a scalar. - * @method mult - * @param {vector} vector - * @param {number} scalar - * @return {vector} A new vector multiplied by scalar - */ - Vector.mult = function (vector, scalar) { - return {x: vector.x * scalar, y: vector.y * scalar}; - }; - - /** - * Divides a vector and a scalar. - * @method div - * @param {vector} vector - * @param {number} scalar - * @return {vector} A new vector divided by scalar - */ - Vector.div = function (vector, scalar) { - return {x: vector.x / scalar, y: vector.y / scalar}; - }; - - /** - * Returns the perpendicular vector. Set `negate` to true for the perpendicular in the opposite direction. - * @method perp - * @param {vector} vector - * @param {bool} [negate=false] - * @return {vector} The perpendicular vector - */ - Vector.perp = function (vector, negate) { - negate = negate === true ? -1 : 1; - return {x: negate * -vector.y, y: negate * vector.x}; - }; - - /** - * Negates both components of a vector such that it points in the opposite direction. - * @method neg - * @param {vector} vector - * @return {vector} The negated vector - */ - Vector.neg = function (vector) { - return {x: -vector.x, y: -vector.y}; - }; - - /** - * Returns the angle between the vector `vectorB - vectorA` and the x-axis in radians. - * @method angle - * @param {vector} vectorA - * @param {vector} vectorB - * @return {number} The angle in radians - */ - Vector.angle = function (vectorA, vectorB) { - return Math.atan2(vectorB.y - vectorA.y, vectorB.x - vectorA.x); - }; - - /** - * Temporary vector pool (not thread-safe). - * @property _temp - * @type {vector[]} - * @private - */ - Vector._temp = [ - Vector.create(), - Vector.create(), - Vector.create(), - Vector.create(), - Vector.create(), - Vector.create(), - ]; - })(); - - /***/ - }, - /* 3 */ - /***/ function (module, exports, __webpack_require__) { - /** - * The `Matter.Vertices` module contains methods for creating and manipulating sets of vertices. - * A set of vertices is an array of `Matter.Vector` with additional indexing properties inserted by `Vertices.create`. - * A `Matter.Body` maintains a set of vertices to represent the shape of the object (its convex hull). - * - * See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples). - * - * @class Vertices - */ - - var Vertices = {}; - - module.exports = Vertices; - - var Vector = __webpack_require__(2); - var Common = __webpack_require__(0); - - (function () { - /** - * Creates a new set of `Matter.Body` compatible vertices. - * The `points` argument accepts an array of `Matter.Vector` points orientated around the origin `(0, 0)`, for example: - * - * [{ x: 0, y: 0 }, { x: 25, y: 50 }, { x: 50, y: 0 }] - * - * The `Vertices.create` method returns a new array of vertices, which are similar to Matter.Vector objects, - * but with some additional references required for efficient collision detection routines. - * - * Vertices must be specified in clockwise order. - * - * Note that the `body` argument is not optional, a `Matter.Body` reference must be provided. - * - * @method create - * @param {vector[]} points - * @param {body} body - */ - Vertices.create = function (points, body) { - var vertices = []; - - for (var i = 0; i < points.length; i++) { - var point = points[i], - vertex = { - x: point.x, - y: point.y, - index: i, - body: body, - isInternal: false, - }; - - vertices.push(vertex); - } - - return vertices; - }; - - /** - * Parses a string containing ordered x y pairs separated by spaces (and optionally commas), - * into a `Matter.Vertices` object for the given `Matter.Body`. - * For parsing SVG paths, see `Svg.pathToVertices`. - * @method fromPath - * @param {string} path - * @param {body} body - * @return {vertices} vertices - */ - Vertices.fromPath = function (path, body) { - var pathPattern = /L?\s*([-\d.e]+)[\s,]*([-\d.e]+)*/gi, - points = []; - - path.replace(pathPattern, function (match, x, y) { - points.push({x: parseFloat(x), y: parseFloat(y)}); - }); - - return Vertices.create(points, body); - }; - - /** - * Returns the centre (centroid) of the set of vertices. - * @method centre - * @param {vertices} vertices - * @return {vector} The centre point - */ - Vertices.centre = function (vertices) { - var area = Vertices.area(vertices, true), - centre = {x: 0, y: 0}, - cross, - temp, - j; - - for (var i = 0; i < vertices.length; i++) { - j = (i + 1) % vertices.length; - cross = Vector.cross(vertices[i], vertices[j]); - temp = Vector.mult(Vector.add(vertices[i], vertices[j]), cross); - centre = Vector.add(centre, temp); - } - - return Vector.div(centre, 6 * area); - }; - - /** - * Returns the average (mean) of the set of vertices. - * @method mean - * @param {vertices} vertices - * @return {vector} The average point - */ - Vertices.mean = function (vertices) { - var average = {x: 0, y: 0}; - - for (var i = 0; i < vertices.length; i++) { - average.x += vertices[i].x; - average.y += vertices[i].y; - } - - return Vector.div(average, vertices.length); - }; - - /** - * Returns the area of the set of vertices. - * @method area - * @param {vertices} vertices - * @param {bool} signed - * @return {number} The area - */ - Vertices.area = function (vertices, signed) { - var area = 0, - j = vertices.length - 1; - - for (var i = 0; i < vertices.length; i++) { - area += (vertices[j].x - vertices[i].x) * (vertices[j].y + vertices[i].y); - j = i; - } - - if (signed) return area / 2; - - return Math.abs(area) / 2; - }; - - /** - * Returns the moment of inertia (second moment of area) of the set of vertices given the total mass. - * @method inertia - * @param {vertices} vertices - * @param {number} mass - * @return {number} The polygon's moment of inertia - */ - Vertices.inertia = function (vertices, mass) { - var numerator = 0, - denominator = 0, - v = vertices, - cross, - j; - - // find the polygon's moment of inertia, using second moment of area - // from equations at http://www.physicsforums.com/showthread.php?t=25293 - for (var n = 0; n < v.length; n++) { - j = (n + 1) % v.length; - cross = Math.abs(Vector.cross(v[j], v[n])); - numerator += cross * (Vector.dot(v[j], v[j]) + Vector.dot(v[j], v[n]) + Vector.dot(v[n], v[n])); - denominator += cross; - } - - return (mass / 6) * (numerator / denominator); - }; - - /** - * Translates the set of vertices in-place. - * @method translate - * @param {vertices} vertices - * @param {vector} vector - * @param {number} scalar - */ - Vertices.translate = function (vertices, vector, scalar) { - var i; - if (scalar) { - for (i = 0; i < vertices.length; i++) { - vertices[i].x += vector.x * scalar; - vertices[i].y += vector.y * scalar; - } - } else { - for (i = 0; i < vertices.length; i++) { - vertices[i].x += vector.x; - vertices[i].y += vector.y; - } - } - - return vertices; - }; - - /** - * Rotates the set of vertices in-place. - * @method rotate - * @param {vertices} vertices - * @param {number} angle - * @param {vector} point - */ - Vertices.rotate = function (vertices, angle, point) { - if (angle === 0) return; - - var cos = Math.cos(angle), - sin = Math.sin(angle); - - for (var i = 0; i < vertices.length; i++) { - var vertice = vertices[i], - dx = vertice.x - point.x, - dy = vertice.y - point.y; - - vertice.x = point.x + (dx * cos - dy * sin); - vertice.y = point.y + (dx * sin + dy * cos); - } - - return vertices; - }; - - /** - * Returns `true` if the `point` is inside the set of `vertices`. - * @method contains - * @param {vertices} vertices - * @param {vector} point - * @return {boolean} True if the vertices contains point, otherwise false - */ - Vertices.contains = function (vertices, point) { - for (var i = 0; i < vertices.length; i++) { - var vertice = vertices[i], - nextVertice = vertices[(i + 1) % vertices.length]; - if ( - (point.x - vertice.x) * (nextVertice.y - vertice.y) + - (point.y - vertice.y) * (vertice.x - nextVertice.x) > - 0 - ) { - return false; - } - } - - return true; - }; - - /** - * Scales the vertices from a point (default is centre) in-place. - * @method scale - * @param {vertices} vertices - * @param {number} scaleX - * @param {number} scaleY - * @param {vector} point - */ - Vertices.scale = function (vertices, scaleX, scaleY, point) { - if (scaleX === 1 && scaleY === 1) return vertices; - - point = point || Vertices.centre(vertices); - - var vertex, delta; - - for (var i = 0; i < vertices.length; i++) { - vertex = vertices[i]; - delta = Vector.sub(vertex, point); - vertices[i].x = point.x + delta.x * scaleX; - vertices[i].y = point.y + delta.y * scaleY; - } - - return vertices; - }; - - /** - * Chamfers a set of vertices by giving them rounded corners, returns a new set of vertices. - * The radius parameter is a single number or an array to specify the radius for each vertex. - * @method chamfer - * @param {vertices} vertices - * @param {number[]} radius - * @param {number} quality - * @param {number} qualityMin - * @param {number} qualityMax - */ - Vertices.chamfer = function (vertices, radius, quality, qualityMin, qualityMax) { - if (typeof radius === 'number') { - radius = [radius]; - } else { - radius = radius || [8]; - } - - // quality defaults to -1, which is auto - quality = typeof quality !== 'undefined' ? quality : -1; - qualityMin = qualityMin || 2; - qualityMax = qualityMax || 14; - - var newVertices = []; - - for (var i = 0; i < vertices.length; i++) { - var prevVertex = vertices[i - 1 >= 0 ? i - 1 : vertices.length - 1], - vertex = vertices[i], - nextVertex = vertices[(i + 1) % vertices.length], - currentRadius = radius[i < radius.length ? i : radius.length - 1]; - - if (currentRadius === 0) { - newVertices.push(vertex); - continue; - } - - var prevNormal = Vector.normalise({ - x: vertex.y - prevVertex.y, - y: prevVertex.x - vertex.x, - }); - - var nextNormal = Vector.normalise({ - x: nextVertex.y - vertex.y, - y: vertex.x - nextVertex.x, - }); - - var diagonalRadius = Math.sqrt(2 * Math.pow(currentRadius, 2)), - radiusVector = Vector.mult(Common.clone(prevNormal), currentRadius), - midNormal = Vector.normalise(Vector.mult(Vector.add(prevNormal, nextNormal), 0.5)), - scaledVertex = Vector.sub(vertex, Vector.mult(midNormal, diagonalRadius)); - - var precision = quality; - - if (quality === -1) { - // automatically decide precision - precision = Math.pow(currentRadius, 0.32) * 1.75; - } - - precision = Common.clamp(precision, qualityMin, qualityMax); - - // use an even value for precision, more likely to reduce axes by using symmetry - if (precision % 2 === 1) precision += 1; - - var alpha = Math.acos(Vector.dot(prevNormal, nextNormal)), - theta = alpha / precision; - - for (var j = 0; j < precision; j++) { - newVertices.push(Vector.add(Vector.rotate(radiusVector, theta * j), scaledVertex)); - } - } - - return newVertices; - }; - - /** - * Sorts the input vertices into clockwise order in place. - * @method clockwiseSort - * @param {vertices} vertices - * @return {vertices} vertices - */ - Vertices.clockwiseSort = function (vertices) { - var centre = Vertices.mean(vertices); - - vertices.sort(function (vertexA, vertexB) { - return Vector.angle(centre, vertexA) - Vector.angle(centre, vertexB); - }); - - return vertices; - }; - - /** - * Returns true if the vertices form a convex shape (vertices must be in clockwise order). - * @method isConvex - * @param {vertices} vertices - * @return {bool} `true` if the `vertices` are convex, `false` if not (or `null` if not computable). - */ - Vertices.isConvex = function (vertices) { - // http://paulbourke.net/geometry/polygonmesh/ - // Copyright (c) Paul Bourke (use permitted) - - var flag = 0, - n = vertices.length, - i, - j, - k, - z; - - if (n < 3) return null; - - for (i = 0; i < n; i++) { - j = (i + 1) % n; - k = (i + 2) % n; - z = (vertices[j].x - vertices[i].x) * (vertices[k].y - vertices[j].y); - z -= (vertices[j].y - vertices[i].y) * (vertices[k].x - vertices[j].x); - - if (z < 0) { - flag |= 1; - } else if (z > 0) { - flag |= 2; - } - - if (flag === 3) { - return false; - } - } - - if (flag !== 0) { - return true; - } else { - return null; - } - }; - - /** - * Returns the convex hull of the input vertices as a new array of points. - * @method hull - * @param {vertices} vertices - * @return [vertex] vertices - */ - Vertices.hull = function (vertices) { - // http://geomalgorithms.com/a10-_hull-1.html - - var upper = [], - lower = [], - vertex, - i; - - // sort vertices on x-axis (y-axis for ties) - vertices = vertices.slice(0); - vertices.sort(function (vertexA, vertexB) { - var dx = vertexA.x - vertexB.x; - return dx !== 0 ? dx : vertexA.y - vertexB.y; - }); - - // build lower hull - for (i = 0; i < vertices.length; i += 1) { - vertex = vertices[i]; - - while ( - lower.length >= 2 && - Vector.cross3(lower[lower.length - 2], lower[lower.length - 1], vertex) <= 0 - ) { - lower.pop(); - } - - lower.push(vertex); - } - - // build upper hull - for (i = vertices.length - 1; i >= 0; i -= 1) { - vertex = vertices[i]; - - while ( - upper.length >= 2 && - Vector.cross3(upper[upper.length - 2], upper[upper.length - 1], vertex) <= 0 - ) { - upper.pop(); - } - - upper.push(vertex); - } - - // concatenation of the lower and upper hulls gives the convex hull - // omit last points because they are repeated at the beginning of the other list - upper.pop(); - lower.pop(); - - return upper.concat(lower); - }; - })(); - - /***/ - }, - /* 4 */ - /***/ function (module, exports, __webpack_require__) { - /** - * The `Matter.Events` module contains methods to fire and listen to events on other objects. - * - * See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples). - * - * @class Events - */ - - var Events = {}; - - module.exports = Events; - - var Common = __webpack_require__(0); - - (function () { - /** - * Subscribes a callback function to the given object's `eventName`. - * @method on - * @param {} object - * @param {string} eventNames - * @param {function} callback - */ - Events.on = function (object, eventNames, callback) { - var names = eventNames.split(' '), - name; - - for (var i = 0; i < names.length; i++) { - name = names[i]; - object.events = object.events || {}; - object.events[name] = object.events[name] || []; - object.events[name].push(callback); - } - - return callback; - }; - - /** - * Removes the given event callback. If no callback, clears all callbacks in `eventNames`. If no `eventNames`, clears all events. - * @method off - * @param {} object - * @param {string} eventNames - * @param {function} callback - */ - Events.off = function (object, eventNames, callback) { - if (!eventNames) { - object.events = {}; - return; - } - - // handle Events.off(object, callback) - if (typeof eventNames === 'function') { - callback = eventNames; - eventNames = Common.keys(object.events).join(' '); - } - - var names = eventNames.split(' '); - - for (var i = 0; i < names.length; i++) { - var callbacks = object.events[names[i]], - newCallbacks = []; - - if (callback && callbacks) { - for (var j = 0; j < callbacks.length; j++) { - if (callbacks[j] !== callback) newCallbacks.push(callbacks[j]); - } - } - - object.events[names[i]] = newCallbacks; - } - }; - - /** - * Fires all the callbacks subscribed to the given object's `eventName`, in the order they subscribed, if any. - * @method trigger - * @param {} object - * @param {string} eventNames - * @param {} event - */ - Events.trigger = function (object, eventNames, event) { - var names, name, callbacks, eventClone; - - var events = object.events; - - if (events && Common.keys(events).length > 0) { - if (!event) event = {}; - - names = eventNames.split(' '); - - for (var i = 0; i < names.length; i++) { - name = names[i]; - callbacks = events[name]; - - if (callbacks) { - eventClone = Common.clone(event, false); - eventClone.name = name; - eventClone.source = object; - - for (var j = 0; j < callbacks.length; j++) { - callbacks[j].apply(object, [eventClone]); - } - } - } - } - }; - })(); - - /***/ - }, - /* 5 */ - /***/ function (module, exports, __webpack_require__) { - /** - * The `Matter.Composite` module contains methods for creating and manipulating composite bodies. - * A composite body is a collection of `Matter.Body`, `Matter.Constraint` and other `Matter.Composite`, therefore composites form a tree structure. - * It is important to use the functions in this module to modify composites, rather than directly modifying their properties. - * Note that the `Matter.World` object is also a type of `Matter.Composite` and as such all composite methods here can also operate on a `Matter.World`. - * - * See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples). - * - * @class Composite - */ - - var Composite = {}; - - module.exports = Composite; - - var Events = __webpack_require__(4); - var Common = __webpack_require__(0); - var Bounds = __webpack_require__(1); - var Body = __webpack_require__(6); - - (function () { - /** - * Creates a new composite. The options parameter is an object that specifies any properties you wish to override the defaults. - * See the properites section below for detailed information on what you can pass via the `options` object. - * @method create - * @param {} [options] - * @return {composite} A new composite - */ - Composite.create = function (options) { - return Common.extend( - { - id: Common.nextId(), - type: 'composite', - parent: null, - isModified: false, - bodies: [], - constraints: [], - composites: [], - label: 'Composite', - plugin: {}, - }, - options, - ); - }; - - /** - * Sets the composite's `isModified` flag. - * If `updateParents` is true, all parents will be set (default: false). - * If `updateChildren` is true, all children will be set (default: false). - * @method setModified - * @param {composite} composite - * @param {boolean} isModified - * @param {boolean} [updateParents=false] - * @param {boolean} [updateChildren=false] - */ - Composite.setModified = function (composite, isModified, updateParents, updateChildren) { - composite.isModified = isModified; - - if (updateParents && composite.parent) { - Composite.setModified(composite.parent, isModified, updateParents, updateChildren); - } - - if (updateChildren) { - for (var i = 0; i < composite.composites.length; i++) { - var childComposite = composite.composites[i]; - Composite.setModified(childComposite, isModified, updateParents, updateChildren); - } - } - }; - - /** - * Generic add function. Adds one or many body(s), constraint(s) or a composite(s) to the given composite. - * Triggers `beforeAdd` and `afterAdd` events on the `composite`. - * @method add - * @param {composite} composite - * @param {} object - * @return {composite} The original composite with the objects added - */ - Composite.add = function (composite, object) { - var objects = [].concat(object); - - Events.trigger(composite, 'beforeAdd', {object: object}); - - for (var i = 0; i < objects.length; i++) { - var obj = objects[i]; - - switch (obj.type) { - case 'body': - // skip adding compound parts - if (obj.parent !== obj) { - Common.warn('Composite.add: skipped adding a compound body part (you must add its parent instead)'); - break; - } - - Composite.addBody(composite, obj); - break; - case 'constraint': - Composite.addConstraint(composite, obj); - break; - case 'composite': - Composite.addComposite(composite, obj); - break; - case 'mouseConstraint': - Composite.addConstraint(composite, obj.constraint); - break; - } - } - - Events.trigger(composite, 'afterAdd', {object: object}); - - return composite; - }; - - /** - * Generic remove function. Removes one or many body(s), constraint(s) or a composite(s) to the given composite. - * Optionally searching its children recursively. - * Triggers `beforeRemove` and `afterRemove` events on the `composite`. - * @method remove - * @param {composite} composite - * @param {} object - * @param {boolean} [deep=false] - * @return {composite} The original composite with the objects removed - */ - Composite.remove = function (composite, object, deep) { - var objects = [].concat(object); - - Events.trigger(composite, 'beforeRemove', {object: object}); - - for (var i = 0; i < objects.length; i++) { - var obj = objects[i]; - - switch (obj.type) { - case 'body': - Composite.removeBody(composite, obj, deep); - break; - case 'constraint': - Composite.removeConstraint(composite, obj, deep); - break; - case 'composite': - Composite.removeComposite(composite, obj, deep); - break; - case 'mouseConstraint': - Composite.removeConstraint(composite, obj.constraint); - break; - } - } - - Events.trigger(composite, 'afterRemove', {object: object}); - - return composite; - }; - - /** - * Adds a composite to the given composite. - * @private - * @method addComposite - * @param {composite} compositeA - * @param {composite} compositeB - * @return {composite} The original compositeA with the objects from compositeB added - */ - Composite.addComposite = function (compositeA, compositeB) { - compositeA.composites.push(compositeB); - compositeB.parent = compositeA; - Composite.setModified(compositeA, true, true, false); - return compositeA; - }; - - /** - * Removes a composite from the given composite, and optionally searching its children recursively. - * @private - * @method removeComposite - * @param {composite} compositeA - * @param {composite} compositeB - * @param {boolean} [deep=false] - * @return {composite} The original compositeA with the composite removed - */ - Composite.removeComposite = function (compositeA, compositeB, deep) { - var position = Common.indexOf(compositeA.composites, compositeB); - if (position !== -1) { - Composite.removeCompositeAt(compositeA, position); - Composite.setModified(compositeA, true, true, false); - } - - if (deep) { - for (var i = 0; i < compositeA.composites.length; i++) { - Composite.removeComposite(compositeA.composites[i], compositeB, true); - } - } - - return compositeA; - }; - - /** - * Removes a composite from the given composite. - * @private - * @method removeCompositeAt - * @param {composite} composite - * @param {number} position - * @return {composite} The original composite with the composite removed - */ - Composite.removeCompositeAt = function (composite, position) { - composite.composites.splice(position, 1); - Composite.setModified(composite, true, true, false); - return composite; - }; - - /** - * Adds a body to the given composite. - * @private - * @method addBody - * @param {composite} composite - * @param {body} body - * @return {composite} The original composite with the body added - */ - Composite.addBody = function (composite, body) { - composite.bodies.push(body); - Composite.setModified(composite, true, true, false); - return composite; - }; - - /** - * Removes a body from the given composite, and optionally searching its children recursively. - * @private - * @method removeBody - * @param {composite} composite - * @param {body} body - * @param {boolean} [deep=false] - * @return {composite} The original composite with the body removed - */ - Composite.removeBody = function (composite, body, deep) { - var position = Common.indexOf(composite.bodies, body); - if (position !== -1) { - Composite.removeBodyAt(composite, position); - Composite.setModified(composite, true, true, false); - } - - if (deep) { - for (var i = 0; i < composite.composites.length; i++) { - Composite.removeBody(composite.composites[i], body, true); - } - } - - return composite; - }; - - /** - * Removes a body from the given composite. - * @private - * @method removeBodyAt - * @param {composite} composite - * @param {number} position - * @return {composite} The original composite with the body removed - */ - Composite.removeBodyAt = function (composite, position) { - composite.bodies.splice(position, 1); - Composite.setModified(composite, true, true, false); - return composite; - }; - - /** - * Adds a constraint to the given composite. - * @private - * @method addConstraint - * @param {composite} composite - * @param {constraint} constraint - * @return {composite} The original composite with the constraint added - */ - Composite.addConstraint = function (composite, constraint) { - composite.constraints.push(constraint); - Composite.setModified(composite, true, true, false); - return composite; - }; - - /** - * Removes a constraint from the given composite, and optionally searching its children recursively. - * @private - * @method removeConstraint - * @param {composite} composite - * @param {constraint} constraint - * @param {boolean} [deep=false] - * @return {composite} The original composite with the constraint removed - */ - Composite.removeConstraint = function (composite, constraint, deep) { - var position = Common.indexOf(composite.constraints, constraint); - if (position !== -1) { - Composite.removeConstraintAt(composite, position); - } - - if (deep) { - for (var i = 0; i < composite.composites.length; i++) { - Composite.removeConstraint(composite.composites[i], constraint, true); - } - } - - return composite; - }; - - /** - * Removes a body from the given composite. - * @private - * @method removeConstraintAt - * @param {composite} composite - * @param {number} position - * @return {composite} The original composite with the constraint removed - */ - Composite.removeConstraintAt = function (composite, position) { - composite.constraints.splice(position, 1); - Composite.setModified(composite, true, true, false); - return composite; - }; - - /** - * Removes all bodies, constraints and composites from the given composite. - * Optionally clearing its children recursively. - * @method clear - * @param {composite} composite - * @param {boolean} keepStatic - * @param {boolean} [deep=false] - */ - Composite.clear = function (composite, keepStatic, deep) { - if (deep) { - for (var i = 0; i < composite.composites.length; i++) { - Composite.clear(composite.composites[i], keepStatic, true); - } - } - - if (keepStatic) { - composite.bodies = composite.bodies.filter(function (body) { - return body.isStatic; - }); - } else { - composite.bodies.length = 0; - } - - composite.constraints.length = 0; - composite.composites.length = 0; - Composite.setModified(composite, true, true, false); - - return composite; - }; - - /** - * Returns all bodies in the given composite, including all bodies in its children, recursively. - * @method allBodies - * @param {composite} composite - * @return {body[]} All the bodies - */ - Composite.allBodies = function (composite) { - var bodies = [].concat(composite.bodies); - - for (var i = 0; i < composite.composites.length; i++) - bodies = bodies.concat(Composite.allBodies(composite.composites[i])); - - return bodies; - }; - - /** - * Returns all constraints in the given composite, including all constraints in its children, recursively. - * @method allConstraints - * @param {composite} composite - * @return {constraint[]} All the constraints - */ - Composite.allConstraints = function (composite) { - var constraints = [].concat(composite.constraints); - - for (var i = 0; i < composite.composites.length; i++) - constraints = constraints.concat(Composite.allConstraints(composite.composites[i])); - - return constraints; - }; - - /** - * Returns all composites in the given composite, including all composites in its children, recursively. - * @method allComposites - * @param {composite} composite - * @return {composite[]} All the composites - */ - Composite.allComposites = function (composite) { - var composites = [].concat(composite.composites); - - for (var i = 0; i < composite.composites.length; i++) - composites = composites.concat(Composite.allComposites(composite.composites[i])); - - return composites; - }; - - /** - * Searches the composite recursively for an object matching the type and id supplied, null if not found. - * @method get - * @param {composite} composite - * @param {number} id - * @param {string} type - * @return {object} The requested object, if found - */ - Composite.get = function (composite, id, type) { - var objects, object; - - switch (type) { - case 'body': - objects = Composite.allBodies(composite); - break; - case 'constraint': - objects = Composite.allConstraints(composite); - break; - case 'composite': - objects = Composite.allComposites(composite).concat(composite); - break; - } - - if (!objects) return null; - - object = objects.filter(function (object) { - return object.id.toString() === id.toString(); - }); - - return object.length === 0 ? null : object[0]; - }; - - /** - * Moves the given object(s) from compositeA to compositeB (equal to a remove followed by an add). - * @method move - * @param {compositeA} compositeA - * @param {object[]} objects - * @param {compositeB} compositeB - * @return {composite} Returns compositeA - */ - Composite.move = function (compositeA, objects, compositeB) { - Composite.remove(compositeA, objects); - Composite.add(compositeB, objects); - return compositeA; - }; - - /** - * Assigns new ids for all objects in the composite, recursively. - * @method rebase - * @param {composite} composite - * @return {composite} Returns composite - */ - Composite.rebase = function (composite) { - var objects = Composite.allBodies(composite) - .concat(Composite.allConstraints(composite)) - .concat(Composite.allComposites(composite)); - - for (var i = 0; i < objects.length; i++) { - objects[i].id = Common.nextId(); - } - - Composite.setModified(composite, true, true, false); - - return composite; - }; - - /** - * Translates all children in the composite by a given vector relative to their current positions, - * without imparting any velocity. - * @method translate - * @param {composite} composite - * @param {vector} translation - * @param {bool} [recursive=true] - */ - Composite.translate = function (composite, translation, recursive) { - var bodies = recursive ? Composite.allBodies(composite) : composite.bodies; - - for (var i = 0; i < bodies.length; i++) { - Body.translate(bodies[i], translation); - } - - Composite.setModified(composite, true, true, false); - - return composite; - }; - - /** - * Rotates all children in the composite by a given angle about the given point, without imparting any angular velocity. - * @method rotate - * @param {composite} composite - * @param {number} rotation - * @param {vector} point - * @param {bool} [recursive=true] - */ - Composite.rotate = function (composite, rotation, point, recursive) { - var cos = Math.cos(rotation), - sin = Math.sin(rotation), - bodies = recursive ? Composite.allBodies(composite) : composite.bodies; - - for (var i = 0; i < bodies.length; i++) { - var body = bodies[i], - dx = body.position.x - point.x, - dy = body.position.y - point.y; - - Body.setPosition(body, { - x: point.x + (dx * cos - dy * sin), - y: point.y + (dx * sin + dy * cos), - }); - - Body.rotate(body, rotation); - } - - Composite.setModified(composite, true, true, false); - - return composite; - }; - - /** - * Scales all children in the composite, including updating physical properties (mass, area, axes, inertia), from a world-space point. - * @method scale - * @param {composite} composite - * @param {number} scaleX - * @param {number} scaleY - * @param {vector} point - * @param {bool} [recursive=true] - */ - Composite.scale = function (composite, scaleX, scaleY, point, recursive) { - var bodies = recursive ? Composite.allBodies(composite) : composite.bodies; - - for (var i = 0; i < bodies.length; i++) { - var body = bodies[i], - dx = body.position.x - point.x, - dy = body.position.y - point.y; - - Body.setPosition(body, { - x: point.x + dx * scaleX, - y: point.y + dy * scaleY, - }); - - Body.scale(body, scaleX, scaleY); - } - - Composite.setModified(composite, true, true, false); - - return composite; - }; - - /** - * Returns the union of the bounds of all of the composite's bodies. - * @method bounds - * @param {composite} composite The composite. - * @returns {bounds} The composite bounds. - */ - Composite.bounds = function (composite) { - var bodies = Composite.allBodies(composite), - vertices = []; - - for (var i = 0; i < bodies.length; i += 1) { - var body = bodies[i]; - vertices.push(body.bounds.min, body.bounds.max); - } - - return Bounds.create(vertices); - }; - - /* - * - * Events Documentation - * - */ - - /** - * Fired when a call to `Composite.add` is made, before objects have been added. - * - * @event beforeAdd - * @param {} event An event object - * @param {} event.object The object(s) to be added (may be a single body, constraint, composite or a mixed array of these) - * @param {} event.source The source object of the event - * @param {} event.name The name of the event - */ - - /** - * Fired when a call to `Composite.add` is made, after objects have been added. - * - * @event afterAdd - * @param {} event An event object - * @param {} event.object The object(s) that have been added (may be a single body, constraint, composite or a mixed array of these) - * @param {} event.source The source object of the event - * @param {} event.name The name of the event - */ - - /** - * Fired when a call to `Composite.remove` is made, before objects have been removed. - * - * @event beforeRemove - * @param {} event An event object - * @param {} event.object The object(s) to be removed (may be a single body, constraint, composite or a mixed array of these) - * @param {} event.source The source object of the event - * @param {} event.name The name of the event - */ - - /** - * Fired when a call to `Composite.remove` is made, after objects have been removed. - * - * @event afterRemove - * @param {} event An event object - * @param {} event.object The object(s) that have been removed (may be a single body, constraint, composite or a mixed array of these) - * @param {} event.source The source object of the event - * @param {} event.name The name of the event - */ - - /* - * - * Properties Documentation - * - */ - - /** - * An integer `Number` uniquely identifying number generated in `Composite.create` by `Common.nextId`. - * - * @property id - * @type number - */ - - /** - * A `String` denoting the type of object. - * - * @property type - * @type string - * @default "composite" - * @readOnly - */ - - /** - * An arbitrary `String` name to help the user identify and manage composites. - * - * @property label - * @type string - * @default "Composite" - */ - - /** - * A flag that specifies whether the composite has been modified during the current step. - * Most `Matter.Composite` methods will automatically set this flag to `true` to inform the engine of changes to be handled. - * If you need to change it manually, you should use the `Composite.setModified` method. - * - * @property isModified - * @type boolean - * @default false - */ - - /** - * The `Composite` that is the parent of this composite. It is automatically managed by the `Matter.Composite` methods. - * - * @property parent - * @type composite - * @default null - */ - - /** - * An array of `Body` that are _direct_ children of this composite. - * To add or remove bodies you should use `Composite.add` and `Composite.remove` methods rather than directly modifying this property. - * If you wish to recursively find all descendants, you should use the `Composite.allBodies` method. - * - * @property bodies - * @type body[] - * @default [] - */ - - /** - * An array of `Constraint` that are _direct_ children of this composite. - * To add or remove constraints you should use `Composite.add` and `Composite.remove` methods rather than directly modifying this property. - * If you wish to recursively find all descendants, you should use the `Composite.allConstraints` method. - * - * @property constraints - * @type constraint[] - * @default [] - */ - - /** - * An array of `Composite` that are _direct_ children of this composite. - * To add or remove composites you should use `Composite.add` and `Composite.remove` methods rather than directly modifying this property. - * If you wish to recursively find all descendants, you should use the `Composite.allComposites` method. - * - * @property composites - * @type composite[] - * @default [] - */ - - /** - * An object reserved for storing plugin-specific properties. - * - * @property plugin - * @type {} - */ - })(); - - /***/ - }, - /* 6 */ - /***/ function (module, exports, __webpack_require__) { - /** - * The `Matter.Body` module contains methods for creating and manipulating body models. - * A `Matter.Body` is a rigid body that can be simulated by a `Matter.Engine`. - * Factories for commonly used body configurations (such as rectangles, circles and other polygons) can be found in the module `Matter.Bodies`. - * - * See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples). - - * @class Body - */ - - var Body = {}; - - module.exports = Body; - - var Vertices = __webpack_require__(3); - var Vector = __webpack_require__(2); - var Sleeping = __webpack_require__(7); - __webpack_require__(10); - var Common = __webpack_require__(0); - var Bounds = __webpack_require__(1); - var Axes = __webpack_require__(15); - - (function () { - Body._inertiaScale = 4; - Body._nextCollidingGroupId = 1; - Body._nextNonCollidingGroupId = -1; - Body._nextCategory = 0x0001; - - /** - * Creates a new rigid body model. The options parameter is an object that specifies any properties you wish to override the defaults. - * All properties have default values, and many are pre-calculated automatically based on other properties. - * Vertices must be specified in clockwise order. - * See the properties section below for detailed information on what you can pass via the `options` object. - * @method create - * @param {} options - * @return {body} body - */ - Body.create = function (options) { - var defaults = { - id: Common.nextId(), - type: 'body', - label: 'Body', - parts: [], - plugin: {}, - angle: 0, - vertices: Vertices.fromPath('L 0 0 L 40 0 L 40 40 L 0 40'), - position: {x: 0, y: 0}, - force: {x: 0, y: 0}, - torque: 0, - positionImpulse: {x: 0, y: 0}, - constraintImpulse: {x: 0, y: 0, angle: 0}, - totalContacts: 0, - speed: 0, - angularSpeed: 0, - velocity: {x: 0, y: 0}, - angularVelocity: 0, - isSensor: false, - isStatic: false, - isSleeping: false, - motion: 0, - sleepThreshold: 60, - density: 0.001, - restitution: 0, - friction: 0.1, - frictionStatic: 0.5, - frictionAir: 0.01, - collisionFilter: { - category: 0x0001, - mask: 0xffffffff, - group: 0, - }, - slop: 0.05, - timeScale: 1, - render: { - visible: true, - opacity: 1, - sprite: { - xScale: 1, - yScale: 1, - xOffset: 0, - yOffset: 0, - }, - lineWidth: 0, - }, - events: null, - bounds: null, - chamfer: null, - circleRadius: 0, - positionPrev: null, - anglePrev: 0, - parent: null, - axes: null, - area: 0, - mass: 0, - inertia: 0, - _original: null, - }; - - var body = Common.extend(defaults, options); - - _initProperties(body, options); - - return body; - }; - - /** - * Returns the next unique group index for which bodies will collide. - * If `isNonColliding` is `true`, returns the next unique group index for which bodies will _not_ collide. - * See `body.collisionFilter` for more information. - * @method nextGroup - * @param {bool} [isNonColliding=false] - * @return {Number} Unique group index - */ - Body.nextGroup = function (isNonColliding) { - if (isNonColliding) return Body._nextNonCollidingGroupId--; - - return Body._nextCollidingGroupId++; - }; - - /** - * Returns the next unique category bitfield (starting after the initial default category `0x0001`). - * There are 32 available. See `body.collisionFilter` for more information. - * @method nextCategory - * @return {Number} Unique category bitfield - */ - Body.nextCategory = function () { - Body._nextCategory = Body._nextCategory << 1; - return Body._nextCategory; - }; - - /** - * Initialises body properties. - * @method _initProperties - * @private - * @param {body} body - * @param {} [options] - */ - var _initProperties = function (body, options) { - options = options || {}; - - // init required properties (order is important) - Body.set(body, { - bounds: body.bounds || Bounds.create(body.vertices), - positionPrev: body.positionPrev || Vector.clone(body.position), - anglePrev: body.anglePrev || body.angle, - vertices: body.vertices, - parts: body.parts || [body], - isStatic: body.isStatic, - isSleeping: body.isSleeping, - parent: body.parent || body, - }); - - Vertices.rotate(body.vertices, body.angle, body.position); - Axes.rotate(body.axes, body.angle); - Bounds.update(body.bounds, body.vertices, body.velocity); - - // allow options to override the automatically calculated properties - Body.set(body, { - axes: options.axes || body.axes, - area: options.area || body.area, - mass: options.mass || body.mass, - inertia: options.inertia || body.inertia, - }); - - // render properties - var defaultFillStyle = body.isStatic - ? '#2e2b44' - : Common.choose(['#006BA6', '#0496FF', '#FFBC42', '#D81159', '#8F2D56']), - defaultStrokeStyle = '#000'; - body.render.fillStyle = body.render.fillStyle || defaultFillStyle; - body.render.strokeStyle = body.render.strokeStyle || defaultStrokeStyle; - body.render.sprite.xOffset += - -(body.bounds.min.x - body.position.x) / (body.bounds.max.x - body.bounds.min.x); - body.render.sprite.yOffset += - -(body.bounds.min.y - body.position.y) / (body.bounds.max.y - body.bounds.min.y); - }; - - /** - * Given a property and a value (or map of), sets the property(s) on the body, using the appropriate setter functions if they exist. - * Prefer to use the actual setter functions in performance critical situations. - * @method set - * @param {body} body - * @param {} settings A property name (or map of properties and values) to set on the body. - * @param {} value The value to set if `settings` is a single property name. - */ - Body.set = function (body, settings, value) { - var property; - - if (typeof settings === 'string') { - property = settings; - settings = {}; - settings[property] = value; - } - - for (property in settings) { - if (!Object.prototype.hasOwnProperty.call(settings, property)) continue; - - value = settings[property]; - switch (property) { - case 'isStatic': - Body.setStatic(body, value); - break; - case 'isSleeping': - Sleeping.set(body, value); - break; - case 'mass': - Body.setMass(body, value); - break; - case 'density': - Body.setDensity(body, value); - break; - case 'inertia': - Body.setInertia(body, value); - break; - case 'vertices': - Body.setVertices(body, value); - break; - case 'position': - Body.setPosition(body, value); - break; - case 'angle': - Body.setAngle(body, value); - break; - case 'velocity': - Body.setVelocity(body, value); - break; - case 'angularVelocity': - Body.setAngularVelocity(body, value); - break; - case 'parts': - Body.setParts(body, value); - break; - case 'centre': - Body.setCentre(body, value); - break; - default: - body[property] = value; - } - } - }; - - /** - * Sets the body as static, including isStatic flag and setting mass and inertia to Infinity. - * @method setStatic - * @param {body} body - * @param {bool} isStatic - */ - Body.setStatic = function (body, isStatic) { - for (var i = 0; i < body.parts.length; i++) { - var part = body.parts[i]; - part.isStatic = isStatic; - - if (isStatic) { - part._original = { - restitution: part.restitution, - friction: part.friction, - mass: part.mass, - inertia: part.inertia, - density: part.density, - inverseMass: part.inverseMass, - inverseInertia: part.inverseInertia, - }; - - part.restitution = 0; - part.friction = 1; - part.mass = part.inertia = part.density = Infinity; - part.inverseMass = part.inverseInertia = 0; - - part.positionPrev.x = part.position.x; - part.positionPrev.y = part.position.y; - part.anglePrev = part.angle; - part.angularVelocity = 0; - part.speed = 0; - part.angularSpeed = 0; - part.motion = 0; - } else if (part._original) { - part.restitution = part._original.restitution; - part.friction = part._original.friction; - part.mass = part._original.mass; - part.inertia = part._original.inertia; - part.density = part._original.density; - part.inverseMass = part._original.inverseMass; - part.inverseInertia = part._original.inverseInertia; - - part._original = null; - } - } - }; - - /** - * Sets the mass of the body. Inverse mass, density and inertia are automatically updated to reflect the change. - * @method setMass - * @param {body} body - * @param {number} mass - */ - Body.setMass = function (body, mass) { - var moment = body.inertia / (body.mass / 6); - body.inertia = moment * (mass / 6); - body.inverseInertia = 1 / body.inertia; - - body.mass = mass; - body.inverseMass = 1 / body.mass; - body.density = body.mass / body.area; - }; - - /** - * Sets the density of the body. Mass and inertia are automatically updated to reflect the change. - * @method setDensity - * @param {body} body - * @param {number} density - */ - Body.setDensity = function (body, density) { - Body.setMass(body, density * body.area); - body.density = density; - }; - - /** - * Sets the moment of inertia (i.e. second moment of area) of the body. - * Inverse inertia is automatically updated to reflect the change. Mass is not changed. - * @method setInertia - * @param {body} body - * @param {number} inertia - */ - Body.setInertia = function (body, inertia) { - body.inertia = inertia; - body.inverseInertia = 1 / body.inertia; - }; - - /** - * Sets the body's vertices and updates body properties accordingly, including inertia, area and mass (with respect to `body.density`). - * Vertices will be automatically transformed to be orientated around their centre of mass as the origin. - * They are then automatically translated to world space based on `body.position`. - * - * The `vertices` argument should be passed as an array of `Matter.Vector` points (or a `Matter.Vertices` array). - * Vertices must form a convex hull, concave hulls are not supported. - * - * @method setVertices - * @param {body} body - * @param {vector[]} vertices - */ - Body.setVertices = function (body, vertices) { - // change vertices - if (vertices[0].body === body) { - body.vertices = vertices; - } else { - body.vertices = Vertices.create(vertices, body); - } - - // update properties - body.axes = Axes.fromVertices(body.vertices); - body.area = Vertices.area(body.vertices); - Body.setMass(body, body.density * body.area); - - // orient vertices around the centre of mass at origin (0, 0) - var centre = Vertices.centre(body.vertices); - Vertices.translate(body.vertices, centre, -1); - - // update inertia while vertices are at origin (0, 0) - Body.setInertia(body, Body._inertiaScale * Vertices.inertia(body.vertices, body.mass)); - - // update geometry - Vertices.translate(body.vertices, body.position); - Bounds.update(body.bounds, body.vertices, body.velocity); - }; - - /** - * Sets the parts of the `body` and updates mass, inertia and centroid. - * Each part will have its parent set to `body`. - * By default the convex hull will be automatically computed and set on `body`, unless `autoHull` is set to `false.` - * Note that this method will ensure that the first part in `body.parts` will always be the `body`. - * @method setParts - * @param {body} body - * @param [body] parts - * @param {bool} [autoHull=true] - */ - Body.setParts = function (body, parts, autoHull) { - var i; - - // add all the parts, ensuring that the first part is always the parent body - parts = parts.slice(0); - body.parts.length = 0; - body.parts.push(body); - body.parent = body; - - for (i = 0; i < parts.length; i++) { - var part = parts[i]; - if (part !== body) { - part.parent = body; - body.parts.push(part); - } - } - - if (body.parts.length === 1) return; - - autoHull = typeof autoHull !== 'undefined' ? autoHull : true; - - // find the convex hull of all parts to set on the parent body - if (autoHull) { - var vertices = []; - for (i = 0; i < parts.length; i++) { - vertices = vertices.concat(parts[i].vertices); - } - - Vertices.clockwiseSort(vertices); - - var hull = Vertices.hull(vertices), - hullCentre = Vertices.centre(hull); - - Body.setVertices(body, hull); - Vertices.translate(body.vertices, hullCentre); - } - - // sum the properties of all compound parts of the parent body - var total = Body._totalProperties(body); - - body.area = total.area; - body.parent = body; - body.position.x = total.centre.x; - body.position.y = total.centre.y; - body.positionPrev.x = total.centre.x; - body.positionPrev.y = total.centre.y; - - Body.setMass(body, total.mass); - Body.setInertia(body, total.inertia); - Body.setPosition(body, total.centre); - }; - - /** - * Set the centre of mass of the body. - * The `centre` is a vector in world-space unless `relative` is set, in which case it is a translation. - * The centre of mass is the point the body rotates about and can be used to simulate non-uniform density. - * This is equal to moving `body.position` but not the `body.vertices`. - * Invalid if the `centre` falls outside the body's convex hull. - * @method setCentre - * @param {body} body - * @param {vector} centre - * @param {bool} relative - */ - Body.setCentre = function (body, centre, relative) { - if (!relative) { - body.positionPrev.x = centre.x - (body.position.x - body.positionPrev.x); - body.positionPrev.y = centre.y - (body.position.y - body.positionPrev.y); - body.position.x = centre.x; - body.position.y = centre.y; - } else { - body.positionPrev.x += centre.x; - body.positionPrev.y += centre.y; - body.position.x += centre.x; - body.position.y += centre.y; - } - }; - - /** - * Sets the position of the body instantly. Velocity, angle, force etc. are unchanged. - * @method setPosition - * @param {body} body - * @param {vector} position - */ - Body.setPosition = function (body, position) { - var delta = Vector.sub(position, body.position); - body.positionPrev.x += delta.x; - body.positionPrev.y += delta.y; - - for (var i = 0; i < body.parts.length; i++) { - var part = body.parts[i]; - part.position.x += delta.x; - part.position.y += delta.y; - Vertices.translate(part.vertices, delta); - Bounds.update(part.bounds, part.vertices, body.velocity); - } - }; - - /** - * Sets the angle of the body instantly. Angular velocity, position, force etc. are unchanged. - * @method setAngle - * @param {body} body - * @param {number} angle - */ - Body.setAngle = function (body, angle) { - var delta = angle - body.angle; - body.anglePrev += delta; - - for (var i = 0; i < body.parts.length; i++) { - var part = body.parts[i]; - part.angle += delta; - Vertices.rotate(part.vertices, delta, body.position); - Axes.rotate(part.axes, delta); - Bounds.update(part.bounds, part.vertices, body.velocity); - if (i > 0) { - Vector.rotateAbout(part.position, delta, body.position, part.position); - } - } - }; - - /** - * Sets the linear velocity of the body instantly. Position, angle, force etc. are unchanged. See also `Body.applyForce`. - * @method setVelocity - * @param {body} body - * @param {vector} velocity - */ - Body.setVelocity = function (body, velocity) { - body.positionPrev.x = body.position.x - velocity.x; - body.positionPrev.y = body.position.y - velocity.y; - body.velocity.x = velocity.x; - body.velocity.y = velocity.y; - body.speed = Vector.magnitude(body.velocity); - }; - - /** - * Sets the angular velocity of the body instantly. Position, angle, force etc. are unchanged. See also `Body.applyForce`. - * @method setAngularVelocity - * @param {body} body - * @param {number} velocity - */ - Body.setAngularVelocity = function (body, velocity) { - body.anglePrev = body.angle - velocity; - body.angularVelocity = velocity; - body.angularSpeed = Math.abs(body.angularVelocity); - }; - - /** - * Moves a body by a given vector relative to its current position, without imparting any velocity. - * @method translate - * @param {body} body - * @param {vector} translation - */ - Body.translate = function (body, translation) { - Body.setPosition(body, Vector.add(body.position, translation)); - }; - - /** - * Rotates a body by a given angle relative to its current angle, without imparting any angular velocity. - * @method rotate - * @param {body} body - * @param {number} rotation - * @param {vector} [point] - */ - Body.rotate = function (body, rotation, point) { - if (!point) { - Body.setAngle(body, body.angle + rotation); - } else { - var cos = Math.cos(rotation), - sin = Math.sin(rotation), - dx = body.position.x - point.x, - dy = body.position.y - point.y; - - Body.setPosition(body, { - x: point.x + (dx * cos - dy * sin), - y: point.y + (dx * sin + dy * cos), - }); - - Body.setAngle(body, body.angle + rotation); - } - }; - - /** - * Scales the body, including updating physical properties (mass, area, axes, inertia), from a world-space point (default is body centre). - * @method scale - * @param {body} body - * @param {number} scaleX - * @param {number} scaleY - * @param {vector} [point] - */ - Body.scale = function (body, scaleX, scaleY, point) { - var totalArea = 0, - totalInertia = 0; - - point = point || body.position; - - for (var i = 0; i < body.parts.length; i++) { - var part = body.parts[i]; - - // scale vertices - Vertices.scale(part.vertices, scaleX, scaleY, point); - - // update properties - part.axes = Axes.fromVertices(part.vertices); - part.area = Vertices.area(part.vertices); - Body.setMass(part, body.density * part.area); - - // update inertia (requires vertices to be at origin) - Vertices.translate(part.vertices, {x: -part.position.x, y: -part.position.y}); - Body.setInertia(part, Body._inertiaScale * Vertices.inertia(part.vertices, part.mass)); - Vertices.translate(part.vertices, {x: part.position.x, y: part.position.y}); - - if (i > 0) { - totalArea += part.area; - totalInertia += part.inertia; - } - - // scale position - part.position.x = point.x + (part.position.x - point.x) * scaleX; - part.position.y = point.y + (part.position.y - point.y) * scaleY; - - // update bounds - Bounds.update(part.bounds, part.vertices, body.velocity); - } - - // handle parent body - if (body.parts.length > 1) { - body.area = totalArea; - - if (!body.isStatic) { - Body.setMass(body, body.density * totalArea); - Body.setInertia(body, totalInertia); - } - } - - // handle circles - if (body.circleRadius) { - if (scaleX === scaleY) { - body.circleRadius *= scaleX; - } else { - // body is no longer a circle - body.circleRadius = null; - } - } - }; - - /** - * Performs a simulation step for the given `body`, including updating position and angle using Verlet integration. - * @method update - * @param {body} body - * @param {number} deltaTime - * @param {number} timeScale - * @param {number} correction - */ - Body.update = function (body, deltaTime, timeScale, correction) { - var deltaTimeSquared = Math.pow(deltaTime * timeScale * body.timeScale, 2); - - // from the previous step - var frictionAir = 1 - body.frictionAir * timeScale * body.timeScale, - velocityPrevX = body.position.x - body.positionPrev.x, - velocityPrevY = body.position.y - body.positionPrev.y; - - // update velocity with Verlet integration - body.velocity.x = velocityPrevX * frictionAir * correction + (body.force.x / body.mass) * deltaTimeSquared; - body.velocity.y = velocityPrevY * frictionAir * correction + (body.force.y / body.mass) * deltaTimeSquared; - - body.positionPrev.x = body.position.x; - body.positionPrev.y = body.position.y; - body.position.x += body.velocity.x; - body.position.y += body.velocity.y; - - // update angular velocity with Verlet integration - body.angularVelocity = - (body.angle - body.anglePrev) * frictionAir * correction + - (body.torque / body.inertia) * deltaTimeSquared; - body.anglePrev = body.angle; - body.angle += body.angularVelocity; - - // track speed and acceleration - body.speed = Vector.magnitude(body.velocity); - body.angularSpeed = Math.abs(body.angularVelocity); - - // transform the body geometry - for (var i = 0; i < body.parts.length; i++) { - var part = body.parts[i]; - - Vertices.translate(part.vertices, body.velocity); - - if (i > 0) { - part.position.x += body.velocity.x; - part.position.y += body.velocity.y; - } - - if (body.angularVelocity !== 0) { - Vertices.rotate(part.vertices, body.angularVelocity, body.position); - Axes.rotate(part.axes, body.angularVelocity); - if (i > 0) { - Vector.rotateAbout(part.position, body.angularVelocity, body.position, part.position); - } - } - - Bounds.update(part.bounds, part.vertices, body.velocity); - } - }; - - /** - * Applies a force to a body from a given world-space position, including resulting torque. - * @method applyForce - * @param {body} body - * @param {vector} position - * @param {vector} force - */ - Body.applyForce = function (body, position, force) { - body.force.x += force.x; - body.force.y += force.y; - var offset = {x: position.x - body.position.x, y: position.y - body.position.y}; - body.torque += offset.x * force.y - offset.y * force.x; - }; - - /** - * Returns the sums of the properties of all compound parts of the parent body. - * @method _totalProperties - * @private - * @param {body} body - * @return {} - */ - Body._totalProperties = function (body) { - // from equations at: - // https://ecourses.ou.edu/cgi-bin/ebook.cgi?doc=&topic=st&chap_sec=07.2&page=theory - // http://output.to/sideway/default.asp?qno=121100087 - - var properties = { - mass: 0, - area: 0, - inertia: 0, - centre: {x: 0, y: 0}, - }; - - // sum the properties of all compound parts of the parent body - for (var i = body.parts.length === 1 ? 0 : 1; i < body.parts.length; i++) { - var part = body.parts[i], - mass = part.mass !== Infinity ? part.mass : 1; - - properties.mass += mass; - properties.area += part.area; - properties.inertia += part.inertia; - properties.centre = Vector.add(properties.centre, Vector.mult(part.position, mass)); - } - - properties.centre = Vector.div(properties.centre, properties.mass); - - return properties; - }; - - /* - * - * Events Documentation - * - */ - - /** - * Fired when a body starts sleeping (where `this` is the body). - * - * @event sleepStart - * @this {body} The body that has started sleeping - * @param {} event An event object - * @param {} event.source The source object of the event - * @param {} event.name The name of the event - */ - - /** - * Fired when a body ends sleeping (where `this` is the body). - * - * @event sleepEnd - * @this {body} The body that has ended sleeping - * @param {} event An event object - * @param {} event.source The source object of the event - * @param {} event.name The name of the event - */ - - /* - * - * Properties Documentation - * - */ - - /** - * An integer `Number` uniquely identifying number generated in `Body.create` by `Common.nextId`. - * - * @property id - * @type number - */ - - /** - * A `String` denoting the type of object. - * - * @property type - * @type string - * @default "body" - * @readOnly - */ - - /** - * An arbitrary `String` name to help the user identify and manage bodies. - * - * @property label - * @type string - * @default "Body" - */ - - /** - * An array of bodies that make up this body. - * The first body in the array must always be a self reference to the current body instance. - * All bodies in the `parts` array together form a single rigid compound body. - * Parts are allowed to overlap, have gaps or holes or even form concave bodies. - * Parts themselves should never be added to a `World`, only the parent body should be. - * Use `Body.setParts` when setting parts to ensure correct updates of all properties. - * - * @property parts - * @type body[] - */ - - /** - * An object reserved for storing plugin-specific properties. - * - * @property plugin - * @type {} - */ - - /** - * A self reference if the body is _not_ a part of another body. - * Otherwise this is a reference to the body that this is a part of. - * See `body.parts`. - * - * @property parent - * @type body - */ - - /** - * A `Number` specifying the angle of the body, in radians. - * - * @property angle - * @type number - * @default 0 - */ - - /** - * An array of `Vector` objects that specify the convex hull of the rigid body. - * These should be provided about the origin `(0, 0)`. E.g. - * - * [{ x: 0, y: 0 }, { x: 25, y: 50 }, { x: 50, y: 0 }] - * - * When passed via `Body.create`, the vertices are translated relative to `body.position` (i.e. world-space, and constantly updated by `Body.update` during simulation). - * The `Vector` objects are also augmented with additional properties required for efficient collision detection. - * - * Other properties such as `inertia` and `bounds` are automatically calculated from the passed vertices (unless provided via `options`). - * Concave hulls are not currently supported. The module `Matter.Vertices` contains useful methods for working with vertices. - * - * @property vertices - * @type vector[] - */ - - /** - * A `Vector` that specifies the current world-space position of the body. - * - * @property position - * @type vector - * @default { x: 0, y: 0 } - */ - - /** - * A `Vector` that specifies the force to apply in the current step. It is zeroed after every `Body.update`. See also `Body.applyForce`. - * - * @property force - * @type vector - * @default { x: 0, y: 0 } - */ - - /** - * A `Number` that specifies the torque (turning force) to apply in the current step. It is zeroed after every `Body.update`. - * - * @property torque - * @type number - * @default 0 - */ - - /** - * A `Number` that _measures_ the current speed of the body after the last `Body.update`. It is read-only and always positive (it's the magnitude of `body.velocity`). - * - * @readOnly - * @property speed - * @type number - * @default 0 - */ - - /** - * A `Number` that _measures_ the current angular speed of the body after the last `Body.update`. It is read-only and always positive (it's the magnitude of `body.angularVelocity`). - * - * @readOnly - * @property angularSpeed - * @type number - * @default 0 - */ - - /** - * A `Vector` that _measures_ the current velocity of the body after the last `Body.update`. It is read-only. - * If you need to modify a body's velocity directly, you should either apply a force or simply change the body's `position` (as the engine uses position-Verlet integration). - * - * @readOnly - * @property velocity - * @type vector - * @default { x: 0, y: 0 } - */ - - /** - * A `Number` that _measures_ the current angular velocity of the body after the last `Body.update`. It is read-only. - * If you need to modify a body's angular velocity directly, you should apply a torque or simply change the body's `angle` (as the engine uses position-Verlet integration). - * - * @readOnly - * @property angularVelocity - * @type number - * @default 0 - */ - - /** - * A flag that indicates whether a body is considered static. A static body can never change position or angle and is completely fixed. - * If you need to set a body as static after its creation, you should use `Body.setStatic` as this requires more than just setting this flag. - * - * @property isStatic - * @type boolean - * @default false - */ - - /** - * A flag that indicates whether a body is a sensor. Sensor triggers collision events, but doesn't react with colliding body physically. - * - * @property isSensor - * @type boolean - * @default false - */ - - /** - * A flag that indicates whether the body is considered sleeping. A sleeping body acts similar to a static body, except it is only temporary and can be awoken. - * If you need to set a body as sleeping, you should use `Sleeping.set` as this requires more than just setting this flag. - * - * @property isSleeping - * @type boolean - * @default false - */ - - /** - * A `Number` that _measures_ the amount of movement a body currently has (a combination of `speed` and `angularSpeed`). It is read-only and always positive. - * It is used and updated by the `Matter.Sleeping` module during simulation to decide if a body has come to rest. - * - * @readOnly - * @property motion - * @type number - * @default 0 - */ - - /** - * A `Number` that defines the number of updates in which this body must have near-zero velocity before it is set as sleeping by the `Matter.Sleeping` module (if sleeping is enabled by the engine). - * - * @property sleepThreshold - * @type number - * @default 60 - */ - - /** - * A `Number` that defines the density of the body, that is its mass per unit area. - * If you pass the density via `Body.create` the `mass` property is automatically calculated for you based on the size (area) of the object. - * This is generally preferable to simply setting mass and allows for more intuitive definition of materials (e.g. rock has a higher density than wood). - * - * @property density - * @type number - * @default 0.001 - */ - - /** - * A `Number` that defines the mass of the body, although it may be more appropriate to specify the `density` property instead. - * If you modify this value, you must also modify the `body.inverseMass` property (`1 / mass`). - * - * @property mass - * @type number - */ - - /** - * A `Number` that defines the inverse mass of the body (`1 / mass`). - * If you modify this value, you must also modify the `body.mass` property. - * - * @property inverseMass - * @type number - */ - - /** - * A `Number` that defines the moment of inertia (i.e. second moment of area) of the body. - * It is automatically calculated from the given convex hull (`vertices` array) and density in `Body.create`. - * If you modify this value, you must also modify the `body.inverseInertia` property (`1 / inertia`). - * - * @property inertia - * @type number - */ - - /** - * A `Number` that defines the inverse moment of inertia of the body (`1 / inertia`). - * If you modify this value, you must also modify the `body.inertia` property. - * - * @property inverseInertia - * @type number - */ - - /** - * A `Number` that defines the restitution (elasticity) of the body. The value is always positive and is in the range `(0, 1)`. - * A value of `0` means collisions may be perfectly inelastic and no bouncing may occur. - * A value of `0.8` means the body may bounce back with approximately 80% of its kinetic energy. - * Note that collision response is based on _pairs_ of bodies, and that `restitution` values are _combined_ with the following formula: - * - * Math.max(bodyA.restitution, bodyB.restitution) - * - * @property restitution - * @type number - * @default 0 - */ - - /** - * A `Number` that defines the friction of the body. The value is always positive and is in the range `(0, 1)`. - * A value of `0` means that the body may slide indefinitely. - * A value of `1` means the body may come to a stop almost instantly after a force is applied. - * - * The effects of the value may be non-linear. - * High values may be unstable depending on the body. - * The engine uses a Coulomb friction model including static and kinetic friction. - * Note that collision response is based on _pairs_ of bodies, and that `friction` values are _combined_ with the following formula: - * - * Math.min(bodyA.friction, bodyB.friction) - * - * @property friction - * @type number - * @default 0.1 - */ - - /** - * A `Number` that defines the static friction of the body (in the Coulomb friction model). - * A value of `0` means the body will never 'stick' when it is nearly stationary and only dynamic `friction` is used. - * The higher the value (e.g. `10`), the more force it will take to initially get the body moving when nearly stationary. - * This value is multiplied with the `friction` property to make it easier to change `friction` and maintain an appropriate amount of static friction. - * - * @property frictionStatic - * @type number - * @default 0.5 - */ - - /** - * A `Number` that defines the air friction of the body (air resistance). - * A value of `0` means the body will never slow as it moves through space. - * The higher the value, the faster a body slows when moving through space. - * The effects of the value are non-linear. - * - * @property frictionAir - * @type number - * @default 0.01 - */ - - /** - * An `Object` that specifies the collision filtering properties of this body. - * - * Collisions between two bodies will obey the following rules: - * - If the two bodies have the same non-zero value of `collisionFilter.group`, - * they will always collide if the value is positive, and they will never collide - * if the value is negative. - * - If the two bodies have different values of `collisionFilter.group` or if one - * (or both) of the bodies has a value of 0, then the category/mask rules apply as follows: - * - * Each body belongs to a collision category, given by `collisionFilter.category`. This - * value is used as a bit field and the category should have only one bit set, meaning that - * the value of this property is a power of two in the range [1, 2^31]. Thus, there are 32 - * different collision categories available. - * - * Each body also defines a collision bitmask, given by `collisionFilter.mask` which specifies - * the categories it collides with (the value is the bitwise AND value of all these categories). - * - * Using the category/mask rules, two bodies `A` and `B` collide if each includes the other's - * category in its mask, i.e. `(categoryA & maskB) !== 0` and `(categoryB & maskA) !== 0` - * are both true. - * - * @property collisionFilter - * @type object - */ - - /** - * An Integer `Number`, that specifies the collision group this body belongs to. - * See `body.collisionFilter` for more information. - * - * @property collisionFilter.group - * @type object - * @default 0 - */ - - /** - * A bit field that specifies the collision category this body belongs to. - * The category value should have only one bit set, for example `0x0001`. - * This means there are up to 32 unique collision categories available. - * See `body.collisionFilter` for more information. - * - * @property collisionFilter.category - * @type object - * @default 1 - */ - - /** - * A bit mask that specifies the collision categories this body may collide with. - * See `body.collisionFilter` for more information. - * - * @property collisionFilter.mask - * @type object - * @default -1 - */ - - /** - * A `Number` that specifies a tolerance on how far a body is allowed to 'sink' or rotate into other bodies. - * Avoid changing this value unless you understand the purpose of `slop` in physics engines. - * The default should generally suffice, although very large bodies may require larger values for stable stacking. - * - * @property slop - * @type number - * @default 0.05 - */ - - /** - * A `Number` that allows per-body time scaling, e.g. a force-field where bodies inside are in slow-motion, while others are at full speed. - * - * @property timeScale - * @type number - * @default 1 - */ - - /** - * An `Object` that defines the rendering properties to be consumed by the module `Matter.Render`. - * - * @property render - * @type object - */ - - /** - * A flag that indicates if the body should be rendered. - * - * @property render.visible - * @type boolean - * @default true - */ - - /** - * Sets the opacity to use when rendering. - * - * @property render.opacity - * @type number - * @default 1 - */ - - /** - * An `Object` that defines the sprite properties to use when rendering, if any. - * - * @property render.sprite - * @type object - */ - - /** - * An `String` that defines the path to the image to use as the sprite texture, if any. - * - * @property render.sprite.texture - * @type string - */ - - /** - * A `Number` that defines the scaling in the x-axis for the sprite, if any. - * - * @property render.sprite.xScale - * @type number - * @default 1 - */ - - /** - * A `Number` that defines the scaling in the y-axis for the sprite, if any. - * - * @property render.sprite.yScale - * @type number - * @default 1 - */ - - /** - * A `Number` that defines the offset in the x-axis for the sprite (normalised by texture width). - * - * @property render.sprite.xOffset - * @type number - * @default 0 - */ - - /** - * A `Number` that defines the offset in the y-axis for the sprite (normalised by texture height). - * - * @property render.sprite.yOffset - * @type number - * @default 0 - */ - - /** - * A `Number` that defines the line width to use when rendering the body outline (if a sprite is not defined). - * A value of `0` means no outline will be rendered. - * - * @property render.lineWidth - * @type number - * @default 0 - */ - - /** - * A `String` that defines the fill style to use when rendering the body (if a sprite is not defined). - * It is the same as when using a canvas, so it accepts CSS style property values. - * - * @property render.fillStyle - * @type string - * @default a random colour - */ - - /** - * A `String` that defines the stroke style to use when rendering the body outline (if a sprite is not defined). - * It is the same as when using a canvas, so it accepts CSS style property values. - * - * @property render.strokeStyle - * @type string - * @default a random colour - */ - - /** - * An array of unique axis vectors (edge normals) used for collision detection. - * These are automatically calculated from the given convex hull (`vertices` array) in `Body.create`. - * They are constantly updated by `Body.update` during the simulation. - * - * @property axes - * @type vector[] - */ - - /** - * A `Number` that _measures_ the area of the body's convex hull, calculated at creation by `Body.create`. - * - * @property area - * @type string - * @default - */ - - /** - * A `Bounds` object that defines the AABB region for the body. - * It is automatically calculated from the given convex hull (`vertices` array) in `Body.create` and constantly updated by `Body.update` during simulation. - * - * @property bounds - * @type bounds - */ - })(); - - /***/ - }, - /* 7 */ - /***/ function (module, exports, __webpack_require__) { - /** - * The `Matter.Sleeping` module contains methods to manage the sleeping state of bodies. - * - * @class Sleeping - */ - - var Sleeping = {}; - - module.exports = Sleeping; - - var Events = __webpack_require__(4); - - (function () { - Sleeping._motionWakeThreshold = 0.18; - Sleeping._motionSleepThreshold = 0.08; - Sleeping._minBias = 0.9; - - /** - * Puts bodies to sleep or wakes them up depending on their motion. - * @method update - * @param {body[]} bodies - * @param {number} timeScale - */ - Sleeping.update = function (bodies, timeScale) { - var timeFactor = timeScale * timeScale * timeScale; - - // update bodies sleeping status - for (var i = 0; i < bodies.length; i++) { - var body = bodies[i], - motion = body.speed * body.speed + body.angularSpeed * body.angularSpeed; - - // wake up bodies if they have a force applied - if (body.force.x !== 0 || body.force.y !== 0) { - Sleeping.set(body, false); - continue; - } - - var minMotion = Math.min(body.motion, motion), - maxMotion = Math.max(body.motion, motion); - - // biased average motion estimation between frames - body.motion = Sleeping._minBias * minMotion + (1 - Sleeping._minBias) * maxMotion; - - if (body.sleepThreshold > 0 && body.motion < Sleeping._motionSleepThreshold * timeFactor) { - body.sleepCounter += 1; - - if (body.sleepCounter >= body.sleepThreshold) Sleeping.set(body, true); - } else if (body.sleepCounter > 0) { - body.sleepCounter -= 1; - } - } - }; - - /** - * Given a set of colliding pairs, wakes the sleeping bodies involved. - * @method afterCollisions - * @param {pair[]} pairs - * @param {number} timeScale - */ - Sleeping.afterCollisions = function (pairs, timeScale) { - var timeFactor = timeScale * timeScale * timeScale; - - // wake up bodies involved in collisions - for (var i = 0; i < pairs.length; i++) { - var pair = pairs[i]; - - // don't wake inactive pairs - if (!pair.isActive) continue; - - var collision = pair.collision, - bodyA = collision.bodyA.parent, - bodyB = collision.bodyB.parent; - - // don't wake if at least one body is static - if ((bodyA.isSleeping && bodyB.isSleeping) || bodyA.isStatic || bodyB.isStatic) continue; - - if (bodyA.isSleeping || bodyB.isSleeping) { - var sleepingBody = bodyA.isSleeping && !bodyA.isStatic ? bodyA : bodyB, - movingBody = sleepingBody === bodyA ? bodyB : bodyA; - - if (!sleepingBody.isStatic && movingBody.motion > Sleeping._motionWakeThreshold * timeFactor) { - Sleeping.set(sleepingBody, false); - } - } - } - }; - - /** - * Set a body as sleeping or awake. - * @method set - * @param {body} body - * @param {boolean} isSleeping - */ - Sleeping.set = function (body, isSleeping) { - var wasSleeping = body.isSleeping; - - if (isSleeping) { - body.isSleeping = true; - body.sleepCounter = body.sleepThreshold; - - body.positionImpulse.x = 0; - body.positionImpulse.y = 0; - - body.positionPrev.x = body.position.x; - body.positionPrev.y = body.position.y; - - body.anglePrev = body.angle; - body.speed = 0; - body.angularSpeed = 0; - body.motion = 0; - - if (!wasSleeping) { - Events.trigger(body, 'sleepStart'); - } - } else { - body.isSleeping = false; - body.sleepCounter = 0; - - if (wasSleeping) { - Events.trigger(body, 'sleepEnd'); - } - } - }; - })(); - - /***/ - }, - /* 8 */ - /***/ function (module, exports, __webpack_require__) { - /** - * The `Matter.Constraint` module contains methods for creating and manipulating constraints. - * Constraints are used for specifying that a fixed distance must be maintained between two bodies (or a body and a fixed world-space position). - * The stiffness of constraints can be modified to create springs or elastic. - * - * See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples). - * - * @class Constraint - */ - - var Constraint = {}; - - module.exports = Constraint; - - var Vertices = __webpack_require__(3); - var Vector = __webpack_require__(2); - var Sleeping = __webpack_require__(7); - var Bounds = __webpack_require__(1); - var Axes = __webpack_require__(15); - var Common = __webpack_require__(0); - - (function () { - Constraint._warming = 0.4; - Constraint._torqueDampen = 1; - Constraint._minLength = 0.000001; - - /** - * Creates a new constraint. - * All properties have default values, and many are pre-calculated automatically based on other properties. - * To simulate a revolute constraint (or pin joint) set `length: 0` and a high `stiffness` value (e.g. `0.7` or above). - * If the constraint is unstable, try lowering the `stiffness` value and / or increasing `engine.constraintIterations`. - * For compound bodies, constraints must be applied to the parent body (not one of its parts). - * See the properties section below for detailed information on what you can pass via the `options` object. - * @method create - * @param {} options - * @return {constraint} constraint - */ - Constraint.create = function (options) { - var constraint = options; - - // if bodies defined but no points, use body centre - if (constraint.bodyA && !constraint.pointA) constraint.pointA = {x: 0, y: 0}; - if (constraint.bodyB && !constraint.pointB) constraint.pointB = {x: 0, y: 0}; - - // calculate static length using initial world space points - var initialPointA = constraint.bodyA - ? Vector.add(constraint.bodyA.position, constraint.pointA) - : constraint.pointA, - initialPointB = constraint.bodyB - ? Vector.add(constraint.bodyB.position, constraint.pointB) - : constraint.pointB, - length = Vector.magnitude(Vector.sub(initialPointA, initialPointB)); - - constraint.length = typeof constraint.length !== 'undefined' ? constraint.length : length; - - // option defaults - constraint.id = constraint.id || Common.nextId(); - constraint.label = constraint.label || 'Constraint'; - constraint.type = 'constraint'; - constraint.stiffness = constraint.stiffness || (constraint.length > 0 ? 1 : 0.7); - constraint.damping = constraint.damping || 0; - constraint.angularStiffness = constraint.angularStiffness || 0; - constraint.angleA = constraint.bodyA ? constraint.bodyA.angle : constraint.angleA; - constraint.angleB = constraint.bodyB ? constraint.bodyB.angle : constraint.angleB; - constraint.plugin = {}; - - // render - var render = { - visible: true, - lineWidth: 2, - strokeStyle: '#ffffff', - type: 'line', - anchors: true, - }; - - if (constraint.length === 0 && constraint.stiffness > 0.1) { - render.type = 'pin'; - render.anchors = false; - } else if (constraint.stiffness < 0.9) { - render.type = 'spring'; - } - - constraint.render = Common.extend(render, constraint.render); - - return constraint; - }; - - /** - * Prepares for solving by constraint warming. - * @private - * @method preSolveAll - * @param {body[]} bodies - */ - Constraint.preSolveAll = function (bodies) { - for (var i = 0; i < bodies.length; i += 1) { - var body = bodies[i], - impulse = body.constraintImpulse; - - if (body.isStatic || (impulse.x === 0 && impulse.y === 0 && impulse.angle === 0)) { - continue; - } - - body.position.x += impulse.x; - body.position.y += impulse.y; - body.angle += impulse.angle; - } - }; - - /** - * Solves all constraints in a list of collisions. - * @private - * @method solveAll - * @param {constraint[]} constraints - * @param {number} timeScale - */ - Constraint.solveAll = function (constraints, timeScale) { - // Solve fixed constraints first. - for (var i = 0; i < constraints.length; i += 1) { - var constraint = constraints[i], - fixedA = !constraint.bodyA || (constraint.bodyA && constraint.bodyA.isStatic), - fixedB = !constraint.bodyB || (constraint.bodyB && constraint.bodyB.isStatic); - - if (fixedA || fixedB) { - Constraint.solve(constraints[i], timeScale); - } - } - - // Solve free constraints last. - for (i = 0; i < constraints.length; i += 1) { - constraint = constraints[i]; - fixedA = !constraint.bodyA || (constraint.bodyA && constraint.bodyA.isStatic); - fixedB = !constraint.bodyB || (constraint.bodyB && constraint.bodyB.isStatic); - - if (!fixedA && !fixedB) { - Constraint.solve(constraints[i], timeScale); - } - } - }; - - /** - * Solves a distance constraint with Gauss-Siedel method. - * @private - * @method solve - * @param {constraint} constraint - * @param {number} timeScale - */ - Constraint.solve = function (constraint, timeScale) { - var bodyA = constraint.bodyA, - bodyB = constraint.bodyB, - pointA = constraint.pointA, - pointB = constraint.pointB; - - if (!bodyA && !bodyB) return; - - // update reference angle - if (bodyA && !bodyA.isStatic) { - Vector.rotate(pointA, bodyA.angle - constraint.angleA, pointA); - constraint.angleA = bodyA.angle; - } - - // update reference angle - if (bodyB && !bodyB.isStatic) { - Vector.rotate(pointB, bodyB.angle - constraint.angleB, pointB); - constraint.angleB = bodyB.angle; - } - - var pointAWorld = pointA, - pointBWorld = pointB; - - if (bodyA) pointAWorld = Vector.add(bodyA.position, pointA); - if (bodyB) pointBWorld = Vector.add(bodyB.position, pointB); - - if (!pointAWorld || !pointBWorld) return; - - var delta = Vector.sub(pointAWorld, pointBWorld), - currentLength = Vector.magnitude(delta); - - // prevent singularity - if (currentLength < Constraint._minLength) { - currentLength = Constraint._minLength; - } - - // solve distance constraint with Gauss-Siedel method - var difference = (currentLength - constraint.length) / currentLength, - stiffness = constraint.stiffness < 1 ? constraint.stiffness * timeScale : constraint.stiffness, - force = Vector.mult(delta, difference * stiffness), - massTotal = (bodyA ? bodyA.inverseMass : 0) + (bodyB ? bodyB.inverseMass : 0), - inertiaTotal = (bodyA ? bodyA.inverseInertia : 0) + (bodyB ? bodyB.inverseInertia : 0), - resistanceTotal = massTotal + inertiaTotal, - torque, - share, - normal, - normalVelocity, - relativeVelocity; - - if (constraint.damping) { - var zero = Vector.create(); - normal = Vector.div(delta, currentLength); - - relativeVelocity = Vector.sub( - (bodyB && Vector.sub(bodyB.position, bodyB.positionPrev)) || zero, - (bodyA && Vector.sub(bodyA.position, bodyA.positionPrev)) || zero, - ); - - normalVelocity = Vector.dot(normal, relativeVelocity); - } - - if (bodyA && !bodyA.isStatic) { - share = bodyA.inverseMass / massTotal; - - // keep track of applied impulses for post solving - bodyA.constraintImpulse.x -= force.x * share; - bodyA.constraintImpulse.y -= force.y * share; - - // apply forces - bodyA.position.x -= force.x * share; - bodyA.position.y -= force.y * share; - - // apply damping - if (constraint.damping) { - bodyA.positionPrev.x -= constraint.damping * normal.x * normalVelocity * share; - bodyA.positionPrev.y -= constraint.damping * normal.y * normalVelocity * share; - } - - // apply torque - torque = - (Vector.cross(pointA, force) / resistanceTotal) * - Constraint._torqueDampen * - bodyA.inverseInertia * - (1 - constraint.angularStiffness); - bodyA.constraintImpulse.angle -= torque; - bodyA.angle -= torque; - } - - if (bodyB && !bodyB.isStatic) { - share = bodyB.inverseMass / massTotal; - - // keep track of applied impulses for post solving - bodyB.constraintImpulse.x += force.x * share; - bodyB.constraintImpulse.y += force.y * share; - - // apply forces - bodyB.position.x += force.x * share; - bodyB.position.y += force.y * share; - - // apply damping - if (constraint.damping) { - bodyB.positionPrev.x += constraint.damping * normal.x * normalVelocity * share; - bodyB.positionPrev.y += constraint.damping * normal.y * normalVelocity * share; - } - - // apply torque - torque = - (Vector.cross(pointB, force) / resistanceTotal) * - Constraint._torqueDampen * - bodyB.inverseInertia * - (1 - constraint.angularStiffness); - bodyB.constraintImpulse.angle += torque; - bodyB.angle += torque; - } - }; - - /** - * Performs body updates required after solving constraints. - * @private - * @method postSolveAll - * @param {body[]} bodies - */ - Constraint.postSolveAll = function (bodies) { - for (var i = 0; i < bodies.length; i++) { - var body = bodies[i], - impulse = body.constraintImpulse; - - if (body.isStatic || (impulse.x === 0 && impulse.y === 0 && impulse.angle === 0)) { - continue; - } - - Sleeping.set(body, false); - - // update geometry and reset - for (var j = 0; j < body.parts.length; j++) { - var part = body.parts[j]; - - Vertices.translate(part.vertices, impulse); - - if (j > 0) { - part.position.x += impulse.x; - part.position.y += impulse.y; - } - - if (impulse.angle !== 0) { - Vertices.rotate(part.vertices, impulse.angle, body.position); - Axes.rotate(part.axes, impulse.angle); - if (j > 0) { - Vector.rotateAbout(part.position, impulse.angle, body.position, part.position); - } - } - - Bounds.update(part.bounds, part.vertices, body.velocity); - } - - // dampen the cached impulse for warming next step - impulse.angle *= Constraint._warming; - impulse.x *= Constraint._warming; - impulse.y *= Constraint._warming; - } - }; - - /** - * Returns the world-space position of `constraint.pointA`, accounting for `constraint.bodyA`. - * @method pointAWorld - * @param {constraint} constraint - * @returns {vector} the world-space position - */ - Constraint.pointAWorld = function (constraint) { - return { - x: (constraint.bodyA ? constraint.bodyA.position.x : 0) + constraint.pointA.x, - y: (constraint.bodyA ? constraint.bodyA.position.y : 0) + constraint.pointA.y, - }; - }; - - /** - * Returns the world-space position of `constraint.pointB`, accounting for `constraint.bodyB`. - * @method pointBWorld - * @param {constraint} constraint - * @returns {vector} the world-space position - */ - Constraint.pointBWorld = function (constraint) { - return { - x: (constraint.bodyB ? constraint.bodyB.position.x : 0) + constraint.pointB.x, - y: (constraint.bodyB ? constraint.bodyB.position.y : 0) + constraint.pointB.y, - }; - }; - - /* - * - * Properties Documentation - * - */ - - /** - * An integer `Number` uniquely identifying number generated in `Composite.create` by `Common.nextId`. - * - * @property id - * @type number - */ - - /** - * A `String` denoting the type of object. - * - * @property type - * @type string - * @default "constraint" - * @readOnly - */ - - /** - * An arbitrary `String` name to help the user identify and manage bodies. - * - * @property label - * @type string - * @default "Constraint" - */ - - /** - * An `Object` that defines the rendering properties to be consumed by the module `Matter.Render`. - * - * @property render - * @type object - */ - - /** - * A flag that indicates if the constraint should be rendered. - * - * @property render.visible - * @type boolean - * @default true - */ - - /** - * A `Number` that defines the line width to use when rendering the constraint outline. - * A value of `0` means no outline will be rendered. - * - * @property render.lineWidth - * @type number - * @default 2 - */ - - /** - * A `String` that defines the stroke style to use when rendering the constraint outline. - * It is the same as when using a canvas, so it accepts CSS style property values. - * - * @property render.strokeStyle - * @type string - * @default a random colour - */ - - /** - * A `String` that defines the constraint rendering type. - * The possible values are 'line', 'pin', 'spring'. - * An appropriate render type will be automatically chosen unless one is given in options. - * - * @property render.type - * @type string - * @default 'line' - */ - - /** - * A `Boolean` that defines if the constraint's anchor points should be rendered. - * - * @property render.anchors - * @type boolean - * @default true - */ - - /** - * The first possible `Body` that this constraint is attached to. - * - * @property bodyA - * @type body - * @default null - */ - - /** - * The second possible `Body` that this constraint is attached to. - * - * @property bodyB - * @type body - * @default null - */ - - /** - * A `Vector` that specifies the offset of the constraint from center of the `constraint.bodyA` if defined, otherwise a world-space position. - * - * @property pointA - * @type vector - * @default { x: 0, y: 0 } - */ - - /** - * A `Vector` that specifies the offset of the constraint from center of the `constraint.bodyB` if defined, otherwise a world-space position. - * - * @property pointB - * @type vector - * @default { x: 0, y: 0 } - */ - - /** - * A `Number` that specifies the stiffness of the constraint, i.e. the rate at which it returns to its resting `constraint.length`. - * A value of `1` means the constraint should be very stiff. - * A value of `0.2` means the constraint acts like a soft spring. - * - * @property stiffness - * @type number - * @default 1 - */ - - /** - * A `Number` that specifies the damping of the constraint, - * i.e. the amount of resistance applied to each body based on their velocities to limit the amount of oscillation. - * Damping will only be apparent when the constraint also has a very low `stiffness`. - * A value of `0.1` means the constraint will apply heavy damping, resulting in little to no oscillation. - * A value of `0` means the constraint will apply no damping. - * - * @property damping - * @type number - * @default 0 - */ - - /** - * A `Number` that specifies the target resting length of the constraint. - * It is calculated automatically in `Constraint.create` from initial positions of the `constraint.bodyA` and `constraint.bodyB`. - * - * @property length - * @type number - */ - - /** - * An object reserved for storing plugin-specific properties. - * - * @property plugin - * @type {} - */ - })(); - - /***/ - }, - /* 9 */ - /***/ function (module, exports, __webpack_require__) { - /** - * The `Matter.Pair` module contains methods for creating and manipulating collision pairs. - * - * @class Pair - */ - - var Pair = {}; - - module.exports = Pair; - - var Contact = __webpack_require__(18); - - (function () { - /** - * Creates a pair. - * @method create - * @param {collision} collision - * @param {number} timestamp - * @return {pair} A new pair - */ - Pair.create = function (collision, timestamp) { - var bodyA = collision.bodyA, - bodyB = collision.bodyB, - parentA = collision.parentA, - parentB = collision.parentB; - - var pair = { - id: Pair.id(bodyA, bodyB), - bodyA: bodyA, - bodyB: bodyB, - contacts: {}, - activeContacts: [], - separation: 0, - isActive: true, - confirmedActive: true, - isSensor: bodyA.isSensor || bodyB.isSensor, - timeCreated: timestamp, - timeUpdated: timestamp, - inverseMass: parentA.inverseMass + parentB.inverseMass, - friction: Math.min(parentA.friction, parentB.friction), - frictionStatic: Math.max(parentA.frictionStatic, parentB.frictionStatic), - restitution: Math.max(parentA.restitution, parentB.restitution), - slop: Math.max(parentA.slop, parentB.slop), - }; - - Pair.update(pair, collision, timestamp); - - return pair; - }; - - /** - * Updates a pair given a collision. - * @method update - * @param {pair} pair - * @param {collision} collision - * @param {number} timestamp - */ - Pair.update = function (pair, collision, timestamp) { - var contacts = pair.contacts, - supports = collision.supports, - activeContacts = pair.activeContacts, - parentA = collision.parentA, - parentB = collision.parentB; - - pair.collision = collision; - pair.inverseMass = parentA.inverseMass + parentB.inverseMass; - pair.friction = Math.min(parentA.friction, parentB.friction); - pair.frictionStatic = Math.max(parentA.frictionStatic, parentB.frictionStatic); - pair.restitution = Math.max(parentA.restitution, parentB.restitution); - pair.slop = Math.max(parentA.slop, parentB.slop); - activeContacts.length = 0; - - if (collision.collided) { - for (var i = 0; i < supports.length; i++) { - var support = supports[i], - contactId = Contact.id(support), - contact = contacts[contactId]; - - if (contact) { - activeContacts.push(contact); - } else { - activeContacts.push((contacts[contactId] = Contact.create(support))); - } - } - - pair.separation = collision.depth; - Pair.setActive(pair, true, timestamp); - } else { - if (pair.isActive === true) Pair.setActive(pair, false, timestamp); - } - }; - - /** - * Set a pair as active or inactive. - * @method setActive - * @param {pair} pair - * @param {bool} isActive - * @param {number} timestamp - */ - Pair.setActive = function (pair, isActive, timestamp) { - if (isActive) { - pair.isActive = true; - pair.timeUpdated = timestamp; - } else { - pair.isActive = false; - pair.activeContacts.length = 0; - } - }; - - /** - * Get the id for the given pair. - * @method id - * @param {body} bodyA - * @param {body} bodyB - * @return {string} Unique pairId - */ - Pair.id = function (bodyA, bodyB) { - if (bodyA.id < bodyB.id) { - return 'A' + bodyA.id + 'B' + bodyB.id; - } else { - return 'A' + bodyB.id + 'B' + bodyA.id; - } - }; - })(); - - /***/ - }, - /* 10 */ - /***/ function (module, exports, __webpack_require__) { - /** - * The `Matter.Render` module is a simple HTML5 canvas based renderer for visualising instances of `Matter.Engine`. - * It is intended for development and debugging purposes, but may also be suitable for simple games. - * It includes a number of drawing options including wireframe, vector with support for sprites and viewports. - * - * @class Render - */ - - var Render = {}; - - module.exports = Render; - - var Common = __webpack_require__(0); - var Composite = __webpack_require__(5); - var Bounds = __webpack_require__(1); - var Events = __webpack_require__(4); - var Grid = __webpack_require__(11); - var Vector = __webpack_require__(2); - var Mouse = __webpack_require__(14); - - (function () { - var _requestAnimationFrame, _cancelAnimationFrame; - - if (typeof window !== 'undefined') { - _requestAnimationFrame = - window.requestAnimationFrame || - window.webkitRequestAnimationFrame || - window.mozRequestAnimationFrame || - window.msRequestAnimationFrame || - function (callback) { - window.setTimeout(function () { - callback(Common.now()); - }, 1000 / 60); - }; - - _cancelAnimationFrame = - window.cancelAnimationFrame || - window.mozCancelAnimationFrame || - window.webkitCancelAnimationFrame || - window.msCancelAnimationFrame; - } - - /** - * Creates a new renderer. The options parameter is an object that specifies any properties you wish to override the defaults. - * All properties have default values, and many are pre-calculated automatically based on other properties. - * See the properties section below for detailed information on what you can pass via the `options` object. - * @method create - * @param {object} [options] - * @return {render} A new renderer - */ - Render.create = function (options) { - var defaults = { - controller: Render, - engine: null, - element: null, - canvas: null, - mouse: null, - frameRequestId: null, - options: { - width: 800, - height: 600, - pixelRatio: 1, - background: '#18181d', - wireframeBackground: '#0f0f13', - hasBounds: !!options.bounds, - enabled: true, - wireframes: true, - showSleeping: true, - showDebug: false, - showBroadphase: false, - showBounds: false, - showVelocity: false, - showCollisions: false, - showSeparations: false, - showAxes: false, - showPositions: false, - showAngleIndicator: false, - showIds: false, - showShadows: false, - showVertexNumbers: false, - showConvexHulls: false, - showInternalEdges: false, - showMousePosition: false, - }, - }; - - var render = Common.extend(defaults, options); - - if (render.canvas) { - render.canvas.width = render.options.width || render.canvas.width; - render.canvas.height = render.options.height || render.canvas.height; - } - - render.mouse = options.mouse; - render.engine = options.engine; - render.canvas = render.canvas || _createCanvas(render.options.width, render.options.height); - render.context = render.canvas.getContext('2d'); - render.textures = {}; - - render.bounds = render.bounds || { - min: { - x: 0, - y: 0, - }, - max: { - x: render.canvas.width, - y: render.canvas.height, - }, - }; - - if (render.options.pixelRatio !== 1) { - Render.setPixelRatio(render, render.options.pixelRatio); - } - - if (Common.isElement(render.element)) { - render.element.appendChild(render.canvas); - } else if (!render.canvas.parentNode) { - Common.log( - 'Render.create: options.element was undefined, render.canvas was created but not appended', - 'warn', - ); - } - - return render; - }; - - /** - * Continuously updates the render canvas on the `requestAnimationFrame` event. - * @method run - * @param {render} render - */ - Render.run = function (render) { - (function loop(time) { - render.frameRequestId = _requestAnimationFrame(loop); - Render.world(render); - })(); - }; - - /** - * Ends execution of `Render.run` on the given `render`, by canceling the animation frame request event loop. - * @method stop - * @param {render} render - */ - Render.stop = function (render) { - _cancelAnimationFrame(render.frameRequestId); - }; - - /** - * Sets the pixel ratio of the renderer and updates the canvas. - * To automatically detect the correct ratio, pass the string `'auto'` for `pixelRatio`. - * @method setPixelRatio - * @param {render} render - * @param {number} pixelRatio - */ - Render.setPixelRatio = function (render, pixelRatio) { - var options = render.options, - canvas = render.canvas; - - if (pixelRatio === 'auto') { - pixelRatio = _getPixelRatio(canvas); - } - - options.pixelRatio = pixelRatio; - canvas.setAttribute('data-pixel-ratio', pixelRatio); - canvas.width = options.width * pixelRatio; - canvas.height = options.height * pixelRatio; - canvas.style.width = options.width / 2 + 'px'; - canvas.style.height = options.height / 2 + 'px'; - }; - - /** - * Positions and sizes the viewport around the given object bounds. - * Objects must have at least one of the following properties: - * - `object.bounds` - * - `object.position` - * - `object.min` and `object.max` - * - `object.x` and `object.y` - * @method lookAt - * @param {render} render - * @param {object[]} objects - * @param {vector} [padding] - * @param {bool} [center=true] - */ - Render.lookAt = function (render, objects, padding, center) { - center = typeof center !== 'undefined' ? center : true; - objects = Common.isArray(objects) ? objects : [objects]; - padding = padding || { - x: 0, - y: 0, - }; - - // find bounds of all objects - var bounds = { - min: {x: Infinity, y: Infinity}, - max: {x: -Infinity, y: -Infinity}, - }; - - for (var i = 0; i < objects.length; i += 1) { - var object = objects[i], - min = object.bounds ? object.bounds.min : object.min || object.position || object, - max = object.bounds ? object.bounds.max : object.max || object.position || object; - - if (min && max) { - if (min.x < bounds.min.x) bounds.min.x = min.x; - - if (max.x > bounds.max.x) bounds.max.x = max.x; - - if (min.y < bounds.min.y) bounds.min.y = min.y; - - if (max.y > bounds.max.y) bounds.max.y = max.y; - } - } - - // find ratios - var width = bounds.max.x - bounds.min.x + 2 * padding.x, - height = bounds.max.y - bounds.min.y + 2 * padding.y, - viewHeight = render.canvas.height, - viewWidth = render.canvas.width, - outerRatio = viewWidth / viewHeight, - innerRatio = width / height, - scaleX = 1, - scaleY = 1; - - // find scale factor - if (innerRatio > outerRatio) { - scaleY = innerRatio / outerRatio; - } else { - scaleX = outerRatio / innerRatio; - } - - // enable bounds - render.options.hasBounds = true; - - // position and size - render.bounds.min.x = bounds.min.x; - render.bounds.max.x = bounds.min.x + width * scaleX; - render.bounds.min.y = bounds.min.y; - render.bounds.max.y = bounds.min.y + height * scaleY; - - // center - if (center) { - render.bounds.min.x += width * 0.5 - width * scaleX * 0.5; - render.bounds.max.x += width * 0.5 - width * scaleX * 0.5; - render.bounds.min.y += height * 0.5 - height * scaleY * 0.5; - render.bounds.max.y += height * 0.5 - height * scaleY * 0.5; - } - - // padding - render.bounds.min.x -= padding.x; - render.bounds.max.x -= padding.x; - render.bounds.min.y -= padding.y; - render.bounds.max.y -= padding.y; - - // update mouse - if (render.mouse) { - Mouse.setScale(render.mouse, { - x: (render.bounds.max.x - render.bounds.min.x) / render.canvas.width, - y: (render.bounds.max.y - render.bounds.min.y) / render.canvas.height, - }); - - Mouse.setOffset(render.mouse, render.bounds.min); - } - }; - - /** - * Applies viewport transforms based on `render.bounds` to a render context. - * @method startViewTransform - * @param {render} render - */ - Render.startViewTransform = function (render) { - var boundsWidth = render.bounds.max.x - render.bounds.min.x, - boundsHeight = render.bounds.max.y - render.bounds.min.y, - boundsScaleX = boundsWidth / render.options.width, - boundsScaleY = boundsHeight / render.options.height; - - render.context.setTransform( - render.options.pixelRatio / boundsScaleX, - 0, - 0, - render.options.pixelRatio / boundsScaleY, - 0, - 0, - ); - - render.context.translate(-render.bounds.min.x, -render.bounds.min.y); - }; - - /** - * Resets all transforms on the render context. - * @method endViewTransform - * @param {render} render - */ - Render.endViewTransform = function (render) { - render.context.setTransform(render.options.pixelRatio, 0, 0, render.options.pixelRatio, 0, 0); - }; - - /** - * Renders the given `engine`'s `Matter.World` object. - * This is the entry point for all rendering and should be called every time the scene changes. - * @method world - * @param {render} render - */ - Render.world = function (render) { - var engine = render.engine, - world = engine.world, - canvas = render.canvas, - context = render.context, - options = render.options, - allBodies = Composite.allBodies(world), - allConstraints = Composite.allConstraints(world), - background = options.wireframes ? options.wireframeBackground : options.background, - bodies = [], - constraints = [], - i; - - var event = { - timestamp: engine.timing.timestamp, - }; - - Events.trigger(render, 'beforeRender', event); - - // apply background if it has changed - if (render.currentBackground !== background) _applyBackground(render, background); - - // clear the canvas with a transparent fill, to allow the canvas background to show - context.globalCompositeOperation = 'source-in'; - context.fillStyle = 'transparent'; - context.fillRect(0, 0, canvas.width, canvas.height); - context.globalCompositeOperation = 'source-over'; - - // handle bounds - if (options.hasBounds) { - // filter out bodies that are not in view - for (i = 0; i < allBodies.length; i++) { - var body = allBodies[i]; - if (Bounds.overlaps(body.bounds, render.bounds)) bodies.push(body); - } - - // filter out constraints that are not in view - for (i = 0; i < allConstraints.length; i++) { - var constraint = allConstraints[i], - bodyA = constraint.bodyA, - bodyB = constraint.bodyB, - pointAWorld = constraint.pointA, - pointBWorld = constraint.pointB; - - if (bodyA) pointAWorld = Vector.add(bodyA.position, constraint.pointA); - if (bodyB) pointBWorld = Vector.add(bodyB.position, constraint.pointB); - - if (!pointAWorld || !pointBWorld) continue; - - if (Bounds.contains(render.bounds, pointAWorld) || Bounds.contains(render.bounds, pointBWorld)) - constraints.push(constraint); - } - - // transform the view - Render.startViewTransform(render); - - // update mouse - if (render.mouse) { - Mouse.setScale(render.mouse, { - x: (render.bounds.max.x - render.bounds.min.x) / render.options.width, - y: (render.bounds.max.y - render.bounds.min.y) / render.options.height, - }); - - Mouse.setOffset(render.mouse, render.bounds.min); - } - } else { - constraints = allConstraints; - bodies = allBodies; - - if (render.options.pixelRatio !== 1) { - render.context.setTransform(render.options.pixelRatio, 0, 0, render.options.pixelRatio, 0, 0); - } - } - - if (!options.wireframes || (engine.enableSleeping && options.showSleeping)) { - // fully featured rendering of bodies - Render.bodies(render, bodies, context); - } else { - if (options.showConvexHulls) Render.bodyConvexHulls(render, bodies, context); - - // optimised method for wireframes only - Render.bodyWireframes(render, bodies, context); - } - - if (options.showBounds) Render.bodyBounds(render, bodies, context); - - if (options.showAxes || options.showAngleIndicator) Render.bodyAxes(render, bodies, context); - - if (options.showPositions) Render.bodyPositions(render, bodies, context); - - if (options.showVelocity) Render.bodyVelocity(render, bodies, context); - - if (options.showIds) Render.bodyIds(render, bodies, context); - - if (options.showSeparations) Render.separations(render, engine.pairs.list, context); - - if (options.showCollisions) Render.collisions(render, engine.pairs.list, context); - - if (options.showVertexNumbers) Render.vertexNumbers(render, bodies, context); - - if (options.showMousePosition) Render.mousePosition(render, render.mouse, context); - - Render.constraints(constraints, context); - - if (options.showBroadphase && engine.broadphase.controller === Grid) - Render.grid(render, engine.broadphase, context); - - if (options.showDebug) Render.debug(render, context); - - if (options.hasBounds) { - // revert view transforms - Render.endViewTransform(render); - } - - Events.trigger(render, 'afterRender', event); - }; - - /** - * Description - * @private - * @method debug - * @param {render} render - * @param {RenderingContext} context - */ - Render.debug = function (render, context) { - var c = context, - engine = render.engine, - world = engine.world, - metrics = engine.metrics, - options = render.options, - bodies = Composite.allBodies(world), - space = ' '; - - if (engine.timing.timestamp - (render.debugTimestamp || 0) >= 500) { - var text = ''; - - if (metrics.timing) { - text += 'fps: ' + Math.round(metrics.timing.fps) + space; - } - - // @if DEBUG - if (metrics.extended) { - if (metrics.timing) { - text += 'delta: ' + metrics.timing.delta.toFixed(3) + space; - text += 'correction: ' + metrics.timing.correction.toFixed(3) + space; - } - - text += 'bodies: ' + bodies.length + space; - - if (engine.broadphase.controller === Grid) text += 'buckets: ' + metrics.buckets + space; - - text += '\n'; - - text += 'collisions: ' + metrics.collisions + space; - text += 'pairs: ' + engine.pairs.list.length + space; - text += 'broad: ' + metrics.broadEff + space; - text += 'mid: ' + metrics.midEff + space; - text += 'narrow: ' + metrics.narrowEff + space; - } - // @endif - - render.debugString = text; - render.debugTimestamp = engine.timing.timestamp; - } - - if (render.debugString) { - c.font = '12px Arial'; - - if (options.wireframes) { - c.fillStyle = 'rgba(255,255,255,0.5)'; - } else { - c.fillStyle = 'rgba(0,0,0,0.5)'; - } - - var split = render.debugString.split('\n'); - - for (var i = 0; i < split.length; i++) { - c.fillText(split[i], 50, 50 + i * 18); - } - } - }; - - /** - * Description - * @private - * @method constraints - * @param {constraint[]} constraints - * @param {RenderingContext} context - */ - Render.constraints = function (constraints, context) { - var c = context; - - for (var i = 0; i < constraints.length; i++) { - var constraint = constraints[i]; - - if (!constraint.render.visible || !constraint.pointA || !constraint.pointB) continue; - - var bodyA = constraint.bodyA, - bodyB = constraint.bodyB, - start, - end; - - if (bodyA) { - start = Vector.add(bodyA.position, constraint.pointA); - } else { - start = constraint.pointA; - } - - if (constraint.render.type === 'pin') { - c.beginPath(); - c.arc(start.x, start.y, 3, 0, 2 * Math.PI); - c.closePath(); - } else { - if (bodyB) { - end = Vector.add(bodyB.position, constraint.pointB); - } else { - end = constraint.pointB; - } - - c.beginPath(); - c.moveTo(start.x, start.y); - - if (constraint.render.type === 'spring') { - var delta = Vector.sub(end, start), - normal = Vector.perp(Vector.normalise(delta)), - coils = Math.ceil(Common.clamp(constraint.length / 5, 12, 20)), - offset; - - for (var j = 1; j < coils; j += 1) { - offset = j % 2 === 0 ? 1 : -1; - - c.lineTo( - start.x + delta.x * (j / coils) + normal.x * offset * 4, - start.y + delta.y * (j / coils) + normal.y * offset * 4, - ); - } - } - - c.lineTo(end.x, end.y); - } - - if (constraint.render.lineWidth) { - c.lineWidth = constraint.render.lineWidth; - c.strokeStyle = constraint.render.strokeStyle; - c.stroke(); - } - - if (constraint.render.anchors) { - c.fillStyle = constraint.render.strokeStyle; - c.beginPath(); - c.arc(start.x, start.y, 3, 0, 2 * Math.PI); - c.arc(end.x, end.y, 3, 0, 2 * Math.PI); - c.closePath(); - c.fill(); - } - } - }; - - /** - * Description - * @private - * @method bodyShadows - * @param {render} render - * @param {body[]} bodies - * @param {RenderingContext} context - */ - Render.bodyShadows = function (render, bodies, context) { - var c = context; - render.engine; - - for (var i = 0; i < bodies.length; i++) { - var body = bodies[i]; - - if (!body.render.visible) continue; - - if (body.circleRadius) { - c.beginPath(); - c.arc(body.position.x, body.position.y, body.circleRadius, 0, 2 * Math.PI); - c.closePath(); - } else { - c.beginPath(); - c.moveTo(body.vertices[0].x, body.vertices[0].y); - for (var j = 1; j < body.vertices.length; j++) { - c.lineTo(body.vertices[j].x, body.vertices[j].y); - } - c.closePath(); - } - - var distanceX = body.position.x - render.options.width * 0.5, - distanceY = body.position.y - render.options.height * 0.2, - distance = Math.abs(distanceX) + Math.abs(distanceY); - - c.shadowColor = 'rgba(0,0,0,0.15)'; - c.shadowOffsetX = 0.05 * distanceX; - c.shadowOffsetY = 0.05 * distanceY; - c.shadowBlur = 1 + 12 * Math.min(1, distance / 1000); - - c.fill(); - - c.shadowColor = null; - c.shadowOffsetX = null; - c.shadowOffsetY = null; - c.shadowBlur = null; - } - }; - - /** - * Description - * @private - * @method bodies - * @param {render} render - * @param {body[]} bodies - * @param {RenderingContext} context - */ - Render.bodies = function (render, bodies, context) { - var c = context; - render.engine; - var options = render.options, - showInternalEdges = options.showInternalEdges || !options.wireframes, - body, - part, - i, - k; - - for (i = 0; i < bodies.length; i++) { - body = bodies[i]; - - if (!body.render.visible) continue; - - // handle compound parts - for (k = body.parts.length > 1 ? 1 : 0; k < body.parts.length; k++) { - part = body.parts[k]; - - if (!part.render.visible) continue; - - if (options.showSleeping && body.isSleeping) { - c.globalAlpha = 0.5 * part.render.opacity; - } else if (part.render.opacity !== 1) { - c.globalAlpha = part.render.opacity; - } - - if (part.render.sprite && part.render.sprite.texture && !options.wireframes) { - // part sprite - var sprite = part.render.sprite, - texture = _getTexture(render, sprite.texture); - - c.translate(part.position.x, part.position.y); - c.rotate(part.angle); - - c.drawImage( - texture, - texture.width * -sprite.xOffset * sprite.xScale, - texture.height * -sprite.yOffset * sprite.yScale, - texture.width * sprite.xScale, - texture.height * sprite.yScale, - ); - - // revert translation, hopefully faster than save / restore - c.rotate(-part.angle); - c.translate(-part.position.x, -part.position.y); - } else { - // part polygon - if (part.circleRadius) { - c.beginPath(); - c.arc(part.position.x, part.position.y, part.circleRadius, 0, 2 * Math.PI); - } else { - c.beginPath(); - c.moveTo(part.vertices[0].x, part.vertices[0].y); - - for (var j = 1; j < part.vertices.length; j++) { - if (!part.vertices[j - 1].isInternal || showInternalEdges) { - c.lineTo(part.vertices[j].x, part.vertices[j].y); - } else { - c.moveTo(part.vertices[j].x, part.vertices[j].y); - } - - if (part.vertices[j].isInternal && !showInternalEdges) { - c.moveTo( - part.vertices[(j + 1) % part.vertices.length].x, - part.vertices[(j + 1) % part.vertices.length].y, - ); - } - } - - c.lineTo(part.vertices[0].x, part.vertices[0].y); - c.closePath(); - } - - if (!options.wireframes) { - c.fillStyle = part.render.fillStyle; - - if (part.render.lineWidth) { - c.lineWidth = part.render.lineWidth; - c.strokeStyle = part.render.strokeStyle; - c.stroke(); - } - - c.fill(); - } else { - c.lineWidth = 1; - c.strokeStyle = '#bbb'; - c.stroke(); - } - } - - c.globalAlpha = 1; - } - } - }; - - /** - * Optimised method for drawing body wireframes in one pass - * @private - * @method bodyWireframes - * @param {render} render - * @param {body[]} bodies - * @param {RenderingContext} context - */ - Render.bodyWireframes = function (render, bodies, context) { - var c = context, - showInternalEdges = render.options.showInternalEdges, - body, - part, - i, - j, - k; - - c.beginPath(); - - // render all bodies - for (i = 0; i < bodies.length; i++) { - body = bodies[i]; - - if (!body.render.visible) continue; - - // handle compound parts - for (k = body.parts.length > 1 ? 1 : 0; k < body.parts.length; k++) { - part = body.parts[k]; - - c.moveTo(part.vertices[0].x, part.vertices[0].y); - - for (j = 1; j < part.vertices.length; j++) { - if (!part.vertices[j - 1].isInternal || showInternalEdges) { - c.lineTo(part.vertices[j].x, part.vertices[j].y); - } else { - c.moveTo(part.vertices[j].x, part.vertices[j].y); - } - - if (part.vertices[j].isInternal && !showInternalEdges) { - c.moveTo( - part.vertices[(j + 1) % part.vertices.length].x, - part.vertices[(j + 1) % part.vertices.length].y, - ); - } - } - - c.lineTo(part.vertices[0].x, part.vertices[0].y); - } - } - - c.lineWidth = 1; - c.strokeStyle = '#bbb'; - c.stroke(); - }; - - /** - * Optimised method for drawing body convex hull wireframes in one pass - * @private - * @method bodyConvexHulls - * @param {render} render - * @param {body[]} bodies - * @param {RenderingContext} context - */ - Render.bodyConvexHulls = function (render, bodies, context) { - var c = context, - body, - i, - j; - - c.beginPath(); - - // render convex hulls - for (i = 0; i < bodies.length; i++) { - body = bodies[i]; - - if (!body.render.visible || body.parts.length === 1) continue; - - c.moveTo(body.vertices[0].x, body.vertices[0].y); - - for (j = 1; j < body.vertices.length; j++) { - c.lineTo(body.vertices[j].x, body.vertices[j].y); - } - - c.lineTo(body.vertices[0].x, body.vertices[0].y); - } - - c.lineWidth = 1; - c.strokeStyle = 'rgba(255,255,255,0.2)'; - c.stroke(); - }; - - /** - * Renders body vertex numbers. - * @private - * @method vertexNumbers - * @param {render} render - * @param {body[]} bodies - * @param {RenderingContext} context - */ - Render.vertexNumbers = function (render, bodies, context) { - var c = context, - i, - j, - k; - - for (i = 0; i < bodies.length; i++) { - var parts = bodies[i].parts; - for (k = parts.length > 1 ? 1 : 0; k < parts.length; k++) { - var part = parts[k]; - for (j = 0; j < part.vertices.length; j++) { - c.fillStyle = 'rgba(255,255,255,0.2)'; - c.fillText( - i + '_' + j, - part.position.x + (part.vertices[j].x - part.position.x) * 0.8, - part.position.y + (part.vertices[j].y - part.position.y) * 0.8, - ); - } - } - } - }; - - /** - * Renders mouse position. - * @private - * @method mousePosition - * @param {render} render - * @param {mouse} mouse - * @param {RenderingContext} context - */ - Render.mousePosition = function (render, mouse, context) { - var c = context; - c.fillStyle = 'rgba(255,255,255,0.8)'; - c.fillText(mouse.position.x + ' ' + mouse.position.y, mouse.position.x + 5, mouse.position.y - 5); - }; - - /** - * Draws body bounds - * @private - * @method bodyBounds - * @param {render} render - * @param {body[]} bodies - * @param {RenderingContext} context - */ - Render.bodyBounds = function (render, bodies, context) { - var c = context; - render.engine; - var options = render.options; - - c.beginPath(); - - for (var i = 0; i < bodies.length; i++) { - var body = bodies[i]; - - if (body.render.visible) { - var parts = bodies[i].parts; - for (var j = parts.length > 1 ? 1 : 0; j < parts.length; j++) { - var part = parts[j]; - c.rect( - part.bounds.min.x, - part.bounds.min.y, - part.bounds.max.x - part.bounds.min.x, - part.bounds.max.y - part.bounds.min.y, - ); - } - } - } - - if (options.wireframes) { - c.strokeStyle = 'rgba(255,255,255,0.08)'; - } else { - c.strokeStyle = 'rgba(0,0,0,0.1)'; - } - - c.lineWidth = 1; - c.stroke(); - }; - - /** - * Draws body angle indicators and axes - * @private - * @method bodyAxes - * @param {render} render - * @param {body[]} bodies - * @param {RenderingContext} context - */ - Render.bodyAxes = function (render, bodies, context) { - var c = context; - render.engine; - var options = render.options, - part, - i, - j, - k; - - c.beginPath(); - - for (i = 0; i < bodies.length; i++) { - var body = bodies[i], - parts = body.parts; - - if (!body.render.visible) continue; - - if (options.showAxes) { - // render all axes - for (j = parts.length > 1 ? 1 : 0; j < parts.length; j++) { - part = parts[j]; - for (k = 0; k < part.axes.length; k++) { - var axis = part.axes[k]; - c.moveTo(part.position.x, part.position.y); - c.lineTo(part.position.x + axis.x * 20, part.position.y + axis.y * 20); - } - } - } else { - for (j = parts.length > 1 ? 1 : 0; j < parts.length; j++) { - part = parts[j]; - for (k = 0; k < part.axes.length; k++) { - // render a single axis indicator - c.moveTo(part.position.x, part.position.y); - c.lineTo( - (part.vertices[0].x + part.vertices[part.vertices.length - 1].x) / 2, - (part.vertices[0].y + part.vertices[part.vertices.length - 1].y) / 2, - ); - } - } - } - } - - if (options.wireframes) { - c.strokeStyle = 'indianred'; - c.lineWidth = 1; - } else { - c.strokeStyle = 'rgba(255, 255, 255, 0.4)'; - c.globalCompositeOperation = 'overlay'; - c.lineWidth = 2; - } - - c.stroke(); - c.globalCompositeOperation = 'source-over'; - }; - - /** - * Draws body positions - * @private - * @method bodyPositions - * @param {render} render - * @param {body[]} bodies - * @param {RenderingContext} context - */ - Render.bodyPositions = function (render, bodies, context) { - var c = context; - render.engine; - var options = render.options, - body, - part, - i, - k; - - c.beginPath(); - - // render current positions - for (i = 0; i < bodies.length; i++) { - body = bodies[i]; - - if (!body.render.visible) continue; - - // handle compound parts - for (k = 0; k < body.parts.length; k++) { - part = body.parts[k]; - c.arc(part.position.x, part.position.y, 3, 0, 2 * Math.PI, false); - c.closePath(); - } - } - - if (options.wireframes) { - c.fillStyle = 'indianred'; - } else { - c.fillStyle = 'rgba(0,0,0,0.5)'; - } - c.fill(); - - c.beginPath(); - - // render previous positions - for (i = 0; i < bodies.length; i++) { - body = bodies[i]; - if (body.render.visible) { - c.arc(body.positionPrev.x, body.positionPrev.y, 2, 0, 2 * Math.PI, false); - c.closePath(); - } - } - - c.fillStyle = 'rgba(255,165,0,0.8)'; - c.fill(); - }; - - /** - * Draws body velocity - * @private - * @method bodyVelocity - * @param {render} render - * @param {body[]} bodies - * @param {RenderingContext} context - */ - Render.bodyVelocity = function (render, bodies, context) { - var c = context; - - c.beginPath(); - - for (var i = 0; i < bodies.length; i++) { - var body = bodies[i]; - - if (!body.render.visible) continue; - - c.moveTo(body.position.x, body.position.y); - c.lineTo( - body.position.x + (body.position.x - body.positionPrev.x) * 2, - body.position.y + (body.position.y - body.positionPrev.y) * 2, - ); - } - - c.lineWidth = 3; - c.strokeStyle = 'cornflowerblue'; - c.stroke(); - }; - - /** - * Draws body ids - * @private - * @method bodyIds - * @param {render} render - * @param {body[]} bodies - * @param {RenderingContext} context - */ - Render.bodyIds = function (render, bodies, context) { - var c = context, - i, - j; - - for (i = 0; i < bodies.length; i++) { - if (!bodies[i].render.visible) continue; - - var parts = bodies[i].parts; - for (j = parts.length > 1 ? 1 : 0; j < parts.length; j++) { - var part = parts[j]; - c.font = '12px Arial'; - c.fillStyle = 'rgba(255,255,255,0.5)'; - c.fillText(part.id, part.position.x + 10, part.position.y - 10); - } - } - }; - - /** - * Description - * @private - * @method collisions - * @param {render} render - * @param {pair[]} pairs - * @param {RenderingContext} context - */ - Render.collisions = function (render, pairs, context) { - var c = context, - options = render.options, - pair, - collision, - i, - j; - - c.beginPath(); - - // render collision positions - for (i = 0; i < pairs.length; i++) { - pair = pairs[i]; - - if (!pair.isActive) continue; - - collision = pair.collision; - for (j = 0; j < pair.activeContacts.length; j++) { - var contact = pair.activeContacts[j], - vertex = contact.vertex; - c.rect(vertex.x - 1.5, vertex.y - 1.5, 3.5, 3.5); - } - } - - if (options.wireframes) { - c.fillStyle = 'rgba(255,255,255,0.7)'; - } else { - c.fillStyle = 'orange'; - } - c.fill(); - - c.beginPath(); - - // render collision normals - for (i = 0; i < pairs.length; i++) { - pair = pairs[i]; - - if (!pair.isActive) continue; - - collision = pair.collision; - - if (pair.activeContacts.length > 0) { - var normalPosX = pair.activeContacts[0].vertex.x, - normalPosY = pair.activeContacts[0].vertex.y; - - if (pair.activeContacts.length === 2) { - normalPosX = (pair.activeContacts[0].vertex.x + pair.activeContacts[1].vertex.x) / 2; - normalPosY = (pair.activeContacts[0].vertex.y + pair.activeContacts[1].vertex.y) / 2; - } - - if (collision.bodyB === collision.supports[0].body || collision.bodyA.isStatic === true) { - c.moveTo(normalPosX - collision.normal.x * 8, normalPosY - collision.normal.y * 8); - } else { - c.moveTo(normalPosX + collision.normal.x * 8, normalPosY + collision.normal.y * 8); - } - - c.lineTo(normalPosX, normalPosY); - } - } - - if (options.wireframes) { - c.strokeStyle = 'rgba(255,165,0,0.7)'; - } else { - c.strokeStyle = 'orange'; - } - - c.lineWidth = 1; - c.stroke(); - }; - - /** - * Description - * @private - * @method separations - * @param {render} render - * @param {pair[]} pairs - * @param {RenderingContext} context - */ - Render.separations = function (render, pairs, context) { - var c = context, - options = render.options, - pair, - collision, - bodyA, - bodyB, - i; - - c.beginPath(); - - // render separations - for (i = 0; i < pairs.length; i++) { - pair = pairs[i]; - - if (!pair.isActive) continue; - - collision = pair.collision; - bodyA = collision.bodyA; - bodyB = collision.bodyB; - - var k = 1; - - if (!bodyB.isStatic && !bodyA.isStatic) k = 0.5; - if (bodyB.isStatic) k = 0; - - c.moveTo(bodyB.position.x, bodyB.position.y); - c.lineTo(bodyB.position.x - collision.penetration.x * k, bodyB.position.y - collision.penetration.y * k); - - k = 1; - - if (!bodyB.isStatic && !bodyA.isStatic) k = 0.5; - if (bodyA.isStatic) k = 0; - - c.moveTo(bodyA.position.x, bodyA.position.y); - c.lineTo(bodyA.position.x + collision.penetration.x * k, bodyA.position.y + collision.penetration.y * k); - } - - if (options.wireframes) { - c.strokeStyle = 'rgba(255,165,0,0.5)'; - } else { - c.strokeStyle = 'orange'; - } - c.stroke(); - }; - - /** - * Description - * @private - * @method grid - * @param {render} render - * @param {grid} grid - * @param {RenderingContext} context - */ - Render.grid = function (render, grid, context) { - var c = context, - options = render.options; - - if (options.wireframes) { - c.strokeStyle = 'rgba(255,180,0,0.1)'; - } else { - c.strokeStyle = 'rgba(255,180,0,0.5)'; - } - - c.beginPath(); - - var bucketKeys = Common.keys(grid.buckets); - - for (var i = 0; i < bucketKeys.length; i++) { - var bucketId = bucketKeys[i]; - - if (grid.buckets[bucketId].length < 2) continue; - - var region = bucketId.split(/C|R/); - c.rect( - 0.5 + parseInt(region[1], 10) * grid.bucketWidth, - 0.5 + parseInt(region[2], 10) * grid.bucketHeight, - grid.bucketWidth, - grid.bucketHeight, - ); - } - - c.lineWidth = 1; - c.stroke(); - }; - - /** - * Description - * @private - * @method inspector - * @param {inspector} inspector - * @param {RenderingContext} context - */ - Render.inspector = function (inspector, context) { - inspector.engine; - var selected = inspector.selected, - render = inspector.render, - options = render.options, - bounds; - - if (options.hasBounds) { - var boundsWidth = render.bounds.max.x - render.bounds.min.x, - boundsHeight = render.bounds.max.y - render.bounds.min.y, - boundsScaleX = boundsWidth / render.options.width, - boundsScaleY = boundsHeight / render.options.height; - - context.scale(1 / boundsScaleX, 1 / boundsScaleY); - context.translate(-render.bounds.min.x, -render.bounds.min.y); - } - - for (var i = 0; i < selected.length; i++) { - var item = selected[i].data; - - context.translate(0.5, 0.5); - context.lineWidth = 1; - context.strokeStyle = 'rgba(255,165,0,0.9)'; - context.setLineDash([1, 2]); - - switch (item.type) { - case 'body': - // render body selections - bounds = item.bounds; - context.beginPath(); - context.rect( - Math.floor(bounds.min.x - 3), - Math.floor(bounds.min.y - 3), - Math.floor(bounds.max.x - bounds.min.x + 6), - Math.floor(bounds.max.y - bounds.min.y + 6), - ); - context.closePath(); - context.stroke(); - - break; - - case 'constraint': - // render constraint selections - var point = item.pointA; - if (item.bodyA) point = item.pointB; - context.beginPath(); - context.arc(point.x, point.y, 10, 0, 2 * Math.PI); - context.closePath(); - context.stroke(); - - break; - } - - context.setLineDash([]); - context.translate(-0.5, -0.5); - } - - // render selection region - if (inspector.selectStart !== null) { - context.translate(0.5, 0.5); - context.lineWidth = 1; - context.strokeStyle = 'rgba(255,165,0,0.6)'; - context.fillStyle = 'rgba(255,165,0,0.1)'; - bounds = inspector.selectBounds; - context.beginPath(); - context.rect( - Math.floor(bounds.min.x), - Math.floor(bounds.min.y), - Math.floor(bounds.max.x - bounds.min.x), - Math.floor(bounds.max.y - bounds.min.y), - ); - context.closePath(); - context.stroke(); - context.fill(); - context.translate(-0.5, -0.5); - } - - if (options.hasBounds) context.setTransform(1, 0, 0, 1, 0, 0); - }; - - /** - * Description - * @method _createCanvas - * @private - * @param {} width - * @param {} height - * @return canvas - */ - var _createCanvas = function (width, height) { - var canvas = document.createElement('canvas'); - canvas.width = width; - canvas.height = height; - canvas.oncontextmenu = function () { - return false; - }; - canvas.onselectstart = function () { - return false; - }; - return canvas; - }; - - /** - * Gets the pixel ratio of the canvas. - * @method _getPixelRatio - * @private - * @param {HTMLElement} canvas - * @return {Number} pixel ratio - */ - var _getPixelRatio = function (canvas) { - var context = canvas.getContext('2d'), - devicePixelRatio = window.devicePixelRatio || 1, - backingStorePixelRatio = - context.webkitBackingStorePixelRatio || - context.mozBackingStorePixelRatio || - context.msBackingStorePixelRatio || - context.oBackingStorePixelRatio || - context.backingStorePixelRatio || - 1; - - return devicePixelRatio / backingStorePixelRatio; - }; - - /** - * Gets the requested texture (an Image) via its path - * @method _getTexture - * @private - * @param {render} render - * @param {string} imagePath - * @return {Image} texture - */ - var _getTexture = function (render, imagePath) { - var image = render.textures[imagePath]; - - if (image) return image; - - image = render.textures[imagePath] = new Image(); - image.src = imagePath; - - return image; - }; - - /** - * Applies the background to the canvas using CSS. - * @method applyBackground - * @private - * @param {render} render - * @param {string} background - */ - var _applyBackground = function (render, background) { - var cssBackground = background; - - if (/(jpg|gif|png)$/.test(background)) cssBackground = 'url(' + background + ')'; - - render.canvas.style.background = cssBackground; - render.canvas.style.backgroundSize = 'contain'; - render.currentBackground = background; - }; - - /* - * - * Events Documentation - * - */ - - /** - * Fired before rendering - * - * @event beforeRender - * @param {} event An event object - * @param {number} event.timestamp The engine.timing.timestamp of the event - * @param {} event.source The source object of the event - * @param {} event.name The name of the event - */ - - /** - * Fired after rendering - * - * @event afterRender - * @param {} event An event object - * @param {number} event.timestamp The engine.timing.timestamp of the event - * @param {} event.source The source object of the event - * @param {} event.name The name of the event - */ - - /* - * - * Properties Documentation - * - */ - - /** - * A back-reference to the `Matter.Render` module. - * - * @property controller - * @type render - */ - - /** - * A reference to the `Matter.Engine` instance to be used. - * - * @property engine - * @type engine - */ - - /** - * A reference to the element where the canvas is to be inserted (if `render.canvas` has not been specified) - * - * @property element - * @type HTMLElement - * @default null - */ - - /** - * The canvas element to render to. If not specified, one will be created if `render.element` has been specified. - * - * @property canvas - * @type HTMLCanvasElement - * @default null - */ - - /** - * The configuration options of the renderer. - * - * @property options - * @type {} - */ - - /** - * The target width in pixels of the `render.canvas` to be created. - * - * @property options.width - * @type number - * @default 800 - */ - - /** - * The target height in pixels of the `render.canvas` to be created. - * - * @property options.height - * @type number - * @default 600 - */ - - /** - * A flag that specifies if `render.bounds` should be used when rendering. - * - * @property options.hasBounds - * @type boolean - * @default false - */ - - /** - * A `Bounds` object that specifies the drawing view region. - * Rendering will be automatically transformed and scaled to fit within the canvas size (`render.options.width` and `render.options.height`). - * This allows for creating views that can pan or zoom around the scene. - * You must also set `render.options.hasBounds` to `true` to enable bounded rendering. - * - * @property bounds - * @type bounds - */ - - /** - * The 2d rendering context from the `render.canvas` element. - * - * @property context - * @type CanvasRenderingContext2D - */ - - /** - * The sprite texture cache. - * - * @property textures - * @type {} - */ - })(); - - /***/ - }, - /* 11 */ - /***/ function (module, exports, __webpack_require__) { - /** - * The `Matter.Grid` module contains methods for creating and manipulating collision broadphase grid structures. - * - * @class Grid - */ - - var Grid = {}; - - module.exports = Grid; - - var Pair = __webpack_require__(9); - var Detector = __webpack_require__(12); - var Common = __webpack_require__(0); - - (function () { - /** - * Creates a new grid. - * @method create - * @param {} options - * @return {grid} A new grid - */ - Grid.create = function (options) { - var defaults = { - controller: Grid, - detector: Detector.collisions, - buckets: {}, - pairs: {}, - pairsList: [], - bucketWidth: 48, - bucketHeight: 48, - }; - - return Common.extend(defaults, options); - }; - - /** - * The width of a single grid bucket. - * - * @property bucketWidth - * @type number - * @default 48 - */ - - /** - * The height of a single grid bucket. - * - * @property bucketHeight - * @type number - * @default 48 - */ - - /** - * Updates the grid. - * @method update - * @param {grid} grid - * @param {body[]} bodies - * @param {engine} engine - * @param {boolean} forceUpdate - */ - Grid.update = function (grid, bodies, engine, forceUpdate) { - var i, - col, - row, - world = engine.world, - buckets = grid.buckets, - bucket, - bucketId, - gridChanged = false; - - // @if DEBUG - var metrics = engine.metrics; - metrics.broadphaseTests = 0; - // @endif - - for (i = 0; i < bodies.length; i++) { - var body = bodies[i]; - - if (body.isSleeping && !forceUpdate) continue; - - // don't update out of world bodies - if ( - body.bounds.max.x < world.bounds.min.x || - body.bounds.min.x > world.bounds.max.x || - body.bounds.max.y < world.bounds.min.y || - body.bounds.min.y > world.bounds.max.y - ) - continue; - - var newRegion = Grid._getRegion(grid, body); - - // if the body has changed grid region - if (!body.region || newRegion.id !== body.region.id || forceUpdate) { - // @if DEBUG - metrics.broadphaseTests += 1; - // @endif - - if (!body.region || forceUpdate) body.region = newRegion; - - var union = Grid._regionUnion(newRegion, body.region); - - // update grid buckets affected by region change - // iterate over the union of both regions - for (col = union.startCol; col <= union.endCol; col++) { - for (row = union.startRow; row <= union.endRow; row++) { - bucketId = Grid._getBucketId(col, row); - bucket = buckets[bucketId]; - - var isInsideNewRegion = - col >= newRegion.startCol && - col <= newRegion.endCol && - row >= newRegion.startRow && - row <= newRegion.endRow; - - var isInsideOldRegion = - col >= body.region.startCol && - col <= body.region.endCol && - row >= body.region.startRow && - row <= body.region.endRow; - - // remove from old region buckets - if (!isInsideNewRegion && isInsideOldRegion) { - if (isInsideOldRegion) { - if (bucket) Grid._bucketRemoveBody(grid, bucket, body); - } - } - - // add to new region buckets - if (body.region === newRegion || (isInsideNewRegion && !isInsideOldRegion) || forceUpdate) { - if (!bucket) bucket = Grid._createBucket(buckets, bucketId); - Grid._bucketAddBody(grid, bucket, body); - } - } - } - - // set the new region - body.region = newRegion; - - // flag changes so we can update pairs - gridChanged = true; - } - } - - // update pairs list only if pairs changed (i.e. a body changed region) - if (gridChanged) grid.pairsList = Grid._createActivePairsList(grid); - }; - - /** - * Clears the grid. - * @method clear - * @param {grid} grid - */ - Grid.clear = function (grid) { - grid.buckets = {}; - grid.pairs = {}; - grid.pairsList = []; - }; - - /** - * Finds the union of two regions. - * @method _regionUnion - * @private - * @param {} regionA - * @param {} regionB - * @return {} region - */ - Grid._regionUnion = function (regionA, regionB) { - var startCol = Math.min(regionA.startCol, regionB.startCol), - endCol = Math.max(regionA.endCol, regionB.endCol), - startRow = Math.min(regionA.startRow, regionB.startRow), - endRow = Math.max(regionA.endRow, regionB.endRow); - - return Grid._createRegion(startCol, endCol, startRow, endRow); - }; - - /** - * Gets the region a given body falls in for a given grid. - * @method _getRegion - * @private - * @param {} grid - * @param {} body - * @return {} region - */ - Grid._getRegion = function (grid, body) { - var bounds = body.bounds, - startCol = Math.floor(bounds.min.x / grid.bucketWidth), - endCol = Math.floor(bounds.max.x / grid.bucketWidth), - startRow = Math.floor(bounds.min.y / grid.bucketHeight), - endRow = Math.floor(bounds.max.y / grid.bucketHeight); - - return Grid._createRegion(startCol, endCol, startRow, endRow); - }; - - /** - * Creates a region. - * @method _createRegion - * @private - * @param {} startCol - * @param {} endCol - * @param {} startRow - * @param {} endRow - * @return {} region - */ - Grid._createRegion = function (startCol, endCol, startRow, endRow) { - return { - id: startCol + ',' + endCol + ',' + startRow + ',' + endRow, - startCol: startCol, - endCol: endCol, - startRow: startRow, - endRow: endRow, - }; - }; - - /** - * Gets the bucket id at the given position. - * @method _getBucketId - * @private - * @param {} column - * @param {} row - * @return {string} bucket id - */ - Grid._getBucketId = function (column, row) { - return 'C' + column + 'R' + row; - }; - - /** - * Creates a bucket. - * @method _createBucket - * @private - * @param {} buckets - * @param {} bucketId - * @return {} bucket - */ - Grid._createBucket = function (buckets, bucketId) { - var bucket = (buckets[bucketId] = []); - return bucket; - }; - - /** - * Adds a body to a bucket. - * @method _bucketAddBody - * @private - * @param {} grid - * @param {} bucket - * @param {} body - */ - Grid._bucketAddBody = function (grid, bucket, body) { - // add new pairs - for (var i = 0; i < bucket.length; i++) { - var bodyB = bucket[i]; - - if (body.id === bodyB.id || (body.isStatic && bodyB.isStatic)) continue; - - // keep track of the number of buckets the pair exists in - // important for Grid.update to work - var pairId = Pair.id(body, bodyB), - pair = grid.pairs[pairId]; - - if (pair) { - pair[2] += 1; - } else { - grid.pairs[pairId] = [body, bodyB, 1]; - } - } - - // add to bodies (after pairs, otherwise pairs with self) - bucket.push(body); - }; - - /** - * Removes a body from a bucket. - * @method _bucketRemoveBody - * @private - * @param {} grid - * @param {} bucket - * @param {} body - */ - Grid._bucketRemoveBody = function (grid, bucket, body) { - // remove from bucket - bucket.splice(Common.indexOf(bucket, body), 1); - - // update pair counts - for (var i = 0; i < bucket.length; i++) { - // keep track of the number of buckets the pair exists in - // important for _createActivePairsList to work - var bodyB = bucket[i], - pairId = Pair.id(body, bodyB), - pair = grid.pairs[pairId]; - - if (pair) pair[2] -= 1; - } - }; - - /** - * Generates a list of the active pairs in the grid. - * @method _createActivePairsList - * @private - * @param {} grid - * @return [] pairs - */ - Grid._createActivePairsList = function (grid) { - var pairKeys, - pair, - pairs = []; - - // grid.pairs is used as a hashmap - pairKeys = Common.keys(grid.pairs); - - // iterate over grid.pairs - for (var k = 0; k < pairKeys.length; k++) { - pair = grid.pairs[pairKeys[k]]; - - // if pair exists in at least one bucket - // it is a pair that needs further collision testing so push it - if (pair[2] > 0) { - pairs.push(pair); - } else { - delete grid.pairs[pairKeys[k]]; - } - } - - return pairs; - }; - })(); - - /***/ - }, - /* 12 */ - /***/ function (module, exports, __webpack_require__) { - /** - * The `Matter.Detector` module contains methods for detecting collisions given a set of pairs. - * - * @class Detector - */ - - // TODO: speculative contacts - - var Detector = {}; - - module.exports = Detector; - - var SAT = __webpack_require__(13); - var Pair = __webpack_require__(9); - var Bounds = __webpack_require__(1); - - (function () { - /** - * Finds all collisions given a list of pairs. - * @method collisions - * @param {pair[]} broadphasePairs - * @param {engine} engine - * @return {array} collisions - */ - Detector.collisions = function (broadphasePairs, engine) { - var collisions = [], - pairsTable = engine.pairs.table; - - // @if DEBUG - var metrics = engine.metrics; - // @endif - - for (var i = 0; i < broadphasePairs.length; i++) { - var bodyA = broadphasePairs[i][0], - bodyB = broadphasePairs[i][1]; - - if ((bodyA.isStatic || bodyA.isSleeping) && (bodyB.isStatic || bodyB.isSleeping)) continue; - - if (!Detector.canCollide(bodyA.collisionFilter, bodyB.collisionFilter)) continue; - - // @if DEBUG - metrics.midphaseTests += 1; - // @endif - - // mid phase - if (Bounds.overlaps(bodyA.bounds, bodyB.bounds)) { - for (var j = bodyA.parts.length > 1 ? 1 : 0; j < bodyA.parts.length; j++) { - var partA = bodyA.parts[j]; - - for (var k = bodyB.parts.length > 1 ? 1 : 0; k < bodyB.parts.length; k++) { - var partB = bodyB.parts[k]; - - if ((partA === bodyA && partB === bodyB) || Bounds.overlaps(partA.bounds, partB.bounds)) { - // find a previous collision we could reuse - var pairId = Pair.id(partA, partB), - pair = pairsTable[pairId], - previousCollision; - - if (pair && pair.isActive) { - previousCollision = pair.collision; - } else { - previousCollision = null; - } - - // narrow phase - var collision = SAT.collides(partA, partB, previousCollision); - - // @if DEBUG - metrics.narrowphaseTests += 1; - if (collision.reused) metrics.narrowReuseCount += 1; - // @endif - - if (collision.collided) { - collisions.push(collision); - // @if DEBUG - metrics.narrowDetections += 1; - // @endif - } - } - } - } - } - } - - return collisions; - }; - - /** - * Returns `true` if both supplied collision filters will allow a collision to occur. - * See `body.collisionFilter` for more information. - * @method canCollide - * @param {} filterA - * @param {} filterB - * @return {bool} `true` if collision can occur - */ - Detector.canCollide = function (filterA, filterB) { - if (filterA.group === filterB.group && filterA.group !== 0) return filterA.group > 0; - - return (filterA.mask & filterB.category) !== 0 && (filterB.mask & filterA.category) !== 0; - }; - })(); - - /***/ - }, - /* 13 */ - /***/ function (module, exports, __webpack_require__) { - /** - * The `Matter.SAT` module contains methods for detecting collisions using the Separating Axis Theorem. - * - * @class SAT - */ - - // TODO: true circles and curves - - var SAT = {}; - - module.exports = SAT; - - var Vertices = __webpack_require__(3); - var Vector = __webpack_require__(2); - - (function () { - /** - * Detect collision between two bodies using the Separating Axis Theorem. - * @method collides - * @param {body} bodyA - * @param {body} bodyB - * @param {collision} previousCollision - * @return {collision} collision - */ - SAT.collides = function (bodyA, bodyB, previousCollision) { - var overlapAB, - overlapBA, - minOverlap, - collision, - canReusePrevCol = false; - - if (previousCollision) { - // estimate total motion - var parentA = bodyA.parent, - parentB = bodyB.parent, - motion = - parentA.speed * parentA.speed + - parentA.angularSpeed * parentA.angularSpeed + - parentB.speed * parentB.speed + - parentB.angularSpeed * parentB.angularSpeed; - - // we may be able to (partially) reuse collision result - // but only safe if collision was resting - canReusePrevCol = previousCollision && previousCollision.collided && motion < 0.2; - - // reuse collision object - collision = previousCollision; - } else { - collision = {collided: false, bodyA: bodyA, bodyB: bodyB}; - } - - if (previousCollision && canReusePrevCol) { - // if we can reuse the collision result - // we only need to test the previously found axis - var axisBodyA = collision.axisBody, - axisBodyB = axisBodyA === bodyA ? bodyB : bodyA, - axes = [axisBodyA.axes[previousCollision.axisNumber]]; - - minOverlap = SAT._overlapAxes(axisBodyA.vertices, axisBodyB.vertices, axes); - collision.reused = true; - - if (minOverlap.overlap <= 0) { - collision.collided = false; - return collision; - } - } else { - // if we can't reuse a result, perform a full SAT test - - overlapAB = SAT._overlapAxes(bodyA.vertices, bodyB.vertices, bodyA.axes); - - if (overlapAB.overlap <= 0) { - collision.collided = false; - return collision; - } - - overlapBA = SAT._overlapAxes(bodyB.vertices, bodyA.vertices, bodyB.axes); - - if (overlapBA.overlap <= 0) { - collision.collided = false; - return collision; - } - - if (overlapAB.overlap < overlapBA.overlap) { - minOverlap = overlapAB; - collision.axisBody = bodyA; - } else { - minOverlap = overlapBA; - collision.axisBody = bodyB; - } - - // important for reuse later - collision.axisNumber = minOverlap.axisNumber; - } - - collision.bodyA = bodyA.id < bodyB.id ? bodyA : bodyB; - collision.bodyB = bodyA.id < bodyB.id ? bodyB : bodyA; - collision.collided = true; - collision.depth = minOverlap.overlap; - collision.parentA = collision.bodyA.parent; - collision.parentB = collision.bodyB.parent; - - bodyA = collision.bodyA; - bodyB = collision.bodyB; - - // ensure normal is facing away from bodyA - if (Vector.dot(minOverlap.axis, Vector.sub(bodyB.position, bodyA.position)) < 0) { - collision.normal = { - x: minOverlap.axis.x, - y: minOverlap.axis.y, - }; - } else { - collision.normal = { - x: -minOverlap.axis.x, - y: -minOverlap.axis.y, - }; - } - - collision.tangent = Vector.perp(collision.normal); - - collision.penetration = collision.penetration || {}; - collision.penetration.x = collision.normal.x * collision.depth; - collision.penetration.y = collision.normal.y * collision.depth; - - // find support points, there is always either exactly one or two - var verticesB = SAT._findSupports(bodyA, bodyB, collision.normal), - supports = []; - - // find the supports from bodyB that are inside bodyA - if (Vertices.contains(bodyA.vertices, verticesB[0])) supports.push(verticesB[0]); - - if (Vertices.contains(bodyA.vertices, verticesB[1])) supports.push(verticesB[1]); - - // find the supports from bodyA that are inside bodyB - if (supports.length < 2) { - var verticesA = SAT._findSupports(bodyB, bodyA, Vector.neg(collision.normal)); - - if (Vertices.contains(bodyB.vertices, verticesA[0])) supports.push(verticesA[0]); - - if (supports.length < 2 && Vertices.contains(bodyB.vertices, verticesA[1])) supports.push(verticesA[1]); - } - - // account for the edge case of overlapping but no vertex containment - if (supports.length < 1) supports = [verticesB[0]]; - - collision.supports = supports; - - return collision; - }; - - /** - * Find the overlap between two sets of vertices. - * @method _overlapAxes - * @private - * @param {} verticesA - * @param {} verticesB - * @param {} axes - * @return result - */ - SAT._overlapAxes = function (verticesA, verticesB, axes) { - var projectionA = Vector._temp[0], - projectionB = Vector._temp[1], - result = {overlap: Number.MAX_VALUE}, - overlap, - axis; - - for (var i = 0; i < axes.length; i++) { - axis = axes[i]; - - SAT._projectToAxis(projectionA, verticesA, axis); - SAT._projectToAxis(projectionB, verticesB, axis); - - overlap = Math.min(projectionA.max - projectionB.min, projectionB.max - projectionA.min); - - if (overlap <= 0) { - result.overlap = overlap; - return result; - } - - if (overlap < result.overlap) { - result.overlap = overlap; - result.axis = axis; - result.axisNumber = i; - } - } - - return result; - }; - - /** - * Projects vertices on an axis and returns an interval. - * @method _projectToAxis - * @private - * @param {} projection - * @param {} vertices - * @param {} axis - */ - SAT._projectToAxis = function (projection, vertices, axis) { - var min = Vector.dot(vertices[0], axis), - max = min; - - for (var i = 1; i < vertices.length; i += 1) { - var dot = Vector.dot(vertices[i], axis); - - if (dot > max) { - max = dot; - } else if (dot < min) { - min = dot; - } - } - - projection.min = min; - projection.max = max; - }; - - /** - * Finds supporting vertices given two bodies along a given direction using hill-climbing. - * @method _findSupports - * @private - * @param {} bodyA - * @param {} bodyB - * @param {} normal - * @return [vector] - */ - SAT._findSupports = function (bodyA, bodyB, normal) { - var nearestDistance = Number.MAX_VALUE, - vertexToBody = Vector._temp[0], - vertices = bodyB.vertices, - bodyAPosition = bodyA.position, - distance, - vertex, - vertexA, - vertexB; - - // find closest vertex on bodyB - for (var i = 0; i < vertices.length; i++) { - vertex = vertices[i]; - vertexToBody.x = vertex.x - bodyAPosition.x; - vertexToBody.y = vertex.y - bodyAPosition.y; - distance = -Vector.dot(normal, vertexToBody); - - if (distance < nearestDistance) { - nearestDistance = distance; - vertexA = vertex; - } - } - - // find next closest vertex using the two connected to it - var prevIndex = vertexA.index - 1 >= 0 ? vertexA.index - 1 : vertices.length - 1; - vertex = vertices[prevIndex]; - vertexToBody.x = vertex.x - bodyAPosition.x; - vertexToBody.y = vertex.y - bodyAPosition.y; - nearestDistance = -Vector.dot(normal, vertexToBody); - vertexB = vertex; - - var nextIndex = (vertexA.index + 1) % vertices.length; - vertex = vertices[nextIndex]; - vertexToBody.x = vertex.x - bodyAPosition.x; - vertexToBody.y = vertex.y - bodyAPosition.y; - distance = -Vector.dot(normal, vertexToBody); - if (distance < nearestDistance) { - vertexB = vertex; - } - - return [vertexA, vertexB]; - }; - })(); - - /***/ - }, - /* 14 */ - /***/ function (module, exports, __webpack_require__) { - /** - * The `Matter.Mouse` module contains methods for creating and manipulating mouse inputs. - * - * @class Mouse - */ - - var Mouse = {}; - - module.exports = Mouse; - - var Common = __webpack_require__(0); - - (function () { - /** - * Creates a mouse input. - * @method create - * @param {HTMLElement} element - * @return {mouse} A new mouse - */ - Mouse.create = function (element) { - var mouse = {}; - - if (!element) { - Common.log('Mouse.create: element was undefined, defaulting to document.body', 'warn'); - } - - mouse.element = element || document.body; - mouse.absolute = {x: 0, y: 0}; - mouse.position = {x: 0, y: 0}; - mouse.mousedownPosition = {x: 0, y: 0}; - mouse.mouseupPosition = {x: 0, y: 0}; - mouse.offset = {x: 0, y: 0}; - mouse.scale = {x: 1, y: 1}; - mouse.wheelDelta = 0; - mouse.button = -1; - mouse.pixelRatio = parseInt(mouse.element.getAttribute('data-pixel-ratio'), 10) || 1; - - mouse.sourceEvents = { - mousemove: null, - mousedown: null, - mouseup: null, - mousewheel: null, - }; - - mouse.mousemove = function (event) { - var position = Mouse._getRelativeMousePosition(event, mouse.element, mouse.pixelRatio), - touches = event.changedTouches; - - if (touches) { - mouse.button = 0; - event.preventDefault(); - } - - mouse.absolute.x = position.x; - mouse.absolute.y = position.y; - mouse.position.x = mouse.absolute.x * mouse.scale.x + mouse.offset.x; - mouse.position.y = mouse.absolute.y * mouse.scale.y + mouse.offset.y; - mouse.sourceEvents.mousemove = event; - }; - - mouse.mousedown = function (event) { - var position = Mouse._getRelativeMousePosition(event, mouse.element, mouse.pixelRatio), - touches = event.changedTouches; - - if (touches) { - mouse.button = 0; - event.preventDefault(); - } else { - mouse.button = event.button; - } - - mouse.absolute.x = position.x; - mouse.absolute.y = position.y; - mouse.position.x = mouse.absolute.x * mouse.scale.x + mouse.offset.x; - mouse.position.y = mouse.absolute.y * mouse.scale.y + mouse.offset.y; - mouse.mousedownPosition.x = mouse.position.x; - mouse.mousedownPosition.y = mouse.position.y; - mouse.sourceEvents.mousedown = event; - }; - - mouse.mouseup = function (event) { - var position = Mouse._getRelativeMousePosition(event, mouse.element, mouse.pixelRatio), - touches = event.changedTouches; - - if (touches) { - event.preventDefault(); - } - - mouse.button = -1; - mouse.absolute.x = position.x; - mouse.absolute.y = position.y; - mouse.position.x = mouse.absolute.x * mouse.scale.x + mouse.offset.x; - mouse.position.y = mouse.absolute.y * mouse.scale.y + mouse.offset.y; - mouse.mouseupPosition.x = mouse.position.x; - mouse.mouseupPosition.y = mouse.position.y; - mouse.sourceEvents.mouseup = event; - }; - - mouse.mousewheel = function (event) { - mouse.wheelDelta = Math.max(-1, Math.min(1, event.wheelDelta || -event.detail)); - event.preventDefault(); - }; - - Mouse.setElement(mouse, mouse.element); - - return mouse; - }; - - /** - * Sets the element the mouse is bound to (and relative to). - * @method setElement - * @param {mouse} mouse - * @param {HTMLElement} element - */ - Mouse.setElement = function (mouse, element) { - mouse.element = element; - - element.addEventListener('mousemove', mouse.mousemove); - element.addEventListener('mousedown', mouse.mousedown); - element.addEventListener('mouseup', mouse.mouseup); - - element.addEventListener('mousewheel', mouse.mousewheel); - element.addEventListener('DOMMouseScroll', mouse.mousewheel); - - element.addEventListener('touchmove', mouse.mousemove); - element.addEventListener('touchstart', mouse.mousedown); - element.addEventListener('touchend', mouse.mouseup); - }; - - /** - * Clears all captured source events. - * @method clearSourceEvents - * @param {mouse} mouse - */ - Mouse.clearSourceEvents = function (mouse) { - mouse.sourceEvents.mousemove = null; - mouse.sourceEvents.mousedown = null; - mouse.sourceEvents.mouseup = null; - mouse.sourceEvents.mousewheel = null; - mouse.wheelDelta = 0; - }; - - /** - * Sets the mouse position offset. - * @method setOffset - * @param {mouse} mouse - * @param {vector} offset - */ - Mouse.setOffset = function (mouse, offset) { - mouse.offset.x = offset.x; - mouse.offset.y = offset.y; - mouse.position.x = mouse.absolute.x * mouse.scale.x + mouse.offset.x; - mouse.position.y = mouse.absolute.y * mouse.scale.y + mouse.offset.y; - }; - - /** - * Sets the mouse position scale. - * @method setScale - * @param {mouse} mouse - * @param {vector} scale - */ - Mouse.setScale = function (mouse, scale) { - mouse.scale.x = scale.x; - mouse.scale.y = scale.y; - mouse.position.x = mouse.absolute.x * mouse.scale.x + mouse.offset.x; - mouse.position.y = mouse.absolute.y * mouse.scale.y + mouse.offset.y; - }; - - /** - * Gets the mouse position relative to an element given a screen pixel ratio. - * @method _getRelativeMousePosition - * @private - * @param {} event - * @param {} element - * @param {number} pixelRatio - * @return {} - */ - Mouse._getRelativeMousePosition = function (event, element, pixelRatio) { - var elementBounds = element.getBoundingClientRect(), - rootNode = document.documentElement || document.body.parentNode || document.body, - scrollX = window.pageXOffset !== undefined ? window.pageXOffset : rootNode.scrollLeft, - scrollY = window.pageYOffset !== undefined ? window.pageYOffset : rootNode.scrollTop, - touches = event.changedTouches, - x, - y; - - if (touches) { - x = touches[0].pageX - elementBounds.left - scrollX; - y = touches[0].pageY - elementBounds.top - scrollY; - } else { - x = event.pageX - elementBounds.left - scrollX; - y = event.pageY - elementBounds.top - scrollY; - } - - return { - x: x / ((element.clientWidth / (element.width || element.clientWidth)) * pixelRatio), - y: y / ((element.clientHeight / (element.height || element.clientHeight)) * pixelRatio), - }; - }; - })(); - - /***/ - }, - /* 15 */ - /***/ function (module, exports, __webpack_require__) { - /** - * The `Matter.Axes` module contains methods for creating and manipulating sets of axes. - * - * @class Axes - */ - - var Axes = {}; - - module.exports = Axes; - - var Vector = __webpack_require__(2); - var Common = __webpack_require__(0); - - (function () { - /** - * Creates a new set of axes from the given vertices. - * @method fromVertices - * @param {vertices} vertices - * @return {axes} A new axes from the given vertices - */ - Axes.fromVertices = function (vertices) { - var axes = {}; - - // find the unique axes, using edge normal gradients - for (var i = 0; i < vertices.length; i++) { - var j = (i + 1) % vertices.length, - normal = Vector.normalise({ - x: vertices[j].y - vertices[i].y, - y: vertices[i].x - vertices[j].x, - }), - gradient = normal.y === 0 ? Infinity : normal.x / normal.y; - - // limit precision - gradient = gradient.toFixed(3).toString(); - axes[gradient] = normal; - } - - return Common.values(axes); - }; - - /** - * Rotates a set of axes by the given angle. - * @method rotate - * @param {axes} axes - * @param {number} angle - */ - Axes.rotate = function (axes, angle) { - if (angle === 0) return; - - var cos = Math.cos(angle), - sin = Math.sin(angle); - - for (var i = 0; i < axes.length; i++) { - var axis = axes[i], - xx; - xx = axis.x * cos - axis.y * sin; - axis.y = axis.x * sin + axis.y * cos; - axis.x = xx; - } - }; - })(); - - /***/ - }, - /* 16 */ - /***/ function (module, exports, __webpack_require__) { - /** - * The `Matter.Bodies` module contains factory methods for creating rigid body models - * with commonly used body configurations (such as rectangles, circles and other polygons). - * - * See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples). - * - * @class Bodies - */ - - // TODO: true circle bodies - - var Bodies = {}; - - module.exports = Bodies; - - var Vertices = __webpack_require__(3); - var Common = __webpack_require__(0); - var Body = __webpack_require__(6); - var Bounds = __webpack_require__(1); - var Vector = __webpack_require__(2); - - (function () { - /** - * Creates a new rigid body model with a rectangle hull. - * The options parameter is an object that specifies any properties you wish to override the defaults. - * See the properties section of the `Matter.Body` module for detailed information on what you can pass via the `options` object. - * @method rectangle - * @param {number} x - * @param {number} y - * @param {number} width - * @param {number} height - * @param {object} [options] - * @return {body} A new rectangle body - */ - Bodies.rectangle = function (x, y, width, height, options) { - options = options || {}; - - var rectangle = { - label: 'Rectangle Body', - position: {x: x, y: y}, - vertices: Vertices.fromPath('L 0 0 L ' + width + ' 0 L ' + width + ' ' + height + ' L 0 ' + height), - }; - - if (options.chamfer) { - var chamfer = options.chamfer; - rectangle.vertices = Vertices.chamfer( - rectangle.vertices, - chamfer.radius, - chamfer.quality, - chamfer.qualityMin, - chamfer.qualityMax, - ); - delete options.chamfer; - } - - return Body.create(Common.extend({}, rectangle, options)); - }; - - /** - * Creates a new rigid body model with a trapezoid hull. - * The options parameter is an object that specifies any properties you wish to override the defaults. - * See the properties section of the `Matter.Body` module for detailed information on what you can pass via the `options` object. - * @method trapezoid - * @param {number} x - * @param {number} y - * @param {number} width - * @param {number} height - * @param {number} slope - * @param {object} [options] - * @return {body} A new trapezoid body - */ - Bodies.trapezoid = function (x, y, width, height, slope, options) { - options = options || {}; - - slope *= 0.5; - var roof = (1 - slope * 2) * width; - - var x1 = width * slope, - x2 = x1 + roof, - x3 = x2 + x1, - verticesPath; - - if (slope < 0.5) { - verticesPath = 'L 0 0 L ' + x1 + ' ' + -height + ' L ' + x2 + ' ' + -height + ' L ' + x3 + ' 0'; - } else { - verticesPath = 'L 0 0 L ' + x2 + ' ' + -height + ' L ' + x3 + ' 0'; - } - - var trapezoid = { - label: 'Trapezoid Body', - position: {x: x, y: y}, - vertices: Vertices.fromPath(verticesPath), - }; - - if (options.chamfer) { - var chamfer = options.chamfer; - trapezoid.vertices = Vertices.chamfer( - trapezoid.vertices, - chamfer.radius, - chamfer.quality, - chamfer.qualityMin, - chamfer.qualityMax, - ); - delete options.chamfer; - } - - return Body.create(Common.extend({}, trapezoid, options)); - }; - - /** - * Creates a new rigid body model with a circle hull. - * The options parameter is an object that specifies any properties you wish to override the defaults. - * See the properties section of the `Matter.Body` module for detailed information on what you can pass via the `options` object. - * @method circle - * @param {number} x - * @param {number} y - * @param {number} radius - * @param {object} [options] - * @param {number} [maxSides] - * @return {body} A new circle body - */ - Bodies.circle = function (x, y, radius, options, maxSides) { - options = options || {}; - - var circle = { - label: 'Circle Body', - circleRadius: radius, - }; - - // approximate circles with polygons until true circles implemented in SAT - maxSides = maxSides || 25; - var sides = Math.ceil(Math.max(10, Math.min(maxSides, radius))); - - // optimisation: always use even number of sides (half the number of unique axes) - if (sides % 2 === 1) sides += 1; - - return Bodies.polygon(x, y, sides, radius, Common.extend({}, circle, options)); - }; - - /** - * Creates a new rigid body model with a regular polygon hull with the given number of sides. - * The options parameter is an object that specifies any properties you wish to override the defaults. - * See the properties section of the `Matter.Body` module for detailed information on what you can pass via the `options` object. - * @method polygon - * @param {number} x - * @param {number} y - * @param {number} sides - * @param {number} radius - * @param {object} [options] - * @return {body} A new regular polygon body - */ - Bodies.polygon = function (x, y, sides, radius, options) { - options = options || {}; - - if (sides < 3) return Bodies.circle(x, y, radius, options); - - var theta = (2 * Math.PI) / sides, - path = '', - offset = theta * 0.5; - - for (var i = 0; i < sides; i += 1) { - var angle = offset + i * theta, - xx = Math.cos(angle) * radius, - yy = Math.sin(angle) * radius; - - path += 'L ' + xx.toFixed(3) + ' ' + yy.toFixed(3) + ' '; - } - - var polygon = { - label: 'Polygon Body', - position: {x: x, y: y}, - vertices: Vertices.fromPath(path), - }; - - if (options.chamfer) { - var chamfer = options.chamfer; - polygon.vertices = Vertices.chamfer( - polygon.vertices, - chamfer.radius, - chamfer.quality, - chamfer.qualityMin, - chamfer.qualityMax, - ); - delete options.chamfer; - } - - return Body.create(Common.extend({}, polygon, options)); - }; - - /** - * Creates a body using the supplied vertices (or an array containing multiple sets of vertices). - * If the vertices are convex, they will pass through as supplied. - * Otherwise if the vertices are concave, they will be decomposed if [poly-decomp.js](https://github.com/schteppe/poly-decomp.js) is available. - * Note that this process is not guaranteed to support complex sets of vertices (e.g. those with holes may fail). - * By default the decomposition will discard collinear edges (to improve performance). - * It can also optionally discard any parts that have an area less than `minimumArea`. - * If the vertices can not be decomposed, the result will fall back to using the convex hull. - * The options parameter is an object that specifies any `Matter.Body` properties you wish to override the defaults. - * See the properties section of the `Matter.Body` module for detailed information on what you can pass via the `options` object. - * @method fromVertices - * @param {number} x - * @param {number} y - * @param [[vector]] vertexSets - * @param {object} [options] - * @param {bool} [flagInternal=false] - * @param {number} [removeCollinear=0.01] - * @param {number} [minimumArea=10] - * @return {body} - */ - Bodies.fromVertices = function (x, y, vertexSets, options, flagInternal, removeCollinear, minimumArea) { - var globals = typeof global$1 !== 'undefined' ? global$1 : window, - decomp, - body, - parts, - isConvex, - vertices, - i, - j, - k, - v, - z; - - try { - decomp = globals.decomp || __webpack_require__(27); - } catch (e) { - // decomp is undefined - } - - options = options || {}; - parts = []; - - flagInternal = typeof flagInternal !== 'undefined' ? flagInternal : false; - removeCollinear = typeof removeCollinear !== 'undefined' ? removeCollinear : 0.01; - minimumArea = typeof minimumArea !== 'undefined' ? minimumArea : 10; - - if (!decomp) { - Common.warn( - 'Bodies.fromVertices: poly-decomp.js required. Could not decompose vertices. Fallback to convex hull.', - ); - } - - // ensure vertexSets is an array of arrays - if (!Common.isArray(vertexSets[0])) { - vertexSets = [vertexSets]; - } - - for (v = 0; v < vertexSets.length; v += 1) { - vertices = vertexSets[v]; - isConvex = Vertices.isConvex(vertices); - - if (isConvex || !decomp) { - if (isConvex) { - vertices = Vertices.clockwiseSort(vertices); - } else { - // fallback to convex hull when decomposition is not possible - vertices = Vertices.hull(vertices); - } - - parts.push({ - position: {x: x, y: y}, - vertices: vertices, - }); - } else { - // initialise a decomposition - var concave = vertices.map(function (vertex) { - return [vertex.x, vertex.y]; - }); - - // vertices are concave and simple, we can decompose into parts - decomp.makeCCW(concave); - if (removeCollinear !== false) decomp.removeCollinearPoints(concave, removeCollinear); - - // use the quick decomposition algorithm (Bayazit) - var decomposed = decomp.quickDecomp(concave); - - // for each decomposed chunk - for (i = 0; i < decomposed.length; i++) { - var chunk = decomposed[i]; - - // convert vertices into the correct structure - var chunkVertices = chunk.map(function (vertices) { - return { - x: vertices[0], - y: vertices[1], - }; - }); - - // skip small chunks - if (minimumArea > 0 && Vertices.area(chunkVertices) < minimumArea) continue; - - // create a compound part - parts.push({ - position: Vertices.centre(chunkVertices), - vertices: chunkVertices, - }); - } - } - } - - // create body parts - for (i = 0; i < parts.length; i++) { - parts[i] = Body.create(Common.extend(parts[i], options)); - } - - // flag internal edges (coincident part edges) - if (flagInternal) { - var coincident_max_dist = 5; - - for (i = 0; i < parts.length; i++) { - var partA = parts[i]; - - for (j = i + 1; j < parts.length; j++) { - var partB = parts[j]; - - if (Bounds.overlaps(partA.bounds, partB.bounds)) { - var pav = partA.vertices, - pbv = partB.vertices; - - // iterate vertices of both parts - for (k = 0; k < partA.vertices.length; k++) { - for (z = 0; z < partB.vertices.length; z++) { - // find distances between the vertices - var da = Vector.magnitudeSquared(Vector.sub(pav[(k + 1) % pav.length], pbv[z])), - db = Vector.magnitudeSquared(Vector.sub(pav[k], pbv[(z + 1) % pbv.length])); - - // if both vertices are very close, consider the edge concident (internal) - if (da < coincident_max_dist && db < coincident_max_dist) { - pav[k].isInternal = true; - pbv[z].isInternal = true; - } - } - } - } - } - } - } - - if (parts.length > 1) { - // create the parent body to be returned, that contains generated compound parts - body = Body.create(Common.extend({parts: parts.slice(0)}, options)); - Body.setPosition(body, {x: x, y: y}); - - return body; - } else { - return parts[0]; - } - }; - })(); - - /***/ - }, - /* 17 */ - /***/ function (module, exports, __webpack_require__) { - /** - * The `Matter.Plugin` module contains functions for registering and installing plugins on modules. - * - * @class Plugin - */ - - var Plugin = {}; - - module.exports = Plugin; - - var Common = __webpack_require__(0); - - (function () { - Plugin._registry = {}; - - /** - * Registers a plugin object so it can be resolved later by name. - * @method register - * @param plugin {} The plugin to register. - * @return {object} The plugin. - */ - Plugin.register = function (plugin) { - if (!Plugin.isPlugin(plugin)) { - Common.warn('Plugin.register:', Plugin.toString(plugin), 'does not implement all required fields.'); - } - - if (plugin.name in Plugin._registry) { - var registered = Plugin._registry[plugin.name], - pluginVersion = Plugin.versionParse(plugin.version).number, - registeredVersion = Plugin.versionParse(registered.version).number; - - if (pluginVersion > registeredVersion) { - Common.warn( - 'Plugin.register:', - Plugin.toString(registered), - 'was upgraded to', - Plugin.toString(plugin), - ); - Plugin._registry[plugin.name] = plugin; - } else if (pluginVersion < registeredVersion) { - Common.warn( - 'Plugin.register:', - Plugin.toString(registered), - 'can not be downgraded to', - Plugin.toString(plugin), - ); - } else if (plugin !== registered) { - Common.warn( - 'Plugin.register:', - Plugin.toString(plugin), - 'is already registered to different plugin object', - ); - } - } else { - Plugin._registry[plugin.name] = plugin; - } - - return plugin; - }; - - /** - * Resolves a dependency to a plugin object from the registry if it exists. - * The `dependency` may contain a version, but only the name matters when resolving. - * @method resolve - * @param dependency {string} The dependency. - * @return {object} The plugin if resolved, otherwise `undefined`. - */ - Plugin.resolve = function (dependency) { - return Plugin._registry[Plugin.dependencyParse(dependency).name]; - }; - - /** - * Returns a pretty printed plugin name and version. - * @method toString - * @param plugin {} The plugin. - * @return {string} Pretty printed plugin name and version. - */ - Plugin.toString = function (plugin) { - return typeof plugin === 'string' - ? plugin - : (plugin.name || 'anonymous') + '@' + (plugin.version || plugin.range || '0.0.0'); - }; - - /** - * Returns `true` if the object meets the minimum standard to be considered a plugin. - * This means it must define the following properties: - * - `name` - * - `version` - * - `install` - * @method isPlugin - * @param obj {} The obj to test. - * @return {boolean} `true` if the object can be considered a plugin otherwise `false`. - */ - Plugin.isPlugin = function (obj) { - return obj && obj.name && obj.version && obj.install; - }; - - /** - * Returns `true` if a plugin with the given `name` been installed on `module`. - * @method isUsed - * @param module {} The module. - * @param name {string} The plugin name. - * @return {boolean} `true` if a plugin with the given `name` been installed on `module`, otherwise `false`. - */ - Plugin.isUsed = function (module, name) { - return module.used.indexOf(name) > -1; - }; - - /** - * Returns `true` if `plugin.for` is applicable to `module` by comparing against `module.name` and `module.version`. - * If `plugin.for` is not specified then it is assumed to be applicable. - * The value of `plugin.for` is a string of the format `'module-name'` or `'module-name@version'`. - * @method isFor - * @param plugin {} The plugin. - * @param module {} The module. - * @return {boolean} `true` if `plugin.for` is applicable to `module`, otherwise `false`. - */ - Plugin.isFor = function (plugin, module) { - var parsed = plugin.for && Plugin.dependencyParse(plugin.for); - return ( - !plugin.for || (module.name === parsed.name && Plugin.versionSatisfies(module.version, parsed.range)) - ); - }; - - /** - * Installs the plugins by calling `plugin.install` on each plugin specified in `plugins` if passed, otherwise `module.uses`. - * For installing plugins on `Matter` see the convenience function `Matter.use`. - * Plugins may be specified either by their name or a reference to the plugin object. - * Plugins themselves may specify further dependencies, but each plugin is installed only once. - * Order is important, a topological sort is performed to find the best resulting order of installation. - * This sorting attempts to satisfy every dependency's requested ordering, but may not be exact in all cases. - * This function logs the resulting status of each dependency in the console, along with any warnings. - * - A green tick ✅ indicates a dependency was resolved and installed. - * - An orange diamond 🔶 indicates a dependency was resolved but a warning was thrown for it or one if its dependencies. - * - A red cross ❌ indicates a dependency could not be resolved. - * Avoid calling this function multiple times on the same module unless you intend to manually control installation order. - * @method use - * @param module {} The module install plugins on. - * @param [plugins=module.uses] {} The plugins to install on module (optional, defaults to `module.uses`). - */ - Plugin.use = function (module, plugins) { - module.uses = (module.uses || []).concat(plugins || []); - - if (module.uses.length === 0) { - Common.warn('Plugin.use:', Plugin.toString(module), 'does not specify any dependencies to install.'); - return; - } - - var dependencies = Plugin.dependencies(module), - sortedDependencies = Common.topologicalSort(dependencies), - status = []; - - for (var i = 0; i < sortedDependencies.length; i += 1) { - if (sortedDependencies[i] === module.name) { - continue; - } - - var plugin = Plugin.resolve(sortedDependencies[i]); - - if (!plugin) { - status.push('❌ ' + sortedDependencies[i]); - continue; - } - - if (Plugin.isUsed(module, plugin.name)) { - continue; - } - - if (!Plugin.isFor(plugin, module)) { - Common.warn( - 'Plugin.use:', - Plugin.toString(plugin), - 'is for', - plugin.for, - 'but installed on', - Plugin.toString(module) + '.', - ); - plugin._warned = true; - } - - if (plugin.install) { - plugin.install(module); - } else { - Common.warn('Plugin.use:', Plugin.toString(plugin), 'does not specify an install function.'); - plugin._warned = true; - } - - if (plugin._warned) { - status.push('🔶 ' + Plugin.toString(plugin)); - delete plugin._warned; - } else { - status.push('✅ ' + Plugin.toString(plugin)); - } - - module.used.push(plugin.name); - } - - if (status.length > 0) { - Common.info(status.join(' ')); - } - }; - - /** - * Recursively finds all of a module's dependencies and returns a flat dependency graph. - * @method dependencies - * @param module {} The module. - * @return {object} A dependency graph. - */ - Plugin.dependencies = function (module, tracked) { - var parsedBase = Plugin.dependencyParse(module), - name = parsedBase.name; - - tracked = tracked || {}; - - if (name in tracked) { - return; - } - - module = Plugin.resolve(module) || module; - - tracked[name] = Common.map(module.uses || [], function (dependency) { - if (Plugin.isPlugin(dependency)) { - Plugin.register(dependency); - } - - var parsed = Plugin.dependencyParse(dependency), - resolved = Plugin.resolve(dependency); - - if (resolved && !Plugin.versionSatisfies(resolved.version, parsed.range)) { - Common.warn( - 'Plugin.dependencies:', - Plugin.toString(resolved), - 'does not satisfy', - Plugin.toString(parsed), - 'used by', - Plugin.toString(parsedBase) + '.', - ); - - resolved._warned = true; - module._warned = true; - } else if (!resolved) { - Common.warn( - 'Plugin.dependencies:', - Plugin.toString(dependency), - 'used by', - Plugin.toString(parsedBase), - 'could not be resolved.', - ); - - module._warned = true; - } - - return parsed.name; - }); - - for (var i = 0; i < tracked[name].length; i += 1) { - Plugin.dependencies(tracked[name][i], tracked); - } - - return tracked; - }; - - /** - * Parses a dependency string into its components. - * The `dependency` is a string of the format `'module-name'` or `'module-name@version'`. - * See documentation for `Plugin.versionParse` for a description of the format. - * This function can also handle dependencies that are already resolved (e.g. a module object). - * @method dependencyParse - * @param dependency {string} The dependency of the format `'module-name'` or `'module-name@version'`. - * @return {object} The dependency parsed into its components. - */ - Plugin.dependencyParse = function (dependency) { - if (Common.isString(dependency)) { - var pattern = /^[\w-]+(@(\*|[\^~]?\d+\.\d+\.\d+(-[0-9A-Za-z-]+)?))?$/; - - if (!pattern.test(dependency)) { - Common.warn('Plugin.dependencyParse:', dependency, 'is not a valid dependency string.'); - } - - return { - name: dependency.split('@')[0], - range: dependency.split('@')[1] || '*', - }; - } - - return { - name: dependency.name, - range: dependency.range || dependency.version, - }; - }; - - /** - * Parses a version string into its components. - * Versions are strictly of the format `x.y.z` (as in [semver](http://semver.org/)). - * Versions may optionally have a prerelease tag in the format `x.y.z-alpha`. - * Ranges are a strict subset of [npm ranges](https://docs.npmjs.com/misc/semver#advanced-range-syntax). - * Only the following range types are supported: - * - Tilde ranges e.g. `~1.2.3` - * - Caret ranges e.g. `^1.2.3` - * - Exact version e.g. `1.2.3` - * - Any version `*` - * @method versionParse - * @param range {string} The version string. - * @return {object} The version range parsed into its components. - */ - Plugin.versionParse = function (range) { - var pattern = /^\*|[\^~]?\d+\.\d+\.\d+(-[0-9A-Za-z-]+)?$/; - - if (!pattern.test(range)) { - Common.warn('Plugin.versionParse:', range, 'is not a valid version or range.'); - } - - var identifiers = range.split('-'); - range = identifiers[0]; - - var isRange = isNaN(Number(range[0])), - version = isRange ? range.substr(1) : range, - parts = Common.map(version.split('.'), function (part) { - return Number(part); - }); - - return { - isRange: isRange, - version: version, - range: range, - operator: isRange ? range[0] : '', - parts: parts, - prerelease: identifiers[1], - number: parts[0] * 1e8 + parts[1] * 1e4 + parts[2], - }; - }; - - /** - * Returns `true` if `version` satisfies the given `range`. - * See documentation for `Plugin.versionParse` for a description of the format. - * If a version or range is not specified, then any version (`*`) is assumed to satisfy. - * @method versionSatisfies - * @param version {string} The version string. - * @param range {string} The range string. - * @return {boolean} `true` if `version` satisfies `range`, otherwise `false`. - */ - Plugin.versionSatisfies = function (version, range) { - range = range || '*'; - - var rangeParsed = Plugin.versionParse(range), - rangeParts = rangeParsed.parts, - versionParsed = Plugin.versionParse(version), - versionParts = versionParsed.parts; - - if (rangeParsed.isRange) { - if (rangeParsed.operator === '*' || version === '*') { - return true; - } - - if (rangeParsed.operator === '~') { - return ( - versionParts[0] === rangeParts[0] && - versionParts[1] === rangeParts[1] && - versionParts[2] >= rangeParts[2] - ); - } - - if (rangeParsed.operator === '^') { - if (rangeParts[0] > 0) { - return versionParts[0] === rangeParts[0] && versionParsed.number >= rangeParsed.number; - } - - if (rangeParts[1] > 0) { - return versionParts[1] === rangeParts[1] && versionParts[2] >= rangeParts[2]; - } - - return versionParts[2] === rangeParts[2]; - } - } - - return version === range || version === '*'; - }; - })(); - - /***/ - }, - /* 18 */ - /***/ function (module, exports) { - /** - * The `Matter.Contact` module contains methods for creating and manipulating collision contacts. - * - * @class Contact - */ - - var Contact = {}; - - module.exports = Contact; - - (function () { - /** - * Creates a new contact. - * @method create - * @param {vertex} vertex - * @return {contact} A new contact - */ - Contact.create = function (vertex) { - return { - id: Contact.id(vertex), - vertex: vertex, - normalImpulse: 0, - tangentImpulse: 0, - }; - }; - - /** - * Generates a contact id. - * @method id - * @param {vertex} vertex - * @return {string} Unique contactID - */ - Contact.id = function (vertex) { - return vertex.body.id + '_' + vertex.index; - }; - })(); - - /***/ - }, - /* 19 */ - /***/ function (module, exports, __webpack_require__) { - /** - * The `Matter.World` module contains methods for creating and manipulating the world composite. - * A `Matter.World` is a `Matter.Composite` body, which is a collection of `Matter.Body`, `Matter.Constraint` and other `Matter.Composite`. - * A `Matter.World` has a few additional properties including `gravity` and `bounds`. - * It is important to use the functions in the `Matter.Composite` module to modify the world composite, rather than directly modifying its properties. - * There are also a few methods here that alias those in `Matter.Composite` for easier readability. - * - * See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples). - * - * @class World - * @extends Composite - */ - - var World = {}; - - module.exports = World; - - var Composite = __webpack_require__(5); - __webpack_require__(8); - var Common = __webpack_require__(0); - - (function () { - /** - * Creates a new world composite. The options parameter is an object that specifies any properties you wish to override the defaults. - * See the properties section below for detailed information on what you can pass via the `options` object. - * @method create - * @constructor - * @param {} options - * @return {world} A new world - */ - World.create = function (options) { - var composite = Composite.create(); - - var defaults = { - label: 'World', - gravity: { - x: 0, - y: 1, - scale: 0.001, - }, - bounds: { - min: {x: -Infinity, y: -Infinity}, - max: {x: Infinity, y: Infinity}, - }, - }; - - return Common.extend(composite, defaults, options); - }; - - /* - * - * Properties Documentation - * - */ - - /** - * The gravity to apply on the world. - * - * @property gravity - * @type object - */ - - /** - * The gravity x component. - * - * @property gravity.x - * @type object - * @default 0 - */ - - /** - * The gravity y component. - * - * @property gravity.y - * @type object - * @default 1 - */ - - /** - * The gravity scale factor. - * - * @property gravity.scale - * @type object - * @default 0.001 - */ - - /** - * A `Bounds` object that defines the world bounds for collision detection. - * - * @property bounds - * @type bounds - * @default { min: { x: -Infinity, y: -Infinity }, max: { x: Infinity, y: Infinity } } - */ - - // World is a Composite body - // see src/module/Outro.js for these aliases: - - /** - * An alias for Composite.add - * @method add - * @param {world} world - * @param {} object - * @return {composite} The original world with the objects added - */ - - /** - * An alias for Composite.remove - * @method remove - * @param {world} world - * @param {} object - * @param {boolean} [deep=false] - * @return {composite} The original world with the objects removed - */ - - /** - * An alias for Composite.clear - * @method clear - * @param {world} world - * @param {boolean} keepStatic - */ - - /** - * An alias for Composite.addComposite - * @method addComposite - * @param {world} world - * @param {composite} composite - * @return {world} The original world with the objects from composite added - */ - - /** - * An alias for Composite.addBody - * @method addBody - * @param {world} world - * @param {body} body - * @return {world} The original world with the body added - */ - - /** - * An alias for Composite.addConstraint - * @method addConstraint - * @param {world} world - * @param {constraint} constraint - * @return {world} The original world with the constraint added - */ - })(); - - /***/ - }, - /* 20 */ - /***/ function (module, exports, __webpack_require__) { - /** - * The `Matter.Pairs` module contains methods for creating and manipulating collision pair sets. - * - * @class Pairs - */ - - var Pairs = {}; - - module.exports = Pairs; - - var Pair = __webpack_require__(9); - var Common = __webpack_require__(0); - - (function () { - Pairs._pairMaxIdleLife = 1000; - - /** - * Creates a new pairs structure. - * @method create - * @param {object} options - * @return {pairs} A new pairs structure - */ - Pairs.create = function (options) { - return Common.extend( - { - table: {}, - list: [], - collisionStart: [], - collisionActive: [], - collisionEnd: [], - }, - options, - ); - }; - - /** - * Updates pairs given a list of collisions. - * @method update - * @param {object} pairs - * @param {collision[]} collisions - * @param {number} timestamp - */ - Pairs.update = function (pairs, collisions, timestamp) { - var pairsList = pairs.list, - pairsTable = pairs.table, - collisionStart = pairs.collisionStart, - collisionEnd = pairs.collisionEnd, - collisionActive = pairs.collisionActive, - collision, - pairId, - pair, - i; - - // clear collision state arrays, but maintain old reference - collisionStart.length = 0; - collisionEnd.length = 0; - collisionActive.length = 0; - - for (i = 0; i < pairsList.length; i++) { - pairsList[i].confirmedActive = false; - } - - for (i = 0; i < collisions.length; i++) { - collision = collisions[i]; - - if (collision.collided) { - pairId = Pair.id(collision.bodyA, collision.bodyB); - - pair = pairsTable[pairId]; - - if (pair) { - // pair already exists (but may or may not be active) - if (pair.isActive) { - // pair exists and is active - collisionActive.push(pair); - } else { - // pair exists but was inactive, so a collision has just started again - collisionStart.push(pair); - } - - // update the pair - Pair.update(pair, collision, timestamp); - pair.confirmedActive = true; - } else { - // pair did not exist, create a new pair - pair = Pair.create(collision, timestamp); - pairsTable[pairId] = pair; - - // push the new pair - collisionStart.push(pair); - pairsList.push(pair); - } - } - } - - // deactivate previously active pairs that are now inactive - for (i = 0; i < pairsList.length; i++) { - pair = pairsList[i]; - if (pair.isActive && !pair.confirmedActive) { - Pair.setActive(pair, false, timestamp); - collisionEnd.push(pair); - } - } - }; - - /** - * Finds and removes pairs that have been inactive for a set amount of time. - * @method removeOld - * @param {object} pairs - * @param {number} timestamp - */ - Pairs.removeOld = function (pairs, timestamp) { - var pairsList = pairs.list, - pairsTable = pairs.table, - indexesToRemove = [], - pair, - collision, - pairIndex, - i; - - for (i = 0; i < pairsList.length; i++) { - pair = pairsList[i]; - collision = pair.collision; - - // never remove sleeping pairs - if (collision.bodyA.isSleeping || collision.bodyB.isSleeping) { - pair.timeUpdated = timestamp; - continue; - } - - // if pair is inactive for too long, mark it to be removed - if (timestamp - pair.timeUpdated > Pairs._pairMaxIdleLife) { - indexesToRemove.push(i); - } - } - - // remove marked pairs - for (i = 0; i < indexesToRemove.length; i++) { - pairIndex = indexesToRemove[i] - i; - pair = pairsList[pairIndex]; - delete pairsTable[pair.id]; - pairsList.splice(pairIndex, 1); - } - }; - - /** - * Clears the given pairs structure. - * @method clear - * @param {pairs} pairs - * @return {pairs} pairs - */ - Pairs.clear = function (pairs) { - pairs.table = {}; - pairs.list.length = 0; - pairs.collisionStart.length = 0; - pairs.collisionActive.length = 0; - pairs.collisionEnd.length = 0; - return pairs; - }; - })(); - - /***/ - }, - /* 21 */ - /***/ function (module, exports, __webpack_require__) { - /** - * The `Matter.Resolver` module contains methods for resolving collision pairs. - * - * @class Resolver - */ - - var Resolver = {}; - - module.exports = Resolver; - - var Vertices = __webpack_require__(3); - var Vector = __webpack_require__(2); - var Common = __webpack_require__(0); - var Bounds = __webpack_require__(1); - - (function () { - Resolver._restingThresh = 4; - Resolver._restingThreshTangent = 6; - Resolver._positionDampen = 0.9; - Resolver._positionWarming = 0.8; - Resolver._frictionNormalMultiplier = 5; - - /** - * Prepare pairs for position solving. - * @method preSolvePosition - * @param {pair[]} pairs - */ - Resolver.preSolvePosition = function (pairs) { - var i, pair, activeCount; - - // find total contacts on each body - for (i = 0; i < pairs.length; i++) { - pair = pairs[i]; - - if (!pair.isActive) continue; - - activeCount = pair.activeContacts.length; - pair.collision.parentA.totalContacts += activeCount; - pair.collision.parentB.totalContacts += activeCount; - } - }; - - /** - * Find a solution for pair positions. - * @method solvePosition - * @param {pair[]} pairs - * @param {number} timeScale - */ - Resolver.solvePosition = function (pairs, timeScale) { - var i, - pair, - collision, - bodyA, - bodyB, - normal, - bodyBtoA, - contactShare, - positionImpulse, - tempA = Vector._temp[0], - tempB = Vector._temp[1], - tempC = Vector._temp[2], - tempD = Vector._temp[3]; - - // find impulses required to resolve penetration - for (i = 0; i < pairs.length; i++) { - pair = pairs[i]; - - if (!pair.isActive || pair.isSensor) continue; - - collision = pair.collision; - bodyA = collision.parentA; - bodyB = collision.parentB; - normal = collision.normal; - - // get current separation between body edges involved in collision - bodyBtoA = Vector.sub( - Vector.add(bodyB.positionImpulse, bodyB.position, tempA), - Vector.add(bodyA.positionImpulse, Vector.sub(bodyB.position, collision.penetration, tempB), tempC), - tempD, - ); - - pair.separation = Vector.dot(normal, bodyBtoA); - } - - for (i = 0; i < pairs.length; i++) { - pair = pairs[i]; - - if (!pair.isActive || pair.isSensor) continue; - - collision = pair.collision; - bodyA = collision.parentA; - bodyB = collision.parentB; - normal = collision.normal; - positionImpulse = (pair.separation - pair.slop) * timeScale; - - if (bodyA.isStatic || bodyB.isStatic) positionImpulse *= 2; - - if (!(bodyA.isStatic || bodyA.isSleeping)) { - contactShare = Resolver._positionDampen / bodyA.totalContacts; - bodyA.positionImpulse.x += normal.x * positionImpulse * contactShare; - bodyA.positionImpulse.y += normal.y * positionImpulse * contactShare; - } - - if (!(bodyB.isStatic || bodyB.isSleeping)) { - contactShare = Resolver._positionDampen / bodyB.totalContacts; - bodyB.positionImpulse.x -= normal.x * positionImpulse * contactShare; - bodyB.positionImpulse.y -= normal.y * positionImpulse * contactShare; - } - } - }; - - /** - * Apply position resolution. - * @method postSolvePosition - * @param {body[]} bodies - */ - Resolver.postSolvePosition = function (bodies) { - for (var i = 0; i < bodies.length; i++) { - var body = bodies[i]; - - // reset contact count - body.totalContacts = 0; - - if (body.positionImpulse.x !== 0 || body.positionImpulse.y !== 0) { - // update body geometry - for (var j = 0; j < body.parts.length; j++) { - var part = body.parts[j]; - Vertices.translate(part.vertices, body.positionImpulse); - Bounds.update(part.bounds, part.vertices, body.velocity); - part.position.x += body.positionImpulse.x; - part.position.y += body.positionImpulse.y; - } - - // move the body without changing velocity - body.positionPrev.x += body.positionImpulse.x; - body.positionPrev.y += body.positionImpulse.y; - - if (Vector.dot(body.positionImpulse, body.velocity) < 0) { - // reset cached impulse if the body has velocity along it - body.positionImpulse.x = 0; - body.positionImpulse.y = 0; - } else { - // warm the next iteration - body.positionImpulse.x *= Resolver._positionWarming; - body.positionImpulse.y *= Resolver._positionWarming; - } - } - } - }; - - /** - * Prepare pairs for velocity solving. - * @method preSolveVelocity - * @param {pair[]} pairs - */ - Resolver.preSolveVelocity = function (pairs) { - var i, - j, - pair, - contacts, - collision, - bodyA, - bodyB, - normal, - tangent, - contact, - contactVertex, - normalImpulse, - tangentImpulse, - offset, - impulse = Vector._temp[0], - tempA = Vector._temp[1]; - - for (i = 0; i < pairs.length; i++) { - pair = pairs[i]; - - if (!pair.isActive || pair.isSensor) continue; - - contacts = pair.activeContacts; - collision = pair.collision; - bodyA = collision.parentA; - bodyB = collision.parentB; - normal = collision.normal; - tangent = collision.tangent; - - // resolve each contact - for (j = 0; j < contacts.length; j++) { - contact = contacts[j]; - contactVertex = contact.vertex; - normalImpulse = contact.normalImpulse; - tangentImpulse = contact.tangentImpulse; - - if (normalImpulse !== 0 || tangentImpulse !== 0) { - // total impulse from contact - impulse.x = normal.x * normalImpulse + tangent.x * tangentImpulse; - impulse.y = normal.y * normalImpulse + tangent.y * tangentImpulse; - - // apply impulse from contact - if (!(bodyA.isStatic || bodyA.isSleeping)) { - offset = Vector.sub(contactVertex, bodyA.position, tempA); - bodyA.positionPrev.x += impulse.x * bodyA.inverseMass; - bodyA.positionPrev.y += impulse.y * bodyA.inverseMass; - bodyA.anglePrev += Vector.cross(offset, impulse) * bodyA.inverseInertia; - } - - if (!(bodyB.isStatic || bodyB.isSleeping)) { - offset = Vector.sub(contactVertex, bodyB.position, tempA); - bodyB.positionPrev.x -= impulse.x * bodyB.inverseMass; - bodyB.positionPrev.y -= impulse.y * bodyB.inverseMass; - bodyB.anglePrev -= Vector.cross(offset, impulse) * bodyB.inverseInertia; - } - } - } - } - }; - - /** - * Find a solution for pair velocities. - * @method solveVelocity - * @param {pair[]} pairs - * @param {number} timeScale - */ - Resolver.solveVelocity = function (pairs, timeScale) { - var timeScaleSquared = timeScale * timeScale, - impulse = Vector._temp[0], - tempA = Vector._temp[1], - tempB = Vector._temp[2], - tempC = Vector._temp[3], - tempD = Vector._temp[4], - tempE = Vector._temp[5]; - - for (var i = 0; i < pairs.length; i++) { - var pair = pairs[i]; - - if (!pair.isActive || pair.isSensor) continue; - - var collision = pair.collision, - bodyA = collision.parentA, - bodyB = collision.parentB, - normal = collision.normal, - tangent = collision.tangent, - contacts = pair.activeContacts, - contactShare = 1 / contacts.length; - - // update body velocities - bodyA.velocity.x = bodyA.position.x - bodyA.positionPrev.x; - bodyA.velocity.y = bodyA.position.y - bodyA.positionPrev.y; - bodyB.velocity.x = bodyB.position.x - bodyB.positionPrev.x; - bodyB.velocity.y = bodyB.position.y - bodyB.positionPrev.y; - bodyA.angularVelocity = bodyA.angle - bodyA.anglePrev; - bodyB.angularVelocity = bodyB.angle - bodyB.anglePrev; - - // resolve each contact - for (var j = 0; j < contacts.length; j++) { - var contact = contacts[j], - contactVertex = contact.vertex, - offsetA = Vector.sub(contactVertex, bodyA.position, tempA), - offsetB = Vector.sub(contactVertex, bodyB.position, tempB), - velocityPointA = Vector.add( - bodyA.velocity, - Vector.mult(Vector.perp(offsetA), bodyA.angularVelocity), - tempC, - ), - velocityPointB = Vector.add( - bodyB.velocity, - Vector.mult(Vector.perp(offsetB), bodyB.angularVelocity), - tempD, - ), - relativeVelocity = Vector.sub(velocityPointA, velocityPointB, tempE), - normalVelocity = Vector.dot(normal, relativeVelocity); - - var tangentVelocity = Vector.dot(tangent, relativeVelocity), - tangentSpeed = Math.abs(tangentVelocity), - tangentVelocityDirection = Common.sign(tangentVelocity); - - // raw impulses - var normalImpulse = (1 + pair.restitution) * normalVelocity, - normalForce = - Common.clamp(pair.separation + normalVelocity, 0, 1) * Resolver._frictionNormalMultiplier; - - // coulomb friction - var tangentImpulse = tangentVelocity, - maxFriction = Infinity; - - if (tangentSpeed > pair.friction * pair.frictionStatic * normalForce * timeScaleSquared) { - maxFriction = tangentSpeed; - tangentImpulse = Common.clamp( - pair.friction * tangentVelocityDirection * timeScaleSquared, - -maxFriction, - maxFriction, - ); - } - - // modify impulses accounting for mass, inertia and offset - var oAcN = Vector.cross(offsetA, normal), - oBcN = Vector.cross(offsetB, normal), - share = - contactShare / - (bodyA.inverseMass + - bodyB.inverseMass + - bodyA.inverseInertia * oAcN * oAcN + - bodyB.inverseInertia * oBcN * oBcN); - - normalImpulse *= share; - tangentImpulse *= share; - - // handle high velocity and resting collisions separately - if ( - normalVelocity < 0 && - normalVelocity * normalVelocity > Resolver._restingThresh * timeScaleSquared - ) { - // high normal velocity so clear cached contact normal impulse - contact.normalImpulse = 0; - } else { - // solve resting collision constraints using Erin Catto's method (GDC08) - // impulse constraint tends to 0 - var contactNormalImpulse = contact.normalImpulse; - contact.normalImpulse = Math.min(contact.normalImpulse + normalImpulse, 0); - normalImpulse = contact.normalImpulse - contactNormalImpulse; - } - - // handle high velocity and resting collisions separately - if (tangentVelocity * tangentVelocity > Resolver._restingThreshTangent * timeScaleSquared) { - // high tangent velocity so clear cached contact tangent impulse - contact.tangentImpulse = 0; - } else { - // solve resting collision constraints using Erin Catto's method (GDC08) - // tangent impulse tends to -tangentSpeed or +tangentSpeed - var contactTangentImpulse = contact.tangentImpulse; - contact.tangentImpulse = Common.clamp( - contact.tangentImpulse + tangentImpulse, - -maxFriction, - maxFriction, - ); - tangentImpulse = contact.tangentImpulse - contactTangentImpulse; - } - - // total impulse from contact - impulse.x = normal.x * normalImpulse + tangent.x * tangentImpulse; - impulse.y = normal.y * normalImpulse + tangent.y * tangentImpulse; - - // apply impulse from contact - if (!(bodyA.isStatic || bodyA.isSleeping)) { - bodyA.positionPrev.x += impulse.x * bodyA.inverseMass; - bodyA.positionPrev.y += impulse.y * bodyA.inverseMass; - bodyA.anglePrev += Vector.cross(offsetA, impulse) * bodyA.inverseInertia; - } - - if (!(bodyB.isStatic || bodyB.isSleeping)) { - bodyB.positionPrev.x -= impulse.x * bodyB.inverseMass; - bodyB.positionPrev.y -= impulse.y * bodyB.inverseMass; - bodyB.anglePrev -= Vector.cross(offsetB, impulse) * bodyB.inverseInertia; - } - } - } - }; - })(); - - /***/ - }, - /* 22 */ - /***/ function (module, exports, __webpack_require__) { - /** - * The `Matter.Engine` module contains methods for creating and manipulating engines. - * An engine is a controller that manages updating the simulation of the world. - * See `Matter.Runner` for an optional game loop utility. - * - * See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples). - * - * @class Engine - */ - - var Engine = {}; - - module.exports = Engine; - - var World = __webpack_require__(19); - var Sleeping = __webpack_require__(7); - var Resolver = __webpack_require__(21); - var Render = __webpack_require__(10); - var Pairs = __webpack_require__(20); - var Metrics = __webpack_require__(23); - var Grid = __webpack_require__(11); - var Events = __webpack_require__(4); - var Composite = __webpack_require__(5); - var Constraint = __webpack_require__(8); - var Common = __webpack_require__(0); - var Body = __webpack_require__(6); - - (function () { - /** - * Creates a new engine. The options parameter is an object that specifies any properties you wish to override the defaults. - * All properties have default values, and many are pre-calculated automatically based on other properties. - * See the properties section below for detailed information on what you can pass via the `options` object. - * @method create - * @param {object} [options] - * @return {engine} engine - */ - Engine.create = function (element, options) { - // options may be passed as the first (and only) argument - options = Common.isElement(element) ? options : element; - element = Common.isElement(element) ? element : null; - options = options || {}; - - if (element || options.render) { - Common.warn('Engine.create: engine.render is deprecated (see docs)'); - } - - var defaults = { - positionIterations: 6, - velocityIterations: 4, - constraintIterations: 2, - enableSleeping: false, - events: [], - plugin: {}, - timing: { - timestamp: 0, - timeScale: 1, - }, - broadphase: { - controller: Grid, - }, - }; - - var engine = Common.extend(defaults, options); - - // @deprecated - if (element || engine.render) { - var renderDefaults = { - element: element, - controller: Render, - }; - - engine.render = Common.extend(renderDefaults, engine.render); - } - - // @deprecated - if (engine.render && engine.render.controller) { - engine.render = engine.render.controller.create(engine.render); - } - - // @deprecated - if (engine.render) { - engine.render.engine = engine; - } - - engine.world = options.world || World.create(engine.world); - engine.pairs = Pairs.create(); - engine.broadphase = engine.broadphase.controller.create(engine.broadphase); - engine.metrics = engine.metrics || {extended: false}; - - // @if DEBUG - engine.metrics = Metrics.create(engine.metrics); - // @endif - - return engine; - }; - - /** - * Moves the simulation forward in time by `delta` ms. - * The `correction` argument is an optional `Number` that specifies the time correction factor to apply to the update. - * This can help improve the accuracy of the simulation in cases where `delta` is changing between updates. - * The value of `correction` is defined as `delta / lastDelta`, i.e. the percentage change of `delta` over the last step. - * Therefore the value is always `1` (no correction) when `delta` constant (or when no correction is desired, which is the default). - * See the paper on Time Corrected Verlet for more information. - * - * Triggers `beforeUpdate` and `afterUpdate` events. - * Triggers `collisionStart`, `collisionActive` and `collisionEnd` events. - * @method update - * @param {engine} engine - * @param {number} [delta=16.666] - * @param {number} [correction=1] - */ - Engine.update = function (engine, delta, correction) { - delta = delta || 1000 / 60; - correction = correction || 1; - - var world = engine.world, - timing = engine.timing, - broadphase = engine.broadphase, - broadphasePairs = [], - i; - - // increment timestamp - timing.timestamp += delta * timing.timeScale; - - // create an event object - var event = { - timestamp: timing.timestamp, - }; - - Events.trigger(engine, 'beforeUpdate', event); - - // get lists of all bodies and constraints, no matter what composites they are in - var allBodies = Composite.allBodies(world), - allConstraints = Composite.allConstraints(world); - - // @if DEBUG - // reset metrics logging - Metrics.reset(engine.metrics); - // @endif - - // if sleeping enabled, call the sleeping controller - if (engine.enableSleeping) Sleeping.update(allBodies, timing.timeScale); - - // applies gravity to all bodies - Engine._bodiesApplyGravity(allBodies, world.gravity); - - // update all body position and rotation by integration - Engine._bodiesUpdate(allBodies, delta, timing.timeScale, correction, world.bounds); - - // update all constraints (first pass) - Constraint.preSolveAll(allBodies); - for (i = 0; i < engine.constraintIterations; i++) { - Constraint.solveAll(allConstraints, timing.timeScale); - } - Constraint.postSolveAll(allBodies); - - // broadphase pass: find potential collision pairs - if (broadphase.controller) { - // if world is dirty, we must flush the whole grid - if (world.isModified) broadphase.controller.clear(broadphase); - - // update the grid buckets based on current bodies - broadphase.controller.update(broadphase, allBodies, engine, world.isModified); - broadphasePairs = broadphase.pairsList; - } else { - // if no broadphase set, we just pass all bodies - broadphasePairs = allBodies; - } - - // clear all composite modified flags - if (world.isModified) { - Composite.setModified(world, false, false, true); - } - - // narrowphase pass: find actual collisions, then create or update collision pairs - var collisions = broadphase.detector(broadphasePairs, engine); - - // update collision pairs - var pairs = engine.pairs, - timestamp = timing.timestamp; - Pairs.update(pairs, collisions, timestamp); - Pairs.removeOld(pairs, timestamp); - - // wake up bodies involved in collisions - if (engine.enableSleeping) Sleeping.afterCollisions(pairs.list, timing.timeScale); - - // trigger collision events - if (pairs.collisionStart.length > 0) - Events.trigger(engine, 'collisionStart', {pairs: pairs.collisionStart}); - - // iteratively resolve position between collisions - Resolver.preSolvePosition(pairs.list); - for (i = 0; i < engine.positionIterations; i++) { - Resolver.solvePosition(pairs.list, timing.timeScale); - } - Resolver.postSolvePosition(allBodies); - - // update all constraints (second pass) - Constraint.preSolveAll(allBodies); - for (i = 0; i < engine.constraintIterations; i++) { - Constraint.solveAll(allConstraints, timing.timeScale); - } - Constraint.postSolveAll(allBodies); - - // iteratively resolve velocity between collisions - Resolver.preSolveVelocity(pairs.list); - for (i = 0; i < engine.velocityIterations; i++) { - Resolver.solveVelocity(pairs.list, timing.timeScale); - } - - // trigger collision events - if (pairs.collisionActive.length > 0) - Events.trigger(engine, 'collisionActive', {pairs: pairs.collisionActive}); - - if (pairs.collisionEnd.length > 0) Events.trigger(engine, 'collisionEnd', {pairs: pairs.collisionEnd}); - - // @if DEBUG - // update metrics log - Metrics.update(engine.metrics, engine); - // @endif - - // clear force buffers - Engine._bodiesClearForces(allBodies); - - Events.trigger(engine, 'afterUpdate', event); - - return engine; - }; - - /** - * Merges two engines by keeping the configuration of `engineA` but replacing the world with the one from `engineB`. - * @method merge - * @param {engine} engineA - * @param {engine} engineB - */ - Engine.merge = function (engineA, engineB) { - Common.extend(engineA, engineB); - - if (engineB.world) { - engineA.world = engineB.world; - - Engine.clear(engineA); - - var bodies = Composite.allBodies(engineA.world); - - for (var i = 0; i < bodies.length; i++) { - var body = bodies[i]; - Sleeping.set(body, false); - body.id = Common.nextId(); - } - } - }; - - /** - * Clears the engine including the world, pairs and broadphase. - * @method clear - * @param {engine} engine - */ - Engine.clear = function (engine) { - var world = engine.world; - - Pairs.clear(engine.pairs); - - var broadphase = engine.broadphase; - if (broadphase.controller) { - var bodies = Composite.allBodies(world); - broadphase.controller.clear(broadphase); - broadphase.controller.update(broadphase, bodies, engine, true); - } - }; - - /** - * Zeroes the `body.force` and `body.torque` force buffers. - * @method _bodiesClearForces - * @private - * @param {body[]} bodies - */ - Engine._bodiesClearForces = function (bodies) { - for (var i = 0; i < bodies.length; i++) { - var body = bodies[i]; - - // reset force buffers - body.force.x = 0; - body.force.y = 0; - body.torque = 0; - } - }; - - /** - * Applys a mass dependant force to all given bodies. - * @method _bodiesApplyGravity - * @private - * @param {body[]} bodies - * @param {vector} gravity - */ - Engine._bodiesApplyGravity = function (bodies, gravity) { - var gravityScale = typeof gravity.scale !== 'undefined' ? gravity.scale : 0.001; - - if ((gravity.x === 0 && gravity.y === 0) || gravityScale === 0) { - return; - } - - for (var i = 0; i < bodies.length; i++) { - var body = bodies[i]; - - if (body.isStatic || body.isSleeping) continue; - - // apply gravity - body.force.y += body.mass * gravity.y * gravityScale; - body.force.x += body.mass * gravity.x * gravityScale; - } - }; - - /** - * Applys `Body.update` to all given `bodies`. - * @method _bodiesUpdate - * @private - * @param {body[]} bodies - * @param {number} deltaTime - * The amount of time elapsed between updates - * @param {number} timeScale - * @param {number} correction - * The Verlet correction factor (deltaTime / lastDeltaTime) - * @param {bounds} worldBounds - */ - Engine._bodiesUpdate = function (bodies, deltaTime, timeScale, correction, worldBounds) { - for (var i = 0; i < bodies.length; i++) { - var body = bodies[i]; - - if (body.isStatic || body.isSleeping) continue; - - Body.update(body, deltaTime, timeScale, correction); - } - }; - - /** - * An alias for `Runner.run`, see `Matter.Runner` for more information. - * @method run - * @param {engine} engine - */ - - /** - * Fired just before an update - * - * @event beforeUpdate - * @param {} event An event object - * @param {number} event.timestamp The engine.timing.timestamp of the event - * @param {} event.source The source object of the event - * @param {} event.name The name of the event - */ - - /** - * Fired after engine update and all collision events - * - * @event afterUpdate - * @param {} event An event object - * @param {number} event.timestamp The engine.timing.timestamp of the event - * @param {} event.source The source object of the event - * @param {} event.name The name of the event - */ - - /** - * Fired after engine update, provides a list of all pairs that have started to collide in the current tick (if any) - * - * @event collisionStart - * @param {} event An event object - * @param {} event.pairs List of affected pairs - * @param {number} event.timestamp The engine.timing.timestamp of the event - * @param {} event.source The source object of the event - * @param {} event.name The name of the event - */ - - /** - * Fired after engine update, provides a list of all pairs that are colliding in the current tick (if any) - * - * @event collisionActive - * @param {} event An event object - * @param {} event.pairs List of affected pairs - * @param {number} event.timestamp The engine.timing.timestamp of the event - * @param {} event.source The source object of the event - * @param {} event.name The name of the event - */ - - /** - * Fired after engine update, provides a list of all pairs that have ended collision in the current tick (if any) - * - * @event collisionEnd - * @param {} event An event object - * @param {} event.pairs List of affected pairs - * @param {number} event.timestamp The engine.timing.timestamp of the event - * @param {} event.source The source object of the event - * @param {} event.name The name of the event - */ - - /* - * - * Properties Documentation - * - */ - - /** - * An integer `Number` that specifies the number of position iterations to perform each update. - * The higher the value, the higher quality the simulation will be at the expense of performance. - * - * @property positionIterations - * @type number - * @default 6 - */ - - /** - * An integer `Number` that specifies the number of velocity iterations to perform each update. - * The higher the value, the higher quality the simulation will be at the expense of performance. - * - * @property velocityIterations - * @type number - * @default 4 - */ - - /** - * An integer `Number` that specifies the number of constraint iterations to perform each update. - * The higher the value, the higher quality the simulation will be at the expense of performance. - * The default value of `2` is usually very adequate. - * - * @property constraintIterations - * @type number - * @default 2 - */ - - /** - * A flag that specifies whether the engine should allow sleeping via the `Matter.Sleeping` module. - * Sleeping can improve stability and performance, but often at the expense of accuracy. - * - * @property enableSleeping - * @type boolean - * @default false - */ - - /** - * An `Object` containing properties regarding the timing systems of the engine. - * - * @property timing - * @type object - */ - - /** - * A `Number` that specifies the global scaling factor of time for all bodies. - * A value of `0` freezes the simulation. - * A value of `0.1` gives a slow-motion effect. - * A value of `1.2` gives a speed-up effect. - * - * @property timing.timeScale - * @type number - * @default 1 - */ - - /** - * A `Number` that specifies the current simulation-time in milliseconds starting from `0`. - * It is incremented on every `Engine.update` by the given `delta` argument. - * - * @property timing.timestamp - * @type number - * @default 0 - */ - - /** - * An instance of a `Render` controller. The default value is a `Matter.Render` instance created by `Engine.create`. - * One may also develop a custom renderer module based on `Matter.Render` and pass an instance of it to `Engine.create` via `options.render`. - * - * A minimal custom renderer object must define at least three functions: `create`, `clear` and `world` (see `Matter.Render`). - * It is also possible to instead pass the _module_ reference via `options.render.controller` and `Engine.create` will instantiate one for you. - * - * @property render - * @type render - * @deprecated see Demo.js for an example of creating a renderer - * @default a Matter.Render instance - */ - - /** - * An instance of a broadphase controller. The default value is a `Matter.Grid` instance created by `Engine.create`. - * - * @property broadphase - * @type grid - * @default a Matter.Grid instance - */ - - /** - * A `World` composite object that will contain all simulated bodies and constraints. - * - * @property world - * @type world - * @default a Matter.World instance - */ - - /** - * An object reserved for storing plugin-specific properties. - * - * @property plugin - * @type {} - */ - })(); - - /***/ - }, - /* 23 */ - /***/ function (module, exports, __webpack_require__) { - // @if DEBUG - /** - * _Internal Class_, not generally used outside of the engine's internals. - * - */ - - var Metrics = {}; - - module.exports = Metrics; - - var Composite = __webpack_require__(5); - var Common = __webpack_require__(0); - - (function () { - /** - * Creates a new metrics. - * @method create - * @private - * @return {metrics} A new metrics - */ - Metrics.create = function (options) { - var defaults = { - extended: false, - narrowDetections: 0, - narrowphaseTests: 0, - narrowReuse: 0, - narrowReuseCount: 0, - midphaseTests: 0, - broadphaseTests: 0, - narrowEff: 0.0001, - midEff: 0.0001, - broadEff: 0.0001, - collisions: 0, - buckets: 0, - bodies: 0, - pairs: 0, - }; - - return Common.extend(defaults, false, options); - }; - - /** - * Resets metrics. - * @method reset - * @private - * @param {metrics} metrics - */ - Metrics.reset = function (metrics) { - if (metrics.extended) { - metrics.narrowDetections = 0; - metrics.narrowphaseTests = 0; - metrics.narrowReuse = 0; - metrics.narrowReuseCount = 0; - metrics.midphaseTests = 0; - metrics.broadphaseTests = 0; - metrics.narrowEff = 0; - metrics.midEff = 0; - metrics.broadEff = 0; - metrics.collisions = 0; - metrics.buckets = 0; - metrics.pairs = 0; - metrics.bodies = 0; - } - }; - - /** - * Updates metrics. - * @method update - * @private - * @param {metrics} metrics - * @param {engine} engine - */ - Metrics.update = function (metrics, engine) { - if (metrics.extended) { - var world = engine.world, - bodies = Composite.allBodies(world); - - metrics.collisions = metrics.narrowDetections; - metrics.pairs = engine.pairs.list.length; - metrics.bodies = bodies.length; - metrics.midEff = (metrics.narrowDetections / (metrics.midphaseTests || 1)).toFixed(2); - metrics.narrowEff = (metrics.narrowDetections / (metrics.narrowphaseTests || 1)).toFixed(2); - metrics.broadEff = (1 - metrics.broadphaseTests / (bodies.length || 1)).toFixed(2); - metrics.narrowReuse = (metrics.narrowReuseCount / (metrics.narrowphaseTests || 1)).toFixed(2); - //var broadphase = engine.broadphase[engine.broadphase.current]; - //if (broadphase.instance) - // metrics.buckets = Common.keys(broadphase.instance.buckets).length; - } - }; - })(); - // @endif - - /***/ - }, - /* 24 */ - /***/ function (module, exports, __webpack_require__) { - var Matter = (module.exports = __webpack_require__(25)); - - Matter.Body = __webpack_require__(6); - Matter.Composite = __webpack_require__(5); - Matter.World = __webpack_require__(19); - - Matter.Contact = __webpack_require__(18); - Matter.Detector = __webpack_require__(12); - Matter.Grid = __webpack_require__(11); - Matter.Pairs = __webpack_require__(20); - Matter.Pair = __webpack_require__(9); - Matter.Query = __webpack_require__(26); - Matter.Resolver = __webpack_require__(21); - Matter.SAT = __webpack_require__(13); - - Matter.Constraint = __webpack_require__(8); - Matter.MouseConstraint = __webpack_require__(28); - - Matter.Common = __webpack_require__(0); - Matter.Engine = __webpack_require__(22); - Matter.Events = __webpack_require__(4); - Matter.Mouse = __webpack_require__(14); - Matter.Runner = __webpack_require__(29); - Matter.Sleeping = __webpack_require__(7); - Matter.Plugin = __webpack_require__(17); - - // @if DEBUG - Matter.Metrics = __webpack_require__(23); - // @endif - - Matter.Bodies = __webpack_require__(16); - Matter.Composites = __webpack_require__(30); - - Matter.Axes = __webpack_require__(15); - Matter.Bounds = __webpack_require__(1); - Matter.Svg = __webpack_require__(31); - Matter.Vector = __webpack_require__(2); - Matter.Vertices = __webpack_require__(3); - - Matter.Render = __webpack_require__(10); - Matter.RenderPixi = __webpack_require__(32); - - // aliases - - Matter.World.add = Matter.Composite.add; - Matter.World.remove = Matter.Composite.remove; - Matter.World.addComposite = Matter.Composite.addComposite; - Matter.World.addBody = Matter.Composite.addBody; - Matter.World.addConstraint = Matter.Composite.addConstraint; - Matter.World.clear = Matter.Composite.clear; - Matter.Engine.run = Matter.Runner.run; - - /***/ - }, - /* 25 */ - /***/ function (module, exports, __webpack_require__) { - /** - * The `Matter` module is the top level namespace. It also includes a function for installing plugins on top of the library. - * - * @class Matter - */ - - var Matter = {}; - - module.exports = Matter; - - var Plugin = __webpack_require__(17); - var Common = __webpack_require__(0); - - (function () { - /** - * The library name. - * @property name - * @readOnly - * @type {String} - */ - Matter.name = 'matter-js'; - - /** - * The library version. - * @property version - * @readOnly - * @type {String} - */ - Matter.version = '0.14.2' ; - - /** - * A list of plugin dependencies to be installed. These are normally set and installed through `Matter.use`. - * Alternatively you may set `Matter.uses` manually and install them by calling `Plugin.use(Matter)`. - * @property uses - * @type {Array} - */ - Matter.uses = []; - - /** - * The plugins that have been installed through `Matter.Plugin.install`. Read only. - * @property used - * @readOnly - * @type {Array} - */ - Matter.used = []; - - /** - * Installs the given plugins on the `Matter` namespace. - * This is a short-hand for `Plugin.use`, see it for more information. - * Call this function once at the start of your code, with all of the plugins you wish to install as arguments. - * Avoid calling this function multiple times unless you intend to manually control installation order. - * @method use - * @param ...plugin {Function} The plugin(s) to install on `base` (multi-argument). - */ - Matter.use = function () { - Plugin.use(Matter, Array.prototype.slice.call(arguments)); - }; - - /** - * Chains a function to excute before the original function on the given `path` relative to `Matter`. - * See also docs for `Common.chain`. - * @method before - * @param {string} path The path relative to `Matter` - * @param {function} func The function to chain before the original - * @return {function} The chained function that replaced the original - */ - Matter.before = function (path, func) { - path = path.replace(/^Matter./, ''); - return Common.chainPathBefore(Matter, path, func); - }; - - /** - * Chains a function to excute after the original function on the given `path` relative to `Matter`. - * See also docs for `Common.chain`. - * @method after - * @param {string} path The path relative to `Matter` - * @param {function} func The function to chain after the original - * @return {function} The chained function that replaced the original - */ - Matter.after = function (path, func) { - path = path.replace(/^Matter./, ''); - return Common.chainPathAfter(Matter, path, func); - }; - })(); - - /***/ - }, - /* 26 */ - /***/ function (module, exports, __webpack_require__) { - /** - * The `Matter.Query` module contains methods for performing collision queries. - * - * See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples). - * - * @class Query - */ - - var Query = {}; - - module.exports = Query; - - var Vector = __webpack_require__(2); - var SAT = __webpack_require__(13); - var Bounds = __webpack_require__(1); - var Bodies = __webpack_require__(16); - var Vertices = __webpack_require__(3); - - (function () { - /** - * Returns a list of collisions between `body` and `bodies`. - * @method collides - * @param {body} body - * @param {body[]} bodies - * @return {object[]} Collisions - */ - Query.collides = function (body, bodies) { - var collisions = []; - - for (var i = 0; i < bodies.length; i++) { - var bodyA = bodies[i]; - - if (Bounds.overlaps(bodyA.bounds, body.bounds)) { - for (var j = bodyA.parts.length === 1 ? 0 : 1; j < bodyA.parts.length; j++) { - var part = bodyA.parts[j]; - - if (Bounds.overlaps(part.bounds, body.bounds)) { - var collision = SAT.collides(part, body); - - if (collision.collided) { - collisions.push(collision); - break; - } - } - } - } - } - - return collisions; - }; - - /** - * Casts a ray segment against a set of bodies and returns all collisions, ray width is optional. Intersection points are not provided. - * @method ray - * @param {body[]} bodies - * @param {vector} startPoint - * @param {vector} endPoint - * @param {number} [rayWidth] - * @return {object[]} Collisions - */ - Query.ray = function (bodies, startPoint, endPoint, rayWidth) { - rayWidth = rayWidth || 1e-100; - - var rayAngle = Vector.angle(startPoint, endPoint), - rayLength = Vector.magnitude(Vector.sub(startPoint, endPoint)), - rayX = (endPoint.x + startPoint.x) * 0.5, - rayY = (endPoint.y + startPoint.y) * 0.5, - ray = Bodies.rectangle(rayX, rayY, rayLength, rayWidth, {angle: rayAngle}), - collisions = Query.collides(ray, bodies); - - for (var i = 0; i < collisions.length; i += 1) { - var collision = collisions[i]; - collision.body = collision.bodyB = collision.bodyA; - } - - return collisions; - }; - - /** - * Returns all bodies whose bounds are inside (or outside if set) the given set of bounds, from the given set of bodies. - * @method region - * @param {body[]} bodies - * @param {bounds} bounds - * @param {bool} [outside=false] - * @return {body[]} The bodies matching the query - */ - Query.region = function (bodies, bounds, outside) { - var result = []; - - for (var i = 0; i < bodies.length; i++) { - var body = bodies[i], - overlaps = Bounds.overlaps(body.bounds, bounds); - if ((overlaps && !outside) || (!overlaps && outside)) result.push(body); - } - - return result; - }; - - /** - * Returns all bodies whose vertices contain the given point, from the given set of bodies. - * @method point - * @param {body[]} bodies - * @param {vector} point - * @return {body[]} The bodies matching the query - */ - Query.point = function (bodies, point) { - var result = []; - - for (var i = 0; i < bodies.length; i++) { - var body = bodies[i]; - - if (Bounds.contains(body.bounds, point)) { - for (var j = body.parts.length === 1 ? 0 : 1; j < body.parts.length; j++) { - var part = body.parts[j]; - - if (Bounds.contains(part.bounds, point) && Vertices.contains(part.vertices, point)) { - result.push(body); - break; - } - } - } - } - - return result; - }; - })(); - - /***/ - }, - /* 27 */ - /***/ function (module, exports) { - if (typeof __WEBPACK_EXTERNAL_MODULE__27__ === 'undefined') { - var e = new Error("Cannot find module 'undefined'"); - e.code = 'MODULE_NOT_FOUND'; - throw e; - } - module.exports = __WEBPACK_EXTERNAL_MODULE__27__; - - /***/ - }, - /* 28 */ - /***/ function (module, exports, __webpack_require__) { - /** - * The `Matter.MouseConstraint` module contains methods for creating mouse constraints. - * Mouse constraints are used for allowing user interaction, providing the ability to move bodies via the mouse or touch. - * - * See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples). - * - * @class MouseConstraint - */ - - var MouseConstraint = {}; - - module.exports = MouseConstraint; - - var Vertices = __webpack_require__(3); - var Sleeping = __webpack_require__(7); - var Mouse = __webpack_require__(14); - var Events = __webpack_require__(4); - var Detector = __webpack_require__(12); - var Constraint = __webpack_require__(8); - var Composite = __webpack_require__(5); - var Common = __webpack_require__(0); - var Bounds = __webpack_require__(1); - - (function () { - /** - * Creates a new mouse constraint. - * All properties have default values, and many are pre-calculated automatically based on other properties. - * See the properties section below for detailed information on what you can pass via the `options` object. - * @method create - * @param {engine} engine - * @param {} options - * @return {MouseConstraint} A new MouseConstraint - */ - MouseConstraint.create = function (engine, options) { - var mouse = (engine ? engine.mouse : null) || (options ? options.mouse : null); - - if (!mouse) { - if (engine && engine.render && engine.render.canvas) { - mouse = Mouse.create(engine.render.canvas); - } else if (options && options.element) { - mouse = Mouse.create(options.element); - } else { - mouse = Mouse.create(); - Common.warn( - 'MouseConstraint.create: options.mouse was undefined, options.element was undefined, may not function as expected', - ); - } - } - - var constraint = Constraint.create({ - label: 'Mouse Constraint', - pointA: mouse.position, - pointB: {x: 0, y: 0}, - length: 0.01, - stiffness: 0.1, - angularStiffness: 1, - render: { - strokeStyle: '#90EE90', - lineWidth: 3, - }, - }); - - var defaults = { - type: 'mouseConstraint', - mouse: mouse, - element: null, - body: null, - constraint: constraint, - collisionFilter: { - category: 0x0001, - mask: 0xffffffff, - group: 0, - }, - }; - - var mouseConstraint = Common.extend(defaults, options); - - Events.on(engine, 'beforeUpdate', function () { - var allBodies = Composite.allBodies(engine.world); - MouseConstraint.update(mouseConstraint, allBodies); - MouseConstraint._triggerEvents(mouseConstraint); - }); - - return mouseConstraint; - }; - - /** - * Updates the given mouse constraint. - * @private - * @method update - * @param {MouseConstraint} mouseConstraint - * @param {body[]} bodies - */ - MouseConstraint.update = function (mouseConstraint, bodies) { - var mouse = mouseConstraint.mouse, - constraint = mouseConstraint.constraint, - body = mouseConstraint.body; - - if (mouse.button === 0) { - if (!constraint.bodyB) { - for (var i = 0; i < bodies.length; i++) { - body = bodies[i]; - if ( - Bounds.contains(body.bounds, mouse.position) && - Detector.canCollide(body.collisionFilter, mouseConstraint.collisionFilter) - ) { - for (var j = body.parts.length > 1 ? 1 : 0; j < body.parts.length; j++) { - var part = body.parts[j]; - if (Vertices.contains(part.vertices, mouse.position)) { - constraint.pointA = mouse.position; - constraint.bodyB = mouseConstraint.body = body; - constraint.pointB = { - x: mouse.position.x - body.position.x, - y: mouse.position.y - body.position.y, - }; - constraint.angleB = body.angle; - - Sleeping.set(body, false); - Events.trigger(mouseConstraint, 'startdrag', {mouse: mouse, body: body}); - - break; - } - } - } - } - } else { - Sleeping.set(constraint.bodyB, false); - constraint.pointA = mouse.position; - } - } else { - constraint.bodyB = mouseConstraint.body = null; - constraint.pointB = null; - - if (body) Events.trigger(mouseConstraint, 'enddrag', {mouse: mouse, body: body}); - } - }; - - /** - * Triggers mouse constraint events. - * @method _triggerEvents - * @private - * @param {mouse} mouseConstraint - */ - MouseConstraint._triggerEvents = function (mouseConstraint) { - var mouse = mouseConstraint.mouse, - mouseEvents = mouse.sourceEvents; - - if (mouseEvents.mousemove) Events.trigger(mouseConstraint, 'mousemove', {mouse: mouse}); - - if (mouseEvents.mousedown) Events.trigger(mouseConstraint, 'mousedown', {mouse: mouse}); - - if (mouseEvents.mouseup) Events.trigger(mouseConstraint, 'mouseup', {mouse: mouse}); - - // reset the mouse state ready for the next step - Mouse.clearSourceEvents(mouse); - }; - - /* - * - * Events Documentation - * - */ - - /** - * Fired when the mouse has moved (or a touch moves) during the last step - * - * @event mousemove - * @param {} event An event object - * @param {mouse} event.mouse The engine's mouse instance - * @param {} event.source The source object of the event - * @param {} event.name The name of the event - */ - - /** - * Fired when the mouse is down (or a touch has started) during the last step - * - * @event mousedown - * @param {} event An event object - * @param {mouse} event.mouse The engine's mouse instance - * @param {} event.source The source object of the event - * @param {} event.name The name of the event - */ - - /** - * Fired when the mouse is up (or a touch has ended) during the last step - * - * @event mouseup - * @param {} event An event object - * @param {mouse} event.mouse The engine's mouse instance - * @param {} event.source The source object of the event - * @param {} event.name The name of the event - */ - - /** - * Fired when the user starts dragging a body - * - * @event startdrag - * @param {} event An event object - * @param {mouse} event.mouse The engine's mouse instance - * @param {body} event.body The body being dragged - * @param {} event.source The source object of the event - * @param {} event.name The name of the event - */ - - /** - * Fired when the user ends dragging a body - * - * @event enddrag - * @param {} event An event object - * @param {mouse} event.mouse The engine's mouse instance - * @param {body} event.body The body that has stopped being dragged - * @param {} event.source The source object of the event - * @param {} event.name The name of the event - */ - - /* - * - * Properties Documentation - * - */ - - /** - * A `String` denoting the type of object. - * - * @property type - * @type string - * @default "constraint" - * @readOnly - */ - - /** - * The `Mouse` instance in use. If not supplied in `MouseConstraint.create`, one will be created. - * - * @property mouse - * @type mouse - * @default mouse - */ - - /** - * The `Body` that is currently being moved by the user, or `null` if no body. - * - * @property body - * @type body - * @default null - */ - - /** - * The `Constraint` object that is used to move the body during interaction. - * - * @property constraint - * @type constraint - */ - - /** - * An `Object` that specifies the collision filter properties. - * The collision filter allows the user to define which types of body this mouse constraint can interact with. - * See `body.collisionFilter` for more information. - * - * @property collisionFilter - * @type object - */ - })(); - - /***/ - }, - /* 29 */ - /***/ function (module, exports, __webpack_require__) { - /** - * The `Matter.Runner` module is an optional utility which provides a game loop, - * that handles continuously updating a `Matter.Engine` for you within a browser. - * It is intended for development and debugging purposes, but may also be suitable for simple games. - * If you are using your own game loop instead, then you do not need the `Matter.Runner` module. - * Instead just call `Engine.update(engine, delta)` in your own loop. - * - * See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples). - * - * @class Runner - */ - - var Runner = {}; - - module.exports = Runner; - - var Events = __webpack_require__(4); - var Engine = __webpack_require__(22); - var Common = __webpack_require__(0); - - (function () { - var _requestAnimationFrame, _cancelAnimationFrame; - - if (typeof window !== 'undefined') { - _requestAnimationFrame = - window.requestAnimationFrame || - window.webkitRequestAnimationFrame || - window.mozRequestAnimationFrame || - window.msRequestAnimationFrame; - - _cancelAnimationFrame = - window.cancelAnimationFrame || - window.mozCancelAnimationFrame || - window.webkitCancelAnimationFrame || - window.msCancelAnimationFrame; - } - - if (!_requestAnimationFrame) { - var _frameTimeout; - - _requestAnimationFrame = function (callback) { - _frameTimeout = setTimeout(function () { - callback(Common.now()); - }, 1000 / 60); - }; - - _cancelAnimationFrame = function () { - clearTimeout(_frameTimeout); - }; - } - - /** - * Creates a new Runner. The options parameter is an object that specifies any properties you wish to override the defaults. - * @method create - * @param {} options - */ - Runner.create = function (options) { - var defaults = { - fps: 60, - correction: 1, - deltaSampleSize: 60, - counterTimestamp: 0, - frameCounter: 0, - deltaHistory: [], - timePrev: null, - timeScalePrev: 1, - frameRequestId: null, - isFixed: false, - enabled: true, - }; - - var runner = Common.extend(defaults, options); - - runner.delta = runner.delta || 1000 / runner.fps; - runner.deltaMin = runner.deltaMin || 1000 / runner.fps; - runner.deltaMax = runner.deltaMax || 1000 / (runner.fps * 0.5); - runner.fps = 1000 / runner.delta; - - return runner; - }; - - /** - * Continuously ticks a `Matter.Engine` by calling `Runner.tick` on the `requestAnimationFrame` event. - * @method run - * @param {engine} engine - */ - Runner.run = function (runner, engine) { - // create runner if engine is first argument - if (typeof runner.positionIterations !== 'undefined') { - engine = runner; - runner = Runner.create(); - } - - (function render(time) { - runner.frameRequestId = _requestAnimationFrame(render); - - if (time && runner.enabled) { - Runner.tick(runner, engine, time); - } - })(); - - return runner; - }; - - /** - * A game loop utility that updates the engine and renderer by one step (a 'tick'). - * Features delta smoothing, time correction and fixed or dynamic timing. - * Triggers `beforeTick`, `tick` and `afterTick` events on the engine. - * Consider just `Engine.update(engine, delta)` if you're using your own loop. - * @method tick - * @param {runner} runner - * @param {engine} engine - * @param {number} time - */ - Runner.tick = function (runner, engine, time) { - var timing = engine.timing, - correction = 1, - delta; - - // create an event object - var event = { - timestamp: timing.timestamp, - }; - - Events.trigger(runner, 'beforeTick', event); - Events.trigger(engine, 'beforeTick', event); // @deprecated - - if (runner.isFixed) { - // fixed timestep - delta = runner.delta; - } else { - // dynamic timestep based on wall clock between calls - delta = time - runner.timePrev || runner.delta; - runner.timePrev = time; - - // optimistically filter delta over a few frames, to improve stability - runner.deltaHistory.push(delta); - runner.deltaHistory = runner.deltaHistory.slice(-runner.deltaSampleSize); - delta = Math.min.apply(null, runner.deltaHistory); - - // limit delta - delta = delta < runner.deltaMin ? runner.deltaMin : delta; - delta = delta > runner.deltaMax ? runner.deltaMax : delta; - - // correction for delta - correction = delta / runner.delta; - - // update engine timing object - runner.delta = delta; - } - - // time correction for time scaling - if (runner.timeScalePrev !== 0) correction *= timing.timeScale / runner.timeScalePrev; - - if (timing.timeScale === 0) correction = 0; - - runner.timeScalePrev = timing.timeScale; - runner.correction = correction; - - // fps counter - runner.frameCounter += 1; - if (time - runner.counterTimestamp >= 1000) { - runner.fps = runner.frameCounter * ((time - runner.counterTimestamp) / 1000); - runner.counterTimestamp = time; - runner.frameCounter = 0; - } - - Events.trigger(runner, 'tick', event); - Events.trigger(engine, 'tick', event); // @deprecated - - // if world has been modified, clear the render scene graph - if ( - engine.world.isModified && - engine.render && - engine.render.controller && - engine.render.controller.clear - ) { - engine.render.controller.clear(engine.render); // @deprecated - } - - // update - Events.trigger(runner, 'beforeUpdate', event); - Engine.update(engine, delta, correction); - Events.trigger(runner, 'afterUpdate', event); - - // render - // @deprecated - if (engine.render && engine.render.controller) { - Events.trigger(runner, 'beforeRender', event); - Events.trigger(engine, 'beforeRender', event); // @deprecated - - engine.render.controller.world(engine.render); - - Events.trigger(runner, 'afterRender', event); - Events.trigger(engine, 'afterRender', event); // @deprecated - } - - Events.trigger(runner, 'afterTick', event); - Events.trigger(engine, 'afterTick', event); // @deprecated - }; - - /** - * Ends execution of `Runner.run` on the given `runner`, by canceling the animation frame request event loop. - * If you wish to only temporarily pause the engine, see `engine.enabled` instead. - * @method stop - * @param {runner} runner - */ - Runner.stop = function (runner) { - _cancelAnimationFrame(runner.frameRequestId); - }; - - /** - * Alias for `Runner.run`. - * @method start - * @param {runner} runner - * @param {engine} engine - */ - Runner.start = function (runner, engine) { - Runner.run(runner, engine); - }; - - /* - * - * Events Documentation - * - */ - - /** - * Fired at the start of a tick, before any updates to the engine or timing - * - * @event beforeTick - * @param {} event An event object - * @param {number} event.timestamp The engine.timing.timestamp of the event - * @param {} event.source The source object of the event - * @param {} event.name The name of the event - */ - - /** - * Fired after engine timing updated, but just before update - * - * @event tick - * @param {} event An event object - * @param {number} event.timestamp The engine.timing.timestamp of the event - * @param {} event.source The source object of the event - * @param {} event.name The name of the event - */ - - /** - * Fired at the end of a tick, after engine update and after rendering - * - * @event afterTick - * @param {} event An event object - * @param {number} event.timestamp The engine.timing.timestamp of the event - * @param {} event.source The source object of the event - * @param {} event.name The name of the event - */ - - /** - * Fired before update - * - * @event beforeUpdate - * @param {} event An event object - * @param {number} event.timestamp The engine.timing.timestamp of the event - * @param {} event.source The source object of the event - * @param {} event.name The name of the event - */ - - /** - * Fired after update - * - * @event afterUpdate - * @param {} event An event object - * @param {number} event.timestamp The engine.timing.timestamp of the event - * @param {} event.source The source object of the event - * @param {} event.name The name of the event - */ - - /** - * Fired before rendering - * - * @event beforeRender - * @param {} event An event object - * @param {number} event.timestamp The engine.timing.timestamp of the event - * @param {} event.source The source object of the event - * @param {} event.name The name of the event - * @deprecated - */ - - /** - * Fired after rendering - * - * @event afterRender - * @param {} event An event object - * @param {number} event.timestamp The engine.timing.timestamp of the event - * @param {} event.source The source object of the event - * @param {} event.name The name of the event - * @deprecated - */ - - /* - * - * Properties Documentation - * - */ - - /** - * A flag that specifies whether the runner is running or not. - * - * @property enabled - * @type boolean - * @default true - */ - - /** - * A `Boolean` that specifies if the runner should use a fixed timestep (otherwise it is variable). - * If timing is fixed, then the apparent simulation speed will change depending on the frame rate (but behaviour will be deterministic). - * If the timing is variable, then the apparent simulation speed will be constant (approximately, but at the cost of determininism). - * - * @property isFixed - * @type boolean - * @default false - */ - - /** - * A `Number` that specifies the time step between updates in milliseconds. - * If `engine.timing.isFixed` is set to `true`, then `delta` is fixed. - * If it is `false`, then `delta` can dynamically change to maintain the correct apparent simulation speed. - * - * @property delta - * @type number - * @default 1000 / 60 - */ - })(); - - /***/ - }, - /* 30 */ - /***/ function (module, exports, __webpack_require__) { - /** - * The `Matter.Composites` module contains factory methods for creating composite bodies - * with commonly used configurations (such as stacks and chains). - * - * See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples). - * - * @class Composites - */ - - var Composites = {}; - - module.exports = Composites; - - var Composite = __webpack_require__(5); - var Constraint = __webpack_require__(8); - var Common = __webpack_require__(0); - var Body = __webpack_require__(6); - var Bodies = __webpack_require__(16); - - (function () { - /** - * Create a new composite containing bodies created in the callback in a grid arrangement. - * This function uses the body's bounds to prevent overlaps. - * @method stack - * @param {number} xx - * @param {number} yy - * @param {number} columns - * @param {number} rows - * @param {number} columnGap - * @param {number} rowGap - * @param {function} callback - * @return {composite} A new composite containing objects created in the callback - */ - Composites.stack = function (xx, yy, columns, rows, columnGap, rowGap, callback) { - var stack = Composite.create({label: 'Stack'}), - x = xx, - y = yy, - lastBody, - i = 0; - - for (var row = 0; row < rows; row++) { - var maxHeight = 0; - - for (var column = 0; column < columns; column++) { - var body = callback(x, y, column, row, lastBody, i); - - if (body) { - var bodyHeight = body.bounds.max.y - body.bounds.min.y, - bodyWidth = body.bounds.max.x - body.bounds.min.x; - - if (bodyHeight > maxHeight) maxHeight = bodyHeight; - - Body.translate(body, {x: bodyWidth * 0.5, y: bodyHeight * 0.5}); - - x = body.bounds.max.x + columnGap; - - Composite.addBody(stack, body); - - lastBody = body; - i += 1; - } else { - x += columnGap; - } - } - - y += maxHeight + rowGap; - x = xx; - } - - return stack; - }; - - /** - * Chains all bodies in the given composite together using constraints. - * @method chain - * @param {composite} composite - * @param {number} xOffsetA - * @param {number} yOffsetA - * @param {number} xOffsetB - * @param {number} yOffsetB - * @param {object} options - * @return {composite} A new composite containing objects chained together with constraints - */ - Composites.chain = function (composite, xOffsetA, yOffsetA, xOffsetB, yOffsetB, options) { - var bodies = composite.bodies; - - for (var i = 1; i < bodies.length; i++) { - var bodyA = bodies[i - 1], - bodyB = bodies[i], - bodyAHeight = bodyA.bounds.max.y - bodyA.bounds.min.y, - bodyAWidth = bodyA.bounds.max.x - bodyA.bounds.min.x, - bodyBHeight = bodyB.bounds.max.y - bodyB.bounds.min.y, - bodyBWidth = bodyB.bounds.max.x - bodyB.bounds.min.x; - - var defaults = { - bodyA: bodyA, - pointA: {x: bodyAWidth * xOffsetA, y: bodyAHeight * yOffsetA}, - bodyB: bodyB, - pointB: {x: bodyBWidth * xOffsetB, y: bodyBHeight * yOffsetB}, - }; - - var constraint = Common.extend(defaults, options); - - Composite.addConstraint(composite, Constraint.create(constraint)); - } - - composite.label += ' Chain'; - - return composite; - }; - - /** - * Connects bodies in the composite with constraints in a grid pattern, with optional cross braces. - * @method mesh - * @param {composite} composite - * @param {number} columns - * @param {number} rows - * @param {boolean} crossBrace - * @param {object} options - * @return {composite} The composite containing objects meshed together with constraints - */ - Composites.mesh = function (composite, columns, rows, crossBrace, options) { - var bodies = composite.bodies, - row, - col, - bodyA, - bodyB, - bodyC; - - for (row = 0; row < rows; row++) { - for (col = 1; col < columns; col++) { - bodyA = bodies[col - 1 + row * columns]; - bodyB = bodies[col + row * columns]; - Composite.addConstraint( - composite, - Constraint.create(Common.extend({bodyA: bodyA, bodyB: bodyB}, options)), - ); - } - - if (row > 0) { - for (col = 0; col < columns; col++) { - bodyA = bodies[col + (row - 1) * columns]; - bodyB = bodies[col + row * columns]; - Composite.addConstraint( - composite, - Constraint.create(Common.extend({bodyA: bodyA, bodyB: bodyB}, options)), - ); - - if (crossBrace && col > 0) { - bodyC = bodies[col - 1 + (row - 1) * columns]; - Composite.addConstraint( - composite, - Constraint.create(Common.extend({bodyA: bodyC, bodyB: bodyB}, options)), - ); - } - - if (crossBrace && col < columns - 1) { - bodyC = bodies[col + 1 + (row - 1) * columns]; - Composite.addConstraint( - composite, - Constraint.create(Common.extend({bodyA: bodyC, bodyB: bodyB}, options)), - ); - } - } - } - } - - composite.label += ' Mesh'; - - return composite; - }; - - /** - * Create a new composite containing bodies created in the callback in a pyramid arrangement. - * This function uses the body's bounds to prevent overlaps. - * @method pyramid - * @param {number} xx - * @param {number} yy - * @param {number} columns - * @param {number} rows - * @param {number} columnGap - * @param {number} rowGap - * @param {function} callback - * @return {composite} A new composite containing objects created in the callback - */ - Composites.pyramid = function (xx, yy, columns, rows, columnGap, rowGap, callback) { - return Composites.stack( - xx, - yy, - columns, - rows, - columnGap, - rowGap, - function (x, y, column, row, lastBody, i) { - var actualRows = Math.min(rows, Math.ceil(columns / 2)), - lastBodyWidth = lastBody ? lastBody.bounds.max.x - lastBody.bounds.min.x : 0; - - if (row > actualRows) return; - - // reverse row order - row = actualRows - row; - - var start = row, - end = columns - 1 - row; - - if (column < start || column > end) return; - - // retroactively fix the first body's position, since width was unknown - if (i === 1) { - Body.translate(lastBody, {x: (column + (columns % 2 === 1 ? 1 : -1)) * lastBodyWidth, y: 0}); - } - - var xOffset = lastBody ? column * lastBodyWidth : 0; - - return callback(xx + xOffset + column * columnGap, y, column, row, lastBody, i); - }, - ); - }; - - /** - * Creates a composite with a Newton's Cradle setup of bodies and constraints. - * @method newtonsCradle - * @param {number} xx - * @param {number} yy - * @param {number} number - * @param {number} size - * @param {number} length - * @return {composite} A new composite newtonsCradle body - */ - Composites.newtonsCradle = function (xx, yy, number, size, length) { - var newtonsCradle = Composite.create({label: 'Newtons Cradle'}); - - for (var i = 0; i < number; i++) { - var separation = 1.9, - circle = Bodies.circle(xx + i * (size * separation), yy + length, size, { - inertia: Infinity, - restitution: 1, - friction: 0, - frictionAir: 0.0001, - slop: 1, - }), - constraint = Constraint.create({pointA: {x: xx + i * (size * separation), y: yy}, bodyB: circle}); - - Composite.addBody(newtonsCradle, circle); - Composite.addConstraint(newtonsCradle, constraint); - } - - return newtonsCradle; - }; - - /** - * Creates a composite with simple car setup of bodies and constraints. - * @method car - * @param {number} xx - * @param {number} yy - * @param {number} width - * @param {number} height - * @param {number} wheelSize - * @return {composite} A new composite car body - */ - Composites.car = function (xx, yy, width, height, wheelSize) { - var group = Body.nextGroup(true), - wheelBase = 20, - wheelAOffset = -width * 0.5 + wheelBase, - wheelBOffset = width * 0.5 - wheelBase, - wheelYOffset = 0; - - var car = Composite.create({label: 'Car'}), - body = Bodies.rectangle(xx, yy, width, height, { - collisionFilter: { - group: group, - }, - chamfer: { - radius: height * 0.5, - }, - density: 0.0002, - }); - - var wheelA = Bodies.circle(xx + wheelAOffset, yy + wheelYOffset, wheelSize, { - collisionFilter: { - group: group, - }, - friction: 0.8, - }); - - var wheelB = Bodies.circle(xx + wheelBOffset, yy + wheelYOffset, wheelSize, { - collisionFilter: { - group: group, - }, - friction: 0.8, - }); - - var axelA = Constraint.create({ - bodyB: body, - pointB: {x: wheelAOffset, y: wheelYOffset}, - bodyA: wheelA, - stiffness: 1, - length: 0, - }); - - var axelB = Constraint.create({ - bodyB: body, - pointB: {x: wheelBOffset, y: wheelYOffset}, - bodyA: wheelB, - stiffness: 1, - length: 0, - }); - - Composite.addBody(car, body); - Composite.addBody(car, wheelA); - Composite.addBody(car, wheelB); - Composite.addConstraint(car, axelA); - Composite.addConstraint(car, axelB); - - return car; - }; - - /** - * Creates a simple soft body like object. - * @method softBody - * @param {number} xx - * @param {number} yy - * @param {number} columns - * @param {number} rows - * @param {number} columnGap - * @param {number} rowGap - * @param {boolean} crossBrace - * @param {number} particleRadius - * @param {} particleOptions - * @param {} constraintOptions - * @return {composite} A new composite softBody - */ - Composites.softBody = function ( - xx, - yy, - columns, - rows, - columnGap, - rowGap, - crossBrace, - particleRadius, - particleOptions, - constraintOptions, - ) { - particleOptions = Common.extend({inertia: Infinity}, particleOptions); - constraintOptions = Common.extend( - {stiffness: 0.2, render: {type: 'line', anchors: false}}, - constraintOptions, - ); - - var softBody = Composites.stack(xx, yy, columns, rows, columnGap, rowGap, function (x, y) { - return Bodies.circle(x, y, particleRadius, particleOptions); - }); - - Composites.mesh(softBody, columns, rows, crossBrace, constraintOptions); - - softBody.label = 'Soft Body'; - - return softBody; - }; - })(); - - /***/ - }, - /* 31 */ - /***/ function (module, exports, __webpack_require__) { - /** - * The `Matter.Svg` module contains methods for converting SVG images into an array of vector points. - * - * To use this module you also need the SVGPathSeg polyfill: https://github.com/progers/pathseg - * - * See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples). - * - * @class Svg - */ - - var Svg = {}; - - module.exports = Svg; - - __webpack_require__(1); - var Common = __webpack_require__(0); - - (function () { - /** - * Converts an SVG path into an array of vector points. - * If the input path forms a concave shape, you must decompose the result into convex parts before use. - * See `Bodies.fromVertices` which provides support for this. - * Note that this function is not guaranteed to support complex paths (such as those with holes). - * You must load the `pathseg.js` polyfill on newer browsers. - * @method pathToVertices - * @param {SVGPathElement} path - * @param {Number} [sampleLength=15] - * @return {Vector[]} points - */ - Svg.pathToVertices = function (path, sampleLength) { - if (typeof window !== 'undefined' && !('SVGPathSeg' in window)) { - Common.warn('Svg.pathToVertices: SVGPathSeg not defined, a polyfill is required.'); - } - - // https://github.com/wout/svg.topoly.js/blob/master/svg.topoly.js - var i, - il, - total, - point, - segment, - segments, - segmentsQueue, - lastSegment, - lastPoint, - segmentIndex, - points = [], - lx, - ly, - length = 0, - x = 0, - y = 0; - - sampleLength = sampleLength || 15; - - var addPoint = function (px, py, pathSegType) { - // all odd-numbered path types are relative except PATHSEG_CLOSEPATH (1) - var isRelative = pathSegType % 2 === 1 && pathSegType > 1; - - // when the last point doesn't equal the current point add the current point - if (!lastPoint || px != lastPoint.x || py != lastPoint.y) { - if (lastPoint && isRelative) { - lx = lastPoint.x; - ly = lastPoint.y; - } else { - lx = 0; - ly = 0; - } - - var point = { - x: lx + px, - y: ly + py, - }; - - // set last point - if (isRelative || !lastPoint) { - lastPoint = point; - } - - points.push(point); - - x = lx + px; - y = ly + py; - } - }; - - var addSegmentPoint = function (segment) { - var segType = segment.pathSegTypeAsLetter.toUpperCase(); - - // skip path ends - if (segType === 'Z') return; - - // map segment to x and y - switch (segType) { - case 'M': - case 'L': - case 'T': - case 'C': - case 'S': - case 'Q': - x = segment.x; - y = segment.y; - break; - case 'H': - x = segment.x; - break; - case 'V': - y = segment.y; - break; - } - - addPoint(x, y, segment.pathSegType); - }; - - // ensure path is absolute - Svg._svgPathToAbsolute(path); - - // get total length - total = path.getTotalLength(); - - // queue segments - segments = []; - for (i = 0; i < path.pathSegList.numberOfItems; i += 1) segments.push(path.pathSegList.getItem(i)); - - segmentsQueue = segments.concat(); - - // sample through path - while (length < total) { - // get segment at position - segmentIndex = path.getPathSegAtLength(length); - segment = segments[segmentIndex]; - - // new segment - if (segment != lastSegment) { - while (segmentsQueue.length && segmentsQueue[0] != segment) addSegmentPoint(segmentsQueue.shift()); - - lastSegment = segment; - } - - // add points in between when curving - // TODO: adaptive sampling - switch (segment.pathSegTypeAsLetter.toUpperCase()) { - case 'C': - case 'T': - case 'S': - case 'Q': - case 'A': - point = path.getPointAtLength(length); - addPoint(point.x, point.y, 0); - break; - } - - // increment by sample value - length += sampleLength; - } - - // add remaining segments not passed by sampling - for (i = 0, il = segmentsQueue.length; i < il; ++i) addSegmentPoint(segmentsQueue[i]); - - return points; - }; - - Svg._svgPathToAbsolute = function (path) { - // http://phrogz.net/convert-svg-path-to-all-absolute-commands - // Copyright (c) Gavin Kistner - // http://phrogz.net/js/_ReuseLicense.txt - // Modifications: tidy formatting and naming - var x0, - y0, - x1, - y1, - x2, - y2, - segs = path.pathSegList, - x = 0, - y = 0, - len = segs.numberOfItems; - - for (var i = 0; i < len; ++i) { - var seg = segs.getItem(i), - segType = seg.pathSegTypeAsLetter; - - if (/[MLHVCSQTA]/.test(segType)) { - if ('x' in seg) x = seg.x; - if ('y' in seg) y = seg.y; - } else { - if ('x1' in seg) x1 = x + seg.x1; - if ('x2' in seg) x2 = x + seg.x2; - if ('y1' in seg) y1 = y + seg.y1; - if ('y2' in seg) y2 = y + seg.y2; - if ('x' in seg) x += seg.x; - if ('y' in seg) y += seg.y; - - switch (segType) { - case 'm': - segs.replaceItem(path.createSVGPathSegMovetoAbs(x, y), i); - break; - case 'l': - segs.replaceItem(path.createSVGPathSegLinetoAbs(x, y), i); - break; - case 'h': - segs.replaceItem(path.createSVGPathSegLinetoHorizontalAbs(x), i); - break; - case 'v': - segs.replaceItem(path.createSVGPathSegLinetoVerticalAbs(y), i); - break; - case 'c': - segs.replaceItem(path.createSVGPathSegCurvetoCubicAbs(x, y, x1, y1, x2, y2), i); - break; - case 's': - segs.replaceItem(path.createSVGPathSegCurvetoCubicSmoothAbs(x, y, x2, y2), i); - break; - case 'q': - segs.replaceItem(path.createSVGPathSegCurvetoQuadraticAbs(x, y, x1, y1), i); - break; - case 't': - segs.replaceItem(path.createSVGPathSegCurvetoQuadraticSmoothAbs(x, y), i); - break; - case 'a': - segs.replaceItem( - path.createSVGPathSegArcAbs(x, y, seg.r1, seg.r2, seg.angle, seg.largeArcFlag, seg.sweepFlag), - i, - ); - break; - case 'z': - case 'Z': - x = x0; - y = y0; - break; - } - } - - if (segType == 'M' || segType == 'm') { - x0 = x; - y0 = y; - } - } - }; - })(); - - /***/ - }, - /* 32 */ - /***/ function (module, exports, __webpack_require__) { - /** - * The `Matter.RenderPixi` module is an example renderer using pixi.js. - * See also `Matter.Render` for a canvas based renderer. - * - * @class RenderPixi - * @deprecated the Matter.RenderPixi module will soon be removed from the Matter.js core. - * It will likely be moved to its own repository (but maintenance will be limited). - */ - - var RenderPixi = {}; - - module.exports = RenderPixi; - - var Bounds = __webpack_require__(1); - var Composite = __webpack_require__(5); - var Common = __webpack_require__(0); - var Events = __webpack_require__(4); - var Vector = __webpack_require__(2); - - (function () { - var _requestAnimationFrame, _cancelAnimationFrame; - - if (typeof window !== 'undefined') { - _requestAnimationFrame = - window.requestAnimationFrame || - window.webkitRequestAnimationFrame || - window.mozRequestAnimationFrame || - window.msRequestAnimationFrame || - function (callback) { - window.setTimeout(function () { - callback(Common.now()); - }, 1000 / 60); - }; - - _cancelAnimationFrame = - window.cancelAnimationFrame || - window.mozCancelAnimationFrame || - window.webkitCancelAnimationFrame || - window.msCancelAnimationFrame; - } - - /** - * Creates a new Pixi.js WebGL renderer - * @method create - * @param {object} options - * @return {RenderPixi} A new renderer - * @deprecated - */ - RenderPixi.create = function (options) { - Common.warn('RenderPixi.create: Matter.RenderPixi is deprecated (see docs)'); - - var defaults = { - controller: RenderPixi, - engine: null, - element: null, - frameRequestId: null, - canvas: null, - renderer: null, - container: null, - spriteContainer: null, - pixiOptions: null, - options: { - width: 800, - height: 600, - background: '#fafafa', - wireframeBackground: '#222', - hasBounds: false, - enabled: true, - wireframes: true, - showSleeping: true, - showDebug: false, - showBroadphase: false, - showBounds: false, - showVelocity: false, - showCollisions: false, - showAxes: false, - showPositions: false, - showAngleIndicator: false, - showIds: false, - showShadows: false, - }, - }; - - var render = Common.extend(defaults, options), - transparent = !render.options.wireframes && render.options.background === 'transparent'; - - // init pixi - render.pixiOptions = render.pixiOptions || { - view: render.canvas, - transparent: transparent, - antialias: true, - backgroundColor: options.background, - }; - - render.mouse = options.mouse; - render.engine = options.engine; - render.renderer = - render.renderer || - new PIXI.WebGLRenderer(render.options.width, render.options.height, render.pixiOptions); - render.container = render.container || new PIXI.Container(); - render.spriteContainer = render.spriteContainer || new PIXI.Container(); - render.canvas = render.canvas || render.renderer.view; - render.bounds = render.bounds || { - min: { - x: 0, - y: 0, - }, - max: { - x: render.options.width, - y: render.options.height, - }, - }; - - // event listeners - Events.on(render.engine, 'beforeUpdate', function () { - RenderPixi.clear(render); - }); - - // caches - render.textures = {}; - render.sprites = {}; - render.primitives = {}; - - // use a sprite batch for performance - render.container.addChild(render.spriteContainer); - - // insert canvas - if (Common.isElement(render.element)) { - render.element.appendChild(render.canvas); - } else { - Common.warn('No "render.element" passed, "render.canvas" was not inserted into document.'); - } - - // prevent menus on canvas - render.canvas.oncontextmenu = function () { - return false; - }; - render.canvas.onselectstart = function () { - return false; - }; - - return render; - }; - - /** - * Continuously updates the render canvas on the `requestAnimationFrame` event. - * @method run - * @param {render} render - * @deprecated - */ - RenderPixi.run = function (render) { - (function loop(time) { - render.frameRequestId = _requestAnimationFrame(loop); - RenderPixi.world(render); - })(); - }; - - /** - * Ends execution of `Render.run` on the given `render`, by canceling the animation frame request event loop. - * @method stop - * @param {render} render - * @deprecated - */ - RenderPixi.stop = function (render) { - _cancelAnimationFrame(render.frameRequestId); - }; - - /** - * Clears the scene graph - * @method clear - * @param {RenderPixi} render - * @deprecated - */ - RenderPixi.clear = function (render) { - var container = render.container, - spriteContainer = render.spriteContainer; - - // clear stage container - while (container.children[0]) { - container.removeChild(container.children[0]); - } - - // clear sprite batch - while (spriteContainer.children[0]) { - spriteContainer.removeChild(spriteContainer.children[0]); - } - - var bgSprite = render.sprites['bg-0']; - - // clear caches - render.textures = {}; - render.sprites = {}; - render.primitives = {}; - - // set background sprite - render.sprites['bg-0'] = bgSprite; - if (bgSprite) container.addChildAt(bgSprite, 0); - - // add sprite batch back into container - render.container.addChild(render.spriteContainer); - - // reset background state - render.currentBackground = null; - - // reset bounds transforms - container.scale.set(1, 1); - container.position.set(0, 0); - }; - - /** - * Sets the background of the canvas - * @method setBackground - * @param {RenderPixi} render - * @param {string} background - * @deprecated - */ - RenderPixi.setBackground = function (render, background) { - if (render.currentBackground !== background) { - var isColor = background.indexOf && background.indexOf('#') !== -1, - bgSprite = render.sprites['bg-0']; - - if (isColor) { - // if solid background color - var color = Common.colorToNumber(background); - render.renderer.backgroundColor = color; - - // remove background sprite if existing - if (bgSprite) render.container.removeChild(bgSprite); - } else { - // initialise background sprite if needed - if (!bgSprite) { - var texture = _getTexture(render, background); - - bgSprite = render.sprites['bg-0'] = new PIXI.Sprite(texture); - bgSprite.position.x = 0; - bgSprite.position.y = 0; - render.container.addChildAt(bgSprite, 0); - } - } - - render.currentBackground = background; - } - }; - - /** - * Description - * @method world - * @param {engine} engine - * @deprecated - */ - RenderPixi.world = function (render) { - var engine = render.engine, - world = engine.world, - renderer = render.renderer, - container = render.container, - options = render.options, - bodies = Composite.allBodies(world), - allConstraints = Composite.allConstraints(world), - constraints = [], - i; - - if (options.wireframes) { - RenderPixi.setBackground(render, options.wireframeBackground); - } else { - RenderPixi.setBackground(render, options.background); - } - - // handle bounds - var boundsWidth = render.bounds.max.x - render.bounds.min.x, - boundsHeight = render.bounds.max.y - render.bounds.min.y, - boundsScaleX = boundsWidth / render.options.width, - boundsScaleY = boundsHeight / render.options.height; - - if (options.hasBounds) { - // Hide bodies that are not in view - for (i = 0; i < bodies.length; i++) { - var body = bodies[i]; - body.render.sprite.visible = Bounds.overlaps(body.bounds, render.bounds); - } - - // filter out constraints that are not in view - for (i = 0; i < allConstraints.length; i++) { - var constraint = allConstraints[i], - bodyA = constraint.bodyA, - bodyB = constraint.bodyB, - pointAWorld = constraint.pointA, - pointBWorld = constraint.pointB; - - if (bodyA) pointAWorld = Vector.add(bodyA.position, constraint.pointA); - if (bodyB) pointBWorld = Vector.add(bodyB.position, constraint.pointB); - - if (!pointAWorld || !pointBWorld) continue; - - if (Bounds.contains(render.bounds, pointAWorld) || Bounds.contains(render.bounds, pointBWorld)) - constraints.push(constraint); - } - - // transform the view - container.scale.set(1 / boundsScaleX, 1 / boundsScaleY); - container.position.set( - -render.bounds.min.x * (1 / boundsScaleX), - -render.bounds.min.y * (1 / boundsScaleY), - ); - } else { - constraints = allConstraints; - } - - for (i = 0; i < bodies.length; i++) RenderPixi.body(render, bodies[i]); - - for (i = 0; i < constraints.length; i++) RenderPixi.constraint(render, constraints[i]); - - renderer.render(container); - }; - - /** - * Description - * @method constraint - * @param {engine} engine - * @param {constraint} constraint - * @deprecated - */ - RenderPixi.constraint = function (render, constraint) { - render.engine; - var bodyA = constraint.bodyA, - bodyB = constraint.bodyB, - pointA = constraint.pointA, - pointB = constraint.pointB, - container = render.container, - constraintRender = constraint.render, - primitiveId = 'c-' + constraint.id, - primitive = render.primitives[primitiveId]; - - // initialise constraint primitive if not existing - if (!primitive) primitive = render.primitives[primitiveId] = new PIXI.Graphics(); - - // don't render if constraint does not have two end points - if (!constraintRender.visible || !constraint.pointA || !constraint.pointB) { - primitive.clear(); - return; - } - - // add to scene graph if not already there - if (Common.indexOf(container.children, primitive) === -1) container.addChild(primitive); - - // render the constraint on every update, since they can change dynamically - primitive.clear(); - primitive.beginFill(0, 0); - primitive.lineStyle(constraintRender.lineWidth, Common.colorToNumber(constraintRender.strokeStyle), 1); - - if (bodyA) { - primitive.moveTo(bodyA.position.x + pointA.x, bodyA.position.y + pointA.y); - } else { - primitive.moveTo(pointA.x, pointA.y); - } - - if (bodyB) { - primitive.lineTo(bodyB.position.x + pointB.x, bodyB.position.y + pointB.y); - } else { - primitive.lineTo(pointB.x, pointB.y); - } - - primitive.endFill(); - }; - - /** - * Description - * @method body - * @param {engine} engine - * @param {body} body - * @deprecated - */ - RenderPixi.body = function (render, body) { - render.engine; - var bodyRender = body.render; - - if (!bodyRender.visible) return; - - if (bodyRender.sprite && bodyRender.sprite.texture) { - var spriteId = 'b-' + body.id, - sprite = render.sprites[spriteId], - spriteContainer = render.spriteContainer; - - // initialise body sprite if not existing - if (!sprite) sprite = render.sprites[spriteId] = _createBodySprite(render, body); - - // add to scene graph if not already there - if (Common.indexOf(spriteContainer.children, sprite) === -1) spriteContainer.addChild(sprite); - - // update body sprite - sprite.position.x = body.position.x; - sprite.position.y = body.position.y; - sprite.rotation = body.angle; - sprite.scale.x = bodyRender.sprite.xScale || 1; - sprite.scale.y = bodyRender.sprite.yScale || 1; - } else { - var primitiveId = 'b-' + body.id, - primitive = render.primitives[primitiveId], - container = render.container; - - // initialise body primitive if not existing - if (!primitive) { - primitive = render.primitives[primitiveId] = _createBodyPrimitive(render, body); - primitive.initialAngle = body.angle; - } - - // add to scene graph if not already there - if (Common.indexOf(container.children, primitive) === -1) container.addChild(primitive); - - // update body primitive - primitive.position.x = body.position.x; - primitive.position.y = body.position.y; - primitive.rotation = body.angle - primitive.initialAngle; - } - }; - - /** - * Creates a body sprite - * @method _createBodySprite - * @private - * @param {RenderPixi} render - * @param {body} body - * @return {PIXI.Sprite} sprite - * @deprecated - */ - var _createBodySprite = function (render, body) { - var bodyRender = body.render, - texturePath = bodyRender.sprite.texture, - texture = _getTexture(render, texturePath), - sprite = new PIXI.Sprite(texture); - - sprite.anchor.x = body.render.sprite.xOffset; - sprite.anchor.y = body.render.sprite.yOffset; - - return sprite; - }; - - /** - * Creates a body primitive - * @method _createBodyPrimitive - * @private - * @param {RenderPixi} render - * @param {body} body - * @return {PIXI.Graphics} graphics - * @deprecated - */ - var _createBodyPrimitive = function (render, body) { - var bodyRender = body.render, - options = render.options, - primitive = new PIXI.Graphics(), - fillStyle = Common.colorToNumber(bodyRender.fillStyle), - strokeStyle = Common.colorToNumber(bodyRender.strokeStyle), - strokeStyleIndicator = Common.colorToNumber(bodyRender.strokeStyle), - strokeStyleWireframe = Common.colorToNumber('#bbb'), - strokeStyleWireframeIndicator = Common.colorToNumber('#CD5C5C'), - part; - - primitive.clear(); - - // handle compound parts - for (var k = body.parts.length > 1 ? 1 : 0; k < body.parts.length; k++) { - part = body.parts[k]; - - if (!options.wireframes) { - primitive.beginFill(fillStyle, 1); - primitive.lineStyle(bodyRender.lineWidth, strokeStyle, 1); - } else { - primitive.beginFill(0, 0); - primitive.lineStyle(1, strokeStyleWireframe, 1); - } - - primitive.moveTo(part.vertices[0].x - body.position.x, part.vertices[0].y - body.position.y); - - for (var j = 1; j < part.vertices.length; j++) { - primitive.lineTo(part.vertices[j].x - body.position.x, part.vertices[j].y - body.position.y); - } - - primitive.lineTo(part.vertices[0].x - body.position.x, part.vertices[0].y - body.position.y); - - primitive.endFill(); - - // angle indicator - if (options.showAngleIndicator || options.showAxes) { - primitive.beginFill(0, 0); - - if (options.wireframes) { - primitive.lineStyle(1, strokeStyleWireframeIndicator, 1); - } else { - primitive.lineStyle(1, strokeStyleIndicator); - } - - primitive.moveTo(part.position.x - body.position.x, part.position.y - body.position.y); - primitive.lineTo( - (part.vertices[0].x + part.vertices[part.vertices.length - 1].x) / 2 - body.position.x, - (part.vertices[0].y + part.vertices[part.vertices.length - 1].y) / 2 - body.position.y, - ); - - primitive.endFill(); - } - } - - return primitive; - }; - - /** - * Gets the requested texture (a PIXI.Texture) via its path - * @method _getTexture - * @private - * @param {RenderPixi} render - * @param {string} imagePath - * @return {PIXI.Texture} texture - * @deprecated - */ - var _getTexture = function (render, imagePath) { - var texture = render.textures[imagePath]; - - if (!texture) texture = render.textures[imagePath] = PIXI.Texture.fromImage(imagePath); - - return texture; - }; - })(); - - /***/ - }, - /******/ - ], - ); - }; - - var Matter = main(); - - exports.PhysicsType = void 0; - (function (PhysicsType) { - PhysicsType["RECTANGLE"] = "rectangle"; - PhysicsType["CIRCLE"] = "circle"; - })(exports.PhysicsType || (exports.PhysicsType = {})); - var Physics = (function (_super) { - __extends(Physics, _super); - function Physics(params) { - return _super.call(this, params) || this; - } - Physics.prototype.init = function (params) { - this.bodyParams = params; - }; - Physics.prototype.update = function () { - if (this.body && this.gameObject) { - this.gameObject.transform.anchor.x = 0; - this.gameObject.transform.anchor.y = 0; - this.gameObject.transform.position.x = this.body.position.x; - this.gameObject.transform.position.y = this.body.position.y; - if (!this.bodyParams.stopRotation) { - this.gameObject.transform.rotation = this.body.angle; - } - } - }; - Physics.prototype.onDestroy = function () { - Matter.World.remove(this.PhysicsEngine.world, this.body, true); - }; - Physics.componentName = 'Physics'; - return Physics; - }(eva_js.Component)); - - var BodiesFactory = (function () { - function BodiesFactory() { - this.Bodies = Matter.Bodies; - } - BodiesFactory.prototype.create = function (component) { - var body = null; - var gameObject = component.gameObject, bodyParams = component.bodyParams; - var coordinate = this.getCoordinate(gameObject); - var x = bodyParams.position ? bodyParams.position.x : coordinate.x; - var y = bodyParams.position ? bodyParams.position.y : coordinate.y; - switch (bodyParams.type) { - case exports.PhysicsType.RECTANGLE: { - var width = gameObject.transform.size.width * gameObject.transform.scale.x; - var height = gameObject.transform.size.height * gameObject.transform.scale.y; - body = this.Bodies.rectangle(x, y, width, height, bodyParams.bodyOptions); - break; - } - case exports.PhysicsType.CIRCLE: { - body = this.Bodies.circle(x, y, bodyParams.radius, bodyParams.bodyOptions); - } - } - return body; - }; - BodiesFactory.prototype.getCoordinate = function (gameObject) { - var x = gameObject.transform.position.x + gameObject.transform.anchor.x * gameObject.parent.transform.size.width; - var y = gameObject.transform.position.y + gameObject.transform.anchor.y * gameObject.parent.transform.size.height; - return { - x: x, - y: y, - }; - }; - return BodiesFactory; - }()); - - var PhysicsEngine = (function () { - function PhysicsEngine(game, options) { - this.enabled = false; - this.Engine = Matter.Engine; - this.World = Matter.World; - this.bodiesFatoty = new BodiesFactory(); - this.Render = Matter.Render; - this.Runner = Matter.Runner; - this.Constraint = Matter.Constraint; - this.game = game; - this.collisionEvents = ['collisionStart', 'collisionActive', 'collisionEnd']; - this.bodyEvents = ['tick', 'beforeUpdate', 'afterUpdate', 'beforeRender', 'afterRender', 'afterTick']; - this.options = options; - } - PhysicsEngine.prototype.start = function () { - this.engine = this.Engine.create(); - var world = this.World.create(this.options.world); - this.engine.world = world; - this.runner = this.Runner.create({ - fps: this.options.fps || 70, - }); - if (this.options.isTest) { - var render = this.Render.create({ - element: this.options.element, - engine: this.engine, - options: { - width: this.game.canvas.width / this.options.resolution, - height: this.game.canvas.height / this.options.resolution, - pixelRatio: this.options.resolution, - showAngleIndicator: true, - }, - }); - this.Render.run(render); - this.Runner.run(this.runner, this.engine); - } - this.enabled = true; - this.initMouse(); - this.initCollisionEvents(); - this.initBodyEvents(); - }; - PhysicsEngine.prototype.update = function () { - if (!this.options.isTest) { - this.Runner.tick(this.runner, this.engine); - } - }; - PhysicsEngine.prototype.stop = function () { - this.enabled = false; - this.runner.enabled = false; - }; - PhysicsEngine.prototype.awake = function () { - this.enabled = true; - this.runner.enabled = true; - }; - PhysicsEngine.prototype.add = function (component) { - var body = this.createBodies(component); - this.World.add(this.engine.world, [body]); - component.body = body; - component.Body = Matter.Body; - component.PhysicsEngine = this.engine; - component.Constraint = this.Constraint; - component.mouseConstraint = this.mouseConstraint; - component.World = this.World; - body.component = component; - }; - PhysicsEngine.prototype.createBodies = function (params) { - var body = this.bodiesFatoty.create(params); - return body; - }; - PhysicsEngine.prototype.initCollisionEvents = function () { - var _this = this; - this.collisionEvents.forEach(function (eventName) { - Matter.Events.on(_this.engine, eventName, function (event) { - var pairs = event.pairs || []; - for (var i = 0; i < pairs.length; i++) { - var pair = pairs[i]; - var bodyA = pair.bodyA, bodyB = pair.bodyB; - var componentA = bodyA.component; - var componentB = bodyB.component; - componentA.emit(eventName, componentB.gameObject, componentA.gameObject); - componentB.emit(eventName, componentA.gameObject, componentB.gameObject); - } - }); - }); - }; - PhysicsEngine.prototype.initMouse = function () { - if (this.options.mouse && this.options.mouse.open) { - var mouse = Matter.Mouse.create(this.game.canvas); - this.mouseConstraint = Matter.MouseConstraint.create(this.engine, { - mouse: mouse, - constraint: this.options.mouse.constraint, - }); - this.World.add(this.engine.world, this.mouseConstraint); - } - }; - PhysicsEngine.prototype.initBodyEvents = function () { - var _this = this; - this.bodyEvents.forEach(function (eventName) { - Matter.Events.on(_this.engine, eventName, function (e) { - var bodies = e.source.world.bodies; - bodies.forEach(function (body) { - body.component.emit(eventName, body, body.component.gameObject); - }); - }); - }); - }; - return PhysicsEngine; - }()); - - var PhysicsSystem = (function (_super) { - __extends(PhysicsSystem, _super); - function PhysicsSystem() { - return _super !== null && _super.apply(this, arguments) || this; - } - PhysicsSystem.prototype.init = function (param) { - this.engine = new PhysicsEngine(this.game, param); - this.game.canvas.setAttribute('data-pixel-ratio', param.resolution || '1'); - }; - PhysicsSystem.prototype.awake = function () { }; - PhysicsSystem.prototype.start = function () { - this.engine.start(); - }; - PhysicsSystem.prototype.update = function () { - var e_1, _a; - var changes = this.componentObserver.clear(); - try { - for (var changes_1 = __values(changes), changes_1_1 = changes_1.next(); !changes_1_1.done; changes_1_1 = changes_1.next()) { - var changed = changes_1_1.value; - if (changed && changed.componentName === 'Physics') { - this.componentChanged(changed); - } - } - } - catch (e_1_1) { e_1 = { error: e_1_1 }; } - finally { - try { - if (changes_1_1 && !changes_1_1.done && (_a = changes_1.return)) _a.call(changes_1); - } - finally { if (e_1) throw e_1.error; } - } - this.engine.update(); - }; - PhysicsSystem.prototype.componentChanged = function (changed) { - switch (changed.type) { - case eva_js.OBSERVER_TYPE.ADD: { - this.engine.add(changed.component); - break; - } - case eva_js.OBSERVER_TYPE.CHANGE: { - break; - } - case eva_js.OBSERVER_TYPE.REMOVE: { - break; - } - } - }; - PhysicsSystem.prototype.lateUpdate = function () { }; - PhysicsSystem.prototype.onResume = function () { - if (!this.engine.enabled) { - this.engine.awake(); - } - }; - PhysicsSystem.prototype.onPause = function () { - this.engine.stop(); - }; - PhysicsSystem.prototype.onDestroy = function () { }; - PhysicsSystem.systemName = 'PhysicsSystem'; - PhysicsSystem = __decorate([ - eva_js.decorators.componentObserver({ - Physics: [{ prop: ['bodyParams'], deep: true }], - }) - ], PhysicsSystem); - return PhysicsSystem; - }(eva_js.System)); - - exports.Physics = Physics; - exports.PhysicsSystem = PhysicsSystem; - - Object.defineProperty(exports, '__esModule', { value: true }); - -}))); diff --git a/dist/cdn/EVA.plugin.renderer.dragonbone.js b/dist/cdn/EVA.plugin.renderer.dragonbone.js deleted file mode 100644 index 8cc7317b..00000000 --- a/dist/cdn/EVA.plugin.renderer.dragonbone.js +++ /dev/null @@ -1,19361 +0,0 @@ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@eva/eva.js'), require('pixi.js'), require('@eva/plugin-renderer')) : - typeof define === 'function' && define.amd ? define(['exports', '@eva/eva.js', 'pixi.js', '@eva/plugin-renderer'], factory) : - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.EVA = global.EVA || {}, global.EVA.plugin = global.EVA.plugin || {}, global.EVA.plugin.renderer = global.EVA.plugin.renderer || {}, global.EVA.plugin.renderer.dragonbone = {}), global.EVA, global.PIXI, global.EVA.plugin.renderer)); -}(this, (function (exports, eva_js, pixi_js, pluginRenderer) { 'use strict'; - - /*! ***************************************************************************** - Copyright (c) Microsoft Corporation. - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. - ***************************************************************************** */ - - function __decorate(decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; - } - - function __awaiter(thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - } - - class DragonBone$3 extends eva_js.Component { - constructor() { - super(...arguments); - this.waitPlay = false; - this.waitStop = false; - this.waitPlayInfo = { - animationName: null, - }; - this.resource = ''; - this.armatureName = ''; - this.animationName = ''; - this.autoPlay = true; - } - init(obj) { - if (!obj) - return; - if (!obj.armatureName) { - throw new Error(`The dragonBone component on ${this.gameObject.name}, armatureName is required!`); - } - Object.assign(this, obj); - if (this.autoPlay) { - this.play(this.animationName); - } - } - play(name, times) { - if (name) - this.animationName = name; - if (!this.armature) { - this.waitPlayInfo = { animationName: name, times }; - this.waitPlay = true; - } - else { - this.armature.play(this.animationName, times); - } - } - stop(name) { - if (!this.armature) { - this.waitPlayInfo = { animationName: name }; - this.waitStop = true; - } - else { - this.armature.stop(name); - } - this.animationName = null; - } - set armature(val) { - this._armature = val; - if (!val) - return; - const { animationName, times } = this.waitPlayInfo; - this.waitPlay && this.play(animationName, times); - this.waitStop && this.stop(animationName); - this.waitPlay = false; - this.waitStop = false; - } - get armature() { - return this._armature; - } - onDestroy() { - this.removeAllListeners(); - } - } - DragonBone$3.componentName = 'DragonBone'; - __decorate([ - eva_js.decorators.IDEProp - ], DragonBone$3.prototype, "resource", void 0); - __decorate([ - eva_js.decorators.IDEProp - ], DragonBone$3.prototype, "armatureName", void 0); - __decorate([ - eva_js.decorators.IDEProp - ], DragonBone$3.prototype, "animationName", void 0); - __decorate([ - eva_js.decorators.IDEProp - ], DragonBone$3.prototype, "autoPlay", void 0); - - const PIXI = { - Texture: pixi_js.Texture, - Rectangle: pixi_js.Rectangle, - Sprite: pixi_js.Sprite, - Graphics: pixi_js.Graphics, - BLEND_MODES: pixi_js.BLEND_MODES, - mesh: pixi_js.mesh, - ticker: pixi_js.ticker, - }; - var dragonBones; - var __extends = - (undefined && undefined.__extends) || - (function() { - var extendStatics = - Object.setPrototypeOf || - ({__proto__: []} instanceof Array && - function(d, b) { - d.__proto__ = b; - }) || - function(d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - }; - return function(d, b) { - extendStatics(d, b); - function __() { - this.constructor = d; - } - d.prototype = - b === null - ? Object.create(b) - : ((__.prototype = b.prototype), new __()); - }; - })(); - /** - * The MIT License (MIT) - * - * Copyright (c) 2012-2018 DragonBones team and other contributors - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of - * the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR - * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - (function(dragonBones) { - /** - * @private - */ - var DragonBones = /** @class */ (function() { - function DragonBones(eventManager) { - this._clock = new dragonBones.WorldClock(); - this._events = []; - this._objects = []; - this._eventManager = null; - this._eventManager = eventManager; - console.info( - 'DragonBones: ' + - DragonBones.VERSION + - '\nWebsite: http://dragonbones.com/\nSource and Demo: https://github.com/DragonBones/', - ); - } - DragonBones.prototype.advanceTime = function(passedTime) { - if (this._objects.length > 0) { - for (var _i = 0, _a = this._objects; _i < _a.length; _i++) { - var object = _a[_i]; - object.returnToPool(); - } - this._objects.length = 0; - } - this._clock.advanceTime(passedTime); - if (this._events.length > 0) { - for (var i = 0; i < this._events.length; ++i) { - var eventObject = this._events[i]; - var armature = eventObject.armature; - if (armature._armatureData !== null) { - armature.eventDispatcher.dispatchDBEvent( - eventObject.type, - eventObject, - ); - if (eventObject.type === dragonBones.EventObject.SOUND_EVENT) { - this._eventManager.dispatchDBEvent(eventObject.type, eventObject); - } - } - this.bufferObject(eventObject); - } - this._events.length = 0; - } - }; - DragonBones.prototype.bufferEvent = function(value) { - if (this._events.indexOf(value) < 0) { - this._events.push(value); - } - }; - DragonBones.prototype.bufferObject = function(object) { - if (this._objects.indexOf(object) < 0) { - this._objects.push(object); - } - }; - Object.defineProperty(DragonBones.prototype, 'clock', { - get: function() { - return this._clock; - }, - enumerable: true, - configurable: true, - }); - Object.defineProperty(DragonBones.prototype, 'eventManager', { - get: function() { - return this._eventManager; - }, - enumerable: true, - configurable: true, - }); - DragonBones.VERSION = '5.7.000'; - DragonBones.yDown = true; - DragonBones.debug = false; - DragonBones.debugDraw = false; - return DragonBones; - })(); - dragonBones.DragonBones = DragonBones; - })(dragonBones || (dragonBones = {})); - // - if (!console.warn) { - console.warn = function() {}; - } - if (!console.assert) { - console.assert = function() {}; - } - // - if (!Date.now) { - Date.now = function now() { - return new Date().getTime(); - }; - } - - /** - * The MIT License (MIT) - * - * Copyright (c) 2012-2018 DragonBones team and other contributors - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of - * the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR - * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - (function(dragonBones) { - /** - * - The BaseObject is the base class for all objects in the DragonBones framework. - * All BaseObject instances are cached to the object pool to reduce the performance consumption of frequent requests for memory or memory recovery. - * @version DragonBones 4.5 - * @language en_US - */ - /** - * - 基础对象,通常 DragonBones 的对象都继承自该类。 - * 所有基础对象的实例都会缓存到对象池,以减少频繁申请内存或内存回收的性能消耗。 - * @version DragonBones 4.5 - * @language zh_CN - */ - var BaseObject = /** @class */ (function() { - function BaseObject() { - /** - * - A unique identification number assigned to the object. - * @version DragonBones 4.5 - * @language en_US - */ - /** - * - 分配给此实例的唯一标识号。 - * @version DragonBones 4.5 - * @language zh_CN - */ - this.hashCode = BaseObject._hashCode++; - this._isInPool = false; - } - BaseObject._returnObject = function(object) { - var classType = String(object.constructor); - var maxCount = - classType in BaseObject._maxCountMap - ? BaseObject._maxCountMap[classType] - : BaseObject._defaultMaxCount; - var pool = (BaseObject._poolsMap[classType] = - BaseObject._poolsMap[classType] || []); - if (pool.length < maxCount) { - if (!object._isInPool) { - object._isInPool = true; - pool.push(object); - } else { - console.warn('The object is already in the pool.'); - } - } - }; - BaseObject.toString = function() { - throw new Error(); - }; - /** - * - Set the maximum cache count of the specify object pool. - * @param objectConstructor - The specify class. (Set all object pools max cache count if not set) - * @param maxCount - Max count. - * @version DragonBones 4.5 - * @language en_US - */ - /** - * - 设置特定对象池的最大缓存数量。 - * @param objectConstructor - 特定的类。 (不设置则设置所有对象池的最大缓存数量) - * @param maxCount - 最大缓存数量。 - * @version DragonBones 4.5 - * @language zh_CN - */ - BaseObject.setMaxCount = function(objectConstructor, maxCount) { - if (maxCount < 0 || maxCount !== maxCount) { - maxCount = 0; - } - if (objectConstructor !== null) { - var classType = String(objectConstructor); - var pool = - classType in BaseObject._poolsMap - ? BaseObject._poolsMap[classType] - : null; - if (pool !== null && pool.length > maxCount) { - pool.length = maxCount; - } - BaseObject._maxCountMap[classType] = maxCount; - } else { - BaseObject._defaultMaxCount = maxCount; - for (var classType in BaseObject._poolsMap) { - var pool = BaseObject._poolsMap[classType]; - if (pool.length > maxCount) { - pool.length = maxCount; - } - if (classType in BaseObject._maxCountMap) { - BaseObject._maxCountMap[classType] = maxCount; - } - } - } - }; - /** - * - Clear the cached instances of a specify object pool. - * @param objectConstructor - Specify class. (Clear all cached instances if not set) - * @version DragonBones 4.5 - * @language en_US - */ - /** - * - 清除特定对象池的缓存实例。 - * @param objectConstructor - 特定的类。 (不设置则清除所有缓存的实例) - * @version DragonBones 4.5 - * @language zh_CN - */ - BaseObject.clearPool = function(objectConstructor) { - if (objectConstructor === void 0) { - objectConstructor = null; - } - if (objectConstructor !== null) { - var classType = String(objectConstructor); - var pool = - classType in BaseObject._poolsMap - ? BaseObject._poolsMap[classType] - : null; - if (pool !== null && pool.length > 0) { - pool.length = 0; - } - } else { - for (var k in BaseObject._poolsMap) { - var pool = BaseObject._poolsMap[k]; - pool.length = 0; - } - } - }; - /** - * - Get an instance of the specify class from object pool. - * @param objectConstructor - The specify class. - * @version DragonBones 4.5 - * @language en_US - */ - /** - * - 从对象池中获取特定类的实例。 - * @param objectConstructor - 特定的类。 - * @version DragonBones 4.5 - * @language zh_CN - */ - BaseObject.borrowObject = function(objectConstructor) { - var classType = String(objectConstructor); - var pool = - classType in BaseObject._poolsMap - ? BaseObject._poolsMap[classType] - : null; - if (pool !== null && pool.length > 0) { - var object_1 = pool.pop(); - object_1._isInPool = false; - return object_1; - } - var object = new objectConstructor(); - object._onClear(); - return object; - }; - /** - * - Clear the object and return it back to object pool。 - * @version DragonBones 4.5 - * @language en_US - */ - /** - * - 清除该实例的所有数据并将其返还对象池。 - * @version DragonBones 4.5 - * @language zh_CN - */ - BaseObject.prototype.returnToPool = function() { - this._onClear(); - BaseObject._returnObject(this); - }; - BaseObject._hashCode = 0; - BaseObject._defaultMaxCount = 3000; - BaseObject._maxCountMap = {}; - BaseObject._poolsMap = {}; - return BaseObject; - })(); - dragonBones.BaseObject = BaseObject; - })(dragonBones || (dragonBones = {})); - /** - * The MIT License (MIT) - * - * Copyright (c) 2012-2018 DragonBones team and other contributors - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of - * the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR - * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - (function(dragonBones) { - /** - * - 2D Transform matrix. - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 2D 转换矩阵。 - * @version DragonBones 3.0 - * @language zh_CN - */ - var Matrix = /** @class */ (function() { - /** - * @private - */ - function Matrix(a, b, c, d, tx, ty) { - if (a === void 0) { - a = 1.0; - } - if (b === void 0) { - b = 0.0; - } - if (c === void 0) { - c = 0.0; - } - if (d === void 0) { - d = 1.0; - } - if (tx === void 0) { - tx = 0.0; - } - if (ty === void 0) { - ty = 0.0; - } - this.a = a; - this.b = b; - this.c = c; - this.d = d; - this.tx = tx; - this.ty = ty; - } - Matrix.prototype.toString = function() { - return ( - '[object dragonBones.Matrix] a:' + - this.a + - ' b:' + - this.b + - ' c:' + - this.c + - ' d:' + - this.d + - ' tx:' + - this.tx + - ' ty:' + - this.ty - ); - }; - /** - * @private - */ - Matrix.prototype.copyFrom = function(value) { - this.a = value.a; - this.b = value.b; - this.c = value.c; - this.d = value.d; - this.tx = value.tx; - this.ty = value.ty; - return this; - }; - /** - * @private - */ - Matrix.prototype.copyFromArray = function(value, offset) { - if (offset === void 0) { - offset = 0; - } - this.a = value[offset]; - this.b = value[offset + 1]; - this.c = value[offset + 2]; - this.d = value[offset + 3]; - this.tx = value[offset + 4]; - this.ty = value[offset + 5]; - return this; - }; - /** - * - Convert to unit matrix. - * The resulting matrix has the following properties: a=1, b=0, c=0, d=1, tx=0, ty=0. - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 转换为单位矩阵。 - * 该矩阵具有以下属性:a=1、b=0、c=0、d=1、tx=0、ty=0。 - * @version DragonBones 3.0 - * @language zh_CN - */ - Matrix.prototype.identity = function() { - this.a = this.d = 1.0; - this.b = this.c = 0.0; - this.tx = this.ty = 0.0; - return this; - }; - /** - * - Multiplies the current matrix with another matrix. - * @param value - The matrix that needs to be multiplied. - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 将当前矩阵与另一个矩阵相乘。 - * @param value - 需要相乘的矩阵。 - * @version DragonBones 3.0 - * @language zh_CN - */ - Matrix.prototype.concat = function(value) { - var aA = this.a * value.a; - var bA = 0.0; - var cA = 0.0; - var dA = this.d * value.d; - var txA = this.tx * value.a + value.tx; - var tyA = this.ty * value.d + value.ty; - if (this.b !== 0.0 || this.c !== 0.0) { - aA += this.b * value.c; - bA += this.b * value.d; - cA += this.c * value.a; - dA += this.c * value.b; - } - if (value.b !== 0.0 || value.c !== 0.0) { - bA += this.a * value.b; - cA += this.d * value.c; - txA += this.ty * value.c; - tyA += this.tx * value.b; - } - this.a = aA; - this.b = bA; - this.c = cA; - this.d = dA; - this.tx = txA; - this.ty = tyA; - return this; - }; - /** - * - Convert to inverse matrix. - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 转换为逆矩阵。 - * @version DragonBones 3.0 - * @language zh_CN - */ - Matrix.prototype.invert = function() { - var aA = this.a; - var bA = this.b; - var cA = this.c; - var dA = this.d; - var txA = this.tx; - var tyA = this.ty; - if (bA === 0.0 && cA === 0.0) { - this.b = this.c = 0.0; - if (aA === 0.0 || dA === 0.0) { - this.a = this.b = this.tx = this.ty = 0.0; - } else { - aA = this.a = 1.0 / aA; - dA = this.d = 1.0 / dA; - this.tx = -aA * txA; - this.ty = -dA * tyA; - } - return this; - } - var determinant = aA * dA - bA * cA; - if (determinant === 0.0) { - this.a = this.d = 1.0; - this.b = this.c = 0.0; - this.tx = this.ty = 0.0; - return this; - } - determinant = 1.0 / determinant; - var k = (this.a = dA * determinant); - bA = this.b = -bA * determinant; - cA = this.c = -cA * determinant; - dA = this.d = aA * determinant; - this.tx = -(k * txA + cA * tyA); - this.ty = -(bA * txA + dA * tyA); - return this; - }; - /** - * - Apply a matrix transformation to a specific point. - * @param x - X coordinate. - * @param y - Y coordinate. - * @param result - The point after the transformation is applied. - * @param delta - Whether to ignore tx, ty's conversion to point. - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 将矩阵转换应用于特定点。 - * @param x - 横坐标。 - * @param y - 纵坐标。 - * @param result - 应用转换之后的点。 - * @param delta - 是否忽略 tx,ty 对点的转换。 - * @version DragonBones 3.0 - * @language zh_CN - */ - Matrix.prototype.transformPoint = function(x, y, result, delta) { - if (delta === void 0) { - delta = false; - } - result.x = this.a * x + this.c * y; - result.y = this.b * x + this.d * y; - if (!delta) { - result.x += this.tx; - result.y += this.ty; - } - }; - /** - * @private - */ - Matrix.prototype.transformRectangle = function(rectangle, delta) { - if (delta === void 0) { - delta = false; - } - var a = this.a; - var b = this.b; - var c = this.c; - var d = this.d; - var tx = delta ? 0.0 : this.tx; - var ty = delta ? 0.0 : this.ty; - var x = rectangle.x; - var y = rectangle.y; - var xMax = x + rectangle.width; - var yMax = y + rectangle.height; - var x0 = a * x + c * y + tx; - var y0 = b * x + d * y + ty; - var x1 = a * xMax + c * y + tx; - var y1 = b * xMax + d * y + ty; - var x2 = a * xMax + c * yMax + tx; - var y2 = b * xMax + d * yMax + ty; - var x3 = a * x + c * yMax + tx; - var y3 = b * x + d * yMax + ty; - var tmp = 0.0; - if (x0 > x1) { - tmp = x0; - x0 = x1; - x1 = tmp; - } - if (x2 > x3) { - tmp = x2; - x2 = x3; - x3 = tmp; - } - rectangle.x = Math.floor(x0 < x2 ? x0 : x2); - rectangle.width = Math.ceil((x1 > x3 ? x1 : x3) - rectangle.x); - if (y0 > y1) { - tmp = y0; - y0 = y1; - y1 = tmp; - } - if (y2 > y3) { - tmp = y2; - y2 = y3; - y3 = tmp; - } - rectangle.y = Math.floor(y0 < y2 ? y0 : y2); - rectangle.height = Math.ceil((y1 > y3 ? y1 : y3) - rectangle.y); - }; - return Matrix; - })(); - dragonBones.Matrix = Matrix; - })(dragonBones || (dragonBones = {})); - /** - * The MIT License (MIT) - * - * Copyright (c) 2012-2018 DragonBones team and other contributors - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of - * the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR - * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - (function(dragonBones) { - /** - * - 2D Transform. - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 2D 变换。 - * @version DragonBones 3.0 - * @language zh_CN - */ - var Transform = /** @class */ (function() { - /** - * @private - */ - function Transform(x, y, skew, rotation, scaleX, scaleY) { - if (x === void 0) { - x = 0.0; - } - if (y === void 0) { - y = 0.0; - } - if (skew === void 0) { - skew = 0.0; - } - if (rotation === void 0) { - rotation = 0.0; - } - if (scaleX === void 0) { - scaleX = 1.0; - } - if (scaleY === void 0) { - scaleY = 1.0; - } - this.x = x; - this.y = y; - this.skew = skew; - this.rotation = rotation; - this.scaleX = scaleX; - this.scaleY = scaleY; - } - /** - * @private - */ - Transform.normalizeRadian = function(value) { - value = (value + Math.PI) % (Math.PI * 2.0); - value += value > 0.0 ? -Math.PI : Math.PI; - return value; - }; - Transform.prototype.toString = function() { - return ( - '[object dragonBones.Transform] x:' + - this.x + - ' y:' + - this.y + - ' skewX:' + - (this.skew * 180.0) / Math.PI + - ' skewY:' + - (this.rotation * 180.0) / Math.PI + - ' scaleX:' + - this.scaleX + - ' scaleY:' + - this.scaleY - ); - }; - /** - * @private - */ - Transform.prototype.copyFrom = function(value) { - this.x = value.x; - this.y = value.y; - this.skew = value.skew; - this.rotation = value.rotation; - this.scaleX = value.scaleX; - this.scaleY = value.scaleY; - return this; - }; - /** - * @private - */ - Transform.prototype.identity = function() { - this.x = this.y = 0.0; - this.skew = this.rotation = 0.0; - this.scaleX = this.scaleY = 1.0; - return this; - }; - /** - * @private - */ - Transform.prototype.add = function(value) { - this.x += value.x; - this.y += value.y; - this.skew += value.skew; - this.rotation += value.rotation; - this.scaleX *= value.scaleX; - this.scaleY *= value.scaleY; - return this; - }; - /** - * @private - */ - Transform.prototype.minus = function(value) { - this.x -= value.x; - this.y -= value.y; - this.skew -= value.skew; - this.rotation -= value.rotation; - this.scaleX /= value.scaleX; - this.scaleY /= value.scaleY; - return this; - }; - /** - * @private - */ - Transform.prototype.fromMatrix = function(matrix) { - var backupScaleX = this.scaleX, - backupScaleY = this.scaleY; - var PI_Q = Transform.PI_Q; - this.x = matrix.tx; - this.y = matrix.ty; - this.rotation = Math.atan(matrix.b / matrix.a); - var skewX = Math.atan(-matrix.c / matrix.d); - this.scaleX = - this.rotation > -PI_Q && this.rotation < PI_Q - ? matrix.a / Math.cos(this.rotation) - : matrix.b / Math.sin(this.rotation); - this.scaleY = - skewX > -PI_Q && skewX < PI_Q - ? matrix.d / Math.cos(skewX) - : -matrix.c / Math.sin(skewX); - if (backupScaleX >= 0.0 && this.scaleX < 0.0) { - this.scaleX = -this.scaleX; - this.rotation = this.rotation - Math.PI; - } - if (backupScaleY >= 0.0 && this.scaleY < 0.0) { - this.scaleY = -this.scaleY; - skewX = skewX - Math.PI; - } - this.skew = skewX - this.rotation; - return this; - }; - /** - * @private - */ - Transform.prototype.toMatrix = function(matrix) { - if (this.rotation === 0.0) { - matrix.a = 1.0; - matrix.b = 0.0; - } else { - matrix.a = Math.cos(this.rotation); - matrix.b = Math.sin(this.rotation); - } - if (this.skew === 0.0) { - matrix.c = -matrix.b; - matrix.d = matrix.a; - } else { - matrix.c = -Math.sin(this.skew + this.rotation); - matrix.d = Math.cos(this.skew + this.rotation); - } - if (this.scaleX !== 1.0) { - matrix.a *= this.scaleX; - matrix.b *= this.scaleX; - } - if (this.scaleY !== 1.0) { - matrix.c *= this.scaleY; - matrix.d *= this.scaleY; - } - matrix.tx = this.x; - matrix.ty = this.y; - return this; - }; - /** - * @private - */ - Transform.PI = Math.PI; - /** - * @private - */ - Transform.PI_D = Math.PI * 2.0; - /** - * @private - */ - Transform.PI_H = Math.PI / 2.0; - /** - * @private - */ - Transform.PI_Q = Math.PI / 4.0; - /** - * @private - */ - Transform.RAD_DEG = 180.0 / Math.PI; - /** - * @private - */ - Transform.DEG_RAD = Math.PI / 180.0; - return Transform; - })(); - dragonBones.Transform = Transform; - })(dragonBones || (dragonBones = {})); - /** - * The MIT License (MIT) - * - * Copyright (c) 2012-2018 DragonBones team and other contributors - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of - * the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR - * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - (function(dragonBones) { - /** - * @private - */ - var ColorTransform = /** @class */ (function() { - function ColorTransform( - alphaMultiplier, - redMultiplier, - greenMultiplier, - blueMultiplier, - alphaOffset, - redOffset, - greenOffset, - blueOffset, - ) { - if (alphaMultiplier === void 0) { - alphaMultiplier = 1.0; - } - if (redMultiplier === void 0) { - redMultiplier = 1.0; - } - if (greenMultiplier === void 0) { - greenMultiplier = 1.0; - } - if (blueMultiplier === void 0) { - blueMultiplier = 1.0; - } - if (alphaOffset === void 0) { - alphaOffset = 0; - } - if (redOffset === void 0) { - redOffset = 0; - } - if (greenOffset === void 0) { - greenOffset = 0; - } - if (blueOffset === void 0) { - blueOffset = 0; - } - this.alphaMultiplier = alphaMultiplier; - this.redMultiplier = redMultiplier; - this.greenMultiplier = greenMultiplier; - this.blueMultiplier = blueMultiplier; - this.alphaOffset = alphaOffset; - this.redOffset = redOffset; - this.greenOffset = greenOffset; - this.blueOffset = blueOffset; - } - ColorTransform.prototype.copyFrom = function(value) { - this.alphaMultiplier = value.alphaMultiplier; - this.redMultiplier = value.redMultiplier; - this.greenMultiplier = value.greenMultiplier; - this.blueMultiplier = value.blueMultiplier; - this.alphaOffset = value.alphaOffset; - this.redOffset = value.redOffset; - this.greenOffset = value.greenOffset; - this.blueOffset = value.blueOffset; - }; - ColorTransform.prototype.identity = function() { - this.alphaMultiplier = this.redMultiplier = this.greenMultiplier = this.blueMultiplier = 1.0; - this.alphaOffset = this.redOffset = this.greenOffset = this.blueOffset = 0; - }; - return ColorTransform; - })(); - dragonBones.ColorTransform = ColorTransform; - })(dragonBones || (dragonBones = {})); - /** - * The MIT License (MIT) - * - * Copyright (c) 2012-2018 DragonBones team and other contributors - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of - * the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR - * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - (function(dragonBones) { - /** - * - The Point object represents a location in a two-dimensional coordinate system. - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - Point 对象表示二维坐标系统中的某个位置。 - * @version DragonBones 3.0 - * @language zh_CN - */ - var Point = /** @class */ (function() { - /** - * - Creates a new point. If you pass no parameters to this method, a point is created at (0,0). - * @param x - The horizontal coordinate. - * @param y - The vertical coordinate. - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 创建一个 egret.Point 对象.若不传入任何参数,将会创建一个位于(0,0)位置的点。 - * @param x - 该对象的x属性值,默认为 0.0。 - * @param y - 该对象的y属性值,默认为 0.0。 - * @version DragonBones 3.0 - * @language zh_CN - */ - function Point(x, y) { - if (x === void 0) { - x = 0.0; - } - if (y === void 0) { - y = 0.0; - } - this.x = x; - this.y = y; - } - /** - * @private - */ - Point.prototype.copyFrom = function(value) { - this.x = value.x; - this.y = value.y; - }; - /** - * @private - */ - Point.prototype.clear = function() { - this.x = this.y = 0.0; - }; - return Point; - })(); - dragonBones.Point = Point; - })(dragonBones || (dragonBones = {})); - /** - * The MIT License (MIT) - * - * Copyright (c) 2012-2018 DragonBones team and other contributors - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of - * the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR - * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - (function(dragonBones) { - /** - * - A Rectangle object is an area defined by its position, as indicated by its top-left corner point (x, y) and by its - * width and its height.
- * The x, y, width, and height properties of the Rectangle class are independent of each other; changing the value of - * one property has no effect on the others. However, the right and bottom properties are integrally related to those - * four properties. For example, if you change the value of the right property, the value of the width property changes; - * if you change the bottom property, the value of the height property changes. - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - Rectangle 对象是按其位置(由它左上角的点 (x, y) 确定)以及宽度和高度定义的区域。
- * Rectangle 类的 x、y、width 和 height 属性相互独立;更改一个属性的值不会影响其他属性。 - * 但是,right 和 bottom 属性与这四个属性是整体相关的。例如,如果更改 right 属性的值,则 width - * 属性的值将发生变化;如果更改 bottom 属性,则 height 属性的值将发生变化。 - * @version DragonBones 3.0 - * @language zh_CN - */ - var Rectangle = /** @class */ (function() { - /** - * @private - */ - function Rectangle(x, y, width, height) { - if (x === void 0) { - x = 0.0; - } - if (y === void 0) { - y = 0.0; - } - if (width === void 0) { - width = 0.0; - } - if (height === void 0) { - height = 0.0; - } - this.x = x; - this.y = y; - this.width = width; - this.height = height; - } - /** - * @private - */ - Rectangle.prototype.copyFrom = function(value) { - this.x = value.x; - this.y = value.y; - this.width = value.width; - this.height = value.height; - }; - /** - * @private - */ - Rectangle.prototype.clear = function() { - this.x = this.y = 0.0; - this.width = this.height = 0.0; - }; - return Rectangle; - })(); - dragonBones.Rectangle = Rectangle; - })(dragonBones || (dragonBones = {})); - /** - * The MIT License (MIT) - * - * Copyright (c) 2012-2018 DragonBones team and other contributors - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of - * the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR - * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - (function(dragonBones) { - /** - * - The user custom data. - * @version DragonBones 5.0 - * @language en_US - */ - /** - * - 用户自定义数据。 - * @version DragonBones 5.0 - * @language zh_CN - */ - var UserData = /** @class */ (function(_super) { - __extends(UserData, _super); - function UserData() { - var _this = (_super !== null && _super.apply(this, arguments)) || this; - /** - * - The custom int numbers. - * @version DragonBones 5.0 - * @language en_US - */ - /** - * - 自定义整数。 - * @version DragonBones 5.0 - * @language zh_CN - */ - _this.ints = []; - /** - * - The custom float numbers. - * @version DragonBones 5.0 - * @language en_US - */ - /** - * - 自定义浮点数。 - * @version DragonBones 5.0 - * @language zh_CN - */ - _this.floats = []; - /** - * - The custom strings. - * @version DragonBones 5.0 - * @language en_US - */ - /** - * - 自定义字符串。 - * @version DragonBones 5.0 - * @language zh_CN - */ - _this.strings = []; - return _this; - } - UserData.toString = function() { - return '[class dragonBones.UserData]'; - }; - UserData.prototype._onClear = function() { - this.ints.length = 0; - this.floats.length = 0; - this.strings.length = 0; - }; - /** - * @internal - */ - UserData.prototype.addInt = function(value) { - this.ints.push(value); - }; - /** - * @internal - */ - UserData.prototype.addFloat = function(value) { - this.floats.push(value); - }; - /** - * @internal - */ - UserData.prototype.addString = function(value) { - this.strings.push(value); - }; - /** - * - Get the custom int number. - * @version DragonBones 5.0 - * @language en_US - */ - /** - * - 获取自定义整数。 - * @version DragonBones 5.0 - * @language zh_CN - */ - UserData.prototype.getInt = function(index) { - if (index === void 0) { - index = 0; - } - return index >= 0 && index < this.ints.length ? this.ints[index] : 0; - }; - /** - * - Get the custom float number. - * @version DragonBones 5.0 - * @language en_US - */ - /** - * - 获取自定义浮点数。 - * @version DragonBones 5.0 - * @language zh_CN - */ - UserData.prototype.getFloat = function(index) { - if (index === void 0) { - index = 0; - } - return index >= 0 && index < this.floats.length - ? this.floats[index] - : 0.0; - }; - /** - * - Get the custom string. - * @version DragonBones 5.0 - * @language en_US - */ - /** - * - 获取自定义字符串。 - * @version DragonBones 5.0 - * @language zh_CN - */ - UserData.prototype.getString = function(index) { - if (index === void 0) { - index = 0; - } - return index >= 0 && index < this.strings.length - ? this.strings[index] - : ''; - }; - return UserData; - })(dragonBones.BaseObject); - dragonBones.UserData = UserData; - /** - * @private - */ - var ActionData = /** @class */ (function(_super) { - __extends(ActionData, _super); - function ActionData() { - var _this = (_super !== null && _super.apply(this, arguments)) || this; - _this.data = null; // - return _this; - } - ActionData.toString = function() { - return '[class dragonBones.ActionData]'; - }; - ActionData.prototype._onClear = function() { - if (this.data !== null) { - this.data.returnToPool(); - } - this.type = 0 /* Play */; - this.name = ''; - this.bone = null; - this.slot = null; - this.data = null; - }; - return ActionData; - })(dragonBones.BaseObject); - dragonBones.ActionData = ActionData; - })(dragonBones || (dragonBones = {})); - /** - * The MIT License (MIT) - * - * Copyright (c) 2012-2018 DragonBones team and other contributors - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of - * the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR - * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - (function(dragonBones) { - /** - * - The DragonBones data. - * A DragonBones data contains multiple armature data. - * @see dragonBones.ArmatureData - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 龙骨数据。 - * 一个龙骨数据包含多个骨架数据。 - * @see dragonBones.ArmatureData - * @version DragonBones 3.0 - * @language zh_CN - */ - var DragonBonesData = /** @class */ (function(_super) { - __extends(DragonBonesData, _super); - function DragonBonesData() { - var _this = (_super !== null && _super.apply(this, arguments)) || this; - /** - * @internal - */ - _this.frameIndices = []; - /** - * @internal - */ - _this.cachedFrames = []; - /** - * - All armature data names. - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 所有的骨架数据名称。 - * @version DragonBones 3.0 - * @language zh_CN - */ - _this.armatureNames = []; - /** - * @private - */ - _this.armatures = {}; - /** - * @private - */ - _this.userData = null; // Initial value. - return _this; - } - DragonBonesData.toString = function() { - return '[class dragonBones.DragonBonesData]'; - }; - DragonBonesData.prototype._onClear = function() { - for (var k in this.armatures) { - this.armatures[k].returnToPool(); - delete this.armatures[k]; - } - if (this.userData !== null) { - this.userData.returnToPool(); - } - this.autoSearch = false; - this.frameRate = 0; - this.version = ''; - this.name = ''; - this.stage = null; - this.frameIndices.length = 0; - this.cachedFrames.length = 0; - this.armatureNames.length = 0; - //this.armatures.clear(); - this.binary = null; // - this.intArray = null; // - this.floatArray = null; // - this.frameIntArray = null; // - this.frameFloatArray = null; // - this.frameArray = null; // - this.timelineArray = null; // - this.colorArray = null; // - this.userData = null; - }; - /** - * @internal - */ - DragonBonesData.prototype.addArmature = function(value) { - if (value.name in this.armatures) { - console.warn('Same armature: ' + value.name); - return; - } - value.parent = this; - this.armatures[value.name] = value; - this.armatureNames.push(value.name); - }; - /** - * - Get a specific armature data. - * @param armatureName - The armature data name. - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 获取特定的骨架数据。 - * @param armatureName - 骨架数据名称。 - * @version DragonBones 3.0 - * @language zh_CN - */ - DragonBonesData.prototype.getArmature = function(armatureName) { - return armatureName in this.armatures - ? this.armatures[armatureName] - : null; - }; - return DragonBonesData; - })(dragonBones.BaseObject); - dragonBones.DragonBonesData = DragonBonesData; - })(dragonBones || (dragonBones = {})); - /** - * The MIT License (MIT) - * - * Copyright (c) 2012-2018 DragonBones team and other contributors - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of - * the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR - * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - (function(dragonBones) { - /** - * - The armature data. - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 骨架数据。 - * @version DragonBones 3.0 - * @language zh_CN - */ - var ArmatureData = /** @class */ (function(_super) { - __extends(ArmatureData, _super); - function ArmatureData() { - var _this = (_super !== null && _super.apply(this, arguments)) || this; - /** - * @private - */ - _this.aabb = new dragonBones.Rectangle(); - /** - * - The names of all the animation data. - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 所有的动画数据名称。 - * @version DragonBones 3.0 - * @language zh_CN - */ - _this.animationNames = []; - /** - * @private - */ - _this.sortedBones = []; - /** - * @private - */ - _this.sortedSlots = []; - /** - * @private - */ - _this.defaultActions = []; - /** - * @private - */ - _this.actions = []; - /** - * @private - */ - _this.bones = {}; - /** - * @private - */ - _this.slots = {}; - /** - * @private - */ - _this.constraints = {}; - /** - * @private - */ - _this.skins = {}; - /** - * @private - */ - _this.animations = {}; - /** - * @private - */ - _this.canvas = null; // Initial value. - /** - * @private - */ - _this.userData = null; // Initial value. - return _this; - } - ArmatureData.toString = function() { - return '[class dragonBones.ArmatureData]'; - }; - ArmatureData.prototype._onClear = function() { - for (var _i = 0, _a = this.defaultActions; _i < _a.length; _i++) { - var action = _a[_i]; - action.returnToPool(); - } - for (var _b = 0, _c = this.actions; _b < _c.length; _b++) { - var action = _c[_b]; - action.returnToPool(); - } - for (var k in this.bones) { - this.bones[k].returnToPool(); - delete this.bones[k]; - } - for (var k in this.slots) { - this.slots[k].returnToPool(); - delete this.slots[k]; - } - for (var k in this.constraints) { - this.constraints[k].returnToPool(); - delete this.constraints[k]; - } - for (var k in this.skins) { - this.skins[k].returnToPool(); - delete this.skins[k]; - } - for (var k in this.animations) { - this.animations[k].returnToPool(); - delete this.animations[k]; - } - if (this.canvas !== null) { - this.canvas.returnToPool(); - } - if (this.userData !== null) { - this.userData.returnToPool(); - } - this.type = 0 /* Armature */; - this.frameRate = 0; - this.cacheFrameRate = 0; - this.scale = 1.0; - this.name = ''; - this.aabb.clear(); - this.animationNames.length = 0; - this.sortedBones.length = 0; - this.sortedSlots.length = 0; - this.defaultActions.length = 0; - this.actions.length = 0; - // this.bones.clear(); - // this.slots.clear(); - // this.constraints.clear(); - // this.skins.clear(); - // this.animations.clear(); - this.defaultSkin = null; - this.defaultAnimation = null; - this.canvas = null; - this.userData = null; - this.parent = null; // - }; - /** - * @internal - */ - ArmatureData.prototype.sortBones = function() { - var total = this.sortedBones.length; - if (total <= 0) { - return; - } - var sortHelper = this.sortedBones.concat(); - var index = 0; - var count = 0; - this.sortedBones.length = 0; - while (count < total) { - var bone = sortHelper[index++]; - if (index >= total) { - index = 0; - } - if (this.sortedBones.indexOf(bone) >= 0) { - continue; - } - var flag = false; - for (var k in this.constraints) { - var constraint = this.constraints[k]; - if ( - constraint.root === bone && - this.sortedBones.indexOf(constraint.target) < 0 - ) { - flag = true; - break; - } - } - if (flag) { - continue; - } - if (bone.parent !== null && this.sortedBones.indexOf(bone.parent) < 0) { - continue; - } - this.sortedBones.push(bone); - count++; - } - }; - /** - * @internal - */ - ArmatureData.prototype.cacheFrames = function(frameRate) { - if (this.cacheFrameRate > 0) { - return; - } - this.cacheFrameRate = frameRate; - for (var k in this.animations) { - this.animations[k].cacheFrames(this.cacheFrameRate); - } - }; - /** - * @internal - */ - ArmatureData.prototype.setCacheFrame = function( - globalTransformMatrix, - transform, - ) { - var dataArray = this.parent.cachedFrames; - var arrayOffset = dataArray.length; - dataArray.length += 10; - dataArray[arrayOffset] = globalTransformMatrix.a; - dataArray[arrayOffset + 1] = globalTransformMatrix.b; - dataArray[arrayOffset + 2] = globalTransformMatrix.c; - dataArray[arrayOffset + 3] = globalTransformMatrix.d; - dataArray[arrayOffset + 4] = globalTransformMatrix.tx; - dataArray[arrayOffset + 5] = globalTransformMatrix.ty; - dataArray[arrayOffset + 6] = transform.rotation; - dataArray[arrayOffset + 7] = transform.skew; - dataArray[arrayOffset + 8] = transform.scaleX; - dataArray[arrayOffset + 9] = transform.scaleY; - return arrayOffset; - }; - /** - * @internal - */ - ArmatureData.prototype.getCacheFrame = function( - globalTransformMatrix, - transform, - arrayOffset, - ) { - var dataArray = this.parent.cachedFrames; - globalTransformMatrix.a = dataArray[arrayOffset]; - globalTransformMatrix.b = dataArray[arrayOffset + 1]; - globalTransformMatrix.c = dataArray[arrayOffset + 2]; - globalTransformMatrix.d = dataArray[arrayOffset + 3]; - globalTransformMatrix.tx = dataArray[arrayOffset + 4]; - globalTransformMatrix.ty = dataArray[arrayOffset + 5]; - transform.rotation = dataArray[arrayOffset + 6]; - transform.skew = dataArray[arrayOffset + 7]; - transform.scaleX = dataArray[arrayOffset + 8]; - transform.scaleY = dataArray[arrayOffset + 9]; - transform.x = globalTransformMatrix.tx; - transform.y = globalTransformMatrix.ty; - }; - /** - * @internal - */ - ArmatureData.prototype.addBone = function(value) { - if (value.name in this.bones) { - console.warn('Same bone: ' + value.name); - return; - } - this.bones[value.name] = value; - this.sortedBones.push(value); - }; - /** - * @internal - */ - ArmatureData.prototype.addSlot = function(value) { - if (value.name in this.slots) { - console.warn('Same slot: ' + value.name); - return; - } - this.slots[value.name] = value; - this.sortedSlots.push(value); - }; - /** - * @internal - */ - ArmatureData.prototype.addConstraint = function(value) { - if (value.name in this.constraints) { - console.warn('Same constraint: ' + value.name); - return; - } - this.constraints[value.name] = value; - }; - /** - * @internal - */ - ArmatureData.prototype.addSkin = function(value) { - if (value.name in this.skins) { - console.warn('Same skin: ' + value.name); - return; - } - value.parent = this; - this.skins[value.name] = value; - if (this.defaultSkin === null) { - this.defaultSkin = value; - } - if (value.name === 'default') { - this.defaultSkin = value; - } - }; - /** - * @internal - */ - ArmatureData.prototype.addAnimation = function(value) { - if (value.name in this.animations) { - console.warn('Same animation: ' + value.name); - return; - } - value.parent = this; - this.animations[value.name] = value; - this.animationNames.push(value.name); - if (this.defaultAnimation === null) { - this.defaultAnimation = value; - } - }; - /** - * @internal - */ - ArmatureData.prototype.addAction = function(value, isDefault) { - if (isDefault) { - this.defaultActions.push(value); - } else { - this.actions.push(value); - } - }; - /** - * - Get a specific done data. - * @param boneName - The bone name. - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 获取特定的骨骼数据。 - * @param boneName - 骨骼名称。 - * @version DragonBones 3.0 - * @language zh_CN - */ - ArmatureData.prototype.getBone = function(boneName) { - return boneName in this.bones ? this.bones[boneName] : null; - }; - /** - * - Get a specific slot data. - * @param slotName - The slot name. - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 获取特定的插槽数据。 - * @param slotName - 插槽名称。 - * @version DragonBones 3.0 - * @language zh_CN - */ - ArmatureData.prototype.getSlot = function(slotName) { - return slotName in this.slots ? this.slots[slotName] : null; - }; - /** - * @private - */ - ArmatureData.prototype.getConstraint = function(constraintName) { - return constraintName in this.constraints - ? this.constraints[constraintName] - : null; - }; - /** - * - Get a specific skin data. - * @param skinName - The skin name. - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 获取特定皮肤数据。 - * @param skinName - 皮肤名称。 - * @version DragonBones 3.0 - * @language zh_CN - */ - ArmatureData.prototype.getSkin = function(skinName) { - return skinName in this.skins ? this.skins[skinName] : null; - }; - /** - * @private - */ - ArmatureData.prototype.getMesh = function(skinName, slotName, meshName) { - var skin = this.getSkin(skinName); - if (skin === null) { - return null; - } - return skin.getDisplay(slotName, meshName); - }; - /** - * - Get a specific animation data. - * @param animationName - The animation animationName. - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 获取特定的动画数据。 - * @param animationName - 动画名称。 - * @version DragonBones 3.0 - * @language zh_CN - */ - ArmatureData.prototype.getAnimation = function(animationName) { - return animationName in this.animations - ? this.animations[animationName] - : null; - }; - return ArmatureData; - })(dragonBones.BaseObject); - dragonBones.ArmatureData = ArmatureData; - /** - * - The bone data. - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 骨骼数据。 - * @version DragonBones 3.0 - * @language zh_CN - */ - var BoneData = /** @class */ (function(_super) { - __extends(BoneData, _super); - function BoneData() { - var _this = (_super !== null && _super.apply(this, arguments)) || this; - /** - * @private - */ - _this.transform = new dragonBones.Transform(); - /** - * @private - */ - _this.userData = null; // Initial value. - return _this; - } - BoneData.toString = function() { - return '[class dragonBones.BoneData]'; - }; - BoneData.prototype._onClear = function() { - if (this.userData !== null) { - this.userData.returnToPool(); - } - this.inheritTranslation = false; - this.inheritRotation = false; - this.inheritScale = false; - this.inheritReflection = false; - this.type = 0 /* Bone */; - this.length = 0.0; - this.alpha = 1.0; - this.name = ''; - this.transform.identity(); - this.userData = null; - this.parent = null; - }; - return BoneData; - })(dragonBones.BaseObject); - dragonBones.BoneData = BoneData; - /** - * @internal - */ - var SurfaceData = /** @class */ (function(_super) { - __extends(SurfaceData, _super); - function SurfaceData() { - var _this = (_super !== null && _super.apply(this, arguments)) || this; - _this.geometry = new dragonBones.GeometryData(); - return _this; - } - SurfaceData.toString = function() { - return '[class dragonBones.SurfaceData]'; - }; - SurfaceData.prototype._onClear = function() { - _super.prototype._onClear.call(this); - this.type = 1 /* Surface */; - this.segmentX = 0; - this.segmentY = 0; - this.geometry.clear(); - }; - return SurfaceData; - })(BoneData); - dragonBones.SurfaceData = SurfaceData; - /** - * - The slot data. - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 插槽数据。 - * @version DragonBones 3.0 - * @language zh_CN - */ - var SlotData = /** @class */ (function(_super) { - __extends(SlotData, _super); - function SlotData() { - var _this = (_super !== null && _super.apply(this, arguments)) || this; - /** - * @private - */ - _this.color = null; // Initial value. - /** - * @private - */ - _this.userData = null; // Initial value. - return _this; - } - /** - * @internal - */ - SlotData.createColor = function() { - return new dragonBones.ColorTransform(); - }; - SlotData.toString = function() { - return '[class dragonBones.SlotData]'; - }; - SlotData.prototype._onClear = function() { - if (this.userData !== null) { - this.userData.returnToPool(); - } - this.blendMode = 0 /* Normal */; - this.displayIndex = 0; - this.zOrder = 0; - this.zIndex = 0; - this.alpha = 1.0; - this.name = ''; - this.color = null; // - this.userData = null; - this.parent = null; // - }; - /** - * @internal - */ - SlotData.DEFAULT_COLOR = new dragonBones.ColorTransform(); - return SlotData; - })(dragonBones.BaseObject); - dragonBones.SlotData = SlotData; - })(dragonBones || (dragonBones = {})); - /** - * The MIT License (MIT) - * - * Copyright (c) 2012-2018 DragonBones team and other contributors - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of - * the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR - * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - (function(dragonBones) { - /** - * @private - */ - var ConstraintData = /** @class */ (function(_super) { - __extends(ConstraintData, _super); - function ConstraintData() { - return (_super !== null && _super.apply(this, arguments)) || this; - } - ConstraintData.prototype._onClear = function() { - this.order = 0; - this.name = ''; - this.type = 0 /* IK */; - this.target = null; // - this.root = null; // - this.bone = null; - }; - return ConstraintData; - })(dragonBones.BaseObject); - dragonBones.ConstraintData = ConstraintData; - /** - * @internal - */ - var IKConstraintData = /** @class */ (function(_super) { - __extends(IKConstraintData, _super); - function IKConstraintData() { - return (_super !== null && _super.apply(this, arguments)) || this; - } - IKConstraintData.toString = function() { - return '[class dragonBones.IKConstraintData]'; - }; - IKConstraintData.prototype._onClear = function() { - _super.prototype._onClear.call(this); - this.scaleEnabled = false; - this.bendPositive = false; - this.weight = 1.0; - }; - return IKConstraintData; - })(ConstraintData); - dragonBones.IKConstraintData = IKConstraintData; - /** - * @internal - */ - var PathConstraintData = /** @class */ (function(_super) { - __extends(PathConstraintData, _super); - function PathConstraintData() { - var _this = (_super !== null && _super.apply(this, arguments)) || this; - _this.bones = []; - return _this; - } - PathConstraintData.toString = function() { - return '[class dragonBones.PathConstraintData]'; - }; - PathConstraintData.prototype._onClear = function() { - _super.prototype._onClear.call(this); - this.pathSlot = null; - this.pathDisplayData = null; - this.bones.length = 0; - this.positionMode = 0 /* Fixed */; - this.spacingMode = 1 /* Fixed */; - this.rotateMode = 1 /* Chain */; - this.position = 0.0; - this.spacing = 0.0; - this.rotateOffset = 0.0; - this.rotateMix = 0.0; - this.translateMix = 0.0; - }; - PathConstraintData.prototype.AddBone = function(value) { - this.bones.push(value); - }; - return PathConstraintData; - })(ConstraintData); - dragonBones.PathConstraintData = PathConstraintData; - })(dragonBones || (dragonBones = {})); - /** - * The MIT License (MIT) - * - * Copyright (c) 2012-2018 DragonBones team and other contributors - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of - * the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR - * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - (function(dragonBones) { - /** - * @private - */ - var CanvasData = /** @class */ (function(_super) { - __extends(CanvasData, _super); - function CanvasData() { - return (_super !== null && _super.apply(this, arguments)) || this; - } - CanvasData.toString = function() { - return '[class dragonBones.CanvasData]'; - }; - CanvasData.prototype._onClear = function() { - this.hasBackground = false; - this.color = 0x000000; - this.x = 0; - this.y = 0; - this.width = 0; - this.height = 0; - }; - return CanvasData; - })(dragonBones.BaseObject); - dragonBones.CanvasData = CanvasData; - })(dragonBones || (dragonBones = {})); - /** - * The MIT License (MIT) - * - * Copyright (c) 2012-2018 DragonBones team and other contributors - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of - * the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR - * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - (function(dragonBones) { - /** - * - The skin data, typically a armature data instance contains at least one skinData. - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 皮肤数据,通常一个骨架数据至少包含一个皮肤数据。 - * @version DragonBones 3.0 - * @language zh_CN - */ - var SkinData = /** @class */ (function(_super) { - __extends(SkinData, _super); - function SkinData() { - var _this = (_super !== null && _super.apply(this, arguments)) || this; - /** - * @private - */ - _this.displays = {}; - return _this; - } - SkinData.toString = function() { - return '[class dragonBones.SkinData]'; - }; - SkinData.prototype._onClear = function() { - for (var k in this.displays) { - var slotDisplays = this.displays[k]; - for ( - var _i = 0, slotDisplays_1 = slotDisplays; - _i < slotDisplays_1.length; - _i++ - ) { - var display = slotDisplays_1[_i]; - if (display !== null) { - display.returnToPool(); - } - } - delete this.displays[k]; - } - this.name = ''; - // this.displays.clear(); - this.parent = null; // - }; - /** - * @internal - */ - SkinData.prototype.addDisplay = function(slotName, value) { - if (!(slotName in this.displays)) { - this.displays[slotName] = []; - } - if (value !== null) { - value.parent = this; - } - var slotDisplays = this.displays[slotName]; // TODO clear prev - slotDisplays.push(value); - }; - /** - * @private - */ - SkinData.prototype.getDisplay = function(slotName, displayName) { - var slotDisplays = this.getDisplays(slotName); - if (slotDisplays !== null) { - for ( - var _i = 0, slotDisplays_2 = slotDisplays; - _i < slotDisplays_2.length; - _i++ - ) { - var display = slotDisplays_2[_i]; - if (display !== null && display.name === displayName) { - return display; - } - } - } - return null; - }; - /** - * @private - */ - SkinData.prototype.getDisplays = function(slotName) { - if (!(slotName in this.displays)) { - return null; - } - return this.displays[slotName]; - }; - return SkinData; - })(dragonBones.BaseObject); - dragonBones.SkinData = SkinData; - })(dragonBones || (dragonBones = {})); - /** - * The MIT License (MIT) - * - * Copyright (c) 2012-2018 DragonBones team and other contributors - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of - * the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR - * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - (function(dragonBones) { - /** - * @private - */ - var GeometryData = /** @class */ (function() { - function GeometryData() { - this.weight = null; // Initial value. - } - GeometryData.prototype.clear = function() { - if (!this.isShared && this.weight !== null) { - this.weight.returnToPool(); - } - this.isShared = false; - this.inheritDeform = false; - this.offset = 0; - this.data = null; - this.weight = null; - }; - GeometryData.prototype.shareFrom = function(value) { - this.isShared = true; - this.offset = value.offset; - this.weight = value.weight; - }; - Object.defineProperty(GeometryData.prototype, 'vertexCount', { - get: function() { - var intArray = this.data.intArray; - return intArray[this.offset + 0 /* GeometryVertexCount */]; - }, - enumerable: true, - configurable: true, - }); - Object.defineProperty(GeometryData.prototype, 'triangleCount', { - get: function() { - var intArray = this.data.intArray; - return intArray[this.offset + 1 /* GeometryTriangleCount */]; - }, - enumerable: true, - configurable: true, - }); - return GeometryData; - })(); - dragonBones.GeometryData = GeometryData; - /** - * @private - */ - var DisplayData = /** @class */ (function(_super) { - __extends(DisplayData, _super); - function DisplayData() { - var _this = (_super !== null && _super.apply(this, arguments)) || this; - _this.transform = new dragonBones.Transform(); - return _this; - } - DisplayData.prototype._onClear = function() { - this.name = ''; - this.path = ''; - this.transform.identity(); - this.parent = null; // - }; - return DisplayData; - })(dragonBones.BaseObject); - dragonBones.DisplayData = DisplayData; - /** - * @private - */ - var ImageDisplayData = /** @class */ (function(_super) { - __extends(ImageDisplayData, _super); - function ImageDisplayData() { - var _this = (_super !== null && _super.apply(this, arguments)) || this; - _this.pivot = new dragonBones.Point(); - return _this; - } - ImageDisplayData.toString = function() { - return '[class dragonBones.ImageDisplayData]'; - }; - ImageDisplayData.prototype._onClear = function() { - _super.prototype._onClear.call(this); - this.type = 0 /* Image */; - this.pivot.clear(); - this.texture = null; - }; - return ImageDisplayData; - })(DisplayData); - dragonBones.ImageDisplayData = ImageDisplayData; - /** - * @private - */ - var ArmatureDisplayData = /** @class */ (function(_super) { - __extends(ArmatureDisplayData, _super); - function ArmatureDisplayData() { - var _this = (_super !== null && _super.apply(this, arguments)) || this; - _this.actions = []; - return _this; - } - ArmatureDisplayData.toString = function() { - return '[class dragonBones.ArmatureDisplayData]'; - }; - ArmatureDisplayData.prototype._onClear = function() { - _super.prototype._onClear.call(this); - for (var _i = 0, _a = this.actions; _i < _a.length; _i++) { - var action = _a[_i]; - action.returnToPool(); - } - this.type = 1 /* Armature */; - this.inheritAnimation = false; - this.actions.length = 0; - this.armature = null; - }; - /** - * @private - */ - ArmatureDisplayData.prototype.addAction = function(value) { - this.actions.push(value); - }; - return ArmatureDisplayData; - })(DisplayData); - dragonBones.ArmatureDisplayData = ArmatureDisplayData; - /** - * @private - */ - var MeshDisplayData = /** @class */ (function(_super) { - __extends(MeshDisplayData, _super); - function MeshDisplayData() { - var _this = (_super !== null && _super.apply(this, arguments)) || this; - _this.geometry = new GeometryData(); - return _this; - } - MeshDisplayData.toString = function() { - return '[class dragonBones.MeshDisplayData]'; - }; - MeshDisplayData.prototype._onClear = function() { - _super.prototype._onClear.call(this); - this.type = 2 /* Mesh */; - this.geometry.clear(); - this.texture = null; - }; - return MeshDisplayData; - })(DisplayData); - dragonBones.MeshDisplayData = MeshDisplayData; - /** - * @private - */ - var BoundingBoxDisplayData = /** @class */ (function(_super) { - __extends(BoundingBoxDisplayData, _super); - function BoundingBoxDisplayData() { - var _this = (_super !== null && _super.apply(this, arguments)) || this; - _this.boundingBox = null; // Initial value. - return _this; - } - BoundingBoxDisplayData.toString = function() { - return '[class dragonBones.BoundingBoxDisplayData]'; - }; - BoundingBoxDisplayData.prototype._onClear = function() { - _super.prototype._onClear.call(this); - if (this.boundingBox !== null) { - this.boundingBox.returnToPool(); - } - this.type = 3 /* BoundingBox */; - this.boundingBox = null; - }; - return BoundingBoxDisplayData; - })(DisplayData); - dragonBones.BoundingBoxDisplayData = BoundingBoxDisplayData; - /** - * @private - */ - var PathDisplayData = /** @class */ (function(_super) { - __extends(PathDisplayData, _super); - function PathDisplayData() { - var _this = (_super !== null && _super.apply(this, arguments)) || this; - _this.geometry = new GeometryData(); - _this.curveLengths = []; - return _this; - } - PathDisplayData.toString = function() { - return '[class dragonBones.PathDisplayData]'; - }; - PathDisplayData.prototype._onClear = function() { - _super.prototype._onClear.call(this); - this.type = 4 /* Path */; - this.closed = false; - this.constantSpeed = false; - this.geometry.clear(); - this.curveLengths.length = 0; - }; - return PathDisplayData; - })(DisplayData); - dragonBones.PathDisplayData = PathDisplayData; - /** - * @private - */ - var WeightData = /** @class */ (function(_super) { - __extends(WeightData, _super); - function WeightData() { - var _this = (_super !== null && _super.apply(this, arguments)) || this; - _this.bones = []; - return _this; - } - WeightData.toString = function() { - return '[class dragonBones.WeightData]'; - }; - WeightData.prototype._onClear = function() { - this.count = 0; - this.offset = 0; - this.bones.length = 0; - }; - WeightData.prototype.addBone = function(value) { - this.bones.push(value); - }; - return WeightData; - })(dragonBones.BaseObject); - dragonBones.WeightData = WeightData; - })(dragonBones || (dragonBones = {})); - /** - * The MIT License (MIT) - * - * Copyright (c) 2012-2018 DragonBones team and other contributors - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of - * the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR - * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - (function(dragonBones) { - /** - * - The base class of bounding box data. - * @see dragonBones.RectangleData - * @see dragonBones.EllipseData - * @see dragonBones.PolygonData - * @version DragonBones 5.0 - * @language en_US - */ - /** - * - 边界框数据基类。 - * @see dragonBones.RectangleData - * @see dragonBones.EllipseData - * @see dragonBones.PolygonData - * @version DragonBones 5.0 - * @language zh_CN - */ - var BoundingBoxData = /** @class */ (function(_super) { - __extends(BoundingBoxData, _super); - function BoundingBoxData() { - return (_super !== null && _super.apply(this, arguments)) || this; - } - BoundingBoxData.prototype._onClear = function() { - this.color = 0x000000; - this.width = 0.0; - this.height = 0.0; - }; - return BoundingBoxData; - })(dragonBones.BaseObject); - dragonBones.BoundingBoxData = BoundingBoxData; - /** - * - The rectangle bounding box data. - * @version DragonBones 5.1 - * @language en_US - */ - /** - * - 矩形边界框数据。 - * @version DragonBones 5.1 - * @language zh_CN - */ - var RectangleBoundingBoxData = /** @class */ (function(_super) { - __extends(RectangleBoundingBoxData, _super); - function RectangleBoundingBoxData() { - return (_super !== null && _super.apply(this, arguments)) || this; - } - RectangleBoundingBoxData.toString = function() { - return '[class dragonBones.RectangleBoundingBoxData]'; - }; - /** - * - Compute the bit code for a point (x, y) using the clip rectangle - */ - RectangleBoundingBoxData._computeOutCode = function( - x, - y, - xMin, - yMin, - xMax, - yMax, - ) { - var code = 0; /* InSide */ // initialised as being inside of [[clip window]] - if (x < xMin) { - code |= 1 /* Left */; - } else if (x > xMax) { - code |= 2 /* Right */; - } - if (y < yMin) { - code |= 4 /* Top */; - } else if (y > yMax) { - code |= 8 /* Bottom */; - } - return code; - }; - /** - * @private - */ - RectangleBoundingBoxData.rectangleIntersectsSegment = function( - xA, - yA, - xB, - yB, - xMin, - yMin, - xMax, - yMax, - intersectionPointA, - intersectionPointB, - normalRadians, - ) { - if (intersectionPointA === void 0) { - intersectionPointA = null; - } - if (intersectionPointB === void 0) { - intersectionPointB = null; - } - if (normalRadians === void 0) { - normalRadians = null; - } - var inSideA = xA > xMin && xA < xMax && yA > yMin && yA < yMax; - var inSideB = xB > xMin && xB < xMax && yB > yMin && yB < yMax; - if (inSideA && inSideB) { - return -1; - } - var intersectionCount = 0; - var outcode0 = RectangleBoundingBoxData._computeOutCode( - xA, - yA, - xMin, - yMin, - xMax, - yMax, - ); - var outcode1 = RectangleBoundingBoxData._computeOutCode( - xB, - yB, - xMin, - yMin, - xMax, - yMax, - ); - while (true) { - if ((outcode0 | outcode1) === 0) { - intersectionCount = 2; - break; - } else if ((outcode0 & outcode1) !== 0) { - break; - } - // failed both tests, so calculate the line segment to clip - // from an outside point to an intersection with clip edge - var x = 0.0; - var y = 0.0; - var normalRadian = 0.0; - // At least one endpoint is outside the clip rectangle; pick it. - var outcodeOut = outcode0 !== 0 ? outcode0 : outcode1; - // Now find the intersection point; - if ((outcodeOut & 4) /* Top */ !== 0) { - x = xA + ((xB - xA) * (yMin - yA)) / (yB - yA); - y = yMin; - if (normalRadians !== null) { - normalRadian = -Math.PI * 0.5; - } - } else if ((outcodeOut & 8) /* Bottom */ !== 0) { - x = xA + ((xB - xA) * (yMax - yA)) / (yB - yA); - y = yMax; - if (normalRadians !== null) { - normalRadian = Math.PI * 0.5; - } - } else if ((outcodeOut & 2) /* Right */ !== 0) { - y = yA + ((yB - yA) * (xMax - xA)) / (xB - xA); - x = xMax; - if (normalRadians !== null) { - normalRadian = 0; - } - } else if ((outcodeOut & 1) /* Left */ !== 0) { - y = yA + ((yB - yA) * (xMin - xA)) / (xB - xA); - x = xMin; - if (normalRadians !== null) { - normalRadian = Math.PI; - } - } - // Now we move outside point to intersection point to clip - // and get ready for next pass. - if (outcodeOut === outcode0) { - xA = x; - yA = y; - outcode0 = RectangleBoundingBoxData._computeOutCode( - xA, - yA, - xMin, - yMin, - xMax, - yMax, - ); - if (normalRadians !== null) { - normalRadians.x = normalRadian; - } - } else { - xB = x; - yB = y; - outcode1 = RectangleBoundingBoxData._computeOutCode( - xB, - yB, - xMin, - yMin, - xMax, - yMax, - ); - if (normalRadians !== null) { - normalRadians.y = normalRadian; - } - } - } - if (intersectionCount) { - if (inSideA) { - intersectionCount = 2; // 10 - if (intersectionPointA !== null) { - intersectionPointA.x = xB; - intersectionPointA.y = yB; - } - if (intersectionPointB !== null) { - intersectionPointB.x = xB; - intersectionPointB.y = xB; - } - if (normalRadians !== null) { - normalRadians.x = normalRadians.y + Math.PI; - } - } else if (inSideB) { - intersectionCount = 1; // 01 - if (intersectionPointA !== null) { - intersectionPointA.x = xA; - intersectionPointA.y = yA; - } - if (intersectionPointB !== null) { - intersectionPointB.x = xA; - intersectionPointB.y = yA; - } - if (normalRadians !== null) { - normalRadians.y = normalRadians.x + Math.PI; - } - } else { - intersectionCount = 3; // 11 - if (intersectionPointA !== null) { - intersectionPointA.x = xA; - intersectionPointA.y = yA; - } - if (intersectionPointB !== null) { - intersectionPointB.x = xB; - intersectionPointB.y = yB; - } - } - } - return intersectionCount; - }; - RectangleBoundingBoxData.prototype._onClear = function() { - _super.prototype._onClear.call(this); - this.type = 0 /* Rectangle */; - }; - /** - * @inheritDoc - */ - RectangleBoundingBoxData.prototype.containsPoint = function(pX, pY) { - var widthH = this.width * 0.5; - if (pX >= -widthH && pX <= widthH) { - var heightH = this.height * 0.5; - if (pY >= -heightH && pY <= heightH) { - return true; - } - } - return false; - }; - /** - * @inheritDoc - */ - RectangleBoundingBoxData.prototype.intersectsSegment = function( - xA, - yA, - xB, - yB, - intersectionPointA, - intersectionPointB, - normalRadians, - ) { - if (intersectionPointA === void 0) { - intersectionPointA = null; - } - if (intersectionPointB === void 0) { - intersectionPointB = null; - } - if (normalRadians === void 0) { - normalRadians = null; - } - var widthH = this.width * 0.5; - var heightH = this.height * 0.5; - var intersectionCount = RectangleBoundingBoxData.rectangleIntersectsSegment( - xA, - yA, - xB, - yB, - -widthH, - -heightH, - widthH, - heightH, - intersectionPointA, - intersectionPointB, - normalRadians, - ); - return intersectionCount; - }; - return RectangleBoundingBoxData; - })(BoundingBoxData); - dragonBones.RectangleBoundingBoxData = RectangleBoundingBoxData; - /** - * - The ellipse bounding box data. - * @version DragonBones 5.1 - * @language en_US - */ - /** - * - 椭圆边界框数据。 - * @version DragonBones 5.1 - * @language zh_CN - */ - var EllipseBoundingBoxData = /** @class */ (function(_super) { - __extends(EllipseBoundingBoxData, _super); - function EllipseBoundingBoxData() { - return (_super !== null && _super.apply(this, arguments)) || this; - } - EllipseBoundingBoxData.toString = function() { - return '[class dragonBones.EllipseData]'; - }; - /** - * @private - */ - EllipseBoundingBoxData.ellipseIntersectsSegment = function( - xA, - yA, - xB, - yB, - xC, - yC, - widthH, - heightH, - intersectionPointA, - intersectionPointB, - normalRadians, - ) { - if (intersectionPointA === void 0) { - intersectionPointA = null; - } - if (intersectionPointB === void 0) { - intersectionPointB = null; - } - if (normalRadians === void 0) { - normalRadians = null; - } - var d = widthH / heightH; - var dd = d * d; - yA *= d; - yB *= d; - var dX = xB - xA; - var dY = yB - yA; - var lAB = Math.sqrt(dX * dX + dY * dY); - var xD = dX / lAB; - var yD = dY / lAB; - var a = (xC - xA) * xD + (yC - yA) * yD; - var aa = a * a; - var ee = xA * xA + yA * yA; - var rr = widthH * widthH; - var dR = rr - ee + aa; - var intersectionCount = 0; - if (dR >= 0.0) { - var dT = Math.sqrt(dR); - var sA = a - dT; - var sB = a + dT; - var inSideA = sA < 0.0 ? -1 : sA <= lAB ? 0 : 1; - var inSideB = sB < 0.0 ? -1 : sB <= lAB ? 0 : 1; - var sideAB = inSideA * inSideB; - if (sideAB < 0) { - return -1; - } else if (sideAB === 0) { - if (inSideA === -1) { - intersectionCount = 2; // 10 - xB = xA + sB * xD; - yB = (yA + sB * yD) / d; - if (intersectionPointA !== null) { - intersectionPointA.x = xB; - intersectionPointA.y = yB; - } - if (intersectionPointB !== null) { - intersectionPointB.x = xB; - intersectionPointB.y = yB; - } - if (normalRadians !== null) { - normalRadians.x = Math.atan2((yB / rr) * dd, xB / rr); - normalRadians.y = normalRadians.x + Math.PI; - } - } else if (inSideB === 1) { - intersectionCount = 1; // 01 - xA = xA + sA * xD; - yA = (yA + sA * yD) / d; - if (intersectionPointA !== null) { - intersectionPointA.x = xA; - intersectionPointA.y = yA; - } - if (intersectionPointB !== null) { - intersectionPointB.x = xA; - intersectionPointB.y = yA; - } - if (normalRadians !== null) { - normalRadians.x = Math.atan2((yA / rr) * dd, xA / rr); - normalRadians.y = normalRadians.x + Math.PI; - } - } else { - intersectionCount = 3; // 11 - if (intersectionPointA !== null) { - intersectionPointA.x = xA + sA * xD; - intersectionPointA.y = (yA + sA * yD) / d; - if (normalRadians !== null) { - normalRadians.x = Math.atan2( - (intersectionPointA.y / rr) * dd, - intersectionPointA.x / rr, - ); - } - } - if (intersectionPointB !== null) { - intersectionPointB.x = xA + sB * xD; - intersectionPointB.y = (yA + sB * yD) / d; - if (normalRadians !== null) { - normalRadians.y = Math.atan2( - (intersectionPointB.y / rr) * dd, - intersectionPointB.x / rr, - ); - } - } - } - } - } - return intersectionCount; - }; - EllipseBoundingBoxData.prototype._onClear = function() { - _super.prototype._onClear.call(this); - this.type = 1 /* Ellipse */; - }; - /** - * @inheritDoc - */ - EllipseBoundingBoxData.prototype.containsPoint = function(pX, pY) { - var widthH = this.width * 0.5; - if (pX >= -widthH && pX <= widthH) { - var heightH = this.height * 0.5; - if (pY >= -heightH && pY <= heightH) { - pY *= widthH / heightH; - return Math.sqrt(pX * pX + pY * pY) <= widthH; - } - } - return false; - }; - /** - * @inheritDoc - */ - EllipseBoundingBoxData.prototype.intersectsSegment = function( - xA, - yA, - xB, - yB, - intersectionPointA, - intersectionPointB, - normalRadians, - ) { - if (intersectionPointA === void 0) { - intersectionPointA = null; - } - if (intersectionPointB === void 0) { - intersectionPointB = null; - } - if (normalRadians === void 0) { - normalRadians = null; - } - var intersectionCount = EllipseBoundingBoxData.ellipseIntersectsSegment( - xA, - yA, - xB, - yB, - 0.0, - 0.0, - this.width * 0.5, - this.height * 0.5, - intersectionPointA, - intersectionPointB, - normalRadians, - ); - return intersectionCount; - }; - return EllipseBoundingBoxData; - })(BoundingBoxData); - dragonBones.EllipseBoundingBoxData = EllipseBoundingBoxData; - /** - * - The polygon bounding box data. - * @version DragonBones 5.1 - * @language en_US - */ - /** - * - 多边形边界框数据。 - * @version DragonBones 5.1 - * @language zh_CN - */ - var PolygonBoundingBoxData = /** @class */ (function(_super) { - __extends(PolygonBoundingBoxData, _super); - function PolygonBoundingBoxData() { - var _this = (_super !== null && _super.apply(this, arguments)) || this; - /** - * - The polygon vertices. - * @version DragonBones 5.1 - * @language en_US - */ - /** - * - 多边形顶点。 - * @version DragonBones 5.1 - * @language zh_CN - */ - _this.vertices = []; - return _this; - } - PolygonBoundingBoxData.toString = function() { - return '[class dragonBones.PolygonBoundingBoxData]'; - }; - /** - * @private - */ - PolygonBoundingBoxData.polygonIntersectsSegment = function( - xA, - yA, - xB, - yB, - vertices, - intersectionPointA, - intersectionPointB, - normalRadians, - ) { - if (intersectionPointA === void 0) { - intersectionPointA = null; - } - if (intersectionPointB === void 0) { - intersectionPointB = null; - } - if (normalRadians === void 0) { - normalRadians = null; - } - if (xA === xB) { - xA = xB + 0.000001; - } - if (yA === yB) { - yA = yB + 0.000001; - } - var count = vertices.length; - var dXAB = xA - xB; - var dYAB = yA - yB; - var llAB = xA * yB - yA * xB; - var intersectionCount = 0; - var xC = vertices[count - 2]; - var yC = vertices[count - 1]; - var dMin = 0.0; - var dMax = 0.0; - var xMin = 0.0; - var yMin = 0.0; - var xMax = 0.0; - var yMax = 0.0; - for (var i = 0; i < count; i += 2) { - var xD = vertices[i]; - var yD = vertices[i + 1]; - if (xC === xD) { - xC = xD + 0.0001; - } - if (yC === yD) { - yC = yD + 0.0001; - } - var dXCD = xC - xD; - var dYCD = yC - yD; - var llCD = xC * yD - yC * xD; - var ll = dXAB * dYCD - dYAB * dXCD; - var x = (llAB * dXCD - dXAB * llCD) / ll; - if ( - ((x >= xC && x <= xD) || (x >= xD && x <= xC)) && - (dXAB === 0.0 || (x >= xA && x <= xB) || (x >= xB && x <= xA)) - ) { - var y = (llAB * dYCD - dYAB * llCD) / ll; - if ( - ((y >= yC && y <= yD) || (y >= yD && y <= yC)) && - (dYAB === 0.0 || (y >= yA && y <= yB) || (y >= yB && y <= yA)) - ) { - if (intersectionPointB !== null) { - var d = x - xA; - if (d < 0.0) { - d = -d; - } - if (intersectionCount === 0) { - dMin = d; - dMax = d; - xMin = x; - yMin = y; - xMax = x; - yMax = y; - if (normalRadians !== null) { - normalRadians.x = - Math.atan2(yD - yC, xD - xC) - Math.PI * 0.5; - normalRadians.y = normalRadians.x; - } - } else { - if (d < dMin) { - dMin = d; - xMin = x; - yMin = y; - if (normalRadians !== null) { - normalRadians.x = - Math.atan2(yD - yC, xD - xC) - Math.PI * 0.5; - } - } - if (d > dMax) { - dMax = d; - xMax = x; - yMax = y; - if (normalRadians !== null) { - normalRadians.y = - Math.atan2(yD - yC, xD - xC) - Math.PI * 0.5; - } - } - } - intersectionCount++; - } else { - xMin = x; - yMin = y; - xMax = x; - yMax = y; - intersectionCount++; - if (normalRadians !== null) { - normalRadians.x = Math.atan2(yD - yC, xD - xC) - Math.PI * 0.5; - normalRadians.y = normalRadians.x; - } - break; - } - } - } - xC = xD; - yC = yD; - } - if (intersectionCount === 1) { - if (intersectionPointA !== null) { - intersectionPointA.x = xMin; - intersectionPointA.y = yMin; - } - if (intersectionPointB !== null) { - intersectionPointB.x = xMin; - intersectionPointB.y = yMin; - } - if (normalRadians !== null) { - normalRadians.y = normalRadians.x + Math.PI; - } - } else if (intersectionCount > 1) { - intersectionCount++; - if (intersectionPointA !== null) { - intersectionPointA.x = xMin; - intersectionPointA.y = yMin; - } - if (intersectionPointB !== null) { - intersectionPointB.x = xMax; - intersectionPointB.y = yMax; - } - } - return intersectionCount; - }; - PolygonBoundingBoxData.prototype._onClear = function() { - _super.prototype._onClear.call(this); - this.type = 2 /* Polygon */; - this.x = 0.0; - this.y = 0.0; - this.vertices.length = 0; - }; - /** - * @inheritDoc - */ - PolygonBoundingBoxData.prototype.containsPoint = function(pX, pY) { - var isInSide = false; - if ( - pX >= this.x && - pX <= this.width && - pY >= this.y && - pY <= this.height - ) { - for (var i = 0, l = this.vertices.length, iP = l - 2; i < l; i += 2) { - var yA = this.vertices[iP + 1]; - var yB = this.vertices[i + 1]; - if ((yB < pY && yA >= pY) || (yA < pY && yB >= pY)) { - var xA = this.vertices[iP]; - var xB = this.vertices[i]; - if (((pY - yB) * (xA - xB)) / (yA - yB) + xB < pX) { - isInSide = !isInSide; - } - } - iP = i; - } - } - return isInSide; - }; - /** - * @inheritDoc - */ - PolygonBoundingBoxData.prototype.intersectsSegment = function( - xA, - yA, - xB, - yB, - intersectionPointA, - intersectionPointB, - normalRadians, - ) { - if (intersectionPointA === void 0) { - intersectionPointA = null; - } - if (intersectionPointB === void 0) { - intersectionPointB = null; - } - if (normalRadians === void 0) { - normalRadians = null; - } - var intersectionCount = 0; - if ( - RectangleBoundingBoxData.rectangleIntersectsSegment( - xA, - yA, - xB, - yB, - this.x, - this.y, - this.x + this.width, - this.y + this.height, - null, - null, - null, - ) !== 0 - ) { - intersectionCount = PolygonBoundingBoxData.polygonIntersectsSegment( - xA, - yA, - xB, - yB, - this.vertices, - intersectionPointA, - intersectionPointB, - normalRadians, - ); - } - return intersectionCount; - }; - return PolygonBoundingBoxData; - })(BoundingBoxData); - dragonBones.PolygonBoundingBoxData = PolygonBoundingBoxData; - })(dragonBones || (dragonBones = {})); - /** - * The MIT License (MIT) - * - * Copyright (c) 2012-2018 DragonBones team and other contributors - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of - * the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR - * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - (function(dragonBones) { - /** - * - The animation data. - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 动画数据。 - * @version DragonBones 3.0 - * @language zh_CN - */ - var AnimationData = /** @class */ (function(_super) { - __extends(AnimationData, _super); - function AnimationData() { - var _this = (_super !== null && _super.apply(this, arguments)) || this; - /** - * @private - */ - _this.cachedFrames = []; - /** - * @private - */ - _this.boneTimelines = {}; - /** - * @private - */ - _this.slotTimelines = {}; - /** - * @private - */ - _this.constraintTimelines = {}; - /** - * @private - */ - _this.animationTimelines = {}; - /** - * @private - */ - _this.boneCachedFrameIndices = {}; - /** - * @private - */ - _this.slotCachedFrameIndices = {}; - /** - * @private - */ - _this.actionTimeline = null; // Initial value. - /** - * @private - */ - _this.zOrderTimeline = null; // Initial value. - return _this; - } - AnimationData.toString = function() { - return '[class dragonBones.AnimationData]'; - }; - AnimationData.prototype._onClear = function() { - for (var k in this.boneTimelines) { - for (var _i = 0, _a = this.boneTimelines[k]; _i < _a.length; _i++) { - var timeline = _a[_i]; - timeline.returnToPool(); - } - delete this.boneTimelines[k]; - } - for (var k in this.slotTimelines) { - for (var _b = 0, _c = this.slotTimelines[k]; _b < _c.length; _b++) { - var timeline = _c[_b]; - timeline.returnToPool(); - } - delete this.slotTimelines[k]; - } - for (var k in this.constraintTimelines) { - for ( - var _d = 0, _e = this.constraintTimelines[k]; - _d < _e.length; - _d++ - ) { - var timeline = _e[_d]; - timeline.returnToPool(); - } - delete this.constraintTimelines[k]; - } - for (var k in this.animationTimelines) { - for ( - var _f = 0, _g = this.animationTimelines[k]; - _f < _g.length; - _f++ - ) { - var timeline = _g[_f]; - timeline.returnToPool(); - } - delete this.animationTimelines[k]; - } - for (var k in this.boneCachedFrameIndices) { - delete this.boneCachedFrameIndices[k]; - } - for (var k in this.slotCachedFrameIndices) { - delete this.slotCachedFrameIndices[k]; - } - if (this.actionTimeline !== null) { - this.actionTimeline.returnToPool(); - } - if (this.zOrderTimeline !== null) { - this.zOrderTimeline.returnToPool(); - } - this.frameIntOffset = 0; - this.frameFloatOffset = 0; - this.frameOffset = 0; - this.blendType = 0 /* None */; - this.frameCount = 0; - this.playTimes = 0; - this.duration = 0.0; - this.scale = 1.0; - this.fadeInTime = 0.0; - this.cacheFrameRate = 0.0; - this.name = ''; - this.cachedFrames.length = 0; - // this.boneTimelines.clear(); - // this.slotTimelines.clear(); - // this.constraintTimelines.clear(); - // this.animationTimelines.clear(); - // this.boneCachedFrameIndices.clear(); - // this.slotCachedFrameIndices.clear(); - this.actionTimeline = null; - this.zOrderTimeline = null; - this.parent = null; // - }; - /** - * @internal - */ - AnimationData.prototype.cacheFrames = function(frameRate) { - if (this.cacheFrameRate > 0.0) { - return; - } - this.cacheFrameRate = Math.max(Math.ceil(frameRate * this.scale), 1.0); - var cacheFrameCount = Math.ceil(this.cacheFrameRate * this.duration) + 1; // Cache one more frame. - this.cachedFrames.length = cacheFrameCount; - // @ts-ignore - for (var i = 0, l = this.cacheFrames.length; i < l; ++i) { - this.cachedFrames[i] = false; - } - for (var _i = 0, _a = this.parent.sortedBones; _i < _a.length; _i++) { - var bone = _a[_i]; - var indices = new Array(cacheFrameCount); - // @ts-ignore - for (var i = 0, l = indices.length; i < l; ++i) { - indices[i] = -1; - } - this.boneCachedFrameIndices[bone.name] = indices; - } - for (var _b = 0, _c = this.parent.sortedSlots; _b < _c.length; _b++) { - var slot = _c[_b]; - var indices = new Array(cacheFrameCount); - // @ts-ignore - for (var i = 0, l = indices.length; i < l; ++i) { - indices[i] = -1; - } - this.slotCachedFrameIndices[slot.name] = indices; - } - }; - /** - * @private - */ - AnimationData.prototype.addBoneTimeline = function(timelineName, timeline) { - var timelines = - timelineName in this.boneTimelines - ? this.boneTimelines[timelineName] - : (this.boneTimelines[timelineName] = []); - if (timelines.indexOf(timeline) < 0) { - timelines.push(timeline); - } - }; - /** - * @private - */ - AnimationData.prototype.addSlotTimeline = function(timelineName, timeline) { - var timelines = - timelineName in this.slotTimelines - ? this.slotTimelines[timelineName] - : (this.slotTimelines[timelineName] = []); - if (timelines.indexOf(timeline) < 0) { - timelines.push(timeline); - } - }; - /** - * @private - */ - AnimationData.prototype.addConstraintTimeline = function( - timelineName, - timeline, - ) { - var timelines = - timelineName in this.constraintTimelines - ? this.constraintTimelines[timelineName] - : (this.constraintTimelines[timelineName] = []); - if (timelines.indexOf(timeline) < 0) { - timelines.push(timeline); - } - }; - /** - * @private - */ - AnimationData.prototype.addAnimationTimeline = function( - timelineName, - timeline, - ) { - var timelines = - timelineName in this.animationTimelines - ? this.animationTimelines[timelineName] - : (this.animationTimelines[timelineName] = []); - if (timelines.indexOf(timeline) < 0) { - timelines.push(timeline); - } - }; - /** - * @private - */ - AnimationData.prototype.getBoneTimelines = function(timelineName) { - return timelineName in this.boneTimelines - ? this.boneTimelines[timelineName] - : null; - }; - /** - * @private - */ - AnimationData.prototype.getSlotTimelines = function(timelineName) { - return timelineName in this.slotTimelines - ? this.slotTimelines[timelineName] - : null; - }; - /** - * @private - */ - AnimationData.prototype.getConstraintTimelines = function(timelineName) { - return timelineName in this.constraintTimelines - ? this.constraintTimelines[timelineName] - : null; - }; - /** - * @private - */ - AnimationData.prototype.getAnimationTimelines = function(timelineName) { - return timelineName in this.animationTimelines - ? this.animationTimelines[timelineName] - : null; - }; - /** - * @private - */ - AnimationData.prototype.getBoneCachedFrameIndices = function(boneName) { - return boneName in this.boneCachedFrameIndices - ? this.boneCachedFrameIndices[boneName] - : null; - }; - /** - * @private - */ - AnimationData.prototype.getSlotCachedFrameIndices = function(slotName) { - return slotName in this.slotCachedFrameIndices - ? this.slotCachedFrameIndices[slotName] - : null; - }; - return AnimationData; - })(dragonBones.BaseObject); - dragonBones.AnimationData = AnimationData; - /** - * @private - */ - var TimelineData = /** @class */ (function(_super) { - __extends(TimelineData, _super); - function TimelineData() { - return (_super !== null && _super.apply(this, arguments)) || this; - } - TimelineData.toString = function() { - return '[class dragonBones.TimelineData]'; - }; - TimelineData.prototype._onClear = function() { - this.type = 10 /* BoneAll */; - this.offset = 0; - this.frameIndicesOffset = -1; - }; - return TimelineData; - })(dragonBones.BaseObject); - dragonBones.TimelineData = TimelineData; - /** - * @internal - */ - var AnimationTimelineData = /** @class */ (function(_super) { - __extends(AnimationTimelineData, _super); - function AnimationTimelineData() { - return (_super !== null && _super.apply(this, arguments)) || this; - } - AnimationTimelineData.toString = function() { - return '[class dragonBones.AnimationTimelineData]'; - }; - AnimationTimelineData.prototype._onClear = function() { - _super.prototype._onClear.call(this); - this.x = 0.0; - this.y = 0.0; - }; - return AnimationTimelineData; - })(TimelineData); - dragonBones.AnimationTimelineData = AnimationTimelineData; - })(dragonBones || (dragonBones = {})); - /** - * The MIT License (MIT) - * - * Copyright (c) 2012-2018 DragonBones team and other contributors - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of - * the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR - * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - (function(dragonBones) { - /** - * - The animation config is used to describe all the information needed to play an animation state. - * The API is still in the experimental phase and may encounter bugs or stability or compatibility issues when used. - * @see dragonBones.AnimationState - * @beta - * @version DragonBones 5.0 - * @language en_US - */ - /** - * - 动画配置用来描述播放一个动画状态所需要的全部信息。 - * 该 API 仍在实验阶段,使用时可能遭遇 bug 或稳定性或兼容性问题。 - * @see dragonBones.AnimationState - * @beta - * @version DragonBones 5.0 - * @language zh_CN - */ - var AnimationConfig = /** @class */ (function(_super) { - __extends(AnimationConfig, _super); - function AnimationConfig() { - var _this = (_super !== null && _super.apply(this, arguments)) || this; - /** - * @private - */ - _this.boneMask = []; - return _this; - } - AnimationConfig.toString = function() { - return '[class dragonBones.AnimationConfig]'; - }; - AnimationConfig.prototype._onClear = function() { - this.pauseFadeOut = true; - this.fadeOutMode = 4 /* All */; - this.fadeOutTweenType = 1 /* Line */; - this.fadeOutTime = -1.0; - this.actionEnabled = true; - this.additive = false; - this.displayControl = true; - this.pauseFadeIn = true; - this.resetToPose = true; - this.fadeInTweenType = 1 /* Line */; - this.playTimes = -1; - this.layer = 0; - this.position = 0.0; - this.duration = -1.0; - this.timeScale = -100.0; - this.weight = 1.0; - this.fadeInTime = -1.0; - this.autoFadeOutTime = -1.0; - this.name = ''; - this.animation = ''; - this.group = ''; - this.boneMask.length = 0; - }; - /** - * @private - */ - AnimationConfig.prototype.clear = function() { - this._onClear(); - }; - /** - * @private - */ - AnimationConfig.prototype.copyFrom = function(value) { - this.pauseFadeOut = value.pauseFadeOut; - this.fadeOutMode = value.fadeOutMode; - this.autoFadeOutTime = value.autoFadeOutTime; - this.fadeOutTweenType = value.fadeOutTweenType; - this.actionEnabled = value.actionEnabled; - this.additive = value.additive; - this.displayControl = value.displayControl; - this.pauseFadeIn = value.pauseFadeIn; - this.resetToPose = value.resetToPose; - this.playTimes = value.playTimes; - this.layer = value.layer; - this.position = value.position; - this.duration = value.duration; - this.timeScale = value.timeScale; - this.fadeInTime = value.fadeInTime; - this.fadeOutTime = value.fadeOutTime; - this.fadeInTweenType = value.fadeInTweenType; - this.weight = value.weight; - this.name = value.name; - this.animation = value.animation; - this.group = value.group; - this.boneMask.length = value.boneMask.length; - for (var i = 0, l = this.boneMask.length; i < l; ++i) { - this.boneMask[i] = value.boneMask[i]; - } - }; - return AnimationConfig; - })(dragonBones.BaseObject); - dragonBones.AnimationConfig = AnimationConfig; - })(dragonBones || (dragonBones = {})); - /** - * The MIT License (MIT) - * - * Copyright (c) 2012-2018 DragonBones team and other contributors - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of - * the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR - * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - (function(dragonBones) { - /** - * - The texture atlas data. - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 贴图集数据。 - * @version DragonBones 3.0 - * @language zh_CN - */ - var TextureAtlasData = /** @class */ (function(_super) { - __extends(TextureAtlasData, _super); - function TextureAtlasData() { - var _this = (_super !== null && _super.apply(this, arguments)) || this; - /** - * @private - */ - _this.textures = {}; - return _this; - } - TextureAtlasData.prototype._onClear = function() { - for (var k in this.textures) { - this.textures[k].returnToPool(); - delete this.textures[k]; - } - this.autoSearch = false; - this.width = 0; - this.height = 0; - this.scale = 1.0; - // this.textures.clear(); - this.name = ''; - this.imagePath = ''; - }; - /** - * @private - */ - TextureAtlasData.prototype.copyFrom = function(value) { - this.autoSearch = value.autoSearch; - this.scale = value.scale; - this.width = value.width; - this.height = value.height; - this.name = value.name; - this.imagePath = value.imagePath; - for (var k in this.textures) { - this.textures[k].returnToPool(); - delete this.textures[k]; - } - // this.textures.clear(); - for (var k in value.textures) { - var texture = this.createTexture(); - texture.copyFrom(value.textures[k]); - this.textures[k] = texture; - } - }; - /** - * @internal - */ - TextureAtlasData.prototype.addTexture = function(value) { - if (value.name in this.textures) { - console.warn('Same texture: ' + value.name); - return; - } - value.parent = this; - this.textures[value.name] = value; - }; - /** - * @private - */ - TextureAtlasData.prototype.getTexture = function(textureName) { - return textureName in this.textures ? this.textures[textureName] : null; - }; - return TextureAtlasData; - })(dragonBones.BaseObject); - dragonBones.TextureAtlasData = TextureAtlasData; - /** - * @private - */ - var TextureData = /** @class */ (function(_super) { - __extends(TextureData, _super); - function TextureData() { - var _this = (_super !== null && _super.apply(this, arguments)) || this; - _this.region = new dragonBones.Rectangle(); - _this.frame = null; // Initial value. - return _this; - } - TextureData.createRectangle = function() { - return new dragonBones.Rectangle(); - }; - TextureData.prototype._onClear = function() { - this.rotated = false; - this.name = ''; - this.region.clear(); - this.parent = null; // - this.frame = null; - }; - TextureData.prototype.copyFrom = function(value) { - this.rotated = value.rotated; - this.name = value.name; - this.region.copyFrom(value.region); - this.parent = value.parent; - if (this.frame === null && value.frame !== null) { - this.frame = TextureData.createRectangle(); - } else if (this.frame !== null && value.frame === null) { - this.frame = null; - } - if (this.frame !== null && value.frame !== null) { - this.frame.copyFrom(value.frame); - } - }; - return TextureData; - })(dragonBones.BaseObject); - dragonBones.TextureData = TextureData; - })(dragonBones || (dragonBones = {})); - /** - * The MIT License (MIT) - * - * Copyright (c) 2012-2018 DragonBones team and other contributors - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of - * the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR - * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - (function(dragonBones_1) { - /** - * - Armature is the core of the skeleton animation system. - * @see dragonBones.ArmatureData - * @see dragonBones.Bone - * @see dragonBones.Slot - * @see dragonBones.Animation - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 骨架是骨骼动画系统的核心。 - * @see dragonBones.ArmatureData - * @see dragonBones.Bone - * @see dragonBones.Slot - * @see dragonBones.Animation - * @version DragonBones 3.0 - * @language zh_CN - */ - var Armature = /** @class */ (function(_super) { - __extends(Armature, _super); - function Armature() { - var _this = (_super !== null && _super.apply(this, arguments)) || this; - _this._bones = []; - _this._slots = []; - /** - * @internal - */ - _this._constraints = []; - _this._actions = []; - _this._animation = null; // Initial value. - _this._proxy = null; // Initial value. - /** - * @internal - */ - _this._replaceTextureAtlasData = null; // Initial value. - _this._clock = null; // Initial value. - return _this; - } - Armature.toString = function() { - return '[class dragonBones.Armature]'; - }; - Armature._onSortSlots = function(a, b) { - return a._zIndex * 1000 + a._zOrder > b._zIndex * 1000 + b._zOrder - ? 1 - : -1; - }; - Armature.prototype._onClear = function() { - if (this._clock !== null) { - this._clock.remove(this); - } - for (var _i = 0, _a = this._bones; _i < _a.length; _i++) { - var bone = _a[_i]; - bone.returnToPool(); - } - for (var _b = 0, _c = this._slots; _b < _c.length; _b++) { - var slot = _c[_b]; - slot.returnToPool(); - } - for (var _d = 0, _e = this._constraints; _d < _e.length; _d++) { - var constraint = _e[_d]; - constraint.returnToPool(); - } - for (var _f = 0, _g = this._actions; _f < _g.length; _f++) { - var action = _g[_f]; - action.returnToPool(); - } - if (this._animation !== null) { - this._animation.returnToPool(); - } - if (this._proxy !== null) { - this._proxy.dbClear(); - } - if (this._replaceTextureAtlasData !== null) { - this._replaceTextureAtlasData.returnToPool(); - } - this.inheritAnimation = true; - this.userData = null; - this._lockUpdate = false; - this._slotsDirty = true; - this._zOrderDirty = false; - this._zIndexDirty = false; - this._alphaDirty = true; - this._flipX = false; - this._flipY = false; - this._cacheFrameIndex = -1; - this._alpha = 1.0; - this._globalAlpha = 1.0; - this._bones.length = 0; - this._slots.length = 0; - this._constraints.length = 0; - this._actions.length = 0; - this._armatureData = null; // - this._animation = null; // - this._proxy = null; // - this._display = null; - this._replaceTextureAtlasData = null; - this._replacedTexture = null; - this._dragonBones = null; // - this._clock = null; - this._parent = null; - }; - /** - * @internal - */ - Armature.prototype._sortZOrder = function(slotIndices, offset) { - var slotDatas = this._armatureData.sortedSlots; - var isOriginal = slotIndices === null; - if (this._zOrderDirty || !isOriginal) { - for (var i = 0, l = slotDatas.length; i < l; ++i) { - var slotIndex = isOriginal ? i : slotIndices[offset + i]; - if (slotIndex < 0 || slotIndex >= l) { - continue; - } - var slotData = slotDatas[slotIndex]; - var slot = this.getSlot(slotData.name); - if (slot !== null) { - slot._setZOrder(i); - } - } - this._slotsDirty = true; - this._zOrderDirty = !isOriginal; - } - }; - /** - * @internal - */ - Armature.prototype._addBone = function(value) { - if (this._bones.indexOf(value) < 0) { - this._bones.push(value); - } - }; - /** - * @internal - */ - Armature.prototype._addSlot = function(value) { - if (this._slots.indexOf(value) < 0) { - this._slots.push(value); - } - }; - /** - * @internal - */ - Armature.prototype._addConstraint = function(value) { - if (this._constraints.indexOf(value) < 0) { - this._constraints.push(value); - } - }; - /** - * @internal - */ - Armature.prototype._bufferAction = function(action, append) { - if (this._actions.indexOf(action) < 0) { - if (append) { - this._actions.push(action); - } else { - this._actions.unshift(action); - } - } - }; - /** - * - Dispose the armature. (Return to the object pool) - * @example - *
-         *     removeChild(armature.display);
-         *     armature.dispose();
-         * 
- * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 释放骨架。 (回收到对象池) - * @example - *
-         *     removeChild(armature.display);
-         *     armature.dispose();
-         * 
- * @version DragonBones 3.0 - * @language zh_CN - */ - Armature.prototype.dispose = function() { - if (this._armatureData !== null) { - this._lockUpdate = true; - this._dragonBones.bufferObject(this); - } - }; - /** - * @internal - */ - Armature.prototype.init = function( - armatureData, - proxy, - display, - dragonBones, - ) { - if (this._armatureData !== null) { - return; - } - this._armatureData = armatureData; - this._animation = dragonBones_1.BaseObject.borrowObject( - dragonBones_1.Animation, - ); - this._proxy = proxy; - this._display = display; - this._dragonBones = dragonBones; - this._proxy.dbInit(this); - this._animation.init(this); - this._animation.animations = this._armatureData.animations; - }; - /** - * @inheritDoc - */ - Armature.prototype.advanceTime = function(passedTime) { - if (this._lockUpdate) { - return; - } - this._lockUpdate = true; - if (this._armatureData === null) { - console.warn('The armature has been disposed.'); - return; - } else if (this._armatureData.parent === null) { - console.warn( - 'The armature data has been disposed.\nPlease make sure dispose armature before call factory.clear().', - ); - return; - } - var prevCacheFrameIndex = this._cacheFrameIndex; - // Update animation. - this._animation.advanceTime(passedTime); - // Sort slots. - if (this._slotsDirty || this._zIndexDirty) { - this._slots.sort(Armature._onSortSlots); - if (this._zIndexDirty) { - for (var i = 0, l = this._slots.length; i < l; ++i) { - this._slots[i]._setZOrder(i); // - } - } - this._slotsDirty = false; - this._zIndexDirty = false; - } - // Update alpha. - if (this._alphaDirty) { - this._alphaDirty = false; - this._globalAlpha = - this._alpha * - (this._parent !== null ? this._parent._globalAlpha : 1.0); - for (var _i = 0, _a = this._bones; _i < _a.length; _i++) { - var bone = _a[_i]; - bone._updateAlpha(); - } - for (var _b = 0, _c = this._slots; _b < _c.length; _b++) { - var slot = _c[_b]; - slot._updateAlpha(); - } - } - // Update bones and slots. - if ( - this._cacheFrameIndex < 0 || - this._cacheFrameIndex !== prevCacheFrameIndex - ) { - var i = 0, - l = 0; - for (i = 0, l = this._bones.length; i < l; ++i) { - this._bones[i].update(this._cacheFrameIndex); - } - for (i = 0, l = this._slots.length; i < l; ++i) { - this._slots[i].update(this._cacheFrameIndex); - } - } - // Do actions. - if (this._actions.length > 0) { - for (var _d = 0, _e = this._actions; _d < _e.length; _d++) { - var action = _e[_d]; - var actionData = action.actionData; - if (actionData !== null) { - if (actionData.type === 0 /* Play */) { - if (action.slot !== null) { - var childArmature = action.slot.childArmature; - if (childArmature !== null) { - childArmature.animation.fadeIn(actionData.name); - } - } else if (action.bone !== null) { - for (var _f = 0, _g = this.getSlots(); _f < _g.length; _f++) { - var slot = _g[_f]; - if (slot.parent === action.bone) { - var childArmature = slot.childArmature; - if (childArmature !== null) { - childArmature.animation.fadeIn(actionData.name); - } - } - } - } else { - this._animation.fadeIn(actionData.name); - } - } - } - action.returnToPool(); - } - this._actions.length = 0; - } - this._lockUpdate = false; - this._proxy.dbUpdate(); - }; - /** - * - Forces a specific bone or its owning slot to update the transform or display property in the next frame. - * @param boneName - The bone name. (If not set, all bones will be update) - * @param updateSlot - Whether to update the bone's slots. (Default: false) - * @see dragonBones.Bone#invalidUpdate() - * @see dragonBones.Slot#invalidUpdate() - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 强制特定骨骼或其拥有的插槽在下一帧更新变换或显示属性。 - * @param boneName - 骨骼名称。 (如果未设置,将更新所有骨骼) - * @param updateSlot - 是否更新骨骼的插槽。 (默认: false) - * @see dragonBones.Bone#invalidUpdate() - * @see dragonBones.Slot#invalidUpdate() - * @version DragonBones 3.0 - * @language zh_CN - */ - Armature.prototype.invalidUpdate = function(boneName, updateSlot) { - if (boneName === void 0) { - boneName = null; - } - if (updateSlot === void 0) { - updateSlot = false; - } - if (boneName !== null && boneName.length > 0) { - var bone = this.getBone(boneName); - if (bone !== null) { - bone.invalidUpdate(); - if (updateSlot) { - for (var _i = 0, _a = this._slots; _i < _a.length; _i++) { - var slot = _a[_i]; - if (slot.parent === bone) { - slot.invalidUpdate(); - } - } - } - } - } else { - for (var _b = 0, _c = this._bones; _b < _c.length; _b++) { - var bone = _c[_b]; - bone.invalidUpdate(); - } - if (updateSlot) { - for (var _d = 0, _e = this._slots; _d < _e.length; _d++) { - var slot = _e[_d]; - slot.invalidUpdate(); - } - } - } - }; - /** - * - Check whether a specific point is inside a custom bounding box in a slot. - * The coordinate system of the point is the inner coordinate system of the armature. - * Custom bounding boxes need to be customized in Dragonbones Pro. - * @param x - The horizontal coordinate of the point. - * @param y - The vertical coordinate of the point. - * @version DragonBones 5.0 - * @language en_US - */ - /** - * - 检查特定点是否在某个插槽的自定义边界框内。 - * 点的坐标系为骨架内坐标系。 - * 自定义边界框需要在 DragonBones Pro 中自定义。 - * @param x - 点的水平坐标。 - * @param y - 点的垂直坐标。 - * @version DragonBones 5.0 - * @language zh_CN - */ - Armature.prototype.containsPoint = function(x, y) { - for (var _i = 0, _a = this._slots; _i < _a.length; _i++) { - var slot = _a[_i]; - if (slot.containsPoint(x, y)) { - return slot; - } - } - return null; - }; - /** - * - Check whether a specific segment intersects a custom bounding box for a slot in the armature. - * The coordinate system of the segment and intersection is the inner coordinate system of the armature. - * Custom bounding boxes need to be customized in Dragonbones Pro. - * @param xA - The horizontal coordinate of the beginning of the segment. - * @param yA - The vertical coordinate of the beginning of the segment. - * @param xB - The horizontal coordinate of the end point of the segment. - * @param yB - The vertical coordinate of the end point of the segment. - * @param intersectionPointA - The first intersection at which a line segment intersects the bounding box from the beginning to the end. (If not set, the intersection point will not calculated) - * @param intersectionPointB - The first intersection at which a line segment intersects the bounding box from the end to the beginning. (If not set, the intersection point will not calculated) - * @param normalRadians - The normal radians of the tangent of the intersection boundary box. [x: Normal radian of the first intersection tangent, y: Normal radian of the second intersection tangent] (If not set, the normal will not calculated) - * @returns The slot of the first custom bounding box where the segment intersects from the start point to the end point. - * @version DragonBones 5.0 - * @language en_US - */ - /** - * - 检查特定线段是否与骨架的某个插槽的自定义边界框相交。 - * 线段和交点的坐标系均为骨架内坐标系。 - * 自定义边界框需要在 DragonBones Pro 中自定义。 - * @param xA - 线段起点的水平坐标。 - * @param yA - 线段起点的垂直坐标。 - * @param xB - 线段终点的水平坐标。 - * @param yB - 线段终点的垂直坐标。 - * @param intersectionPointA - 线段从起点到终点与边界框相交的第一个交点。 (如果未设置,则不计算交点) - * @param intersectionPointB - 线段从终点到起点与边界框相交的第一个交点。 (如果未设置,则不计算交点) - * @param normalRadians - 交点边界框切线的法线弧度。 [x: 第一个交点切线的法线弧度, y: 第二个交点切线的法线弧度] (如果未设置,则不计算法线) - * @returns 线段从起点到终点相交的第一个自定义边界框的插槽。 - * @version DragonBones 5.0 - * @language zh_CN - */ - Armature.prototype.intersectsSegment = function( - xA, - yA, - xB, - yB, - intersectionPointA, - intersectionPointB, - normalRadians, - ) { - if (intersectionPointA === void 0) { - intersectionPointA = null; - } - if (intersectionPointB === void 0) { - intersectionPointB = null; - } - if (normalRadians === void 0) { - normalRadians = null; - } - var isV = xA === xB; - var dMin = 0.0; - var dMax = 0.0; - var intXA = 0.0; - var intYA = 0.0; - var intXB = 0.0; - var intYB = 0.0; - var intAN = 0.0; - var intBN = 0.0; - var intSlotA = null; - var intSlotB = null; - for (var _i = 0, _a = this._slots; _i < _a.length; _i++) { - var slot = _a[_i]; - var intersectionCount = slot.intersectsSegment( - xA, - yA, - xB, - yB, - intersectionPointA, - intersectionPointB, - normalRadians, - ); - if (intersectionCount > 0) { - if (intersectionPointA !== null || intersectionPointB !== null) { - if (intersectionPointA !== null) { - var d = isV - ? intersectionPointA.y - yA - : intersectionPointA.x - xA; - if (d < 0.0) { - d = -d; - } - if (intSlotA === null || d < dMin) { - dMin = d; - intXA = intersectionPointA.x; - intYA = intersectionPointA.y; - intSlotA = slot; - if (normalRadians) { - intAN = normalRadians.x; - } - } - } - if (intersectionPointB !== null) { - var d = intersectionPointB.x - xA; - if (d < 0.0) { - d = -d; - } - if (intSlotB === null || d > dMax) { - dMax = d; - intXB = intersectionPointB.x; - intYB = intersectionPointB.y; - intSlotB = slot; - if (normalRadians !== null) { - intBN = normalRadians.y; - } - } - } - } else { - intSlotA = slot; - break; - } - } - } - if (intSlotA !== null && intersectionPointA !== null) { - intersectionPointA.x = intXA; - intersectionPointA.y = intYA; - if (normalRadians !== null) { - normalRadians.x = intAN; - } - } - if (intSlotB !== null && intersectionPointB !== null) { - intersectionPointB.x = intXB; - intersectionPointB.y = intYB; - if (normalRadians !== null) { - normalRadians.y = intBN; - } - } - return intSlotA; - }; - /** - * - Get a specific bone. - * @param name - The bone name. - * @see dragonBones.Bone - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 获取特定的骨骼。 - * @param name - 骨骼名称。 - * @see dragonBones.Bone - * @version DragonBones 3.0 - * @language zh_CN - */ - Armature.prototype.getBone = function(name) { - for (var _i = 0, _a = this._bones; _i < _a.length; _i++) { - var bone = _a[_i]; - if (bone.name === name) { - return bone; - } - } - return null; - }; - /** - * - Get a specific bone by the display. - * @param display - The display object. - * @see dragonBones.Bone - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 通过显示对象获取特定的骨骼。 - * @param display - 显示对象。 - * @see dragonBones.Bone - * @version DragonBones 3.0 - * @language zh_CN - */ - Armature.prototype.getBoneByDisplay = function(display) { - var slot = this.getSlotByDisplay(display); - return slot !== null ? slot.parent : null; - }; - /** - * - Get a specific slot. - * @param name - The slot name. - * @see dragonBones.Slot - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 获取特定的插槽。 - * @param name - 插槽名称。 - * @see dragonBones.Slot - * @version DragonBones 3.0 - * @language zh_CN - */ - Armature.prototype.getSlot = function(name) { - for (var _i = 0, _a = this._slots; _i < _a.length; _i++) { - var slot = _a[_i]; - if (slot.name === name) { - return slot; - } - } - return null; - }; - /** - * - Get a specific slot by the display. - * @param display - The display object. - * @see dragonBones.Slot - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 通过显示对象获取特定的插槽。 - * @param display - 显示对象。 - * @see dragonBones.Slot - * @version DragonBones 3.0 - * @language zh_CN - */ - Armature.prototype.getSlotByDisplay = function(display) { - if (display !== null) { - for (var _i = 0, _a = this._slots; _i < _a.length; _i++) { - var slot = _a[_i]; - if (slot.display === display) { - return slot; - } - } - } - return null; - }; - /** - * - Get all bones. - * @see dragonBones.Bone - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 获取所有的骨骼。 - * @see dragonBones.Bone - * @version DragonBones 3.0 - * @language zh_CN - */ - Armature.prototype.getBones = function() { - return this._bones; - }; - /** - * - Get all slots. - * @see dragonBones.Slot - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 获取所有的插槽。 - * @see dragonBones.Slot - * @version DragonBones 3.0 - * @language zh_CN - */ - Armature.prototype.getSlots = function() { - return this._slots; - }; - Object.defineProperty(Armature.prototype, 'flipX', { - /** - * - Whether to flip the armature horizontally. - * @version DragonBones 5.5 - * @language en_US - */ - /** - * - 是否将骨架水平翻转。 - * @version DragonBones 5.5 - * @language zh_CN - */ - get: function() { - return this._flipX; - }, - set: function(value) { - if (this._flipX === value) { - return; - } - this._flipX = value; - this.invalidUpdate(); - }, - enumerable: true, - configurable: true, - }); - Object.defineProperty(Armature.prototype, 'flipY', { - /** - * - Whether to flip the armature vertically. - * @version DragonBones 5.5 - * @language en_US - */ - /** - * - 是否将骨架垂直翻转。 - * @version DragonBones 5.5 - * @language zh_CN - */ - get: function() { - return this._flipY; - }, - set: function(value) { - if (this._flipY === value) { - return; - } - this._flipY = value; - this.invalidUpdate(); - }, - enumerable: true, - configurable: true, - }); - Object.defineProperty(Armature.prototype, 'cacheFrameRate', { - /** - * - The animation cache frame rate, which turns on the animation cache when the set value is greater than 0. - * There is a certain amount of memory overhead to improve performance by caching animation data in memory. - * The frame rate should not be set too high, usually with the frame rate of the animation is similar and lower than the program running frame rate. - * When the animation cache is turned on, some features will fail, such as the offset property of bone. - * @example - *
-           *     armature.cacheFrameRate = 24;
-           * 
- * @see dragonBones.DragonBonesData#frameRate - * @see dragonBones.ArmatureData#frameRate - * @version DragonBones 4.5 - * @language en_US - */ - /** - * - 动画缓存帧率,当设置的值大于 0 的时,将会开启动画缓存。 - * 通过将动画数据缓存在内存中来提高运行性能,会有一定的内存开销。 - * 帧率不宜设置的过高,通常跟动画的帧率相当且低于程序运行的帧率。 - * 开启动画缓存后,某些功能将会失效,比如骨骼的 offset 属性等。 - * @example - *
-           *     armature.cacheFrameRate = 24;
-           * 
- * @see dragonBones.DragonBonesData#frameRate - * @see dragonBones.ArmatureData#frameRate - * @version DragonBones 4.5 - * @language zh_CN - */ - get: function() { - return this._armatureData.cacheFrameRate; - }, - set: function(value) { - if (this._armatureData.cacheFrameRate !== value) { - this._armatureData.cacheFrames(value); - // Set child armature frameRate. - for (var _i = 0, _a = this._slots; _i < _a.length; _i++) { - var slot = _a[_i]; - var childArmature = slot.childArmature; - if (childArmature !== null) { - childArmature.cacheFrameRate = value; - } - } - } - }, - enumerable: true, - configurable: true, - }); - Object.defineProperty(Armature.prototype, 'name', { - /** - * - The armature name. - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 骨架名称。 - * @version DragonBones 3.0 - * @language zh_CN - */ - get: function() { - return this._armatureData.name; - }, - enumerable: true, - configurable: true, - }); - Object.defineProperty(Armature.prototype, 'armatureData', { - /** - * - The armature data. - * @see dragonBones.ArmatureData - * @version DragonBones 4.5 - * @language en_US - */ - /** - * - 骨架数据。 - * @see dragonBones.ArmatureData - * @version DragonBones 4.5 - * @language zh_CN - */ - get: function() { - return this._armatureData; - }, - enumerable: true, - configurable: true, - }); - Object.defineProperty(Armature.prototype, 'animation', { - /** - * - The animation player. - * @see dragonBones.Animation - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 动画播放器。 - * @see dragonBones.Animation - * @version DragonBones 3.0 - * @language zh_CN - */ - get: function() { - return this._animation; - }, - enumerable: true, - configurable: true, - }); - Object.defineProperty(Armature.prototype, 'proxy', { - /** - * @pivate - */ - get: function() { - return this._proxy; - }, - enumerable: true, - configurable: true, - }); - Object.defineProperty(Armature.prototype, 'eventDispatcher', { - /** - * - The EventDispatcher instance of the armature. - * @version DragonBones 4.5 - * @language en_US - */ - /** - * - 该骨架的 EventDispatcher 实例。 - * @version DragonBones 4.5 - * @language zh_CN - */ - get: function() { - return this._proxy; - }, - enumerable: true, - configurable: true, - }); - Object.defineProperty(Armature.prototype, 'display', { - /** - * - The display container. - * The display of the slot is displayed as the parent. - * Depending on the rendering engine, the type will be different, usually the DisplayObjectContainer type. - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 显示容器实例。 - * 插槽的显示对象都会以此显示容器为父级。 - * 根据渲染引擎的不同,类型会不同,通常是 DisplayObjectContainer 类型。 - * @version DragonBones 3.0 - * @language zh_CN - */ - get: function() { - return this._display; - }, - enumerable: true, - configurable: true, - }); - Object.defineProperty(Armature.prototype, 'replacedTexture', { - /** - * @private - */ - get: function() { - return this._replacedTexture; - }, - set: function(value) { - if (this._replacedTexture === value) { - return; - } - if (this._replaceTextureAtlasData !== null) { - this._replaceTextureAtlasData.returnToPool(); - this._replaceTextureAtlasData = null; - } - this._replacedTexture = value; - for (var _i = 0, _a = this._slots; _i < _a.length; _i++) { - var slot = _a[_i]; - slot.invalidUpdate(); - slot.update(-1); - } - }, - enumerable: true, - configurable: true, - }); - Object.defineProperty(Armature.prototype, 'clock', { - /** - * @inheritDoc - */ - get: function() { - return this._clock; - }, - set: function(value) { - if (this._clock === value) { - return; - } - if (this._clock !== null) { - this._clock.remove(this); - } - this._clock = value; - if (this._clock) { - this._clock.add(this); - } - // Update childArmature clock. - for (var _i = 0, _a = this._slots; _i < _a.length; _i++) { - var slot = _a[_i]; - var childArmature = slot.childArmature; - if (childArmature !== null) { - childArmature.clock = this._clock; - } - } - }, - enumerable: true, - configurable: true, - }); - Object.defineProperty(Armature.prototype, 'parent', { - /** - * - Get the parent slot which the armature belongs to. - * @see dragonBones.Slot - * @version DragonBones 4.5 - * @language en_US - */ - /** - * - 该骨架所属的父插槽。 - * @see dragonBones.Slot - * @version DragonBones 4.5 - * @language zh_CN - */ - get: function() { - return this._parent; - }, - enumerable: true, - configurable: true, - }); - /** - * - Deprecated, please refer to {@link #display}. - * @deprecated - * @language en_US - */ - /** - * - 已废弃,请参考 {@link #display}。 - * @deprecated - * @language zh_CN - */ - Armature.prototype.getDisplay = function() { - return this._display; - }; - return Armature; - })(dragonBones_1.BaseObject); - dragonBones_1.Armature = Armature; - })(dragonBones || (dragonBones = {})); - /** - * The MIT License (MIT) - * - * Copyright (c) 2012-2018 DragonBones team and other contributors - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of - * the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR - * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - (function(dragonBones) { - /** - * - The base class of the transform object. - * @see dragonBones.Transform - * @version DragonBones 4.5 - * @language en_US - */ - /** - * - 变换对象的基类。 - * @see dragonBones.Transform - * @version DragonBones 4.5 - * @language zh_CN - */ - var TransformObject = /** @class */ (function(_super) { - __extends(TransformObject, _super); - function TransformObject() { - var _this = (_super !== null && _super.apply(this, arguments)) || this; - /** - * - A matrix relative to the armature coordinate system. - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 相对于骨架坐标系的矩阵。 - * @version DragonBones 3.0 - * @language zh_CN - */ - _this.globalTransformMatrix = new dragonBones.Matrix(); - /** - * - A transform relative to the armature coordinate system. - * @see #updateGlobalTransform() - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 相对于骨架坐标系的变换。 - * @see #updateGlobalTransform() - * @version DragonBones 3.0 - * @language zh_CN - */ - _this.global = new dragonBones.Transform(); - /** - * - The offset transform relative to the armature or the parent bone coordinate system. - * @see #dragonBones.Bone#invalidUpdate() - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 相对于骨架或父骨骼坐标系的偏移变换。 - * @see #dragonBones.Bone#invalidUpdate() - * @version DragonBones 3.0 - * @language zh_CN - */ - _this.offset = new dragonBones.Transform(); - return _this; - } - /** - */ - TransformObject.prototype._onClear = function() { - this.globalTransformMatrix.identity(); - this.global.identity(); - this.offset.identity(); - this.origin = null; - this.userData = null; - this._globalDirty = false; - this._alpha = 1.0; - this._globalAlpha = 1.0; - this._armature = null; // - }; - /** - * - For performance considerations, rotation or scale in the {@link #global} attribute of the bone or slot is not always properly accessible, - * some engines do not rely on these attributes to update rendering, such as Egret. - * The use of this method ensures that the access to the {@link #global} property is correctly rotation or scale. - * @example - *
-         *     bone.updateGlobalTransform();
-         *     let rotation = bone.global.rotation;
-         * 
- * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 出于性能的考虑,骨骼或插槽的 {@link #global} 属性中的旋转或缩放并不总是正确可访问的,有些引擎并不依赖这些属性更新渲染,比如 Egret。 - * 使用此方法可以保证访问到 {@link #global} 属性中正确的旋转或缩放。 - * @example - *
-         *     bone.updateGlobalTransform();
-         *     let rotation = bone.global.rotation;
-         * 
- * @version DragonBones 3.0 - * @language zh_CN - */ - TransformObject.prototype.updateGlobalTransform = function() { - if (this._globalDirty) { - this._globalDirty = false; - this.global.fromMatrix(this.globalTransformMatrix); - } - }; - Object.defineProperty(TransformObject.prototype, 'armature', { - /** - * - The armature to which it belongs. - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 所属的骨架。 - * @version DragonBones 3.0 - * @language zh_CN - */ - get: function() { - return this._armature; - }, - enumerable: true, - configurable: true, - }); - TransformObject._helpMatrix = new dragonBones.Matrix(); - TransformObject._helpTransform = new dragonBones.Transform(); - TransformObject._helpPoint = new dragonBones.Point(); - return TransformObject; - })(dragonBones.BaseObject); - dragonBones.TransformObject = TransformObject; - })(dragonBones || (dragonBones = {})); - /** - * The MIT License (MIT) - * - * Copyright (c) 2012-2018 DragonBones team and other contributors - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of - * the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR - * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - (function(dragonBones) { - /** - * - Bone is one of the most important logical units in the armature animation system, - * and is responsible for the realization of translate, rotation, scaling in the animations. - * A armature can contain multiple bones. - * @see dragonBones.BoneData - * @see dragonBones.Armature - * @see dragonBones.Slot - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 骨骼在骨骼动画体系中是最重要的逻辑单元之一,负责动画中的平移、旋转、缩放的实现。 - * 一个骨架中可以包含多个骨骼。 - * @see dragonBones.BoneData - * @see dragonBones.Armature - * @see dragonBones.Slot - * @version DragonBones 3.0 - * @language zh_CN - */ - var Bone = /** @class */ (function(_super) { - __extends(Bone, _super); - function Bone() { - var _this = (_super !== null && _super.apply(this, arguments)) || this; - /** - * @internal - */ - _this.animationPose = new dragonBones.Transform(); - return _this; - } - Bone.toString = function() { - return '[class dragonBones.Bone]'; - }; - Bone.prototype._onClear = function() { - _super.prototype._onClear.call(this); - this.offsetMode = 1 /* Additive */; - this.animationPose.identity(); - this._transformDirty = false; - this._childrenTransformDirty = false; - this._localDirty = true; - this._hasConstraint = false; - this._visible = true; - this._cachedFrameIndex = -1; - this._boneData = null; // - this._parent = null; // - this._cachedFrameIndices = null; - }; - Bone.prototype._updateGlobalTransformMatrix = function(isCache) { - // For typescript. - var boneData = this._boneData; - var global = this.global; - var globalTransformMatrix = this.globalTransformMatrix; - var origin = this.origin; - var offset = this.offset; - var animationPose = this.animationPose; - var parent = this._parent; // - var flipX = this._armature.flipX; - var flipY = this._armature.flipY === dragonBones.DragonBones.yDown; - var inherit = parent !== null; - var rotation = 0.0; - if (this.offsetMode === 1 /* Additive */) { - if (origin !== null) { - // global.copyFrom(this.origin).add(this.offset).add(this.animationPose); - global.x = origin.x + offset.x + animationPose.x; - global.y = origin.y + offset.y + animationPose.y; - global.skew = origin.skew + offset.skew + animationPose.skew; - global.rotation = - origin.rotation + offset.rotation + animationPose.rotation; - global.scaleX = origin.scaleX * offset.scaleX * animationPose.scaleX; - global.scaleY = origin.scaleY * offset.scaleY * animationPose.scaleY; - } else { - global.copyFrom(offset).add(animationPose); - } - } else if (this.offsetMode === 0 /* None */) { - if (origin !== null) { - global.copyFrom(origin).add(animationPose); - } else { - global.copyFrom(animationPose); - } - } else { - inherit = false; - global.copyFrom(offset); - } - if (inherit) { - var isSurface = parent._boneData.type === 1; /* Surface */ - var surfaceBone = isSurface ? parent._bone : null; - var parentMatrix = isSurface - ? parent._getGlobalTransformMatrix(global.x, global.y) - : parent.globalTransformMatrix; - if (boneData.inheritScale && (!isSurface || surfaceBone !== null)) { - if (isSurface) { - if (boneData.inheritRotation) { - global.rotation += parent.global.rotation; - } - surfaceBone.updateGlobalTransform(); - global.scaleX *= surfaceBone.global.scaleX; - global.scaleY *= surfaceBone.global.scaleY; - parentMatrix.transformPoint(global.x, global.y, global); - global.toMatrix(globalTransformMatrix); - if (boneData.inheritTranslation) { - global.x = globalTransformMatrix.tx; - global.y = globalTransformMatrix.ty; - } else { - globalTransformMatrix.tx = global.x; - globalTransformMatrix.ty = global.y; - } - } else { - if (!boneData.inheritRotation) { - parent.updateGlobalTransform(); - if (flipX && flipY) { - rotation = global.rotation - (parent.global.rotation + Math.PI); - } else if (flipX) { - rotation = global.rotation + parent.global.rotation + Math.PI; - } else if (flipY) { - rotation = global.rotation + parent.global.rotation; - } else { - rotation = global.rotation - parent.global.rotation; - } - global.rotation = rotation; - } - global.toMatrix(globalTransformMatrix); - globalTransformMatrix.concat(parentMatrix); - if (boneData.inheritTranslation) { - global.x = globalTransformMatrix.tx; - global.y = globalTransformMatrix.ty; - } else { - globalTransformMatrix.tx = global.x; - globalTransformMatrix.ty = global.y; - } - if (isCache) { - global.fromMatrix(globalTransformMatrix); - } else { - this._globalDirty = true; - } - } - } else { - if (boneData.inheritTranslation) { - var x = global.x; - var y = global.y; - global.x = - parentMatrix.a * x + parentMatrix.c * y + parentMatrix.tx; - global.y = - parentMatrix.b * x + parentMatrix.d * y + parentMatrix.ty; - } else { - if (flipX) { - global.x = -global.x; - } - if (flipY) { - global.y = -global.y; - } - } - if (boneData.inheritRotation) { - parent.updateGlobalTransform(); - if (parent.global.scaleX < 0.0) { - rotation = global.rotation + parent.global.rotation + Math.PI; - } else { - rotation = global.rotation + parent.global.rotation; - } - if ( - parentMatrix.a * parentMatrix.d - - parentMatrix.b * parentMatrix.c < - 0.0 - ) { - rotation -= global.rotation * 2.0; - if (flipX !== flipY || boneData.inheritReflection) { - global.skew += Math.PI; - } - } - global.rotation = rotation; - } else if (flipX || flipY) { - if (flipX && flipY) { - rotation = global.rotation + Math.PI; - } else { - if (flipX) { - rotation = Math.PI - global.rotation; - } else { - rotation = -global.rotation; - } - global.skew += Math.PI; - } - global.rotation = rotation; - } - global.toMatrix(globalTransformMatrix); - } - } else { - if (flipX || flipY) { - if (flipX) { - global.x = -global.x; - } - if (flipY) { - global.y = -global.y; - } - if (flipX && flipY) { - rotation = global.rotation + Math.PI; - } else { - if (flipX) { - rotation = Math.PI - global.rotation; - } else { - rotation = -global.rotation; - } - global.skew += Math.PI; - } - global.rotation = rotation; - } - global.toMatrix(globalTransformMatrix); - } - }; - /** - * @internal - */ - Bone.prototype._updateAlpha = function() { - if (this._parent !== null) { - this._globalAlpha = this._alpha * this._parent._globalAlpha; - } else { - this._globalAlpha = this._alpha * this._armature._globalAlpha; - } - }; - /** - * @internal - */ - Bone.prototype.init = function(boneData, armatureValue) { - if (this._boneData !== null) { - return; - } - this._boneData = boneData; - this._armature = armatureValue; - this._alpha = this._boneData.alpha; - if (this._boneData.parent !== null) { - this._parent = this._armature.getBone(this._boneData.parent.name); - } - this._armature._addBone(this); - // - this.origin = this._boneData.transform; - }; - /** - * @internal - */ - Bone.prototype.update = function(cacheFrameIndex) { - if (cacheFrameIndex >= 0 && this._cachedFrameIndices !== null) { - var cachedFrameIndex = this._cachedFrameIndices[cacheFrameIndex]; - if ( - cachedFrameIndex >= 0 && - this._cachedFrameIndex === cachedFrameIndex - ) { - this._transformDirty = false; - } else if (cachedFrameIndex >= 0) { - this._transformDirty = true; - this._cachedFrameIndex = cachedFrameIndex; - } else { - if (this._hasConstraint) { - for ( - var _i = 0, _a = this._armature._constraints; - _i < _a.length; - _i++ - ) { - var constraint = _a[_i]; - if (constraint._root === this) { - constraint.update(); - } - } - } - if ( - this._transformDirty || - (this._parent !== null && this._parent._childrenTransformDirty) - ) { - this._transformDirty = true; - this._cachedFrameIndex = -1; - } else if (this._cachedFrameIndex >= 0) { - this._transformDirty = false; - this._cachedFrameIndices[cacheFrameIndex] = this._cachedFrameIndex; - } else { - this._transformDirty = true; - this._cachedFrameIndex = -1; - } - } - } else { - if (this._hasConstraint) { - for ( - var _b = 0, _c = this._armature._constraints; - _b < _c.length; - _b++ - ) { - var constraint = _c[_b]; - if (constraint._root === this) { - constraint.update(); - } - } - } - if ( - this._transformDirty || - (this._parent !== null && this._parent._childrenTransformDirty) - ) { - cacheFrameIndex = -1; - this._transformDirty = true; - this._cachedFrameIndex = -1; - } - } - if (this._transformDirty) { - this._transformDirty = false; - this._childrenTransformDirty = true; - // - if (this._cachedFrameIndex < 0) { - var isCache = cacheFrameIndex >= 0; - if (this._localDirty) { - this._updateGlobalTransformMatrix(isCache); - } - if (isCache && this._cachedFrameIndices !== null) { - this._cachedFrameIndex = this._cachedFrameIndices[ - cacheFrameIndex - ] = this._armature._armatureData.setCacheFrame( - this.globalTransformMatrix, - this.global, - ); - } - } else { - this._armature._armatureData.getCacheFrame( - this.globalTransformMatrix, - this.global, - this._cachedFrameIndex, - ); - } - // - } else if (this._childrenTransformDirty) { - this._childrenTransformDirty = false; - } - this._localDirty = true; - }; - /** - * @internal - */ - Bone.prototype.updateByConstraint = function() { - if (this._localDirty) { - this._localDirty = false; - if ( - this._transformDirty || - (this._parent !== null && this._parent._childrenTransformDirty) - ) { - this._updateGlobalTransformMatrix(true); - } - this._transformDirty = true; - } - }; - /** - * - Forces the bone to update the transform in the next frame. - * When the bone is not animated or its animation state is finished, the bone will not continue to update, - * and when the skeleton must be updated for some reason, the method needs to be called explicitly. - * @example - *
-         *     let bone = armature.getBone("arm");
-         *     bone.offset.scaleX = 2.0;
-         *     bone.invalidUpdate();
-         * 
- * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 强制骨骼在下一帧更新变换。 - * 当该骨骼没有动画状态或其动画状态播放完成时,骨骼将不在继续更新,而此时由于某些原因必须更新骨骼时,则需要显式调用该方法。 - * @example - *
-         *     let bone = armature.getBone("arm");
-         *     bone.offset.scaleX = 2.0;
-         *     bone.invalidUpdate();
-         * 
- * @version DragonBones 3.0 - * @language zh_CN - */ - Bone.prototype.invalidUpdate = function() { - this._transformDirty = true; - }; - /** - * - Check whether the bone contains a specific bone. - * @see dragonBones.Bone - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 检查该骨骼是否包含特定的骨骼。 - * @see dragonBones.Bone - * @version DragonBones 3.0 - * @language zh_CN - */ - Bone.prototype.contains = function(value) { - if (value === this) { - return false; - } - var ancestor = value; - while (ancestor !== this && ancestor !== null) { - ancestor = ancestor.parent; - } - return ancestor === this; - }; - Object.defineProperty(Bone.prototype, 'boneData', { - /** - * - The bone data. - * @version DragonBones 4.5 - * @language en_US - */ - /** - * - 骨骼数据。 - * @version DragonBones 4.5 - * @language zh_CN - */ - get: function() { - return this._boneData; - }, - enumerable: true, - configurable: true, - }); - Object.defineProperty(Bone.prototype, 'visible', { - /** - * - The visible of all slots in the bone. - * @default true - * @see dragonBones.Slot#visible - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 此骨骼所有插槽的可见。 - * @default true - * @see dragonBones.Slot#visible - * @version DragonBones 3.0 - * @language zh_CN - */ - get: function() { - return this._visible; - }, - set: function(value) { - if (this._visible === value) { - return; - } - this._visible = value; - for (var _i = 0, _a = this._armature.getSlots(); _i < _a.length; _i++) { - var slot = _a[_i]; - if (slot.parent === this) { - slot._updateVisible(); - } - } - }, - enumerable: true, - configurable: true, - }); - Object.defineProperty(Bone.prototype, 'name', { - /** - * - The bone name. - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 骨骼名称。 - * @version DragonBones 3.0 - * @language zh_CN - */ - get: function() { - return this._boneData.name; - }, - enumerable: true, - configurable: true, - }); - Object.defineProperty(Bone.prototype, 'parent', { - /** - * - The parent bone to which it belongs. - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 所属的父骨骼。 - * @version DragonBones 3.0 - * @language zh_CN - */ - get: function() { - return this._parent; - }, - enumerable: true, - configurable: true, - }); - return Bone; - })(dragonBones.TransformObject); - dragonBones.Bone = Bone; - })(dragonBones || (dragonBones = {})); - /** - * The MIT License (MIT) - * - * Copyright (c) 2012-2018 DragonBones team and other contributors - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of - * the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR - * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - (function(dragonBones) { - /** - * @internal - */ - var Surface = /** @class */ (function(_super) { - __extends(Surface, _super); - function Surface() { - var _this = (_super !== null && _super.apply(this, arguments)) || this; - _this._vertices = []; - _this._deformVertices = []; - /** - * - x1, y1, x2, y2, x3, y3, x4, y4, d1X, d1Y, d2X, d2Y - */ - _this._hullCache = []; - /** - * - Inside [flag, a, b, c, d, tx, ty], Outside [flag, a, b, c, d, tx, ty] - */ - _this._matrixCahce = []; - return _this; - } - Surface.toString = function() { - return '[class dragonBones.Surface]'; - }; - Surface.prototype._onClear = function() { - _super.prototype._onClear.call(this); - this._dX = 0.0; - this._dY = 0.0; - this._k = 0.0; - this._kX = 0.0; - this._kY = 0.0; - this._vertices.length = 0; - this._deformVertices.length = 0; - this._matrixCahce.length = 0; - this._hullCache.length = 0; - this._bone = null; - }; - Surface.prototype._getAffineTransform = function( - x, - y, - lX, - lY, - aX, - aY, - bX, - bY, - cX, - cY, - transform, - matrix, - isDown, - ) { - var dabX = bX - aX; - var dabY = bY - aY; - var dacX = cX - aX; - var dacY = cY - aY; - transform.rotation = Math.atan2(dabY, dabX); - transform.skew = - Math.atan2(dacY, dacX) - Math.PI * 0.5 - transform.rotation; - if (isDown) { - transform.rotation += Math.PI; - } - transform.scaleX = Math.sqrt(dabX * dabX + dabY * dabY) / lX; - transform.scaleY = Math.sqrt(dacX * dacX + dacY * dacY) / lY; - transform.toMatrix(matrix); - transform.x = matrix.tx = aX - (matrix.a * x + matrix.c * y); - transform.y = matrix.ty = aY - (matrix.b * x + matrix.d * y); - }; - Surface.prototype._updateVertices = function() { - var data = this._armature.armatureData.parent; - var geometry = this._boneData.geometry; - var intArray = data.intArray; - var floatArray = data.floatArray; - var vertexCount = intArray[geometry.offset + 0 /* GeometryVertexCount */]; - var verticesOffset = - intArray[geometry.offset + 2 /* GeometryFloatOffset */]; - var vertices = this._vertices; - var animationVertices = this._deformVertices; - if (this._parent !== null) { - if (this._parent._boneData.type === 1 /* Surface */) { - for (var i = 0, l = vertexCount; i < l; ++i) { - var iD = i * 2; - var x = floatArray[verticesOffset + iD] + animationVertices[iD]; - var y = - floatArray[verticesOffset + iD + 1] + animationVertices[iD + 1]; - var matrix = this._parent._getGlobalTransformMatrix(x, y); - // - vertices[iD] = matrix.a * x + matrix.c * y + matrix.tx; - vertices[iD + 1] = matrix.b * x + matrix.d * y + matrix.ty; - } - } else { - var parentMatrix = this._parent.globalTransformMatrix; - for (var i = 0, l = vertexCount; i < l; ++i) { - var iD = i * 2; - var x = floatArray[verticesOffset + iD] + animationVertices[iD]; - var y = - floatArray[verticesOffset + iD + 1] + animationVertices[iD + 1]; - // - vertices[iD] = - parentMatrix.a * x + parentMatrix.c * y + parentMatrix.tx; - vertices[iD + 1] = - parentMatrix.b * x + parentMatrix.d * y + parentMatrix.ty; - } - } - } else { - for (var i = 0, l = vertexCount; i < l; ++i) { - var iD = i * 2; - vertices[iD] = - floatArray[verticesOffset + iD] + animationVertices[iD]; - vertices[iD + 1] = - floatArray[verticesOffset + iD + 1] + animationVertices[iD + 1]; - } - } - }; - Surface.prototype._updateGlobalTransformMatrix = function(isCache) { - var segmentXD = this._boneData.segmentX * 2; - var lastIndex = this._vertices.length - 2; - var lA = 200.0; - // - var raX = this._vertices[0]; - var raY = this._vertices[1]; - var rbX = this._vertices[segmentXD]; - var rbY = this._vertices[segmentXD + 1]; - var rcX = this._vertices[lastIndex]; - var rcY = this._vertices[lastIndex + 1]; - var rdX = this._vertices[lastIndex - segmentXD]; - var rdY = this._vertices[lastIndex - segmentXD + 1]; - // - var dacX = raX + (rcX - raX) * 0.5; - var dacY = raY + (rcY - raY) * 0.5; - var dbdX = rbX + (rdX - rbX) * 0.5; - var dbdY = rbY + (rdY - rbY) * 0.5; - var aX = dacX + (dbdX - dacX) * 0.5; - var aY = dacY + (dbdY - dacY) * 0.5; - var bX = rbX + (rcX - rbX) * 0.5; - var bY = rbY + (rcY - rbY) * 0.5; - var cX = rdX + (rcX - rdX) * 0.5; - var cY = rdY + (rcY - rdY) * 0.5; - // TODO interpolation - this._getAffineTransform( - 0.0, - 0.0, - lA, - lA, - aX, - aY, - bX, - bY, - cX, - cY, - this.global, - this.globalTransformMatrix, - false, - ); - this._globalDirty = false; - }; - Surface.prototype._getGlobalTransformMatrix = function(x, y) { - var lA = 200.0; - var lB = 1000.0; - if (x < -lB || lB < x || y < -lB || lB < y) { - return this.globalTransformMatrix; - } - var isDown = false; - var surfaceData = this._boneData; - var segmentX = surfaceData.segmentX; - var segmentY = surfaceData.segmentY; - var segmentXD = surfaceData.segmentX * 2; - var dX = this._dX; - var dY = this._dY; - var indexX = Math.floor((x + lA) / dX); // -1 ~ segmentX - 1 - var indexY = Math.floor((y + lA) / dY); // -1 ~ segmentY - 1 - var matrixIndex = 0; - var pX = indexX * dX - lA; - var pY = indexY * dY - lA; - // - var matrices = this._matrixCahce; - var helpMatrix = Surface._helpMatrix; - if (x < -lA) { - if (y < -lA || y >= lA) { - return this.globalTransformMatrix; - } - // Left. - isDown = y > this._kX * (x + lA) + pY; - matrixIndex = - ((segmentX * segmentY + segmentX + segmentY + segmentY + indexY) * 2 + - (isDown ? 1 : 0)) * - 7; - if (matrices[matrixIndex] > 0.0) { - helpMatrix.copyFromArray(matrices, matrixIndex + 1); - } else { - var vertexIndex = indexY * (segmentXD + 2); - var ddX = this._hullCache[4]; - var ddY = this._hullCache[5]; - var sX = this._hullCache[2] - (segmentY - indexY) * ddX; - var sY = this._hullCache[3] - (segmentY - indexY) * ddY; - var vertices = this._vertices; - if (isDown) { - this._getAffineTransform( - -lA, - pY + dY, - lB - lA, - dY, - vertices[vertexIndex + segmentXD + 2], - vertices[vertexIndex + segmentXD + 3], - sX + ddX, - sY + ddY, - vertices[vertexIndex], - vertices[vertexIndex + 1], - Surface._helpTransform, - helpMatrix, - true, - ); - } else { - this._getAffineTransform( - -lB, - pY, - lB - lA, - dY, - sX, - sY, - vertices[vertexIndex], - vertices[vertexIndex + 1], - sX + ddX, - sY + ddY, - Surface._helpTransform, - helpMatrix, - false, - ); - } - matrices[matrixIndex] = 1.0; - matrices[matrixIndex + 1] = helpMatrix.a; - matrices[matrixIndex + 2] = helpMatrix.b; - matrices[matrixIndex + 3] = helpMatrix.c; - matrices[matrixIndex + 4] = helpMatrix.d; - matrices[matrixIndex + 5] = helpMatrix.tx; - matrices[matrixIndex + 6] = helpMatrix.ty; - } - } else if (x >= lA) { - if (y < -lA || y >= lA) { - return this.globalTransformMatrix; - } - // Right. - isDown = y > this._kX * (x - lB) + pY; - matrixIndex = - ((segmentX * segmentY + segmentX + indexY) * 2 + (isDown ? 1 : 0)) * - 7; - if (matrices[matrixIndex] > 0.0) { - helpMatrix.copyFromArray(matrices, matrixIndex + 1); - } else { - var vertexIndex = (indexY + 1) * (segmentXD + 2) - 2; - var ddX = this._hullCache[4]; - var ddY = this._hullCache[5]; - var sX = this._hullCache[0] + indexY * ddX; - var sY = this._hullCache[1] + indexY * ddY; - var vertices = this._vertices; - if (isDown) { - this._getAffineTransform( - lB, - pY + dY, - lB - lA, - dY, - sX + ddX, - sY + ddY, - vertices[vertexIndex + segmentXD + 2], - vertices[vertexIndex + segmentXD + 3], - sX, - sY, - Surface._helpTransform, - helpMatrix, - true, - ); - } else { - this._getAffineTransform( - lA, - pY, - lB - lA, - dY, - vertices[vertexIndex], - vertices[vertexIndex + 1], - sX, - sY, - vertices[vertexIndex + segmentXD + 2], - vertices[vertexIndex + segmentXD + 3], - Surface._helpTransform, - helpMatrix, - false, - ); - } - matrices[matrixIndex] = 1.0; - matrices[matrixIndex + 1] = helpMatrix.a; - matrices[matrixIndex + 2] = helpMatrix.b; - matrices[matrixIndex + 3] = helpMatrix.c; - matrices[matrixIndex + 4] = helpMatrix.d; - matrices[matrixIndex + 5] = helpMatrix.tx; - matrices[matrixIndex + 6] = helpMatrix.ty; - } - } else if (y < -lA) { - if (x < -lA || x >= lA) { - return this.globalTransformMatrix; - } - // Up. - isDown = y > this._kY * (x - pX - dX) - lB; - matrixIndex = - ((segmentX * segmentY + indexX) * 2 + (isDown ? 1 : 0)) * 7; - if (matrices[matrixIndex] > 0.0) { - helpMatrix.copyFromArray(matrices, matrixIndex + 1); - } else { - var vertexIndex = indexX * 2; - var ddX = this._hullCache[10]; - var ddY = this._hullCache[11]; - var sX = this._hullCache[8] + indexX * ddX; - var sY = this._hullCache[9] + indexX * ddY; - var vertices = this._vertices; - if (isDown) { - this._getAffineTransform( - pX + dX, - -lA, - dX, - lB - lA, - vertices[vertexIndex + 2], - vertices[vertexIndex + 3], - vertices[vertexIndex], - vertices[vertexIndex + 1], - sX + ddX, - sY + ddY, - Surface._helpTransform, - helpMatrix, - true, - ); - } else { - this._getAffineTransform( - pX, - -lB, - dX, - lB - lA, - sX, - sY, - sX + ddX, - sY + ddY, - vertices[vertexIndex], - vertices[vertexIndex + 1], - Surface._helpTransform, - helpMatrix, - false, - ); - } - matrices[matrixIndex] = 1.0; - matrices[matrixIndex + 1] = helpMatrix.a; - matrices[matrixIndex + 2] = helpMatrix.b; - matrices[matrixIndex + 3] = helpMatrix.c; - matrices[matrixIndex + 4] = helpMatrix.d; - matrices[matrixIndex + 5] = helpMatrix.tx; - matrices[matrixIndex + 6] = helpMatrix.ty; - } - } else if (y >= lA) { - if (x < -lA || x >= lA) { - return this.globalTransformMatrix; - } - // Down - isDown = y > this._kY * (x - pX - dX) + lA; - matrixIndex = - ((segmentX * segmentY + segmentX + segmentY + indexX) * 2 + - (isDown ? 1 : 0)) * - 7; - if (matrices[matrixIndex] > 0.0) { - helpMatrix.copyFromArray(matrices, matrixIndex + 1); - } else { - var vertexIndex = segmentY * (segmentXD + 2) + indexX * 2; - var ddX = this._hullCache[10]; - var ddY = this._hullCache[11]; - var sX = this._hullCache[6] - (segmentX - indexX) * ddX; - var sY = this._hullCache[7] - (segmentX - indexX) * ddY; - var vertices = this._vertices; - if (isDown) { - this._getAffineTransform( - pX + dX, - lB, - dX, - lB - lA, - sX + ddX, - sY + ddY, - sX, - sY, - vertices[vertexIndex + 2], - vertices[vertexIndex + 3], - Surface._helpTransform, - helpMatrix, - true, - ); - } else { - this._getAffineTransform( - pX, - lA, - dX, - lB - lA, - vertices[vertexIndex], - vertices[vertexIndex + 1], - vertices[vertexIndex + 2], - vertices[vertexIndex + 3], - sX, - sY, - Surface._helpTransform, - helpMatrix, - false, - ); - } - matrices[matrixIndex] = 1.0; - matrices[matrixIndex + 1] = helpMatrix.a; - matrices[matrixIndex + 2] = helpMatrix.b; - matrices[matrixIndex + 3] = helpMatrix.c; - matrices[matrixIndex + 4] = helpMatrix.d; - matrices[matrixIndex + 5] = helpMatrix.tx; - matrices[matrixIndex + 6] = helpMatrix.ty; - } - } else { - isDown = y > this._k * (x - pX - dX) + pY; - matrixIndex = ((segmentX * indexY + indexX) * 2 + (isDown ? 1 : 0)) * 7; - if (matrices[matrixIndex] > 0.0) { - helpMatrix.copyFromArray(matrices, matrixIndex + 1); - } else { - var vertexIndex = indexX * 2 + indexY * (segmentXD + 2); - var vertices = this._vertices; - if (isDown) { - this._getAffineTransform( - pX + dX, - pY + dY, - dX, - dY, - vertices[vertexIndex + segmentXD + 4], - vertices[vertexIndex + segmentXD + 5], - vertices[vertexIndex + segmentXD + 2], - vertices[vertexIndex + segmentXD + 3], - vertices[vertexIndex + 2], - vertices[vertexIndex + 3], - Surface._helpTransform, - helpMatrix, - true, - ); - } else { - this._getAffineTransform( - pX, - pY, - dX, - dY, - vertices[vertexIndex], - vertices[vertexIndex + 1], - vertices[vertexIndex + 2], - vertices[vertexIndex + 3], - vertices[vertexIndex + segmentXD + 2], - vertices[vertexIndex + segmentXD + 3], - Surface._helpTransform, - helpMatrix, - false, - ); - } - matrices[matrixIndex] = 1.0; - matrices[matrixIndex + 1] = helpMatrix.a; - matrices[matrixIndex + 2] = helpMatrix.b; - matrices[matrixIndex + 3] = helpMatrix.c; - matrices[matrixIndex + 4] = helpMatrix.d; - matrices[matrixIndex + 5] = helpMatrix.tx; - matrices[matrixIndex + 6] = helpMatrix.ty; - } - } - return helpMatrix; - }; - /** - * @internal - * @private - */ - Surface.prototype.init = function(surfaceData, armatureValue) { - if (this._boneData !== null) { - return; - } - _super.prototype.init.call(this, surfaceData, armatureValue); - var segmentX = surfaceData.segmentX; - var segmentY = surfaceData.segmentY; - var vertexCount = this._armature.armatureData.parent.intArray[ - surfaceData.geometry.offset + 0 /* GeometryVertexCount */ - ]; - var lB = 1000.0; - var lA = 200.0; - // - this._dX = (lA * 2.0) / segmentX; - this._dY = (lA * 2.0) / segmentY; - this._k = -this._dY / this._dX; - this._kX = -this._dY / (lB - lA); - this._kY = -(lB - lA) / this._dX; - this._vertices.length = vertexCount * 2; - this._deformVertices.length = vertexCount * 2; - this._matrixCahce.length = - (segmentX * segmentY + segmentX * 2 + segmentY * 2) * 2 * 7; - this._hullCache.length = 10; - for (var i = 0; i < vertexCount * 2; ++i) { - this._deformVertices[i] = 0.0; - } - if (this._parent !== null) { - if (this._parent.boneData.type === 0 /* Bone */) { - this._bone = this._parent; - } else { - this._bone = this._parent._bone; - } - } - }; - /** - * @internal - */ - Surface.prototype.update = function(cacheFrameIndex) { - if (cacheFrameIndex >= 0 && this._cachedFrameIndices !== null) { - var cachedFrameIndex = this._cachedFrameIndices[cacheFrameIndex]; - if ( - cachedFrameIndex >= 0 && - this._cachedFrameIndex === cachedFrameIndex - ) { - this._transformDirty = false; - } else if (cachedFrameIndex >= 0) { - this._transformDirty = true; - this._cachedFrameIndex = cachedFrameIndex; - } else { - if (this._hasConstraint) { - for ( - var _i = 0, _a = this._armature._constraints; - _i < _a.length; - _i++ - ) { - var constraint = _a[_i]; - if (constraint._root === this) { - constraint.update(); - } - } - } - if ( - this._transformDirty || - (this._parent !== null && this._parent._childrenTransformDirty) - ) { - this._transformDirty = true; - this._cachedFrameIndex = -1; - } else if (this._cachedFrameIndex >= 0) { - this._transformDirty = false; - this._cachedFrameIndices[cacheFrameIndex] = this._cachedFrameIndex; - } else { - this._transformDirty = true; - this._cachedFrameIndex = -1; - } - } - } else { - if (this._hasConstraint) { - for ( - var _b = 0, _c = this._armature._constraints; - _b < _c.length; - _b++ - ) { - var constraint = _c[_b]; - if (constraint._root === this) { - constraint.update(); - } - } - } - if ( - this._transformDirty || - (this._parent !== null && this._parent._childrenTransformDirty) - ) { - cacheFrameIndex = -1; - this._transformDirty = true; - this._cachedFrameIndex = -1; - } - } - if (this._transformDirty) { - this._transformDirty = false; - this._childrenTransformDirty = true; - // - for (var i = 0, l = this._matrixCahce.length; i < l; i += 7) { - this._matrixCahce[i] = -1.0; - } - // - this._updateVertices(); - // - if (this._cachedFrameIndex < 0) { - var isCache = cacheFrameIndex >= 0; - if (this._localDirty) { - this._updateGlobalTransformMatrix(isCache); - } - if (isCache && this._cachedFrameIndices !== null) { - this._cachedFrameIndex = this._cachedFrameIndices[ - cacheFrameIndex - ] = this._armature._armatureData.setCacheFrame( - this.globalTransformMatrix, - this.global, - ); - } - } else { - this._armature._armatureData.getCacheFrame( - this.globalTransformMatrix, - this.global, - this._cachedFrameIndex, - ); - } - // Update hull vertices. - var lB = 1000.0; - var lA = 200.0; - var ddX = 2 * this.global.x; - var ddY = 2 * this.global.y; - // - var helpPoint = Surface._helpPoint; - this.globalTransformMatrix.transformPoint(lB, -lA, helpPoint); - this._hullCache[0] = helpPoint.x; - this._hullCache[1] = helpPoint.y; - this._hullCache[2] = ddX - helpPoint.x; - this._hullCache[3] = ddY - helpPoint.y; - this.globalTransformMatrix.transformPoint( - 0.0, - this._dY, - helpPoint, - true, - ); - this._hullCache[4] = helpPoint.x; - this._hullCache[5] = helpPoint.y; - // - this.globalTransformMatrix.transformPoint(lA, lB, helpPoint); - this._hullCache[6] = helpPoint.x; - this._hullCache[7] = helpPoint.y; - this._hullCache[8] = ddX - helpPoint.x; - this._hullCache[9] = ddY - helpPoint.y; - this.globalTransformMatrix.transformPoint( - this._dX, - 0.0, - helpPoint, - true, - ); - this._hullCache[10] = helpPoint.x; - this._hullCache[11] = helpPoint.y; - } else if (this._childrenTransformDirty) { - this._childrenTransformDirty = false; - } - this._localDirty = true; - }; - return Surface; - })(dragonBones.Bone); - dragonBones.Surface = Surface; - })(dragonBones || (dragonBones = {})); - /** - * The MIT License (MIT) - * - * Copyright (c) 2012-2018 DragonBones team and other contributors - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of - * the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR - * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - (function(dragonBones) { - /** - * @private - */ - var DisplayFrame = /** @class */ (function(_super) { - __extends(DisplayFrame, _super); - function DisplayFrame() { - var _this = (_super !== null && _super.apply(this, arguments)) || this; - _this.deformVertices = []; - return _this; - } - DisplayFrame.toString = function() { - return '[class dragonBones.DisplayFrame]'; - }; - DisplayFrame.prototype._onClear = function() { - this.rawDisplayData = null; - this.displayData = null; - this.textureData = null; - this.display = null; - this.deformVertices.length = 0; - }; - DisplayFrame.prototype.updateDeformVertices = function() { - if (this.rawDisplayData === null || this.deformVertices.length !== 0) { - return; - } - var rawGeometryData; - if (this.rawDisplayData.type === 2 /* Mesh */) { - rawGeometryData = this.rawDisplayData.geometry; - } else if (this.rawDisplayData.type === 4 /* Path */) { - rawGeometryData = this.rawDisplayData.geometry; - } else { - return; - } - var vertexCount = 0; - if (rawGeometryData.weight !== null) { - vertexCount = rawGeometryData.weight.count * 2; - } else { - vertexCount = - rawGeometryData.data.intArray[ - rawGeometryData.offset + 0 /* GeometryVertexCount */ - ] * 2; - } - this.deformVertices.length = vertexCount; - for (var i = 0, l = this.deformVertices.length; i < l; ++i) { - this.deformVertices[i] = 0.0; - } - }; - DisplayFrame.prototype.getGeometryData = function() { - if (this.displayData !== null) { - if (this.displayData.type === 2 /* Mesh */) { - return this.displayData.geometry; - } - if (this.displayData.type === 4 /* Path */) { - return this.displayData.geometry; - } - } - if (this.rawDisplayData !== null) { - if (this.rawDisplayData.type === 2 /* Mesh */) { - return this.rawDisplayData.geometry; - } - if (this.rawDisplayData.type === 4 /* Path */) { - return this.rawDisplayData.geometry; - } - } - return null; - }; - DisplayFrame.prototype.getBoundingBox = function() { - if ( - this.displayData !== null && - this.displayData.type === 3 /* BoundingBox */ - ) { - return this.displayData.boundingBox; - } - if ( - this.rawDisplayData !== null && - this.rawDisplayData.type === 3 /* BoundingBox */ - ) { - return this.rawDisplayData.boundingBox; - } - return null; - }; - DisplayFrame.prototype.getTextureData = function() { - if (this.displayData !== null) { - if (this.displayData.type === 0 /* Image */) { - return this.displayData.texture; - } - if (this.displayData.type === 2 /* Mesh */) { - return this.displayData.texture; - } - } - if (this.textureData !== null) { - return this.textureData; - } - if (this.rawDisplayData !== null) { - if (this.rawDisplayData.type === 0 /* Image */) { - return this.rawDisplayData.texture; - } - if (this.rawDisplayData.type === 2 /* Mesh */) { - return this.rawDisplayData.texture; - } - } - return null; - }; - return DisplayFrame; - })(dragonBones.BaseObject); - dragonBones.DisplayFrame = DisplayFrame; - /** - * - The slot attached to the armature, controls the display status and properties of the display object. - * A bone can contain multiple slots. - * A slot can contain multiple display objects, displaying only one of the display objects at a time, - * but you can toggle the display object into frame animation while the animation is playing. - * The display object can be a normal texture, or it can be a display of a child armature, a grid display object, - * and a custom other display object. - * @see dragonBones.Armature - * @see dragonBones.Bone - * @see dragonBones.SlotData - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 插槽附着在骨骼上,控制显示对象的显示状态和属性。 - * 一个骨骼上可以包含多个插槽。 - * 一个插槽中可以包含多个显示对象,同一时间只能显示其中的一个显示对象,但可以在动画播放的过程中切换显示对象实现帧动画。 - * 显示对象可以是普通的图片纹理,也可以是子骨架的显示容器,网格显示对象,还可以是自定义的其他显示对象。 - * @see dragonBones.Armature - * @see dragonBones.Bone - * @see dragonBones.SlotData - * @version DragonBones 3.0 - * @language zh_CN - */ - var Slot = /** @class */ (function(_super) { - __extends(Slot, _super); - function Slot() { - var _this = (_super !== null && _super.apply(this, arguments)) || this; - _this._localMatrix = new dragonBones.Matrix(); - /** - * @internal - */ - _this._colorTransform = new dragonBones.ColorTransform(); - /** - * @internal - */ - _this._displayFrames = []; - /** - * @internal - */ - _this._geometryBones = []; - _this._rawDisplay = null; // Initial value. - _this._meshDisplay = null; // Initial value. - _this._display = null; - return _this; - } - Slot.prototype._onClear = function() { - _super.prototype._onClear.call(this); - var disposeDisplayList = []; - for (var _i = 0, _a = this._displayFrames; _i < _a.length; _i++) { - var dispayFrame = _a[_i]; - var display = dispayFrame.display; - if ( - display !== this._rawDisplay && - display !== this._meshDisplay && - disposeDisplayList.indexOf(display) < 0 - ) { - disposeDisplayList.push(display); - } - dispayFrame.returnToPool(); - } - for ( - var _b = 0, disposeDisplayList_1 = disposeDisplayList; - _b < disposeDisplayList_1.length; - _b++ - ) { - var eachDisplay = disposeDisplayList_1[_b]; - if (eachDisplay instanceof dragonBones.Armature) { - eachDisplay.dispose(); - } else { - this._disposeDisplay(eachDisplay, true); - } - } - if ( - this._meshDisplay !== null && - this._meshDisplay !== this._rawDisplay - ) { - this._disposeDisplay(this._meshDisplay, false); - } - if (this._rawDisplay !== null) { - this._disposeDisplay(this._rawDisplay, false); - } - this.displayController = null; - this._displayDataDirty = false; - this._displayDirty = false; - this._geometryDirty = false; - this._textureDirty = false; - this._visibleDirty = false; - this._blendModeDirty = false; - this._zOrderDirty = false; - this._colorDirty = false; - this._verticesDirty = false; - this._transformDirty = false; - this._visible = true; - this._blendMode = 0 /* Normal */; - this._displayIndex = -1; - this._animationDisplayIndex = -1; - this._zOrder = 0; - this._zIndex = 0; - this._cachedFrameIndex = -1; - this._pivotX = 0.0; - this._pivotY = 0.0; - this._localMatrix.identity(); - this._colorTransform.identity(); - this._displayFrames.length = 0; - this._geometryBones.length = 0; - this._slotData = null; // - this._displayFrame = null; - this._geometryData = null; - this._boundingBoxData = null; - this._textureData = null; - this._rawDisplay = null; - this._meshDisplay = null; - this._display = null; - this._childArmature = null; - this._parent = null; // - this._cachedFrameIndices = null; - }; - Slot.prototype._hasDisplay = function(display) { - for (var _i = 0, _a = this._displayFrames; _i < _a.length; _i++) { - var displayFrame = _a[_i]; - if (displayFrame.display === display) { - return true; - } - } - return false; - }; - /** - * @internal - */ - Slot.prototype._isBonesUpdate = function() { - for (var _i = 0, _a = this._geometryBones; _i < _a.length; _i++) { - var bone = _a[_i]; - if (bone !== null && bone._childrenTransformDirty) { - return true; - } - } - return false; - }; - /** - * @internal - */ - Slot.prototype._updateAlpha = function() { - var globalAlpha = this._alpha * this._parent._globalAlpha; - if (this._globalAlpha !== globalAlpha) { - this._globalAlpha = globalAlpha; - this._colorDirty = true; - } - }; - Slot.prototype._updateDisplayData = function() { - var prevDisplayFrame = this._displayFrame; - var prevGeometryData = this._geometryData; - var prevTextureData = this._textureData; - var rawDisplayData = null; - var displayData = null; - this._displayFrame = null; - this._geometryData = null; - this._boundingBoxData = null; - this._textureData = null; - if ( - this._displayIndex >= 0 && - this._displayIndex < this._displayFrames.length - ) { - this._displayFrame = this._displayFrames[this._displayIndex]; - rawDisplayData = this._displayFrame.rawDisplayData; - displayData = this._displayFrame.displayData; - this._geometryData = this._displayFrame.getGeometryData(); - this._boundingBoxData = this._displayFrame.getBoundingBox(); - this._textureData = this._displayFrame.getTextureData(); - } - if ( - this._displayFrame !== prevDisplayFrame || - this._geometryData !== prevGeometryData || - this._textureData !== prevTextureData - ) { - // Update pivot offset. - if (this._geometryData === null && this._textureData !== null) { - var imageDisplayData = - displayData !== null && displayData.type === 0 /* Image */ - ? displayData - : rawDisplayData; // - var scale = - this._textureData.parent.scale * this._armature._armatureData.scale; - var frame = this._textureData.frame; - this._pivotX = imageDisplayData.pivot.x; - this._pivotY = imageDisplayData.pivot.y; - var rect = frame !== null ? frame : this._textureData.region; - var width = rect.width; - var height = rect.height; - if (this._textureData.rotated && frame === null) { - width = rect.height; - height = rect.width; - } - this._pivotX *= width * scale; - this._pivotY *= height * scale; - if (frame !== null) { - this._pivotX += frame.x * scale; - this._pivotY += frame.y * scale; - } - // Update replace pivot. TODO - if (rawDisplayData !== null && imageDisplayData !== rawDisplayData) { - rawDisplayData.transform.toMatrix(Slot._helpMatrix); - Slot._helpMatrix.invert(); - Slot._helpMatrix.transformPoint(0.0, 0.0, Slot._helpPoint); - this._pivotX -= Slot._helpPoint.x; - this._pivotY -= Slot._helpPoint.y; - imageDisplayData.transform.toMatrix(Slot._helpMatrix); - Slot._helpMatrix.invert(); - Slot._helpMatrix.transformPoint(0.0, 0.0, Slot._helpPoint); - this._pivotX += Slot._helpPoint.x; - this._pivotY += Slot._helpPoint.y; - } - if (!dragonBones.DragonBones.yDown) { - this._pivotY = - (this._textureData.rotated - ? this._textureData.region.width - : this._textureData.region.height) * - scale - - this._pivotY; - } - } else { - this._pivotX = 0.0; - this._pivotY = 0.0; - } - // Update original transform. - if (rawDisplayData !== null) { - this.origin = rawDisplayData.transform; - } else if (displayData !== null) { - this.origin = displayData.transform; - } else { - this.origin = null; - } - // TODO remove slot offset. - if (this.origin !== null) { - this.global - .copyFrom(this.origin) - .add(this.offset) - .toMatrix(this._localMatrix); - } else { - this.global.copyFrom(this.offset).toMatrix(this._localMatrix); - } - // Update geometry. - if (this._geometryData !== prevGeometryData) { - this._geometryDirty = true; - this._verticesDirty = true; - if (this._geometryData !== null) { - this._geometryBones.length = 0; - if (this._geometryData.weight !== null) { - for ( - var i = 0, l = this._geometryData.weight.bones.length; - i < l; - ++i - ) { - var bone = this._armature.getBone( - this._geometryData.weight.bones[i].name, - ); - this._geometryBones.push(bone); - } - } - } else { - this._geometryBones.length = 0; - this._geometryData = null; - } - } - this._textureDirty = this._textureData !== prevTextureData; - this._transformDirty = true; - } - }; - Slot.prototype._updateDisplay = function() { - var prevDisplay = - this._display !== null ? this._display : this._rawDisplay; - var prevChildArmature = this._childArmature; - // Update display and child armature. - if (this._displayFrame !== null) { - this._display = this._displayFrame.display; - if ( - this._display !== null && - this._display instanceof dragonBones.Armature - ) { - this._childArmature = this._display; - this._display = this._childArmature.display; - } else { - this._childArmature = null; - } - } else { - this._display = null; - this._childArmature = null; - } - // Update display. - var currentDisplay = - this._display !== null ? this._display : this._rawDisplay; - if (currentDisplay !== prevDisplay) { - this._textureDirty = true; - this._visibleDirty = true; - this._blendModeDirty = true; - // this._zOrderDirty = true; - this._colorDirty = true; - this._transformDirty = true; - this._onUpdateDisplay(); - this._replaceDisplay(prevDisplay); - } - // Update child armature. - if (this._childArmature !== prevChildArmature) { - if (prevChildArmature !== null) { - prevChildArmature._parent = null; // Update child armature parent. - prevChildArmature.clock = null; - if (prevChildArmature.inheritAnimation) { - prevChildArmature.animation.reset(); - } - } - if (this._childArmature !== null) { - this._childArmature._parent = this; // Update child armature parent. - this._childArmature.clock = this._armature.clock; - if (this._childArmature.inheritAnimation) { - if (this._childArmature.cacheFrameRate === 0) { - var cacheFrameRate = this._armature.cacheFrameRate; - if (cacheFrameRate !== 0) { - this._childArmature.cacheFrameRate = cacheFrameRate; - } - } - // Child armature action. - if (this._displayFrame !== null) { - var actions = null; - var displayData = - this._displayFrame.displayData !== null - ? this._displayFrame.displayData - : this._displayFrame.rawDisplayData; - if ( - displayData !== null && - displayData.type === 1 /* Armature */ - ) { - actions = displayData.actions; - } - if (actions !== null && actions.length > 0) { - for ( - var _i = 0, actions_1 = actions; - _i < actions_1.length; - _i++ - ) { - var action = actions_1[_i]; - var eventObject = dragonBones.BaseObject.borrowObject( - dragonBones.EventObject, - ); - dragonBones.EventObject.actionDataToInstance( - action, - eventObject, - this._armature, - ); - eventObject.slot = this; - this._armature._bufferAction(eventObject, false); - } - } else { - this._childArmature.animation.play(); - } - } - } - } - } - }; - Slot.prototype._updateGlobalTransformMatrix = function(isCache) { - var parentMatrix = - this._parent._boneData.type === 0 /* Bone */ - ? this._parent.globalTransformMatrix - : this._parent._getGlobalTransformMatrix( - this.global.x, - this.global.y, - ); - this.globalTransformMatrix.copyFrom(this._localMatrix); - this.globalTransformMatrix.concat(parentMatrix); - if (isCache) { - this.global.fromMatrix(this.globalTransformMatrix); - } else { - this._globalDirty = true; - } - }; - /** - * @internal - */ - Slot.prototype._setDisplayIndex = function(value, isAnimation) { - if (isAnimation === void 0) { - isAnimation = false; - } - if (isAnimation) { - if (this._animationDisplayIndex === value) { - return; - } - this._animationDisplayIndex = value; - } - if (this._displayIndex === value) { - return; - } - this._displayIndex = - value < this._displayFrames.length - ? value - : this._displayFrames.length - 1; - this._displayDataDirty = true; - this._displayDirty = - this._displayIndex < 0 || - this._display !== this._displayFrames[this._displayIndex].display; - }; - /** - * @internal - */ - Slot.prototype._setZOrder = function(value) { - if (this._zOrder === value) ; - this._zOrder = value; - this._zOrderDirty = true; - return this._zOrderDirty; - }; - /** - * @internal - */ - Slot.prototype._setColor = function(value) { - this._colorTransform.copyFrom(value); - return (this._colorDirty = true); - }; - /** - * @internal - */ - Slot.prototype.init = function( - slotData, - armatureValue, - rawDisplay, - meshDisplay, - ) { - if (this._slotData !== null) { - return; - } - this._slotData = slotData; - this._colorDirty = true; // - this._blendModeDirty = true; // - this._blendMode = this._slotData.blendMode; - this._zOrder = this._slotData.zOrder; - this._zIndex = this._slotData.zIndex; - this._alpha = this._slotData.alpha; - this._colorTransform.copyFrom(this._slotData.color); - this._rawDisplay = rawDisplay; - this._meshDisplay = meshDisplay; - // - this._armature = armatureValue; - var slotParent = this._armature.getBone(this._slotData.parent.name); - if (slotParent !== null) { - this._parent = slotParent; - } - this._armature._addSlot(this); - // - this._initDisplay(this._rawDisplay, false); - if (this._rawDisplay !== this._meshDisplay) { - this._initDisplay(this._meshDisplay, false); - } - this._onUpdateDisplay(); - this._addDisplay(); - }; - /** - * @internal - */ - Slot.prototype.update = function(cacheFrameIndex) { - if (this._displayDataDirty) { - this._updateDisplayData(); - this._displayDataDirty = false; - } - if (this._displayDirty) { - this._updateDisplay(); - this._displayDirty = false; - } - if (this._geometryDirty || this._textureDirty) { - if ( - this._display === null || - this._display === this._rawDisplay || - this._display === this._meshDisplay - ) { - this._updateFrame(); - } - this._geometryDirty = false; - this._textureDirty = false; - } - if (this._display === null) { - return; - } - if (this._visibleDirty) { - this._updateVisible(); - this._visibleDirty = false; - } - if (this._blendModeDirty) { - this._updateBlendMode(); - this._blendModeDirty = false; - } - if (this._colorDirty) { - this._updateColor(); - this._colorDirty = false; - } - if (this._zOrderDirty) { - this._updateZOrder(); - this._zOrderDirty = false; - } - if (this._geometryData !== null && this._display === this._meshDisplay) { - var isSkinned = this._geometryData.weight !== null; - var isSurface = this._parent._boneData.type !== 0; /* Bone */ - if ( - this._verticesDirty || - (isSkinned && this._isBonesUpdate()) || - (isSurface && this._parent._childrenTransformDirty) - ) { - this._updateMesh(); - this._verticesDirty = false; - } - if (isSkinned || isSurface) { - return; - } - } - if (cacheFrameIndex >= 0 && this._cachedFrameIndices !== null) { - var cachedFrameIndex = this._cachedFrameIndices[cacheFrameIndex]; - if ( - cachedFrameIndex >= 0 && - this._cachedFrameIndex === cachedFrameIndex - ) { - this._transformDirty = false; - } else if (cachedFrameIndex >= 0) { - this._transformDirty = true; - this._cachedFrameIndex = cachedFrameIndex; - } else if ( - this._transformDirty || - this._parent._childrenTransformDirty - ) { - this._transformDirty = true; - this._cachedFrameIndex = -1; - } else if (this._cachedFrameIndex >= 0) { - this._transformDirty = false; - this._cachedFrameIndices[cacheFrameIndex] = this._cachedFrameIndex; - } else { - this._transformDirty = true; - this._cachedFrameIndex = -1; - } - } else if (this._transformDirty || this._parent._childrenTransformDirty) { - cacheFrameIndex = -1; - this._transformDirty = true; - this._cachedFrameIndex = -1; - } - if (this._transformDirty) { - if (this._cachedFrameIndex < 0) { - var isCache = cacheFrameIndex >= 0; - this._updateGlobalTransformMatrix(isCache); - if (isCache && this._cachedFrameIndices !== null) { - this._cachedFrameIndex = this._cachedFrameIndices[ - cacheFrameIndex - ] = this._armature._armatureData.setCacheFrame( - this.globalTransformMatrix, - this.global, - ); - } - } else { - this._armature._armatureData.getCacheFrame( - this.globalTransformMatrix, - this.global, - this._cachedFrameIndex, - ); - } - this._updateTransform(); - this._transformDirty = false; - } - }; - /** - * - Forces the slot to update the state of the display object in the next frame. - * @version DragonBones 4.5 - * @language en_US - */ - /** - * - 强制插槽在下一帧更新显示对象的状态。 - * @version DragonBones 4.5 - * @language zh_CN - */ - Slot.prototype.invalidUpdate = function() { - this._displayDataDirty = true; - this._displayDirty = true; - // - this._transformDirty = true; - }; - /** - * @private - */ - Slot.prototype.updateTransformAndMatrix = function() { - if (this._transformDirty) { - this._updateGlobalTransformMatrix(false); - this._transformDirty = false; - } - }; - /** - * @private - */ - Slot.prototype.replaceRawDisplayData = function(displayData, index) { - if (index === void 0) { - index = -1; - } - if (index < 0) { - index = this._displayIndex < 0 ? 0 : this._displayIndex; - } else if (index >= this._displayFrames.length) { - return; - } - var displayFrame = this._displayFrames[index]; - if (displayFrame.rawDisplayData !== displayData) { - displayFrame.deformVertices.length = 0; - displayFrame.rawDisplayData = displayData; - if (displayFrame.rawDisplayData === null) { - var defaultSkin = this._armature._armatureData.defaultSkin; - if (defaultSkin !== null) { - var defaultRawDisplayDatas = defaultSkin.getDisplays( - this._slotData.name, - ); - if ( - defaultRawDisplayDatas !== null && - index < defaultRawDisplayDatas.length - ) { - displayFrame.rawDisplayData = defaultRawDisplayDatas[index]; - } - } - } - if (index === this._displayIndex) { - this._displayDataDirty = true; - } - } - }; - /** - * @private - */ - Slot.prototype.replaceDisplayData = function(displayData, index) { - if (index === void 0) { - index = -1; - } - if (index < 0) { - index = this._displayIndex < 0 ? 0 : this._displayIndex; - } else if (index >= this._displayFrames.length) { - return; - } - var displayFrame = this._displayFrames[index]; - if ( - displayFrame.displayData !== displayData && - displayFrame.rawDisplayData !== displayData - ) { - displayFrame.displayData = displayData; - if (index === this._displayIndex) { - this._displayDataDirty = true; - } - } - }; - /** - * @private - */ - Slot.prototype.replaceTextureData = function(textureData, index) { - if (index === void 0) { - index = -1; - } - if (index < 0) { - index = this._displayIndex < 0 ? 0 : this._displayIndex; - } else if (index >= this._displayFrames.length) { - return; - } - var displayFrame = this._displayFrames[index]; - if (displayFrame.textureData !== textureData) { - displayFrame.textureData = textureData; - if (index === this._displayIndex) { - this._displayDataDirty = true; - } - } - }; - /** - * @private - */ - Slot.prototype.replaceDisplay = function(value, index) { - if (index === void 0) { - index = -1; - } - if (index < 0) { - index = this._displayIndex < 0 ? 0 : this._displayIndex; - } else if (index >= this._displayFrames.length) { - return; - } - var displayFrame = this._displayFrames[index]; - if (displayFrame.display !== value) { - var prevDisplay = displayFrame.display; - displayFrame.display = value; - if ( - prevDisplay !== null && - prevDisplay !== this._rawDisplay && - prevDisplay !== this._meshDisplay && - !this._hasDisplay(prevDisplay) - ) { - if (prevDisplay instanceof dragonBones.Armature) ; else { - this._disposeDisplay(prevDisplay, true); - } - } - if ( - value !== null && - value !== this._rawDisplay && - value !== this._meshDisplay && - !this._hasDisplay(prevDisplay) && - !(value instanceof dragonBones.Armature) - ) { - this._initDisplay(value, true); - } - if (index === this._displayIndex) { - this._displayDirty = true; - } - } - }; - /** - * - Check whether a specific point is inside a custom bounding box in the slot. - * The coordinate system of the point is the inner coordinate system of the armature. - * Custom bounding boxes need to be customized in Dragonbones Pro. - * @param x - The horizontal coordinate of the point. - * @param y - The vertical coordinate of the point. - * @version DragonBones 5.0 - * @language en_US - */ - /** - * - 检查特定点是否在插槽的自定义边界框内。 - * 点的坐标系为骨架内坐标系。 - * 自定义边界框需要在 DragonBones Pro 中自定义。 - * @param x - 点的水平坐标。 - * @param y - 点的垂直坐标。 - * @version DragonBones 5.0 - * @language zh_CN - */ - Slot.prototype.containsPoint = function(x, y) { - if (this._boundingBoxData === null) { - return false; - } - this.updateTransformAndMatrix(); - Slot._helpMatrix.copyFrom(this.globalTransformMatrix); - Slot._helpMatrix.invert(); - Slot._helpMatrix.transformPoint(x, y, Slot._helpPoint); - return this._boundingBoxData.containsPoint( - Slot._helpPoint.x, - Slot._helpPoint.y, - ); - }; - /** - * - Check whether a specific segment intersects a custom bounding box for the slot. - * The coordinate system of the segment and intersection is the inner coordinate system of the armature. - * Custom bounding boxes need to be customized in Dragonbones Pro. - * @param xA - The horizontal coordinate of the beginning of the segment. - * @param yA - The vertical coordinate of the beginning of the segment. - * @param xB - The horizontal coordinate of the end point of the segment. - * @param yB - The vertical coordinate of the end point of the segment. - * @param intersectionPointA - The first intersection at which a line segment intersects the bounding box from the beginning to the end. (If not set, the intersection point will not calculated) - * @param intersectionPointB - The first intersection at which a line segment intersects the bounding box from the end to the beginning. (If not set, the intersection point will not calculated) - * @param normalRadians - The normal radians of the tangent of the intersection boundary box. [x: Normal radian of the first intersection tangent, y: Normal radian of the second intersection tangent] (If not set, the normal will not calculated) - * @returns Intersection situation. [1: Disjoint and segments within the bounding box, 0: Disjoint, 1: Intersecting and having a nodal point and ending in the bounding box, 2: Intersecting and having a nodal point and starting at the bounding box, 3: Intersecting and having two intersections, N: Intersecting and having N intersections] - * @version DragonBones 5.0 - * @language en_US - */ - /** - * - 检查特定线段是否与插槽的自定义边界框相交。 - * 线段和交点的坐标系均为骨架内坐标系。 - * 自定义边界框需要在 DragonBones Pro 中自定义。 - * @param xA - 线段起点的水平坐标。 - * @param yA - 线段起点的垂直坐标。 - * @param xB - 线段终点的水平坐标。 - * @param yB - 线段终点的垂直坐标。 - * @param intersectionPointA - 线段从起点到终点与边界框相交的第一个交点。 (如果未设置,则不计算交点) - * @param intersectionPointB - 线段从终点到起点与边界框相交的第一个交点。 (如果未设置,则不计算交点) - * @param normalRadians - 交点边界框切线的法线弧度。 [x: 第一个交点切线的法线弧度, y: 第二个交点切线的法线弧度] (如果未设置,则不计算法线) - * @returns 相交的情况。 [-1: 不相交且线段在包围盒内, 0: 不相交, 1: 相交且有一个交点且终点在包围盒内, 2: 相交且有一个交点且起点在包围盒内, 3: 相交且有两个交点, N: 相交且有 N 个交点] - * @version DragonBones 5.0 - * @language zh_CN - */ - Slot.prototype.intersectsSegment = function( - xA, - yA, - xB, - yB, - intersectionPointA, - intersectionPointB, - normalRadians, - ) { - if (intersectionPointA === void 0) { - intersectionPointA = null; - } - if (intersectionPointB === void 0) { - intersectionPointB = null; - } - if (normalRadians === void 0) { - normalRadians = null; - } - if (this._boundingBoxData === null) { - return 0; - } - this.updateTransformAndMatrix(); - Slot._helpMatrix.copyFrom(this.globalTransformMatrix); - Slot._helpMatrix.invert(); - Slot._helpMatrix.transformPoint(xA, yA, Slot._helpPoint); - xA = Slot._helpPoint.x; - yA = Slot._helpPoint.y; - Slot._helpMatrix.transformPoint(xB, yB, Slot._helpPoint); - xB = Slot._helpPoint.x; - yB = Slot._helpPoint.y; - var intersectionCount = this._boundingBoxData.intersectsSegment( - xA, - yA, - xB, - yB, - intersectionPointA, - intersectionPointB, - normalRadians, - ); - if (intersectionCount > 0) { - if (intersectionCount === 1 || intersectionCount === 2) { - if (intersectionPointA !== null) { - this.globalTransformMatrix.transformPoint( - intersectionPointA.x, - intersectionPointA.y, - intersectionPointA, - ); - if (intersectionPointB !== null) { - intersectionPointB.x = intersectionPointA.x; - intersectionPointB.y = intersectionPointA.y; - } - } else if (intersectionPointB !== null) { - this.globalTransformMatrix.transformPoint( - intersectionPointB.x, - intersectionPointB.y, - intersectionPointB, - ); - } - } else { - if (intersectionPointA !== null) { - this.globalTransformMatrix.transformPoint( - intersectionPointA.x, - intersectionPointA.y, - intersectionPointA, - ); - } - if (intersectionPointB !== null) { - this.globalTransformMatrix.transformPoint( - intersectionPointB.x, - intersectionPointB.y, - intersectionPointB, - ); - } - } - if (normalRadians !== null) { - this.globalTransformMatrix.transformPoint( - Math.cos(normalRadians.x), - Math.sin(normalRadians.x), - Slot._helpPoint, - true, - ); - normalRadians.x = Math.atan2(Slot._helpPoint.y, Slot._helpPoint.x); - this.globalTransformMatrix.transformPoint( - Math.cos(normalRadians.y), - Math.sin(normalRadians.y), - Slot._helpPoint, - true, - ); - normalRadians.y = Math.atan2(Slot._helpPoint.y, Slot._helpPoint.x); - } - } - return intersectionCount; - }; - /** - * @private - */ - Slot.prototype.getDisplayFrameAt = function(index) { - return this._displayFrames[index]; - }; - Object.defineProperty(Slot.prototype, 'visible', { - /** - * - The visible of slot's display object. - * @default true - * @version DragonBones 5.6 - * @language en_US - */ - /** - * - 插槽的显示对象的可见。 - * @default true - * @version DragonBones 5.6 - * @language zh_CN - */ - get: function() { - return this._visible; - }, - set: function(value) { - if (this._visible === value) { - return; - } - this._visible = value; - this._updateVisible(); - }, - enumerable: true, - configurable: true, - }); - Object.defineProperty(Slot.prototype, 'displayFrameCount', { - /** - * @private - */ - get: function() { - return this._displayFrames.length; - }, - set: function(value) { - var prevCount = this._displayFrames.length; - if (prevCount < value) { - this._displayFrames.length = value; - for (var i = prevCount; i < value; ++i) { - this._displayFrames[i] = dragonBones.BaseObject.borrowObject( - DisplayFrame, - ); - } - } else if (prevCount > value) { - for (var i = prevCount - 1; i < value; --i) { - this.replaceDisplay(null, i); - this._displayFrames[i].returnToPool(); - } - this._displayFrames.length = value; - } - }, - enumerable: true, - configurable: true, - }); - Object.defineProperty(Slot.prototype, 'displayIndex', { - /** - * - The index of the display object displayed in the display list. - * @example - *
-           *     let slot = armature.getSlot("weapon");
-           *     slot.displayIndex = 3;
-           *     slot.displayController = "none";
-           * 
- * @version DragonBones 4.5 - * @language en_US - */ - /** - * - 此时显示的显示对象在显示列表中的索引。 - * @example - *
-           *     let slot = armature.getSlot("weapon");
-           *     slot.displayIndex = 3;
-           *     slot.displayController = "none";
-           * 
- * @version DragonBones 4.5 - * @language zh_CN - */ - get: function() { - return this._displayIndex; - }, - set: function(value) { - this._setDisplayIndex(value); - this.update(-1); - }, - enumerable: true, - configurable: true, - }); - Object.defineProperty(Slot.prototype, 'name', { - /** - * - The slot name. - * @see dragonBones.SlotData#name - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 插槽名称。 - * @see dragonBones.SlotData#name - * @version DragonBones 3.0 - * @language zh_CN - */ - get: function() { - return this._slotData.name; - }, - enumerable: true, - configurable: true, - }); - Object.defineProperty(Slot.prototype, 'displayList', { - /** - * - Contains a display list of display objects or child armatures. - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 包含显示对象或子骨架的显示列表。 - * @version DragonBones 3.0 - * @language zh_CN - */ - get: function() { - var displays = new Array(); - for (var _i = 0, _a = this._displayFrames; _i < _a.length; _i++) { - var displayFrame = _a[_i]; - displays.push(displayFrame.display); - } - return displays; - }, - set: function(value) { - this.displayFrameCount = value.length; - var index = 0; - for (var _i = 0, value_1 = value; _i < value_1.length; _i++) { - var eachDisplay = value_1[_i]; - this.replaceDisplay(eachDisplay, index++); - } - }, - enumerable: true, - configurable: true, - }); - Object.defineProperty(Slot.prototype, 'slotData', { - /** - * - The slot data. - * @see dragonBones.SlotData - * @version DragonBones 4.5 - * @language en_US - */ - /** - * - 插槽数据。 - * @see dragonBones.SlotData - * @version DragonBones 4.5 - * @language zh_CN - */ - get: function() { - return this._slotData; - }, - enumerable: true, - configurable: true, - }); - Object.defineProperty(Slot.prototype, 'boundingBoxData', { - /** - * - The custom bounding box data for the slot at current time. - * @version DragonBones 5.0 - * @language en_US - */ - /** - * - 插槽此时的自定义包围盒数据。 - * @version DragonBones 5.0 - * @language zh_CN - */ - get: function() { - return this._boundingBoxData; - }, - enumerable: true, - configurable: true, - }); - Object.defineProperty(Slot.prototype, 'rawDisplay', { - /** - * @private - */ - get: function() { - return this._rawDisplay; - }, - enumerable: true, - configurable: true, - }); - Object.defineProperty(Slot.prototype, 'meshDisplay', { - /** - * @private - */ - get: function() { - return this._meshDisplay; - }, - enumerable: true, - configurable: true, - }); - Object.defineProperty(Slot.prototype, 'display', { - /** - * - The display object that the slot displays at this time. - * @example - *
-           *     let slot = armature.getSlot("text");
-           *     slot.display = new yourEngine.TextField();
-           * 
- * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 插槽此时显示的显示对象。 - * @example - *
-           *     let slot = armature.getSlot("text");
-           *     slot.display = new yourEngine.TextField();
-           * 
- * @version DragonBones 3.0 - * @language zh_CN - */ - get: function() { - return this._display; - }, - set: function(value) { - if (this._display === value) { - return; - } - if (this._displayFrames.length === 0) { - this.displayFrameCount = 1; - this._displayIndex = 0; - } - this.replaceDisplay(value, this._displayIndex); - }, - enumerable: true, - configurable: true, - }); - Object.defineProperty(Slot.prototype, 'childArmature', { - /** - * - The child armature that the slot displayed at current time. - * @example - *
-           *     let slot = armature.getSlot("weapon");
-           *     let prevChildArmature = slot.childArmature;
-           *     if (prevChildArmature) {
-           *         prevChildArmature.dispose();
-           *     }
-           *     slot.childArmature = factory.buildArmature("weapon_blabla", "weapon_blabla_project");
-           * 
- * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 插槽此时显示的子骨架。 - * 注意,被替换的对象或子骨架并不会被回收,根据语言和引擎的不同,需要额外处理。 - * @example - *
-           *     let slot = armature.getSlot("weapon");
-           *     let prevChildArmature = slot.childArmature;
-           *     if (prevChildArmature) {
-           *         prevChildArmature.dispose();
-           *     }
-           *     slot.childArmature = factory.buildArmature("weapon_blabla", "weapon_blabla_project");
-           * 
- * @version DragonBones 3.0 - * @language zh_CN - */ - get: function() { - return this._childArmature; - }, - set: function(value) { - if (this._childArmature === value) { - return; - } - this.display = value; - }, - enumerable: true, - configurable: true, - }); - Object.defineProperty(Slot.prototype, 'parent', { - /** - * - The parent bone to which it belongs. - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 所属的父骨骼。 - * @version DragonBones 3.0 - * @language zh_CN - */ - get: function() { - return this._parent; - }, - enumerable: true, - configurable: true, - }); - /** - * - Deprecated, please refer to {@link #display}. - * @deprecated - * @language en_US - */ - /** - * - 已废弃,请参考 {@link #display}。 - * @deprecated - * @language zh_CN - */ - Slot.prototype.getDisplay = function() { - return this._display; - }; - /** - * - Deprecated, please refer to {@link #display}. - * @deprecated - * @language en_US - */ - /** - * - 已废弃,请参考 {@link #display}。 - * @deprecated - * @language zh_CN - */ - Slot.prototype.setDisplay = function(value) { - this.display = value; - }; - return Slot; - })(dragonBones.TransformObject); - dragonBones.Slot = Slot; - })(dragonBones || (dragonBones = {})); - /** - * The MIT License (MIT) - * - * Copyright (c) 2012-2018 DragonBones team and other contributors - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of - * the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR - * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - (function(dragonBones) { - /** - * @internal - */ - var Constraint = /** @class */ (function(_super) { - __extends(Constraint, _super); - function Constraint() { - return (_super !== null && _super.apply(this, arguments)) || this; - } - Constraint.prototype._onClear = function() { - this._armature = null; // - this._target = null; // - this._root = null; // - this._bone = null; - }; - Object.defineProperty(Constraint.prototype, 'name', { - get: function() { - return this._constraintData.name; - }, - enumerable: true, - configurable: true, - }); - Constraint._helpMatrix = new dragonBones.Matrix(); - Constraint._helpTransform = new dragonBones.Transform(); - Constraint._helpPoint = new dragonBones.Point(); - return Constraint; - })(dragonBones.BaseObject); - dragonBones.Constraint = Constraint; - /** - * @internal - */ - var IKConstraint = /** @class */ (function(_super) { - __extends(IKConstraint, _super); - function IKConstraint() { - return (_super !== null && _super.apply(this, arguments)) || this; - } - IKConstraint.toString = function() { - return '[class dragonBones.IKConstraint]'; - }; - IKConstraint.prototype._onClear = function() { - _super.prototype._onClear.call(this); - this._scaleEnabled = false; - this._bendPositive = false; - this._weight = 1.0; - this._constraintData = null; - }; - IKConstraint.prototype._computeA = function() { - var ikGlobal = this._target.global; - var global = this._root.global; - var globalTransformMatrix = this._root.globalTransformMatrix; - var radian = Math.atan2(ikGlobal.y - global.y, ikGlobal.x - global.x); - if (global.scaleX < 0.0) { - radian += Math.PI; - } - global.rotation += - dragonBones.Transform.normalizeRadian(radian - global.rotation) * - this._weight; - global.toMatrix(globalTransformMatrix); - }; - IKConstraint.prototype._computeB = function() { - var boneLength = this._bone._boneData.length; - var parent = this._root; - var ikGlobal = this._target.global; - var parentGlobal = parent.global; - var global = this._bone.global; - var globalTransformMatrix = this._bone.globalTransformMatrix; - var x = globalTransformMatrix.a * boneLength; - var y = globalTransformMatrix.b * boneLength; - var lLL = x * x + y * y; - var lL = Math.sqrt(lLL); - var dX = global.x - parentGlobal.x; - var dY = global.y - parentGlobal.y; - var lPP = dX * dX + dY * dY; - var lP = Math.sqrt(lPP); - var rawRadian = global.rotation; - var rawParentRadian = parentGlobal.rotation; - var rawRadianA = Math.atan2(dY, dX); - dX = ikGlobal.x - parentGlobal.x; - dY = ikGlobal.y - parentGlobal.y; - var lTT = dX * dX + dY * dY; - var lT = Math.sqrt(lTT); - var radianA = 0.0; - if (lL + lP <= lT || lT + lL <= lP || lT + lP <= lL) { - radianA = Math.atan2( - ikGlobal.y - parentGlobal.y, - ikGlobal.x - parentGlobal.x, - ); - if (lL + lP <= lT) ; else if (lP < lL) { - radianA += Math.PI; - } - } else { - var h = (lPP - lLL + lTT) / (2.0 * lTT); - var r = Math.sqrt(lPP - h * h * lTT) / lT; - var hX = parentGlobal.x + dX * h; - var hY = parentGlobal.y + dY * h; - var rX = -dY * r; - var rY = dX * r; - var isPPR = false; - var parentParent = parent.parent; - if (parentParent !== null) { - var parentParentMatrix = parentParent.globalTransformMatrix; - isPPR = - parentParentMatrix.a * parentParentMatrix.d - - parentParentMatrix.b * parentParentMatrix.c < - 0.0; - } - if (isPPR !== this._bendPositive) { - global.x = hX - rX; - global.y = hY - rY; - } else { - global.x = hX + rX; - global.y = hY + rY; - } - radianA = Math.atan2( - global.y - parentGlobal.y, - global.x - parentGlobal.x, - ); - } - var dR = dragonBones.Transform.normalizeRadian(radianA - rawRadianA); - parentGlobal.rotation = rawParentRadian + dR * this._weight; - parentGlobal.toMatrix(parent.globalTransformMatrix); - // - var currentRadianA = rawRadianA + dR * this._weight; - global.x = parentGlobal.x + Math.cos(currentRadianA) * lP; - global.y = parentGlobal.y + Math.sin(currentRadianA) * lP; - // - var radianB = Math.atan2(ikGlobal.y - global.y, ikGlobal.x - global.x); - if (global.scaleX < 0.0) { - radianB += Math.PI; - } - global.rotation = - parentGlobal.rotation + - rawRadian - - rawParentRadian + - dragonBones.Transform.normalizeRadian(radianB - dR - rawRadian) * - this._weight; - global.toMatrix(globalTransformMatrix); - }; - IKConstraint.prototype.init = function(constraintData, armature) { - if (this._constraintData !== null) { - return; - } - this._constraintData = constraintData; - this._armature = armature; - this._target = this._armature.getBone(this._constraintData.target.name); - this._root = this._armature.getBone(this._constraintData.root.name); - this._bone = - this._constraintData.bone !== null - ? this._armature.getBone(this._constraintData.bone.name) - : null; - { - var ikConstraintData = this._constraintData; - this._scaleEnabled = ikConstraintData.scaleEnabled; - this._bendPositive = ikConstraintData.bendPositive; - this._weight = ikConstraintData.weight; - } - this._root._hasConstraint = true; - }; - IKConstraint.prototype.update = function() { - this._root.updateByConstraint(); - if (this._bone !== null) { - this._bone.updateByConstraint(); - this._computeB(); - } else { - this._computeA(); - } - }; - IKConstraint.prototype.invalidUpdate = function() { - this._root.invalidUpdate(); - if (this._bone !== null) { - this._bone.invalidUpdate(); - } - }; - return IKConstraint; - })(Constraint); - dragonBones.IKConstraint = IKConstraint; - /** - * @internal - */ - var PathConstraint = /** @class */ (function(_super) { - __extends(PathConstraint, _super); - function PathConstraint() { - var _this = (_super !== null && _super.apply(this, arguments)) || this; - _this._bones = []; - _this._spaces = []; - _this._positions = []; - _this._curves = []; - _this._boneLengths = []; - _this._pathGlobalVertices = []; - _this._segments = [10]; - return _this; - } - PathConstraint.toString = function() { - return '[class dragonBones.PathConstraint]'; - }; - PathConstraint.prototype._onClear = function() { - _super.prototype._onClear.call(this); - this.dirty = false; - this.pathOffset = 0; - this.position = 0.0; - this.spacing = 0.0; - this.rotateOffset = 0.0; - this.rotateMix = 1.0; - this.translateMix = 1.0; - this._pathSlot = null; - this._bones.length = 0; - this._spaces.length = 0; - this._positions.length = 0; - this._curves.length = 0; - this._boneLengths.length = 0; - this._pathGlobalVertices.length = 0; - }; - PathConstraint.prototype._updatePathVertices = function(verticesData) { - //计算曲线的节点数据 - var armature = this._armature; - var dragonBonesData = armature.armatureData.parent; - var scale = armature.armatureData.scale; - var intArray = dragonBonesData.intArray; - var floatArray = dragonBonesData.floatArray; - var pathOffset = verticesData.offset; - var pathVertexCount = intArray[pathOffset + 0 /* GeometryVertexCount */]; - var pathVertexOffset = intArray[pathOffset + 2 /* GeometryFloatOffset */]; - this._pathGlobalVertices.length = pathVertexCount * 2; - var weightData = verticesData.weight; - //没有骨骼约束我,那节点只受自己的Bone控制 - if (weightData === null) { - var parentBone = this._pathSlot.parent; - parentBone.updateByConstraint(); - var matrix = parentBone.globalTransformMatrix; - for (var i = 0, iV_1 = pathVertexOffset; i < pathVertexCount; i += 2) { - var vx = floatArray[iV_1++] * scale; - var vy = floatArray[iV_1++] * scale; - var x = matrix.a * vx + matrix.c * vy + matrix.tx; - var y = matrix.b * vx + matrix.d * vy + matrix.ty; - // - this._pathGlobalVertices[i] = x; - this._pathGlobalVertices[i + 1] = y; - } - return; - } - //有骨骼约束我,那我的节点受骨骼权重控制 - var bones = this._pathSlot._geometryBones; - var weightBoneCount = weightData.bones.length; - var weightOffset = weightData.offset; - var floatOffset = intArray[weightOffset + 1 /* WeigthFloatOffset */]; - var iV = floatOffset; - var iB = weightOffset + 2 /* WeigthBoneIndices */ + weightBoneCount; - for (var i = 0, iW = 0; i < pathVertexCount; i++) { - var vertexBoneCount = intArray[iB++]; // - var xG = 0.0, - yG = 0.0; - for (var ii = 0, ll = vertexBoneCount; ii < ll; ii++) { - var boneIndex = intArray[iB++]; - var bone = bones[boneIndex]; - if (bone === null) { - continue; - } - bone.updateByConstraint(); - var matrix = bone.globalTransformMatrix; - var weight = floatArray[iV++]; - var vx = floatArray[iV++] * scale; - var vy = floatArray[iV++] * scale; - xG += (matrix.a * vx + matrix.c * vy + matrix.tx) * weight; - yG += (matrix.b * vx + matrix.d * vy + matrix.ty) * weight; - } - this._pathGlobalVertices[iW++] = xG; - this._pathGlobalVertices[iW++] = yG; - } - }; - PathConstraint.prototype._computeVertices = function( - start, - count, - offset, - out, - ) { - //TODO优化 - for (var i = offset, iW = start; i < count; i += 2) { - out[i] = this._pathGlobalVertices[iW++]; - out[i + 1] = this._pathGlobalVertices[iW++]; - } - }; - PathConstraint.prototype._computeBezierCurve = function( - pathDisplayDta, - spaceCount, - tangents, - percentPosition, - percentSpacing, - ) { - //计算当前的骨骼在曲线上的位置 - var armature = this._armature; - var intArray = armature.armatureData.parent.intArray; - var vertexCount = - intArray[pathDisplayDta.geometry.offset + 0 /* GeometryVertexCount */]; - var positions = this._positions; - var spaces = this._spaces; - var isClosed = pathDisplayDta.closed; - var curveVertices = Array(); - var verticesLength = vertexCount * 2; - var curveCount = verticesLength / 6; - var preCurve = -1; - var position = this.position; - positions.length = spaceCount * 3 + 2; - var pathLength = 0.0; - //不需要匀速运动,效率高些 - if (!pathDisplayDta.constantSpeed) { - var lenghts = pathDisplayDta.curveLengths; - curveCount -= isClosed ? 1 : 2; - pathLength = lenghts[curveCount]; - if (percentPosition) { - position *= pathLength; - } - if (percentSpacing) { - for (var i = 0; i < spaceCount; i++) { - spaces[i] *= pathLength; - } - } - curveVertices.length = 8; - for (var i = 0, o = 0, curve = 0; i < spaceCount; i++, o += 3) { - var space = spaces[i]; - position += space; - if (isClosed) { - position %= pathLength; - if (position < 0) { - position += pathLength; - } - curve = 0; - } else if (position < 0) { - //TODO - continue; - } else if (position > pathLength) { - //TODO - continue; - } - var percent = 0.0; - for (; ; curve++) { - var len = lenghts[curve]; - if (position > len) { - continue; - } - if (curve === 0) { - percent = position / len; - } else { - var preLen = lenghts[curve - 1]; - percent = (position - preLen) / (len - preLen); - } - break; - } - if (curve !== preCurve) { - preCurve = curve; - if (isClosed && curve === curveCount) { - //计算曲线 - this._computeVertices(verticesLength - 4, 4, 0, curveVertices); - this._computeVertices(0, 4, 4, curveVertices); - } else { - this._computeVertices(curve * 6 + 2, 8, 0, curveVertices); - } - } - // - this.addCurvePosition( - percent, - curveVertices[0], - curveVertices[1], - curveVertices[2], - curveVertices[3], - curveVertices[4], - curveVertices[5], - curveVertices[6], - curveVertices[7], - positions, - o, - tangents, - ); - } - return; - } - //匀速的 - if (isClosed) { - verticesLength += 2; - curveVertices.length = vertexCount; - this._computeVertices(2, verticesLength - 4, 0, curveVertices); - this._computeVertices(0, 2, verticesLength - 4, curveVertices); - curveVertices[verticesLength - 2] = curveVertices[0]; - curveVertices[verticesLength - 1] = curveVertices[1]; - } else { - curveCount--; - verticesLength -= 4; - curveVertices.length = verticesLength; - this._computeVertices(2, verticesLength, 0, curveVertices); - } - // - var curves = new Array(curveCount); - pathLength = 0; - var x1 = curveVertices[0], - y1 = curveVertices[1], - cx1 = 0, - cy1 = 0, - cx2 = 0, - cy2 = 0, - x2 = 0, - y2 = 0; - var tmpx, tmpy, dddfx, dddfy, ddfx, ddfy, dfx, dfy; - for (var i = 0, w = 2; i < curveCount; i++, w += 6) { - cx1 = curveVertices[w]; - cy1 = curveVertices[w + 1]; - cx2 = curveVertices[w + 2]; - cy2 = curveVertices[w + 3]; - x2 = curveVertices[w + 4]; - y2 = curveVertices[w + 5]; - tmpx = (x1 - cx1 * 2 + cx2) * 0.1875; - tmpy = (y1 - cy1 * 2 + cy2) * 0.1875; - dddfx = ((cx1 - cx2) * 3 - x1 + x2) * 0.09375; - dddfy = ((cy1 - cy2) * 3 - y1 + y2) * 0.09375; - ddfx = tmpx * 2 + dddfx; - ddfy = tmpy * 2 + dddfy; - dfx = (cx1 - x1) * 0.75 + tmpx + dddfx * 0.16666667; - dfy = (cy1 - y1) * 0.75 + tmpy + dddfy * 0.16666667; - pathLength += Math.sqrt(dfx * dfx + dfy * dfy); - dfx += ddfx; - dfy += ddfy; - ddfx += dddfx; - ddfy += dddfy; - pathLength += Math.sqrt(dfx * dfx + dfy * dfy); - dfx += ddfx; - dfy += ddfy; - pathLength += Math.sqrt(dfx * dfx + dfy * dfy); - dfx += ddfx + dddfx; - dfy += ddfy + dddfy; - pathLength += Math.sqrt(dfx * dfx + dfy * dfy); - curves[i] = pathLength; - x1 = x2; - y1 = y2; - } - if (percentPosition) { - position *= pathLength; - } - if (percentSpacing) { - for (var i = 0; i < spaceCount; i++) { - spaces[i] *= pathLength; - } - } - var segments = this._segments; - var curveLength = 0; - for ( - var i = 0, o = 0, curve = 0, segment = 0; - i < spaceCount; - i++, o += 3 - ) { - var space = spaces[i]; - position += space; - var p = position; - if (isClosed) { - p %= pathLength; - if (p < 0) p += pathLength; - curve = 0; - } else if (p < 0) { - continue; - } else if (p > pathLength) { - continue; - } - // Determine curve containing position. - for (; ; curve++) { - var length_1 = curves[curve]; - if (p > length_1) continue; - if (curve === 0) p /= length_1; - else { - var prev = curves[curve - 1]; - p = (p - prev) / (length_1 - prev); - } - break; - } - if (curve !== preCurve) { - preCurve = curve; - var ii = curve * 6; - x1 = curveVertices[ii]; - y1 = curveVertices[ii + 1]; - cx1 = curveVertices[ii + 2]; - cy1 = curveVertices[ii + 3]; - cx2 = curveVertices[ii + 4]; - cy2 = curveVertices[ii + 5]; - x2 = curveVertices[ii + 6]; - y2 = curveVertices[ii + 7]; - tmpx = (x1 - cx1 * 2 + cx2) * 0.03; - tmpy = (y1 - cy1 * 2 + cy2) * 0.03; - dddfx = ((cx1 - cx2) * 3 - x1 + x2) * 0.006; - dddfy = ((cy1 - cy2) * 3 - y1 + y2) * 0.006; - ddfx = tmpx * 2 + dddfx; - ddfy = tmpy * 2 + dddfy; - dfx = (cx1 - x1) * 0.3 + tmpx + dddfx * 0.16666667; - dfy = (cy1 - y1) * 0.3 + tmpy + dddfy * 0.16666667; - curveLength = Math.sqrt(dfx * dfx + dfy * dfy); - segments[0] = curveLength; - for (ii = 1; ii < 8; ii++) { - dfx += ddfx; - dfy += ddfy; - ddfx += dddfx; - ddfy += dddfy; - curveLength += Math.sqrt(dfx * dfx + dfy * dfy); - segments[ii] = curveLength; - } - dfx += ddfx; - dfy += ddfy; - curveLength += Math.sqrt(dfx * dfx + dfy * dfy); - segments[8] = curveLength; - dfx += ddfx + dddfx; - dfy += ddfy + dddfy; - curveLength += Math.sqrt(dfx * dfx + dfy * dfy); - segments[9] = curveLength; - segment = 0; - } - // Weight by segment length. - p *= curveLength; - for (; ; segment++) { - var length_2 = segments[segment]; - if (p > length_2) continue; - if (segment === 0) p /= length_2; - else { - var prev = segments[segment - 1]; - p = segment + (p - prev) / (length_2 - prev); - } - break; - } - this.addCurvePosition( - p * 0.1, - x1, - y1, - cx1, - cy1, - cx2, - cy2, - x2, - y2, - positions, - o, - tangents, - ); - } - }; - //Calculates a point on the curve, for a given t value between 0 and 1. - PathConstraint.prototype.addCurvePosition = function( - t, - x1, - y1, - cx1, - cy1, - cx2, - cy2, - x2, - y2, - out, - offset, - tangents, - ) { - if (t === 0) { - out[offset] = x1; - out[offset + 1] = y1; - out[offset + 2] = 0; - return; - } - if (t === 1) { - out[offset] = x2; - out[offset + 1] = y2; - out[offset + 2] = 0; - return; - } - var mt = 1 - t; - var mt2 = mt * mt; - var t2 = t * t; - var a = mt2 * mt; - var b = mt2 * t * 3; - var c = mt * t2 * 3; - var d = t * t2; - var x = a * x1 + b * cx1 + c * cx2 + d * x2; - var y = a * y1 + b * cy1 + c * cy2 + d * y2; - out[offset] = x; - out[offset + 1] = y; - if (tangents) { - //Calculates the curve tangent at the specified t value - out[offset + 2] = Math.atan2( - y - (a * y1 + b * cy1 + c * cy2), - x - (a * x1 + b * cx1 + c * cx2), - ); - } else { - out[offset + 2] = 0; - } - }; - PathConstraint.prototype.init = function(constraintData, armature) { - this._constraintData = constraintData; - this._armature = armature; - var data = constraintData; - this.pathOffset = data.pathDisplayData.geometry.offset; - // - this.position = data.position; - this.spacing = data.spacing; - this.rotateOffset = data.rotateOffset; - this.rotateMix = data.rotateMix; - this.translateMix = data.translateMix; - // - this._root = this._armature.getBone(data.root.name); - this._target = this._armature.getBone(data.target.name); - this._pathSlot = this._armature.getSlot(data.pathSlot.name); - for (var i = 0, l = data.bones.length; i < l; i++) { - var bone = this._armature.getBone(data.bones[i].name); - if (bone !== null) { - this._bones.push(bone); - } - } - if (data.rotateMode === 2 /* ChainScale */) { - this._boneLengths.length = this._bones.length; - } - this._root._hasConstraint = true; - }; - PathConstraint.prototype.update = function() { - var pathSlot = this._pathSlot; - if ( - pathSlot._geometryData === null || - pathSlot._geometryData.offset !== this.pathOffset - ) { - return; - } - var constraintData = this._constraintData; - // - //曲线节点数据改变:父亲bone改变,权重bones改变,变形顶点改变 - var isPathVerticeDirty = false; - if (this._root._childrenTransformDirty) { - this._updatePathVertices(pathSlot._geometryData); - isPathVerticeDirty = true; - } else if (pathSlot._verticesDirty || pathSlot._isBonesUpdate()) { - this._updatePathVertices(pathSlot._geometryData); - pathSlot._verticesDirty = false; - isPathVerticeDirty = true; - } - if (!isPathVerticeDirty && !this.dirty) { - return; - } - // - var positionMode = constraintData.positionMode; - var spacingMode = constraintData.spacingMode; - var rotateMode = constraintData.rotateMode; - var bones = this._bones; - var isLengthMode = spacingMode === 0; /* Length */ - var isChainScaleMode = rotateMode === 2; /* ChainScale */ - var isTangentMode = rotateMode === 0; /* Tangent */ - var boneCount = bones.length; - var spacesCount = isTangentMode ? boneCount : boneCount + 1; - var spacing = this.spacing; - var spaces = this._spaces; - spaces.length = spacesCount; - //计曲线间隔和长度 - if (isChainScaleMode || isLengthMode) { - //Bone改变和spacing改变触发 - spaces[0] = 0; - for (var i = 0, l = spacesCount - 1; i < l; i++) { - var bone = bones[i]; - bone.updateByConstraint(); - var boneLength = bone._boneData.length; - var matrix = bone.globalTransformMatrix; - var x = boneLength * matrix.a; - var y = boneLength * matrix.b; - var len = Math.sqrt(x * x + y * y); - if (isChainScaleMode) { - this._boneLengths[i] = len; - } - spaces[i + 1] = ((boneLength + spacing) * len) / boneLength; - } - } else { - for (var i = 0; i < spacesCount; i++) { - spaces[i] = spacing; - } - } - // - this._computeBezierCurve( - pathSlot._displayFrame.rawDisplayData, - spacesCount, - isTangentMode, - positionMode === 1 /* Percent */, - spacingMode === 2 /* Percent */, - ); - //根据新的节点数据重新采样 - var positions = this._positions; - var rotateOffset = this.rotateOffset; - var boneX = positions[0], - boneY = positions[1]; - var tip; - if (rotateOffset === 0) { - tip = rotateMode === 1 /* Chain */; - } else { - tip = false; - var bone = pathSlot.parent; - if (bone !== null) { - var matrix = bone.globalTransformMatrix; - rotateOffset *= - matrix.a * matrix.d - matrix.b * matrix.c > 0 - ? dragonBones.Transform.DEG_RAD - : -dragonBones.Transform.DEG_RAD; - } - } - // - var rotateMix = this.rotateMix; - var translateMix = this.translateMix; - for (var i = 0, p = 3; i < boneCount; i++, p += 3) { - var bone = bones[i]; - bone.updateByConstraint(); - var matrix = bone.globalTransformMatrix; - matrix.tx += (boneX - matrix.tx) * translateMix; - matrix.ty += (boneY - matrix.ty) * translateMix; - var x = positions[p], - y = positions[p + 1]; - var dx = x - boneX, - dy = y - boneY; - if (isChainScaleMode) { - var lenght = this._boneLengths[i]; - var s = (Math.sqrt(dx * dx + dy * dy) / lenght - 1) * rotateMix + 1; - matrix.a *= s; - matrix.b *= s; - } - boneX = x; - boneY = y; - if (rotateMix > 0) { - var a = matrix.a, - b = matrix.b, - c = matrix.c, - d = matrix.d, - r = void 0, - cos = void 0, - sin = void 0; - if (isTangentMode) { - r = positions[p - 1]; - } else { - r = Math.atan2(dy, dx); - } - r -= Math.atan2(b, a); - if (tip) { - cos = Math.cos(r); - sin = Math.sin(r); - var length_3 = bone._boneData.length; - boneX += (length_3 * (cos * a - sin * b) - dx) * rotateMix; - boneY += (length_3 * (sin * a + cos * b) - dy) * rotateMix; - } else { - r += rotateOffset; - } - if (r > dragonBones.Transform.PI) { - r -= dragonBones.Transform.PI_D; - } else if (r < -dragonBones.Transform.PI) { - r += dragonBones.Transform.PI_D; - } - r *= rotateMix; - cos = Math.cos(r); - sin = Math.sin(r); - matrix.a = cos * a - sin * b; - matrix.b = sin * a + cos * b; - matrix.c = cos * c - sin * d; - matrix.d = sin * c + cos * d; - } - bone.global.fromMatrix(matrix); - } - this.dirty = false; - }; - PathConstraint.prototype.invalidUpdate = function() {}; - return PathConstraint; - })(Constraint); - dragonBones.PathConstraint = PathConstraint; - })(dragonBones || (dragonBones = {})); - /** - * The MIT License (MIT) - * - * Copyright (c) 2012-2018 DragonBones team and other contributors - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of - * the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR - * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - (function(dragonBones) { - /** - * - Worldclock provides clock support for animations, advance time for each IAnimatable object added to the instance. - * @see dragonBones.IAnimateble - * @see dragonBones.Armature - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - WorldClock 对动画提供时钟支持,为每个加入到该实例的 IAnimatable 对象更新时间。 - * @see dragonBones.IAnimateble - * @see dragonBones.Armature - * @version DragonBones 3.0 - * @language zh_CN - */ - var WorldClock = /** @class */ (function() { - /** - * - Creating a Worldclock instance. Typically, you do not need to create Worldclock instance. - * When multiple Worldclock instances are running at different speeds, can achieving some specific animation effects, such as bullet time. - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 创建一个 WorldClock 实例。通常并不需要创建 WorldClock 实例。 - * 当多个 WorldClock 实例使用不同的速度运行时,可以实现一些特殊的动画效果,比如子弹时间等。 - * @version DragonBones 3.0 - * @language zh_CN - */ - function WorldClock(time) { - if (time === void 0) { - time = 0.0; - } - /** - * - Current time. (In seconds) - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 当前的时间。 (以秒为单位) - * @version DragonBones 3.0 - * @language zh_CN - */ - this.time = 0.0; - /** - * - The play speed, used to control animation speed-shift play. - * [0: Stop play, (0~1): Slow play, 1: Normal play, (1~N): Fast play] - * @default 1.0 - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 播放速度,用于控制动画变速播放。 - * [0: 停止播放, (0~1): 慢速播放, 1: 正常播放, (1~N): 快速播放] - * @default 1.0 - * @version DragonBones 3.0 - * @language zh_CN - */ - this.timeScale = 1.0; - this._systemTime = 0.0; - this._animatebles = []; - this._clock = null; - this.time = time; - this._systemTime = new Date().getTime() * 0.001; - } - /** - * - Advance time for all IAnimatable instances. - * @param passedTime - Passed time. [-1: Automatically calculates the time difference between the current frame and the previous frame, [0~N): Passed time] (In seconds) - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 为所有的 IAnimatable 实例更新时间。 - * @param passedTime - 前进的时间。 [-1: 自动计算当前帧与上一帧的时间差, [0~N): 前进的时间] (以秒为单位) - * @version DragonBones 3.0 - * @language zh_CN - */ - WorldClock.prototype.advanceTime = function(passedTime) { - if (passedTime !== passedTime) { - passedTime = 0.0; - } - var currentTime = Date.now() * 0.001; - if (passedTime < 0.0) { - passedTime = currentTime - this._systemTime; - } - this._systemTime = currentTime; - if (this.timeScale !== 1.0) { - passedTime *= this.timeScale; - } - if (passedTime === 0.0) { - return; - } - if (passedTime < 0.0) { - this.time -= passedTime; - } else { - this.time += passedTime; - } - var i = 0, - r = 0, - l = this._animatebles.length; - for (; i < l; ++i) { - var animatable = this._animatebles[i]; - if (animatable !== null) { - if (r > 0) { - this._animatebles[i - r] = animatable; - this._animatebles[i] = null; - } - animatable.advanceTime(passedTime); - } else { - r++; - } - } - if (r > 0) { - l = this._animatebles.length; - for (; i < l; ++i) { - var animateble = this._animatebles[i]; - if (animateble !== null) { - this._animatebles[i - r] = animateble; - } else { - r++; - } - } - this._animatebles.length -= r; - } - }; - /** - * - Check whether contains a specific instance of IAnimatable. - * @param value - The IAnimatable instance. - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 检查是否包含特定的 IAnimatable 实例。 - * @param value - IAnimatable 实例。 - * @version DragonBones 3.0 - * @language zh_CN - */ - WorldClock.prototype.contains = function(value) { - if (value === this) { - return false; - } - var ancestor = value; - while (ancestor !== this && ancestor !== null) { - ancestor = ancestor.clock; - } - return ancestor === this; - }; - /** - * - Add IAnimatable instance. - * @param value - The IAnimatable instance. - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 添加 IAnimatable 实例。 - * @param value - IAnimatable 实例。 - * @version DragonBones 3.0 - * @language zh_CN - */ - WorldClock.prototype.add = function(value) { - if (this._animatebles.indexOf(value) < 0) { - this._animatebles.push(value); - value.clock = this; - } - }; - /** - * - Removes a specified IAnimatable instance. - * @param value - The IAnimatable instance. - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 移除特定的 IAnimatable 实例。 - * @param value - IAnimatable 实例。 - * @version DragonBones 3.0 - * @language zh_CN - */ - WorldClock.prototype.remove = function(value) { - var index = this._animatebles.indexOf(value); - if (index >= 0) { - this._animatebles[index] = null; - value.clock = null; - } - }; - /** - * - Clear all IAnimatable instances. - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 清除所有的 IAnimatable 实例。 - * @version DragonBones 3.0 - * @language zh_CN - */ - WorldClock.prototype.clear = function() { - for (var _i = 0, _a = this._animatebles; _i < _a.length; _i++) { - var animatable = _a[_i]; - if (animatable !== null) { - animatable.clock = null; - } - } - }; - Object.defineProperty(WorldClock.prototype, 'clock', { - /** - * @inheritDoc - */ - get: function() { - return this._clock; - }, - set: function(value) { - if (this._clock === value) { - return; - } - if (this._clock !== null) { - this._clock.remove(this); - } - this._clock = value; - if (this._clock !== null) { - this._clock.add(this); - } - }, - enumerable: true, - configurable: true, - }); - return WorldClock; - })(); - dragonBones.WorldClock = WorldClock; - })(dragonBones || (dragonBones = {})); - /** - * The MIT License (MIT) - * - * Copyright (c) 2012-2018 DragonBones team and other contributors - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of - * the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR - * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - (function(dragonBones) { - /** - * - The animation player is used to play the animation data and manage the animation states. - * @see dragonBones.AnimationData - * @see dragonBones.AnimationState - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 动画播放器用来播放动画数据和管理动画状态。 - * @see dragonBones.AnimationData - * @see dragonBones.AnimationState - * @version DragonBones 3.0 - * @language zh_CN - */ - var Animation = /** @class */ (function(_super) { - __extends(Animation, _super); - function Animation() { - var _this = (_super !== null && _super.apply(this, arguments)) || this; - _this._animationNames = []; - _this._animationStates = []; - _this._animations = {}; - _this._blendStates = {}; - _this._animationConfig = null; // Initial value. - return _this; - } - Animation.toString = function() { - return '[class dragonBones.Animation]'; - }; - Animation.prototype._onClear = function() { - for (var _i = 0, _a = this._animationStates; _i < _a.length; _i++) { - var animationState = _a[_i]; - animationState.returnToPool(); - } - for (var k in this._animations) { - delete this._animations[k]; - } - for (var k in this._blendStates) { - var blendStates = this._blendStates[k]; - for (var kB in blendStates) { - blendStates[kB].returnToPool(); - } - delete this._blendStates[k]; - } - if (this._animationConfig !== null) { - this._animationConfig.returnToPool(); - } - this.timeScale = 1.0; - this._animationDirty = false; - this._inheritTimeScale = 1.0; - this._animationNames.length = 0; - this._animationStates.length = 0; - //this._animations.clear(); - this._armature = null; // - this._animationConfig = null; // - this._lastAnimationState = null; - }; - Animation.prototype._fadeOut = function(animationConfig) { - switch (animationConfig.fadeOutMode) { - case 1 /* SameLayer */: - for (var _i = 0, _a = this._animationStates; _i < _a.length; _i++) { - var animationState = _a[_i]; - if (animationState._parent !== null) { - continue; - } - if (animationState.layer === animationConfig.layer) { - animationState.fadeOut( - animationConfig.fadeOutTime, - animationConfig.pauseFadeOut, - ); - } - } - break; - case 2 /* SameGroup */: - for (var _b = 0, _c = this._animationStates; _b < _c.length; _b++) { - var animationState = _c[_b]; - if (animationState._parent !== null) { - continue; - } - if (animationState.group === animationConfig.group) { - animationState.fadeOut( - animationConfig.fadeOutTime, - animationConfig.pauseFadeOut, - ); - } - } - break; - case 3 /* SameLayerAndGroup */: - for (var _d = 0, _e = this._animationStates; _d < _e.length; _d++) { - var animationState = _e[_d]; - if (animationState._parent !== null) { - continue; - } - if ( - animationState.layer === animationConfig.layer && - animationState.group === animationConfig.group - ) { - animationState.fadeOut( - animationConfig.fadeOutTime, - animationConfig.pauseFadeOut, - ); - } - } - break; - case 4 /* All */: - for (var _f = 0, _g = this._animationStates; _f < _g.length; _f++) { - var animationState = _g[_f]; - if (animationState._parent !== null) { - continue; - } - animationState.fadeOut( - animationConfig.fadeOutTime, - animationConfig.pauseFadeOut, - ); - } - break; - } - }; - /** - * @internal - */ - Animation.prototype.init = function(armature) { - if (this._armature !== null) { - return; - } - this._armature = armature; - this._animationConfig = dragonBones.BaseObject.borrowObject( - dragonBones.AnimationConfig, - ); - }; - /** - * @internal - */ - Animation.prototype.advanceTime = function(passedTime) { - if (passedTime < 0.0) { - passedTime = -passedTime; - } - if (this._armature.inheritAnimation && this._armature._parent !== null) { - this._inheritTimeScale = - this._armature._parent._armature.animation._inheritTimeScale * - this.timeScale; - } else { - this._inheritTimeScale = this.timeScale; - } - if (this._inheritTimeScale !== 1.0) { - passedTime *= this._inheritTimeScale; - } - for (var k in this._blendStates) { - var blendStates = this._blendStates[k]; - for (var kB in blendStates) { - blendStates[kB].reset(); - } - } - var animationStateCount = this._animationStates.length; - if (animationStateCount === 1) { - var animationState = this._animationStates[0]; - if (animationState._fadeState > 0 && animationState._subFadeState > 0) { - this._armature._dragonBones.bufferObject(animationState); - this._animationStates.length = 0; - this._lastAnimationState = null; - } else { - var animationData = animationState.animationData; - var cacheFrameRate = animationData.cacheFrameRate; - if (this._animationDirty && cacheFrameRate > 0.0) { - this._animationDirty = false; - for ( - var _i = 0, _a = this._armature.getBones(); - _i < _a.length; - _i++ - ) { - var bone = _a[_i]; - bone._cachedFrameIndices = animationData.getBoneCachedFrameIndices( - bone.name, - ); - } - for ( - var _b = 0, _c = this._armature.getSlots(); - _b < _c.length; - _b++ - ) { - var slot = _c[_b]; - if (slot.displayFrameCount > 0) { - var rawDisplayData = slot.getDisplayFrameAt(0).rawDisplayData; - if ( - rawDisplayData !== null && - rawDisplayData.parent === - this._armature.armatureData.defaultSkin - ) { - slot._cachedFrameIndices = animationData.getSlotCachedFrameIndices( - slot.name, - ); - continue; - } - } - slot._cachedFrameIndices = null; - } - } - animationState.advanceTime(passedTime, cacheFrameRate); - } - } else if (animationStateCount > 1) { - for (var i = 0, r = 0; i < animationStateCount; ++i) { - var animationState = this._animationStates[i]; - if ( - animationState._fadeState > 0 && - animationState._subFadeState > 0 - ) { - r++; - this._armature._dragonBones.bufferObject(animationState); - this._animationDirty = true; - if (this._lastAnimationState === animationState) { - this._lastAnimationState = null; - } - } else { - if (r > 0) { - this._animationStates[i - r] = animationState; - } - animationState.advanceTime(passedTime, 0.0); - } - if (i === animationStateCount - 1 && r > 0) { - this._animationStates.length -= r; - if ( - this._lastAnimationState === null && - this._animationStates.length > 0 - ) { - this._lastAnimationState = this._animationStates[ - this._animationStates.length - 1 - ]; - } - } - } - this._armature._cacheFrameIndex = -1; - } else { - this._armature._cacheFrameIndex = -1; - } - }; - /** - * - Clear all animations states. - * @see dragonBones.AnimationState - * @version DragonBones 4.5 - * @language en_US - */ - /** - * - 清除所有的动画状态。 - * @see dragonBones.AnimationState - * @version DragonBones 4.5 - * @language zh_CN - */ - Animation.prototype.reset = function() { - for (var _i = 0, _a = this._animationStates; _i < _a.length; _i++) { - var animationState = _a[_i]; - animationState.returnToPool(); - } - this._animationDirty = false; - this._animationConfig.clear(); - this._animationStates.length = 0; - this._lastAnimationState = null; - }; - /** - * - Pause a specific animation state. - * @param animationName - The name of animation state. (If not set, it will pause all animations) - * @see dragonBones.AnimationState - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 暂停指定动画状态的播放。 - * @param animationName - 动画状态名称。 (如果未设置,则暂停所有动画) - * @see dragonBones.AnimationState - * @version DragonBones 3.0 - * @language zh_CN - */ - Animation.prototype.stop = function(animationName) { - if (animationName === void 0) { - animationName = null; - } - if (animationName !== null) { - var animationState = this.getState(animationName); - if (animationState !== null) { - animationState.stop(); - } - } else { - for (var _i = 0, _a = this._animationStates; _i < _a.length; _i++) { - var animationState = _a[_i]; - animationState.stop(); - } - } - }; - /** - * - Play animation with a specific animation config. - * The API is still in the experimental phase and may encounter bugs or stability or compatibility issues when used. - * @param animationConfig - The animation config. - * @returns The playing animation state. - * @see dragonBones.AnimationConfig - * @beta - * @version DragonBones 5.0 - * @language en_US - */ - /** - * - 通过指定的动画配置来播放动画。 - * 该 API 仍在实验阶段,使用时可能遭遇 bug 或稳定性或兼容性问题。 - * @param animationConfig - 动画配置。 - * @returns 播放的动画状态。 - * @see dragonBones.AnimationConfig - * @beta - * @version DragonBones 5.0 - * @language zh_CN - */ - Animation.prototype.playConfig = function(animationConfig) { - var animationName = animationConfig.animation; - if (!(animationName in this._animations)) { - console.warn( - 'Non-existent animation.\n', - 'DragonBones name: ' + this._armature.armatureData.parent.name, - 'Armature name: ' + this._armature.name, - 'Animation name: ' + animationName, - ); - return null; - } - var animationData = this._animations[animationName]; - if (animationConfig.fadeOutMode === 5 /* Single */) { - for (var _i = 0, _a = this._animationStates; _i < _a.length; _i++) { - var animationState_1 = _a[_i]; - if ( - animationState_1._fadeState < 1 && - animationState_1.layer === animationConfig.layer && - animationState_1.animationData === animationData - ) { - return animationState_1; - } - } - } - if (this._animationStates.length === 0) { - animationConfig.fadeInTime = 0.0; - } else if (animationConfig.fadeInTime < 0.0) { - animationConfig.fadeInTime = animationData.fadeInTime; - } - if (animationConfig.fadeOutTime < 0.0) { - animationConfig.fadeOutTime = animationConfig.fadeInTime; - } - if (animationConfig.timeScale <= -100.0) { - animationConfig.timeScale = 1.0 / animationData.scale; - } - if (animationData.frameCount > 0) { - if (animationConfig.position < 0.0) { - animationConfig.position %= animationData.duration; - animationConfig.position = - animationData.duration - animationConfig.position; - } else if (animationConfig.position === animationData.duration) { - animationConfig.position -= 0.000001; // Play a little time before end. - } else if (animationConfig.position > animationData.duration) { - animationConfig.position %= animationData.duration; - } - if ( - animationConfig.duration > 0.0 && - animationConfig.position + animationConfig.duration > - animationData.duration - ) { - animationConfig.duration = - animationData.duration - animationConfig.position; - } - if (animationConfig.playTimes < 0) { - animationConfig.playTimes = animationData.playTimes; - } - } else { - animationConfig.playTimes = 1; - animationConfig.position = 0.0; - if (animationConfig.duration > 0.0) { - animationConfig.duration = 0.0; - } - } - if (animationConfig.duration === 0.0) { - animationConfig.duration = -1.0; - } - this._fadeOut(animationConfig); - // - var animationState = dragonBones.BaseObject.borrowObject( - dragonBones.AnimationState, - ); - animationState.init(this._armature, animationData, animationConfig); - this._animationDirty = true; - this._armature._cacheFrameIndex = -1; - if (this._animationStates.length > 0) { - var added = false; - for (var i = 0, l = this._animationStates.length; i < l; ++i) { - if (animationState.layer > this._animationStates[i].layer) { - added = true; - this._animationStates.splice(i, 0, animationState); - break; - } else if ( - i !== l - 1 && - animationState.layer > this._animationStates[i + 1].layer - ) { - added = true; - this._animationStates.splice(i + 1, 0, animationState); - break; - } - } - if (!added) { - this._animationStates.push(animationState); - } - } else { - this._animationStates.push(animationState); - } - for (var _b = 0, _c = this._armature.getSlots(); _b < _c.length; _b++) { - var slot = _c[_b]; - var childArmature = slot.childArmature; - if ( - childArmature !== null && - childArmature.inheritAnimation && - childArmature.animation.hasAnimation(animationName) && - childArmature.animation.getState(animationName) === null - ) { - childArmature.animation.fadeIn(animationName); // - } - } - for (var k in animationData.animationTimelines) { - var childAnimationState = this.fadeIn( - k, - 0.0, - 1, - animationState.layer, - '', - 5 /* Single */, - ); - if (childAnimationState === null) { - continue; - } - var timelines = animationData.animationTimelines[k]; - childAnimationState.actionEnabled = false; - childAnimationState.resetToPose = false; - childAnimationState.stop(); - animationState.addState(childAnimationState, timelines); - // - var index = this._animationStates.indexOf(animationState); - var childIndex = this._animationStates.indexOf(childAnimationState); - if (childIndex < index) { - this._animationStates.splice(index, 1); - this._animationStates.splice(childIndex, 0, animationState); - } - } - // if (!this._armature._lockUpdate && animationConfig.fadeInTime <= 0.0) { // Blend animation state, update armature. - // this._armature.advanceTime(0.0); - // } - this._lastAnimationState = animationState; - return animationState; - }; - /** - * - Play a specific animation. - * @param animationName - The name of animation data. (If not set, The default animation will be played, or resume the animation playing from pause status, or replay the last playing animation) - * @param playTimes - Playing repeat times. [-1: Use default value of the animation data, 0: No end loop playing, [1~N]: Repeat N times] (default: -1) - * @returns The playing animation state. - * @example - *
-         *     armature.animation.play("walk");
-         * 
- * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 播放指定动画。 - * @param animationName - 动画数据名称。 (如果未设置,则播放默认动画,或将暂停状态切换为播放状态,或重新播放之前播放的动画) - * @param playTimes - 循环播放次数。 [-1: 使用动画数据默认值, 0: 无限循环播放, [1~N]: 循环播放 N 次] (默认: -1) - * @returns 播放的动画状态。 - * @example - *
-         *     armature.animation.play("walk");
-         * 
- * @version DragonBones 3.0 - * @language zh_CN - */ - Animation.prototype.play = function(animationName, playTimes) { - if (animationName === void 0) { - animationName = null; - } - if (playTimes === void 0) { - playTimes = -1; - } - this._animationConfig.clear(); - this._animationConfig.resetToPose = true; - this._animationConfig.playTimes = playTimes; - this._animationConfig.fadeInTime = 0.0; - this._animationConfig.animation = - animationName !== null ? animationName : ''; - if (animationName !== null && animationName.length > 0) { - this.playConfig(this._animationConfig); - } else if (this._lastAnimationState === null) { - var defaultAnimation = this._armature.armatureData.defaultAnimation; - if (defaultAnimation !== null) { - this._animationConfig.animation = defaultAnimation.name; - this.playConfig(this._animationConfig); - } - } else if ( - !this._lastAnimationState.isPlaying && - !this._lastAnimationState.isCompleted - ) { - this._lastAnimationState.play(); - } else { - this._animationConfig.animation = this._lastAnimationState.name; - this.playConfig(this._animationConfig); - } - return this._lastAnimationState; - }; - /** - * - Fade in a specific animation. - * @param animationName - The name of animation data. - * @param fadeInTime - The fade in time. [-1: Use the default value of animation data, [0~N]: The fade in time (In seconds)] (Default: -1) - * @param playTimes - playing repeat times. [-1: Use the default value of animation data, 0: No end loop playing, [1~N]: Repeat N times] (Default: -1) - * @param layer - The blending layer, the animation states in high level layer will get the blending weights with high priority, when the total blending weights are more than 1.0, there will be no more weights can be allocated to the other animation states. (Default: 0) - * @param group - The blending group name, it is typically used to specify the substitution of multiple animation states blending. (Default: null) - * @param fadeOutMode - The fade out mode, which is typically used to specify alternate mode of multiple animation states blending. (Default: AnimationFadeOutMode.SameLayerAndGroup) - * @returns The playing animation state. - * @example - *
-         *     armature.animation.fadeIn("walk", 0.3, 0, 0, "normalGroup").resetToPose = false;
-         *     armature.animation.fadeIn("attack", 0.3, 1, 0, "attackGroup").resetToPose = false;
-         * 
- * @version DragonBones 4.5 - * @language en_US - */ - /** - * - 淡入播放指定的动画。 - * @param animationName - 动画数据名称。 - * @param fadeInTime - 淡入时间。 [-1: 使用动画数据默认值, [0~N]: 淡入时间 (以秒为单位)] (默认: -1) - * @param playTimes - 播放次数。 [-1: 使用动画数据默认值, 0: 无限循环播放, [1~N]: 循环播放 N 次] (默认: -1) - * @param layer - 混合图层,图层高的动画状态会优先获取混合权重,当混合权重分配总和超过 1.0 时,剩余的动画状态将不能再获得权重分配。 (默认: 0) - * @param group - 混合组名称,该属性通常用来指定多个动画状态混合时的相互替换关系。 (默认: null) - * @param fadeOutMode - 淡出模式,该属性通常用来指定多个动画状态混合时的相互替换模式。 (默认: AnimationFadeOutMode.SameLayerAndGroup) - * @returns 播放的动画状态。 - * @example - *
-         *     armature.animation.fadeIn("walk", 0.3, 0, 0, "normalGroup").resetToPose = false;
-         *     armature.animation.fadeIn("attack", 0.3, 1, 0, "attackGroup").resetToPose = false;
-         * 
- * @version DragonBones 4.5 - * @language zh_CN - */ - Animation.prototype.fadeIn = function( - animationName, - fadeInTime, - playTimes, - layer, - group, - fadeOutMode, - ) { - if (fadeInTime === void 0) { - fadeInTime = -1.0; - } - if (playTimes === void 0) { - playTimes = -1; - } - if (layer === void 0) { - layer = 0; - } - if (group === void 0) { - group = null; - } - if (fadeOutMode === void 0) { - fadeOutMode = 3 /* SameLayerAndGroup */; - } - this._animationConfig.clear(); - this._animationConfig.fadeOutMode = fadeOutMode; - this._animationConfig.playTimes = playTimes; - this._animationConfig.layer = layer; - this._animationConfig.fadeInTime = fadeInTime; - this._animationConfig.animation = animationName; - this._animationConfig.group = group !== null ? group : ''; - return this.playConfig(this._animationConfig); - }; - /** - * - Play a specific animation from the specific time. - * @param animationName - The name of animation data. - * @param time - The start time point of playing. (In seconds) - * @param playTimes - Playing repeat times. [-1: Use the default value of animation data, 0: No end loop playing, [1~N]: Repeat N times] (Default: -1) - * @returns The played animation state. - * @version DragonBones 4.5 - * @language en_US - */ - /** - * - 从指定时间开始播放指定的动画。 - * @param animationName - 动画数据名称。 - * @param time - 播放开始的时间。 (以秒为单位) - * @param playTimes - 循环播放次数。 [-1: 使用动画数据默认值, 0: 无限循环播放, [1~N]: 循环播放 N 次] (默认: -1) - * @returns 播放的动画状态。 - * @version DragonBones 4.5 - * @language zh_CN - */ - Animation.prototype.gotoAndPlayByTime = function( - animationName, - time, - playTimes, - ) { - if (time === void 0) { - time = 0.0; - } - if (playTimes === void 0) { - playTimes = -1; - } - this._animationConfig.clear(); - this._animationConfig.resetToPose = true; - this._animationConfig.playTimes = playTimes; - this._animationConfig.position = time; - this._animationConfig.fadeInTime = 0.0; - this._animationConfig.animation = animationName; - return this.playConfig(this._animationConfig); - }; - /** - * - Play a specific animation from the specific frame. - * @param animationName - The name of animation data. - * @param frame - The start frame of playing. - * @param playTimes - Playing repeat times. [-1: Use the default value of animation data, 0: No end loop playing, [1~N]: Repeat N times] (Default: -1) - * @returns The played animation state. - * @version DragonBones 4.5 - * @language en_US - */ - /** - * - 从指定帧开始播放指定的动画。 - * @param animationName - 动画数据名称。 - * @param frame - 播放开始的帧数。 - * @param playTimes - 播放次数。 [-1: 使用动画数据默认值, 0: 无限循环播放, [1~N]: 循环播放 N 次] (默认: -1) - * @returns 播放的动画状态。 - * @version DragonBones 4.5 - * @language zh_CN - */ - Animation.prototype.gotoAndPlayByFrame = function( - animationName, - frame, - playTimes, - ) { - if (frame === void 0) { - frame = 0; - } - if (playTimes === void 0) { - playTimes = -1; - } - this._animationConfig.clear(); - this._animationConfig.resetToPose = true; - this._animationConfig.playTimes = playTimes; - this._animationConfig.fadeInTime = 0.0; - this._animationConfig.animation = animationName; - var animationData = - animationName in this._animations - ? this._animations[animationName] - : null; - if (animationData !== null) { - this._animationConfig.position = - animationData.frameCount > 0 - ? (animationData.duration * frame) / animationData.frameCount - : 0.0; - } - return this.playConfig(this._animationConfig); - }; - /** - * - Play a specific animation from the specific progress. - * @param animationName - The name of animation data. - * @param progress - The start progress value of playing. - * @param playTimes - Playing repeat times. [-1: Use the default value of animation data, 0: No end loop playing, [1~N]: Repeat N times] (Default: -1) - * @returns The played animation state. - * @version DragonBones 4.5 - * @language en_US - */ - /** - * - 从指定进度开始播放指定的动画。 - * @param animationName - 动画数据名称。 - * @param progress - 开始播放的进度。 - * @param playTimes - 播放次数。 [-1: 使用动画数据默认值, 0: 无限循环播放, [1~N]: 循环播放 N 次] (默认: -1) - * @returns 播放的动画状态。 - * @version DragonBones 4.5 - * @language zh_CN - */ - Animation.prototype.gotoAndPlayByProgress = function( - animationName, - progress, - playTimes, - ) { - if (progress === void 0) { - progress = 0.0; - } - if (playTimes === void 0) { - playTimes = -1; - } - this._animationConfig.clear(); - this._animationConfig.resetToPose = true; - this._animationConfig.playTimes = playTimes; - this._animationConfig.fadeInTime = 0.0; - this._animationConfig.animation = animationName; - var animationData = - animationName in this._animations - ? this._animations[animationName] - : null; - if (animationData !== null) { - this._animationConfig.position = - animationData.duration * (progress > 0.0 ? progress : 0.0); - } - return this.playConfig(this._animationConfig); - }; - /** - * - Stop a specific animation at the specific time. - * @param animationName - The name of animation data. - * @param time - The stop time. (In seconds) - * @returns The played animation state. - * @version DragonBones 4.5 - * @language en_US - */ - /** - * - 在指定时间停止指定动画播放 - * @param animationName - 动画数据名称。 - * @param time - 停止的时间。 (以秒为单位) - * @returns 播放的动画状态。 - * @version DragonBones 4.5 - * @language zh_CN - */ - Animation.prototype.gotoAndStopByTime = function(animationName, time) { - if (time === void 0) { - time = 0.0; - } - var animationState = this.gotoAndPlayByTime(animationName, time, 1); - if (animationState !== null) { - animationState.stop(); - } - return animationState; - }; - /** - * - Stop a specific animation at the specific frame. - * @param animationName - The name of animation data. - * @param frame - The stop frame. - * @returns The played animation state. - * @version DragonBones 4.5 - * @language en_US - */ - /** - * - 在指定帧停止指定动画的播放 - * @param animationName - 动画数据名称。 - * @param frame - 停止的帧数。 - * @returns 播放的动画状态。 - * @version DragonBones 4.5 - * @language zh_CN - */ - Animation.prototype.gotoAndStopByFrame = function(animationName, frame) { - if (frame === void 0) { - frame = 0; - } - var animationState = this.gotoAndPlayByFrame(animationName, frame, 1); - if (animationState !== null) { - animationState.stop(); - } - return animationState; - }; - /** - * - Stop a specific animation at the specific progress. - * @param animationName - The name of animation data. - * @param progress - The stop progress value. - * @returns The played animation state. - * @version DragonBones 4.5 - * @language en_US - */ - /** - * - 在指定的进度停止指定的动画播放。 - * @param animationName - 动画数据名称。 - * @param progress - 停止进度。 - * @returns 播放的动画状态。 - * @version DragonBones 4.5 - * @language zh_CN - */ - Animation.prototype.gotoAndStopByProgress = function( - animationName, - progress, - ) { - if (progress === void 0) { - progress = 0.0; - } - var animationState = this.gotoAndPlayByProgress( - animationName, - progress, - 1, - ); - if (animationState !== null) { - animationState.stop(); - } - return animationState; - }; - /** - * @internal - */ - Animation.prototype.getBlendState = function(type, name, target) { - if (!(type in this._blendStates)) { - this._blendStates[type] = {}; - } - var blendStates = this._blendStates[type]; - if (!(name in blendStates)) { - var blendState = (blendStates[ - name - ] = dragonBones.BaseObject.borrowObject(dragonBones.BlendState)); - blendState.target = target; - } - return blendStates[name]; - }; - /** - * - Get a specific animation state. - * @param animationName - The name of animation state. - * @param layer - The layer of find animation states. [-1: Find all layers, [0~N]: Specified layer] (default: -1) - * @example - *
-         *     armature.animation.play("walk");
-         *     let walkState = armature.animation.getState("walk");
-         *     walkState.timeScale = 0.5;
-         * 
- * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 获取指定的动画状态。 - * @param animationName - 动画状态名称。 - * @param layer - 查找动画状态的层级。 [-1: 查找所有层级, [0~N]: 指定层级] (默认: -1) - * @example - *
-         *     armature.animation.play("walk");
-         *     let walkState = armature.animation.getState("walk");
-         *     walkState.timeScale = 0.5;
-         * 
- * @version DragonBones 3.0 - * @language zh_CN - */ - Animation.prototype.getState = function(animationName, layer) { - if (layer === void 0) { - layer = -1; - } - var i = this._animationStates.length; - while (i--) { - var animationState = this._animationStates[i]; - if ( - animationState.name === animationName && - (layer < 0 || animationState.layer === layer) - ) { - return animationState; - } - } - return null; - }; - /** - * - Check whether a specific animation data is included. - * @param animationName - The name of animation data. - * @see dragonBones.AnimationData - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 检查是否包含指定的动画数据 - * @param animationName - 动画数据名称。 - * @see dragonBones.AnimationData - * @version DragonBones 3.0 - * @language zh_CN - */ - Animation.prototype.hasAnimation = function(animationName) { - return animationName in this._animations; - }; - /** - * - Get all the animation states. - * @version DragonBones 5.1 - * @language en_US - */ - /** - * - 获取所有的动画状态 - * @version DragonBones 5.1 - * @language zh_CN - */ - Animation.prototype.getStates = function() { - return this._animationStates; - }; - Object.defineProperty(Animation.prototype, 'isPlaying', { - /** - * - Check whether there is an animation state is playing - * @see dragonBones.AnimationState - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 检查是否有动画状态正在播放 - * @see dragonBones.AnimationState - * @version DragonBones 3.0 - * @language zh_CN - */ - get: function() { - for (var _i = 0, _a = this._animationStates; _i < _a.length; _i++) { - var animationState = _a[_i]; - if (animationState.isPlaying) { - return true; - } - } - return false; - }, - enumerable: true, - configurable: true, - }); - Object.defineProperty(Animation.prototype, 'isCompleted', { - /** - * - Check whether all the animation states' playing were finished. - * @see dragonBones.AnimationState - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 检查是否所有的动画状态均已播放完毕。 - * @see dragonBones.AnimationState - * @version DragonBones 3.0 - * @language zh_CN - */ - get: function() { - for (var _i = 0, _a = this._animationStates; _i < _a.length; _i++) { - var animationState = _a[_i]; - if (!animationState.isCompleted) { - return false; - } - } - return this._animationStates.length > 0; - }, - enumerable: true, - configurable: true, - }); - Object.defineProperty(Animation.prototype, 'lastAnimationName', { - /** - * - The name of the last playing animation state. - * @see #lastAnimationState - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 上一个播放的动画状态名称 - * @see #lastAnimationState - * @version DragonBones 3.0 - * @language zh_CN - */ - get: function() { - return this._lastAnimationState !== null - ? this._lastAnimationState.name - : ''; - }, - enumerable: true, - configurable: true, - }); - Object.defineProperty(Animation.prototype, 'animationNames', { - /** - * - The name of all animation data - * @version DragonBones 4.5 - * @language en_US - */ - /** - * - 所有动画数据的名称 - * @version DragonBones 4.5 - * @language zh_CN - */ - get: function() { - return this._animationNames; - }, - enumerable: true, - configurable: true, - }); - Object.defineProperty(Animation.prototype, 'animations', { - /** - * - All animation data. - * @version DragonBones 4.5 - * @language en_US - */ - /** - * - 所有的动画数据。 - * @version DragonBones 4.5 - * @language zh_CN - */ - get: function() { - return this._animations; - }, - set: function(value) { - if (this._animations === value) { - return; - } - this._animationNames.length = 0; - for (var k in this._animations) { - delete this._animations[k]; - } - for (var k in value) { - this._animationNames.push(k); - this._animations[k] = value[k]; - } - }, - enumerable: true, - configurable: true, - }); - Object.defineProperty(Animation.prototype, 'animationConfig', { - /** - * - An AnimationConfig instance that can be used quickly. - * @see dragonBones.AnimationConfig - * @version DragonBones 5.0 - * @language en_US - */ - /** - * - 一个可以快速使用的动画配置实例。 - * @see dragonBones.AnimationConfig - * @version DragonBones 5.0 - * @language zh_CN - */ - get: function() { - this._animationConfig.clear(); - return this._animationConfig; - }, - enumerable: true, - configurable: true, - }); - Object.defineProperty(Animation.prototype, 'lastAnimationState', { - /** - * - The last playing animation state - * @see dragonBones.AnimationState - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 上一个播放的动画状态 - * @see dragonBones.AnimationState - * @version DragonBones 3.0 - * @language zh_CN - */ - get: function() { - return this._lastAnimationState; - }, - enumerable: true, - configurable: true, - }); - return Animation; - })(dragonBones.BaseObject); - dragonBones.Animation = Animation; - })(dragonBones || (dragonBones = {})); - /** - * The MIT License (MIT) - * - * Copyright (c) 2012-2018 DragonBones team and other contributors - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of - * the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR - * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - (function(dragonBones) { - /** - * - The animation state is generated when the animation data is played. - * @see dragonBones.Animation - * @see dragonBones.AnimationData - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 动画状态由播放动画数据时产生。 - * @see dragonBones.Animation - * @see dragonBones.AnimationData - * @version DragonBones 3.0 - * @language zh_CN - */ - var AnimationState = /** @class */ (function(_super) { - __extends(AnimationState, _super); - function AnimationState() { - var _this = (_super !== null && _super.apply(this, arguments)) || this; - _this._boneMask = []; - _this._boneTimelines = []; - _this._boneBlendTimelines = []; - _this._slotTimelines = []; - _this._slotBlendTimelines = []; - _this._constraintTimelines = []; - _this._animationTimelines = []; - _this._poseTimelines = []; - /** - * @internal - */ - _this._actionTimeline = null; // Initial value. - _this._zOrderTimeline = null; // Initial value. - return _this; - } - AnimationState.toString = function() { - return '[class dragonBones.AnimationState]'; - }; - AnimationState.prototype._onClear = function() { - for (var _i = 0, _a = this._boneTimelines; _i < _a.length; _i++) { - var timeline = _a[_i]; - timeline.returnToPool(); - } - for (var _b = 0, _c = this._boneBlendTimelines; _b < _c.length; _b++) { - var timeline = _c[_b]; - timeline.returnToPool(); - } - for (var _d = 0, _e = this._slotTimelines; _d < _e.length; _d++) { - var timeline = _e[_d]; - timeline.returnToPool(); - } - for (var _f = 0, _g = this._slotBlendTimelines; _f < _g.length; _f++) { - var timeline = _g[_f]; - timeline.returnToPool(); - } - for (var _h = 0, _j = this._constraintTimelines; _h < _j.length; _h++) { - var timeline = _j[_h]; - timeline.returnToPool(); - } - for (var _k = 0, _l = this._animationTimelines; _k < _l.length; _k++) { - var timeline = _l[_k]; - var animationState = timeline.target; - if (animationState._parent === this) { - animationState._fadeState = 1; - animationState._subFadeState = 1; - animationState._parent = null; - } - timeline.returnToPool(); - } - if (this._actionTimeline !== null) { - this._actionTimeline.returnToPool(); - } - if (this._zOrderTimeline !== null) { - this._zOrderTimeline.returnToPool(); - } - this.actionEnabled = false; - this.additive = false; - this.displayControl = false; - this.resetToPose = false; - this.blendType = 0 /* None */; - this.playTimes = 1; - this.layer = 0; - this.timeScale = 1.0; - this._weight = 1.0; - this.parameterX = 0.0; - this.parameterY = 0.0; - this.positionX = 0.0; - this.positionY = 0.0; - this.autoFadeOutTime = 0.0; - this.fadeTotalTime = 0.0; - this.name = ''; - this.group = ''; - this._timelineDirty = 2; - this._playheadState = 0; - this._fadeState = -1; - this._subFadeState = -1; - this._position = 0.0; - this._duration = 0.0; - this._fadeTime = 0.0; - this._time = 0.0; - this._fadeProgress = 0.0; - this._weightResult = 0.0; - this._boneMask.length = 0; - this._boneTimelines.length = 0; - this._boneBlendTimelines.length = 0; - this._slotTimelines.length = 0; - this._slotBlendTimelines.length = 0; - this._constraintTimelines.length = 0; - this._animationTimelines.length = 0; - this._poseTimelines.length = 0; - // this._bonePoses.clear(); - this._animationData = null; // - this._armature = null; // - this._actionTimeline = null; // - this._zOrderTimeline = null; - this._activeChildA = null; - this._activeChildB = null; - this._parent = null; - }; - AnimationState.prototype._updateTimelines = function() { - { - for ( - var _i = 0, _a = this._armature._constraints; - _i < _a.length; - _i++ - ) { - var constraint = _a[_i]; - var timelineDatas = this._animationData.getConstraintTimelines( - constraint.name, - ); - if (timelineDatas !== null) { - for ( - var _b = 0, timelineDatas_1 = timelineDatas; - _b < timelineDatas_1.length; - _b++ - ) { - var timelineData = timelineDatas_1[_b]; - switch (timelineData.type) { - case 30 /* IKConstraint */: { - var timeline = dragonBones.BaseObject.borrowObject( - dragonBones.IKConstraintTimelineState, - ); - timeline.target = constraint; - timeline.init(this._armature, this, timelineData); - this._constraintTimelines.push(timeline); - break; - } - } - } - } else if (this.resetToPose) { - var timeline = dragonBones.BaseObject.borrowObject( - dragonBones.IKConstraintTimelineState, - ); - timeline.target = constraint; - timeline.init(this._armature, this, null); - this._constraintTimelines.push(timeline); - this._poseTimelines.push(timeline); - } - } - } - }; - AnimationState.prototype._updateBoneAndSlotTimelines = function() { - { - var boneTimelines = {}; - // Create bone timelines map. - for (var _i = 0, _a = this._boneTimelines; _i < _a.length; _i++) { - var timeline = _a[_i]; - var timelineName = timeline.target.target.name; - if (!(timelineName in boneTimelines)) { - boneTimelines[timelineName] = []; - } - boneTimelines[timelineName].push(timeline); - } - for (var _b = 0, _c = this._boneBlendTimelines; _b < _c.length; _b++) { - var timeline = _c[_b]; - var timelineName = timeline.target.target.name; - if (!(timelineName in boneTimelines)) { - boneTimelines[timelineName] = []; - } - boneTimelines[timelineName].push(timeline); - } - // - for (var _d = 0, _e = this._armature.getBones(); _d < _e.length; _d++) { - var bone = _e[_d]; - var timelineName = bone.name; - if (!this.containsBoneMask(timelineName)) { - continue; - } - if (timelineName in boneTimelines) { - delete boneTimelines[timelineName]; - } else { - var timelineDatas = this._animationData.getBoneTimelines( - timelineName, - ); - var blendState = this._armature.animation.getBlendState( - BlendState.BONE_TRANSFORM, - bone.name, - bone, - ); - if (timelineDatas !== null) { - for ( - var _f = 0, timelineDatas_2 = timelineDatas; - _f < timelineDatas_2.length; - _f++ - ) { - var timelineData = timelineDatas_2[_f]; - switch (timelineData.type) { - case 10 /* BoneAll */: { - var timeline = dragonBones.BaseObject.borrowObject( - dragonBones.BoneAllTimelineState, - ); - timeline.target = blendState; - timeline.init(this._armature, this, timelineData); - this._boneTimelines.push(timeline); - break; - } - case 11 /* BoneTranslate */: { - var timeline = dragonBones.BaseObject.borrowObject( - dragonBones.BoneTranslateTimelineState, - ); - timeline.target = blendState; - timeline.init(this._armature, this, timelineData); - this._boneTimelines.push(timeline); - break; - } - case 12 /* BoneRotate */: { - var timeline = dragonBones.BaseObject.borrowObject( - dragonBones.BoneRotateTimelineState, - ); - timeline.target = blendState; - timeline.init(this._armature, this, timelineData); - this._boneTimelines.push(timeline); - break; - } - case 13 /* BoneScale */: { - var timeline = dragonBones.BaseObject.borrowObject( - dragonBones.BoneScaleTimelineState, - ); - timeline.target = blendState; - timeline.init(this._armature, this, timelineData); - this._boneTimelines.push(timeline); - break; - } - case 60 /* BoneAlpha */: { - var timeline = dragonBones.BaseObject.borrowObject( - dragonBones.AlphaTimelineState, - ); - timeline.target = this._armature.animation.getBlendState( - BlendState.BONE_ALPHA, - bone.name, - bone, - ); - timeline.init(this._armature, this, timelineData); - this._boneBlendTimelines.push(timeline); - break; - } - case 50 /* Surface */: { - var timeline = dragonBones.BaseObject.borrowObject( - dragonBones.SurfaceTimelineState, - ); - timeline.target = this._armature.animation.getBlendState( - BlendState.SURFACE, - bone.name, - bone, - ); - timeline.init(this._armature, this, timelineData); - this._boneBlendTimelines.push(timeline); - break; - } - } - } - } else if (this.resetToPose) { - if (bone._boneData.type === 0 /* Bone */) { - var timeline = dragonBones.BaseObject.borrowObject( - dragonBones.BoneAllTimelineState, - ); - timeline.target = blendState; - timeline.init(this._armature, this, null); - this._boneTimelines.push(timeline); - this._poseTimelines.push(timeline); - } else { - var timeline = dragonBones.BaseObject.borrowObject( - dragonBones.SurfaceTimelineState, - ); - timeline.target = this._armature.animation.getBlendState( - BlendState.SURFACE, - bone.name, - bone, - ); - timeline.init(this._armature, this, null); - this._boneBlendTimelines.push(timeline); - this._poseTimelines.push(timeline); - } - } - } - } - for (var k in boneTimelines) { - for (var _g = 0, _h = boneTimelines[k]; _g < _h.length; _g++) { - var timeline = _h[_g]; - var index = this._boneTimelines.indexOf(timeline); - if (index >= 0) { - this._boneTimelines.splice(index, 1); - timeline.returnToPool(); - } - index = this._boneBlendTimelines.indexOf(timeline); - if (index >= 0) { - this._boneBlendTimelines.splice(index, 1); - timeline.returnToPool(); - } - } - } - } - { - var slotTimelines = {}; - var ffdFlags = []; - // Create slot timelines map. - for (var _j = 0, _k = this._slotTimelines; _j < _k.length; _j++) { - var timeline = _k[_j]; - var timelineName = timeline.target.name; - if (!(timelineName in slotTimelines)) { - slotTimelines[timelineName] = []; - } - slotTimelines[timelineName].push(timeline); - } - for (var _l = 0, _m = this._slotBlendTimelines; _l < _m.length; _l++) { - var timeline = _m[_l]; - var timelineName = timeline.target.target.name; - if (!(timelineName in slotTimelines)) { - slotTimelines[timelineName] = []; - } - slotTimelines[timelineName].push(timeline); - } - // - for (var _o = 0, _p = this._armature.getSlots(); _o < _p.length; _o++) { - var slot = _p[_o]; - var boneName = slot.parent.name; - if (!this.containsBoneMask(boneName)) { - continue; - } - var timelineName = slot.name; - if (timelineName in slotTimelines) { - delete slotTimelines[timelineName]; - } else { - var displayIndexFlag = false; - var colorFlag = false; - ffdFlags.length = 0; - var timelineDatas = this._animationData.getSlotTimelines( - timelineName, - ); - if (timelineDatas !== null) { - for ( - var _q = 0, timelineDatas_3 = timelineDatas; - _q < timelineDatas_3.length; - _q++ - ) { - var timelineData = timelineDatas_3[_q]; - switch (timelineData.type) { - case 20 /* SlotDisplay */: { - var timeline = dragonBones.BaseObject.borrowObject( - dragonBones.SlotDislayTimelineState, - ); - timeline.target = slot; - timeline.init(this._armature, this, timelineData); - this._slotTimelines.push(timeline); - displayIndexFlag = true; - break; - } - case 23 /* SlotZIndex */: { - var timeline = dragonBones.BaseObject.borrowObject( - dragonBones.SlotZIndexTimelineState, - ); - timeline.target = this._armature.animation.getBlendState( - BlendState.SLOT_Z_INDEX, - slot.name, - slot, - ); - timeline.init(this._armature, this, timelineData); - this._slotBlendTimelines.push(timeline); - break; - } - case 21 /* SlotColor */: { - var timeline = dragonBones.BaseObject.borrowObject( - dragonBones.SlotColorTimelineState, - ); - timeline.target = slot; - timeline.init(this._armature, this, timelineData); - this._slotTimelines.push(timeline); - colorFlag = true; - break; - } - case 22 /* SlotDeform */: { - var timeline = dragonBones.BaseObject.borrowObject( - dragonBones.DeformTimelineState, - ); - timeline.target = this._armature.animation.getBlendState( - BlendState.SLOT_DEFORM, - slot.name, - slot, - ); - timeline.init(this._armature, this, timelineData); - if (timeline.target !== null) { - this._slotBlendTimelines.push(timeline); - ffdFlags.push(timeline.geometryOffset); - } else { - timeline.returnToPool(); - } - break; - } - case 24 /* SlotAlpha */: { - var timeline = dragonBones.BaseObject.borrowObject( - dragonBones.AlphaTimelineState, - ); - timeline.target = this._armature.animation.getBlendState( - BlendState.SLOT_ALPHA, - slot.name, - slot, - ); - timeline.init(this._armature, this, timelineData); - this._slotBlendTimelines.push(timeline); - break; - } - } - } - } - if (this.resetToPose) { - if (!displayIndexFlag) { - var timeline = dragonBones.BaseObject.borrowObject( - dragonBones.SlotDislayTimelineState, - ); - timeline.target = slot; - timeline.init(this._armature, this, null); - this._slotTimelines.push(timeline); - this._poseTimelines.push(timeline); - } - if (!colorFlag) { - var timeline = dragonBones.BaseObject.borrowObject( - dragonBones.SlotColorTimelineState, - ); - timeline.target = slot; - timeline.init(this._armature, this, null); - this._slotTimelines.push(timeline); - this._poseTimelines.push(timeline); - } - for (var i = 0, l = slot.displayFrameCount; i < l; ++i) { - var displayFrame = slot.getDisplayFrameAt(i); - if (displayFrame.deformVertices.length === 0) { - continue; - } - var geometryData = displayFrame.getGeometryData(); - if ( - geometryData !== null && - ffdFlags.indexOf(geometryData.offset) < 0 - ) { - var timeline = dragonBones.BaseObject.borrowObject( - dragonBones.DeformTimelineState, - ); - timeline.geometryOffset = geometryData.offset; // - timeline.displayFrame = displayFrame; // - timeline.target = this._armature.animation.getBlendState( - BlendState.SLOT_DEFORM, - slot.name, - slot, - ); - timeline.init(this._armature, this, null); - this._slotBlendTimelines.push(timeline); - this._poseTimelines.push(timeline); - } - } - } - } - } - for (var k in slotTimelines) { - for (var _r = 0, _s = slotTimelines[k]; _r < _s.length; _r++) { - var timeline = _s[_r]; - var index = this._slotTimelines.indexOf(timeline); - if (index >= 0) { - this._slotTimelines.splice(index, 1); - timeline.returnToPool(); - } - index = this._slotBlendTimelines.indexOf(timeline); - if (index >= 0) { - this._slotBlendTimelines.splice(index, 1); - timeline.returnToPool(); - } - } - } - } - }; - AnimationState.prototype._advanceFadeTime = function(passedTime) { - var isFadeOut = this._fadeState > 0; - if (this._subFadeState < 0) { - this._subFadeState = 0; - var eventActive = this._parent === null && this.actionEnabled; - if (eventActive) { - var eventType = isFadeOut - ? dragonBones.EventObject.FADE_OUT - : dragonBones.EventObject.FADE_IN; - if (this._armature.eventDispatcher.hasDBEventListener(eventType)) { - var eventObject = dragonBones.BaseObject.borrowObject( - dragonBones.EventObject, - ); - eventObject.type = eventType; - eventObject.armature = this._armature; - eventObject.animationState = this; - this._armature._dragonBones.bufferEvent(eventObject); - } - } - } - if (passedTime < 0.0) { - passedTime = -passedTime; - } - this._fadeTime += passedTime; - if (this._fadeTime >= this.fadeTotalTime) { - this._subFadeState = 1; - this._fadeProgress = isFadeOut ? 0.0 : 1.0; - } else if (this._fadeTime > 0.0) { - this._fadeProgress = isFadeOut - ? 1.0 - this._fadeTime / this.fadeTotalTime - : this._fadeTime / this.fadeTotalTime; - } else { - this._fadeProgress = isFadeOut ? 1.0 : 0.0; - } - if (this._subFadeState > 0) { - if (!isFadeOut) { - this._playheadState |= 1; // x1 - this._fadeState = 0; - } - var eventActive = this._parent === null && this.actionEnabled; - if (eventActive) { - var eventType = isFadeOut - ? dragonBones.EventObject.FADE_OUT_COMPLETE - : dragonBones.EventObject.FADE_IN_COMPLETE; - if (this._armature.eventDispatcher.hasDBEventListener(eventType)) { - var eventObject = dragonBones.BaseObject.borrowObject( - dragonBones.EventObject, - ); - eventObject.type = eventType; - eventObject.armature = this._armature; - eventObject.animationState = this; - this._armature._dragonBones.bufferEvent(eventObject); - } - } - } - }; - /** - * @internal - */ - AnimationState.prototype.init = function( - armature, - animationData, - animationConfig, - ) { - if (this._armature !== null) { - return; - } - this._armature = armature; - this._animationData = animationData; - // - this.resetToPose = animationConfig.resetToPose; - this.additive = animationConfig.additive; - this.displayControl = animationConfig.displayControl; - this.actionEnabled = animationConfig.actionEnabled; - this.blendType = animationData.blendType; - this.layer = animationConfig.layer; - this.playTimes = animationConfig.playTimes; - this.timeScale = animationConfig.timeScale; - this.fadeTotalTime = animationConfig.fadeInTime; - this.autoFadeOutTime = animationConfig.autoFadeOutTime; - this.name = - animationConfig.name.length > 0 - ? animationConfig.name - : animationConfig.animation; - this.group = animationConfig.group; - // - this._weight = animationConfig.weight; - if (animationConfig.pauseFadeIn) { - this._playheadState = 2; // 10 - } else { - this._playheadState = 3; // 11 - } - if (animationConfig.duration < 0.0) { - this._position = 0.0; - this._duration = this._animationData.duration; - if (animationConfig.position !== 0.0) { - if (this.timeScale >= 0.0) { - this._time = animationConfig.position; - } else { - this._time = animationConfig.position - this._duration; - } - } else { - this._time = 0.0; - } - } else { - this._position = animationConfig.position; - this._duration = animationConfig.duration; - this._time = 0.0; - } - if (this.timeScale < 0.0 && this._time === 0.0) { - this._time = -0.000001; // Turn to end. - } - if (this.fadeTotalTime <= 0.0) { - this._fadeProgress = 0.999999; // Make different. - } - if (animationConfig.boneMask.length > 0) { - this._boneMask.length = animationConfig.boneMask.length; - for (var i = 0, l = this._boneMask.length; i < l; ++i) { - this._boneMask[i] = animationConfig.boneMask[i]; - } - } - this._actionTimeline = dragonBones.BaseObject.borrowObject( - dragonBones.ActionTimelineState, - ); - this._actionTimeline.init( - this._armature, - this, - this._animationData.actionTimeline, - ); - this._actionTimeline.currentTime = this._time; - if (this._actionTimeline.currentTime < 0.0) { - this._actionTimeline.currentTime = - this._duration - this._actionTimeline.currentTime; - } - if (this._animationData.zOrderTimeline !== null) { - this._zOrderTimeline = dragonBones.BaseObject.borrowObject( - dragonBones.ZOrderTimelineState, - ); - this._zOrderTimeline.init( - this._armature, - this, - this._animationData.zOrderTimeline, - ); - } - }; - /** - * @internal - */ - AnimationState.prototype.advanceTime = function( - passedTime, - cacheFrameRate, - ) { - // Update fade time. - if (this._fadeState !== 0 || this._subFadeState !== 0) { - this._advanceFadeTime(passedTime); - } - // Update time. - if (this._playheadState === 3) { - if (this.timeScale !== 1.0) { - passedTime *= this.timeScale; - } - this._time += passedTime; - } - // Update timeline. - if (this._timelineDirty !== 0) { - if (this._timelineDirty === 2) { - this._updateTimelines(); - } - this._timelineDirty = 0; - this._updateBoneAndSlotTimelines(); - } - var isBlendDirty = this._fadeState !== 0 || this._subFadeState === 0; - var isCacheEnabled = this._fadeState === 0 && cacheFrameRate > 0.0; - var isUpdateTimeline = true; - var isUpdateBoneTimeline = true; - var time = this._time; - this._weightResult = this._weight * this._fadeProgress; - if (this._parent !== null) { - this._weightResult *= this._parent._weightResult; - } - if (this._actionTimeline.playState <= 0) { - this._actionTimeline.update(time); - } - if (this._weight === 0.0) { - return; - } - if (isCacheEnabled) { - var internval = cacheFrameRate * 2.0; - this._actionTimeline.currentTime = - Math.floor(this._actionTimeline.currentTime * internval) / internval; - } - if ( - this._zOrderTimeline !== null && - this._zOrderTimeline.playState <= 0 - ) { - this._zOrderTimeline.update(time); - } - if (isCacheEnabled) { - var cacheFrameIndex = Math.floor( - this._actionTimeline.currentTime * cacheFrameRate, - ); // uint - if (this._armature._cacheFrameIndex === cacheFrameIndex) { - isUpdateTimeline = false; - isUpdateBoneTimeline = false; - } else { - this._armature._cacheFrameIndex = cacheFrameIndex; - if (this._animationData.cachedFrames[cacheFrameIndex]) { - isUpdateBoneTimeline = false; - } else { - this._animationData.cachedFrames[cacheFrameIndex] = true; - } - } - } - if (isUpdateTimeline) { - var isBlend = false; - var prevTarget = null; // - if (isUpdateBoneTimeline) { - for (var i = 0, l = this._boneTimelines.length; i < l; ++i) { - var timeline = this._boneTimelines[i]; - if (timeline.playState <= 0) { - timeline.update(time); - } - if (timeline.target !== prevTarget) { - var blendState = timeline.target; - isBlend = blendState.update(this); - prevTarget = blendState; - if (blendState.dirty === 1) { - var pose = blendState.target.animationPose; - pose.x = 0.0; - pose.y = 0.0; - pose.rotation = 0.0; - pose.skew = 0.0; - pose.scaleX = 1.0; - pose.scaleY = 1.0; - } - } - if (isBlend) { - timeline.blend(isBlendDirty); - } - } - } - for (var i = 0, l = this._boneBlendTimelines.length; i < l; ++i) { - var timeline = this._boneBlendTimelines[i]; - if (timeline.playState <= 0) { - timeline.update(time); - } - if (timeline.target.update(this)) { - timeline.blend(isBlendDirty); - } - } - if (this.displayControl) { - for (var i = 0, l = this._slotTimelines.length; i < l; ++i) { - var timeline = this._slotTimelines[i]; - if (timeline.playState <= 0) { - var slot = timeline.target; - var displayController = slot.displayController; - if ( - displayController === null || - displayController === this.name || - displayController === this.group - ) { - timeline.update(time); - } - } - } - } - for (var i = 0, l = this._slotBlendTimelines.length; i < l; ++i) { - var timeline = this._slotBlendTimelines[i]; - if (timeline.playState <= 0) { - var blendState = timeline.target; - timeline.update(time); - if (blendState.update(this)) { - timeline.blend(isBlendDirty); - } - } - } - for (var i = 0, l = this._constraintTimelines.length; i < l; ++i) { - var timeline = this._constraintTimelines[i]; - if (timeline.playState <= 0) { - timeline.update(time); - } - } - if (this._animationTimelines.length > 0) { - var dL = 100.0; - var dR = 100.0; - var leftState = null; - var rightState = null; - for (var i = 0, l = this._animationTimelines.length; i < l; ++i) { - var timeline = this._animationTimelines[i]; - if (timeline.playState <= 0) { - timeline.update(time); - } - if (this.blendType === 1 /* E1D */) { - var animationState = timeline.target; - var d = this.parameterX - animationState.positionX; - if (d >= 0.0) { - if (d < dL) { - dL = d; - leftState = animationState; - } - } else { - if (-d < dR) { - dR = -d; - rightState = animationState; - } - } - } - } - if (leftState !== null) { - if (this._activeChildA !== leftState) { - if (this._activeChildA !== null) { - this._activeChildA.weight = 0.0; - } - this._activeChildA = leftState; - this._activeChildA.activeTimeline(); - } - if (this._activeChildB !== rightState) { - if (this._activeChildB !== null) { - this._activeChildB.weight = 0.0; - } - this._activeChildB = rightState; - } - leftState.weight = dR / (dL + dR); - if (rightState) { - rightState.weight = 1.0 - leftState.weight; - } - } - } - } - if (this._fadeState === 0) { - if (this._subFadeState > 0) { - this._subFadeState = 0; - if (this._poseTimelines.length > 0) { - for (var _i = 0, _a = this._poseTimelines; _i < _a.length; _i++) { - var timeline = _a[_i]; - var index = this._boneTimelines.indexOf(timeline); - if (index >= 0) { - this._boneTimelines.splice(index, 1); - timeline.returnToPool(); - continue; - } - index = this._boneBlendTimelines.indexOf(timeline); - if (index >= 0) { - this._boneBlendTimelines.splice(index, 1); - timeline.returnToPool(); - continue; - } - index = this._slotTimelines.indexOf(timeline); - if (index >= 0) { - this._slotTimelines.splice(index, 1); - timeline.returnToPool(); - continue; - } - index = this._slotBlendTimelines.indexOf(timeline); - if (index >= 0) { - this._slotBlendTimelines.splice(index, 1); - timeline.returnToPool(); - continue; - } - index = this._constraintTimelines.indexOf(timeline); - if (index >= 0) { - this._constraintTimelines.splice(index, 1); - timeline.returnToPool(); - continue; - } - } - this._poseTimelines.length = 0; - } - } - if (this._actionTimeline.playState > 0) { - if (this.autoFadeOutTime >= 0.0) { - this.fadeOut(this.autoFadeOutTime); - } - } - } - }; - /** - * - Continue play. - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 继续播放。 - * @version DragonBones 3.0 - * @language zh_CN - */ - AnimationState.prototype.play = function() { - this._playheadState = 3; // 11 - }; - /** - * - Stop play. - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 暂停播放。 - * @version DragonBones 3.0 - * @language zh_CN - */ - AnimationState.prototype.stop = function() { - this._playheadState &= 1; // 0x - }; - /** - * - Fade out the animation state. - * @param fadeOutTime - The fade out time. (In seconds) - * @param pausePlayhead - Whether to pause the animation playing when fade out. - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 淡出动画状态。 - * @param fadeOutTime - 淡出时间。 (以秒为单位) - * @param pausePlayhead - 淡出时是否暂停播放。 - * @version DragonBones 3.0 - * @language zh_CN - */ - AnimationState.prototype.fadeOut = function(fadeOutTime, pausePlayhead) { - if (pausePlayhead === void 0) { - pausePlayhead = true; - } - if (fadeOutTime < 0.0) { - fadeOutTime = 0.0; - } - if (pausePlayhead) { - this._playheadState &= 2; // x0 - } - if (this._fadeState > 0) { - if (fadeOutTime > this.fadeTotalTime - this._fadeTime) { - return; - } - } else { - this._fadeState = 1; - this._subFadeState = -1; - if (fadeOutTime <= 0.0 || this._fadeProgress <= 0.0) { - this._fadeProgress = 0.000001; // Modify fade progress to different value. - } - for (var _i = 0, _a = this._boneTimelines; _i < _a.length; _i++) { - var timeline = _a[_i]; - timeline.fadeOut(); - } - for (var _b = 0, _c = this._boneBlendTimelines; _b < _c.length; _b++) { - var timeline = _c[_b]; - timeline.fadeOut(); - } - for (var _d = 0, _e = this._slotTimelines; _d < _e.length; _d++) { - var timeline = _e[_d]; - timeline.fadeOut(); - } - for (var _f = 0, _g = this._slotBlendTimelines; _f < _g.length; _f++) { - var timeline = _g[_f]; - timeline.fadeOut(); - } - for (var _h = 0, _j = this._constraintTimelines; _h < _j.length; _h++) { - var timeline = _j[_h]; - timeline.fadeOut(); - } - for (var _k = 0, _l = this._animationTimelines; _k < _l.length; _k++) { - var timeline = _l[_k]; - timeline.fadeOut(); - // - var animaitonState = timeline.target; - animaitonState.fadeOut(999999.0, true); - } - } - this.displayControl = false; // - this.fadeTotalTime = - this._fadeProgress > 0.000001 ? fadeOutTime / this._fadeProgress : 0.0; - this._fadeTime = this.fadeTotalTime * (1.0 - this._fadeProgress); - }; - /** - * - Check if a specific bone mask is included. - * @param boneName - The bone name. - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 检查是否包含特定骨骼遮罩。 - * @param boneName - 骨骼名称。 - * @version DragonBones 3.0 - * @language zh_CN - */ - AnimationState.prototype.containsBoneMask = function(boneName) { - return ( - this._boneMask.length === 0 || this._boneMask.indexOf(boneName) >= 0 - ); - }; - /** - * - Add a specific bone mask. - * @param boneName - The bone name. - * @param recursive - Whether or not to add a mask to the bone's sub-bone. - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 添加特定的骨骼遮罩。 - * @param boneName - 骨骼名称。 - * @param recursive - 是否为该骨骼的子骨骼添加遮罩。 - * @version DragonBones 3.0 - * @language zh_CN - */ - AnimationState.prototype.addBoneMask = function(boneName, recursive) { - if (recursive === void 0) { - recursive = true; - } - var currentBone = this._armature.getBone(boneName); - if (currentBone === null) { - return; - } - if (this._boneMask.indexOf(boneName) < 0) { - this._boneMask.push(boneName); - } - if (recursive) { - for (var _i = 0, _a = this._armature.getBones(); _i < _a.length; _i++) { - var bone = _a[_i]; - if ( - this._boneMask.indexOf(bone.name) < 0 && - currentBone.contains(bone) - ) { - this._boneMask.push(bone.name); - } - } - } - this._timelineDirty = 1; - }; - /** - * - Remove the mask of a specific bone. - * @param boneName - The bone name. - * @param recursive - Whether to remove the bone's sub-bone mask. - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 删除特定骨骼的遮罩。 - * @param boneName - 骨骼名称。 - * @param recursive - 是否删除该骨骼的子骨骼遮罩。 - * @version DragonBones 3.0 - * @language zh_CN - */ - AnimationState.prototype.removeBoneMask = function(boneName, recursive) { - if (recursive === void 0) { - recursive = true; - } - var index = this._boneMask.indexOf(boneName); - if (index >= 0) { - this._boneMask.splice(index, 1); - } - if (recursive) { - var currentBone = this._armature.getBone(boneName); - if (currentBone !== null) { - var bones = this._armature.getBones(); - if (this._boneMask.length > 0) { - for (var _i = 0, bones_1 = bones; _i < bones_1.length; _i++) { - var bone = bones_1[_i]; - var index_1 = this._boneMask.indexOf(bone.name); - if (index_1 >= 0 && currentBone.contains(bone)) { - this._boneMask.splice(index_1, 1); - } - } - } else { - for (var _a = 0, bones_2 = bones; _a < bones_2.length; _a++) { - var bone = bones_2[_a]; - if (bone === currentBone) { - continue; - } - if (!currentBone.contains(bone)) { - this._boneMask.push(bone.name); - } - } - } - } - } - this._timelineDirty = 1; - }; - /** - * - Remove all bone masks. - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 删除所有骨骼遮罩。 - * @version DragonBones 3.0 - * @language zh_CN - */ - AnimationState.prototype.removeAllBoneMask = function() { - this._boneMask.length = 0; - this._timelineDirty = 1; - }; - /** - * @private - */ - AnimationState.prototype.addState = function( - animationState, - timelineDatas, - ) { - if (timelineDatas === void 0) { - timelineDatas = null; - } - if (timelineDatas !== null) { - for ( - var _i = 0, timelineDatas_4 = timelineDatas; - _i < timelineDatas_4.length; - _i++ - ) { - var timelineData = timelineDatas_4[_i]; - switch (timelineData.type) { - case 40 /* AnimationProgress */: { - var timeline = dragonBones.BaseObject.borrowObject( - dragonBones.AnimationProgressTimelineState, - ); - timeline.target = animationState; - timeline.init(this._armature, this, timelineData); - this._animationTimelines.push(timeline); - if (this.blendType !== 0 /* None */) { - var animaitonTimelineData = timelineData; - animationState.positionX = animaitonTimelineData.x; - animationState.positionY = animaitonTimelineData.y; - animationState.weight = 0.0; - } - animationState._parent = this; - this.resetToPose = false; - break; - } - case 41 /* AnimationWeight */: { - var timeline = dragonBones.BaseObject.borrowObject( - dragonBones.AnimationWeightTimelineState, - ); - timeline.target = animationState; - timeline.init(this._armature, this, timelineData); - this._animationTimelines.push(timeline); - break; - } - case 42 /* AnimationParameter */: { - var timeline = dragonBones.BaseObject.borrowObject( - dragonBones.AnimationParametersTimelineState, - ); - timeline.target = animationState; - timeline.init(this._armature, this, timelineData); - this._animationTimelines.push(timeline); - break; - } - } - } - } - if (animationState._parent === null) { - animationState._parent = this; - } - }; - /** - * @internal - */ - AnimationState.prototype.activeTimeline = function() { - for (var _i = 0, _a = this._slotTimelines; _i < _a.length; _i++) { - var timeline = _a[_i]; - timeline.dirty = true; - timeline.currentTime = -1.0; - } - }; - Object.defineProperty(AnimationState.prototype, 'isFadeIn', { - /** - * - Whether the animation state is fading in. - * @version DragonBones 5.1 - * @language en_US - */ - /** - * - 是否正在淡入。 - * @version DragonBones 5.1 - * @language zh_CN - */ - get: function() { - return this._fadeState < 0; - }, - enumerable: true, - configurable: true, - }); - Object.defineProperty(AnimationState.prototype, 'isFadeOut', { - /** - * - Whether the animation state is fading out. - * @version DragonBones 5.1 - * @language en_US - */ - /** - * - 是否正在淡出。 - * @version DragonBones 5.1 - * @language zh_CN - */ - get: function() { - return this._fadeState > 0; - }, - enumerable: true, - configurable: true, - }); - Object.defineProperty(AnimationState.prototype, 'isFadeComplete', { - /** - * - Whether the animation state is fade completed. - * @version DragonBones 5.1 - * @language en_US - */ - /** - * - 是否淡入或淡出完毕。 - * @version DragonBones 5.1 - * @language zh_CN - */ - get: function() { - return this._fadeState === 0; - }, - enumerable: true, - configurable: true, - }); - Object.defineProperty(AnimationState.prototype, 'isPlaying', { - /** - * - Whether the animation state is playing. - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 是否正在播放。 - * @version DragonBones 3.0 - * @language zh_CN - */ - get: function() { - return ( - (this._playheadState & 2) !== 0 && this._actionTimeline.playState <= 0 - ); - }, - enumerable: true, - configurable: true, - }); - Object.defineProperty(AnimationState.prototype, 'isCompleted', { - /** - * - Whether the animation state is play completed. - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 是否播放完毕。 - * @version DragonBones 3.0 - * @language zh_CN - */ - get: function() { - return this._actionTimeline.playState > 0; - }, - enumerable: true, - configurable: true, - }); - Object.defineProperty(AnimationState.prototype, 'currentPlayTimes', { - /** - * - The times has been played. - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 已经循环播放的次数。 - * @version DragonBones 3.0 - * @language zh_CN - */ - get: function() { - return this._actionTimeline.currentPlayTimes; - }, - enumerable: true, - configurable: true, - }); - Object.defineProperty(AnimationState.prototype, 'totalTime', { - /** - * - The total time. (In seconds) - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 总播放时间。 (以秒为单位) - * @version DragonBones 3.0 - * @language zh_CN - */ - get: function() { - return this._duration; - }, - enumerable: true, - configurable: true, - }); - Object.defineProperty(AnimationState.prototype, 'currentTime', { - /** - * - The time is currently playing. (In seconds) - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 当前播放的时间。 (以秒为单位) - * @version DragonBones 3.0 - * @language zh_CN - */ - get: function() { - return this._actionTimeline.currentTime; - }, - set: function(value) { - var currentPlayTimes = - this._actionTimeline.currentPlayTimes - - (this._actionTimeline.playState > 0 ? 1 : 0); - if (value < 0 || this._duration < value) { - value = (value % this._duration) + currentPlayTimes * this._duration; - if (value < 0) { - value += this._duration; - } - } - if ( - this.playTimes > 0 && - currentPlayTimes === this.playTimes - 1 && - value === this._duration && - this._parent === null - ) { - value = this._duration - 0.000001; // - } - if (this._time === value) { - return; - } - this._time = value; - this._actionTimeline.setCurrentTime(this._time); - if (this._zOrderTimeline !== null) { - this._zOrderTimeline.playState = -1; - } - for (var _i = 0, _a = this._boneTimelines; _i < _a.length; _i++) { - var timeline = _a[_i]; - timeline.playState = -1; - } - for (var _b = 0, _c = this._slotTimelines; _b < _c.length; _b++) { - var timeline = _c[_b]; - timeline.playState = -1; - } - }, - enumerable: true, - configurable: true, - }); - Object.defineProperty(AnimationState.prototype, 'weight', { - /** - * - The blend weight. - * @default 1.0 - * @version DragonBones 5.0 - * @language en_US - */ - /** - * - 混合权重。 - * @default 1.0 - * @version DragonBones 5.0 - * @language zh_CN - */ - /** - * - The animation data. - * @see dragonBones.AnimationData - * @version DragonBones 3.0 - * @language en_US - */ - get: function() { - return this._weight; - }, - set: function(value) { - if (this._weight === value) { - return; - } - this._weight = value; - for (var _i = 0, _a = this._boneTimelines; _i < _a.length; _i++) { - var timeline = _a[_i]; - timeline.dirty = true; - } - for (var _b = 0, _c = this._boneBlendTimelines; _b < _c.length; _b++) { - var timeline = _c[_b]; - timeline.dirty = true; - } - for (var _d = 0, _e = this._slotBlendTimelines; _d < _e.length; _d++) { - var timeline = _e[_d]; - timeline.dirty = true; - } - }, - enumerable: true, - configurable: true, - }); - Object.defineProperty(AnimationState.prototype, 'animationData', { - /** - * - 动画数据。 - * @see dragonBones.AnimationData - * @version DragonBones 3.0 - * @language zh_CN - */ - get: function() { - return this._animationData; - }, - enumerable: true, - configurable: true, - }); - return AnimationState; - })(dragonBones.BaseObject); - dragonBones.AnimationState = AnimationState; - /** - * @internal - */ - var BlendState = /** @class */ (function(_super) { - __extends(BlendState, _super); - function BlendState() { - return (_super !== null && _super.apply(this, arguments)) || this; - } - BlendState.toString = function() { - return '[class dragonBones.BlendState]'; - }; - BlendState.prototype._onClear = function() { - this.reset(); - this.target = null; - }; - BlendState.prototype.update = function(animationState) { - var animationLayer = animationState.layer; - var animationWeight = animationState._weightResult; - if (this.dirty > 0) { - if (this.leftWeight > 0.0) { - if (this.layer !== animationLayer) { - if (this.layerWeight >= this.leftWeight) { - this.dirty++; - this.layer = animationLayer; - this.leftWeight = 0.0; - this.blendWeight = 0.0; - return false; - } - this.layer = animationLayer; - this.leftWeight -= this.layerWeight; - this.layerWeight = 0.0; - } - animationWeight *= this.leftWeight; - this.dirty++; - this.blendWeight = animationWeight; - this.layerWeight += this.blendWeight; - return true; - } - return false; - } - this.dirty++; - this.layer = animationLayer; - this.leftWeight = 1.0; - this.blendWeight = animationWeight; - this.layerWeight = animationWeight; - return true; - }; - BlendState.prototype.reset = function() { - this.dirty = 0; - this.layer = 0; - this.leftWeight = 0.0; - this.layerWeight = 0.0; - this.blendWeight = 0.0; - }; - BlendState.BONE_TRANSFORM = 'boneTransform'; - BlendState.BONE_ALPHA = 'boneAlpha'; - BlendState.SURFACE = 'surface'; - BlendState.SLOT_DEFORM = 'slotDeform'; - BlendState.SLOT_ALPHA = 'slotAlpha'; - BlendState.SLOT_Z_INDEX = 'slotZIndex'; - return BlendState; - })(dragonBones.BaseObject); - dragonBones.BlendState = BlendState; - })(dragonBones || (dragonBones = {})); - /** - * The MIT License (MIT) - * - * Copyright (c) 2012-2018 DragonBones team and other contributors - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of - * the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR - * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - (function(dragonBones) { - /** - * @internal - */ - var TimelineState = /** @class */ (function(_super) { - __extends(TimelineState, _super); - function TimelineState() { - return (_super !== null && _super.apply(this, arguments)) || this; - } - TimelineState.prototype._onClear = function() { - this.dirty = false; - this.playState = -1; - this.currentPlayTimes = -1; - this.currentTime = -1.0; - this.target = null; - this._isTween = false; - this._valueOffset = 0; - this._frameValueOffset = 0; - this._frameOffset = 0; - this._frameRate = 0; - this._frameCount = 0; - this._frameIndex = -1; - this._frameRateR = 0.0; - this._position = 0.0; - this._duration = 0.0; - this._timeScale = 1.0; - this._timeOffset = 0.0; - this._animationData = null; // - this._timelineData = null; // - this._armature = null; // - this._animationState = null; // - this._actionTimeline = null; // - this._frameArray = null; // - this._valueArray = null; // - this._timelineArray = null; // - this._frameIndices = null; // - }; - TimelineState.prototype._setCurrentTime = function(passedTime) { - var prevState = this.playState; - var prevPlayTimes = this.currentPlayTimes; - var prevTime = this.currentTime; - if (this._actionTimeline !== null && this._frameCount <= 1) { - this.playState = this._actionTimeline.playState >= 0 ? 1 : -1; - this.currentPlayTimes = 1; - this.currentTime = this._actionTimeline.currentTime; - } else if ( - this._actionTimeline === null || - this._timeScale !== 1.0 || - this._timeOffset !== 0.0 - ) { - var playTimes = this._animationState.playTimes; - var totalTime = playTimes * this._duration; - passedTime *= this._timeScale; - if (this._timeOffset !== 0.0) { - passedTime += this._timeOffset * this._animationData.duration; - } - if ( - playTimes > 0 && - (passedTime >= totalTime || passedTime <= -totalTime) - ) { - if ( - this.playState <= 0 && - this._animationState._playheadState === 3 - ) { - this.playState = 1; - } - this.currentPlayTimes = playTimes; - if (passedTime < 0.0) { - this.currentTime = 0.0; - } else { - this.currentTime = this._duration + 0.000001; // Precision problem - } - } else { - if ( - this.playState !== 0 && - this._animationState._playheadState === 3 - ) { - this.playState = 0; - } - if (passedTime < 0.0) { - passedTime = -passedTime; - this.currentPlayTimes = Math.floor(passedTime / this._duration); - this.currentTime = this._duration - (passedTime % this._duration); - } else { - this.currentPlayTimes = Math.floor(passedTime / this._duration); - this.currentTime = passedTime % this._duration; - } - } - this.currentTime += this._position; - } else { - this.playState = this._actionTimeline.playState; - this.currentPlayTimes = this._actionTimeline.currentPlayTimes; - this.currentTime = this._actionTimeline.currentTime; - } - if ( - this.currentPlayTimes === prevPlayTimes && - this.currentTime === prevTime - ) { - return false; - } - // Clear frame flag when timeline start or loopComplete. - if ( - (prevState < 0 && this.playState !== prevState) || - (this.playState <= 0 && this.currentPlayTimes !== prevPlayTimes) - ) { - this._frameIndex = -1; - } - return true; - }; - TimelineState.prototype.init = function( - armature, - animationState, - timelineData, - ) { - this._armature = armature; - this._animationState = animationState; - this._timelineData = timelineData; - this._actionTimeline = this._animationState._actionTimeline; - if (this === this._actionTimeline) { - this._actionTimeline = null; // - } - this._animationData = this._animationState.animationData; - // - this._frameRate = this._animationData.parent.frameRate; - this._frameRateR = 1.0 / this._frameRate; - this._position = this._animationState._position; - this._duration = this._animationState._duration; - if (this._timelineData !== null) { - var dragonBonesData = this._animationData.parent.parent; // May by the animation data is not belone to this armature data. - this._frameArray = dragonBonesData.frameArray; - this._timelineArray = dragonBonesData.timelineArray; - this._frameIndices = dragonBonesData.frameIndices; - // - this._frameCount = this._timelineArray[ - this._timelineData.offset + 2 /* TimelineKeyFrameCount */ - ]; - this._frameValueOffset = this._timelineArray[ - this._timelineData.offset + 4 /* TimelineFrameValueOffset */ - ]; - this._timeScale = - 100.0 / - this._timelineArray[ - this._timelineData.offset + 0 /* TimelineScale */ - ]; - this._timeOffset = - this._timelineArray[ - this._timelineData.offset + 1 /* TimelineOffset */ - ] * 0.01; - } - }; - TimelineState.prototype.fadeOut = function() { - this.dirty = false; - }; - TimelineState.prototype.update = function(passedTime) { - if (this._setCurrentTime(passedTime)) { - if (this._frameCount > 1) { - var timelineFrameIndex = Math.floor( - this.currentTime * this._frameRate, - ); // uint - var frameIndex = this._frameIndices[ - this._timelineData.frameIndicesOffset + timelineFrameIndex - ]; - if (this._frameIndex !== frameIndex) { - this._frameIndex = frameIndex; - this._frameOffset = - this._animationData.frameOffset + - this._timelineArray[ - this._timelineData.offset + - 5 /* TimelineFrameOffset */ + - this._frameIndex - ]; - this._onArriveAtFrame(); - } - } else if (this._frameIndex < 0) { - this._frameIndex = 0; - if (this._timelineData !== null) { - this._frameOffset = - this._animationData.frameOffset + - this._timelineArray[ - this._timelineData.offset + 5 /* TimelineFrameOffset */ - ]; - } - this._onArriveAtFrame(); - } - if (this._isTween || this.dirty) { - this._onUpdateFrame(); - } - } - }; - TimelineState.prototype.blend = function(_isDirty) {}; - return TimelineState; - })(dragonBones.BaseObject); - dragonBones.TimelineState = TimelineState; - /** - * @internal - */ - var TweenTimelineState = /** @class */ (function(_super) { - __extends(TweenTimelineState, _super); - function TweenTimelineState() { - return (_super !== null && _super.apply(this, arguments)) || this; - } - TweenTimelineState._getEasingValue = function(tweenType, progress, easing) { - var value = progress; - switch (tweenType) { - case 3 /* QuadIn */: - value = Math.pow(progress, 2.0); - break; - case 4 /* QuadOut */: - value = 1.0 - Math.pow(1.0 - progress, 2.0); - break; - case 5 /* QuadInOut */: - value = 0.5 * (1.0 - Math.cos(progress * Math.PI)); - break; - } - return (value - progress) * easing + progress; - }; - TweenTimelineState._getEasingCurveValue = function( - progress, - samples, - count, - offset, - ) { - if (progress <= 0.0) { - return 0.0; - } else if (progress >= 1.0) { - return 1.0; - } - var isOmited = count > 0; - var segmentCount = count + 1; // + 2 - 1 - var valueIndex = Math.floor(progress * segmentCount); - var fromValue = 0.0; - var toValue = 0.0; - if (isOmited) { - fromValue = valueIndex === 0 ? 0.0 : samples[offset + valueIndex - 1]; - toValue = - valueIndex === segmentCount - 1 - ? 10000.0 - : samples[offset + valueIndex]; - } else { - fromValue = samples[offset + valueIndex - 1]; - toValue = samples[offset + valueIndex]; - } - return ( - (fromValue + - (toValue - fromValue) * (progress * segmentCount - valueIndex)) * - 0.0001 - ); - }; - TweenTimelineState.prototype._onClear = function() { - _super.prototype._onClear.call(this); - this._tweenType = 0 /* None */; - this._curveCount = 0; - this._framePosition = 0.0; - this._frameDurationR = 0.0; - this._tweenEasing = 0.0; - this._tweenProgress = 0.0; - this._valueScale = 1.0; - }; - TweenTimelineState.prototype._onArriveAtFrame = function() { - if ( - this._frameCount > 1 && - (this._frameIndex !== this._frameCount - 1 || - this._animationState.playTimes === 0 || - this._animationState.currentPlayTimes < - this._animationState.playTimes - 1) - ) { - this._tweenType = this._frameArray[ - this._frameOffset + 1 /* FrameTweenType */ - ]; - this._isTween = this._tweenType !== 0 /* None */; - if (this._isTween) { - if (this._tweenType === 2 /* Curve */) { - this._curveCount = this._frameArray[ - this._frameOffset + 2 /* FrameTweenEasingOrCurveSampleCount */ - ]; - } else if ( - this._tweenType !== 0 /* None */ && - this._tweenType !== 1 /* Line */ - ) { - this._tweenEasing = - this._frameArray[ - this._frameOffset + 2 /* FrameTweenEasingOrCurveSampleCount */ - ] * 0.01; - } - } else { - this.dirty = true; - } - this._framePosition = - this._frameArray[this._frameOffset] * this._frameRateR; - if (this._frameIndex === this._frameCount - 1) { - this._frameDurationR = - 1.0 / (this._animationData.duration - this._framePosition); - } else { - var nextFrameOffset = - this._animationData.frameOffset + - this._timelineArray[ - this._timelineData.offset + - 5 /* TimelineFrameOffset */ + - this._frameIndex + - 1 - ]; - var frameDuration = - this._frameArray[nextFrameOffset] * this._frameRateR - - this._framePosition; - if (frameDuration > 0) { - this._frameDurationR = 1.0 / frameDuration; - } else { - this._frameDurationR = 0.0; - } - } - } else { - this.dirty = true; - this._isTween = false; - } - }; - TweenTimelineState.prototype._onUpdateFrame = function() { - if (this._isTween) { - this.dirty = true; - this._tweenProgress = - (this.currentTime - this._framePosition) * this._frameDurationR; - if (this._tweenType === 2 /* Curve */) { - this._tweenProgress = TweenTimelineState._getEasingCurveValue( - this._tweenProgress, - this._frameArray, - this._curveCount, - this._frameOffset + 3 /* FrameCurveSamples */, - ); - } else if (this._tweenType !== 1 /* Line */) { - this._tweenProgress = TweenTimelineState._getEasingValue( - this._tweenType, - this._tweenProgress, - this._tweenEasing, - ); - } - } - }; - return TweenTimelineState; - })(TimelineState); - dragonBones.TweenTimelineState = TweenTimelineState; - /** - * @internal - */ - var SingleValueTimelineState = /** @class */ (function(_super) { - __extends(SingleValueTimelineState, _super); - function SingleValueTimelineState() { - return (_super !== null && _super.apply(this, arguments)) || this; - } - SingleValueTimelineState.prototype._onClear = function() { - _super.prototype._onClear.call(this); - this._current = 0.0; - this._difference = 0.0; - this._result = 0.0; - }; - SingleValueTimelineState.prototype._onArriveAtFrame = function() { - _super.prototype._onArriveAtFrame.call(this); - if (this._timelineData !== null) { - var valueScale = this._valueScale; - var valueArray = this._valueArray; - // - var valueOffset = - this._valueOffset + this._frameValueOffset + this._frameIndex; - if (this._isTween) { - var nextValueOffset = - this._frameIndex === this._frameCount - 1 - ? this._valueOffset + this._frameValueOffset - : valueOffset + 1; - if (valueScale === 1.0) { - this._current = valueArray[valueOffset]; - this._difference = valueArray[nextValueOffset] - this._current; - } else { - this._current = valueArray[valueOffset] * valueScale; - this._difference = - valueArray[nextValueOffset] * valueScale - this._current; - } - } else { - this._result = valueArray[valueOffset] * valueScale; - } - } else { - this._result = 0.0; - } - }; - SingleValueTimelineState.prototype._onUpdateFrame = function() { - _super.prototype._onUpdateFrame.call(this); - if (this._isTween) { - this._result = this._current + this._difference * this._tweenProgress; - } - }; - return SingleValueTimelineState; - })(TweenTimelineState); - dragonBones.SingleValueTimelineState = SingleValueTimelineState; - /** - * @internal - */ - var DoubleValueTimelineState = /** @class */ (function(_super) { - __extends(DoubleValueTimelineState, _super); - function DoubleValueTimelineState() { - return (_super !== null && _super.apply(this, arguments)) || this; - } - DoubleValueTimelineState.prototype._onClear = function() { - _super.prototype._onClear.call(this); - this._currentA = 0.0; - this._currentB = 0.0; - this._differenceA = 0.0; - this._differenceB = 0.0; - this._resultA = 0.0; - this._resultB = 0.0; - }; - DoubleValueTimelineState.prototype._onArriveAtFrame = function() { - _super.prototype._onArriveAtFrame.call(this); - if (this._timelineData !== null) { - var valueScale = this._valueScale; - var valueArray = this._valueArray; - // - var valueOffset = - this._valueOffset + this._frameValueOffset + this._frameIndex * 2; - if (this._isTween) { - var nextValueOffset = - this._frameIndex === this._frameCount - 1 - ? this._valueOffset + this._frameValueOffset - : valueOffset + 2; - if (valueScale === 1.0) { - this._currentA = valueArray[valueOffset]; - this._currentB = valueArray[valueOffset + 1]; - this._differenceA = valueArray[nextValueOffset] - this._currentA; - this._differenceB = - valueArray[nextValueOffset + 1] - this._currentB; - } else { - this._currentA = valueArray[valueOffset] * valueScale; - this._currentB = valueArray[valueOffset + 1] * valueScale; - this._differenceA = - valueArray[nextValueOffset] * valueScale - this._currentA; - this._differenceB = - valueArray[nextValueOffset + 1] * valueScale - this._currentB; - } - } else { - this._resultA = valueArray[valueOffset] * valueScale; - this._resultB = valueArray[valueOffset + 1] * valueScale; - } - } else { - this._resultA = 0.0; - this._resultB = 0.0; - } - }; - DoubleValueTimelineState.prototype._onUpdateFrame = function() { - _super.prototype._onUpdateFrame.call(this); - if (this._isTween) { - this._resultA = - this._currentA + this._differenceA * this._tweenProgress; - this._resultB = - this._currentB + this._differenceB * this._tweenProgress; - } - }; - return DoubleValueTimelineState; - })(TweenTimelineState); - dragonBones.DoubleValueTimelineState = DoubleValueTimelineState; - /** - * @internal - */ - var MutilpleValueTimelineState = /** @class */ (function(_super) { - __extends(MutilpleValueTimelineState, _super); - function MutilpleValueTimelineState() { - var _this = (_super !== null && _super.apply(this, arguments)) || this; - _this._rd = []; - return _this; - } - MutilpleValueTimelineState.prototype._onClear = function() { - _super.prototype._onClear.call(this); - this._valueCount = 0; - this._rd.length = 0; - }; - MutilpleValueTimelineState.prototype._onArriveAtFrame = function() { - _super.prototype._onArriveAtFrame.call(this); - var valueCount = this._valueCount; - var rd = this._rd; - if (this._timelineData !== null) { - var valueScale = this._valueScale; - var valueArray = this._valueArray; - // - var valueOffset = - this._valueOffset + - this._frameValueOffset + - this._frameIndex * valueCount; - if (this._isTween) { - var nextValueOffset = - this._frameIndex === this._frameCount - 1 - ? this._valueOffset + this._frameValueOffset - : valueOffset + valueCount; - if (valueScale === 1.0) { - for (var i = 0; i < valueCount; ++i) { - rd[valueCount + i] = - valueArray[nextValueOffset + i] - valueArray[valueOffset + i]; - } - } else { - for (var i = 0; i < valueCount; ++i) { - rd[valueCount + i] = - (valueArray[nextValueOffset + i] - - valueArray[valueOffset + i]) * - valueScale; - } - } - } else if (valueScale === 1.0) { - for (var i = 0; i < valueCount; ++i) { - rd[i] = valueArray[valueOffset + i]; - } - } else { - for (var i = 0; i < valueCount; ++i) { - rd[i] = valueArray[valueOffset + i] * valueScale; - } - } - } else { - for (var i = 0; i < valueCount; ++i) { - rd[i] = 0.0; - } - } - }; - MutilpleValueTimelineState.prototype._onUpdateFrame = function() { - _super.prototype._onUpdateFrame.call(this); - if (this._isTween) { - var valueCount = this._valueCount; - var valueScale = this._valueScale; - var tweenProgress = this._tweenProgress; - var valueArray = this._valueArray; - var rd = this._rd; - // - var valueOffset = - this._valueOffset + - this._frameValueOffset + - this._frameIndex * valueCount; - if (valueScale === 1.0) { - for (var i = 0; i < valueCount; ++i) { - rd[i] = - valueArray[valueOffset + i] + rd[valueCount + i] * tweenProgress; - } - } else { - for (var i = 0; i < valueCount; ++i) { - rd[i] = - valueArray[valueOffset + i] * valueScale + - rd[valueCount + i] * tweenProgress; - } - } - } - }; - return MutilpleValueTimelineState; - })(TweenTimelineState); - dragonBones.MutilpleValueTimelineState = MutilpleValueTimelineState; - })(dragonBones || (dragonBones = {})); - /** - * The MIT License (MIT) - * - * Copyright (c) 2012-2018 DragonBones team and other contributors - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of - * the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR - * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - (function(dragonBones) { - /** - * @internal - */ - var ActionTimelineState = /** @class */ (function(_super) { - __extends(ActionTimelineState, _super); - function ActionTimelineState() { - return (_super !== null && _super.apply(this, arguments)) || this; - } - ActionTimelineState.toString = function() { - return '[class dragonBones.ActionTimelineState]'; - }; - ActionTimelineState.prototype._onCrossFrame = function(frameIndex) { - var eventDispatcher = this._armature.eventDispatcher; - if (this._animationState.actionEnabled) { - var frameOffset = - this._animationData.frameOffset + - this._timelineArray[ - this._timelineData.offset + 5 /* TimelineFrameOffset */ + frameIndex - ]; - var actionCount = this._frameArray[frameOffset + 1]; - var actions = this._animationData.parent.actions; // May be the animaton data not belong to this armature data. - for (var i = 0; i < actionCount; ++i) { - var actionIndex = this._frameArray[frameOffset + 2 + i]; - var action = actions[actionIndex]; - if (action.type === 0 /* Play */) { - var eventObject = dragonBones.BaseObject.borrowObject( - dragonBones.EventObject, - ); - // eventObject.time = this._frameArray[frameOffset] * this._frameRateR; // Precision problem - eventObject.time = this._frameArray[frameOffset] / this._frameRate; - eventObject.animationState = this._animationState; - dragonBones.EventObject.actionDataToInstance( - action, - eventObject, - this._armature, - ); - this._armature._bufferAction(eventObject, true); - } else { - var eventType = - action.type === 10 /* Frame */ - ? dragonBones.EventObject.FRAME_EVENT - : dragonBones.EventObject.SOUND_EVENT; - if ( - action.type === 11 /* Sound */ || - eventDispatcher.hasDBEventListener(eventType) - ) { - var eventObject = dragonBones.BaseObject.borrowObject( - dragonBones.EventObject, - ); - // eventObject.time = this._frameArray[frameOffset] * this._frameRateR; // Precision problem - eventObject.time = - this._frameArray[frameOffset] / this._frameRate; - eventObject.animationState = this._animationState; - dragonBones.EventObject.actionDataToInstance( - action, - eventObject, - this._armature, - ); - this._armature._dragonBones.bufferEvent(eventObject); - } - } - } - } - }; - ActionTimelineState.prototype._onArriveAtFrame = function() {}; - ActionTimelineState.prototype._onUpdateFrame = function() {}; - ActionTimelineState.prototype.update = function(passedTime) { - var prevState = this.playState; - var prevPlayTimes = this.currentPlayTimes; - var prevTime = this.currentTime; - if (this._setCurrentTime(passedTime)) { - var eventActive = - this._animationState._parent === null && - this._animationState.actionEnabled; - var eventDispatcher = this._armature.eventDispatcher; - if (prevState < 0) { - if (this.playState !== prevState) { - if ( - this._animationState.displayControl && - this._animationState.resetToPose - ) { - this._armature._sortZOrder(null, 0); - } - prevPlayTimes = this.currentPlayTimes; - if ( - eventActive && - eventDispatcher.hasDBEventListener(dragonBones.EventObject.START) - ) { - var eventObject = dragonBones.BaseObject.borrowObject( - dragonBones.EventObject, - ); - eventObject.type = dragonBones.EventObject.START; - eventObject.armature = this._armature; - eventObject.animationState = this._animationState; - this._armature._dragonBones.bufferEvent(eventObject); - } - } else { - return; - } - } - var isReverse = this._animationState.timeScale < 0.0; - var loopCompleteEvent = null; - var completeEvent = null; - if (eventActive && this.currentPlayTimes !== prevPlayTimes) { - if ( - eventDispatcher.hasDBEventListener( - dragonBones.EventObject.LOOP_COMPLETE, - ) - ) { - loopCompleteEvent = dragonBones.BaseObject.borrowObject( - dragonBones.EventObject, - ); - loopCompleteEvent.type = dragonBones.EventObject.LOOP_COMPLETE; - loopCompleteEvent.armature = this._armature; - loopCompleteEvent.animationState = this._animationState; - } - if (this.playState > 0) { - if ( - eventDispatcher.hasDBEventListener( - dragonBones.EventObject.COMPLETE, - ) - ) { - completeEvent = dragonBones.BaseObject.borrowObject( - dragonBones.EventObject, - ); - completeEvent.type = dragonBones.EventObject.COMPLETE; - completeEvent.armature = this._armature; - completeEvent.animationState = this._animationState; - } - } - } - if (this._frameCount > 1) { - var timelineData = this._timelineData; - var timelineFrameIndex = Math.floor( - this.currentTime * this._frameRate, - ); // uint - var frameIndex = this._frameIndices[ - timelineData.frameIndicesOffset + timelineFrameIndex - ]; - if (this._frameIndex !== frameIndex) { - var crossedFrameIndex = this._frameIndex; - this._frameIndex = frameIndex; - if (this._timelineArray !== null) { - this._frameOffset = - this._animationData.frameOffset + - this._timelineArray[ - timelineData.offset + - 5 /* TimelineFrameOffset */ + - this._frameIndex - ]; - if (isReverse) { - if (crossedFrameIndex < 0) { - var prevFrameIndex = Math.floor(prevTime * this._frameRate); - crossedFrameIndex = this._frameIndices[ - timelineData.frameIndicesOffset + prevFrameIndex - ]; - if (this.currentPlayTimes === prevPlayTimes) { - if (crossedFrameIndex === frameIndex) { - crossedFrameIndex = -1; - } - } - } - while (crossedFrameIndex >= 0) { - var frameOffset = - this._animationData.frameOffset + - this._timelineArray[ - timelineData.offset + - 5 /* TimelineFrameOffset */ + - crossedFrameIndex - ]; - // const framePosition = this._frameArray[frameOffset] * this._frameRateR; // Precision problem - var framePosition = - this._frameArray[frameOffset] / this._frameRate; - if ( - this._position <= framePosition && - framePosition <= this._position + this._duration - ) { - this._onCrossFrame(crossedFrameIndex); - } - if (loopCompleteEvent !== null && crossedFrameIndex === 0) { - this._armature._dragonBones.bufferEvent(loopCompleteEvent); - loopCompleteEvent = null; - } - if (crossedFrameIndex > 0) { - crossedFrameIndex--; - } else { - crossedFrameIndex = this._frameCount - 1; - } - if (crossedFrameIndex === frameIndex) { - break; - } - } - } else { - if (crossedFrameIndex < 0) { - var prevFrameIndex = Math.floor(prevTime * this._frameRate); - crossedFrameIndex = this._frameIndices[ - timelineData.frameIndicesOffset + prevFrameIndex - ]; - var frameOffset = - this._animationData.frameOffset + - this._timelineArray[ - timelineData.offset + - 5 /* TimelineFrameOffset */ + - crossedFrameIndex - ]; - // const framePosition = this._frameArray[frameOffset] * this._frameRateR; // Precision problem - var framePosition = - this._frameArray[frameOffset] / this._frameRate; - if (this.currentPlayTimes === prevPlayTimes) { - if (prevTime <= framePosition) { - if (crossedFrameIndex > 0) { - crossedFrameIndex--; - } else { - crossedFrameIndex = this._frameCount - 1; - } - } else if (crossedFrameIndex === frameIndex) { - crossedFrameIndex = -1; - } - } - } - while (crossedFrameIndex >= 0) { - if (crossedFrameIndex < this._frameCount - 1) { - crossedFrameIndex++; - } else { - crossedFrameIndex = 0; - } - var frameOffset = - this._animationData.frameOffset + - this._timelineArray[ - timelineData.offset + - 5 /* TimelineFrameOffset */ + - crossedFrameIndex - ]; - // const framePosition = this._frameArray[frameOffset] * this._frameRateR; // Precision problem - var framePosition = - this._frameArray[frameOffset] / this._frameRate; - if ( - this._position <= framePosition && - framePosition <= this._position + this._duration // - ) { - this._onCrossFrame(crossedFrameIndex); - } - if (loopCompleteEvent !== null && crossedFrameIndex === 0) { - this._armature._dragonBones.bufferEvent(loopCompleteEvent); - loopCompleteEvent = null; - } - if (crossedFrameIndex === frameIndex) { - break; - } - } - } - } - } - } else if (this._frameIndex < 0) { - this._frameIndex = 0; - if (this._timelineData !== null) { - this._frameOffset = - this._animationData.frameOffset + - this._timelineArray[ - this._timelineData.offset + 5 /* TimelineFrameOffset */ - ]; - // Arrive at frame. - var framePosition = - this._frameArray[this._frameOffset] / this._frameRate; - if (this.currentPlayTimes === prevPlayTimes) { - if (prevTime <= framePosition) { - this._onCrossFrame(this._frameIndex); - } - } else if (this._position <= framePosition) { - if (!isReverse && loopCompleteEvent !== null) { - this._armature._dragonBones.bufferEvent(loopCompleteEvent); - loopCompleteEvent = null; - } - this._onCrossFrame(this._frameIndex); - } - } - } - if (loopCompleteEvent !== null) { - this._armature._dragonBones.bufferEvent(loopCompleteEvent); - } - if (completeEvent !== null) { - this._armature._dragonBones.bufferEvent(completeEvent); - } - } - }; - ActionTimelineState.prototype.setCurrentTime = function(value) { - this._setCurrentTime(value); - this._frameIndex = -1; - }; - return ActionTimelineState; - })(dragonBones.TimelineState); - dragonBones.ActionTimelineState = ActionTimelineState; - /** - * @internal - */ - var ZOrderTimelineState = /** @class */ (function(_super) { - __extends(ZOrderTimelineState, _super); - function ZOrderTimelineState() { - return (_super !== null && _super.apply(this, arguments)) || this; - } - ZOrderTimelineState.toString = function() { - return '[class dragonBones.ZOrderTimelineState]'; - }; - ZOrderTimelineState.prototype._onArriveAtFrame = function() { - if (this.playState >= 0) { - var count = this._frameArray[this._frameOffset + 1]; - if (count > 0) { - this._armature._sortZOrder(this._frameArray, this._frameOffset + 2); - } else { - this._armature._sortZOrder(null, 0); - } - } - }; - ZOrderTimelineState.prototype._onUpdateFrame = function() {}; - return ZOrderTimelineState; - })(dragonBones.TimelineState); - dragonBones.ZOrderTimelineState = ZOrderTimelineState; - /** - * @internal - */ - var BoneAllTimelineState = /** @class */ (function(_super) { - __extends(BoneAllTimelineState, _super); - function BoneAllTimelineState() { - return (_super !== null && _super.apply(this, arguments)) || this; - } - BoneAllTimelineState.toString = function() { - return '[class dragonBones.BoneAllTimelineState]'; - }; - BoneAllTimelineState.prototype._onArriveAtFrame = function() { - _super.prototype._onArriveAtFrame.call(this); - if (this._isTween && this._frameIndex === this._frameCount - 1) { - this._rd[2] = dragonBones.Transform.normalizeRadian(this._rd[2]); - this._rd[3] = dragonBones.Transform.normalizeRadian(this._rd[3]); - } - if (this._timelineData === null) { - this._rd[4] = 1.0; - this._rd[5] = 1.0; - } - }; - BoneAllTimelineState.prototype.init = function( - armature, - animationState, - timelineData, - ) { - _super.prototype.init.call(this, armature, animationState, timelineData); - this._valueOffset = this._animationData.frameFloatOffset; - this._valueCount = 6; - this._valueArray = this._animationData.parent.parent.frameFloatArray; - }; - BoneAllTimelineState.prototype.fadeOut = function() { - this.dirty = false; - this._rd[2] = dragonBones.Transform.normalizeRadian(this._rd[2]); - this._rd[3] = dragonBones.Transform.normalizeRadian(this._rd[3]); - }; - BoneAllTimelineState.prototype.blend = function(isDirty) { - var valueScale = this._armature.armatureData.scale; - var rd = this._rd; - // - var blendState = this.target; - var bone = blendState.target; - var blendWeight = blendState.blendWeight; - var result = bone.animationPose; - if (blendState.dirty > 1) { - result.x += rd[0] * blendWeight * valueScale; - result.y += rd[1] * blendWeight * valueScale; - result.rotation += rd[2] * blendWeight; - result.skew += rd[3] * blendWeight; - result.scaleX += (rd[4] - 1.0) * blendWeight; - result.scaleY += (rd[5] - 1.0) * blendWeight; - } else { - result.x = rd[0] * blendWeight * valueScale; - result.y = rd[1] * blendWeight * valueScale; - result.rotation = rd[2] * blendWeight; - result.skew = rd[3] * blendWeight; - result.scaleX = (rd[4] - 1.0) * blendWeight + 1.0; // - result.scaleY = (rd[5] - 1.0) * blendWeight + 1.0; // - } - if (isDirty || this.dirty) { - this.dirty = false; - bone._transformDirty = true; - } - }; - return BoneAllTimelineState; - })(dragonBones.MutilpleValueTimelineState); - dragonBones.BoneAllTimelineState = BoneAllTimelineState; - /** - * @internal - */ - var BoneTranslateTimelineState = /** @class */ (function(_super) { - __extends(BoneTranslateTimelineState, _super); - function BoneTranslateTimelineState() { - return (_super !== null && _super.apply(this, arguments)) || this; - } - BoneTranslateTimelineState.toString = function() { - return '[class dragonBones.BoneTranslateTimelineState]'; - }; - BoneTranslateTimelineState.prototype.init = function( - armature, - animationState, - timelineData, - ) { - _super.prototype.init.call(this, armature, animationState, timelineData); - this._valueOffset = this._animationData.frameFloatOffset; - this._valueScale = this._armature.armatureData.scale; - this._valueArray = this._animationData.parent.parent.frameFloatArray; - }; - BoneTranslateTimelineState.prototype.blend = function(isDirty) { - var blendState = this.target; - var bone = blendState.target; - var blendWeight = blendState.blendWeight; - var result = bone.animationPose; - if (blendState.dirty > 1) { - result.x += this._resultA * blendWeight; - result.y += this._resultB * blendWeight; - } else if (blendWeight !== 1.0) { - result.x = this._resultA * blendWeight; - result.y = this._resultB * blendWeight; - } else { - result.x = this._resultA; - result.y = this._resultB; - } - if (isDirty || this.dirty) { - this.dirty = false; - bone._transformDirty = true; - } - }; - return BoneTranslateTimelineState; - })(dragonBones.DoubleValueTimelineState); - dragonBones.BoneTranslateTimelineState = BoneTranslateTimelineState; - /** - * @internal - */ - var BoneRotateTimelineState = /** @class */ (function(_super) { - __extends(BoneRotateTimelineState, _super); - function BoneRotateTimelineState() { - return (_super !== null && _super.apply(this, arguments)) || this; - } - BoneRotateTimelineState.toString = function() { - return '[class dragonBones.BoneRotateTimelineState]'; - }; - BoneRotateTimelineState.prototype._onArriveAtFrame = function() { - _super.prototype._onArriveAtFrame.call(this); - if (this._isTween && this._frameIndex === this._frameCount - 1) { - this._differenceA = dragonBones.Transform.normalizeRadian( - this._differenceA, - ); - this._differenceB = dragonBones.Transform.normalizeRadian( - this._differenceB, - ); - } - }; - BoneRotateTimelineState.prototype.init = function( - armature, - animationState, - timelineData, - ) { - _super.prototype.init.call(this, armature, animationState, timelineData); - this._valueOffset = this._animationData.frameFloatOffset; - this._valueArray = this._animationData.parent.parent.frameFloatArray; - }; - BoneRotateTimelineState.prototype.fadeOut = function() { - this.dirty = false; - this._resultA = dragonBones.Transform.normalizeRadian(this._resultA); - this._resultB = dragonBones.Transform.normalizeRadian(this._resultB); - }; - BoneRotateTimelineState.prototype.blend = function(isDirty) { - var blendState = this.target; - var bone = blendState.target; - var blendWeight = blendState.blendWeight; - var result = bone.animationPose; - if (blendState.dirty > 1) { - result.rotation += this._resultA * blendWeight; - result.skew += this._resultB * blendWeight; - } else if (blendWeight !== 1.0) { - result.rotation = this._resultA * blendWeight; - result.skew = this._resultB * blendWeight; - } else { - result.rotation = this._resultA; - result.skew = this._resultB; - } - if (isDirty || this.dirty) { - this.dirty = false; - bone._transformDirty = true; - } - }; - return BoneRotateTimelineState; - })(dragonBones.DoubleValueTimelineState); - dragonBones.BoneRotateTimelineState = BoneRotateTimelineState; - /** - * @internal - */ - var BoneScaleTimelineState = /** @class */ (function(_super) { - __extends(BoneScaleTimelineState, _super); - function BoneScaleTimelineState() { - return (_super !== null && _super.apply(this, arguments)) || this; - } - BoneScaleTimelineState.toString = function() { - return '[class dragonBones.BoneScaleTimelineState]'; - }; - BoneScaleTimelineState.prototype._onArriveAtFrame = function() { - _super.prototype._onArriveAtFrame.call(this); - if (this._timelineData === null) { - this._resultA = 1.0; - this._resultB = 1.0; - } - }; - BoneScaleTimelineState.prototype.init = function( - armature, - animationState, - timelineData, - ) { - _super.prototype.init.call(this, armature, animationState, timelineData); - this._valueOffset = this._animationData.frameFloatOffset; - this._valueArray = this._animationData.parent.parent.frameFloatArray; - }; - BoneScaleTimelineState.prototype.blend = function(isDirty) { - var blendState = this.target; - var bone = blendState.target; - var blendWeight = blendState.blendWeight; - var result = bone.animationPose; - if (blendState.dirty > 1) { - result.scaleX += (this._resultA - 1.0) * blendWeight; - result.scaleY += (this._resultB - 1.0) * blendWeight; - } else if (blendWeight !== 1.0) { - result.scaleX = (this._resultA - 1.0) * blendWeight + 1.0; - result.scaleY = (this._resultB - 1.0) * blendWeight + 1.0; - } else { - result.scaleX = this._resultA; - result.scaleY = this._resultB; - } - if (isDirty || this.dirty) { - this.dirty = false; - bone._transformDirty = true; - } - }; - return BoneScaleTimelineState; - })(dragonBones.DoubleValueTimelineState); - dragonBones.BoneScaleTimelineState = BoneScaleTimelineState; - /** - * @internal - */ - var SurfaceTimelineState = /** @class */ (function(_super) { - __extends(SurfaceTimelineState, _super); - function SurfaceTimelineState() { - return (_super !== null && _super.apply(this, arguments)) || this; - } - SurfaceTimelineState.toString = function() { - return '[class dragonBones.SurfaceTimelineState]'; - }; - SurfaceTimelineState.prototype._onClear = function() { - _super.prototype._onClear.call(this); - this._deformCount = 0; - this._deformOffset = 0; - this._sameValueOffset = 0; - }; - SurfaceTimelineState.prototype.init = function( - armature, - animationState, - timelineData, - ) { - _super.prototype.init.call(this, armature, animationState, timelineData); - if (this._timelineData !== null) { - var dragonBonesData = this._animationData.parent.parent; - var frameIntArray = dragonBonesData.frameIntArray; - var frameIntOffset = - this._animationData.frameIntOffset + - this._timelineArray[ - this._timelineData.offset + 3 /* TimelineFrameValueCount */ - ]; - this._valueOffset = this._animationData.frameFloatOffset; - this._valueCount = - frameIntArray[frameIntOffset + 2 /* DeformValueCount */]; - this._deformCount = frameIntArray[frameIntOffset + 1 /* DeformCount */]; - this._deformOffset = - frameIntArray[frameIntOffset + 3 /* DeformValueOffset */]; - this._sameValueOffset = - frameIntArray[frameIntOffset + 4 /* DeformFloatOffset */] + - this._animationData.frameFloatOffset; - this._valueScale = this._armature.armatureData.scale; - this._valueArray = dragonBonesData.frameFloatArray; - this._rd.length = this._valueCount * 2; - } else { - this._deformCount = this.target.target._deformVertices.length; - } - }; - SurfaceTimelineState.prototype.blend = function(isDirty) { - var blendState = this.target; - var surface = blendState.target; - var blendWeight = blendState.blendWeight; - var result = surface._deformVertices; - var valueArray = this._valueArray; - if (valueArray !== null) { - var valueCount = this._valueCount; - var deformOffset = this._deformOffset; - var sameValueOffset = this._sameValueOffset; - var rd = this._rd; - for (var i = 0; i < this._deformCount; ++i) { - var value = 0.0; - if (i < deformOffset) { - value = valueArray[sameValueOffset + i]; - } else if (i < deformOffset + valueCount) { - value = rd[i - deformOffset]; - } else { - value = valueArray[sameValueOffset + i - valueCount]; - } - if (blendState.dirty > 1) { - result[i] += value * blendWeight; - } else { - result[i] = value * blendWeight; - } - } - } else if (blendState.dirty === 1) { - for (var i = 0; i < this._deformCount; ++i) { - result[i] = 0.0; - } - } - if (isDirty || this.dirty) { - this.dirty = false; - surface._transformDirty = true; - } - }; - return SurfaceTimelineState; - })(dragonBones.MutilpleValueTimelineState); - dragonBones.SurfaceTimelineState = SurfaceTimelineState; - /** - * @internal - */ - var AlphaTimelineState = /** @class */ (function(_super) { - __extends(AlphaTimelineState, _super); - function AlphaTimelineState() { - return (_super !== null && _super.apply(this, arguments)) || this; - } - AlphaTimelineState.toString = function() { - return '[class dragonBones.AlphaTimelineState]'; - }; - AlphaTimelineState.prototype._onArriveAtFrame = function() { - _super.prototype._onArriveAtFrame.call(this); - if (this._timelineData === null) { - this._result = 1.0; - } - }; - AlphaTimelineState.prototype.init = function( - armature, - animationState, - timelineData, - ) { - _super.prototype.init.call(this, armature, animationState, timelineData); - this._valueOffset = this._animationData.frameIntOffset; - this._valueScale = 0.01; - this._valueArray = this._animationData.parent.parent.frameIntArray; - }; - AlphaTimelineState.prototype.blend = function(isDirty) { - var blendState = this.target; - var alphaTarget = blendState.target; - var blendWeight = blendState.blendWeight; - if (blendState.dirty > 1) { - alphaTarget._alpha += this._result * blendWeight; - if (alphaTarget._alpha > 1.0) { - alphaTarget._alpha = 1.0; - } - } else { - alphaTarget._alpha = this._result * blendWeight; - } - if (isDirty || this.dirty) { - this.dirty = false; - this._armature._alphaDirty = true; - } - }; - return AlphaTimelineState; - })(dragonBones.SingleValueTimelineState); - dragonBones.AlphaTimelineState = AlphaTimelineState; - /** - * @internal - */ - var SlotDislayTimelineState = /** @class */ (function(_super) { - __extends(SlotDislayTimelineState, _super); - function SlotDislayTimelineState() { - return (_super !== null && _super.apply(this, arguments)) || this; - } - SlotDislayTimelineState.toString = function() { - return '[class dragonBones.SlotDislayTimelineState]'; - }; - SlotDislayTimelineState.prototype._onArriveAtFrame = function() { - if (this.playState >= 0) { - var slot = this.target; - var displayIndex = - this._timelineData !== null - ? this._frameArray[this._frameOffset + 1] - : slot._slotData.displayIndex; - if (slot.displayIndex !== displayIndex) { - slot._setDisplayIndex(displayIndex, true); - } - } - }; - SlotDislayTimelineState.prototype._onUpdateFrame = function() {}; - return SlotDislayTimelineState; - })(dragonBones.TimelineState); - dragonBones.SlotDislayTimelineState = SlotDislayTimelineState; - /** - * @internal - */ - var SlotColorTimelineState = /** @class */ (function(_super) { - __extends(SlotColorTimelineState, _super); - function SlotColorTimelineState() { - var _this = (_super !== null && _super.apply(this, arguments)) || this; - _this._current = [0, 0, 0, 0, 0, 0, 0, 0]; - _this._difference = [0, 0, 0, 0, 0, 0, 0, 0]; - _this._result = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]; - return _this; - } - SlotColorTimelineState.toString = function() { - return '[class dragonBones.SlotColorTimelineState]'; - }; - SlotColorTimelineState.prototype._onArriveAtFrame = function() { - _super.prototype._onArriveAtFrame.call(this); - if (this._timelineData !== null) { - var dragonBonesData = this._animationData.parent.parent; - var colorArray = dragonBonesData.colorArray; - var frameIntArray = dragonBonesData.frameIntArray; - var valueOffset = - this._animationData.frameIntOffset + - this._frameValueOffset + - this._frameIndex; - var colorOffset = frameIntArray[valueOffset]; - if (colorOffset < 0) { - colorOffset += 65536; // Fixed out of bounds bug. - } - if (this._isTween) { - this._current[0] = colorArray[colorOffset++]; - this._current[1] = colorArray[colorOffset++]; - this._current[2] = colorArray[colorOffset++]; - this._current[3] = colorArray[colorOffset++]; - this._current[4] = colorArray[colorOffset++]; - this._current[5] = colorArray[colorOffset++]; - this._current[6] = colorArray[colorOffset++]; - this._current[7] = colorArray[colorOffset++]; - if (this._frameIndex === this._frameCount - 1) { - colorOffset = - frameIntArray[ - this._animationData.frameIntOffset + this._frameValueOffset - ]; - } else { - colorOffset = frameIntArray[valueOffset + 1]; - } - if (colorOffset < 0) { - colorOffset += 65536; // Fixed out of bounds bug. - } - this._difference[0] = colorArray[colorOffset++] - this._current[0]; - this._difference[1] = colorArray[colorOffset++] - this._current[1]; - this._difference[2] = colorArray[colorOffset++] - this._current[2]; - this._difference[3] = colorArray[colorOffset++] - this._current[3]; - this._difference[4] = colorArray[colorOffset++] - this._current[4]; - this._difference[5] = colorArray[colorOffset++] - this._current[5]; - this._difference[6] = colorArray[colorOffset++] - this._current[6]; - this._difference[7] = colorArray[colorOffset++] - this._current[7]; - } else { - this._result[0] = colorArray[colorOffset++] * 0.01; - this._result[1] = colorArray[colorOffset++] * 0.01; - this._result[2] = colorArray[colorOffset++] * 0.01; - this._result[3] = colorArray[colorOffset++] * 0.01; - this._result[4] = colorArray[colorOffset++]; - this._result[5] = colorArray[colorOffset++]; - this._result[6] = colorArray[colorOffset++]; - this._result[7] = colorArray[colorOffset++]; - } - } else { - var slot = this.target; - var color = slot.slotData.color; - this._result[0] = color.alphaMultiplier; - this._result[1] = color.redMultiplier; - this._result[2] = color.greenMultiplier; - this._result[3] = color.blueMultiplier; - this._result[4] = color.alphaOffset; - this._result[5] = color.redOffset; - this._result[6] = color.greenOffset; - this._result[7] = color.blueOffset; - } - }; - SlotColorTimelineState.prototype._onUpdateFrame = function() { - _super.prototype._onUpdateFrame.call(this); - if (this._isTween) { - this._result[0] = - (this._current[0] + this._difference[0] * this._tweenProgress) * 0.01; - this._result[1] = - (this._current[1] + this._difference[1] * this._tweenProgress) * 0.01; - this._result[2] = - (this._current[2] + this._difference[2] * this._tweenProgress) * 0.01; - this._result[3] = - (this._current[3] + this._difference[3] * this._tweenProgress) * 0.01; - this._result[4] = - this._current[4] + this._difference[4] * this._tweenProgress; - this._result[5] = - this._current[5] + this._difference[5] * this._tweenProgress; - this._result[6] = - this._current[6] + this._difference[6] * this._tweenProgress; - this._result[7] = - this._current[7] + this._difference[7] * this._tweenProgress; - } - }; - SlotColorTimelineState.prototype.fadeOut = function() { - this._isTween = false; - }; - SlotColorTimelineState.prototype.update = function(passedTime) { - _super.prototype.update.call(this, passedTime); - // Fade animation. - if (this._isTween || this.dirty) { - var slot = this.target; - var result = slot._colorTransform; - if ( - this._animationState._fadeState !== 0 || - this._animationState._subFadeState !== 0 - ) { - if ( - result.alphaMultiplier !== this._result[0] || - result.redMultiplier !== this._result[1] || - result.greenMultiplier !== this._result[2] || - result.blueMultiplier !== this._result[3] || - result.alphaOffset !== this._result[4] || - result.redOffset !== this._result[5] || - result.greenOffset !== this._result[6] || - result.blueOffset !== this._result[7] - ) { - var fadeProgress = Math.pow(this._animationState._fadeProgress, 4); - result.alphaMultiplier += - (this._result[0] - result.alphaMultiplier) * fadeProgress; - result.redMultiplier += - (this._result[1] - result.redMultiplier) * fadeProgress; - result.greenMultiplier += - (this._result[2] - result.greenMultiplier) * fadeProgress; - result.blueMultiplier += - (this._result[3] - result.blueMultiplier) * fadeProgress; - result.alphaOffset += - (this._result[4] - result.alphaOffset) * fadeProgress; - result.redOffset += - (this._result[5] - result.redOffset) * fadeProgress; - result.greenOffset += - (this._result[6] - result.greenOffset) * fadeProgress; - result.blueOffset += - (this._result[7] - result.blueOffset) * fadeProgress; - slot._colorDirty = true; - } - } else if (this.dirty) { - this.dirty = false; - if ( - result.alphaMultiplier !== this._result[0] || - result.redMultiplier !== this._result[1] || - result.greenMultiplier !== this._result[2] || - result.blueMultiplier !== this._result[3] || - result.alphaOffset !== this._result[4] || - result.redOffset !== this._result[5] || - result.greenOffset !== this._result[6] || - result.blueOffset !== this._result[7] - ) { - result.alphaMultiplier = this._result[0]; - result.redMultiplier = this._result[1]; - result.greenMultiplier = this._result[2]; - result.blueMultiplier = this._result[3]; - result.alphaOffset = this._result[4]; - result.redOffset = this._result[5]; - result.greenOffset = this._result[6]; - result.blueOffset = this._result[7]; - slot._colorDirty = true; - } - } - } - }; - return SlotColorTimelineState; - })(dragonBones.TweenTimelineState); - dragonBones.SlotColorTimelineState = SlotColorTimelineState; - /** - * @internal - */ - var SlotZIndexTimelineState = /** @class */ (function(_super) { - __extends(SlotZIndexTimelineState, _super); - function SlotZIndexTimelineState() { - return (_super !== null && _super.apply(this, arguments)) || this; - } - SlotZIndexTimelineState.toString = function() { - return '[class dragonBones.SlotZIndexTimelineState]'; - }; - SlotZIndexTimelineState.prototype._onArriveAtFrame = function() { - _super.prototype._onArriveAtFrame.call(this); - if (this._timelineData === null) { - var blendState = this.target; - var slot = blendState.target; - this._result = slot.slotData.zIndex; - } - }; - SlotZIndexTimelineState.prototype.init = function( - armature, - animationState, - timelineData, - ) { - _super.prototype.init.call(this, armature, animationState, timelineData); - this._valueOffset = this._animationData.frameIntOffset; - this._valueArray = this._animationData.parent.parent.frameIntArray; - }; - SlotZIndexTimelineState.prototype.blend = function(isDirty) { - var blendState = this.target; - var slot = blendState.target; - var blendWeight = blendState.blendWeight; - if (blendState.dirty > 1) { - slot._zIndex += this._result * blendWeight; - } else { - slot._zIndex = this._result * blendWeight; - } - if (isDirty || this.dirty) { - this.dirty = false; - this._armature._zIndexDirty = true; - } - }; - return SlotZIndexTimelineState; - })(dragonBones.SingleValueTimelineState); - dragonBones.SlotZIndexTimelineState = SlotZIndexTimelineState; - /** - * @internal - */ - var DeformTimelineState = /** @class */ (function(_super) { - __extends(DeformTimelineState, _super); - function DeformTimelineState() { - return (_super !== null && _super.apply(this, arguments)) || this; - } - DeformTimelineState.toString = function() { - return '[class dragonBones.DeformTimelineState]'; - }; - DeformTimelineState.prototype._onClear = function() { - _super.prototype._onClear.call(this); - this.geometryOffset = 0; - this.displayFrame = null; - this._deformCount = 0; - this._deformOffset = 0; - this._sameValueOffset = 0; - }; - DeformTimelineState.prototype.init = function( - armature, - animationState, - timelineData, - ) { - _super.prototype.init.call(this, armature, animationState, timelineData); - if (this._timelineData !== null) { - var frameIntOffset = - this._animationData.frameIntOffset + - this._timelineArray[ - this._timelineData.offset + 3 /* TimelineFrameValueCount */ - ]; - var dragonBonesData = this._animationData.parent.parent; - var frameIntArray = dragonBonesData.frameIntArray; - var slot = this.target.target; - this.geometryOffset = - frameIntArray[frameIntOffset + 0 /* DeformVertexOffset */]; - if (this.geometryOffset < 0) { - this.geometryOffset += 65536; // Fixed out of bounds bug. - } - for (var i = 0, l = slot.displayFrameCount; i < l; ++i) { - var displayFrame = slot.getDisplayFrameAt(i); - var geometryData = displayFrame.getGeometryData(); - if (geometryData === null) { - continue; - } - if (geometryData.offset === this.geometryOffset) { - this.displayFrame = displayFrame; - this.displayFrame.updateDeformVertices(); - break; - } - } - if (this.displayFrame === null) { - this.returnToPool(); // - return; - } - this._valueOffset = this._animationData.frameFloatOffset; - this._valueCount = - frameIntArray[frameIntOffset + 2 /* DeformValueCount */]; - this._deformCount = frameIntArray[frameIntOffset + 1 /* DeformCount */]; - this._deformOffset = - frameIntArray[frameIntOffset + 3 /* DeformValueOffset */]; - this._sameValueOffset = - frameIntArray[frameIntOffset + 4 /* DeformFloatOffset */] + - this._animationData.frameFloatOffset; - this._valueScale = this._armature.armatureData.scale; - this._valueArray = dragonBonesData.frameFloatArray; - this._rd.length = this._valueCount * 2; - } else { - this._deformCount = this.displayFrame.deformVertices.length; - } - }; - DeformTimelineState.prototype.blend = function(isDirty) { - var blendState = this.target; - var slot = blendState.target; - var blendWeight = blendState.blendWeight; - var result = this.displayFrame.deformVertices; - var valueArray = this._valueArray; - if (valueArray !== null) { - var valueCount = this._valueCount; - var deformOffset = this._deformOffset; - var sameValueOffset = this._sameValueOffset; - var rd = this._rd; - for (var i = 0; i < this._deformCount; ++i) { - var value = 0.0; - if (i < deformOffset) { - value = valueArray[sameValueOffset + i]; - } else if (i < deformOffset + valueCount) { - value = rd[i - deformOffset]; - } else { - value = valueArray[sameValueOffset + i - valueCount]; - } - if (blendState.dirty > 1) { - result[i] += value * blendWeight; - } else { - result[i] = value * blendWeight; - } - } - } else if (blendState.dirty === 1) { - for (var i = 0; i < this._deformCount; ++i) { - result[i] = 0.0; - } - } - if (isDirty || this.dirty) { - this.dirty = false; - if (slot._geometryData === this.displayFrame.getGeometryData()) { - slot._verticesDirty = true; - } - } - }; - return DeformTimelineState; - })(dragonBones.MutilpleValueTimelineState); - dragonBones.DeformTimelineState = DeformTimelineState; - /** - * @internal - */ - var IKConstraintTimelineState = /** @class */ (function(_super) { - __extends(IKConstraintTimelineState, _super); - function IKConstraintTimelineState() { - return (_super !== null && _super.apply(this, arguments)) || this; - } - IKConstraintTimelineState.toString = function() { - return '[class dragonBones.IKConstraintTimelineState]'; - }; - IKConstraintTimelineState.prototype._onUpdateFrame = function() { - _super.prototype._onUpdateFrame.call(this); - var ikConstraint = this.target; - if (this._timelineData !== null) { - ikConstraint._bendPositive = this._currentA > 0.0; - ikConstraint._weight = this._currentB; - } else { - var ikConstraintData = ikConstraint._constraintData; - ikConstraint._bendPositive = ikConstraintData.bendPositive; - ikConstraint._weight = ikConstraintData.weight; - } - ikConstraint.invalidUpdate(); - this.dirty = false; - }; - IKConstraintTimelineState.prototype.init = function( - armature, - animationState, - timelineData, - ) { - _super.prototype.init.call(this, armature, animationState, timelineData); - this._valueOffset = this._animationData.frameIntOffset; - this._valueScale = 0.01; - this._valueArray = this._animationData.parent.parent.frameIntArray; - }; - return IKConstraintTimelineState; - })(dragonBones.DoubleValueTimelineState); - dragonBones.IKConstraintTimelineState = IKConstraintTimelineState; - /** - * @internal - */ - var AnimationProgressTimelineState = /** @class */ (function(_super) { - __extends(AnimationProgressTimelineState, _super); - function AnimationProgressTimelineState() { - return (_super !== null && _super.apply(this, arguments)) || this; - } - AnimationProgressTimelineState.toString = function() { - return '[class dragonBones.AnimationProgressTimelineState]'; - }; - AnimationProgressTimelineState.prototype._onUpdateFrame = function() { - _super.prototype._onUpdateFrame.call(this); - var animationState = this.target; - if (animationState._parent !== null) { - animationState.currentTime = this._result * animationState.totalTime; - } - this.dirty = false; - }; - AnimationProgressTimelineState.prototype.init = function( - armature, - animationState, - timelineData, - ) { - _super.prototype.init.call(this, armature, animationState, timelineData); - this._valueOffset = this._animationData.frameIntOffset; - this._valueScale = 0.0001; - this._valueArray = this._animationData.parent.parent.frameIntArray; - }; - return AnimationProgressTimelineState; - })(dragonBones.SingleValueTimelineState); - dragonBones.AnimationProgressTimelineState = AnimationProgressTimelineState; - /** - * @internal - */ - var AnimationWeightTimelineState = /** @class */ (function(_super) { - __extends(AnimationWeightTimelineState, _super); - function AnimationWeightTimelineState() { - return (_super !== null && _super.apply(this, arguments)) || this; - } - AnimationWeightTimelineState.toString = function() { - return '[class dragonBones.AnimationWeightTimelineState]'; - }; - AnimationWeightTimelineState.prototype._onUpdateFrame = function() { - _super.prototype._onUpdateFrame.call(this); - var animationState = this.target; - if (animationState._parent !== null) { - animationState.weight = this._result; - } - this.dirty = false; - }; - AnimationWeightTimelineState.prototype.init = function( - armature, - animationState, - timelineData, - ) { - _super.prototype.init.call(this, armature, animationState, timelineData); - this._valueOffset = this._animationData.frameIntOffset; - this._valueScale = 0.0001; - this._valueArray = this._animationData.parent.parent.frameIntArray; - }; - return AnimationWeightTimelineState; - })(dragonBones.SingleValueTimelineState); - dragonBones.AnimationWeightTimelineState = AnimationWeightTimelineState; - /** - * @internal - */ - var AnimationParametersTimelineState = /** @class */ (function(_super) { - __extends(AnimationParametersTimelineState, _super); - function AnimationParametersTimelineState() { - return (_super !== null && _super.apply(this, arguments)) || this; - } - AnimationParametersTimelineState.toString = function() { - return '[class dragonBones.AnimationParametersTimelineState]'; - }; - AnimationParametersTimelineState.prototype._onUpdateFrame = function() { - _super.prototype._onUpdateFrame.call(this); - var animationState = this.target; - if (animationState._parent !== null) { - animationState.parameterX = this._resultA; - animationState.parameterY = this._resultB; - } - this.dirty = false; - }; - AnimationParametersTimelineState.prototype.init = function( - armature, - animationState, - timelineData, - ) { - _super.prototype.init.call(this, armature, animationState, timelineData); - this._valueOffset = this._animationData.frameIntOffset; - this._valueScale = 0.0001; - this._valueArray = this._animationData.parent.parent.frameIntArray; - }; - return AnimationParametersTimelineState; - })(dragonBones.DoubleValueTimelineState); - dragonBones.AnimationParametersTimelineState = AnimationParametersTimelineState; - })(dragonBones || (dragonBones = {})); - /** - * The MIT License (MIT) - * - * Copyright (c) 2012-2018 DragonBones team and other contributors - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of - * the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR - * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - (function(dragonBones) { - /** - * - The properties of the object carry basic information about an event, - * which are passed as parameter or parameter's parameter to event listeners when an event occurs. - * @version DragonBones 4.5 - * @language en_US - */ - /** - * - 事件对象,包含有关事件的基本信息,当发生事件时,该实例将作为参数或参数的参数传递给事件侦听器。 - * @version DragonBones 4.5 - * @language zh_CN - */ - var EventObject = /** @class */ (function(_super) { - __extends(EventObject, _super); - function EventObject() { - return (_super !== null && _super.apply(this, arguments)) || this; - } - /** - * @internal - * @private - */ - EventObject.actionDataToInstance = function(data, instance, armature) { - if (data.type === 0 /* Play */) { - instance.type = EventObject.FRAME_EVENT; - } else { - instance.type = - data.type === 10 /* Frame */ - ? EventObject.FRAME_EVENT - : EventObject.SOUND_EVENT; - } - instance.name = data.name; - instance.armature = armature; - instance.actionData = data; - instance.data = data.data; - if (data.bone !== null) { - instance.bone = armature.getBone(data.bone.name); - } - if (data.slot !== null) { - instance.slot = armature.getSlot(data.slot.name); - } - }; - EventObject.toString = function() { - return '[class dragonBones.EventObject]'; - }; - EventObject.prototype._onClear = function() { - this.time = 0.0; - this.type = ''; - this.name = ''; - this.armature = null; - this.bone = null; - this.slot = null; - this.animationState = null; - this.actionData = null; - this.data = null; - }; - /** - * - Animation start play. - * @version DragonBones 4.5 - * @language en_US - */ - /** - * - 动画开始播放。 - * @version DragonBones 4.5 - * @language zh_CN - */ - EventObject.START = 'start'; - /** - * - Animation loop play complete once. - * @version DragonBones 4.5 - * @language en_US - */ - /** - * - 动画循环播放完成一次。 - * @version DragonBones 4.5 - * @language zh_CN - */ - EventObject.LOOP_COMPLETE = 'loopComplete'; - /** - * - Animation play complete. - * @version DragonBones 4.5 - * @language en_US - */ - /** - * - 动画播放完成。 - * @version DragonBones 4.5 - * @language zh_CN - */ - EventObject.COMPLETE = 'complete'; - /** - * - Animation fade in start. - * @version DragonBones 4.5 - * @language en_US - */ - /** - * - 动画淡入开始。 - * @version DragonBones 4.5 - * @language zh_CN - */ - EventObject.FADE_IN = 'fadeIn'; - /** - * - Animation fade in complete. - * @version DragonBones 4.5 - * @language en_US - */ - /** - * - 动画淡入完成。 - * @version DragonBones 4.5 - * @language zh_CN - */ - EventObject.FADE_IN_COMPLETE = 'fadeInComplete'; - /** - * - Animation fade out start. - * @version DragonBones 4.5 - * @language en_US - */ - /** - * - 动画淡出开始。 - * @version DragonBones 4.5 - * @language zh_CN - */ - EventObject.FADE_OUT = 'fadeOut'; - /** - * - Animation fade out complete. - * @version DragonBones 4.5 - * @language en_US - */ - /** - * - 动画淡出完成。 - * @version DragonBones 4.5 - * @language zh_CN - */ - EventObject.FADE_OUT_COMPLETE = 'fadeOutComplete'; - /** - * - Animation frame event. - * @version DragonBones 4.5 - * @language en_US - */ - /** - * - 动画帧事件。 - * @version DragonBones 4.5 - * @language zh_CN - */ - EventObject.FRAME_EVENT = 'frameEvent'; - /** - * - Animation frame sound event. - * @version DragonBones 4.5 - * @language en_US - */ - /** - * - 动画帧声音事件。 - * @version DragonBones 4.5 - * @language zh_CN - */ - EventObject.SOUND_EVENT = 'soundEvent'; - return EventObject; - })(dragonBones.BaseObject); - dragonBones.EventObject = EventObject; - })(dragonBones || (dragonBones = {})); - /** - * The MIT License (MIT) - * - * Copyright (c) 2012-2018 DragonBones team and other contributors - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of - * the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR - * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - (function(dragonBones) { - /** - * @private - */ - var DataParser = /** @class */ (function() { - function DataParser() {} - DataParser._getArmatureType = function(value) { - switch (value.toLowerCase()) { - case 'stage': - return 2 /* Stage */; - case 'armature': - return 0 /* Armature */; - case 'movieclip': - return 1 /* MovieClip */; - default: - return 0 /* Armature */; - } - }; - DataParser._getBoneType = function(value) { - switch (value.toLowerCase()) { - case 'bone': - return 0 /* Bone */; - case 'surface': - return 1 /* Surface */; - default: - return 0 /* Bone */; - } - }; - DataParser._getPositionMode = function(value) { - switch (value.toLocaleLowerCase()) { - case 'percent': - return 1 /* Percent */; - case 'fixed': - return 0 /* Fixed */; - default: - return 1 /* Percent */; - } - }; - DataParser._getSpacingMode = function(value) { - switch (value.toLocaleLowerCase()) { - case 'length': - return 0 /* Length */; - case 'percent': - return 2 /* Percent */; - case 'fixed': - return 1 /* Fixed */; - default: - return 0 /* Length */; - } - }; - DataParser._getRotateMode = function(value) { - switch (value.toLocaleLowerCase()) { - case 'tangent': - return 0 /* Tangent */; - case 'chain': - return 1 /* Chain */; - case 'chainscale': - return 2 /* ChainScale */; - default: - return 0 /* Tangent */; - } - }; - DataParser._getDisplayType = function(value) { - switch (value.toLowerCase()) { - case 'image': - return 0 /* Image */; - case 'mesh': - return 2 /* Mesh */; - case 'armature': - return 1 /* Armature */; - case 'boundingbox': - return 3 /* BoundingBox */; - case 'path': - return 4 /* Path */; - default: - return 0 /* Image */; - } - }; - DataParser._getBoundingBoxType = function(value) { - switch (value.toLowerCase()) { - case 'rectangle': - return 0 /* Rectangle */; - case 'ellipse': - return 1 /* Ellipse */; - case 'polygon': - return 2 /* Polygon */; - default: - return 0 /* Rectangle */; - } - }; - DataParser._getBlendMode = function(value) { - switch (value.toLowerCase()) { - case 'normal': - return 0 /* Normal */; - case 'add': - return 1 /* Add */; - case 'alpha': - return 2 /* Alpha */; - case 'darken': - return 3 /* Darken */; - case 'difference': - return 4 /* Difference */; - case 'erase': - return 5 /* Erase */; - case 'hardlight': - return 6 /* HardLight */; - case 'invert': - return 7 /* Invert */; - case 'layer': - return 8 /* Layer */; - case 'lighten': - return 9 /* Lighten */; - case 'multiply': - return 10 /* Multiply */; - case 'overlay': - return 11 /* Overlay */; - case 'screen': - return 12 /* Screen */; - case 'subtract': - return 13 /* Subtract */; - default: - return 0 /* Normal */; - } - }; - DataParser._getAnimationBlendType = function(value) { - switch (value.toLowerCase()) { - case 'none': - return 0 /* None */; - case '1d': - return 1 /* E1D */; - default: - return 0 /* None */; - } - }; - DataParser._getActionType = function(value) { - switch (value.toLowerCase()) { - case 'play': - return 0 /* Play */; - case 'frame': - return 10 /* Frame */; - case 'sound': - return 11 /* Sound */; - default: - return 0 /* Play */; - } - }; - DataParser.DATA_VERSION_2_3 = '2.3'; - DataParser.DATA_VERSION_3_0 = '3.0'; - DataParser.DATA_VERSION_4_0 = '4.0'; - DataParser.DATA_VERSION_4_5 = '4.5'; - DataParser.DATA_VERSION_5_0 = '5.0'; - DataParser.DATA_VERSION_5_5 = '5.5'; - DataParser.DATA_VERSION_5_6 = '5.6'; - DataParser.DATA_VERSION = DataParser.DATA_VERSION_5_6; - DataParser.DATA_VERSIONS = [ - DataParser.DATA_VERSION_4_0, - DataParser.DATA_VERSION_4_5, - DataParser.DATA_VERSION_5_0, - DataParser.DATA_VERSION_5_5, - DataParser.DATA_VERSION_5_6, - ]; - DataParser.TEXTURE_ATLAS = 'textureAtlas'; - DataParser.SUB_TEXTURE = 'SubTexture'; - DataParser.FORMAT = 'format'; - DataParser.IMAGE_PATH = 'imagePath'; - DataParser.WIDTH = 'width'; - DataParser.HEIGHT = 'height'; - DataParser.ROTATED = 'rotated'; - DataParser.FRAME_X = 'frameX'; - DataParser.FRAME_Y = 'frameY'; - DataParser.FRAME_WIDTH = 'frameWidth'; - DataParser.FRAME_HEIGHT = 'frameHeight'; - DataParser.DRADON_BONES = 'dragonBones'; - DataParser.USER_DATA = 'userData'; - DataParser.ARMATURE = 'armature'; - DataParser.CANVAS = 'canvas'; - DataParser.BONE = 'bone'; - DataParser.SURFACE = 'surface'; - DataParser.SLOT = 'slot'; - DataParser.CONSTRAINT = 'constraint'; - DataParser.SKIN = 'skin'; - DataParser.DISPLAY = 'display'; - DataParser.FRAME = 'frame'; - DataParser.IK = 'ik'; - DataParser.PATH_CONSTRAINT = 'path'; - DataParser.ANIMATION = 'animation'; - DataParser.TIMELINE = 'timeline'; - DataParser.FFD = 'ffd'; - DataParser.TRANSLATE_FRAME = 'translateFrame'; - DataParser.ROTATE_FRAME = 'rotateFrame'; - DataParser.SCALE_FRAME = 'scaleFrame'; - DataParser.DISPLAY_FRAME = 'displayFrame'; - DataParser.COLOR_FRAME = 'colorFrame'; - DataParser.DEFAULT_ACTIONS = 'defaultActions'; - DataParser.ACTIONS = 'actions'; - DataParser.EVENTS = 'events'; - DataParser.INTS = 'ints'; - DataParser.FLOATS = 'floats'; - DataParser.STRINGS = 'strings'; - DataParser.TRANSFORM = 'transform'; - DataParser.PIVOT = 'pivot'; - DataParser.AABB = 'aabb'; - DataParser.COLOR = 'color'; - DataParser.VERSION = 'version'; - DataParser.COMPATIBLE_VERSION = 'compatibleVersion'; - DataParser.FRAME_RATE = 'frameRate'; - DataParser.TYPE = 'type'; - DataParser.SUB_TYPE = 'subType'; - DataParser.NAME = 'name'; - DataParser.PARENT = 'parent'; - DataParser.TARGET = 'target'; - DataParser.STAGE = 'stage'; - DataParser.SHARE = 'share'; - DataParser.PATH = 'path'; - DataParser.LENGTH = 'length'; - DataParser.DISPLAY_INDEX = 'displayIndex'; - DataParser.Z_ORDER = 'zOrder'; - DataParser.Z_INDEX = 'zIndex'; - DataParser.BLEND_MODE = 'blendMode'; - DataParser.INHERIT_TRANSLATION = 'inheritTranslation'; - DataParser.INHERIT_ROTATION = 'inheritRotation'; - DataParser.INHERIT_SCALE = 'inheritScale'; - DataParser.INHERIT_REFLECTION = 'inheritReflection'; - DataParser.INHERIT_ANIMATION = 'inheritAnimation'; - DataParser.INHERIT_DEFORM = 'inheritDeform'; - DataParser.SEGMENT_X = 'segmentX'; - DataParser.SEGMENT_Y = 'segmentY'; - DataParser.BEND_POSITIVE = 'bendPositive'; - DataParser.CHAIN = 'chain'; - DataParser.WEIGHT = 'weight'; - DataParser.BLEND_TYPE = 'blendType'; - DataParser.FADE_IN_TIME = 'fadeInTime'; - DataParser.PLAY_TIMES = 'playTimes'; - DataParser.SCALE = 'scale'; - DataParser.OFFSET = 'offset'; - DataParser.POSITION = 'position'; - DataParser.DURATION = 'duration'; - DataParser.TWEEN_EASING = 'tweenEasing'; - DataParser.TWEEN_ROTATE = 'tweenRotate'; - DataParser.TWEEN_SCALE = 'tweenScale'; - DataParser.CLOCK_WISE = 'clockwise'; - DataParser.CURVE = 'curve'; - DataParser.SOUND = 'sound'; - DataParser.EVENT = 'event'; - DataParser.ACTION = 'action'; - DataParser.X = 'x'; - DataParser.Y = 'y'; - DataParser.SKEW_X = 'skX'; - DataParser.SKEW_Y = 'skY'; - DataParser.SCALE_X = 'scX'; - DataParser.SCALE_Y = 'scY'; - DataParser.VALUE = 'value'; - DataParser.ROTATE = 'rotate'; - DataParser.SKEW = 'skew'; - DataParser.ALPHA = 'alpha'; - DataParser.ALPHA_OFFSET = 'aO'; - DataParser.RED_OFFSET = 'rO'; - DataParser.GREEN_OFFSET = 'gO'; - DataParser.BLUE_OFFSET = 'bO'; - DataParser.ALPHA_MULTIPLIER = 'aM'; - DataParser.RED_MULTIPLIER = 'rM'; - DataParser.GREEN_MULTIPLIER = 'gM'; - DataParser.BLUE_MULTIPLIER = 'bM'; - DataParser.UVS = 'uvs'; - DataParser.VERTICES = 'vertices'; - DataParser.TRIANGLES = 'triangles'; - DataParser.WEIGHTS = 'weights'; - DataParser.SLOT_POSE = 'slotPose'; - DataParser.BONE_POSE = 'bonePose'; - DataParser.BONES = 'bones'; - DataParser.POSITION_MODE = 'positionMode'; - DataParser.SPACING_MODE = 'spacingMode'; - DataParser.ROTATE_MODE = 'rotateMode'; - DataParser.SPACING = 'spacing'; - DataParser.ROTATE_OFFSET = 'rotateOffset'; - DataParser.ROTATE_MIX = 'rotateMix'; - DataParser.TRANSLATE_MIX = 'translateMix'; - DataParser.TARGET_DISPLAY = 'targetDisplay'; - DataParser.CLOSED = 'closed'; - DataParser.CONSTANT_SPEED = 'constantSpeed'; - DataParser.VERTEX_COUNT = 'vertexCount'; - DataParser.LENGTHS = 'lengths'; - DataParser.GOTO_AND_PLAY = 'gotoAndPlay'; - DataParser.DEFAULT_NAME = 'default'; - return DataParser; - })(); - dragonBones.DataParser = DataParser; - })(dragonBones || (dragonBones = {})); - /** - * The MIT License (MIT) - * - * Copyright (c) 2012-2018 DragonBones team and other contributors - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of - * the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR - * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - (function(dragonBones) { - /** - * @private - */ - var ObjectDataParser = /** @class */ (function(_super) { - __extends(ObjectDataParser, _super); - function ObjectDataParser() { - var _this = (_super !== null && _super.apply(this, arguments)) || this; - _this._rawTextureAtlasIndex = 0; - _this._rawBones = []; - _this._data = null; // - _this._armature = null; // - _this._bone = null; // - _this._geometry = null; // - _this._slot = null; // - _this._skin = null; // - _this._mesh = null; // - _this._animation = null; // - _this._timeline = null; // - _this._rawTextureAtlases = null; - _this._frameValueType = 0 /* Step */; - _this._defaultColorOffset = -1; - _this._prevClockwise = 0; - _this._prevRotation = 0.0; - _this._frameDefaultValue = 0.0; - _this._frameValueScale = 1.0; - _this._helpMatrixA = new dragonBones.Matrix(); - _this._helpMatrixB = new dragonBones.Matrix(); - _this._helpTransform = new dragonBones.Transform(); - _this._helpColorTransform = new dragonBones.ColorTransform(); - _this._helpPoint = new dragonBones.Point(); - _this._helpArray = []; - _this._intArray = []; - _this._floatArray = []; - _this._frameIntArray = []; - _this._frameFloatArray = []; - _this._frameArray = []; - _this._timelineArray = []; - _this._colorArray = []; - _this._cacheRawMeshes = []; - _this._cacheMeshes = []; - _this._actionFrames = []; - _this._weightSlotPose = {}; - _this._weightBonePoses = {}; - _this._cacheBones = {}; - _this._slotChildActions = {}; - return _this; - } - ObjectDataParser._getBoolean = function(rawData, key, defaultValue) { - if (key in rawData) { - var value = rawData[key]; - var type = typeof value; - if (type === 'boolean') { - return value; - } else if (type === 'string') { - switch (value) { - case '0': - case 'NaN': - case '': - case 'false': - case 'null': - case 'undefined': - return false; - default: - return true; - } - } else { - return !!value; - } - } - return defaultValue; - }; - ObjectDataParser._getNumber = function(rawData, key, defaultValue) { - if (key in rawData) { - var value = rawData[key]; - if (value === null || value === 'NaN') { - return defaultValue; - } - return +value || 0; - } - return defaultValue; - }; - ObjectDataParser._getString = function(rawData, key, defaultValue) { - if (key in rawData) { - var value = rawData[key]; - var type = typeof value; - if (type === 'string') { - return value; - } - return String(value); - } - return defaultValue; - }; - ObjectDataParser.prototype._getCurvePoint = function( - x1, - y1, - x2, - y2, - x3, - y3, - x4, - y4, - t, - result, - ) { - var l_t = 1.0 - t; - var powA = l_t * l_t; - var powB = t * t; - var kA = l_t * powA; - var kB = 3.0 * t * powA; - var kC = 3.0 * l_t * powB; - var kD = t * powB; - result.x = kA * x1 + kB * x2 + kC * x3 + kD * x4; - result.y = kA * y1 + kB * y2 + kC * y3 + kD * y4; - }; - ObjectDataParser.prototype._samplingEasingCurve = function(curve, samples) { - var curveCount = curve.length; - if (curveCount % 3 === 1) { - var stepIndex = -2; - for (var i = 0, l = samples.length; i < l; ++i) { - var t = (i + 1) / (l + 1); // float - while ((stepIndex + 6 < curveCount ? curve[stepIndex + 6] : 1) < t) { - stepIndex += 6; - } - var isInCurve = stepIndex >= 0 && stepIndex + 6 < curveCount; - var x1 = isInCurve ? curve[stepIndex] : 0.0; - var y1 = isInCurve ? curve[stepIndex + 1] : 0.0; - var x2 = curve[stepIndex + 2]; - var y2 = curve[stepIndex + 3]; - var x3 = curve[stepIndex + 4]; - var y3 = curve[stepIndex + 5]; - var x4 = isInCurve ? curve[stepIndex + 6] : 1.0; - var y4 = isInCurve ? curve[stepIndex + 7] : 1.0; - var lower = 0.0; - var higher = 1.0; - while (higher - lower > 0.0001) { - var percentage = (higher + lower) * 0.5; - this._getCurvePoint( - x1, - y1, - x2, - y2, - x3, - y3, - x4, - y4, - percentage, - this._helpPoint, - ); - if (t - this._helpPoint.x > 0.0) { - lower = percentage; - } else { - higher = percentage; - } - } - samples[i] = this._helpPoint.y; - } - return true; - } else { - var stepIndex = 0; - for (var i = 0, l = samples.length; i < l; ++i) { - var t = (i + 1) / (l + 1); // float - while (curve[stepIndex + 6] < t) { - stepIndex += 6; - } - var x1 = curve[stepIndex]; - var y1 = curve[stepIndex + 1]; - var x2 = curve[stepIndex + 2]; - var y2 = curve[stepIndex + 3]; - var x3 = curve[stepIndex + 4]; - var y3 = curve[stepIndex + 5]; - var x4 = curve[stepIndex + 6]; - var y4 = curve[stepIndex + 7]; - var lower = 0.0; - var higher = 1.0; - while (higher - lower > 0.0001) { - var percentage = (higher + lower) * 0.5; - this._getCurvePoint( - x1, - y1, - x2, - y2, - x3, - y3, - x4, - y4, - percentage, - this._helpPoint, - ); - if (t - this._helpPoint.x > 0.0) { - lower = percentage; - } else { - higher = percentage; - } - } - samples[i] = this._helpPoint.y; - } - return false; - } - }; - ObjectDataParser.prototype._parseActionDataInFrame = function( - rawData, - frameStart, - bone, - slot, - ) { - if (dragonBones.DataParser.EVENT in rawData) { - this._mergeActionFrame( - rawData[dragonBones.DataParser.EVENT], - frameStart, - 10 /* Frame */, - bone, - slot, - ); - } - if (dragonBones.DataParser.SOUND in rawData) { - this._mergeActionFrame( - rawData[dragonBones.DataParser.SOUND], - frameStart, - 11 /* Sound */, - bone, - slot, - ); - } - if (dragonBones.DataParser.ACTION in rawData) { - this._mergeActionFrame( - rawData[dragonBones.DataParser.ACTION], - frameStart, - 0 /* Play */, - bone, - slot, - ); - } - if (dragonBones.DataParser.EVENTS in rawData) { - this._mergeActionFrame( - rawData[dragonBones.DataParser.EVENTS], - frameStart, - 10 /* Frame */, - bone, - slot, - ); - } - if (dragonBones.DataParser.ACTIONS in rawData) { - this._mergeActionFrame( - rawData[dragonBones.DataParser.ACTIONS], - frameStart, - 0 /* Play */, - bone, - slot, - ); - } - }; - ObjectDataParser.prototype._mergeActionFrame = function( - rawData, - frameStart, - type, - bone, - slot, - ) { - var actionOffset = this._armature.actions.length; - var actions = this._parseActionData(rawData, type, bone, slot); - var frameIndex = 0; - var frame = null; - for (var _i = 0, actions_2 = actions; _i < actions_2.length; _i++) { - var action = actions_2[_i]; - this._armature.addAction(action, false); - } - if (this._actionFrames.length === 0) { - frame = new ActionFrame(); - frame.frameStart = 0; - this._actionFrames.push(frame); - frame = null; - } - for (var _a = 0, _b = this._actionFrames; _a < _b.length; _a++) { - var eachFrame = _b[_a]; - if (eachFrame.frameStart === frameStart) { - frame = eachFrame; - break; - } else if (eachFrame.frameStart > frameStart) { - break; - } - frameIndex++; - } - if (frame === null) { - frame = new ActionFrame(); - frame.frameStart = frameStart; - this._actionFrames.splice(frameIndex, 0, frame); - } - for (var i = 0; i < actions.length; ++i) { - frame.actions.push(actionOffset + i); - } - }; - ObjectDataParser.prototype._parseArmature = function(rawData, scale) { - var armature = dragonBones.BaseObject.borrowObject( - dragonBones.ArmatureData, - ); - armature.name = ObjectDataParser._getString( - rawData, - dragonBones.DataParser.NAME, - '', - ); - armature.frameRate = ObjectDataParser._getNumber( - rawData, - dragonBones.DataParser.FRAME_RATE, - this._data.frameRate, - ); - armature.scale = scale; - if ( - dragonBones.DataParser.TYPE in rawData && - typeof rawData[dragonBones.DataParser.TYPE] === 'string' - ) { - armature.type = dragonBones.DataParser._getArmatureType( - rawData[dragonBones.DataParser.TYPE], - ); - } else { - armature.type = ObjectDataParser._getNumber( - rawData, - dragonBones.DataParser.TYPE, - 0 /* Armature */, - ); - } - if (armature.frameRate === 0) { - armature.frameRate = 24; - } - this._armature = armature; - if (dragonBones.DataParser.CANVAS in rawData) { - var rawCanvas = rawData[dragonBones.DataParser.CANVAS]; - var canvas = dragonBones.BaseObject.borrowObject( - dragonBones.CanvasData, - ); - if (dragonBones.DataParser.COLOR in rawCanvas) { - canvas.hasBackground = true; - } else { - canvas.hasBackground = false; - } - canvas.color = ObjectDataParser._getNumber( - rawCanvas, - dragonBones.DataParser.COLOR, - 0, - ); - canvas.x = - ObjectDataParser._getNumber(rawCanvas, dragonBones.DataParser.X, 0) * - armature.scale; - canvas.y = - ObjectDataParser._getNumber(rawCanvas, dragonBones.DataParser.Y, 0) * - armature.scale; - canvas.width = - ObjectDataParser._getNumber( - rawCanvas, - dragonBones.DataParser.WIDTH, - 0, - ) * armature.scale; - canvas.height = - ObjectDataParser._getNumber( - rawCanvas, - dragonBones.DataParser.HEIGHT, - 0, - ) * armature.scale; - armature.canvas = canvas; - } - if (dragonBones.DataParser.AABB in rawData) { - var rawAABB = rawData[dragonBones.DataParser.AABB]; - armature.aabb.x = - ObjectDataParser._getNumber(rawAABB, dragonBones.DataParser.X, 0.0) * - armature.scale; - armature.aabb.y = - ObjectDataParser._getNumber(rawAABB, dragonBones.DataParser.Y, 0.0) * - armature.scale; - armature.aabb.width = - ObjectDataParser._getNumber( - rawAABB, - dragonBones.DataParser.WIDTH, - 0.0, - ) * armature.scale; - armature.aabb.height = - ObjectDataParser._getNumber( - rawAABB, - dragonBones.DataParser.HEIGHT, - 0.0, - ) * armature.scale; - } - if (dragonBones.DataParser.BONE in rawData) { - var rawBones = rawData[dragonBones.DataParser.BONE]; - for (var _i = 0, rawBones_1 = rawBones; _i < rawBones_1.length; _i++) { - var rawBone = rawBones_1[_i]; - var parentName = ObjectDataParser._getString( - rawBone, - dragonBones.DataParser.PARENT, - '', - ); - var bone = this._parseBone(rawBone); - if (parentName.length > 0) { - var parent_1 = armature.getBone(parentName); - if (parent_1 !== null) { - bone.parent = parent_1; - } else { - if (!(parentName in this._cacheBones)) { - this._cacheBones[parentName] = []; - } - this._cacheBones[parentName].push(bone); - } - } - if (bone.name in this._cacheBones) { - for ( - var _a = 0, _b = this._cacheBones[bone.name]; - _a < _b.length; - _a++ - ) { - var child = _b[_a]; - child.parent = bone; - } - delete this._cacheBones[bone.name]; - } - armature.addBone(bone); - this._rawBones.push(bone); // Cache raw bones sort. - } - } - if (dragonBones.DataParser.IK in rawData) { - var rawIKS = rawData[dragonBones.DataParser.IK]; - for (var _c = 0, rawIKS_1 = rawIKS; _c < rawIKS_1.length; _c++) { - var rawIK = rawIKS_1[_c]; - var constraint = this._parseIKConstraint(rawIK); - if (constraint) { - armature.addConstraint(constraint); - } - } - } - armature.sortBones(); - if (dragonBones.DataParser.SLOT in rawData) { - var zOrder = 0; - var rawSlots = rawData[dragonBones.DataParser.SLOT]; - for (var _d = 0, rawSlots_1 = rawSlots; _d < rawSlots_1.length; _d++) { - var rawSlot = rawSlots_1[_d]; - armature.addSlot(this._parseSlot(rawSlot, zOrder++)); - } - } - if (dragonBones.DataParser.SKIN in rawData) { - var rawSkins = rawData[dragonBones.DataParser.SKIN]; - for (var _e = 0, rawSkins_1 = rawSkins; _e < rawSkins_1.length; _e++) { - var rawSkin = rawSkins_1[_e]; - armature.addSkin(this._parseSkin(rawSkin)); - } - } - if (dragonBones.DataParser.PATH_CONSTRAINT in rawData) { - var rawPaths = rawData[dragonBones.DataParser.PATH_CONSTRAINT]; - for (var _f = 0, rawPaths_1 = rawPaths; _f < rawPaths_1.length; _f++) { - var rawPath = rawPaths_1[_f]; - var constraint = this._parsePathConstraint(rawPath); - if (constraint) { - armature.addConstraint(constraint); - } - } - } - for (var i = 0, l = this._cacheRawMeshes.length; i < l; ++i) { - var rawData_1 = this._cacheRawMeshes[i]; - var shareName = ObjectDataParser._getString( - rawData_1, - dragonBones.DataParser.SHARE, - '', - ); - if (shareName.length === 0) { - continue; - } - var skinName = ObjectDataParser._getString( - rawData_1, - dragonBones.DataParser.SKIN, - dragonBones.DataParser.DEFAULT_NAME, - ); - if (skinName.length === 0) { - skinName = dragonBones.DataParser.DEFAULT_NAME; - } - var shareMesh = armature.getMesh(skinName, '', shareName); // TODO slot; - if (shareMesh === null) { - continue; // Error. - } - var mesh = this._cacheMeshes[i]; - mesh.geometry.shareFrom(shareMesh.geometry); - } - if (dragonBones.DataParser.ANIMATION in rawData) { - var rawAnimations = rawData[dragonBones.DataParser.ANIMATION]; - for ( - var _g = 0, rawAnimations_1 = rawAnimations; - _g < rawAnimations_1.length; - _g++ - ) { - var rawAnimation = rawAnimations_1[_g]; - var animation = this._parseAnimation(rawAnimation); - armature.addAnimation(animation); - } - } - if (dragonBones.DataParser.DEFAULT_ACTIONS in rawData) { - var actions = this._parseActionData( - rawData[dragonBones.DataParser.DEFAULT_ACTIONS], - 0 /* Play */, - null, - null, - ); - for (var _h = 0, actions_3 = actions; _h < actions_3.length; _h++) { - var action = actions_3[_h]; - armature.addAction(action, true); - if (action.type === 0 /* Play */) { - var animation = armature.getAnimation(action.name); - if (animation !== null) { - armature.defaultAnimation = animation; - } - } - } - } - if (dragonBones.DataParser.ACTIONS in rawData) { - var actions = this._parseActionData( - rawData[dragonBones.DataParser.ACTIONS], - 0 /* Play */, - null, - null, - ); - for (var _j = 0, actions_4 = actions; _j < actions_4.length; _j++) { - var action = actions_4[_j]; - armature.addAction(action, false); - } - } - // Clear helper. - this._rawBones.length = 0; - this._cacheRawMeshes.length = 0; - this._cacheMeshes.length = 0; - this._armature = null; - for (var k in this._weightSlotPose) { - delete this._weightSlotPose[k]; - } - for (var k in this._weightBonePoses) { - delete this._weightBonePoses[k]; - } - for (var k in this._cacheBones) { - delete this._cacheBones[k]; - } - for (var k in this._slotChildActions) { - delete this._slotChildActions[k]; - } - return armature; - }; - ObjectDataParser.prototype._parseBone = function(rawData) { - var type = 0; /* Bone */ - if ( - dragonBones.DataParser.TYPE in rawData && - typeof rawData[dragonBones.DataParser.TYPE] === 'string' - ) { - type = dragonBones.DataParser._getBoneType( - rawData[dragonBones.DataParser.TYPE], - ); - } else { - type = ObjectDataParser._getNumber( - rawData, - dragonBones.DataParser.TYPE, - 0 /* Bone */, - ); - } - if (type === 0 /* Bone */) { - var scale = this._armature.scale; - var bone = dragonBones.BaseObject.borrowObject(dragonBones.BoneData); - bone.inheritTranslation = ObjectDataParser._getBoolean( - rawData, - dragonBones.DataParser.INHERIT_TRANSLATION, - true, - ); - bone.inheritRotation = ObjectDataParser._getBoolean( - rawData, - dragonBones.DataParser.INHERIT_ROTATION, - true, - ); - bone.inheritScale = ObjectDataParser._getBoolean( - rawData, - dragonBones.DataParser.INHERIT_SCALE, - true, - ); - bone.inheritReflection = ObjectDataParser._getBoolean( - rawData, - dragonBones.DataParser.INHERIT_REFLECTION, - true, - ); - bone.length = - ObjectDataParser._getNumber( - rawData, - dragonBones.DataParser.LENGTH, - 0, - ) * scale; - bone.alpha = ObjectDataParser._getNumber( - rawData, - dragonBones.DataParser.ALPHA, - 1.0, - ); - bone.name = ObjectDataParser._getString( - rawData, - dragonBones.DataParser.NAME, - '', - ); - if (dragonBones.DataParser.TRANSFORM in rawData) { - this._parseTransform( - rawData[dragonBones.DataParser.TRANSFORM], - bone.transform, - scale, - ); - } - return bone; - } - var surface = dragonBones.BaseObject.borrowObject( - dragonBones.SurfaceData, - ); - surface.alpha = ObjectDataParser._getNumber( - rawData, - dragonBones.DataParser.ALPHA, - 1.0, - ); - surface.name = ObjectDataParser._getString( - rawData, - dragonBones.DataParser.NAME, - '', - ); - surface.segmentX = ObjectDataParser._getNumber( - rawData, - dragonBones.DataParser.SEGMENT_X, - 0, - ); - surface.segmentY = ObjectDataParser._getNumber( - rawData, - dragonBones.DataParser.SEGMENT_Y, - 0, - ); - this._parseGeometry(rawData, surface.geometry); - return surface; - }; - ObjectDataParser.prototype._parseIKConstraint = function(rawData) { - var bone = this._armature.getBone( - ObjectDataParser._getString(rawData, dragonBones.DataParser.BONE, ''), - ); - if (bone === null) { - return null; - } - var target = this._armature.getBone( - ObjectDataParser._getString(rawData, dragonBones.DataParser.TARGET, ''), - ); - if (target === null) { - return null; - } - var chain = ObjectDataParser._getNumber( - rawData, - dragonBones.DataParser.CHAIN, - 0, - ); - var constraint = dragonBones.BaseObject.borrowObject( - dragonBones.IKConstraintData, - ); - constraint.scaleEnabled = ObjectDataParser._getBoolean( - rawData, - dragonBones.DataParser.SCALE, - false, - ); - constraint.bendPositive = ObjectDataParser._getBoolean( - rawData, - dragonBones.DataParser.BEND_POSITIVE, - true, - ); - constraint.weight = ObjectDataParser._getNumber( - rawData, - dragonBones.DataParser.WEIGHT, - 1.0, - ); - constraint.name = ObjectDataParser._getString( - rawData, - dragonBones.DataParser.NAME, - '', - ); - constraint.type = 0 /* IK */; - constraint.target = target; - if (chain > 0 && bone.parent !== null) { - constraint.root = bone.parent; - constraint.bone = bone; - } else { - constraint.root = bone; - constraint.bone = null; - } - return constraint; - }; - ObjectDataParser.prototype._parsePathConstraint = function(rawData) { - var target = this._armature.getSlot( - ObjectDataParser._getString(rawData, dragonBones.DataParser.TARGET, ''), - ); - if (target === null) { - return null; - } - var defaultSkin = this._armature.defaultSkin; - if (defaultSkin === null) { - return null; - } - //TODO - var targetDisplay = defaultSkin.getDisplay( - target.name, - ObjectDataParser._getString( - rawData, - dragonBones.DataParser.TARGET_DISPLAY, - target.name, - ), - ); - if ( - targetDisplay === null || - !(targetDisplay instanceof dragonBones.PathDisplayData) - ) { - return null; - } - var bones = rawData[dragonBones.DataParser.BONES]; - if (bones === null || bones.length === 0) { - return null; - } - var constraint = dragonBones.BaseObject.borrowObject( - dragonBones.PathConstraintData, - ); - constraint.name = ObjectDataParser._getString( - rawData, - dragonBones.DataParser.NAME, - '', - ); - constraint.type = 1 /* Path */; - constraint.pathSlot = target; - constraint.pathDisplayData = targetDisplay; - constraint.target = target.parent; - constraint.positionMode = dragonBones.DataParser._getPositionMode( - ObjectDataParser._getString( - rawData, - dragonBones.DataParser.POSITION_MODE, - '', - ), - ); - constraint.spacingMode = dragonBones.DataParser._getSpacingMode( - ObjectDataParser._getString( - rawData, - dragonBones.DataParser.SPACING_MODE, - '', - ), - ); - constraint.rotateMode = dragonBones.DataParser._getRotateMode( - ObjectDataParser._getString( - rawData, - dragonBones.DataParser.ROTATE_MODE, - '', - ), - ); - constraint.position = ObjectDataParser._getNumber( - rawData, - dragonBones.DataParser.POSITION, - 0, - ); - constraint.spacing = ObjectDataParser._getNumber( - rawData, - dragonBones.DataParser.SPACING, - 0, - ); - constraint.rotateOffset = ObjectDataParser._getNumber( - rawData, - dragonBones.DataParser.ROTATE_OFFSET, - 0, - ); - constraint.rotateMix = ObjectDataParser._getNumber( - rawData, - dragonBones.DataParser.ROTATE_MIX, - 1, - ); - constraint.translateMix = ObjectDataParser._getNumber( - rawData, - dragonBones.DataParser.TRANSLATE_MIX, - 1, - ); - // - for (var _i = 0, bones_3 = bones; _i < bones_3.length; _i++) { - var boneName = bones_3[_i]; - var bone = this._armature.getBone(boneName); - if (bone !== null) { - constraint.AddBone(bone); - if (constraint.root === null) { - constraint.root = bone; - } - } - } - return constraint; - }; - ObjectDataParser.prototype._parseSlot = function(rawData, zOrder) { - var slot = dragonBones.BaseObject.borrowObject(dragonBones.SlotData); - slot.displayIndex = ObjectDataParser._getNumber( - rawData, - dragonBones.DataParser.DISPLAY_INDEX, - 0, - ); - slot.zOrder = zOrder; - slot.zIndex = ObjectDataParser._getNumber( - rawData, - dragonBones.DataParser.Z_INDEX, - 0, - ); - slot.alpha = ObjectDataParser._getNumber( - rawData, - dragonBones.DataParser.ALPHA, - 1.0, - ); - slot.name = ObjectDataParser._getString( - rawData, - dragonBones.DataParser.NAME, - '', - ); - slot.parent = this._armature.getBone( - ObjectDataParser._getString(rawData, dragonBones.DataParser.PARENT, ''), - ); // - if ( - dragonBones.DataParser.BLEND_MODE in rawData && - typeof rawData[dragonBones.DataParser.BLEND_MODE] === 'string' - ) { - slot.blendMode = dragonBones.DataParser._getBlendMode( - rawData[dragonBones.DataParser.BLEND_MODE], - ); - } else { - slot.blendMode = ObjectDataParser._getNumber( - rawData, - dragonBones.DataParser.BLEND_MODE, - 0 /* Normal */, - ); - } - if (dragonBones.DataParser.COLOR in rawData) { - slot.color = dragonBones.SlotData.createColor(); - this._parseColorTransform( - rawData[dragonBones.DataParser.COLOR], - slot.color, - ); - } else { - slot.color = dragonBones.SlotData.DEFAULT_COLOR; - } - if (dragonBones.DataParser.ACTIONS in rawData) { - this._slotChildActions[slot.name] = this._parseActionData( - rawData[dragonBones.DataParser.ACTIONS], - 0 /* Play */, - null, - null, - ); - } - return slot; - }; - ObjectDataParser.prototype._parseSkin = function(rawData) { - var skin = dragonBones.BaseObject.borrowObject(dragonBones.SkinData); - skin.name = ObjectDataParser._getString( - rawData, - dragonBones.DataParser.NAME, - dragonBones.DataParser.DEFAULT_NAME, - ); - if (skin.name.length === 0) { - skin.name = dragonBones.DataParser.DEFAULT_NAME; - } - if (dragonBones.DataParser.SLOT in rawData) { - var rawSlots = rawData[dragonBones.DataParser.SLOT]; - this._skin = skin; - for (var _i = 0, rawSlots_2 = rawSlots; _i < rawSlots_2.length; _i++) { - var rawSlot = rawSlots_2[_i]; - var slotName = ObjectDataParser._getString( - rawSlot, - dragonBones.DataParser.NAME, - '', - ); - var slot = this._armature.getSlot(slotName); - if (slot !== null) { - this._slot = slot; - if (dragonBones.DataParser.DISPLAY in rawSlot) { - var rawDisplays = rawSlot[dragonBones.DataParser.DISPLAY]; - for ( - var _a = 0, rawDisplays_1 = rawDisplays; - _a < rawDisplays_1.length; - _a++ - ) { - var rawDisplay = rawDisplays_1[_a]; - if (rawDisplay) { - skin.addDisplay(slotName, this._parseDisplay(rawDisplay)); - } else { - skin.addDisplay(slotName, null); - } - } - } - this._slot = null; // - } - } - this._skin = null; // - } - return skin; - }; - ObjectDataParser.prototype._parseDisplay = function(rawData) { - var name = ObjectDataParser._getString( - rawData, - dragonBones.DataParser.NAME, - '', - ); - var path = ObjectDataParser._getString( - rawData, - dragonBones.DataParser.PATH, - '', - ); - var type = 0; /* Image */ - var display = null; - if ( - dragonBones.DataParser.TYPE in rawData && - typeof rawData[dragonBones.DataParser.TYPE] === 'string' - ) { - type = dragonBones.DataParser._getDisplayType( - rawData[dragonBones.DataParser.TYPE], - ); - } else { - type = ObjectDataParser._getNumber( - rawData, - dragonBones.DataParser.TYPE, - type, - ); - } - switch (type) { - case 0 /* Image */: { - var imageDisplay = (display = dragonBones.BaseObject.borrowObject( - dragonBones.ImageDisplayData, - )); - imageDisplay.name = name; - imageDisplay.path = path.length > 0 ? path : name; - this._parsePivot(rawData, imageDisplay); - break; - } - case 1 /* Armature */: { - var armatureDisplay = (display = dragonBones.BaseObject.borrowObject( - dragonBones.ArmatureDisplayData, - )); - armatureDisplay.name = name; - armatureDisplay.path = path.length > 0 ? path : name; - armatureDisplay.inheritAnimation = true; - if (dragonBones.DataParser.ACTIONS in rawData) { - var actions = this._parseActionData( - rawData[dragonBones.DataParser.ACTIONS], - 0 /* Play */, - null, - null, - ); - for (var _i = 0, actions_5 = actions; _i < actions_5.length; _i++) { - var action = actions_5[_i]; - armatureDisplay.addAction(action); - } - } else if (this._slot.name in this._slotChildActions) { - var displays = this._skin.getDisplays(this._slot.name); - if ( - displays === null - ? this._slot.displayIndex === 0 - : this._slot.displayIndex === displays.length - ) { - for ( - var _a = 0, _b = this._slotChildActions[this._slot.name]; - _a < _b.length; - _a++ - ) { - var action = _b[_a]; - armatureDisplay.addAction(action); - } - delete this._slotChildActions[this._slot.name]; - } - } - break; - } - case 2 /* Mesh */: { - var meshDisplay = (display = dragonBones.BaseObject.borrowObject( - dragonBones.MeshDisplayData, - )); - meshDisplay.geometry.inheritDeform = ObjectDataParser._getBoolean( - rawData, - dragonBones.DataParser.INHERIT_DEFORM, - true, - ); - meshDisplay.name = name; - meshDisplay.path = path.length > 0 ? path : name; - if (dragonBones.DataParser.SHARE in rawData) { - meshDisplay.geometry.data = this._data; - this._cacheRawMeshes.push(rawData); - this._cacheMeshes.push(meshDisplay); - } else { - this._parseMesh(rawData, meshDisplay); - } - break; - } - case 3 /* BoundingBox */: { - var boundingBox = this._parseBoundingBox(rawData); - if (boundingBox !== null) { - var boundingBoxDisplay = (display = dragonBones.BaseObject.borrowObject( - dragonBones.BoundingBoxDisplayData, - )); - boundingBoxDisplay.name = name; - boundingBoxDisplay.path = path.length > 0 ? path : name; - boundingBoxDisplay.boundingBox = boundingBox; - } - break; - } - case 4 /* Path */: { - var rawCurveLengths = rawData[dragonBones.DataParser.LENGTHS]; - var pathDisplay = (display = dragonBones.BaseObject.borrowObject( - dragonBones.PathDisplayData, - )); - pathDisplay.closed = ObjectDataParser._getBoolean( - rawData, - dragonBones.DataParser.CLOSED, - false, - ); - pathDisplay.constantSpeed = ObjectDataParser._getBoolean( - rawData, - dragonBones.DataParser.CONSTANT_SPEED, - false, - ); - pathDisplay.name = name; - pathDisplay.path = path.length > 0 ? path : name; - pathDisplay.curveLengths.length = rawCurveLengths.length; - for (var i = 0, l = rawCurveLengths.length; i < l; ++i) { - pathDisplay.curveLengths[i] = rawCurveLengths[i]; - } - this._parsePath(rawData, pathDisplay); - break; - } - } - if (display !== null && dragonBones.DataParser.TRANSFORM in rawData) { - this._parseTransform( - rawData[dragonBones.DataParser.TRANSFORM], - display.transform, - this._armature.scale, - ); - } - return display; - }; - ObjectDataParser.prototype._parsePath = function(rawData, display) { - this._parseGeometry(rawData, display.geometry); - }; - ObjectDataParser.prototype._parsePivot = function(rawData, display) { - if (dragonBones.DataParser.PIVOT in rawData) { - var rawPivot = rawData[dragonBones.DataParser.PIVOT]; - display.pivot.x = ObjectDataParser._getNumber( - rawPivot, - dragonBones.DataParser.X, - 0.0, - ); - display.pivot.y = ObjectDataParser._getNumber( - rawPivot, - dragonBones.DataParser.Y, - 0.0, - ); - } else { - display.pivot.x = 0.5; - display.pivot.y = 0.5; - } - }; - ObjectDataParser.prototype._parseMesh = function(rawData, mesh) { - this._parseGeometry(rawData, mesh.geometry); - if (dragonBones.DataParser.WEIGHTS in rawData) { - var rawSlotPose = rawData[dragonBones.DataParser.SLOT_POSE]; - var rawBonePoses = rawData[dragonBones.DataParser.BONE_POSE]; - var meshName = - this._skin.name + '_' + this._slot.name + '_' + mesh.name; - this._weightSlotPose[meshName] = rawSlotPose; - this._weightBonePoses[meshName] = rawBonePoses; - } - }; - ObjectDataParser.prototype._parseBoundingBox = function(rawData) { - var boundingBox = null; - var type = 0; /* Rectangle */ - if ( - dragonBones.DataParser.SUB_TYPE in rawData && - typeof rawData[dragonBones.DataParser.SUB_TYPE] === 'string' - ) { - type = dragonBones.DataParser._getBoundingBoxType( - rawData[dragonBones.DataParser.SUB_TYPE], - ); - } else { - type = ObjectDataParser._getNumber( - rawData, - dragonBones.DataParser.SUB_TYPE, - type, - ); - } - switch (type) { - case 0 /* Rectangle */: - boundingBox = dragonBones.BaseObject.borrowObject( - dragonBones.RectangleBoundingBoxData, - ); - break; - case 1 /* Ellipse */: - boundingBox = dragonBones.BaseObject.borrowObject( - dragonBones.EllipseBoundingBoxData, - ); - break; - case 2 /* Polygon */: - boundingBox = this._parsePolygonBoundingBox(rawData); - break; - } - if (boundingBox !== null) { - boundingBox.color = ObjectDataParser._getNumber( - rawData, - dragonBones.DataParser.COLOR, - 0x000000, - ); - if ( - boundingBox.type === 0 /* Rectangle */ || - boundingBox.type === 1 /* Ellipse */ - ) { - boundingBox.width = ObjectDataParser._getNumber( - rawData, - dragonBones.DataParser.WIDTH, - 0.0, - ); - boundingBox.height = ObjectDataParser._getNumber( - rawData, - dragonBones.DataParser.HEIGHT, - 0.0, - ); - } - } - return boundingBox; - }; - ObjectDataParser.prototype._parsePolygonBoundingBox = function(rawData) { - var polygonBoundingBox = dragonBones.BaseObject.borrowObject( - dragonBones.PolygonBoundingBoxData, - ); - if (dragonBones.DataParser.VERTICES in rawData) { - var scale = this._armature.scale; - var rawVertices = rawData[dragonBones.DataParser.VERTICES]; - var vertices = polygonBoundingBox.vertices; - vertices.length = rawVertices.length; - for (var i = 0, l = rawVertices.length; i < l; i += 2) { - var x = rawVertices[i] * scale; - var y = rawVertices[i + 1] * scale; - vertices[i] = x; - vertices[i + 1] = y; - // AABB. - if (i === 0) { - polygonBoundingBox.x = x; - polygonBoundingBox.y = y; - polygonBoundingBox.width = x; - polygonBoundingBox.height = y; - } else { - if (x < polygonBoundingBox.x) { - polygonBoundingBox.x = x; - } else if (x > polygonBoundingBox.width) { - polygonBoundingBox.width = x; - } - if (y < polygonBoundingBox.y) { - polygonBoundingBox.y = y; - } else if (y > polygonBoundingBox.height) { - polygonBoundingBox.height = y; - } - } - } - polygonBoundingBox.width -= polygonBoundingBox.x; - polygonBoundingBox.height -= polygonBoundingBox.y; - } else { - console.warn( - 'Data error.\n Please reexport DragonBones Data to fixed the bug.', - ); - } - return polygonBoundingBox; - }; - ObjectDataParser.prototype._parseAnimation = function(rawData) { - var animation = dragonBones.BaseObject.borrowObject( - dragonBones.AnimationData, - ); - animation.blendType = dragonBones.DataParser._getAnimationBlendType( - ObjectDataParser._getString( - rawData, - dragonBones.DataParser.BLEND_TYPE, - '', - ), - ); - animation.frameCount = ObjectDataParser._getNumber( - rawData, - dragonBones.DataParser.DURATION, - 0, - ); - animation.playTimes = ObjectDataParser._getNumber( - rawData, - dragonBones.DataParser.PLAY_TIMES, - 1, - ); - animation.duration = animation.frameCount / this._armature.frameRate; // float - animation.fadeInTime = ObjectDataParser._getNumber( - rawData, - dragonBones.DataParser.FADE_IN_TIME, - 0.0, - ); - animation.scale = ObjectDataParser._getNumber( - rawData, - dragonBones.DataParser.SCALE, - 1.0, - ); - animation.name = ObjectDataParser._getString( - rawData, - dragonBones.DataParser.NAME, - dragonBones.DataParser.DEFAULT_NAME, - ); - if (animation.name.length === 0) { - animation.name = dragonBones.DataParser.DEFAULT_NAME; - } - animation.frameIntOffset = this._frameIntArray.length; - animation.frameFloatOffset = this._frameFloatArray.length; - animation.frameOffset = this._frameArray.length; - this._animation = animation; - if (dragonBones.DataParser.FRAME in rawData) { - var rawFrames = rawData[dragonBones.DataParser.FRAME]; - var keyFrameCount = rawFrames.length; - if (keyFrameCount > 0) { - for (var i = 0, frameStart = 0; i < keyFrameCount; ++i) { - var rawFrame = rawFrames[i]; - this._parseActionDataInFrame(rawFrame, frameStart, null, null); - frameStart += ObjectDataParser._getNumber( - rawFrame, - dragonBones.DataParser.DURATION, - 1, - ); - } - } - } - if (dragonBones.DataParser.Z_ORDER in rawData) { - this._animation.zOrderTimeline = this._parseTimeline( - rawData[dragonBones.DataParser.Z_ORDER], - null, - dragonBones.DataParser.FRAME, - 1 /* ZOrder */, - 0 /* Step */, - 0, - this._parseZOrderFrame, - ); - } - if (dragonBones.DataParser.BONE in rawData) { - var rawTimelines = rawData[dragonBones.DataParser.BONE]; - for ( - var _i = 0, rawTimelines_1 = rawTimelines; - _i < rawTimelines_1.length; - _i++ - ) { - var rawTimeline = rawTimelines_1[_i]; - this._parseBoneTimeline(rawTimeline); - } - } - if (dragonBones.DataParser.SLOT in rawData) { - var rawTimelines = rawData[dragonBones.DataParser.SLOT]; - for ( - var _a = 0, rawTimelines_2 = rawTimelines; - _a < rawTimelines_2.length; - _a++ - ) { - var rawTimeline = rawTimelines_2[_a]; - this._parseSlotTimeline(rawTimeline); - } - } - if (dragonBones.DataParser.FFD in rawData) { - var rawTimelines = rawData[dragonBones.DataParser.FFD]; - for ( - var _b = 0, rawTimelines_3 = rawTimelines; - _b < rawTimelines_3.length; - _b++ - ) { - var rawTimeline = rawTimelines_3[_b]; - var skinName = ObjectDataParser._getString( - rawTimeline, - dragonBones.DataParser.SKIN, - dragonBones.DataParser.DEFAULT_NAME, - ); - var slotName = ObjectDataParser._getString( - rawTimeline, - dragonBones.DataParser.SLOT, - '', - ); - var displayName = ObjectDataParser._getString( - rawTimeline, - dragonBones.DataParser.NAME, - '', - ); - if (skinName.length === 0) { - skinName = dragonBones.DataParser.DEFAULT_NAME; - } - this._slot = this._armature.getSlot(slotName); - this._mesh = this._armature.getMesh(skinName, slotName, displayName); - if (this._slot === null || this._mesh === null) { - continue; - } - var timeline = this._parseTimeline( - rawTimeline, - null, - dragonBones.DataParser.FRAME, - 22 /* SlotDeform */, - 2 /* Float */, - 0, - this._parseSlotDeformFrame, - ); - if (timeline !== null) { - this._animation.addSlotTimeline(slotName, timeline); - } - this._slot = null; // - this._mesh = null; // - } - } - if (dragonBones.DataParser.IK in rawData) { - var rawTimelines = rawData[dragonBones.DataParser.IK]; - for ( - var _c = 0, rawTimelines_4 = rawTimelines; - _c < rawTimelines_4.length; - _c++ - ) { - var rawTimeline = rawTimelines_4[_c]; - var constraintName = ObjectDataParser._getString( - rawTimeline, - dragonBones.DataParser.NAME, - '', - ); - var constraint = this._armature.getConstraint(constraintName); - if (constraint === null) { - continue; - } - var timeline = this._parseTimeline( - rawTimeline, - null, - dragonBones.DataParser.FRAME, - 30 /* IKConstraint */, - 1 /* Int */, - 2, - this._parseIKConstraintFrame, - ); - if (timeline !== null) { - this._animation.addConstraintTimeline(constraintName, timeline); - } - } - } - if (this._actionFrames.length > 0) { - this._animation.actionTimeline = this._parseTimeline( - null, - this._actionFrames, - '', - 0 /* Action */, - 0 /* Step */, - 0, - this._parseActionFrame, - ); - this._actionFrames.length = 0; - } - if (dragonBones.DataParser.TIMELINE in rawData) { - var rawTimelines = rawData[dragonBones.DataParser.TIMELINE]; - for ( - var _d = 0, rawTimelines_5 = rawTimelines; - _d < rawTimelines_5.length; - _d++ - ) { - var rawTimeline = rawTimelines_5[_d]; - var timelineType = ObjectDataParser._getNumber( - rawTimeline, - dragonBones.DataParser.TYPE, - 0 /* Action */, - ); - var timelineName = ObjectDataParser._getString( - rawTimeline, - dragonBones.DataParser.NAME, - '', - ); - var timeline = null; - switch (timelineType) { - case 0 /* Action */: - // TODO - break; - case 20 /* SlotDisplay */: // TODO - case 23 /* SlotZIndex */: - case 60 /* BoneAlpha */: - case 24 /* SlotAlpha */: - case 40 /* AnimationProgress */: - case 41 /* AnimationWeight */: - if (timelineType === 20 /* SlotDisplay */) { - this._frameValueType = 0 /* Step */; - this._frameValueScale = 1.0; - } else { - this._frameValueType = 1 /* Int */; - if (timelineType === 23 /* SlotZIndex */) { - this._frameValueScale = 1.0; - } else if ( - timelineType === 40 /* AnimationProgress */ || - timelineType === 41 /* AnimationWeight */ - ) { - this._frameValueScale = 10000.0; - } else { - this._frameValueScale = 100.0; - } - } - if ( - timelineType === 60 /* BoneAlpha */ || - timelineType === 24 /* SlotAlpha */ || - timelineType === 41 /* AnimationWeight */ - ) { - this._frameDefaultValue = 1.0; - } else { - this._frameDefaultValue = 0.0; - } - if ( - timelineType === 40 /* AnimationProgress */ && - animation.blendType !== 0 /* None */ - ) { - timeline = dragonBones.BaseObject.borrowObject( - dragonBones.AnimationTimelineData, - ); - var animaitonTimeline = timeline; - animaitonTimeline.x = ObjectDataParser._getNumber( - rawTimeline, - dragonBones.DataParser.X, - 0.0, - ); - animaitonTimeline.y = ObjectDataParser._getNumber( - rawTimeline, - dragonBones.DataParser.Y, - 0.0, - ); - } - timeline = this._parseTimeline( - rawTimeline, - null, - dragonBones.DataParser.FRAME, - timelineType, - this._frameValueType, - 1, - this._parseSingleValueFrame, - timeline, - ); - break; - case 11 /* BoneTranslate */: - case 12 /* BoneRotate */: - case 13 /* BoneScale */: - case 30 /* IKConstraint */: - case 42 /* AnimationParameter */: - if ( - timelineType === 30 /* IKConstraint */ || - timelineType === 42 /* AnimationParameter */ - ) { - this._frameValueType = 1 /* Int */; - if (timelineType === 42 /* AnimationParameter */) { - this._frameValueScale = 10000.0; - } else { - this._frameValueScale = 100.0; - } - } else { - if (timelineType === 12 /* BoneRotate */) { - this._frameValueScale = dragonBones.Transform.DEG_RAD; - } else { - this._frameValueScale = 1.0; - } - this._frameValueType = 2 /* Float */; - } - if ( - timelineType === 13 /* BoneScale */ || - timelineType === 30 /* IKConstraint */ - ) { - this._frameDefaultValue = 1.0; - } else { - this._frameDefaultValue = 0.0; - } - timeline = this._parseTimeline( - rawTimeline, - null, - dragonBones.DataParser.FRAME, - timelineType, - this._frameValueType, - 2, - this._parseDoubleValueFrame, - ); - break; - case 1 /* ZOrder */: - // TODO - break; - case 50 /* Surface */: { - var surface = this._armature.getBone(timelineName); - if (surface === null) { - continue; - } - this._geometry = surface.geometry; - timeline = this._parseTimeline( - rawTimeline, - null, - dragonBones.DataParser.FRAME, - timelineType, - 2 /* Float */, - 0, - this._parseDeformFrame, - ); - this._geometry = null; // - break; - } - case 22 /* SlotDeform */: { - this._geometry = null; // - for (var skinName in this._armature.skins) { - var skin = this._armature.skins[skinName]; - for (var slontName in skin.displays) { - var displays = skin.displays[slontName]; - for ( - var _e = 0, displays_1 = displays; - _e < displays_1.length; - _e++ - ) { - var display = displays_1[_e]; - if (display !== null && display.name === timelineName) { - this._geometry = display.geometry; - break; - } - } - } - } - if (this._geometry === null) { - continue; - } - timeline = this._parseTimeline( - rawTimeline, - null, - dragonBones.DataParser.FRAME, - timelineType, - 2 /* Float */, - 0, - this._parseDeformFrame, - ); - this._geometry = null; // - break; - } - case 21 /* SlotColor */: - timeline = this._parseTimeline( - rawTimeline, - null, - dragonBones.DataParser.FRAME, - timelineType, - 1 /* Int */, - 1, - this._parseSlotColorFrame, - ); - break; - } - if (timeline !== null) { - switch (timelineType) { - case 0 /* Action */: - // TODO - break; - case 1 /* ZOrder */: - // TODO - break; - case 11 /* BoneTranslate */: - case 12 /* BoneRotate */: - case 13 /* BoneScale */: - case 50 /* Surface */: - case 60 /* BoneAlpha */: - this._animation.addBoneTimeline(timelineName, timeline); - break; - case 20 /* SlotDisplay */: - case 21 /* SlotColor */: - case 22 /* SlotDeform */: - case 23 /* SlotZIndex */: - case 24 /* SlotAlpha */: - this._animation.addSlotTimeline(timelineName, timeline); - break; - case 30 /* IKConstraint */: - this._animation.addConstraintTimeline(timelineName, timeline); - break; - case 40 /* AnimationProgress */: - case 41 /* AnimationWeight */: - case 42 /* AnimationParameter */: - this._animation.addAnimationTimeline(timelineName, timeline); - break; - } - } - } - } - this._animation = null; // - return animation; - }; - ObjectDataParser.prototype._parseTimeline = function( - rawData, - rawFrames, - framesKey, - timelineType, - frameValueType, - frameValueCount, - frameParser, - timeline, - ) { - if (timeline === void 0) { - timeline = null; - } - if (rawData !== null && framesKey.length > 0 && framesKey in rawData) { - rawFrames = rawData[framesKey]; - } - if (rawFrames === null) { - return null; - } - var keyFrameCount = rawFrames.length; - if (keyFrameCount === 0) { - return null; - } - var frameIntArrayLength = this._frameIntArray.length; - var frameFloatArrayLength = this._frameFloatArray.length; - var timelineOffset = this._timelineArray.length; - if (timeline === null) { - timeline = dragonBones.BaseObject.borrowObject( - dragonBones.TimelineData, - ); - } - timeline.type = timelineType; - timeline.offset = timelineOffset; - this._frameValueType = frameValueType; - this._timeline = timeline; - this._timelineArray.length += 1 + 1 + 1 + 1 + 1 + keyFrameCount; - if (rawData !== null) { - this._timelineArray[ - timelineOffset + 0 /* TimelineScale */ - ] = Math.round( - ObjectDataParser._getNumber( - rawData, - dragonBones.DataParser.SCALE, - 1.0, - ) * 100, - ); - this._timelineArray[ - timelineOffset + 1 /* TimelineOffset */ - ] = Math.round( - ObjectDataParser._getNumber( - rawData, - dragonBones.DataParser.OFFSET, - 0.0, - ) * 100, - ); - } else { - this._timelineArray[timelineOffset + 0 /* TimelineScale */] = 100; - this._timelineArray[timelineOffset + 1 /* TimelineOffset */] = 0; - } - this._timelineArray[ - timelineOffset + 2 /* TimelineKeyFrameCount */ - ] = keyFrameCount; - this._timelineArray[ - timelineOffset + 3 /* TimelineFrameValueCount */ - ] = frameValueCount; - switch (this._frameValueType) { - case 0 /* Step */: - this._timelineArray[ - timelineOffset + 4 /* TimelineFrameValueOffset */ - ] = 0; - break; - case 1 /* Int */: - this._timelineArray[ - timelineOffset + 4 /* TimelineFrameValueOffset */ - ] = frameIntArrayLength - this._animation.frameIntOffset; - break; - case 2 /* Float */: - this._timelineArray[ - timelineOffset + 4 /* TimelineFrameValueOffset */ - ] = frameFloatArrayLength - this._animation.frameFloatOffset; - break; - } - if (keyFrameCount === 1) { - timeline.frameIndicesOffset = -1; - this._timelineArray[timelineOffset + 5 /* TimelineFrameOffset */ + 0] = - frameParser.call(this, rawFrames[0], 0, 0) - - this._animation.frameOffset; - } else { - var totalFrameCount = this._animation.frameCount + 1; // One more frame than animation. - var frameIndices = this._data.frameIndices; - var frameIndicesOffset = frameIndices.length; - frameIndices.length += totalFrameCount; - timeline.frameIndicesOffset = frameIndicesOffset; - for ( - var i = 0, iK = 0, frameStart = 0, frameCount = 0; - i < totalFrameCount; - ++i - ) { - if (frameStart + frameCount <= i && iK < keyFrameCount) { - var rawFrame = rawFrames[iK]; - frameStart = i; // frame.frameStart; - if (iK === keyFrameCount - 1) { - frameCount = this._animation.frameCount - frameStart; - } else { - if (rawFrame instanceof ActionFrame) { - frameCount = this._actionFrames[iK + 1].frameStart - frameStart; - } else { - frameCount = ObjectDataParser._getNumber( - rawFrame, - dragonBones.DataParser.DURATION, - 1, - ); - } - } - this._timelineArray[ - timelineOffset + 5 /* TimelineFrameOffset */ + iK - ] = - frameParser.call(this, rawFrame, frameStart, frameCount) - - this._animation.frameOffset; - iK++; - } - frameIndices[frameIndicesOffset + i] = iK - 1; - } - } - this._timeline = null; // - return timeline; - }; - ObjectDataParser.prototype._parseBoneTimeline = function(rawData) { - var bone = this._armature.getBone( - ObjectDataParser._getString(rawData, dragonBones.DataParser.NAME, ''), - ); - if (bone === null) { - return; - } - this._bone = bone; - this._slot = this._armature.getSlot(this._bone.name); - if (dragonBones.DataParser.TRANSLATE_FRAME in rawData) { - this._frameDefaultValue = 0.0; - this._frameValueScale = 1.0; - var timeline = this._parseTimeline( - rawData, - null, - dragonBones.DataParser.TRANSLATE_FRAME, - 11 /* BoneTranslate */, - 2 /* Float */, - 2, - this._parseDoubleValueFrame, - ); - if (timeline !== null) { - this._animation.addBoneTimeline(bone.name, timeline); - } - } - if (dragonBones.DataParser.ROTATE_FRAME in rawData) { - this._frameDefaultValue = 0.0; - this._frameValueScale = 1.0; - var timeline = this._parseTimeline( - rawData, - null, - dragonBones.DataParser.ROTATE_FRAME, - 12 /* BoneRotate */, - 2 /* Float */, - 2, - this._parseBoneRotateFrame, - ); - if (timeline !== null) { - this._animation.addBoneTimeline(bone.name, timeline); - } - } - if (dragonBones.DataParser.SCALE_FRAME in rawData) { - this._frameDefaultValue = 1.0; - this._frameValueScale = 1.0; - var timeline = this._parseTimeline( - rawData, - null, - dragonBones.DataParser.SCALE_FRAME, - 13 /* BoneScale */, - 2 /* Float */, - 2, - this._parseBoneScaleFrame, - ); - if (timeline !== null) { - this._animation.addBoneTimeline(bone.name, timeline); - } - } - if (dragonBones.DataParser.FRAME in rawData) { - var timeline = this._parseTimeline( - rawData, - null, - dragonBones.DataParser.FRAME, - 10 /* BoneAll */, - 2 /* Float */, - 6, - this._parseBoneAllFrame, - ); - if (timeline !== null) { - this._animation.addBoneTimeline(bone.name, timeline); - } - } - this._bone = null; // - this._slot = null; // - }; - ObjectDataParser.prototype._parseSlotTimeline = function(rawData) { - var slot = this._armature.getSlot( - ObjectDataParser._getString(rawData, dragonBones.DataParser.NAME, ''), - ); - if (slot === null) { - return; - } - var displayTimeline = null; - var colorTimeline = null; - this._slot = slot; - if (dragonBones.DataParser.DISPLAY_FRAME in rawData) { - displayTimeline = this._parseTimeline( - rawData, - null, - dragonBones.DataParser.DISPLAY_FRAME, - 20 /* SlotDisplay */, - 0 /* Step */, - 0, - this._parseSlotDisplayFrame, - ); - } else { - displayTimeline = this._parseTimeline( - rawData, - null, - dragonBones.DataParser.FRAME, - 20 /* SlotDisplay */, - 0 /* Step */, - 0, - this._parseSlotDisplayFrame, - ); - } - if (dragonBones.DataParser.COLOR_FRAME in rawData) { - colorTimeline = this._parseTimeline( - rawData, - null, - dragonBones.DataParser.COLOR_FRAME, - 21 /* SlotColor */, - 1 /* Int */, - 1, - this._parseSlotColorFrame, - ); - } else { - colorTimeline = this._parseTimeline( - rawData, - null, - dragonBones.DataParser.FRAME, - 21 /* SlotColor */, - 1 /* Int */, - 1, - this._parseSlotColorFrame, - ); - } - if (displayTimeline !== null) { - this._animation.addSlotTimeline(slot.name, displayTimeline); - } - if (colorTimeline !== null) { - this._animation.addSlotTimeline(slot.name, colorTimeline); - } - this._slot = null; // - }; - ObjectDataParser.prototype._parseFrame = function( - rawData, - frameStart, - frameCount, - ) { - var frameOffset = this._frameArray.length; - this._frameArray.length += 1; - this._frameArray[frameOffset + 0 /* FramePosition */] = frameStart; - return frameOffset; - }; - ObjectDataParser.prototype._parseTweenFrame = function( - rawData, - frameStart, - frameCount, - ) { - var frameOffset = this._parseFrame(rawData, frameStart, frameCount); - if (frameCount > 0) { - if (dragonBones.DataParser.CURVE in rawData) { - var sampleCount = frameCount + 1; - this._helpArray.length = sampleCount; - var isOmited = this._samplingEasingCurve( - rawData[dragonBones.DataParser.CURVE], - this._helpArray, - ); - this._frameArray.length += 1 + 1 + this._helpArray.length; - this._frameArray[ - frameOffset + 1 /* FrameTweenType */ - ] = 2 /* Curve */; - this._frameArray[ - frameOffset + 2 /* FrameTweenEasingOrCurveSampleCount */ - ] = isOmited ? sampleCount : -sampleCount; - for (var i = 0; i < sampleCount; ++i) { - this._frameArray[ - frameOffset + 3 /* FrameCurveSamples */ + i - ] = Math.round(this._helpArray[i] * 10000.0); - } - } else { - var noTween = -2.0; - var tweenEasing = noTween; - if (dragonBones.DataParser.TWEEN_EASING in rawData) { - tweenEasing = ObjectDataParser._getNumber( - rawData, - dragonBones.DataParser.TWEEN_EASING, - noTween, - ); - } - if (tweenEasing === noTween) { - this._frameArray.length += 1; - this._frameArray[ - frameOffset + 1 /* FrameTweenType */ - ] = 0 /* None */; - } else if (tweenEasing === 0.0) { - this._frameArray.length += 1; - this._frameArray[ - frameOffset + 1 /* FrameTweenType */ - ] = 1 /* Line */; - } else if (tweenEasing < 0.0) { - this._frameArray.length += 1 + 1; - this._frameArray[ - frameOffset + 1 /* FrameTweenType */ - ] = 3 /* QuadIn */; - this._frameArray[ - frameOffset + 2 /* FrameTweenEasingOrCurveSampleCount */ - ] = Math.round(-tweenEasing * 100.0); - } else if (tweenEasing <= 1.0) { - this._frameArray.length += 1 + 1; - this._frameArray[ - frameOffset + 1 /* FrameTweenType */ - ] = 4 /* QuadOut */; - this._frameArray[ - frameOffset + 2 /* FrameTweenEasingOrCurveSampleCount */ - ] = Math.round(tweenEasing * 100.0); - } else { - this._frameArray.length += 1 + 1; - this._frameArray[ - frameOffset + 1 /* FrameTweenType */ - ] = 5 /* QuadInOut */; - this._frameArray[ - frameOffset + 2 /* FrameTweenEasingOrCurveSampleCount */ - ] = Math.round(tweenEasing * 100.0 - 100.0); - } - } - } else { - this._frameArray.length += 1; - this._frameArray[frameOffset + 1 /* FrameTweenType */] = 0 /* None */; - } - return frameOffset; - }; - ObjectDataParser.prototype._parseSingleValueFrame = function( - rawData, - frameStart, - frameCount, - ) { - var frameOffset = 0; - switch (this._frameValueType) { - case 0: { - frameOffset = this._parseFrame(rawData, frameStart, frameCount); - this._frameArray.length += 1; - this._frameArray[frameOffset + 1] = ObjectDataParser._getNumber( - rawData, - dragonBones.DataParser.VALUE, - this._frameDefaultValue, - ); - break; - } - case 1: { - frameOffset = this._parseTweenFrame(rawData, frameStart, frameCount); - var frameValueOffset = this._frameIntArray.length; - this._frameIntArray.length += 1; - this._frameIntArray[frameValueOffset] = Math.round( - ObjectDataParser._getNumber( - rawData, - dragonBones.DataParser.VALUE, - this._frameDefaultValue, - ) * this._frameValueScale, - ); - break; - } - case 2: { - frameOffset = this._parseTweenFrame(rawData, frameStart, frameCount); - var frameValueOffset = this._frameFloatArray.length; - this._frameFloatArray.length += 1; - this._frameFloatArray[frameValueOffset] = - ObjectDataParser._getNumber( - rawData, - dragonBones.DataParser.VALUE, - this._frameDefaultValue, - ) * this._frameValueScale; - break; - } - } - return frameOffset; - }; - ObjectDataParser.prototype._parseDoubleValueFrame = function( - rawData, - frameStart, - frameCount, - ) { - var frameOffset = 0; - switch (this._frameValueType) { - case 0: { - frameOffset = this._parseFrame(rawData, frameStart, frameCount); - this._frameArray.length += 2; - this._frameArray[frameOffset + 1] = ObjectDataParser._getNumber( - rawData, - dragonBones.DataParser.X, - this._frameDefaultValue, - ); - this._frameArray[frameOffset + 2] = ObjectDataParser._getNumber( - rawData, - dragonBones.DataParser.Y, - this._frameDefaultValue, - ); - break; - } - case 1: { - frameOffset = this._parseTweenFrame(rawData, frameStart, frameCount); - var frameValueOffset = this._frameIntArray.length; - this._frameIntArray.length += 2; - this._frameIntArray[frameValueOffset] = Math.round( - ObjectDataParser._getNumber( - rawData, - dragonBones.DataParser.X, - this._frameDefaultValue, - ) * this._frameValueScale, - ); - this._frameIntArray[frameValueOffset + 1] = Math.round( - ObjectDataParser._getNumber( - rawData, - dragonBones.DataParser.Y, - this._frameDefaultValue, - ) * this._frameValueScale, - ); - break; - } - case 2: { - frameOffset = this._parseTweenFrame(rawData, frameStart, frameCount); - var frameValueOffset = this._frameFloatArray.length; - this._frameFloatArray.length += 2; - this._frameFloatArray[frameValueOffset] = - ObjectDataParser._getNumber( - rawData, - dragonBones.DataParser.X, - this._frameDefaultValue, - ) * this._frameValueScale; - this._frameFloatArray[frameValueOffset + 1] = - ObjectDataParser._getNumber( - rawData, - dragonBones.DataParser.Y, - this._frameDefaultValue, - ) * this._frameValueScale; - break; - } - } - return frameOffset; - }; - ObjectDataParser.prototype._parseActionFrame = function( - frame, - frameStart, - frameCount, - ) { - var frameOffset = this._frameArray.length; - var actionCount = frame.actions.length; - this._frameArray.length += 1 + 1 + actionCount; - this._frameArray[frameOffset + 0 /* FramePosition */] = frameStart; - this._frameArray[frameOffset + 0 /* FramePosition */ + 1] = actionCount; // Action count. - for (var i = 0; i < actionCount; ++i) { - this._frameArray[frameOffset + 0 /* FramePosition */ + 2 + i] = - frame.actions[i]; - } - return frameOffset; - }; - ObjectDataParser.prototype._parseZOrderFrame = function( - rawData, - frameStart, - frameCount, - ) { - var frameOffset = this._parseFrame(rawData, frameStart, frameCount); - if (dragonBones.DataParser.Z_ORDER in rawData) { - var rawZOrder = rawData[dragonBones.DataParser.Z_ORDER]; - if (rawZOrder.length > 0) { - var slotCount = this._armature.sortedSlots.length; - var unchanged = new Array(slotCount - rawZOrder.length / 2); - var zOrders = new Array(slotCount); - for (var i_1 = 0; i_1 < unchanged.length; ++i_1) { - unchanged[i_1] = 0; - } - for (var i_2 = 0; i_2 < slotCount; ++i_2) { - zOrders[i_2] = -1; - } - var originalIndex = 0; - var unchangedIndex = 0; - for (var i_3 = 0, l = rawZOrder.length; i_3 < l; i_3 += 2) { - var slotIndex = rawZOrder[i_3]; - var zOrderOffset = rawZOrder[i_3 + 1]; - while (originalIndex !== slotIndex) { - unchanged[unchangedIndex++] = originalIndex++; - } - var index = originalIndex + zOrderOffset; - zOrders[index] = originalIndex++; - } - while (originalIndex < slotCount) { - unchanged[unchangedIndex++] = originalIndex++; - } - this._frameArray.length += 1 + slotCount; - this._frameArray[frameOffset + 1] = slotCount; - var i = slotCount; - while (i--) { - if (zOrders[i] === -1) { - this._frameArray[frameOffset + 2 + i] = - unchanged[--unchangedIndex] || 0; - } else { - this._frameArray[frameOffset + 2 + i] = zOrders[i] || 0; - } - } - return frameOffset; - } - } - this._frameArray.length += 1; - this._frameArray[frameOffset + 1] = 0; - return frameOffset; - }; - ObjectDataParser.prototype._parseBoneAllFrame = function( - rawData, - frameStart, - frameCount, - ) { - this._helpTransform.identity(); - if (dragonBones.DataParser.TRANSFORM in rawData) { - this._parseTransform( - rawData[dragonBones.DataParser.TRANSFORM], - this._helpTransform, - 1.0, - ); - } - // Modify rotation. - var rotation = this._helpTransform.rotation; - if (frameStart !== 0) { - if (this._prevClockwise === 0) { - rotation = - this._prevRotation + - dragonBones.Transform.normalizeRadian( - rotation - this._prevRotation, - ); - } else { - if ( - this._prevClockwise > 0 - ? rotation >= this._prevRotation - : rotation <= this._prevRotation - ) { - this._prevClockwise = - this._prevClockwise > 0 - ? this._prevClockwise - 1 - : this._prevClockwise + 1; - } - rotation = - this._prevRotation + - rotation - - this._prevRotation + - dragonBones.Transform.PI_D * this._prevClockwise; - } - } - this._prevClockwise = ObjectDataParser._getNumber( - rawData, - dragonBones.DataParser.TWEEN_ROTATE, - 0.0, - ); - this._prevRotation = rotation; - // - var frameOffset = this._parseTweenFrame(rawData, frameStart, frameCount); - var frameFloatOffset = this._frameFloatArray.length; - this._frameFloatArray.length += 6; - this._frameFloatArray[frameFloatOffset++] = this._helpTransform.x; - this._frameFloatArray[frameFloatOffset++] = this._helpTransform.y; - this._frameFloatArray[frameFloatOffset++] = rotation; - this._frameFloatArray[frameFloatOffset++] = this._helpTransform.skew; - this._frameFloatArray[frameFloatOffset++] = this._helpTransform.scaleX; - this._frameFloatArray[frameFloatOffset++] = this._helpTransform.scaleY; - this._parseActionDataInFrame(rawData, frameStart, this._bone, this._slot); - return frameOffset; - }; - ObjectDataParser.prototype._parseBoneTranslateFrame = function( - rawData, - frameStart, - frameCount, - ) { - var frameOffset = this._parseTweenFrame(rawData, frameStart, frameCount); - var frameFloatOffset = this._frameFloatArray.length; - this._frameFloatArray.length += 2; - this._frameFloatArray[frameFloatOffset++] = ObjectDataParser._getNumber( - rawData, - dragonBones.DataParser.X, - 0.0, - ); - this._frameFloatArray[frameFloatOffset++] = ObjectDataParser._getNumber( - rawData, - dragonBones.DataParser.Y, - 0.0, - ); - return frameOffset; - }; - ObjectDataParser.prototype._parseBoneRotateFrame = function( - rawData, - frameStart, - frameCount, - ) { - // Modify rotation. - var rotation = - ObjectDataParser._getNumber( - rawData, - dragonBones.DataParser.ROTATE, - 0.0, - ) * dragonBones.Transform.DEG_RAD; - if (frameStart !== 0) { - if (this._prevClockwise === 0) { - rotation = - this._prevRotation + - dragonBones.Transform.normalizeRadian( - rotation - this._prevRotation, - ); - } else { - if ( - this._prevClockwise > 0 - ? rotation >= this._prevRotation - : rotation <= this._prevRotation - ) { - this._prevClockwise = - this._prevClockwise > 0 - ? this._prevClockwise - 1 - : this._prevClockwise + 1; - } - rotation = - this._prevRotation + - rotation - - this._prevRotation + - dragonBones.Transform.PI_D * this._prevClockwise; - } - } - this._prevClockwise = ObjectDataParser._getNumber( - rawData, - dragonBones.DataParser.CLOCK_WISE, - 0, - ); - this._prevRotation = rotation; - // - var frameOffset = this._parseTweenFrame(rawData, frameStart, frameCount); - var frameFloatOffset = this._frameFloatArray.length; - this._frameFloatArray.length += 2; - this._frameFloatArray[frameFloatOffset++] = rotation; - this._frameFloatArray[frameFloatOffset++] = - ObjectDataParser._getNumber(rawData, dragonBones.DataParser.SKEW, 0.0) * - dragonBones.Transform.DEG_RAD; - return frameOffset; - }; - ObjectDataParser.prototype._parseBoneScaleFrame = function( - rawData, - frameStart, - frameCount, - ) { - var frameOffset = this._parseTweenFrame(rawData, frameStart, frameCount); - var frameFloatOffset = this._frameFloatArray.length; - this._frameFloatArray.length += 2; - this._frameFloatArray[frameFloatOffset++] = ObjectDataParser._getNumber( - rawData, - dragonBones.DataParser.X, - 1.0, - ); - this._frameFloatArray[frameFloatOffset++] = ObjectDataParser._getNumber( - rawData, - dragonBones.DataParser.Y, - 1.0, - ); - return frameOffset; - }; - ObjectDataParser.prototype._parseSlotDisplayFrame = function( - rawData, - frameStart, - frameCount, - ) { - var frameOffset = this._parseFrame(rawData, frameStart, frameCount); - this._frameArray.length += 1; - if (dragonBones.DataParser.VALUE in rawData) { - this._frameArray[frameOffset + 1] = ObjectDataParser._getNumber( - rawData, - dragonBones.DataParser.VALUE, - 0, - ); - } else { - this._frameArray[frameOffset + 1] = ObjectDataParser._getNumber( - rawData, - dragonBones.DataParser.DISPLAY_INDEX, - 0, - ); - } - this._parseActionDataInFrame( - rawData, - frameStart, - this._slot.parent, - this._slot, - ); - return frameOffset; - }; - ObjectDataParser.prototype._parseSlotColorFrame = function( - rawData, - frameStart, - frameCount, - ) { - var frameOffset = this._parseTweenFrame(rawData, frameStart, frameCount); - var colorOffset = -1; - if ( - dragonBones.DataParser.VALUE in rawData || - dragonBones.DataParser.COLOR in rawData - ) { - var rawColor = - dragonBones.DataParser.VALUE in rawData - ? rawData[dragonBones.DataParser.VALUE] - : rawData[dragonBones.DataParser.COLOR]; - for (var k in rawColor) { - this._parseColorTransform(rawColor, this._helpColorTransform); - colorOffset = this._colorArray.length; - this._colorArray.length += 8; - this._colorArray[colorOffset++] = Math.round( - this._helpColorTransform.alphaMultiplier * 100, - ); - this._colorArray[colorOffset++] = Math.round( - this._helpColorTransform.redMultiplier * 100, - ); - this._colorArray[colorOffset++] = Math.round( - this._helpColorTransform.greenMultiplier * 100, - ); - this._colorArray[colorOffset++] = Math.round( - this._helpColorTransform.blueMultiplier * 100, - ); - this._colorArray[colorOffset++] = Math.round( - this._helpColorTransform.alphaOffset, - ); - this._colorArray[colorOffset++] = Math.round( - this._helpColorTransform.redOffset, - ); - this._colorArray[colorOffset++] = Math.round( - this._helpColorTransform.greenOffset, - ); - this._colorArray[colorOffset++] = Math.round( - this._helpColorTransform.blueOffset, - ); - colorOffset -= 8; - break; - } - } - if (colorOffset < 0) { - if (this._defaultColorOffset < 0) { - this._defaultColorOffset = colorOffset = this._colorArray.length; - this._colorArray.length += 8; - this._colorArray[colorOffset++] = 100; - this._colorArray[colorOffset++] = 100; - this._colorArray[colorOffset++] = 100; - this._colorArray[colorOffset++] = 100; - this._colorArray[colorOffset++] = 0; - this._colorArray[colorOffset++] = 0; - this._colorArray[colorOffset++] = 0; - this._colorArray[colorOffset++] = 0; - } - colorOffset = this._defaultColorOffset; - } - var frameIntOffset = this._frameIntArray.length; - this._frameIntArray.length += 1; - this._frameIntArray[frameIntOffset] = colorOffset; - return frameOffset; - }; - ObjectDataParser.prototype._parseSlotDeformFrame = function( - rawData, - frameStart, - frameCount, - ) { - var frameFloatOffset = this._frameFloatArray.length; - var frameOffset = this._parseTweenFrame(rawData, frameStart, frameCount); - var rawVertices = - dragonBones.DataParser.VERTICES in rawData - ? rawData[dragonBones.DataParser.VERTICES] - : null; - var offset = ObjectDataParser._getNumber( - rawData, - dragonBones.DataParser.OFFSET, - 0, - ); // uint - var vertexCount = this._intArray[ - this._mesh.geometry.offset + 0 /* GeometryVertexCount */ - ]; - var meshName = - this._mesh.parent.name + '_' + this._slot.name + '_' + this._mesh.name; - var weight = this._mesh.geometry.weight; - var x = 0.0; - var y = 0.0; - var iB = 0; - var iV = 0; - if (weight !== null) { - var rawSlotPose = this._weightSlotPose[meshName]; - this._helpMatrixA.copyFromArray(rawSlotPose, 0); - this._frameFloatArray.length += weight.count * 2; - iB = weight.offset + 2 /* WeigthBoneIndices */ + weight.bones.length; - } else { - this._frameFloatArray.length += vertexCount * 2; - } - for (var i = 0; i < vertexCount * 2; i += 2) { - if (rawVertices === null) { - x = 0.0; - y = 0.0; - } else { - if (i < offset || i - offset >= rawVertices.length) { - x = 0.0; - } else { - x = rawVertices[i - offset]; - } - if (i + 1 < offset || i + 1 - offset >= rawVertices.length) { - y = 0.0; - } else { - y = rawVertices[i + 1 - offset]; - } - } - if (weight !== null) { - var rawBonePoses = this._weightBonePoses[meshName]; - var vertexBoneCount = this._intArray[iB++]; - this._helpMatrixA.transformPoint(x, y, this._helpPoint, true); - x = this._helpPoint.x; - y = this._helpPoint.y; - for (var j = 0; j < vertexBoneCount; ++j) { - var boneIndex = this._intArray[iB++]; - this._helpMatrixB.copyFromArray(rawBonePoses, boneIndex * 7 + 1); - this._helpMatrixB.invert(); - this._helpMatrixB.transformPoint(x, y, this._helpPoint, true); - this._frameFloatArray[frameFloatOffset + iV++] = this._helpPoint.x; - this._frameFloatArray[frameFloatOffset + iV++] = this._helpPoint.y; - } - } else { - this._frameFloatArray[frameFloatOffset + i] = x; - this._frameFloatArray[frameFloatOffset + i + 1] = y; - } - } - if (frameStart === 0) { - var frameIntOffset = this._frameIntArray.length; - this._frameIntArray.length += 1 + 1 + 1 + 1 + 1; - this._frameIntArray[ - frameIntOffset + 0 /* DeformVertexOffset */ - ] = this._mesh.geometry.offset; - this._frameIntArray[frameIntOffset + 1 /* DeformCount */] = - this._frameFloatArray.length - frameFloatOffset; - this._frameIntArray[frameIntOffset + 2 /* DeformValueCount */] = - this._frameFloatArray.length - frameFloatOffset; - this._frameIntArray[frameIntOffset + 3 /* DeformValueOffset */] = 0; - this._frameIntArray[frameIntOffset + 4 /* DeformFloatOffset */] = - frameFloatOffset - this._animation.frameFloatOffset; - this._timelineArray[ - this._timeline.offset + 3 /* TimelineFrameValueCount */ - ] = frameIntOffset - this._animation.frameIntOffset; - } - return frameOffset; - }; - ObjectDataParser.prototype._parseIKConstraintFrame = function( - rawData, - frameStart, - frameCount, - ) { - var frameOffset = this._parseTweenFrame(rawData, frameStart, frameCount); - var frameIntOffset = this._frameIntArray.length; - this._frameIntArray.length += 2; - this._frameIntArray[frameIntOffset++] = ObjectDataParser._getBoolean( - rawData, - dragonBones.DataParser.BEND_POSITIVE, - true, - ) - ? 1 - : 0; - this._frameIntArray[frameIntOffset++] = Math.round( - ObjectDataParser._getNumber( - rawData, - dragonBones.DataParser.WEIGHT, - 1.0, - ) * 100.0, - ); - return frameOffset; - }; - ObjectDataParser.prototype._parseActionData = function( - rawData, - type, - bone, - slot, - ) { - var actions = new Array(); - if (typeof rawData === 'string') { - var action = dragonBones.BaseObject.borrowObject( - dragonBones.ActionData, - ); - action.type = type; - action.name = rawData; - action.bone = bone; - action.slot = slot; - actions.push(action); - } else if (rawData instanceof Array) { - for (var _i = 0, rawData_2 = rawData; _i < rawData_2.length; _i++) { - var rawAction = rawData_2[_i]; - var action = dragonBones.BaseObject.borrowObject( - dragonBones.ActionData, - ); - if (dragonBones.DataParser.GOTO_AND_PLAY in rawAction) { - action.type = 0 /* Play */; - action.name = ObjectDataParser._getString( - rawAction, - dragonBones.DataParser.GOTO_AND_PLAY, - '', - ); - } else { - if ( - dragonBones.DataParser.TYPE in rawAction && - typeof rawAction[dragonBones.DataParser.TYPE] === 'string' - ) { - action.type = dragonBones.DataParser._getActionType( - rawAction[dragonBones.DataParser.TYPE], - ); - } else { - action.type = ObjectDataParser._getNumber( - rawAction, - dragonBones.DataParser.TYPE, - type, - ); - } - action.name = ObjectDataParser._getString( - rawAction, - dragonBones.DataParser.NAME, - '', - ); - } - if (dragonBones.DataParser.BONE in rawAction) { - var boneName = ObjectDataParser._getString( - rawAction, - dragonBones.DataParser.BONE, - '', - ); - action.bone = this._armature.getBone(boneName); - } else { - action.bone = bone; - } - if (dragonBones.DataParser.SLOT in rawAction) { - var slotName = ObjectDataParser._getString( - rawAction, - dragonBones.DataParser.SLOT, - '', - ); - action.slot = this._armature.getSlot(slotName); - } else { - action.slot = slot; - } - var userData = null; - if (dragonBones.DataParser.INTS in rawAction) { - if (userData === null) { - userData = dragonBones.BaseObject.borrowObject( - dragonBones.UserData, - ); - } - var rawInts = rawAction[dragonBones.DataParser.INTS]; - for (var _a = 0, rawInts_1 = rawInts; _a < rawInts_1.length; _a++) { - var rawValue = rawInts_1[_a]; - userData.addInt(rawValue); - } - } - if (dragonBones.DataParser.FLOATS in rawAction) { - if (userData === null) { - userData = dragonBones.BaseObject.borrowObject( - dragonBones.UserData, - ); - } - var rawFloats = rawAction[dragonBones.DataParser.FLOATS]; - for ( - var _b = 0, rawFloats_1 = rawFloats; - _b < rawFloats_1.length; - _b++ - ) { - var rawValue = rawFloats_1[_b]; - userData.addFloat(rawValue); - } - } - if (dragonBones.DataParser.STRINGS in rawAction) { - if (userData === null) { - userData = dragonBones.BaseObject.borrowObject( - dragonBones.UserData, - ); - } - var rawStrings = rawAction[dragonBones.DataParser.STRINGS]; - for ( - var _c = 0, rawStrings_1 = rawStrings; - _c < rawStrings_1.length; - _c++ - ) { - var rawValue = rawStrings_1[_c]; - userData.addString(rawValue); - } - } - action.data = userData; - actions.push(action); - } - } - return actions; - }; - ObjectDataParser.prototype._parseDeformFrame = function( - rawData, - frameStart, - frameCount, - ) { - var frameFloatOffset = this._frameFloatArray.length; - var frameOffset = this._parseTweenFrame(rawData, frameStart, frameCount); - var rawVertices = - dragonBones.DataParser.VERTICES in rawData - ? rawData[dragonBones.DataParser.VERTICES] - : dragonBones.DataParser.VALUE in rawData - ? rawData[dragonBones.DataParser.VALUE] - : null; - var offset = ObjectDataParser._getNumber( - rawData, - dragonBones.DataParser.OFFSET, - 0, - ); // uint - var vertexCount = this._intArray[ - this._geometry.offset + 0 /* GeometryVertexCount */ - ]; - var weight = this._geometry.weight; - var x = 0.0; - var y = 0.0; - if (weight !== null) ; else { - this._frameFloatArray.length += vertexCount * 2; - for (var i = 0; i < vertexCount * 2; i += 2) { - if (rawVertices !== null) { - if (i < offset || i - offset >= rawVertices.length) { - x = 0.0; - } else { - x = rawVertices[i - offset]; - } - if (i + 1 < offset || i + 1 - offset >= rawVertices.length) { - y = 0.0; - } else { - y = rawVertices[i + 1 - offset]; - } - } else { - x = 0.0; - y = 0.0; - } - this._frameFloatArray[frameFloatOffset + i] = x; - this._frameFloatArray[frameFloatOffset + i + 1] = y; - } - } - if (frameStart === 0) { - var frameIntOffset = this._frameIntArray.length; - this._frameIntArray.length += 1 + 1 + 1 + 1 + 1; - this._frameIntArray[ - frameIntOffset + 0 /* DeformVertexOffset */ - ] = this._geometry.offset; - this._frameIntArray[frameIntOffset + 1 /* DeformCount */] = - this._frameFloatArray.length - frameFloatOffset; - this._frameIntArray[frameIntOffset + 2 /* DeformValueCount */] = - this._frameFloatArray.length - frameFloatOffset; - this._frameIntArray[frameIntOffset + 3 /* DeformValueOffset */] = 0; - this._frameIntArray[frameIntOffset + 4 /* DeformFloatOffset */] = - frameFloatOffset - this._animation.frameFloatOffset; - this._timelineArray[ - this._timeline.offset + 3 /* TimelineFrameValueCount */ - ] = frameIntOffset - this._animation.frameIntOffset; - } - return frameOffset; - }; - ObjectDataParser.prototype._parseTransform = function( - rawData, - transform, - scale, - ) { - transform.x = - ObjectDataParser._getNumber(rawData, dragonBones.DataParser.X, 0.0) * - scale; - transform.y = - ObjectDataParser._getNumber(rawData, dragonBones.DataParser.Y, 0.0) * - scale; - if ( - dragonBones.DataParser.ROTATE in rawData || - dragonBones.DataParser.SKEW in rawData - ) { - transform.rotation = dragonBones.Transform.normalizeRadian( - ObjectDataParser._getNumber( - rawData, - dragonBones.DataParser.ROTATE, - 0.0, - ) * dragonBones.Transform.DEG_RAD, - ); - transform.skew = dragonBones.Transform.normalizeRadian( - ObjectDataParser._getNumber( - rawData, - dragonBones.DataParser.SKEW, - 0.0, - ) * dragonBones.Transform.DEG_RAD, - ); - } else if ( - dragonBones.DataParser.SKEW_X in rawData || - dragonBones.DataParser.SKEW_Y in rawData - ) { - transform.rotation = dragonBones.Transform.normalizeRadian( - ObjectDataParser._getNumber( - rawData, - dragonBones.DataParser.SKEW_Y, - 0.0, - ) * dragonBones.Transform.DEG_RAD, - ); - transform.skew = - dragonBones.Transform.normalizeRadian( - ObjectDataParser._getNumber( - rawData, - dragonBones.DataParser.SKEW_X, - 0.0, - ) * dragonBones.Transform.DEG_RAD, - ) - transform.rotation; - } - transform.scaleX = ObjectDataParser._getNumber( - rawData, - dragonBones.DataParser.SCALE_X, - 1.0, - ); - transform.scaleY = ObjectDataParser._getNumber( - rawData, - dragonBones.DataParser.SCALE_Y, - 1.0, - ); - }; - ObjectDataParser.prototype._parseColorTransform = function(rawData, color) { - color.alphaMultiplier = - ObjectDataParser._getNumber( - rawData, - dragonBones.DataParser.ALPHA_MULTIPLIER, - 100, - ) * 0.01; - color.redMultiplier = - ObjectDataParser._getNumber( - rawData, - dragonBones.DataParser.RED_MULTIPLIER, - 100, - ) * 0.01; - color.greenMultiplier = - ObjectDataParser._getNumber( - rawData, - dragonBones.DataParser.GREEN_MULTIPLIER, - 100, - ) * 0.01; - color.blueMultiplier = - ObjectDataParser._getNumber( - rawData, - dragonBones.DataParser.BLUE_MULTIPLIER, - 100, - ) * 0.01; - color.alphaOffset = ObjectDataParser._getNumber( - rawData, - dragonBones.DataParser.ALPHA_OFFSET, - 0, - ); - color.redOffset = ObjectDataParser._getNumber( - rawData, - dragonBones.DataParser.RED_OFFSET, - 0, - ); - color.greenOffset = ObjectDataParser._getNumber( - rawData, - dragonBones.DataParser.GREEN_OFFSET, - 0, - ); - color.blueOffset = ObjectDataParser._getNumber( - rawData, - dragonBones.DataParser.BLUE_OFFSET, - 0, - ); - }; - ObjectDataParser.prototype._parseGeometry = function(rawData, geometry) { - var rawVertices = rawData[dragonBones.DataParser.VERTICES]; - var vertexCount = Math.floor(rawVertices.length / 2); // uint - var triangleCount = 0; - var geometryOffset = this._intArray.length; - var verticesOffset = this._floatArray.length; - // - geometry.offset = geometryOffset; - geometry.data = this._data; - // - this._intArray.length += 1 + 1 + 1 + 1; - this._intArray[ - geometryOffset + 0 /* GeometryVertexCount */ - ] = vertexCount; - this._intArray[ - geometryOffset + 2 /* GeometryFloatOffset */ - ] = verticesOffset; - this._intArray[geometryOffset + 3 /* GeometryWeightOffset */] = -1; // - // - this._floatArray.length += vertexCount * 2; - for (var i = 0, l = vertexCount * 2; i < l; ++i) { - this._floatArray[verticesOffset + i] = rawVertices[i]; - } - if (dragonBones.DataParser.TRIANGLES in rawData) { - var rawTriangles = rawData[dragonBones.DataParser.TRIANGLES]; - triangleCount = Math.floor(rawTriangles.length / 3); // uint - // - this._intArray.length += triangleCount * 3; - for (var i = 0, l = triangleCount * 3; i < l; ++i) { - this._intArray[geometryOffset + 4 /* GeometryVertexIndices */ + i] = - rawTriangles[i]; - } - } - // Fill triangle count. - this._intArray[ - geometryOffset + 1 /* GeometryTriangleCount */ - ] = triangleCount; - if (dragonBones.DataParser.UVS in rawData) { - var rawUVs = rawData[dragonBones.DataParser.UVS]; - var uvOffset = verticesOffset + vertexCount * 2; - this._floatArray.length += vertexCount * 2; - for (var i = 0, l = vertexCount * 2; i < l; ++i) { - this._floatArray[uvOffset + i] = rawUVs[i]; - } - } - if (dragonBones.DataParser.WEIGHTS in rawData) { - var rawWeights = rawData[dragonBones.DataParser.WEIGHTS]; - var weightCount = Math.floor(rawWeights.length - vertexCount) / 2; // uint - var weightOffset = this._intArray.length; - var floatOffset = this._floatArray.length; - var weightBoneCount = 0; - var sortedBones = this._armature.sortedBones; - var weight = dragonBones.BaseObject.borrowObject( - dragonBones.WeightData, - ); - weight.count = weightCount; - weight.offset = weightOffset; - this._intArray.length += - 1 + 1 + weightBoneCount + vertexCount + weightCount; - this._intArray[weightOffset + 1 /* WeigthFloatOffset */] = floatOffset; - if (dragonBones.DataParser.BONE_POSE in rawData) { - var rawSlotPose = rawData[dragonBones.DataParser.SLOT_POSE]; - var rawBonePoses = rawData[dragonBones.DataParser.BONE_POSE]; - var weightBoneIndices = new Array(); - weightBoneCount = Math.floor(rawBonePoses.length / 7); // uint - weightBoneIndices.length = weightBoneCount; - for (var i = 0; i < weightBoneCount; ++i) { - var rawBoneIndex = rawBonePoses[i * 7]; // uint - var bone = this._rawBones[rawBoneIndex]; - weight.addBone(bone); - weightBoneIndices[i] = rawBoneIndex; - this._intArray[ - weightOffset + 2 /* WeigthBoneIndices */ + i - ] = sortedBones.indexOf(bone); - } - this._floatArray.length += weightCount * 3; - this._helpMatrixA.copyFromArray(rawSlotPose, 0); - for ( - var i = 0, - iW = 0, - iB = weightOffset + 2 /* WeigthBoneIndices */ + weightBoneCount, - iV = floatOffset; - i < vertexCount; - ++i - ) { - var iD = i * 2; - var vertexBoneCount = (this._intArray[iB++] = rawWeights[iW++]); // uint - var x = this._floatArray[verticesOffset + iD]; - var y = this._floatArray[verticesOffset + iD + 1]; - this._helpMatrixA.transformPoint(x, y, this._helpPoint); - x = this._helpPoint.x; - y = this._helpPoint.y; - for (var j = 0; j < vertexBoneCount; ++j) { - var rawBoneIndex = rawWeights[iW++]; // uint - var boneIndex = weightBoneIndices.indexOf(rawBoneIndex); - this._helpMatrixB.copyFromArray(rawBonePoses, boneIndex * 7 + 1); - this._helpMatrixB.invert(); - this._helpMatrixB.transformPoint(x, y, this._helpPoint); - this._intArray[iB++] = boneIndex; - this._floatArray[iV++] = rawWeights[iW++]; - this._floatArray[iV++] = this._helpPoint.x; - this._floatArray[iV++] = this._helpPoint.y; - } - } - } else { - var rawBones = rawData[dragonBones.DataParser.BONES]; - weightBoneCount = rawBones.length; - for (var i = 0; i < weightBoneCount; i++) { - var rawBoneIndex = rawBones[i]; - var bone = this._rawBones[rawBoneIndex]; - weight.addBone(bone); - this._intArray[ - weightOffset + 2 /* WeigthBoneIndices */ + i - ] = sortedBones.indexOf(bone); - } - this._floatArray.length += weightCount * 3; - for ( - var i = 0, - iW = 0, - iV = 0, - iB = weightOffset + 2 /* WeigthBoneIndices */ + weightBoneCount, - iF = floatOffset; - i < weightCount; - i++ - ) { - var vertexBoneCount = rawWeights[iW++]; - this._intArray[iB++] = vertexBoneCount; - for (var j = 0; j < vertexBoneCount; j++) { - var boneIndex = rawWeights[iW++]; - var boneWeight = rawWeights[iW++]; - var x = rawVertices[iV++]; - var y = rawVertices[iV++]; - this._intArray[iB++] = rawBones.indexOf(boneIndex); - this._floatArray[iF++] = boneWeight; - this._floatArray[iF++] = x; - this._floatArray[iF++] = y; - } - } - } - geometry.weight = weight; - } - }; - ObjectDataParser.prototype._parseArray = function(rawData) { - this._intArray.length = 0; - this._floatArray.length = 0; - this._frameIntArray.length = 0; - this._frameFloatArray.length = 0; - this._frameArray.length = 0; - this._timelineArray.length = 0; - this._colorArray.length = 0; - }; - ObjectDataParser.prototype._modifyArray = function() { - // Align. - if (this._intArray.length % Int16Array.BYTES_PER_ELEMENT !== 0) { - this._intArray.push(0); - } - if (this._frameIntArray.length % Int16Array.BYTES_PER_ELEMENT !== 0) { - this._frameIntArray.push(0); - } - if (this._frameArray.length % Int16Array.BYTES_PER_ELEMENT !== 0) { - this._frameArray.push(0); - } - if (this._timelineArray.length % Uint16Array.BYTES_PER_ELEMENT !== 0) { - this._timelineArray.push(0); - } - if (this._timelineArray.length % Int16Array.BYTES_PER_ELEMENT !== 0) { - this._colorArray.push(0); - } - var l1 = this._intArray.length * Int16Array.BYTES_PER_ELEMENT; - var l2 = this._floatArray.length * Float32Array.BYTES_PER_ELEMENT; - var l3 = this._frameIntArray.length * Int16Array.BYTES_PER_ELEMENT; - var l4 = this._frameFloatArray.length * Float32Array.BYTES_PER_ELEMENT; - var l5 = this._frameArray.length * Int16Array.BYTES_PER_ELEMENT; - var l6 = this._timelineArray.length * Uint16Array.BYTES_PER_ELEMENT; - var l7 = this._colorArray.length * Int16Array.BYTES_PER_ELEMENT; - var lTotal = l1 + l2 + l3 + l4 + l5 + l6 + l7; - // - var binary = new ArrayBuffer(lTotal); - var intArray = new Int16Array(binary, 0, this._intArray.length); - var floatArray = new Float32Array(binary, l1, this._floatArray.length); - var frameIntArray = new Int16Array( - binary, - l1 + l2, - this._frameIntArray.length, - ); - var frameFloatArray = new Float32Array( - binary, - l1 + l2 + l3, - this._frameFloatArray.length, - ); - var frameArray = new Int16Array( - binary, - l1 + l2 + l3 + l4, - this._frameArray.length, - ); - var timelineArray = new Uint16Array( - binary, - l1 + l2 + l3 + l4 + l5, - this._timelineArray.length, - ); - var colorArray = new Int16Array( - binary, - l1 + l2 + l3 + l4 + l5 + l6, - this._colorArray.length, - ); - for (var i = 0, l = this._intArray.length; i < l; ++i) { - intArray[i] = this._intArray[i]; - } - for (var i = 0, l = this._floatArray.length; i < l; ++i) { - floatArray[i] = this._floatArray[i]; - } - for (var i = 0, l = this._frameIntArray.length; i < l; ++i) { - frameIntArray[i] = this._frameIntArray[i]; - } - for (var i = 0, l = this._frameFloatArray.length; i < l; ++i) { - frameFloatArray[i] = this._frameFloatArray[i]; - } - for (var i = 0, l = this._frameArray.length; i < l; ++i) { - frameArray[i] = this._frameArray[i]; - } - for (var i = 0, l = this._timelineArray.length; i < l; ++i) { - timelineArray[i] = this._timelineArray[i]; - } - for (var i = 0, l = this._colorArray.length; i < l; ++i) { - colorArray[i] = this._colorArray[i]; - } - this._data.binary = binary; - this._data.intArray = intArray; - this._data.floatArray = floatArray; - this._data.frameIntArray = frameIntArray; - this._data.frameFloatArray = frameFloatArray; - this._data.frameArray = frameArray; - this._data.timelineArray = timelineArray; - this._data.colorArray = colorArray; - this._defaultColorOffset = -1; - }; - ObjectDataParser.prototype.parseDragonBonesData = function(rawData, scale) { - if (scale === void 0) { - scale = 1; - } - console.assert(rawData !== null && rawData !== undefined, 'Data error.'); - var version = ObjectDataParser._getString( - rawData, - dragonBones.DataParser.VERSION, - '', - ); - var compatibleVersion = ObjectDataParser._getString( - rawData, - dragonBones.DataParser.COMPATIBLE_VERSION, - '', - ); - if ( - dragonBones.DataParser.DATA_VERSIONS.indexOf(version) >= 0 || - dragonBones.DataParser.DATA_VERSIONS.indexOf(compatibleVersion) >= 0 - ) { - var data = dragonBones.BaseObject.borrowObject( - dragonBones.DragonBonesData, - ); - data.version = version; - data.name = ObjectDataParser._getString( - rawData, - dragonBones.DataParser.NAME, - '', - ); - data.frameRate = ObjectDataParser._getNumber( - rawData, - dragonBones.DataParser.FRAME_RATE, - 24, - ); - if (data.frameRate === 0) { - data.frameRate = 24; - } - if (dragonBones.DataParser.ARMATURE in rawData) { - this._data = data; - this._parseArray(rawData); - var rawArmatures = rawData[dragonBones.DataParser.ARMATURE]; - for ( - var _i = 0, rawArmatures_1 = rawArmatures; - _i < rawArmatures_1.length; - _i++ - ) { - var rawArmature = rawArmatures_1[_i]; - data.addArmature(this._parseArmature(rawArmature, scale)); - } - if (!this._data.binary) { - this._modifyArray(); - } - if (dragonBones.DataParser.STAGE in rawData) { - data.stage = data.getArmature( - ObjectDataParser._getString( - rawData, - dragonBones.DataParser.STAGE, - '', - ), - ); - } else if (data.armatureNames.length > 0) { - data.stage = data.getArmature(data.armatureNames[0]); - } - this._data = null; - } - if (dragonBones.DataParser.TEXTURE_ATLAS in rawData) { - this._rawTextureAtlases = - rawData[dragonBones.DataParser.TEXTURE_ATLAS]; - } - return data; - } else { - console.assert( - false, - 'Nonsupport data version: ' + - version + - '\n' + - 'Please convert DragonBones data to support version.\n' + - 'Read more: https://github.com/DragonBones/Tools/', - ); - } - return null; - }; - ObjectDataParser.prototype.parseTextureAtlasData = function( - rawData, - textureAtlasData, - scale, - ) { - if (scale === void 0) { - scale = 1.0; - } - console.assert(rawData !== undefined); - if (rawData === null) { - if ( - this._rawTextureAtlases === null || - this._rawTextureAtlases.length === 0 - ) { - return false; - } - var rawTextureAtlas = this._rawTextureAtlases[ - this._rawTextureAtlasIndex++ - ]; - this.parseTextureAtlasData(rawTextureAtlas, textureAtlasData, scale); - if (this._rawTextureAtlasIndex >= this._rawTextureAtlases.length) { - this._rawTextureAtlasIndex = 0; - this._rawTextureAtlases = null; - } - return true; - } - // Texture format. - textureAtlasData.width = ObjectDataParser._getNumber( - rawData, - dragonBones.DataParser.WIDTH, - 0, - ); - textureAtlasData.height = ObjectDataParser._getNumber( - rawData, - dragonBones.DataParser.HEIGHT, - 0, - ); - textureAtlasData.scale = - scale === 1.0 - ? 1.0 / - ObjectDataParser._getNumber( - rawData, - dragonBones.DataParser.SCALE, - 1.0, - ) - : scale; - textureAtlasData.name = ObjectDataParser._getString( - rawData, - dragonBones.DataParser.NAME, - '', - ); - textureAtlasData.imagePath = ObjectDataParser._getString( - rawData, - dragonBones.DataParser.IMAGE_PATH, - '', - ); - if (dragonBones.DataParser.SUB_TEXTURE in rawData) { - var rawTextures = rawData[dragonBones.DataParser.SUB_TEXTURE]; - for (var i = 0, l = rawTextures.length; i < l; ++i) { - var rawTexture = rawTextures[i]; - var frameWidth = ObjectDataParser._getNumber( - rawTexture, - dragonBones.DataParser.FRAME_WIDTH, - -1.0, - ); - var frameHeight = ObjectDataParser._getNumber( - rawTexture, - dragonBones.DataParser.FRAME_HEIGHT, - -1.0, - ); - var textureData = textureAtlasData.createTexture(); - textureData.rotated = ObjectDataParser._getBoolean( - rawTexture, - dragonBones.DataParser.ROTATED, - false, - ); - textureData.name = ObjectDataParser._getString( - rawTexture, - dragonBones.DataParser.NAME, - '', - ); - textureData.region.x = ObjectDataParser._getNumber( - rawTexture, - dragonBones.DataParser.X, - 0.0, - ); - textureData.region.y = ObjectDataParser._getNumber( - rawTexture, - dragonBones.DataParser.Y, - 0.0, - ); - textureData.region.width = ObjectDataParser._getNumber( - rawTexture, - dragonBones.DataParser.WIDTH, - 0.0, - ); - textureData.region.height = ObjectDataParser._getNumber( - rawTexture, - dragonBones.DataParser.HEIGHT, - 0.0, - ); - if (frameWidth > 0.0 && frameHeight > 0.0) { - textureData.frame = dragonBones.TextureData.createRectangle(); - textureData.frame.x = ObjectDataParser._getNumber( - rawTexture, - dragonBones.DataParser.FRAME_X, - 0.0, - ); - textureData.frame.y = ObjectDataParser._getNumber( - rawTexture, - dragonBones.DataParser.FRAME_Y, - 0.0, - ); - textureData.frame.width = frameWidth; - textureData.frame.height = frameHeight; - } - textureAtlasData.addTexture(textureData); - } - } - return true; - }; - /** - * - Deprecated, please refer to {@link dragonBones.BaseFactory#parseDragonBonesData()}. - * @deprecated - * @language en_US - */ - /** - * - 已废弃,请参考 {@link dragonBones.BaseFactory#parseDragonBonesData()}。 - * @deprecated - * @language zh_CN - */ - ObjectDataParser.getInstance = function() { - if (ObjectDataParser._objectDataParserInstance === null) { - ObjectDataParser._objectDataParserInstance = new ObjectDataParser(); - } - return ObjectDataParser._objectDataParserInstance; - }; - ObjectDataParser._objectDataParserInstance = null; - return ObjectDataParser; - })(dragonBones.DataParser); - dragonBones.ObjectDataParser = ObjectDataParser; - /** - * @private - */ - var ActionFrame = /** @class */ (function() { - function ActionFrame() { - this.frameStart = 0; - this.actions = []; - } - return ActionFrame; - })(); - dragonBones.ActionFrame = ActionFrame; - })(dragonBones || (dragonBones = {})); - /** - * The MIT License (MIT) - * - * Copyright (c) 2012-2018 DragonBones team and other contributors - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of - * the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR - * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - (function(dragonBones) { - /** - * @private - */ - var BinaryDataParser = /** @class */ (function(_super) { - __extends(BinaryDataParser, _super); - function BinaryDataParser() { - return (_super !== null && _super.apply(this, arguments)) || this; - } - BinaryDataParser.prototype._inRange = function(a, min, max) { - return min <= a && a <= max; - }; - BinaryDataParser.prototype._decodeUTF8 = function(data) { - var EOF_byte = -1; - var EOF_code_point = -1; - var FATAL_POINT = 0xfffd; - var pos = 0; - var result = ''; - var code_point; - var utf8_code_point = 0; - var utf8_bytes_needed = 0; - var utf8_bytes_seen = 0; - var utf8_lower_boundary = 0; - while (data.length > pos) { - var _byte = data[pos++]; - if (_byte === EOF_byte) { - if (utf8_bytes_needed !== 0) { - code_point = FATAL_POINT; - } else { - code_point = EOF_code_point; - } - } else { - if (utf8_bytes_needed === 0) { - if (this._inRange(_byte, 0x00, 0x7f)) { - code_point = _byte; - } else { - if (this._inRange(_byte, 0xc2, 0xdf)) { - utf8_bytes_needed = 1; - utf8_lower_boundary = 0x80; - utf8_code_point = _byte - 0xc0; - } else if (this._inRange(_byte, 0xe0, 0xef)) { - utf8_bytes_needed = 2; - utf8_lower_boundary = 0x800; - utf8_code_point = _byte - 0xe0; - } else if (this._inRange(_byte, 0xf0, 0xf4)) { - utf8_bytes_needed = 3; - utf8_lower_boundary = 0x10000; - utf8_code_point = _byte - 0xf0; - } else ; - utf8_code_point = - utf8_code_point * Math.pow(64, utf8_bytes_needed); - code_point = null; - } - } else if (!this._inRange(_byte, 0x80, 0xbf)) { - utf8_code_point = 0; - utf8_bytes_needed = 0; - utf8_bytes_seen = 0; - utf8_lower_boundary = 0; - pos--; - code_point = _byte; - } else { - utf8_bytes_seen += 1; - utf8_code_point = - utf8_code_point + - (_byte - 0x80) * - Math.pow(64, utf8_bytes_needed - utf8_bytes_seen); - if (utf8_bytes_seen !== utf8_bytes_needed) { - code_point = null; - } else { - var cp = utf8_code_point; - var lower_boundary = utf8_lower_boundary; - utf8_code_point = 0; - utf8_bytes_needed = 0; - utf8_bytes_seen = 0; - utf8_lower_boundary = 0; - if ( - this._inRange(cp, lower_boundary, 0x10ffff) && - !this._inRange(cp, 0xd800, 0xdfff) - ) { - code_point = cp; - } else { - code_point = _byte; - } - } - } - } - //Decode string - if (code_point !== null && code_point !== EOF_code_point) { - if (code_point <= 0xffff) { - if (code_point > 0) result += String.fromCharCode(code_point); - } else { - code_point -= 0x10000; - result += String.fromCharCode( - 0xd800 + ((code_point >> 10) & 0x3ff), - ); - result += String.fromCharCode(0xdc00 + (code_point & 0x3ff)); - } - } - } - return result; - }; - BinaryDataParser.prototype._parseBinaryTimeline = function( - type, - offset, - timelineData, - ) { - if (timelineData === void 0) { - timelineData = null; - } - var timeline = - timelineData !== null - ? timelineData - : dragonBones.BaseObject.borrowObject(dragonBones.TimelineData); - timeline.type = type; - timeline.offset = offset; - this._timeline = timeline; - var keyFrameCount = this._timelineArrayBuffer[ - timeline.offset + 2 /* TimelineKeyFrameCount */ - ]; - if (keyFrameCount === 1) { - timeline.frameIndicesOffset = -1; - } else { - var frameIndicesOffset = 0; - var totalFrameCount = this._animation.frameCount + 1; // One more frame than animation. - var frameIndices = this._data.frameIndices; - frameIndicesOffset = frameIndices.length; - frameIndices.length += totalFrameCount; - timeline.frameIndicesOffset = frameIndicesOffset; - for ( - var i = 0, iK = 0, frameStart = 0, frameCount = 0; - i < totalFrameCount; - ++i - ) { - if (frameStart + frameCount <= i && iK < keyFrameCount) { - frameStart = this._frameArrayBuffer[ - this._animation.frameOffset + - this._timelineArrayBuffer[ - timeline.offset + 5 /* TimelineFrameOffset */ + iK - ] - ]; - if (iK === keyFrameCount - 1) { - frameCount = this._animation.frameCount - frameStart; - } else { - frameCount = - this._frameArrayBuffer[ - this._animation.frameOffset + - this._timelineArrayBuffer[ - timeline.offset + 5 /* TimelineFrameOffset */ + iK + 1 - ] - ] - frameStart; - } - iK++; - } - frameIndices[frameIndicesOffset + i] = iK - 1; - } - } - this._timeline = null; // - return timeline; - }; - BinaryDataParser.prototype._parseAnimation = function(rawData) { - var animation = dragonBones.BaseObject.borrowObject( - dragonBones.AnimationData, - ); - animation.blendType = dragonBones.DataParser._getAnimationBlendType( - dragonBones.ObjectDataParser._getString( - rawData, - dragonBones.DataParser.BLEND_TYPE, - '', - ), - ); - animation.frameCount = dragonBones.ObjectDataParser._getNumber( - rawData, - dragonBones.DataParser.DURATION, - 0, - ); - animation.playTimes = dragonBones.ObjectDataParser._getNumber( - rawData, - dragonBones.DataParser.PLAY_TIMES, - 1, - ); - animation.duration = animation.frameCount / this._armature.frameRate; // float - animation.fadeInTime = dragonBones.ObjectDataParser._getNumber( - rawData, - dragonBones.DataParser.FADE_IN_TIME, - 0.0, - ); - animation.scale = dragonBones.ObjectDataParser._getNumber( - rawData, - dragonBones.DataParser.SCALE, - 1.0, - ); - animation.name = dragonBones.ObjectDataParser._getString( - rawData, - dragonBones.DataParser.NAME, - dragonBones.DataParser.DEFAULT_NAME, - ); - if (animation.name.length === 0) { - animation.name = dragonBones.DataParser.DEFAULT_NAME; - } - // Offsets. - var offsets = rawData[dragonBones.DataParser.OFFSET]; - animation.frameIntOffset = offsets[0]; - animation.frameFloatOffset = offsets[1]; - animation.frameOffset = offsets[2]; - this._animation = animation; - if (dragonBones.DataParser.ACTION in rawData) { - animation.actionTimeline = this._parseBinaryTimeline( - 0 /* Action */, - rawData[dragonBones.DataParser.ACTION], - ); - } - if (dragonBones.DataParser.Z_ORDER in rawData) { - animation.zOrderTimeline = this._parseBinaryTimeline( - 1 /* ZOrder */, - rawData[dragonBones.DataParser.Z_ORDER], - ); - } - if (dragonBones.DataParser.BONE in rawData) { - var rawTimeliness = rawData[dragonBones.DataParser.BONE]; - for (var k in rawTimeliness) { - var rawTimelines = rawTimeliness[k]; - var bone = this._armature.getBone(k); - if (bone === null) { - continue; - } - for (var i = 0, l = rawTimelines.length; i < l; i += 2) { - var timelineType = rawTimelines[i]; - var timelineOffset = rawTimelines[i + 1]; - var timeline = this._parseBinaryTimeline( - timelineType, - timelineOffset, - ); - this._animation.addBoneTimeline(bone.name, timeline); - } - } - } - if (dragonBones.DataParser.SLOT in rawData) { - var rawTimeliness = rawData[dragonBones.DataParser.SLOT]; - for (var k in rawTimeliness) { - var rawTimelines = rawTimeliness[k]; - var slot = this._armature.getSlot(k); - if (slot === null) { - continue; - } - for (var i = 0, l = rawTimelines.length; i < l; i += 2) { - var timelineType = rawTimelines[i]; - var timelineOffset = rawTimelines[i + 1]; - var timeline = this._parseBinaryTimeline( - timelineType, - timelineOffset, - ); - this._animation.addSlotTimeline(slot.name, timeline); - } - } - } - if (dragonBones.DataParser.CONSTRAINT in rawData) { - var rawTimeliness = rawData[dragonBones.DataParser.CONSTRAINT]; - for (var k in rawTimeliness) { - var rawTimelines = rawTimeliness[k]; - var constraint = this._armature.getConstraint(k); - if (constraint === null) { - continue; - } - for (var i = 0, l = rawTimelines.length; i < l; i += 2) { - var timelineType = rawTimelines[i]; - var timelineOffset = rawTimelines[i + 1]; - var timeline = this._parseBinaryTimeline( - timelineType, - timelineOffset, - ); - this._animation.addConstraintTimeline(constraint.name, timeline); - } - } - } - if (dragonBones.DataParser.TIMELINE in rawData) { - var rawTimelines = rawData[dragonBones.DataParser.TIMELINE]; - for ( - var _i = 0, rawTimelines_6 = rawTimelines; - _i < rawTimelines_6.length; - _i++ - ) { - var rawTimeline = rawTimelines_6[_i]; - var timelineOffset = dragonBones.ObjectDataParser._getNumber( - rawTimeline, - dragonBones.DataParser.OFFSET, - 0, - ); - if (timelineOffset >= 0) { - var timelineType = dragonBones.ObjectDataParser._getNumber( - rawTimeline, - dragonBones.DataParser.TYPE, - 0 /* Action */, - ); - var timelineName = dragonBones.ObjectDataParser._getString( - rawTimeline, - dragonBones.DataParser.NAME, - '', - ); - var timeline = null; - if ( - timelineType === 40 /* AnimationProgress */ && - animation.blendType !== 0 /* None */ - ) { - timeline = dragonBones.BaseObject.borrowObject( - dragonBones.AnimationTimelineData, - ); - var animaitonTimeline = timeline; - animaitonTimeline.x = dragonBones.ObjectDataParser._getNumber( - rawTimeline, - dragonBones.DataParser.X, - 0.0, - ); - animaitonTimeline.y = dragonBones.ObjectDataParser._getNumber( - rawTimeline, - dragonBones.DataParser.Y, - 0.0, - ); - } - timeline = this._parseBinaryTimeline( - timelineType, - timelineOffset, - timeline, - ); - switch (timelineType) { - case 0 /* Action */: - // TODO - break; - case 1 /* ZOrder */: - // TODO - break; - case 11 /* BoneTranslate */: - case 12 /* BoneRotate */: - case 13 /* BoneScale */: - case 50 /* Surface */: - case 60 /* BoneAlpha */: - this._animation.addBoneTimeline(timelineName, timeline); - break; - case 20 /* SlotDisplay */: - case 21 /* SlotColor */: - case 22 /* SlotDeform */: - case 23 /* SlotZIndex */: - case 24 /* SlotAlpha */: - this._animation.addSlotTimeline(timelineName, timeline); - break; - case 30 /* IKConstraint */: - this._animation.addConstraintTimeline(timelineName, timeline); - break; - case 40 /* AnimationProgress */: - case 41 /* AnimationWeight */: - case 42 /* AnimationParameter */: - this._animation.addAnimationTimeline(timelineName, timeline); - break; - } - } - } - } - this._animation = null; - return animation; - }; - BinaryDataParser.prototype._parseGeometry = function(rawData, geometry) { - geometry.offset = rawData[dragonBones.DataParser.OFFSET]; - geometry.data = this._data; - var weightOffset = this._intArrayBuffer[ - geometry.offset + 3 /* GeometryWeightOffset */ - ]; - if (weightOffset >= 0) { - var weight = dragonBones.BaseObject.borrowObject( - dragonBones.WeightData, - ); - var vertexCount = this._intArrayBuffer[ - geometry.offset + 0 /* GeometryVertexCount */ - ]; - var boneCount = this._intArrayBuffer[ - weightOffset + 0 /* WeigthBoneCount */ - ]; - weight.offset = weightOffset; - for (var i = 0; i < boneCount; ++i) { - var boneIndex = this._intArrayBuffer[ - weightOffset + 2 /* WeigthBoneIndices */ + i - ]; - weight.addBone(this._rawBones[boneIndex]); - } - var boneIndicesOffset = - weightOffset + 2 /* WeigthBoneIndices */ + boneCount; - var weightCount = 0; - for (var i = 0, l = vertexCount; i < l; ++i) { - var vertexBoneCount = this._intArrayBuffer[boneIndicesOffset++]; - weightCount += vertexBoneCount; - boneIndicesOffset += vertexBoneCount; - } - weight.count = weightCount; - geometry.weight = weight; - } - }; - BinaryDataParser.prototype._parseArray = function(rawData) { - var offsets = rawData[dragonBones.DataParser.OFFSET]; - var l1 = offsets[1]; - var l2 = offsets[3]; - var l3 = offsets[5]; - var l4 = offsets[7]; - var l5 = offsets[9]; - var l6 = offsets[11]; - var l7 = offsets.length > 12 ? offsets[13] : 0; // Color. - var intArray = new Int16Array( - this._binary, - this._binaryOffset + offsets[0], - l1 / Int16Array.BYTES_PER_ELEMENT, - ); - var floatArray = new Float32Array( - this._binary, - this._binaryOffset + offsets[2], - l2 / Float32Array.BYTES_PER_ELEMENT, - ); - var frameIntArray = new Int16Array( - this._binary, - this._binaryOffset + offsets[4], - l3 / Int16Array.BYTES_PER_ELEMENT, - ); - var frameFloatArray = new Float32Array( - this._binary, - this._binaryOffset + offsets[6], - l4 / Float32Array.BYTES_PER_ELEMENT, - ); - var frameArray = new Int16Array( - this._binary, - this._binaryOffset + offsets[8], - l5 / Int16Array.BYTES_PER_ELEMENT, - ); - var timelineArray = new Uint16Array( - this._binary, - this._binaryOffset + offsets[10], - l6 / Uint16Array.BYTES_PER_ELEMENT, - ); - var colorArray = - l7 > 0 - ? new Int16Array( - this._binary, - this._binaryOffset + offsets[12], - l7 / Int16Array.BYTES_PER_ELEMENT, - ) - : intArray; // Color. - this._data.binary = this._binary; - this._data.intArray = this._intArrayBuffer = intArray; - this._data.floatArray = floatArray; - this._data.frameIntArray = frameIntArray; - this._data.frameFloatArray = frameFloatArray; - this._data.frameArray = this._frameArrayBuffer = frameArray; - this._data.timelineArray = this._timelineArrayBuffer = timelineArray; - this._data.colorArray = colorArray; - }; - BinaryDataParser.prototype.parseDragonBonesData = function(rawData, scale) { - if (scale === void 0) { - scale = 1; - } - console.assert( - rawData !== null && - rawData !== undefined && - rawData instanceof ArrayBuffer, - 'Data error.', - ); - var tag = new Uint8Array(rawData, 0, 8); - if ( - tag[0] !== 'D'.charCodeAt(0) || - tag[1] !== 'B'.charCodeAt(0) || - tag[2] !== 'D'.charCodeAt(0) || - tag[3] !== 'T'.charCodeAt(0) - ) { - console.assert(false, 'Nonsupport data.'); - return null; - } - var headerLength = new Uint32Array(rawData, 8, 1)[0]; - var headerBytes = new Uint8Array(rawData, 8 + 4, headerLength); - var headerString = this._decodeUTF8(headerBytes); - var header = JSON.parse(headerString); - // - this._binaryOffset = 8 + 4 + headerLength; - this._binary = rawData; - return _super.prototype.parseDragonBonesData.call(this, header, scale); - }; - /** - * - Deprecated, please refer to {@link dragonBones.BaseFactory#parseDragonBonesData()}. - * @deprecated - * @language en_US - */ - /** - * - 已废弃,请参考 {@link dragonBones.BaseFactory#parseDragonBonesData()}。 - * @deprecated - * @language zh_CN - */ - BinaryDataParser.getInstance = function() { - if (BinaryDataParser._binaryDataParserInstance === null) { - BinaryDataParser._binaryDataParserInstance = new BinaryDataParser(); - } - return BinaryDataParser._binaryDataParserInstance; - }; - BinaryDataParser._binaryDataParserInstance = null; - return BinaryDataParser; - })(dragonBones.ObjectDataParser); - dragonBones.BinaryDataParser = BinaryDataParser; - })(dragonBones || (dragonBones = {})); - /** - * The MIT License (MIT) - * - * Copyright (c) 2012-2018 DragonBones team and other contributors - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of - * the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR - * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - (function(dragonBones) { - /** - * - Base class for the factory that create the armatures. (Typically only one global factory instance is required) - * The factory instance create armatures by parsed and added DragonBonesData instances and TextureAtlasData instances. - * Once the data has been parsed, it has been cached in the factory instance and does not need to be parsed again until it is cleared by the factory instance. - * @see dragonBones.DragonBonesData - * @see dragonBones.TextureAtlasData - * @see dragonBones.ArmatureData - * @see dragonBones.Armature - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 创建骨架的工厂基类。 (通常只需要一个全局工厂实例) - * 工厂通过解析并添加的 DragonBonesData 实例和 TextureAtlasData 实例来创建骨架。 - * 当数据被解析过之后,已经添加到工厂中,在没有被工厂清理之前,不需要再次解析。 - * @see dragonBones.DragonBonesData - * @see dragonBones.TextureAtlasData - * @see dragonBones.ArmatureData - * @see dragonBones.Armature - * @version DragonBones 3.0 - * @language zh_CN - */ - var BaseFactory = /** @class */ (function() { - /** - * - Create a factory instance. (typically only one global factory instance is required) - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 创建一个工厂实例。 (通常只需要一个全局工厂实例) - * @version DragonBones 3.0 - * @language zh_CN - */ - function BaseFactory(dataParser) { - if (dataParser === void 0) { - dataParser = null; - } - /** - * @private - */ - this.autoSearch = false; - this._dragonBonesDataMap = {}; - this._textureAtlasDataMap = {}; - this._dragonBones = null; - this._dataParser = null; - if (BaseFactory._objectParser === null) { - BaseFactory._objectParser = new dragonBones.ObjectDataParser(); - } - if (BaseFactory._binaryParser === null) { - BaseFactory._binaryParser = new dragonBones.BinaryDataParser(); - } - this._dataParser = - dataParser !== null ? dataParser : BaseFactory._objectParser; - } - BaseFactory.prototype._isSupportMesh = function() { - return true; - }; - BaseFactory.prototype._getTextureData = function( - textureAtlasName, - textureName, - ) { - if (textureAtlasName in this._textureAtlasDataMap) { - for ( - var _i = 0, _a = this._textureAtlasDataMap[textureAtlasName]; - _i < _a.length; - _i++ - ) { - var textureAtlasData = _a[_i]; - var textureData = textureAtlasData.getTexture(textureName); - if (textureData !== null) { - return textureData; - } - } - } - if (this.autoSearch) { - for (var k in this._textureAtlasDataMap) { - for ( - var _b = 0, _c = this._textureAtlasDataMap[k]; - _b < _c.length; - _b++ - ) { - var textureAtlasData = _c[_b]; - if (textureAtlasData.autoSearch) { - var textureData = textureAtlasData.getTexture(textureName); - if (textureData !== null) { - return textureData; - } - } - } - } - } - return null; - }; - BaseFactory.prototype._fillBuildArmaturePackage = function( - dataPackage, - dragonBonesName, - armatureName, - skinName, - textureAtlasName, - ) { - var dragonBonesData = null; - var armatureData = null; - if (dragonBonesName.length > 0) { - if (dragonBonesName in this._dragonBonesDataMap) { - dragonBonesData = this._dragonBonesDataMap[dragonBonesName]; - armatureData = dragonBonesData.getArmature(armatureName); - } - } - if ( - armatureData === null && - (dragonBonesName.length === 0 || this.autoSearch) - ) { - for (var k in this._dragonBonesDataMap) { - dragonBonesData = this._dragonBonesDataMap[k]; - if (dragonBonesName.length === 0 || dragonBonesData.autoSearch) { - armatureData = dragonBonesData.getArmature(armatureName); - if (armatureData !== null) { - dragonBonesName = k; - break; - } - } - } - } - if (armatureData !== null) { - dataPackage.dataName = dragonBonesName; - dataPackage.textureAtlasName = textureAtlasName; - dataPackage.data = dragonBonesData; - dataPackage.armature = armatureData; - dataPackage.skin = null; - if (skinName.length > 0) { - dataPackage.skin = armatureData.getSkin(skinName); - if (dataPackage.skin === null && this.autoSearch) { - for (var k in this._dragonBonesDataMap) { - var skinDragonBonesData = this._dragonBonesDataMap[k]; - var skinArmatureData = skinDragonBonesData.getArmature(skinName); - if (skinArmatureData !== null) { - dataPackage.skin = skinArmatureData.defaultSkin; - break; - } - } - } - } - if (dataPackage.skin === null) { - dataPackage.skin = armatureData.defaultSkin; - } - return true; - } - return false; - }; - BaseFactory.prototype._buildBones = function(dataPackage, armature) { - for ( - var _i = 0, _a = dataPackage.armature.sortedBones; - _i < _a.length; - _i++ - ) { - var boneData = _a[_i]; - var bone = dragonBones.BaseObject.borrowObject( - boneData.type === 0 /* Bone */ - ? dragonBones.Bone - : dragonBones.Surface, - ); - bone.init(boneData, armature); - } - }; - /** - * @private - */ - BaseFactory.prototype._buildSlots = function(dataPackage, armature) { - var currentSkin = dataPackage.skin; - var defaultSkin = dataPackage.armature.defaultSkin; - if (currentSkin === null || defaultSkin === null) { - return; - } - var skinSlots = {}; - for (var k in defaultSkin.displays) { - var displays = defaultSkin.getDisplays(k); - skinSlots[k] = displays; - } - if (currentSkin !== defaultSkin) { - for (var k in currentSkin.displays) { - var displays = currentSkin.getDisplays(k); - skinSlots[k] = displays; - } - } - for ( - var _i = 0, _a = dataPackage.armature.sortedSlots; - _i < _a.length; - _i++ - ) { - var slotData = _a[_i]; - var displayDatas = - slotData.name in skinSlots ? skinSlots[slotData.name] : null; - var slot = this._buildSlot(dataPackage, slotData, armature); - if (displayDatas !== null) { - slot.displayFrameCount = displayDatas.length; - for (var i = 0, l = slot.displayFrameCount; i < l; ++i) { - var displayData = displayDatas[i]; - slot.replaceRawDisplayData(displayData, i); - if (displayData !== null) { - if (dataPackage.textureAtlasName.length > 0) { - var textureData = this._getTextureData( - dataPackage.textureAtlasName, - displayData.path, - ); - slot.replaceTextureData(textureData, i); - } - var display = this._getSlotDisplay( - dataPackage, - displayData, - slot, - ); - slot.replaceDisplay(display, i); - } else { - slot.replaceDisplay(null); - } - } - } - slot._setDisplayIndex(slotData.displayIndex, true); - } - }; - BaseFactory.prototype._buildConstraints = function(dataPackage, armature) { - var constraints = dataPackage.armature.constraints; - for (var k in constraints) { - var constraintData = constraints[k]; - // TODO more constraint type. - switch (constraintData.type) { - case 0 /* IK */: - var ikConstraint = dragonBones.BaseObject.borrowObject( - dragonBones.IKConstraint, - ); - ikConstraint.init(constraintData, armature); - armature._addConstraint(ikConstraint); - break; - case 1 /* Path */: - var pathConstraint = dragonBones.BaseObject.borrowObject( - dragonBones.PathConstraint, - ); - pathConstraint.init(constraintData, armature); - armature._addConstraint(pathConstraint); - break; - default: - var constraint = dragonBones.BaseObject.borrowObject( - dragonBones.IKConstraint, - ); - constraint.init(constraintData, armature); - armature._addConstraint(constraint); - break; - } - } - }; - BaseFactory.prototype._buildChildArmature = function( - dataPackage, - _slot, - displayData, - ) { - return this.buildArmature( - displayData.path, - dataPackage !== null ? dataPackage.dataName : '', - '', - dataPackage !== null ? dataPackage.textureAtlasName : '', - ); - }; - BaseFactory.prototype._getSlotDisplay = function( - dataPackage, - displayData, - slot, - ) { - var dataName = - dataPackage !== null - ? dataPackage.dataName - : displayData.parent.parent.parent.name; - var display = null; - switch (displayData.type) { - case 0 /* Image */: { - var imageDisplayData = displayData; - if (imageDisplayData.texture === null) { - imageDisplayData.texture = this._getTextureData( - dataName, - displayData.path, - ); - } - display = slot.rawDisplay; - break; - } - case 2 /* Mesh */: { - var meshDisplayData = displayData; - if (meshDisplayData.texture === null) { - meshDisplayData.texture = this._getTextureData( - dataName, - meshDisplayData.path, - ); - } - if (this._isSupportMesh()) { - display = slot.meshDisplay; - } else { - display = slot.rawDisplay; - } - break; - } - case 1 /* Armature */: { - var armatureDisplayData = displayData; - var childArmature = this._buildChildArmature( - dataPackage, - slot, - armatureDisplayData, - ); - if (childArmature !== null) { - childArmature.inheritAnimation = - armatureDisplayData.inheritAnimation; - if (!childArmature.inheritAnimation) { - var actions = - armatureDisplayData.actions.length > 0 - ? armatureDisplayData.actions - : childArmature.armatureData.defaultActions; - if (actions.length > 0) { - for ( - var _i = 0, actions_6 = actions; - _i < actions_6.length; - _i++ - ) { - var action = actions_6[_i]; - var eventObject = dragonBones.BaseObject.borrowObject( - dragonBones.EventObject, - ); - dragonBones.EventObject.actionDataToInstance( - action, - eventObject, - slot.armature, - ); - eventObject.slot = slot; - slot.armature._bufferAction(eventObject, false); - } - } else { - childArmature.animation.play(); - } - } - armatureDisplayData.armature = childArmature.armatureData; // - } - display = childArmature; - break; - } - } - return display; - }; - /** - * - Parse the raw data to a DragonBonesData instance and cache it to the factory. - * @param rawData - The raw data. - * @param name - Specify a cache name for the instance so that the instance can be obtained through this name. (If not set, use the instance name instead) - * @param scale - Specify a scaling value for all armatures. (Default: 1.0) - * @returns DragonBonesData instance - * @see #getDragonBonesData() - * @see #addDragonBonesData() - * @see #removeDragonBonesData() - * @see dragonBones.DragonBonesData - * @version DragonBones 4.5 - * @language en_US - */ - /** - * - 将原始数据解析为 DragonBonesData 实例,并缓存到工厂中。 - * @param rawData - 原始数据。 - * @param name - 为该实例指定一个缓存名称,以便可以通过此名称获取该实例。 (如果未设置,则使用该实例中的名称) - * @param scale - 为所有的骨架指定一个缩放值。 (默认: 1.0) - * @returns DragonBonesData 实例 - * @see #getDragonBonesData() - * @see #addDragonBonesData() - * @see #removeDragonBonesData() - * @see dragonBones.DragonBonesData - * @version DragonBones 4.5 - * @language zh_CN - */ - BaseFactory.prototype.parseDragonBonesData = function( - rawData, - name, - scale, - ) { - if (name === void 0) { - name = null; - } - if (scale === void 0) { - scale = 1.0; - } - var dataParser = - rawData instanceof ArrayBuffer - ? BaseFactory._binaryParser - : this._dataParser; - var dragonBonesData = dataParser.parseDragonBonesData(rawData, scale); - while (true) { - var textureAtlasData = this._buildTextureAtlasData(null, null); - if (dataParser.parseTextureAtlasData(null, textureAtlasData, scale)) { - this.addTextureAtlasData(textureAtlasData, name); - } else { - textureAtlasData.returnToPool(); - break; - } - } - if (dragonBonesData !== null) { - this.addDragonBonesData(dragonBonesData, name); - } - return dragonBonesData; - }; - /** - * - Parse the raw texture atlas data and the texture atlas object to a TextureAtlasData instance and cache it to the factory. - * @param rawData - The raw texture atlas data. - * @param textureAtlas - The texture atlas object. - * @param name - Specify a cache name for the instance so that the instance can be obtained through this name. (If not set, use the instance name instead) - * @param scale - Specify a scaling value for the map set. (Default: 1.0) - * @returns TextureAtlasData instance - * @see #getTextureAtlasData() - * @see #addTextureAtlasData() - * @see #removeTextureAtlasData() - * @see dragonBones.TextureAtlasData - * @version DragonBones 4.5 - * @language en_US - */ - /** - * - 将原始贴图集数据和贴图集对象解析为 TextureAtlasData 实例,并缓存到工厂中。 - * @param rawData - 原始贴图集数据。 - * @param textureAtlas - 贴图集对象。 - * @param name - 为该实例指定一个缓存名称,以便可以通过此名称获取该实例。 (如果未设置,则使用该实例中的名称) - * @param scale - 为贴图集指定一个缩放值。 (默认: 1.0) - * @returns TextureAtlasData 实例 - * @see #getTextureAtlasData() - * @see #addTextureAtlasData() - * @see #removeTextureAtlasData() - * @see dragonBones.TextureAtlasData - * @version DragonBones 4.5 - * @language zh_CN - */ - BaseFactory.prototype.parseTextureAtlasData = function( - rawData, - textureAtlas, - name, - scale, - ) { - if (name === void 0) { - name = null; - } - if (scale === void 0) { - scale = 1.0; - } - var textureAtlasData = this._buildTextureAtlasData(null, null); - this._dataParser.parseTextureAtlasData(rawData, textureAtlasData, scale); - this._buildTextureAtlasData(textureAtlasData, textureAtlas || null); - this.addTextureAtlasData(textureAtlasData, name); - return textureAtlasData; - }; - /** - * - Update texture atlases. - * @param textureAtlases - The texture atlas objects. - * @param name - The texture atlas name. - * @version DragonBones 5.7 - * @language en_US - */ - /** - * - 更新贴图集对象。 - * @param textureAtlases - 多个贴图集对象。 - * @param name - 贴图集名称。 - * @version DragonBones 5.7 - * @language zh_CN - */ - BaseFactory.prototype.updateTextureAtlases = function( - textureAtlases, - name, - ) { - var textureAtlasDatas = this.getTextureAtlasData(name); - if (textureAtlasDatas !== null) { - for (var i = 0, l = textureAtlasDatas.length; i < l; ++i) { - if (i < textureAtlases.length) { - this._buildTextureAtlasData( - textureAtlasDatas[i], - textureAtlases[i], - ); - } - } - } - }; - /** - * - Get a specific DragonBonesData instance. - * @param name - The DragonBonesData instance cache name. - * @returns DragonBonesData instance - * @see #parseDragonBonesData() - * @see #addDragonBonesData() - * @see #removeDragonBonesData() - * @see dragonBones.DragonBonesData - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 获取特定的 DragonBonesData 实例。 - * @param name - DragonBonesData 实例的缓存名称。 - * @returns DragonBonesData 实例 - * @see #parseDragonBonesData() - * @see #addDragonBonesData() - * @see #removeDragonBonesData() - * @see dragonBones.DragonBonesData - * @version DragonBones 3.0 - * @language zh_CN - */ - BaseFactory.prototype.getDragonBonesData = function(name) { - return name in this._dragonBonesDataMap - ? this._dragonBonesDataMap[name] - : null; - }; - /** - * - Cache a DragonBonesData instance to the factory. - * @param data - The DragonBonesData instance. - * @param name - Specify a cache name for the instance so that the instance can be obtained through this name. (if not set, use the instance name instead) - * @see #parseDragonBonesData() - * @see #getDragonBonesData() - * @see #removeDragonBonesData() - * @see dragonBones.DragonBonesData - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 将 DragonBonesData 实例缓存到工厂中。 - * @param data - DragonBonesData 实例。 - * @param name - 为该实例指定一个缓存名称,以便可以通过此名称获取该实例。 (如果未设置,则使用该实例中的名称) - * @see #parseDragonBonesData() - * @see #getDragonBonesData() - * @see #removeDragonBonesData() - * @see dragonBones.DragonBonesData - * @version DragonBones 3.0 - * @language zh_CN - */ - BaseFactory.prototype.addDragonBonesData = function(data, name) { - if (name === void 0) { - name = null; - } - name = name !== null ? name : data.name; - if (name in this._dragonBonesDataMap) { - if (this._dragonBonesDataMap[name] === data) { - return; - } - console.warn('Can not add same name data: ' + name); - return; - } - this._dragonBonesDataMap[name] = data; - }; - /** - * - Remove a DragonBonesData instance. - * @param name - The DragonBonesData instance cache name. - * @param disposeData - Whether to dispose data. (Default: true) - * @see #parseDragonBonesData() - * @see #getDragonBonesData() - * @see #addDragonBonesData() - * @see dragonBones.DragonBonesData - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 移除 DragonBonesData 实例。 - * @param name - DragonBonesData 实例缓存名称。 - * @param disposeData - 是否释放数据。 (默认: true) - * @see #parseDragonBonesData() - * @see #getDragonBonesData() - * @see #addDragonBonesData() - * @see dragonBones.DragonBonesData - * @version DragonBones 3.0 - * @language zh_CN - */ - BaseFactory.prototype.removeDragonBonesData = function(name, disposeData) { - if (disposeData === void 0) { - disposeData = true; - } - if (name in this._dragonBonesDataMap) { - if (disposeData) { - this._dragonBones.bufferObject(this._dragonBonesDataMap[name]); - } - delete this._dragonBonesDataMap[name]; - } - }; - /** - * - Get a list of specific TextureAtlasData instances. - * @param name - The TextureAtlasData cahce name. - * @see #parseTextureAtlasData() - * @see #addTextureAtlasData() - * @see #removeTextureAtlasData() - * @see dragonBones.TextureAtlasData - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 获取特定的 TextureAtlasData 实例列表。 - * @param name - TextureAtlasData 实例缓存名称。 - * @see #parseTextureAtlasData() - * @see #addTextureAtlasData() - * @see #removeTextureAtlasData() - * @see dragonBones.TextureAtlasData - * @version DragonBones 3.0 - * @language zh_CN - */ - BaseFactory.prototype.getTextureAtlasData = function(name) { - return name in this._textureAtlasDataMap - ? this._textureAtlasDataMap[name] - : null; - }; - /** - * - Cache a TextureAtlasData instance to the factory. - * @param data - The TextureAtlasData instance. - * @param name - Specify a cache name for the instance so that the instance can be obtained through this name. (if not set, use the instance name instead) - * @see #parseTextureAtlasData() - * @see #getTextureAtlasData() - * @see #removeTextureAtlasData() - * @see dragonBones.TextureAtlasData - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 将 TextureAtlasData 实例缓存到工厂中。 - * @param data - TextureAtlasData 实例。 - * @param name - 为该实例指定一个缓存名称,以便可以通过此名称获取该实例。 (如果未设置,则使用该实例中的名称) - * @see #parseTextureAtlasData() - * @see #getTextureAtlasData() - * @see #removeTextureAtlasData() - * @see dragonBones.TextureAtlasData - * @version DragonBones 3.0 - * @language zh_CN - */ - BaseFactory.prototype.addTextureAtlasData = function(data, name) { - if (name === void 0) { - name = null; - } - name = name !== null ? name : data.name; - var textureAtlasList = - name in this._textureAtlasDataMap - ? this._textureAtlasDataMap[name] - : (this._textureAtlasDataMap[name] = []); - if (textureAtlasList.indexOf(data) < 0) { - textureAtlasList.push(data); - } - }; - /** - * - Remove a TextureAtlasData instance. - * @param name - The TextureAtlasData instance cache name. - * @param disposeData - Whether to dispose data. - * @see #parseTextureAtlasData() - * @see #getTextureAtlasData() - * @see #addTextureAtlasData() - * @see dragonBones.TextureAtlasData - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 移除 TextureAtlasData 实例。 - * @param name - TextureAtlasData 实例的缓存名称。 - * @param disposeData - 是否释放数据。 - * @see #parseTextureAtlasData() - * @see #getTextureAtlasData() - * @see #addTextureAtlasData() - * @see dragonBones.TextureAtlasData - * @version DragonBones 3.0 - * @language zh_CN - */ - BaseFactory.prototype.removeTextureAtlasData = function(name, disposeData) { - if (disposeData === void 0) { - disposeData = true; - } - if (name in this._textureAtlasDataMap) { - var textureAtlasDataList = this._textureAtlasDataMap[name]; - if (disposeData) { - for ( - var _i = 0, textureAtlasDataList_1 = textureAtlasDataList; - _i < textureAtlasDataList_1.length; - _i++ - ) { - var textureAtlasData = textureAtlasDataList_1[_i]; - this._dragonBones.bufferObject(textureAtlasData); - } - } - delete this._textureAtlasDataMap[name]; - } - }; - /** - * - Get a specific armature data. - * @param name - The armature data name. - * @param dragonBonesName - The cached name for DragonbonesData instance. - * @see dragonBones.ArmatureData - * @version DragonBones 5.1 - * @language en_US - */ - /** - * - 获取特定的骨架数据。 - * @param name - 骨架数据名称。 - * @param dragonBonesName - DragonBonesData 实例的缓存名称。 - * @see dragonBones.ArmatureData - * @version DragonBones 5.1 - * @language zh_CN - */ - BaseFactory.prototype.getArmatureData = function(name, dragonBonesName) { - if (dragonBonesName === void 0) { - dragonBonesName = ''; - } - var dataPackage = new BuildArmaturePackage(); - if ( - !this._fillBuildArmaturePackage( - dataPackage, - dragonBonesName, - name, - '', - '', - ) - ) { - return null; - } - return dataPackage.armature; - }; - /** - * - Clear all cached DragonBonesData instances and TextureAtlasData instances. - * @param disposeData - Whether to dispose data. - * @version DragonBones 4.5 - * @language en_US - */ - /** - * - 清除缓存的所有 DragonBonesData 实例和 TextureAtlasData 实例。 - * @param disposeData - 是否释放数据。 - * @version DragonBones 4.5 - * @language zh_CN - */ - BaseFactory.prototype.clear = function(disposeData) { - if (disposeData === void 0) { - disposeData = true; - } - for (var k in this._dragonBonesDataMap) { - if (disposeData) { - this._dragonBones.bufferObject(this._dragonBonesDataMap[k]); - } - delete this._dragonBonesDataMap[k]; - } - for (var k in this._textureAtlasDataMap) { - if (disposeData) { - var textureAtlasDataList = this._textureAtlasDataMap[k]; - for ( - var _i = 0, textureAtlasDataList_2 = textureAtlasDataList; - _i < textureAtlasDataList_2.length; - _i++ - ) { - var textureAtlasData = textureAtlasDataList_2[_i]; - this._dragonBones.bufferObject(textureAtlasData); - } - } - delete this._textureAtlasDataMap[k]; - } - }; - /** - * - Create a armature from cached DragonBonesData instances and TextureAtlasData instances. - * Note that when the created armature that is no longer in use, you need to explicitly dispose {@link #dragonBones.Armature#dispose()}. - * @param armatureName - The armature data name. - * @param dragonBonesName - The cached name of the DragonBonesData instance. (If not set, all DragonBonesData instances are retrieved, and when multiple DragonBonesData instances contain a the same name armature data, it may not be possible to accurately create a specific armature) - * @param skinName - The skin name, you can set a different ArmatureData name to share it's skin data. (If not set, use the default skin data) - * @returns The armature. - * @example - *
-         *     let armature = factory.buildArmature("armatureName", "dragonBonesName");
-         *     armature.clock = factory.clock;
-         * 
- * @see dragonBones.DragonBonesData - * @see dragonBones.ArmatureData - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 通过缓存的 DragonBonesData 实例和 TextureAtlasData 实例创建一个骨架。 - * 注意,创建的骨架不再使用时,需要显式释放 {@link #dragonBones.Armature#dispose()}。 - * @param armatureName - 骨架数据名称。 - * @param dragonBonesName - DragonBonesData 实例的缓存名称。 (如果未设置,将检索所有的 DragonBonesData 实例,当多个 DragonBonesData 实例中包含同名的骨架数据时,可能无法准确的创建出特定的骨架) - * @param skinName - 皮肤名称,可以设置一个其他骨架数据名称来共享其皮肤数据。(如果未设置,则使用默认的皮肤数据) - * @returns 骨架。 - * @example - *
-         *     let armature = factory.buildArmature("armatureName", "dragonBonesName");
-         *     armature.clock = factory.clock;
-         * 
- * @see dragonBones.DragonBonesData - * @see dragonBones.ArmatureData - * @version DragonBones 3.0 - * @language zh_CN - */ - BaseFactory.prototype.buildArmature = function( - armatureName, - dragonBonesName, - skinName, - textureAtlasName, - ) { - if (dragonBonesName === void 0) { - dragonBonesName = ''; - } - if (skinName === void 0) { - skinName = ''; - } - if (textureAtlasName === void 0) { - textureAtlasName = ''; - } - var dataPackage = new BuildArmaturePackage(); - if ( - !this._fillBuildArmaturePackage( - dataPackage, - dragonBonesName || '', - armatureName, - skinName || '', - textureAtlasName || '', - ) - ) { - console.warn( - 'No armature data: ' + - armatureName + - ', ' + - (dragonBonesName !== null ? dragonBonesName : ''), - ); - return null; - } - var armature = this._buildArmature(dataPackage); - this._buildBones(dataPackage, armature); - this._buildSlots(dataPackage, armature); - this._buildConstraints(dataPackage, armature); - armature.invalidUpdate(null, true); - armature.advanceTime(0.0); // Update armature pose. - return armature; - }; - /** - * @private - */ - BaseFactory.prototype.replaceDisplay = function( - slot, - displayData, - displayIndex, - ) { - if (displayIndex === void 0) { - displayIndex = -1; - } - if (displayIndex < 0) { - displayIndex = slot.displayIndex; - } - if (displayIndex < 0) { - displayIndex = 0; - } - slot.replaceDisplayData(displayData, displayIndex); - if (displayData !== null) { - var display = this._getSlotDisplay(null, displayData, slot); - if (displayData.type === 0 /* Image */) { - var rawDisplayData = slot.getDisplayFrameAt(displayIndex) - .rawDisplayData; - if (rawDisplayData !== null && rawDisplayData.type === 2 /* Mesh */) { - display = slot.meshDisplay; - } - } - slot.replaceDisplay(display, displayIndex); - } else { - slot.replaceDisplay(null, displayIndex); - } - }; - /** - * - Replaces the current display data for a particular slot with a specific display data. - * Specify display data with "dragonBonesName/armatureName/slotName/displayName". - * @param dragonBonesName - The DragonBonesData instance cache name. - * @param armatureName - The armature data name. - * @param slotName - The slot data name. - * @param displayName - The display data name. - * @param slot - The slot. - * @param displayIndex - The index of the display data that is replaced. (If it is not set, replaces the current display data) - * @example - *
-         *     let slot = armature.getSlot("weapon");
-         *     factory.replaceSlotDisplay("dragonBonesName", "armatureName", "slotName", "displayName", slot);
-         * 
- * @version DragonBones 4.5 - * @language en_US - */ - /** - * - 用特定的显示对象数据替换特定插槽当前的显示对象数据。 - * 用 "dragonBonesName/armatureName/slotName/displayName" 指定显示对象数据。 - * @param dragonBonesName - DragonBonesData 实例的缓存名称。 - * @param armatureName - 骨架数据名称。 - * @param slotName - 插槽数据名称。 - * @param displayName - 显示对象数据名称。 - * @param slot - 插槽。 - * @param displayIndex - 被替换的显示对象数据的索引。 (如果未设置,则替换当前的显示对象数据) - * @example - *
-         *     let slot = armature.getSlot("weapon");
-         *     factory.replaceSlotDisplay("dragonBonesName", "armatureName", "slotName", "displayName", slot);
-         * 
- * @version DragonBones 4.5 - * @language zh_CN - */ - BaseFactory.prototype.replaceSlotDisplay = function( - dragonBonesName, - armatureName, - slotName, - displayName, - slot, - displayIndex, - ) { - if (displayIndex === void 0) { - displayIndex = -1; - } - var armatureData = this.getArmatureData( - armatureName, - dragonBonesName || '', - ); - if (armatureData === null || armatureData.defaultSkin === null) { - return false; - } - var displayData = armatureData.defaultSkin.getDisplay( - slotName, - displayName, - ); - this.replaceDisplay(slot, displayData, displayIndex); - return true; - }; - /** - * @private - */ - BaseFactory.prototype.replaceSlotDisplayList = function( - dragonBonesName, - armatureName, - slotName, - slot, - ) { - var armatureData = this.getArmatureData( - armatureName, - dragonBonesName || '', - ); - if (!armatureData || !armatureData.defaultSkin) { - return false; - } - var displayDatas = armatureData.defaultSkin.getDisplays(slotName); - if (!displayDatas) { - return false; - } - slot.displayFrameCount = displayDatas.length; - for (var i = 0, l = slot.displayFrameCount; i < l; ++i) { - var displayData = displayDatas[i]; - this.replaceDisplay(slot, displayData, i); - } - return true; - }; - /** - * - Share specific skin data with specific armature. - * @param armature - The armature. - * @param skin - The skin data. - * @param isOverride - Whether it completely override the original skin. (Default: false) - * @param exclude - A list of slot names that do not need to be replace. - * @example - *
-         *     let armatureA = factory.buildArmature("armatureA", "dragonBonesA");
-         *     let armatureDataB = factory.getArmatureData("armatureB", "dragonBonesB");
-         *     if (armatureDataB && armatureDataB.defaultSkin) {
-         *     factory.replaceSkin(armatureA, armatureDataB.defaultSkin, false, ["arm_l", "weapon_l"]);
-         *     }
-         * 
- * @see dragonBones.Armature - * @see dragonBones.SkinData - * @version DragonBones 5.6 - * @language en_US - */ - /** - * - 将特定的皮肤数据共享给特定的骨架使用。 - * @param armature - 骨架。 - * @param skin - 皮肤数据。 - * @param isOverride - 是否完全覆盖原来的皮肤。 (默认: false) - * @param exclude - 不需要被替换的插槽名称列表。 - * @example - *
-         *     let armatureA = factory.buildArmature("armatureA", "dragonBonesA");
-         *     let armatureDataB = factory.getArmatureData("armatureB", "dragonBonesB");
-         *     if (armatureDataB && armatureDataB.defaultSkin) {
-         *     factory.replaceSkin(armatureA, armatureDataB.defaultSkin, false, ["arm_l", "weapon_l"]);
-         *     }
-         * 
- * @see dragonBones.Armature - * @see dragonBones.SkinData - * @version DragonBones 5.6 - * @language zh_CN - */ - BaseFactory.prototype.replaceSkin = function( - armature, - skin, - isOverride, - exclude, - ) { - if (isOverride === void 0) { - isOverride = false; - } - if (exclude === void 0) { - exclude = null; - } - var success = false; - var defaultSkin = skin.parent.defaultSkin; - for (var _i = 0, _a = armature.getSlots(); _i < _a.length; _i++) { - var slot = _a[_i]; - if (exclude !== null && exclude.indexOf(slot.name) >= 0) { - continue; - } - var displayDatas = skin.getDisplays(slot.name); - if (displayDatas === null) { - if (defaultSkin !== null && skin !== defaultSkin) { - displayDatas = defaultSkin.getDisplays(slot.name); - } - if (displayDatas === null) { - if (isOverride) { - slot.displayFrameCount = 0; - } - continue; - } - } - slot.displayFrameCount = displayDatas.length; - for (var i = 0, l = slot.displayFrameCount; i < l; ++i) { - var displayData = displayDatas[i]; - slot.replaceRawDisplayData(displayData, i); - if (displayData !== null) { - slot.replaceDisplay( - this._getSlotDisplay(null, displayData, slot), - i, - ); - } else { - slot.replaceDisplay(null, i); - } - } - success = true; - } - return success; - }; - /** - * - Replaces the existing animation data for a specific armature with the animation data for the specific armature data. - * This enables you to make a armature template so that other armature without animations can share it's animations. - * @param armature - The armtaure. - * @param armatureData - The armature data. - * @param isOverride - Whether to completely overwrite the original animation. (Default: false) - * @example - *
-         *     let armatureA = factory.buildArmature("armatureA", "dragonBonesA");
-         *     let armatureDataB = factory.getArmatureData("armatureB", "dragonBonesB");
-         *     if (armatureDataB) {
-         *     factory.replaceAnimation(armatureA, armatureDataB);
-         *     }
-         * 
- * @see dragonBones.Armature - * @see dragonBones.ArmatureData - * @version DragonBones 5.6 - * @language en_US - */ - /** - * - 用特定骨架数据的动画数据替换特定骨架现有的动画数据。 - * 这样就能实现制作一个骨架动画模板,让其他没有制作动画的骨架共享该动画。 - * @param armature - 骨架。 - * @param armatureData - 骨架数据。 - * @param isOverride - 是否完全覆盖原来的动画。(默认: false) - * @example - *
-         *     let armatureA = factory.buildArmature("armatureA", "dragonBonesA");
-         *     let armatureDataB = factory.getArmatureData("armatureB", "dragonBonesB");
-         *     if (armatureDataB) {
-         *     factory.replaceAnimation(armatureA, armatureDataB);
-         *     }
-         * 
- * @see dragonBones.Armature - * @see dragonBones.ArmatureData - * @version DragonBones 5.6 - * @language zh_CN - */ - BaseFactory.prototype.replaceAnimation = function( - armature, - armatureData, - isOverride, - ) { - if (isOverride === void 0) { - isOverride = true; - } - var skinData = armatureData.defaultSkin; - if (skinData === null) { - return false; - } - if (isOverride) { - armature.animation.animations = armatureData.animations; - } else { - var rawAnimations = armature.animation.animations; - var animations = {}; - for (var k in rawAnimations) { - animations[k] = rawAnimations[k]; - } - for (var k in armatureData.animations) { - animations[k] = armatureData.animations[k]; - } - armature.animation.animations = animations; - } - for (var _i = 0, _a = armature.getSlots(); _i < _a.length; _i++) { - var slot = _a[_i]; - var index = 0; - for (var _b = 0, _c = slot.displayList; _b < _c.length; _b++) { - var display = _c[_b]; - if (display instanceof dragonBones.Armature) { - var displayDatas = skinData.getDisplays(slot.name); - if (displayDatas !== null && index < displayDatas.length) { - var displayData = displayDatas[index]; - if ( - displayData !== null && - displayData.type === 1 /* Armature */ - ) { - var childArmatureData = this.getArmatureData( - displayData.path, - displayData.parent.parent.parent.name, - ); - if (childArmatureData) { - this.replaceAnimation(display, childArmatureData, isOverride); - } - } - } - } - index++; - } - } - return true; - }; - /** - * @private - */ - BaseFactory.prototype.getAllDragonBonesData = function() { - return this._dragonBonesDataMap; - }; - /** - * @private - */ - BaseFactory.prototype.getAllTextureAtlasData = function() { - return this._textureAtlasDataMap; - }; - Object.defineProperty(BaseFactory.prototype, 'clock', { - /** - * - An Worldclock instance updated by engine. - * @version DragonBones 5.7 - * @language en_US - */ - /** - * - 由引擎驱动的 WorldClock 实例。 - * @version DragonBones 5.7 - * @language zh_CN - */ - get: function() { - return this._dragonBones.clock; - }, - enumerable: true, - configurable: true, - }); - Object.defineProperty(BaseFactory.prototype, 'dragonBones', { - /** - * @private - */ - get: function() { - return this._dragonBones; - }, - enumerable: true, - configurable: true, - }); - BaseFactory._objectParser = null; - BaseFactory._binaryParser = null; - return BaseFactory; - })(); - dragonBones.BaseFactory = BaseFactory; - /** - * @private - */ - var BuildArmaturePackage = /** @class */ (function() { - function BuildArmaturePackage() { - this.dataName = ''; - this.textureAtlasName = ''; - this.skin = null; - } - return BuildArmaturePackage; - })(); - dragonBones.BuildArmaturePackage = BuildArmaturePackage; - })(dragonBones || (dragonBones = {})); - /** - * The MIT License (MIT) - * - * Copyright (c) 2012-2018 DragonBones team and other contributors - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of - * the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR - * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - (function(dragonBones) { - /** - * - The PixiJS texture atlas data. - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - PixiJS 贴图集数据。 - * @version DragonBones 3.0 - * @language zh_CN - */ - var PixiTextureAtlasData = /** @class */ (function(_super) { - __extends(PixiTextureAtlasData, _super); - function PixiTextureAtlasData() { - var _this = (_super !== null && _super.apply(this, arguments)) || this; - _this._renderTexture = null; // Initial value. - return _this; - } - PixiTextureAtlasData.toString = function() { - return '[class dragonBones.PixiTextureAtlasData]'; - }; - PixiTextureAtlasData.prototype._onClear = function() { - _super.prototype._onClear.call(this); - if (this._renderTexture !== null) ; - this._renderTexture = null; - }; - /** - * @inheritDoc - */ - PixiTextureAtlasData.prototype.createTexture = function() { - return dragonBones.BaseObject.borrowObject(PixiTextureData); - }; - Object.defineProperty(PixiTextureAtlasData.prototype, 'renderTexture', { - /** - * - The PixiJS texture. - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - PixiJS 贴图。 - * @version DragonBones 3.0 - * @language zh_CN - */ - get: function() { - return this._renderTexture; - }, - set: function(value) { - if (this._renderTexture === value) { - return; - } - this._renderTexture = value; - if (this._renderTexture !== null) { - for (var k in this.textures) { - var textureData = this.textures[k]; - textureData.renderTexture = new PIXI.Texture( - this._renderTexture, - new PIXI.Rectangle( - textureData.region.x, - textureData.region.y, - textureData.region.width, - textureData.region.height, - ), - new PIXI.Rectangle( - textureData.region.x, - textureData.region.y, - textureData.region.width, - textureData.region.height, - ), - new PIXI.Rectangle( - 0, - 0, - textureData.region.width, - textureData.region.height, - ), - textureData.rotated, // .d.ts bug - ); - } - } else { - for (var k in this.textures) { - var textureData = this.textures[k]; - textureData.renderTexture = null; - } - } - }, - enumerable: true, - configurable: true, - }); - return PixiTextureAtlasData; - })(dragonBones.TextureAtlasData); - dragonBones.PixiTextureAtlasData = PixiTextureAtlasData; - /** - * @internal - */ - var PixiTextureData = /** @class */ (function(_super) { - __extends(PixiTextureData, _super); - function PixiTextureData() { - var _this = (_super !== null && _super.apply(this, arguments)) || this; - _this.renderTexture = null; // Initial value. - return _this; - } - PixiTextureData.toString = function() { - return '[class dragonBones.PixiTextureData]'; - }; - PixiTextureData.prototype._onClear = function() { - _super.prototype._onClear.call(this); - if (this.renderTexture !== null) { - this.renderTexture.destroy(false); - } - this.renderTexture = null; - }; - return PixiTextureData; - })(dragonBones.TextureData); - dragonBones.PixiTextureData = PixiTextureData; - })(dragonBones || (dragonBones = {})); - /** - * The MIT License (MIT) - * - * Copyright (c) 2012-2018 DragonBones team and other contributors - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of - * the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR - * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - (function(dragonBones) { - /** - * @inheritDoc - */ - var PixiArmatureDisplay = /** @class */ (function(_super) { - __extends(PixiArmatureDisplay, _super); - function PixiArmatureDisplay() { - var _this = (_super !== null && _super.apply(this, arguments)) || this; - /** - * @private - */ - _this.debugDraw = false; - _this._debugDraw = false; - // private _disposeProxy: boolean = false; - _this._armature = null; - _this._debugDrawer = null; - return _this; - } - /** - * @inheritDoc - */ - PixiArmatureDisplay.prototype.dbInit = function(armature) { - this._armature = armature; - }; - /** - * @inheritDoc - */ - PixiArmatureDisplay.prototype.dbClear = function() { - if (this._debugDrawer !== null) { - this._debugDrawer.destroy(true); - } - this._armature = null; - this._debugDrawer = null; - _super.prototype.destroy.call(this); - }; - /** - * @inheritDoc - */ - PixiArmatureDisplay.prototype.dbUpdate = function() { - var drawed = dragonBones.DragonBones.debugDraw || this.debugDraw; - if (drawed || this._debugDraw) { - this._debugDraw = drawed; - if (this._debugDraw) { - if (this._debugDrawer === null) { - this._debugDrawer = new PIXI.Sprite(); - var boneDrawer_1 = new PIXI.Graphics(); - this._debugDrawer.addChild(boneDrawer_1); - } - this.addChild(this._debugDrawer); - var boneDrawer = this._debugDrawer.getChildAt(0); - boneDrawer.clear(); - var bones = this._armature.getBones(); - for (var i = 0, l = bones.length; i < l; ++i) { - var bone = bones[i]; - var boneLength = bone.boneData.length; - var startX = bone.globalTransformMatrix.tx; - var startY = bone.globalTransformMatrix.ty; - var endX = startX + bone.globalTransformMatrix.a * boneLength; - var endY = startY + bone.globalTransformMatrix.b * boneLength; - boneDrawer.lineStyle(2.0, 0x00ffff, 0.7); - boneDrawer.moveTo(startX, startY); - boneDrawer.lineTo(endX, endY); - boneDrawer.lineStyle(0.0, 0, 0.0); - boneDrawer.beginFill(0x00ffff, 0.7); - boneDrawer.drawCircle(startX, startY, 3.0); - boneDrawer.endFill(); - } - var slots = this._armature.getSlots(); - for (var i = 0, l = slots.length; i < l; ++i) { - var slot = slots[i]; - var boundingBoxData = slot.boundingBoxData; - if (boundingBoxData) { - var child = this._debugDrawer.getChildByName(slot.name); - if (!child) { - child = new PIXI.Graphics(); - child.name = slot.name; - this._debugDrawer.addChild(child); - } - child.clear(); - child.lineStyle(2.0, 0xff00ff, 0.7); - switch (boundingBoxData.type) { - case 0 /* Rectangle */: - child.drawRect( - -boundingBoxData.width * 0.5, - -boundingBoxData.height * 0.5, - boundingBoxData.width, - boundingBoxData.height, - ); - break; - case 1 /* Ellipse */: - child.drawEllipse( - -boundingBoxData.width * 0.5, - -boundingBoxData.height * 0.5, - boundingBoxData.width, - boundingBoxData.height, - ); - break; - case 2 /* Polygon */: - var vertices = boundingBoxData.vertices; - for ( - var i_4 = 0, l_1 = vertices.length; - i_4 < l_1; - i_4 += 2 - ) { - var x = vertices[i_4]; - var y = vertices[i_4 + 1]; - if (i_4 === 0) { - child.moveTo(x, y); - } else { - child.lineTo(x, y); - } - } - child.lineTo(vertices[0], vertices[1]); - break; - } - child.endFill(); - slot.updateTransformAndMatrix(); - slot.updateGlobalTransform(); - var transform = slot.global; - child.setTransform( - transform.x, - transform.y, - transform.scaleX, - transform.scaleY, - transform.rotation, - transform.skew, - 0.0, - slot._pivotX, - slot._pivotY, - ); - } else { - var child = this._debugDrawer.getChildByName(slot.name); - if (child) { - this._debugDrawer.removeChild(child); - } - } - } - } else if ( - this._debugDrawer !== null && - this._debugDrawer.parent === this - ) { - this.removeChild(this._debugDrawer); - } - } - }; - /** - * @inheritDoc - */ - PixiArmatureDisplay.prototype.dispose = function(disposeProxy) { - if (this._armature !== null) { - this._armature.dispose(); - this._armature = null; - } - }; - /** - * @inheritDoc - */ - PixiArmatureDisplay.prototype.destroy = function() { - this.dispose(); - }; - /** - * @private - */ - PixiArmatureDisplay.prototype.dispatchDBEvent = function( - type, - eventObject, - ) { - this.emit(type, eventObject); - }; - /** - * @inheritDoc - */ - PixiArmatureDisplay.prototype.hasDBEventListener = function(type) { - return this.listeners(type, true); // .d.ts bug - }; - /** - * @inheritDoc - */ - PixiArmatureDisplay.prototype.addDBEventListener = function( - type, - listener, - target, - ) { - this.addListener(type, listener, target); - }; - /** - * @inheritDoc - */ - PixiArmatureDisplay.prototype.removeDBEventListener = function( - type, - listener, - target, - ) { - this.removeListener(type, listener, target); - }; - Object.defineProperty(PixiArmatureDisplay.prototype, 'armature', { - /** - * @inheritDoc - */ - get: function() { - return this._armature; - }, - enumerable: true, - configurable: true, - }); - Object.defineProperty(PixiArmatureDisplay.prototype, 'animation', { - /** - * @inheritDoc - */ - get: function() { - return this._armature.animation; - }, - enumerable: true, - configurable: true, - }); - return PixiArmatureDisplay; - })(PIXI.Sprite); - dragonBones.PixiArmatureDisplay = PixiArmatureDisplay; - })(dragonBones || (dragonBones = {})); - /** - * The MIT License (MIT) - * - * Copyright (c) 2012-2018 DragonBones team and other contributors - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of - * the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR - * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - (function(dragonBones) { - /** - * - The PixiJS slot. - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - PixiJS 插槽。 - * @version DragonBones 3.0 - * @language zh_CN - */ - var PixiSlot = /** @class */ (function(_super) { - __extends(PixiSlot, _super); - function PixiSlot() { - return (_super !== null && _super.apply(this, arguments)) || this; - } - PixiSlot.toString = function() { - return '[class dragonBones.PixiSlot]'; - }; - PixiSlot.prototype._onClear = function() { - _super.prototype._onClear.call(this); - this._textureScale = 1.0; - this._renderDisplay = null; - this._updateTransform = this._updateTransformV4; - }; - PixiSlot.prototype._initDisplay = function(value, isRetain) { - }; - PixiSlot.prototype._disposeDisplay = function(value, isRelease) { - if (!isRelease) { - value.destroy(); - } - }; - PixiSlot.prototype._onUpdateDisplay = function() { - this._renderDisplay = this._display ? this._display : this._rawDisplay; - }; - PixiSlot.prototype._addDisplay = function() { - var container = this._armature.display; - container.addChild(this._renderDisplay); - }; - PixiSlot.prototype._replaceDisplay = function(value) { - var container = this._armature.display; - var prevDisplay = value; - container.addChild(this._renderDisplay); - container.swapChildren(this._renderDisplay, prevDisplay); - container.removeChild(prevDisplay); - this._textureScale = 1.0; - }; - PixiSlot.prototype._removeDisplay = function() { - this._renderDisplay.parent.removeChild(this._renderDisplay); - }; - PixiSlot.prototype._updateZOrder = function() { - var container = this._armature.display; - var index = container.getChildIndex(this._renderDisplay); - if (index === this._zOrder) { - return; - } - container.addChildAt(this._renderDisplay, this._zOrder); - }; - /** - * @internal - */ - PixiSlot.prototype._updateVisible = function() { - this._renderDisplay.visible = this._parent.visible && this._visible; - }; - PixiSlot.prototype._updateBlendMode = function() { - if (this._renderDisplay instanceof PIXI.Sprite) { - switch (this._blendMode) { - case 0 /* Normal */: - this._renderDisplay.blendMode = PIXI.BLEND_MODES.NORMAL; - break; - case 1 /* Add */: - this._renderDisplay.blendMode = PIXI.BLEND_MODES.ADD; - break; - case 3 /* Darken */: - this._renderDisplay.blendMode = PIXI.BLEND_MODES.DARKEN; - break; - case 4 /* Difference */: - this._renderDisplay.blendMode = PIXI.BLEND_MODES.DIFFERENCE; - break; - case 6 /* HardLight */: - this._renderDisplay.blendMode = PIXI.BLEND_MODES.HARD_LIGHT; - break; - case 9 /* Lighten */: - this._renderDisplay.blendMode = PIXI.BLEND_MODES.LIGHTEN; - break; - case 10 /* Multiply */: - this._renderDisplay.blendMode = PIXI.BLEND_MODES.MULTIPLY; - break; - case 11 /* Overlay */: - this._renderDisplay.blendMode = PIXI.BLEND_MODES.OVERLAY; - break; - case 12 /* Screen */: - this._renderDisplay.blendMode = PIXI.BLEND_MODES.SCREEN; - break; - } - } - // TODO child armature. - }; - PixiSlot.prototype._updateColor = function() { - var alpha = this._colorTransform.alphaMultiplier * this._globalAlpha; - this._renderDisplay.alpha = alpha; - if ( - this._renderDisplay instanceof PIXI.Sprite || - this._renderDisplay instanceof PIXI.mesh.Mesh - ) { - var color = - (Math.round(this._colorTransform.redMultiplier * 0xff) << 16) + - (Math.round(this._colorTransform.greenMultiplier * 0xff) << 8) + - Math.round(this._colorTransform.blueMultiplier * 0xff); - this._renderDisplay.tint = color; - } - // TODO child armature. - }; - PixiSlot.prototype._updateFrame = function() { - var currentTextureData = this._textureData; - if ( - this._displayIndex >= 0 && - this._display !== null && - currentTextureData !== null - ) { - var currentTextureAtlasData = currentTextureData.parent; - if (this._armature.replacedTexture !== null) { - if (this._armature._replaceTextureAtlasData === null) { - currentTextureAtlasData = dragonBones.BaseObject.borrowObject( - dragonBones.PixiTextureAtlasData, - ); - currentTextureAtlasData.copyFrom(currentTextureData.parent); - currentTextureAtlasData.renderTexture = this._armature.replacedTexture; - this._armature._replaceTextureAtlasData = currentTextureAtlasData; - } else { - currentTextureAtlasData = this._armature._replaceTextureAtlasData; - } - currentTextureData = currentTextureAtlasData.getTexture( - currentTextureData.name, - ); - } - var renderTexture = currentTextureData.renderTexture; - if (renderTexture !== null) { - if (this._geometryData !== null) { - var data = this._geometryData.data; - var intArray = data.intArray; - var floatArray = data.floatArray; - var vertexCount = - intArray[this._geometryData.offset + 0 /* GeometryVertexCount */]; - var triangleCount = - intArray[ - this._geometryData.offset + 1 /* GeometryTriangleCount */ - ]; - var vertexOffset = - intArray[this._geometryData.offset + 2 /* GeometryFloatOffset */]; - if (vertexOffset < 0) { - vertexOffset += 65536; // Fixed out of bouds bug. - } - var uvOffset = vertexOffset + vertexCount * 2; - var scale = this._armature._armatureData.scale; - var meshDisplay = this._renderDisplay; - var textureAtlasWidth = - currentTextureAtlasData.width > 0.0 - ? currentTextureAtlasData.width - : renderTexture.baseTexture.width; - var textureAtlasHeight = - currentTextureAtlasData.height > 0.0 - ? currentTextureAtlasData.height - : renderTexture.baseTexture.height; - var region = currentTextureData.region; - meshDisplay.vertices = new Float32Array(vertexCount * 2); - meshDisplay.uvs = new Float32Array(vertexCount * 2); - meshDisplay.indices = new Uint16Array(triangleCount * 3); - for (var i = 0, l = vertexCount * 2; i < l; ++i) { - meshDisplay.vertices[i] = floatArray[vertexOffset + i] * scale; - } - for (var i = 0; i < triangleCount * 3; ++i) { - meshDisplay.indices[i] = - intArray[ - this._geometryData.offset + 4 /* GeometryVertexIndices */ + i - ]; - } - for (var i = 0, l = vertexCount * 2; i < l; i += 2) { - var u = floatArray[uvOffset + i]; - var v = floatArray[uvOffset + i + 1]; - if (currentTextureData.rotated) { - meshDisplay.uvs[i] = - (region.x + (1.0 - v) * region.width) / textureAtlasWidth; - meshDisplay.uvs[i + 1] = - (region.y + u * region.height) / textureAtlasHeight; - } else { - meshDisplay.uvs[i] = - (region.x + u * region.width) / textureAtlasWidth; - meshDisplay.uvs[i + 1] = - (region.y + v * region.height) / textureAtlasHeight; - } - } - this._textureScale = 1.0; - meshDisplay.texture = renderTexture; - meshDisplay.dirty++; - meshDisplay.indexDirty++; - var isSkinned = this._geometryData.weight !== null; - var isSurface = this._parent._boneData.type !== 0; /* Bone */ - if (isSkinned || isSurface) { - this._identityTransform(); - } - } else { - this._textureScale = - currentTextureData.parent.scale * - this._armature._armatureData.scale; - var normalDisplay = this._renderDisplay; - normalDisplay.texture = renderTexture; - } - this._visibleDirty = true; - return; - } - } - if (this._geometryData !== null) { - var meshDisplay = this._renderDisplay; - meshDisplay.texture = null; - meshDisplay.x = 0.0; - meshDisplay.y = 0.0; - meshDisplay.visible = false; - } else { - var normalDisplay = this._renderDisplay; - normalDisplay.texture = null; - normalDisplay.x = 0.0; - normalDisplay.y = 0.0; - normalDisplay.visible = false; - } - }; - PixiSlot.prototype._updateMesh = function() { - var scale = this._armature._armatureData.scale; - var deformVertices = this._displayFrame.deformVertices; - var bones = this._geometryBones; - var geometryData = this._geometryData; - var weightData = geometryData.weight; - var hasDeform = deformVertices.length > 0 && geometryData.inheritDeform; - var meshDisplay = this._renderDisplay; - if (weightData !== null) { - var data = geometryData.data; - var intArray = data.intArray; - var floatArray = data.floatArray; - var vertexCount = - intArray[geometryData.offset + 0 /* GeometryVertexCount */]; - var weightFloatOffset = - intArray[weightData.offset + 1 /* WeigthFloatOffset */]; - if (weightFloatOffset < 0) { - weightFloatOffset += 65536; // Fixed out of bouds bug. - } - for ( - var i = 0, - iD = 0, - iB = weightData.offset + 2 /* WeigthBoneIndices */ + bones.length, - iV = weightFloatOffset, - iF = 0; - i < vertexCount; - ++i - ) { - var boneCount = intArray[iB++]; - var xG = 0.0, - yG = 0.0; - for (var j = 0; j < boneCount; ++j) { - var boneIndex = intArray[iB++]; - var bone = bones[boneIndex]; - if (bone !== null) { - var matrix = bone.globalTransformMatrix; - var weight = floatArray[iV++]; - var xL = floatArray[iV++] * scale; - var yL = floatArray[iV++] * scale; - if (hasDeform) { - xL += deformVertices[iF++]; - yL += deformVertices[iF++]; - } - xG += (matrix.a * xL + matrix.c * yL + matrix.tx) * weight; - yG += (matrix.b * xL + matrix.d * yL + matrix.ty) * weight; - } - } - meshDisplay.vertices[iD++] = xG; - meshDisplay.vertices[iD++] = yG; - } - } else { - var isSurface = this._parent._boneData.type !== 0; /* Bone */ - var data = geometryData.data; - var intArray = data.intArray; - var floatArray = data.floatArray; - var vertexCount = - intArray[geometryData.offset + 0 /* GeometryVertexCount */]; - var vertexOffset = - intArray[geometryData.offset + 2 /* GeometryFloatOffset */]; - if (vertexOffset < 0) { - vertexOffset += 65536; // Fixed out of bouds bug. - } - for (var i = 0, l = vertexCount * 2; i < l; i += 2) { - var x = floatArray[vertexOffset + i] * scale; - var y = floatArray[vertexOffset + i + 1] * scale; - if (hasDeform) { - x += deformVertices[i]; - y += deformVertices[i + 1]; - } - if (isSurface) { - var matrix = this._parent._getGlobalTransformMatrix(x, y); - meshDisplay.vertices[i] = matrix.a * x + matrix.c * y + matrix.tx; - meshDisplay.vertices[i + 1] = - matrix.b * x + matrix.d * y + matrix.ty; - } else { - meshDisplay.vertices[i] = x; - meshDisplay.vertices[i + 1] = y; - } - } - } - }; - PixiSlot.prototype._updateTransform = function() { - throw new Error(); - }; - PixiSlot.prototype._updateTransformV3 = function() { - this.updateGlobalTransform(); // Update transform. - var transform = this.global; - if ( - this._renderDisplay === this._rawDisplay || - this._renderDisplay === this._meshDisplay - ) { - var x = - transform.x - - (this.globalTransformMatrix.a * this._pivotX + - this.globalTransformMatrix.c * this._pivotY); - var y = - transform.y - - (this.globalTransformMatrix.b * this._pivotX + - this.globalTransformMatrix.d * this._pivotY); - this._renderDisplay.setTransform( - x, - y, - transform.scaleX * this._textureScale, - transform.scaleY * this._textureScale, - transform.rotation, - transform.skew, - 0.0, - ); - } else { - this._renderDisplay.position.set(transform.x, transform.y); - this._renderDisplay.rotation = transform.rotation; - this._renderDisplay.skew.set(transform.skew, 0.0); - this._renderDisplay.scale.set(transform.scaleX, transform.scaleY); - } - }; - PixiSlot.prototype._updateTransformV4 = function() { - this.updateGlobalTransform(); // Update transform. - var transform = this.global; - if ( - this._renderDisplay === this._rawDisplay || - this._renderDisplay === this._meshDisplay - ) { - var x = - transform.x - - (this.globalTransformMatrix.a * this._pivotX + - this.globalTransformMatrix.c * this._pivotY); - var y = - transform.y - - (this.globalTransformMatrix.b * this._pivotX + - this.globalTransformMatrix.d * this._pivotY); - this._renderDisplay.setTransform( - x, - y, - transform.scaleX * this._textureScale, - transform.scaleY * this._textureScale, - transform.rotation, - -transform.skew, - 0.0, - ); - } else { - this._renderDisplay.position.set(transform.x, transform.y); - this._renderDisplay.rotation = transform.rotation; - this._renderDisplay.skew.set(-transform.skew, 0.0); - this._renderDisplay.scale.set(transform.scaleX, transform.scaleY); - } - }; - PixiSlot.prototype._identityTransform = function() { - this._renderDisplay.setTransform(0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 0.0); - }; - return PixiSlot; - })(dragonBones.Slot); - dragonBones.PixiSlot = PixiSlot; - })(dragonBones || (dragonBones = {})); - /** - * The MIT License (MIT) - * - * Copyright (c) 2012-2018 DragonBones team and other contributors - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of - * the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR - * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - (function(dragonBones) { - /** - * - The PixiJS factory. - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - PixiJS 工厂。 - * @version DragonBones 3.0 - * @language zh_CN - */ - var PixiFactory = /** @class */ (function(_super) { - __extends(PixiFactory, _super); - /** - * @inheritDoc - */ - function PixiFactory(dataParser) { - if (dataParser === void 0) { - dataParser = null; - } - var _this = _super.call(this, dataParser) || this; - if (PixiFactory._dragonBonesInstance === null) { - var eventManager = new dragonBones.PixiArmatureDisplay(); - PixiFactory._dragonBonesInstance = new dragonBones.DragonBones( - eventManager, - ); - // PIXI.ticker.shared.add(PixiFactory._clockHandler, PixiFactory); - } - _this._dragonBones = PixiFactory._dragonBonesInstance; - return _this; - } - PixiFactory._clockHandler = function(passedTime) { - this._dragonBonesInstance.advanceTime( - PIXI.ticker.shared.elapsedMS * passedTime * 0.001, - ); - }; - Object.defineProperty(PixiFactory, 'factory', { - /** - * - A global factory instance that can be used directly. - * @version DragonBones 4.7 - * @language en_US - */ - /** - * - 一个可以直接使用的全局工厂实例。 - * @version DragonBones 4.7 - * @language zh_CN - */ - get: function() { - if (PixiFactory._factory === null) { - PixiFactory._factory = new PixiFactory(); - } - return PixiFactory._factory; - }, - enumerable: true, - configurable: true, - }); - PixiFactory.prototype._buildTextureAtlasData = function( - textureAtlasData, - textureAtlas, - ) { - if (textureAtlasData) { - textureAtlasData.renderTexture = textureAtlas; - } else { - textureAtlasData = dragonBones.BaseObject.borrowObject( - dragonBones.PixiTextureAtlasData, - ); - } - return textureAtlasData; - }; - PixiFactory.prototype._buildArmature = function(dataPackage) { - var armature = dragonBones.BaseObject.borrowObject(dragonBones.Armature); - var armatureDisplay = new dragonBones.PixiArmatureDisplay(); - armature.init( - dataPackage.armature, - armatureDisplay, - armatureDisplay, - this._dragonBones, - ); - return armature; - }; - PixiFactory.prototype._buildSlot = function( - _dataPackage, - slotData, - armature, - ) { - var slot = dragonBones.BaseObject.borrowObject(dragonBones.PixiSlot); - slot.init( - slotData, - armature, - new PIXI.Sprite(), - new PIXI.mesh.Mesh( - null, - null, - null, - null, - PIXI.mesh.Mesh.DRAW_MODES.TRIANGLES, - ), - ); - return slot; - }; - /** - * - Create a armature from cached DragonBonesData instances and TextureAtlasData instances, then use the {@link #clock} to update it. - * The difference is that the armature created by {@link #buildArmature} is not WorldClock instance update. - * @param armatureName - The armature data name. - * @param dragonBonesName - The cached name of the DragonBonesData instance. (If not set, all DragonBonesData instances are retrieved, and when multiple DragonBonesData instances contain a the same name armature data, it may not be possible to accurately create a specific armature) - * @param skinName - The skin name, you can set a different ArmatureData name to share it's skin data. (If not set, use the default skin data) - * @returns The armature display container. - * @see dragonBones.IArmatureProxy - * @see dragonBones.BaseFactory#buildArmature - * @version DragonBones 4.5 - * @example - *
-         *     let armatureDisplay = factory.buildArmatureDisplay("armatureName", "dragonBonesName");
-         * 
- * @language en_US - */ - /** - * - 通过缓存的 DragonBonesData 实例和 TextureAtlasData 实例创建一个骨架,并用 {@link #clock} 更新该骨架。 - * 区别在于由 {@link #buildArmature} 创建的骨架没有 WorldClock 实例驱动。 - * @param armatureName - 骨架数据名称。 - * @param dragonBonesName - DragonBonesData 实例的缓存名称。 (如果未设置,将检索所有的 DragonBonesData 实例,当多个 DragonBonesData 实例中包含同名的骨架数据时,可能无法准确的创建出特定的骨架) - * @param skinName - 皮肤名称,可以设置一个其他骨架数据名称来共享其皮肤数据。 (如果未设置,则使用默认的皮肤数据) - * @returns 骨架的显示容器。 - * @see dragonBones.IArmatureProxy - * @see dragonBones.BaseFactory#buildArmature - * @version DragonBones 4.5 - * @example - *
-         *     let armatureDisplay = factory.buildArmatureDisplay("armatureName", "dragonBonesName");
-         * 
- * @language zh_CN - */ - PixiFactory.prototype.buildArmatureDisplay = function( - armatureName, - dragonBonesName, - skinName, - textureAtlasName, - ) { - if (dragonBonesName === void 0) { - dragonBonesName = ''; - } - if (skinName === void 0) { - skinName = ''; - } - if (textureAtlasName === void 0) { - textureAtlasName = ''; - } - var armature = this.buildArmature( - armatureName, - dragonBonesName || '', - skinName || '', - textureAtlasName || '', - ); - if (armature !== null) { - this._dragonBones.clock.add(armature); - return armature.display; - } - return null; - }; - /** - * - Create the display object with the specified texture. - * @param textureName - The texture data name. - * @param textureAtlasName - The texture atlas data name (Of not set, all texture atlas data will be searched) - * @version DragonBones 3.0 - * @language en_US - */ - /** - * - 创建带有指定贴图的显示对象。 - * @param textureName - 贴图数据名称。 - * @param textureAtlasName - 贴图集数据名称。 (如果未设置,将检索所有的贴图集数据) - * @version DragonBones 3.0 - * @language zh_CN - */ - PixiFactory.prototype.getTextureDisplay = function( - textureName, - textureAtlasName, - ) { - if (textureAtlasName === void 0) { - textureAtlasName = null; - } - var textureData = this._getTextureData( - textureAtlasName !== null ? textureAtlasName : '', - textureName, - ); - if (textureData !== null && textureData.renderTexture !== null) { - return new PIXI.Sprite(textureData.renderTexture); - } - return null; - }; - Object.defineProperty(PixiFactory.prototype, 'soundEventManager', { - /** - * - A global sound event manager. - * Sound events can be listened to uniformly from the manager. - * @version DragonBones 4.5 - * @language en_US - */ - /** - * - 全局声音事件管理器。 - * 声音事件可以从该管理器统一侦听。 - * @version DragonBones 4.5 - * @language zh_CN - */ - get: function() { - return this._dragonBones.eventManager; - }, - enumerable: true, - configurable: true, - }); - PixiFactory._dragonBonesInstance = null; - PixiFactory._factory = null; - return PixiFactory; - })(dragonBones.BaseFactory); - dragonBones.PixiFactory = PixiFactory; - })(dragonBones || (dragonBones = {})); - - var dragonBones$1 = dragonBones; - - class DragonBone$2 { - constructor({ armatureName }) { - this.factory = dragonBones$1.PixiFactory.factory; - this.armature = this.factory.buildArmatureDisplay(armatureName); - } - play(name, time) { - return this.armature.animation.play(name, time); - } - stop(name) { - return this.armature.animation.stop(name); - } - } - - const events = { - START: 'start', - LOOP_COMPLETE: 'loopComplete', - COMPLETE: 'complete', - FADE_IN: 'fadeIn', - FADE_IN_COMPLETE: 'fadeInComplete', - FADE_OUT: 'fadeOut', - FADE_OUT_COMPLETE: 'fadeOutComplete', - FRAME_EVENT: 'frameEvent', - SOUND_EVENT: 'soundEvent', - }; - const factory = dragonBones$1.PixiFactory.factory; - eva_js.resource.registerInstance(eva_js.RESOURCE_TYPE.DRAGONBONE, ({ data, name }) => { - factory.parseDragonBonesData(data.ske, name); - factory.parseTextureAtlasData(data.tex, pixi_js.Texture.from(data.image), name); - }); - eva_js.resource.registerDestroy(eva_js.RESOURCE_TYPE.DRAGONBONE, ({ name }) => { - factory.removeDragonBonesData(name); - factory.removeTextureAtlasData(name); - }); - let DragonBone = class DragonBone extends pluginRenderer.Renderer { - constructor() { - super(...arguments); - this.name = 'DragonBone'; - this.armatures = {}; - this.autoPlay = {}; - this.isRemovedMap = new Map(); - } - init() { - this.renderSystem = this.game.getSystem(pluginRenderer.RendererSystem); - this.renderSystem.rendererManager.register(this); - pixi_js.ticker.shared.add(dragonBones$1.PixiFactory._clockHandler, dragonBones$1.PixiFactory); - } - componentChanged(changed) { - return __awaiter(this, void 0, void 0, function* () { - this.autoPlay[changed.gameObject.id] = changed.component.autoPlay; - if (changed.componentName === 'DragonBone') { - if (changed.type === eva_js.OBSERVER_TYPE.ADD) { - this.add(changed); - } - else if (changed.type === eva_js.OBSERVER_TYPE.CHANGE) { - switch (changed.prop.prop[0]) { - case 'armature': - this.change(changed); - break; - } - } - else if (changed.type === eva_js.OBSERVER_TYPE.REMOVE) { - this.remove(changed); - } - } - }); - } - add(changed) { - return __awaiter(this, void 0, void 0, function* () { - const component = changed.component; - this.isRemovedMap.delete(component); - yield eva_js.resource.getResource(component.resource); - if (this.isRemovedMap.get(component)) { - this.isRemovedMap.delete(component); - return; - } - const armature = new DragonBone$2({ - armatureName: component.armatureName, - }); - this.armatures[changed.gameObject.id] = armature; - this.renderSystem.containerManager - .getContainer(changed.gameObject.id) - .addChildAt(armature.armature, 0); - component.armature = armature; - for (const key in events) { - armature.armature.on(events[key], e => { - component.emit(events[key], e); - }); - } - }); - } - change(changed) { - this.remove(changed); - this.add(changed); - if (this.autoPlay[changed.gameObject.id]) { - const component = changed.component; - component.play(component.animationName); - } - } - remove(changed) { - const armature = this.armatures[changed.gameObject.id]; - if (!armature) { - this.isRemovedMap.set(changed.component, true); - return; - } - this.autoPlay[changed.gameObject.id] = - armature.armature.animation.isPlaying; - this.renderSystem.containerManager - .getContainer(changed.gameObject.id) - .removeChild(armature.armature); - armature.armature.removeAllListeners(); - armature.armature.destroy(true); - const component = changed.component; - component.armature = null; - delete this.armatures[changed.gameObject.id]; - if (changed.type === eva_js.OBSERVER_TYPE.CHANGE) { - delete this.autoPlay[changed.gameObject.id]; - component.removeAllListeners(); - } - } - }; - DragonBone.systemName = 'DragonBone'; - DragonBone = __decorate([ - eva_js.decorators.componentObserver({ - DragonBone: ['armatureName'], - }) - ], DragonBone); - var DragonBone$1 = DragonBone; - - exports.DragonBone = DragonBone$3; - exports.DragonBoneSystem = DragonBone$1; - - Object.defineProperty(exports, '__esModule', { value: true }); - -}))); diff --git a/dist/cdn/EVA.plugin.renderer.event.js b/dist/cdn/EVA.plugin.renderer.event.js deleted file mode 100644 index 94bef193..00000000 --- a/dist/cdn/EVA.plugin.renderer.event.js +++ /dev/null @@ -1,226 +0,0 @@ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@eva/eva.js'), require('@eva/plugin-renderer'), require('pixi.js')) : - typeof define === 'function' && define.amd ? define(['exports', '@eva/eva.js', '@eva/plugin-renderer', 'pixi.js'], factory) : - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.EVA = global.EVA || {}, global.EVA.plugin = global.EVA.plugin || {}, global.EVA.plugin.renderer = global.EVA.plugin.renderer || {}, global.EVA.plugin.renderer.event = {}), global.EVA, global.EVA.plugin.renderer, global.PIXI)); -}(this, (function (exports, eva_js, pluginRenderer, pixi_js) { 'use strict'; - - exports.HIT_AREA_TYPE = void 0; - (function (HIT_AREA_TYPE) { - HIT_AREA_TYPE["Circle"] = "Circle"; - HIT_AREA_TYPE["Ellipse"] = "Ellipse"; - HIT_AREA_TYPE["Polygon"] = "Polygon"; - HIT_AREA_TYPE["Rect"] = "Rect"; - HIT_AREA_TYPE["RoundedRect"] = "RoundedRect"; - })(exports.HIT_AREA_TYPE || (exports.HIT_AREA_TYPE = {})); - class Event$2 extends eva_js.Component { - constructor() { - super(...arguments); - this.hitArea = undefined; - } - init(params) { - params && Object.assign(this, params); - } - } - Event$2.componentName = 'Event'; - - /*! ***************************************************************************** - Copyright (c) Microsoft Corporation. - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. - ***************************************************************************** */ - - function __decorate(decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; - } - - const hitAreaFunc = { - Circle: pixi_js.Circle, - Ellipse: pixi_js.Ellipse, - Polygon: pixi_js.Polygon, - Rect: pixi_js.Rectangle, - RoundedRect: pixi_js.RoundedRectangle, - }; - const propertyForHitArea = { - Circle: ['x', 'y', 'radius'], - Ellipse: ['x', 'y', 'width', 'height'], - Rect: ['x', 'y', 'width', 'height'], - RoundedRect: ['x', 'y', 'width', 'height', 'radius'], - Polygon: ['paths'], - }; - let Event = class Event extends pluginRenderer.Renderer { - constructor() { - super(...arguments); - this.name = 'Event'; - } - init({ moveWhenInside = false } = {}) { - this.renderSystem = this.game.getSystem(pluginRenderer.RendererSystem); - this.renderSystem.rendererManager.register(this); - try { - this.renderSystem.application.renderer.plugins.interaction.moveWhenInside = moveWhenInside; - } - catch (e) { - console.error('Setting moveWhenInside error.', e); - } - } - componentChanged(changed) { - switch (changed.type) { - case eva_js.OBSERVER_TYPE.ADD: - this.add(changed); - break; - case eva_js.OBSERVER_TYPE.REMOVE: - this.remove(changed); - break; - case eva_js.OBSERVER_TYPE.CHANGE: - this.change(changed); - break; - } - } - add(changed) { - const container = this.containerManager.getContainer(changed.gameObject.id); - container.interactive = true; - container.interactiveChildren = true; - const component = changed.component; - if (component.hitArea) { - this.addHitArea(changed, container, component.hitArea); - } - container.on('pointertap', e => { - component.emit('tap', { - stopPropagation: () => e.stopPropagation(), - data: { - pointerId: e.data.pointerId, - position: { - x: e.data.global.x, - y: e.data.global.y, - }, - }, - gameObject: component.gameObject, - }); - }); - container.on('pointerdown', e => { - component.emit('touchstart', { - stopPropagation: () => e.stopPropagation(), - data: { - pointerId: e.data.pointerId, - position: { - x: e.data.global.x, - y: e.data.global.y, - }, - }, - gameObject: component.gameObject, - }); - }); - container.on('pointermove', e => { - component.emit('touchmove', { - stopPropagation: () => e.stopPropagation(), - data: { - pointerId: e.data.pointerId, - position: { - x: e.data.global.x, - y: e.data.global.y, - }, - }, - gameObject: component.gameObject, - }); - }); - container.on('pointerup', e => { - component.emit('touchend', { - stopPropagation: () => e.stopPropagation(), - data: { - pointerId: e.data.pointerId, - position: { - x: e.data.global.x, - y: e.data.global.y, - }, - }, - gameObject: component.gameObject, - }); - }); - container.on('pointerupoutside', e => { - component.emit('touchendoutside', { - stopPropagation: () => e.stopPropagation(), - data: { - pointerId: e.data.pointerId, - position: { - x: e.data.global.x, - y: e.data.global.y, - }, - }, - gameObject: component.gameObject, - }); - }); - container.on('pointercancel', e => { - component.emit('touchcancel', { - stopPropagation: () => e.stopPropagation(), - data: { - pointerId: e.data.pointerId, - position: { - x: e.data.global.x, - y: e.data.global.y, - }, - }, - gameObject: component.gameObject, - }); - }); - } - remove(changed) { - const container = this.containerManager.getContainer(changed.gameObject.id); - container.interactive = false; - container.off('tap'); - container.off('pointerdown'); - container.off('pointermove'); - container.off('pointerup'); - container.off('pointerupoutside'); - container.off('pointercancel'); - changed.component.removeAllListeners(); - } - change(changed) { - const container = this.containerManager.getContainer(changed.gameObject.id); - container.interactive = true; - const component = changed.component; - if (component.hitArea) { - this.addHitArea(changed, container, component.hitArea); - } - else { - component.hitArea = null; - } - } - addHitArea(changed, container, hitArea) { - const { type, style } = hitArea; - if (!hitAreaFunc[type]) { - console.error(`${changed.gameObject.name}'s hitArea type is not defined`); - return; - } - const params = []; - for (const key of propertyForHitArea[type]) { - params.push(style[key]); - } - const hitAreaShape = new hitAreaFunc[type](...params); - container.hitArea = hitAreaShape; - } - }; - Event.systemName = 'Event'; - Event = __decorate([ - eva_js.decorators.componentObserver({ - Event: [{ prop: ['hitArea'], deep: true }], - }) - ], Event); - var Event$1 = Event; - - exports.Event = Event$2; - exports.EventSystem = Event$1; - - Object.defineProperty(exports, '__esModule', { value: true }); - -}))); diff --git a/dist/cdn/EVA.plugin.renderer.graphics.js b/dist/cdn/EVA.plugin.renderer.graphics.js deleted file mode 100644 index 10977d43..00000000 --- a/dist/cdn/EVA.plugin.renderer.graphics.js +++ /dev/null @@ -1,91 +0,0 @@ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@eva/eva.js'), require('pixi.js'), require('@eva/plugin-renderer')) : - typeof define === 'function' && define.amd ? define(['exports', '@eva/eva.js', 'pixi.js', '@eva/plugin-renderer'], factory) : - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.EVA = global.EVA || {}, global.EVA.plugin = global.EVA.plugin || {}, global.EVA.plugin.renderer = global.EVA.plugin.renderer || {}, global.EVA.plugin.renderer.graphics = {}), global.EVA, global.PIXI, global.EVA.plugin.renderer)); -}(this, (function (exports, eva_js, pixi_js, pluginRenderer) { 'use strict'; - - class Graphics$3 extends pixi_js.Graphics { - } - - class Graphics$2 extends eva_js.Component { - constructor() { - super(...arguments); - this.graphics = null; - } - init() { - this.graphics = new Graphics$3(); - } - } - Graphics$2.componentName = 'Graphics'; - - /*! ***************************************************************************** - Copyright (c) Microsoft Corporation. - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. - ***************************************************************************** */ - - function __decorate(decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; - } - - function __awaiter(thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - } - - let Graphics = class Graphics extends pluginRenderer.Renderer { - constructor() { - super(...arguments); - this.name = 'Graphics'; - } - init() { - this.renderSystem = this.game.getSystem(pluginRenderer.RendererSystem); - this.renderSystem.rendererManager.register(this); - } - componentChanged(changed) { - return __awaiter(this, void 0, void 0, function* () { - if (changed.type === eva_js.OBSERVER_TYPE.ADD) { - this.containerManager - .getContainer(changed.gameObject.id) - .addChildAt(changed.component.graphics, 0); - } - else if (changed.type === eva_js.OBSERVER_TYPE.REMOVE) { - this.containerManager - .getContainer(changed.gameObject.id) - .removeChild(changed.component.graphics); - changed.component.graphics.destroy(true); - } - }); - } - }; - Graphics.systemName = 'Graphics'; - Graphics = __decorate([ - eva_js.decorators.componentObserver({ - Graphics: ['graphics'], - }) - ], Graphics); - var Graphics$1 = Graphics; - - exports.Graphics = Graphics$2; - exports.GraphicsSystem = Graphics$1; - - Object.defineProperty(exports, '__esModule', { value: true }); - -}))); diff --git a/dist/cdn/EVA.plugin.renderer.img.js b/dist/cdn/EVA.plugin.renderer.img.js deleted file mode 100644 index a9399b72..00000000 --- a/dist/cdn/EVA.plugin.renderer.img.js +++ /dev/null @@ -1,134 +0,0 @@ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@eva/eva.js'), require('@eva/plugin-renderer'), require('@eva/renderer-adapter'), require('pixi.js')) : - typeof define === 'function' && define.amd ? define(['exports', '@eva/eva.js', '@eva/plugin-renderer', '@eva/renderer-adapter', 'pixi.js'], factory) : - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.EVA = global.EVA || {}, global.EVA.plugin = global.EVA.plugin || {}, global.EVA.plugin.renderer = global.EVA.plugin.renderer || {}, global.EVA.plugin.renderer.img = {}), global.EVA, global.EVA.plugin.renderer, global.EVA.rendererAdapter, global.PIXI)); -}(this, (function (exports, eva_js, pluginRenderer, rendererAdapter, pixi_js) { 'use strict'; - - /*! ***************************************************************************** - Copyright (c) Microsoft Corporation. - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. - ***************************************************************************** */ - - function __decorate(decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; - } - - function __awaiter(thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - } - - class Img$2 extends eva_js.Component { - constructor() { - super(...arguments); - this.resource = ''; - } - init(obj) { - if (obj && obj.resource) { - this.resource = obj.resource; - } - } - } - Img$2.componentName = 'Img'; - __decorate([ - eva_js.decorators.IDEProp - ], Img$2.prototype, "resource", void 0); - - eva_js.resource.registerInstance(eva_js.RESOURCE_TYPE.IMAGE, ({ data = {} }) => { - const { image } = data; - if (image) { - const texture = pixi_js.Texture.from(image); - return texture; - } - return; - }); - eva_js.resource.registerDestroy(eva_js.RESOURCE_TYPE.IMAGE, ({ instance }) => { - if (instance) { - instance.destroy(true); - } - }); - let Img = class Img extends pluginRenderer.Renderer { - constructor() { - super(...arguments); - this.name = 'Img'; - this.imgs = {}; - } - init() { - this.renderSystem = this.game.getSystem(pluginRenderer.RendererSystem); - this.renderSystem.rendererManager.register(this); - } - rendererUpdate(gameObject) { - const { width, height } = gameObject.transform.size; - if (this.imgs[gameObject.id]) { - this.imgs[gameObject.id].sprite.width = width; - this.imgs[gameObject.id].sprite.height = height; - } - } - componentChanged(changed) { - return __awaiter(this, void 0, void 0, function* () { - if (changed.componentName === 'Img') { - const component = changed.component; - if (changed.type === eva_js.OBSERVER_TYPE.ADD) { - const sprite = new rendererAdapter.Sprite(null); - eva_js.resource.getResource(component.resource).then(({ instance }) => { - if (!instance) { - console.error(`GameObject:${changed.gameObject.name}'s Img resource load error`); - } - sprite.image = instance; - }); - this.imgs[changed.gameObject.id] = sprite; - this.containerManager - .getContainer(changed.gameObject.id) - .addChildAt(sprite.sprite, 0); - } - else if (changed.type === eva_js.OBSERVER_TYPE.CHANGE) { - const { instance } = yield eva_js.resource.getResource(component.resource); - if (!instance) { - console.error(`GameObject:${changed.gameObject.name}'s Img resource load error`); - } - this.imgs[changed.gameObject.id].image = instance; - } - else if (changed.type === eva_js.OBSERVER_TYPE.REMOVE) { - const sprite = this.imgs[changed.gameObject.id]; - this.containerManager - .getContainer(changed.gameObject.id) - .removeChild(sprite.sprite); - sprite.sprite.destroy(true); - delete this.imgs[changed.gameObject.id]; - } - } - }); - } - }; - Img.systemName = 'Img'; - Img = __decorate([ - eva_js.decorators.componentObserver({ - Img: [{ prop: ['resource'], deep: false }], - }) - ], Img); - var Img$1 = Img; - - exports.Img = Img$2; - exports.ImgSystem = Img$1; - - Object.defineProperty(exports, '__esModule', { value: true }); - -}))); diff --git a/dist/cdn/EVA.plugin.renderer.js b/dist/cdn/EVA.plugin.renderer.js deleted file mode 100644 index 1e319ed5..00000000 --- a/dist/cdn/EVA.plugin.renderer.js +++ /dev/null @@ -1,2764 +0,0 @@ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - ? factory(exports, require('@eva/eva.js'), require('@eva/renderer-adapter'), require('pixi.js')) - : typeof define === 'function' && define.amd - ? define(['exports', '@eva/eva.js', '@eva/renderer-adapter', 'pixi.js'], factory) - : ((global = typeof globalThis !== 'undefined' ? globalThis : global || self), - factory( - ((global.EVA = global.EVA || {}), (global.EVA.plugin = global.EVA.plugin || {}), (global.EVA.plugin.renderer = {})), - global.EVA, - global.EVA.rendererAdapter, - global.PIXI, - )); -})(this, function (exports, eva_js, rendererAdapter, pixi_js) { - 'use strict'; - - /*! ***************************************************************************** - Copyright (c) Microsoft Corporation. - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. - ***************************************************************************** */ - - function __decorate(decorators, target, key, desc) { - var c = arguments.length, - r = c < 3 ? target : desc === null ? (desc = Object.getOwnPropertyDescriptor(target, key)) : desc, - d; - if (typeof Reflect === 'object' && typeof Reflect.decorate === 'function') - r = Reflect.decorate(decorators, target, key, desc); - else - for (var i = decorators.length - 1; i >= 0; i--) - if ((d = decorators[i])) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; - } - - /** - * Removes all key-value entries from the list cache. - * - * @private - * @name clear - * @memberOf ListCache - */ - function listCacheClear() { - this.__data__ = []; - this.size = 0; - } - - /** - * Performs a - * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) - * comparison between two values to determine if they are equivalent. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @returns {boolean} Returns `true` if the values are equivalent, else `false`. - * @example - * - * var object = { 'a': 1 }; - * var other = { 'a': 1 }; - * - * _.eq(object, object); - * // => true - * - * _.eq(object, other); - * // => false - * - * _.eq('a', 'a'); - * // => true - * - * _.eq('a', Object('a')); - * // => false - * - * _.eq(NaN, NaN); - * // => true - */ - function eq(value, other) { - return value === other || (value !== value && other !== other); - } - - /** - * Gets the index at which the `key` is found in `array` of key-value pairs. - * - * @private - * @param {Array} array The array to inspect. - * @param {*} key The key to search for. - * @returns {number} Returns the index of the matched value, else `-1`. - */ - function assocIndexOf(array, key) { - var length = array.length; - while (length--) { - if (eq(array[length][0], key)) { - return length; - } - } - return -1; - } - - /** Used for built-in method references. */ - var arrayProto = Array.prototype; - - /** Built-in value references. */ - var splice = arrayProto.splice; - - /** - * Removes `key` and its value from the list cache. - * - * @private - * @name delete - * @memberOf ListCache - * @param {string} key The key of the value to remove. - * @returns {boolean} Returns `true` if the entry was removed, else `false`. - */ - function listCacheDelete(key) { - var data = this.__data__, - index = assocIndexOf(data, key); - - if (index < 0) { - return false; - } - var lastIndex = data.length - 1; - if (index == lastIndex) { - data.pop(); - } else { - splice.call(data, index, 1); - } - --this.size; - return true; - } - - /** - * Gets the list cache value for `key`. - * - * @private - * @name get - * @memberOf ListCache - * @param {string} key The key of the value to get. - * @returns {*} Returns the entry value. - */ - function listCacheGet(key) { - var data = this.__data__, - index = assocIndexOf(data, key); - - return index < 0 ? undefined : data[index][1]; - } - - /** - * Checks if a list cache value for `key` exists. - * - * @private - * @name has - * @memberOf ListCache - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ - function listCacheHas(key) { - return assocIndexOf(this.__data__, key) > -1; - } - - /** - * Sets the list cache `key` to `value`. - * - * @private - * @name set - * @memberOf ListCache - * @param {string} key The key of the value to set. - * @param {*} value The value to set. - * @returns {Object} Returns the list cache instance. - */ - function listCacheSet(key, value) { - var data = this.__data__, - index = assocIndexOf(data, key); - - if (index < 0) { - ++this.size; - data.push([key, value]); - } else { - data[index][1] = value; - } - return this; - } - - /** - * Creates an list cache object. - * - * @private - * @constructor - * @param {Array} [entries] The key-value pairs to cache. - */ - function ListCache(entries) { - var index = -1, - length = entries == null ? 0 : entries.length; - - this.clear(); - while (++index < length) { - var entry = entries[index]; - this.set(entry[0], entry[1]); - } - } - - // Add methods to `ListCache`. - ListCache.prototype.clear = listCacheClear; - ListCache.prototype['delete'] = listCacheDelete; - ListCache.prototype.get = listCacheGet; - ListCache.prototype.has = listCacheHas; - ListCache.prototype.set = listCacheSet; - - /** - * Removes all key-value entries from the stack. - * - * @private - * @name clear - * @memberOf Stack - */ - function stackClear() { - this.__data__ = new ListCache(); - this.size = 0; - } - - /** - * Removes `key` and its value from the stack. - * - * @private - * @name delete - * @memberOf Stack - * @param {string} key The key of the value to remove. - * @returns {boolean} Returns `true` if the entry was removed, else `false`. - */ - function stackDelete(key) { - var data = this.__data__, - result = data['delete'](key); - - this.size = data.size; - return result; - } - - /** - * Gets the stack value for `key`. - * - * @private - * @name get - * @memberOf Stack - * @param {string} key The key of the value to get. - * @returns {*} Returns the entry value. - */ - function stackGet(key) { - return this.__data__.get(key); - } - - /** - * Checks if a stack value for `key` exists. - * - * @private - * @name has - * @memberOf Stack - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ - function stackHas(key) { - return this.__data__.has(key); - } - - /** Detect free variable `global` from Node.js. */ - var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; - - /** Detect free variable `self`. */ - var freeSelf = typeof self == 'object' && self && self.Object === Object && self; - - /** Used as a reference to the global object. */ - var root = freeGlobal || freeSelf || Function('return this')(); - - /** Built-in value references. */ - var Symbol = root.Symbol; - - /** Used for built-in method references. */ - var objectProto$b = Object.prototype; - - /** Used to check objects for own properties. */ - var hasOwnProperty$8 = objectProto$b.hasOwnProperty; - - /** - * Used to resolve the - * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) - * of values. - */ - var nativeObjectToString$1 = objectProto$b.toString; - - /** Built-in value references. */ - var symToStringTag$1 = Symbol ? Symbol.toStringTag : undefined; - - /** - * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values. - * - * @private - * @param {*} value The value to query. - * @returns {string} Returns the raw `toStringTag`. - */ - function getRawTag(value) { - var isOwn = hasOwnProperty$8.call(value, symToStringTag$1), - tag = value[symToStringTag$1]; - - try { - value[symToStringTag$1] = undefined; - var unmasked = true; - } catch (e) {} - - var result = nativeObjectToString$1.call(value); - if (unmasked) { - if (isOwn) { - value[symToStringTag$1] = tag; - } else { - delete value[symToStringTag$1]; - } - } - return result; - } - - /** Used for built-in method references. */ - var objectProto$a = Object.prototype; - - /** - * Used to resolve the - * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) - * of values. - */ - var nativeObjectToString = objectProto$a.toString; - - /** - * Converts `value` to a string using `Object.prototype.toString`. - * - * @private - * @param {*} value The value to convert. - * @returns {string} Returns the converted string. - */ - function objectToString(value) { - return nativeObjectToString.call(value); - } - - /** `Object#toString` result references. */ - var nullTag = '[object Null]', - undefinedTag = '[object Undefined]'; - - /** Built-in value references. */ - var symToStringTag = Symbol ? Symbol.toStringTag : undefined; - - /** - * The base implementation of `getTag` without fallbacks for buggy environments. - * - * @private - * @param {*} value The value to query. - * @returns {string} Returns the `toStringTag`. - */ - function baseGetTag(value) { - if (value == null) { - return value === undefined ? undefinedTag : nullTag; - } - return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value); - } - - /** - * Checks if `value` is the - * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) - * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(_.noop); - * // => true - * - * _.isObject(null); - * // => false - */ - function isObject(value) { - var type = typeof value; - return value != null && (type == 'object' || type == 'function'); - } - - /** `Object#toString` result references. */ - var asyncTag = '[object AsyncFunction]', - funcTag$1 = '[object Function]', - genTag = '[object GeneratorFunction]', - proxyTag = '[object Proxy]'; - - /** - * Checks if `value` is classified as a `Function` object. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a function, else `false`. - * @example - * - * _.isFunction(_); - * // => true - * - * _.isFunction(/abc/); - * // => false - */ - function isFunction(value) { - if (!isObject(value)) { - return false; - } - // The use of `Object#toString` avoids issues with the `typeof` operator - // in Safari 9 which returns 'object' for typed arrays and other constructors. - var tag = baseGetTag(value); - return tag == funcTag$1 || tag == genTag || tag == asyncTag || tag == proxyTag; - } - - /** Used to detect overreaching core-js shims. */ - var coreJsData = root['__core-js_shared__']; - - /** Used to detect methods masquerading as native. */ - var maskSrcKey = (function () { - var uid = /[^.]+$/.exec((coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO) || ''); - return uid ? 'Symbol(src)_1.' + uid : ''; - })(); - - /** - * Checks if `func` has its source masked. - * - * @private - * @param {Function} func The function to check. - * @returns {boolean} Returns `true` if `func` is masked, else `false`. - */ - function isMasked(func) { - return !!maskSrcKey && maskSrcKey in func; - } - - /** Used for built-in method references. */ - var funcProto$1 = Function.prototype; - - /** Used to resolve the decompiled source of functions. */ - var funcToString$1 = funcProto$1.toString; - - /** - * Converts `func` to its source code. - * - * @private - * @param {Function} func The function to convert. - * @returns {string} Returns the source code. - */ - function toSource(func) { - if (func != null) { - try { - return funcToString$1.call(func); - } catch (e) {} - try { - return func + ''; - } catch (e) {} - } - return ''; - } - - /** - * Used to match `RegExp` - * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). - */ - var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; - - /** Used to detect host constructors (Safari). */ - var reIsHostCtor = /^\[object .+?Constructor\]$/; - - /** Used for built-in method references. */ - var funcProto = Function.prototype, - objectProto$9 = Object.prototype; - - /** Used to resolve the decompiled source of functions. */ - var funcToString = funcProto.toString; - - /** Used to check objects for own properties. */ - var hasOwnProperty$7 = objectProto$9.hasOwnProperty; - - /** Used to detect if a method is native. */ - var reIsNative = RegExp( - '^' + - funcToString - .call(hasOwnProperty$7) - .replace(reRegExpChar, '\\$&') - .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + - '$', - ); - - /** - * The base implementation of `_.isNative` without bad shim checks. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a native function, - * else `false`. - */ - function baseIsNative(value) { - if (!isObject(value) || isMasked(value)) { - return false; - } - var pattern = isFunction(value) ? reIsNative : reIsHostCtor; - return pattern.test(toSource(value)); - } - - /** - * Gets the value at `key` of `object`. - * - * @private - * @param {Object} [object] The object to query. - * @param {string} key The key of the property to get. - * @returns {*} Returns the property value. - */ - function getValue(object, key) { - return object == null ? undefined : object[key]; - } - - /** - * Gets the native function at `key` of `object`. - * - * @private - * @param {Object} object The object to query. - * @param {string} key The key of the method to get. - * @returns {*} Returns the function if it's native, else `undefined`. - */ - function getNative(object, key) { - var value = getValue(object, key); - return baseIsNative(value) ? value : undefined; - } - - /* Built-in method references that are verified to be native. */ - var Map = getNative(root, 'Map'); - - /* Built-in method references that are verified to be native. */ - var nativeCreate = getNative(Object, 'create'); - - /** - * Removes all key-value entries from the hash. - * - * @private - * @name clear - * @memberOf Hash - */ - function hashClear() { - this.__data__ = nativeCreate ? nativeCreate(null) : {}; - this.size = 0; - } - - /** - * Removes `key` and its value from the hash. - * - * @private - * @name delete - * @memberOf Hash - * @param {Object} hash The hash to modify. - * @param {string} key The key of the value to remove. - * @returns {boolean} Returns `true` if the entry was removed, else `false`. - */ - function hashDelete(key) { - var result = this.has(key) && delete this.__data__[key]; - this.size -= result ? 1 : 0; - return result; - } - - /** Used to stand-in for `undefined` hash values. */ - var HASH_UNDEFINED$2 = '__lodash_hash_undefined__'; - - /** Used for built-in method references. */ - var objectProto$8 = Object.prototype; - - /** Used to check objects for own properties. */ - var hasOwnProperty$6 = objectProto$8.hasOwnProperty; - - /** - * Gets the hash value for `key`. - * - * @private - * @name get - * @memberOf Hash - * @param {string} key The key of the value to get. - * @returns {*} Returns the entry value. - */ - function hashGet(key) { - var data = this.__data__; - if (nativeCreate) { - var result = data[key]; - return result === HASH_UNDEFINED$2 ? undefined : result; - } - return hasOwnProperty$6.call(data, key) ? data[key] : undefined; - } - - /** Used for built-in method references. */ - var objectProto$7 = Object.prototype; - - /** Used to check objects for own properties. */ - var hasOwnProperty$5 = objectProto$7.hasOwnProperty; - - /** - * Checks if a hash value for `key` exists. - * - * @private - * @name has - * @memberOf Hash - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ - function hashHas(key) { - var data = this.__data__; - return nativeCreate ? data[key] !== undefined : hasOwnProperty$5.call(data, key); - } - - /** Used to stand-in for `undefined` hash values. */ - var HASH_UNDEFINED$1 = '__lodash_hash_undefined__'; - - /** - * Sets the hash `key` to `value`. - * - * @private - * @name set - * @memberOf Hash - * @param {string} key The key of the value to set. - * @param {*} value The value to set. - * @returns {Object} Returns the hash instance. - */ - function hashSet(key, value) { - var data = this.__data__; - this.size += this.has(key) ? 0 : 1; - data[key] = nativeCreate && value === undefined ? HASH_UNDEFINED$1 : value; - return this; - } - - /** - * Creates a hash object. - * - * @private - * @constructor - * @param {Array} [entries] The key-value pairs to cache. - */ - function Hash(entries) { - var index = -1, - length = entries == null ? 0 : entries.length; - - this.clear(); - while (++index < length) { - var entry = entries[index]; - this.set(entry[0], entry[1]); - } - } - - // Add methods to `Hash`. - Hash.prototype.clear = hashClear; - Hash.prototype['delete'] = hashDelete; - Hash.prototype.get = hashGet; - Hash.prototype.has = hashHas; - Hash.prototype.set = hashSet; - - /** - * Removes all key-value entries from the map. - * - * @private - * @name clear - * @memberOf MapCache - */ - function mapCacheClear() { - this.size = 0; - this.__data__ = { - hash: new Hash(), - map: new (Map || ListCache)(), - string: new Hash(), - }; - } - - /** - * Checks if `value` is suitable for use as unique object key. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is suitable, else `false`. - */ - function isKeyable(value) { - var type = typeof value; - return type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean' ? value !== '__proto__' : value === null; - } - - /** - * Gets the data for `map`. - * - * @private - * @param {Object} map The map to query. - * @param {string} key The reference key. - * @returns {*} Returns the map data. - */ - function getMapData(map, key) { - var data = map.__data__; - return isKeyable(key) ? data[typeof key == 'string' ? 'string' : 'hash'] : data.map; - } - - /** - * Removes `key` and its value from the map. - * - * @private - * @name delete - * @memberOf MapCache - * @param {string} key The key of the value to remove. - * @returns {boolean} Returns `true` if the entry was removed, else `false`. - */ - function mapCacheDelete(key) { - var result = getMapData(this, key)['delete'](key); - this.size -= result ? 1 : 0; - return result; - } - - /** - * Gets the map value for `key`. - * - * @private - * @name get - * @memberOf MapCache - * @param {string} key The key of the value to get. - * @returns {*} Returns the entry value. - */ - function mapCacheGet(key) { - return getMapData(this, key).get(key); - } - - /** - * Checks if a map value for `key` exists. - * - * @private - * @name has - * @memberOf MapCache - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ - function mapCacheHas(key) { - return getMapData(this, key).has(key); - } - - /** - * Sets the map `key` to `value`. - * - * @private - * @name set - * @memberOf MapCache - * @param {string} key The key of the value to set. - * @param {*} value The value to set. - * @returns {Object} Returns the map cache instance. - */ - function mapCacheSet(key, value) { - var data = getMapData(this, key), - size = data.size; - - data.set(key, value); - this.size += data.size == size ? 0 : 1; - return this; - } - - /** - * Creates a map cache object to store key-value pairs. - * - * @private - * @constructor - * @param {Array} [entries] The key-value pairs to cache. - */ - function MapCache(entries) { - var index = -1, - length = entries == null ? 0 : entries.length; - - this.clear(); - while (++index < length) { - var entry = entries[index]; - this.set(entry[0], entry[1]); - } - } - - // Add methods to `MapCache`. - MapCache.prototype.clear = mapCacheClear; - MapCache.prototype['delete'] = mapCacheDelete; - MapCache.prototype.get = mapCacheGet; - MapCache.prototype.has = mapCacheHas; - MapCache.prototype.set = mapCacheSet; - - /** Used as the size to enable large array optimizations. */ - var LARGE_ARRAY_SIZE = 200; - - /** - * Sets the stack `key` to `value`. - * - * @private - * @name set - * @memberOf Stack - * @param {string} key The key of the value to set. - * @param {*} value The value to set. - * @returns {Object} Returns the stack cache instance. - */ - function stackSet(key, value) { - var data = this.__data__; - if (data instanceof ListCache) { - var pairs = data.__data__; - if (!Map || pairs.length < LARGE_ARRAY_SIZE - 1) { - pairs.push([key, value]); - this.size = ++data.size; - return this; - } - data = this.__data__ = new MapCache(pairs); - } - data.set(key, value); - this.size = data.size; - return this; - } - - /** - * Creates a stack cache object to store key-value pairs. - * - * @private - * @constructor - * @param {Array} [entries] The key-value pairs to cache. - */ - function Stack(entries) { - var data = (this.__data__ = new ListCache(entries)); - this.size = data.size; - } - - // Add methods to `Stack`. - Stack.prototype.clear = stackClear; - Stack.prototype['delete'] = stackDelete; - Stack.prototype.get = stackGet; - Stack.prototype.has = stackHas; - Stack.prototype.set = stackSet; - - /** Used to stand-in for `undefined` hash values. */ - var HASH_UNDEFINED = '__lodash_hash_undefined__'; - - /** - * Adds `value` to the array cache. - * - * @private - * @name add - * @memberOf SetCache - * @alias push - * @param {*} value The value to cache. - * @returns {Object} Returns the cache instance. - */ - function setCacheAdd(value) { - this.__data__.set(value, HASH_UNDEFINED); - return this; - } - - /** - * Checks if `value` is in the array cache. - * - * @private - * @name has - * @memberOf SetCache - * @param {*} value The value to search for. - * @returns {number} Returns `true` if `value` is found, else `false`. - */ - function setCacheHas(value) { - return this.__data__.has(value); - } - - /** - * - * Creates an array cache object to store unique values. - * - * @private - * @constructor - * @param {Array} [values] The values to cache. - */ - function SetCache(values) { - var index = -1, - length = values == null ? 0 : values.length; - - this.__data__ = new MapCache(); - while (++index < length) { - this.add(values[index]); - } - } - - // Add methods to `SetCache`. - SetCache.prototype.add = SetCache.prototype.push = setCacheAdd; - SetCache.prototype.has = setCacheHas; - - /** - * A specialized version of `_.some` for arrays without support for iteratee - * shorthands. - * - * @private - * @param {Array} [array] The array to iterate over. - * @param {Function} predicate The function invoked per iteration. - * @returns {boolean} Returns `true` if any element passes the predicate check, - * else `false`. - */ - function arraySome(array, predicate) { - var index = -1, - length = array == null ? 0 : array.length; - - while (++index < length) { - if (predicate(array[index], index, array)) { - return true; - } - } - return false; - } - - /** - * Checks if a `cache` value for `key` exists. - * - * @private - * @param {Object} cache The cache to query. - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ - function cacheHas(cache, key) { - return cache.has(key); - } - - /** Used to compose bitmasks for value comparisons. */ - var COMPARE_PARTIAL_FLAG$3 = 1, - COMPARE_UNORDERED_FLAG$1 = 2; - - /** - * A specialized version of `baseIsEqualDeep` for arrays with support for - * partial deep comparisons. - * - * @private - * @param {Array} array The array to compare. - * @param {Array} other The other array to compare. - * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. - * @param {Function} customizer The function to customize comparisons. - * @param {Function} equalFunc The function to determine equivalents of values. - * @param {Object} stack Tracks traversed `array` and `other` objects. - * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`. - */ - function equalArrays(array, other, bitmask, customizer, equalFunc, stack) { - var isPartial = bitmask & COMPARE_PARTIAL_FLAG$3, - arrLength = array.length, - othLength = other.length; - - if (arrLength != othLength && !(isPartial && othLength > arrLength)) { - return false; - } - // Check that cyclic values are equal. - var arrStacked = stack.get(array); - var othStacked = stack.get(other); - if (arrStacked && othStacked) { - return arrStacked == other && othStacked == array; - } - var index = -1, - result = true, - seen = bitmask & COMPARE_UNORDERED_FLAG$1 ? new SetCache() : undefined; - - stack.set(array, other); - stack.set(other, array); - - // Ignore non-index properties. - while (++index < arrLength) { - var arrValue = array[index], - othValue = other[index]; - - if (customizer) { - var compared = isPartial - ? customizer(othValue, arrValue, index, other, array, stack) - : customizer(arrValue, othValue, index, array, other, stack); - } - if (compared !== undefined) { - if (compared) { - continue; - } - result = false; - break; - } - // Recursively compare arrays (susceptible to call stack limits). - if (seen) { - if ( - !arraySome(other, function (othValue, othIndex) { - if ( - !cacheHas(seen, othIndex) && - (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack)) - ) { - return seen.push(othIndex); - } - }) - ) { - result = false; - break; - } - } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) { - result = false; - break; - } - } - stack['delete'](array); - stack['delete'](other); - return result; - } - - /** Built-in value references. */ - var Uint8Array = root.Uint8Array; - - /** - * Converts `map` to its key-value pairs. - * - * @private - * @param {Object} map The map to convert. - * @returns {Array} Returns the key-value pairs. - */ - function mapToArray(map) { - var index = -1, - result = Array(map.size); - - map.forEach(function (value, key) { - result[++index] = [key, value]; - }); - return result; - } - - /** - * Converts `set` to an array of its values. - * - * @private - * @param {Object} set The set to convert. - * @returns {Array} Returns the values. - */ - function setToArray(set) { - var index = -1, - result = Array(set.size); - - set.forEach(function (value) { - result[++index] = value; - }); - return result; - } - - /** Used to compose bitmasks for value comparisons. */ - var COMPARE_PARTIAL_FLAG$2 = 1, - COMPARE_UNORDERED_FLAG = 2; - - /** `Object#toString` result references. */ - var boolTag$1 = '[object Boolean]', - dateTag$1 = '[object Date]', - errorTag$1 = '[object Error]', - mapTag$2 = '[object Map]', - numberTag$1 = '[object Number]', - regexpTag$1 = '[object RegExp]', - setTag$2 = '[object Set]', - stringTag$1 = '[object String]', - symbolTag = '[object Symbol]'; - - var arrayBufferTag$1 = '[object ArrayBuffer]', - dataViewTag$2 = '[object DataView]'; - - /** Used to convert symbols to primitives and strings. */ - var symbolProto = Symbol ? Symbol.prototype : undefined, - symbolValueOf = symbolProto ? symbolProto.valueOf : undefined; - - /** - * A specialized version of `baseIsEqualDeep` for comparing objects of - * the same `toStringTag`. - * - * **Note:** This function only supports comparing values with tags of - * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`. - * - * @private - * @param {Object} object The object to compare. - * @param {Object} other The other object to compare. - * @param {string} tag The `toStringTag` of the objects to compare. - * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. - * @param {Function} customizer The function to customize comparisons. - * @param {Function} equalFunc The function to determine equivalents of values. - * @param {Object} stack Tracks traversed `object` and `other` objects. - * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. - */ - function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) { - switch (tag) { - case dataViewTag$2: - if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) { - return false; - } - object = object.buffer; - other = other.buffer; - - case arrayBufferTag$1: - if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array(object), new Uint8Array(other))) { - return false; - } - return true; - - case boolTag$1: - case dateTag$1: - case numberTag$1: - // Coerce booleans to `1` or `0` and dates to milliseconds. - // Invalid dates are coerced to `NaN`. - return eq(+object, +other); - - case errorTag$1: - return object.name == other.name && object.message == other.message; - - case regexpTag$1: - case stringTag$1: - // Coerce regexes to strings and treat strings, primitives and objects, - // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring - // for more details. - return object == other + ''; - - case mapTag$2: - var convert = mapToArray; - - case setTag$2: - var isPartial = bitmask & COMPARE_PARTIAL_FLAG$2; - convert || (convert = setToArray); - - if (object.size != other.size && !isPartial) { - return false; - } - // Assume cyclic values are equal. - var stacked = stack.get(object); - if (stacked) { - return stacked == other; - } - bitmask |= COMPARE_UNORDERED_FLAG; - - // Recursively compare objects (susceptible to call stack limits). - stack.set(object, other); - var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack); - stack['delete'](object); - return result; - - case symbolTag: - if (symbolValueOf) { - return symbolValueOf.call(object) == symbolValueOf.call(other); - } - } - return false; - } - - /** - * Appends the elements of `values` to `array`. - * - * @private - * @param {Array} array The array to modify. - * @param {Array} values The values to append. - * @returns {Array} Returns `array`. - */ - function arrayPush(array, values) { - var index = -1, - length = values.length, - offset = array.length; - - while (++index < length) { - array[offset + index] = values[index]; - } - return array; - } - - /** - * Checks if `value` is classified as an `Array` object. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an array, else `false`. - * @example - * - * _.isArray([1, 2, 3]); - * // => true - * - * _.isArray(document.body.children); - * // => false - * - * _.isArray('abc'); - * // => false - * - * _.isArray(_.noop); - * // => false - */ - var isArray = Array.isArray; - - /** - * The base implementation of `getAllKeys` and `getAllKeysIn` which uses - * `keysFunc` and `symbolsFunc` to get the enumerable property names and - * symbols of `object`. - * - * @private - * @param {Object} object The object to query. - * @param {Function} keysFunc The function to get the keys of `object`. - * @param {Function} symbolsFunc The function to get the symbols of `object`. - * @returns {Array} Returns the array of property names and symbols. - */ - function baseGetAllKeys(object, keysFunc, symbolsFunc) { - var result = keysFunc(object); - return isArray(object) ? result : arrayPush(result, symbolsFunc(object)); - } - - /** - * A specialized version of `_.filter` for arrays without support for - * iteratee shorthands. - * - * @private - * @param {Array} [array] The array to iterate over. - * @param {Function} predicate The function invoked per iteration. - * @returns {Array} Returns the new filtered array. - */ - function arrayFilter(array, predicate) { - var index = -1, - length = array == null ? 0 : array.length, - resIndex = 0, - result = []; - - while (++index < length) { - var value = array[index]; - if (predicate(value, index, array)) { - result[resIndex++] = value; - } - } - return result; - } - - /** - * This method returns a new empty array. - * - * @static - * @memberOf _ - * @since 4.13.0 - * @category Util - * @returns {Array} Returns the new empty array. - * @example - * - * var arrays = _.times(2, _.stubArray); - * - * console.log(arrays); - * // => [[], []] - * - * console.log(arrays[0] === arrays[1]); - * // => false - */ - function stubArray() { - return []; - } - - /** Used for built-in method references. */ - var objectProto$6 = Object.prototype; - - /** Built-in value references. */ - var propertyIsEnumerable$1 = objectProto$6.propertyIsEnumerable; - - /* Built-in method references for those with the same name as other `lodash` methods. */ - var nativeGetSymbols = Object.getOwnPropertySymbols; - - /** - * Creates an array of the own enumerable symbols of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the array of symbols. - */ - var getSymbols = !nativeGetSymbols - ? stubArray - : function (object) { - if (object == null) { - return []; - } - object = Object(object); - return arrayFilter(nativeGetSymbols(object), function (symbol) { - return propertyIsEnumerable$1.call(object, symbol); - }); - }; - - /** - * The base implementation of `_.times` without support for iteratee shorthands - * or max array length checks. - * - * @private - * @param {number} n The number of times to invoke `iteratee`. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Array} Returns the array of results. - */ - function baseTimes(n, iteratee) { - var index = -1, - result = Array(n); - - while (++index < n) { - result[index] = iteratee(index); - } - return result; - } - - /** - * Checks if `value` is object-like. A value is object-like if it's not `null` - * and has a `typeof` result of "object". - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is object-like, else `false`. - * @example - * - * _.isObjectLike({}); - * // => true - * - * _.isObjectLike([1, 2, 3]); - * // => true - * - * _.isObjectLike(_.noop); - * // => false - * - * _.isObjectLike(null); - * // => false - */ - function isObjectLike(value) { - return value != null && typeof value == 'object'; - } - - /** `Object#toString` result references. */ - var argsTag$2 = '[object Arguments]'; - - /** - * The base implementation of `_.isArguments`. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an `arguments` object, - */ - function baseIsArguments(value) { - return isObjectLike(value) && baseGetTag(value) == argsTag$2; - } - - /** Used for built-in method references. */ - var objectProto$5 = Object.prototype; - - /** Used to check objects for own properties. */ - var hasOwnProperty$4 = objectProto$5.hasOwnProperty; - - /** Built-in value references. */ - var propertyIsEnumerable = objectProto$5.propertyIsEnumerable; - - /** - * Checks if `value` is likely an `arguments` object. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an `arguments` object, - * else `false`. - * @example - * - * _.isArguments(function() { return arguments; }()); - * // => true - * - * _.isArguments([1, 2, 3]); - * // => false - */ - var isArguments = baseIsArguments( - (function () { - return arguments; - })(), - ) - ? baseIsArguments - : function (value) { - return isObjectLike(value) && hasOwnProperty$4.call(value, 'callee') && !propertyIsEnumerable.call(value, 'callee'); - }; - - /** - * This method returns `false`. - * - * @static - * @memberOf _ - * @since 4.13.0 - * @category Util - * @returns {boolean} Returns `false`. - * @example - * - * _.times(2, _.stubFalse); - * // => [false, false] - */ - function stubFalse() { - return false; - } - - /** Detect free variable `exports`. */ - var freeExports$1 = typeof exports == 'object' && exports && !exports.nodeType && exports; - - /** Detect free variable `module`. */ - var freeModule$1 = freeExports$1 && typeof module == 'object' && module && !module.nodeType && module; - - /** Detect the popular CommonJS extension `module.exports`. */ - var moduleExports$1 = freeModule$1 && freeModule$1.exports === freeExports$1; - - /** Built-in value references. */ - var Buffer = moduleExports$1 ? root.Buffer : undefined; - - /* Built-in method references for those with the same name as other `lodash` methods. */ - var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined; - - /** - * Checks if `value` is a buffer. - * - * @static - * @memberOf _ - * @since 4.3.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a buffer, else `false`. - * @example - * - * _.isBuffer(new Buffer(2)); - * // => true - * - * _.isBuffer(new Uint8Array(2)); - * // => false - */ - var isBuffer = nativeIsBuffer || stubFalse; - - /** Used as references for various `Number` constants. */ - var MAX_SAFE_INTEGER$1 = 9007199254740991; - - /** Used to detect unsigned integer values. */ - var reIsUint = /^(?:0|[1-9]\d*)$/; - - /** - * Checks if `value` is a valid array-like index. - * - * @private - * @param {*} value The value to check. - * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. - * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. - */ - function isIndex(value, length) { - var type = typeof value; - length = length == null ? MAX_SAFE_INTEGER$1 : length; - - return ( - !!length && - (type == 'number' || (type != 'symbol' && reIsUint.test(value))) && - value > -1 && - value % 1 == 0 && - value < length - ); - } - - /** Used as references for various `Number` constants. */ - var MAX_SAFE_INTEGER = 9007199254740991; - - /** - * Checks if `value` is a valid array-like length. - * - * **Note:** This method is loosely based on - * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. - * @example - * - * _.isLength(3); - * // => true - * - * _.isLength(Number.MIN_VALUE); - * // => false - * - * _.isLength(Infinity); - * // => false - * - * _.isLength('3'); - * // => false - */ - function isLength(value) { - return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; - } - - /** `Object#toString` result references. */ - var argsTag$1 = '[object Arguments]', - arrayTag$1 = '[object Array]', - boolTag = '[object Boolean]', - dateTag = '[object Date]', - errorTag = '[object Error]', - funcTag = '[object Function]', - mapTag$1 = '[object Map]', - numberTag = '[object Number]', - objectTag$2 = '[object Object]', - regexpTag = '[object RegExp]', - setTag$1 = '[object Set]', - stringTag = '[object String]', - weakMapTag$1 = '[object WeakMap]'; - - var arrayBufferTag = '[object ArrayBuffer]', - dataViewTag$1 = '[object DataView]', - float32Tag = '[object Float32Array]', - float64Tag = '[object Float64Array]', - int8Tag = '[object Int8Array]', - int16Tag = '[object Int16Array]', - int32Tag = '[object Int32Array]', - uint8Tag = '[object Uint8Array]', - uint8ClampedTag = '[object Uint8ClampedArray]', - uint16Tag = '[object Uint16Array]', - uint32Tag = '[object Uint32Array]'; - - /** Used to identify `toStringTag` values of typed arrays. */ - var typedArrayTags = {}; - typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[ - int32Tag - ] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true; - typedArrayTags[argsTag$1] = typedArrayTags[arrayTag$1] = typedArrayTags[arrayBufferTag] = typedArrayTags[ - boolTag - ] = typedArrayTags[dataViewTag$1] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[ - funcTag - ] = typedArrayTags[mapTag$1] = typedArrayTags[numberTag] = typedArrayTags[objectTag$2] = typedArrayTags[ - regexpTag - ] = typedArrayTags[setTag$1] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag$1] = false; - - /** - * The base implementation of `_.isTypedArray` without Node.js optimizations. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. - */ - function baseIsTypedArray(value) { - return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)]; - } - - /** - * The base implementation of `_.unary` without support for storing metadata. - * - * @private - * @param {Function} func The function to cap arguments for. - * @returns {Function} Returns the new capped function. - */ - function baseUnary(func) { - return function (value) { - return func(value); - }; - } - - /** Detect free variable `exports`. */ - var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports; - - /** Detect free variable `module`. */ - var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module; - - /** Detect the popular CommonJS extension `module.exports`. */ - var moduleExports = freeModule && freeModule.exports === freeExports; - - /** Detect free variable `process` from Node.js. */ - var freeProcess = moduleExports && freeGlobal.process; - - /** Used to access faster Node.js helpers. */ - var nodeUtil = (function () { - try { - // Use `util.types` for Node.js 10+. - var types = freeModule && freeModule.require && freeModule.require('util').types; - - if (types) { - return types; - } - - // Legacy `process.binding('util')` for Node.js < 10. - return freeProcess && freeProcess.binding && freeProcess.binding('util'); - } catch (e) {} - })(); - - /* Node.js helper references. */ - var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray; - - /** - * Checks if `value` is classified as a typed array. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. - * @example - * - * _.isTypedArray(new Uint8Array); - * // => true - * - * _.isTypedArray([]); - * // => false - */ - var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray; - - /** Used for built-in method references. */ - var objectProto$4 = Object.prototype; - - /** Used to check objects for own properties. */ - var hasOwnProperty$3 = objectProto$4.hasOwnProperty; - - /** - * Creates an array of the enumerable property names of the array-like `value`. - * - * @private - * @param {*} value The value to query. - * @param {boolean} inherited Specify returning inherited property names. - * @returns {Array} Returns the array of property names. - */ - function arrayLikeKeys(value, inherited) { - var isArr = isArray(value), - isArg = !isArr && isArguments(value), - isBuff = !isArr && !isArg && isBuffer(value), - isType = !isArr && !isArg && !isBuff && isTypedArray(value), - skipIndexes = isArr || isArg || isBuff || isType, - result = skipIndexes ? baseTimes(value.length, String) : [], - length = result.length; - - for (var key in value) { - if ( - (inherited || hasOwnProperty$3.call(value, key)) && - !( - skipIndexes && - // Safari 9 has enumerable `arguments.length` in strict mode. - (key == 'length' || - // Node.js 0.10 has enumerable non-index properties on buffers. - (isBuff && (key == 'offset' || key == 'parent')) || - // PhantomJS 2 has enumerable non-index properties on typed arrays. - (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) || - // Skip index properties. - isIndex(key, length)) - ) - ) { - result.push(key); - } - } - return result; - } - - /** Used for built-in method references. */ - var objectProto$3 = Object.prototype; - - /** - * Checks if `value` is likely a prototype object. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a prototype, else `false`. - */ - function isPrototype(value) { - var Ctor = value && value.constructor, - proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto$3; - - return value === proto; - } - - /** - * Creates a unary function that invokes `func` with its argument transformed. - * - * @private - * @param {Function} func The function to wrap. - * @param {Function} transform The argument transform. - * @returns {Function} Returns the new function. - */ - function overArg(func, transform) { - return function (arg) { - return func(transform(arg)); - }; - } - - /* Built-in method references for those with the same name as other `lodash` methods. */ - var nativeKeys = overArg(Object.keys, Object); - - /** Used for built-in method references. */ - var objectProto$2 = Object.prototype; - - /** Used to check objects for own properties. */ - var hasOwnProperty$2 = objectProto$2.hasOwnProperty; - - /** - * The base implementation of `_.keys` which doesn't treat sparse arrays as dense. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names. - */ - function baseKeys(object) { - if (!isPrototype(object)) { - return nativeKeys(object); - } - var result = []; - for (var key in Object(object)) { - if (hasOwnProperty$2.call(object, key) && key != 'constructor') { - result.push(key); - } - } - return result; - } - - /** - * Checks if `value` is array-like. A value is considered array-like if it's - * not a function and has a `value.length` that's an integer greater than or - * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is array-like, else `false`. - * @example - * - * _.isArrayLike([1, 2, 3]); - * // => true - * - * _.isArrayLike(document.body.children); - * // => true - * - * _.isArrayLike('abc'); - * // => true - * - * _.isArrayLike(_.noop); - * // => false - */ - function isArrayLike(value) { - return value != null && isLength(value.length) && !isFunction(value); - } - - /** - * Creates an array of the own enumerable property names of `object`. - * - * **Note:** Non-object values are coerced to objects. See the - * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) - * for more details. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Object - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names. - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.keys(new Foo); - * // => ['a', 'b'] (iteration order is not guaranteed) - * - * _.keys('hi'); - * // => ['0', '1'] - */ - function keys(object) { - return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object); - } - - /** - * Creates an array of own enumerable property names and symbols of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names and symbols. - */ - function getAllKeys(object) { - return baseGetAllKeys(object, keys, getSymbols); - } - - /** Used to compose bitmasks for value comparisons. */ - var COMPARE_PARTIAL_FLAG$1 = 1; - - /** Used for built-in method references. */ - var objectProto$1 = Object.prototype; - - /** Used to check objects for own properties. */ - var hasOwnProperty$1 = objectProto$1.hasOwnProperty; - - /** - * A specialized version of `baseIsEqualDeep` for objects with support for - * partial deep comparisons. - * - * @private - * @param {Object} object The object to compare. - * @param {Object} other The other object to compare. - * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. - * @param {Function} customizer The function to customize comparisons. - * @param {Function} equalFunc The function to determine equivalents of values. - * @param {Object} stack Tracks traversed `object` and `other` objects. - * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. - */ - function equalObjects(object, other, bitmask, customizer, equalFunc, stack) { - var isPartial = bitmask & COMPARE_PARTIAL_FLAG$1, - objProps = getAllKeys(object), - objLength = objProps.length, - othProps = getAllKeys(other), - othLength = othProps.length; - - if (objLength != othLength && !isPartial) { - return false; - } - var index = objLength; - while (index--) { - var key = objProps[index]; - if (!(isPartial ? key in other : hasOwnProperty$1.call(other, key))) { - return false; - } - } - // Check that cyclic values are equal. - var objStacked = stack.get(object); - var othStacked = stack.get(other); - if (objStacked && othStacked) { - return objStacked == other && othStacked == object; - } - var result = true; - stack.set(object, other); - stack.set(other, object); - - var skipCtor = isPartial; - while (++index < objLength) { - key = objProps[index]; - var objValue = object[key], - othValue = other[key]; - - if (customizer) { - var compared = isPartial - ? customizer(othValue, objValue, key, other, object, stack) - : customizer(objValue, othValue, key, object, other, stack); - } - // Recursively compare objects (susceptible to call stack limits). - if ( - !(compared === undefined ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared) - ) { - result = false; - break; - } - skipCtor || (skipCtor = key == 'constructor'); - } - if (result && !skipCtor) { - var objCtor = object.constructor, - othCtor = other.constructor; - - // Non `Object` object instances with different constructors are not equal. - if ( - objCtor != othCtor && - 'constructor' in object && - 'constructor' in other && - !( - typeof objCtor == 'function' && - objCtor instanceof objCtor && - typeof othCtor == 'function' && - othCtor instanceof othCtor - ) - ) { - result = false; - } - } - stack['delete'](object); - stack['delete'](other); - return result; - } - - /* Built-in method references that are verified to be native. */ - var DataView = getNative(root, 'DataView'); - - /* Built-in method references that are verified to be native. */ - var Promise$1 = getNative(root, 'Promise'); - - /* Built-in method references that are verified to be native. */ - var Set = getNative(root, 'Set'); - - /* Built-in method references that are verified to be native. */ - var WeakMap = getNative(root, 'WeakMap'); - - /** `Object#toString` result references. */ - var mapTag = '[object Map]', - objectTag$1 = '[object Object]', - promiseTag = '[object Promise]', - setTag = '[object Set]', - weakMapTag = '[object WeakMap]'; - - var dataViewTag = '[object DataView]'; - - /** Used to detect maps, sets, and weakmaps. */ - var dataViewCtorString = toSource(DataView), - mapCtorString = toSource(Map), - promiseCtorString = toSource(Promise$1), - setCtorString = toSource(Set), - weakMapCtorString = toSource(WeakMap); - - /** - * Gets the `toStringTag` of `value`. - * - * @private - * @param {*} value The value to query. - * @returns {string} Returns the `toStringTag`. - */ - var getTag = baseGetTag; - - // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6. - if ( - (DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) || - (Map && getTag(new Map()) != mapTag) || - (Promise$1 && getTag(Promise$1.resolve()) != promiseTag) || - (Set && getTag(new Set()) != setTag) || - (WeakMap && getTag(new WeakMap()) != weakMapTag) - ) { - getTag = function (value) { - var result = baseGetTag(value), - Ctor = result == objectTag$1 ? value.constructor : undefined, - ctorString = Ctor ? toSource(Ctor) : ''; - - if (ctorString) { - switch (ctorString) { - case dataViewCtorString: - return dataViewTag; - case mapCtorString: - return mapTag; - case promiseCtorString: - return promiseTag; - case setCtorString: - return setTag; - case weakMapCtorString: - return weakMapTag; - } - } - return result; - }; - } - - var getTag$1 = getTag; - - /** Used to compose bitmasks for value comparisons. */ - var COMPARE_PARTIAL_FLAG = 1; - - /** `Object#toString` result references. */ - var argsTag = '[object Arguments]', - arrayTag = '[object Array]', - objectTag = '[object Object]'; - - /** Used for built-in method references. */ - var objectProto = Object.prototype; - - /** Used to check objects for own properties. */ - var hasOwnProperty = objectProto.hasOwnProperty; - - /** - * A specialized version of `baseIsEqual` for arrays and objects which performs - * deep comparisons and tracks traversed objects enabling objects with circular - * references to be compared. - * - * @private - * @param {Object} object The object to compare. - * @param {Object} other The other object to compare. - * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. - * @param {Function} customizer The function to customize comparisons. - * @param {Function} equalFunc The function to determine equivalents of values. - * @param {Object} [stack] Tracks traversed `object` and `other` objects. - * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. - */ - function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) { - var objIsArr = isArray(object), - othIsArr = isArray(other), - objTag = objIsArr ? arrayTag : getTag$1(object), - othTag = othIsArr ? arrayTag : getTag$1(other); - - objTag = objTag == argsTag ? objectTag : objTag; - othTag = othTag == argsTag ? objectTag : othTag; - - var objIsObj = objTag == objectTag, - othIsObj = othTag == objectTag, - isSameTag = objTag == othTag; - - if (isSameTag && isBuffer(object)) { - if (!isBuffer(other)) { - return false; - } - objIsArr = true; - objIsObj = false; - } - if (isSameTag && !objIsObj) { - stack || (stack = new Stack()); - return objIsArr || isTypedArray(object) - ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) - : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack); - } - if (!(bitmask & COMPARE_PARTIAL_FLAG)) { - var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'), - othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__'); - - if (objIsWrapped || othIsWrapped) { - var objUnwrapped = objIsWrapped ? object.value() : object, - othUnwrapped = othIsWrapped ? other.value() : other; - - stack || (stack = new Stack()); - return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack); - } - } - if (!isSameTag) { - return false; - } - stack || (stack = new Stack()); - return equalObjects(object, other, bitmask, customizer, equalFunc, stack); - } - - /** - * The base implementation of `_.isEqual` which supports partial comparisons - * and tracks traversed objects. - * - * @private - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @param {boolean} bitmask The bitmask flags. - * 1 - Unordered comparison - * 2 - Partial comparison - * @param {Function} [customizer] The function to customize comparisons. - * @param {Object} [stack] Tracks traversed `value` and `other` objects. - * @returns {boolean} Returns `true` if the values are equivalent, else `false`. - */ - function baseIsEqual(value, other, bitmask, customizer, stack) { - if (value === other) { - return true; - } - if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) { - return value !== value && other !== other; - } - return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack); - } - - /** - * Performs a deep comparison between two values to determine if they are - * equivalent. - * - * **Note:** This method supports comparing arrays, array buffers, booleans, - * date objects, error objects, maps, numbers, `Object` objects, regexes, - * sets, strings, symbols, and typed arrays. `Object` objects are compared - * by their own, not inherited, enumerable properties. Functions and DOM - * nodes are compared by strict equality, i.e. `===`. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @returns {boolean} Returns `true` if the values are equivalent, else `false`. - * @example - * - * var object = { 'a': 1 }; - * var other = { 'a': 1 }; - * - * _.isEqual(object, other); - * // => true - * - * object === other; - * // => false - */ - function isEqual(value, other) { - return baseIsEqual(value, other); - } - - class RendererManager { - constructor({game, rendererSystem}) { - this.renderers = []; - this.game = game; - this.rendererSystem = rendererSystem; - } - register(...renderers) { - for (const renderer of renderers) { - renderer.game = this.game; - renderer.rendererManager = this.rendererSystem.rendererManager; - renderer.containerManager = this.rendererSystem.containerManager; - this.renderers.push(renderer); - } - } - componentChanged(changes) { - for (const changed of changes) { - for (const renderer of this.renderers) { - const props = renderer.observerInfo[changed.componentName]; - if (props) { - if ([eva_js.OBSERVER_TYPE.ADD, eva_js.OBSERVER_TYPE.REMOVE].indexOf(changed.type) > -1) { - try { - renderer.componentChanged && renderer.componentChanged(changed); - } catch (e) { - console.error(`gameObject: ${changed.gameObject.name}, ${changed.componentName} is error.`, changed, e); - } - continue; - } - const index = props.findIndex(prop => { - return isEqual(prop, changed.prop); - }); - if (index > -1) { - try { - renderer.componentChanged && renderer.componentChanged(changed); - } catch (e) { - console.error( - `gameObject: ${changed.gameObject && changed.gameObject.name}, ${ - changed.componentName - } is componentChanged error.`, - changed, - e, - ); - } - } - } - } - } - } - update(gameObject) { - for (const component of gameObject.components) { - for (const renderer of this.renderers) { - const cache = []; - const props = renderer.observerInfo[component.name]; - if (props && cache.indexOf(gameObject) === -1) { - cache.push(gameObject); - try { - renderer.rendererUpdate && renderer.rendererUpdate(gameObject); - } catch (e) { - console.info(`gameObject: ${gameObject.name}, ${component.name} is update error`, e); - } - } - } - } - } - } - - class ContainerManager { - constructor() { - this.containerMap = {}; - } - addContainer({name, container}) { - this.containerMap[name] = container; - } - getContainer(name) { - return this.containerMap[name]; - } - removeContainer(name) { - var _a; - (_a = this.containerMap[name]) === null || _a === void 0 ? void 0 : _a.destroy(true); - delete this.containerMap[name]; - } - updateTransform({name, transform}) { - const container = this.containerMap[name]; - if (!container) return; - const {anchor, origin, position, rotation, scale, size, skew} = transform; - container.rotation = rotation; - container.scale = scale; - container.pivot.x = size.width * origin.x; - container.pivot.y = size.height * origin.y; - container.skew = skew; - let x = position.x; - let y = position.y; - if (transform.parent) { - const parent = transform.parent; - x = x + parent.size.width * anchor.x; - y = y + parent.size.height * anchor.y; - } - container.position = {x, y}; - } - } - - function createCommonjsModule(fn) { - var module = {exports: {}}; - return fn(module, module.exports), module.exports; - } - - var eventemitter3 = createCommonjsModule(function (module) { - var has = Object.prototype.hasOwnProperty, - prefix = '~'; - - /** - * Constructor to create a storage for our `EE` objects. - * An `Events` instance is a plain object whose properties are event names. - * - * @constructor - * @private - */ - function Events() {} - - // - // We try to not inherit from `Object.prototype`. In some engines creating an - // instance in this way is faster than calling `Object.create(null)` directly. - // If `Object.create(null)` is not supported we prefix the event names with a - // character to make sure that the built-in object properties are not - // overridden or used as an attack vector. - // - if (Object.create) { - Events.prototype = Object.create(null); - - // - // This hack is needed because the `__proto__` property is still inherited in - // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5. - // - if (!new Events().__proto__) prefix = false; - } - - /** - * Representation of a single event listener. - * - * @param {Function} fn The listener function. - * @param {*} context The context to invoke the listener with. - * @param {Boolean} [once=false] Specify if the listener is a one-time listener. - * @constructor - * @private - */ - function EE(fn, context, once) { - this.fn = fn; - this.context = context; - this.once = once || false; - } - - /** - * Add a listener for a given event. - * - * @param {EventEmitter} emitter Reference to the `EventEmitter` instance. - * @param {(String|Symbol)} event The event name. - * @param {Function} fn The listener function. - * @param {*} context The context to invoke the listener with. - * @param {Boolean} once Specify if the listener is a one-time listener. - * @returns {EventEmitter} - * @private - */ - function addListener(emitter, event, fn, context, once) { - if (typeof fn !== 'function') { - throw new TypeError('The listener must be a function'); - } - - var listener = new EE(fn, context || emitter, once), - evt = prefix ? prefix + event : event; - - if (!emitter._events[evt]) (emitter._events[evt] = listener), emitter._eventsCount++; - else if (!emitter._events[evt].fn) emitter._events[evt].push(listener); - else emitter._events[evt] = [emitter._events[evt], listener]; - - return emitter; - } - - /** - * Clear event by name. - * - * @param {EventEmitter} emitter Reference to the `EventEmitter` instance. - * @param {(String|Symbol)} evt The Event name. - * @private - */ - function clearEvent(emitter, evt) { - if (--emitter._eventsCount === 0) emitter._events = new Events(); - else delete emitter._events[evt]; - } - - /** - * Minimal `EventEmitter` interface that is molded against the Node.js - * `EventEmitter` interface. - * - * @constructor - * @public - */ - function EventEmitter() { - this._events = new Events(); - this._eventsCount = 0; - } - - /** - * Return an array listing the events for which the emitter has registered - * listeners. - * - * @returns {Array} - * @public - */ - EventEmitter.prototype.eventNames = function eventNames() { - var names = [], - events, - name; - - if (this._eventsCount === 0) return names; - - for (name in (events = this._events)) { - if (has.call(events, name)) names.push(prefix ? name.slice(1) : name); - } - - if (Object.getOwnPropertySymbols) { - return names.concat(Object.getOwnPropertySymbols(events)); - } - - return names; - }; - - /** - * Return the listeners registered for a given event. - * - * @param {(String|Symbol)} event The event name. - * @returns {Array} The registered listeners. - * @public - */ - EventEmitter.prototype.listeners = function listeners(event) { - var evt = prefix ? prefix + event : event, - handlers = this._events[evt]; - - if (!handlers) return []; - if (handlers.fn) return [handlers.fn]; - - for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) { - ee[i] = handlers[i].fn; - } - - return ee; - }; - - /** - * Return the number of listeners listening to a given event. - * - * @param {(String|Symbol)} event The event name. - * @returns {Number} The number of listeners. - * @public - */ - EventEmitter.prototype.listenerCount = function listenerCount(event) { - var evt = prefix ? prefix + event : event, - listeners = this._events[evt]; - - if (!listeners) return 0; - if (listeners.fn) return 1; - return listeners.length; - }; - - /** - * Calls each of the listeners registered for a given event. - * - * @param {(String|Symbol)} event The event name. - * @returns {Boolean} `true` if the event had listeners, else `false`. - * @public - */ - EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) { - var evt = prefix ? prefix + event : event; - - if (!this._events[evt]) return false; - - var listeners = this._events[evt], - len = arguments.length, - args, - i; - - if (listeners.fn) { - if (listeners.once) this.removeListener(event, listeners.fn, undefined, true); - - switch (len) { - case 1: - return listeners.fn.call(listeners.context), true; - case 2: - return listeners.fn.call(listeners.context, a1), true; - case 3: - return listeners.fn.call(listeners.context, a1, a2), true; - case 4: - return listeners.fn.call(listeners.context, a1, a2, a3), true; - case 5: - return listeners.fn.call(listeners.context, a1, a2, a3, a4), true; - case 6: - return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true; - } - - for (i = 1, args = new Array(len - 1); i < len; i++) { - args[i - 1] = arguments[i]; - } - - listeners.fn.apply(listeners.context, args); - } else { - var length = listeners.length, - j; - - for (i = 0; i < length; i++) { - if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true); - - switch (len) { - case 1: - listeners[i].fn.call(listeners[i].context); - break; - case 2: - listeners[i].fn.call(listeners[i].context, a1); - break; - case 3: - listeners[i].fn.call(listeners[i].context, a1, a2); - break; - case 4: - listeners[i].fn.call(listeners[i].context, a1, a2, a3); - break; - default: - if (!args) - for (j = 1, args = new Array(len - 1); j < len; j++) { - args[j - 1] = arguments[j]; - } - - listeners[i].fn.apply(listeners[i].context, args); - } - } - } - - return true; - }; - - /** - * Add a listener for a given event. - * - * @param {(String|Symbol)} event The event name. - * @param {Function} fn The listener function. - * @param {*} [context=this] The context to invoke the listener with. - * @returns {EventEmitter} `this`. - * @public - */ - EventEmitter.prototype.on = function on(event, fn, context) { - return addListener(this, event, fn, context, false); - }; - - /** - * Add a one-time listener for a given event. - * - * @param {(String|Symbol)} event The event name. - * @param {Function} fn The listener function. - * @param {*} [context=this] The context to invoke the listener with. - * @returns {EventEmitter} `this`. - * @public - */ - EventEmitter.prototype.once = function once(event, fn, context) { - return addListener(this, event, fn, context, true); - }; - - /** - * Remove the listeners of a given event. - * - * @param {(String|Symbol)} event The event name. - * @param {Function} fn Only remove the listeners that match this function. - * @param {*} context Only remove the listeners that have this context. - * @param {Boolean} once Only remove one-time listeners. - * @returns {EventEmitter} `this`. - * @public - */ - EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) { - var evt = prefix ? prefix + event : event; - - if (!this._events[evt]) return this; - if (!fn) { - clearEvent(this, evt); - return this; - } - - var listeners = this._events[evt]; - - if (listeners.fn) { - if (listeners.fn === fn && (!once || listeners.once) && (!context || listeners.context === context)) { - clearEvent(this, evt); - } - } else { - for (var i = 0, events = [], length = listeners.length; i < length; i++) { - if (listeners[i].fn !== fn || (once && !listeners[i].once) || (context && listeners[i].context !== context)) { - events.push(listeners[i]); - } - } - - // - // Reset the array, or remove it completely if we have no more listeners. - // - if (events.length) this._events[evt] = events.length === 1 ? events[0] : events; - else clearEvent(this, evt); - } - - return this; - }; - - /** - * Remove all listeners, or those of the specified event. - * - * @param {(String|Symbol)} [event] The event name. - * @returns {EventEmitter} `this`. - * @public - */ - EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) { - var evt; - - if (event) { - evt = prefix ? prefix + event : event; - if (this._events[evt]) clearEvent(this, evt); - } else { - this._events = new Events(); - this._eventsCount = 0; - } - - return this; - }; - - // - // Alias methods names because people roll like that. - // - EventEmitter.prototype.off = EventEmitter.prototype.removeListener; - EventEmitter.prototype.addListener = EventEmitter.prototype.on; - - // - // Expose the prefix. - // - EventEmitter.prefixed = prefix; - - // - // Allow `EventEmitter` to be imported as module namespace. - // - EventEmitter.EventEmitter = EventEmitter; - - // - // Expose the module. - // - { - module.exports = EventEmitter; - } - }); - - let Transform = class Transform extends eventemitter3 { - constructor({system, containerManager}) { - super(); - this.name = 'Transform'; - this.waitRemoveIds = []; - this.waitChangeScenes = []; - this.containerManager = containerManager; - this.init(system); - } - init(system) { - this.system = system; - this.on('changeScene', ({scene, mode, application}) => { - this.waitChangeScenes.push({scene, mode, application}); - }); - } - update() { - for (const id of this.waitRemoveIds) { - this.containerManager.removeContainer(id); - } - this.waitRemoveIds = []; - for (const sceneInfo of this.waitChangeScenes) { - const container = this.containerManager.getContainer(sceneInfo.scene.id); - if (container) { - sceneInfo.application.stage.removeChildren(); - sceneInfo.application.stage.addChild(container); - } - } - this.waitChangeScenes = []; - } - componentChanged(changed) { - if (changed.type === eva_js.OBSERVER_TYPE.ADD) { - this.addContainer(changed); - } else if (changed.type === eva_js.OBSERVER_TYPE.CHANGE) { - this.change(changed); - } else if (changed.type === eva_js.OBSERVER_TYPE.REMOVE) { - this.waitRemoveIds.push(changed.gameObject.id); - } - } - addContainer(changed) { - const container = new rendererAdapter.Container(); - container.name = changed.gameObject.name; - this.containerManager.addContainer({ - name: changed.gameObject.id, - container, - }); - const transform = changed.component; - transform.worldTransform = container.transform.worldTransform; - } - change(changed) { - const transform = changed.component; - if (transform.parent) { - const parentContainer = this.containerManager.getContainer(transform.parent.gameObject.id); - parentContainer.addChild(this.containerManager.getContainer(changed.gameObject.id)); - const render = - changed.gameObject.transform.parent && changed.gameObject.transform.parent.gameObject.getComponent('Render'); - if (render) { - render.sortDirty = true; - } - } else { - const container = this.containerManager.getContainer(changed.gameObject.id); - delete transform.worldTransform; - container.parent && container.parent.removeChild(container); - } - } - destroy() { - this.removeAllListeners(); - this.waitRemoveIds = null; - this.waitChangeScenes = null; - this.system = null; - this.containerManager = null; - } - }; - Transform = __decorate( - [ - eva_js.decorators.componentObserver({ - Transform: ['_parent'], - }), - ], - Transform, - ); - var Transform$1 = Transform; - - exports.RENDERER_TYPE = void 0; - (function (RENDERER_TYPE) { - RENDERER_TYPE[(RENDERER_TYPE['UNKNOWN'] = 0)] = 'UNKNOWN'; - RENDERER_TYPE[(RENDERER_TYPE['WEBGL'] = 1)] = 'WEBGL'; - RENDERER_TYPE[(RENDERER_TYPE['CANVAS'] = 2)] = 'CANVAS'; - })(exports.RENDERER_TYPE || (exports.RENDERER_TYPE = {})); - const disableScroll = renderer => { - renderer.plugins.interaction.autoPreventDefault = true; - renderer.view.style.touchAction = 'none'; - }; - const enableScroll = renderer => { - renderer.plugins.interaction.autoPreventDefault = false; - renderer.view.style.touchAction = 'auto'; - }; - let Renderer$1 = class Renderer extends eva_js.System { - constructor() { - super(...arguments); - this.multiApps = []; - } - init(params) { - this.params = params; - this.application = this.createApplication(params); - this.containerManager = new ContainerManager(); - this.rendererManager = new RendererManager({ - game: this.game, - rendererSystem: this, - }); - this.game.canvas = this.application.view; - this.transform = new Transform$1({ - system: this, - containerManager: this.containerManager, - }); - this.game.on('sceneChanged', ({scene, mode, params}) => { - let application; - switch (mode) { - case eva_js.LOAD_SCENE_MODE.SINGLE: - application = this.application; - break; - case eva_js.LOAD_SCENE_MODE.MULTI_CANVAS: - application = this.createMultiApplication({params}); - break; - } - scene.canvas = application.view; - this.transform.emit('changeScene', { - scene, - mode, - application, - }); - }); - } - registerObserver(observerInfo) { - const thisObserverInfo = this.constructor.observerInfo; - for (const key in observerInfo) { - if (!thisObserverInfo[key]) { - thisObserverInfo[key] = []; - } - thisObserverInfo[key].push(...observerInfo[key]); - } - } - createMultiApplication({params}) { - const app = this.createApplication(params); - this.multiApps.push(app); - return app; - } - createApplication(params) { - params.view = params.canvas; - if (params.renderType === exports.RENDERER_TYPE.CANVAS) { - params.forceCanvas = true; - } - pixi_js.ticker.shared.autoStart = false; - pixi_js.ticker.shared.stop(); - const app = new rendererAdapter.Application(Object.assign({sharedTicker: true}, params)); - if (params.preventScroll !== undefined) { - console.warn( - 'PreventScroll property will deprecate at next major version, please use enableEnable instead. https://eva.js.org/#/tutorials/game', - ); - params.preventScroll ? enableScroll(app.renderer) : disableScroll(app.renderer); - } - if (params.enableScroll !== undefined) { - params.enableScroll ? enableScroll(app.renderer) : disableScroll(app.renderer); - } - if (params.preventScroll === undefined && params.enableScroll === undefined) { - enableScroll(app.renderer); - } - return app; - } - update() { - const changes = this.componentObserver.clear(); - for (const changed of changes) { - this.transform.componentChanged(changed); - } - for (const gameObject of this.game.gameObjects) { - this.containerManager.updateTransform({ - name: gameObject.id, - transform: gameObject.transform, - }); - this.rendererManager.update(gameObject); - } - } - lateUpdate(e) { - this.transform.update(); - this.application.ticker.update(e.time); - } - onDestroy() { - this.application.destroy(); - for (const app of this.multiApps) { - app && app.destroy(); - } - this.transform.destroy(); - this.transform = null; - this.params = null; - this.rendererManager = null; - this.containerManager = null; - this.application = null; - this.game = null; - this.multiApps = null; - } - resize(width, height) { - this.params.width = width; - this.params.height = height; - this.application.renderer.resize(width, height); - } - }; - Renderer$1.systemName = 'Renderer'; - Renderer$1 = __decorate( - [ - eva_js.decorators.componentObserver({ - Transform: ['_parent'], - }), - ], - Renderer$1, - ); - var Renderer$2 = Renderer$1; - - class Renderer extends eva_js.System { - constructor(params) { - super(params); - this.observerInfo = this.constructor.observerInfo; - } - componentChanged(_changed) {} - rendererUpdate(_gameObject) {} - update() { - const changes = this.componentObserver.clear(); - for (const changed of changes) { - this.componentChanged(changed); - } - } - } - - exports.ContainerManager = ContainerManager; - exports.Renderer = Renderer; - exports.RendererManager = RendererManager; - exports.RendererSystem = Renderer$2; - - Object.defineProperty(exports, '__esModule', {value: true}); -}); diff --git a/dist/cdn/EVA.plugin.renderer.lottie.js b/dist/cdn/EVA.plugin.renderer.lottie.js deleted file mode 100644 index f16ef3ac..00000000 --- a/dist/cdn/EVA.plugin.renderer.lottie.js +++ /dev/null @@ -1,331 +0,0 @@ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@eva/eva.js'), require('@eva/plugin-renderer'), require('pixi.js')) : - typeof define === 'function' && define.amd ? define(['exports', '@eva/eva.js', '@eva/plugin-renderer', 'pixi.js'], factory) : - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.EVA = global.EVA || {}, global.EVA.plugin = global.EVA.plugin || {}, global.EVA.plugin.renderer = global.EVA.plugin.renderer || {}, global.EVA.plugin.renderer.lottie = {}), global.EVA, global.EVA.plugin.renderer, global.PIXI)); -}(this, (function (exports, eva_js, pluginRenderer, pixi_js) { 'use strict'; - - /*! ***************************************************************************** - Copyright (c) Microsoft Corporation. - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. - ***************************************************************************** */ - - function __rest(s, e) { - var t = {}; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) - t[p] = s[p]; - if (s != null && typeof Object.getOwnPropertySymbols === "function") - for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { - if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) - t[p[i]] = s[p[i]]; - } - return t; - } - - function __decorate(decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; - } - - function __awaiter(thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - } - - function t(t){return Object.prototype.toString.call(t)}const s={copyJSON:function(t){return JSON.parse(JSON.stringify(t))},isArray:function(){let s=t([]);return function(e){return t(e)===s}}(),isString:function(){let s=t("s");return function(e){return t(e)===s}}(),isNumber:function(){let s=t(1);return function(e){return t(e)===s}}(),isFunction:function(){let s=t((function(){}));return function(e){return t(e)===s}}(),isUndefined:function(t){return void 0===t},isBoolean:function(){let s=t(!0);return function(e){return t(e)===s}}(),isObject:function(){let s=t({});return function(e){return t(e)===s}}(),random:function(t,s){return this.isArray(t)?t[~~(Math.random()*t.length)]:(this.isNumber(s)||(s=t||1,t=0),t+Math.random()*(s-t))},euclideanModulo:function(t,s){return (t%s+s)%s},codomainBounce:function(t,s,e){return te?2*e-t:t},clamp:function(t,s,e){return te?e:t},inRange:(t,s,e)=>t>=s&&t<=e,getAssets(t,s){for(let e=0;e(t[0]<<16)+(t[1]<<8)+(0|t[2])};class e{constructor(){this.listeners={},this.addEventListener=this.on,this.removeEventListener=this.off;}on(t,e){return s.isFunction(e)?(s.isUndefined(this.listeners[t])&&(this.listeners[t]=[]),this.listeners[t].push(e),this):this}off(t,e){if(s.isUndefined(this.listeners[t]))return this;const i=this.listeners[t];let h=i.length;if(h>0)if(e)for(;h--;)i[h]===e&&i.splice(h,1);else i.length=0;return this}once(t,e){if(!s.isFunction(e))return this;const i=s=>{e(s),this.off(t,i);};return this.on(t,i),this}emit(t,...e){if(s.isUndefined(this.listeners[t]))return this;const i=(this.listeners[t]||[]).slice(0);for(let t=0;t=0;s-=1)if("sh"==t[s].ty)if(t[s].ks.k.i)l(t[s].ks.k);else for(i=t[s].ks.k.length,e=0;ee[0]||!(e[0]>t[0])&&(t[1]>e[1]||!(e[1]>t[1])&&(t[2]>e[2]||!(e[2]>t[2])&&void 0))}let c=function(){let t=[4,4,14];function s(t){let s=t.t.d;t.t.d={k:[{s:s,t:0}]};}function e(t){let e,i=t.length;for(e=0;e=0;e-=1)if("sh"==t[e].ty)if(t[e].ks.k.i)t[e].ks.k.c=t[e].closed;else for(h=t[e].ks.k.length,i=0;i=.001?function(t,s,e,i){for(let h=0;h<4;++h){let h=x(s,e,i);if(0===h)return s;s-=(S$1(s,e,i)-t)/h;}return s}(t,i,this.mX1,this.mX2):0===h?i:function(t,s,e,i,h){let r,a,n=0;do{a=s+(e-s)/2,r=S$1(a,i,h)-t,r>0?e=a:s=a;}while(Math.abs(r)>1e-7&&++n<10);return a}(t,s,s+.1,this.mX1,this.mX2)},M$1.prototype.get=function(t){return this.mX1===this.mY1&&this.mX2===this.mY2?t:0===t?0:1===t?1:S$1(this._getTForX(t),this.mY1,this.mY2)};const P={};var T$1={getBezierEasing:function(t,s,e,i,h){const r=h||("bez_"+t+"_"+s+"_"+e+"_"+i).replace(/\./g,"p");if(P[r])return P[r];const a=new M$1(t,s,e,i);return P[r]=a,a}};let w;function D$1(t){return new Array(t)}w="function"==typeof Uint8ClampedArray&&"function"==typeof Float32Array?function(t,s){return "float32"===t?new Float32Array(s):"int16"===t?new Int16Array(s):"uint8c"===t?new Uint8ClampedArray(s):void 0}:function(t,s){let e=0;const i=[];let h;switch(t){case"int16":case"uint8c":h=1;break;default:h=1.1;}for(e=0;e=this._maxLength&&this.doubleArrayLength(),e){case"v":r=this.v;break;case"i":r=this.i;break;case"o":r=this.o;}(!r[i]||r[i]&&!h)&&(r[i]=A$1.newElement()),r[i][0]=t,r[i][1]=s;}setTripleAt(t,s,e,i,h,r,a,n){this.setXYAt(t,s,"v",a,n),this.setXYAt(e,i,"o",a,n),this.setXYAt(h,r,"i",a,n);}reverse(){const t=new C$1;t.setPathData(this.c,this._length);const s=this.v,e=this.o,i=this.i;let h=0;this.c&&(t.setTripleAt(s[0][0],s[0][1],i[0][0],i[0][1],e[0][0],e[0][1],0,!1),h=1);let r=this._length-1;const a=this._length;for(let n=h;n-.001&&a<.001}function z$1(t,s,e,i){let h,r=0;const a=[],n=[],o=X$1.newElement(),l=e.length;for(let p=0;p<200;p+=1){const c=p/199;h=0;for(let r=0;ra?-1:1;let s=!0;for(;s;)if(i[r]<=a&&i[r+1]>a?(n=(a-i[r])/(i[r+1]-i[r]),s=!1):r+=t,r<0||r>=h-1){if(r===h-1)return e[r];s=!1;}return e[r]+(e[r+1]-e[r])*n}}const J$1=w("float32",8);var H$1={getSegmentsLength:function(t){const s=Y$1.newElement(),e=t.c,i=t.v,h=t.o,r=t.i,a=t._length,n=s.lengths;let o=0,l=0;for(;l1?1:h,a),o=G$1(r=r>1?1:r,a),l=t.length,p=1-n,c=1-o,d=p*p*p,u=n*p*p*3,f=n*n*p*3,m=n*n*n,g=p*p*c,y=n*p*c+p*n*c+p*p*o,v=n*n*c+p*n*o+n*p*o,_=n*n*o,k=p*c*c,S=n*c*c+p*o*c+p*c*o,x=n*o*c+p*o*o+n*c*o,M=n*o*o,P=c*c*c,T=o*c*c+c*o*c+c*c*o,w=o*o*c+c*o*o+o*c*o,D=o*o*o;for(let h=0;hp?l>c?l-p-c:c-p-l:c>p?c-p-l:p-l-c,d>-1e-4&&d<1e-4}};const U$1=Math.PI/180,Z$1=[0,0],Q=/(loopIn|loopOut)\(([^)]+)/,W$1=/["']\w+["']/;class $$1{constructor(t,s,e){this.begin=s,this.end=e,this.total=this.end-this.begin,this.type=t;}update(t){return "in"===this.type?t>=this.begin?t:this.end-s.euclideanModulo(this.begin-t,this.total):"out"===this.type?t<=this.end?t:this.begin+s.euclideanModulo(t-this.end,this.total):void 0}}class tt{constructor(t,s,e){this.begin=s,this.end=e,this.total=this.end-this.begin,this.type=t;}update(t){if("in"===this.type&&tthis.end){const s=t-this.end;return this.pingpong(s)}return t}pingpong(t){return Math.floor(t/this.total)%2?this.begin+s.euclideanModulo(t,this.total):this.end-s.euclideanModulo(t,this.total)}}const st={loopIn(t,s,e){const i=t[0].t,h=t.length-1,r=t[Math.min(h,e)].t;switch(s){case"cycle":return new $$1("in",i,r);case"pingpong":return new tt("in",i,r)}return null},loopOut(t,s,e){const i=t.length-1,h=t[Math.max(0,i-e)].t,r=t[i].t;switch(s){case"cycle":return new $$1("out",h,r);case"pingpong":return new tt("out",h,r)}return null}};function et(t){const s=t.match(Q),e=s[2].split(/\s*,\s*/).map(t=>W$1.test(t)?t.replace(/"|'/g,""):parseInt(t));return {name:s[1],mode:e[0],offset:e[1]}}var it={hasSupportExpression:function(t){return t.x&&Q.test(t.x)},getExpression:function(t){const{name:s,mode:e,offset:i=0}=et(t.x),h=0===i?t.k.length-1:i;return st[s]&&st[s](t.k,e,h)}};function ht(t){const s=t[0]*U$1,e=t[1]*U$1,i=t[2]*U$1,h=Math.cos(s/2),r=Math.cos(e/2),a=Math.cos(i/2),n=Math.sin(s/2),o=Math.sin(e/2),l=Math.sin(i/2);return [n*o*a+h*r*l,n*r*a+h*o*l,h*o*a-n*r*l,h*r*a-n*o*l]}class rt{interpolateValue(t,s){let e;"multidimensional"===this.propType&&(e=w("float32",this.pv.length));let i,h,r,a,n,o,l,p,c=s.lastIndex,d=c,u=this.keyframes.length-1,f=!0;for(;f;){if(i=this.keyframes[d],h=this.keyframes[d+1],d===u-1&&t>=h.t){i.h&&(i=h),c=0;break}if(h.t>t){c=d;break}d=g||t=g?c.points.length-1:0;for(a=c.points[s].point.length,r=0;r=m&&u=g)e[0]=m[0],e[1]=m[1],e[2]=m[2];else if(t<=y)e[0]=i.s[0],e[1]=i.s[1],e[2]=i.s[2];else {!function(t,s){const e=s[0],i=s[1],h=s[2],r=s[3],a=Math.atan2(2*i*r-2*e*h,1-2*i*i-2*h*h),n=Math.asin(2*e*i+2*h*r),o=Math.atan2(2*e*r-2*i*h,1-2*e*e-2*h*h);t[0]=a/U$1,t[1]=n/U$1,t[2]=o/U$1;}(e,function(t,s,e){const i=[],h=t[0],r=t[1],a=t[2],n=t[3];let o,l,p,c,d,u=s[0],f=s[1],m=s[2],g=s[3];return l=h*u+r*f+a*m+n*g,l<0&&(l=-l,u=-u,f=-f,m=-m,g=-g),1-l>1e-6?(o=Math.acos(l),p=Math.sin(o),c=Math.sin((1-e)*o)/p,d=Math.sin(e*o)/p):(c=1-e,d=e),i[0]=c*h+d*u,i[1]=c*r+d*f,i[2]=c*a+d*m,i[3]=c*n+d*g,i}(ht(i.s),ht(m),(t-y)/(g-y)));}else for(d=0;d=g?n=1:t=e&&t>=e||this._caching.lastFrame=t&&(this._caching._lastKeyframeIndex=-1,this._caching.lastIndex=0);let s=this.interpolateValue(t,this._caching);this.pv=s;}return this._caching.lastFrame=t,this.pv}setVValue(t){let s;if("unidimensional"===this.propType)s=t*this.mult,Math.abs(this.v-s)>1e-5&&(this.v=s,this._mdf=!0);else {let e=0;const i=this.v.length;for(;e1e-5&&(this.v[e]=s,this._mdf=!0),e+=1;}}processEffectsSequence(t){if(this.expression&&(t=this.expression.update(t)),t===this.frameId||!this.effectsSequence.length)return;if(this.lock)return void this.setVValue(this.pv);let s;this.lock=!0,this._mdf=this._isFirstFrame;let e=this.effectsSequence.length,i=this.kf?this.pv:this.data.k;for(s=0;s=u[u.length-1].t)i=u[u.length-1].s?u[u.length-1].s[0]:u[u.length-2].e[0],r=!0;else {let s,e,a=d,n=u.length-1,o=!0;for(;o&&(s=u[a],e=u[a+1],!(e.t>t));)a=e.t)p=1;else if(te&&t>e)||(this._caching.lastIndex=i0||t>-1e-6&&t<0?i(1e4*t)/1e4:t}function b(){var t=this.props;return "matrix("+C(t[0])+","+C(t[1])+","+C(t[4])+","+C(t[5])+","+C(t[12])+","+C(t[13])+")"}return function(){this.reset=h,this.rotate=r,this.rotateX=a,this.rotateY=n,this.rotateZ=o,this.skew=p,this.skewFromAxis=c,this.shear=l,this.scale=d,this.setTransform=u,this.translate=f,this.transform=m,this.applyToPoint=k,this.applyToX=S,this.applyToY=x,this.applyToZ=M,this.applyToPointArray=L,this.applyToTriplePoints=D,this.applyToPointStringified=F,this.toCSS=A,this.to2dCSS=b,this.clone=v,this.cloneFromProps=_,this.equals=y,this.inversePoints=T,this.inversePoint=P,this._t=this.transform,this.isIdentity=g,this._identity=!0,this._identityCalculated=!1,this.props=w("float32",16),this.reset();}}();class St{constructor(){this.sequences={},this.sequenceList=[],this.transform_key_count=0;}addTransformSequence(t){const s=t.length;let e="_";for(let i=0;i=0;e-=1)s=t.transforms[e].transform.mProps.v.props,t.finalTransform.transform(s[0],s[1],s[2],s[3],s[4],s[5],s[6],s[7],s[8],s[9],s[10],s[11],s[12],s[13],s[14],s[15]);}t._mdf=i;}processSequences(t){const s=this.sequenceList.length;for(let e=0;e=this.p.keyframes[this.p.keyframes.length-1].t?(t=this.p.getValueAtTime(this.p.keyframes[this.p.keyframes.length-1].t/e,0),s=this.p.getValueAtTime((this.p.keyframes[this.p.keyframes.length-1].t-.05)/e,0)):(t=this.p.pv,s=this.p.getValueAtTime((this.p._caching.lastFrame+this.p.offsetTime-.01)/e,this.p.offsetTime));else if(this.px&&this.px.keyframes&&this.py.keyframes&&this.px.getValueAtTime&&this.py.getValueAtTime){t=[],s=[];let i=this.px,h=this.py;i._caching.lastFrame+i.offsetTime<=i.keyframes[0].t?(t[0]=i.getValueAtTime((i.keyframes[0].t+.01)/e,0),t[1]=h.getValueAtTime((h.keyframes[0].t+.01)/e,0),s[0]=i.getValueAtTime(i.keyframes[0].t/e,0),s[1]=h.getValueAtTime(h.keyframes[0].t/e,0)):i._caching.lastFrame+i.offsetTime>=i.keyframes[i.keyframes.length-1].t?(t[0]=i.getValueAtTime(i.keyframes[i.keyframes.length-1].t/e,0),t[1]=h.getValueAtTime(h.keyframes[h.keyframes.length-1].t/e,0),s[0]=i.getValueAtTime((i.keyframes[i.keyframes.length-1].t-.01)/e,0),s[1]=h.getValueAtTime((h.keyframes[h.keyframes.length-1].t-.01)/e,0)):(t=[i.pv,h.pv],s[0]=i.getValueAtTime((i._caching.lastFrame+i.offsetTime-.01)/e,i.offsetTime),s[1]=h.getValueAtTime((h._caching.lastFrame+h.offsetTime-.01)/e,h.offsetTime));}else t=s=Z$1;this.v.rotate(-Math.atan2(t[1]-s[1],t[0]-s[0]));}this.data.p&&this.data.p.s?this.data.p.z?this.v.translate(this.px.v,this.py.v,-this.pz.v):this.v.translate(this.px.v,this.py.v,0):this.v.translate(this.p.v[0],this.p.v[1],-this.p.v[2]);}this.frameId=t;}}precalculateMatrix(){if(!this.a.k&&(this.pre.translate(-this.a.v[0],-this.a.v[1],this.a.v[2]),this.appliedTransformations=1,!this.s.effectsSequence.length)){if(this.pre.scale(this.s.v[0],this.s.v[1],this.s.v[2]),this.appliedTransformations=2,this.sk){if(this.sk.effectsSequence.length||this.sa.effectsSequence.length)return;this.pre.skewFromAxis(-this.sk.v,this.sa.v),this.appliedTransformations=3;}if(this.r){if(this.r.effectsSequence.length)return;this.pre.rotate(-this.r.v),this.appliedTransformations=4;}else this.rz.effectsSequence.length||this.ry.effectsSequence.length||this.rx.effectsSequence.length||this.or.effectsSequence.length||(this.pre.rotateZ(-this.rz.v).rotateY(this.ry.v).rotateX(this.rx.v).rotateZ(-this.or.v[2]).rotateY(this.or.v[1]).rotateX(this.or.v[0]),this.appliedTransformations=4);}}applyToMatrix(t){let s=this._mdf;this.iterateDynamicProperties(),this._mdf=this._mdf||s,this.a&&t.translate(-this.a.v[0],-this.a.v[1],this.a.v[2]),this.s&&t.scale(this.s.v[0],this.s.v[1],this.s.v[2]),this.sk&&t.skewFromAxis(-this.sk.v,this.sa.v),this.r?t.rotate(-this.r.v):t.rotateZ(-this.rz.v).rotateY(this.ry.v).rotateX(this.rx.v).rotateZ(-this.or.v[2]).rotateY(this.or.v[1]).rotateX(this.or.v[0]),this.data.p.s?this.data.p.z?t.translate(this.px.v,this.py.v,-this.pz.v):t.translate(this.px.v,this.py.v,0):t.translate(this.p.v[0],this.p.v[1],-this.p.v[2]);}}function Ft(t,s,e){return new Lt(t,s,e)}class At extends O$1{initModifierProperties(){}addShapeToModifier(){}addShape(t){if(!this.closed){t.sh.container.addDynamicProperty(t.sh);const s={shape:t.sh,data:t,localShapeCollection:q$1.newShapeCollection()};this.shapes.push(s),this.addShapeToModifier(s),this._isAnimated&&t.setAsAnimated();}}init(t,s){this.shapes=[],this.elem=t,this.initDynamicPropertyContainer(t),this.initModifierProperties(t,s),this.frameId=-999999,this.closed=!1,this.k=!1,this.dynamicProperties.length?this.k=!0:this.getValue(!0);}processKeys(t){t!==this.frameId&&(this.frameId=t,this.iterateDynamicProperties(t));}}const Ct={};function bt(t,s){Ct[t]||(Ct[t]=s);}bt("tm",class extends At{initModifierProperties(t,s){this.s=pt.getProp(t,s.s,0,.01,this),this.e=pt.getProp(t,s.e,0,.01,this),this.o=pt.getProp(t,s.o,0,0,this),this.sValue=0,this.eValue=0,this.getValue=this.processKeys,this.m=s.m,this._isAnimated=!!this.s.effectsSequence.length||!!this.e.effectsSequence.length||!!this.o.effectsSequence.length;}addShapeToModifier(t){t.pathsData=[];}calculateShapeEdges(t,s,e,i,h){let r=[];s<=1?r.push({s:t,e:s}):t>=1?r.push({s:t-1,e:s-1}):(r.push({s:t,e:1}),r.push({s:0,e:s-1}));let a,n,o=[],l=r.length;for(a=0;ai+e);else {let t,s;t=n.s*h<=i?0:(n.s*h-i)/e,s=n.e*h>=i+e?1:(n.e*h-i)/e,o.push([t,s]);}return o.length||o.push([0,0]),o}releasePathsData(t){const s=t.length;for(let e=0;e1?1:this.s.v<0?0:this.s.v)+t,e=(this.e.v>1?1:this.e.v<0?0:this.e.v)+t,s>e){let t=s;s=e,e=t;}s=1e-4*Math.round(1e4*s),e=1e-4*Math.round(1e4*e),this.sValue=s,this.eValue=e;}else s=this.sValue,e=this.eValue;let r,a,n,o,l,p=this.shapes.length,c=0;if(e===s)for(h=0;h=0;h-=1)if(d=this.shapes[h],d.shape._mdf){for(u=d.localShapeCollection,u.releaseShapes(),2===this.m&&p>1?(m=this.calculateShapeEdges(s,e,d.totalShapeLength,v,c),v+=d.totalShapeLength):m=[[g,y]],a=m.length,r=0;r=1?f.push({s:d.totalShapeLength*(g-1),e:d.totalShapeLength*(y-1)}):(f.push({s:d.totalShapeLength*g,e:d.totalShapeLength}),f.push({s:0,e:d.totalShapeLength*(y-1)}));let t=this.addShapes(d,f[0]);if(f[0].s!==f[0].e){if(f.length>1){if(d.shape.paths.shapes[d.shape.paths._length-1].c){let s=t.pop();this.addPaths(t,u),t=this.addShapes(d,f[1],s);}else this.addPaths(t,u),t=this.addShapes(d,f[1]);}this.addPaths(t,u);}}d.shape.paths=u;}}}addPaths(t,s){const e=t.length;for(let i=0;is.e){e.c=!1;break}s.s<=f&&s.e>=f+a.addedLength?(this.addSegment(d[i].v[h-1],d[i].o[h-1],d[i].i[h],d[i].v[h],e,n,g),g=!1):(l=H$1.getNewSegment(d[i].v[h-1],d[i].v[h],d[i].o[h-1],d[i].i[h],(s.s-f)/a.addedLength,(s.e-f)/a.addedLength,o[h-1]),this.addSegmentFromArray(l,e,n,g),g=!1,e.c=!1),f+=a.addedLength,n+=1;}if(d[i].c&&o.length){if(a=o[h-1],f<=s.e){let t=o[h-1].addedLength;s.s<=f&&s.e>=f+t?(this.addSegment(d[i].v[h-1],d[i].o[h-1],d[i].i[0],d[i].v[0],e,n,g),g=!1):(l=H$1.getNewSegment(d[i].v[h-1],d[i].v[0],d[i].o[h-1],d[i].i[0],(s.s-f)/t,(s.e-f)/t,o[h-1]),this.addSegmentFromArray(l,e,n,g),g=!1,e.c=!1);}else e.c=!1;f+=a.addedLength,n+=1;}if(e._length&&(e.setXYAt(e.v[p][0],e.v[p][1],"i",p),e.setXYAt(e.v[e._length-1][0],e.v[e._length-1][1],"o",e._length-1)),f>s.e)break;i0;)e-=1,this._elements.unshift(s[e]);this.dynamicProperties.length?this.k=!0:this.getValue(!0);}resetElements(t){const s=t.length;for(let e=0;e0?Math.floor(h):Math.ceil(h),n=this.pMatrix.props,o=this.rMatrix.props,l=this.sMatrix.props;this.pMatrix.reset(),this.rMatrix.reset(),this.sMatrix.reset(),this.tMatrix.reset(),this.matrix.reset();let p=0;if(h>0){for(;pa;)this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,1,!0),p-=1;r&&(this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,-r,!0),p-=r);}s=1===this.data.m?0:this._currentCopies-1;const c=1===this.data.m?1:-1;for(i=this._currentCopies;i;){const t=this.elemsData[s].it,e=t[t.length-1].transform.mProps.v.props,h=e.length;if(t[t.length-1].transform.mProps._mdf=!0,t[t.length-1].transform.op._mdf=!0,t[t.length-1].transform.op.v=this.so.v+(this.eo.v-this.so.v)*(s/(this._currentCopies-1)),0!==p){(0!==s&&1===c||s!==this._currentCopies-1&&-1===c)&&this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,1,!1),this.matrix.transform(o[0],o[1],o[2],o[3],o[4],o[5],o[6],o[7],o[8],o[9],o[10],o[11],o[12],o[13],o[14],o[15]),this.matrix.transform(l[0],l[1],l[2],l[3],l[4],l[5],l[6],l[7],l[8],l[9],l[10],l[11],l[12],l[13],l[14],l[15]),this.matrix.transform(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7],n[8],n[9],n[10],n[11],n[12],n[13],n[14],n[15]);for(let t=0;t.01)return !1;i+=1;}return !0}checkCollapsable(){if(this.o.length/2!=this.c.length/4)return !1;if(this.data.k.k[0].s){let t=0,s=this.data.k.k.length;for(;t=0;s-=1)this.shapeModifiers[s].processShapes(t,this._isFirstFrame);}searchProcessedElement(t){let s=this.processedElements,e=0,i=s.length;for(;e=0;r-=1){if(o=this.searchProcessedElement(t[r]),o?s[r]=e[o-1]:t[r]._shouldRender=i,"fl"==t[r].ty||"st"==t[r].ty||"gf"==t[r].ty||"gs"==t[r].ty)o?s[r].style.closed=!1:s[r]=this.createStyleElement(t[r],f),d.push(s[r].style);else if("gr"==t[r].ty){if(o)for(n=s[r].it.length,a=0;a=0;h-=1)"tr"==s[h].ty?(i=e[h].transform,this.updateShapeTransform(t,i)):"sh"==s[h].ty||"el"==s[h].ty||"rc"==s[h].ty||"sr"==s[h].ty?this.updatePath(s[h],e[h]):"fl"==s[h].ty?this.updateFill(s[h],e[h],i):"st"==s[h].ty?this.updateStroke(s[h],e[h],i):"gf"==s[h].ty||"gs"==s[h].ty?this.updateGradientFill(s[h],e[h],i):"gr"==s[h].ty&&this.updateShape(i,s[h].it,e[h].it);}updateGrahpics(){const t=this.stylesList.length;for(let s=0;s=e.op-e.st,this.isOverlapMode=i.overlapMode,this.parseLayer(t,s);}outTypeExpressionMode(){this._hasOutTypeExpression=!0,this.isOverlapLayer&&(this.needUpdateOverlap=!0);}prepareProperties(t,s){let e,i=this.dynamicProperties.length;for(e=0;e=this.layer.ip:this.visible=e,this.prepareProperties(t,e);}updateDisplay(){const t=this.elem.display;this.elem._isRoot||(this.visible?t.show():t.hide(),(this._mdf||this.transform._mdf||this._isFirstFrame)&&t.updateLottieTransform(this.transform),this.masks&&(this.masks._mdf||this._isFirstFrame)&&t.updateLottieMasks(this.masks)),this._isFirstFrame=!1;}}class Xt{constructor(t){this.data=t,void 0===this.data.sr&&(this.data.sr=1),this.offsetTime=t.st||0,this.fullname=t.nm||"",this.idname=t.ln||"",this.classnames=t.cl?t.cl.split(" "):[],this.bodymovin=new Ot(this),this.displayType="",this.display=null,this.hierarchy=null,this.lottieTreeParent=null;}initBodymovin(t,s){this.bodymovin.initFrame(t,s),this.display&&this.display.onSetupLottie&&this.display.onSetupLottie();}hasValidMasks(){return !(!this.bodymovin.masks||!this.bodymovin.masks.hasMasks)}setHierarchy(t){this.hierarchy=t,this.display.setHierarchy(t.display);}initDisplayInstance(t,s){return new(Tt(t))(this,s)}updateFrame(t){this.bodymovin.updateFrame(t),this.bodymovin.updateDisplay();}}class Yt extends Xt{constructor(t,s){super(t);const{global:e}=s;this.session=s;const i={layer:t,session:s};if(e.maskComp){i.maskComp=e.maskComp;const{w:s,h:h}=t;i.viewport={w:s,h:h};}this.config=i,this.childNodes=[],this.displayType=wt.Type.Component,this.innerDisplay=null,this.display=this.initDisplayInstance(this.displayType,i),this.initBodymovin(t,s);}updateFrame(t){if(this.bodymovin.updateFrame(t),this.bodymovin.updateDisplay(),t-=this.offsetTime,this.bodymovin.tm){let s=this.bodymovin.tm.v;s===this.data.op&&(s=this.data.op-1),t=s;}else t/=this.data.sr;for(let s=0;s{this._setupDate(t);}),this.jsonLoader.once("error",t=>{this.emit("error",t);});}}_setupDate(t){this._sourceData=t,this._copyJSON&&(t=s.copyJSON(t)),g.completeData(t),this.keyframes=t;const{w:e,h:r,st:a=0,fr:n,ip:o,op:l,assets:p}=t;this.frameRate=n,this.frameMult=n/1e3,this._defaultSegment=[o,l];const c=this._segmentName&&this.segments[this._segmentName]||this._defaultSegment;this.beginFrame=c[0],this.endFrame=c[1],this._timePerFrame=1e3/n,this.duration=Math.floor(this.endFrame-this.beginFrame);let d=null;const u=p.filter(t=>t.u||t.p);u.length>0?(this.textureLoader=d=function(t,s){const e=i[h.Texture];return e||console.warn("must register an image loader, before you parse an animation some has image assets"),e(t,s)}(u,{prefix:this._prefix,autoLoad:this._autoLoad}),d.loaded?(this.isImagesLoaded=!0,this.isPaused=!this._autoStart,this.emit("ImageReady")):(d.once("complete",()=>{this.isImagesLoaded=!0,this.emit("ImageReady");}),null!==this._pausedNeedSet&&(this._pausedNeedSet=!0,d.once("complete",()=>{this._pausedNeedSet&&(this._pausedNeedSet=!1,this.isPaused=!this._autoStart);})))):(this.isImagesLoaded=!0,this.isPaused=!this._autoStart);const f={global:{assets:p,textureLoader:d,frameRate:n,maskComp:this._maskComp,overlapMode:this.overlapMode},local:{w:e,h:r,ip:o,op:l,st:a}};this._buildElements(f),null!==this.textureLoader&&this._justDisplayOnImagesLoaded&&!this.textureLoader.loaded&&null!==this._justDisplayNeedSet&&(this.group.visible=!1,this._justDisplayNeedSet=!0,this.textureLoader.once("complete",()=>{this._justDisplayNeedSet&&(this._justDisplayNeedSet=!1,this.group.visible=!0);})),this.isDisplayLoaded=!0,this.update(0,!0);}_buildElements(t){this.root=this._extraCompositions(this.keyframes,t,!0),this.display=this.root.display,this.group.addChild(this.display),this.emit("DOMLoaded").emit("DisplayReady"),null===this.textureLoader?this.emit("success"):this.textureLoader.loaded?this.emit("success"):this.textureLoader.once("complete",()=>this.emit("success"));}_extraCompositions(t,{global:e,local:i},h=!1){const{w:r,h:a,ip:n,op:o,st:l=0}=t,p=new Yt(t,{global:e,local:i});p._isRoot=h;const c=t.layers||s.getAssets(t.refId,e.assets).layers,d={global:e,local:{w:r,h:a,ip:n,op:o,st:l}},u=this._createElements(c,d);for(let t=c.length-1;t>=0;t--){const e=c[t],i=u[e.ind];if(i){if(!s.isUndefined(e.parent)){const t=u[e.parent];t._isParent=!0,i.setHierarchy(t);}p.addChild(i);}}return p}_createElements(t,s){const e={};for(let i=t.length-1;i>=0;i--){const h=t[i];let r=null;if(void 0===h.td){switch(h.ty){case 0:r=this._extraCompositions(h,s);break;case 1:r=new jt(h,s);break;case 2:r=new zt(h,s);break;case 3:r=new Rt(h,s);break;case 4:r=new Bt(h,s);break;default:continue}r&&(void 0===h.ind&&(h.ind=i),e[h.ind]=r,r.name=h.nm||null);}}return e}getDisplayByQuerySelector(t){const s=this.querySelector(t);return s&&s.display?s.display:(console.warn("can not find display which query with ",t),null)}_queryMatch(t,s,e){const i=t.substr(0,1),h=t.substr(1,t.length);let r=!1;return r="#"===i?s.idname===h:"."===i?-1!==s.classnames.indexOf(h):s.fullname===t,r&&e.push(s),r}_searchNodes(t,s,e,i=!1){if(s.childNodes&&s.childNodes.length>0){const h=[];for(let r=0;r0&&h.push(a);}for(let s=0;s>0;this._lastFrame!==h&&(this._emitFrame(this.direction>0?h:this._lastFrame),this._lastFrame=h),!1===e?(this.emit("enterFrame",i),this.emit("update",this.frameNum/this.duration)):this.hadEnded!==e&&!0===e&&this.emit("complete"),this.hadEnded=e;}_updateTime(t){const e=this.direction*this.timeScale*t;if(this._waitCut>0)return this._waitCut-=Math.abs(e),null;if(this.isPaused||this._delayCut>0)return this._delayCut>0&&(this._delayCut-=Math.abs(e)),null;this.frameNum+=e/this._timePerFrame;let i=!1;return this._spill()&&(this._repeatsCut>0||this.infinite?(this._repeatsCut>0&&--this._repeatsCut,this._delayCut=this.delay,this.alternate?(this.direction*=-1,this.frameNum=s.codomainBounce(this.frameNum,0,this.duration)):(this.direction=1,this.frameNum=s.euclideanModulo(this.frameNum,this.duration)),this.emit("loopComplete")):(this.overlapMode||(this.frameNum=s.clamp(this.frameNum,0,this.duration),this.living=!1),i=!0)),i}_spill(){const t=this.frameNum<=0&&-1===this.direction,s=this.frameNum>=this.duration&&1===this.direction;return t||s}frameToTime(t){return t*this._timePerFrame}setSpeed(t){this.timeScale=t;}playSegment(t,e={}){if(!t)return;let i=null;s.isArray(t)?i=t:s.isString(t)&&(i=this.segments[t],s.isArray(i)&&(this._segmentName=t)),s.isArray(i)&&(this.beginFrame=s.isNumber(i[0])?i[0]:this._defaultSegment[0],this.endFrame=s.isNumber(i[1])?i[1]:this._defaultSegment[1],s.isNumber(e.repeats)&&(this.repeats=e.repeats),s.isBoolean(e.infinite)&&(this.infinite=e.infinite),s.isBoolean(e.alternate)&&(this.alternate=e.alternate),s.isNumber(e.wait)&&(this.wait=e.wait),s.isNumber(e.delay)&&(this.delay=e.delay),this.replay());}goToAndStop(t,s=!1){this.frameNum=s?t:t*this.frameMult,this.update(0,!0),this.pause();}goToAndPlay(t,s=!1){this.frameNum=s?t:t*this.frameMult,this.update(0,!0),this.resume();}getDuration(t){const s=this.endFrame-this.beginFrame;return t?s:s/this.frameRate}setDirection(t){return this.direction=t<0?-1:1,this}pause(){return this._pausedNeedSet?this._pausedNeedSet=!1:this._pausedNeedSet=null,this.isPaused=!0,this}resume(){return this._pausedNeedSet?this._pausedNeedSet=!1:this._pausedNeedSet=null,this.isPaused=!1,this}play(){return this.resume()}replay(){return this._pausedNeedSet?this._pausedNeedSet=!1:this._pausedNeedSet=null,this.isPaused=!1,this._repeatsCut=this.repeats,this._delayCut=this.delay,this.living=!0,this.frameNum=0,this.duration=Math.floor(this.endFrame-this.beginFrame),this.direction=1,this}show(){this._justDisplayNeedSet?this._justDisplayNeedSet=!1:this._justDisplayNeedSet=null,this.group.visible=!0;}hide(){this._justDisplayNeedSet?this._justDisplayNeedSet=!1:this._justDisplayNeedSet=null,this.group.visible=!1;}destroy(){this.parent&&this.parent.remove(this),this.group.parent&&this.group.parent.removeChild(this.group),this.pause(),this.root=null,this.group=null,this.display=null,this.textureLoader&&(this.textureLoader.off("complete"),this.textureLoader=null),this.jsonLoader&&(this.jsonLoader.off("success"),this.jsonLoader=null),this.keyframes=null,this.living=!1;}}class Gt extends e{constructor(t){super(),this._lastTime=0,this._snippet=0,this.timeScale=1,this.isPaused=!1,this.ticker=t.ticker?t.ticker:t,this.groups=[],this.update=this.update.bind(this),this.ticker&&this.start();}add(t){const s=arguments.length;if(s>1)for(let t=0;t1)for(let t=0;t200)&&(this._lastTime=Date.now(),t=Date.now()-this._lastTime),this._lastTime+=t,this._snippet=t;}destroy(){for(let t=this.groups.length-1;t>=0;t--)this.groups[t].destroy();}} - - class T extends pixi_js.Graphics{constructor(t){super(),this.parentCompBox=t,this.lineStyle(0);}updateLayerMask(t){for(let e=0;ethis.buffer.length){const e=new this.buffer.constructor(Math.max(this.length+t.length,Math.round(2*this.buffer.length)));e.set(this.buffer,0),this.buffer=e;}for(let e=0;e=r&&(r+=2*Math.PI);let o=r-n,a=1;h&&(a=-1,o=2*Math.PI-o,0==o&&(o=2*Math.PI));const l=o*i;let p=Math.sqrt(l/1)>>0;p=p%2==0?p+1:p;const c=o/p;let u=n;for(let n=0;n=2,h=e.lineWidth/2;let o,a=[i[0],i[1]];for(let t=2;ts[r];)n-=s[r],r++,h=h?0:1,r==s.length&&(r=0);let o=[t[0],t[1]],a=[h];for(let e=2;e=s[r];)p+=s[r]-n,n=0,h=h?0:1,r++,r==s.length&&(r=0),a.push(h),o.push(t[e-2]+p*i[0],t[e-1]+p*i[1]);l-p!=0&&(o.push(t[e],t[e+1]),a.push(h)),n+=l-p;}return e&&(t.pop(),t.pop(),o.pop(),o.pop(),a.pop()),{newPoints:o,toDrawOrNotToDraw:a}}(a,n,e.lineDash,e.lineDashOffset);o=t.toDrawOrNotToDraw,a=t.newPoints;}const l=s.length;let p=s.length;const c=[];if(n)a.push(a[2],a[3]);else {const t=[a[2]-a[0],a[3]-a[1]],i=O(t[0],t[1]);t[0]/=i,t[1]/=i;const n=[-t[1],t[0]],l=[a[0]+h*n[0],a[1]+h*n[1]],u=[a[0]-h*n[0],a[1]-h*n[1]];if("butt"==e.lineCap)s.push(l[0],l[1],u[0],u[1]);else if("square"==e.lineCap)s.push(l[0]-h*t[0],l[1]-h*t[1],u[0]-h*t[0],u[1]-h*t[1]);else {s.push(a[0],a[1],l[0],l[1]);const t=Math.atan2(l[1]-a[1],l[0]-a[0]),e=Math.atan2(u[1]-a[1],u[0]-a[0]);E(s,a[0],a[1],h,t,e),s.push(a[0],a[1],u[0],u[1]),s.push(l[0],l[1],u[0],u[1]);}if(r){const t=o[0];for(let e=p;e0?(f[0]/=l,f[1]/=l,g=[-f[1],f[0]],m=g[0]*n[0]+g[1]*n[1],y=h/m):(y=0,g=[-f[1],f[0]]);const w=[a[t]+y*g[0],a[t+1]+y*g[1]],v=[a[t]-y*g[0],a[t+1]-y*g[1]];if("miter"==e.lineJoin&&1/m<=e.miterLimit)s.push(w[0],w[1],v[0],v[1]);else {const i=d[1]*u[0]-d[0]*u[1];if("round"==e.lineJoin)if(i<0){const e=[a[t]+d[1]*h,a[t+1]-d[0]*h],i=[a[t]+u[1]*h,a[t+1]-u[0]*h];s.push(w[0],w[1],e[0],e[1]);const n=Math.atan2(e[1]-a[t+1],e[0]-a[t]),r=Math.atan2(i[1]-a[t+1],i[0]-a[t]);E(s,a[t],a[t+1],h,n,r),s.push(w[0],w[1],i[0],i[1]);}else {const e=[a[t]-d[1]*h,a[t+1]+d[0]*h],i=[a[t]-u[1]*h,a[t+1]+u[0]*h];s.push(e[0],e[1],v[0],v[1]);const n=Math.atan2(i[1]-a[t+1],i[0]-a[t]),r=Math.atan2(e[1]-a[t+1],e[0]-a[t]);E(s,a[t],a[t+1],h,n,r),s.push(i[0],i[1],v[0],v[1]);}else if(i<0){const e=[a[t]+d[1]*h,a[t+1]-d[0]*h],i=[a[t]+u[1]*h,a[t+1]-u[0]*h];s.push(w[0],w[1],e[0],e[1],w[0],w[1],i[0],i[1]);}else {const e=[a[t]-d[1]*h,a[t+1]+d[0]*h],i=[a[t]-u[1]*h,a[t+1]+u[0]*h];s.push(e[0],e[1],v[0],v[1],i[0],i[1],v[0],v[1]);}}if(r){const e=o[t/2];for(let t=p;t=6){for(let t=0;t=2;for(let t=0;t1){const t=this.paths.length,e=function(t){const e=t.length;let s=0;for(let i=e-1,n=0;n0;if(this.currentPath.isClockWise=e,0===t&&(this.firstIsClockWise=e),t>0&&this.preClockWiseStatus===this.firstIsClockWise&&this.preClockWiseStatus!==e){(t>0?this.paths[t-1]:null).holes.push(this.currentPath);}else this.paths.push(this.currentPath),this.preClockWiseStatus=e;this.currentPath=null,this.isDirty=!0;}this._samplerPoints.length=0;}closePath(){this.currentPath.closePath();}stroke(){this.endPath(),this.drawType="stroke";}fill(){null!==this.currentPath&&(this.closePath(),this.endPath(),this.drawType="fill");}_renderWebGL(t){t.setObjectRenderer(t.plugins.lottiegraphics),t.plugins.lottiegraphics.render(this);}_renderCanvas(t){t.plugins.lottiegraphics.render(this);}}class z extends X{constructor(t,e){super(),this.lottieElement=t,this.config=e,this.passMatrix=new pixi_js.Matrix;}setShapeTransform(){const t=this.lottieElement.preTransforms.finalTransform.props;this.passMatrix.set(t[0],t[1],t[4],t[5],t[12],t[13]),this.transform.setFromMatrix(this.passMatrix);}updateTransform(){this.setShapeTransform(),this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha,this._bounds.updateID++;}updateLottieGrahpics(e){const s$1=e.type;if(this.clear(),("st"===s$1||"gs"===s$1)&&0===e.wi||!e.data._shouldRender||0===e.coOp)return;const i=e.elements,n=i.length;for(let t=0;t{s.orig=new pixi_js.Rectangle(0,0,i.w,i.h),s._updateUvs();}),this.lottieElement=t,this.config=e;}onSetupLottie(){if(this.lottieElement.hasValidMasks()){const t=this.config.session.local;this.graphicsMasks=new T(t),this.mask=this.graphicsMasks,this.addChild(this.mask);}}setHierarchy(t){this.hierarchy=t;}show(){this.visible=!0;}hide(){this.visible=!1;}updateLottieTransform(t){this.x=t.x,this.y=t.y,this.pivot.x=t.anchorX,this.pivot.y=t.anchorY,this.scale.x=t.scaleX,this.scale.y=t.scaleY,this.rotation=t.rotation,this.alpha=t.alpha;}updateLottieMasks(t){this.graphicsMasks&&this.graphicsMasks.updateMasks(t);}}const U=/^(https?:)?\/\//;class N extends e{constructor(t,{prefix:e,autoLoad:s=!0}){super(),this.assets=t,this.prefix=e||"",this.textures={},this._total=0,this._failed=0,this._received=0,this.loaded=!1,s&&this.load();}load(){this.assets.forEach(t=>{const e=t.id,s=function(t,e){if(1===t.e)return t.p;e&&(e=e.replace(/\/?$/,"/"));const s=t.u+t.p;let i="";return i=t.up?t.up:U.test(s)?s:e+s,i}(t,this.prefix),i=pixi_js.Texture.fromImage(s,"*");this.textures[e]=i,this._total++,i.baseTexture.hasLoaded?(this._received++,this.emit("update"),this._received+this._failed>=this._total&&this._onComplete()):(i.baseTexture.once("loaded",()=>{this._received++,this.emit("update"),this._received+this._failed>=this._total&&this._onComplete();}),i.baseTexture.once("error",()=>{this._failed++,this.emit("update"),this._received+this._failed>=this._total&&this._onComplete();}));});}_onComplete(){this.loaded=!0,this.emit("complete"),this._failed>0&&(this._failed>=this._total?this.emit("fail"):this.emit("partlyfail",this._failed));}getTextureById(t){return this.textures[t]}}function j(t){return t.response&&"object"==typeof t.response?t.response:t.response&&"string"==typeof t.response?JSON.parse(t.response):t.responseText?JSON.parse(t.responseText):void 0}class q extends e{constructor(t){super(),this.path=t,this.onSuccess=this.onSuccess.bind(this),this.onFail=this.onFail.bind(this),function(t,e,s){let i,n=new XMLHttpRequest;n.open("GET",t,!0);try{n.responseType="json";}catch(t){console.error("lottie-pixi loadAjax:",t);}n.send(),n.onreadystatechange=function(){if(4==n.readyState)if(200==n.status)i=j(n),e(i);else try{i=j(n),e(i);}catch(t){s&&s(t);}};}(t,this.onSuccess,this.onFail);}onSuccess(t){this.emit("success",t),this.emit("complete",t);}onFail(t){this.emit("fail",t),this.emit("error",t);}}const Y={Linear:{None:t=>t},Ease:{In:function(){const t=new M$1(.42,0,1,1);return function(e){return t.get(e)}}(),Out:function(){const t=new M$1(0,0,.58,1);return function(e){return t.get(e)}}(),InOut:function(){const t=new M$1(.42,0,.58,1);return function(e){return t.get(e)}}(),Bezier(t,e,i,n){const r=new M$1(t,e,i,n);return function(t){return r.get(t)}}},Elastic:{In:t=>0===t?0:1===t?1:-Math.pow(2,10*(t-1))*Math.sin(5*(t-1.1)*Math.PI),Out:t=>0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin(5*(t-.1)*Math.PI)+1,InOut:t=>0===t?0:1===t?1:(t*=2)<1?-.5*Math.pow(2,10*(t-1))*Math.sin(5*(t-1.1)*Math.PI):.5*Math.pow(2,-10*(t-1))*Math.sin(5*(t-1.1)*Math.PI)+1},Back:{In(t){const e=1.70158;return t*t*((e+1)*t-e)},Out(t){const e=1.70158;return --t*t*((e+1)*t+e)+1},InOut(t){const e=2.5949095;return (t*=2)<1?t*t*((e+1)*t-e)*.5:.5*((t-=2)*t*((e+1)*t+e)+2)}},Bounce:{In:t=>1-Y.Bounce.Out(1-t),Out:t=>t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375,InOut:t=>t<.5?.5*Y.Bounce.In(2*t):.5*Y.Bounce.Out(2*t-1)+.5}};function J(s$1){e.call(this),this.element=s$1.element||{},this.duration=s$1.duration||300,this.living=!0,this.resident=s$1.resident||!1,this.infinite=s$1.infinite||!1,this.alternate=s$1.alternate||!1,this.repeats=s$1.repeats||0,this.delay=s$1.delay||0,this.wait=s$1.wait||0,this.timeScale=s.isNumber(s$1.timeScale)?s$1.timeScale:1,s$1.onComplete&&this.on("complete",s$1.onComplete.bind(this)),s$1.onUpdate&&this.on("update",s$1.onUpdate.bind(this)),this.init(),this.paused=!1;}function V(e){J.call(this,e),e.from=e.from||{};for(const s$1 in e.to)s.isUndefined(e.from[s$1])&&(e.from[s$1]=this.element[s$1]);this.ease=e.ease||Y.Ease.InOut,this.from=e.from,this.to=e.to;}function H(e){J.call(this,e),this.dynamicProperties=[],this._mdf=!1,this.keyframes=s.copyJSON(e.keyframes),this.frameRate=e.frameRate||30,this.tpf=1e3/this.frameRate,this.ip=s.isUndefined(e.ip)?this.keyframes.ip:e.ip,this.op=s.isUndefined(e.ip)?this.keyframes.op:e.op,this.tfs=this.op-this.ip,this.duration=this.tfs*this.tpf,this.ignoreProps=s.isArray(e.ignoreProps)?e.ignoreProps:[],this.transform=new qt(this,this.keyframes.ks);}function $(t,e){J.call(this,e),this.runners=[],this.queues=[],this.cursor=0,this.total=0,this.alternate=!1,t&&this.then(t);}J.prototype=Object.create(e.prototype),J.prototype.update=function(e){const s$1=this.direction*this.timeScale*e;if(this.waitCut>0)return void(this.waitCut-=Math.abs(s$1));if(this.paused||!this.living||this.delayCut>0)return void(this.delayCut>0&&(this.delayCut-=Math.abs(s$1)));this.progress+=s$1;let i=!1;const n=this.progress;let r;return this.spill()&&(this.repeatsCut>0||this.infinite?(this.repeatsCut>0&&--this.repeatsCut,this.delayCut=this.delay,this.alternate?(this.direction*=-1,this.progress=s.codomainBounce(this.progress,0,this.duration)):(this.direction=1,this.progress=s.euclideanModulo(this.progress,this.duration))):i=!0),i?(this.resident||(this.living=!1),this.progress=s.clamp(n,0,this.duration),r=this.nextPose(),this.emit("complete",r,n-this.progress)):(r=this.nextPose(),this.emit("update",r,this.progress/this.duration)),r},J.prototype.spill=function(){const t=this.progress<=0&&-1===this.direction,e=this.progress>=this.duration&&1===this.direction;return t||e},J.prototype.init=function(){this.direction=1,this.progress=0,this.repeatsCut=this.repeats,this.delayCut=this.delay,this.waitCut=this.wait;},J.prototype.nextPose=function(){console.warn("should be overwrite");},J.prototype.linear=function(t,e,s){return (e-t)*s+t},J.prototype.setSpeed=function(t){return this.timeScale=t,this},J.prototype.pause=function(){return this.paused=!0,this},J.prototype.resume=function(){return this.paused=!1,this},J.prototype.restart=J.prototype.resume,J.prototype.stop=function(){return this.repeats=0,this.infinite=!1,this.progress=this.duration,this},J.prototype.cancel=function(){return this.living=!1,this},V.prototype=Object.create(J.prototype),V.prototype.nextPose=function(){const t={},e=this.ease(this.progress/this.duration);for(const s in this.to)void 0!==this.element[s]&&(this.element[s]=t[s]=this.linear(this.from[s],this.to[s],e));return t},H.prototype=Object.create(J.prototype),H.prototype.prepareProperties=function(t){const e=this.dynamicProperties.length;let s;for(s=0;s0&&(t+=this._residueTime,this._residueTime=0),this.runners[this.cursor].update(t)},$.prototype.update=function(t){if(this.wait>0)return void(this.wait-=Math.abs(t));if(this.paused||!this.living||this.delayCut>0)return void(this.delayCut>0&&(this.delayCut-=Math.abs(t)));const e=this.cursor,s=this.nextPose(this.timeScale*t);return this.emit("update",{index:e,pose:s},this.progress/this.duration),this.spill()&&(this.repeats>0||this.infinite?(this.repeats>0&&--this.repeats,this.delayCut=this.delay,this.cursor=0):(this.resident||(this.living=!1),this.emit("complete",s))),s},$.prototype.spill=function(){return this.cursor>=this.total};const K={settings:pixi_js.settings,UPDATE_PRIORITY:pixi_js.UPDATE_PRIORITY,animationTicker:pixi_js.ticker.shared};function Z(t){this.element=t,this.animates=[],this.timeScale=1,this.paused=!1,this.updateDeltaTime=this.updateDeltaTime.bind(this),K.animationTicker.add(this.updateDeltaTime,K.UPDATE_PRIORITY.HIGH);}Z.prototype.clearAnimators=function(t){if(this.paused)return;const e=this.animates;for(let s=0;s0&&this.clearAnimators(e);},Z.prototype.animate=function(t,e){return t.element=this.element,this._addMove(new V(t),e)},Z.prototype.queues=function(t,e,s){return e.element=this.element,this._addMove(new $(t,e),s)},Z.prototype.bodymovin=function(t,e){return t.element=this.element,this._addMove(new H(t),e)},Z.prototype._addMove=function(t,e){return e&&this.clearAll(),this.animates.push(t),t},Z.prototype.pause=function(){this.paused=!0;},Z.prototype.resume=function(){this.paused=!1;},Z.prototype.restart=Z.prototype.resume,Z.prototype.setSpeed=function(t){this.timeScale=t;},Z.prototype.clearAll=function(){this.animates.length=0;},pixi_js.DisplayObject.prototype.setupAnimations=function(){this.animations||(this.animations=new Z(this));},pixi_js.DisplayObject.prototype.animate=function(t,e){return this.animations||this.setupAnimations(),this.animations.animate(t,e)},pixi_js.DisplayObject.prototype.queues=function(t,e={},s){return this.animations||this.setupAnimations(),this.animations.queues(t,e,s)},pixi_js.DisplayObject.prototype.bodymovin=function(t,e){return this.animations||this.setupAnimations(),this.animations.bodymovin(t,e)},Object.defineProperties(pixi_js.DisplayObject.prototype,{scaleXY:{get(){return this.scale.x},set(t){this.scale.set(t);}},scaleX:{get(){return this.scale.x},set(t){this.scale.x=t;}},scaleY:{get(){return this.scale.y},set(t){this.scale.y=t;}},pivotX:{get(){return this.pivot.x},set(t){this.pivot.x=t;}},pivotY:{get(){return this.pivot.y},set(t){this.pivot.y=t;}}}),pixi_js.Container.prototype.updateTransform=function(){this.emit("pretransform"),this._boundsID++,this.hierarchy&&this.hierarchy.transform?(this.hierarchy.updateTransform(),this.transform.updateTransform(this.hierarchy.transform)):this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha;for(let t=0,e=this.children.length;t (s.application)); - this.app = this.renderSystem.application; - } - componentChanged(changed) { - return __awaiter(this, void 0, void 0, function* () { - if (changed.componentName === 'Lottie') { - if (changed.type === eva_js.OBSERVER_TYPE.ADD) { - this.add(changed); - } - else if (changed.type === eva_js.OBSERVER_TYPE.REMOVE) { - this.remove(changed); - } - } - }); - } - add(changed) { - return __awaiter(this, void 0, void 0, function* () { - this.manager = new Gt(this.app); - const component = changed.component; - const container = this.renderSystem.containerManager.getContainer(changed.gameObject.id); - if (!container) - return; - const _a = component.options, { resource: rn } = _a, otherOpts = __rest(_a, ["resource"]); - const { data } = yield eva_js.resource.getResource(rn); - const json = Object.assign({}, (data.json || {})); - const assets = json.assets || []; - assets.forEach(item => { - if (item.p) - item.p = imageHandle(item.p); - }); - const anim = this.manager.parseAnimation(Object.assign({ keyframes: json }, otherOpts)); - component.anim = anim; - container.addChildAt(anim.group, 0); - this.managerLife.forEach(eventName => { - anim.on(eventName, e => component.emit(eventName, e)); - }); - if (anim.isImagesLoaded) - component.emit('success', {}); - }); - } - remove(changed) { - const component = changed.component; - const container = this.renderSystem.containerManager.getContainer(changed.gameObject.id); - if (container) { - container.removeChild(component.anim.group); - component.anim.group.destory(true); - } - component.anim = null; - } - }; - LottieSystem.systemName = 'LottieSystem'; - LottieSystem = __decorate([ - eva_js.decorators.componentObserver({ - Lottie: [] - }) - ], LottieSystem); - var LottieSystem$1 = LottieSystem; - - class Lottie extends eva_js.Component { - constructor(options) { - super(); - this.loadStatus = false; - this.firstPlay = null; - this.prevSlot = {}; - this.currentSlot = {}; - this.options = Object.assign({ autoStart: false }, options); - this.on('success', () => { - this.loadStatus = true; - const { ip, op } = this.anim.keyframes; - for (let i = ip; i <= op; i++) { - const event = `@${i}`; - this.anim.on(event, e => this.emit(event, e)); - } - this.firstPlay && this.firstPlay(); - }); - } - play(params = [], expandOpts = { - repeats: 0 - }) { - if (!this.loadStatus) { - this.firstPlay = () => { - this.play(params, expandOpts); - }; - return; - } - const { slot = [] } = expandOpts; - slot.forEach(({ name, type, value, style = {} }) => { - const { x, y, anchor = { x: 0, y: 0 }, pivot = { x: 0, y: 0 }, width, height } = style; - if (type === 'IMAGE') { - this.currentSlot[name] = pixi_js.Sprite.from(value); - } - else if (type === 'TEXT') { - this.currentSlot[name] = new pixi_js.Text(value, new pixi_js.TextStyle(style)); - } - if (x) - this.currentSlot[name].x = x; - if (y) - this.currentSlot[name].y = y; - if (width) - this.currentSlot[name].width = width; - if (height) - this.currentSlot[name].height = height; - this.currentSlot[name].anchor.set(anchor.x || 0, anchor.y || 0); - this.currentSlot[name].pivot.set(this.currentSlot[name].width * (pivot.x || 0), this.currentSlot[name].height * (pivot.y || 0)); - if (this.prevSlot[name]) - this.anim.unbindSlot(name, this.prevSlot[name]); - this.anim.bindSlot(name, this.currentSlot[name]); - this.prevSlot[name] = this.currentSlot[name]; - }); - this.anim.playSegment(this.playParamsHandle(params), expandOpts); - } - playParamsHandle(params) { - let p = [].concat(params); - const { keyframes } = this.anim; - if (!p.length || p.length > 2) { - p = [keyframes.ip, keyframes.op]; - } - else if (p.length === 1) { - p = [p[0] % keyframes.op, keyframes.op]; - } - return p; - } - onTap(name, callback) { - const g = new pixi_js.Graphics(); - this.on('success', () => { - const ele = this.anim.querySelector(name); - const display = ele.display; - g.beginFill(0xFFFFFF); - g.drawRect(0, 0, 100, 100); - g.endFill(); - g.alpha = 0; - display.addChild(g); - ele.display.interactive = true; - ele.display.on('pointertap', () => { - callback(); - }); - }); - } - } - Lottie.componentName = 'Lottie'; - __decorate([ - eva_js.decorators.IDEProp - ], Lottie.prototype, "slot", void 0); - - exports.Lottie = Lottie; - exports.LottieSystem = LottieSystem$1; - - Object.defineProperty(exports, '__esModule', { value: true }); - -}))); diff --git a/dist/cdn/EVA.plugin.renderer.mask.js b/dist/cdn/EVA.plugin.renderer.mask.js deleted file mode 100644 index b8a34d45..00000000 --- a/dist/cdn/EVA.plugin.renderer.mask.js +++ /dev/null @@ -1,279 +0,0 @@ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@eva/eva.js'), require('@eva/plugin-renderer'), require('@eva/renderer-adapter')) : - typeof define === 'function' && define.amd ? define(['exports', '@eva/eva.js', '@eva/plugin-renderer', '@eva/renderer-adapter'], factory) : - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.EVA = global.EVA || {}, global.EVA.plugin = global.EVA.plugin || {}, global.EVA.plugin.renderer = global.EVA.plugin.renderer || {}, global.EVA.plugin.renderer.mask = {}), global.EVA, global.EVA.plugin.renderer, global.EVA.rendererAdapter)); -}(this, (function (exports, eva_js, pluginRenderer, rendererAdapter) { 'use strict'; - - /*! ***************************************************************************** - Copyright (c) Microsoft Corporation. - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. - ***************************************************************************** */ - - function __decorate(decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; - } - - function __awaiter(thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - } - - exports.MASK_TYPE = void 0; - (function (MASK_TYPE) { - MASK_TYPE["Circle"] = "Circle"; - MASK_TYPE["Ellipse"] = "Ellipse"; - MASK_TYPE["Rect"] = "Rect"; - MASK_TYPE["RoundedRect"] = "RoundedRect"; - MASK_TYPE["Polygon"] = "Polygon"; - MASK_TYPE["Img"] = "Img"; - MASK_TYPE["Sprite"] = "Sprite"; - })(exports.MASK_TYPE || (exports.MASK_TYPE = {})); - class Mask$2 extends eva_js.Component { - constructor() { - super(...arguments); - this.style = {}; - this.resource = ''; - this.spriteName = ''; - } - init(obj) { - Object.assign(this, obj); - } - } - Mask$2.componentName = 'Mask'; - __decorate([ - eva_js.decorators.IDEProp - ], Mask$2.prototype, "type", void 0); - __decorate([ - eva_js.decorators.IDEProp - ], Mask$2.prototype, "style", void 0); - __decorate([ - eva_js.decorators.IDEProp - ], Mask$2.prototype, "resource", void 0); - __decorate([ - eva_js.decorators.IDEProp - ], Mask$2.prototype, "spriteName", void 0); - - const resourceKeySplit = '_s|r|c_'; - const propertyForGraphics = { - Circle: ['x', 'y', 'radius'], - Ellipse: ['x', 'y', 'width', 'height'], - Rect: ['x', 'y', 'width', 'height'], - RoundedRect: ['x', 'y', 'width', 'height', 'radius'], - Polygon: ['paths'], - }; - const functionForGraphics = { - Circle: 'drawCircle', - Ellipse: 'drawEllipse', - Rect: 'drawRect', - RoundedRect: 'drawRoundedRect', - Polygon: 'drawPolygon', - }; - var MASK_TYPE; - (function (MASK_TYPE) { - MASK_TYPE["Circle"] = "Circle"; - MASK_TYPE["Ellipse"] = "Ellipse"; - MASK_TYPE["Rect"] = "Rect"; - MASK_TYPE["RoundedRect"] = "RoundedRect"; - MASK_TYPE["Polygon"] = "Polygon"; - MASK_TYPE["Img"] = "Img"; - MASK_TYPE["Sprite"] = "Sprite"; - })(MASK_TYPE || (MASK_TYPE = {})); - let Mask = class Mask extends pluginRenderer.Renderer { - constructor() { - super(...arguments); - this.name = 'Mask'; - this.changedCache = {}; - this.maskSpriteCache = {}; - } - init() { - this.renderSystem = this.game.getSystem(pluginRenderer.RendererSystem); - this.renderSystem.rendererManager.register(this); - } - rendererUpdate() { - this.changedCache = {}; - } - componentChanged(changed) { - if (changed.component.name !== 'Mask') - return; - switch (changed.type) { - case eva_js.OBSERVER_TYPE.ADD: - this.add(changed); - break; - case eva_js.OBSERVER_TYPE.REMOVE: - this.remove(changed); - break; - case eva_js.OBSERVER_TYPE.CHANGE: - this.change(changed); - break; - } - } - add(changed) { - const component = changed.component; - if (!(component.type in MASK_TYPE)) { - throw new Error('no have Mask type: ' + component.type); - } - if (!component.style) { - throw new Error('no have Mask style: ' + component.type); - } - let mask; - switch (component.type) { - case MASK_TYPE.Circle: - mask = this.createGraphics(component); - break; - case MASK_TYPE.Ellipse: - mask = this.createGraphics(component); - break; - case MASK_TYPE.Rect: - mask = this.createGraphics(component); - break; - case MASK_TYPE.RoundedRect: - mask = this.createGraphics(component); - break; - case MASK_TYPE.Polygon: - mask = this.createGraphics(component); - break; - case MASK_TYPE.Img: - mask = this.createSprite(component); - break; - case MASK_TYPE.Sprite: - mask = this.createSprite(component); - break; - } - if (!mask) { - throw new Error('no have mask instance, check your mask params: ' + component.type); - } - const container = this.containerManager.getContainer(changed.gameObject.id); - container.mask = mask; - container.addChild(mask); - } - remove(changed) { - const container = this.containerManager.getContainer(changed.gameObject.id); - container.removeChild(container.mask); - container.mask.destroy(true); - container.mask = null; - delete this.maskSpriteCache[changed.component.gameObject.id]; - } - change(changed) { - if (this.changedCache[changed.gameObject.id]) - return; - const component = changed.component; - if (changed.prop.prop[0] === 'type') { - this.changedCache[changed.gameObject.id] = true; - if ([MASK_TYPE.Sprite, MASK_TYPE.Img].indexOf(component.type) > -1) { - this.remove(changed); - this.add(changed); - } - else { - this.redrawGraphics(changed); - } - } - else if (changed.prop.prop[0] === 'style') { - if ([MASK_TYPE.Sprite, MASK_TYPE.Img].indexOf(component.type) > -1) { - this.changeSpriteStyle(component); - } - else { - this.redrawGraphics(changed); - } - } - else if (changed.prop.prop[0] === 'resource') { - this.changedCache[changed.gameObject.id] = true; - this.changeSprite(component); - } - else if (changed.prop.prop[0] === 'spriteName') { - this.changedCache[changed.gameObject.id] = true; - this.changeSprite(component); - } - } - createGraphics(component) { - const graphics = new rendererAdapter.Graphics(); - this.draw(graphics, component); - return graphics; - } - redrawGraphics(changed) { - const container = this.containerManager.getContainer(changed.gameObject.id); - const graphics = container.mask; - graphics.clear(); - this.draw(graphics, changed.component); - } - draw(graphics, component) { - const params = []; - for (const key of propertyForGraphics[component.type]) { - params.push(component.style[key]); - } - graphics.beginFill(0x000000, 1); - graphics[functionForGraphics[component.type]](...params); - graphics.endFill(); - } - createSprite(component) { - const sprite = new rendererAdapter.Sprite(null); - this.maskSpriteCache[component.gameObject.id] = sprite; - this.setSprite(component, sprite); - return sprite.sprite; - } - changeSpriteStyle(component) { - const sprite = this.maskSpriteCache[component.gameObject.id]; - sprite.sprite.width = component.style.width; - sprite.sprite.height = component.style.height; - sprite.sprite.position.x = component.style.x; - sprite.sprite.position.y = component.style.y; - } - changeSprite(component) { - const sprite = this.maskSpriteCache[component.gameObject.id]; - this.setSprite(component, sprite); - } - setSprite(component, sprite) { - return __awaiter(this, void 0, void 0, function* () { - let res; - try { - res = yield eva_js.resource.getResource(component.resource); - } - catch (e) { - throw new Error('mask resource load error'); - } - if (component.type === MASK_TYPE.Sprite) { - const img = component.resource + resourceKeySplit + component.spriteName; - const texture = res.instance[img]; - sprite.image = texture; - } - else { - sprite.image = res.data.image; - } - sprite.sprite.width = component.style.width; - sprite.sprite.height = component.style.height; - sprite.sprite.position.x = component.style.x; - sprite.sprite.position.y = component.style.y; - }); - } - }; - Mask.systemName = 'Mask'; - Mask = __decorate([ - eva_js.decorators.componentObserver({ - Mask: ['type', { prop: ['style'], deep: true }, 'resource', 'spriteName'], - }) - ], Mask); - var Mask$1 = Mask; - - exports.Mask = Mask$2; - exports.MaskSystem = Mask$1; - - Object.defineProperty(exports, '__esModule', { value: true }); - -}))); diff --git a/dist/cdn/EVA.plugin.renderer.matterjs.js b/dist/cdn/EVA.plugin.renderer.matterjs.js deleted file mode 100644 index a1b095ff..00000000 --- a/dist/cdn/EVA.plugin.renderer.matterjs.js +++ /dev/null @@ -1,11086 +0,0 @@ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@eva/eva.js')) : - typeof define === 'function' && define.amd ? define(['exports', '@eva/eva.js'], factory) : - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.EVA = global.EVA || {}, global.EVA.plugin = global.EVA.plugin || {}, global.EVA.plugin.renderer = global.EVA.plugin.renderer || {}, global.EVA.plugin.renderer.matterjs = {}), global.EVA)); -}(this, (function (exports, eva_js) { 'use strict'; - - /*! ***************************************************************************** - Copyright (c) Microsoft Corporation. - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. - ***************************************************************************** */ - - function __decorate(decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; - } - - /*! - 基于matter-js 修改, API保留了matter-js的api: http://brm.io/matter-js - */ - function __WEBPACK_EXTERNAL_MODULE__27__() { - try { - return require('poly-decomp'); - } catch (e) {} - } - - const main = function () { - return /******/ (function (modules) { - // webpackBootstrap - /******/ // The module cache - /******/ var installedModules = {}; // The require function - /******/ - /******/ /******/ function __webpack_require__(moduleId) { - /******/ - /******/ // Check if module is in cache - /******/ if (installedModules[moduleId]) { - /******/ return installedModules[moduleId].exports; - /******/ - } // Create a new module (and put it into the cache) - /******/ /******/ var module = (installedModules[moduleId] = { - /******/ i: moduleId, - /******/ l: false, - /******/ exports: {}, - /******/ - }); // Execute the module function - /******/ - /******/ /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); // Flag the module as loaded - /******/ - /******/ /******/ module.l = true; // Return the exports of the module - /******/ - /******/ /******/ return module.exports; - /******/ - } // expose the modules object (__webpack_modules__) - /******/ - /******/ - /******/ /******/ __webpack_require__.m = modules; // expose the module cache - /******/ - /******/ /******/ __webpack_require__.c = installedModules; // define getter function for harmony exports - /******/ - /******/ /******/ __webpack_require__.d = function (exports, name, getter) { - /******/ if (!__webpack_require__.o(exports, name)) { - /******/ Object.defineProperty(exports, name, {enumerable: true, get: getter}); - /******/ - } - /******/ - }; // define __esModule on exports - /******/ - /******/ /******/ __webpack_require__.r = function (exports) { - /******/ if (typeof Symbol !== 'undefined' && Symbol.toStringTag) { - /******/ Object.defineProperty(exports, Symbol.toStringTag, {value: 'Module'}); - /******/ - } - /******/ Object.defineProperty(exports, '__esModule', {value: true}); - /******/ - }; // create a fake namespace object // mode & 1: value is a module id, require it // mode & 2: merge all properties of value into the ns // mode & 4: return value when already ns object // mode & 8|1: behave like require - /******/ - /******/ /******/ /******/ /******/ /******/ /******/ __webpack_require__.t = function (value, mode) { - /******/ if (mode & 1) value = __webpack_require__(value); - /******/ if (mode & 8) return value; - /******/ if (mode & 4 && typeof value === 'object' && value && value.__esModule) return value; - /******/ var ns = Object.create(null); - /******/ __webpack_require__.r(ns); - /******/ Object.defineProperty(ns, 'default', {enumerable: true, value: value}); - /******/ if (mode & 2 && typeof value != 'string') - for (var key in value) - __webpack_require__.d( - ns, - key, - function (key) { - return value[key]; - }.bind(null, key), - ); - /******/ return ns; - /******/ - }; // getDefaultExport function for compatibility with non-harmony modules - /******/ - /******/ /******/ __webpack_require__.n = function (module) { - /******/ var getter = - module && module.__esModule - ? /******/ function getDefault() { - return module['default']; - } - : /******/ function getModuleExports() { - return module; - }; - /******/ __webpack_require__.d(getter, 'a', getter); - /******/ return getter; - /******/ - }; // Object.prototype.hasOwnProperty.call - /******/ - /******/ /******/ __webpack_require__.o = function (object, property) { - return Object.prototype.hasOwnProperty.call(object, property); - }; // __webpack_public_path__ - /******/ - /******/ /******/ __webpack_require__.p = ''; // Load entry module and return exports - /******/ - /******/ - /******/ /******/ return __webpack_require__((__webpack_require__.s = 24)); - /******/ - })( - /************************************************************************/ - /******/ [ - /* 0 */ - /***/ function (module, exports) { - /** - * The `Matter.Common` module contains utility functions that are common to all modules. - * - * @class Common - */ - - var Common = {}; - - module.exports = Common; - - (function () { - Common._nextId = 0; - Common._seed = 0; - Common._nowStartTime = +new Date(); - - /** - * Extends the object in the first argument using the object in the second argument. - * @method extend - * @param {} obj - * @param {boolean} deep - * @return {} obj extended - */ - Common.extend = function (obj, deep) { - var argsStart, deepClone; - - if (typeof deep === 'boolean') { - argsStart = 2; - deepClone = deep; - } else { - argsStart = 1; - deepClone = true; - } - - for (var i = argsStart; i < arguments.length; i++) { - var source = arguments[i]; - - if (source) { - for (var prop in source) { - if (deepClone && source[prop] && source[prop].constructor === Object) { - if (!obj[prop] || obj[prop].constructor === Object) { - obj[prop] = obj[prop] || {}; - Common.extend(obj[prop], deepClone, source[prop]); - } else { - obj[prop] = source[prop]; - } - } else { - obj[prop] = source[prop]; - } - } - } - } - - return obj; - }; - - /** - * Creates a new clone of the object, if deep is true references will also be cloned. - * @method clone - * @param {} obj - * @param {bool} deep - * @return {} obj cloned - */ - Common.clone = function (obj, deep) { - return Common.extend({}, deep, obj); - }; - - /** - * Returns the list of keys for the given object. - * @method keys - * @param {} obj - * @return {string[]} keys - */ - Common.keys = function (obj) { - if (Object.keys) return Object.keys(obj); - - // avoid hasOwnProperty for performance - var keys = []; - for (var key in obj) keys.push(key); - return keys; - }; - - /** - * Returns the list of values for the given object. - * @method values - * @param {} obj - * @return {array} Array of the objects property values - */ - Common.values = function (obj) { - var values = []; - - if (Object.keys) { - var keys = Object.keys(obj); - for (var i = 0; i < keys.length; i++) { - values.push(obj[keys[i]]); - } - return values; - } - - // avoid hasOwnProperty for performance - for (var key in obj) values.push(obj[key]); - return values; - }; - - /** - * Gets a value from `base` relative to the `path` string. - * @method get - * @param {} obj The base object - * @param {string} path The path relative to `base`, e.g. 'Foo.Bar.baz' - * @param {number} [begin] Path slice begin - * @param {number} [end] Path slice end - * @return {} The object at the given path - */ - Common.get = function (obj, path, begin, end) { - path = path.split('.').slice(begin, end); - - for (var i = 0; i < path.length; i += 1) { - obj = obj[path[i]]; - } - - return obj; - }; - - /** - * Sets a value on `base` relative to the given `path` string. - * @method set - * @param {} obj The base object - * @param {string} path The path relative to `base`, e.g. 'Foo.Bar.baz' - * @param {} val The value to set - * @param {number} [begin] Path slice begin - * @param {number} [end] Path slice end - * @return {} Pass through `val` for chaining - */ - Common.set = function (obj, path, val, begin, end) { - var parts = path.split('.').slice(begin, end); - Common.get(obj, path, 0, -1)[parts[parts.length - 1]] = val; - return val; - }; - - /** - * Shuffles the given array in-place. - * The function uses a seeded random generator. - * @method shuffle - * @param {array} array - * @return {array} array shuffled randomly - */ - Common.shuffle = function (array) { - for (var i = array.length - 1; i > 0; i--) { - var j = Math.floor(Common.random() * (i + 1)); - var temp = array[i]; - array[i] = array[j]; - array[j] = temp; - } - return array; - }; - - /** - * Randomly chooses a value from a list with equal probability. - * The function uses a seeded random generator. - * @method choose - * @param {array} choices - * @return {object} A random choice object from the array - */ - Common.choose = function (choices) { - return choices[Math.floor(Common.random() * choices.length)]; - }; - - /** - * Returns true if the object is a HTMLElement, otherwise false. - * @method isElement - * @param {object} obj - * @return {boolean} True if the object is a HTMLElement, otherwise false - */ - Common.isElement = function (obj) { - if (typeof HTMLElement !== 'undefined') { - return obj instanceof HTMLElement; - } - - return !!(obj && obj.nodeType && obj.nodeName); - }; - - /** - * Returns true if the object is an array. - * @method isArray - * @param {object} obj - * @return {boolean} True if the object is an array, otherwise false - */ - Common.isArray = function (obj) { - return Object.prototype.toString.call(obj) === '[object Array]'; - }; - - /** - * Returns true if the object is a function. - * @method isFunction - * @param {object} obj - * @return {boolean} True if the object is a function, otherwise false - */ - Common.isFunction = function (obj) { - return typeof obj === 'function'; - }; - - /** - * Returns true if the object is a plain object. - * @method isPlainObject - * @param {object} obj - * @return {boolean} True if the object is a plain object, otherwise false - */ - Common.isPlainObject = function (obj) { - return typeof obj === 'object' && obj.constructor === Object; - }; - - /** - * Returns true if the object is a string. - * @method isString - * @param {object} obj - * @return {boolean} True if the object is a string, otherwise false - */ - Common.isString = function (obj) { - return toString.call(obj) === '[object String]'; - }; - - /** - * Returns the given value clamped between a minimum and maximum value. - * @method clamp - * @param {number} value - * @param {number} min - * @param {number} max - * @return {number} The value clamped between min and max inclusive - */ - Common.clamp = function (value, min, max) { - if (value < min) return min; - if (value > max) return max; - return value; - }; - - /** - * Returns the sign of the given value. - * @method sign - * @param {number} value - * @return {number} -1 if negative, +1 if 0 or positive - */ - Common.sign = function (value) { - return value < 0 ? -1 : 1; - }; - - /** - * Returns the current timestamp since the time origin (e.g. from page load). - * The result will be high-resolution including decimal places if available. - * @method now - * @return {number} the current timestamp - */ - Common.now = function () { - if (typeof window !== 'undefined' && window.performance) { - if (window.performance.now) { - return window.performance.now(); - } else if (window.performance.webkitNow) { - return window.performance.webkitNow(); - } - } - - return new Date() - Common._nowStartTime; - }; - - /** - * Returns a random value between a minimum and a maximum value inclusive. - * The function uses a seeded random generator. - * @method random - * @param {number} min - * @param {number} max - * @return {number} A random number between min and max inclusive - */ - Common.random = function (min, max) { - min = typeof min !== 'undefined' ? min : 0; - max = typeof max !== 'undefined' ? max : 1; - return min + _seededRandom() * (max - min); - }; - - var _seededRandom = function () { - // https://en.wikipedia.org/wiki/Linear_congruential_generator - Common._seed = (Common._seed * 9301 + 49297) % 233280; - return Common._seed / 233280; - }; - - /** - * Converts a CSS hex colour string into an integer. - * @method colorToNumber - * @param {string} colorString - * @return {number} An integer representing the CSS hex string - */ - Common.colorToNumber = function (colorString) { - colorString = colorString.replace('#', ''); - - if (colorString.length == 3) { - colorString = - colorString.charAt(0) + - colorString.charAt(0) + - colorString.charAt(1) + - colorString.charAt(1) + - colorString.charAt(2) + - colorString.charAt(2); - } - - return parseInt(colorString, 16); - }; - - /** - * The console logging level to use, where each level includes all levels above and excludes the levels below. - * The default level is 'debug' which shows all console messages. - * - * Possible level values are: - * - 0 = None - * - 1 = Debug - * - 2 = Info - * - 3 = Warn - * - 4 = Error - * @property Common.logLevel - * @type {Number} - * @default 1 - */ - Common.logLevel = 1; - - /** - * Shows a `console.log` message only if the current `Common.logLevel` allows it. - * The message will be prefixed with 'matter-js' to make it easily identifiable. - * @method log - * @param ...objs {} The objects to log. - */ - Common.log = function () { - if (console && Common.logLevel > 0 && Common.logLevel <= 3) { - console.log.apply(console, ['matter-js:'].concat(Array.prototype.slice.call(arguments))); - } - }; - - /** - * Shows a `console.info` message only if the current `Common.logLevel` allows it. - * The message will be prefixed with 'matter-js' to make it easily identifiable. - * @method info - * @param ...objs {} The objects to log. - */ - Common.info = function () { - if (console && Common.logLevel > 0 && Common.logLevel <= 2) { - console.info.apply(console, ['matter-js:'].concat(Array.prototype.slice.call(arguments))); - } - }; - - /** - * Shows a `console.warn` message only if the current `Common.logLevel` allows it. - * The message will be prefixed with 'matter-js' to make it easily identifiable. - * @method warn - * @param ...objs {} The objects to log. - */ - Common.warn = function () { - if (console && Common.logLevel > 0 && Common.logLevel <= 3) { - console.warn.apply(console, ['matter-js:'].concat(Array.prototype.slice.call(arguments))); - } - }; - - /** - * Returns the next unique sequential ID. - * @method nextId - * @return {Number} Unique sequential ID - */ - Common.nextId = function () { - return Common._nextId++; - }; - - /** - * A cross browser compatible indexOf implementation. - * @method indexOf - * @param {array} haystack - * @param {object} needle - * @return {number} The position of needle in haystack, otherwise -1. - */ - Common.indexOf = function (haystack, needle) { - if (haystack.indexOf) return haystack.indexOf(needle); - - for (var i = 0; i < haystack.length; i++) { - if (haystack[i] === needle) return i; - } - - return -1; - }; - - /** - * A cross browser compatible array map implementation. - * @method map - * @param {array} list - * @param {function} func - * @return {array} Values from list transformed by func. - */ - Common.map = function (list, func) { - if (list.map) { - return list.map(func); - } - - var mapped = []; - - for (var i = 0; i < list.length; i += 1) { - mapped.push(func(list[i])); - } - - return mapped; - }; - - /** - * Takes a directed graph and returns the partially ordered set of vertices in topological order. - * Circular dependencies are allowed. - * @method topologicalSort - * @param {object} graph - * @return {array} Partially ordered set of vertices in topological order. - */ - Common.topologicalSort = function (graph) { - // https://github.com/mgechev/javascript-algorithms - // Copyright (c) Minko Gechev (MIT license) - // Modifications: tidy formatting and naming - var result = [], - visited = [], - temp = []; - - for (var node in graph) { - if (!visited[node] && !temp[node]) { - Common._topologicalSort(node, visited, temp, graph, result); - } - } - - return result; - }; - - Common._topologicalSort = function (node, visited, temp, graph, result) { - var neighbors = graph[node] || []; - temp[node] = true; - - for (var i = 0; i < neighbors.length; i += 1) { - var neighbor = neighbors[i]; - - if (temp[neighbor]) { - // skip circular dependencies - continue; - } - - if (!visited[neighbor]) { - Common._topologicalSort(neighbor, visited, temp, graph, result); - } - } - - temp[node] = false; - visited[node] = true; - - result.push(node); - }; - - /** - * Takes _n_ functions as arguments and returns a new function that calls them in order. - * The arguments applied when calling the new function will also be applied to every function passed. - * The value of `this` refers to the last value returned in the chain that was not `undefined`. - * Therefore if a passed function does not return a value, the previously returned value is maintained. - * After all passed functions have been called the new function returns the last returned value (if any). - * If any of the passed functions are a chain, then the chain will be flattened. - * @method chain - * @param ...funcs {function} The functions to chain. - * @return {function} A new function that calls the passed functions in order. - */ - Common.chain = function () { - var funcs = []; - - for (var i = 0; i < arguments.length; i += 1) { - var func = arguments[i]; - - if (func._chained) { - // flatten already chained functions - funcs.push.apply(funcs, func._chained); - } else { - funcs.push(func); - } - } - - var chain = function () { - // https://github.com/GoogleChrome/devtools-docs/issues/53#issuecomment-51941358 - var lastResult, - args = new Array(arguments.length); - - for (var i = 0, l = arguments.length; i < l; i++) { - args[i] = arguments[i]; - } - - for (i = 0; i < funcs.length; i += 1) { - var result = funcs[i].apply(lastResult, args); - - if (typeof result !== 'undefined') { - lastResult = result; - } - } - - return lastResult; - }; - - chain._chained = funcs; - - return chain; - }; - - /** - * Chains a function to excute before the original function on the given `path` relative to `base`. - * See also docs for `Common.chain`. - * @method chainPathBefore - * @param {} base The base object - * @param {string} path The path relative to `base` - * @param {function} func The function to chain before the original - * @return {function} The chained function that replaced the original - */ - Common.chainPathBefore = function (base, path, func) { - return Common.set(base, path, Common.chain(func, Common.get(base, path))); - }; - - /** - * Chains a function to excute after the original function on the given `path` relative to `base`. - * See also docs for `Common.chain`. - * @method chainPathAfter - * @param {} base The base object - * @param {string} path The path relative to `base` - * @param {function} func The function to chain after the original - * @return {function} The chained function that replaced the original - */ - Common.chainPathAfter = function (base, path, func) { - return Common.set(base, path, Common.chain(Common.get(base, path), func)); - }; - })(); - - /***/ - }, - /* 1 */ - /***/ function (module, exports) { - /** - * The `Matter.Bounds` module contains methods for creating and manipulating axis-aligned bounding boxes (AABB). - * - * @class Bounds - */ - - var Bounds = {}; - - module.exports = Bounds; - - (function () { - /** - * Creates a new axis-aligned bounding box (AABB) for the given vertices. - * @method create - * @param {vertices} vertices - * @return {bounds} A new bounds object - */ - Bounds.create = function (vertices) { - var bounds = { - min: {x: 0, y: 0}, - max: {x: 0, y: 0}, - }; - - if (vertices) Bounds.update(bounds, vertices); - - return bounds; - }; - - /** - * Updates bounds using the given vertices and extends the bounds given a velocity. - * @method update - * @param {bounds} bounds - * @param {vertices} vertices - * @param {vector} velocity - */ - Bounds.update = function (bounds, vertices, velocity) { - bounds.min.x = Infinity; - bounds.max.x = -Infinity; - bounds.min.y = Infinity; - bounds.max.y = -Infinity; - - for (var i = 0; i < vertices.length; i++) { - var vertex = vertices[i]; - if (vertex.x > bounds.max.x) bounds.max.x = vertex.x; - if (vertex.x < bounds.min.x) bounds.min.x = vertex.x; - if (vertex.y > bounds.max.y) bounds.max.y = vertex.y; - if (vertex.y < bounds.min.y) bounds.min.y = vertex.y; - } - - if (velocity) { - if (velocity.x > 0) { - bounds.max.x += velocity.x; - } else { - bounds.min.x += velocity.x; - } - - if (velocity.y > 0) { - bounds.max.y += velocity.y; - } else { - bounds.min.y += velocity.y; - } - } - }; - - /** - * Returns true if the bounds contains the given point. - * @method contains - * @param {bounds} bounds - * @param {vector} point - * @return {boolean} True if the bounds contain the point, otherwise false - */ - Bounds.contains = function (bounds, point) { - return ( - point.x >= bounds.min.x && point.x <= bounds.max.x && point.y >= bounds.min.y && point.y <= bounds.max.y - ); - }; - - /** - * Returns true if the two bounds intersect. - * @method overlaps - * @param {bounds} boundsA - * @param {bounds} boundsB - * @return {boolean} True if the bounds overlap, otherwise false - */ - Bounds.overlaps = function (boundsA, boundsB) { - return ( - boundsA.min.x <= boundsB.max.x && - boundsA.max.x >= boundsB.min.x && - boundsA.max.y >= boundsB.min.y && - boundsA.min.y <= boundsB.max.y - ); - }; - - /** - * Translates the bounds by the given vector. - * @method translate - * @param {bounds} bounds - * @param {vector} vector - */ - Bounds.translate = function (bounds, vector) { - bounds.min.x += vector.x; - bounds.max.x += vector.x; - bounds.min.y += vector.y; - bounds.max.y += vector.y; - }; - - /** - * Shifts the bounds to the given position. - * @method shift - * @param {bounds} bounds - * @param {vector} position - */ - Bounds.shift = function (bounds, position) { - var deltaX = bounds.max.x - bounds.min.x, - deltaY = bounds.max.y - bounds.min.y; - - bounds.min.x = position.x; - bounds.max.x = position.x + deltaX; - bounds.min.y = position.y; - bounds.max.y = position.y + deltaY; - }; - })(); - - /***/ - }, - /* 2 */ - /***/ function (module, exports) { - /** - * The `Matter.Vector` module contains methods for creating and manipulating vectors. - * Vectors are the basis of all the geometry related operations in the engine. - * A `Matter.Vector` object is of the form `{ x: 0, y: 0 }`. - * - * See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples). - * - * @class Vector - */ - - // TODO: consider params for reusing vector objects - - var Vector = {}; - - module.exports = Vector; - - (function () { - /** - * Creates a new vector. - * @method create - * @param {number} x - * @param {number} y - * @return {vector} A new vector - */ - Vector.create = function (x, y) { - return {x: x || 0, y: y || 0}; - }; - - /** - * Returns a new vector with `x` and `y` copied from the given `vector`. - * @method clone - * @param {vector} vector - * @return {vector} A new cloned vector - */ - Vector.clone = function (vector) { - return {x: vector.x, y: vector.y}; - }; - - /** - * Returns the magnitude (length) of a vector. - * @method magnitude - * @param {vector} vector - * @return {number} The magnitude of the vector - */ - Vector.magnitude = function (vector) { - return Math.sqrt(vector.x * vector.x + vector.y * vector.y); - }; - - /** - * Returns the magnitude (length) of a vector (therefore saving a `sqrt` operation). - * @method magnitudeSquared - * @param {vector} vector - * @return {number} The squared magnitude of the vector - */ - Vector.magnitudeSquared = function (vector) { - return vector.x * vector.x + vector.y * vector.y; - }; - - /** - * Rotates the vector about (0, 0) by specified angle. - * @method rotate - * @param {vector} vector - * @param {number} angle - * @param {vector} [output] - * @return {vector} The vector rotated about (0, 0) - */ - Vector.rotate = function (vector, angle, output) { - var cos = Math.cos(angle), - sin = Math.sin(angle); - if (!output) output = {}; - var x = vector.x * cos - vector.y * sin; - output.y = vector.x * sin + vector.y * cos; - output.x = x; - return output; - }; - - /** - * Rotates the vector about a specified point by specified angle. - * @method rotateAbout - * @param {vector} vector - * @param {number} angle - * @param {vector} point - * @param {vector} [output] - * @return {vector} A new vector rotated about the point - */ - Vector.rotateAbout = function (vector, angle, point, output) { - var cos = Math.cos(angle), - sin = Math.sin(angle); - if (!output) output = {}; - var x = point.x + ((vector.x - point.x) * cos - (vector.y - point.y) * sin); - output.y = point.y + ((vector.x - point.x) * sin + (vector.y - point.y) * cos); - output.x = x; - return output; - }; - - /** - * Normalises a vector (such that its magnitude is `1`). - * @method normalise - * @param {vector} vector - * @return {vector} A new vector normalised - */ - Vector.normalise = function (vector) { - var magnitude = Vector.magnitude(vector); - if (magnitude === 0) return {x: 0, y: 0}; - return {x: vector.x / magnitude, y: vector.y / magnitude}; - }; - - /** - * Returns the dot-product of two vectors. - * @method dot - * @param {vector} vectorA - * @param {vector} vectorB - * @return {number} The dot product of the two vectors - */ - Vector.dot = function (vectorA, vectorB) { - return vectorA.x * vectorB.x + vectorA.y * vectorB.y; - }; - - /** - * Returns the cross-product of two vectors. - * @method cross - * @param {vector} vectorA - * @param {vector} vectorB - * @return {number} The cross product of the two vectors - */ - Vector.cross = function (vectorA, vectorB) { - return vectorA.x * vectorB.y - vectorA.y * vectorB.x; - }; - - /** - * Returns the cross-product of three vectors. - * @method cross3 - * @param {vector} vectorA - * @param {vector} vectorB - * @param {vector} vectorC - * @return {number} The cross product of the three vectors - */ - Vector.cross3 = function (vectorA, vectorB, vectorC) { - return ( - (vectorB.x - vectorA.x) * (vectorC.y - vectorA.y) - (vectorB.y - vectorA.y) * (vectorC.x - vectorA.x) - ); - }; - - /** - * Adds the two vectors. - * @method add - * @param {vector} vectorA - * @param {vector} vectorB - * @param {vector} [output] - * @return {vector} A new vector of vectorA and vectorB added - */ - Vector.add = function (vectorA, vectorB, output) { - if (!output) output = {}; - output.x = vectorA.x + vectorB.x; - output.y = vectorA.y + vectorB.y; - return output; - }; - - /** - * Subtracts the two vectors. - * @method sub - * @param {vector} vectorA - * @param {vector} vectorB - * @param {vector} [output] - * @return {vector} A new vector of vectorA and vectorB subtracted - */ - Vector.sub = function (vectorA, vectorB, output) { - if (!output) output = {}; - output.x = vectorA.x - vectorB.x; - output.y = vectorA.y - vectorB.y; - return output; - }; - - /** - * Multiplies a vector and a scalar. - * @method mult - * @param {vector} vector - * @param {number} scalar - * @return {vector} A new vector multiplied by scalar - */ - Vector.mult = function (vector, scalar) { - return {x: vector.x * scalar, y: vector.y * scalar}; - }; - - /** - * Divides a vector and a scalar. - * @method div - * @param {vector} vector - * @param {number} scalar - * @return {vector} A new vector divided by scalar - */ - Vector.div = function (vector, scalar) { - return {x: vector.x / scalar, y: vector.y / scalar}; - }; - - /** - * Returns the perpendicular vector. Set `negate` to true for the perpendicular in the opposite direction. - * @method perp - * @param {vector} vector - * @param {bool} [negate=false] - * @return {vector} The perpendicular vector - */ - Vector.perp = function (vector, negate) { - negate = negate === true ? -1 : 1; - return {x: negate * -vector.y, y: negate * vector.x}; - }; - - /** - * Negates both components of a vector such that it points in the opposite direction. - * @method neg - * @param {vector} vector - * @return {vector} The negated vector - */ - Vector.neg = function (vector) { - return {x: -vector.x, y: -vector.y}; - }; - - /** - * Returns the angle between the vector `vectorB - vectorA` and the x-axis in radians. - * @method angle - * @param {vector} vectorA - * @param {vector} vectorB - * @return {number} The angle in radians - */ - Vector.angle = function (vectorA, vectorB) { - return Math.atan2(vectorB.y - vectorA.y, vectorB.x - vectorA.x); - }; - - /** - * Temporary vector pool (not thread-safe). - * @property _temp - * @type {vector[]} - * @private - */ - Vector._temp = [ - Vector.create(), - Vector.create(), - Vector.create(), - Vector.create(), - Vector.create(), - Vector.create(), - ]; - })(); - - /***/ - }, - /* 3 */ - /***/ function (module, exports, __webpack_require__) { - /** - * The `Matter.Vertices` module contains methods for creating and manipulating sets of vertices. - * A set of vertices is an array of `Matter.Vector` with additional indexing properties inserted by `Vertices.create`. - * A `Matter.Body` maintains a set of vertices to represent the shape of the object (its convex hull). - * - * See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples). - * - * @class Vertices - */ - - var Vertices = {}; - - module.exports = Vertices; - - var Vector = __webpack_require__(2); - var Common = __webpack_require__(0); - - (function () { - /** - * Creates a new set of `Matter.Body` compatible vertices. - * The `points` argument accepts an array of `Matter.Vector` points orientated around the origin `(0, 0)`, for example: - * - * [{ x: 0, y: 0 }, { x: 25, y: 50 }, { x: 50, y: 0 }] - * - * The `Vertices.create` method returns a new array of vertices, which are similar to Matter.Vector objects, - * but with some additional references required for efficient collision detection routines. - * - * Vertices must be specified in clockwise order. - * - * Note that the `body` argument is not optional, a `Matter.Body` reference must be provided. - * - * @method create - * @param {vector[]} points - * @param {body} body - */ - Vertices.create = function (points, body) { - var vertices = []; - - for (var i = 0; i < points.length; i++) { - var point = points[i], - vertex = { - x: point.x, - y: point.y, - index: i, - body: body, - isInternal: false, - }; - - vertices.push(vertex); - } - - return vertices; - }; - - /** - * Parses a string containing ordered x y pairs separated by spaces (and optionally commas), - * into a `Matter.Vertices` object for the given `Matter.Body`. - * For parsing SVG paths, see `Svg.pathToVertices`. - * @method fromPath - * @param {string} path - * @param {body} body - * @return {vertices} vertices - */ - Vertices.fromPath = function (path, body) { - var pathPattern = /L?\s*([-\d.e]+)[\s,]*([-\d.e]+)*/gi, - points = []; - - path.replace(pathPattern, function (match, x, y) { - points.push({x: parseFloat(x), y: parseFloat(y)}); - }); - - return Vertices.create(points, body); - }; - - /** - * Returns the centre (centroid) of the set of vertices. - * @method centre - * @param {vertices} vertices - * @return {vector} The centre point - */ - Vertices.centre = function (vertices) { - var area = Vertices.area(vertices, true), - centre = {x: 0, y: 0}, - cross, - temp, - j; - - for (var i = 0; i < vertices.length; i++) { - j = (i + 1) % vertices.length; - cross = Vector.cross(vertices[i], vertices[j]); - temp = Vector.mult(Vector.add(vertices[i], vertices[j]), cross); - centre = Vector.add(centre, temp); - } - - return Vector.div(centre, 6 * area); - }; - - /** - * Returns the average (mean) of the set of vertices. - * @method mean - * @param {vertices} vertices - * @return {vector} The average point - */ - Vertices.mean = function (vertices) { - var average = {x: 0, y: 0}; - - for (var i = 0; i < vertices.length; i++) { - average.x += vertices[i].x; - average.y += vertices[i].y; - } - - return Vector.div(average, vertices.length); - }; - - /** - * Returns the area of the set of vertices. - * @method area - * @param {vertices} vertices - * @param {bool} signed - * @return {number} The area - */ - Vertices.area = function (vertices, signed) { - var area = 0, - j = vertices.length - 1; - - for (var i = 0; i < vertices.length; i++) { - area += (vertices[j].x - vertices[i].x) * (vertices[j].y + vertices[i].y); - j = i; - } - - if (signed) return area / 2; - - return Math.abs(area) / 2; - }; - - /** - * Returns the moment of inertia (second moment of area) of the set of vertices given the total mass. - * @method inertia - * @param {vertices} vertices - * @param {number} mass - * @return {number} The polygon's moment of inertia - */ - Vertices.inertia = function (vertices, mass) { - var numerator = 0, - denominator = 0, - v = vertices, - cross, - j; - - // find the polygon's moment of inertia, using second moment of area - // from equations at http://www.physicsforums.com/showthread.php?t=25293 - for (var n = 0; n < v.length; n++) { - j = (n + 1) % v.length; - cross = Math.abs(Vector.cross(v[j], v[n])); - numerator += cross * (Vector.dot(v[j], v[j]) + Vector.dot(v[j], v[n]) + Vector.dot(v[n], v[n])); - denominator += cross; - } - - return (mass / 6) * (numerator / denominator); - }; - - /** - * Translates the set of vertices in-place. - * @method translate - * @param {vertices} vertices - * @param {vector} vector - * @param {number} scalar - */ - Vertices.translate = function (vertices, vector, scalar) { - var i; - if (scalar) { - for (i = 0; i < vertices.length; i++) { - vertices[i].x += vector.x * scalar; - vertices[i].y += vector.y * scalar; - } - } else { - for (i = 0; i < vertices.length; i++) { - vertices[i].x += vector.x; - vertices[i].y += vector.y; - } - } - - return vertices; - }; - - /** - * Rotates the set of vertices in-place. - * @method rotate - * @param {vertices} vertices - * @param {number} angle - * @param {vector} point - */ - Vertices.rotate = function (vertices, angle, point) { - if (angle === 0) return; - - var cos = Math.cos(angle), - sin = Math.sin(angle); - - for (var i = 0; i < vertices.length; i++) { - var vertice = vertices[i], - dx = vertice.x - point.x, - dy = vertice.y - point.y; - - vertice.x = point.x + (dx * cos - dy * sin); - vertice.y = point.y + (dx * sin + dy * cos); - } - - return vertices; - }; - - /** - * Returns `true` if the `point` is inside the set of `vertices`. - * @method contains - * @param {vertices} vertices - * @param {vector} point - * @return {boolean} True if the vertices contains point, otherwise false - */ - Vertices.contains = function (vertices, point) { - for (var i = 0; i < vertices.length; i++) { - var vertice = vertices[i], - nextVertice = vertices[(i + 1) % vertices.length]; - if ( - (point.x - vertice.x) * (nextVertice.y - vertice.y) + - (point.y - vertice.y) * (vertice.x - nextVertice.x) > - 0 - ) { - return false; - } - } - - return true; - }; - - /** - * Scales the vertices from a point (default is centre) in-place. - * @method scale - * @param {vertices} vertices - * @param {number} scaleX - * @param {number} scaleY - * @param {vector} point - */ - Vertices.scale = function (vertices, scaleX, scaleY, point) { - if (scaleX === 1 && scaleY === 1) return vertices; - - point = point || Vertices.centre(vertices); - - var vertex, delta; - - for (var i = 0; i < vertices.length; i++) { - vertex = vertices[i]; - delta = Vector.sub(vertex, point); - vertices[i].x = point.x + delta.x * scaleX; - vertices[i].y = point.y + delta.y * scaleY; - } - - return vertices; - }; - - /** - * Chamfers a set of vertices by giving them rounded corners, returns a new set of vertices. - * The radius parameter is a single number or an array to specify the radius for each vertex. - * @method chamfer - * @param {vertices} vertices - * @param {number[]} radius - * @param {number} quality - * @param {number} qualityMin - * @param {number} qualityMax - */ - Vertices.chamfer = function (vertices, radius, quality, qualityMin, qualityMax) { - if (typeof radius === 'number') { - radius = [radius]; - } else { - radius = radius || [8]; - } - - // quality defaults to -1, which is auto - quality = typeof quality !== 'undefined' ? quality : -1; - qualityMin = qualityMin || 2; - qualityMax = qualityMax || 14; - - var newVertices = []; - - for (var i = 0; i < vertices.length; i++) { - var prevVertex = vertices[i - 1 >= 0 ? i - 1 : vertices.length - 1], - vertex = vertices[i], - nextVertex = vertices[(i + 1) % vertices.length], - currentRadius = radius[i < radius.length ? i : radius.length - 1]; - - if (currentRadius === 0) { - newVertices.push(vertex); - continue; - } - - var prevNormal = Vector.normalise({ - x: vertex.y - prevVertex.y, - y: prevVertex.x - vertex.x, - }); - - var nextNormal = Vector.normalise({ - x: nextVertex.y - vertex.y, - y: vertex.x - nextVertex.x, - }); - - var diagonalRadius = Math.sqrt(2 * Math.pow(currentRadius, 2)), - radiusVector = Vector.mult(Common.clone(prevNormal), currentRadius), - midNormal = Vector.normalise(Vector.mult(Vector.add(prevNormal, nextNormal), 0.5)), - scaledVertex = Vector.sub(vertex, Vector.mult(midNormal, diagonalRadius)); - - var precision = quality; - - if (quality === -1) { - // automatically decide precision - precision = Math.pow(currentRadius, 0.32) * 1.75; - } - - precision = Common.clamp(precision, qualityMin, qualityMax); - - // use an even value for precision, more likely to reduce axes by using symmetry - if (precision % 2 === 1) precision += 1; - - var alpha = Math.acos(Vector.dot(prevNormal, nextNormal)), - theta = alpha / precision; - - for (var j = 0; j < precision; j++) { - newVertices.push(Vector.add(Vector.rotate(radiusVector, theta * j), scaledVertex)); - } - } - - return newVertices; - }; - - /** - * Sorts the input vertices into clockwise order in place. - * @method clockwiseSort - * @param {vertices} vertices - * @return {vertices} vertices - */ - Vertices.clockwiseSort = function (vertices) { - var centre = Vertices.mean(vertices); - - vertices.sort(function (vertexA, vertexB) { - return Vector.angle(centre, vertexA) - Vector.angle(centre, vertexB); - }); - - return vertices; - }; - - /** - * Returns true if the vertices form a convex shape (vertices must be in clockwise order). - * @method isConvex - * @param {vertices} vertices - * @return {bool} `true` if the `vertices` are convex, `false` if not (or `null` if not computable). - */ - Vertices.isConvex = function (vertices) { - // http://paulbourke.net/geometry/polygonmesh/ - // Copyright (c) Paul Bourke (use permitted) - - var flag = 0, - n = vertices.length, - i, - j, - k, - z; - - if (n < 3) return null; - - for (i = 0; i < n; i++) { - j = (i + 1) % n; - k = (i + 2) % n; - z = (vertices[j].x - vertices[i].x) * (vertices[k].y - vertices[j].y); - z -= (vertices[j].y - vertices[i].y) * (vertices[k].x - vertices[j].x); - - if (z < 0) { - flag |= 1; - } else if (z > 0) { - flag |= 2; - } - - if (flag === 3) { - return false; - } - } - - if (flag !== 0) { - return true; - } else { - return null; - } - }; - - /** - * Returns the convex hull of the input vertices as a new array of points. - * @method hull - * @param {vertices} vertices - * @return [vertex] vertices - */ - Vertices.hull = function (vertices) { - // http://geomalgorithms.com/a10-_hull-1.html - - var upper = [], - lower = [], - vertex, - i; - - // sort vertices on x-axis (y-axis for ties) - vertices = vertices.slice(0); - vertices.sort(function (vertexA, vertexB) { - var dx = vertexA.x - vertexB.x; - return dx !== 0 ? dx : vertexA.y - vertexB.y; - }); - - // build lower hull - for (i = 0; i < vertices.length; i += 1) { - vertex = vertices[i]; - - while ( - lower.length >= 2 && - Vector.cross3(lower[lower.length - 2], lower[lower.length - 1], vertex) <= 0 - ) { - lower.pop(); - } - - lower.push(vertex); - } - - // build upper hull - for (i = vertices.length - 1; i >= 0; i -= 1) { - vertex = vertices[i]; - - while ( - upper.length >= 2 && - Vector.cross3(upper[upper.length - 2], upper[upper.length - 1], vertex) <= 0 - ) { - upper.pop(); - } - - upper.push(vertex); - } - - // concatenation of the lower and upper hulls gives the convex hull - // omit last points because they are repeated at the beginning of the other list - upper.pop(); - lower.pop(); - - return upper.concat(lower); - }; - })(); - - /***/ - }, - /* 4 */ - /***/ function (module, exports, __webpack_require__) { - /** - * The `Matter.Events` module contains methods to fire and listen to events on other objects. - * - * See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples). - * - * @class Events - */ - - var Events = {}; - - module.exports = Events; - - var Common = __webpack_require__(0); - - (function () { - /** - * Subscribes a callback function to the given object's `eventName`. - * @method on - * @param {} object - * @param {string} eventNames - * @param {function} callback - */ - Events.on = function (object, eventNames, callback) { - var names = eventNames.split(' '), - name; - - for (var i = 0; i < names.length; i++) { - name = names[i]; - object.events = object.events || {}; - object.events[name] = object.events[name] || []; - object.events[name].push(callback); - } - - return callback; - }; - - /** - * Removes the given event callback. If no callback, clears all callbacks in `eventNames`. If no `eventNames`, clears all events. - * @method off - * @param {} object - * @param {string} eventNames - * @param {function} callback - */ - Events.off = function (object, eventNames, callback) { - if (!eventNames) { - object.events = {}; - return; - } - - // handle Events.off(object, callback) - if (typeof eventNames === 'function') { - callback = eventNames; - eventNames = Common.keys(object.events).join(' '); - } - - var names = eventNames.split(' '); - - for (var i = 0; i < names.length; i++) { - var callbacks = object.events[names[i]], - newCallbacks = []; - - if (callback && callbacks) { - for (var j = 0; j < callbacks.length; j++) { - if (callbacks[j] !== callback) newCallbacks.push(callbacks[j]); - } - } - - object.events[names[i]] = newCallbacks; - } - }; - - /** - * Fires all the callbacks subscribed to the given object's `eventName`, in the order they subscribed, if any. - * @method trigger - * @param {} object - * @param {string} eventNames - * @param {} event - */ - Events.trigger = function (object, eventNames, event) { - var names, name, callbacks, eventClone; - - var events = object.events; - - if (events && Common.keys(events).length > 0) { - if (!event) event = {}; - - names = eventNames.split(' '); - - for (var i = 0; i < names.length; i++) { - name = names[i]; - callbacks = events[name]; - - if (callbacks) { - eventClone = Common.clone(event, false); - eventClone.name = name; - eventClone.source = object; - - for (var j = 0; j < callbacks.length; j++) { - callbacks[j].apply(object, [eventClone]); - } - } - } - } - }; - })(); - - /***/ - }, - /* 5 */ - /***/ function (module, exports, __webpack_require__) { - /** - * The `Matter.Composite` module contains methods for creating and manipulating composite bodies. - * A composite body is a collection of `Matter.Body`, `Matter.Constraint` and other `Matter.Composite`, therefore composites form a tree structure. - * It is important to use the functions in this module to modify composites, rather than directly modifying their properties. - * Note that the `Matter.World` object is also a type of `Matter.Composite` and as such all composite methods here can also operate on a `Matter.World`. - * - * See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples). - * - * @class Composite - */ - - var Composite = {}; - - module.exports = Composite; - - var Events = __webpack_require__(4); - var Common = __webpack_require__(0); - var Bounds = __webpack_require__(1); - var Body = __webpack_require__(6); - - (function () { - /** - * Creates a new composite. The options parameter is an object that specifies any properties you wish to override the defaults. - * See the properites section below for detailed information on what you can pass via the `options` object. - * @method create - * @param {} [options] - * @return {composite} A new composite - */ - Composite.create = function (options) { - return Common.extend( - { - id: Common.nextId(), - type: 'composite', - parent: null, - isModified: false, - bodies: [], - constraints: [], - composites: [], - label: 'Composite', - plugin: {}, - }, - options, - ); - }; - - /** - * Sets the composite's `isModified` flag. - * If `updateParents` is true, all parents will be set (default: false). - * If `updateChildren` is true, all children will be set (default: false). - * @method setModified - * @param {composite} composite - * @param {boolean} isModified - * @param {boolean} [updateParents=false] - * @param {boolean} [updateChildren=false] - */ - Composite.setModified = function (composite, isModified, updateParents, updateChildren) { - composite.isModified = isModified; - - if (updateParents && composite.parent) { - Composite.setModified(composite.parent, isModified, updateParents, updateChildren); - } - - if (updateChildren) { - for (var i = 0; i < composite.composites.length; i++) { - var childComposite = composite.composites[i]; - Composite.setModified(childComposite, isModified, updateParents, updateChildren); - } - } - }; - - /** - * Generic add function. Adds one or many body(s), constraint(s) or a composite(s) to the given composite. - * Triggers `beforeAdd` and `afterAdd` events on the `composite`. - * @method add - * @param {composite} composite - * @param {} object - * @return {composite} The original composite with the objects added - */ - Composite.add = function (composite, object) { - var objects = [].concat(object); - - Events.trigger(composite, 'beforeAdd', {object: object}); - - for (var i = 0; i < objects.length; i++) { - var obj = objects[i]; - - switch (obj.type) { - case 'body': - // skip adding compound parts - if (obj.parent !== obj) { - Common.warn('Composite.add: skipped adding a compound body part (you must add its parent instead)'); - break; - } - - Composite.addBody(composite, obj); - break; - case 'constraint': - Composite.addConstraint(composite, obj); - break; - case 'composite': - Composite.addComposite(composite, obj); - break; - case 'mouseConstraint': - Composite.addConstraint(composite, obj.constraint); - break; - } - } - - Events.trigger(composite, 'afterAdd', {object: object}); - - return composite; - }; - - /** - * Generic remove function. Removes one or many body(s), constraint(s) or a composite(s) to the given composite. - * Optionally searching its children recursively. - * Triggers `beforeRemove` and `afterRemove` events on the `composite`. - * @method remove - * @param {composite} composite - * @param {} object - * @param {boolean} [deep=false] - * @return {composite} The original composite with the objects removed - */ - Composite.remove = function (composite, object, deep) { - var objects = [].concat(object); - - Events.trigger(composite, 'beforeRemove', {object: object}); - - for (var i = 0; i < objects.length; i++) { - var obj = objects[i]; - - switch (obj.type) { - case 'body': - Composite.removeBody(composite, obj, deep); - break; - case 'constraint': - Composite.removeConstraint(composite, obj, deep); - break; - case 'composite': - Composite.removeComposite(composite, obj, deep); - break; - case 'mouseConstraint': - Composite.removeConstraint(composite, obj.constraint); - break; - } - } - - Events.trigger(composite, 'afterRemove', {object: object}); - - return composite; - }; - - /** - * Adds a composite to the given composite. - * @private - * @method addComposite - * @param {composite} compositeA - * @param {composite} compositeB - * @return {composite} The original compositeA with the objects from compositeB added - */ - Composite.addComposite = function (compositeA, compositeB) { - compositeA.composites.push(compositeB); - compositeB.parent = compositeA; - Composite.setModified(compositeA, true, true, false); - return compositeA; - }; - - /** - * Removes a composite from the given composite, and optionally searching its children recursively. - * @private - * @method removeComposite - * @param {composite} compositeA - * @param {composite} compositeB - * @param {boolean} [deep=false] - * @return {composite} The original compositeA with the composite removed - */ - Composite.removeComposite = function (compositeA, compositeB, deep) { - var position = Common.indexOf(compositeA.composites, compositeB); - if (position !== -1) { - Composite.removeCompositeAt(compositeA, position); - Composite.setModified(compositeA, true, true, false); - } - - if (deep) { - for (var i = 0; i < compositeA.composites.length; i++) { - Composite.removeComposite(compositeA.composites[i], compositeB, true); - } - } - - return compositeA; - }; - - /** - * Removes a composite from the given composite. - * @private - * @method removeCompositeAt - * @param {composite} composite - * @param {number} position - * @return {composite} The original composite with the composite removed - */ - Composite.removeCompositeAt = function (composite, position) { - composite.composites.splice(position, 1); - Composite.setModified(composite, true, true, false); - return composite; - }; - - /** - * Adds a body to the given composite. - * @private - * @method addBody - * @param {composite} composite - * @param {body} body - * @return {composite} The original composite with the body added - */ - Composite.addBody = function (composite, body) { - composite.bodies.push(body); - Composite.setModified(composite, true, true, false); - return composite; - }; - - /** - * Removes a body from the given composite, and optionally searching its children recursively. - * @private - * @method removeBody - * @param {composite} composite - * @param {body} body - * @param {boolean} [deep=false] - * @return {composite} The original composite with the body removed - */ - Composite.removeBody = function (composite, body, deep) { - var position = Common.indexOf(composite.bodies, body); - if (position !== -1) { - Composite.removeBodyAt(composite, position); - Composite.setModified(composite, true, true, false); - } - - if (deep) { - for (var i = 0; i < composite.composites.length; i++) { - Composite.removeBody(composite.composites[i], body, true); - } - } - - return composite; - }; - - /** - * Removes a body from the given composite. - * @private - * @method removeBodyAt - * @param {composite} composite - * @param {number} position - * @return {composite} The original composite with the body removed - */ - Composite.removeBodyAt = function (composite, position) { - composite.bodies.splice(position, 1); - Composite.setModified(composite, true, true, false); - return composite; - }; - - /** - * Adds a constraint to the given composite. - * @private - * @method addConstraint - * @param {composite} composite - * @param {constraint} constraint - * @return {composite} The original composite with the constraint added - */ - Composite.addConstraint = function (composite, constraint) { - composite.constraints.push(constraint); - Composite.setModified(composite, true, true, false); - return composite; - }; - - /** - * Removes a constraint from the given composite, and optionally searching its children recursively. - * @private - * @method removeConstraint - * @param {composite} composite - * @param {constraint} constraint - * @param {boolean} [deep=false] - * @return {composite} The original composite with the constraint removed - */ - Composite.removeConstraint = function (composite, constraint, deep) { - var position = Common.indexOf(composite.constraints, constraint); - if (position !== -1) { - Composite.removeConstraintAt(composite, position); - } - - if (deep) { - for (var i = 0; i < composite.composites.length; i++) { - Composite.removeConstraint(composite.composites[i], constraint, true); - } - } - - return composite; - }; - - /** - * Removes a body from the given composite. - * @private - * @method removeConstraintAt - * @param {composite} composite - * @param {number} position - * @return {composite} The original composite with the constraint removed - */ - Composite.removeConstraintAt = function (composite, position) { - composite.constraints.splice(position, 1); - Composite.setModified(composite, true, true, false); - return composite; - }; - - /** - * Removes all bodies, constraints and composites from the given composite. - * Optionally clearing its children recursively. - * @method clear - * @param {composite} composite - * @param {boolean} keepStatic - * @param {boolean} [deep=false] - */ - Composite.clear = function (composite, keepStatic, deep) { - if (deep) { - for (var i = 0; i < composite.composites.length; i++) { - Composite.clear(composite.composites[i], keepStatic, true); - } - } - - if (keepStatic) { - composite.bodies = composite.bodies.filter(function (body) { - return body.isStatic; - }); - } else { - composite.bodies.length = 0; - } - - composite.constraints.length = 0; - composite.composites.length = 0; - Composite.setModified(composite, true, true, false); - - return composite; - }; - - /** - * Returns all bodies in the given composite, including all bodies in its children, recursively. - * @method allBodies - * @param {composite} composite - * @return {body[]} All the bodies - */ - Composite.allBodies = function (composite) { - var bodies = [].concat(composite.bodies); - - for (var i = 0; i < composite.composites.length; i++) - bodies = bodies.concat(Composite.allBodies(composite.composites[i])); - - return bodies; - }; - - /** - * Returns all constraints in the given composite, including all constraints in its children, recursively. - * @method allConstraints - * @param {composite} composite - * @return {constraint[]} All the constraints - */ - Composite.allConstraints = function (composite) { - var constraints = [].concat(composite.constraints); - - for (var i = 0; i < composite.composites.length; i++) - constraints = constraints.concat(Composite.allConstraints(composite.composites[i])); - - return constraints; - }; - - /** - * Returns all composites in the given composite, including all composites in its children, recursively. - * @method allComposites - * @param {composite} composite - * @return {composite[]} All the composites - */ - Composite.allComposites = function (composite) { - var composites = [].concat(composite.composites); - - for (var i = 0; i < composite.composites.length; i++) - composites = composites.concat(Composite.allComposites(composite.composites[i])); - - return composites; - }; - - /** - * Searches the composite recursively for an object matching the type and id supplied, null if not found. - * @method get - * @param {composite} composite - * @param {number} id - * @param {string} type - * @return {object} The requested object, if found - */ - Composite.get = function (composite, id, type) { - var objects, object; - - switch (type) { - case 'body': - objects = Composite.allBodies(composite); - break; - case 'constraint': - objects = Composite.allConstraints(composite); - break; - case 'composite': - objects = Composite.allComposites(composite).concat(composite); - break; - } - - if (!objects) return null; - - object = objects.filter(function (object) { - return object.id.toString() === id.toString(); - }); - - return object.length === 0 ? null : object[0]; - }; - - /** - * Moves the given object(s) from compositeA to compositeB (equal to a remove followed by an add). - * @method move - * @param {compositeA} compositeA - * @param {object[]} objects - * @param {compositeB} compositeB - * @return {composite} Returns compositeA - */ - Composite.move = function (compositeA, objects, compositeB) { - Composite.remove(compositeA, objects); - Composite.add(compositeB, objects); - return compositeA; - }; - - /** - * Assigns new ids for all objects in the composite, recursively. - * @method rebase - * @param {composite} composite - * @return {composite} Returns composite - */ - Composite.rebase = function (composite) { - var objects = Composite.allBodies(composite) - .concat(Composite.allConstraints(composite)) - .concat(Composite.allComposites(composite)); - - for (var i = 0; i < objects.length; i++) { - objects[i].id = Common.nextId(); - } - - Composite.setModified(composite, true, true, false); - - return composite; - }; - - /** - * Translates all children in the composite by a given vector relative to their current positions, - * without imparting any velocity. - * @method translate - * @param {composite} composite - * @param {vector} translation - * @param {bool} [recursive=true] - */ - Composite.translate = function (composite, translation, recursive) { - var bodies = recursive ? Composite.allBodies(composite) : composite.bodies; - - for (var i = 0; i < bodies.length; i++) { - Body.translate(bodies[i], translation); - } - - Composite.setModified(composite, true, true, false); - - return composite; - }; - - /** - * Rotates all children in the composite by a given angle about the given point, without imparting any angular velocity. - * @method rotate - * @param {composite} composite - * @param {number} rotation - * @param {vector} point - * @param {bool} [recursive=true] - */ - Composite.rotate = function (composite, rotation, point, recursive) { - var cos = Math.cos(rotation), - sin = Math.sin(rotation), - bodies = recursive ? Composite.allBodies(composite) : composite.bodies; - - for (var i = 0; i < bodies.length; i++) { - var body = bodies[i], - dx = body.position.x - point.x, - dy = body.position.y - point.y; - - Body.setPosition(body, { - x: point.x + (dx * cos - dy * sin), - y: point.y + (dx * sin + dy * cos), - }); - - Body.rotate(body, rotation); - } - - Composite.setModified(composite, true, true, false); - - return composite; - }; - - /** - * Scales all children in the composite, including updating physical properties (mass, area, axes, inertia), from a world-space point. - * @method scale - * @param {composite} composite - * @param {number} scaleX - * @param {number} scaleY - * @param {vector} point - * @param {bool} [recursive=true] - */ - Composite.scale = function (composite, scaleX, scaleY, point, recursive) { - var bodies = recursive ? Composite.allBodies(composite) : composite.bodies; - - for (var i = 0; i < bodies.length; i++) { - var body = bodies[i], - dx = body.position.x - point.x, - dy = body.position.y - point.y; - - Body.setPosition(body, { - x: point.x + dx * scaleX, - y: point.y + dy * scaleY, - }); - - Body.scale(body, scaleX, scaleY); - } - - Composite.setModified(composite, true, true, false); - - return composite; - }; - - /** - * Returns the union of the bounds of all of the composite's bodies. - * @method bounds - * @param {composite} composite The composite. - * @returns {bounds} The composite bounds. - */ - Composite.bounds = function (composite) { - var bodies = Composite.allBodies(composite), - vertices = []; - - for (var i = 0; i < bodies.length; i += 1) { - var body = bodies[i]; - vertices.push(body.bounds.min, body.bounds.max); - } - - return Bounds.create(vertices); - }; - - /* - * - * Events Documentation - * - */ - - /** - * Fired when a call to `Composite.add` is made, before objects have been added. - * - * @event beforeAdd - * @param {} event An event object - * @param {} event.object The object(s) to be added (may be a single body, constraint, composite or a mixed array of these) - * @param {} event.source The source object of the event - * @param {} event.name The name of the event - */ - - /** - * Fired when a call to `Composite.add` is made, after objects have been added. - * - * @event afterAdd - * @param {} event An event object - * @param {} event.object The object(s) that have been added (may be a single body, constraint, composite or a mixed array of these) - * @param {} event.source The source object of the event - * @param {} event.name The name of the event - */ - - /** - * Fired when a call to `Composite.remove` is made, before objects have been removed. - * - * @event beforeRemove - * @param {} event An event object - * @param {} event.object The object(s) to be removed (may be a single body, constraint, composite or a mixed array of these) - * @param {} event.source The source object of the event - * @param {} event.name The name of the event - */ - - /** - * Fired when a call to `Composite.remove` is made, after objects have been removed. - * - * @event afterRemove - * @param {} event An event object - * @param {} event.object The object(s) that have been removed (may be a single body, constraint, composite or a mixed array of these) - * @param {} event.source The source object of the event - * @param {} event.name The name of the event - */ - - /* - * - * Properties Documentation - * - */ - - /** - * An integer `Number` uniquely identifying number generated in `Composite.create` by `Common.nextId`. - * - * @property id - * @type number - */ - - /** - * A `String` denoting the type of object. - * - * @property type - * @type string - * @default "composite" - * @readOnly - */ - - /** - * An arbitrary `String` name to help the user identify and manage composites. - * - * @property label - * @type string - * @default "Composite" - */ - - /** - * A flag that specifies whether the composite has been modified during the current step. - * Most `Matter.Composite` methods will automatically set this flag to `true` to inform the engine of changes to be handled. - * If you need to change it manually, you should use the `Composite.setModified` method. - * - * @property isModified - * @type boolean - * @default false - */ - - /** - * The `Composite` that is the parent of this composite. It is automatically managed by the `Matter.Composite` methods. - * - * @property parent - * @type composite - * @default null - */ - - /** - * An array of `Body` that are _direct_ children of this composite. - * To add or remove bodies you should use `Composite.add` and `Composite.remove` methods rather than directly modifying this property. - * If you wish to recursively find all descendants, you should use the `Composite.allBodies` method. - * - * @property bodies - * @type body[] - * @default [] - */ - - /** - * An array of `Constraint` that are _direct_ children of this composite. - * To add or remove constraints you should use `Composite.add` and `Composite.remove` methods rather than directly modifying this property. - * If you wish to recursively find all descendants, you should use the `Composite.allConstraints` method. - * - * @property constraints - * @type constraint[] - * @default [] - */ - - /** - * An array of `Composite` that are _direct_ children of this composite. - * To add or remove composites you should use `Composite.add` and `Composite.remove` methods rather than directly modifying this property. - * If you wish to recursively find all descendants, you should use the `Composite.allComposites` method. - * - * @property composites - * @type composite[] - * @default [] - */ - - /** - * An object reserved for storing plugin-specific properties. - * - * @property plugin - * @type {} - */ - })(); - - /***/ - }, - /* 6 */ - /***/ function (module, exports, __webpack_require__) { - /** - * The `Matter.Body` module contains methods for creating and manipulating body models. - * A `Matter.Body` is a rigid body that can be simulated by a `Matter.Engine`. - * Factories for commonly used body configurations (such as rectangles, circles and other polygons) can be found in the module `Matter.Bodies`. - * - * See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples). - - * @class Body - */ - - var Body = {}; - - module.exports = Body; - - var Vertices = __webpack_require__(3); - var Vector = __webpack_require__(2); - var Sleeping = __webpack_require__(7); - __webpack_require__(10); - var Common = __webpack_require__(0); - var Bounds = __webpack_require__(1); - var Axes = __webpack_require__(15); - - (function () { - Body._inertiaScale = 4; - Body._nextCollidingGroupId = 1; - Body._nextNonCollidingGroupId = -1; - Body._nextCategory = 0x0001; - - /** - * Creates a new rigid body model. The options parameter is an object that specifies any properties you wish to override the defaults. - * All properties have default values, and many are pre-calculated automatically based on other properties. - * Vertices must be specified in clockwise order. - * See the properties section below for detailed information on what you can pass via the `options` object. - * @method create - * @param {} options - * @return {body} body - */ - Body.create = function (options) { - var defaults = { - id: Common.nextId(), - type: 'body', - label: 'Body', - parts: [], - plugin: {}, - angle: 0, - vertices: Vertices.fromPath('L 0 0 L 40 0 L 40 40 L 0 40'), - position: {x: 0, y: 0}, - force: {x: 0, y: 0}, - torque: 0, - positionImpulse: {x: 0, y: 0}, - constraintImpulse: {x: 0, y: 0, angle: 0}, - totalContacts: 0, - speed: 0, - angularSpeed: 0, - velocity: {x: 0, y: 0}, - angularVelocity: 0, - isSensor: false, - isStatic: false, - isSleeping: false, - motion: 0, - sleepThreshold: 60, - density: 0.001, - restitution: 0, - friction: 0.1, - frictionStatic: 0.5, - frictionAir: 0.01, - collisionFilter: { - category: 0x0001, - mask: 0xffffffff, - group: 0, - }, - slop: 0.05, - timeScale: 1, - render: { - visible: true, - opacity: 1, - sprite: { - xScale: 1, - yScale: 1, - xOffset: 0, - yOffset: 0, - }, - lineWidth: 0, - }, - events: null, - bounds: null, - chamfer: null, - circleRadius: 0, - positionPrev: null, - anglePrev: 0, - parent: null, - axes: null, - area: 0, - mass: 0, - inertia: 0, - _original: null, - }; - - var body = Common.extend(defaults, options); - - _initProperties(body, options); - - return body; - }; - - /** - * Returns the next unique group index for which bodies will collide. - * If `isNonColliding` is `true`, returns the next unique group index for which bodies will _not_ collide. - * See `body.collisionFilter` for more information. - * @method nextGroup - * @param {bool} [isNonColliding=false] - * @return {Number} Unique group index - */ - Body.nextGroup = function (isNonColliding) { - if (isNonColliding) return Body._nextNonCollidingGroupId--; - - return Body._nextCollidingGroupId++; - }; - - /** - * Returns the next unique category bitfield (starting after the initial default category `0x0001`). - * There are 32 available. See `body.collisionFilter` for more information. - * @method nextCategory - * @return {Number} Unique category bitfield - */ - Body.nextCategory = function () { - Body._nextCategory = Body._nextCategory << 1; - return Body._nextCategory; - }; - - /** - * Initialises body properties. - * @method _initProperties - * @private - * @param {body} body - * @param {} [options] - */ - var _initProperties = function (body, options) { - options = options || {}; - - // init required properties (order is important) - Body.set(body, { - bounds: body.bounds || Bounds.create(body.vertices), - positionPrev: body.positionPrev || Vector.clone(body.position), - anglePrev: body.anglePrev || body.angle, - vertices: body.vertices, - parts: body.parts || [body], - isStatic: body.isStatic, - isSleeping: body.isSleeping, - parent: body.parent || body, - }); - - Vertices.rotate(body.vertices, body.angle, body.position); - Axes.rotate(body.axes, body.angle); - Bounds.update(body.bounds, body.vertices, body.velocity); - - // allow options to override the automatically calculated properties - Body.set(body, { - axes: options.axes || body.axes, - area: options.area || body.area, - mass: options.mass || body.mass, - inertia: options.inertia || body.inertia, - }); - - // render properties - var defaultFillStyle = body.isStatic - ? '#2e2b44' - : Common.choose(['#006BA6', '#0496FF', '#FFBC42', '#D81159', '#8F2D56']), - defaultStrokeStyle = '#000'; - body.render.fillStyle = body.render.fillStyle || defaultFillStyle; - body.render.strokeStyle = body.render.strokeStyle || defaultStrokeStyle; - body.render.sprite.xOffset += - -(body.bounds.min.x - body.position.x) / (body.bounds.max.x - body.bounds.min.x); - body.render.sprite.yOffset += - -(body.bounds.min.y - body.position.y) / (body.bounds.max.y - body.bounds.min.y); - }; - - /** - * Given a property and a value (or map of), sets the property(s) on the body, using the appropriate setter functions if they exist. - * Prefer to use the actual setter functions in performance critical situations. - * @method set - * @param {body} body - * @param {} settings A property name (or map of properties and values) to set on the body. - * @param {} value The value to set if `settings` is a single property name. - */ - Body.set = function (body, settings, value) { - var property; - - if (typeof settings === 'string') { - property = settings; - settings = {}; - settings[property] = value; - } - - for (property in settings) { - if (!Object.prototype.hasOwnProperty.call(settings, property)) continue; - - value = settings[property]; - switch (property) { - case 'isStatic': - Body.setStatic(body, value); - break; - case 'isSleeping': - Sleeping.set(body, value); - break; - case 'mass': - Body.setMass(body, value); - break; - case 'density': - Body.setDensity(body, value); - break; - case 'inertia': - Body.setInertia(body, value); - break; - case 'vertices': - Body.setVertices(body, value); - break; - case 'position': - Body.setPosition(body, value); - break; - case 'angle': - Body.setAngle(body, value); - break; - case 'velocity': - Body.setVelocity(body, value); - break; - case 'angularVelocity': - Body.setAngularVelocity(body, value); - break; - case 'parts': - Body.setParts(body, value); - break; - case 'centre': - Body.setCentre(body, value); - break; - default: - body[property] = value; - } - } - }; - - /** - * Sets the body as static, including isStatic flag and setting mass and inertia to Infinity. - * @method setStatic - * @param {body} body - * @param {bool} isStatic - */ - Body.setStatic = function (body, isStatic) { - for (var i = 0; i < body.parts.length; i++) { - var part = body.parts[i]; - part.isStatic = isStatic; - - if (isStatic) { - part._original = { - restitution: part.restitution, - friction: part.friction, - mass: part.mass, - inertia: part.inertia, - density: part.density, - inverseMass: part.inverseMass, - inverseInertia: part.inverseInertia, - }; - - part.restitution = 0; - part.friction = 1; - part.mass = part.inertia = part.density = Infinity; - part.inverseMass = part.inverseInertia = 0; - - part.positionPrev.x = part.position.x; - part.positionPrev.y = part.position.y; - part.anglePrev = part.angle; - part.angularVelocity = 0; - part.speed = 0; - part.angularSpeed = 0; - part.motion = 0; - } else if (part._original) { - part.restitution = part._original.restitution; - part.friction = part._original.friction; - part.mass = part._original.mass; - part.inertia = part._original.inertia; - part.density = part._original.density; - part.inverseMass = part._original.inverseMass; - part.inverseInertia = part._original.inverseInertia; - - part._original = null; - } - } - }; - - /** - * Sets the mass of the body. Inverse mass, density and inertia are automatically updated to reflect the change. - * @method setMass - * @param {body} body - * @param {number} mass - */ - Body.setMass = function (body, mass) { - var moment = body.inertia / (body.mass / 6); - body.inertia = moment * (mass / 6); - body.inverseInertia = 1 / body.inertia; - - body.mass = mass; - body.inverseMass = 1 / body.mass; - body.density = body.mass / body.area; - }; - - /** - * Sets the density of the body. Mass and inertia are automatically updated to reflect the change. - * @method setDensity - * @param {body} body - * @param {number} density - */ - Body.setDensity = function (body, density) { - Body.setMass(body, density * body.area); - body.density = density; - }; - - /** - * Sets the moment of inertia (i.e. second moment of area) of the body. - * Inverse inertia is automatically updated to reflect the change. Mass is not changed. - * @method setInertia - * @param {body} body - * @param {number} inertia - */ - Body.setInertia = function (body, inertia) { - body.inertia = inertia; - body.inverseInertia = 1 / body.inertia; - }; - - /** - * Sets the body's vertices and updates body properties accordingly, including inertia, area and mass (with respect to `body.density`). - * Vertices will be automatically transformed to be orientated around their centre of mass as the origin. - * They are then automatically translated to world space based on `body.position`. - * - * The `vertices` argument should be passed as an array of `Matter.Vector` points (or a `Matter.Vertices` array). - * Vertices must form a convex hull, concave hulls are not supported. - * - * @method setVertices - * @param {body} body - * @param {vector[]} vertices - */ - Body.setVertices = function (body, vertices) { - // change vertices - if (vertices[0].body === body) { - body.vertices = vertices; - } else { - body.vertices = Vertices.create(vertices, body); - } - - // update properties - body.axes = Axes.fromVertices(body.vertices); - body.area = Vertices.area(body.vertices); - Body.setMass(body, body.density * body.area); - - // orient vertices around the centre of mass at origin (0, 0) - var centre = Vertices.centre(body.vertices); - Vertices.translate(body.vertices, centre, -1); - - // update inertia while vertices are at origin (0, 0) - Body.setInertia(body, Body._inertiaScale * Vertices.inertia(body.vertices, body.mass)); - - // update geometry - Vertices.translate(body.vertices, body.position); - Bounds.update(body.bounds, body.vertices, body.velocity); - }; - - /** - * Sets the parts of the `body` and updates mass, inertia and centroid. - * Each part will have its parent set to `body`. - * By default the convex hull will be automatically computed and set on `body`, unless `autoHull` is set to `false.` - * Note that this method will ensure that the first part in `body.parts` will always be the `body`. - * @method setParts - * @param {body} body - * @param [body] parts - * @param {bool} [autoHull=true] - */ - Body.setParts = function (body, parts, autoHull) { - var i; - - // add all the parts, ensuring that the first part is always the parent body - parts = parts.slice(0); - body.parts.length = 0; - body.parts.push(body); - body.parent = body; - - for (i = 0; i < parts.length; i++) { - var part = parts[i]; - if (part !== body) { - part.parent = body; - body.parts.push(part); - } - } - - if (body.parts.length === 1) return; - - autoHull = typeof autoHull !== 'undefined' ? autoHull : true; - - // find the convex hull of all parts to set on the parent body - if (autoHull) { - var vertices = []; - for (i = 0; i < parts.length; i++) { - vertices = vertices.concat(parts[i].vertices); - } - - Vertices.clockwiseSort(vertices); - - var hull = Vertices.hull(vertices), - hullCentre = Vertices.centre(hull); - - Body.setVertices(body, hull); - Vertices.translate(body.vertices, hullCentre); - } - - // sum the properties of all compound parts of the parent body - var total = Body._totalProperties(body); - - body.area = total.area; - body.parent = body; - body.position.x = total.centre.x; - body.position.y = total.centre.y; - body.positionPrev.x = total.centre.x; - body.positionPrev.y = total.centre.y; - - Body.setMass(body, total.mass); - Body.setInertia(body, total.inertia); - Body.setPosition(body, total.centre); - }; - - /** - * Set the centre of mass of the body. - * The `centre` is a vector in world-space unless `relative` is set, in which case it is a translation. - * The centre of mass is the point the body rotates about and can be used to simulate non-uniform density. - * This is equal to moving `body.position` but not the `body.vertices`. - * Invalid if the `centre` falls outside the body's convex hull. - * @method setCentre - * @param {body} body - * @param {vector} centre - * @param {bool} relative - */ - Body.setCentre = function (body, centre, relative) { - if (!relative) { - body.positionPrev.x = centre.x - (body.position.x - body.positionPrev.x); - body.positionPrev.y = centre.y - (body.position.y - body.positionPrev.y); - body.position.x = centre.x; - body.position.y = centre.y; - } else { - body.positionPrev.x += centre.x; - body.positionPrev.y += centre.y; - body.position.x += centre.x; - body.position.y += centre.y; - } - }; - - /** - * Sets the position of the body instantly. Velocity, angle, force etc. are unchanged. - * @method setPosition - * @param {body} body - * @param {vector} position - */ - Body.setPosition = function (body, position) { - var delta = Vector.sub(position, body.position); - body.positionPrev.x += delta.x; - body.positionPrev.y += delta.y; - - for (var i = 0; i < body.parts.length; i++) { - var part = body.parts[i]; - part.position.x += delta.x; - part.position.y += delta.y; - Vertices.translate(part.vertices, delta); - Bounds.update(part.bounds, part.vertices, body.velocity); - } - }; - - /** - * Sets the angle of the body instantly. Angular velocity, position, force etc. are unchanged. - * @method setAngle - * @param {body} body - * @param {number} angle - */ - Body.setAngle = function (body, angle) { - var delta = angle - body.angle; - body.anglePrev += delta; - - for (var i = 0; i < body.parts.length; i++) { - var part = body.parts[i]; - part.angle += delta; - Vertices.rotate(part.vertices, delta, body.position); - Axes.rotate(part.axes, delta); - Bounds.update(part.bounds, part.vertices, body.velocity); - if (i > 0) { - Vector.rotateAbout(part.position, delta, body.position, part.position); - } - } - }; - - /** - * Sets the linear velocity of the body instantly. Position, angle, force etc. are unchanged. See also `Body.applyForce`. - * @method setVelocity - * @param {body} body - * @param {vector} velocity - */ - Body.setVelocity = function (body, velocity) { - body.positionPrev.x = body.position.x - velocity.x; - body.positionPrev.y = body.position.y - velocity.y; - body.velocity.x = velocity.x; - body.velocity.y = velocity.y; - body.speed = Vector.magnitude(body.velocity); - }; - - /** - * Sets the angular velocity of the body instantly. Position, angle, force etc. are unchanged. See also `Body.applyForce`. - * @method setAngularVelocity - * @param {body} body - * @param {number} velocity - */ - Body.setAngularVelocity = function (body, velocity) { - body.anglePrev = body.angle - velocity; - body.angularVelocity = velocity; - body.angularSpeed = Math.abs(body.angularVelocity); - }; - - /** - * Moves a body by a given vector relative to its current position, without imparting any velocity. - * @method translate - * @param {body} body - * @param {vector} translation - */ - Body.translate = function (body, translation) { - Body.setPosition(body, Vector.add(body.position, translation)); - }; - - /** - * Rotates a body by a given angle relative to its current angle, without imparting any angular velocity. - * @method rotate - * @param {body} body - * @param {number} rotation - * @param {vector} [point] - */ - Body.rotate = function (body, rotation, point) { - if (!point) { - Body.setAngle(body, body.angle + rotation); - } else { - var cos = Math.cos(rotation), - sin = Math.sin(rotation), - dx = body.position.x - point.x, - dy = body.position.y - point.y; - - Body.setPosition(body, { - x: point.x + (dx * cos - dy * sin), - y: point.y + (dx * sin + dy * cos), - }); - - Body.setAngle(body, body.angle + rotation); - } - }; - - /** - * Scales the body, including updating physical properties (mass, area, axes, inertia), from a world-space point (default is body centre). - * @method scale - * @param {body} body - * @param {number} scaleX - * @param {number} scaleY - * @param {vector} [point] - */ - Body.scale = function (body, scaleX, scaleY, point) { - var totalArea = 0, - totalInertia = 0; - - point = point || body.position; - - for (var i = 0; i < body.parts.length; i++) { - var part = body.parts[i]; - - // scale vertices - Vertices.scale(part.vertices, scaleX, scaleY, point); - - // update properties - part.axes = Axes.fromVertices(part.vertices); - part.area = Vertices.area(part.vertices); - Body.setMass(part, body.density * part.area); - - // update inertia (requires vertices to be at origin) - Vertices.translate(part.vertices, {x: -part.position.x, y: -part.position.y}); - Body.setInertia(part, Body._inertiaScale * Vertices.inertia(part.vertices, part.mass)); - Vertices.translate(part.vertices, {x: part.position.x, y: part.position.y}); - - if (i > 0) { - totalArea += part.area; - totalInertia += part.inertia; - } - - // scale position - part.position.x = point.x + (part.position.x - point.x) * scaleX; - part.position.y = point.y + (part.position.y - point.y) * scaleY; - - // update bounds - Bounds.update(part.bounds, part.vertices, body.velocity); - } - - // handle parent body - if (body.parts.length > 1) { - body.area = totalArea; - - if (!body.isStatic) { - Body.setMass(body, body.density * totalArea); - Body.setInertia(body, totalInertia); - } - } - - // handle circles - if (body.circleRadius) { - if (scaleX === scaleY) { - body.circleRadius *= scaleX; - } else { - // body is no longer a circle - body.circleRadius = null; - } - } - }; - - /** - * Performs a simulation step for the given `body`, including updating position and angle using Verlet integration. - * @method update - * @param {body} body - * @param {number} deltaTime - * @param {number} timeScale - * @param {number} correction - */ - Body.update = function (body, deltaTime, timeScale, correction) { - var deltaTimeSquared = Math.pow(deltaTime * timeScale * body.timeScale, 2); - - // from the previous step - var frictionAir = 1 - body.frictionAir * timeScale * body.timeScale, - velocityPrevX = body.position.x - body.positionPrev.x, - velocityPrevY = body.position.y - body.positionPrev.y; - - // update velocity with Verlet integration - body.velocity.x = velocityPrevX * frictionAir * correction + (body.force.x / body.mass) * deltaTimeSquared; - body.velocity.y = velocityPrevY * frictionAir * correction + (body.force.y / body.mass) * deltaTimeSquared; - - body.positionPrev.x = body.position.x; - body.positionPrev.y = body.position.y; - body.position.x += body.velocity.x; - body.position.y += body.velocity.y; - - // update angular velocity with Verlet integration - body.angularVelocity = - (body.angle - body.anglePrev) * frictionAir * correction + - (body.torque / body.inertia) * deltaTimeSquared; - body.anglePrev = body.angle; - body.angle += body.angularVelocity; - - // track speed and acceleration - body.speed = Vector.magnitude(body.velocity); - body.angularSpeed = Math.abs(body.angularVelocity); - - // transform the body geometry - for (var i = 0; i < body.parts.length; i++) { - var part = body.parts[i]; - - Vertices.translate(part.vertices, body.velocity); - - if (i > 0) { - part.position.x += body.velocity.x; - part.position.y += body.velocity.y; - } - - if (body.angularVelocity !== 0) { - Vertices.rotate(part.vertices, body.angularVelocity, body.position); - Axes.rotate(part.axes, body.angularVelocity); - if (i > 0) { - Vector.rotateAbout(part.position, body.angularVelocity, body.position, part.position); - } - } - - Bounds.update(part.bounds, part.vertices, body.velocity); - } - }; - - /** - * Applies a force to a body from a given world-space position, including resulting torque. - * @method applyForce - * @param {body} body - * @param {vector} position - * @param {vector} force - */ - Body.applyForce = function (body, position, force) { - body.force.x += force.x; - body.force.y += force.y; - var offset = {x: position.x - body.position.x, y: position.y - body.position.y}; - body.torque += offset.x * force.y - offset.y * force.x; - }; - - /** - * Returns the sums of the properties of all compound parts of the parent body. - * @method _totalProperties - * @private - * @param {body} body - * @return {} - */ - Body._totalProperties = function (body) { - // from equations at: - // https://ecourses.ou.edu/cgi-bin/ebook.cgi?doc=&topic=st&chap_sec=07.2&page=theory - // http://output.to/sideway/default.asp?qno=121100087 - - var properties = { - mass: 0, - area: 0, - inertia: 0, - centre: {x: 0, y: 0}, - }; - - // sum the properties of all compound parts of the parent body - for (var i = body.parts.length === 1 ? 0 : 1; i < body.parts.length; i++) { - var part = body.parts[i], - mass = part.mass !== Infinity ? part.mass : 1; - - properties.mass += mass; - properties.area += part.area; - properties.inertia += part.inertia; - properties.centre = Vector.add(properties.centre, Vector.mult(part.position, mass)); - } - - properties.centre = Vector.div(properties.centre, properties.mass); - - return properties; - }; - - /* - * - * Events Documentation - * - */ - - /** - * Fired when a body starts sleeping (where `this` is the body). - * - * @event sleepStart - * @this {body} The body that has started sleeping - * @param {} event An event object - * @param {} event.source The source object of the event - * @param {} event.name The name of the event - */ - - /** - * Fired when a body ends sleeping (where `this` is the body). - * - * @event sleepEnd - * @this {body} The body that has ended sleeping - * @param {} event An event object - * @param {} event.source The source object of the event - * @param {} event.name The name of the event - */ - - /* - * - * Properties Documentation - * - */ - - /** - * An integer `Number` uniquely identifying number generated in `Body.create` by `Common.nextId`. - * - * @property id - * @type number - */ - - /** - * A `String` denoting the type of object. - * - * @property type - * @type string - * @default "body" - * @readOnly - */ - - /** - * An arbitrary `String` name to help the user identify and manage bodies. - * - * @property label - * @type string - * @default "Body" - */ - - /** - * An array of bodies that make up this body. - * The first body in the array must always be a self reference to the current body instance. - * All bodies in the `parts` array together form a single rigid compound body. - * Parts are allowed to overlap, have gaps or holes or even form concave bodies. - * Parts themselves should never be added to a `World`, only the parent body should be. - * Use `Body.setParts` when setting parts to ensure correct updates of all properties. - * - * @property parts - * @type body[] - */ - - /** - * An object reserved for storing plugin-specific properties. - * - * @property plugin - * @type {} - */ - - /** - * A self reference if the body is _not_ a part of another body. - * Otherwise this is a reference to the body that this is a part of. - * See `body.parts`. - * - * @property parent - * @type body - */ - - /** - * A `Number` specifying the angle of the body, in radians. - * - * @property angle - * @type number - * @default 0 - */ - - /** - * An array of `Vector` objects that specify the convex hull of the rigid body. - * These should be provided about the origin `(0, 0)`. E.g. - * - * [{ x: 0, y: 0 }, { x: 25, y: 50 }, { x: 50, y: 0 }] - * - * When passed via `Body.create`, the vertices are translated relative to `body.position` (i.e. world-space, and constantly updated by `Body.update` during simulation). - * The `Vector` objects are also augmented with additional properties required for efficient collision detection. - * - * Other properties such as `inertia` and `bounds` are automatically calculated from the passed vertices (unless provided via `options`). - * Concave hulls are not currently supported. The module `Matter.Vertices` contains useful methods for working with vertices. - * - * @property vertices - * @type vector[] - */ - - /** - * A `Vector` that specifies the current world-space position of the body. - * - * @property position - * @type vector - * @default { x: 0, y: 0 } - */ - - /** - * A `Vector` that specifies the force to apply in the current step. It is zeroed after every `Body.update`. See also `Body.applyForce`. - * - * @property force - * @type vector - * @default { x: 0, y: 0 } - */ - - /** - * A `Number` that specifies the torque (turning force) to apply in the current step. It is zeroed after every `Body.update`. - * - * @property torque - * @type number - * @default 0 - */ - - /** - * A `Number` that _measures_ the current speed of the body after the last `Body.update`. It is read-only and always positive (it's the magnitude of `body.velocity`). - * - * @readOnly - * @property speed - * @type number - * @default 0 - */ - - /** - * A `Number` that _measures_ the current angular speed of the body after the last `Body.update`. It is read-only and always positive (it's the magnitude of `body.angularVelocity`). - * - * @readOnly - * @property angularSpeed - * @type number - * @default 0 - */ - - /** - * A `Vector` that _measures_ the current velocity of the body after the last `Body.update`. It is read-only. - * If you need to modify a body's velocity directly, you should either apply a force or simply change the body's `position` (as the engine uses position-Verlet integration). - * - * @readOnly - * @property velocity - * @type vector - * @default { x: 0, y: 0 } - */ - - /** - * A `Number` that _measures_ the current angular velocity of the body after the last `Body.update`. It is read-only. - * If you need to modify a body's angular velocity directly, you should apply a torque or simply change the body's `angle` (as the engine uses position-Verlet integration). - * - * @readOnly - * @property angularVelocity - * @type number - * @default 0 - */ - - /** - * A flag that indicates whether a body is considered static. A static body can never change position or angle and is completely fixed. - * If you need to set a body as static after its creation, you should use `Body.setStatic` as this requires more than just setting this flag. - * - * @property isStatic - * @type boolean - * @default false - */ - - /** - * A flag that indicates whether a body is a sensor. Sensor triggers collision events, but doesn't react with colliding body physically. - * - * @property isSensor - * @type boolean - * @default false - */ - - /** - * A flag that indicates whether the body is considered sleeping. A sleeping body acts similar to a static body, except it is only temporary and can be awoken. - * If you need to set a body as sleeping, you should use `Sleeping.set` as this requires more than just setting this flag. - * - * @property isSleeping - * @type boolean - * @default false - */ - - /** - * A `Number` that _measures_ the amount of movement a body currently has (a combination of `speed` and `angularSpeed`). It is read-only and always positive. - * It is used and updated by the `Matter.Sleeping` module during simulation to decide if a body has come to rest. - * - * @readOnly - * @property motion - * @type number - * @default 0 - */ - - /** - * A `Number` that defines the number of updates in which this body must have near-zero velocity before it is set as sleeping by the `Matter.Sleeping` module (if sleeping is enabled by the engine). - * - * @property sleepThreshold - * @type number - * @default 60 - */ - - /** - * A `Number` that defines the density of the body, that is its mass per unit area. - * If you pass the density via `Body.create` the `mass` property is automatically calculated for you based on the size (area) of the object. - * This is generally preferable to simply setting mass and allows for more intuitive definition of materials (e.g. rock has a higher density than wood). - * - * @property density - * @type number - * @default 0.001 - */ - - /** - * A `Number` that defines the mass of the body, although it may be more appropriate to specify the `density` property instead. - * If you modify this value, you must also modify the `body.inverseMass` property (`1 / mass`). - * - * @property mass - * @type number - */ - - /** - * A `Number` that defines the inverse mass of the body (`1 / mass`). - * If you modify this value, you must also modify the `body.mass` property. - * - * @property inverseMass - * @type number - */ - - /** - * A `Number` that defines the moment of inertia (i.e. second moment of area) of the body. - * It is automatically calculated from the given convex hull (`vertices` array) and density in `Body.create`. - * If you modify this value, you must also modify the `body.inverseInertia` property (`1 / inertia`). - * - * @property inertia - * @type number - */ - - /** - * A `Number` that defines the inverse moment of inertia of the body (`1 / inertia`). - * If you modify this value, you must also modify the `body.inertia` property. - * - * @property inverseInertia - * @type number - */ - - /** - * A `Number` that defines the restitution (elasticity) of the body. The value is always positive and is in the range `(0, 1)`. - * A value of `0` means collisions may be perfectly inelastic and no bouncing may occur. - * A value of `0.8` means the body may bounce back with approximately 80% of its kinetic energy. - * Note that collision response is based on _pairs_ of bodies, and that `restitution` values are _combined_ with the following formula: - * - * Math.max(bodyA.restitution, bodyB.restitution) - * - * @property restitution - * @type number - * @default 0 - */ - - /** - * A `Number` that defines the friction of the body. The value is always positive and is in the range `(0, 1)`. - * A value of `0` means that the body may slide indefinitely. - * A value of `1` means the body may come to a stop almost instantly after a force is applied. - * - * The effects of the value may be non-linear. - * High values may be unstable depending on the body. - * The engine uses a Coulomb friction model including static and kinetic friction. - * Note that collision response is based on _pairs_ of bodies, and that `friction` values are _combined_ with the following formula: - * - * Math.min(bodyA.friction, bodyB.friction) - * - * @property friction - * @type number - * @default 0.1 - */ - - /** - * A `Number` that defines the static friction of the body (in the Coulomb friction model). - * A value of `0` means the body will never 'stick' when it is nearly stationary and only dynamic `friction` is used. - * The higher the value (e.g. `10`), the more force it will take to initially get the body moving when nearly stationary. - * This value is multiplied with the `friction` property to make it easier to change `friction` and maintain an appropriate amount of static friction. - * - * @property frictionStatic - * @type number - * @default 0.5 - */ - - /** - * A `Number` that defines the air friction of the body (air resistance). - * A value of `0` means the body will never slow as it moves through space. - * The higher the value, the faster a body slows when moving through space. - * The effects of the value are non-linear. - * - * @property frictionAir - * @type number - * @default 0.01 - */ - - /** - * An `Object` that specifies the collision filtering properties of this body. - * - * Collisions between two bodies will obey the following rules: - * - If the two bodies have the same non-zero value of `collisionFilter.group`, - * they will always collide if the value is positive, and they will never collide - * if the value is negative. - * - If the two bodies have different values of `collisionFilter.group` or if one - * (or both) of the bodies has a value of 0, then the category/mask rules apply as follows: - * - * Each body belongs to a collision category, given by `collisionFilter.category`. This - * value is used as a bit field and the category should have only one bit set, meaning that - * the value of this property is a power of two in the range [1, 2^31]. Thus, there are 32 - * different collision categories available. - * - * Each body also defines a collision bitmask, given by `collisionFilter.mask` which specifies - * the categories it collides with (the value is the bitwise AND value of all these categories). - * - * Using the category/mask rules, two bodies `A` and `B` collide if each includes the other's - * category in its mask, i.e. `(categoryA & maskB) !== 0` and `(categoryB & maskA) !== 0` - * are both true. - * - * @property collisionFilter - * @type object - */ - - /** - * An Integer `Number`, that specifies the collision group this body belongs to. - * See `body.collisionFilter` for more information. - * - * @property collisionFilter.group - * @type object - * @default 0 - */ - - /** - * A bit field that specifies the collision category this body belongs to. - * The category value should have only one bit set, for example `0x0001`. - * This means there are up to 32 unique collision categories available. - * See `body.collisionFilter` for more information. - * - * @property collisionFilter.category - * @type object - * @default 1 - */ - - /** - * A bit mask that specifies the collision categories this body may collide with. - * See `body.collisionFilter` for more information. - * - * @property collisionFilter.mask - * @type object - * @default -1 - */ - - /** - * A `Number` that specifies a tolerance on how far a body is allowed to 'sink' or rotate into other bodies. - * Avoid changing this value unless you understand the purpose of `slop` in physics engines. - * The default should generally suffice, although very large bodies may require larger values for stable stacking. - * - * @property slop - * @type number - * @default 0.05 - */ - - /** - * A `Number` that allows per-body time scaling, e.g. a force-field where bodies inside are in slow-motion, while others are at full speed. - * - * @property timeScale - * @type number - * @default 1 - */ - - /** - * An `Object` that defines the rendering properties to be consumed by the module `Matter.Render`. - * - * @property render - * @type object - */ - - /** - * A flag that indicates if the body should be rendered. - * - * @property render.visible - * @type boolean - * @default true - */ - - /** - * Sets the opacity to use when rendering. - * - * @property render.opacity - * @type number - * @default 1 - */ - - /** - * An `Object` that defines the sprite properties to use when rendering, if any. - * - * @property render.sprite - * @type object - */ - - /** - * An `String` that defines the path to the image to use as the sprite texture, if any. - * - * @property render.sprite.texture - * @type string - */ - - /** - * A `Number` that defines the scaling in the x-axis for the sprite, if any. - * - * @property render.sprite.xScale - * @type number - * @default 1 - */ - - /** - * A `Number` that defines the scaling in the y-axis for the sprite, if any. - * - * @property render.sprite.yScale - * @type number - * @default 1 - */ - - /** - * A `Number` that defines the offset in the x-axis for the sprite (normalised by texture width). - * - * @property render.sprite.xOffset - * @type number - * @default 0 - */ - - /** - * A `Number` that defines the offset in the y-axis for the sprite (normalised by texture height). - * - * @property render.sprite.yOffset - * @type number - * @default 0 - */ - - /** - * A `Number` that defines the line width to use when rendering the body outline (if a sprite is not defined). - * A value of `0` means no outline will be rendered. - * - * @property render.lineWidth - * @type number - * @default 0 - */ - - /** - * A `String` that defines the fill style to use when rendering the body (if a sprite is not defined). - * It is the same as when using a canvas, so it accepts CSS style property values. - * - * @property render.fillStyle - * @type string - * @default a random colour - */ - - /** - * A `String` that defines the stroke style to use when rendering the body outline (if a sprite is not defined). - * It is the same as when using a canvas, so it accepts CSS style property values. - * - * @property render.strokeStyle - * @type string - * @default a random colour - */ - - /** - * An array of unique axis vectors (edge normals) used for collision detection. - * These are automatically calculated from the given convex hull (`vertices` array) in `Body.create`. - * They are constantly updated by `Body.update` during the simulation. - * - * @property axes - * @type vector[] - */ - - /** - * A `Number` that _measures_ the area of the body's convex hull, calculated at creation by `Body.create`. - * - * @property area - * @type string - * @default - */ - - /** - * A `Bounds` object that defines the AABB region for the body. - * It is automatically calculated from the given convex hull (`vertices` array) in `Body.create` and constantly updated by `Body.update` during simulation. - * - * @property bounds - * @type bounds - */ - })(); - - /***/ - }, - /* 7 */ - /***/ function (module, exports, __webpack_require__) { - /** - * The `Matter.Sleeping` module contains methods to manage the sleeping state of bodies. - * - * @class Sleeping - */ - - var Sleeping = {}; - - module.exports = Sleeping; - - var Events = __webpack_require__(4); - - (function () { - Sleeping._motionWakeThreshold = 0.18; - Sleeping._motionSleepThreshold = 0.08; - Sleeping._minBias = 0.9; - - /** - * Puts bodies to sleep or wakes them up depending on their motion. - * @method update - * @param {body[]} bodies - * @param {number} timeScale - */ - Sleeping.update = function (bodies, timeScale) { - var timeFactor = timeScale * timeScale * timeScale; - - // update bodies sleeping status - for (var i = 0; i < bodies.length; i++) { - var body = bodies[i], - motion = body.speed * body.speed + body.angularSpeed * body.angularSpeed; - - // wake up bodies if they have a force applied - if (body.force.x !== 0 || body.force.y !== 0) { - Sleeping.set(body, false); - continue; - } - - var minMotion = Math.min(body.motion, motion), - maxMotion = Math.max(body.motion, motion); - - // biased average motion estimation between frames - body.motion = Sleeping._minBias * minMotion + (1 - Sleeping._minBias) * maxMotion; - - if (body.sleepThreshold > 0 && body.motion < Sleeping._motionSleepThreshold * timeFactor) { - body.sleepCounter += 1; - - if (body.sleepCounter >= body.sleepThreshold) Sleeping.set(body, true); - } else if (body.sleepCounter > 0) { - body.sleepCounter -= 1; - } - } - }; - - /** - * Given a set of colliding pairs, wakes the sleeping bodies involved. - * @method afterCollisions - * @param {pair[]} pairs - * @param {number} timeScale - */ - Sleeping.afterCollisions = function (pairs, timeScale) { - var timeFactor = timeScale * timeScale * timeScale; - - // wake up bodies involved in collisions - for (var i = 0; i < pairs.length; i++) { - var pair = pairs[i]; - - // don't wake inactive pairs - if (!pair.isActive) continue; - - var collision = pair.collision, - bodyA = collision.bodyA.parent, - bodyB = collision.bodyB.parent; - - // don't wake if at least one body is static - if ((bodyA.isSleeping && bodyB.isSleeping) || bodyA.isStatic || bodyB.isStatic) continue; - - if (bodyA.isSleeping || bodyB.isSleeping) { - var sleepingBody = bodyA.isSleeping && !bodyA.isStatic ? bodyA : bodyB, - movingBody = sleepingBody === bodyA ? bodyB : bodyA; - - if (!sleepingBody.isStatic && movingBody.motion > Sleeping._motionWakeThreshold * timeFactor) { - Sleeping.set(sleepingBody, false); - } - } - } - }; - - /** - * Set a body as sleeping or awake. - * @method set - * @param {body} body - * @param {boolean} isSleeping - */ - Sleeping.set = function (body, isSleeping) { - var wasSleeping = body.isSleeping; - - if (isSleeping) { - body.isSleeping = true; - body.sleepCounter = body.sleepThreshold; - - body.positionImpulse.x = 0; - body.positionImpulse.y = 0; - - body.positionPrev.x = body.position.x; - body.positionPrev.y = body.position.y; - - body.anglePrev = body.angle; - body.speed = 0; - body.angularSpeed = 0; - body.motion = 0; - - if (!wasSleeping) { - Events.trigger(body, 'sleepStart'); - } - } else { - body.isSleeping = false; - body.sleepCounter = 0; - - if (wasSleeping) { - Events.trigger(body, 'sleepEnd'); - } - } - }; - })(); - - /***/ - }, - /* 8 */ - /***/ function (module, exports, __webpack_require__) { - /** - * The `Matter.Constraint` module contains methods for creating and manipulating constraints. - * Constraints are used for specifying that a fixed distance must be maintained between two bodies (or a body and a fixed world-space position). - * The stiffness of constraints can be modified to create springs or elastic. - * - * See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples). - * - * @class Constraint - */ - - var Constraint = {}; - - module.exports = Constraint; - - var Vertices = __webpack_require__(3); - var Vector = __webpack_require__(2); - var Sleeping = __webpack_require__(7); - var Bounds = __webpack_require__(1); - var Axes = __webpack_require__(15); - var Common = __webpack_require__(0); - - (function () { - Constraint._warming = 0.4; - Constraint._torqueDampen = 1; - Constraint._minLength = 0.000001; - - /** - * Creates a new constraint. - * All properties have default values, and many are pre-calculated automatically based on other properties. - * To simulate a revolute constraint (or pin joint) set `length: 0` and a high `stiffness` value (e.g. `0.7` or above). - * If the constraint is unstable, try lowering the `stiffness` value and / or increasing `engine.constraintIterations`. - * For compound bodies, constraints must be applied to the parent body (not one of its parts). - * See the properties section below for detailed information on what you can pass via the `options` object. - * @method create - * @param {} options - * @return {constraint} constraint - */ - Constraint.create = function (options) { - var constraint = options; - - // if bodies defined but no points, use body centre - if (constraint.bodyA && !constraint.pointA) constraint.pointA = {x: 0, y: 0}; - if (constraint.bodyB && !constraint.pointB) constraint.pointB = {x: 0, y: 0}; - - // calculate static length using initial world space points - var initialPointA = constraint.bodyA - ? Vector.add(constraint.bodyA.position, constraint.pointA) - : constraint.pointA, - initialPointB = constraint.bodyB - ? Vector.add(constraint.bodyB.position, constraint.pointB) - : constraint.pointB, - length = Vector.magnitude(Vector.sub(initialPointA, initialPointB)); - - constraint.length = typeof constraint.length !== 'undefined' ? constraint.length : length; - - // option defaults - constraint.id = constraint.id || Common.nextId(); - constraint.label = constraint.label || 'Constraint'; - constraint.type = 'constraint'; - constraint.stiffness = constraint.stiffness || (constraint.length > 0 ? 1 : 0.7); - constraint.damping = constraint.damping || 0; - constraint.angularStiffness = constraint.angularStiffness || 0; - constraint.angleA = constraint.bodyA ? constraint.bodyA.angle : constraint.angleA; - constraint.angleB = constraint.bodyB ? constraint.bodyB.angle : constraint.angleB; - constraint.plugin = {}; - - // render - var render = { - visible: true, - lineWidth: 2, - strokeStyle: '#ffffff', - type: 'line', - anchors: true, - }; - - if (constraint.length === 0 && constraint.stiffness > 0.1) { - render.type = 'pin'; - render.anchors = false; - } else if (constraint.stiffness < 0.9) { - render.type = 'spring'; - } - - constraint.render = Common.extend(render, constraint.render); - - return constraint; - }; - - /** - * Prepares for solving by constraint warming. - * @private - * @method preSolveAll - * @param {body[]} bodies - */ - Constraint.preSolveAll = function (bodies) { - for (var i = 0; i < bodies.length; i += 1) { - var body = bodies[i], - impulse = body.constraintImpulse; - - if (body.isStatic || (impulse.x === 0 && impulse.y === 0 && impulse.angle === 0)) { - continue; - } - - body.position.x += impulse.x; - body.position.y += impulse.y; - body.angle += impulse.angle; - } - }; - - /** - * Solves all constraints in a list of collisions. - * @private - * @method solveAll - * @param {constraint[]} constraints - * @param {number} timeScale - */ - Constraint.solveAll = function (constraints, timeScale) { - // Solve fixed constraints first. - for (var i = 0; i < constraints.length; i += 1) { - var constraint = constraints[i], - fixedA = !constraint.bodyA || (constraint.bodyA && constraint.bodyA.isStatic), - fixedB = !constraint.bodyB || (constraint.bodyB && constraint.bodyB.isStatic); - - if (fixedA || fixedB) { - Constraint.solve(constraints[i], timeScale); - } - } - - // Solve free constraints last. - for (i = 0; i < constraints.length; i += 1) { - constraint = constraints[i]; - fixedA = !constraint.bodyA || (constraint.bodyA && constraint.bodyA.isStatic); - fixedB = !constraint.bodyB || (constraint.bodyB && constraint.bodyB.isStatic); - - if (!fixedA && !fixedB) { - Constraint.solve(constraints[i], timeScale); - } - } - }; - - /** - * Solves a distance constraint with Gauss-Siedel method. - * @private - * @method solve - * @param {constraint} constraint - * @param {number} timeScale - */ - Constraint.solve = function (constraint, timeScale) { - var bodyA = constraint.bodyA, - bodyB = constraint.bodyB, - pointA = constraint.pointA, - pointB = constraint.pointB; - - if (!bodyA && !bodyB) return; - - // update reference angle - if (bodyA && !bodyA.isStatic) { - Vector.rotate(pointA, bodyA.angle - constraint.angleA, pointA); - constraint.angleA = bodyA.angle; - } - - // update reference angle - if (bodyB && !bodyB.isStatic) { - Vector.rotate(pointB, bodyB.angle - constraint.angleB, pointB); - constraint.angleB = bodyB.angle; - } - - var pointAWorld = pointA, - pointBWorld = pointB; - - if (bodyA) pointAWorld = Vector.add(bodyA.position, pointA); - if (bodyB) pointBWorld = Vector.add(bodyB.position, pointB); - - if (!pointAWorld || !pointBWorld) return; - - var delta = Vector.sub(pointAWorld, pointBWorld), - currentLength = Vector.magnitude(delta); - - // prevent singularity - if (currentLength < Constraint._minLength) { - currentLength = Constraint._minLength; - } - - // solve distance constraint with Gauss-Siedel method - var difference = (currentLength - constraint.length) / currentLength, - stiffness = constraint.stiffness < 1 ? constraint.stiffness * timeScale : constraint.stiffness, - force = Vector.mult(delta, difference * stiffness), - massTotal = (bodyA ? bodyA.inverseMass : 0) + (bodyB ? bodyB.inverseMass : 0), - inertiaTotal = (bodyA ? bodyA.inverseInertia : 0) + (bodyB ? bodyB.inverseInertia : 0), - resistanceTotal = massTotal + inertiaTotal, - torque, - share, - normal, - normalVelocity, - relativeVelocity; - - if (constraint.damping) { - var zero = Vector.create(); - normal = Vector.div(delta, currentLength); - - relativeVelocity = Vector.sub( - (bodyB && Vector.sub(bodyB.position, bodyB.positionPrev)) || zero, - (bodyA && Vector.sub(bodyA.position, bodyA.positionPrev)) || zero, - ); - - normalVelocity = Vector.dot(normal, relativeVelocity); - } - - if (bodyA && !bodyA.isStatic) { - share = bodyA.inverseMass / massTotal; - - // keep track of applied impulses for post solving - bodyA.constraintImpulse.x -= force.x * share; - bodyA.constraintImpulse.y -= force.y * share; - - // apply forces - bodyA.position.x -= force.x * share; - bodyA.position.y -= force.y * share; - - // apply damping - if (constraint.damping) { - bodyA.positionPrev.x -= constraint.damping * normal.x * normalVelocity * share; - bodyA.positionPrev.y -= constraint.damping * normal.y * normalVelocity * share; - } - - // apply torque - torque = - (Vector.cross(pointA, force) / resistanceTotal) * - Constraint._torqueDampen * - bodyA.inverseInertia * - (1 - constraint.angularStiffness); - bodyA.constraintImpulse.angle -= torque; - bodyA.angle -= torque; - } - - if (bodyB && !bodyB.isStatic) { - share = bodyB.inverseMass / massTotal; - - // keep track of applied impulses for post solving - bodyB.constraintImpulse.x += force.x * share; - bodyB.constraintImpulse.y += force.y * share; - - // apply forces - bodyB.position.x += force.x * share; - bodyB.position.y += force.y * share; - - // apply damping - if (constraint.damping) { - bodyB.positionPrev.x += constraint.damping * normal.x * normalVelocity * share; - bodyB.positionPrev.y += constraint.damping * normal.y * normalVelocity * share; - } - - // apply torque - torque = - (Vector.cross(pointB, force) / resistanceTotal) * - Constraint._torqueDampen * - bodyB.inverseInertia * - (1 - constraint.angularStiffness); - bodyB.constraintImpulse.angle += torque; - bodyB.angle += torque; - } - }; - - /** - * Performs body updates required after solving constraints. - * @private - * @method postSolveAll - * @param {body[]} bodies - */ - Constraint.postSolveAll = function (bodies) { - for (var i = 0; i < bodies.length; i++) { - var body = bodies[i], - impulse = body.constraintImpulse; - - if (body.isStatic || (impulse.x === 0 && impulse.y === 0 && impulse.angle === 0)) { - continue; - } - - Sleeping.set(body, false); - - // update geometry and reset - for (var j = 0; j < body.parts.length; j++) { - var part = body.parts[j]; - - Vertices.translate(part.vertices, impulse); - - if (j > 0) { - part.position.x += impulse.x; - part.position.y += impulse.y; - } - - if (impulse.angle !== 0) { - Vertices.rotate(part.vertices, impulse.angle, body.position); - Axes.rotate(part.axes, impulse.angle); - if (j > 0) { - Vector.rotateAbout(part.position, impulse.angle, body.position, part.position); - } - } - - Bounds.update(part.bounds, part.vertices, body.velocity); - } - - // dampen the cached impulse for warming next step - impulse.angle *= Constraint._warming; - impulse.x *= Constraint._warming; - impulse.y *= Constraint._warming; - } - }; - - /** - * Returns the world-space position of `constraint.pointA`, accounting for `constraint.bodyA`. - * @method pointAWorld - * @param {constraint} constraint - * @returns {vector} the world-space position - */ - Constraint.pointAWorld = function (constraint) { - return { - x: (constraint.bodyA ? constraint.bodyA.position.x : 0) + constraint.pointA.x, - y: (constraint.bodyA ? constraint.bodyA.position.y : 0) + constraint.pointA.y, - }; - }; - - /** - * Returns the world-space position of `constraint.pointB`, accounting for `constraint.bodyB`. - * @method pointBWorld - * @param {constraint} constraint - * @returns {vector} the world-space position - */ - Constraint.pointBWorld = function (constraint) { - return { - x: (constraint.bodyB ? constraint.bodyB.position.x : 0) + constraint.pointB.x, - y: (constraint.bodyB ? constraint.bodyB.position.y : 0) + constraint.pointB.y, - }; - }; - - /* - * - * Properties Documentation - * - */ - - /** - * An integer `Number` uniquely identifying number generated in `Composite.create` by `Common.nextId`. - * - * @property id - * @type number - */ - - /** - * A `String` denoting the type of object. - * - * @property type - * @type string - * @default "constraint" - * @readOnly - */ - - /** - * An arbitrary `String` name to help the user identify and manage bodies. - * - * @property label - * @type string - * @default "Constraint" - */ - - /** - * An `Object` that defines the rendering properties to be consumed by the module `Matter.Render`. - * - * @property render - * @type object - */ - - /** - * A flag that indicates if the constraint should be rendered. - * - * @property render.visible - * @type boolean - * @default true - */ - - /** - * A `Number` that defines the line width to use when rendering the constraint outline. - * A value of `0` means no outline will be rendered. - * - * @property render.lineWidth - * @type number - * @default 2 - */ - - /** - * A `String` that defines the stroke style to use when rendering the constraint outline. - * It is the same as when using a canvas, so it accepts CSS style property values. - * - * @property render.strokeStyle - * @type string - * @default a random colour - */ - - /** - * A `String` that defines the constraint rendering type. - * The possible values are 'line', 'pin', 'spring'. - * An appropriate render type will be automatically chosen unless one is given in options. - * - * @property render.type - * @type string - * @default 'line' - */ - - /** - * A `Boolean` that defines if the constraint's anchor points should be rendered. - * - * @property render.anchors - * @type boolean - * @default true - */ - - /** - * The first possible `Body` that this constraint is attached to. - * - * @property bodyA - * @type body - * @default null - */ - - /** - * The second possible `Body` that this constraint is attached to. - * - * @property bodyB - * @type body - * @default null - */ - - /** - * A `Vector` that specifies the offset of the constraint from center of the `constraint.bodyA` if defined, otherwise a world-space position. - * - * @property pointA - * @type vector - * @default { x: 0, y: 0 } - */ - - /** - * A `Vector` that specifies the offset of the constraint from center of the `constraint.bodyB` if defined, otherwise a world-space position. - * - * @property pointB - * @type vector - * @default { x: 0, y: 0 } - */ - - /** - * A `Number` that specifies the stiffness of the constraint, i.e. the rate at which it returns to its resting `constraint.length`. - * A value of `1` means the constraint should be very stiff. - * A value of `0.2` means the constraint acts like a soft spring. - * - * @property stiffness - * @type number - * @default 1 - */ - - /** - * A `Number` that specifies the damping of the constraint, - * i.e. the amount of resistance applied to each body based on their velocities to limit the amount of oscillation. - * Damping will only be apparent when the constraint also has a very low `stiffness`. - * A value of `0.1` means the constraint will apply heavy damping, resulting in little to no oscillation. - * A value of `0` means the constraint will apply no damping. - * - * @property damping - * @type number - * @default 0 - */ - - /** - * A `Number` that specifies the target resting length of the constraint. - * It is calculated automatically in `Constraint.create` from initial positions of the `constraint.bodyA` and `constraint.bodyB`. - * - * @property length - * @type number - */ - - /** - * An object reserved for storing plugin-specific properties. - * - * @property plugin - * @type {} - */ - })(); - - /***/ - }, - /* 9 */ - /***/ function (module, exports, __webpack_require__) { - /** - * The `Matter.Pair` module contains methods for creating and manipulating collision pairs. - * - * @class Pair - */ - - var Pair = {}; - - module.exports = Pair; - - var Contact = __webpack_require__(18); - - (function () { - /** - * Creates a pair. - * @method create - * @param {collision} collision - * @param {number} timestamp - * @return {pair} A new pair - */ - Pair.create = function (collision, timestamp) { - var bodyA = collision.bodyA, - bodyB = collision.bodyB, - parentA = collision.parentA, - parentB = collision.parentB; - - var pair = { - id: Pair.id(bodyA, bodyB), - bodyA: bodyA, - bodyB: bodyB, - contacts: {}, - activeContacts: [], - separation: 0, - isActive: true, - confirmedActive: true, - isSensor: bodyA.isSensor || bodyB.isSensor, - timeCreated: timestamp, - timeUpdated: timestamp, - inverseMass: parentA.inverseMass + parentB.inverseMass, - friction: Math.min(parentA.friction, parentB.friction), - frictionStatic: Math.max(parentA.frictionStatic, parentB.frictionStatic), - restitution: Math.max(parentA.restitution, parentB.restitution), - slop: Math.max(parentA.slop, parentB.slop), - }; - - Pair.update(pair, collision, timestamp); - - return pair; - }; - - /** - * Updates a pair given a collision. - * @method update - * @param {pair} pair - * @param {collision} collision - * @param {number} timestamp - */ - Pair.update = function (pair, collision, timestamp) { - var contacts = pair.contacts, - supports = collision.supports, - activeContacts = pair.activeContacts, - parentA = collision.parentA, - parentB = collision.parentB; - - pair.collision = collision; - pair.inverseMass = parentA.inverseMass + parentB.inverseMass; - pair.friction = Math.min(parentA.friction, parentB.friction); - pair.frictionStatic = Math.max(parentA.frictionStatic, parentB.frictionStatic); - pair.restitution = Math.max(parentA.restitution, parentB.restitution); - pair.slop = Math.max(parentA.slop, parentB.slop); - activeContacts.length = 0; - - if (collision.collided) { - for (var i = 0; i < supports.length; i++) { - var support = supports[i], - contactId = Contact.id(support), - contact = contacts[contactId]; - - if (contact) { - activeContacts.push(contact); - } else { - activeContacts.push((contacts[contactId] = Contact.create(support))); - } - } - - pair.separation = collision.depth; - Pair.setActive(pair, true, timestamp); - } else { - if (pair.isActive === true) Pair.setActive(pair, false, timestamp); - } - }; - - /** - * Set a pair as active or inactive. - * @method setActive - * @param {pair} pair - * @param {bool} isActive - * @param {number} timestamp - */ - Pair.setActive = function (pair, isActive, timestamp) { - if (isActive) { - pair.isActive = true; - pair.timeUpdated = timestamp; - } else { - pair.isActive = false; - pair.activeContacts.length = 0; - } - }; - - /** - * Get the id for the given pair. - * @method id - * @param {body} bodyA - * @param {body} bodyB - * @return {string} Unique pairId - */ - Pair.id = function (bodyA, bodyB) { - if (bodyA.id < bodyB.id) { - return 'A' + bodyA.id + 'B' + bodyB.id; - } else { - return 'A' + bodyB.id + 'B' + bodyA.id; - } - }; - })(); - - /***/ - }, - /* 10 */ - /***/ function (module, exports, __webpack_require__) { - /** - * The `Matter.Render` module is a simple HTML5 canvas based renderer for visualising instances of `Matter.Engine`. - * It is intended for development and debugging purposes, but may also be suitable for simple games. - * It includes a number of drawing options including wireframe, vector with support for sprites and viewports. - * - * @class Render - */ - - var Render = {}; - - module.exports = Render; - - var Common = __webpack_require__(0); - var Composite = __webpack_require__(5); - var Bounds = __webpack_require__(1); - var Events = __webpack_require__(4); - var Grid = __webpack_require__(11); - var Vector = __webpack_require__(2); - var Mouse = __webpack_require__(14); - - (function () { - var _requestAnimationFrame, _cancelAnimationFrame; - - if (typeof window !== 'undefined') { - _requestAnimationFrame = - window.requestAnimationFrame || - window.webkitRequestAnimationFrame || - window.mozRequestAnimationFrame || - window.msRequestAnimationFrame || - function (callback) { - window.setTimeout(function () { - callback(Common.now()); - }, 1000 / 60); - }; - - _cancelAnimationFrame = - window.cancelAnimationFrame || - window.mozCancelAnimationFrame || - window.webkitCancelAnimationFrame || - window.msCancelAnimationFrame; - } - - /** - * Creates a new renderer. The options parameter is an object that specifies any properties you wish to override the defaults. - * All properties have default values, and many are pre-calculated automatically based on other properties. - * See the properties section below for detailed information on what you can pass via the `options` object. - * @method create - * @param {object} [options] - * @return {render} A new renderer - */ - Render.create = function (options) { - var defaults = { - controller: Render, - engine: null, - element: null, - canvas: null, - mouse: null, - frameRequestId: null, - options: { - width: 800, - height: 600, - pixelRatio: 1, - background: '#18181d', - wireframeBackground: '#0f0f13', - hasBounds: !!options.bounds, - enabled: true, - wireframes: true, - showSleeping: true, - showDebug: false, - showBroadphase: false, - showBounds: false, - showVelocity: false, - showCollisions: false, - showSeparations: false, - showAxes: false, - showPositions: false, - showAngleIndicator: false, - showIds: false, - showShadows: false, - showVertexNumbers: false, - showConvexHulls: false, - showInternalEdges: false, - showMousePosition: false, - }, - }; - - var render = Common.extend(defaults, options); - - if (render.canvas) { - render.canvas.width = render.options.width || render.canvas.width; - render.canvas.height = render.options.height || render.canvas.height; - } - - render.mouse = options.mouse; - render.engine = options.engine; - render.canvas = render.canvas || _createCanvas(render.options.width, render.options.height); - render.context = render.canvas.getContext('2d'); - render.textures = {}; - - render.bounds = render.bounds || { - min: { - x: 0, - y: 0, - }, - max: { - x: render.canvas.width, - y: render.canvas.height, - }, - }; - - if (render.options.pixelRatio !== 1) { - Render.setPixelRatio(render, render.options.pixelRatio); - } - - if (Common.isElement(render.element)) { - render.element.appendChild(render.canvas); - } else if (!render.canvas.parentNode) { - Common.log( - 'Render.create: options.element was undefined, render.canvas was created but not appended', - 'warn', - ); - } - - return render; - }; - - /** - * Continuously updates the render canvas on the `requestAnimationFrame` event. - * @method run - * @param {render} render - */ - Render.run = function (render) { - (function loop(time) { - render.frameRequestId = _requestAnimationFrame(loop); - Render.world(render); - })(); - }; - - /** - * Ends execution of `Render.run` on the given `render`, by canceling the animation frame request event loop. - * @method stop - * @param {render} render - */ - Render.stop = function (render) { - _cancelAnimationFrame(render.frameRequestId); - }; - - /** - * Sets the pixel ratio of the renderer and updates the canvas. - * To automatically detect the correct ratio, pass the string `'auto'` for `pixelRatio`. - * @method setPixelRatio - * @param {render} render - * @param {number} pixelRatio - */ - Render.setPixelRatio = function (render, pixelRatio) { - var options = render.options, - canvas = render.canvas; - - if (pixelRatio === 'auto') { - pixelRatio = _getPixelRatio(canvas); - } - - options.pixelRatio = pixelRatio; - canvas.setAttribute('data-pixel-ratio', pixelRatio); - canvas.width = options.width * pixelRatio; - canvas.height = options.height * pixelRatio; - canvas.style.width = options.width / 2 + 'px'; - canvas.style.height = options.height / 2 + 'px'; - }; - - /** - * Positions and sizes the viewport around the given object bounds. - * Objects must have at least one of the following properties: - * - `object.bounds` - * - `object.position` - * - `object.min` and `object.max` - * - `object.x` and `object.y` - * @method lookAt - * @param {render} render - * @param {object[]} objects - * @param {vector} [padding] - * @param {bool} [center=true] - */ - Render.lookAt = function (render, objects, padding, center) { - center = typeof center !== 'undefined' ? center : true; - objects = Common.isArray(objects) ? objects : [objects]; - padding = padding || { - x: 0, - y: 0, - }; - - // find bounds of all objects - var bounds = { - min: {x: Infinity, y: Infinity}, - max: {x: -Infinity, y: -Infinity}, - }; - - for (var i = 0; i < objects.length; i += 1) { - var object = objects[i], - min = object.bounds ? object.bounds.min : object.min || object.position || object, - max = object.bounds ? object.bounds.max : object.max || object.position || object; - - if (min && max) { - if (min.x < bounds.min.x) bounds.min.x = min.x; - - if (max.x > bounds.max.x) bounds.max.x = max.x; - - if (min.y < bounds.min.y) bounds.min.y = min.y; - - if (max.y > bounds.max.y) bounds.max.y = max.y; - } - } - - // find ratios - var width = bounds.max.x - bounds.min.x + 2 * padding.x, - height = bounds.max.y - bounds.min.y + 2 * padding.y, - viewHeight = render.canvas.height, - viewWidth = render.canvas.width, - outerRatio = viewWidth / viewHeight, - innerRatio = width / height, - scaleX = 1, - scaleY = 1; - - // find scale factor - if (innerRatio > outerRatio) { - scaleY = innerRatio / outerRatio; - } else { - scaleX = outerRatio / innerRatio; - } - - // enable bounds - render.options.hasBounds = true; - - // position and size - render.bounds.min.x = bounds.min.x; - render.bounds.max.x = bounds.min.x + width * scaleX; - render.bounds.min.y = bounds.min.y; - render.bounds.max.y = bounds.min.y + height * scaleY; - - // center - if (center) { - render.bounds.min.x += width * 0.5 - width * scaleX * 0.5; - render.bounds.max.x += width * 0.5 - width * scaleX * 0.5; - render.bounds.min.y += height * 0.5 - height * scaleY * 0.5; - render.bounds.max.y += height * 0.5 - height * scaleY * 0.5; - } - - // padding - render.bounds.min.x -= padding.x; - render.bounds.max.x -= padding.x; - render.bounds.min.y -= padding.y; - render.bounds.max.y -= padding.y; - - // update mouse - if (render.mouse) { - Mouse.setScale(render.mouse, { - x: (render.bounds.max.x - render.bounds.min.x) / render.canvas.width, - y: (render.bounds.max.y - render.bounds.min.y) / render.canvas.height, - }); - - Mouse.setOffset(render.mouse, render.bounds.min); - } - }; - - /** - * Applies viewport transforms based on `render.bounds` to a render context. - * @method startViewTransform - * @param {render} render - */ - Render.startViewTransform = function (render) { - var boundsWidth = render.bounds.max.x - render.bounds.min.x, - boundsHeight = render.bounds.max.y - render.bounds.min.y, - boundsScaleX = boundsWidth / render.options.width, - boundsScaleY = boundsHeight / render.options.height; - - render.context.setTransform( - render.options.pixelRatio / boundsScaleX, - 0, - 0, - render.options.pixelRatio / boundsScaleY, - 0, - 0, - ); - - render.context.translate(-render.bounds.min.x, -render.bounds.min.y); - }; - - /** - * Resets all transforms on the render context. - * @method endViewTransform - * @param {render} render - */ - Render.endViewTransform = function (render) { - render.context.setTransform(render.options.pixelRatio, 0, 0, render.options.pixelRatio, 0, 0); - }; - - /** - * Renders the given `engine`'s `Matter.World` object. - * This is the entry point for all rendering and should be called every time the scene changes. - * @method world - * @param {render} render - */ - Render.world = function (render) { - var engine = render.engine, - world = engine.world, - canvas = render.canvas, - context = render.context, - options = render.options, - allBodies = Composite.allBodies(world), - allConstraints = Composite.allConstraints(world), - background = options.wireframes ? options.wireframeBackground : options.background, - bodies = [], - constraints = [], - i; - - var event = { - timestamp: engine.timing.timestamp, - }; - - Events.trigger(render, 'beforeRender', event); - - // apply background if it has changed - if (render.currentBackground !== background) _applyBackground(render, background); - - // clear the canvas with a transparent fill, to allow the canvas background to show - context.globalCompositeOperation = 'source-in'; - context.fillStyle = 'transparent'; - context.fillRect(0, 0, canvas.width, canvas.height); - context.globalCompositeOperation = 'source-over'; - - // handle bounds - if (options.hasBounds) { - // filter out bodies that are not in view - for (i = 0; i < allBodies.length; i++) { - var body = allBodies[i]; - if (Bounds.overlaps(body.bounds, render.bounds)) bodies.push(body); - } - - // filter out constraints that are not in view - for (i = 0; i < allConstraints.length; i++) { - var constraint = allConstraints[i], - bodyA = constraint.bodyA, - bodyB = constraint.bodyB, - pointAWorld = constraint.pointA, - pointBWorld = constraint.pointB; - - if (bodyA) pointAWorld = Vector.add(bodyA.position, constraint.pointA); - if (bodyB) pointBWorld = Vector.add(bodyB.position, constraint.pointB); - - if (!pointAWorld || !pointBWorld) continue; - - if (Bounds.contains(render.bounds, pointAWorld) || Bounds.contains(render.bounds, pointBWorld)) - constraints.push(constraint); - } - - // transform the view - Render.startViewTransform(render); - - // update mouse - if (render.mouse) { - Mouse.setScale(render.mouse, { - x: (render.bounds.max.x - render.bounds.min.x) / render.options.width, - y: (render.bounds.max.y - render.bounds.min.y) / render.options.height, - }); - - Mouse.setOffset(render.mouse, render.bounds.min); - } - } else { - constraints = allConstraints; - bodies = allBodies; - - if (render.options.pixelRatio !== 1) { - render.context.setTransform(render.options.pixelRatio, 0, 0, render.options.pixelRatio, 0, 0); - } - } - - if (!options.wireframes || (engine.enableSleeping && options.showSleeping)) { - // fully featured rendering of bodies - Render.bodies(render, bodies, context); - } else { - if (options.showConvexHulls) Render.bodyConvexHulls(render, bodies, context); - - // optimised method for wireframes only - Render.bodyWireframes(render, bodies, context); - } - - if (options.showBounds) Render.bodyBounds(render, bodies, context); - - if (options.showAxes || options.showAngleIndicator) Render.bodyAxes(render, bodies, context); - - if (options.showPositions) Render.bodyPositions(render, bodies, context); - - if (options.showVelocity) Render.bodyVelocity(render, bodies, context); - - if (options.showIds) Render.bodyIds(render, bodies, context); - - if (options.showSeparations) Render.separations(render, engine.pairs.list, context); - - if (options.showCollisions) Render.collisions(render, engine.pairs.list, context); - - if (options.showVertexNumbers) Render.vertexNumbers(render, bodies, context); - - if (options.showMousePosition) Render.mousePosition(render, render.mouse, context); - - Render.constraints(constraints, context); - - if (options.showBroadphase && engine.broadphase.controller === Grid) - Render.grid(render, engine.broadphase, context); - - if (options.showDebug) Render.debug(render, context); - - if (options.hasBounds) { - // revert view transforms - Render.endViewTransform(render); - } - - Events.trigger(render, 'afterRender', event); - }; - - /** - * Description - * @private - * @method debug - * @param {render} render - * @param {RenderingContext} context - */ - Render.debug = function (render, context) { - var c = context, - engine = render.engine, - world = engine.world, - metrics = engine.metrics, - options = render.options, - bodies = Composite.allBodies(world), - space = ' '; - - if (engine.timing.timestamp - (render.debugTimestamp || 0) >= 500) { - var text = ''; - - if (metrics.timing) { - text += 'fps: ' + Math.round(metrics.timing.fps) + space; - } - - // @if DEBUG - if (metrics.extended) { - if (metrics.timing) { - text += 'delta: ' + metrics.timing.delta.toFixed(3) + space; - text += 'correction: ' + metrics.timing.correction.toFixed(3) + space; - } - - text += 'bodies: ' + bodies.length + space; - - if (engine.broadphase.controller === Grid) text += 'buckets: ' + metrics.buckets + space; - - text += '\n'; - - text += 'collisions: ' + metrics.collisions + space; - text += 'pairs: ' + engine.pairs.list.length + space; - text += 'broad: ' + metrics.broadEff + space; - text += 'mid: ' + metrics.midEff + space; - text += 'narrow: ' + metrics.narrowEff + space; - } - // @endif - - render.debugString = text; - render.debugTimestamp = engine.timing.timestamp; - } - - if (render.debugString) { - c.font = '12px Arial'; - - if (options.wireframes) { - c.fillStyle = 'rgba(255,255,255,0.5)'; - } else { - c.fillStyle = 'rgba(0,0,0,0.5)'; - } - - var split = render.debugString.split('\n'); - - for (var i = 0; i < split.length; i++) { - c.fillText(split[i], 50, 50 + i * 18); - } - } - }; - - /** - * Description - * @private - * @method constraints - * @param {constraint[]} constraints - * @param {RenderingContext} context - */ - Render.constraints = function (constraints, context) { - var c = context; - - for (var i = 0; i < constraints.length; i++) { - var constraint = constraints[i]; - - if (!constraint.render.visible || !constraint.pointA || !constraint.pointB) continue; - - var bodyA = constraint.bodyA, - bodyB = constraint.bodyB, - start, - end; - - if (bodyA) { - start = Vector.add(bodyA.position, constraint.pointA); - } else { - start = constraint.pointA; - } - - if (constraint.render.type === 'pin') { - c.beginPath(); - c.arc(start.x, start.y, 3, 0, 2 * Math.PI); - c.closePath(); - } else { - if (bodyB) { - end = Vector.add(bodyB.position, constraint.pointB); - } else { - end = constraint.pointB; - } - - c.beginPath(); - c.moveTo(start.x, start.y); - - if (constraint.render.type === 'spring') { - var delta = Vector.sub(end, start), - normal = Vector.perp(Vector.normalise(delta)), - coils = Math.ceil(Common.clamp(constraint.length / 5, 12, 20)), - offset; - - for (var j = 1; j < coils; j += 1) { - offset = j % 2 === 0 ? 1 : -1; - - c.lineTo( - start.x + delta.x * (j / coils) + normal.x * offset * 4, - start.y + delta.y * (j / coils) + normal.y * offset * 4, - ); - } - } - - c.lineTo(end.x, end.y); - } - - if (constraint.render.lineWidth) { - c.lineWidth = constraint.render.lineWidth; - c.strokeStyle = constraint.render.strokeStyle; - c.stroke(); - } - - if (constraint.render.anchors) { - c.fillStyle = constraint.render.strokeStyle; - c.beginPath(); - c.arc(start.x, start.y, 3, 0, 2 * Math.PI); - c.arc(end.x, end.y, 3, 0, 2 * Math.PI); - c.closePath(); - c.fill(); - } - } - }; - - /** - * Description - * @private - * @method bodyShadows - * @param {render} render - * @param {body[]} bodies - * @param {RenderingContext} context - */ - Render.bodyShadows = function (render, bodies, context) { - var c = context; - render.engine; - - for (var i = 0; i < bodies.length; i++) { - var body = bodies[i]; - - if (!body.render.visible) continue; - - if (body.circleRadius) { - c.beginPath(); - c.arc(body.position.x, body.position.y, body.circleRadius, 0, 2 * Math.PI); - c.closePath(); - } else { - c.beginPath(); - c.moveTo(body.vertices[0].x, body.vertices[0].y); - for (var j = 1; j < body.vertices.length; j++) { - c.lineTo(body.vertices[j].x, body.vertices[j].y); - } - c.closePath(); - } - - var distanceX = body.position.x - render.options.width * 0.5, - distanceY = body.position.y - render.options.height * 0.2, - distance = Math.abs(distanceX) + Math.abs(distanceY); - - c.shadowColor = 'rgba(0,0,0,0.15)'; - c.shadowOffsetX = 0.05 * distanceX; - c.shadowOffsetY = 0.05 * distanceY; - c.shadowBlur = 1 + 12 * Math.min(1, distance / 1000); - - c.fill(); - - c.shadowColor = null; - c.shadowOffsetX = null; - c.shadowOffsetY = null; - c.shadowBlur = null; - } - }; - - /** - * Description - * @private - * @method bodies - * @param {render} render - * @param {body[]} bodies - * @param {RenderingContext} context - */ - Render.bodies = function (render, bodies, context) { - var c = context; - render.engine; - var options = render.options, - showInternalEdges = options.showInternalEdges || !options.wireframes, - body, - part, - i, - k; - - for (i = 0; i < bodies.length; i++) { - body = bodies[i]; - - if (!body.render.visible) continue; - - // handle compound parts - for (k = body.parts.length > 1 ? 1 : 0; k < body.parts.length; k++) { - part = body.parts[k]; - - if (!part.render.visible) continue; - - if (options.showSleeping && body.isSleeping) { - c.globalAlpha = 0.5 * part.render.opacity; - } else if (part.render.opacity !== 1) { - c.globalAlpha = part.render.opacity; - } - - if (part.render.sprite && part.render.sprite.texture && !options.wireframes) { - // part sprite - var sprite = part.render.sprite, - texture = _getTexture(render, sprite.texture); - - c.translate(part.position.x, part.position.y); - c.rotate(part.angle); - - c.drawImage( - texture, - texture.width * -sprite.xOffset * sprite.xScale, - texture.height * -sprite.yOffset * sprite.yScale, - texture.width * sprite.xScale, - texture.height * sprite.yScale, - ); - - // revert translation, hopefully faster than save / restore - c.rotate(-part.angle); - c.translate(-part.position.x, -part.position.y); - } else { - // part polygon - if (part.circleRadius) { - c.beginPath(); - c.arc(part.position.x, part.position.y, part.circleRadius, 0, 2 * Math.PI); - } else { - c.beginPath(); - c.moveTo(part.vertices[0].x, part.vertices[0].y); - - for (var j = 1; j < part.vertices.length; j++) { - if (!part.vertices[j - 1].isInternal || showInternalEdges) { - c.lineTo(part.vertices[j].x, part.vertices[j].y); - } else { - c.moveTo(part.vertices[j].x, part.vertices[j].y); - } - - if (part.vertices[j].isInternal && !showInternalEdges) { - c.moveTo( - part.vertices[(j + 1) % part.vertices.length].x, - part.vertices[(j + 1) % part.vertices.length].y, - ); - } - } - - c.lineTo(part.vertices[0].x, part.vertices[0].y); - c.closePath(); - } - - if (!options.wireframes) { - c.fillStyle = part.render.fillStyle; - - if (part.render.lineWidth) { - c.lineWidth = part.render.lineWidth; - c.strokeStyle = part.render.strokeStyle; - c.stroke(); - } - - c.fill(); - } else { - c.lineWidth = 1; - c.strokeStyle = '#bbb'; - c.stroke(); - } - } - - c.globalAlpha = 1; - } - } - }; - - /** - * Optimised method for drawing body wireframes in one pass - * @private - * @method bodyWireframes - * @param {render} render - * @param {body[]} bodies - * @param {RenderingContext} context - */ - Render.bodyWireframes = function (render, bodies, context) { - var c = context, - showInternalEdges = render.options.showInternalEdges, - body, - part, - i, - j, - k; - - c.beginPath(); - - // render all bodies - for (i = 0; i < bodies.length; i++) { - body = bodies[i]; - - if (!body.render.visible) continue; - - // handle compound parts - for (k = body.parts.length > 1 ? 1 : 0; k < body.parts.length; k++) { - part = body.parts[k]; - - c.moveTo(part.vertices[0].x, part.vertices[0].y); - - for (j = 1; j < part.vertices.length; j++) { - if (!part.vertices[j - 1].isInternal || showInternalEdges) { - c.lineTo(part.vertices[j].x, part.vertices[j].y); - } else { - c.moveTo(part.vertices[j].x, part.vertices[j].y); - } - - if (part.vertices[j].isInternal && !showInternalEdges) { - c.moveTo( - part.vertices[(j + 1) % part.vertices.length].x, - part.vertices[(j + 1) % part.vertices.length].y, - ); - } - } - - c.lineTo(part.vertices[0].x, part.vertices[0].y); - } - } - - c.lineWidth = 1; - c.strokeStyle = '#bbb'; - c.stroke(); - }; - - /** - * Optimised method for drawing body convex hull wireframes in one pass - * @private - * @method bodyConvexHulls - * @param {render} render - * @param {body[]} bodies - * @param {RenderingContext} context - */ - Render.bodyConvexHulls = function (render, bodies, context) { - var c = context, - body, - i, - j; - - c.beginPath(); - - // render convex hulls - for (i = 0; i < bodies.length; i++) { - body = bodies[i]; - - if (!body.render.visible || body.parts.length === 1) continue; - - c.moveTo(body.vertices[0].x, body.vertices[0].y); - - for (j = 1; j < body.vertices.length; j++) { - c.lineTo(body.vertices[j].x, body.vertices[j].y); - } - - c.lineTo(body.vertices[0].x, body.vertices[0].y); - } - - c.lineWidth = 1; - c.strokeStyle = 'rgba(255,255,255,0.2)'; - c.stroke(); - }; - - /** - * Renders body vertex numbers. - * @private - * @method vertexNumbers - * @param {render} render - * @param {body[]} bodies - * @param {RenderingContext} context - */ - Render.vertexNumbers = function (render, bodies, context) { - var c = context, - i, - j, - k; - - for (i = 0; i < bodies.length; i++) { - var parts = bodies[i].parts; - for (k = parts.length > 1 ? 1 : 0; k < parts.length; k++) { - var part = parts[k]; - for (j = 0; j < part.vertices.length; j++) { - c.fillStyle = 'rgba(255,255,255,0.2)'; - c.fillText( - i + '_' + j, - part.position.x + (part.vertices[j].x - part.position.x) * 0.8, - part.position.y + (part.vertices[j].y - part.position.y) * 0.8, - ); - } - } - } - }; - - /** - * Renders mouse position. - * @private - * @method mousePosition - * @param {render} render - * @param {mouse} mouse - * @param {RenderingContext} context - */ - Render.mousePosition = function (render, mouse, context) { - var c = context; - c.fillStyle = 'rgba(255,255,255,0.8)'; - c.fillText(mouse.position.x + ' ' + mouse.position.y, mouse.position.x + 5, mouse.position.y - 5); - }; - - /** - * Draws body bounds - * @private - * @method bodyBounds - * @param {render} render - * @param {body[]} bodies - * @param {RenderingContext} context - */ - Render.bodyBounds = function (render, bodies, context) { - var c = context; - render.engine; - var options = render.options; - - c.beginPath(); - - for (var i = 0; i < bodies.length; i++) { - var body = bodies[i]; - - if (body.render.visible) { - var parts = bodies[i].parts; - for (var j = parts.length > 1 ? 1 : 0; j < parts.length; j++) { - var part = parts[j]; - c.rect( - part.bounds.min.x, - part.bounds.min.y, - part.bounds.max.x - part.bounds.min.x, - part.bounds.max.y - part.bounds.min.y, - ); - } - } - } - - if (options.wireframes) { - c.strokeStyle = 'rgba(255,255,255,0.08)'; - } else { - c.strokeStyle = 'rgba(0,0,0,0.1)'; - } - - c.lineWidth = 1; - c.stroke(); - }; - - /** - * Draws body angle indicators and axes - * @private - * @method bodyAxes - * @param {render} render - * @param {body[]} bodies - * @param {RenderingContext} context - */ - Render.bodyAxes = function (render, bodies, context) { - var c = context; - render.engine; - var options = render.options, - part, - i, - j, - k; - - c.beginPath(); - - for (i = 0; i < bodies.length; i++) { - var body = bodies[i], - parts = body.parts; - - if (!body.render.visible) continue; - - if (options.showAxes) { - // render all axes - for (j = parts.length > 1 ? 1 : 0; j < parts.length; j++) { - part = parts[j]; - for (k = 0; k < part.axes.length; k++) { - var axis = part.axes[k]; - c.moveTo(part.position.x, part.position.y); - c.lineTo(part.position.x + axis.x * 20, part.position.y + axis.y * 20); - } - } - } else { - for (j = parts.length > 1 ? 1 : 0; j < parts.length; j++) { - part = parts[j]; - for (k = 0; k < part.axes.length; k++) { - // render a single axis indicator - c.moveTo(part.position.x, part.position.y); - c.lineTo( - (part.vertices[0].x + part.vertices[part.vertices.length - 1].x) / 2, - (part.vertices[0].y + part.vertices[part.vertices.length - 1].y) / 2, - ); - } - } - } - } - - if (options.wireframes) { - c.strokeStyle = 'indianred'; - c.lineWidth = 1; - } else { - c.strokeStyle = 'rgba(255, 255, 255, 0.4)'; - c.globalCompositeOperation = 'overlay'; - c.lineWidth = 2; - } - - c.stroke(); - c.globalCompositeOperation = 'source-over'; - }; - - /** - * Draws body positions - * @private - * @method bodyPositions - * @param {render} render - * @param {body[]} bodies - * @param {RenderingContext} context - */ - Render.bodyPositions = function (render, bodies, context) { - var c = context; - render.engine; - var options = render.options, - body, - part, - i, - k; - - c.beginPath(); - - // render current positions - for (i = 0; i < bodies.length; i++) { - body = bodies[i]; - - if (!body.render.visible) continue; - - // handle compound parts - for (k = 0; k < body.parts.length; k++) { - part = body.parts[k]; - c.arc(part.position.x, part.position.y, 3, 0, 2 * Math.PI, false); - c.closePath(); - } - } - - if (options.wireframes) { - c.fillStyle = 'indianred'; - } else { - c.fillStyle = 'rgba(0,0,0,0.5)'; - } - c.fill(); - - c.beginPath(); - - // render previous positions - for (i = 0; i < bodies.length; i++) { - body = bodies[i]; - if (body.render.visible) { - c.arc(body.positionPrev.x, body.positionPrev.y, 2, 0, 2 * Math.PI, false); - c.closePath(); - } - } - - c.fillStyle = 'rgba(255,165,0,0.8)'; - c.fill(); - }; - - /** - * Draws body velocity - * @private - * @method bodyVelocity - * @param {render} render - * @param {body[]} bodies - * @param {RenderingContext} context - */ - Render.bodyVelocity = function (render, bodies, context) { - var c = context; - - c.beginPath(); - - for (var i = 0; i < bodies.length; i++) { - var body = bodies[i]; - - if (!body.render.visible) continue; - - c.moveTo(body.position.x, body.position.y); - c.lineTo( - body.position.x + (body.position.x - body.positionPrev.x) * 2, - body.position.y + (body.position.y - body.positionPrev.y) * 2, - ); - } - - c.lineWidth = 3; - c.strokeStyle = 'cornflowerblue'; - c.stroke(); - }; - - /** - * Draws body ids - * @private - * @method bodyIds - * @param {render} render - * @param {body[]} bodies - * @param {RenderingContext} context - */ - Render.bodyIds = function (render, bodies, context) { - var c = context, - i, - j; - - for (i = 0; i < bodies.length; i++) { - if (!bodies[i].render.visible) continue; - - var parts = bodies[i].parts; - for (j = parts.length > 1 ? 1 : 0; j < parts.length; j++) { - var part = parts[j]; - c.font = '12px Arial'; - c.fillStyle = 'rgba(255,255,255,0.5)'; - c.fillText(part.id, part.position.x + 10, part.position.y - 10); - } - } - }; - - /** - * Description - * @private - * @method collisions - * @param {render} render - * @param {pair[]} pairs - * @param {RenderingContext} context - */ - Render.collisions = function (render, pairs, context) { - var c = context, - options = render.options, - pair, - collision, - i, - j; - - c.beginPath(); - - // render collision positions - for (i = 0; i < pairs.length; i++) { - pair = pairs[i]; - - if (!pair.isActive) continue; - - collision = pair.collision; - for (j = 0; j < pair.activeContacts.length; j++) { - var contact = pair.activeContacts[j], - vertex = contact.vertex; - c.rect(vertex.x - 1.5, vertex.y - 1.5, 3.5, 3.5); - } - } - - if (options.wireframes) { - c.fillStyle = 'rgba(255,255,255,0.7)'; - } else { - c.fillStyle = 'orange'; - } - c.fill(); - - c.beginPath(); - - // render collision normals - for (i = 0; i < pairs.length; i++) { - pair = pairs[i]; - - if (!pair.isActive) continue; - - collision = pair.collision; - - if (pair.activeContacts.length > 0) { - var normalPosX = pair.activeContacts[0].vertex.x, - normalPosY = pair.activeContacts[0].vertex.y; - - if (pair.activeContacts.length === 2) { - normalPosX = (pair.activeContacts[0].vertex.x + pair.activeContacts[1].vertex.x) / 2; - normalPosY = (pair.activeContacts[0].vertex.y + pair.activeContacts[1].vertex.y) / 2; - } - - if (collision.bodyB === collision.supports[0].body || collision.bodyA.isStatic === true) { - c.moveTo(normalPosX - collision.normal.x * 8, normalPosY - collision.normal.y * 8); - } else { - c.moveTo(normalPosX + collision.normal.x * 8, normalPosY + collision.normal.y * 8); - } - - c.lineTo(normalPosX, normalPosY); - } - } - - if (options.wireframes) { - c.strokeStyle = 'rgba(255,165,0,0.7)'; - } else { - c.strokeStyle = 'orange'; - } - - c.lineWidth = 1; - c.stroke(); - }; - - /** - * Description - * @private - * @method separations - * @param {render} render - * @param {pair[]} pairs - * @param {RenderingContext} context - */ - Render.separations = function (render, pairs, context) { - var c = context, - options = render.options, - pair, - collision, - bodyA, - bodyB, - i; - - c.beginPath(); - - // render separations - for (i = 0; i < pairs.length; i++) { - pair = pairs[i]; - - if (!pair.isActive) continue; - - collision = pair.collision; - bodyA = collision.bodyA; - bodyB = collision.bodyB; - - var k = 1; - - if (!bodyB.isStatic && !bodyA.isStatic) k = 0.5; - if (bodyB.isStatic) k = 0; - - c.moveTo(bodyB.position.x, bodyB.position.y); - c.lineTo(bodyB.position.x - collision.penetration.x * k, bodyB.position.y - collision.penetration.y * k); - - k = 1; - - if (!bodyB.isStatic && !bodyA.isStatic) k = 0.5; - if (bodyA.isStatic) k = 0; - - c.moveTo(bodyA.position.x, bodyA.position.y); - c.lineTo(bodyA.position.x + collision.penetration.x * k, bodyA.position.y + collision.penetration.y * k); - } - - if (options.wireframes) { - c.strokeStyle = 'rgba(255,165,0,0.5)'; - } else { - c.strokeStyle = 'orange'; - } - c.stroke(); - }; - - /** - * Description - * @private - * @method grid - * @param {render} render - * @param {grid} grid - * @param {RenderingContext} context - */ - Render.grid = function (render, grid, context) { - var c = context, - options = render.options; - - if (options.wireframes) { - c.strokeStyle = 'rgba(255,180,0,0.1)'; - } else { - c.strokeStyle = 'rgba(255,180,0,0.5)'; - } - - c.beginPath(); - - var bucketKeys = Common.keys(grid.buckets); - - for (var i = 0; i < bucketKeys.length; i++) { - var bucketId = bucketKeys[i]; - - if (grid.buckets[bucketId].length < 2) continue; - - var region = bucketId.split(/C|R/); - c.rect( - 0.5 + parseInt(region[1], 10) * grid.bucketWidth, - 0.5 + parseInt(region[2], 10) * grid.bucketHeight, - grid.bucketWidth, - grid.bucketHeight, - ); - } - - c.lineWidth = 1; - c.stroke(); - }; - - /** - * Description - * @private - * @method inspector - * @param {inspector} inspector - * @param {RenderingContext} context - */ - Render.inspector = function (inspector, context) { - inspector.engine; - var selected = inspector.selected, - render = inspector.render, - options = render.options, - bounds; - - if (options.hasBounds) { - var boundsWidth = render.bounds.max.x - render.bounds.min.x, - boundsHeight = render.bounds.max.y - render.bounds.min.y, - boundsScaleX = boundsWidth / render.options.width, - boundsScaleY = boundsHeight / render.options.height; - - context.scale(1 / boundsScaleX, 1 / boundsScaleY); - context.translate(-render.bounds.min.x, -render.bounds.min.y); - } - - for (var i = 0; i < selected.length; i++) { - var item = selected[i].data; - - context.translate(0.5, 0.5); - context.lineWidth = 1; - context.strokeStyle = 'rgba(255,165,0,0.9)'; - context.setLineDash([1, 2]); - - switch (item.type) { - case 'body': - // render body selections - bounds = item.bounds; - context.beginPath(); - context.rect( - Math.floor(bounds.min.x - 3), - Math.floor(bounds.min.y - 3), - Math.floor(bounds.max.x - bounds.min.x + 6), - Math.floor(bounds.max.y - bounds.min.y + 6), - ); - context.closePath(); - context.stroke(); - - break; - - case 'constraint': - // render constraint selections - var point = item.pointA; - if (item.bodyA) point = item.pointB; - context.beginPath(); - context.arc(point.x, point.y, 10, 0, 2 * Math.PI); - context.closePath(); - context.stroke(); - - break; - } - - context.setLineDash([]); - context.translate(-0.5, -0.5); - } - - // render selection region - if (inspector.selectStart !== null) { - context.translate(0.5, 0.5); - context.lineWidth = 1; - context.strokeStyle = 'rgba(255,165,0,0.6)'; - context.fillStyle = 'rgba(255,165,0,0.1)'; - bounds = inspector.selectBounds; - context.beginPath(); - context.rect( - Math.floor(bounds.min.x), - Math.floor(bounds.min.y), - Math.floor(bounds.max.x - bounds.min.x), - Math.floor(bounds.max.y - bounds.min.y), - ); - context.closePath(); - context.stroke(); - context.fill(); - context.translate(-0.5, -0.5); - } - - if (options.hasBounds) context.setTransform(1, 0, 0, 1, 0, 0); - }; - - /** - * Description - * @method _createCanvas - * @private - * @param {} width - * @param {} height - * @return canvas - */ - var _createCanvas = function (width, height) { - var canvas = document.createElement('canvas'); - canvas.width = width; - canvas.height = height; - canvas.oncontextmenu = function () { - return false; - }; - canvas.onselectstart = function () { - return false; - }; - return canvas; - }; - - /** - * Gets the pixel ratio of the canvas. - * @method _getPixelRatio - * @private - * @param {HTMLElement} canvas - * @return {Number} pixel ratio - */ - var _getPixelRatio = function (canvas) { - var context = canvas.getContext('2d'), - devicePixelRatio = window.devicePixelRatio || 1, - backingStorePixelRatio = - context.webkitBackingStorePixelRatio || - context.mozBackingStorePixelRatio || - context.msBackingStorePixelRatio || - context.oBackingStorePixelRatio || - context.backingStorePixelRatio || - 1; - - return devicePixelRatio / backingStorePixelRatio; - }; - - /** - * Gets the requested texture (an Image) via its path - * @method _getTexture - * @private - * @param {render} render - * @param {string} imagePath - * @return {Image} texture - */ - var _getTexture = function (render, imagePath) { - var image = render.textures[imagePath]; - - if (image) return image; - - image = render.textures[imagePath] = new Image(); - image.src = imagePath; - - return image; - }; - - /** - * Applies the background to the canvas using CSS. - * @method applyBackground - * @private - * @param {render} render - * @param {string} background - */ - var _applyBackground = function (render, background) { - var cssBackground = background; - - if (/(jpg|gif|png)$/.test(background)) cssBackground = 'url(' + background + ')'; - - render.canvas.style.background = cssBackground; - render.canvas.style.backgroundSize = 'contain'; - render.currentBackground = background; - }; - - /* - * - * Events Documentation - * - */ - - /** - * Fired before rendering - * - * @event beforeRender - * @param {} event An event object - * @param {number} event.timestamp The engine.timing.timestamp of the event - * @param {} event.source The source object of the event - * @param {} event.name The name of the event - */ - - /** - * Fired after rendering - * - * @event afterRender - * @param {} event An event object - * @param {number} event.timestamp The engine.timing.timestamp of the event - * @param {} event.source The source object of the event - * @param {} event.name The name of the event - */ - - /* - * - * Properties Documentation - * - */ - - /** - * A back-reference to the `Matter.Render` module. - * - * @property controller - * @type render - */ - - /** - * A reference to the `Matter.Engine` instance to be used. - * - * @property engine - * @type engine - */ - - /** - * A reference to the element where the canvas is to be inserted (if `render.canvas` has not been specified) - * - * @property element - * @type HTMLElement - * @default null - */ - - /** - * The canvas element to render to. If not specified, one will be created if `render.element` has been specified. - * - * @property canvas - * @type HTMLCanvasElement - * @default null - */ - - /** - * The configuration options of the renderer. - * - * @property options - * @type {} - */ - - /** - * The target width in pixels of the `render.canvas` to be created. - * - * @property options.width - * @type number - * @default 800 - */ - - /** - * The target height in pixels of the `render.canvas` to be created. - * - * @property options.height - * @type number - * @default 600 - */ - - /** - * A flag that specifies if `render.bounds` should be used when rendering. - * - * @property options.hasBounds - * @type boolean - * @default false - */ - - /** - * A `Bounds` object that specifies the drawing view region. - * Rendering will be automatically transformed and scaled to fit within the canvas size (`render.options.width` and `render.options.height`). - * This allows for creating views that can pan or zoom around the scene. - * You must also set `render.options.hasBounds` to `true` to enable bounded rendering. - * - * @property bounds - * @type bounds - */ - - /** - * The 2d rendering context from the `render.canvas` element. - * - * @property context - * @type CanvasRenderingContext2D - */ - - /** - * The sprite texture cache. - * - * @property textures - * @type {} - */ - })(); - - /***/ - }, - /* 11 */ - /***/ function (module, exports, __webpack_require__) { - /** - * The `Matter.Grid` module contains methods for creating and manipulating collision broadphase grid structures. - * - * @class Grid - */ - - var Grid = {}; - - module.exports = Grid; - - var Pair = __webpack_require__(9); - var Detector = __webpack_require__(12); - var Common = __webpack_require__(0); - - (function () { - /** - * Creates a new grid. - * @method create - * @param {} options - * @return {grid} A new grid - */ - Grid.create = function (options) { - var defaults = { - controller: Grid, - detector: Detector.collisions, - buckets: {}, - pairs: {}, - pairsList: [], - bucketWidth: 48, - bucketHeight: 48, - }; - - return Common.extend(defaults, options); - }; - - /** - * The width of a single grid bucket. - * - * @property bucketWidth - * @type number - * @default 48 - */ - - /** - * The height of a single grid bucket. - * - * @property bucketHeight - * @type number - * @default 48 - */ - - /** - * Updates the grid. - * @method update - * @param {grid} grid - * @param {body[]} bodies - * @param {engine} engine - * @param {boolean} forceUpdate - */ - Grid.update = function (grid, bodies, engine, forceUpdate) { - var i, - col, - row, - world = engine.world, - buckets = grid.buckets, - bucket, - bucketId, - gridChanged = false; - - // @if DEBUG - var metrics = engine.metrics; - metrics.broadphaseTests = 0; - // @endif - - for (i = 0; i < bodies.length; i++) { - var body = bodies[i]; - - if (body.isSleeping && !forceUpdate) continue; - - // don't update out of world bodies - if ( - body.bounds.max.x < world.bounds.min.x || - body.bounds.min.x > world.bounds.max.x || - body.bounds.max.y < world.bounds.min.y || - body.bounds.min.y > world.bounds.max.y - ) - continue; - - var newRegion = Grid._getRegion(grid, body); - - // if the body has changed grid region - if (!body.region || newRegion.id !== body.region.id || forceUpdate) { - // @if DEBUG - metrics.broadphaseTests += 1; - // @endif - - if (!body.region || forceUpdate) body.region = newRegion; - - var union = Grid._regionUnion(newRegion, body.region); - - // update grid buckets affected by region change - // iterate over the union of both regions - for (col = union.startCol; col <= union.endCol; col++) { - for (row = union.startRow; row <= union.endRow; row++) { - bucketId = Grid._getBucketId(col, row); - bucket = buckets[bucketId]; - - var isInsideNewRegion = - col >= newRegion.startCol && - col <= newRegion.endCol && - row >= newRegion.startRow && - row <= newRegion.endRow; - - var isInsideOldRegion = - col >= body.region.startCol && - col <= body.region.endCol && - row >= body.region.startRow && - row <= body.region.endRow; - - // remove from old region buckets - if (!isInsideNewRegion && isInsideOldRegion) { - if (isInsideOldRegion) { - if (bucket) Grid._bucketRemoveBody(grid, bucket, body); - } - } - - // add to new region buckets - if (body.region === newRegion || (isInsideNewRegion && !isInsideOldRegion) || forceUpdate) { - if (!bucket) bucket = Grid._createBucket(buckets, bucketId); - Grid._bucketAddBody(grid, bucket, body); - } - } - } - - // set the new region - body.region = newRegion; - - // flag changes so we can update pairs - gridChanged = true; - } - } - - // update pairs list only if pairs changed (i.e. a body changed region) - if (gridChanged) grid.pairsList = Grid._createActivePairsList(grid); - }; - - /** - * Clears the grid. - * @method clear - * @param {grid} grid - */ - Grid.clear = function (grid) { - grid.buckets = {}; - grid.pairs = {}; - grid.pairsList = []; - }; - - /** - * Finds the union of two regions. - * @method _regionUnion - * @private - * @param {} regionA - * @param {} regionB - * @return {} region - */ - Grid._regionUnion = function (regionA, regionB) { - var startCol = Math.min(regionA.startCol, regionB.startCol), - endCol = Math.max(regionA.endCol, regionB.endCol), - startRow = Math.min(regionA.startRow, regionB.startRow), - endRow = Math.max(regionA.endRow, regionB.endRow); - - return Grid._createRegion(startCol, endCol, startRow, endRow); - }; - - /** - * Gets the region a given body falls in for a given grid. - * @method _getRegion - * @private - * @param {} grid - * @param {} body - * @return {} region - */ - Grid._getRegion = function (grid, body) { - var bounds = body.bounds, - startCol = Math.floor(bounds.min.x / grid.bucketWidth), - endCol = Math.floor(bounds.max.x / grid.bucketWidth), - startRow = Math.floor(bounds.min.y / grid.bucketHeight), - endRow = Math.floor(bounds.max.y / grid.bucketHeight); - - return Grid._createRegion(startCol, endCol, startRow, endRow); - }; - - /** - * Creates a region. - * @method _createRegion - * @private - * @param {} startCol - * @param {} endCol - * @param {} startRow - * @param {} endRow - * @return {} region - */ - Grid._createRegion = function (startCol, endCol, startRow, endRow) { - return { - id: startCol + ',' + endCol + ',' + startRow + ',' + endRow, - startCol: startCol, - endCol: endCol, - startRow: startRow, - endRow: endRow, - }; - }; - - /** - * Gets the bucket id at the given position. - * @method _getBucketId - * @private - * @param {} column - * @param {} row - * @return {string} bucket id - */ - Grid._getBucketId = function (column, row) { - return 'C' + column + 'R' + row; - }; - - /** - * Creates a bucket. - * @method _createBucket - * @private - * @param {} buckets - * @param {} bucketId - * @return {} bucket - */ - Grid._createBucket = function (buckets, bucketId) { - var bucket = (buckets[bucketId] = []); - return bucket; - }; - - /** - * Adds a body to a bucket. - * @method _bucketAddBody - * @private - * @param {} grid - * @param {} bucket - * @param {} body - */ - Grid._bucketAddBody = function (grid, bucket, body) { - // add new pairs - for (var i = 0; i < bucket.length; i++) { - var bodyB = bucket[i]; - - if (body.id === bodyB.id || (body.isStatic && bodyB.isStatic)) continue; - - // keep track of the number of buckets the pair exists in - // important for Grid.update to work - var pairId = Pair.id(body, bodyB), - pair = grid.pairs[pairId]; - - if (pair) { - pair[2] += 1; - } else { - grid.pairs[pairId] = [body, bodyB, 1]; - } - } - - // add to bodies (after pairs, otherwise pairs with self) - bucket.push(body); - }; - - /** - * Removes a body from a bucket. - * @method _bucketRemoveBody - * @private - * @param {} grid - * @param {} bucket - * @param {} body - */ - Grid._bucketRemoveBody = function (grid, bucket, body) { - // remove from bucket - bucket.splice(Common.indexOf(bucket, body), 1); - - // update pair counts - for (var i = 0; i < bucket.length; i++) { - // keep track of the number of buckets the pair exists in - // important for _createActivePairsList to work - var bodyB = bucket[i], - pairId = Pair.id(body, bodyB), - pair = grid.pairs[pairId]; - - if (pair) pair[2] -= 1; - } - }; - - /** - * Generates a list of the active pairs in the grid. - * @method _createActivePairsList - * @private - * @param {} grid - * @return [] pairs - */ - Grid._createActivePairsList = function (grid) { - var pairKeys, - pair, - pairs = []; - - // grid.pairs is used as a hashmap - pairKeys = Common.keys(grid.pairs); - - // iterate over grid.pairs - for (var k = 0; k < pairKeys.length; k++) { - pair = grid.pairs[pairKeys[k]]; - - // if pair exists in at least one bucket - // it is a pair that needs further collision testing so push it - if (pair[2] > 0) { - pairs.push(pair); - } else { - delete grid.pairs[pairKeys[k]]; - } - } - - return pairs; - }; - })(); - - /***/ - }, - /* 12 */ - /***/ function (module, exports, __webpack_require__) { - /** - * The `Matter.Detector` module contains methods for detecting collisions given a set of pairs. - * - * @class Detector - */ - - // TODO: speculative contacts - - var Detector = {}; - - module.exports = Detector; - - var SAT = __webpack_require__(13); - var Pair = __webpack_require__(9); - var Bounds = __webpack_require__(1); - - (function () { - /** - * Finds all collisions given a list of pairs. - * @method collisions - * @param {pair[]} broadphasePairs - * @param {engine} engine - * @return {array} collisions - */ - Detector.collisions = function (broadphasePairs, engine) { - var collisions = [], - pairsTable = engine.pairs.table; - - // @if DEBUG - var metrics = engine.metrics; - // @endif - - for (var i = 0; i < broadphasePairs.length; i++) { - var bodyA = broadphasePairs[i][0], - bodyB = broadphasePairs[i][1]; - - if ((bodyA.isStatic || bodyA.isSleeping) && (bodyB.isStatic || bodyB.isSleeping)) continue; - - if (!Detector.canCollide(bodyA.collisionFilter, bodyB.collisionFilter)) continue; - - // @if DEBUG - metrics.midphaseTests += 1; - // @endif - - // mid phase - if (Bounds.overlaps(bodyA.bounds, bodyB.bounds)) { - for (var j = bodyA.parts.length > 1 ? 1 : 0; j < bodyA.parts.length; j++) { - var partA = bodyA.parts[j]; - - for (var k = bodyB.parts.length > 1 ? 1 : 0; k < bodyB.parts.length; k++) { - var partB = bodyB.parts[k]; - - if ((partA === bodyA && partB === bodyB) || Bounds.overlaps(partA.bounds, partB.bounds)) { - // find a previous collision we could reuse - var pairId = Pair.id(partA, partB), - pair = pairsTable[pairId], - previousCollision; - - if (pair && pair.isActive) { - previousCollision = pair.collision; - } else { - previousCollision = null; - } - - // narrow phase - var collision = SAT.collides(partA, partB, previousCollision); - - // @if DEBUG - metrics.narrowphaseTests += 1; - if (collision.reused) metrics.narrowReuseCount += 1; - // @endif - - if (collision.collided) { - collisions.push(collision); - // @if DEBUG - metrics.narrowDetections += 1; - // @endif - } - } - } - } - } - } - - return collisions; - }; - - /** - * Returns `true` if both supplied collision filters will allow a collision to occur. - * See `body.collisionFilter` for more information. - * @method canCollide - * @param {} filterA - * @param {} filterB - * @return {bool} `true` if collision can occur - */ - Detector.canCollide = function (filterA, filterB) { - if (filterA.group === filterB.group && filterA.group !== 0) return filterA.group > 0; - - return (filterA.mask & filterB.category) !== 0 && (filterB.mask & filterA.category) !== 0; - }; - })(); - - /***/ - }, - /* 13 */ - /***/ function (module, exports, __webpack_require__) { - /** - * The `Matter.SAT` module contains methods for detecting collisions using the Separating Axis Theorem. - * - * @class SAT - */ - - // TODO: true circles and curves - - var SAT = {}; - - module.exports = SAT; - - var Vertices = __webpack_require__(3); - var Vector = __webpack_require__(2); - - (function () { - /** - * Detect collision between two bodies using the Separating Axis Theorem. - * @method collides - * @param {body} bodyA - * @param {body} bodyB - * @param {collision} previousCollision - * @return {collision} collision - */ - SAT.collides = function (bodyA, bodyB, previousCollision) { - var overlapAB, - overlapBA, - minOverlap, - collision, - canReusePrevCol = false; - - if (previousCollision) { - // estimate total motion - var parentA = bodyA.parent, - parentB = bodyB.parent, - motion = - parentA.speed * parentA.speed + - parentA.angularSpeed * parentA.angularSpeed + - parentB.speed * parentB.speed + - parentB.angularSpeed * parentB.angularSpeed; - - // we may be able to (partially) reuse collision result - // but only safe if collision was resting - canReusePrevCol = previousCollision && previousCollision.collided && motion < 0.2; - - // reuse collision object - collision = previousCollision; - } else { - collision = {collided: false, bodyA: bodyA, bodyB: bodyB}; - } - - if (previousCollision && canReusePrevCol) { - // if we can reuse the collision result - // we only need to test the previously found axis - var axisBodyA = collision.axisBody, - axisBodyB = axisBodyA === bodyA ? bodyB : bodyA, - axes = [axisBodyA.axes[previousCollision.axisNumber]]; - - minOverlap = SAT._overlapAxes(axisBodyA.vertices, axisBodyB.vertices, axes); - collision.reused = true; - - if (minOverlap.overlap <= 0) { - collision.collided = false; - return collision; - } - } else { - // if we can't reuse a result, perform a full SAT test - - overlapAB = SAT._overlapAxes(bodyA.vertices, bodyB.vertices, bodyA.axes); - - if (overlapAB.overlap <= 0) { - collision.collided = false; - return collision; - } - - overlapBA = SAT._overlapAxes(bodyB.vertices, bodyA.vertices, bodyB.axes); - - if (overlapBA.overlap <= 0) { - collision.collided = false; - return collision; - } - - if (overlapAB.overlap < overlapBA.overlap) { - minOverlap = overlapAB; - collision.axisBody = bodyA; - } else { - minOverlap = overlapBA; - collision.axisBody = bodyB; - } - - // important for reuse later - collision.axisNumber = minOverlap.axisNumber; - } - - collision.bodyA = bodyA.id < bodyB.id ? bodyA : bodyB; - collision.bodyB = bodyA.id < bodyB.id ? bodyB : bodyA; - collision.collided = true; - collision.depth = minOverlap.overlap; - collision.parentA = collision.bodyA.parent; - collision.parentB = collision.bodyB.parent; - - bodyA = collision.bodyA; - bodyB = collision.bodyB; - - // ensure normal is facing away from bodyA - if (Vector.dot(minOverlap.axis, Vector.sub(bodyB.position, bodyA.position)) < 0) { - collision.normal = { - x: minOverlap.axis.x, - y: minOverlap.axis.y, - }; - } else { - collision.normal = { - x: -minOverlap.axis.x, - y: -minOverlap.axis.y, - }; - } - - collision.tangent = Vector.perp(collision.normal); - - collision.penetration = collision.penetration || {}; - collision.penetration.x = collision.normal.x * collision.depth; - collision.penetration.y = collision.normal.y * collision.depth; - - // find support points, there is always either exactly one or two - var verticesB = SAT._findSupports(bodyA, bodyB, collision.normal), - supports = []; - - // find the supports from bodyB that are inside bodyA - if (Vertices.contains(bodyA.vertices, verticesB[0])) supports.push(verticesB[0]); - - if (Vertices.contains(bodyA.vertices, verticesB[1])) supports.push(verticesB[1]); - - // find the supports from bodyA that are inside bodyB - if (supports.length < 2) { - var verticesA = SAT._findSupports(bodyB, bodyA, Vector.neg(collision.normal)); - - if (Vertices.contains(bodyB.vertices, verticesA[0])) supports.push(verticesA[0]); - - if (supports.length < 2 && Vertices.contains(bodyB.vertices, verticesA[1])) supports.push(verticesA[1]); - } - - // account for the edge case of overlapping but no vertex containment - if (supports.length < 1) supports = [verticesB[0]]; - - collision.supports = supports; - - return collision; - }; - - /** - * Find the overlap between two sets of vertices. - * @method _overlapAxes - * @private - * @param {} verticesA - * @param {} verticesB - * @param {} axes - * @return result - */ - SAT._overlapAxes = function (verticesA, verticesB, axes) { - var projectionA = Vector._temp[0], - projectionB = Vector._temp[1], - result = {overlap: Number.MAX_VALUE}, - overlap, - axis; - - for (var i = 0; i < axes.length; i++) { - axis = axes[i]; - - SAT._projectToAxis(projectionA, verticesA, axis); - SAT._projectToAxis(projectionB, verticesB, axis); - - overlap = Math.min(projectionA.max - projectionB.min, projectionB.max - projectionA.min); - - if (overlap <= 0) { - result.overlap = overlap; - return result; - } - - if (overlap < result.overlap) { - result.overlap = overlap; - result.axis = axis; - result.axisNumber = i; - } - } - - return result; - }; - - /** - * Projects vertices on an axis and returns an interval. - * @method _projectToAxis - * @private - * @param {} projection - * @param {} vertices - * @param {} axis - */ - SAT._projectToAxis = function (projection, vertices, axis) { - var min = Vector.dot(vertices[0], axis), - max = min; - - for (var i = 1; i < vertices.length; i += 1) { - var dot = Vector.dot(vertices[i], axis); - - if (dot > max) { - max = dot; - } else if (dot < min) { - min = dot; - } - } - - projection.min = min; - projection.max = max; - }; - - /** - * Finds supporting vertices given two bodies along a given direction using hill-climbing. - * @method _findSupports - * @private - * @param {} bodyA - * @param {} bodyB - * @param {} normal - * @return [vector] - */ - SAT._findSupports = function (bodyA, bodyB, normal) { - var nearestDistance = Number.MAX_VALUE, - vertexToBody = Vector._temp[0], - vertices = bodyB.vertices, - bodyAPosition = bodyA.position, - distance, - vertex, - vertexA, - vertexB; - - // find closest vertex on bodyB - for (var i = 0; i < vertices.length; i++) { - vertex = vertices[i]; - vertexToBody.x = vertex.x - bodyAPosition.x; - vertexToBody.y = vertex.y - bodyAPosition.y; - distance = -Vector.dot(normal, vertexToBody); - - if (distance < nearestDistance) { - nearestDistance = distance; - vertexA = vertex; - } - } - - // find next closest vertex using the two connected to it - var prevIndex = vertexA.index - 1 >= 0 ? vertexA.index - 1 : vertices.length - 1; - vertex = vertices[prevIndex]; - vertexToBody.x = vertex.x - bodyAPosition.x; - vertexToBody.y = vertex.y - bodyAPosition.y; - nearestDistance = -Vector.dot(normal, vertexToBody); - vertexB = vertex; - - var nextIndex = (vertexA.index + 1) % vertices.length; - vertex = vertices[nextIndex]; - vertexToBody.x = vertex.x - bodyAPosition.x; - vertexToBody.y = vertex.y - bodyAPosition.y; - distance = -Vector.dot(normal, vertexToBody); - if (distance < nearestDistance) { - vertexB = vertex; - } - - return [vertexA, vertexB]; - }; - })(); - - /***/ - }, - /* 14 */ - /***/ function (module, exports, __webpack_require__) { - /** - * The `Matter.Mouse` module contains methods for creating and manipulating mouse inputs. - * - * @class Mouse - */ - - var Mouse = {}; - - module.exports = Mouse; - - var Common = __webpack_require__(0); - - (function () { - /** - * Creates a mouse input. - * @method create - * @param {HTMLElement} element - * @return {mouse} A new mouse - */ - Mouse.create = function (element) { - var mouse = {}; - - if (!element) { - Common.log('Mouse.create: element was undefined, defaulting to document.body', 'warn'); - } - - mouse.element = element || document.body; - mouse.absolute = {x: 0, y: 0}; - mouse.position = {x: 0, y: 0}; - mouse.mousedownPosition = {x: 0, y: 0}; - mouse.mouseupPosition = {x: 0, y: 0}; - mouse.offset = {x: 0, y: 0}; - mouse.scale = {x: 1, y: 1}; - mouse.wheelDelta = 0; - mouse.button = -1; - mouse.pixelRatio = parseInt(mouse.element.getAttribute('data-pixel-ratio'), 10) || 1; - - mouse.sourceEvents = { - mousemove: null, - mousedown: null, - mouseup: null, - mousewheel: null, - }; - - mouse.mousemove = function (event) { - var position = Mouse._getRelativeMousePosition(event, mouse.element, mouse.pixelRatio), - touches = event.changedTouches; - - if (touches) { - mouse.button = 0; - event.preventDefault(); - } - - mouse.absolute.x = position.x; - mouse.absolute.y = position.y; - mouse.position.x = mouse.absolute.x * mouse.scale.x + mouse.offset.x; - mouse.position.y = mouse.absolute.y * mouse.scale.y + mouse.offset.y; - mouse.sourceEvents.mousemove = event; - }; - - mouse.mousedown = function (event) { - var position = Mouse._getRelativeMousePosition(event, mouse.element, mouse.pixelRatio), - touches = event.changedTouches; - - if (touches) { - mouse.button = 0; - event.preventDefault(); - } else { - mouse.button = event.button; - } - - mouse.absolute.x = position.x; - mouse.absolute.y = position.y; - mouse.position.x = mouse.absolute.x * mouse.scale.x + mouse.offset.x; - mouse.position.y = mouse.absolute.y * mouse.scale.y + mouse.offset.y; - mouse.mousedownPosition.x = mouse.position.x; - mouse.mousedownPosition.y = mouse.position.y; - mouse.sourceEvents.mousedown = event; - }; - - mouse.mouseup = function (event) { - var position = Mouse._getRelativeMousePosition(event, mouse.element, mouse.pixelRatio), - touches = event.changedTouches; - - if (touches) { - event.preventDefault(); - } - - mouse.button = -1; - mouse.absolute.x = position.x; - mouse.absolute.y = position.y; - mouse.position.x = mouse.absolute.x * mouse.scale.x + mouse.offset.x; - mouse.position.y = mouse.absolute.y * mouse.scale.y + mouse.offset.y; - mouse.mouseupPosition.x = mouse.position.x; - mouse.mouseupPosition.y = mouse.position.y; - mouse.sourceEvents.mouseup = event; - }; - - mouse.mousewheel = function (event) { - mouse.wheelDelta = Math.max(-1, Math.min(1, event.wheelDelta || -event.detail)); - event.preventDefault(); - }; - - Mouse.setElement(mouse, mouse.element); - - return mouse; - }; - - /** - * Sets the element the mouse is bound to (and relative to). - * @method setElement - * @param {mouse} mouse - * @param {HTMLElement} element - */ - Mouse.setElement = function (mouse, element) { - mouse.element = element; - - element.addEventListener('mousemove', mouse.mousemove); - element.addEventListener('mousedown', mouse.mousedown); - element.addEventListener('mouseup', mouse.mouseup); - - element.addEventListener('mousewheel', mouse.mousewheel); - element.addEventListener('DOMMouseScroll', mouse.mousewheel); - - element.addEventListener('touchmove', mouse.mousemove); - element.addEventListener('touchstart', mouse.mousedown); - element.addEventListener('touchend', mouse.mouseup); - }; - - /** - * Clears all captured source events. - * @method clearSourceEvents - * @param {mouse} mouse - */ - Mouse.clearSourceEvents = function (mouse) { - mouse.sourceEvents.mousemove = null; - mouse.sourceEvents.mousedown = null; - mouse.sourceEvents.mouseup = null; - mouse.sourceEvents.mousewheel = null; - mouse.wheelDelta = 0; - }; - - /** - * Sets the mouse position offset. - * @method setOffset - * @param {mouse} mouse - * @param {vector} offset - */ - Mouse.setOffset = function (mouse, offset) { - mouse.offset.x = offset.x; - mouse.offset.y = offset.y; - mouse.position.x = mouse.absolute.x * mouse.scale.x + mouse.offset.x; - mouse.position.y = mouse.absolute.y * mouse.scale.y + mouse.offset.y; - }; - - /** - * Sets the mouse position scale. - * @method setScale - * @param {mouse} mouse - * @param {vector} scale - */ - Mouse.setScale = function (mouse, scale) { - mouse.scale.x = scale.x; - mouse.scale.y = scale.y; - mouse.position.x = mouse.absolute.x * mouse.scale.x + mouse.offset.x; - mouse.position.y = mouse.absolute.y * mouse.scale.y + mouse.offset.y; - }; - - /** - * Gets the mouse position relative to an element given a screen pixel ratio. - * @method _getRelativeMousePosition - * @private - * @param {} event - * @param {} element - * @param {number} pixelRatio - * @return {} - */ - Mouse._getRelativeMousePosition = function (event, element, pixelRatio) { - var elementBounds = element.getBoundingClientRect(), - rootNode = document.documentElement || document.body.parentNode || document.body, - scrollX = window.pageXOffset !== undefined ? window.pageXOffset : rootNode.scrollLeft, - scrollY = window.pageYOffset !== undefined ? window.pageYOffset : rootNode.scrollTop, - touches = event.changedTouches, - x, - y; - - if (touches) { - x = touches[0].pageX - elementBounds.left - scrollX; - y = touches[0].pageY - elementBounds.top - scrollY; - } else { - x = event.pageX - elementBounds.left - scrollX; - y = event.pageY - elementBounds.top - scrollY; - } - - return { - x: x / ((element.clientWidth / (element.width || element.clientWidth)) * pixelRatio), - y: y / ((element.clientHeight / (element.height || element.clientHeight)) * pixelRatio), - }; - }; - })(); - - /***/ - }, - /* 15 */ - /***/ function (module, exports, __webpack_require__) { - /** - * The `Matter.Axes` module contains methods for creating and manipulating sets of axes. - * - * @class Axes - */ - - var Axes = {}; - - module.exports = Axes; - - var Vector = __webpack_require__(2); - var Common = __webpack_require__(0); - - (function () { - /** - * Creates a new set of axes from the given vertices. - * @method fromVertices - * @param {vertices} vertices - * @return {axes} A new axes from the given vertices - */ - Axes.fromVertices = function (vertices) { - var axes = {}; - - // find the unique axes, using edge normal gradients - for (var i = 0; i < vertices.length; i++) { - var j = (i + 1) % vertices.length, - normal = Vector.normalise({ - x: vertices[j].y - vertices[i].y, - y: vertices[i].x - vertices[j].x, - }), - gradient = normal.y === 0 ? Infinity : normal.x / normal.y; - - // limit precision - gradient = gradient.toFixed(3).toString(); - axes[gradient] = normal; - } - - return Common.values(axes); - }; - - /** - * Rotates a set of axes by the given angle. - * @method rotate - * @param {axes} axes - * @param {number} angle - */ - Axes.rotate = function (axes, angle) { - if (angle === 0) return; - - var cos = Math.cos(angle), - sin = Math.sin(angle); - - for (var i = 0; i < axes.length; i++) { - var axis = axes[i], - xx; - xx = axis.x * cos - axis.y * sin; - axis.y = axis.x * sin + axis.y * cos; - axis.x = xx; - } - }; - })(); - - /***/ - }, - /* 16 */ - /***/ function (module, exports, __webpack_require__) { - /** - * The `Matter.Bodies` module contains factory methods for creating rigid body models - * with commonly used body configurations (such as rectangles, circles and other polygons). - * - * See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples). - * - * @class Bodies - */ - - // TODO: true circle bodies - - var Bodies = {}; - - module.exports = Bodies; - - var Vertices = __webpack_require__(3); - var Common = __webpack_require__(0); - var Body = __webpack_require__(6); - var Bounds = __webpack_require__(1); - var Vector = __webpack_require__(2); - - (function () { - /** - * Creates a new rigid body model with a rectangle hull. - * The options parameter is an object that specifies any properties you wish to override the defaults. - * See the properties section of the `Matter.Body` module for detailed information on what you can pass via the `options` object. - * @method rectangle - * @param {number} x - * @param {number} y - * @param {number} width - * @param {number} height - * @param {object} [options] - * @return {body} A new rectangle body - */ - Bodies.rectangle = function (x, y, width, height, options) { - options = options || {}; - - var rectangle = { - label: 'Rectangle Body', - position: {x: x, y: y}, - vertices: Vertices.fromPath('L 0 0 L ' + width + ' 0 L ' + width + ' ' + height + ' L 0 ' + height), - }; - - if (options.chamfer) { - var chamfer = options.chamfer; - rectangle.vertices = Vertices.chamfer( - rectangle.vertices, - chamfer.radius, - chamfer.quality, - chamfer.qualityMin, - chamfer.qualityMax, - ); - delete options.chamfer; - } - - return Body.create(Common.extend({}, rectangle, options)); - }; - - /** - * Creates a new rigid body model with a trapezoid hull. - * The options parameter is an object that specifies any properties you wish to override the defaults. - * See the properties section of the `Matter.Body` module for detailed information on what you can pass via the `options` object. - * @method trapezoid - * @param {number} x - * @param {number} y - * @param {number} width - * @param {number} height - * @param {number} slope - * @param {object} [options] - * @return {body} A new trapezoid body - */ - Bodies.trapezoid = function (x, y, width, height, slope, options) { - options = options || {}; - - slope *= 0.5; - var roof = (1 - slope * 2) * width; - - var x1 = width * slope, - x2 = x1 + roof, - x3 = x2 + x1, - verticesPath; - - if (slope < 0.5) { - verticesPath = 'L 0 0 L ' + x1 + ' ' + -height + ' L ' + x2 + ' ' + -height + ' L ' + x3 + ' 0'; - } else { - verticesPath = 'L 0 0 L ' + x2 + ' ' + -height + ' L ' + x3 + ' 0'; - } - - var trapezoid = { - label: 'Trapezoid Body', - position: {x: x, y: y}, - vertices: Vertices.fromPath(verticesPath), - }; - - if (options.chamfer) { - var chamfer = options.chamfer; - trapezoid.vertices = Vertices.chamfer( - trapezoid.vertices, - chamfer.radius, - chamfer.quality, - chamfer.qualityMin, - chamfer.qualityMax, - ); - delete options.chamfer; - } - - return Body.create(Common.extend({}, trapezoid, options)); - }; - - /** - * Creates a new rigid body model with a circle hull. - * The options parameter is an object that specifies any properties you wish to override the defaults. - * See the properties section of the `Matter.Body` module for detailed information on what you can pass via the `options` object. - * @method circle - * @param {number} x - * @param {number} y - * @param {number} radius - * @param {object} [options] - * @param {number} [maxSides] - * @return {body} A new circle body - */ - Bodies.circle = function (x, y, radius, options, maxSides) { - options = options || {}; - - var circle = { - label: 'Circle Body', - circleRadius: radius, - }; - - // approximate circles with polygons until true circles implemented in SAT - maxSides = maxSides || 25; - var sides = Math.ceil(Math.max(10, Math.min(maxSides, radius))); - - // optimisation: always use even number of sides (half the number of unique axes) - if (sides % 2 === 1) sides += 1; - - return Bodies.polygon(x, y, sides, radius, Common.extend({}, circle, options)); - }; - - /** - * Creates a new rigid body model with a regular polygon hull with the given number of sides. - * The options parameter is an object that specifies any properties you wish to override the defaults. - * See the properties section of the `Matter.Body` module for detailed information on what you can pass via the `options` object. - * @method polygon - * @param {number} x - * @param {number} y - * @param {number} sides - * @param {number} radius - * @param {object} [options] - * @return {body} A new regular polygon body - */ - Bodies.polygon = function (x, y, sides, radius, options) { - options = options || {}; - - if (sides < 3) return Bodies.circle(x, y, radius, options); - - var theta = (2 * Math.PI) / sides, - path = '', - offset = theta * 0.5; - - for (var i = 0; i < sides; i += 1) { - var angle = offset + i * theta, - xx = Math.cos(angle) * radius, - yy = Math.sin(angle) * radius; - - path += 'L ' + xx.toFixed(3) + ' ' + yy.toFixed(3) + ' '; - } - - var polygon = { - label: 'Polygon Body', - position: {x: x, y: y}, - vertices: Vertices.fromPath(path), - }; - - if (options.chamfer) { - var chamfer = options.chamfer; - polygon.vertices = Vertices.chamfer( - polygon.vertices, - chamfer.radius, - chamfer.quality, - chamfer.qualityMin, - chamfer.qualityMax, - ); - delete options.chamfer; - } - - return Body.create(Common.extend({}, polygon, options)); - }; - - /** - * Creates a body using the supplied vertices (or an array containing multiple sets of vertices). - * If the vertices are convex, they will pass through as supplied. - * Otherwise if the vertices are concave, they will be decomposed if [poly-decomp.js](https://github.com/schteppe/poly-decomp.js) is available. - * Note that this process is not guaranteed to support complex sets of vertices (e.g. those with holes may fail). - * By default the decomposition will discard collinear edges (to improve performance). - * It can also optionally discard any parts that have an area less than `minimumArea`. - * If the vertices can not be decomposed, the result will fall back to using the convex hull. - * The options parameter is an object that specifies any `Matter.Body` properties you wish to override the defaults. - * See the properties section of the `Matter.Body` module for detailed information on what you can pass via the `options` object. - * @method fromVertices - * @param {number} x - * @param {number} y - * @param [[vector]] vertexSets - * @param {object} [options] - * @param {bool} [flagInternal=false] - * @param {number} [removeCollinear=0.01] - * @param {number} [minimumArea=10] - * @return {body} - */ - Bodies.fromVertices = function (x, y, vertexSets, options, flagInternal, removeCollinear, minimumArea) { - var globals = typeof global !== 'undefined' ? global : window, - decomp, - body, - parts, - isConvex, - vertices, - i, - j, - k, - v, - z; - - try { - decomp = globals.decomp || __webpack_require__(27); - } catch (e) { - // decomp is undefined - } - - options = options || {}; - parts = []; - - flagInternal = typeof flagInternal !== 'undefined' ? flagInternal : false; - removeCollinear = typeof removeCollinear !== 'undefined' ? removeCollinear : 0.01; - minimumArea = typeof minimumArea !== 'undefined' ? minimumArea : 10; - - if (!decomp) { - Common.warn( - 'Bodies.fromVertices: poly-decomp.js required. Could not decompose vertices. Fallback to convex hull.', - ); - } - - // ensure vertexSets is an array of arrays - if (!Common.isArray(vertexSets[0])) { - vertexSets = [vertexSets]; - } - - for (v = 0; v < vertexSets.length; v += 1) { - vertices = vertexSets[v]; - isConvex = Vertices.isConvex(vertices); - - if (isConvex || !decomp) { - if (isConvex) { - vertices = Vertices.clockwiseSort(vertices); - } else { - // fallback to convex hull when decomposition is not possible - vertices = Vertices.hull(vertices); - } - - parts.push({ - position: {x: x, y: y}, - vertices: vertices, - }); - } else { - // initialise a decomposition - var concave = vertices.map(function (vertex) { - return [vertex.x, vertex.y]; - }); - - // vertices are concave and simple, we can decompose into parts - decomp.makeCCW(concave); - if (removeCollinear !== false) decomp.removeCollinearPoints(concave, removeCollinear); - - // use the quick decomposition algorithm (Bayazit) - var decomposed = decomp.quickDecomp(concave); - - // for each decomposed chunk - for (i = 0; i < decomposed.length; i++) { - var chunk = decomposed[i]; - - // convert vertices into the correct structure - var chunkVertices = chunk.map(function (vertices) { - return { - x: vertices[0], - y: vertices[1], - }; - }); - - // skip small chunks - if (minimumArea > 0 && Vertices.area(chunkVertices) < minimumArea) continue; - - // create a compound part - parts.push({ - position: Vertices.centre(chunkVertices), - vertices: chunkVertices, - }); - } - } - } - - // create body parts - for (i = 0; i < parts.length; i++) { - parts[i] = Body.create(Common.extend(parts[i], options)); - } - - // flag internal edges (coincident part edges) - if (flagInternal) { - var coincident_max_dist = 5; - - for (i = 0; i < parts.length; i++) { - var partA = parts[i]; - - for (j = i + 1; j < parts.length; j++) { - var partB = parts[j]; - - if (Bounds.overlaps(partA.bounds, partB.bounds)) { - var pav = partA.vertices, - pbv = partB.vertices; - - // iterate vertices of both parts - for (k = 0; k < partA.vertices.length; k++) { - for (z = 0; z < partB.vertices.length; z++) { - // find distances between the vertices - var da = Vector.magnitudeSquared(Vector.sub(pav[(k + 1) % pav.length], pbv[z])), - db = Vector.magnitudeSquared(Vector.sub(pav[k], pbv[(z + 1) % pbv.length])); - - // if both vertices are very close, consider the edge concident (internal) - if (da < coincident_max_dist && db < coincident_max_dist) { - pav[k].isInternal = true; - pbv[z].isInternal = true; - } - } - } - } - } - } - } - - if (parts.length > 1) { - // create the parent body to be returned, that contains generated compound parts - body = Body.create(Common.extend({parts: parts.slice(0)}, options)); - Body.setPosition(body, {x: x, y: y}); - - return body; - } else { - return parts[0]; - } - }; - })(); - - /***/ - }, - /* 17 */ - /***/ function (module, exports, __webpack_require__) { - /** - * The `Matter.Plugin` module contains functions for registering and installing plugins on modules. - * - * @class Plugin - */ - - var Plugin = {}; - - module.exports = Plugin; - - var Common = __webpack_require__(0); - - (function () { - Plugin._registry = {}; - - /** - * Registers a plugin object so it can be resolved later by name. - * @method register - * @param plugin {} The plugin to register. - * @return {object} The plugin. - */ - Plugin.register = function (plugin) { - if (!Plugin.isPlugin(plugin)) { - Common.warn('Plugin.register:', Plugin.toString(plugin), 'does not implement all required fields.'); - } - - if (plugin.name in Plugin._registry) { - var registered = Plugin._registry[plugin.name], - pluginVersion = Plugin.versionParse(plugin.version).number, - registeredVersion = Plugin.versionParse(registered.version).number; - - if (pluginVersion > registeredVersion) { - Common.warn( - 'Plugin.register:', - Plugin.toString(registered), - 'was upgraded to', - Plugin.toString(plugin), - ); - Plugin._registry[plugin.name] = plugin; - } else if (pluginVersion < registeredVersion) { - Common.warn( - 'Plugin.register:', - Plugin.toString(registered), - 'can not be downgraded to', - Plugin.toString(plugin), - ); - } else if (plugin !== registered) { - Common.warn( - 'Plugin.register:', - Plugin.toString(plugin), - 'is already registered to different plugin object', - ); - } - } else { - Plugin._registry[plugin.name] = plugin; - } - - return plugin; - }; - - /** - * Resolves a dependency to a plugin object from the registry if it exists. - * The `dependency` may contain a version, but only the name matters when resolving. - * @method resolve - * @param dependency {string} The dependency. - * @return {object} The plugin if resolved, otherwise `undefined`. - */ - Plugin.resolve = function (dependency) { - return Plugin._registry[Plugin.dependencyParse(dependency).name]; - }; - - /** - * Returns a pretty printed plugin name and version. - * @method toString - * @param plugin {} The plugin. - * @return {string} Pretty printed plugin name and version. - */ - Plugin.toString = function (plugin) { - return typeof plugin === 'string' - ? plugin - : (plugin.name || 'anonymous') + '@' + (plugin.version || plugin.range || '0.0.0'); - }; - - /** - * Returns `true` if the object meets the minimum standard to be considered a plugin. - * This means it must define the following properties: - * - `name` - * - `version` - * - `install` - * @method isPlugin - * @param obj {} The obj to test. - * @return {boolean} `true` if the object can be considered a plugin otherwise `false`. - */ - Plugin.isPlugin = function (obj) { - return obj && obj.name && obj.version && obj.install; - }; - - /** - * Returns `true` if a plugin with the given `name` been installed on `module`. - * @method isUsed - * @param module {} The module. - * @param name {string} The plugin name. - * @return {boolean} `true` if a plugin with the given `name` been installed on `module`, otherwise `false`. - */ - Plugin.isUsed = function (module, name) { - return module.used.indexOf(name) > -1; - }; - - /** - * Returns `true` if `plugin.for` is applicable to `module` by comparing against `module.name` and `module.version`. - * If `plugin.for` is not specified then it is assumed to be applicable. - * The value of `plugin.for` is a string of the format `'module-name'` or `'module-name@version'`. - * @method isFor - * @param plugin {} The plugin. - * @param module {} The module. - * @return {boolean} `true` if `plugin.for` is applicable to `module`, otherwise `false`. - */ - Plugin.isFor = function (plugin, module) { - var parsed = plugin.for && Plugin.dependencyParse(plugin.for); - return ( - !plugin.for || (module.name === parsed.name && Plugin.versionSatisfies(module.version, parsed.range)) - ); - }; - - /** - * Installs the plugins by calling `plugin.install` on each plugin specified in `plugins` if passed, otherwise `module.uses`. - * For installing plugins on `Matter` see the convenience function `Matter.use`. - * Plugins may be specified either by their name or a reference to the plugin object. - * Plugins themselves may specify further dependencies, but each plugin is installed only once. - * Order is important, a topological sort is performed to find the best resulting order of installation. - * This sorting attempts to satisfy every dependency's requested ordering, but may not be exact in all cases. - * This function logs the resulting status of each dependency in the console, along with any warnings. - * - A green tick ✅ indicates a dependency was resolved and installed. - * - An orange diamond 🔶 indicates a dependency was resolved but a warning was thrown for it or one if its dependencies. - * - A red cross ❌ indicates a dependency could not be resolved. - * Avoid calling this function multiple times on the same module unless you intend to manually control installation order. - * @method use - * @param module {} The module install plugins on. - * @param [plugins=module.uses] {} The plugins to install on module (optional, defaults to `module.uses`). - */ - Plugin.use = function (module, plugins) { - module.uses = (module.uses || []).concat(plugins || []); - - if (module.uses.length === 0) { - Common.warn('Plugin.use:', Plugin.toString(module), 'does not specify any dependencies to install.'); - return; - } - - var dependencies = Plugin.dependencies(module), - sortedDependencies = Common.topologicalSort(dependencies), - status = []; - - for (var i = 0; i < sortedDependencies.length; i += 1) { - if (sortedDependencies[i] === module.name) { - continue; - } - - var plugin = Plugin.resolve(sortedDependencies[i]); - - if (!plugin) { - status.push('❌ ' + sortedDependencies[i]); - continue; - } - - if (Plugin.isUsed(module, plugin.name)) { - continue; - } - - if (!Plugin.isFor(plugin, module)) { - Common.warn( - 'Plugin.use:', - Plugin.toString(plugin), - 'is for', - plugin.for, - 'but installed on', - Plugin.toString(module) + '.', - ); - plugin._warned = true; - } - - if (plugin.install) { - plugin.install(module); - } else { - Common.warn('Plugin.use:', Plugin.toString(plugin), 'does not specify an install function.'); - plugin._warned = true; - } - - if (plugin._warned) { - status.push('🔶 ' + Plugin.toString(plugin)); - delete plugin._warned; - } else { - status.push('✅ ' + Plugin.toString(plugin)); - } - - module.used.push(plugin.name); - } - - if (status.length > 0) { - Common.info(status.join(' ')); - } - }; - - /** - * Recursively finds all of a module's dependencies and returns a flat dependency graph. - * @method dependencies - * @param module {} The module. - * @return {object} A dependency graph. - */ - Plugin.dependencies = function (module, tracked) { - var parsedBase = Plugin.dependencyParse(module), - name = parsedBase.name; - - tracked = tracked || {}; - - if (name in tracked) { - return; - } - - module = Plugin.resolve(module) || module; - - tracked[name] = Common.map(module.uses || [], function (dependency) { - if (Plugin.isPlugin(dependency)) { - Plugin.register(dependency); - } - - var parsed = Plugin.dependencyParse(dependency), - resolved = Plugin.resolve(dependency); - - if (resolved && !Plugin.versionSatisfies(resolved.version, parsed.range)) { - Common.warn( - 'Plugin.dependencies:', - Plugin.toString(resolved), - 'does not satisfy', - Plugin.toString(parsed), - 'used by', - Plugin.toString(parsedBase) + '.', - ); - - resolved._warned = true; - module._warned = true; - } else if (!resolved) { - Common.warn( - 'Plugin.dependencies:', - Plugin.toString(dependency), - 'used by', - Plugin.toString(parsedBase), - 'could not be resolved.', - ); - - module._warned = true; - } - - return parsed.name; - }); - - for (var i = 0; i < tracked[name].length; i += 1) { - Plugin.dependencies(tracked[name][i], tracked); - } - - return tracked; - }; - - /** - * Parses a dependency string into its components. - * The `dependency` is a string of the format `'module-name'` or `'module-name@version'`. - * See documentation for `Plugin.versionParse` for a description of the format. - * This function can also handle dependencies that are already resolved (e.g. a module object). - * @method dependencyParse - * @param dependency {string} The dependency of the format `'module-name'` or `'module-name@version'`. - * @return {object} The dependency parsed into its components. - */ - Plugin.dependencyParse = function (dependency) { - if (Common.isString(dependency)) { - var pattern = /^[\w-]+(@(\*|[\^~]?\d+\.\d+\.\d+(-[0-9A-Za-z-]+)?))?$/; - - if (!pattern.test(dependency)) { - Common.warn('Plugin.dependencyParse:', dependency, 'is not a valid dependency string.'); - } - - return { - name: dependency.split('@')[0], - range: dependency.split('@')[1] || '*', - }; - } - - return { - name: dependency.name, - range: dependency.range || dependency.version, - }; - }; - - /** - * Parses a version string into its components. - * Versions are strictly of the format `x.y.z` (as in [semver](http://semver.org/)). - * Versions may optionally have a prerelease tag in the format `x.y.z-alpha`. - * Ranges are a strict subset of [npm ranges](https://docs.npmjs.com/misc/semver#advanced-range-syntax). - * Only the following range types are supported: - * - Tilde ranges e.g. `~1.2.3` - * - Caret ranges e.g. `^1.2.3` - * - Exact version e.g. `1.2.3` - * - Any version `*` - * @method versionParse - * @param range {string} The version string. - * @return {object} The version range parsed into its components. - */ - Plugin.versionParse = function (range) { - var pattern = /^\*|[\^~]?\d+\.\d+\.\d+(-[0-9A-Za-z-]+)?$/; - - if (!pattern.test(range)) { - Common.warn('Plugin.versionParse:', range, 'is not a valid version or range.'); - } - - var identifiers = range.split('-'); - range = identifiers[0]; - - var isRange = isNaN(Number(range[0])), - version = isRange ? range.substr(1) : range, - parts = Common.map(version.split('.'), function (part) { - return Number(part); - }); - - return { - isRange: isRange, - version: version, - range: range, - operator: isRange ? range[0] : '', - parts: parts, - prerelease: identifiers[1], - number: parts[0] * 1e8 + parts[1] * 1e4 + parts[2], - }; - }; - - /** - * Returns `true` if `version` satisfies the given `range`. - * See documentation for `Plugin.versionParse` for a description of the format. - * If a version or range is not specified, then any version (`*`) is assumed to satisfy. - * @method versionSatisfies - * @param version {string} The version string. - * @param range {string} The range string. - * @return {boolean} `true` if `version` satisfies `range`, otherwise `false`. - */ - Plugin.versionSatisfies = function (version, range) { - range = range || '*'; - - var rangeParsed = Plugin.versionParse(range), - rangeParts = rangeParsed.parts, - versionParsed = Plugin.versionParse(version), - versionParts = versionParsed.parts; - - if (rangeParsed.isRange) { - if (rangeParsed.operator === '*' || version === '*') { - return true; - } - - if (rangeParsed.operator === '~') { - return ( - versionParts[0] === rangeParts[0] && - versionParts[1] === rangeParts[1] && - versionParts[2] >= rangeParts[2] - ); - } - - if (rangeParsed.operator === '^') { - if (rangeParts[0] > 0) { - return versionParts[0] === rangeParts[0] && versionParsed.number >= rangeParsed.number; - } - - if (rangeParts[1] > 0) { - return versionParts[1] === rangeParts[1] && versionParts[2] >= rangeParts[2]; - } - - return versionParts[2] === rangeParts[2]; - } - } - - return version === range || version === '*'; - }; - })(); - - /***/ - }, - /* 18 */ - /***/ function (module, exports) { - /** - * The `Matter.Contact` module contains methods for creating and manipulating collision contacts. - * - * @class Contact - */ - - var Contact = {}; - - module.exports = Contact; - - (function () { - /** - * Creates a new contact. - * @method create - * @param {vertex} vertex - * @return {contact} A new contact - */ - Contact.create = function (vertex) { - return { - id: Contact.id(vertex), - vertex: vertex, - normalImpulse: 0, - tangentImpulse: 0, - }; - }; - - /** - * Generates a contact id. - * @method id - * @param {vertex} vertex - * @return {string} Unique contactID - */ - Contact.id = function (vertex) { - return vertex.body.id + '_' + vertex.index; - }; - })(); - - /***/ - }, - /* 19 */ - /***/ function (module, exports, __webpack_require__) { - /** - * The `Matter.World` module contains methods for creating and manipulating the world composite. - * A `Matter.World` is a `Matter.Composite` body, which is a collection of `Matter.Body`, `Matter.Constraint` and other `Matter.Composite`. - * A `Matter.World` has a few additional properties including `gravity` and `bounds`. - * It is important to use the functions in the `Matter.Composite` module to modify the world composite, rather than directly modifying its properties. - * There are also a few methods here that alias those in `Matter.Composite` for easier readability. - * - * See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples). - * - * @class World - * @extends Composite - */ - - var World = {}; - - module.exports = World; - - var Composite = __webpack_require__(5); - __webpack_require__(8); - var Common = __webpack_require__(0); - - (function () { - /** - * Creates a new world composite. The options parameter is an object that specifies any properties you wish to override the defaults. - * See the properties section below for detailed information on what you can pass via the `options` object. - * @method create - * @constructor - * @param {} options - * @return {world} A new world - */ - World.create = function (options) { - var composite = Composite.create(); - - var defaults = { - label: 'World', - gravity: { - x: 0, - y: 1, - scale: 0.001, - }, - bounds: { - min: {x: -Infinity, y: -Infinity}, - max: {x: Infinity, y: Infinity}, - }, - }; - - return Common.extend(composite, defaults, options); - }; - - /* - * - * Properties Documentation - * - */ - - /** - * The gravity to apply on the world. - * - * @property gravity - * @type object - */ - - /** - * The gravity x component. - * - * @property gravity.x - * @type object - * @default 0 - */ - - /** - * The gravity y component. - * - * @property gravity.y - * @type object - * @default 1 - */ - - /** - * The gravity scale factor. - * - * @property gravity.scale - * @type object - * @default 0.001 - */ - - /** - * A `Bounds` object that defines the world bounds for collision detection. - * - * @property bounds - * @type bounds - * @default { min: { x: -Infinity, y: -Infinity }, max: { x: Infinity, y: Infinity } } - */ - - // World is a Composite body - // see src/module/Outro.js for these aliases: - - /** - * An alias for Composite.add - * @method add - * @param {world} world - * @param {} object - * @return {composite} The original world with the objects added - */ - - /** - * An alias for Composite.remove - * @method remove - * @param {world} world - * @param {} object - * @param {boolean} [deep=false] - * @return {composite} The original world with the objects removed - */ - - /** - * An alias for Composite.clear - * @method clear - * @param {world} world - * @param {boolean} keepStatic - */ - - /** - * An alias for Composite.addComposite - * @method addComposite - * @param {world} world - * @param {composite} composite - * @return {world} The original world with the objects from composite added - */ - - /** - * An alias for Composite.addBody - * @method addBody - * @param {world} world - * @param {body} body - * @return {world} The original world with the body added - */ - - /** - * An alias for Composite.addConstraint - * @method addConstraint - * @param {world} world - * @param {constraint} constraint - * @return {world} The original world with the constraint added - */ - })(); - - /***/ - }, - /* 20 */ - /***/ function (module, exports, __webpack_require__) { - /** - * The `Matter.Pairs` module contains methods for creating and manipulating collision pair sets. - * - * @class Pairs - */ - - var Pairs = {}; - - module.exports = Pairs; - - var Pair = __webpack_require__(9); - var Common = __webpack_require__(0); - - (function () { - Pairs._pairMaxIdleLife = 1000; - - /** - * Creates a new pairs structure. - * @method create - * @param {object} options - * @return {pairs} A new pairs structure - */ - Pairs.create = function (options) { - return Common.extend( - { - table: {}, - list: [], - collisionStart: [], - collisionActive: [], - collisionEnd: [], - }, - options, - ); - }; - - /** - * Updates pairs given a list of collisions. - * @method update - * @param {object} pairs - * @param {collision[]} collisions - * @param {number} timestamp - */ - Pairs.update = function (pairs, collisions, timestamp) { - var pairsList = pairs.list, - pairsTable = pairs.table, - collisionStart = pairs.collisionStart, - collisionEnd = pairs.collisionEnd, - collisionActive = pairs.collisionActive, - collision, - pairId, - pair, - i; - - // clear collision state arrays, but maintain old reference - collisionStart.length = 0; - collisionEnd.length = 0; - collisionActive.length = 0; - - for (i = 0; i < pairsList.length; i++) { - pairsList[i].confirmedActive = false; - } - - for (i = 0; i < collisions.length; i++) { - collision = collisions[i]; - - if (collision.collided) { - pairId = Pair.id(collision.bodyA, collision.bodyB); - - pair = pairsTable[pairId]; - - if (pair) { - // pair already exists (but may or may not be active) - if (pair.isActive) { - // pair exists and is active - collisionActive.push(pair); - } else { - // pair exists but was inactive, so a collision has just started again - collisionStart.push(pair); - } - - // update the pair - Pair.update(pair, collision, timestamp); - pair.confirmedActive = true; - } else { - // pair did not exist, create a new pair - pair = Pair.create(collision, timestamp); - pairsTable[pairId] = pair; - - // push the new pair - collisionStart.push(pair); - pairsList.push(pair); - } - } - } - - // deactivate previously active pairs that are now inactive - for (i = 0; i < pairsList.length; i++) { - pair = pairsList[i]; - if (pair.isActive && !pair.confirmedActive) { - Pair.setActive(pair, false, timestamp); - collisionEnd.push(pair); - } - } - }; - - /** - * Finds and removes pairs that have been inactive for a set amount of time. - * @method removeOld - * @param {object} pairs - * @param {number} timestamp - */ - Pairs.removeOld = function (pairs, timestamp) { - var pairsList = pairs.list, - pairsTable = pairs.table, - indexesToRemove = [], - pair, - collision, - pairIndex, - i; - - for (i = 0; i < pairsList.length; i++) { - pair = pairsList[i]; - collision = pair.collision; - - // never remove sleeping pairs - if (collision.bodyA.isSleeping || collision.bodyB.isSleeping) { - pair.timeUpdated = timestamp; - continue; - } - - // if pair is inactive for too long, mark it to be removed - if (timestamp - pair.timeUpdated > Pairs._pairMaxIdleLife) { - indexesToRemove.push(i); - } - } - - // remove marked pairs - for (i = 0; i < indexesToRemove.length; i++) { - pairIndex = indexesToRemove[i] - i; - pair = pairsList[pairIndex]; - delete pairsTable[pair.id]; - pairsList.splice(pairIndex, 1); - } - }; - - /** - * Clears the given pairs structure. - * @method clear - * @param {pairs} pairs - * @return {pairs} pairs - */ - Pairs.clear = function (pairs) { - pairs.table = {}; - pairs.list.length = 0; - pairs.collisionStart.length = 0; - pairs.collisionActive.length = 0; - pairs.collisionEnd.length = 0; - return pairs; - }; - })(); - - /***/ - }, - /* 21 */ - /***/ function (module, exports, __webpack_require__) { - /** - * The `Matter.Resolver` module contains methods for resolving collision pairs. - * - * @class Resolver - */ - - var Resolver = {}; - - module.exports = Resolver; - - var Vertices = __webpack_require__(3); - var Vector = __webpack_require__(2); - var Common = __webpack_require__(0); - var Bounds = __webpack_require__(1); - - (function () { - Resolver._restingThresh = 4; - Resolver._restingThreshTangent = 6; - Resolver._positionDampen = 0.9; - Resolver._positionWarming = 0.8; - Resolver._frictionNormalMultiplier = 5; - - /** - * Prepare pairs for position solving. - * @method preSolvePosition - * @param {pair[]} pairs - */ - Resolver.preSolvePosition = function (pairs) { - var i, pair, activeCount; - - // find total contacts on each body - for (i = 0; i < pairs.length; i++) { - pair = pairs[i]; - - if (!pair.isActive) continue; - - activeCount = pair.activeContacts.length; - pair.collision.parentA.totalContacts += activeCount; - pair.collision.parentB.totalContacts += activeCount; - } - }; - - /** - * Find a solution for pair positions. - * @method solvePosition - * @param {pair[]} pairs - * @param {number} timeScale - */ - Resolver.solvePosition = function (pairs, timeScale) { - var i, - pair, - collision, - bodyA, - bodyB, - normal, - bodyBtoA, - contactShare, - positionImpulse, - tempA = Vector._temp[0], - tempB = Vector._temp[1], - tempC = Vector._temp[2], - tempD = Vector._temp[3]; - - // find impulses required to resolve penetration - for (i = 0; i < pairs.length; i++) { - pair = pairs[i]; - - if (!pair.isActive || pair.isSensor) continue; - - collision = pair.collision; - bodyA = collision.parentA; - bodyB = collision.parentB; - normal = collision.normal; - - // get current separation between body edges involved in collision - bodyBtoA = Vector.sub( - Vector.add(bodyB.positionImpulse, bodyB.position, tempA), - Vector.add(bodyA.positionImpulse, Vector.sub(bodyB.position, collision.penetration, tempB), tempC), - tempD, - ); - - pair.separation = Vector.dot(normal, bodyBtoA); - } - - for (i = 0; i < pairs.length; i++) { - pair = pairs[i]; - - if (!pair.isActive || pair.isSensor) continue; - - collision = pair.collision; - bodyA = collision.parentA; - bodyB = collision.parentB; - normal = collision.normal; - positionImpulse = (pair.separation - pair.slop) * timeScale; - - if (bodyA.isStatic || bodyB.isStatic) positionImpulse *= 2; - - if (!(bodyA.isStatic || bodyA.isSleeping)) { - contactShare = Resolver._positionDampen / bodyA.totalContacts; - bodyA.positionImpulse.x += normal.x * positionImpulse * contactShare; - bodyA.positionImpulse.y += normal.y * positionImpulse * contactShare; - } - - if (!(bodyB.isStatic || bodyB.isSleeping)) { - contactShare = Resolver._positionDampen / bodyB.totalContacts; - bodyB.positionImpulse.x -= normal.x * positionImpulse * contactShare; - bodyB.positionImpulse.y -= normal.y * positionImpulse * contactShare; - } - } - }; - - /** - * Apply position resolution. - * @method postSolvePosition - * @param {body[]} bodies - */ - Resolver.postSolvePosition = function (bodies) { - for (var i = 0; i < bodies.length; i++) { - var body = bodies[i]; - - // reset contact count - body.totalContacts = 0; - - if (body.positionImpulse.x !== 0 || body.positionImpulse.y !== 0) { - // update body geometry - for (var j = 0; j < body.parts.length; j++) { - var part = body.parts[j]; - Vertices.translate(part.vertices, body.positionImpulse); - Bounds.update(part.bounds, part.vertices, body.velocity); - part.position.x += body.positionImpulse.x; - part.position.y += body.positionImpulse.y; - } - - // move the body without changing velocity - body.positionPrev.x += body.positionImpulse.x; - body.positionPrev.y += body.positionImpulse.y; - - if (Vector.dot(body.positionImpulse, body.velocity) < 0) { - // reset cached impulse if the body has velocity along it - body.positionImpulse.x = 0; - body.positionImpulse.y = 0; - } else { - // warm the next iteration - body.positionImpulse.x *= Resolver._positionWarming; - body.positionImpulse.y *= Resolver._positionWarming; - } - } - } - }; - - /** - * Prepare pairs for velocity solving. - * @method preSolveVelocity - * @param {pair[]} pairs - */ - Resolver.preSolveVelocity = function (pairs) { - var i, - j, - pair, - contacts, - collision, - bodyA, - bodyB, - normal, - tangent, - contact, - contactVertex, - normalImpulse, - tangentImpulse, - offset, - impulse = Vector._temp[0], - tempA = Vector._temp[1]; - - for (i = 0; i < pairs.length; i++) { - pair = pairs[i]; - - if (!pair.isActive || pair.isSensor) continue; - - contacts = pair.activeContacts; - collision = pair.collision; - bodyA = collision.parentA; - bodyB = collision.parentB; - normal = collision.normal; - tangent = collision.tangent; - - // resolve each contact - for (j = 0; j < contacts.length; j++) { - contact = contacts[j]; - contactVertex = contact.vertex; - normalImpulse = contact.normalImpulse; - tangentImpulse = contact.tangentImpulse; - - if (normalImpulse !== 0 || tangentImpulse !== 0) { - // total impulse from contact - impulse.x = normal.x * normalImpulse + tangent.x * tangentImpulse; - impulse.y = normal.y * normalImpulse + tangent.y * tangentImpulse; - - // apply impulse from contact - if (!(bodyA.isStatic || bodyA.isSleeping)) { - offset = Vector.sub(contactVertex, bodyA.position, tempA); - bodyA.positionPrev.x += impulse.x * bodyA.inverseMass; - bodyA.positionPrev.y += impulse.y * bodyA.inverseMass; - bodyA.anglePrev += Vector.cross(offset, impulse) * bodyA.inverseInertia; - } - - if (!(bodyB.isStatic || bodyB.isSleeping)) { - offset = Vector.sub(contactVertex, bodyB.position, tempA); - bodyB.positionPrev.x -= impulse.x * bodyB.inverseMass; - bodyB.positionPrev.y -= impulse.y * bodyB.inverseMass; - bodyB.anglePrev -= Vector.cross(offset, impulse) * bodyB.inverseInertia; - } - } - } - } - }; - - /** - * Find a solution for pair velocities. - * @method solveVelocity - * @param {pair[]} pairs - * @param {number} timeScale - */ - Resolver.solveVelocity = function (pairs, timeScale) { - var timeScaleSquared = timeScale * timeScale, - impulse = Vector._temp[0], - tempA = Vector._temp[1], - tempB = Vector._temp[2], - tempC = Vector._temp[3], - tempD = Vector._temp[4], - tempE = Vector._temp[5]; - - for (var i = 0; i < pairs.length; i++) { - var pair = pairs[i]; - - if (!pair.isActive || pair.isSensor) continue; - - var collision = pair.collision, - bodyA = collision.parentA, - bodyB = collision.parentB, - normal = collision.normal, - tangent = collision.tangent, - contacts = pair.activeContacts, - contactShare = 1 / contacts.length; - - // update body velocities - bodyA.velocity.x = bodyA.position.x - bodyA.positionPrev.x; - bodyA.velocity.y = bodyA.position.y - bodyA.positionPrev.y; - bodyB.velocity.x = bodyB.position.x - bodyB.positionPrev.x; - bodyB.velocity.y = bodyB.position.y - bodyB.positionPrev.y; - bodyA.angularVelocity = bodyA.angle - bodyA.anglePrev; - bodyB.angularVelocity = bodyB.angle - bodyB.anglePrev; - - // resolve each contact - for (var j = 0; j < contacts.length; j++) { - var contact = contacts[j], - contactVertex = contact.vertex, - offsetA = Vector.sub(contactVertex, bodyA.position, tempA), - offsetB = Vector.sub(contactVertex, bodyB.position, tempB), - velocityPointA = Vector.add( - bodyA.velocity, - Vector.mult(Vector.perp(offsetA), bodyA.angularVelocity), - tempC, - ), - velocityPointB = Vector.add( - bodyB.velocity, - Vector.mult(Vector.perp(offsetB), bodyB.angularVelocity), - tempD, - ), - relativeVelocity = Vector.sub(velocityPointA, velocityPointB, tempE), - normalVelocity = Vector.dot(normal, relativeVelocity); - - var tangentVelocity = Vector.dot(tangent, relativeVelocity), - tangentSpeed = Math.abs(tangentVelocity), - tangentVelocityDirection = Common.sign(tangentVelocity); - - // raw impulses - var normalImpulse = (1 + pair.restitution) * normalVelocity, - normalForce = - Common.clamp(pair.separation + normalVelocity, 0, 1) * Resolver._frictionNormalMultiplier; - - // coulomb friction - var tangentImpulse = tangentVelocity, - maxFriction = Infinity; - - if (tangentSpeed > pair.friction * pair.frictionStatic * normalForce * timeScaleSquared) { - maxFriction = tangentSpeed; - tangentImpulse = Common.clamp( - pair.friction * tangentVelocityDirection * timeScaleSquared, - -maxFriction, - maxFriction, - ); - } - - // modify impulses accounting for mass, inertia and offset - var oAcN = Vector.cross(offsetA, normal), - oBcN = Vector.cross(offsetB, normal), - share = - contactShare / - (bodyA.inverseMass + - bodyB.inverseMass + - bodyA.inverseInertia * oAcN * oAcN + - bodyB.inverseInertia * oBcN * oBcN); - - normalImpulse *= share; - tangentImpulse *= share; - - // handle high velocity and resting collisions separately - if ( - normalVelocity < 0 && - normalVelocity * normalVelocity > Resolver._restingThresh * timeScaleSquared - ) { - // high normal velocity so clear cached contact normal impulse - contact.normalImpulse = 0; - } else { - // solve resting collision constraints using Erin Catto's method (GDC08) - // impulse constraint tends to 0 - var contactNormalImpulse = contact.normalImpulse; - contact.normalImpulse = Math.min(contact.normalImpulse + normalImpulse, 0); - normalImpulse = contact.normalImpulse - contactNormalImpulse; - } - - // handle high velocity and resting collisions separately - if (tangentVelocity * tangentVelocity > Resolver._restingThreshTangent * timeScaleSquared) { - // high tangent velocity so clear cached contact tangent impulse - contact.tangentImpulse = 0; - } else { - // solve resting collision constraints using Erin Catto's method (GDC08) - // tangent impulse tends to -tangentSpeed or +tangentSpeed - var contactTangentImpulse = contact.tangentImpulse; - contact.tangentImpulse = Common.clamp( - contact.tangentImpulse + tangentImpulse, - -maxFriction, - maxFriction, - ); - tangentImpulse = contact.tangentImpulse - contactTangentImpulse; - } - - // total impulse from contact - impulse.x = normal.x * normalImpulse + tangent.x * tangentImpulse; - impulse.y = normal.y * normalImpulse + tangent.y * tangentImpulse; - - // apply impulse from contact - if (!(bodyA.isStatic || bodyA.isSleeping)) { - bodyA.positionPrev.x += impulse.x * bodyA.inverseMass; - bodyA.positionPrev.y += impulse.y * bodyA.inverseMass; - bodyA.anglePrev += Vector.cross(offsetA, impulse) * bodyA.inverseInertia; - } - - if (!(bodyB.isStatic || bodyB.isSleeping)) { - bodyB.positionPrev.x -= impulse.x * bodyB.inverseMass; - bodyB.positionPrev.y -= impulse.y * bodyB.inverseMass; - bodyB.anglePrev -= Vector.cross(offsetB, impulse) * bodyB.inverseInertia; - } - } - } - }; - })(); - - /***/ - }, - /* 22 */ - /***/ function (module, exports, __webpack_require__) { - /** - * The `Matter.Engine` module contains methods for creating and manipulating engines. - * An engine is a controller that manages updating the simulation of the world. - * See `Matter.Runner` for an optional game loop utility. - * - * See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples). - * - * @class Engine - */ - - var Engine = {}; - - module.exports = Engine; - - var World = __webpack_require__(19); - var Sleeping = __webpack_require__(7); - var Resolver = __webpack_require__(21); - var Render = __webpack_require__(10); - var Pairs = __webpack_require__(20); - var Metrics = __webpack_require__(23); - var Grid = __webpack_require__(11); - var Events = __webpack_require__(4); - var Composite = __webpack_require__(5); - var Constraint = __webpack_require__(8); - var Common = __webpack_require__(0); - var Body = __webpack_require__(6); - - (function () { - /** - * Creates a new engine. The options parameter is an object that specifies any properties you wish to override the defaults. - * All properties have default values, and many are pre-calculated automatically based on other properties. - * See the properties section below for detailed information on what you can pass via the `options` object. - * @method create - * @param {object} [options] - * @return {engine} engine - */ - Engine.create = function (element, options) { - // options may be passed as the first (and only) argument - options = Common.isElement(element) ? options : element; - element = Common.isElement(element) ? element : null; - options = options || {}; - - if (element || options.render) { - Common.warn('Engine.create: engine.render is deprecated (see docs)'); - } - - var defaults = { - positionIterations: 6, - velocityIterations: 4, - constraintIterations: 2, - enableSleeping: false, - events: [], - plugin: {}, - timing: { - timestamp: 0, - timeScale: 1, - }, - broadphase: { - controller: Grid, - }, - }; - - var engine = Common.extend(defaults, options); - - // @deprecated - if (element || engine.render) { - var renderDefaults = { - element: element, - controller: Render, - }; - - engine.render = Common.extend(renderDefaults, engine.render); - } - - // @deprecated - if (engine.render && engine.render.controller) { - engine.render = engine.render.controller.create(engine.render); - } - - // @deprecated - if (engine.render) { - engine.render.engine = engine; - } - - engine.world = options.world || World.create(engine.world); - engine.pairs = Pairs.create(); - engine.broadphase = engine.broadphase.controller.create(engine.broadphase); - engine.metrics = engine.metrics || {extended: false}; - - // @if DEBUG - engine.metrics = Metrics.create(engine.metrics); - // @endif - - return engine; - }; - - /** - * Moves the simulation forward in time by `delta` ms. - * The `correction` argument is an optional `Number` that specifies the time correction factor to apply to the update. - * This can help improve the accuracy of the simulation in cases where `delta` is changing between updates. - * The value of `correction` is defined as `delta / lastDelta`, i.e. the percentage change of `delta` over the last step. - * Therefore the value is always `1` (no correction) when `delta` constant (or when no correction is desired, which is the default). - * See the paper on Time Corrected Verlet for more information. - * - * Triggers `beforeUpdate` and `afterUpdate` events. - * Triggers `collisionStart`, `collisionActive` and `collisionEnd` events. - * @method update - * @param {engine} engine - * @param {number} [delta=16.666] - * @param {number} [correction=1] - */ - Engine.update = function (engine, delta, correction) { - delta = delta || 1000 / 60; - correction = correction || 1; - - var world = engine.world, - timing = engine.timing, - broadphase = engine.broadphase, - broadphasePairs = [], - i; - - // increment timestamp - timing.timestamp += delta * timing.timeScale; - - // create an event object - var event = { - timestamp: timing.timestamp, - }; - - Events.trigger(engine, 'beforeUpdate', event); - - // get lists of all bodies and constraints, no matter what composites they are in - var allBodies = Composite.allBodies(world), - allConstraints = Composite.allConstraints(world); - - // @if DEBUG - // reset metrics logging - Metrics.reset(engine.metrics); - // @endif - - // if sleeping enabled, call the sleeping controller - if (engine.enableSleeping) Sleeping.update(allBodies, timing.timeScale); - - // applies gravity to all bodies - Engine._bodiesApplyGravity(allBodies, world.gravity); - - // update all body position and rotation by integration - Engine._bodiesUpdate(allBodies, delta, timing.timeScale, correction, world.bounds); - - // update all constraints (first pass) - Constraint.preSolveAll(allBodies); - for (i = 0; i < engine.constraintIterations; i++) { - Constraint.solveAll(allConstraints, timing.timeScale); - } - Constraint.postSolveAll(allBodies); - - // broadphase pass: find potential collision pairs - if (broadphase.controller) { - // if world is dirty, we must flush the whole grid - if (world.isModified) broadphase.controller.clear(broadphase); - - // update the grid buckets based on current bodies - broadphase.controller.update(broadphase, allBodies, engine, world.isModified); - broadphasePairs = broadphase.pairsList; - } else { - // if no broadphase set, we just pass all bodies - broadphasePairs = allBodies; - } - - // clear all composite modified flags - if (world.isModified) { - Composite.setModified(world, false, false, true); - } - - // narrowphase pass: find actual collisions, then create or update collision pairs - var collisions = broadphase.detector(broadphasePairs, engine); - - // update collision pairs - var pairs = engine.pairs, - timestamp = timing.timestamp; - Pairs.update(pairs, collisions, timestamp); - Pairs.removeOld(pairs, timestamp); - - // wake up bodies involved in collisions - if (engine.enableSleeping) Sleeping.afterCollisions(pairs.list, timing.timeScale); - - // trigger collision events - if (pairs.collisionStart.length > 0) - Events.trigger(engine, 'collisionStart', {pairs: pairs.collisionStart}); - - // iteratively resolve position between collisions - Resolver.preSolvePosition(pairs.list); - for (i = 0; i < engine.positionIterations; i++) { - Resolver.solvePosition(pairs.list, timing.timeScale); - } - Resolver.postSolvePosition(allBodies); - - // update all constraints (second pass) - Constraint.preSolveAll(allBodies); - for (i = 0; i < engine.constraintIterations; i++) { - Constraint.solveAll(allConstraints, timing.timeScale); - } - Constraint.postSolveAll(allBodies); - - // iteratively resolve velocity between collisions - Resolver.preSolveVelocity(pairs.list); - for (i = 0; i < engine.velocityIterations; i++) { - Resolver.solveVelocity(pairs.list, timing.timeScale); - } - - // trigger collision events - if (pairs.collisionActive.length > 0) - Events.trigger(engine, 'collisionActive', {pairs: pairs.collisionActive}); - - if (pairs.collisionEnd.length > 0) Events.trigger(engine, 'collisionEnd', {pairs: pairs.collisionEnd}); - - // @if DEBUG - // update metrics log - Metrics.update(engine.metrics, engine); - // @endif - - // clear force buffers - Engine._bodiesClearForces(allBodies); - - Events.trigger(engine, 'afterUpdate', event); - - return engine; - }; - - /** - * Merges two engines by keeping the configuration of `engineA` but replacing the world with the one from `engineB`. - * @method merge - * @param {engine} engineA - * @param {engine} engineB - */ - Engine.merge = function (engineA, engineB) { - Common.extend(engineA, engineB); - - if (engineB.world) { - engineA.world = engineB.world; - - Engine.clear(engineA); - - var bodies = Composite.allBodies(engineA.world); - - for (var i = 0; i < bodies.length; i++) { - var body = bodies[i]; - Sleeping.set(body, false); - body.id = Common.nextId(); - } - } - }; - - /** - * Clears the engine including the world, pairs and broadphase. - * @method clear - * @param {engine} engine - */ - Engine.clear = function (engine) { - var world = engine.world; - - Pairs.clear(engine.pairs); - - var broadphase = engine.broadphase; - if (broadphase.controller) { - var bodies = Composite.allBodies(world); - broadphase.controller.clear(broadphase); - broadphase.controller.update(broadphase, bodies, engine, true); - } - }; - - /** - * Zeroes the `body.force` and `body.torque` force buffers. - * @method _bodiesClearForces - * @private - * @param {body[]} bodies - */ - Engine._bodiesClearForces = function (bodies) { - for (var i = 0; i < bodies.length; i++) { - var body = bodies[i]; - - // reset force buffers - body.force.x = 0; - body.force.y = 0; - body.torque = 0; - } - }; - - /** - * Applys a mass dependant force to all given bodies. - * @method _bodiesApplyGravity - * @private - * @param {body[]} bodies - * @param {vector} gravity - */ - Engine._bodiesApplyGravity = function (bodies, gravity) { - var gravityScale = typeof gravity.scale !== 'undefined' ? gravity.scale : 0.001; - - if ((gravity.x === 0 && gravity.y === 0) || gravityScale === 0) { - return; - } - - for (var i = 0; i < bodies.length; i++) { - var body = bodies[i]; - - if (body.isStatic || body.isSleeping) continue; - - // apply gravity - body.force.y += body.mass * gravity.y * gravityScale; - body.force.x += body.mass * gravity.x * gravityScale; - } - }; - - /** - * Applys `Body.update` to all given `bodies`. - * @method _bodiesUpdate - * @private - * @param {body[]} bodies - * @param {number} deltaTime - * The amount of time elapsed between updates - * @param {number} timeScale - * @param {number} correction - * The Verlet correction factor (deltaTime / lastDeltaTime) - * @param {bounds} worldBounds - */ - Engine._bodiesUpdate = function (bodies, deltaTime, timeScale, correction, worldBounds) { - for (var i = 0; i < bodies.length; i++) { - var body = bodies[i]; - - if (body.isStatic || body.isSleeping) continue; - - Body.update(body, deltaTime, timeScale, correction); - } - }; - - /** - * An alias for `Runner.run`, see `Matter.Runner` for more information. - * @method run - * @param {engine} engine - */ - - /** - * Fired just before an update - * - * @event beforeUpdate - * @param {} event An event object - * @param {number} event.timestamp The engine.timing.timestamp of the event - * @param {} event.source The source object of the event - * @param {} event.name The name of the event - */ - - /** - * Fired after engine update and all collision events - * - * @event afterUpdate - * @param {} event An event object - * @param {number} event.timestamp The engine.timing.timestamp of the event - * @param {} event.source The source object of the event - * @param {} event.name The name of the event - */ - - /** - * Fired after engine update, provides a list of all pairs that have started to collide in the current tick (if any) - * - * @event collisionStart - * @param {} event An event object - * @param {} event.pairs List of affected pairs - * @param {number} event.timestamp The engine.timing.timestamp of the event - * @param {} event.source The source object of the event - * @param {} event.name The name of the event - */ - - /** - * Fired after engine update, provides a list of all pairs that are colliding in the current tick (if any) - * - * @event collisionActive - * @param {} event An event object - * @param {} event.pairs List of affected pairs - * @param {number} event.timestamp The engine.timing.timestamp of the event - * @param {} event.source The source object of the event - * @param {} event.name The name of the event - */ - - /** - * Fired after engine update, provides a list of all pairs that have ended collision in the current tick (if any) - * - * @event collisionEnd - * @param {} event An event object - * @param {} event.pairs List of affected pairs - * @param {number} event.timestamp The engine.timing.timestamp of the event - * @param {} event.source The source object of the event - * @param {} event.name The name of the event - */ - - /* - * - * Properties Documentation - * - */ - - /** - * An integer `Number` that specifies the number of position iterations to perform each update. - * The higher the value, the higher quality the simulation will be at the expense of performance. - * - * @property positionIterations - * @type number - * @default 6 - */ - - /** - * An integer `Number` that specifies the number of velocity iterations to perform each update. - * The higher the value, the higher quality the simulation will be at the expense of performance. - * - * @property velocityIterations - * @type number - * @default 4 - */ - - /** - * An integer `Number` that specifies the number of constraint iterations to perform each update. - * The higher the value, the higher quality the simulation will be at the expense of performance. - * The default value of `2` is usually very adequate. - * - * @property constraintIterations - * @type number - * @default 2 - */ - - /** - * A flag that specifies whether the engine should allow sleeping via the `Matter.Sleeping` module. - * Sleeping can improve stability and performance, but often at the expense of accuracy. - * - * @property enableSleeping - * @type boolean - * @default false - */ - - /** - * An `Object` containing properties regarding the timing systems of the engine. - * - * @property timing - * @type object - */ - - /** - * A `Number` that specifies the global scaling factor of time for all bodies. - * A value of `0` freezes the simulation. - * A value of `0.1` gives a slow-motion effect. - * A value of `1.2` gives a speed-up effect. - * - * @property timing.timeScale - * @type number - * @default 1 - */ - - /** - * A `Number` that specifies the current simulation-time in milliseconds starting from `0`. - * It is incremented on every `Engine.update` by the given `delta` argument. - * - * @property timing.timestamp - * @type number - * @default 0 - */ - - /** - * An instance of a `Render` controller. The default value is a `Matter.Render` instance created by `Engine.create`. - * One may also develop a custom renderer module based on `Matter.Render` and pass an instance of it to `Engine.create` via `options.render`. - * - * A minimal custom renderer object must define at least three functions: `create`, `clear` and `world` (see `Matter.Render`). - * It is also possible to instead pass the _module_ reference via `options.render.controller` and `Engine.create` will instantiate one for you. - * - * @property render - * @type render - * @deprecated see Demo.js for an example of creating a renderer - * @default a Matter.Render instance - */ - - /** - * An instance of a broadphase controller. The default value is a `Matter.Grid` instance created by `Engine.create`. - * - * @property broadphase - * @type grid - * @default a Matter.Grid instance - */ - - /** - * A `World` composite object that will contain all simulated bodies and constraints. - * - * @property world - * @type world - * @default a Matter.World instance - */ - - /** - * An object reserved for storing plugin-specific properties. - * - * @property plugin - * @type {} - */ - })(); - - /***/ - }, - /* 23 */ - /***/ function (module, exports, __webpack_require__) { - // @if DEBUG - /** - * _Internal Class_, not generally used outside of the engine's internals. - * - */ - - var Metrics = {}; - - module.exports = Metrics; - - var Composite = __webpack_require__(5); - var Common = __webpack_require__(0); - - (function () { - /** - * Creates a new metrics. - * @method create - * @private - * @return {metrics} A new metrics - */ - Metrics.create = function (options) { - var defaults = { - extended: false, - narrowDetections: 0, - narrowphaseTests: 0, - narrowReuse: 0, - narrowReuseCount: 0, - midphaseTests: 0, - broadphaseTests: 0, - narrowEff: 0.0001, - midEff: 0.0001, - broadEff: 0.0001, - collisions: 0, - buckets: 0, - bodies: 0, - pairs: 0, - }; - - return Common.extend(defaults, false, options); - }; - - /** - * Resets metrics. - * @method reset - * @private - * @param {metrics} metrics - */ - Metrics.reset = function (metrics) { - if (metrics.extended) { - metrics.narrowDetections = 0; - metrics.narrowphaseTests = 0; - metrics.narrowReuse = 0; - metrics.narrowReuseCount = 0; - metrics.midphaseTests = 0; - metrics.broadphaseTests = 0; - metrics.narrowEff = 0; - metrics.midEff = 0; - metrics.broadEff = 0; - metrics.collisions = 0; - metrics.buckets = 0; - metrics.pairs = 0; - metrics.bodies = 0; - } - }; - - /** - * Updates metrics. - * @method update - * @private - * @param {metrics} metrics - * @param {engine} engine - */ - Metrics.update = function (metrics, engine) { - if (metrics.extended) { - var world = engine.world, - bodies = Composite.allBodies(world); - - metrics.collisions = metrics.narrowDetections; - metrics.pairs = engine.pairs.list.length; - metrics.bodies = bodies.length; - metrics.midEff = (metrics.narrowDetections / (metrics.midphaseTests || 1)).toFixed(2); - metrics.narrowEff = (metrics.narrowDetections / (metrics.narrowphaseTests || 1)).toFixed(2); - metrics.broadEff = (1 - metrics.broadphaseTests / (bodies.length || 1)).toFixed(2); - metrics.narrowReuse = (metrics.narrowReuseCount / (metrics.narrowphaseTests || 1)).toFixed(2); - //var broadphase = engine.broadphase[engine.broadphase.current]; - //if (broadphase.instance) - // metrics.buckets = Common.keys(broadphase.instance.buckets).length; - } - }; - })(); - // @endif - - /***/ - }, - /* 24 */ - /***/ function (module, exports, __webpack_require__) { - var Matter = (module.exports = __webpack_require__(25)); - - Matter.Body = __webpack_require__(6); - Matter.Composite = __webpack_require__(5); - Matter.World = __webpack_require__(19); - - Matter.Contact = __webpack_require__(18); - Matter.Detector = __webpack_require__(12); - Matter.Grid = __webpack_require__(11); - Matter.Pairs = __webpack_require__(20); - Matter.Pair = __webpack_require__(9); - Matter.Query = __webpack_require__(26); - Matter.Resolver = __webpack_require__(21); - Matter.SAT = __webpack_require__(13); - - Matter.Constraint = __webpack_require__(8); - Matter.MouseConstraint = __webpack_require__(28); - - Matter.Common = __webpack_require__(0); - Matter.Engine = __webpack_require__(22); - Matter.Events = __webpack_require__(4); - Matter.Mouse = __webpack_require__(14); - Matter.Runner = __webpack_require__(29); - Matter.Sleeping = __webpack_require__(7); - Matter.Plugin = __webpack_require__(17); - - // @if DEBUG - Matter.Metrics = __webpack_require__(23); - // @endif - - Matter.Bodies = __webpack_require__(16); - Matter.Composites = __webpack_require__(30); - - Matter.Axes = __webpack_require__(15); - Matter.Bounds = __webpack_require__(1); - Matter.Svg = __webpack_require__(31); - Matter.Vector = __webpack_require__(2); - Matter.Vertices = __webpack_require__(3); - - Matter.Render = __webpack_require__(10); - Matter.RenderPixi = __webpack_require__(32); - - // aliases - - Matter.World.add = Matter.Composite.add; - Matter.World.remove = Matter.Composite.remove; - Matter.World.addComposite = Matter.Composite.addComposite; - Matter.World.addBody = Matter.Composite.addBody; - Matter.World.addConstraint = Matter.Composite.addConstraint; - Matter.World.clear = Matter.Composite.clear; - Matter.Engine.run = Matter.Runner.run; - - /***/ - }, - /* 25 */ - /***/ function (module, exports, __webpack_require__) { - /** - * The `Matter` module is the top level namespace. It also includes a function for installing plugins on top of the library. - * - * @class Matter - */ - - var Matter = {}; - - module.exports = Matter; - - var Plugin = __webpack_require__(17); - var Common = __webpack_require__(0); - - (function () { - /** - * The library name. - * @property name - * @readOnly - * @type {String} - */ - Matter.name = 'matter-js'; - - /** - * The library version. - * @property version - * @readOnly - * @type {String} - */ - Matter.version = '0.14.2' ; - - /** - * A list of plugin dependencies to be installed. These are normally set and installed through `Matter.use`. - * Alternatively you may set `Matter.uses` manually and install them by calling `Plugin.use(Matter)`. - * @property uses - * @type {Array} - */ - Matter.uses = []; - - /** - * The plugins that have been installed through `Matter.Plugin.install`. Read only. - * @property used - * @readOnly - * @type {Array} - */ - Matter.used = []; - - /** - * Installs the given plugins on the `Matter` namespace. - * This is a short-hand for `Plugin.use`, see it for more information. - * Call this function once at the start of your code, with all of the plugins you wish to install as arguments. - * Avoid calling this function multiple times unless you intend to manually control installation order. - * @method use - * @param ...plugin {Function} The plugin(s) to install on `base` (multi-argument). - */ - Matter.use = function () { - Plugin.use(Matter, Array.prototype.slice.call(arguments)); - }; - - /** - * Chains a function to excute before the original function on the given `path` relative to `Matter`. - * See also docs for `Common.chain`. - * @method before - * @param {string} path The path relative to `Matter` - * @param {function} func The function to chain before the original - * @return {function} The chained function that replaced the original - */ - Matter.before = function (path, func) { - path = path.replace(/^Matter./, ''); - return Common.chainPathBefore(Matter, path, func); - }; - - /** - * Chains a function to excute after the original function on the given `path` relative to `Matter`. - * See also docs for `Common.chain`. - * @method after - * @param {string} path The path relative to `Matter` - * @param {function} func The function to chain after the original - * @return {function} The chained function that replaced the original - */ - Matter.after = function (path, func) { - path = path.replace(/^Matter./, ''); - return Common.chainPathAfter(Matter, path, func); - }; - })(); - - /***/ - }, - /* 26 */ - /***/ function (module, exports, __webpack_require__) { - /** - * The `Matter.Query` module contains methods for performing collision queries. - * - * See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples). - * - * @class Query - */ - - var Query = {}; - - module.exports = Query; - - var Vector = __webpack_require__(2); - var SAT = __webpack_require__(13); - var Bounds = __webpack_require__(1); - var Bodies = __webpack_require__(16); - var Vertices = __webpack_require__(3); - - (function () { - /** - * Returns a list of collisions between `body` and `bodies`. - * @method collides - * @param {body} body - * @param {body[]} bodies - * @return {object[]} Collisions - */ - Query.collides = function (body, bodies) { - var collisions = []; - - for (var i = 0; i < bodies.length; i++) { - var bodyA = bodies[i]; - - if (Bounds.overlaps(bodyA.bounds, body.bounds)) { - for (var j = bodyA.parts.length === 1 ? 0 : 1; j < bodyA.parts.length; j++) { - var part = bodyA.parts[j]; - - if (Bounds.overlaps(part.bounds, body.bounds)) { - var collision = SAT.collides(part, body); - - if (collision.collided) { - collisions.push(collision); - break; - } - } - } - } - } - - return collisions; - }; - - /** - * Casts a ray segment against a set of bodies and returns all collisions, ray width is optional. Intersection points are not provided. - * @method ray - * @param {body[]} bodies - * @param {vector} startPoint - * @param {vector} endPoint - * @param {number} [rayWidth] - * @return {object[]} Collisions - */ - Query.ray = function (bodies, startPoint, endPoint, rayWidth) { - rayWidth = rayWidth || 1e-100; - - var rayAngle = Vector.angle(startPoint, endPoint), - rayLength = Vector.magnitude(Vector.sub(startPoint, endPoint)), - rayX = (endPoint.x + startPoint.x) * 0.5, - rayY = (endPoint.y + startPoint.y) * 0.5, - ray = Bodies.rectangle(rayX, rayY, rayLength, rayWidth, {angle: rayAngle}), - collisions = Query.collides(ray, bodies); - - for (var i = 0; i < collisions.length; i += 1) { - var collision = collisions[i]; - collision.body = collision.bodyB = collision.bodyA; - } - - return collisions; - }; - - /** - * Returns all bodies whose bounds are inside (or outside if set) the given set of bounds, from the given set of bodies. - * @method region - * @param {body[]} bodies - * @param {bounds} bounds - * @param {bool} [outside=false] - * @return {body[]} The bodies matching the query - */ - Query.region = function (bodies, bounds, outside) { - var result = []; - - for (var i = 0; i < bodies.length; i++) { - var body = bodies[i], - overlaps = Bounds.overlaps(body.bounds, bounds); - if ((overlaps && !outside) || (!overlaps && outside)) result.push(body); - } - - return result; - }; - - /** - * Returns all bodies whose vertices contain the given point, from the given set of bodies. - * @method point - * @param {body[]} bodies - * @param {vector} point - * @return {body[]} The bodies matching the query - */ - Query.point = function (bodies, point) { - var result = []; - - for (var i = 0; i < bodies.length; i++) { - var body = bodies[i]; - - if (Bounds.contains(body.bounds, point)) { - for (var j = body.parts.length === 1 ? 0 : 1; j < body.parts.length; j++) { - var part = body.parts[j]; - - if (Bounds.contains(part.bounds, point) && Vertices.contains(part.vertices, point)) { - result.push(body); - break; - } - } - } - } - - return result; - }; - })(); - - /***/ - }, - /* 27 */ - /***/ function (module, exports) { - if (typeof __WEBPACK_EXTERNAL_MODULE__27__ === 'undefined') { - var e = new Error("Cannot find module 'undefined'"); - e.code = 'MODULE_NOT_FOUND'; - throw e; - } - module.exports = __WEBPACK_EXTERNAL_MODULE__27__; - - /***/ - }, - /* 28 */ - /***/ function (module, exports, __webpack_require__) { - /** - * The `Matter.MouseConstraint` module contains methods for creating mouse constraints. - * Mouse constraints are used for allowing user interaction, providing the ability to move bodies via the mouse or touch. - * - * See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples). - * - * @class MouseConstraint - */ - - var MouseConstraint = {}; - - module.exports = MouseConstraint; - - var Vertices = __webpack_require__(3); - var Sleeping = __webpack_require__(7); - var Mouse = __webpack_require__(14); - var Events = __webpack_require__(4); - var Detector = __webpack_require__(12); - var Constraint = __webpack_require__(8); - var Composite = __webpack_require__(5); - var Common = __webpack_require__(0); - var Bounds = __webpack_require__(1); - - (function () { - /** - * Creates a new mouse constraint. - * All properties have default values, and many are pre-calculated automatically based on other properties. - * See the properties section below for detailed information on what you can pass via the `options` object. - * @method create - * @param {engine} engine - * @param {} options - * @return {MouseConstraint} A new MouseConstraint - */ - MouseConstraint.create = function (engine, options) { - var mouse = (engine ? engine.mouse : null) || (options ? options.mouse : null); - - if (!mouse) { - if (engine && engine.render && engine.render.canvas) { - mouse = Mouse.create(engine.render.canvas); - } else if (options && options.element) { - mouse = Mouse.create(options.element); - } else { - mouse = Mouse.create(); - Common.warn( - 'MouseConstraint.create: options.mouse was undefined, options.element was undefined, may not function as expected', - ); - } - } - - var constraint = Constraint.create({ - label: 'Mouse Constraint', - pointA: mouse.position, - pointB: {x: 0, y: 0}, - length: 0.01, - stiffness: 0.1, - angularStiffness: 1, - render: { - strokeStyle: '#90EE90', - lineWidth: 3, - }, - }); - - var defaults = { - type: 'mouseConstraint', - mouse: mouse, - element: null, - body: null, - constraint: constraint, - collisionFilter: { - category: 0x0001, - mask: 0xffffffff, - group: 0, - }, - }; - - var mouseConstraint = Common.extend(defaults, options); - - Events.on(engine, 'beforeUpdate', function () { - var allBodies = Composite.allBodies(engine.world); - MouseConstraint.update(mouseConstraint, allBodies); - MouseConstraint._triggerEvents(mouseConstraint); - }); - - return mouseConstraint; - }; - - /** - * Updates the given mouse constraint. - * @private - * @method update - * @param {MouseConstraint} mouseConstraint - * @param {body[]} bodies - */ - MouseConstraint.update = function (mouseConstraint, bodies) { - var mouse = mouseConstraint.mouse, - constraint = mouseConstraint.constraint, - body = mouseConstraint.body; - - if (mouse.button === 0) { - if (!constraint.bodyB) { - for (var i = 0; i < bodies.length; i++) { - body = bodies[i]; - if ( - Bounds.contains(body.bounds, mouse.position) && - Detector.canCollide(body.collisionFilter, mouseConstraint.collisionFilter) - ) { - for (var j = body.parts.length > 1 ? 1 : 0; j < body.parts.length; j++) { - var part = body.parts[j]; - if (Vertices.contains(part.vertices, mouse.position)) { - constraint.pointA = mouse.position; - constraint.bodyB = mouseConstraint.body = body; - constraint.pointB = { - x: mouse.position.x - body.position.x, - y: mouse.position.y - body.position.y, - }; - constraint.angleB = body.angle; - - Sleeping.set(body, false); - Events.trigger(mouseConstraint, 'startdrag', {mouse: mouse, body: body}); - - break; - } - } - } - } - } else { - Sleeping.set(constraint.bodyB, false); - constraint.pointA = mouse.position; - } - } else { - constraint.bodyB = mouseConstraint.body = null; - constraint.pointB = null; - - if (body) Events.trigger(mouseConstraint, 'enddrag', {mouse: mouse, body: body}); - } - }; - - /** - * Triggers mouse constraint events. - * @method _triggerEvents - * @private - * @param {mouse} mouseConstraint - */ - MouseConstraint._triggerEvents = function (mouseConstraint) { - var mouse = mouseConstraint.mouse, - mouseEvents = mouse.sourceEvents; - - if (mouseEvents.mousemove) Events.trigger(mouseConstraint, 'mousemove', {mouse: mouse}); - - if (mouseEvents.mousedown) Events.trigger(mouseConstraint, 'mousedown', {mouse: mouse}); - - if (mouseEvents.mouseup) Events.trigger(mouseConstraint, 'mouseup', {mouse: mouse}); - - // reset the mouse state ready for the next step - Mouse.clearSourceEvents(mouse); - }; - - /* - * - * Events Documentation - * - */ - - /** - * Fired when the mouse has moved (or a touch moves) during the last step - * - * @event mousemove - * @param {} event An event object - * @param {mouse} event.mouse The engine's mouse instance - * @param {} event.source The source object of the event - * @param {} event.name The name of the event - */ - - /** - * Fired when the mouse is down (or a touch has started) during the last step - * - * @event mousedown - * @param {} event An event object - * @param {mouse} event.mouse The engine's mouse instance - * @param {} event.source The source object of the event - * @param {} event.name The name of the event - */ - - /** - * Fired when the mouse is up (or a touch has ended) during the last step - * - * @event mouseup - * @param {} event An event object - * @param {mouse} event.mouse The engine's mouse instance - * @param {} event.source The source object of the event - * @param {} event.name The name of the event - */ - - /** - * Fired when the user starts dragging a body - * - * @event startdrag - * @param {} event An event object - * @param {mouse} event.mouse The engine's mouse instance - * @param {body} event.body The body being dragged - * @param {} event.source The source object of the event - * @param {} event.name The name of the event - */ - - /** - * Fired when the user ends dragging a body - * - * @event enddrag - * @param {} event An event object - * @param {mouse} event.mouse The engine's mouse instance - * @param {body} event.body The body that has stopped being dragged - * @param {} event.source The source object of the event - * @param {} event.name The name of the event - */ - - /* - * - * Properties Documentation - * - */ - - /** - * A `String` denoting the type of object. - * - * @property type - * @type string - * @default "constraint" - * @readOnly - */ - - /** - * The `Mouse` instance in use. If not supplied in `MouseConstraint.create`, one will be created. - * - * @property mouse - * @type mouse - * @default mouse - */ - - /** - * The `Body` that is currently being moved by the user, or `null` if no body. - * - * @property body - * @type body - * @default null - */ - - /** - * The `Constraint` object that is used to move the body during interaction. - * - * @property constraint - * @type constraint - */ - - /** - * An `Object` that specifies the collision filter properties. - * The collision filter allows the user to define which types of body this mouse constraint can interact with. - * See `body.collisionFilter` for more information. - * - * @property collisionFilter - * @type object - */ - })(); - - /***/ - }, - /* 29 */ - /***/ function (module, exports, __webpack_require__) { - /** - * The `Matter.Runner` module is an optional utility which provides a game loop, - * that handles continuously updating a `Matter.Engine` for you within a browser. - * It is intended for development and debugging purposes, but may also be suitable for simple games. - * If you are using your own game loop instead, then you do not need the `Matter.Runner` module. - * Instead just call `Engine.update(engine, delta)` in your own loop. - * - * See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples). - * - * @class Runner - */ - - var Runner = {}; - - module.exports = Runner; - - var Events = __webpack_require__(4); - var Engine = __webpack_require__(22); - var Common = __webpack_require__(0); - - (function () { - var _requestAnimationFrame, _cancelAnimationFrame; - - if (typeof window !== 'undefined') { - _requestAnimationFrame = - window.requestAnimationFrame || - window.webkitRequestAnimationFrame || - window.mozRequestAnimationFrame || - window.msRequestAnimationFrame; - - _cancelAnimationFrame = - window.cancelAnimationFrame || - window.mozCancelAnimationFrame || - window.webkitCancelAnimationFrame || - window.msCancelAnimationFrame; - } - - if (!_requestAnimationFrame) { - var _frameTimeout; - - _requestAnimationFrame = function (callback) { - _frameTimeout = setTimeout(function () { - callback(Common.now()); - }, 1000 / 60); - }; - - _cancelAnimationFrame = function () { - clearTimeout(_frameTimeout); - }; - } - - /** - * Creates a new Runner. The options parameter is an object that specifies any properties you wish to override the defaults. - * @method create - * @param {} options - */ - Runner.create = function (options) { - var defaults = { - fps: 60, - correction: 1, - deltaSampleSize: 60, - counterTimestamp: 0, - frameCounter: 0, - deltaHistory: [], - timePrev: null, - timeScalePrev: 1, - frameRequestId: null, - isFixed: false, - enabled: true, - }; - - var runner = Common.extend(defaults, options); - - runner.delta = runner.delta || 1000 / runner.fps; - runner.deltaMin = runner.deltaMin || 1000 / runner.fps; - runner.deltaMax = runner.deltaMax || 1000 / (runner.fps * 0.5); - runner.fps = 1000 / runner.delta; - - return runner; - }; - - /** - * Continuously ticks a `Matter.Engine` by calling `Runner.tick` on the `requestAnimationFrame` event. - * @method run - * @param {engine} engine - */ - Runner.run = function (runner, engine) { - // create runner if engine is first argument - if (typeof runner.positionIterations !== 'undefined') { - engine = runner; - runner = Runner.create(); - } - - (function render(time) { - runner.frameRequestId = _requestAnimationFrame(render); - - if (time && runner.enabled) { - Runner.tick(runner, engine, time); - } - })(); - - return runner; - }; - - /** - * A game loop utility that updates the engine and renderer by one step (a 'tick'). - * Features delta smoothing, time correction and fixed or dynamic timing. - * Triggers `beforeTick`, `tick` and `afterTick` events on the engine. - * Consider just `Engine.update(engine, delta)` if you're using your own loop. - * @method tick - * @param {runner} runner - * @param {engine} engine - * @param {number} time - */ - Runner.tick = function (runner, engine, time) { - var timing = engine.timing, - correction = 1, - delta; - - // create an event object - var event = { - timestamp: timing.timestamp, - }; - - Events.trigger(runner, 'beforeTick', event); - Events.trigger(engine, 'beforeTick', event); // @deprecated - - if (runner.isFixed) { - // fixed timestep - delta = runner.delta; - } else { - // dynamic timestep based on wall clock between calls - delta = time - runner.timePrev || runner.delta; - runner.timePrev = time; - - // optimistically filter delta over a few frames, to improve stability - runner.deltaHistory.push(delta); - runner.deltaHistory = runner.deltaHistory.slice(-runner.deltaSampleSize); - delta = Math.min.apply(null, runner.deltaHistory); - - // limit delta - delta = delta < runner.deltaMin ? runner.deltaMin : delta; - delta = delta > runner.deltaMax ? runner.deltaMax : delta; - - // correction for delta - correction = delta / runner.delta; - - // update engine timing object - runner.delta = delta; - } - - // time correction for time scaling - if (runner.timeScalePrev !== 0) correction *= timing.timeScale / runner.timeScalePrev; - - if (timing.timeScale === 0) correction = 0; - - runner.timeScalePrev = timing.timeScale; - runner.correction = correction; - - // fps counter - runner.frameCounter += 1; - if (time - runner.counterTimestamp >= 1000) { - runner.fps = runner.frameCounter * ((time - runner.counterTimestamp) / 1000); - runner.counterTimestamp = time; - runner.frameCounter = 0; - } - - Events.trigger(runner, 'tick', event); - Events.trigger(engine, 'tick', event); // @deprecated - - // if world has been modified, clear the render scene graph - if ( - engine.world.isModified && - engine.render && - engine.render.controller && - engine.render.controller.clear - ) { - engine.render.controller.clear(engine.render); // @deprecated - } - - // update - Events.trigger(runner, 'beforeUpdate', event); - Engine.update(engine, delta, correction); - Events.trigger(runner, 'afterUpdate', event); - - // render - // @deprecated - if (engine.render && engine.render.controller) { - Events.trigger(runner, 'beforeRender', event); - Events.trigger(engine, 'beforeRender', event); // @deprecated - - engine.render.controller.world(engine.render); - - Events.trigger(runner, 'afterRender', event); - Events.trigger(engine, 'afterRender', event); // @deprecated - } - - Events.trigger(runner, 'afterTick', event); - Events.trigger(engine, 'afterTick', event); // @deprecated - }; - - /** - * Ends execution of `Runner.run` on the given `runner`, by canceling the animation frame request event loop. - * If you wish to only temporarily pause the engine, see `engine.enabled` instead. - * @method stop - * @param {runner} runner - */ - Runner.stop = function (runner) { - _cancelAnimationFrame(runner.frameRequestId); - }; - - /** - * Alias for `Runner.run`. - * @method start - * @param {runner} runner - * @param {engine} engine - */ - Runner.start = function (runner, engine) { - Runner.run(runner, engine); - }; - - /* - * - * Events Documentation - * - */ - - /** - * Fired at the start of a tick, before any updates to the engine or timing - * - * @event beforeTick - * @param {} event An event object - * @param {number} event.timestamp The engine.timing.timestamp of the event - * @param {} event.source The source object of the event - * @param {} event.name The name of the event - */ - - /** - * Fired after engine timing updated, but just before update - * - * @event tick - * @param {} event An event object - * @param {number} event.timestamp The engine.timing.timestamp of the event - * @param {} event.source The source object of the event - * @param {} event.name The name of the event - */ - - /** - * Fired at the end of a tick, after engine update and after rendering - * - * @event afterTick - * @param {} event An event object - * @param {number} event.timestamp The engine.timing.timestamp of the event - * @param {} event.source The source object of the event - * @param {} event.name The name of the event - */ - - /** - * Fired before update - * - * @event beforeUpdate - * @param {} event An event object - * @param {number} event.timestamp The engine.timing.timestamp of the event - * @param {} event.source The source object of the event - * @param {} event.name The name of the event - */ - - /** - * Fired after update - * - * @event afterUpdate - * @param {} event An event object - * @param {number} event.timestamp The engine.timing.timestamp of the event - * @param {} event.source The source object of the event - * @param {} event.name The name of the event - */ - - /** - * Fired before rendering - * - * @event beforeRender - * @param {} event An event object - * @param {number} event.timestamp The engine.timing.timestamp of the event - * @param {} event.source The source object of the event - * @param {} event.name The name of the event - * @deprecated - */ - - /** - * Fired after rendering - * - * @event afterRender - * @param {} event An event object - * @param {number} event.timestamp The engine.timing.timestamp of the event - * @param {} event.source The source object of the event - * @param {} event.name The name of the event - * @deprecated - */ - - /* - * - * Properties Documentation - * - */ - - /** - * A flag that specifies whether the runner is running or not. - * - * @property enabled - * @type boolean - * @default true - */ - - /** - * A `Boolean` that specifies if the runner should use a fixed timestep (otherwise it is variable). - * If timing is fixed, then the apparent simulation speed will change depending on the frame rate (but behaviour will be deterministic). - * If the timing is variable, then the apparent simulation speed will be constant (approximately, but at the cost of determininism). - * - * @property isFixed - * @type boolean - * @default false - */ - - /** - * A `Number` that specifies the time step between updates in milliseconds. - * If `engine.timing.isFixed` is set to `true`, then `delta` is fixed. - * If it is `false`, then `delta` can dynamically change to maintain the correct apparent simulation speed. - * - * @property delta - * @type number - * @default 1000 / 60 - */ - })(); - - /***/ - }, - /* 30 */ - /***/ function (module, exports, __webpack_require__) { - /** - * The `Matter.Composites` module contains factory methods for creating composite bodies - * with commonly used configurations (such as stacks and chains). - * - * See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples). - * - * @class Composites - */ - - var Composites = {}; - - module.exports = Composites; - - var Composite = __webpack_require__(5); - var Constraint = __webpack_require__(8); - var Common = __webpack_require__(0); - var Body = __webpack_require__(6); - var Bodies = __webpack_require__(16); - - (function () { - /** - * Create a new composite containing bodies created in the callback in a grid arrangement. - * This function uses the body's bounds to prevent overlaps. - * @method stack - * @param {number} xx - * @param {number} yy - * @param {number} columns - * @param {number} rows - * @param {number} columnGap - * @param {number} rowGap - * @param {function} callback - * @return {composite} A new composite containing objects created in the callback - */ - Composites.stack = function (xx, yy, columns, rows, columnGap, rowGap, callback) { - var stack = Composite.create({label: 'Stack'}), - x = xx, - y = yy, - lastBody, - i = 0; - - for (var row = 0; row < rows; row++) { - var maxHeight = 0; - - for (var column = 0; column < columns; column++) { - var body = callback(x, y, column, row, lastBody, i); - - if (body) { - var bodyHeight = body.bounds.max.y - body.bounds.min.y, - bodyWidth = body.bounds.max.x - body.bounds.min.x; - - if (bodyHeight > maxHeight) maxHeight = bodyHeight; - - Body.translate(body, {x: bodyWidth * 0.5, y: bodyHeight * 0.5}); - - x = body.bounds.max.x + columnGap; - - Composite.addBody(stack, body); - - lastBody = body; - i += 1; - } else { - x += columnGap; - } - } - - y += maxHeight + rowGap; - x = xx; - } - - return stack; - }; - - /** - * Chains all bodies in the given composite together using constraints. - * @method chain - * @param {composite} composite - * @param {number} xOffsetA - * @param {number} yOffsetA - * @param {number} xOffsetB - * @param {number} yOffsetB - * @param {object} options - * @return {composite} A new composite containing objects chained together with constraints - */ - Composites.chain = function (composite, xOffsetA, yOffsetA, xOffsetB, yOffsetB, options) { - var bodies = composite.bodies; - - for (var i = 1; i < bodies.length; i++) { - var bodyA = bodies[i - 1], - bodyB = bodies[i], - bodyAHeight = bodyA.bounds.max.y - bodyA.bounds.min.y, - bodyAWidth = bodyA.bounds.max.x - bodyA.bounds.min.x, - bodyBHeight = bodyB.bounds.max.y - bodyB.bounds.min.y, - bodyBWidth = bodyB.bounds.max.x - bodyB.bounds.min.x; - - var defaults = { - bodyA: bodyA, - pointA: {x: bodyAWidth * xOffsetA, y: bodyAHeight * yOffsetA}, - bodyB: bodyB, - pointB: {x: bodyBWidth * xOffsetB, y: bodyBHeight * yOffsetB}, - }; - - var constraint = Common.extend(defaults, options); - - Composite.addConstraint(composite, Constraint.create(constraint)); - } - - composite.label += ' Chain'; - - return composite; - }; - - /** - * Connects bodies in the composite with constraints in a grid pattern, with optional cross braces. - * @method mesh - * @param {composite} composite - * @param {number} columns - * @param {number} rows - * @param {boolean} crossBrace - * @param {object} options - * @return {composite} The composite containing objects meshed together with constraints - */ - Composites.mesh = function (composite, columns, rows, crossBrace, options) { - var bodies = composite.bodies, - row, - col, - bodyA, - bodyB, - bodyC; - - for (row = 0; row < rows; row++) { - for (col = 1; col < columns; col++) { - bodyA = bodies[col - 1 + row * columns]; - bodyB = bodies[col + row * columns]; - Composite.addConstraint( - composite, - Constraint.create(Common.extend({bodyA: bodyA, bodyB: bodyB}, options)), - ); - } - - if (row > 0) { - for (col = 0; col < columns; col++) { - bodyA = bodies[col + (row - 1) * columns]; - bodyB = bodies[col + row * columns]; - Composite.addConstraint( - composite, - Constraint.create(Common.extend({bodyA: bodyA, bodyB: bodyB}, options)), - ); - - if (crossBrace && col > 0) { - bodyC = bodies[col - 1 + (row - 1) * columns]; - Composite.addConstraint( - composite, - Constraint.create(Common.extend({bodyA: bodyC, bodyB: bodyB}, options)), - ); - } - - if (crossBrace && col < columns - 1) { - bodyC = bodies[col + 1 + (row - 1) * columns]; - Composite.addConstraint( - composite, - Constraint.create(Common.extend({bodyA: bodyC, bodyB: bodyB}, options)), - ); - } - } - } - } - - composite.label += ' Mesh'; - - return composite; - }; - - /** - * Create a new composite containing bodies created in the callback in a pyramid arrangement. - * This function uses the body's bounds to prevent overlaps. - * @method pyramid - * @param {number} xx - * @param {number} yy - * @param {number} columns - * @param {number} rows - * @param {number} columnGap - * @param {number} rowGap - * @param {function} callback - * @return {composite} A new composite containing objects created in the callback - */ - Composites.pyramid = function (xx, yy, columns, rows, columnGap, rowGap, callback) { - return Composites.stack( - xx, - yy, - columns, - rows, - columnGap, - rowGap, - function (x, y, column, row, lastBody, i) { - var actualRows = Math.min(rows, Math.ceil(columns / 2)), - lastBodyWidth = lastBody ? lastBody.bounds.max.x - lastBody.bounds.min.x : 0; - - if (row > actualRows) return; - - // reverse row order - row = actualRows - row; - - var start = row, - end = columns - 1 - row; - - if (column < start || column > end) return; - - // retroactively fix the first body's position, since width was unknown - if (i === 1) { - Body.translate(lastBody, {x: (column + (columns % 2 === 1 ? 1 : -1)) * lastBodyWidth, y: 0}); - } - - var xOffset = lastBody ? column * lastBodyWidth : 0; - - return callback(xx + xOffset + column * columnGap, y, column, row, lastBody, i); - }, - ); - }; - - /** - * Creates a composite with a Newton's Cradle setup of bodies and constraints. - * @method newtonsCradle - * @param {number} xx - * @param {number} yy - * @param {number} number - * @param {number} size - * @param {number} length - * @return {composite} A new composite newtonsCradle body - */ - Composites.newtonsCradle = function (xx, yy, number, size, length) { - var newtonsCradle = Composite.create({label: 'Newtons Cradle'}); - - for (var i = 0; i < number; i++) { - var separation = 1.9, - circle = Bodies.circle(xx + i * (size * separation), yy + length, size, { - inertia: Infinity, - restitution: 1, - friction: 0, - frictionAir: 0.0001, - slop: 1, - }), - constraint = Constraint.create({pointA: {x: xx + i * (size * separation), y: yy}, bodyB: circle}); - - Composite.addBody(newtonsCradle, circle); - Composite.addConstraint(newtonsCradle, constraint); - } - - return newtonsCradle; - }; - - /** - * Creates a composite with simple car setup of bodies and constraints. - * @method car - * @param {number} xx - * @param {number} yy - * @param {number} width - * @param {number} height - * @param {number} wheelSize - * @return {composite} A new composite car body - */ - Composites.car = function (xx, yy, width, height, wheelSize) { - var group = Body.nextGroup(true), - wheelBase = 20, - wheelAOffset = -width * 0.5 + wheelBase, - wheelBOffset = width * 0.5 - wheelBase, - wheelYOffset = 0; - - var car = Composite.create({label: 'Car'}), - body = Bodies.rectangle(xx, yy, width, height, { - collisionFilter: { - group: group, - }, - chamfer: { - radius: height * 0.5, - }, - density: 0.0002, - }); - - var wheelA = Bodies.circle(xx + wheelAOffset, yy + wheelYOffset, wheelSize, { - collisionFilter: { - group: group, - }, - friction: 0.8, - }); - - var wheelB = Bodies.circle(xx + wheelBOffset, yy + wheelYOffset, wheelSize, { - collisionFilter: { - group: group, - }, - friction: 0.8, - }); - - var axelA = Constraint.create({ - bodyB: body, - pointB: {x: wheelAOffset, y: wheelYOffset}, - bodyA: wheelA, - stiffness: 1, - length: 0, - }); - - var axelB = Constraint.create({ - bodyB: body, - pointB: {x: wheelBOffset, y: wheelYOffset}, - bodyA: wheelB, - stiffness: 1, - length: 0, - }); - - Composite.addBody(car, body); - Composite.addBody(car, wheelA); - Composite.addBody(car, wheelB); - Composite.addConstraint(car, axelA); - Composite.addConstraint(car, axelB); - - return car; - }; - - /** - * Creates a simple soft body like object. - * @method softBody - * @param {number} xx - * @param {number} yy - * @param {number} columns - * @param {number} rows - * @param {number} columnGap - * @param {number} rowGap - * @param {boolean} crossBrace - * @param {number} particleRadius - * @param {} particleOptions - * @param {} constraintOptions - * @return {composite} A new composite softBody - */ - Composites.softBody = function ( - xx, - yy, - columns, - rows, - columnGap, - rowGap, - crossBrace, - particleRadius, - particleOptions, - constraintOptions, - ) { - particleOptions = Common.extend({inertia: Infinity}, particleOptions); - constraintOptions = Common.extend( - {stiffness: 0.2, render: {type: 'line', anchors: false}}, - constraintOptions, - ); - - var softBody = Composites.stack(xx, yy, columns, rows, columnGap, rowGap, function (x, y) { - return Bodies.circle(x, y, particleRadius, particleOptions); - }); - - Composites.mesh(softBody, columns, rows, crossBrace, constraintOptions); - - softBody.label = 'Soft Body'; - - return softBody; - }; - })(); - - /***/ - }, - /* 31 */ - /***/ function (module, exports, __webpack_require__) { - /** - * The `Matter.Svg` module contains methods for converting SVG images into an array of vector points. - * - * To use this module you also need the SVGPathSeg polyfill: https://github.com/progers/pathseg - * - * See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples). - * - * @class Svg - */ - - var Svg = {}; - - module.exports = Svg; - - __webpack_require__(1); - var Common = __webpack_require__(0); - - (function () { - /** - * Converts an SVG path into an array of vector points. - * If the input path forms a concave shape, you must decompose the result into convex parts before use. - * See `Bodies.fromVertices` which provides support for this. - * Note that this function is not guaranteed to support complex paths (such as those with holes). - * You must load the `pathseg.js` polyfill on newer browsers. - * @method pathToVertices - * @param {SVGPathElement} path - * @param {Number} [sampleLength=15] - * @return {Vector[]} points - */ - Svg.pathToVertices = function (path, sampleLength) { - if (typeof window !== 'undefined' && !('SVGPathSeg' in window)) { - Common.warn('Svg.pathToVertices: SVGPathSeg not defined, a polyfill is required.'); - } - - // https://github.com/wout/svg.topoly.js/blob/master/svg.topoly.js - var i, - il, - total, - point, - segment, - segments, - segmentsQueue, - lastSegment, - lastPoint, - segmentIndex, - points = [], - lx, - ly, - length = 0, - x = 0, - y = 0; - - sampleLength = sampleLength || 15; - - var addPoint = function (px, py, pathSegType) { - // all odd-numbered path types are relative except PATHSEG_CLOSEPATH (1) - var isRelative = pathSegType % 2 === 1 && pathSegType > 1; - - // when the last point doesn't equal the current point add the current point - if (!lastPoint || px != lastPoint.x || py != lastPoint.y) { - if (lastPoint && isRelative) { - lx = lastPoint.x; - ly = lastPoint.y; - } else { - lx = 0; - ly = 0; - } - - var point = { - x: lx + px, - y: ly + py, - }; - - // set last point - if (isRelative || !lastPoint) { - lastPoint = point; - } - - points.push(point); - - x = lx + px; - y = ly + py; - } - }; - - var addSegmentPoint = function (segment) { - var segType = segment.pathSegTypeAsLetter.toUpperCase(); - - // skip path ends - if (segType === 'Z') return; - - // map segment to x and y - switch (segType) { - case 'M': - case 'L': - case 'T': - case 'C': - case 'S': - case 'Q': - x = segment.x; - y = segment.y; - break; - case 'H': - x = segment.x; - break; - case 'V': - y = segment.y; - break; - } - - addPoint(x, y, segment.pathSegType); - }; - - // ensure path is absolute - Svg._svgPathToAbsolute(path); - - // get total length - total = path.getTotalLength(); - - // queue segments - segments = []; - for (i = 0; i < path.pathSegList.numberOfItems; i += 1) segments.push(path.pathSegList.getItem(i)); - - segmentsQueue = segments.concat(); - - // sample through path - while (length < total) { - // get segment at position - segmentIndex = path.getPathSegAtLength(length); - segment = segments[segmentIndex]; - - // new segment - if (segment != lastSegment) { - while (segmentsQueue.length && segmentsQueue[0] != segment) addSegmentPoint(segmentsQueue.shift()); - - lastSegment = segment; - } - - // add points in between when curving - // TODO: adaptive sampling - switch (segment.pathSegTypeAsLetter.toUpperCase()) { - case 'C': - case 'T': - case 'S': - case 'Q': - case 'A': - point = path.getPointAtLength(length); - addPoint(point.x, point.y, 0); - break; - } - - // increment by sample value - length += sampleLength; - } - - // add remaining segments not passed by sampling - for (i = 0, il = segmentsQueue.length; i < il; ++i) addSegmentPoint(segmentsQueue[i]); - - return points; - }; - - Svg._svgPathToAbsolute = function (path) { - // http://phrogz.net/convert-svg-path-to-all-absolute-commands - // Copyright (c) Gavin Kistner - // http://phrogz.net/js/_ReuseLicense.txt - // Modifications: tidy formatting and naming - var x0, - y0, - x1, - y1, - x2, - y2, - segs = path.pathSegList, - x = 0, - y = 0, - len = segs.numberOfItems; - - for (var i = 0; i < len; ++i) { - var seg = segs.getItem(i), - segType = seg.pathSegTypeAsLetter; - - if (/[MLHVCSQTA]/.test(segType)) { - if ('x' in seg) x = seg.x; - if ('y' in seg) y = seg.y; - } else { - if ('x1' in seg) x1 = x + seg.x1; - if ('x2' in seg) x2 = x + seg.x2; - if ('y1' in seg) y1 = y + seg.y1; - if ('y2' in seg) y2 = y + seg.y2; - if ('x' in seg) x += seg.x; - if ('y' in seg) y += seg.y; - - switch (segType) { - case 'm': - segs.replaceItem(path.createSVGPathSegMovetoAbs(x, y), i); - break; - case 'l': - segs.replaceItem(path.createSVGPathSegLinetoAbs(x, y), i); - break; - case 'h': - segs.replaceItem(path.createSVGPathSegLinetoHorizontalAbs(x), i); - break; - case 'v': - segs.replaceItem(path.createSVGPathSegLinetoVerticalAbs(y), i); - break; - case 'c': - segs.replaceItem(path.createSVGPathSegCurvetoCubicAbs(x, y, x1, y1, x2, y2), i); - break; - case 's': - segs.replaceItem(path.createSVGPathSegCurvetoCubicSmoothAbs(x, y, x2, y2), i); - break; - case 'q': - segs.replaceItem(path.createSVGPathSegCurvetoQuadraticAbs(x, y, x1, y1), i); - break; - case 't': - segs.replaceItem(path.createSVGPathSegCurvetoQuadraticSmoothAbs(x, y), i); - break; - case 'a': - segs.replaceItem( - path.createSVGPathSegArcAbs(x, y, seg.r1, seg.r2, seg.angle, seg.largeArcFlag, seg.sweepFlag), - i, - ); - break; - case 'z': - case 'Z': - x = x0; - y = y0; - break; - } - } - - if (segType == 'M' || segType == 'm') { - x0 = x; - y0 = y; - } - } - }; - })(); - - /***/ - }, - /* 32 */ - /***/ function (module, exports, __webpack_require__) { - /** - * The `Matter.RenderPixi` module is an example renderer using pixi.js. - * See also `Matter.Render` for a canvas based renderer. - * - * @class RenderPixi - * @deprecated the Matter.RenderPixi module will soon be removed from the Matter.js core. - * It will likely be moved to its own repository (but maintenance will be limited). - */ - - var RenderPixi = {}; - - module.exports = RenderPixi; - - var Bounds = __webpack_require__(1); - var Composite = __webpack_require__(5); - var Common = __webpack_require__(0); - var Events = __webpack_require__(4); - var Vector = __webpack_require__(2); - - (function () { - var _requestAnimationFrame, _cancelAnimationFrame; - - if (typeof window !== 'undefined') { - _requestAnimationFrame = - window.requestAnimationFrame || - window.webkitRequestAnimationFrame || - window.mozRequestAnimationFrame || - window.msRequestAnimationFrame || - function (callback) { - window.setTimeout(function () { - callback(Common.now()); - }, 1000 / 60); - }; - - _cancelAnimationFrame = - window.cancelAnimationFrame || - window.mozCancelAnimationFrame || - window.webkitCancelAnimationFrame || - window.msCancelAnimationFrame; - } - - /** - * Creates a new Pixi.js WebGL renderer - * @method create - * @param {object} options - * @return {RenderPixi} A new renderer - * @deprecated - */ - RenderPixi.create = function (options) { - Common.warn('RenderPixi.create: Matter.RenderPixi is deprecated (see docs)'); - - var defaults = { - controller: RenderPixi, - engine: null, - element: null, - frameRequestId: null, - canvas: null, - renderer: null, - container: null, - spriteContainer: null, - pixiOptions: null, - options: { - width: 800, - height: 600, - background: '#fafafa', - wireframeBackground: '#222', - hasBounds: false, - enabled: true, - wireframes: true, - showSleeping: true, - showDebug: false, - showBroadphase: false, - showBounds: false, - showVelocity: false, - showCollisions: false, - showAxes: false, - showPositions: false, - showAngleIndicator: false, - showIds: false, - showShadows: false, - }, - }; - - var render = Common.extend(defaults, options), - transparent = !render.options.wireframes && render.options.background === 'transparent'; - - // init pixi - render.pixiOptions = render.pixiOptions || { - view: render.canvas, - transparent: transparent, - antialias: true, - backgroundColor: options.background, - }; - - render.mouse = options.mouse; - render.engine = options.engine; - render.renderer = - render.renderer || - new PIXI.WebGLRenderer(render.options.width, render.options.height, render.pixiOptions); - render.container = render.container || new PIXI.Container(); - render.spriteContainer = render.spriteContainer || new PIXI.Container(); - render.canvas = render.canvas || render.renderer.view; - render.bounds = render.bounds || { - min: { - x: 0, - y: 0, - }, - max: { - x: render.options.width, - y: render.options.height, - }, - }; - - // event listeners - Events.on(render.engine, 'beforeUpdate', function () { - RenderPixi.clear(render); - }); - - // caches - render.textures = {}; - render.sprites = {}; - render.primitives = {}; - - // use a sprite batch for performance - render.container.addChild(render.spriteContainer); - - // insert canvas - if (Common.isElement(render.element)) { - render.element.appendChild(render.canvas); - } else { - Common.warn('No "render.element" passed, "render.canvas" was not inserted into document.'); - } - - // prevent menus on canvas - render.canvas.oncontextmenu = function () { - return false; - }; - render.canvas.onselectstart = function () { - return false; - }; - - return render; - }; - - /** - * Continuously updates the render canvas on the `requestAnimationFrame` event. - * @method run - * @param {render} render - * @deprecated - */ - RenderPixi.run = function (render) { - (function loop(time) { - render.frameRequestId = _requestAnimationFrame(loop); - RenderPixi.world(render); - })(); - }; - - /** - * Ends execution of `Render.run` on the given `render`, by canceling the animation frame request event loop. - * @method stop - * @param {render} render - * @deprecated - */ - RenderPixi.stop = function (render) { - _cancelAnimationFrame(render.frameRequestId); - }; - - /** - * Clears the scene graph - * @method clear - * @param {RenderPixi} render - * @deprecated - */ - RenderPixi.clear = function (render) { - var container = render.container, - spriteContainer = render.spriteContainer; - - // clear stage container - while (container.children[0]) { - container.removeChild(container.children[0]); - } - - // clear sprite batch - while (spriteContainer.children[0]) { - spriteContainer.removeChild(spriteContainer.children[0]); - } - - var bgSprite = render.sprites['bg-0']; - - // clear caches - render.textures = {}; - render.sprites = {}; - render.primitives = {}; - - // set background sprite - render.sprites['bg-0'] = bgSprite; - if (bgSprite) container.addChildAt(bgSprite, 0); - - // add sprite batch back into container - render.container.addChild(render.spriteContainer); - - // reset background state - render.currentBackground = null; - - // reset bounds transforms - container.scale.set(1, 1); - container.position.set(0, 0); - }; - - /** - * Sets the background of the canvas - * @method setBackground - * @param {RenderPixi} render - * @param {string} background - * @deprecated - */ - RenderPixi.setBackground = function (render, background) { - if (render.currentBackground !== background) { - var isColor = background.indexOf && background.indexOf('#') !== -1, - bgSprite = render.sprites['bg-0']; - - if (isColor) { - // if solid background color - var color = Common.colorToNumber(background); - render.renderer.backgroundColor = color; - - // remove background sprite if existing - if (bgSprite) render.container.removeChild(bgSprite); - } else { - // initialise background sprite if needed - if (!bgSprite) { - var texture = _getTexture(render, background); - - bgSprite = render.sprites['bg-0'] = new PIXI.Sprite(texture); - bgSprite.position.x = 0; - bgSprite.position.y = 0; - render.container.addChildAt(bgSprite, 0); - } - } - - render.currentBackground = background; - } - }; - - /** - * Description - * @method world - * @param {engine} engine - * @deprecated - */ - RenderPixi.world = function (render) { - var engine = render.engine, - world = engine.world, - renderer = render.renderer, - container = render.container, - options = render.options, - bodies = Composite.allBodies(world), - allConstraints = Composite.allConstraints(world), - constraints = [], - i; - - if (options.wireframes) { - RenderPixi.setBackground(render, options.wireframeBackground); - } else { - RenderPixi.setBackground(render, options.background); - } - - // handle bounds - var boundsWidth = render.bounds.max.x - render.bounds.min.x, - boundsHeight = render.bounds.max.y - render.bounds.min.y, - boundsScaleX = boundsWidth / render.options.width, - boundsScaleY = boundsHeight / render.options.height; - - if (options.hasBounds) { - // Hide bodies that are not in view - for (i = 0; i < bodies.length; i++) { - var body = bodies[i]; - body.render.sprite.visible = Bounds.overlaps(body.bounds, render.bounds); - } - - // filter out constraints that are not in view - for (i = 0; i < allConstraints.length; i++) { - var constraint = allConstraints[i], - bodyA = constraint.bodyA, - bodyB = constraint.bodyB, - pointAWorld = constraint.pointA, - pointBWorld = constraint.pointB; - - if (bodyA) pointAWorld = Vector.add(bodyA.position, constraint.pointA); - if (bodyB) pointBWorld = Vector.add(bodyB.position, constraint.pointB); - - if (!pointAWorld || !pointBWorld) continue; - - if (Bounds.contains(render.bounds, pointAWorld) || Bounds.contains(render.bounds, pointBWorld)) - constraints.push(constraint); - } - - // transform the view - container.scale.set(1 / boundsScaleX, 1 / boundsScaleY); - container.position.set( - -render.bounds.min.x * (1 / boundsScaleX), - -render.bounds.min.y * (1 / boundsScaleY), - ); - } else { - constraints = allConstraints; - } - - for (i = 0; i < bodies.length; i++) RenderPixi.body(render, bodies[i]); - - for (i = 0; i < constraints.length; i++) RenderPixi.constraint(render, constraints[i]); - - renderer.render(container); - }; - - /** - * Description - * @method constraint - * @param {engine} engine - * @param {constraint} constraint - * @deprecated - */ - RenderPixi.constraint = function (render, constraint) { - render.engine; - var bodyA = constraint.bodyA, - bodyB = constraint.bodyB, - pointA = constraint.pointA, - pointB = constraint.pointB, - container = render.container, - constraintRender = constraint.render, - primitiveId = 'c-' + constraint.id, - primitive = render.primitives[primitiveId]; - - // initialise constraint primitive if not existing - if (!primitive) primitive = render.primitives[primitiveId] = new PIXI.Graphics(); - - // don't render if constraint does not have two end points - if (!constraintRender.visible || !constraint.pointA || !constraint.pointB) { - primitive.clear(); - return; - } - - // add to scene graph if not already there - if (Common.indexOf(container.children, primitive) === -1) container.addChild(primitive); - - // render the constraint on every update, since they can change dynamically - primitive.clear(); - primitive.beginFill(0, 0); - primitive.lineStyle(constraintRender.lineWidth, Common.colorToNumber(constraintRender.strokeStyle), 1); - - if (bodyA) { - primitive.moveTo(bodyA.position.x + pointA.x, bodyA.position.y + pointA.y); - } else { - primitive.moveTo(pointA.x, pointA.y); - } - - if (bodyB) { - primitive.lineTo(bodyB.position.x + pointB.x, bodyB.position.y + pointB.y); - } else { - primitive.lineTo(pointB.x, pointB.y); - } - - primitive.endFill(); - }; - - /** - * Description - * @method body - * @param {engine} engine - * @param {body} body - * @deprecated - */ - RenderPixi.body = function (render, body) { - render.engine; - var bodyRender = body.render; - - if (!bodyRender.visible) return; - - if (bodyRender.sprite && bodyRender.sprite.texture) { - var spriteId = 'b-' + body.id, - sprite = render.sprites[spriteId], - spriteContainer = render.spriteContainer; - - // initialise body sprite if not existing - if (!sprite) sprite = render.sprites[spriteId] = _createBodySprite(render, body); - - // add to scene graph if not already there - if (Common.indexOf(spriteContainer.children, sprite) === -1) spriteContainer.addChild(sprite); - - // update body sprite - sprite.position.x = body.position.x; - sprite.position.y = body.position.y; - sprite.rotation = body.angle; - sprite.scale.x = bodyRender.sprite.xScale || 1; - sprite.scale.y = bodyRender.sprite.yScale || 1; - } else { - var primitiveId = 'b-' + body.id, - primitive = render.primitives[primitiveId], - container = render.container; - - // initialise body primitive if not existing - if (!primitive) { - primitive = render.primitives[primitiveId] = _createBodyPrimitive(render, body); - primitive.initialAngle = body.angle; - } - - // add to scene graph if not already there - if (Common.indexOf(container.children, primitive) === -1) container.addChild(primitive); - - // update body primitive - primitive.position.x = body.position.x; - primitive.position.y = body.position.y; - primitive.rotation = body.angle - primitive.initialAngle; - } - }; - - /** - * Creates a body sprite - * @method _createBodySprite - * @private - * @param {RenderPixi} render - * @param {body} body - * @return {PIXI.Sprite} sprite - * @deprecated - */ - var _createBodySprite = function (render, body) { - var bodyRender = body.render, - texturePath = bodyRender.sprite.texture, - texture = _getTexture(render, texturePath), - sprite = new PIXI.Sprite(texture); - - sprite.anchor.x = body.render.sprite.xOffset; - sprite.anchor.y = body.render.sprite.yOffset; - - return sprite; - }; - - /** - * Creates a body primitive - * @method _createBodyPrimitive - * @private - * @param {RenderPixi} render - * @param {body} body - * @return {PIXI.Graphics} graphics - * @deprecated - */ - var _createBodyPrimitive = function (render, body) { - var bodyRender = body.render, - options = render.options, - primitive = new PIXI.Graphics(), - fillStyle = Common.colorToNumber(bodyRender.fillStyle), - strokeStyle = Common.colorToNumber(bodyRender.strokeStyle), - strokeStyleIndicator = Common.colorToNumber(bodyRender.strokeStyle), - strokeStyleWireframe = Common.colorToNumber('#bbb'), - strokeStyleWireframeIndicator = Common.colorToNumber('#CD5C5C'), - part; - - primitive.clear(); - - // handle compound parts - for (var k = body.parts.length > 1 ? 1 : 0; k < body.parts.length; k++) { - part = body.parts[k]; - - if (!options.wireframes) { - primitive.beginFill(fillStyle, 1); - primitive.lineStyle(bodyRender.lineWidth, strokeStyle, 1); - } else { - primitive.beginFill(0, 0); - primitive.lineStyle(1, strokeStyleWireframe, 1); - } - - primitive.moveTo(part.vertices[0].x - body.position.x, part.vertices[0].y - body.position.y); - - for (var j = 1; j < part.vertices.length; j++) { - primitive.lineTo(part.vertices[j].x - body.position.x, part.vertices[j].y - body.position.y); - } - - primitive.lineTo(part.vertices[0].x - body.position.x, part.vertices[0].y - body.position.y); - - primitive.endFill(); - - // angle indicator - if (options.showAngleIndicator || options.showAxes) { - primitive.beginFill(0, 0); - - if (options.wireframes) { - primitive.lineStyle(1, strokeStyleWireframeIndicator, 1); - } else { - primitive.lineStyle(1, strokeStyleIndicator); - } - - primitive.moveTo(part.position.x - body.position.x, part.position.y - body.position.y); - primitive.lineTo( - (part.vertices[0].x + part.vertices[part.vertices.length - 1].x) / 2 - body.position.x, - (part.vertices[0].y + part.vertices[part.vertices.length - 1].y) / 2 - body.position.y, - ); - - primitive.endFill(); - } - } - - return primitive; - }; - - /** - * Gets the requested texture (a PIXI.Texture) via its path - * @method _getTexture - * @private - * @param {RenderPixi} render - * @param {string} imagePath - * @return {PIXI.Texture} texture - * @deprecated - */ - var _getTexture = function (render, imagePath) { - var texture = render.textures[imagePath]; - - if (!texture) texture = render.textures[imagePath] = PIXI.Texture.fromImage(imagePath); - - return texture; - }; - })(); - - /***/ - }, - /******/ - ], - ); - }; - - var Matter = main(); - - exports.PhysicsType = void 0; - (function (PhysicsType) { - PhysicsType["RECTANGLE"] = "rectangle"; - PhysicsType["CIRCLE"] = "circle"; - PhysicsType["POLYGON"] = "polygon"; - })(exports.PhysicsType || (exports.PhysicsType = {})); - class Physics extends eva_js.Component { - constructor(params) { - super(params); - } - init(params) { - this.bodyParams = params; - } - update() { - if (this.body && this.gameObject) { - this.gameObject.transform.anchor.x = 0; - this.gameObject.transform.anchor.y = 0; - this.gameObject.transform.position.x = this.body.position.x; - this.gameObject.transform.position.y = this.body.position.y; - if (!this.bodyParams.stopRotation) { - this.gameObject.transform.rotation = this.body.angle; - } - } - } - onDestroy() { - Matter.World.remove(this.PhysicsEngine.world, this.body, true); - } - } - Physics.componentName = 'Physics'; - - class BodiesFactory { - constructor() { - this.Bodies = Matter.Bodies; - } - create(component) { - let body = null; - const { gameObject, bodyParams } = component; - const coordinate = this.getCoordinate(gameObject); - const x = bodyParams.position ? bodyParams.position.x : coordinate.x; - const y = bodyParams.position ? bodyParams.position.y : coordinate.y; - switch (bodyParams.type) { - case exports.PhysicsType.RECTANGLE: { - const width = gameObject.transform.size.width * gameObject.transform.scale.x; - const height = gameObject.transform.size.height * gameObject.transform.scale.y; - body = this.Bodies.rectangle(x, y, width, height, bodyParams.bodyOptions); - break; - } - case exports.PhysicsType.CIRCLE: { - body = this.Bodies.circle(x, y, bodyParams.radius, bodyParams.bodyOptions); - break; - } - case exports.PhysicsType.POLYGON: { - body = this.Bodies.polygon(x, y, bodyParams.sides, bodyParams.radius, bodyParams.bodyOptions); - break; - } - } - return body; - } - getCoordinate(gameObject) { - const x = gameObject.transform.position.x + gameObject.transform.anchor.x * gameObject.parent.transform.size.width; - const y = gameObject.transform.position.y + gameObject.transform.anchor.y * gameObject.parent.transform.size.height; - return { - x, - y, - }; - } - } - - class PhysicsEngine { - constructor(game, options) { - this.enabled = false; - this.Engine = Matter.Engine; - this.World = Matter.World; - this.bodiesFatoty = new BodiesFactory(); - this.Render = Matter.Render; - this.Runner = Matter.Runner; - this.Constraint = Matter.Constraint; - this.game = game; - this.collisionEvents = ['collisionStart', 'collisionActive', 'collisionEnd']; - this.bodyEvents = ['tick', 'beforeUpdate', 'afterUpdate', 'beforeRender', 'afterRender', 'afterTick']; - this.options = options; - } - start() { - this.engine = this.Engine.create(); - const world = this.World.create(this.options.world); - this.engine.world = world; - this.runner = this.Runner.create({ - fps: this.options.fps || 70, - }); - if (this.options.isTest) { - const render = this.Render.create({ - element: this.options.element, - engine: this.engine, - options: { - width: this.game.canvas.width / this.options.resolution, - height: this.game.canvas.height / this.options.resolution, - pixelRatio: this.options.resolution, - showAngleIndicator: true, - }, - }); - this.Render.run(render); - this.Runner.run(this.runner, this.engine); - } - this.enabled = true; - this.initMouse(); - this.initCollisionEvents(); - this.initBodyEvents(); - } - update() { - if (!this.options.isTest) { - this.Runner.tick(this.runner, this.engine); - } - } - stop() { - this.enabled = false; - this.runner.enabled = false; - } - awake() { - this.enabled = true; - this.runner.enabled = true; - } - add(component) { - const body = this.createBodies(component); - this.World.add(this.engine.world, [body]); - component.body = body; - component.Body = Matter.Body; - component.PhysicsEngine = this.engine; - component.Constraint = this.Constraint; - component.mouseConstraint = this.mouseConstraint; - component.World = this.World; - body.component = component; - } - createBodies(params) { - const body = this.bodiesFatoty.create(params); - return body; - } - initCollisionEvents() { - this.collisionEvents.forEach(eventName => { - Matter.Events.on(this.engine, eventName, event => { - const pairs = event.pairs || []; - for (let i = 0; i < pairs.length; i++) { - const pair = pairs[i]; - const { bodyA, bodyB } = pair; - const componentA = bodyA.component; - const componentB = bodyB.component; - componentA.emit(eventName, componentB.gameObject, componentA.gameObject); - componentB.emit(eventName, componentA.gameObject, componentB.gameObject); - } - }); - }); - } - initMouse() { - if (this.options.mouse && this.options.mouse.open) { - const mouse = Matter.Mouse.create(this.game.canvas); - this.mouseConstraint = Matter.MouseConstraint.create(this.engine, { - mouse: mouse, - constraint: this.options.mouse.constraint, - }); - this.World.add(this.engine.world, this.mouseConstraint); - } - } - initBodyEvents() { - this.bodyEvents.forEach(eventName => { - Matter.Events.on(this.engine, eventName, e => { - const bodies = e.source.world.bodies; - bodies.forEach(body => { - body.component.emit(eventName, body, body.component.gameObject); - }); - }); - }); - } - } - - let PhysicsSystem = class PhysicsSystem extends eva_js.System { - init(param) { - this.engine = new PhysicsEngine(this.game, param); - this.game.canvas.setAttribute('data-pixel-ratio', param.resolution || '1'); - } - awake() { } - start() { - this.engine.start(); - } - update() { - const changes = this.componentObserver.clear(); - for (const changed of changes) { - if (changed && changed.componentName === 'Physics') { - this.componentChanged(changed); - } - } - this.engine.update(); - } - componentChanged(changed) { - switch (changed.type) { - case eva_js.OBSERVER_TYPE.ADD: { - this.engine.add(changed.component); - break; - } - case eva_js.OBSERVER_TYPE.CHANGE: { - break; - } - case eva_js.OBSERVER_TYPE.REMOVE: { - break; - } - } - } - lateUpdate() { } - onResume() { - if (!this.engine.enabled) { - this.engine.awake(); - } - } - onPause() { - this.engine.stop(); - } - onDestroy() { } - }; - PhysicsSystem.systemName = 'PhysicsSystem'; - PhysicsSystem = __decorate([ - eva_js.decorators.componentObserver({ - Physics: [{ prop: ['bodyParams'], deep: true }], - }) - ], PhysicsSystem); - var PhysicsSystem$1 = PhysicsSystem; - - exports.Physics = Physics; - exports.PhysicsSystem = PhysicsSystem$1; - - Object.defineProperty(exports, '__esModule', { value: true }); - -}))); diff --git a/dist/cdn/EVA.plugin.renderer.ninePatch.js b/dist/cdn/EVA.plugin.renderer.ninePatch.js deleted file mode 100644 index 8c064dd5..00000000 --- a/dist/cdn/EVA.plugin.renderer.ninePatch.js +++ /dev/null @@ -1,166 +0,0 @@ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@eva/eva.js'), require('@eva/plugin-renderer'), require('@eva/renderer-adapter')) : - typeof define === 'function' && define.amd ? define(['exports', '@eva/eva.js', '@eva/plugin-renderer', '@eva/renderer-adapter'], factory) : - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.EVA = global.EVA || {}, global.EVA.plugin = global.EVA.plugin || {}, global.EVA.plugin.renderer = global.EVA.plugin.renderer || {}, global.EVA.plugin.renderer.ninePatch = {}), global.EVA, global.EVA.plugin.renderer, global.EVA.rendererAdapter)); -}(this, (function (exports, eva_js, pluginRenderer, rendererAdapter) { 'use strict'; - - /*! ***************************************************************************** - Copyright (c) Microsoft Corporation. - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. - ***************************************************************************** */ - - function __decorate(decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; - } - - function __awaiter(thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - } - - class NinePatch$2 extends eva_js.Component { - constructor() { - super(...arguments); - this.resource = ''; - this.spriteName = ''; - this.leftWidth = 0; - this.topHeight = 0; - this.rightWidth = 0; - this.bottomHeight = 0; - } - init(obj) { - this.resource = obj.resource; - this.spriteName = obj.spriteName; - this.leftWidth = obj.leftWidth; - this.topHeight = obj.topHeight; - this.rightWidth = obj.rightWidth; - this.bottomHeight = obj.bottomHeight; - } - } - NinePatch$2.componentName = 'NinePatch'; - __decorate([ - eva_js.decorators.IDEProp - ], NinePatch$2.prototype, "resource", void 0); - __decorate([ - eva_js.decorators.IDEProp - ], NinePatch$2.prototype, "spriteName", void 0); - __decorate([ - eva_js.decorators.IDEProp - ], NinePatch$2.prototype, "leftWidth", void 0); - __decorate([ - eva_js.decorators.IDEProp - ], NinePatch$2.prototype, "topHeight", void 0); - __decorate([ - eva_js.decorators.IDEProp - ], NinePatch$2.prototype, "rightWidth", void 0); - __decorate([ - eva_js.decorators.IDEProp - ], NinePatch$2.prototype, "bottomHeight", void 0); - - const resourceKeySplit = '_s|r|c_'; - let NinePatch = class NinePatch extends pluginRenderer.Renderer { - constructor() { - super(...arguments); - this.name = 'NinePatch'; - this.ninePatch = {}; - } - init() { - this.renderSystem = this.game.getSystem(pluginRenderer.RendererSystem); - this.renderSystem.rendererManager.register(this); - } - rendererUpdate(gameObject) { - const { width, height } = gameObject.transform.size; - if (this.ninePatch[gameObject.id]) { - this.ninePatch[gameObject.id].width = width; - this.ninePatch[gameObject.id].height = height; - } - } - componentChanged(changed) { - return __awaiter(this, void 0, void 0, function* () { - if (changed.componentName === 'NinePatch') { - if (changed.type === eva_js.OBSERVER_TYPE.ADD) { - this.add(changed); - } - else if (changed.type === eva_js.OBSERVER_TYPE.REMOVE) { - this.remove(changed); - } - else { - this.remove(changed); - this.add(changed); - } - } - }); - } - add(changed) { - return __awaiter(this, void 0, void 0, function* () { - const component = changed.component; - const { type, data } = yield eva_js.resource.getResource(component.resource); - if (!data) { - throw new Error(`GameObject:${changed.gameObject.name}'s NinePatch resource load error`); - } - let img; - if (type === eva_js.RESOURCE_TYPE.SPRITE) { - img = component.resource + resourceKeySplit + component.spriteName; - } - else { - img = data.image; - } - const { leftWidth, topHeight, rightWidth, bottomHeight } = component; - const np = new rendererAdapter.NinePatch(img, leftWidth, topHeight, rightWidth, bottomHeight); - this.ninePatch[changed.gameObject.id] = np; - component.ninePatch = np; - this.containerManager - .getContainer(changed.gameObject.id) - .addChildAt(np, 0); - }); - } - remove(changed) { - const sprite = this.ninePatch[changed.gameObject.id]; - if (sprite) { - this.containerManager - .getContainer(changed.gameObject.id) - .removeChild(sprite); - delete this.ninePatch[changed.gameObject.id]; - sprite.destroy(true); - } - } - }; - NinePatch.systemName = 'NinePatch'; - NinePatch = __decorate([ - eva_js.decorators.componentObserver({ - NinePatch: [ - 'resource', - 'spriteName', - 'leftWidth', - 'topHeight', - 'rightWidth', - 'bottomHeight', - ], - }) - ], NinePatch); - var NinePatch$1 = NinePatch; - - exports.NinePatch = NinePatch$2; - exports.NinePatchSystem = NinePatch$1; - - Object.defineProperty(exports, '__esModule', { value: true }); - -}))); diff --git a/dist/cdn/EVA.plugin.renderer.render.js b/dist/cdn/EVA.plugin.renderer.render.js deleted file mode 100644 index 02b76953..00000000 --- a/dist/cdn/EVA.plugin.renderer.render.js +++ /dev/null @@ -1,144 +0,0 @@ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@eva/eva.js'), require('@eva/plugin-renderer')) : - typeof define === 'function' && define.amd ? define(['exports', '@eva/eva.js', '@eva/plugin-renderer'], factory) : - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.EVA = global.EVA || {}, global.EVA.plugin = global.EVA.plugin || {}, global.EVA.plugin.renderer = global.EVA.plugin.renderer || {}, global.EVA.plugin.renderer.render = {}), global.EVA, global.EVA.plugin.renderer)); -}(this, (function (exports, eva_js, pluginRenderer) { 'use strict'; - - /*! ***************************************************************************** - Copyright (c) Microsoft Corporation. - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. - ***************************************************************************** */ - - function __decorate(decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; - } - - class Render$2 extends eva_js.Component { - constructor() { - super(...arguments); - this.sortDirty = false; - this.visible = true; - this.alpha = 1; - this.zIndex = 0; - this.sortableChildren = false; - } - init(obj) { - obj && Object.assign(this, obj); - } - } - Render$2.componentName = 'Render'; - __decorate([ - eva_js.decorators.IDEProp - ], Render$2.prototype, "visible", void 0); - __decorate([ - eva_js.decorators.IDEProp - ], Render$2.prototype, "alpha", void 0); - __decorate([ - eva_js.decorators.IDEProp - ], Render$2.prototype, "zIndex", void 0); - __decorate([ - eva_js.decorators.IDEProp - ], Render$2.prototype, "sortableChildren", void 0); - - let Render = class Render extends pluginRenderer.Renderer { - constructor() { - super(...arguments); - this.name = 'Render'; - } - init() { - this.renderSystem = this.game.getSystem(pluginRenderer.RendererSystem); - this.renderSystem.rendererManager.register(this); - } - rendererUpdate(gameObject) { - const component = gameObject.getComponent('Render'); - const container = this.containerManager.getContainer(gameObject.id); - container.alpha = component.alpha; - container.visible = component.visible; - if (component.sortDirty && component.sortableChildren) { - const gameObjects = gameObject.transform.children.map(({ gameObject }) => gameObject); - const children = gameObjects - .sort((a, b) => { - const aRender = a.getComponent('Render'); - const bRender = b.getComponent('Render'); - if (!aRender) { - return -1; - } - if (!bRender) { - return 1; - } - return aRender.zIndex - bRender.zIndex; - }) - .map(gameObject => { - return this.containerManager.getContainer(gameObject.id); - }); - const oldChildren = this.containerManager.getContainer(component.gameObject.id).children; - const elements = oldChildren.filter(c => children.indexOf(c) === -1); - oldChildren.length = 0; - oldChildren.push(...elements, ...children); - component.sortDirty = false; - } - } - componentChanged(changed) { - if (changed.type === eva_js.OBSERVER_TYPE.ADD || - changed.type === eva_js.OBSERVER_TYPE.REMOVE) { - this.add(changed); - } - if (changed.type === eva_js.OBSERVER_TYPE.CHANGE) { - this.change(changed); - } - if (changed.type === eva_js.OBSERVER_TYPE.REMOVE) { - this.remove(changed); - } - } - add(changed) { - if (changed.component.name === 'Render') { - this.setDirty(changed); - } - } - change(changed) { - if (changed.component.name === 'Render' && - changed.prop.prop[0] === 'zIndex') { - this.setDirty(changed); - } - } - remove(changed) { - if (changed.component.name === 'Render') { - const container = this.containerManager.getContainer(changed.gameObject.id); - container.alpha = 1; - } - } - setDirty(changed) { - const parentRender = changed.gameObject.parent && - changed.gameObject.parent.getComponent('Render'); - if (parentRender) { - parentRender.sortDirty = true; - } - } - }; - Render.systemName = 'Render'; - Render = __decorate([ - eva_js.decorators.componentObserver({ - Render: ['zIndex'], - }) - ], Render); - var Render$1 = Render; - - exports.Render = Render$2; - exports.RenderSystem = Render$1; - - Object.defineProperty(exports, '__esModule', { value: true }); - -}))); diff --git a/dist/cdn/EVA.plugin.renderer.spine.js b/dist/cdn/EVA.plugin.renderer.spine.js deleted file mode 100644 index cd7f2ec5..00000000 --- a/dist/cdn/EVA.plugin.renderer.spine.js +++ /dev/null @@ -1,9494 +0,0 @@ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@eva/eva.js'), require('@eva/plugin-renderer'), require('pixi.js')) : - typeof define === 'function' && define.amd ? define(['exports', '@eva/eva.js', '@eva/plugin-renderer', 'pixi.js'], factory) : - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.EVA = global.EVA || {}, global.EVA.plugin = global.EVA.plugin || {}, global.EVA.plugin.renderer = global.EVA.plugin.renderer || {}, global.EVA.plugin.renderer.spine = {}), global.EVA, global.EVA.plugin.renderer, global.PIXI)); -}(this, (function (exports, eva_js, pluginRenderer, pixi_js) { 'use strict'; - - /*! ***************************************************************************** - Copyright (c) Microsoft Corporation. - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. - ***************************************************************************** */ - - function __decorate(decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; - } - - function __awaiter(thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - } - - class Spine extends eva_js.Component { - constructor() { - super(...arguments); - this.resource = ''; - this.animationName = ''; - this.autoPlay = true; - } - init(obj) { - if (!obj) - return; - Object.assign(this, obj); - if (this.autoPlay) { - this.play(this.animationName); - } - } - onDestroy() { - this.destroied = true; - } - play(name, loop, track) { - try { - if (name) - this.animationName = name; - if (!this.armature) { - } - else { - if (track === undefined) { - track = 0; - } - this.armature.state.setAnimation(track, this.animationName, loop); - } - } - catch (e) { - console.log(e); - } - } - stop(track) { - if (!this.armature) { - return; - } - if (track === undefined) { - track = 0; - } - this.armature.state.setEmptyAnimation(track, 0); - } - addAnimation(name, delay, loop, track) { - try { - if (!this.armature) { - } - else { - if (track === undefined) { - track = 0; - } - this.armature.state.addAnimation(track, name, loop, delay); - } - } - catch (e) { - console.log(e); - } - } - setMix(from, to, duration) { - if (!this.armature) ; - else { - this.armature.stateData.setMix(from, to, duration); - } - } - getAnim(track = 0) { - try { - if (!this.armature) { - } - else { - return this.armature.state.tracks[track].animation.name; - } - } - catch (e) { - console.log(e); - } - } - setDefaultMix(duration) { - if (!this.armature) ; - else { - this.armature.stateData.defaultMix = duration; - } - } - setAttachment(slotName, attachmentName) { - if (!this.armature) { - return; - } - this.armature.skeleton.setAttachment(slotName, attachmentName); - } - getBone(boneName) { - if (!this.armature) { - return; - } - return this.armature.skeleton.findBone(boneName); - } - } - Spine.componentName = 'Spine'; - __decorate([ - eva_js.decorators.IDEProp - ], Spine.prototype, "resource", void 0); - __decorate([ - eva_js.decorators.IDEProp - ], Spine.prototype, "animationName", void 0); - __decorate([ - eva_js.decorators.IDEProp - ], Spine.prototype, "autoPlay", void 0); - - const VERSION = '4.8.9'; - const loader = pixi_js.loaders.shared; - - const PIXI = { - Texture: pixi_js.Texture, - Rectangle: pixi_js.Rectangle, - Sprite: pixi_js.Sprite, - Graphics: pixi_js.Graphics, - mesh: pixi_js.mesh, - Matrix: pixi_js.Matrix, - Container: pixi_js.Container, - VERSION, - loaders: pixi_js.loaders, - loader, - SCALE_MODES: pixi_js.SCALE_MODES, - utils: pixi_js.utils, - TransformBase: pixi_js.TransformBase, - TransformStatic: pixi_js.TransformStatic, - DisplayObject: pixi_js.DisplayObject, - Polygon: pixi_js.Polygon, - BaseTexture: pixi_js.BaseTexture, - }; - var __extends = - (undefined && undefined.__extends) || - (function() { - var extendStatics = - Object.setPrototypeOf || - ({__proto__: []} instanceof Array && - function(d, b) { - d.__proto__ = b; - }) || - function(d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - }; - return function(d, b) { - extendStatics(d, b); - function __() { - this.constructor = d; - } - d.prototype = - b === null - ? Object.create(b) - : ((__.prototype = b.prototype), new __()); - }; - })(); - var pixi_spine; - (function(pixi_spine) { - (function(core) { - var Animation = (function() { - function Animation(name, timelines, duration) { - if (name == null) throw new Error('name cannot be null.'); - if (timelines == null) throw new Error('timelines cannot be null.'); - this.name = name; - this.timelines = timelines; - this.duration = duration; - } - Animation.prototype.apply = function( - skeleton, - lastTime, - time, - loop, - events, - alpha, - blend, - direction, - ) { - if (skeleton == null) throw new Error('skeleton cannot be null.'); - if (loop && this.duration != 0) { - time %= this.duration; - if (lastTime > 0) lastTime %= this.duration; - } - var timelines = this.timelines; - for (var i = 0, n = timelines.length; i < n; i++) - timelines[i].apply( - skeleton, - lastTime, - time, - events, - alpha, - blend, - direction, - ); - }; - Animation.binarySearch = function(values, target, step) { - if (step === void 0) { - step = 1; - } - var low = 0; - var high = values.length / step - 2; - if (high == 0) return step; - var current = high >>> 1; - while (true) { - if (values[(current + 1) * step] <= target) low = current + 1; - else high = current; - if (low == high) return (low + 1) * step; - current = (low + high) >>> 1; - } - }; - Animation.linearSearch = function(values, target, step) { - for (var i = 0, last = values.length - step; i <= last; i += step) - if (values[i] > target) return i; - return -1; - }; - return Animation; - })(); - core.Animation = Animation; - var MixBlend; - (function(MixBlend) { - MixBlend[(MixBlend['setup'] = 0)] = 'setup'; - MixBlend[(MixBlend['first'] = 1)] = 'first'; - MixBlend[(MixBlend['replace'] = 2)] = 'replace'; - MixBlend[(MixBlend['add'] = 3)] = 'add'; - })((MixBlend = core.MixBlend || (core.MixBlend = {}))); - var MixDirection; - (function(MixDirection) { - MixDirection[(MixDirection['in'] = 0)] = 'in'; - MixDirection[(MixDirection['out'] = 1)] = 'out'; - })((MixDirection = core.MixDirection || (core.MixDirection = {}))); - var TimelineType; - (function(TimelineType) { - TimelineType[(TimelineType['rotate'] = 0)] = 'rotate'; - TimelineType[(TimelineType['translate'] = 1)] = 'translate'; - TimelineType[(TimelineType['scale'] = 2)] = 'scale'; - TimelineType[(TimelineType['shear'] = 3)] = 'shear'; - TimelineType[(TimelineType['attachment'] = 4)] = 'attachment'; - TimelineType[(TimelineType['color'] = 5)] = 'color'; - TimelineType[(TimelineType['deform'] = 6)] = 'deform'; - TimelineType[(TimelineType['event'] = 7)] = 'event'; - TimelineType[(TimelineType['drawOrder'] = 8)] = 'drawOrder'; - TimelineType[(TimelineType['ikConstraint'] = 9)] = 'ikConstraint'; - TimelineType[(TimelineType['transformConstraint'] = 10)] = - 'transformConstraint'; - TimelineType[(TimelineType['pathConstraintPosition'] = 11)] = - 'pathConstraintPosition'; - TimelineType[(TimelineType['pathConstraintSpacing'] = 12)] = - 'pathConstraintSpacing'; - TimelineType[(TimelineType['pathConstraintMix'] = 13)] = - 'pathConstraintMix'; - TimelineType[(TimelineType['twoColor'] = 14)] = 'twoColor'; - })((TimelineType = core.TimelineType || (core.TimelineType = {}))); - var CurveTimeline = (function() { - function CurveTimeline(frameCount) { - if (frameCount <= 0) - throw new Error('frameCount must be > 0: ' + frameCount); - this.curves = core.Utils.newFloatArray( - (frameCount - 1) * CurveTimeline.BEZIER_SIZE, - ); - } - CurveTimeline.prototype.getFrameCount = function() { - return this.curves.length / CurveTimeline.BEZIER_SIZE + 1; - }; - CurveTimeline.prototype.setLinear = function(frameIndex) { - this.curves[frameIndex * CurveTimeline.BEZIER_SIZE] = - CurveTimeline.LINEAR; - }; - CurveTimeline.prototype.setStepped = function(frameIndex) { - this.curves[frameIndex * CurveTimeline.BEZIER_SIZE] = - CurveTimeline.STEPPED; - }; - CurveTimeline.prototype.getCurveType = function(frameIndex) { - var index = frameIndex * CurveTimeline.BEZIER_SIZE; - if (index == this.curves.length) return CurveTimeline.LINEAR; - var type = this.curves[index]; - if (type == CurveTimeline.LINEAR) return CurveTimeline.LINEAR; - if (type == CurveTimeline.STEPPED) return CurveTimeline.STEPPED; - return CurveTimeline.BEZIER; - }; - CurveTimeline.prototype.setCurve = function( - frameIndex, - cx1, - cy1, - cx2, - cy2, - ) { - var tmpx = (-cx1 * 2 + cx2) * 0.03, - tmpy = (-cy1 * 2 + cy2) * 0.03; - var dddfx = ((cx1 - cx2) * 3 + 1) * 0.006, - dddfy = ((cy1 - cy2) * 3 + 1) * 0.006; - var ddfx = tmpx * 2 + dddfx, - ddfy = tmpy * 2 + dddfy; - var dfx = cx1 * 0.3 + tmpx + dddfx * 0.16666667, - dfy = cy1 * 0.3 + tmpy + dddfy * 0.16666667; - var i = frameIndex * CurveTimeline.BEZIER_SIZE; - var curves = this.curves; - curves[i++] = CurveTimeline.BEZIER; - var x = dfx, - y = dfy; - for (var n = i + CurveTimeline.BEZIER_SIZE - 1; i < n; i += 2) { - curves[i] = x; - curves[i + 1] = y; - dfx += ddfx; - dfy += ddfy; - ddfx += dddfx; - ddfy += dddfy; - x += dfx; - y += dfy; - } - }; - CurveTimeline.prototype.getCurvePercent = function(frameIndex, percent) { - percent = core.MathUtils.clamp(percent, 0, 1); - var curves = this.curves; - var i = frameIndex * CurveTimeline.BEZIER_SIZE; - var type = curves[i]; - if (type == CurveTimeline.LINEAR) return percent; - if (type == CurveTimeline.STEPPED) return 0; - i++; - var x = 0; - for ( - var start = i, n = i + CurveTimeline.BEZIER_SIZE - 1; - i < n; - i += 2 - ) { - x = curves[i]; - if (x >= percent) { - var prevX = void 0, - prevY = void 0; - if (i == start) { - prevX = 0; - prevY = 0; - } else { - prevX = curves[i - 2]; - prevY = curves[i - 1]; - } - return ( - prevY + - ((curves[i + 1] - prevY) * (percent - prevX)) / (x - prevX) - ); - } - } - var y = curves[i - 1]; - return y + ((1 - y) * (percent - x)) / (1 - x); - }; - CurveTimeline.LINEAR = 0; - CurveTimeline.STEPPED = 1; - CurveTimeline.BEZIER = 2; - CurveTimeline.BEZIER_SIZE = 10 * 2 - 1; - return CurveTimeline; - })(); - core.CurveTimeline = CurveTimeline; - var RotateTimeline = (function(_super) { - __extends(RotateTimeline, _super); - function RotateTimeline(frameCount) { - var _this = _super.call(this, frameCount) || this; - _this.frames = core.Utils.newFloatArray(frameCount << 1); - return _this; - } - RotateTimeline.prototype.getPropertyId = function() { - return (TimelineType.rotate << 24) + this.boneIndex; - }; - RotateTimeline.prototype.setFrame = function(frameIndex, time, degrees) { - frameIndex <<= 1; - this.frames[frameIndex] = time; - this.frames[frameIndex + RotateTimeline.ROTATION] = degrees; - }; - RotateTimeline.prototype.apply = function( - skeleton, - lastTime, - time, - events, - alpha, - blend, - direction, - ) { - var frames = this.frames; - var bone = skeleton.bones[this.boneIndex]; - if (time < frames[0]) { - switch (blend) { - case MixBlend.setup: - bone.rotation = bone.data.rotation; - return; - case MixBlend.first: - var r_1 = bone.data.rotation - bone.rotation; - bone.rotation += - (r_1 - (16384 - ((16384.499999999996 - r_1 / 360) | 0)) * 360) * - alpha; - } - return; - } - if (time >= frames[frames.length - RotateTimeline.ENTRIES]) { - var r_2 = frames[frames.length + RotateTimeline.PREV_ROTATION]; - switch (blend) { - case MixBlend.setup: - bone.rotation = bone.data.rotation + r_2 * alpha; - break; - case MixBlend.first: - case MixBlend.replace: - r_2 += bone.data.rotation - bone.rotation; - r_2 -= (16384 - ((16384.499999999996 - r_2 / 360) | 0)) * 360; - case MixBlend.add: - bone.rotation += r_2 * alpha; - } - return; - } - var frame = Animation.binarySearch( - frames, - time, - RotateTimeline.ENTRIES, - ); - var prevRotation = frames[frame + RotateTimeline.PREV_ROTATION]; - var frameTime = frames[frame]; - var percent = this.getCurvePercent( - (frame >> 1) - 1, - 1 - - (time - frameTime) / - (frames[frame + RotateTimeline.PREV_TIME] - frameTime), - ); - var r = frames[frame + RotateTimeline.ROTATION] - prevRotation; - r = - prevRotation + - (r - (16384 - ((16384.499999999996 - r / 360) | 0)) * 360) * percent; - switch (blend) { - case MixBlend.setup: - bone.rotation = - bone.data.rotation + - (r - (16384 - ((16384.499999999996 - r / 360) | 0)) * 360) * - alpha; - break; - case MixBlend.first: - case MixBlend.replace: - r += bone.data.rotation - bone.rotation; - case MixBlend.add: - bone.rotation += - (r - (16384 - ((16384.499999999996 - r / 360) | 0)) * 360) * - alpha; - } - }; - RotateTimeline.ENTRIES = 2; - RotateTimeline.PREV_TIME = -2; - RotateTimeline.PREV_ROTATION = -1; - RotateTimeline.ROTATION = 1; - return RotateTimeline; - })(CurveTimeline); - core.RotateTimeline = RotateTimeline; - var TranslateTimeline = (function(_super) { - __extends(TranslateTimeline, _super); - function TranslateTimeline(frameCount) { - var _this = _super.call(this, frameCount) || this; - _this.frames = core.Utils.newFloatArray( - frameCount * TranslateTimeline.ENTRIES, - ); - return _this; - } - TranslateTimeline.prototype.getPropertyId = function() { - return (TimelineType.translate << 24) + this.boneIndex; - }; - TranslateTimeline.prototype.setFrame = function(frameIndex, time, x, y) { - frameIndex *= TranslateTimeline.ENTRIES; - this.frames[frameIndex] = time; - this.frames[frameIndex + TranslateTimeline.X] = x; - this.frames[frameIndex + TranslateTimeline.Y] = y; - }; - TranslateTimeline.prototype.apply = function( - skeleton, - lastTime, - time, - events, - alpha, - blend, - direction, - ) { - var frames = this.frames; - var bone = skeleton.bones[this.boneIndex]; - if (time < frames[0]) { - switch (blend) { - case MixBlend.setup: - bone.x = bone.data.x; - bone.y = bone.data.y; - return; - case MixBlend.first: - bone.x += (bone.data.x - bone.x) * alpha; - bone.y += (bone.data.y - bone.y) * alpha; - } - return; - } - var x = 0, - y = 0; - if (time >= frames[frames.length - TranslateTimeline.ENTRIES]) { - x = frames[frames.length + TranslateTimeline.PREV_X]; - y = frames[frames.length + TranslateTimeline.PREV_Y]; - } else { - var frame = Animation.binarySearch( - frames, - time, - TranslateTimeline.ENTRIES, - ); - x = frames[frame + TranslateTimeline.PREV_X]; - y = frames[frame + TranslateTimeline.PREV_Y]; - var frameTime = frames[frame]; - var percent = this.getCurvePercent( - frame / TranslateTimeline.ENTRIES - 1, - 1 - - (time - frameTime) / - (frames[frame + TranslateTimeline.PREV_TIME] - frameTime), - ); - x += (frames[frame + TranslateTimeline.X] - x) * percent; - y += (frames[frame + TranslateTimeline.Y] - y) * percent; - } - switch (blend) { - case MixBlend.setup: - bone.x = bone.data.x + x * alpha; - bone.y = bone.data.y + y * alpha; - break; - case MixBlend.first: - case MixBlend.replace: - bone.x += (bone.data.x + x - bone.x) * alpha; - bone.y += (bone.data.y + y - bone.y) * alpha; - break; - case MixBlend.add: - bone.x += x * alpha; - bone.y += y * alpha; - } - }; - TranslateTimeline.ENTRIES = 3; - TranslateTimeline.PREV_TIME = -3; - TranslateTimeline.PREV_X = -2; - TranslateTimeline.PREV_Y = -1; - TranslateTimeline.X = 1; - TranslateTimeline.Y = 2; - return TranslateTimeline; - })(CurveTimeline); - core.TranslateTimeline = TranslateTimeline; - var ScaleTimeline = (function(_super) { - __extends(ScaleTimeline, _super); - function ScaleTimeline(frameCount) { - return _super.call(this, frameCount) || this; - } - ScaleTimeline.prototype.getPropertyId = function() { - return (TimelineType.scale << 24) + this.boneIndex; - }; - ScaleTimeline.prototype.apply = function( - skeleton, - lastTime, - time, - events, - alpha, - blend, - direction, - ) { - var frames = this.frames; - var bone = skeleton.bones[this.boneIndex]; - if (time < frames[0]) { - switch (blend) { - case MixBlend.setup: - bone.scaleX = bone.data.scaleX; - bone.scaleY = bone.data.scaleY; - return; - case MixBlend.first: - bone.scaleX += (bone.data.scaleX - bone.scaleX) * alpha; - bone.scaleY += (bone.data.scaleY - bone.scaleY) * alpha; - } - return; - } - var x = 0, - y = 0; - if (time >= frames[frames.length - ScaleTimeline.ENTRIES]) { - x = frames[frames.length + ScaleTimeline.PREV_X] * bone.data.scaleX; - y = frames[frames.length + ScaleTimeline.PREV_Y] * bone.data.scaleY; - } else { - var frame = Animation.binarySearch( - frames, - time, - ScaleTimeline.ENTRIES, - ); - x = frames[frame + ScaleTimeline.PREV_X]; - y = frames[frame + ScaleTimeline.PREV_Y]; - var frameTime = frames[frame]; - var percent = this.getCurvePercent( - frame / ScaleTimeline.ENTRIES - 1, - 1 - - (time - frameTime) / - (frames[frame + ScaleTimeline.PREV_TIME] - frameTime), - ); - x = - (x + (frames[frame + ScaleTimeline.X] - x) * percent) * - bone.data.scaleX; - y = - (y + (frames[frame + ScaleTimeline.Y] - y) * percent) * - bone.data.scaleY; - } - if (alpha == 1) { - if (blend == MixBlend.add) { - bone.scaleX += x - bone.data.scaleX; - bone.scaleY += y - bone.data.scaleY; - } else { - bone.scaleX = x; - bone.scaleY = y; - } - } else { - var bx = 0, - by = 0; - if (direction == MixDirection.out) { - switch (blend) { - case MixBlend.setup: - bx = bone.data.scaleX; - by = bone.data.scaleY; - bone.scaleX = - bx + (Math.abs(x) * core.MathUtils.signum(bx) - bx) * alpha; - bone.scaleY = - by + (Math.abs(y) * core.MathUtils.signum(by) - by) * alpha; - break; - case MixBlend.first: - case MixBlend.replace: - bx = bone.scaleX; - by = bone.scaleY; - bone.scaleX = - bx + (Math.abs(x) * core.MathUtils.signum(bx) - bx) * alpha; - bone.scaleY = - by + (Math.abs(y) * core.MathUtils.signum(by) - by) * alpha; - break; - case MixBlend.add: - bx = bone.scaleX; - by = bone.scaleY; - bone.scaleX = - bx + - (Math.abs(x) * core.MathUtils.signum(bx) - bone.data.scaleX) * - alpha; - bone.scaleY = - by + - (Math.abs(y) * core.MathUtils.signum(by) - bone.data.scaleY) * - alpha; - } - } else { - switch (blend) { - case MixBlend.setup: - bx = Math.abs(bone.data.scaleX) * core.MathUtils.signum(x); - by = Math.abs(bone.data.scaleY) * core.MathUtils.signum(y); - bone.scaleX = bx + (x - bx) * alpha; - bone.scaleY = by + (y - by) * alpha; - break; - case MixBlend.first: - case MixBlend.replace: - bx = Math.abs(bone.scaleX) * core.MathUtils.signum(x); - by = Math.abs(bone.scaleY) * core.MathUtils.signum(y); - bone.scaleX = bx + (x - bx) * alpha; - bone.scaleY = by + (y - by) * alpha; - break; - case MixBlend.add: - bx = core.MathUtils.signum(x); - by = core.MathUtils.signum(y); - bone.scaleX = - Math.abs(bone.scaleX) * bx + - (x - Math.abs(bone.data.scaleX) * bx) * alpha; - bone.scaleY = - Math.abs(bone.scaleY) * by + - (y - Math.abs(bone.data.scaleY) * by) * alpha; - } - } - } - }; - return ScaleTimeline; - })(TranslateTimeline); - core.ScaleTimeline = ScaleTimeline; - var ShearTimeline = (function(_super) { - __extends(ShearTimeline, _super); - function ShearTimeline(frameCount) { - return _super.call(this, frameCount) || this; - } - ShearTimeline.prototype.getPropertyId = function() { - return (TimelineType.shear << 24) + this.boneIndex; - }; - ShearTimeline.prototype.apply = function( - skeleton, - lastTime, - time, - events, - alpha, - blend, - direction, - ) { - var frames = this.frames; - var bone = skeleton.bones[this.boneIndex]; - if (time < frames[0]) { - switch (blend) { - case MixBlend.setup: - bone.shearX = bone.data.shearX; - bone.shearY = bone.data.shearY; - return; - case MixBlend.first: - bone.shearX += (bone.data.shearX - bone.shearX) * alpha; - bone.shearY += (bone.data.shearY - bone.shearY) * alpha; - } - return; - } - var x = 0, - y = 0; - if (time >= frames[frames.length - ShearTimeline.ENTRIES]) { - x = frames[frames.length + ShearTimeline.PREV_X]; - y = frames[frames.length + ShearTimeline.PREV_Y]; - } else { - var frame = Animation.binarySearch( - frames, - time, - ShearTimeline.ENTRIES, - ); - x = frames[frame + ShearTimeline.PREV_X]; - y = frames[frame + ShearTimeline.PREV_Y]; - var frameTime = frames[frame]; - var percent = this.getCurvePercent( - frame / ShearTimeline.ENTRIES - 1, - 1 - - (time - frameTime) / - (frames[frame + ShearTimeline.PREV_TIME] - frameTime), - ); - x = x + (frames[frame + ShearTimeline.X] - x) * percent; - y = y + (frames[frame + ShearTimeline.Y] - y) * percent; - } - switch (blend) { - case MixBlend.setup: - bone.shearX = bone.data.shearX + x * alpha; - bone.shearY = bone.data.shearY + y * alpha; - break; - case MixBlend.first: - case MixBlend.replace: - bone.shearX += (bone.data.shearX + x - bone.shearX) * alpha; - bone.shearY += (bone.data.shearY + y - bone.shearY) * alpha; - break; - case MixBlend.add: - bone.shearX += x * alpha; - bone.shearY += y * alpha; - } - }; - return ShearTimeline; - })(TranslateTimeline); - core.ShearTimeline = ShearTimeline; - var ColorTimeline = (function(_super) { - __extends(ColorTimeline, _super); - function ColorTimeline(frameCount) { - var _this = _super.call(this, frameCount) || this; - _this.frames = core.Utils.newFloatArray( - frameCount * ColorTimeline.ENTRIES, - ); - return _this; - } - ColorTimeline.prototype.getPropertyId = function() { - return (TimelineType.color << 24) + this.slotIndex; - }; - ColorTimeline.prototype.setFrame = function( - frameIndex, - time, - r, - g, - b, - a, - ) { - frameIndex *= ColorTimeline.ENTRIES; - this.frames[frameIndex] = time; - this.frames[frameIndex + ColorTimeline.R] = r; - this.frames[frameIndex + ColorTimeline.G] = g; - this.frames[frameIndex + ColorTimeline.B] = b; - this.frames[frameIndex + ColorTimeline.A] = a; - }; - ColorTimeline.prototype.apply = function( - skeleton, - lastTime, - time, - events, - alpha, - blend, - direction, - ) { - var slot = skeleton.slots[this.slotIndex]; - var frames = this.frames; - if (time < frames[0]) { - switch (blend) { - case MixBlend.setup: - slot.color.setFromColor(slot.data.color); - return; - case MixBlend.first: - var color = slot.color, - setup = slot.data.color; - color.add( - (setup.r - color.r) * alpha, - (setup.g - color.g) * alpha, - (setup.b - color.b) * alpha, - (setup.a - color.a) * alpha, - ); - } - return; - } - var r = 0, - g = 0, - b = 0, - a = 0; - if (time >= frames[frames.length - ColorTimeline.ENTRIES]) { - var i = frames.length; - r = frames[i + ColorTimeline.PREV_R]; - g = frames[i + ColorTimeline.PREV_G]; - b = frames[i + ColorTimeline.PREV_B]; - a = frames[i + ColorTimeline.PREV_A]; - } else { - var frame = Animation.binarySearch( - frames, - time, - ColorTimeline.ENTRIES, - ); - r = frames[frame + ColorTimeline.PREV_R]; - g = frames[frame + ColorTimeline.PREV_G]; - b = frames[frame + ColorTimeline.PREV_B]; - a = frames[frame + ColorTimeline.PREV_A]; - var frameTime = frames[frame]; - var percent = this.getCurvePercent( - frame / ColorTimeline.ENTRIES - 1, - 1 - - (time - frameTime) / - (frames[frame + ColorTimeline.PREV_TIME] - frameTime), - ); - r += (frames[frame + ColorTimeline.R] - r) * percent; - g += (frames[frame + ColorTimeline.G] - g) * percent; - b += (frames[frame + ColorTimeline.B] - b) * percent; - a += (frames[frame + ColorTimeline.A] - a) * percent; - } - if (alpha == 1) slot.color.set(r, g, b, a); - else { - var color = slot.color; - if (blend == MixBlend.setup) color.setFromColor(slot.data.color); - color.add( - (r - color.r) * alpha, - (g - color.g) * alpha, - (b - color.b) * alpha, - (a - color.a) * alpha, - ); - } - }; - ColorTimeline.ENTRIES = 5; - ColorTimeline.PREV_TIME = -5; - ColorTimeline.PREV_R = -4; - ColorTimeline.PREV_G = -3; - ColorTimeline.PREV_B = -2; - ColorTimeline.PREV_A = -1; - ColorTimeline.R = 1; - ColorTimeline.G = 2; - ColorTimeline.B = 3; - ColorTimeline.A = 4; - return ColorTimeline; - })(CurveTimeline); - core.ColorTimeline = ColorTimeline; - var TwoColorTimeline = (function(_super) { - __extends(TwoColorTimeline, _super); - function TwoColorTimeline(frameCount) { - var _this = _super.call(this, frameCount) || this; - _this.frames = core.Utils.newFloatArray( - frameCount * TwoColorTimeline.ENTRIES, - ); - return _this; - } - TwoColorTimeline.prototype.getPropertyId = function() { - return (TimelineType.twoColor << 24) + this.slotIndex; - }; - TwoColorTimeline.prototype.setFrame = function( - frameIndex, - time, - r, - g, - b, - a, - r2, - g2, - b2, - ) { - frameIndex *= TwoColorTimeline.ENTRIES; - this.frames[frameIndex] = time; - this.frames[frameIndex + TwoColorTimeline.R] = r; - this.frames[frameIndex + TwoColorTimeline.G] = g; - this.frames[frameIndex + TwoColorTimeline.B] = b; - this.frames[frameIndex + TwoColorTimeline.A] = a; - this.frames[frameIndex + TwoColorTimeline.R2] = r2; - this.frames[frameIndex + TwoColorTimeline.G2] = g2; - this.frames[frameIndex + TwoColorTimeline.B2] = b2; - }; - TwoColorTimeline.prototype.apply = function( - skeleton, - lastTime, - time, - events, - alpha, - blend, - direction, - ) { - var slot = skeleton.slots[this.slotIndex]; - var frames = this.frames; - if (time < frames[0]) { - switch (blend) { - case MixBlend.setup: - slot.color.setFromColor(slot.data.color); - slot.darkColor.setFromColor(slot.data.darkColor); - return; - case MixBlend.first: - var light = slot.color, - dark = slot.darkColor, - setupLight = slot.data.color, - setupDark = slot.data.darkColor; - light.add( - (setupLight.r - light.r) * alpha, - (setupLight.g - light.g) * alpha, - (setupLight.b - light.b) * alpha, - (setupLight.a - light.a) * alpha, - ); - dark.add( - (setupDark.r - dark.r) * alpha, - (setupDark.g - dark.g) * alpha, - (setupDark.b - dark.b) * alpha, - 0, - ); - } - return; - } - var r = 0, - g = 0, - b = 0, - a = 0, - r2 = 0, - g2 = 0, - b2 = 0; - if (time >= frames[frames.length - TwoColorTimeline.ENTRIES]) { - var i = frames.length; - r = frames[i + TwoColorTimeline.PREV_R]; - g = frames[i + TwoColorTimeline.PREV_G]; - b = frames[i + TwoColorTimeline.PREV_B]; - a = frames[i + TwoColorTimeline.PREV_A]; - r2 = frames[i + TwoColorTimeline.PREV_R2]; - g2 = frames[i + TwoColorTimeline.PREV_G2]; - b2 = frames[i + TwoColorTimeline.PREV_B2]; - } else { - var frame = Animation.binarySearch( - frames, - time, - TwoColorTimeline.ENTRIES, - ); - r = frames[frame + TwoColorTimeline.PREV_R]; - g = frames[frame + TwoColorTimeline.PREV_G]; - b = frames[frame + TwoColorTimeline.PREV_B]; - a = frames[frame + TwoColorTimeline.PREV_A]; - r2 = frames[frame + TwoColorTimeline.PREV_R2]; - g2 = frames[frame + TwoColorTimeline.PREV_G2]; - b2 = frames[frame + TwoColorTimeline.PREV_B2]; - var frameTime = frames[frame]; - var percent = this.getCurvePercent( - frame / TwoColorTimeline.ENTRIES - 1, - 1 - - (time - frameTime) / - (frames[frame + TwoColorTimeline.PREV_TIME] - frameTime), - ); - r += (frames[frame + TwoColorTimeline.R] - r) * percent; - g += (frames[frame + TwoColorTimeline.G] - g) * percent; - b += (frames[frame + TwoColorTimeline.B] - b) * percent; - a += (frames[frame + TwoColorTimeline.A] - a) * percent; - r2 += (frames[frame + TwoColorTimeline.R2] - r2) * percent; - g2 += (frames[frame + TwoColorTimeline.G2] - g2) * percent; - b2 += (frames[frame + TwoColorTimeline.B2] - b2) * percent; - } - if (alpha == 1) { - slot.color.set(r, g, b, a); - slot.darkColor.set(r2, g2, b2, 1); - } else { - var light = slot.color, - dark = slot.darkColor; - if (blend == MixBlend.setup) { - light.setFromColor(slot.data.color); - dark.setFromColor(slot.data.darkColor); - } - light.add( - (r - light.r) * alpha, - (g - light.g) * alpha, - (b - light.b) * alpha, - (a - light.a) * alpha, - ); - dark.add( - (r2 - dark.r) * alpha, - (g2 - dark.g) * alpha, - (b2 - dark.b) * alpha, - 0, - ); - } - }; - TwoColorTimeline.ENTRIES = 8; - TwoColorTimeline.PREV_TIME = -8; - TwoColorTimeline.PREV_R = -7; - TwoColorTimeline.PREV_G = -6; - TwoColorTimeline.PREV_B = -5; - TwoColorTimeline.PREV_A = -4; - TwoColorTimeline.PREV_R2 = -3; - TwoColorTimeline.PREV_G2 = -2; - TwoColorTimeline.PREV_B2 = -1; - TwoColorTimeline.R = 1; - TwoColorTimeline.G = 2; - TwoColorTimeline.B = 3; - TwoColorTimeline.A = 4; - TwoColorTimeline.R2 = 5; - TwoColorTimeline.G2 = 6; - TwoColorTimeline.B2 = 7; - return TwoColorTimeline; - })(CurveTimeline); - core.TwoColorTimeline = TwoColorTimeline; - var AttachmentTimeline = (function() { - function AttachmentTimeline(frameCount) { - this.frames = core.Utils.newFloatArray(frameCount); - this.attachmentNames = new Array(frameCount); - } - AttachmentTimeline.prototype.getPropertyId = function() { - return (TimelineType.attachment << 24) + this.slotIndex; - }; - AttachmentTimeline.prototype.getFrameCount = function() { - return this.frames.length; - }; - AttachmentTimeline.prototype.setFrame = function( - frameIndex, - time, - attachmentName, - ) { - this.frames[frameIndex] = time; - this.attachmentNames[frameIndex] = attachmentName; - }; - AttachmentTimeline.prototype.apply = function( - skeleton, - lastTime, - time, - events, - alpha, - blend, - direction, - ) { - var slot = skeleton.slots[this.slotIndex]; - if (direction == MixDirection.out && blend == MixBlend.setup) { - var attachmentName_1 = slot.data.attachmentName; - slot.setAttachment( - attachmentName_1 == null - ? null - : skeleton.getAttachment(this.slotIndex, attachmentName_1), - ); - return; - } - var frames = this.frames; - if (time < frames[0]) { - if (blend == MixBlend.setup || blend == MixBlend.first) { - var attachmentName_2 = slot.data.attachmentName; - slot.setAttachment( - attachmentName_2 == null - ? null - : skeleton.getAttachment(this.slotIndex, attachmentName_2), - ); - } - return; - } - var frameIndex = 0; - if (time >= frames[frames.length - 1]) frameIndex = frames.length - 1; - else frameIndex = Animation.binarySearch(frames, time, 1) - 1; - var attachmentName = this.attachmentNames[frameIndex]; - skeleton.slots[this.slotIndex].setAttachment( - attachmentName == null - ? null - : skeleton.getAttachment(this.slotIndex, attachmentName), - ); - }; - return AttachmentTimeline; - })(); - core.AttachmentTimeline = AttachmentTimeline; - var zeros = null; - var DeformTimeline = (function(_super) { - __extends(DeformTimeline, _super); - function DeformTimeline(frameCount) { - var _this = _super.call(this, frameCount) || this; - _this.frames = core.Utils.newFloatArray(frameCount); - _this.frameVertices = new Array(frameCount); - if (zeros == null) zeros = core.Utils.newFloatArray(64); - return _this; - } - DeformTimeline.prototype.getPropertyId = function() { - return ( - (TimelineType.deform << 27) + +this.attachment.id + this.slotIndex - ); - }; - DeformTimeline.prototype.setFrame = function(frameIndex, time, vertices) { - this.frames[frameIndex] = time; - this.frameVertices[frameIndex] = vertices; - }; - DeformTimeline.prototype.apply = function( - skeleton, - lastTime, - time, - firedEvents, - alpha, - blend, - direction, - ) { - var slot = skeleton.slots[this.slotIndex]; - var slotAttachment = slot.getAttachment(); - if ( - !(slotAttachment instanceof core.VertexAttachment) || - !slotAttachment.applyDeform(this.attachment) - ) - return; - var verticesArray = slot.attachmentVertices; - if (verticesArray.length == 0) blend = MixBlend.setup; - var frameVertices = this.frameVertices; - var vertexCount = frameVertices[0].length; - var frames = this.frames; - if (time < frames[0]) { - var vertexAttachment = slotAttachment; - switch (blend) { - case MixBlend.setup: - verticesArray.length = 0; - return; - case MixBlend.first: - if (alpha == 1) { - verticesArray.length = 0; - break; - } - var vertices_1 = core.Utils.setArraySize( - verticesArray, - vertexCount, - ); - if (vertexAttachment.bones == null) { - var setupVertices = vertexAttachment.vertices; - for (var i = 0; i < vertexCount; i++) - vertices_1[i] += (setupVertices[i] - vertices_1[i]) * alpha; - } else { - alpha = 1 - alpha; - for (var i = 0; i < vertexCount; i++) vertices_1[i] *= alpha; - } - } - return; - } - var vertices = core.Utils.setArraySize(verticesArray, vertexCount); - if (time >= frames[frames.length - 1]) { - var lastVertices = frameVertices[frames.length - 1]; - if (alpha == 1) { - if (blend == MixBlend.add) { - var vertexAttachment = slotAttachment; - if (vertexAttachment.bones == null) { - var setupVertices = vertexAttachment.vertices; - for (var i = 0; i < vertexCount; i++) { - vertices[i] += lastVertices[i] - setupVertices[i]; - } - } else { - for (var i = 0; i < vertexCount; i++) - vertices[i] += lastVertices[i]; - } - } else { - core.Utils.arrayCopy(lastVertices, 0, vertices, 0, vertexCount); - } - } else { - switch (blend) { - case MixBlend.setup: { - var vertexAttachment_1 = slotAttachment; - if (vertexAttachment_1.bones == null) { - var setupVertices = vertexAttachment_1.vertices; - for (var i = 0; i < vertexCount; i++) { - var setup = setupVertices[i]; - vertices[i] = setup + (lastVertices[i] - setup) * alpha; - } - } else { - for (var i = 0; i < vertexCount; i++) - vertices[i] = lastVertices[i] * alpha; - } - break; - } - case MixBlend.first: - case MixBlend.replace: - for (var i = 0; i < vertexCount; i++) - vertices[i] += (lastVertices[i] - vertices[i]) * alpha; - case MixBlend.add: - var vertexAttachment = slotAttachment; - if (vertexAttachment.bones == null) { - var setupVertices = vertexAttachment.vertices; - for (var i = 0; i < vertexCount; i++) { - vertices[i] += (lastVertices[i] - setupVertices[i]) * alpha; - } - } else { - for (var i = 0; i < vertexCount; i++) - vertices[i] += lastVertices[i] * alpha; - } - } - } - return; - } - var frame = Animation.binarySearch(frames, time); - var prevVertices = frameVertices[frame - 1]; - var nextVertices = frameVertices[frame]; - var frameTime = frames[frame]; - var percent = this.getCurvePercent( - frame - 1, - 1 - (time - frameTime) / (frames[frame - 1] - frameTime), - ); - if (alpha == 1) { - if (blend == MixBlend.add) { - var vertexAttachment = slotAttachment; - if (vertexAttachment.bones == null) { - var setupVertices = vertexAttachment.vertices; - for (var i = 0; i < vertexCount; i++) { - var prev = prevVertices[i]; - vertices[i] += - prev + (nextVertices[i] - prev) * percent - setupVertices[i]; - } - } else { - for (var i = 0; i < vertexCount; i++) { - var prev = prevVertices[i]; - vertices[i] += prev + (nextVertices[i] - prev) * percent; - } - } - } else { - for (var i = 0; i < vertexCount; i++) { - var prev = prevVertices[i]; - vertices[i] = prev + (nextVertices[i] - prev) * percent; - } - } - } else { - switch (blend) { - case MixBlend.setup: { - var vertexAttachment_2 = slotAttachment; - if (vertexAttachment_2.bones == null) { - var setupVertices = vertexAttachment_2.vertices; - for (var i = 0; i < vertexCount; i++) { - var prev = prevVertices[i], - setup = setupVertices[i]; - vertices[i] = - setup + - (prev + (nextVertices[i] - prev) * percent - setup) * alpha; - } - } else { - for (var i = 0; i < vertexCount; i++) { - var prev = prevVertices[i]; - vertices[i] = - (prev + (nextVertices[i] - prev) * percent) * alpha; - } - } - break; - } - case MixBlend.first: - case MixBlend.replace: - for (var i = 0; i < vertexCount; i++) { - var prev = prevVertices[i]; - vertices[i] += - (prev + (nextVertices[i] - prev) * percent - vertices[i]) * - alpha; - } - break; - case MixBlend.add: - var vertexAttachment = slotAttachment; - if (vertexAttachment.bones == null) { - var setupVertices = vertexAttachment.vertices; - for (var i = 0; i < vertexCount; i++) { - var prev = prevVertices[i]; - vertices[i] += - (prev + - (nextVertices[i] - prev) * percent - - setupVertices[i]) * - alpha; - } - } else { - for (var i = 0; i < vertexCount; i++) { - var prev = prevVertices[i]; - vertices[i] += - (prev + (nextVertices[i] - prev) * percent) * alpha; - } - } - } - } - }; - return DeformTimeline; - })(CurveTimeline); - core.DeformTimeline = DeformTimeline; - var EventTimeline = (function() { - function EventTimeline(frameCount) { - this.frames = core.Utils.newFloatArray(frameCount); - this.events = new Array(frameCount); - } - EventTimeline.prototype.getPropertyId = function() { - return TimelineType.event << 24; - }; - EventTimeline.prototype.getFrameCount = function() { - return this.frames.length; - }; - EventTimeline.prototype.setFrame = function(frameIndex, event) { - this.frames[frameIndex] = event.time; - this.events[frameIndex] = event; - }; - EventTimeline.prototype.apply = function( - skeleton, - lastTime, - time, - firedEvents, - alpha, - blend, - direction, - ) { - if (firedEvents == null) return; - var frames = this.frames; - var frameCount = this.frames.length; - if (lastTime > time) { - this.apply( - skeleton, - lastTime, - Number.MAX_VALUE, - firedEvents, - alpha, - blend, - direction, - ); - lastTime = -1; - } else if (lastTime >= frames[frameCount - 1]) return; - if (time < frames[0]) return; - var frame = 0; - if (lastTime < frames[0]) frame = 0; - else { - frame = Animation.binarySearch(frames, lastTime); - var frameTime = frames[frame]; - while (frame > 0) { - if (frames[frame - 1] != frameTime) break; - frame--; - } - } - for (; frame < frameCount && time >= frames[frame]; frame++) - firedEvents.push(this.events[frame]); - }; - return EventTimeline; - })(); - core.EventTimeline = EventTimeline; - var DrawOrderTimeline = (function() { - function DrawOrderTimeline(frameCount) { - this.frames = core.Utils.newFloatArray(frameCount); - this.drawOrders = new Array(frameCount); - } - DrawOrderTimeline.prototype.getPropertyId = function() { - return TimelineType.drawOrder << 24; - }; - DrawOrderTimeline.prototype.getFrameCount = function() { - return this.frames.length; - }; - DrawOrderTimeline.prototype.setFrame = function( - frameIndex, - time, - drawOrder, - ) { - this.frames[frameIndex] = time; - this.drawOrders[frameIndex] = drawOrder; - }; - DrawOrderTimeline.prototype.apply = function( - skeleton, - lastTime, - time, - firedEvents, - alpha, - blend, - direction, - ) { - var drawOrder = skeleton.drawOrder; - var slots = skeleton.slots; - if (direction == MixDirection.out && blend == MixBlend.setup) { - core.Utils.arrayCopy( - skeleton.slots, - 0, - skeleton.drawOrder, - 0, - skeleton.slots.length, - ); - return; - } - var frames = this.frames; - if (time < frames[0]) { - if (blend == MixBlend.setup || blend == MixBlend.first) - core.Utils.arrayCopy( - skeleton.slots, - 0, - skeleton.drawOrder, - 0, - skeleton.slots.length, - ); - return; - } - var frame = 0; - if (time >= frames[frames.length - 1]) frame = frames.length - 1; - else frame = Animation.binarySearch(frames, time) - 1; - var drawOrderToSetupIndex = this.drawOrders[frame]; - if (drawOrderToSetupIndex == null) - core.Utils.arrayCopy(slots, 0, drawOrder, 0, slots.length); - else { - for (var i = 0, n = drawOrderToSetupIndex.length; i < n; i++) - drawOrder[i] = slots[drawOrderToSetupIndex[i]]; - } - }; - return DrawOrderTimeline; - })(); - core.DrawOrderTimeline = DrawOrderTimeline; - var IkConstraintTimeline = (function(_super) { - __extends(IkConstraintTimeline, _super); - function IkConstraintTimeline(frameCount) { - var _this = _super.call(this, frameCount) || this; - _this.frames = core.Utils.newFloatArray( - frameCount * IkConstraintTimeline.ENTRIES, - ); - return _this; - } - IkConstraintTimeline.prototype.getPropertyId = function() { - return (TimelineType.ikConstraint << 24) + this.ikConstraintIndex; - }; - IkConstraintTimeline.prototype.setFrame = function( - frameIndex, - time, - mix, - bendDirection, - compress, - stretch, - ) { - frameIndex *= IkConstraintTimeline.ENTRIES; - this.frames[frameIndex] = time; - this.frames[frameIndex + IkConstraintTimeline.MIX] = mix; - this.frames[ - frameIndex + IkConstraintTimeline.BEND_DIRECTION - ] = bendDirection; - this.frames[frameIndex + IkConstraintTimeline.COMPRESS] = compress - ? 1 - : 0; - this.frames[frameIndex + IkConstraintTimeline.STRETCH] = stretch - ? 1 - : 0; - }; - IkConstraintTimeline.prototype.apply = function( - skeleton, - lastTime, - time, - firedEvents, - alpha, - blend, - direction, - ) { - var frames = this.frames; - var constraint = skeleton.ikConstraints[this.ikConstraintIndex]; - if (time < frames[0]) { - switch (blend) { - case MixBlend.setup: - constraint.mix = constraint.data.mix; - constraint.bendDirection = constraint.data.bendDirection; - constraint.compress = constraint.data.compress; - constraint.stretch = constraint.data.stretch; - return; - case MixBlend.first: - constraint.mix += (constraint.data.mix - constraint.mix) * alpha; - constraint.bendDirection = constraint.data.bendDirection; - constraint.compress = constraint.data.compress; - constraint.stretch = constraint.data.stretch; - } - return; - } - if (time >= frames[frames.length - IkConstraintTimeline.ENTRIES]) { - if (blend == MixBlend.setup) { - constraint.mix = - constraint.data.mix + - (frames[frames.length + IkConstraintTimeline.PREV_MIX] - - constraint.data.mix) * - alpha; - if (direction == MixDirection.out) { - constraint.bendDirection = constraint.data.bendDirection; - constraint.compress = constraint.data.compress; - constraint.stretch = constraint.data.stretch; - } else { - constraint.bendDirection = - frames[ - frames.length + IkConstraintTimeline.PREV_BEND_DIRECTION - ]; - constraint.compress = - frames[frames.length + IkConstraintTimeline.PREV_COMPRESS] != 0; - constraint.stretch = - frames[frames.length + IkConstraintTimeline.PREV_STRETCH] != 0; - } - } else { - constraint.mix += - (frames[frames.length + IkConstraintTimeline.PREV_MIX] - - constraint.mix) * - alpha; - if (direction == MixDirection.in) { - constraint.bendDirection = - frames[ - frames.length + IkConstraintTimeline.PREV_BEND_DIRECTION - ]; - constraint.compress = - frames[frames.length + IkConstraintTimeline.PREV_COMPRESS] != 0; - constraint.stretch = - frames[frames.length + IkConstraintTimeline.PREV_STRETCH] != 0; - } - } - return; - } - var frame = Animation.binarySearch( - frames, - time, - IkConstraintTimeline.ENTRIES, - ); - var mix = frames[frame + IkConstraintTimeline.PREV_MIX]; - var frameTime = frames[frame]; - var percent = this.getCurvePercent( - frame / IkConstraintTimeline.ENTRIES - 1, - 1 - - (time - frameTime) / - (frames[frame + IkConstraintTimeline.PREV_TIME] - frameTime), - ); - if (blend == MixBlend.setup) { - constraint.mix = - constraint.data.mix + - (mix + - (frames[frame + IkConstraintTimeline.MIX] - mix) * percent - - constraint.data.mix) * - alpha; - if (direction == MixDirection.out) { - constraint.bendDirection = constraint.data.bendDirection; - constraint.compress = constraint.data.compress; - constraint.stretch = constraint.data.stretch; - } else { - constraint.bendDirection = - frames[frame + IkConstraintTimeline.PREV_BEND_DIRECTION]; - constraint.compress = - frames[frame + IkConstraintTimeline.PREV_COMPRESS] != 0; - constraint.stretch = - frames[frame + IkConstraintTimeline.PREV_STRETCH] != 0; - } - } else { - constraint.mix += - (mix + - (frames[frame + IkConstraintTimeline.MIX] - mix) * percent - - constraint.mix) * - alpha; - if (direction == MixDirection.in) { - constraint.bendDirection = - frames[frame + IkConstraintTimeline.PREV_BEND_DIRECTION]; - constraint.compress = - frames[frame + IkConstraintTimeline.PREV_COMPRESS] != 0; - constraint.stretch = - frames[frame + IkConstraintTimeline.PREV_STRETCH] != 0; - } - } - }; - IkConstraintTimeline.ENTRIES = 5; - IkConstraintTimeline.PREV_TIME = -5; - IkConstraintTimeline.PREV_MIX = -4; - IkConstraintTimeline.PREV_BEND_DIRECTION = -3; - IkConstraintTimeline.PREV_COMPRESS = -2; - IkConstraintTimeline.PREV_STRETCH = -1; - IkConstraintTimeline.MIX = 1; - IkConstraintTimeline.BEND_DIRECTION = 2; - IkConstraintTimeline.COMPRESS = 3; - IkConstraintTimeline.STRETCH = 4; - return IkConstraintTimeline; - })(CurveTimeline); - core.IkConstraintTimeline = IkConstraintTimeline; - var TransformConstraintTimeline = (function(_super) { - __extends(TransformConstraintTimeline, _super); - function TransformConstraintTimeline(frameCount) { - var _this = _super.call(this, frameCount) || this; - _this.frames = core.Utils.newFloatArray( - frameCount * TransformConstraintTimeline.ENTRIES, - ); - return _this; - } - TransformConstraintTimeline.prototype.getPropertyId = function() { - return ( - (TimelineType.transformConstraint << 24) + - this.transformConstraintIndex - ); - }; - TransformConstraintTimeline.prototype.setFrame = function( - frameIndex, - time, - rotateMix, - translateMix, - scaleMix, - shearMix, - ) { - frameIndex *= TransformConstraintTimeline.ENTRIES; - this.frames[frameIndex] = time; - this.frames[ - frameIndex + TransformConstraintTimeline.ROTATE - ] = rotateMix; - this.frames[ - frameIndex + TransformConstraintTimeline.TRANSLATE - ] = translateMix; - this.frames[frameIndex + TransformConstraintTimeline.SCALE] = scaleMix; - this.frames[frameIndex + TransformConstraintTimeline.SHEAR] = shearMix; - }; - TransformConstraintTimeline.prototype.apply = function( - skeleton, - lastTime, - time, - firedEvents, - alpha, - blend, - direction, - ) { - var frames = this.frames; - var constraint = - skeleton.transformConstraints[this.transformConstraintIndex]; - if (time < frames[0]) { - var data = constraint.data; - switch (blend) { - case MixBlend.setup: - constraint.rotateMix = data.rotateMix; - constraint.translateMix = data.translateMix; - constraint.scaleMix = data.scaleMix; - constraint.shearMix = data.shearMix; - return; - case MixBlend.first: - constraint.rotateMix += - (data.rotateMix - constraint.rotateMix) * alpha; - constraint.translateMix += - (data.translateMix - constraint.translateMix) * alpha; - constraint.scaleMix += - (data.scaleMix - constraint.scaleMix) * alpha; - constraint.shearMix += - (data.shearMix - constraint.shearMix) * alpha; - } - return; - } - var rotate = 0, - translate = 0, - scale = 0, - shear = 0; - if ( - time >= frames[frames.length - TransformConstraintTimeline.ENTRIES] - ) { - var i = frames.length; - rotate = frames[i + TransformConstraintTimeline.PREV_ROTATE]; - translate = frames[i + TransformConstraintTimeline.PREV_TRANSLATE]; - scale = frames[i + TransformConstraintTimeline.PREV_SCALE]; - shear = frames[i + TransformConstraintTimeline.PREV_SHEAR]; - } else { - var frame = Animation.binarySearch( - frames, - time, - TransformConstraintTimeline.ENTRIES, - ); - rotate = frames[frame + TransformConstraintTimeline.PREV_ROTATE]; - translate = - frames[frame + TransformConstraintTimeline.PREV_TRANSLATE]; - scale = frames[frame + TransformConstraintTimeline.PREV_SCALE]; - shear = frames[frame + TransformConstraintTimeline.PREV_SHEAR]; - var frameTime = frames[frame]; - var percent = this.getCurvePercent( - frame / TransformConstraintTimeline.ENTRIES - 1, - 1 - - (time - frameTime) / - (frames[frame + TransformConstraintTimeline.PREV_TIME] - - frameTime), - ); - rotate += - (frames[frame + TransformConstraintTimeline.ROTATE] - rotate) * - percent; - translate += - (frames[frame + TransformConstraintTimeline.TRANSLATE] - - translate) * - percent; - scale += - (frames[frame + TransformConstraintTimeline.SCALE] - scale) * - percent; - shear += - (frames[frame + TransformConstraintTimeline.SHEAR] - shear) * - percent; - } - if (blend == MixBlend.setup) { - var data = constraint.data; - constraint.rotateMix = - data.rotateMix + (rotate - data.rotateMix) * alpha; - constraint.translateMix = - data.translateMix + (translate - data.translateMix) * alpha; - constraint.scaleMix = data.scaleMix + (scale - data.scaleMix) * alpha; - constraint.shearMix = data.shearMix + (shear - data.shearMix) * alpha; - } else { - constraint.rotateMix += (rotate - constraint.rotateMix) * alpha; - constraint.translateMix += - (translate - constraint.translateMix) * alpha; - constraint.scaleMix += (scale - constraint.scaleMix) * alpha; - constraint.shearMix += (shear - constraint.shearMix) * alpha; - } - }; - TransformConstraintTimeline.ENTRIES = 5; - TransformConstraintTimeline.PREV_TIME = -5; - TransformConstraintTimeline.PREV_ROTATE = -4; - TransformConstraintTimeline.PREV_TRANSLATE = -3; - TransformConstraintTimeline.PREV_SCALE = -2; - TransformConstraintTimeline.PREV_SHEAR = -1; - TransformConstraintTimeline.ROTATE = 1; - TransformConstraintTimeline.TRANSLATE = 2; - TransformConstraintTimeline.SCALE = 3; - TransformConstraintTimeline.SHEAR = 4; - return TransformConstraintTimeline; - })(CurveTimeline); - core.TransformConstraintTimeline = TransformConstraintTimeline; - var PathConstraintPositionTimeline = (function(_super) { - __extends(PathConstraintPositionTimeline, _super); - function PathConstraintPositionTimeline(frameCount) { - var _this = _super.call(this, frameCount) || this; - _this.frames = core.Utils.newFloatArray( - frameCount * PathConstraintPositionTimeline.ENTRIES, - ); - return _this; - } - PathConstraintPositionTimeline.prototype.getPropertyId = function() { - return ( - (TimelineType.pathConstraintPosition << 24) + this.pathConstraintIndex - ); - }; - PathConstraintPositionTimeline.prototype.setFrame = function( - frameIndex, - time, - value, - ) { - frameIndex *= PathConstraintPositionTimeline.ENTRIES; - this.frames[frameIndex] = time; - this.frames[frameIndex + PathConstraintPositionTimeline.VALUE] = value; - }; - PathConstraintPositionTimeline.prototype.apply = function( - skeleton, - lastTime, - time, - firedEvents, - alpha, - blend, - direction, - ) { - var frames = this.frames; - var constraint = skeleton.pathConstraints[this.pathConstraintIndex]; - if (time < frames[0]) { - switch (blend) { - case MixBlend.setup: - constraint.position = constraint.data.position; - return; - case MixBlend.first: - constraint.position += - (constraint.data.position - constraint.position) * alpha; - } - return; - } - var position = 0; - if ( - time >= frames[frames.length - PathConstraintPositionTimeline.ENTRIES] - ) - position = - frames[frames.length + PathConstraintPositionTimeline.PREV_VALUE]; - else { - var frame = Animation.binarySearch( - frames, - time, - PathConstraintPositionTimeline.ENTRIES, - ); - position = frames[frame + PathConstraintPositionTimeline.PREV_VALUE]; - var frameTime = frames[frame]; - var percent = this.getCurvePercent( - frame / PathConstraintPositionTimeline.ENTRIES - 1, - 1 - - (time - frameTime) / - (frames[frame + PathConstraintPositionTimeline.PREV_TIME] - - frameTime), - ); - position += - (frames[frame + PathConstraintPositionTimeline.VALUE] - position) * - percent; - } - if (blend == MixBlend.setup) - constraint.position = - constraint.data.position + - (position - constraint.data.position) * alpha; - else constraint.position += (position - constraint.position) * alpha; - }; - PathConstraintPositionTimeline.ENTRIES = 2; - PathConstraintPositionTimeline.PREV_TIME = -2; - PathConstraintPositionTimeline.PREV_VALUE = -1; - PathConstraintPositionTimeline.VALUE = 1; - return PathConstraintPositionTimeline; - })(CurveTimeline); - core.PathConstraintPositionTimeline = PathConstraintPositionTimeline; - var PathConstraintSpacingTimeline = (function(_super) { - __extends(PathConstraintSpacingTimeline, _super); - function PathConstraintSpacingTimeline(frameCount) { - return _super.call(this, frameCount) || this; - } - PathConstraintSpacingTimeline.prototype.getPropertyId = function() { - return ( - (TimelineType.pathConstraintSpacing << 24) + this.pathConstraintIndex - ); - }; - PathConstraintSpacingTimeline.prototype.apply = function( - skeleton, - lastTime, - time, - firedEvents, - alpha, - blend, - direction, - ) { - var frames = this.frames; - var constraint = skeleton.pathConstraints[this.pathConstraintIndex]; - if (time < frames[0]) { - switch (blend) { - case MixBlend.setup: - constraint.spacing = constraint.data.spacing; - return; - case MixBlend.first: - constraint.spacing += - (constraint.data.spacing - constraint.spacing) * alpha; - } - return; - } - var spacing = 0; - if ( - time >= frames[frames.length - PathConstraintSpacingTimeline.ENTRIES] - ) - spacing = - frames[frames.length + PathConstraintSpacingTimeline.PREV_VALUE]; - else { - var frame = Animation.binarySearch( - frames, - time, - PathConstraintSpacingTimeline.ENTRIES, - ); - spacing = frames[frame + PathConstraintSpacingTimeline.PREV_VALUE]; - var frameTime = frames[frame]; - var percent = this.getCurvePercent( - frame / PathConstraintSpacingTimeline.ENTRIES - 1, - 1 - - (time - frameTime) / - (frames[frame + PathConstraintSpacingTimeline.PREV_TIME] - - frameTime), - ); - spacing += - (frames[frame + PathConstraintSpacingTimeline.VALUE] - spacing) * - percent; - } - if (blend == MixBlend.setup) - constraint.spacing = - constraint.data.spacing + - (spacing - constraint.data.spacing) * alpha; - else constraint.spacing += (spacing - constraint.spacing) * alpha; - }; - return PathConstraintSpacingTimeline; - })(PathConstraintPositionTimeline); - core.PathConstraintSpacingTimeline = PathConstraintSpacingTimeline; - var PathConstraintMixTimeline = (function(_super) { - __extends(PathConstraintMixTimeline, _super); - function PathConstraintMixTimeline(frameCount) { - var _this = _super.call(this, frameCount) || this; - _this.frames = core.Utils.newFloatArray( - frameCount * PathConstraintMixTimeline.ENTRIES, - ); - return _this; - } - PathConstraintMixTimeline.prototype.getPropertyId = function() { - return ( - (TimelineType.pathConstraintMix << 24) + this.pathConstraintIndex - ); - }; - PathConstraintMixTimeline.prototype.setFrame = function( - frameIndex, - time, - rotateMix, - translateMix, - ) { - frameIndex *= PathConstraintMixTimeline.ENTRIES; - this.frames[frameIndex] = time; - this.frames[frameIndex + PathConstraintMixTimeline.ROTATE] = rotateMix; - this.frames[ - frameIndex + PathConstraintMixTimeline.TRANSLATE - ] = translateMix; - }; - PathConstraintMixTimeline.prototype.apply = function( - skeleton, - lastTime, - time, - firedEvents, - alpha, - blend, - direction, - ) { - var frames = this.frames; - var constraint = skeleton.pathConstraints[this.pathConstraintIndex]; - if (time < frames[0]) { - switch (blend) { - case MixBlend.setup: - constraint.rotateMix = constraint.data.rotateMix; - constraint.translateMix = constraint.data.translateMix; - return; - case MixBlend.first: - constraint.rotateMix += - (constraint.data.rotateMix - constraint.rotateMix) * alpha; - constraint.translateMix += - (constraint.data.translateMix - constraint.translateMix) * - alpha; - } - return; - } - var rotate = 0, - translate = 0; - if (time >= frames[frames.length - PathConstraintMixTimeline.ENTRIES]) { - rotate = - frames[frames.length + PathConstraintMixTimeline.PREV_ROTATE]; - translate = - frames[frames.length + PathConstraintMixTimeline.PREV_TRANSLATE]; - } else { - var frame = Animation.binarySearch( - frames, - time, - PathConstraintMixTimeline.ENTRIES, - ); - rotate = frames[frame + PathConstraintMixTimeline.PREV_ROTATE]; - translate = frames[frame + PathConstraintMixTimeline.PREV_TRANSLATE]; - var frameTime = frames[frame]; - var percent = this.getCurvePercent( - frame / PathConstraintMixTimeline.ENTRIES - 1, - 1 - - (time - frameTime) / - (frames[frame + PathConstraintMixTimeline.PREV_TIME] - - frameTime), - ); - rotate += - (frames[frame + PathConstraintMixTimeline.ROTATE] - rotate) * - percent; - translate += - (frames[frame + PathConstraintMixTimeline.TRANSLATE] - translate) * - percent; - } - if (blend == MixBlend.setup) { - constraint.rotateMix = - constraint.data.rotateMix + - (rotate - constraint.data.rotateMix) * alpha; - constraint.translateMix = - constraint.data.translateMix + - (translate - constraint.data.translateMix) * alpha; - } else { - constraint.rotateMix += (rotate - constraint.rotateMix) * alpha; - constraint.translateMix += - (translate - constraint.translateMix) * alpha; - } - }; - PathConstraintMixTimeline.ENTRIES = 3; - PathConstraintMixTimeline.PREV_TIME = -3; - PathConstraintMixTimeline.PREV_ROTATE = -2; - PathConstraintMixTimeline.PREV_TRANSLATE = -1; - PathConstraintMixTimeline.ROTATE = 1; - PathConstraintMixTimeline.TRANSLATE = 2; - return PathConstraintMixTimeline; - })(CurveTimeline); - core.PathConstraintMixTimeline = PathConstraintMixTimeline; - })((pixi_spine.core || (pixi_spine.core = {}))); - })(pixi_spine || (pixi_spine = {})); - var pixi_spine; - (function(pixi_spine) { - (function(core) { - var AnimationState = (function() { - function AnimationState(data) { - this.tracks = new Array(); - this.events = new Array(); - this.listeners = new Array(); - this.queue = new EventQueue(this); - this.propertyIDs = new core.IntSet(); - this.animationsChanged = false; - this.timeScale = 1; - this.trackEntryPool = new core.Pool(function() { - return new TrackEntry(); - }); - this.data = data; - } - AnimationState.prototype.update = function(delta) { - delta *= this.timeScale; - var tracks = this.tracks; - for (var i = 0, n = tracks.length; i < n; i++) { - var current = tracks[i]; - if (current == null) continue; - current.animationLast = current.nextAnimationLast; - current.trackLast = current.nextTrackLast; - var currentDelta = delta * current.timeScale; - if (current.delay > 0) { - current.delay -= currentDelta; - if (current.delay > 0) continue; - currentDelta = -current.delay; - current.delay = 0; - } - var next = current.next; - if (next != null) { - var nextTime = current.trackLast - next.delay; - if (nextTime >= 0) { - next.delay = 0; - next.trackTime = - current.timeScale == 0 - ? 0 - : (nextTime / current.timeScale + delta) * next.timeScale; - current.trackTime += currentDelta; - this.setCurrent(i, next, true); - while (next.mixingFrom != null) { - next.mixTime += delta; - next = next.mixingFrom; - } - continue; - } - } else if ( - current.trackLast >= current.trackEnd && - current.mixingFrom == null - ) { - tracks[i] = null; - this.queue.end(current); - this.disposeNext(current); - continue; - } - if ( - current.mixingFrom != null && - this.updateMixingFrom(current, delta) - ) { - var from = current.mixingFrom; - current.mixingFrom = null; - if (from != null) from.mixingTo = null; - while (from != null) { - this.queue.end(from); - from = from.mixingFrom; - } - } - current.trackTime += currentDelta; - } - this.queue.drain(); - }; - AnimationState.prototype.updateMixingFrom = function(to, delta) { - var from = to.mixingFrom; - if (from == null) return true; - var finished = this.updateMixingFrom(from, delta); - from.animationLast = from.nextAnimationLast; - from.trackLast = from.nextTrackLast; - if (to.mixTime > 0 && to.mixTime >= to.mixDuration) { - if (from.totalAlpha == 0 || to.mixDuration == 0) { - to.mixingFrom = from.mixingFrom; - if (from.mixingFrom != null) from.mixingFrom.mixingTo = to; - to.interruptAlpha = from.interruptAlpha; - this.queue.end(from); - } - return finished; - } - from.trackTime += delta * from.timeScale; - to.mixTime += delta; - return false; - }; - AnimationState.prototype.apply = function(skeleton) { - if (skeleton == null) throw new Error('skeleton cannot be null.'); - if (this.animationsChanged) this._animationsChanged(); - var events = this.events; - var tracks = this.tracks; - var applied = false; - for (var i = 0, n = tracks.length; i < n; i++) { - var current = tracks[i]; - if (current == null || current.delay > 0) continue; - applied = true; - var blend = i == 0 ? core.MixBlend.first : current.mixBlend; - var mix = current.alpha; - if (current.mixingFrom != null) - mix *= this.applyMixingFrom(current, skeleton, blend); - else if ( - current.trackTime >= current.trackEnd && - current.next == null - ) - mix = 0; - var animationLast = current.animationLast, - animationTime = current.getAnimationTime(); - var timelineCount = current.animation.timelines.length; - var timelines = current.animation.timelines; - if (i == 0 && (mix == 1 || blend == core.MixBlend.add)) { - for (var ii = 0; ii < timelineCount; ii++) { - core.Utils.webkit602BugfixHelper(mix, blend); - timelines[ii].apply( - skeleton, - animationLast, - animationTime, - events, - mix, - blend, - core.MixDirection.in, - ); - } - } else { - var timelineMode = current.timelineMode; - var firstFrame = current.timelinesRotation.length == 0; - if (firstFrame) - core.Utils.setArraySize( - current.timelinesRotation, - timelineCount << 1, - null, - ); - var timelinesRotation = current.timelinesRotation; - for (var ii = 0; ii < timelineCount; ii++) { - var timeline = timelines[ii]; - var timelineBlend = - timelineMode[ii] == AnimationState.SUBSEQUENT - ? blend - : core.MixBlend.setup; - if (timeline instanceof core.RotateTimeline) { - this.applyRotateTimeline( - timeline, - skeleton, - animationTime, - mix, - timelineBlend, - timelinesRotation, - ii << 1, - firstFrame, - ); - } else { - core.Utils.webkit602BugfixHelper(mix, blend); - timeline.apply( - skeleton, - animationLast, - animationTime, - events, - mix, - timelineBlend, - core.MixDirection.in, - ); - } - } - } - this.queueEvents(current, animationTime); - events.length = 0; - current.nextAnimationLast = animationTime; - current.nextTrackLast = current.trackTime; - } - this.queue.drain(); - return applied; - }; - AnimationState.prototype.applyMixingFrom = function(to, skeleton, blend) { - var from = to.mixingFrom; - if (from.mixingFrom != null) - this.applyMixingFrom(from, skeleton, blend); - var mix = 0; - if (to.mixDuration == 0) { - mix = 1; - if (blend == core.MixBlend.first) blend = core.MixBlend.setup; - } else { - mix = to.mixTime / to.mixDuration; - if (mix > 1) mix = 1; - if (blend != core.MixBlend.first) blend = from.mixBlend; - } - var events = mix < from.eventThreshold ? this.events : null; - var attachments = mix < from.attachmentThreshold, - drawOrder = mix < from.drawOrderThreshold; - var animationLast = from.animationLast, - animationTime = from.getAnimationTime(); - var timelineCount = from.animation.timelines.length; - var timelines = from.animation.timelines; - var alphaHold = from.alpha * to.interruptAlpha, - alphaMix = alphaHold * (1 - mix); - if (blend == core.MixBlend.add) { - for (var i = 0; i < timelineCount; i++) - timelines[i].apply( - skeleton, - animationLast, - animationTime, - events, - alphaMix, - blend, - core.MixDirection.out, - ); - } else { - var timelineMode = from.timelineMode; - var timelineHoldMix = from.timelineHoldMix; - var firstFrame = from.timelinesRotation.length == 0; - if (firstFrame) - core.Utils.setArraySize( - from.timelinesRotation, - timelineCount << 1, - null, - ); - var timelinesRotation = from.timelinesRotation; - from.totalAlpha = 0; - for (var i = 0; i < timelineCount; i++) { - var timeline = timelines[i]; - var direction = core.MixDirection.out; - var timelineBlend = void 0; - var alpha = 0; - switch (timelineMode[i]) { - case AnimationState.SUBSEQUENT: - if (!attachments && timeline instanceof core.AttachmentTimeline) - continue; - if (!drawOrder && timeline instanceof core.DrawOrderTimeline) - continue; - timelineBlend = blend; - alpha = alphaMix; - break; - case AnimationState.FIRST: - timelineBlend = core.MixBlend.setup; - alpha = alphaMix; - break; - case AnimationState.HOLD: - timelineBlend = core.MixBlend.setup; - alpha = alphaHold; - break; - default: - timelineBlend = core.MixBlend.setup; - var holdMix = timelineHoldMix[i]; - alpha = - alphaHold * - Math.max(0, 1 - holdMix.mixTime / holdMix.mixDuration); - break; - } - from.totalAlpha += alpha; - if (timeline instanceof core.RotateTimeline) - this.applyRotateTimeline( - timeline, - skeleton, - animationTime, - alpha, - timelineBlend, - timelinesRotation, - i << 1, - firstFrame, - ); - else { - core.Utils.webkit602BugfixHelper(alpha, blend); - if (timelineBlend == core.MixBlend.setup) { - if (timeline instanceof core.AttachmentTimeline) { - if (attachments) direction = core.MixDirection.out; - } else if (timeline instanceof core.DrawOrderTimeline) { - if (drawOrder) direction = core.MixDirection.out; - } - } - timeline.apply( - skeleton, - animationLast, - animationTime, - events, - alpha, - timelineBlend, - direction, - ); - } - } - } - if (to.mixDuration > 0) this.queueEvents(from, animationTime); - this.events.length = 0; - from.nextAnimationLast = animationTime; - from.nextTrackLast = from.trackTime; - return mix; - }; - AnimationState.prototype.applyRotateTimeline = function( - timeline, - skeleton, - time, - alpha, - blend, - timelinesRotation, - i, - firstFrame, - ) { - if (firstFrame) timelinesRotation[i] = 0; - if (alpha == 1) { - timeline.apply( - skeleton, - 0, - time, - null, - 1, - blend, - core.MixDirection.in, - ); - return; - } - var rotateTimeline = timeline; - var frames = rotateTimeline.frames; - var bone = skeleton.bones[rotateTimeline.boneIndex]; - var r1 = 0, - r2 = 0; - if (time < frames[0]) { - switch (blend) { - case core.MixBlend.setup: - bone.rotation = bone.data.rotation; - default: - return; - case core.MixBlend.first: - r1 = bone.rotation; - r2 = bone.data.rotation; - } - } else { - r1 = - blend == core.MixBlend.setup ? bone.data.rotation : bone.rotation; - if (time >= frames[frames.length - core.RotateTimeline.ENTRIES]) - r2 = - bone.data.rotation + - frames[frames.length + core.RotateTimeline.PREV_ROTATION]; - else { - var frame = core.Animation.binarySearch( - frames, - time, - core.RotateTimeline.ENTRIES, - ); - var prevRotation = - frames[frame + core.RotateTimeline.PREV_ROTATION]; - var frameTime = frames[frame]; - var percent = rotateTimeline.getCurvePercent( - (frame >> 1) - 1, - 1 - - (time - frameTime) / - (frames[frame + core.RotateTimeline.PREV_TIME] - frameTime), - ); - r2 = frames[frame + core.RotateTimeline.ROTATION] - prevRotation; - r2 -= (16384 - ((16384.499999999996 - r2 / 360) | 0)) * 360; - r2 = prevRotation + r2 * percent + bone.data.rotation; - r2 -= (16384 - ((16384.499999999996 - r2 / 360) | 0)) * 360; - } - } - var total = 0, - diff = r2 - r1; - diff -= (16384 - ((16384.499999999996 - diff / 360) | 0)) * 360; - if (diff == 0) { - total = timelinesRotation[i]; - } else { - var lastTotal = 0, - lastDiff = 0; - if (firstFrame) { - lastTotal = 0; - lastDiff = diff; - } else { - lastTotal = timelinesRotation[i]; - lastDiff = timelinesRotation[i + 1]; - } - var current = diff > 0, - dir = lastTotal >= 0; - if ( - core.MathUtils.signum(lastDiff) != core.MathUtils.signum(diff) && - Math.abs(lastDiff) <= 90 - ) { - if (Math.abs(lastTotal) > 180) - lastTotal += 360 * core.MathUtils.signum(lastTotal); - dir = current; - } - total = diff + lastTotal - (lastTotal % 360); - if (dir != current) total += 360 * core.MathUtils.signum(lastTotal); - timelinesRotation[i] = total; - } - timelinesRotation[i + 1] = diff; - r1 += total * alpha; - bone.rotation = - r1 - (16384 - ((16384.499999999996 - r1 / 360) | 0)) * 360; - }; - AnimationState.prototype.queueEvents = function(entry, animationTime) { - var animationStart = entry.animationStart, - animationEnd = entry.animationEnd; - var duration = animationEnd - animationStart; - var trackLastWrapped = entry.trackLast % duration; - var events = this.events; - var i = 0, - n = events.length; - for (; i < n; i++) { - var event_1 = events[i]; - if (event_1.time < trackLastWrapped) break; - if (event_1.time > animationEnd) continue; - this.queue.event(entry, event_1); - } - var complete = false; - if (entry.loop) - complete = - duration == 0 || trackLastWrapped > entry.trackTime % duration; - else - complete = - animationTime >= animationEnd && entry.animationLast < animationEnd; - if (complete) this.queue.complete(entry); - for (; i < n; i++) { - var event_2 = events[i]; - if (event_2.time < animationStart) continue; - this.queue.event(entry, events[i]); - } - }; - AnimationState.prototype.clearTracks = function() { - var oldDrainDisabled = this.queue.drainDisabled; - this.queue.drainDisabled = true; - for (var i = 0, n = this.tracks.length; i < n; i++) this.clearTrack(i); - this.tracks.length = 0; - this.queue.drainDisabled = oldDrainDisabled; - this.queue.drain(); - }; - AnimationState.prototype.clearTrack = function(trackIndex) { - if (trackIndex >= this.tracks.length) return; - var current = this.tracks[trackIndex]; - if (current == null) return; - this.queue.end(current); - this.disposeNext(current); - var entry = current; - while (true) { - var from = entry.mixingFrom; - if (from == null) break; - this.queue.end(from); - entry.mixingFrom = null; - entry.mixingTo = null; - entry = from; - } - this.tracks[current.trackIndex] = null; - this.queue.drain(); - }; - AnimationState.prototype.setCurrent = function( - index, - current, - interrupt, - ) { - var from = this.expandToIndex(index); - this.tracks[index] = current; - if (from != null) { - if (interrupt) this.queue.interrupt(from); - current.mixingFrom = from; - from.mixingTo = current; - current.mixTime = 0; - if (from.mixingFrom != null && from.mixDuration > 0) - current.interruptAlpha *= Math.min( - 1, - from.mixTime / from.mixDuration, - ); - from.timelinesRotation.length = 0; - } - this.queue.start(current); - }; - AnimationState.prototype.setAnimation = function( - trackIndex, - animationName, - loop, - ) { - var animation = this.data.skeletonData.findAnimation(animationName); - if (animation == null) - throw new Error('Animation not found: ' + animationName); - return this.setAnimationWith(trackIndex, animation, loop); - }; - AnimationState.prototype.setAnimationWith = function( - trackIndex, - animation, - loop, - ) { - if (animation == null) throw new Error('animation cannot be null.'); - var interrupt = true; - var current = this.expandToIndex(trackIndex); - if (current != null) { - if (current.nextTrackLast == -1) { - this.tracks[trackIndex] = current.mixingFrom; - this.queue.interrupt(current); - this.queue.end(current); - this.disposeNext(current); - current = current.mixingFrom; - interrupt = false; - } else this.disposeNext(current); - } - var entry = this.trackEntry(trackIndex, animation, loop, current); - this.setCurrent(trackIndex, entry, interrupt); - this.queue.drain(); - return entry; - }; - AnimationState.prototype.addAnimation = function( - trackIndex, - animationName, - loop, - delay, - ) { - var animation = this.data.skeletonData.findAnimation(animationName); - if (animation == null) - throw new Error('Animation not found: ' + animationName); - return this.addAnimationWith(trackIndex, animation, loop, delay); - }; - AnimationState.prototype.addAnimationWith = function( - trackIndex, - animation, - loop, - delay, - ) { - if (animation == null) throw new Error('animation cannot be null.'); - var last = this.expandToIndex(trackIndex); - if (last != null) { - while (last.next != null) last = last.next; - } - var entry = this.trackEntry(trackIndex, animation, loop, last); - if (last == null) { - this.setCurrent(trackIndex, entry, true); - this.queue.drain(); - } else { - last.next = entry; - if (delay <= 0) { - var duration = last.animationEnd - last.animationStart; - if (duration != 0) { - if (last.loop) - delay += duration * (1 + ((last.trackTime / duration) | 0)); - else delay += Math.max(duration, last.trackTime); - delay -= this.data.getMix(last.animation, animation); - } else delay = last.trackTime; - } - } - entry.delay = delay; - return entry; - }; - AnimationState.prototype.setEmptyAnimation = function( - trackIndex, - mixDuration, - ) { - var entry = this.setAnimationWith( - trackIndex, - AnimationState.emptyAnimation, - false, - ); - entry.mixDuration = mixDuration; - entry.trackEnd = mixDuration; - return entry; - }; - AnimationState.prototype.addEmptyAnimation = function( - trackIndex, - mixDuration, - delay, - ) { - if (delay <= 0) delay -= mixDuration; - var entry = this.addAnimationWith( - trackIndex, - AnimationState.emptyAnimation, - false, - delay, - ); - entry.mixDuration = mixDuration; - entry.trackEnd = mixDuration; - return entry; - }; - AnimationState.prototype.setEmptyAnimations = function(mixDuration) { - var oldDrainDisabled = this.queue.drainDisabled; - this.queue.drainDisabled = true; - for (var i = 0, n = this.tracks.length; i < n; i++) { - var current = this.tracks[i]; - if (current != null) - this.setEmptyAnimation(current.trackIndex, mixDuration); - } - this.queue.drainDisabled = oldDrainDisabled; - this.queue.drain(); - }; - AnimationState.prototype.expandToIndex = function(index) { - if (index < this.tracks.length) return this.tracks[index]; - core.Utils.ensureArrayCapacity( - this.tracks, - index - this.tracks.length + 1, - null, - ); - this.tracks.length = index + 1; - return null; - }; - AnimationState.prototype.trackEntry = function( - trackIndex, - animation, - loop, - last, - ) { - var entry = this.trackEntryPool.obtain(); - entry.trackIndex = trackIndex; - entry.animation = animation; - entry.loop = loop; - entry.holdPrevious = false; - entry.eventThreshold = 0; - entry.attachmentThreshold = 0; - entry.drawOrderThreshold = 0; - entry.animationStart = 0; - entry.animationEnd = animation.duration; - entry.animationLast = -1; - entry.nextAnimationLast = -1; - entry.delay = 0; - entry.trackTime = 0; - entry.trackLast = -1; - entry.nextTrackLast = -1; - entry.trackEnd = Number.MAX_VALUE; - entry.timeScale = 1; - entry.alpha = 1; - entry.interruptAlpha = 1; - entry.mixTime = 0; - entry.mixDuration = - last == null ? 0 : this.data.getMix(last.animation, animation); - return entry; - }; - AnimationState.prototype.disposeNext = function(entry) { - var next = entry.next; - while (next != null) { - this.queue.dispose(next); - next = next.next; - } - entry.next = null; - }; - AnimationState.prototype._animationsChanged = function() { - this.animationsChanged = false; - this.propertyIDs.clear(); - for (var i = 0, n = this.tracks.length; i < n; i++) { - var entry = this.tracks[i]; - if (entry == null) continue; - while (entry.mixingFrom != null) entry = entry.mixingFrom; - do { - if (entry.mixingFrom == null || entry.mixBlend != core.MixBlend.add) - this.setTimelineModes(entry); - entry = entry.mixingTo; - } while (entry != null); - } - }; - AnimationState.prototype.setTimelineModes = function(entry) { - var to = entry.mixingTo; - var timelines = entry.animation.timelines; - var timelinesCount = entry.animation.timelines.length; - var timelineMode = core.Utils.setArraySize( - entry.timelineMode, - timelinesCount, - ); - entry.timelineHoldMix.length = 0; - var timelineDipMix = core.Utils.setArraySize( - entry.timelineHoldMix, - timelinesCount, - ); - var propertyIDs = this.propertyIDs; - if (to != null && to.holdPrevious) { - for (var i = 0; i < timelinesCount; i++) { - propertyIDs.add(timelines[i].getPropertyId()); - timelineMode[i] = AnimationState.HOLD; - } - return; - } - outer: for (var i = 0; i < timelinesCount; i++) { - var id = timelines[i].getPropertyId(); - if (!propertyIDs.add(id)) timelineMode[i] = AnimationState.SUBSEQUENT; - else if (to == null || !this.hasTimeline(to, id)) - timelineMode[i] = AnimationState.FIRST; - else { - for (var next = to.mixingTo; next != null; next = next.mixingTo) { - if (this.hasTimeline(next, id)) continue; - if (entry.mixDuration > 0) { - timelineMode[i] = AnimationState.HOLD_MIX; - timelineDipMix[i] = next; - continue outer; - } - break; - } - timelineMode[i] = AnimationState.HOLD; - } - } - }; - AnimationState.prototype.hasTimeline = function(entry, id) { - var timelines = entry.animation.timelines; - for (var i = 0, n = timelines.length; i < n; i++) - if (timelines[i].getPropertyId() == id) return true; - return false; - }; - AnimationState.prototype.getCurrent = function(trackIndex) { - if (trackIndex >= this.tracks.length) return null; - return this.tracks[trackIndex]; - }; - AnimationState.prototype.addListener = function(listener) { - if (listener == null) throw new Error('listener cannot be null.'); - this.listeners.push(listener); - }; - AnimationState.prototype.removeListener = function(listener) { - var index = this.listeners.indexOf(listener); - if (index >= 0) this.listeners.splice(index, 1); - }; - AnimationState.prototype.clearListeners = function() { - this.listeners.length = 0; - }; - AnimationState.prototype.clearListenerNotifications = function() { - this.queue.clear(); - }; - AnimationState.prototype.setAnimationByName = function( - trackIndex, - animationName, - loop, - ) { - if (!AnimationState.deprecatedWarning1) { - AnimationState.deprecatedWarning1 = true; - console.warn( - 'Spine Deprecation Warning: AnimationState.setAnimationByName is deprecated, please use setAnimation from now on.', - ); - } - this.setAnimation(trackIndex, animationName, loop); - }; - AnimationState.prototype.addAnimationByName = function( - trackIndex, - animationName, - loop, - delay, - ) { - if (!AnimationState.deprecatedWarning2) { - AnimationState.deprecatedWarning2 = true; - console.warn( - 'Spine Deprecation Warning: AnimationState.addAnimationByName is deprecated, please use addAnimation from now on.', - ); - } - this.addAnimation(trackIndex, animationName, loop, delay); - }; - AnimationState.prototype.hasAnimation = function(animationName) { - var animation = this.data.skeletonData.findAnimation(animationName); - return animation !== null; - }; - AnimationState.prototype.hasAnimationByName = function(animationName) { - if (!AnimationState.deprecatedWarning3) { - AnimationState.deprecatedWarning3 = true; - console.warn( - 'Spine Deprecation Warning: AnimationState.hasAnimationByName is deprecated, please use hasAnimation from now on.', - ); - } - return this.hasAnimation(animationName); - }; - AnimationState.emptyAnimation = new core.Animation('', [], 0); - AnimationState.SUBSEQUENT = 0; - AnimationState.FIRST = 1; - AnimationState.HOLD = 2; - AnimationState.HOLD_MIX = 3; - AnimationState.deprecatedWarning1 = false; - AnimationState.deprecatedWarning2 = false; - AnimationState.deprecatedWarning3 = false; - return AnimationState; - })(); - core.AnimationState = AnimationState; - var TrackEntry = (function() { - function TrackEntry() { - this.mixBlend = core.MixBlend.replace; - this.timelineMode = new Array(); - this.timelineHoldMix = new Array(); - this.timelinesRotation = new Array(); - } - TrackEntry.prototype.reset = function() { - this.next = null; - this.mixingFrom = null; - this.mixingTo = null; - this.animation = null; - this.listener = null; - this.timelineMode.length = 0; - this.timelineHoldMix.length = 0; - this.timelinesRotation.length = 0; - }; - TrackEntry.prototype.getAnimationTime = function() { - if (this.loop) { - var duration = this.animationEnd - this.animationStart; - if (duration == 0) return this.animationStart; - return (this.trackTime % duration) + this.animationStart; - } - return Math.min( - this.trackTime + this.animationStart, - this.animationEnd, - ); - }; - TrackEntry.prototype.setAnimationLast = function(animationLast) { - this.animationLast = animationLast; - this.nextAnimationLast = animationLast; - }; - TrackEntry.prototype.isComplete = function() { - return this.trackTime >= this.animationEnd - this.animationStart; - }; - TrackEntry.prototype.resetRotationDirections = function() { - this.timelinesRotation.length = 0; - }; - Object.defineProperty(TrackEntry.prototype, 'time', { - get: function() { - if (!TrackEntry.deprecatedWarning1) { - TrackEntry.deprecatedWarning1 = true; - console.warn( - 'Spine Deprecation Warning: TrackEntry.time is deprecated, please use trackTime from now on.', - ); - } - return this.trackTime; - }, - set: function(value) { - if (!TrackEntry.deprecatedWarning1) { - TrackEntry.deprecatedWarning1 = true; - console.warn( - 'Spine Deprecation Warning: TrackEntry.time is deprecated, please use trackTime from now on.', - ); - } - this.trackTime = value; - }, - enumerable: true, - configurable: true, - }); - Object.defineProperty(TrackEntry.prototype, 'endTime', { - get: function() { - if (!TrackEntry.deprecatedWarning2) { - TrackEntry.deprecatedWarning2 = true; - console.warn( - 'Spine Deprecation Warning: TrackEntry.endTime is deprecated, please use trackEnd from now on.', - ); - } - return this.trackTime; - }, - set: function(value) { - if (!TrackEntry.deprecatedWarning2) { - TrackEntry.deprecatedWarning2 = true; - console.warn( - 'Spine Deprecation Warning: TrackEntry.endTime is deprecated, please use trackEnd from now on.', - ); - } - this.trackTime = value; - }, - enumerable: true, - configurable: true, - }); - TrackEntry.prototype.loopsCount = function() { - return Math.floor(this.trackTime / this.trackEnd); - }; - TrackEntry.deprecatedWarning1 = false; - TrackEntry.deprecatedWarning2 = false; - return TrackEntry; - })(); - core.TrackEntry = TrackEntry; - var EventQueue = (function() { - function EventQueue(animState) { - this.objects = []; - this.drainDisabled = false; - this.animState = animState; - } - EventQueue.prototype.start = function(entry) { - this.objects.push(EventType.start); - this.objects.push(entry); - this.animState.animationsChanged = true; - }; - EventQueue.prototype.interrupt = function(entry) { - this.objects.push(EventType.interrupt); - this.objects.push(entry); - }; - EventQueue.prototype.end = function(entry) { - this.objects.push(EventType.end); - this.objects.push(entry); - this.animState.animationsChanged = true; - }; - EventQueue.prototype.dispose = function(entry) { - this.objects.push(EventType.dispose); - this.objects.push(entry); - }; - EventQueue.prototype.complete = function(entry) { - this.objects.push(EventType.complete); - this.objects.push(entry); - }; - EventQueue.prototype.event = function(entry, event) { - this.objects.push(EventType.event); - this.objects.push(entry); - this.objects.push(event); - }; - EventQueue.prototype.deprecateStuff = function() { - if (!EventQueue.deprecatedWarning1) { - EventQueue.deprecatedWarning1 = true; - console.warn( - "Spine Deprecation Warning: onComplete, onStart, onEnd, onEvent art deprecated, please use listeners from now on. 'state.addListener({ complete: function(track, event) { } })'", - ); - } - return true; - }; - EventQueue.prototype.drain = function() { - if (this.drainDisabled) return; - this.drainDisabled = true; - var objects = this.objects; - var listeners = this.animState.listeners; - for (var i = 0; i < objects.length; i += 2) { - var type = objects[i]; - var entry = objects[i + 1]; - switch (type) { - case EventType.start: - if (entry.listener != null && entry.listener.start) - entry.listener.start(entry); - for (var ii = 0; ii < listeners.length; ii++) - if (listeners[ii].start) listeners[ii].start(entry); - entry.onStart && - this.deprecateStuff() && - entry.onStart(entry.trackIndex); - this.animState.onStart && - this.deprecateStuff() && - this.deprecateStuff && - this.animState.onStart(entry.trackIndex); - break; - case EventType.interrupt: - if (entry.listener != null && entry.listener.interrupt) - entry.listener.interrupt(entry); - for (var ii = 0; ii < listeners.length; ii++) - if (listeners[ii].interrupt) listeners[ii].interrupt(entry); - break; - case EventType.end: - if (entry.listener != null && entry.listener.end) - entry.listener.end(entry); - for (var ii = 0; ii < listeners.length; ii++) - if (listeners[ii].end) listeners[ii].end(entry); - entry.onEnd && - this.deprecateStuff() && - entry.onEnd(entry.trackIndex); - this.animState.onEnd && - this.deprecateStuff() && - this.animState.onEnd(entry.trackIndex); - case EventType.dispose: - if (entry.listener != null && entry.listener.dispose) - entry.listener.dispose(entry); - for (var ii = 0; ii < listeners.length; ii++) - if (listeners[ii].dispose) listeners[ii].dispose(entry); - this.animState.trackEntryPool.free(entry); - break; - case EventType.complete: - if (entry.listener != null && entry.listener.complete) - entry.listener.complete(entry); - for (var ii = 0; ii < listeners.length; ii++) - if (listeners[ii].complete) listeners[ii].complete(entry); - var count = core.MathUtils.toInt(entry.loopsCount()); - entry.onComplete && - this.deprecateStuff() && - entry.onComplete(entry.trackIndex, count); - this.animState.onComplete && - this.deprecateStuff() && - this.animState.onComplete(entry.trackIndex, count); - break; - case EventType.event: - var event_3 = objects[i++ + 2]; - if (entry.listener != null && entry.listener.event) - entry.listener.event(entry, event_3); - for (var ii = 0; ii < listeners.length; ii++) - if (listeners[ii].event) listeners[ii].event(entry, event_3); - entry.onEvent && - this.deprecateStuff() && - entry.onEvent(entry.trackIndex, event_3); - this.animState.onEvent && - this.deprecateStuff() && - this.animState.onEvent(entry.trackIndex, event_3); - break; - } - } - this.clear(); - this.drainDisabled = false; - }; - EventQueue.prototype.clear = function() { - this.objects.length = 0; - }; - EventQueue.deprecatedWarning1 = false; - return EventQueue; - })(); - core.EventQueue = EventQueue; - var EventType; - (function(EventType) { - EventType[(EventType['start'] = 0)] = 'start'; - EventType[(EventType['interrupt'] = 1)] = 'interrupt'; - EventType[(EventType['end'] = 2)] = 'end'; - EventType[(EventType['dispose'] = 3)] = 'dispose'; - EventType[(EventType['complete'] = 4)] = 'complete'; - EventType[(EventType['event'] = 5)] = 'event'; - })((EventType = core.EventType || (core.EventType = {}))); - var AnimationStateAdapter2 = (function() { - function AnimationStateAdapter2() {} - AnimationStateAdapter2.prototype.start = function(entry) {}; - AnimationStateAdapter2.prototype.interrupt = function(entry) {}; - AnimationStateAdapter2.prototype.end = function(entry) {}; - AnimationStateAdapter2.prototype.dispose = function(entry) {}; - AnimationStateAdapter2.prototype.complete = function(entry) {}; - AnimationStateAdapter2.prototype.event = function(entry, event) {}; - return AnimationStateAdapter2; - })(); - core.AnimationStateAdapter2 = AnimationStateAdapter2; - })((pixi_spine.core || (pixi_spine.core = {}))); - })(pixi_spine || (pixi_spine = {})); - var pixi_spine; - (function(pixi_spine) { - (function(core) { - var AnimationStateData = (function() { - function AnimationStateData(skeletonData) { - this.animationToMixTime = {}; - this.defaultMix = 0; - if (skeletonData == null) - throw new Error('skeletonData cannot be null.'); - this.skeletonData = skeletonData; - } - AnimationStateData.prototype.setMix = function( - fromName, - toName, - duration, - ) { - var from = this.skeletonData.findAnimation(fromName); - if (from == null) throw new Error('Animation not found: ' + fromName); - var to = this.skeletonData.findAnimation(toName); - if (to == null) throw new Error('Animation not found: ' + toName); - this.setMixWith(from, to, duration); - }; - AnimationStateData.prototype.setMixByName = function( - fromName, - toName, - duration, - ) { - if (!AnimationStateData.deprecatedWarning1) { - AnimationStateData.deprecatedWarning1 = true; - console.warn( - 'Deprecation Warning: AnimationStateData.setMixByName is deprecated, please use setMix from now on.', - ); - } - this.setMix(fromName, toName, duration); - }; - AnimationStateData.prototype.setMixWith = function(from, to, duration) { - if (from == null) throw new Error('from cannot be null.'); - if (to == null) throw new Error('to cannot be null.'); - var key = from.name + '.' + to.name; - this.animationToMixTime[key] = duration; - }; - AnimationStateData.prototype.getMix = function(from, to) { - var key = from.name + '.' + to.name; - var value = this.animationToMixTime[key]; - return value === undefined ? this.defaultMix : value; - }; - AnimationStateData.deprecatedWarning1 = false; - return AnimationStateData; - })(); - core.AnimationStateData = AnimationStateData; - })((pixi_spine.core || (pixi_spine.core = {}))); - })(pixi_spine || (pixi_spine = {})); - var pixi_spine; - (function(pixi_spine) { - (function(core) { - var AtlasAttachmentLoader = (function() { - function AtlasAttachmentLoader(atlas) { - this.atlas = atlas; - } - AtlasAttachmentLoader.prototype.newRegionAttachment = function( - skin, - name, - path, - ) { - var region = this.atlas.findRegion(path); - if (region == null) - throw new Error( - 'Region not found in atlas: ' + - path + - ' (region attachment: ' + - name + - ')', - ); - var attachment = new core.RegionAttachment(name); - attachment.region = region; - return attachment; - }; - AtlasAttachmentLoader.prototype.newMeshAttachment = function( - skin, - name, - path, - ) { - var region = this.atlas.findRegion(path); - if (region == null) - throw new Error( - 'Region not found in atlas: ' + - path + - ' (mesh attachment: ' + - name + - ')', - ); - var attachment = new core.MeshAttachment(name); - attachment.region = region; - return attachment; - }; - AtlasAttachmentLoader.prototype.newBoundingBoxAttachment = function( - skin, - name, - ) { - return new core.BoundingBoxAttachment(name); - }; - AtlasAttachmentLoader.prototype.newPathAttachment = function(skin, name) { - return new core.PathAttachment(name); - }; - AtlasAttachmentLoader.prototype.newPointAttachment = function( - skin, - name, - ) { - return new core.PointAttachment(name); - }; - AtlasAttachmentLoader.prototype.newClippingAttachment = function( - skin, - name, - ) { - return new core.ClippingAttachment(name); - }; - return AtlasAttachmentLoader; - })(); - core.AtlasAttachmentLoader = AtlasAttachmentLoader; - })((pixi_spine.core || (pixi_spine.core = {}))); - })(pixi_spine || (pixi_spine = {})); - var pixi_spine; - (function(pixi_spine) { - (function(core) { - (function(BlendMode) { - BlendMode[(BlendMode['Normal'] = 0)] = 'Normal'; - BlendMode[(BlendMode['Additive'] = 1)] = 'Additive'; - BlendMode[(BlendMode['Multiply'] = 2)] = 'Multiply'; - BlendMode[(BlendMode['Screen'] = 3)] = 'Screen'; - })((core.BlendMode || (core.BlendMode = {}))); - })((pixi_spine.core || (pixi_spine.core = {}))); - })(pixi_spine || (pixi_spine = {})); - var pixi_spine; - (function(pixi_spine) { - (function(core) { - var Bone = (function() { - function Bone(data, skeleton, parent) { - this.matrix = new PIXI.Matrix(); - this.children = new Array(); - this.x = 0; - this.y = 0; - this.rotation = 0; - this.scaleX = 0; - this.scaleY = 0; - this.shearX = 0; - this.shearY = 0; - this.ax = 0; - this.ay = 0; - this.arotation = 0; - this.ascaleX = 0; - this.ascaleY = 0; - this.ashearX = 0; - this.ashearY = 0; - this.appliedValid = false; - this.sorted = false; - if (data == null) throw new Error('data cannot be null.'); - if (skeleton == null) throw new Error('skeleton cannot be null.'); - this.data = data; - this.skeleton = skeleton; - this.parent = parent; - this.setToSetupPose(); - } - Object.defineProperty(Bone.prototype, 'worldX', { - get: function() { - return this.matrix.tx; - }, - enumerable: true, - configurable: true, - }); - Object.defineProperty(Bone.prototype, 'worldY', { - get: function() { - return this.matrix.ty; - }, - enumerable: true, - configurable: true, - }); - Bone.prototype.update = function() { - this.updateWorldTransformWith( - this.x, - this.y, - this.rotation, - this.scaleX, - this.scaleY, - this.shearX, - this.shearY, - ); - }; - Bone.prototype.updateWorldTransform = function() { - this.updateWorldTransformWith( - this.x, - this.y, - this.rotation, - this.scaleX, - this.scaleY, - this.shearX, - this.shearY, - ); - }; - Bone.prototype.updateWorldTransformWith = function( - x, - y, - rotation, - scaleX, - scaleY, - shearX, - shearY, - ) { - this.ax = x; - this.ay = y; - this.arotation = rotation; - this.ascaleX = scaleX; - this.ascaleY = scaleY; - this.ashearX = shearX; - this.ashearY = shearY; - this.appliedValid = true; - var parent = this.parent; - var m = this.matrix; - var sx = this.skeleton.scaleX; - var sy = Bone.yDown ? -this.skeleton.scaleY : this.skeleton.scaleY; - if (parent == null) { - if (Bone.yDown) { - rotation = -rotation; - this.arotation = rotation; - } - var skeleton = this.skeleton; - var rotationY = rotation + 90 + shearY; - m.a = core.MathUtils.cosDeg(rotation + shearX) * scaleX * sx; - m.c = core.MathUtils.cosDeg(rotationY) * scaleY * sy; - m.b = core.MathUtils.sinDeg(rotation + shearX) * scaleX * sx; - m.d = core.MathUtils.sinDeg(rotationY) * scaleY * sy; - m.tx = x * sx + skeleton.x; - m.ty = y * sy + skeleton.y; - return; - } - var pa = parent.matrix.a, - pb = parent.matrix.c, - pc = parent.matrix.b, - pd = parent.matrix.d; - m.tx = pa * x + pb * y + parent.matrix.tx; - m.ty = pc * x + pd * y + parent.matrix.ty; - switch (this.data.transformMode) { - case core.TransformMode.Normal: { - var rotationY = rotation + 90 + shearY; - var la = core.MathUtils.cosDeg(rotation + shearX) * scaleX; - var lb = core.MathUtils.cosDeg(rotationY) * scaleY; - var lc = core.MathUtils.sinDeg(rotation + shearX) * scaleX; - var ld = core.MathUtils.sinDeg(rotationY) * scaleY; - m.a = pa * la + pb * lc; - m.c = pa * lb + pb * ld; - m.b = pc * la + pd * lc; - m.d = pc * lb + pd * ld; - return; - } - case core.TransformMode.OnlyTranslation: { - var rotationY = rotation + 90 + shearY; - m.a = core.MathUtils.cosDeg(rotation + shearX) * scaleX; - m.c = core.MathUtils.cosDeg(rotationY) * scaleY; - m.b = core.MathUtils.sinDeg(rotation + shearX) * scaleX; - m.d = core.MathUtils.sinDeg(rotationY) * scaleY; - break; - } - case core.TransformMode.NoRotationOrReflection: { - var s = pa * pa + pc * pc; - var prx = 0; - if (s > 0.0001) { - s = Math.abs(pa * pd - pb * pc) / s; - pb = pc * s; - pd = pa * s; - prx = Math.atan2(pc, pa) * core.MathUtils.radDeg; - } else { - pa = 0; - pc = 0; - prx = 90 - Math.atan2(pd, pb) * core.MathUtils.radDeg; - } - var rx = rotation + shearX - prx; - var ry = rotation + shearY - prx + 90; - var la = core.MathUtils.cosDeg(rx) * scaleX; - var lb = core.MathUtils.cosDeg(ry) * scaleY; - var lc = core.MathUtils.sinDeg(rx) * scaleX; - var ld = core.MathUtils.sinDeg(ry) * scaleY; - m.a = pa * la - pb * lc; - m.c = pa * lb - pb * ld; - m.b = pc * la + pd * lc; - m.d = pc * lb + pd * ld; - break; - } - case core.TransformMode.NoScale: - case core.TransformMode.NoScaleOrReflection: { - var cos = core.MathUtils.cosDeg(rotation); - var sin = core.MathUtils.sinDeg(rotation); - var za = (pa * cos + pb * sin) / sx; - var zc = (pc * cos + pd * sin) / sy; - var s = Math.sqrt(za * za + zc * zc); - if (s > 0.00001) s = 1 / s; - za *= s; - zc *= s; - s = Math.sqrt(za * za + zc * zc); - if ( - this.data.transformMode == core.TransformMode.NoScale && - pa * pd - pb * pc < 0 != - (Bone.yDown - ? this.skeleton.scaleX < 0 != this.skeleton.scaleY > 0 - : this.skeleton.scaleX < 0 != this.skeleton.scaleY < 0) - ) - s = -s; - var r = Math.PI / 2 + Math.atan2(zc, za); - var zb = Math.cos(r) * s; - var zd = Math.sin(r) * s; - var la = core.MathUtils.cosDeg(shearX) * scaleX; - var lb = core.MathUtils.cosDeg(90 + shearY) * scaleY; - var lc = core.MathUtils.sinDeg(shearX) * scaleX; - var ld = core.MathUtils.sinDeg(90 + shearY) * scaleY; - m.a = za * la + zb * lc; - m.c = za * lb + zb * ld; - m.b = zc * la + zd * lc; - m.d = zc * lb + zd * ld; - break; - } - } - m.a *= sx; - m.c *= sx; - m.b *= sy; - m.d *= sy; - }; - Bone.prototype.setToSetupPose = function() { - var data = this.data; - this.x = data.x; - this.y = data.y; - this.rotation = data.rotation; - this.scaleX = data.scaleX; - this.scaleY = data.scaleY; - this.shearX = data.shearX; - this.shearY = data.shearY; - }; - Bone.prototype.getWorldRotationX = function() { - return Math.atan2(this.matrix.b, this.matrix.a) * core.MathUtils.radDeg; - }; - Bone.prototype.getWorldRotationY = function() { - return Math.atan2(this.matrix.d, this.matrix.c) * core.MathUtils.radDeg; - }; - Bone.prototype.getWorldScaleX = function() { - var m = this.matrix; - return Math.sqrt(m.a * m.a + m.c * m.c); - }; - Bone.prototype.getWorldScaleY = function() { - var m = this.matrix; - return Math.sqrt(m.b * m.b + m.d * m.d); - }; - Bone.prototype.updateAppliedTransform = function() { - this.appliedValid = true; - var parent = this.parent; - var m = this.matrix; - if (parent == null) { - this.ax = m.tx; - this.ay = m.ty; - this.arotation = Math.atan2(m.b, m.a) * core.MathUtils.radDeg; - this.ascaleX = Math.sqrt(m.a * m.a + m.b * m.b); - this.ascaleY = Math.sqrt(m.c * m.c + m.d * m.d); - this.ashearX = 0; - this.ashearY = - Math.atan2(m.a * m.c + m.b * m.d, m.a * m.d - m.b * m.c) * - core.MathUtils.radDeg; - return; - } - var pm = parent.matrix; - var pid = 1 / (pm.a * pm.d - pm.b * pm.c); - var dx = m.tx - pm.tx, - dy = m.ty - pm.ty; - this.ax = dx * pm.d * pid - dy * pm.c * pid; - this.ay = dy * pm.a * pid - dx * pm.b * pid; - var ia = pid * pm.d; - var id = pid * pm.a; - var ib = pid * pm.c; - var ic = pid * pm.b; - var ra = ia * m.a - ib * m.b; - var rb = ia * m.c - ib * m.d; - var rc = id * m.b - ic * m.a; - var rd = id * m.d - ic * m.c; - this.ashearX = 0; - this.ascaleX = Math.sqrt(ra * ra + rc * rc); - if (this.ascaleX > 0.0001) { - var det = ra * rd - rb * rc; - this.ascaleY = det / this.ascaleX; - this.ashearY = - Math.atan2(ra * rb + rc * rd, det) * core.MathUtils.radDeg; - this.arotation = Math.atan2(rc, ra) * core.MathUtils.radDeg; - } else { - this.ascaleX = 0; - this.ascaleY = Math.sqrt(rb * rb + rd * rd); - this.ashearY = 0; - this.arotation = 90 - Math.atan2(rd, rb) * core.MathUtils.radDeg; - } - }; - Bone.prototype.worldToLocal = function(world) { - var m = this.matrix; - var a = m.a, - b = m.c, - c = m.b, - d = m.d; - var invDet = 1 / (a * d - b * c); - var x = world.x - m.tx, - y = world.y - m.ty; - world.x = x * d * invDet - y * b * invDet; - world.y = y * a * invDet - x * c * invDet; - return world; - }; - Bone.prototype.localToWorld = function(local) { - var m = this.matrix; - var x = local.x, - y = local.y; - local.x = x * m.a + y * m.c + m.tx; - local.y = x * m.b + y * m.d + m.ty; - return local; - }; - Bone.prototype.worldToLocalRotation = function(worldRotation) { - var sin = core.MathUtils.sinDeg(worldRotation), - cos = core.MathUtils.cosDeg(worldRotation); - var mat = this.matrix; - return ( - Math.atan2(mat.a * sin - mat.b * cos, mat.d * cos - mat.c * sin) * - core.MathUtils.radDeg - ); - }; - Bone.prototype.localToWorldRotation = function(localRotation) { - var sin = core.MathUtils.sinDeg(localRotation), - cos = core.MathUtils.cosDeg(localRotation); - var mat = this.matrix; - return ( - Math.atan2(cos * mat.b + sin * mat.d, cos * mat.a + sin * mat.c) * - core.MathUtils.radDeg - ); - }; - Bone.prototype.rotateWorld = function(degrees) { - var mat = this.matrix; - var a = mat.a, - b = mat.c, - c = mat.b, - d = mat.d; - var cos = core.MathUtils.cosDeg(degrees), - sin = core.MathUtils.sinDeg(degrees); - mat.a = cos * a - sin * c; - mat.c = cos * b - sin * d; - mat.b = sin * a + cos * c; - mat.d = sin * b + cos * d; - this.appliedValid = false; - }; - Bone.yDown = false; - return Bone; - })(); - core.Bone = Bone; - })((pixi_spine.core || (pixi_spine.core = {}))); - })(pixi_spine || (pixi_spine = {})); - var pixi_spine; - (function(pixi_spine) { - (function(core) { - var BoneData = (function() { - function BoneData(index, name, parent) { - this.x = 0; - this.y = 0; - this.rotation = 0; - this.scaleX = 1; - this.scaleY = 1; - this.shearX = 0; - this.shearY = 0; - this.transformMode = TransformMode.Normal; - if (index < 0) throw new Error('index must be >= 0.'); - if (name == null) throw new Error('name cannot be null.'); - this.index = index; - this.name = name; - this.parent = parent; - } - return BoneData; - })(); - core.BoneData = BoneData; - var TransformMode; - (function(TransformMode) { - TransformMode[(TransformMode['Normal'] = 0)] = 'Normal'; - TransformMode[(TransformMode['OnlyTranslation'] = 1)] = 'OnlyTranslation'; - TransformMode[(TransformMode['NoRotationOrReflection'] = 2)] = - 'NoRotationOrReflection'; - TransformMode[(TransformMode['NoScale'] = 3)] = 'NoScale'; - TransformMode[(TransformMode['NoScaleOrReflection'] = 4)] = - 'NoScaleOrReflection'; - })((TransformMode = core.TransformMode || (core.TransformMode = {}))); - })((pixi_spine.core || (pixi_spine.core = {}))); - })(pixi_spine || (pixi_spine = {})); - var pixi_spine; - (function(pixi_spine) { - (function(core) { - var Event = (function() { - function Event(time, data) { - if (data == null) throw new Error('data cannot be null.'); - this.time = time; - this.data = data; - } - return Event; - })(); - core.Event = Event; - })((pixi_spine.core || (pixi_spine.core = {}))); - })(pixi_spine || (pixi_spine = {})); - var pixi_spine; - (function(pixi_spine) { - (function(core) { - var EventData = (function() { - function EventData(name) { - this.name = name; - } - return EventData; - })(); - core.EventData = EventData; - })((pixi_spine.core || (pixi_spine.core = {}))); - })(pixi_spine || (pixi_spine = {})); - var pixi_spine; - (function(pixi_spine) { - (function(core) { - var IkConstraint = (function() { - function IkConstraint(data, skeleton) { - this.bendDirection = 0; - this.compress = false; - this.stretch = false; - this.mix = 1; - if (data == null) throw new Error('data cannot be null.'); - if (skeleton == null) throw new Error('skeleton cannot be null.'); - this.data = data; - this.mix = data.mix; - this.bendDirection = data.bendDirection; - this.compress = data.compress; - this.stretch = data.stretch; - this.bones = new Array(); - for (var i = 0; i < data.bones.length; i++) - this.bones.push(skeleton.findBone(data.bones[i].name)); - this.target = skeleton.findBone(data.target.name); - } - IkConstraint.prototype.getOrder = function() { - return this.data.order; - }; - IkConstraint.prototype.apply = function() { - this.update(); - }; - IkConstraint.prototype.update = function() { - var target = this.target; - var bones = this.bones; - switch (bones.length) { - case 1: - this.apply1( - bones[0], - target.worldX, - target.worldY, - this.compress, - this.stretch, - this.data.uniform, - this.mix, - ); - break; - case 2: - this.apply2( - bones[0], - bones[1], - target.worldX, - target.worldY, - this.bendDirection, - this.stretch, - this.mix, - ); - break; - } - }; - IkConstraint.prototype.apply1 = function( - bone, - targetX, - targetY, - compress, - stretch, - uniform, - alpha, - ) { - if (!bone.appliedValid) bone.updateAppliedTransform(); - var p = bone.parent.matrix; - var id = 1 / (p.a * p.d - p.b * p.c); - var x = targetX - p.tx, - y = targetY - p.ty; - var tx = (x * p.d - y * p.c) * id - bone.ax, - ty = (y * p.a - x * p.b) * id - bone.ay; - var rotationIK = - Math.atan2(ty, tx) * core.MathUtils.radDeg - - bone.ashearX - - bone.arotation; - if (bone.ascaleX < 0) rotationIK += 180; - if (rotationIK > 180) rotationIK -= 360; - else if (rotationIK < -180) rotationIK += 360; - var sx = bone.ascaleX, - sy = bone.ascaleY; - if (compress || stretch) { - var b = bone.data.length * sx, - dd = Math.sqrt(tx * tx + ty * ty); - if ((compress && dd < b) || (stretch && dd > b && b > 0.0001)) { - var s = (dd / b - 1) * alpha + 1; - sx *= s; - if (uniform) sy *= s; - } - } - bone.updateWorldTransformWith( - bone.ax, - bone.ay, - bone.arotation + rotationIK * alpha, - sx, - sy, - bone.ashearX, - bone.ashearY, - ); - }; - IkConstraint.prototype.apply2 = function( - parent, - child, - targetX, - targetY, - bendDir, - stretch, - alpha, - ) { - if (alpha == 0) { - child.updateWorldTransform(); - return; - } - if (!parent.appliedValid) parent.updateAppliedTransform(); - if (!child.appliedValid) child.updateAppliedTransform(); - var px = parent.ax, - py = parent.ay, - psx = parent.ascaleX, - sx = psx, - psy = parent.ascaleY, - csx = child.ascaleX; - var pmat = parent.matrix; - var os1 = 0, - os2 = 0, - s2 = 0; - if (psx < 0) { - psx = -psx; - os1 = 180; - s2 = -1; - } else { - os1 = 0; - s2 = 1; - } - if (psy < 0) { - psy = -psy; - s2 = -s2; - } - if (csx < 0) { - csx = -csx; - os2 = 180; - } else os2 = 0; - var cx = child.ax, - cy = 0, - cwx = 0, - cwy = 0, - a = pmat.a, - b = pmat.c, - c = pmat.b, - d = pmat.d; - var u = Math.abs(psx - psy) <= 0.0001; - if (!u) { - cy = 0; - cwx = a * cx + pmat.tx; - cwy = c * cx + pmat.ty; - } else { - cy = child.ay; - cwx = a * cx + b * cy + pmat.tx; - cwy = c * cx + d * cy + pmat.ty; - } - var pp = parent.parent.matrix; - a = pp.a; - b = pp.c; - c = pp.b; - d = pp.d; - var id = 1 / (a * d - b * c), - x = targetX - pp.tx, - y = targetY - pp.ty; - var tx = (x * d - y * b) * id - px, - ty = (y * a - x * c) * id - py, - dd = tx * tx + ty * ty; - x = cwx - pp.tx; - y = cwy - pp.ty; - var dx = (x * d - y * b) * id - px, - dy = (y * a - x * c) * id - py; - var l1 = Math.sqrt(dx * dx + dy * dy), - l2 = child.data.length * csx, - a1 = 0, - a2 = 0; - outer: if (u) { - l2 *= psx; - var cos = (dd - l1 * l1 - l2 * l2) / (2 * l1 * l2); - if (cos < -1) cos = -1; - else if (cos > 1) { - cos = 1; - if (stretch && l1 + l2 > 0.0001) - sx *= (Math.sqrt(dd) / (l1 + l2) - 1) * alpha + 1; - } - a2 = Math.acos(cos) * bendDir; - a = l1 + l2 * cos; - b = l2 * Math.sin(a2); - a1 = Math.atan2(ty * a - tx * b, tx * a + ty * b); - } else { - a = psx * l2; - b = psy * l2; - var aa = a * a, - bb = b * b, - ta = Math.atan2(ty, tx); - c = bb * l1 * l1 + aa * dd - aa * bb; - var c1 = -2 * bb * l1, - c2 = bb - aa; - d = c1 * c1 - 4 * c2 * c; - if (d >= 0) { - var q = Math.sqrt(d); - if (c1 < 0) q = -q; - q = -(c1 + q) / 2; - var r0 = q / c2, - r1 = c / q; - var r = Math.abs(r0) < Math.abs(r1) ? r0 : r1; - if (r * r <= dd) { - y = Math.sqrt(dd - r * r) * bendDir; - a1 = ta - Math.atan2(y, r); - a2 = Math.atan2(y / psy, (r - l1) / psx); - break outer; - } - } - var minAngle = core.MathUtils.PI, - minX = l1 - a, - minDist = minX * minX, - minY = 0; - var maxAngle = 0, - maxX = l1 + a, - maxDist = maxX * maxX, - maxY = 0; - c = (-a * l1) / (aa - bb); - if (c >= -1 && c <= 1) { - c = Math.acos(c); - x = a * Math.cos(c) + l1; - y = b * Math.sin(c); - d = x * x + y * y; - if (d < minDist) { - minAngle = c; - minDist = d; - minX = x; - minY = y; - } - if (d > maxDist) { - maxAngle = c; - maxDist = d; - maxX = x; - maxY = y; - } - } - if (dd <= (minDist + maxDist) / 2) { - a1 = ta - Math.atan2(minY * bendDir, minX); - a2 = minAngle * bendDir; - } else { - a1 = ta - Math.atan2(maxY * bendDir, maxX); - a2 = maxAngle * bendDir; - } - } - var os = Math.atan2(cy, cx) * s2; - var rotation = parent.arotation; - a1 = (a1 - os) * core.MathUtils.radDeg + os1 - rotation; - if (a1 > 180) a1 -= 360; - else if (a1 < -180) a1 += 360; - parent.updateWorldTransformWith( - px, - py, - rotation + a1 * alpha, - sx, - parent.ascaleY, - 0, - 0, - ); - rotation = child.arotation; - a2 = - ((a2 + os) * core.MathUtils.radDeg - child.ashearX) * s2 + - os2 - - rotation; - if (a2 > 180) a2 -= 360; - else if (a2 < -180) a2 += 360; - child.updateWorldTransformWith( - cx, - cy, - rotation + a2 * alpha, - child.ascaleX, - child.ascaleY, - child.ashearX, - child.ashearY, - ); - }; - return IkConstraint; - })(); - core.IkConstraint = IkConstraint; - })((pixi_spine.core || (pixi_spine.core = {}))); - })(pixi_spine || (pixi_spine = {})); - var pixi_spine; - (function(pixi_spine) { - (function(core) { - var IkConstraintData = (function() { - function IkConstraintData(name) { - this.order = 0; - this.bones = new Array(); - this.bendDirection = 1; - this.compress = false; - this.stretch = false; - this.uniform = false; - this.mix = 1; - this.name = name; - } - return IkConstraintData; - })(); - core.IkConstraintData = IkConstraintData; - })((pixi_spine.core || (pixi_spine.core = {}))); - })(pixi_spine || (pixi_spine = {})); - var pixi_spine; - (function(pixi_spine) { - (function(core) { - var PathConstraint = (function() { - function PathConstraint(data, skeleton) { - this.position = 0; - this.spacing = 0; - this.rotateMix = 0; - this.translateMix = 0; - this.spaces = new Array(); - this.positions = new Array(); - this.world = new Array(); - this.curves = new Array(); - this.lengths = new Array(); - this.segments = new Array(); - if (data == null) throw new Error('data cannot be null.'); - if (skeleton == null) throw new Error('skeleton cannot be null.'); - this.data = data; - this.bones = new Array(); - for (var i = 0, n = data.bones.length; i < n; i++) - this.bones.push(skeleton.findBone(data.bones[i].name)); - this.target = skeleton.findSlot(data.target.name); - this.position = data.position; - this.spacing = data.spacing; - this.rotateMix = data.rotateMix; - this.translateMix = data.translateMix; - } - PathConstraint.prototype.apply = function() { - this.update(); - }; - PathConstraint.prototype.update = function() { - var attachment = this.target.getAttachment(); - if (!(attachment instanceof core.PathAttachment)) return; - var rotateMix = this.rotateMix, - translateMix = this.translateMix; - var translate = translateMix > 0, - rotate = rotateMix > 0; - if (!translate && !rotate) return; - var data = this.data; - var spacingMode = data.spacingMode; - var lengthSpacing = spacingMode == core.SpacingMode.Length; - var rotateMode = data.rotateMode; - var tangents = rotateMode == core.RotateMode.Tangent, - scale = rotateMode == core.RotateMode.ChainScale; - var boneCount = this.bones.length, - spacesCount = tangents ? boneCount : boneCount + 1; - var bones = this.bones; - var spaces = core.Utils.setArraySize(this.spaces, spacesCount), - lengths = null; - var spacing = this.spacing; - if (scale || lengthSpacing) { - if (scale) lengths = core.Utils.setArraySize(this.lengths, boneCount); - for (var i = 0, n = spacesCount - 1; i < n; ) { - var bone = bones[i]; - var setupLength = bone.data.length; - if (setupLength < PathConstraint.epsilon) { - if (scale) lengths[i] = 0; - spaces[++i] = 0; - } else { - var x = setupLength * bone.matrix.a, - y = setupLength * bone.matrix.b; - var length_1 = Math.sqrt(x * x + y * y); - if (scale) lengths[i] = length_1; - spaces[++i] = - ((lengthSpacing ? setupLength + spacing : spacing) * length_1) / - setupLength; - } - } - } else { - for (var i = 1; i < spacesCount; i++) spaces[i] = spacing; - } - var positions = this.computeWorldPositions( - attachment, - spacesCount, - tangents, - data.positionMode == core.PositionMode.Percent, - spacingMode == core.SpacingMode.Percent, - ); - var boneX = positions[0], - boneY = positions[1], - offsetRotation = data.offsetRotation; - var tip = false; - if (offsetRotation == 0) tip = rotateMode == core.RotateMode.Chain; - else { - tip = false; - var p = this.target.bone.matrix; - offsetRotation *= - p.a * p.d - p.b * p.c > 0 - ? core.MathUtils.degRad - : -core.MathUtils.degRad; - } - for (var i = 0, p = 3; i < boneCount; i++, p += 3) { - var bone = bones[i]; - var mat = bone.matrix; - mat.tx += (boneX - mat.tx) * translateMix; - mat.ty += (boneY - mat.ty) * translateMix; - var x = positions[p], - y = positions[p + 1], - dx = x - boneX, - dy = y - boneY; - if (scale) { - var length_2 = lengths[i]; - if (length_2 != 0) { - var s = - (Math.sqrt(dx * dx + dy * dy) / length_2 - 1) * rotateMix + 1; - mat.a *= s; - mat.b *= s; - } - } - boneX = x; - boneY = y; - if (rotate) { - var a = mat.a, - b = mat.c, - c = mat.b, - d = mat.d, - r = 0, - cos = 0, - sin = 0; - if (tangents) r = positions[p - 1]; - else if (spaces[i + 1] == 0) r = positions[p + 2]; - else r = Math.atan2(dy, dx); - r -= Math.atan2(c, a); - if (tip) { - cos = Math.cos(r); - sin = Math.sin(r); - var length_3 = bone.data.length; - boneX += (length_3 * (cos * a - sin * c) - dx) * rotateMix; - boneY += (length_3 * (sin * a + cos * c) - dy) * rotateMix; - } else { - r += offsetRotation; - } - if (r > core.MathUtils.PI) r -= core.MathUtils.PI2; - else if (r < -core.MathUtils.PI) r += core.MathUtils.PI2; - r *= rotateMix; - cos = Math.cos(r); - sin = Math.sin(r); - mat.a = cos * a - sin * c; - mat.c = cos * b - sin * d; - mat.b = sin * a + cos * c; - mat.d = sin * b + cos * d; - } - bone.appliedValid = false; - } - }; - PathConstraint.prototype.computeWorldPositions = function( - path, - spacesCount, - tangents, - percentPosition, - percentSpacing, - ) { - var target = this.target; - var position = this.position; - var spaces = this.spaces, - out = core.Utils.setArraySize(this.positions, spacesCount * 3 + 2), - world = null; - var closed = path.closed; - var verticesLength = path.worldVerticesLength, - curveCount = verticesLength / 6, - prevCurve = PathConstraint.NONE; - if (!path.constantSpeed) { - var lengths = path.lengths; - curveCount -= closed ? 1 : 2; - var pathLength_1 = lengths[curveCount]; - if (percentPosition) position *= pathLength_1; - if (percentSpacing) { - for (var i = 0; i < spacesCount; i++) spaces[i] *= pathLength_1; - } - world = core.Utils.setArraySize(this.world, 8); - for (var i = 0, o = 0, curve = 0; i < spacesCount; i++, o += 3) { - var space = spaces[i]; - position += space; - var p = position; - if (closed) { - p %= pathLength_1; - if (p < 0) p += pathLength_1; - curve = 0; - } else if (p < 0) { - if (prevCurve != PathConstraint.BEFORE) { - prevCurve = PathConstraint.BEFORE; - path.computeWorldVertices(target, 2, 4, world, 0, 2); - } - this.addBeforePosition(p, world, 0, out, o); - continue; - } else if (p > pathLength_1) { - if (prevCurve != PathConstraint.AFTER) { - prevCurve = PathConstraint.AFTER; - path.computeWorldVertices( - target, - verticesLength - 6, - 4, - world, - 0, - 2, - ); - } - this.addAfterPosition(p - pathLength_1, world, 0, out, o); - continue; - } - for (; ; curve++) { - var length_4 = lengths[curve]; - if (p > length_4) continue; - if (curve == 0) p /= length_4; - else { - var prev = lengths[curve - 1]; - p = (p - prev) / (length_4 - prev); - } - break; - } - if (curve != prevCurve) { - prevCurve = curve; - if (closed && curve == curveCount) { - path.computeWorldVertices( - target, - verticesLength - 4, - 4, - world, - 0, - 2, - ); - path.computeWorldVertices(target, 0, 4, world, 4, 2); - } else - path.computeWorldVertices( - target, - curve * 6 + 2, - 8, - world, - 0, - 2, - ); - } - this.addCurvePosition( - p, - world[0], - world[1], - world[2], - world[3], - world[4], - world[5], - world[6], - world[7], - out, - o, - tangents || (i > 0 && space == 0), - ); - } - return out; - } - if (closed) { - verticesLength += 2; - world = core.Utils.setArraySize(this.world, verticesLength); - path.computeWorldVertices(target, 2, verticesLength - 4, world, 0, 2); - path.computeWorldVertices(target, 0, 2, world, verticesLength - 4, 2); - world[verticesLength - 2] = world[0]; - world[verticesLength - 1] = world[1]; - } else { - curveCount--; - verticesLength -= 4; - world = core.Utils.setArraySize(this.world, verticesLength); - path.computeWorldVertices(target, 2, verticesLength, world, 0, 2); - } - var curves = core.Utils.setArraySize(this.curves, curveCount); - var pathLength = 0; - var x1 = world[0], - y1 = world[1], - cx1 = 0, - cy1 = 0, - cx2 = 0, - cy2 = 0, - x2 = 0, - y2 = 0; - var tmpx = 0, - tmpy = 0, - dddfx = 0, - dddfy = 0, - ddfx = 0, - ddfy = 0, - dfx = 0, - dfy = 0; - for (var i = 0, w = 2; i < curveCount; i++, w += 6) { - cx1 = world[w]; - cy1 = world[w + 1]; - cx2 = world[w + 2]; - cy2 = world[w + 3]; - x2 = world[w + 4]; - y2 = world[w + 5]; - tmpx = (x1 - cx1 * 2 + cx2) * 0.1875; - tmpy = (y1 - cy1 * 2 + cy2) * 0.1875; - dddfx = ((cx1 - cx2) * 3 - x1 + x2) * 0.09375; - dddfy = ((cy1 - cy2) * 3 - y1 + y2) * 0.09375; - ddfx = tmpx * 2 + dddfx; - ddfy = tmpy * 2 + dddfy; - dfx = (cx1 - x1) * 0.75 + tmpx + dddfx * 0.16666667; - dfy = (cy1 - y1) * 0.75 + tmpy + dddfy * 0.16666667; - pathLength += Math.sqrt(dfx * dfx + dfy * dfy); - dfx += ddfx; - dfy += ddfy; - ddfx += dddfx; - ddfy += dddfy; - pathLength += Math.sqrt(dfx * dfx + dfy * dfy); - dfx += ddfx; - dfy += ddfy; - pathLength += Math.sqrt(dfx * dfx + dfy * dfy); - dfx += ddfx + dddfx; - dfy += ddfy + dddfy; - pathLength += Math.sqrt(dfx * dfx + dfy * dfy); - curves[i] = pathLength; - x1 = x2; - y1 = y2; - } - if (percentPosition) position *= pathLength; - if (percentSpacing) { - for (var i = 0; i < spacesCount; i++) spaces[i] *= pathLength; - } - var segments = this.segments; - var curveLength = 0; - for ( - var i = 0, o = 0, curve = 0, segment = 0; - i < spacesCount; - i++, o += 3 - ) { - var space = spaces[i]; - position += space; - var p = position; - if (closed) { - p %= pathLength; - if (p < 0) p += pathLength; - curve = 0; - } else if (p < 0) { - this.addBeforePosition(p, world, 0, out, o); - continue; - } else if (p > pathLength) { - this.addAfterPosition( - p - pathLength, - world, - verticesLength - 4, - out, - o, - ); - continue; - } - for (; ; curve++) { - var length_5 = curves[curve]; - if (p > length_5) continue; - if (curve == 0) p /= length_5; - else { - var prev = curves[curve - 1]; - p = (p - prev) / (length_5 - prev); - } - break; - } - if (curve != prevCurve) { - prevCurve = curve; - var ii = curve * 6; - x1 = world[ii]; - y1 = world[ii + 1]; - cx1 = world[ii + 2]; - cy1 = world[ii + 3]; - cx2 = world[ii + 4]; - cy2 = world[ii + 5]; - x2 = world[ii + 6]; - y2 = world[ii + 7]; - tmpx = (x1 - cx1 * 2 + cx2) * 0.03; - tmpy = (y1 - cy1 * 2 + cy2) * 0.03; - dddfx = ((cx1 - cx2) * 3 - x1 + x2) * 0.006; - dddfy = ((cy1 - cy2) * 3 - y1 + y2) * 0.006; - ddfx = tmpx * 2 + dddfx; - ddfy = tmpy * 2 + dddfy; - dfx = (cx1 - x1) * 0.3 + tmpx + dddfx * 0.16666667; - dfy = (cy1 - y1) * 0.3 + tmpy + dddfy * 0.16666667; - curveLength = Math.sqrt(dfx * dfx + dfy * dfy); - segments[0] = curveLength; - for (ii = 1; ii < 8; ii++) { - dfx += ddfx; - dfy += ddfy; - ddfx += dddfx; - ddfy += dddfy; - curveLength += Math.sqrt(dfx * dfx + dfy * dfy); - segments[ii] = curveLength; - } - dfx += ddfx; - dfy += ddfy; - curveLength += Math.sqrt(dfx * dfx + dfy * dfy); - segments[8] = curveLength; - dfx += ddfx + dddfx; - dfy += ddfy + dddfy; - curveLength += Math.sqrt(dfx * dfx + dfy * dfy); - segments[9] = curveLength; - segment = 0; - } - p *= curveLength; - for (; ; segment++) { - var length_6 = segments[segment]; - if (p > length_6) continue; - if (segment == 0) p /= length_6; - else { - var prev = segments[segment - 1]; - p = segment + (p - prev) / (length_6 - prev); - } - break; - } - this.addCurvePosition( - p * 0.1, - x1, - y1, - cx1, - cy1, - cx2, - cy2, - x2, - y2, - out, - o, - tangents || (i > 0 && space == 0), - ); - } - return out; - }; - PathConstraint.prototype.addBeforePosition = function( - p, - temp, - i, - out, - o, - ) { - var x1 = temp[i], - y1 = temp[i + 1], - dx = temp[i + 2] - x1, - dy = temp[i + 3] - y1, - r = Math.atan2(dy, dx); - out[o] = x1 + p * Math.cos(r); - out[o + 1] = y1 + p * Math.sin(r); - out[o + 2] = r; - }; - PathConstraint.prototype.addAfterPosition = function(p, temp, i, out, o) { - var x1 = temp[i + 2], - y1 = temp[i + 3], - dx = x1 - temp[i], - dy = y1 - temp[i + 1], - r = Math.atan2(dy, dx); - out[o] = x1 + p * Math.cos(r); - out[o + 1] = y1 + p * Math.sin(r); - out[o + 2] = r; - }; - PathConstraint.prototype.addCurvePosition = function( - p, - x1, - y1, - cx1, - cy1, - cx2, - cy2, - x2, - y2, - out, - o, - tangents, - ) { - if (p == 0 || isNaN(p)) p = 0.0001; - var tt = p * p, - ttt = tt * p, - u = 1 - p, - uu = u * u, - uuu = uu * u; - var ut = u * p, - ut3 = ut * 3, - uut3 = u * ut3, - utt3 = ut3 * p; - var x = x1 * uuu + cx1 * uut3 + cx2 * utt3 + x2 * ttt, - y = y1 * uuu + cy1 * uut3 + cy2 * utt3 + y2 * ttt; - out[o] = x; - out[o + 1] = y; - if (tangents) - out[o + 2] = Math.atan2( - y - (y1 * uu + cy1 * ut * 2 + cy2 * tt), - x - (x1 * uu + cx1 * ut * 2 + cx2 * tt), - ); - }; - PathConstraint.prototype.getOrder = function() { - return this.data.order; - }; - PathConstraint.NONE = -1; - PathConstraint.BEFORE = -2; - PathConstraint.AFTER = -3; - PathConstraint.epsilon = 0.00001; - return PathConstraint; - })(); - core.PathConstraint = PathConstraint; - })((pixi_spine.core || (pixi_spine.core = {}))); - })(pixi_spine || (pixi_spine = {})); - var pixi_spine; - (function(pixi_spine) { - (function(core) { - var PathConstraintData = (function() { - function PathConstraintData(name) { - this.order = 0; - this.bones = new Array(); - this.name = name; - } - return PathConstraintData; - })(); - core.PathConstraintData = PathConstraintData; - (function(PositionMode) { - PositionMode[(PositionMode['Fixed'] = 0)] = 'Fixed'; - PositionMode[(PositionMode['Percent'] = 1)] = 'Percent'; - })((core.PositionMode || (core.PositionMode = {}))); - (function(SpacingMode) { - SpacingMode[(SpacingMode['Length'] = 0)] = 'Length'; - SpacingMode[(SpacingMode['Fixed'] = 1)] = 'Fixed'; - SpacingMode[(SpacingMode['Percent'] = 2)] = 'Percent'; - })((core.SpacingMode || (core.SpacingMode = {}))); - (function(RotateMode) { - RotateMode[(RotateMode['Tangent'] = 0)] = 'Tangent'; - RotateMode[(RotateMode['Chain'] = 1)] = 'Chain'; - RotateMode[(RotateMode['ChainScale'] = 2)] = 'ChainScale'; - })((core.RotateMode || (core.RotateMode = {}))); - })((pixi_spine.core || (pixi_spine.core = {}))); - })(pixi_spine || (pixi_spine = {})); - var pixi_spine; - (function(pixi_spine) { - (function(core) { - var Skeleton = (function() { - function Skeleton(data) { - this._updateCache = new Array(); - this.updateCacheReset = new Array(); - this.time = 0; - this.scaleX = 1; - this.scaleY = 1; - this.x = 0; - this.y = 0; - if (data == null) throw new Error('data cannot be null.'); - this.data = data; - this.bones = new Array(); - for (var i = 0; i < data.bones.length; i++) { - var boneData = data.bones[i]; - var bone = void 0; - if (boneData.parent == null) - bone = new core.Bone(boneData, this, null); - else { - var parent_1 = this.bones[boneData.parent.index]; - bone = new core.Bone(boneData, this, parent_1); - parent_1.children.push(bone); - } - this.bones.push(bone); - } - this.slots = new Array(); - this.drawOrder = new Array(); - for (var i = 0; i < data.slots.length; i++) { - var slotData = data.slots[i]; - var bone = this.bones[slotData.boneData.index]; - var slot = new core.Slot(slotData, bone); - this.slots.push(slot); - this.drawOrder.push(slot); - } - this.ikConstraints = new Array(); - for (var i = 0; i < data.ikConstraints.length; i++) { - var ikConstraintData = data.ikConstraints[i]; - this.ikConstraints.push( - new core.IkConstraint(ikConstraintData, this), - ); - } - this.transformConstraints = new Array(); - for (var i = 0; i < data.transformConstraints.length; i++) { - var transformConstraintData = data.transformConstraints[i]; - this.transformConstraints.push( - new core.TransformConstraint(transformConstraintData, this), - ); - } - this.pathConstraints = new Array(); - for (var i = 0; i < data.pathConstraints.length; i++) { - var pathConstraintData = data.pathConstraints[i]; - this.pathConstraints.push( - new core.PathConstraint(pathConstraintData, this), - ); - } - this.color = new core.Color(1, 1, 1, 1); - this.updateCache(); - } - Skeleton.prototype.updateCache = function() { - var updateCache = this._updateCache; - updateCache.length = 0; - this.updateCacheReset.length = 0; - var bones = this.bones; - for (var i = 0, n = bones.length; i < n; i++) bones[i].sorted = false; - var ikConstraints = this.ikConstraints; - var transformConstraints = this.transformConstraints; - var pathConstraints = this.pathConstraints; - var ikCount = ikConstraints.length, - transformCount = transformConstraints.length, - pathCount = pathConstraints.length; - var constraintCount = ikCount + transformCount + pathCount; - outer: for (var i = 0; i < constraintCount; i++) { - for (var ii = 0; ii < ikCount; ii++) { - var constraint = ikConstraints[ii]; - if (constraint.data.order == i) { - this.sortIkConstraint(constraint); - continue outer; - } - } - for (var ii = 0; ii < transformCount; ii++) { - var constraint = transformConstraints[ii]; - if (constraint.data.order == i) { - this.sortTransformConstraint(constraint); - continue outer; - } - } - for (var ii = 0; ii < pathCount; ii++) { - var constraint = pathConstraints[ii]; - if (constraint.data.order == i) { - this.sortPathConstraint(constraint); - continue outer; - } - } - } - for (var i = 0, n = bones.length; i < n; i++) this.sortBone(bones[i]); - }; - Skeleton.prototype.sortIkConstraint = function(constraint) { - var target = constraint.target; - this.sortBone(target); - var constrained = constraint.bones; - var parent = constrained[0]; - this.sortBone(parent); - if (constrained.length > 1) { - var child = constrained[constrained.length - 1]; - if (!(this._updateCache.indexOf(child) > -1)) - this.updateCacheReset.push(child); - } - this._updateCache.push(constraint); - this.sortReset(parent.children); - constrained[constrained.length - 1].sorted = true; - }; - Skeleton.prototype.sortPathConstraint = function(constraint) { - var slot = constraint.target; - var slotIndex = slot.data.index; - var slotBone = slot.bone; - if (this.skin != null) - this.sortPathConstraintAttachment(this.skin, slotIndex, slotBone); - if (this.data.defaultSkin != null && this.data.defaultSkin != this.skin) - this.sortPathConstraintAttachment( - this.data.defaultSkin, - slotIndex, - slotBone, - ); - for (var i = 0, n = this.data.skins.length; i < n; i++) - this.sortPathConstraintAttachment( - this.data.skins[i], - slotIndex, - slotBone, - ); - var attachment = slot.getAttachment(); - if (attachment instanceof core.PathAttachment) - this.sortPathConstraintAttachmentWith(attachment, slotBone); - var constrained = constraint.bones; - var boneCount = constrained.length; - for (var i = 0; i < boneCount; i++) this.sortBone(constrained[i]); - this._updateCache.push(constraint); - for (var i = 0; i < boneCount; i++) - this.sortReset(constrained[i].children); - for (var i = 0; i < boneCount; i++) constrained[i].sorted = true; - }; - Skeleton.prototype.sortTransformConstraint = function(constraint) { - this.sortBone(constraint.target); - var constrained = constraint.bones; - var boneCount = constrained.length; - if (constraint.data.local) { - for (var i = 0; i < boneCount; i++) { - var child = constrained[i]; - this.sortBone(child.parent); - if (!(this._updateCache.indexOf(child) > -1)) - this.updateCacheReset.push(child); - } - } else { - for (var i = 0; i < boneCount; i++) { - this.sortBone(constrained[i]); - } - } - this._updateCache.push(constraint); - for (var ii = 0; ii < boneCount; ii++) - this.sortReset(constrained[ii].children); - for (var ii = 0; ii < boneCount; ii++) constrained[ii].sorted = true; - }; - Skeleton.prototype.sortPathConstraintAttachment = function( - skin, - slotIndex, - slotBone, - ) { - var attachments = skin.attachments[slotIndex]; - if (!attachments) return; - for (var key in attachments) { - this.sortPathConstraintAttachmentWith(attachments[key], slotBone); - } - }; - Skeleton.prototype.sortPathConstraintAttachmentWith = function( - attachment, - slotBone, - ) { - if (!(attachment instanceof core.PathAttachment)) return; - var pathBones = attachment.bones; - if (pathBones == null) this.sortBone(slotBone); - else { - var bones = this.bones; - var i = 0; - while (i < pathBones.length) { - var boneCount = pathBones[i++]; - for (var n = i + boneCount; i < n; i++) { - var boneIndex = pathBones[i]; - this.sortBone(bones[boneIndex]); - } - } - } - }; - Skeleton.prototype.sortBone = function(bone) { - if (bone.sorted) return; - var parent = bone.parent; - if (parent != null) this.sortBone(parent); - bone.sorted = true; - this._updateCache.push(bone); - }; - Skeleton.prototype.sortReset = function(bones) { - for (var i = 0, n = bones.length; i < n; i++) { - var bone = bones[i]; - if (bone.sorted) this.sortReset(bone.children); - bone.sorted = false; - } - }; - Skeleton.prototype.updateWorldTransform = function() { - var updateCacheReset = this.updateCacheReset; - for (var i = 0, n = updateCacheReset.length; i < n; i++) { - var bone = updateCacheReset[i]; - bone.ax = bone.x; - bone.ay = bone.y; - bone.arotation = bone.rotation; - bone.ascaleX = bone.scaleX; - bone.ascaleY = bone.scaleY; - bone.ashearX = bone.shearX; - bone.ashearY = bone.shearY; - bone.appliedValid = true; - } - var updateCache = this._updateCache; - for (var i = 0, n = updateCache.length; i < n; i++) - updateCache[i].update(); - }; - Skeleton.prototype.setToSetupPose = function() { - this.setBonesToSetupPose(); - this.setSlotsToSetupPose(); - }; - Skeleton.prototype.setBonesToSetupPose = function() { - var bones = this.bones; - for (var i = 0, n = bones.length; i < n; i++) bones[i].setToSetupPose(); - var ikConstraints = this.ikConstraints; - for (var i = 0, n = ikConstraints.length; i < n; i++) { - var constraint = ikConstraints[i]; - constraint.bendDirection = constraint.data.bendDirection; - constraint.mix = constraint.data.mix; - } - var transformConstraints = this.transformConstraints; - for (var i = 0, n = transformConstraints.length; i < n; i++) { - var constraint = transformConstraints[i]; - var data = constraint.data; - constraint.rotateMix = data.rotateMix; - constraint.translateMix = data.translateMix; - constraint.scaleMix = data.scaleMix; - constraint.shearMix = data.shearMix; - } - var pathConstraints = this.pathConstraints; - for (var i = 0, n = pathConstraints.length; i < n; i++) { - var constraint = pathConstraints[i]; - var data = constraint.data; - constraint.position = data.position; - constraint.spacing = data.spacing; - constraint.rotateMix = data.rotateMix; - constraint.translateMix = data.translateMix; - } - }; - Skeleton.prototype.setSlotsToSetupPose = function() { - var slots = this.slots; - core.Utils.arrayCopy(slots, 0, this.drawOrder, 0, slots.length); - for (var i = 0, n = slots.length; i < n; i++) slots[i].setToSetupPose(); - }; - Skeleton.prototype.getRootBone = function() { - if (this.bones.length == 0) return null; - return this.bones[0]; - }; - Skeleton.prototype.findBone = function(boneName) { - if (boneName == null) throw new Error('boneName cannot be null.'); - var bones = this.bones; - for (var i = 0, n = bones.length; i < n; i++) { - var bone = bones[i]; - if (bone.data.name == boneName) return bone; - } - return null; - }; - Skeleton.prototype.findBoneIndex = function(boneName) { - if (boneName == null) throw new Error('boneName cannot be null.'); - var bones = this.bones; - for (var i = 0, n = bones.length; i < n; i++) - if (bones[i].data.name == boneName) return i; - return -1; - }; - Skeleton.prototype.findSlot = function(slotName) { - if (slotName == null) throw new Error('slotName cannot be null.'); - var slots = this.slots; - for (var i = 0, n = slots.length; i < n; i++) { - var slot = slots[i]; - if (slot.data.name == slotName) return slot; - } - return null; - }; - Skeleton.prototype.findSlotIndex = function(slotName) { - if (slotName == null) throw new Error('slotName cannot be null.'); - var slots = this.slots; - for (var i = 0, n = slots.length; i < n; i++) - if (slots[i].data.name == slotName) return i; - return -1; - }; - Skeleton.prototype.setSkinByName = function(skinName) { - var skin = this.data.findSkin(skinName); - if (skin == null) throw new Error('Skin not found: ' + skinName); - this.setSkin(skin); - }; - Skeleton.prototype.setSkin = function(newSkin) { - if (newSkin != null) { - if (this.skin != null) newSkin.attachAll(this, this.skin); - else { - var slots = this.slots; - for (var i = 0, n = slots.length; i < n; i++) { - var slot = slots[i]; - var name_1 = slot.data.attachmentName; - if (name_1 != null) { - var attachment = newSkin.getAttachment(i, name_1); - if (attachment != null) slot.setAttachment(attachment); - } - } - } - } - this.skin = newSkin; - }; - Skeleton.prototype.getAttachmentByName = function( - slotName, - attachmentName, - ) { - return this.getAttachment( - this.data.findSlotIndex(slotName), - attachmentName, - ); - }; - Skeleton.prototype.getAttachment = function(slotIndex, attachmentName) { - if (attachmentName == null) - throw new Error('attachmentName cannot be null.'); - if (this.skin != null) { - var attachment = this.skin.getAttachment(slotIndex, attachmentName); - if (attachment != null) return attachment; - } - if (this.data.defaultSkin != null) - return this.data.defaultSkin.getAttachment(slotIndex, attachmentName); - return null; - }; - Skeleton.prototype.setAttachment = function(slotName, attachmentName) { - if (slotName == null) throw new Error('slotName cannot be null.'); - var slots = this.slots; - for (var i = 0, n = slots.length; i < n; i++) { - var slot = slots[i]; - if (slot.data.name == slotName) { - var attachment = null; - if (attachmentName != null) { - attachment = this.getAttachment(i, attachmentName); - if (attachment == null) - throw new Error( - 'Attachment not found: ' + - attachmentName + - ', for slot: ' + - slotName, - ); - } - slot.setAttachment(attachment); - return; - } - } - throw new Error('Slot not found: ' + slotName); - }; - Skeleton.prototype.findIkConstraint = function(constraintName) { - if (constraintName == null) - throw new Error('constraintName cannot be null.'); - var ikConstraints = this.ikConstraints; - for (var i = 0, n = ikConstraints.length; i < n; i++) { - var ikConstraint = ikConstraints[i]; - if (ikConstraint.data.name == constraintName) return ikConstraint; - } - return null; - }; - Skeleton.prototype.findTransformConstraint = function(constraintName) { - if (constraintName == null) - throw new Error('constraintName cannot be null.'); - var transformConstraints = this.transformConstraints; - for (var i = 0, n = transformConstraints.length; i < n; i++) { - var constraint = transformConstraints[i]; - if (constraint.data.name == constraintName) return constraint; - } - return null; - }; - Skeleton.prototype.findPathConstraint = function(constraintName) { - if (constraintName == null) - throw new Error('constraintName cannot be null.'); - var pathConstraints = this.pathConstraints; - for (var i = 0, n = pathConstraints.length; i < n; i++) { - var constraint = pathConstraints[i]; - if (constraint.data.name == constraintName) return constraint; - } - return null; - }; - Skeleton.prototype.getBounds = function(offset, size, temp) { - if (offset == null) throw new Error('offset cannot be null.'); - if (size == null) throw new Error('size cannot be null.'); - var drawOrder = this.drawOrder; - var minX = Number.POSITIVE_INFINITY, - minY = Number.POSITIVE_INFINITY, - maxX = Number.NEGATIVE_INFINITY, - maxY = Number.NEGATIVE_INFINITY; - for (var i = 0, n = drawOrder.length; i < n; i++) { - var slot = drawOrder[i]; - var verticesLength = 0; - var vertices = null; - var attachment = slot.getAttachment(); - if (attachment instanceof core.RegionAttachment) { - verticesLength = 8; - vertices = core.Utils.setArraySize(temp, verticesLength, 0); - attachment.computeWorldVertices(slot.bone, vertices, 0, 2); - } else if (attachment instanceof core.MeshAttachment) { - var mesh = attachment; - verticesLength = mesh.worldVerticesLength; - vertices = core.Utils.setArraySize(temp, verticesLength, 0); - mesh.computeWorldVertices(slot, 0, verticesLength, vertices, 0, 2); - } - if (vertices != null) { - for (var ii = 0, nn = vertices.length; ii < nn; ii += 2) { - var x = vertices[ii], - y = vertices[ii + 1]; - minX = Math.min(minX, x); - minY = Math.min(minY, y); - maxX = Math.max(maxX, x); - maxY = Math.max(maxY, y); - } - } - } - offset.set(minX, minY); - size.set(maxX - minX, maxY - minY); - }; - Skeleton.prototype.update = function(delta) { - this.time += delta; - }; - Object.defineProperty(Skeleton.prototype, 'flipX', { - get: function() { - return this.scaleX == -1; - }, - set: function(value) { - if (!Skeleton.deprecatedWarning1) { - Skeleton.deprecatedWarning1 = true; - console.warn( - 'Spine Deprecation Warning: `Skeleton.flipX/flipY` was deprecated, please use scaleX/scaleY', - ); - } - this.scaleX = value ? 1.0 : -1.0; - }, - enumerable: true, - configurable: true, - }); - Object.defineProperty(Skeleton.prototype, 'flipY', { - get: function() { - return this.scaleY == -1; - }, - set: function(value) { - if (!Skeleton.deprecatedWarning1) { - Skeleton.deprecatedWarning1 = true; - console.warn( - 'Spine Deprecation Warning: `Skeleton.flipX/flipY` was deprecated, please use scaleX/scaleY', - ); - } - this.scaleY = value ? 1.0 : -1.0; - }, - enumerable: true, - configurable: true, - }); - Skeleton.deprecatedWarning1 = false; - return Skeleton; - })(); - core.Skeleton = Skeleton; - })((pixi_spine.core || (pixi_spine.core = {}))); - })(pixi_spine || (pixi_spine = {})); - var pixi_spine; - (function(pixi_spine) { - (function(core) { - var SkeletonBounds = (function() { - function SkeletonBounds() { - this.minX = 0; - this.minY = 0; - this.maxX = 0; - this.maxY = 0; - this.boundingBoxes = new Array(); - this.polygons = new Array(); - this.polygonPool = new core.Pool(function() { - return core.Utils.newFloatArray(16); - }); - } - SkeletonBounds.prototype.update = function(skeleton, updateAabb) { - if (skeleton == null) throw new Error('skeleton cannot be null.'); - var boundingBoxes = this.boundingBoxes; - var polygons = this.polygons; - var polygonPool = this.polygonPool; - var slots = skeleton.slots; - var slotCount = slots.length; - boundingBoxes.length = 0; - polygonPool.freeAll(polygons); - polygons.length = 0; - for (var i = 0; i < slotCount; i++) { - var slot = slots[i]; - var attachment = slot.getAttachment(); - if (attachment instanceof core.BoundingBoxAttachment) { - var boundingBox = attachment; - boundingBoxes.push(boundingBox); - var polygon = polygonPool.obtain(); - if (polygon.length != boundingBox.worldVerticesLength) { - polygon = core.Utils.newFloatArray( - boundingBox.worldVerticesLength, - ); - } - polygons.push(polygon); - boundingBox.computeWorldVertices( - slot, - 0, - boundingBox.worldVerticesLength, - polygon, - 0, - 2, - ); - } - } - if (updateAabb) { - this.aabbCompute(); - } else { - this.minX = Number.POSITIVE_INFINITY; - this.minY = Number.POSITIVE_INFINITY; - this.maxX = Number.NEGATIVE_INFINITY; - this.maxY = Number.NEGATIVE_INFINITY; - } - }; - SkeletonBounds.prototype.aabbCompute = function() { - var minX = Number.POSITIVE_INFINITY, - minY = Number.POSITIVE_INFINITY, - maxX = Number.NEGATIVE_INFINITY, - maxY = Number.NEGATIVE_INFINITY; - var polygons = this.polygons; - for (var i = 0, n = polygons.length; i < n; i++) { - var polygon = polygons[i]; - var vertices = polygon; - for (var ii = 0, nn = polygon.length; ii < nn; ii += 2) { - var x = vertices[ii]; - var y = vertices[ii + 1]; - minX = Math.min(minX, x); - minY = Math.min(minY, y); - maxX = Math.max(maxX, x); - maxY = Math.max(maxY, y); - } - } - this.minX = minX; - this.minY = minY; - this.maxX = maxX; - this.maxY = maxY; - }; - SkeletonBounds.prototype.aabbContainsPoint = function(x, y) { - return ( - x >= this.minX && x <= this.maxX && y >= this.minY && y <= this.maxY - ); - }; - SkeletonBounds.prototype.aabbIntersectsSegment = function( - x1, - y1, - x2, - y2, - ) { - var minX = this.minX; - var minY = this.minY; - var maxX = this.maxX; - var maxY = this.maxY; - if ( - (x1 <= minX && x2 <= minX) || - (y1 <= minY && y2 <= minY) || - (x1 >= maxX && x2 >= maxX) || - (y1 >= maxY && y2 >= maxY) - ) - return false; - var m = (y2 - y1) / (x2 - x1); - var y = m * (minX - x1) + y1; - if (y > minY && y < maxY) return true; - y = m * (maxX - x1) + y1; - if (y > minY && y < maxY) return true; - var x = (minY - y1) / m + x1; - if (x > minX && x < maxX) return true; - x = (maxY - y1) / m + x1; - if (x > minX && x < maxX) return true; - return false; - }; - SkeletonBounds.prototype.aabbIntersectsSkeleton = function(bounds) { - return ( - this.minX < bounds.maxX && - this.maxX > bounds.minX && - this.minY < bounds.maxY && - this.maxY > bounds.minY - ); - }; - SkeletonBounds.prototype.containsPoint = function(x, y) { - var polygons = this.polygons; - for (var i = 0, n = polygons.length; i < n; i++) - if (this.containsPointPolygon(polygons[i], x, y)) - return this.boundingBoxes[i]; - return null; - }; - SkeletonBounds.prototype.containsPointPolygon = function(polygon, x, y) { - var vertices = polygon; - var nn = polygon.length; - var prevIndex = nn - 2; - var inside = false; - for (var ii = 0; ii < nn; ii += 2) { - var vertexY = vertices[ii + 1]; - var prevY = vertices[prevIndex + 1]; - if ((vertexY < y && prevY >= y) || (prevY < y && vertexY >= y)) { - var vertexX = vertices[ii]; - if ( - vertexX + - ((y - vertexY) / (prevY - vertexY)) * - (vertices[prevIndex] - vertexX) < - x - ) - inside = !inside; - } - prevIndex = ii; - } - return inside; - }; - SkeletonBounds.prototype.intersectsSegment = function(x1, y1, x2, y2) { - var polygons = this.polygons; - for (var i = 0, n = polygons.length; i < n; i++) - if (this.intersectsSegmentPolygon(polygons[i], x1, y1, x2, y2)) - return this.boundingBoxes[i]; - return null; - }; - SkeletonBounds.prototype.intersectsSegmentPolygon = function( - polygon, - x1, - y1, - x2, - y2, - ) { - var vertices = polygon; - var nn = polygon.length; - var width12 = x1 - x2, - height12 = y1 - y2; - var det1 = x1 * y2 - y1 * x2; - var x3 = vertices[nn - 2], - y3 = vertices[nn - 1]; - for (var ii = 0; ii < nn; ii += 2) { - var x4 = vertices[ii], - y4 = vertices[ii + 1]; - var det2 = x3 * y4 - y3 * x4; - var width34 = x3 - x4, - height34 = y3 - y4; - var det3 = width12 * height34 - height12 * width34; - var x = (det1 * width34 - width12 * det2) / det3; - if ( - ((x >= x3 && x <= x4) || (x >= x4 && x <= x3)) && - ((x >= x1 && x <= x2) || (x >= x2 && x <= x1)) - ) { - var y = (det1 * height34 - height12 * det2) / det3; - if ( - ((y >= y3 && y <= y4) || (y >= y4 && y <= y3)) && - ((y >= y1 && y <= y2) || (y >= y2 && y <= y1)) - ) - return true; - } - x3 = x4; - y3 = y4; - } - return false; - }; - SkeletonBounds.prototype.getPolygon = function(boundingBox) { - if (boundingBox == null) throw new Error('boundingBox cannot be null.'); - var index = this.boundingBoxes.indexOf(boundingBox); - return index == -1 ? null : this.polygons[index]; - }; - SkeletonBounds.prototype.getWidth = function() { - return this.maxX - this.minX; - }; - SkeletonBounds.prototype.getHeight = function() { - return this.maxY - this.minY; - }; - return SkeletonBounds; - })(); - core.SkeletonBounds = SkeletonBounds; - })((pixi_spine.core || (pixi_spine.core = {}))); - })(pixi_spine || (pixi_spine = {})); - var pixi_spine; - (function(pixi_spine) { - (function(core) { - var SkeletonClipping = (function() { - function SkeletonClipping() { - this.triangulator = new core.Triangulator(); - this.clippingPolygon = new Array(); - this.clipOutput = new Array(); - this.clippedVertices = new Array(); - this.clippedTriangles = new Array(); - this.scratch = new Array(); - } - SkeletonClipping.prototype.clipStart = function(slot, clip) { - if (this.clipAttachment != null) return 0; - this.clipAttachment = clip; - var n = clip.worldVerticesLength; - var vertices = core.Utils.setArraySize(this.clippingPolygon, n); - clip.computeWorldVertices(slot, 0, n, vertices, 0, 2); - var clippingPolygon = this.clippingPolygon; - SkeletonClipping.makeClockwise(clippingPolygon); - var clippingPolygons = (this.clippingPolygons = this.triangulator.decompose( - clippingPolygon, - this.triangulator.triangulate(clippingPolygon), - )); - for (var i = 0, n_1 = clippingPolygons.length; i < n_1; i++) { - var polygon = clippingPolygons[i]; - SkeletonClipping.makeClockwise(polygon); - polygon.push(polygon[0]); - polygon.push(polygon[1]); - } - return clippingPolygons.length; - }; - SkeletonClipping.prototype.clipEndWithSlot = function(slot) { - if ( - this.clipAttachment != null && - this.clipAttachment.endSlot == slot.data - ) - this.clipEnd(); - }; - SkeletonClipping.prototype.clipEnd = function() { - if (this.clipAttachment == null) return; - this.clipAttachment = null; - this.clippingPolygons = null; - this.clippedVertices.length = 0; - this.clippedTriangles.length = 0; - this.clippingPolygon.length = 0; - }; - SkeletonClipping.prototype.isClipping = function() { - return this.clipAttachment != null; - }; - SkeletonClipping.prototype.clipTriangles = function( - vertices, - verticesLength, - triangles, - trianglesLength, - uvs, - light, - dark, - twoColor, - ) { - var clipOutput = this.clipOutput, - clippedVertices = this.clippedVertices; - var clippedTriangles = this.clippedTriangles; - var polygons = this.clippingPolygons; - var polygonsCount = this.clippingPolygons.length; - var vertexSize = twoColor ? 12 : 8; - var index = 0; - clippedVertices.length = 0; - clippedTriangles.length = 0; - outer: for (var i = 0; i < trianglesLength; i += 3) { - var vertexOffset = triangles[i] << 1; - var x1 = vertices[vertexOffset], - y1 = vertices[vertexOffset + 1]; - var u1 = uvs[vertexOffset], - v1 = uvs[vertexOffset + 1]; - vertexOffset = triangles[i + 1] << 1; - var x2 = vertices[vertexOffset], - y2 = vertices[vertexOffset + 1]; - var u2 = uvs[vertexOffset], - v2 = uvs[vertexOffset + 1]; - vertexOffset = triangles[i + 2] << 1; - var x3 = vertices[vertexOffset], - y3 = vertices[vertexOffset + 1]; - var u3 = uvs[vertexOffset], - v3 = uvs[vertexOffset + 1]; - for (var p = 0; p < polygonsCount; p++) { - var s = clippedVertices.length; - if (this.clip(x1, y1, x2, y2, x3, y3, polygons[p], clipOutput)) { - var clipOutputLength = clipOutput.length; - if (clipOutputLength == 0) continue; - var d0 = y2 - y3, - d1 = x3 - x2, - d2 = x1 - x3, - d4 = y3 - y1; - var d = 1 / (d0 * d2 + d1 * (y1 - y3)); - var clipOutputCount = clipOutputLength >> 1; - var clipOutputItems = this.clipOutput; - var clippedVerticesItems = core.Utils.setArraySize( - clippedVertices, - s + clipOutputCount * vertexSize, - ); - for (var ii = 0; ii < clipOutputLength; ii += 2) { - var x = clipOutputItems[ii], - y = clipOutputItems[ii + 1]; - clippedVerticesItems[s] = x; - clippedVerticesItems[s + 1] = y; - clippedVerticesItems[s + 2] = light.r; - clippedVerticesItems[s + 3] = light.g; - clippedVerticesItems[s + 4] = light.b; - clippedVerticesItems[s + 5] = light.a; - var c0 = x - x3, - c1 = y - y3; - var a = (d0 * c0 + d1 * c1) * d; - var b = (d4 * c0 + d2 * c1) * d; - var c = 1 - a - b; - clippedVerticesItems[s + 6] = u1 * a + u2 * b + u3 * c; - clippedVerticesItems[s + 7] = v1 * a + v2 * b + v3 * c; - if (twoColor) { - clippedVerticesItems[s + 8] = dark.r; - clippedVerticesItems[s + 9] = dark.g; - clippedVerticesItems[s + 10] = dark.b; - clippedVerticesItems[s + 11] = dark.a; - } - s += vertexSize; - } - s = clippedTriangles.length; - var clippedTrianglesItems = core.Utils.setArraySize( - clippedTriangles, - s + 3 * (clipOutputCount - 2), - ); - clipOutputCount--; - for (var ii = 1; ii < clipOutputCount; ii++) { - clippedTrianglesItems[s] = index; - clippedTrianglesItems[s + 1] = index + ii; - clippedTrianglesItems[s + 2] = index + ii + 1; - s += 3; - } - index += clipOutputCount + 1; - } else { - var clippedVerticesItems = core.Utils.setArraySize( - clippedVertices, - s + 3 * vertexSize, - ); - clippedVerticesItems[s] = x1; - clippedVerticesItems[s + 1] = y1; - clippedVerticesItems[s + 2] = light.r; - clippedVerticesItems[s + 3] = light.g; - clippedVerticesItems[s + 4] = light.b; - clippedVerticesItems[s + 5] = light.a; - if (!twoColor) { - clippedVerticesItems[s + 6] = u1; - clippedVerticesItems[s + 7] = v1; - clippedVerticesItems[s + 8] = x2; - clippedVerticesItems[s + 9] = y2; - clippedVerticesItems[s + 10] = light.r; - clippedVerticesItems[s + 11] = light.g; - clippedVerticesItems[s + 12] = light.b; - clippedVerticesItems[s + 13] = light.a; - clippedVerticesItems[s + 14] = u2; - clippedVerticesItems[s + 15] = v2; - clippedVerticesItems[s + 16] = x3; - clippedVerticesItems[s + 17] = y3; - clippedVerticesItems[s + 18] = light.r; - clippedVerticesItems[s + 19] = light.g; - clippedVerticesItems[s + 20] = light.b; - clippedVerticesItems[s + 21] = light.a; - clippedVerticesItems[s + 22] = u3; - clippedVerticesItems[s + 23] = v3; - } else { - clippedVerticesItems[s + 6] = u1; - clippedVerticesItems[s + 7] = v1; - clippedVerticesItems[s + 8] = dark.r; - clippedVerticesItems[s + 9] = dark.g; - clippedVerticesItems[s + 10] = dark.b; - clippedVerticesItems[s + 11] = dark.a; - clippedVerticesItems[s + 12] = x2; - clippedVerticesItems[s + 13] = y2; - clippedVerticesItems[s + 14] = light.r; - clippedVerticesItems[s + 15] = light.g; - clippedVerticesItems[s + 16] = light.b; - clippedVerticesItems[s + 17] = light.a; - clippedVerticesItems[s + 18] = u2; - clippedVerticesItems[s + 19] = v2; - clippedVerticesItems[s + 20] = dark.r; - clippedVerticesItems[s + 21] = dark.g; - clippedVerticesItems[s + 22] = dark.b; - clippedVerticesItems[s + 23] = dark.a; - clippedVerticesItems[s + 24] = x3; - clippedVerticesItems[s + 25] = y3; - clippedVerticesItems[s + 26] = light.r; - clippedVerticesItems[s + 27] = light.g; - clippedVerticesItems[s + 28] = light.b; - clippedVerticesItems[s + 29] = light.a; - clippedVerticesItems[s + 30] = u3; - clippedVerticesItems[s + 31] = v3; - clippedVerticesItems[s + 32] = dark.r; - clippedVerticesItems[s + 33] = dark.g; - clippedVerticesItems[s + 34] = dark.b; - clippedVerticesItems[s + 35] = dark.a; - } - s = clippedTriangles.length; - var clippedTrianglesItems = core.Utils.setArraySize( - clippedTriangles, - s + 3, - ); - clippedTrianglesItems[s] = index; - clippedTrianglesItems[s + 1] = index + 1; - clippedTrianglesItems[s + 2] = index + 2; - index += 3; - continue outer; - } - } - } - }; - SkeletonClipping.prototype.clip = function( - x1, - y1, - x2, - y2, - x3, - y3, - clippingArea, - output, - ) { - var originalOutput = output; - var clipped = false; - var input = null; - if (clippingArea.length % 4 >= 2) { - input = output; - output = this.scratch; - } else input = this.scratch; - input.length = 0; - input.push(x1); - input.push(y1); - input.push(x2); - input.push(y2); - input.push(x3); - input.push(y3); - input.push(x1); - input.push(y1); - output.length = 0; - var clippingVertices = clippingArea; - var clippingVerticesLast = clippingArea.length - 4; - for (var i = 0; ; i += 2) { - var edgeX = clippingVertices[i], - edgeY = clippingVertices[i + 1]; - var edgeX2 = clippingVertices[i + 2], - edgeY2 = clippingVertices[i + 3]; - var deltaX = edgeX - edgeX2, - deltaY = edgeY - edgeY2; - var inputVertices = input; - var inputVerticesLength = input.length - 2, - outputStart = output.length; - for (var ii = 0; ii < inputVerticesLength; ii += 2) { - var inputX = inputVertices[ii], - inputY = inputVertices[ii + 1]; - var inputX2 = inputVertices[ii + 2], - inputY2 = inputVertices[ii + 3]; - var side2 = - deltaX * (inputY2 - edgeY2) - deltaY * (inputX2 - edgeX2) > 0; - if (deltaX * (inputY - edgeY2) - deltaY * (inputX - edgeX2) > 0) { - if (side2) { - output.push(inputX2); - output.push(inputY2); - continue; - } - var c0 = inputY2 - inputY, - c2 = inputX2 - inputX; - var ua = - (c2 * (edgeY - inputY) - c0 * (edgeX - inputX)) / - (c0 * (edgeX2 - edgeX) - c2 * (edgeY2 - edgeY)); - output.push(edgeX + (edgeX2 - edgeX) * ua); - output.push(edgeY + (edgeY2 - edgeY) * ua); - } else if (side2) { - var c0 = inputY2 - inputY, - c2 = inputX2 - inputX; - var ua = - (c2 * (edgeY - inputY) - c0 * (edgeX - inputX)) / - (c0 * (edgeX2 - edgeX) - c2 * (edgeY2 - edgeY)); - output.push(edgeX + (edgeX2 - edgeX) * ua); - output.push(edgeY + (edgeY2 - edgeY) * ua); - output.push(inputX2); - output.push(inputY2); - } - clipped = true; - } - if (outputStart == output.length) { - originalOutput.length = 0; - return true; - } - output.push(output[0]); - output.push(output[1]); - if (i == clippingVerticesLast) break; - var temp = output; - output = input; - output.length = 0; - input = temp; - } - if (originalOutput != output) { - originalOutput.length = 0; - for (var i = 0, n = output.length - 2; i < n; i++) - originalOutput[i] = output[i]; - } else originalOutput.length = originalOutput.length - 2; - return clipped; - }; - SkeletonClipping.makeClockwise = function(polygon) { - var vertices = polygon; - var verticeslength = polygon.length; - var area = - vertices[verticeslength - 2] * vertices[1] - - vertices[0] * vertices[verticeslength - 1], - p1x = 0, - p1y = 0, - p2x = 0, - p2y = 0; - for (var i = 0, n = verticeslength - 3; i < n; i += 2) { - p1x = vertices[i]; - p1y = vertices[i + 1]; - p2x = vertices[i + 2]; - p2y = vertices[i + 3]; - area += p1x * p2y - p2x * p1y; - } - if (area < 0) return; - for ( - var i = 0, lastX = verticeslength - 2, n = verticeslength >> 1; - i < n; - i += 2 - ) { - var x = vertices[i], - y = vertices[i + 1]; - var other = lastX - i; - vertices[i] = vertices[other]; - vertices[i + 1] = vertices[other + 1]; - vertices[other] = x; - vertices[other + 1] = y; - } - }; - return SkeletonClipping; - })(); - core.SkeletonClipping = SkeletonClipping; - })((pixi_spine.core || (pixi_spine.core = {}))); - })(pixi_spine || (pixi_spine = {})); - var pixi_spine; - (function(pixi_spine) { - (function(core) { - var SkeletonData = (function() { - function SkeletonData() { - this.bones = new Array(); - this.slots = new Array(); - this.skins = new Array(); - this.events = new Array(); - this.animations = new Array(); - this.ikConstraints = new Array(); - this.transformConstraints = new Array(); - this.pathConstraints = new Array(); - this.fps = 0; - } - SkeletonData.prototype.findBone = function(boneName) { - if (boneName == null) throw new Error('boneName cannot be null.'); - var bones = this.bones; - for (var i = 0, n = bones.length; i < n; i++) { - var bone = bones[i]; - if (bone.name == boneName) return bone; - } - return null; - }; - SkeletonData.prototype.findBoneIndex = function(boneName) { - if (boneName == null) throw new Error('boneName cannot be null.'); - var bones = this.bones; - for (var i = 0, n = bones.length; i < n; i++) - if (bones[i].name == boneName) return i; - return -1; - }; - SkeletonData.prototype.findSlot = function(slotName) { - if (slotName == null) throw new Error('slotName cannot be null.'); - var slots = this.slots; - for (var i = 0, n = slots.length; i < n; i++) { - var slot = slots[i]; - if (slot.name == slotName) return slot; - } - return null; - }; - SkeletonData.prototype.findSlotIndex = function(slotName) { - if (slotName == null) throw new Error('slotName cannot be null.'); - var slots = this.slots; - for (var i = 0, n = slots.length; i < n; i++) - if (slots[i].name == slotName) return i; - return -1; - }; - SkeletonData.prototype.findSkin = function(skinName) { - if (skinName == null) throw new Error('skinName cannot be null.'); - var skins = this.skins; - for (var i = 0, n = skins.length; i < n; i++) { - var skin = skins[i]; - if (skin.name == skinName) return skin; - } - return null; - }; - SkeletonData.prototype.findEvent = function(eventDataName) { - if (eventDataName == null) - throw new Error('eventDataName cannot be null.'); - var events = this.events; - for (var i = 0, n = events.length; i < n; i++) { - var event_4 = events[i]; - if (event_4.name == eventDataName) return event_4; - } - return null; - }; - SkeletonData.prototype.findAnimation = function(animationName) { - if (animationName == null) - throw new Error('animationName cannot be null.'); - var animations = this.animations; - for (var i = 0, n = animations.length; i < n; i++) { - var animation = animations[i]; - if (animation.name == animationName) return animation; - } - return null; - }; - SkeletonData.prototype.findIkConstraint = function(constraintName) { - if (constraintName == null) - throw new Error('constraintName cannot be null.'); - var ikConstraints = this.ikConstraints; - for (var i = 0, n = ikConstraints.length; i < n; i++) { - var constraint = ikConstraints[i]; - if (constraint.name == constraintName) return constraint; - } - return null; - }; - SkeletonData.prototype.findTransformConstraint = function( - constraintName, - ) { - if (constraintName == null) - throw new Error('constraintName cannot be null.'); - var transformConstraints = this.transformConstraints; - for (var i = 0, n = transformConstraints.length; i < n; i++) { - var constraint = transformConstraints[i]; - if (constraint.name == constraintName) return constraint; - } - return null; - }; - SkeletonData.prototype.findPathConstraint = function(constraintName) { - if (constraintName == null) - throw new Error('constraintName cannot be null.'); - var pathConstraints = this.pathConstraints; - for (var i = 0, n = pathConstraints.length; i < n; i++) { - var constraint = pathConstraints[i]; - if (constraint.name == constraintName) return constraint; - } - return null; - }; - SkeletonData.prototype.findPathConstraintIndex = function( - pathConstraintName, - ) { - if (pathConstraintName == null) - throw new Error('pathConstraintName cannot be null.'); - var pathConstraints = this.pathConstraints; - for (var i = 0, n = pathConstraints.length; i < n; i++) - if (pathConstraints[i].name == pathConstraintName) return i; - return -1; - }; - return SkeletonData; - })(); - core.SkeletonData = SkeletonData; - })((pixi_spine.core || (pixi_spine.core = {}))); - })(pixi_spine || (pixi_spine = {})); - var pixi_spine; - (function(pixi_spine) { - (function(core) { - var SkeletonJson = (function() { - function SkeletonJson(attachmentLoader) { - this.scale = 1; - this.linkedMeshes = new Array(); - this.attachmentLoader = attachmentLoader; - } - SkeletonJson.prototype.readSkeletonData = function(json) { - var scale = this.scale; - var skeletonData = new core.SkeletonData(); - var root = typeof json === 'string' ? JSON.parse(json) : json; - var skeletonMap = root.skeleton; - if (skeletonMap != null) { - skeletonData.hash = skeletonMap.hash; - skeletonData.version = skeletonMap.spine; - skeletonData.width = skeletonMap.width; - skeletonData.height = skeletonMap.height; - skeletonData.fps = skeletonMap.fps; - skeletonData.imagesPath = skeletonMap.images; - } - if (root.bones) { - for (var i = 0; i < root.bones.length; i++) { - var boneMap = root.bones[i]; - var parent_2 = null; - var parentName = this.getValue(boneMap, 'parent', null); - if (parentName != null) { - parent_2 = skeletonData.findBone(parentName); - if (parent_2 == null) - throw new Error('Parent bone not found: ' + parentName); - } - var data = new core.BoneData( - skeletonData.bones.length, - boneMap.name, - parent_2, - ); - data.length = this.getValue(boneMap, 'length', 0) * scale; - data.x = this.getValue(boneMap, 'x', 0) * scale; - data.y = this.getValue(boneMap, 'y', 0) * scale; - data.rotation = this.getValue(boneMap, 'rotation', 0); - data.scaleX = this.getValue(boneMap, 'scaleX', 1); - data.scaleY = this.getValue(boneMap, 'scaleY', 1); - data.shearX = this.getValue(boneMap, 'shearX', 0); - data.shearY = this.getValue(boneMap, 'shearY', 0); - data.transformMode = SkeletonJson.transformModeFromString( - this.getValue(boneMap, 'transform', 'normal'), - ); - skeletonData.bones.push(data); - } - } - if (root.slots) { - for (var i = 0; i < root.slots.length; i++) { - var slotMap = root.slots[i]; - var slotName = slotMap.name; - var boneName = slotMap.bone; - var boneData = skeletonData.findBone(boneName); - if (boneData == null) - throw new Error('Slot bone not found: ' + boneName); - var data = new core.SlotData( - skeletonData.slots.length, - slotName, - boneData, - ); - var color = this.getValue(slotMap, 'color', null); - if (color != null) data.color.setFromString(color); - var dark = this.getValue(slotMap, 'dark', null); - if (dark != null) { - data.darkColor = new core.Color(1, 1, 1, 1); - data.darkColor.setFromString(dark); - } - data.attachmentName = this.getValue(slotMap, 'attachment', null); - data.blendMode = SkeletonJson.blendModeFromString( - this.getValue(slotMap, 'blend', 'normal'), - ); - skeletonData.slots.push(data); - } - } - if (root.ik) { - for (var i = 0; i < root.ik.length; i++) { - var constraintMap = root.ik[i]; - var data = new core.IkConstraintData(constraintMap.name); - data.order = this.getValue(constraintMap, 'order', 0); - for (var j = 0; j < constraintMap.bones.length; j++) { - var boneName = constraintMap.bones[j]; - var bone = skeletonData.findBone(boneName); - if (bone == null) - throw new Error('IK bone not found: ' + boneName); - data.bones.push(bone); - } - var targetName = constraintMap.target; - data.target = skeletonData.findBone(targetName); - if (data.target == null) - throw new Error('IK target bone not found: ' + targetName); - data.bendDirection = this.getValue( - constraintMap, - 'bendPositive', - true, - ) - ? 1 - : -1; - data.mix = this.getValue(constraintMap, 'mix', 1); - skeletonData.ikConstraints.push(data); - } - } - if (root.transform) { - for (var i = 0; i < root.transform.length; i++) { - var constraintMap = root.transform[i]; - var data = new core.TransformConstraintData(constraintMap.name); - data.order = this.getValue(constraintMap, 'order', 0); - for (var j = 0; j < constraintMap.bones.length; j++) { - var boneName = constraintMap.bones[j]; - var bone = skeletonData.findBone(boneName); - if (bone == null) - throw new Error( - 'Transform constraint bone not found: ' + boneName, - ); - data.bones.push(bone); - } - var targetName = constraintMap.target; - data.target = skeletonData.findBone(targetName); - if (data.target == null) - throw new Error( - 'Transform constraint target bone not found: ' + targetName, - ); - data.local = this.getValue(constraintMap, 'local', false); - data.relative = this.getValue(constraintMap, 'relative', false); - data.offsetRotation = this.getValue(constraintMap, 'rotation', 0); - data.offsetX = this.getValue(constraintMap, 'x', 0) * scale; - data.offsetY = this.getValue(constraintMap, 'y', 0) * scale; - data.offsetScaleX = this.getValue(constraintMap, 'scaleX', 0); - data.offsetScaleY = this.getValue(constraintMap, 'scaleY', 0); - data.offsetShearY = this.getValue(constraintMap, 'shearY', 0); - data.rotateMix = this.getValue(constraintMap, 'rotateMix', 1); - data.translateMix = this.getValue(constraintMap, 'translateMix', 1); - data.scaleMix = this.getValue(constraintMap, 'scaleMix', 1); - data.shearMix = this.getValue(constraintMap, 'shearMix', 1); - skeletonData.transformConstraints.push(data); - } - } - if (root.path) { - for (var i = 0; i < root.path.length; i++) { - var constraintMap = root.path[i]; - var data = new core.PathConstraintData(constraintMap.name); - data.order = this.getValue(constraintMap, 'order', 0); - for (var j = 0; j < constraintMap.bones.length; j++) { - var boneName = constraintMap.bones[j]; - var bone = skeletonData.findBone(boneName); - if (bone == null) - throw new Error( - 'Transform constraint bone not found: ' + boneName, - ); - data.bones.push(bone); - } - var targetName = constraintMap.target; - data.target = skeletonData.findSlot(targetName); - if (data.target == null) - throw new Error('Path target slot not found: ' + targetName); - data.positionMode = SkeletonJson.positionModeFromString( - this.getValue(constraintMap, 'positionMode', 'percent'), - ); - data.spacingMode = SkeletonJson.spacingModeFromString( - this.getValue(constraintMap, 'spacingMode', 'length'), - ); - data.rotateMode = SkeletonJson.rotateModeFromString( - this.getValue(constraintMap, 'rotateMode', 'tangent'), - ); - data.offsetRotation = this.getValue(constraintMap, 'rotation', 0); - data.position = this.getValue(constraintMap, 'position', 0); - if (data.positionMode == core.PositionMode.Fixed) - data.position *= scale; - data.spacing = this.getValue(constraintMap, 'spacing', 0); - if ( - data.spacingMode == core.SpacingMode.Length || - data.spacingMode == core.SpacingMode.Fixed - ) - data.spacing *= scale; - data.rotateMix = this.getValue(constraintMap, 'rotateMix', 1); - data.translateMix = this.getValue(constraintMap, 'translateMix', 1); - skeletonData.pathConstraints.push(data); - } - } - if (root.skins) { - for (var skinName in root.skins) { - var skinMap = root.skins[skinName]; - var skin = new core.Skin(skinName); - for (var slotName in skinMap) { - var slotIndex = skeletonData.findSlotIndex(slotName); - if (slotIndex == -1) - throw new Error('Slot not found: ' + slotName); - var slotMap = skinMap[slotName]; - for (var entryName in slotMap) { - var attachment = this.readAttachment( - slotMap[entryName], - skin, - slotIndex, - entryName, - skeletonData, - ); - if (attachment != null) - skin.addAttachment(slotIndex, entryName, attachment); - } - } - skeletonData.skins.push(skin); - if (skin.name == 'default') skeletonData.defaultSkin = skin; - } - } - for (var i = 0, n = this.linkedMeshes.length; i < n; i++) { - var linkedMesh = this.linkedMeshes[i]; - var skin = - linkedMesh.skin == null - ? skeletonData.defaultSkin - : skeletonData.findSkin(linkedMesh.skin); - if (skin == null) - throw new Error('Skin not found: ' + linkedMesh.skin); - var parent_3 = skin.getAttachment( - linkedMesh.slotIndex, - linkedMesh.parent, - ); - if (parent_3 == null) - throw new Error('Parent mesh not found: ' + linkedMesh.parent); - linkedMesh.mesh.setParentMesh(parent_3); - } - this.linkedMeshes.length = 0; - if (root.events) { - for (var eventName in root.events) { - var eventMap = root.events[eventName]; - var data = new core.EventData(eventName); - data.intValue = this.getValue(eventMap, 'int', 0); - data.floatValue = this.getValue(eventMap, 'float', 0); - data.stringValue = this.getValue(eventMap, 'string', ''); - data.audioPath = this.getValue(eventMap, 'audio', null); - if (data.audioPath != null) { - data.volume = this.getValue(eventMap, 'volume', 1); - data.balance = this.getValue(eventMap, 'balance', 0); - } - skeletonData.events.push(data); - } - } - if (root.animations) { - for (var animationName in root.animations) { - var animationMap = root.animations[animationName]; - this.readAnimation(animationMap, animationName, skeletonData); - } - } - return skeletonData; - }; - SkeletonJson.prototype.readAttachment = function( - map, - skin, - slotIndex, - name, - skeletonData, - ) { - var scale = this.scale; - name = this.getValue(map, 'name', name); - var type = this.getValue(map, 'type', 'region'); - switch (type) { - case 'region': { - var path = this.getValue(map, 'path', name); - var region = this.attachmentLoader.newRegionAttachment( - skin, - name, - path, - ); - if (region == null) return null; - region.path = path; - region.x = this.getValue(map, 'x', 0) * scale; - region.y = this.getValue(map, 'y', 0) * scale; - region.scaleX = this.getValue(map, 'scaleX', 1); - region.scaleY = this.getValue(map, 'scaleY', 1); - region.rotation = this.getValue(map, 'rotation', 0); - region.width = map.width * scale; - region.height = map.height * scale; - var color = this.getValue(map, 'color', null); - if (color != null) region.color.setFromString(color); - return region; - } - case 'boundingbox': { - var box = this.attachmentLoader.newBoundingBoxAttachment( - skin, - name, - ); - if (box == null) return null; - this.readVertices(map, box, map.vertexCount << 1); - var color = this.getValue(map, 'color', null); - if (color != null) box.color.setFromString(color); - return box; - } - case 'mesh': - case 'linkedmesh': { - var path = this.getValue(map, 'path', name); - var mesh = this.attachmentLoader.newMeshAttachment( - skin, - name, - path, - ); - if (mesh == null) return null; - mesh.path = path; - var color = this.getValue(map, 'color', null); - if (color != null) mesh.color.setFromString(color); - var parent_4 = this.getValue(map, 'parent', null); - if (parent_4 != null) { - mesh.inheritDeform = this.getValue(map, 'deform', true); - this.linkedMeshes.push( - new LinkedMesh( - mesh, - this.getValue(map, 'skin', null), - slotIndex, - parent_4, - ), - ); - return mesh; - } - var uvs = map.uvs; - this.readVertices(map, mesh, uvs.length); - mesh.triangles = map.triangles; - mesh.regionUVs = uvs; - mesh.hullLength = this.getValue(map, 'hull', 0) * 2; - return mesh; - } - case 'path': { - var path = this.attachmentLoader.newPathAttachment(skin, name); - if (path == null) return null; - path.closed = this.getValue(map, 'closed', false); - path.constantSpeed = this.getValue(map, 'constantSpeed', true); - var vertexCount = map.vertexCount; - this.readVertices(map, path, vertexCount << 1); - var lengths = core.Utils.newArray(vertexCount / 3, 0); - for (var i = 0; i < map.lengths.length; i++) - lengths[i] = map.lengths[i] * scale; - path.lengths = lengths; - var color = this.getValue(map, 'color', null); - if (color != null) path.color.setFromString(color); - return path; - } - case 'point': { - var point = this.attachmentLoader.newPointAttachment(skin, name); - if (point == null) return null; - point.x = this.getValue(map, 'x', 0) * scale; - point.y = this.getValue(map, 'y', 0) * scale; - point.rotation = this.getValue(map, 'rotation', 0); - var color = this.getValue(map, 'color', null); - if (color != null) point.color.setFromString(color); - return point; - } - case 'clipping': { - var clip = this.attachmentLoader.newClippingAttachment(skin, name); - if (clip == null) return null; - var end = this.getValue(map, 'end', null); - if (end != null) { - var slot = skeletonData.findSlot(end); - if (slot == null) - throw new Error('Clipping end slot not found: ' + end); - clip.endSlot = slot; - } - var vertexCount = map.vertexCount; - this.readVertices(map, clip, vertexCount << 1); - var color = this.getValue(map, 'color', null); - if (color != null) clip.color.setFromString(color); - return clip; - } - } - return null; - }; - SkeletonJson.prototype.readVertices = function( - map, - attachment, - verticesLength, - ) { - var scale = this.scale; - attachment.worldVerticesLength = verticesLength; - var vertices = map.vertices; - if (verticesLength == vertices.length) { - var scaledVertices = core.Utils.toFloatArray(vertices); - if (scale != 1) { - for (var i = 0, n = vertices.length; i < n; i++) - scaledVertices[i] *= scale; - } - attachment.vertices = scaledVertices; - return; - } - var weights = new Array(); - var bones = new Array(); - for (var i = 0, n = vertices.length; i < n; ) { - var boneCount = vertices[i++]; - bones.push(boneCount); - for (var nn = i + boneCount * 4; i < nn; i += 4) { - bones.push(vertices[i]); - weights.push(vertices[i + 1] * scale); - weights.push(vertices[i + 2] * scale); - weights.push(vertices[i + 3]); - } - } - attachment.bones = bones; - attachment.vertices = core.Utils.toFloatArray(weights); - }; - SkeletonJson.prototype.readAnimation = function(map, name, skeletonData) { - var scale = this.scale; - var timelines = new Array(); - var duration = 0; - if (map.slots) { - for (var slotName in map.slots) { - var slotMap = map.slots[slotName]; - var slotIndex = skeletonData.findSlotIndex(slotName); - if (slotIndex == -1) throw new Error('Slot not found: ' + slotName); - for (var timelineName in slotMap) { - var timelineMap = slotMap[timelineName]; - if (timelineName == 'attachment') { - var timeline = new core.AttachmentTimeline(timelineMap.length); - timeline.slotIndex = slotIndex; - var frameIndex = 0; - for (var i = 0; i < timelineMap.length; i++) { - var valueMap = timelineMap[i]; - timeline.setFrame(frameIndex++, valueMap.time, valueMap.name); - } - timelines.push(timeline); - duration = Math.max( - duration, - timeline.frames[timeline.getFrameCount() - 1], - ); - } else if (timelineName == 'color') { - var timeline = new core.ColorTimeline(timelineMap.length); - timeline.slotIndex = slotIndex; - var frameIndex = 0; - for (var i = 0; i < timelineMap.length; i++) { - var valueMap = timelineMap[i]; - var color = new core.Color(); - color.setFromString(valueMap.color || 'ffffffff'); - timeline.setFrame( - frameIndex, - valueMap.time, - color.r, - color.g, - color.b, - color.a, - ); - this.readCurve(valueMap, timeline, frameIndex); - frameIndex++; - } - timelines.push(timeline); - duration = Math.max( - duration, - timeline.frames[ - (timeline.getFrameCount() - 1) * core.ColorTimeline.ENTRIES - ], - ); - } else if (timelineName == 'twoColor') { - var timeline = new core.TwoColorTimeline(timelineMap.length); - timeline.slotIndex = slotIndex; - var frameIndex = 0; - for (var i = 0; i < timelineMap.length; i++) { - var valueMap = timelineMap[i]; - var light = new core.Color(); - var dark = new core.Color(); - light.setFromString(valueMap.light); - dark.setFromString(valueMap.dark); - timeline.setFrame( - frameIndex, - valueMap.time, - light.r, - light.g, - light.b, - light.a, - dark.r, - dark.g, - dark.b, - ); - this.readCurve(valueMap, timeline, frameIndex); - frameIndex++; - } - timelines.push(timeline); - duration = Math.max( - duration, - timeline.frames[ - (timeline.getFrameCount() - 1) * - core.TwoColorTimeline.ENTRIES - ], - ); - } else - throw new Error( - 'Invalid timeline type for a slot: ' + - timelineName + - ' (' + - slotName + - ')', - ); - } - } - } - if (map.bones) { - for (var boneName in map.bones) { - var boneMap = map.bones[boneName]; - var boneIndex = skeletonData.findBoneIndex(boneName); - if (boneIndex == -1) throw new Error('Bone not found: ' + boneName); - for (var timelineName in boneMap) { - var timelineMap = boneMap[timelineName]; - if (timelineName === 'rotate') { - var timeline = new core.RotateTimeline(timelineMap.length); - timeline.boneIndex = boneIndex; - var frameIndex = 0; - for (var i = 0; i < timelineMap.length; i++) { - var valueMap = timelineMap[i]; - timeline.setFrame(frameIndex, valueMap.time, valueMap.angle); - this.readCurve(valueMap, timeline, frameIndex); - frameIndex++; - } - timelines.push(timeline); - duration = Math.max( - duration, - timeline.frames[ - (timeline.getFrameCount() - 1) * core.RotateTimeline.ENTRIES - ], - ); - } else if ( - timelineName === 'translate' || - timelineName === 'scale' || - timelineName === 'shear' - ) { - var timeline = null; - var timelineScale = 1; - if (timelineName === 'scale') - timeline = new core.ScaleTimeline(timelineMap.length); - else if (timelineName === 'shear') - timeline = new core.ShearTimeline(timelineMap.length); - else { - timeline = new core.TranslateTimeline(timelineMap.length); - timelineScale = scale; - } - timeline.boneIndex = boneIndex; - var frameIndex = 0; - for (var i = 0; i < timelineMap.length; i++) { - var valueMap = timelineMap[i]; - var x = this.getValue(valueMap, 'x', 0), - y = this.getValue(valueMap, 'y', 0); - timeline.setFrame( - frameIndex, - valueMap.time, - x * timelineScale, - y * timelineScale, - ); - this.readCurve(valueMap, timeline, frameIndex); - frameIndex++; - } - timelines.push(timeline); - duration = Math.max( - duration, - timeline.frames[ - (timeline.getFrameCount() - 1) * - core.TranslateTimeline.ENTRIES - ], - ); - } else - throw new Error( - 'Invalid timeline type for a bone: ' + - timelineName + - ' (' + - boneName + - ')', - ); - } - } - } - if (map.ik) { - for (var constraintName in map.ik) { - var constraintMap = map.ik[constraintName]; - var constraint = skeletonData.findIkConstraint(constraintName); - var timeline = new core.IkConstraintTimeline(constraintMap.length); - timeline.ikConstraintIndex = skeletonData.ikConstraints.indexOf( - constraint, - ); - var frameIndex = 0; - for (var i = 0; i < constraintMap.length; i++) { - var valueMap = constraintMap[i]; - timeline.setFrame( - frameIndex, - valueMap.time, - this.getValue(valueMap, 'mix', 1), - this.getValue(valueMap, 'bendPositive', true) ? 1 : -1, - this.getValue(valueMap, 'compress', false), - this.getValue(valueMap, 'stretch', false), - ); - this.readCurve(valueMap, timeline, frameIndex); - frameIndex++; - } - timelines.push(timeline); - duration = Math.max( - duration, - timeline.frames[ - (timeline.getFrameCount() - 1) * - core.IkConstraintTimeline.ENTRIES - ], - ); - } - } - if (map.transform) { - for (var constraintName in map.transform) { - var constraintMap = map.transform[constraintName]; - var constraint = skeletonData.findTransformConstraint( - constraintName, - ); - var timeline = new core.TransformConstraintTimeline( - constraintMap.length, - ); - timeline.transformConstraintIndex = skeletonData.transformConstraints.indexOf( - constraint, - ); - var frameIndex = 0; - for (var i = 0; i < constraintMap.length; i++) { - var valueMap = constraintMap[i]; - timeline.setFrame( - frameIndex, - valueMap.time, - this.getValue(valueMap, 'rotateMix', 1), - this.getValue(valueMap, 'translateMix', 1), - this.getValue(valueMap, 'scaleMix', 1), - this.getValue(valueMap, 'shearMix', 1), - ); - this.readCurve(valueMap, timeline, frameIndex); - frameIndex++; - } - timelines.push(timeline); - duration = Math.max( - duration, - timeline.frames[ - (timeline.getFrameCount() - 1) * - core.TransformConstraintTimeline.ENTRIES - ], - ); - } - } - if (map.paths) { - for (var constraintName in map.paths) { - var constraintMap = map.paths[constraintName]; - var index = skeletonData.findPathConstraintIndex(constraintName); - if (index == -1) - throw new Error('Path constraint not found: ' + constraintName); - var data = skeletonData.pathConstraints[index]; - for (var timelineName in constraintMap) { - var timelineMap = constraintMap[timelineName]; - if (timelineName === 'position' || timelineName === 'spacing') { - var timeline = null; - var timelineScale = 1; - if (timelineName === 'spacing') { - timeline = new core.PathConstraintSpacingTimeline( - timelineMap.length, - ); - if ( - data.spacingMode == core.SpacingMode.Length || - data.spacingMode == core.SpacingMode.Fixed - ) - timelineScale = scale; - } else { - timeline = new core.PathConstraintPositionTimeline( - timelineMap.length, - ); - if (data.positionMode == core.PositionMode.Fixed) - timelineScale = scale; - } - timeline.pathConstraintIndex = index; - var frameIndex = 0; - for (var i = 0; i < timelineMap.length; i++) { - var valueMap = timelineMap[i]; - timeline.setFrame( - frameIndex, - valueMap.time, - this.getValue(valueMap, timelineName, 0) * timelineScale, - ); - this.readCurve(valueMap, timeline, frameIndex); - frameIndex++; - } - timelines.push(timeline); - duration = Math.max( - duration, - timeline.frames[ - (timeline.getFrameCount() - 1) * - core.PathConstraintPositionTimeline.ENTRIES - ], - ); - } else if (timelineName === 'mix') { - var timeline = new core.PathConstraintMixTimeline( - timelineMap.length, - ); - timeline.pathConstraintIndex = index; - var frameIndex = 0; - for (var i = 0; i < timelineMap.length; i++) { - var valueMap = timelineMap[i]; - timeline.setFrame( - frameIndex, - valueMap.time, - this.getValue(valueMap, 'rotateMix', 1), - this.getValue(valueMap, 'translateMix', 1), - ); - this.readCurve(valueMap, timeline, frameIndex); - frameIndex++; - } - timelines.push(timeline); - duration = Math.max( - duration, - timeline.frames[ - (timeline.getFrameCount() - 1) * - core.PathConstraintMixTimeline.ENTRIES - ], - ); - } - } - } - } - if (map.deform) { - for (var deformName in map.deform) { - var deformMap = map.deform[deformName]; - var skin = skeletonData.findSkin(deformName); - if (skin == null) throw new Error('Skin not found: ' + deformName); - for (var slotName in deformMap) { - var slotMap = deformMap[slotName]; - var slotIndex = skeletonData.findSlotIndex(slotName); - if (slotIndex == -1) - throw new Error('Slot not found: ' + slotMap.name); - for (var timelineName in slotMap) { - var timelineMap = slotMap[timelineName]; - var attachment = skin.getAttachment(slotIndex, timelineName); - if (attachment == null) - throw new Error( - 'Deform attachment not found: ' + timelineMap.name, - ); - var weighted = attachment.bones != null; - var vertices = attachment.vertices; - var deformLength = weighted - ? (vertices.length / 3) * 2 - : vertices.length; - var timeline = new core.DeformTimeline(timelineMap.length); - timeline.slotIndex = slotIndex; - timeline.attachment = attachment; - var frameIndex = 0; - for (var j = 0; j < timelineMap.length; j++) { - var valueMap = timelineMap[j]; - var deform = void 0; - var verticesValue = this.getValue(valueMap, 'vertices', null); - if (verticesValue == null) - deform = weighted - ? core.Utils.newFloatArray(deformLength) - : vertices; - else { - deform = core.Utils.newFloatArray(deformLength); - var start = this.getValue(valueMap, 'offset', 0); - core.Utils.arrayCopy( - verticesValue, - 0, - deform, - start, - verticesValue.length, - ); - if (scale != 1) { - for ( - var i = start, n = i + verticesValue.length; - i < n; - i++ - ) - deform[i] *= scale; - } - if (!weighted) { - for (var i = 0; i < deformLength; i++) - deform[i] += vertices[i]; - } - } - timeline.setFrame(frameIndex, valueMap.time, deform); - this.readCurve(valueMap, timeline, frameIndex); - frameIndex++; - } - timelines.push(timeline); - duration = Math.max( - duration, - timeline.frames[timeline.getFrameCount() - 1], - ); - } - } - } - } - var drawOrderNode = map.drawOrder; - if (drawOrderNode == null) drawOrderNode = map.draworder; - if (drawOrderNode != null) { - var timeline = new core.DrawOrderTimeline(drawOrderNode.length); - var slotCount = skeletonData.slots.length; - var frameIndex = 0; - for (var j = 0; j < drawOrderNode.length; j++) { - var drawOrderMap = drawOrderNode[j]; - var drawOrder = null; - var offsets = this.getValue(drawOrderMap, 'offsets', null); - if (offsets != null) { - drawOrder = core.Utils.newArray(slotCount, -1); - var unchanged = core.Utils.newArray( - slotCount - offsets.length, - 0, - ); - var originalIndex = 0, - unchangedIndex = 0; - for (var i = 0; i < offsets.length; i++) { - var offsetMap = offsets[i]; - var slotIndex = skeletonData.findSlotIndex(offsetMap.slot); - if (slotIndex == -1) - throw new Error('Slot not found: ' + offsetMap.slot); - while (originalIndex != slotIndex) - unchanged[unchangedIndex++] = originalIndex++; - drawOrder[originalIndex + offsetMap.offset] = originalIndex++; - } - while (originalIndex < slotCount) - unchanged[unchangedIndex++] = originalIndex++; - for (var i = slotCount - 1; i >= 0; i--) - if (drawOrder[i] == -1) - drawOrder[i] = unchanged[--unchangedIndex]; - } - timeline.setFrame(frameIndex++, drawOrderMap.time, drawOrder); - } - timelines.push(timeline); - duration = Math.max( - duration, - timeline.frames[timeline.getFrameCount() - 1], - ); - } - if (map.events) { - var timeline = new core.EventTimeline(map.events.length); - var frameIndex = 0; - for (var i = 0; i < map.events.length; i++) { - var eventMap = map.events[i]; - var eventData = skeletonData.findEvent(eventMap.name); - if (eventData == null) - throw new Error('Event not found: ' + eventMap.name); - var event_5 = new core.Event( - core.Utils.toSinglePrecision(eventMap.time), - eventData, - ); - event_5.intValue = this.getValue( - eventMap, - 'int', - eventData.intValue, - ); - event_5.floatValue = this.getValue( - eventMap, - 'float', - eventData.floatValue, - ); - event_5.stringValue = this.getValue( - eventMap, - 'string', - eventData.stringValue, - ); - if (event_5.data.audioPath != null) { - event_5.volume = this.getValue(eventMap, 'volume', 1); - event_5.balance = this.getValue(eventMap, 'balance', 0); - } - timeline.setFrame(frameIndex++, event_5); - } - timelines.push(timeline); - duration = Math.max( - duration, - timeline.frames[timeline.getFrameCount() - 1], - ); - } - if (isNaN(duration)) { - throw new Error('Error while parsing animation, duration is NaN'); - } - skeletonData.animations.push( - new core.Animation(name, timelines, duration), - ); - }; - SkeletonJson.prototype.readCurve = function(map, timeline, frameIndex) { - if (!map.curve) return; - if (map.curve === 'stepped') timeline.setStepped(frameIndex); - else if ( - Object.prototype.toString.call(map.curve) === '[object Array]' - ) { - var curve = map.curve; - timeline.setCurve(frameIndex, curve[0], curve[1], curve[2], curve[3]); - } - }; - SkeletonJson.prototype.getValue = function(map, prop, defaultValue) { - return map[prop] !== undefined ? map[prop] : defaultValue; - }; - SkeletonJson.blendModeFromString = function(str) { - str = str.toLowerCase(); - if (str == 'normal') return core.BlendMode.Normal; - if (str == 'additive') return core.BlendMode.Additive; - if (str == 'multiply') return core.BlendMode.Multiply; - if (str == 'screen') return core.BlendMode.Screen; - throw new Error('Unknown blend mode: ' + str); - }; - SkeletonJson.positionModeFromString = function(str) { - str = str.toLowerCase(); - if (str == 'fixed') return core.PositionMode.Fixed; - if (str == 'percent') return core.PositionMode.Percent; - throw new Error('Unknown position mode: ' + str); - }; - SkeletonJson.spacingModeFromString = function(str) { - str = str.toLowerCase(); - if (str == 'length') return core.SpacingMode.Length; - if (str == 'fixed') return core.SpacingMode.Fixed; - if (str == 'percent') return core.SpacingMode.Percent; - throw new Error('Unknown position mode: ' + str); - }; - SkeletonJson.rotateModeFromString = function(str) { - str = str.toLowerCase(); - if (str == 'tangent') return core.RotateMode.Tangent; - if (str == 'chain') return core.RotateMode.Chain; - if (str == 'chainscale') return core.RotateMode.ChainScale; - throw new Error('Unknown rotate mode: ' + str); - }; - SkeletonJson.transformModeFromString = function(str) { - str = str.toLowerCase(); - if (str == 'normal') return core.TransformMode.Normal; - if (str == 'onlytranslation') return core.TransformMode.OnlyTranslation; - if (str == 'norotationorreflection') - return core.TransformMode.NoRotationOrReflection; - if (str == 'noscale') return core.TransformMode.NoScale; - if (str == 'noscaleorreflection') - return core.TransformMode.NoScaleOrReflection; - throw new Error('Unknown transform mode: ' + str); - }; - return SkeletonJson; - })(); - core.SkeletonJson = SkeletonJson; - var LinkedMesh = (function() { - function LinkedMesh(mesh, skin, slotIndex, parent) { - this.mesh = mesh; - this.skin = skin; - this.slotIndex = slotIndex; - this.parent = parent; - } - return LinkedMesh; - })(); - })((pixi_spine.core || (pixi_spine.core = {}))); - })(pixi_spine || (pixi_spine = {})); - var pixi_spine; - (function(pixi_spine) { - (function(core) { - var Skin = (function() { - function Skin(name) { - this.attachments = new Array(); - if (name == null) throw new Error('name cannot be null.'); - this.name = name; - } - Skin.prototype.addAttachment = function(slotIndex, name, attachment) { - if (attachment == null) throw new Error('attachment cannot be null.'); - var attachments = this.attachments; - if (slotIndex >= attachments.length) attachments.length = slotIndex + 1; - if (!attachments[slotIndex]) attachments[slotIndex] = {}; - attachments[slotIndex][name] = attachment; - }; - Skin.prototype.getAttachment = function(slotIndex, name) { - var dictionary = this.attachments[slotIndex]; - return dictionary ? dictionary[name] : null; - }; - Skin.prototype.attachAll = function(skeleton, oldSkin) { - var slotIndex = 0; - for (var i = 0; i < skeleton.slots.length; i++) { - var slot = skeleton.slots[i]; - var slotAttachment = slot.getAttachment(); - if (slotAttachment && slotIndex < oldSkin.attachments.length) { - var dictionary = oldSkin.attachments[slotIndex]; - for (var key in dictionary) { - var skinAttachment = dictionary[key]; - if (slotAttachment == skinAttachment) { - var attachment = this.getAttachment(slotIndex, key); - if (attachment != null) slot.setAttachment(attachment); - break; - } - } - } - slotIndex++; - } - }; - return Skin; - })(); - core.Skin = Skin; - })((pixi_spine.core || (pixi_spine.core = {}))); - })(pixi_spine || (pixi_spine = {})); - var pixi_spine; - (function(pixi_spine) { - (function(core) { - var Slot = (function() { - function Slot(data, bone) { - this.attachmentVertices = new Array(); - if (data == null) throw new Error('data cannot be null.'); - if (bone == null) throw new Error('bone cannot be null.'); - this.data = data; - this.bone = bone; - this.color = new core.Color(); - this.darkColor = data.darkColor == null ? null : new core.Color(); - this.setToSetupPose(); - this.blendMode = this.data.blendMode; - } - Slot.prototype.getAttachment = function() { - return this.attachment; - }; - Slot.prototype.setAttachment = function(attachment) { - if (this.attachment == attachment) return; - this.attachment = attachment; - this.attachmentTime = this.bone.skeleton.time; - this.attachmentVertices.length = 0; - }; - Slot.prototype.setAttachmentTime = function(time) { - this.attachmentTime = this.bone.skeleton.time - time; - }; - Slot.prototype.getAttachmentTime = function() { - return this.bone.skeleton.time - this.attachmentTime; - }; - Slot.prototype.setToSetupPose = function() { - this.color.setFromColor(this.data.color); - if (this.darkColor != null) - this.darkColor.setFromColor(this.data.darkColor); - if (this.data.attachmentName == null) this.attachment = null; - else { - this.attachment = null; - this.setAttachment( - this.bone.skeleton.getAttachment( - this.data.index, - this.data.attachmentName, - ), - ); - } - }; - return Slot; - })(); - core.Slot = Slot; - })((pixi_spine.core || (pixi_spine.core = {}))); - })(pixi_spine || (pixi_spine = {})); - var pixi_spine; - (function(pixi_spine) { - (function(core) { - var SlotData = (function() { - function SlotData(index, name, boneData) { - this.color = new core.Color(1, 1, 1, 1); - if (index < 0) throw new Error('index must be >= 0.'); - if (name == null) throw new Error('name cannot be null.'); - if (boneData == null) throw new Error('boneData cannot be null.'); - this.index = index; - this.name = name; - this.boneData = boneData; - } - return SlotData; - })(); - core.SlotData = SlotData; - })((pixi_spine.core || (pixi_spine.core = {}))); - })(pixi_spine || (pixi_spine = {})); - var pixi_spine; - (function(pixi_spine) { - (function(core) { - var Texture = (function() { - function Texture(image) { - this._image = image; - } - Texture.prototype.getImage = function() { - return this._image; - }; - Texture.filterFromString = function(text) { - switch (text.toLowerCase()) { - case 'nearest': - return TextureFilter.Nearest; - case 'linear': - return TextureFilter.Linear; - case 'mipmap': - return TextureFilter.MipMap; - case 'mipmapnearestnearest': - return TextureFilter.MipMapNearestNearest; - case 'mipmaplinearnearest': - return TextureFilter.MipMapLinearNearest; - case 'mipmapnearestlinear': - return TextureFilter.MipMapNearestLinear; - case 'mipmaplinearlinear': - return TextureFilter.MipMapLinearLinear; - default: - throw new Error('Unknown texture filter ' + text); - } - }; - Texture.wrapFromString = function(text) { - switch (text.toLowerCase()) { - case 'mirroredtepeat': - return TextureWrap.MirroredRepeat; - case 'clamptoedge': - return TextureWrap.ClampToEdge; - case 'repeat': - return TextureWrap.Repeat; - default: - throw new Error('Unknown texture wrap ' + text); - } - }; - return Texture; - })(); - core.Texture = Texture; - var TextureFilter; - (function(TextureFilter) { - TextureFilter[(TextureFilter['Nearest'] = 9728)] = 'Nearest'; - TextureFilter[(TextureFilter['Linear'] = 9729)] = 'Linear'; - TextureFilter[(TextureFilter['MipMap'] = 9987)] = 'MipMap'; - TextureFilter[(TextureFilter['MipMapNearestNearest'] = 9984)] = - 'MipMapNearestNearest'; - TextureFilter[(TextureFilter['MipMapLinearNearest'] = 9985)] = - 'MipMapLinearNearest'; - TextureFilter[(TextureFilter['MipMapNearestLinear'] = 9986)] = - 'MipMapNearestLinear'; - TextureFilter[(TextureFilter['MipMapLinearLinear'] = 9987)] = - 'MipMapLinearLinear'; - })((TextureFilter = core.TextureFilter || (core.TextureFilter = {}))); - var TextureWrap; - (function(TextureWrap) { - TextureWrap[(TextureWrap['MirroredRepeat'] = 33648)] = 'MirroredRepeat'; - TextureWrap[(TextureWrap['ClampToEdge'] = 33071)] = 'ClampToEdge'; - TextureWrap[(TextureWrap['Repeat'] = 10497)] = 'Repeat'; - })((TextureWrap = core.TextureWrap || (core.TextureWrap = {}))); - var TextureRegion = (function() { - function TextureRegion() { - this.size = null; - } - Object.defineProperty(TextureRegion.prototype, 'width', { - get: function() { - var tex = this.texture; - if (PIXI.VERSION[0] == '3') { - return tex.crop.width; - } - if (tex.trim) { - return tex.trim.width; - } - return tex.orig.width; - }, - enumerable: true, - configurable: true, - }); - Object.defineProperty(TextureRegion.prototype, 'height', { - get: function() { - var tex = this.texture; - if (PIXI.VERSION[0] == '3') { - return tex.crop.height; - } - if (tex.trim) { - return tex.trim.height; - } - return tex.orig.height; - }, - enumerable: true, - configurable: true, - }); - Object.defineProperty(TextureRegion.prototype, 'u', { - get: function() { - return this.texture._uvs.x0; - }, - enumerable: true, - configurable: true, - }); - Object.defineProperty(TextureRegion.prototype, 'v', { - get: function() { - return this.texture._uvs.y0; - }, - enumerable: true, - configurable: true, - }); - Object.defineProperty(TextureRegion.prototype, 'u2', { - get: function() { - return this.texture._uvs.x2; - }, - enumerable: true, - configurable: true, - }); - Object.defineProperty(TextureRegion.prototype, 'v2', { - get: function() { - return this.texture._uvs.y2; - }, - enumerable: true, - configurable: true, - }); - Object.defineProperty(TextureRegion.prototype, 'offsetX', { - get: function() { - var tex = this.texture; - return tex.trim ? tex.trim.x : 0; - }, - enumerable: true, - configurable: true, - }); - Object.defineProperty(TextureRegion.prototype, 'offsetY', { - get: function() { - console.warn( - 'Deprecation Warning: @Hackerham: I guess, if you are using PIXI-SPINE ATLAS region.offsetY, you want a texture, right? Use region.texture from now on.', - ); - return this.spineOffsetY; - }, - enumerable: true, - configurable: true, - }); - Object.defineProperty(TextureRegion.prototype, 'pixiOffsetY', { - get: function() { - var tex = this.texture; - return tex.trim ? tex.trim.y : 0; - }, - enumerable: true, - configurable: true, - }); - Object.defineProperty(TextureRegion.prototype, 'spineOffsetY', { - get: function() { - var tex = this.texture; - return ( - this.originalHeight - this.height - (tex.trim ? tex.trim.y : 0) - ); - }, - enumerable: true, - configurable: true, - }); - Object.defineProperty(TextureRegion.prototype, 'originalWidth', { - get: function() { - var tex = this.texture; - if (PIXI.VERSION[0] == '3') { - if (tex.trim) { - return tex.trim.width; - } - return tex.crop.width; - } - return tex.orig.width; - }, - enumerable: true, - configurable: true, - }); - Object.defineProperty(TextureRegion.prototype, 'originalHeight', { - get: function() { - var tex = this.texture; - if (PIXI.VERSION[0] == '3') { - if (tex.trim) { - return tex.trim.height; - } - return tex.crop.height; - } - return tex.orig.height; - }, - enumerable: true, - configurable: true, - }); - Object.defineProperty(TextureRegion.prototype, 'x', { - get: function() { - return this.texture.frame.x; - }, - enumerable: true, - configurable: true, - }); - Object.defineProperty(TextureRegion.prototype, 'y', { - get: function() { - return this.texture.frame.y; - }, - enumerable: true, - configurable: true, - }); - Object.defineProperty(TextureRegion.prototype, 'rotate', { - get: function() { - return this.texture.rotate !== 0; - }, - enumerable: true, - configurable: true, - }); - return TextureRegion; - })(); - core.TextureRegion = TextureRegion; - })((pixi_spine.core || (pixi_spine.core = {}))); - })(pixi_spine || (pixi_spine = {})); - var pixi_spine; - (function(pixi_spine) { - (function(core) { - var TextureAtlas = (function() { - function TextureAtlas(atlasText, textureLoader, callback) { - this.pages = new Array(); - this.regions = new Array(); - if (atlasText) { - this.addSpineAtlas(atlasText, textureLoader, callback); - } - } - TextureAtlas.prototype.addTexture = function(name, texture) { - var pages = this.pages; - var page = null; - for (var i = 0; i < pages.length; i++) { - if (pages[i].baseTexture === texture.baseTexture) { - page = pages[i]; - break; - } - } - if (page === null) { - page = new TextureAtlasPage(); - page.name = 'texturePage'; - var baseTexture = texture.baseTexture; - page.width = baseTexture.realWidth; - page.height = baseTexture.realHeight; - page.baseTexture = baseTexture; - page.minFilter = page.magFilter = core.TextureFilter.Nearest; - page.uWrap = core.TextureWrap.ClampToEdge; - page.vWrap = core.TextureWrap.ClampToEdge; - pages.push(page); - } - var region = new TextureAtlasRegion(); - region.name = name; - region.page = page; - region.texture = texture; - region.index = -1; - this.regions.push(region); - return region; - }; - TextureAtlas.prototype.addTextureHash = function( - textures, - stripExtension, - ) { - for (var key in textures) { - if (textures.hasOwnProperty(key)) { - this.addTexture( - stripExtension && key.indexOf('.') !== -1 - ? key.substr(0, key.lastIndexOf('.')) - : key, - textures[key], - ); - } - } - }; - TextureAtlas.prototype.addSpineAtlas = function( - atlasText, - textureLoader, - callback, - ) { - return this.load(atlasText, textureLoader, callback); - }; - TextureAtlas.prototype.load = function( - atlasText, - textureLoader, - callback, - ) { - var _this = this; - if (textureLoader == null) - throw new Error('textureLoader cannot be null.'); - var reader = new TextureAtlasReader(atlasText); - var tuple = new Array(4); - var page = null; - var iterateParser = function() { - while (true) { - var line = reader.readLine(); - if (line == null) { - return callback && callback(_this); - } - line = line.trim(); - if (line.length == 0) page = null; - else if (!page) { - page = new TextureAtlasPage(); - page.name = line; - if (reader.readTuple(tuple) == 2) { - page.width = parseInt(tuple[0]); - page.height = parseInt(tuple[1]); - reader.readTuple(tuple); - } - reader.readTuple(tuple); - page.minFilter = core.Texture.filterFromString(tuple[0]); - page.magFilter = core.Texture.filterFromString(tuple[1]); - var direction = reader.readValue(); - page.uWrap = core.TextureWrap.ClampToEdge; - page.vWrap = core.TextureWrap.ClampToEdge; - if (direction == 'x') page.uWrap = core.TextureWrap.Repeat; - else if (direction == 'y') page.vWrap = core.TextureWrap.Repeat; - else if (direction == 'xy') - page.uWrap = page.vWrap = core.TextureWrap.Repeat; - textureLoader(line, function(texture) { - if (texture === null) { - _this.pages.splice(_this.pages.indexOf(page), 1); - return callback && callback(null); - } - page.baseTexture = texture; - if (!texture.hasLoaded) { - texture.width = page.width; - texture.height = page.height; - } - _this.pages.push(page); - page.setFilters(); - if (!page.width || !page.height) { - page.width = texture.realWidth; - page.height = texture.realHeight; - if (!page.width || !page.height) { - console.log( - 'ERROR spine atlas page ' + - page.name + - ': meshes wont work if you dont specify size in atlas (http://www.html5gamedevs.com/topic/18888-pixi-spines-and-meshes/?p=107121)', - ); - } - } - iterateParser(); - }); - _this.pages.push(page); - break; - } else { - var region = new TextureAtlasRegion(); - region.name = line; - region.page = page; - var rotate = reader.readValue() == 'true' ? 6 : 0; - reader.readTuple(tuple); - var x = parseInt(tuple[0]); - var y = parseInt(tuple[1]); - reader.readTuple(tuple); - var width = parseInt(tuple[0]); - var height = parseInt(tuple[1]); - var resolution = page.baseTexture.resolution; - x /= resolution; - y /= resolution; - width /= resolution; - height /= resolution; - var frame = new PIXI.Rectangle( - x, - y, - rotate ? height : width, - rotate ? width : height, - ); - if (reader.readTuple(tuple) == 4) { - if (reader.readTuple(tuple) == 4) { - reader.readTuple(tuple); - } - } - var originalWidth = parseInt(tuple[0]) / resolution; - var originalHeight = parseInt(tuple[1]) / resolution; - reader.readTuple(tuple); - var offsetX = parseInt(tuple[0]) / resolution; - var offsetY = parseInt(tuple[1]) / resolution; - var orig = new PIXI.Rectangle( - 0, - 0, - originalWidth, - originalHeight, - ); - var trim = new PIXI.Rectangle( - offsetX, - originalHeight - height - offsetY, - width, - height, - ); - if (PIXI.VERSION[0] != '3') { - region.texture = new PIXI.Texture( - region.page.baseTexture, - frame, - orig, - trim, - rotate, - ); - } else { - var frame2 = new PIXI.Rectangle(x, y, width, height); - var crop = frame2.clone(); - trim.width = originalWidth; - trim.height = originalHeight; - region.texture = new PIXI.Texture( - region.page.baseTexture, - frame2, - crop, - trim, - rotate, - ); - } - region.index = parseInt(reader.readValue()); - region.texture._updateUvs(); - _this.regions.push(region); - } - } - }; - iterateParser(); - }; - TextureAtlas.prototype.findRegion = function(name) { - for (var i = 0; i < this.regions.length; i++) { - if (this.regions[i].name == name) { - return this.regions[i]; - } - } - return null; - }; - TextureAtlas.prototype.dispose = function() { - for (var i = 0; i < this.pages.length; i++) { - this.pages[i].baseTexture.dispose(); - } - }; - return TextureAtlas; - })(); - core.TextureAtlas = TextureAtlas; - var TextureAtlasReader = (function() { - function TextureAtlasReader(text) { - this.index = 0; - this.lines = text.split(/\r\n|\r|\n/); - } - TextureAtlasReader.prototype.readLine = function() { - if (this.index >= this.lines.length) return null; - return this.lines[this.index++]; - }; - TextureAtlasReader.prototype.readValue = function() { - var line = this.readLine(); - var colon = line.indexOf(':'); - if (colon == -1) throw new Error('Invalid line: ' + line); - return line.substring(colon + 1).trim(); - }; - TextureAtlasReader.prototype.readTuple = function(tuple) { - var line = this.readLine(); - var colon = line.indexOf(':'); - if (colon == -1) throw new Error('Invalid line: ' + line); - var i = 0, - lastMatch = colon + 1; - for (; i < 3; i++) { - var comma = line.indexOf(',', lastMatch); - if (comma == -1) break; - tuple[i] = line.substr(lastMatch, comma - lastMatch).trim(); - lastMatch = comma + 1; - } - tuple[i] = line.substring(lastMatch).trim(); - return i + 1; - }; - return TextureAtlasReader; - })(); - var TextureAtlasPage = (function() { - function TextureAtlasPage() {} - TextureAtlasPage.prototype.setFilters = function() { - var tex = this.baseTexture; - var filter = this.minFilter; - if (filter == core.TextureFilter.Linear) { - tex.scaleMode = PIXI.SCALE_MODES.LINEAR; - } else if (this.minFilter == core.TextureFilter.Nearest) { - tex.scaleMode = PIXI.SCALE_MODES.NEAREST; - } else { - tex.mipmap = true; - if (filter == core.TextureFilter.MipMapNearestNearest) { - tex.scaleMode = PIXI.SCALE_MODES.NEAREST; - } else { - tex.scaleMode = PIXI.SCALE_MODES.LINEAR; - } - } - }; - return TextureAtlasPage; - })(); - core.TextureAtlasPage = TextureAtlasPage; - var TextureAtlasRegion = (function(_super) { - __extends(TextureAtlasRegion, _super); - function TextureAtlasRegion() { - return (_super !== null && _super.apply(this, arguments)) || this; - } - return TextureAtlasRegion; - })(core.TextureRegion); - core.TextureAtlasRegion = TextureAtlasRegion; - })((pixi_spine.core || (pixi_spine.core = {}))); - })(pixi_spine || (pixi_spine = {})); - var pixi_spine; - (function(pixi_spine) { - (function(core) { - var TransformConstraint = (function() { - function TransformConstraint(data, skeleton) { - this.rotateMix = 0; - this.translateMix = 0; - this.scaleMix = 0; - this.shearMix = 0; - this.temp = new core.Vector2(); - if (data == null) throw new Error('data cannot be null.'); - if (skeleton == null) throw new Error('skeleton cannot be null.'); - this.data = data; - this.rotateMix = data.rotateMix; - this.translateMix = data.translateMix; - this.scaleMix = data.scaleMix; - this.shearMix = data.shearMix; - this.bones = new Array(); - for (var i = 0; i < data.bones.length; i++) - this.bones.push(skeleton.findBone(data.bones[i].name)); - this.target = skeleton.findBone(data.target.name); - } - TransformConstraint.prototype.apply = function() { - this.update(); - }; - TransformConstraint.prototype.update = function() { - if (this.data.local) { - if (this.data.relative) this.applyRelativeLocal(); - else this.applyAbsoluteLocal(); - } else { - if (this.data.relative) this.applyRelativeWorld(); - else this.applyAbsoluteWorld(); - } - }; - TransformConstraint.prototype.applyAbsoluteWorld = function() { - var rotateMix = this.rotateMix, - translateMix = this.translateMix, - scaleMix = this.scaleMix, - shearMix = this.shearMix; - var target = this.target; - var targetMat = target.matrix; - var ta = targetMat.a, - tb = targetMat.c, - tc = targetMat.b, - td = targetMat.d; - var degRadReflect = - ta * td - tb * tc > 0 - ? core.MathUtils.degRad - : -core.MathUtils.degRad; - var offsetRotation = this.data.offsetRotation * degRadReflect; - var offsetShearY = this.data.offsetShearY * degRadReflect; - var bones = this.bones; - for (var i = 0, n = bones.length; i < n; i++) { - var bone = bones[i]; - var modified = false; - var mat = bone.matrix; - if (rotateMix != 0) { - var a = mat.a, - b = mat.c, - c = mat.b, - d = mat.d; - var r = Math.atan2(tc, ta) - Math.atan2(c, a) + offsetRotation; - if (r > core.MathUtils.PI) r -= core.MathUtils.PI2; - else if (r < -core.MathUtils.PI) r += core.MathUtils.PI2; - r *= rotateMix; - var cos = Math.cos(r), - sin = Math.sin(r); - mat.a = cos * a - sin * c; - mat.c = cos * b - sin * d; - mat.b = sin * a + cos * c; - mat.d = sin * b + cos * d; - modified = true; - } - if (translateMix != 0) { - var temp = this.temp; - target.localToWorld(temp.set(this.data.offsetX, this.data.offsetY)); - mat.tx += (temp.x - mat.tx) * translateMix; - mat.ty += (temp.y - mat.ty) * translateMix; - modified = true; - } - if (scaleMix > 0) { - var s = Math.sqrt(mat.a * mat.a + mat.b * mat.b); - var ts = Math.sqrt(ta * ta + tc * tc); - if (s > 0.00001) - s = (s + (ts - s + this.data.offsetScaleX) * scaleMix) / s; - mat.a *= s; - mat.b *= s; - s = Math.sqrt(mat.c * mat.c + mat.d * mat.d); - ts = Math.sqrt(tb * tb + td * td); - if (s > 0.00001) - s = (s + (ts - s + this.data.offsetScaleY) * scaleMix) / s; - mat.c *= s; - mat.d *= s; - modified = true; - } - if (shearMix > 0) { - var b = mat.c, - d = mat.d; - var by = Math.atan2(d, b); - var r = - Math.atan2(td, tb) - - Math.atan2(tc, ta) - - (by - Math.atan2(mat.b, mat.a)); - if (r > core.MathUtils.PI) r -= core.MathUtils.PI2; - else if (r < -core.MathUtils.PI) r += core.MathUtils.PI2; - r = by + (r + offsetShearY) * shearMix; - var s = Math.sqrt(b * b + d * d); - mat.c = Math.cos(r) * s; - mat.d = Math.sin(r) * s; - modified = true; - } - if (modified) bone.appliedValid = false; - } - }; - TransformConstraint.prototype.applyRelativeWorld = function() { - var rotateMix = this.rotateMix, - translateMix = this.translateMix, - scaleMix = this.scaleMix, - shearMix = this.shearMix; - var target = this.target; - var targetMat = target.matrix; - var ta = targetMat.a, - tb = targetMat.c, - tc = targetMat.b, - td = targetMat.d; - var degRadReflect = - ta * td - tb * tc > 0 - ? core.MathUtils.degRad - : -core.MathUtils.degRad; - var offsetRotation = this.data.offsetRotation * degRadReflect, - offsetShearY = this.data.offsetShearY * degRadReflect; - var bones = this.bones; - for (var i = 0, n = bones.length; i < n; i++) { - var bone = bones[i]; - var modified = false; - var mat = bone.matrix; - if (rotateMix != 0) { - var a = mat.a, - b = mat.c, - c = mat.b, - d = mat.d; - var r = Math.atan2(tc, ta) + offsetRotation; - if (r > core.MathUtils.PI) r -= core.MathUtils.PI2; - else if (r < -core.MathUtils.PI) r += core.MathUtils.PI2; - r *= rotateMix; - var cos = Math.cos(r), - sin = Math.sin(r); - mat.a = cos * a - sin * c; - mat.c = cos * b - sin * d; - mat.b = sin * a + cos * c; - mat.d = sin * b + cos * d; - modified = true; - } - if (translateMix != 0) { - var temp = this.temp; - target.localToWorld(temp.set(this.data.offsetX, this.data.offsetY)); - mat.tx += temp.x * translateMix; - mat.ty += temp.y * translateMix; - modified = true; - } - if (scaleMix > 0) { - var s = - (Math.sqrt(ta * ta + tc * tc) - 1 + this.data.offsetScaleX) * - scaleMix + - 1; - mat.a *= s; - mat.b *= s; - s = - (Math.sqrt(tb * tb + td * td) - 1 + this.data.offsetScaleY) * - scaleMix + - 1; - mat.c *= s; - mat.d *= s; - modified = true; - } - if (shearMix > 0) { - var r = Math.atan2(td, tb) - Math.atan2(tc, ta); - if (r > core.MathUtils.PI) r -= core.MathUtils.PI2; - else if (r < -core.MathUtils.PI) r += core.MathUtils.PI2; - var b = mat.c, - d = mat.d; - r = - Math.atan2(d, b) + - (r - core.MathUtils.PI / 2 + offsetShearY) * shearMix; - var s = Math.sqrt(b * b + d * d); - mat.c = Math.cos(r) * s; - mat.d = Math.sin(r) * s; - modified = true; - } - if (modified) bone.appliedValid = false; - } - }; - TransformConstraint.prototype.applyAbsoluteLocal = function() { - var rotateMix = this.rotateMix, - translateMix = this.translateMix, - scaleMix = this.scaleMix, - shearMix = this.shearMix; - var target = this.target; - if (!target.appliedValid) target.updateAppliedTransform(); - var bones = this.bones; - for (var i = 0, n = bones.length; i < n; i++) { - var bone = bones[i]; - if (!bone.appliedValid) bone.updateAppliedTransform(); - var rotation = bone.arotation; - if (rotateMix != 0) { - var r = target.arotation - rotation + this.data.offsetRotation; - r -= (16384 - ((16384.499999999996 - r / 360) | 0)) * 360; - rotation += r * rotateMix; - } - var x = bone.ax, - y = bone.ay; - if (translateMix != 0) { - x += (target.ax - x + this.data.offsetX) * translateMix; - y += (target.ay - y + this.data.offsetY) * translateMix; - } - var scaleX = bone.ascaleX, - scaleY = bone.ascaleY; - if (scaleMix > 0) { - if (scaleX > 0.00001) - scaleX = - (scaleX + - (target.ascaleX - scaleX + this.data.offsetScaleX) * - scaleMix) / - scaleX; - if (scaleY > 0.00001) - scaleY = - (scaleY + - (target.ascaleY - scaleY + this.data.offsetScaleY) * - scaleMix) / - scaleY; - } - var shearY = bone.ashearY; - if (shearMix > 0) { - var r = target.ashearY - shearY + this.data.offsetShearY; - r -= (16384 - ((16384.499999999996 - r / 360) | 0)) * 360; - bone.shearY += r * shearMix; - } - bone.updateWorldTransformWith( - x, - y, - rotation, - scaleX, - scaleY, - bone.ashearX, - shearY, - ); - } - }; - TransformConstraint.prototype.applyRelativeLocal = function() { - var rotateMix = this.rotateMix, - translateMix = this.translateMix, - scaleMix = this.scaleMix, - shearMix = this.shearMix; - var target = this.target; - if (!target.appliedValid) target.updateAppliedTransform(); - var bones = this.bones; - for (var i = 0, n = bones.length; i < n; i++) { - var bone = bones[i]; - if (!bone.appliedValid) bone.updateAppliedTransform(); - var rotation = bone.arotation; - if (rotateMix != 0) - rotation += - (target.arotation + this.data.offsetRotation) * rotateMix; - var x = bone.ax, - y = bone.ay; - if (translateMix != 0) { - x += (target.ax + this.data.offsetX) * translateMix; - y += (target.ay + this.data.offsetY) * translateMix; - } - var scaleX = bone.ascaleX, - scaleY = bone.ascaleY; - if (scaleMix > 0) { - if (scaleX > 0.00001) - scaleX *= - (target.ascaleX - 1 + this.data.offsetScaleX) * scaleMix + 1; - if (scaleY > 0.00001) - scaleY *= - (target.ascaleY - 1 + this.data.offsetScaleY) * scaleMix + 1; - } - var shearY = bone.ashearY; - if (shearMix > 0) - shearY += (target.ashearY + this.data.offsetShearY) * shearMix; - bone.updateWorldTransformWith( - x, - y, - rotation, - scaleX, - scaleY, - bone.ashearX, - shearY, - ); - } - }; - TransformConstraint.prototype.getOrder = function() { - return this.data.order; - }; - return TransformConstraint; - })(); - core.TransformConstraint = TransformConstraint; - })((pixi_spine.core || (pixi_spine.core = {}))); - })(pixi_spine || (pixi_spine = {})); - var pixi_spine; - (function(pixi_spine) { - (function(core) { - var TransformConstraintData = (function() { - function TransformConstraintData(name) { - this.order = 0; - this.bones = new Array(); - this.rotateMix = 0; - this.translateMix = 0; - this.scaleMix = 0; - this.shearMix = 0; - this.offsetRotation = 0; - this.offsetX = 0; - this.offsetY = 0; - this.offsetScaleX = 0; - this.offsetScaleY = 0; - this.offsetShearY = 0; - this.relative = false; - this.local = false; - if (name == null) throw new Error('name cannot be null.'); - this.name = name; - } - return TransformConstraintData; - })(); - core.TransformConstraintData = TransformConstraintData; - })((pixi_spine.core || (pixi_spine.core = {}))); - })(pixi_spine || (pixi_spine = {})); - var pixi_spine; - (function(pixi_spine) { - (function(core) { - var Triangulator = (function() { - function Triangulator() { - this.convexPolygons = new Array(); - this.convexPolygonsIndices = new Array(); - this.indicesArray = new Array(); - this.isConcaveArray = new Array(); - this.triangles = new Array(); - this.polygonPool = new core.Pool(function() { - return new Array(); - }); - this.polygonIndicesPool = new core.Pool(function() { - return new Array(); - }); - } - Triangulator.prototype.triangulate = function(verticesArray) { - var vertices = verticesArray; - var vertexCount = verticesArray.length >> 1; - var indices = this.indicesArray; - indices.length = 0; - for (var i = 0; i < vertexCount; i++) indices[i] = i; - var isConcave = this.isConcaveArray; - isConcave.length = 0; - for (var i = 0, n = vertexCount; i < n; ++i) - isConcave[i] = Triangulator.isConcave( - i, - vertexCount, - vertices, - indices, - ); - var triangles = this.triangles; - triangles.length = 0; - while (vertexCount > 3) { - var previous = vertexCount - 1, - i = 0, - next = 1; - while (true) { - outer: if (!isConcave[i]) { - var p1 = indices[previous] << 1, - p2 = indices[i] << 1, - p3 = indices[next] << 1; - var p1x = vertices[p1], - p1y = vertices[p1 + 1]; - var p2x = vertices[p2], - p2y = vertices[p2 + 1]; - var p3x = vertices[p3], - p3y = vertices[p3 + 1]; - for ( - var ii = (next + 1) % vertexCount; - ii != previous; - ii = (ii + 1) % vertexCount - ) { - if (!isConcave[ii]) continue; - var v = indices[ii] << 1; - var vx = vertices[v], - vy = vertices[v + 1]; - if (Triangulator.positiveArea(p3x, p3y, p1x, p1y, vx, vy)) { - if (Triangulator.positiveArea(p1x, p1y, p2x, p2y, vx, vy)) { - if (Triangulator.positiveArea(p2x, p2y, p3x, p3y, vx, vy)) - break outer; - } - } - } - break; - } - if (next == 0) { - do { - if (!isConcave[i]) break; - i--; - } while (i > 0); - break; - } - previous = i; - i = next; - next = (next + 1) % vertexCount; - } - triangles.push(indices[(vertexCount + i - 1) % vertexCount]); - triangles.push(indices[i]); - triangles.push(indices[(i + 1) % vertexCount]); - indices.splice(i, 1); - isConcave.splice(i, 1); - vertexCount--; - var previousIndex = (vertexCount + i - 1) % vertexCount; - var nextIndex = i == vertexCount ? 0 : i; - isConcave[previousIndex] = Triangulator.isConcave( - previousIndex, - vertexCount, - vertices, - indices, - ); - isConcave[nextIndex] = Triangulator.isConcave( - nextIndex, - vertexCount, - vertices, - indices, - ); - } - if (vertexCount == 3) { - triangles.push(indices[2]); - triangles.push(indices[0]); - triangles.push(indices[1]); - } - return triangles; - }; - Triangulator.prototype.decompose = function(verticesArray, triangles) { - var vertices = verticesArray; - var convexPolygons = this.convexPolygons; - this.polygonPool.freeAll(convexPolygons); - convexPolygons.length = 0; - var convexPolygonsIndices = this.convexPolygonsIndices; - this.polygonIndicesPool.freeAll(convexPolygonsIndices); - convexPolygonsIndices.length = 0; - var polygonIndices = this.polygonIndicesPool.obtain(); - polygonIndices.length = 0; - var polygon = this.polygonPool.obtain(); - polygon.length = 0; - var fanBaseIndex = -1, - lastWinding = 0; - for (var i = 0, n = triangles.length; i < n; i += 3) { - var t1 = triangles[i] << 1, - t2 = triangles[i + 1] << 1, - t3 = triangles[i + 2] << 1; - var x1 = vertices[t1], - y1 = vertices[t1 + 1]; - var x2 = vertices[t2], - y2 = vertices[t2 + 1]; - var x3 = vertices[t3], - y3 = vertices[t3 + 1]; - var merged = false; - if (fanBaseIndex == t1) { - var o = polygon.length - 4; - var winding1 = Triangulator.winding( - polygon[o], - polygon[o + 1], - polygon[o + 2], - polygon[o + 3], - x3, - y3, - ); - var winding2 = Triangulator.winding( - x3, - y3, - polygon[0], - polygon[1], - polygon[2], - polygon[3], - ); - if (winding1 == lastWinding && winding2 == lastWinding) { - polygon.push(x3); - polygon.push(y3); - polygonIndices.push(t3); - merged = true; - } - } - if (!merged) { - if (polygon.length > 0) { - convexPolygons.push(polygon); - convexPolygonsIndices.push(polygonIndices); - } else { - this.polygonPool.free(polygon); - this.polygonIndicesPool.free(polygonIndices); - } - polygon = this.polygonPool.obtain(); - polygon.length = 0; - polygon.push(x1); - polygon.push(y1); - polygon.push(x2); - polygon.push(y2); - polygon.push(x3); - polygon.push(y3); - polygonIndices = this.polygonIndicesPool.obtain(); - polygonIndices.length = 0; - polygonIndices.push(t1); - polygonIndices.push(t2); - polygonIndices.push(t3); - lastWinding = Triangulator.winding(x1, y1, x2, y2, x3, y3); - fanBaseIndex = t1; - } - } - if (polygon.length > 0) { - convexPolygons.push(polygon); - convexPolygonsIndices.push(polygonIndices); - } - for (var i = 0, n = convexPolygons.length; i < n; i++) { - polygonIndices = convexPolygonsIndices[i]; - if (polygonIndices.length == 0) continue; - var firstIndex = polygonIndices[0]; - var lastIndex = polygonIndices[polygonIndices.length - 1]; - polygon = convexPolygons[i]; - var o = polygon.length - 4; - var prevPrevX = polygon[o], - prevPrevY = polygon[o + 1]; - var prevX = polygon[o + 2], - prevY = polygon[o + 3]; - var firstX = polygon[0], - firstY = polygon[1]; - var secondX = polygon[2], - secondY = polygon[3]; - var winding = Triangulator.winding( - prevPrevX, - prevPrevY, - prevX, - prevY, - firstX, - firstY, - ); - for (var ii = 0; ii < n; ii++) { - if (ii == i) continue; - var otherIndices = convexPolygonsIndices[ii]; - if (otherIndices.length != 3) continue; - var otherFirstIndex = otherIndices[0]; - var otherSecondIndex = otherIndices[1]; - var otherLastIndex = otherIndices[2]; - var otherPoly = convexPolygons[ii]; - var x3 = otherPoly[otherPoly.length - 2], - y3 = otherPoly[otherPoly.length - 1]; - if (otherFirstIndex != firstIndex || otherSecondIndex != lastIndex) - continue; - var winding1 = Triangulator.winding( - prevPrevX, - prevPrevY, - prevX, - prevY, - x3, - y3, - ); - var winding2 = Triangulator.winding( - x3, - y3, - firstX, - firstY, - secondX, - secondY, - ); - if (winding1 == winding && winding2 == winding) { - otherPoly.length = 0; - otherIndices.length = 0; - polygon.push(x3); - polygon.push(y3); - polygonIndices.push(otherLastIndex); - prevPrevX = prevX; - prevPrevY = prevY; - prevX = x3; - prevY = y3; - ii = 0; - } - } - } - for (var i = convexPolygons.length - 1; i >= 0; i--) { - polygon = convexPolygons[i]; - if (polygon.length == 0) { - convexPolygons.splice(i, 1); - this.polygonPool.free(polygon); - polygonIndices = convexPolygonsIndices[i]; - convexPolygonsIndices.splice(i, 1); - this.polygonIndicesPool.free(polygonIndices); - } - } - return convexPolygons; - }; - Triangulator.isConcave = function(index, vertexCount, vertices, indices) { - var previous = indices[(vertexCount + index - 1) % vertexCount] << 1; - var current = indices[index] << 1; - var next = indices[(index + 1) % vertexCount] << 1; - return !this.positiveArea( - vertices[previous], - vertices[previous + 1], - vertices[current], - vertices[current + 1], - vertices[next], - vertices[next + 1], - ); - }; - Triangulator.positiveArea = function(p1x, p1y, p2x, p2y, p3x, p3y) { - return p1x * (p3y - p2y) + p2x * (p1y - p3y) + p3x * (p2y - p1y) >= 0; - }; - Triangulator.winding = function(p1x, p1y, p2x, p2y, p3x, p3y) { - var px = p2x - p1x, - py = p2y - p1y; - return p3x * py - p3y * px + px * p1y - p1x * py >= 0 ? 1 : -1; - }; - return Triangulator; - })(); - core.Triangulator = Triangulator; - })((pixi_spine.core || (pixi_spine.core = {}))); - })(pixi_spine || (pixi_spine = {})); - var pixi_spine; - (function(pixi_spine) { - (function(core) { - var IntSet = (function() { - function IntSet() { - this.array = new Array(); - } - IntSet.prototype.add = function(value) { - var contains = this.contains(value); - this.array[value | 0] = value | 0; - return !contains; - }; - IntSet.prototype.contains = function(value) { - return this.array[value | 0] != undefined; - }; - IntSet.prototype.remove = function(value) { - this.array[value | 0] = undefined; - }; - IntSet.prototype.clear = function() { - this.array.length = 0; - }; - return IntSet; - })(); - core.IntSet = IntSet; - var Color = (function() { - function Color(r, g, b, a) { - if (r === void 0) { - r = 0; - } - if (g === void 0) { - g = 0; - } - if (b === void 0) { - b = 0; - } - if (a === void 0) { - a = 0; - } - this.r = r; - this.g = g; - this.b = b; - this.a = a; - } - Color.prototype.set = function(r, g, b, a) { - this.r = r; - this.g = g; - this.b = b; - this.a = a; - this.clamp(); - return this; - }; - Color.prototype.setFromColor = function(c) { - this.r = c.r; - this.g = c.g; - this.b = c.b; - this.a = c.a; - return this; - }; - Color.prototype.setFromString = function(hex) { - hex = hex.charAt(0) == '#' ? hex.substr(1) : hex; - this.r = parseInt(hex.substr(0, 2), 16) / 255.0; - this.g = parseInt(hex.substr(2, 2), 16) / 255.0; - this.b = parseInt(hex.substr(4, 2), 16) / 255.0; - this.a = - (hex.length != 8 ? 255 : parseInt(hex.substr(6, 2), 16)) / 255.0; - return this; - }; - Color.prototype.add = function(r, g, b, a) { - this.r += r; - this.g += g; - this.b += b; - this.a += a; - this.clamp(); - return this; - }; - Color.prototype.clamp = function() { - if (this.r < 0) this.r = 0; - else if (this.r > 1) this.r = 1; - if (this.g < 0) this.g = 0; - else if (this.g > 1) this.g = 1; - if (this.b < 0) this.b = 0; - else if (this.b > 1) this.b = 1; - if (this.a < 0) this.a = 0; - else if (this.a > 1) this.a = 1; - return this; - }; - Color.WHITE = new Color(1, 1, 1, 1); - Color.RED = new Color(1, 0, 0, 1); - Color.GREEN = new Color(0, 1, 0, 1); - Color.BLUE = new Color(0, 0, 1, 1); - Color.MAGENTA = new Color(1, 0, 1, 1); - return Color; - })(); - core.Color = Color; - var MathUtils = (function() { - function MathUtils() {} - MathUtils.clamp = function(value, min, max) { - if (value < min) return min; - if (value > max) return max; - return value; - }; - MathUtils.cosDeg = function(degrees) { - return Math.cos(degrees * MathUtils.degRad); - }; - MathUtils.sinDeg = function(degrees) { - return Math.sin(degrees * MathUtils.degRad); - }; - MathUtils.signum = function(value) { - return value > 0 ? 1 : value < 0 ? -1 : 0; - }; - MathUtils.toInt = function(x) { - return x > 0 ? Math.floor(x) : Math.ceil(x); - }; - MathUtils.cbrt = function(x) { - var y = Math.pow(Math.abs(x), 1 / 3); - return x < 0 ? -y : y; - }; - MathUtils.randomTriangular = function(min, max) { - return MathUtils.randomTriangularWith(min, max, (min + max) * 0.5); - }; - MathUtils.randomTriangularWith = function(min, max, mode) { - var u = Math.random(); - var d = max - min; - if (u <= (mode - min) / d) return min + Math.sqrt(u * d * (mode - min)); - return max - Math.sqrt((1 - u) * d * (max - mode)); - }; - MathUtils.PI = 3.1415927; - MathUtils.PI2 = MathUtils.PI * 2; - MathUtils.radiansToDegrees = 180 / MathUtils.PI; - MathUtils.radDeg = MathUtils.radiansToDegrees; - MathUtils.degreesToRadians = MathUtils.PI / 180; - MathUtils.degRad = MathUtils.degreesToRadians; - return MathUtils; - })(); - core.MathUtils = MathUtils; - var Interpolation = (function() { - function Interpolation() {} - Interpolation.prototype.apply = function(start, end, a) { - return start + (end - start) * this.applyInternal(a); - }; - return Interpolation; - })(); - core.Interpolation = Interpolation; - var Pow = (function(_super) { - __extends(Pow, _super); - function Pow(power) { - var _this = _super.call(this) || this; - _this.power = 2; - _this.power = power; - return _this; - } - Pow.prototype.applyInternal = function(a) { - if (a <= 0.5) return Math.pow(a * 2, this.power) / 2; - return ( - Math.pow((a - 1) * 2, this.power) / (this.power % 2 == 0 ? -2 : 2) + 1 - ); - }; - return Pow; - })(Interpolation); - core.Pow = Pow; - var PowOut = (function(_super) { - __extends(PowOut, _super); - function PowOut(power) { - return _super.call(this, power) || this; - } - PowOut.prototype.applyInternal = function(a) { - return Math.pow(a - 1, this.power) * (this.power % 2 == 0 ? -1 : 1) + 1; - }; - return PowOut; - })(Pow); - core.PowOut = PowOut; - var Utils = (function() { - function Utils() {} - Utils.arrayCopy = function( - source, - sourceStart, - dest, - destStart, - numElements, - ) { - for ( - var i = sourceStart, j = destStart; - i < sourceStart + numElements; - i++, j++ - ) { - dest[j] = source[i]; - } - }; - Utils.setArraySize = function(array, size, value) { - if (value === void 0) { - value = 0; - } - var oldSize = array.length; - if (oldSize == size) return array; - array.length = size; - if (oldSize < size) { - for (var i = oldSize; i < size; i++) array[i] = value; - } - return array; - }; - Utils.ensureArrayCapacity = function(array, size, value) { - if (value === void 0) { - value = 0; - } - if (array.length >= size) return array; - return Utils.setArraySize(array, size, value); - }; - Utils.newArray = function(size, defaultValue) { - var array = new Array(size); - for (var i = 0; i < size; i++) array[i] = defaultValue; - return array; - }; - Utils.newFloatArray = function(size) { - if (Utils.SUPPORTS_TYPED_ARRAYS) { - return new Float32Array(size); - } else { - var array = new Array(size); - for (var i = 0; i < array.length; i++) array[i] = 0; - return array; - } - }; - Utils.newShortArray = function(size) { - if (Utils.SUPPORTS_TYPED_ARRAYS) { - return new Int16Array(size); - } else { - var array = new Array(size); - for (var i = 0; i < array.length; i++) array[i] = 0; - return array; - } - }; - Utils.toFloatArray = function(array) { - return Utils.SUPPORTS_TYPED_ARRAYS ? new Float32Array(array) : array; - }; - Utils.toSinglePrecision = function(value) { - return Utils.SUPPORTS_TYPED_ARRAYS ? Math.fround(value) : value; - }; - Utils.webkit602BugfixHelper = function(alpha, blend) {}; - Utils.SUPPORTS_TYPED_ARRAYS = typeof Float32Array !== 'undefined'; - return Utils; - })(); - core.Utils = Utils; - var DebugUtils = (function() { - function DebugUtils() {} - DebugUtils.logBones = function(skeleton) { - for (var i = 0; i < skeleton.bones.length; i++) { - var bone = skeleton.bones[i]; - var mat = bone.matrix; - console.log( - bone.data.name + - ', ' + - mat.a + - ', ' + - mat.b + - ', ' + - mat.c + - ', ' + - mat.d + - ', ' + - mat.tx + - ', ' + - mat.ty, - ); - } - }; - return DebugUtils; - })(); - core.DebugUtils = DebugUtils; - var Pool = (function() { - function Pool(instantiator) { - this.items = new Array(); - this.instantiator = instantiator; - } - Pool.prototype.obtain = function() { - return this.items.length > 0 ? this.items.pop() : this.instantiator(); - }; - Pool.prototype.free = function(item) { - if (item.reset) item.reset(); - this.items.push(item); - }; - Pool.prototype.freeAll = function(items) { - for (var i = 0; i < items.length; i++) { - if (items[i].reset) items[i].reset(); - this.items[i] = items[i]; - } - }; - Pool.prototype.clear = function() { - this.items.length = 0; - }; - return Pool; - })(); - core.Pool = Pool; - var Vector2 = (function() { - function Vector2(x, y) { - if (x === void 0) { - x = 0; - } - if (y === void 0) { - y = 0; - } - this.x = x; - this.y = y; - } - Vector2.prototype.set = function(x, y) { - this.x = x; - this.y = y; - return this; - }; - Vector2.prototype.length = function() { - var x = this.x; - var y = this.y; - return Math.sqrt(x * x + y * y); - }; - Vector2.prototype.normalize = function() { - var len = this.length(); - if (len != 0) { - this.x /= len; - this.y /= len; - } - return this; - }; - return Vector2; - })(); - core.Vector2 = Vector2; - var TimeKeeper = (function() { - function TimeKeeper() { - this.maxDelta = 0.064; - this.framesPerSecond = 0; - this.delta = 0; - this.totalTime = 0; - this.lastTime = Date.now() / 1000; - this.frameCount = 0; - this.frameTime = 0; - } - TimeKeeper.prototype.update = function() { - var now = Date.now() / 1000; - this.delta = now - this.lastTime; - this.frameTime += this.delta; - this.totalTime += this.delta; - if (this.delta > this.maxDelta) this.delta = this.maxDelta; - this.lastTime = now; - this.frameCount++; - if (this.frameTime > 1) { - this.framesPerSecond = this.frameCount / this.frameTime; - this.frameTime = 0; - this.frameCount = 0; - } - }; - return TimeKeeper; - })(); - core.TimeKeeper = TimeKeeper; - var WindowedMean = (function() { - function WindowedMean(windowSize) { - if (windowSize === void 0) { - windowSize = 32; - } - this.addedValues = 0; - this.lastValue = 0; - this.mean = 0; - this.dirty = true; - this.values = new Array(windowSize); - } - WindowedMean.prototype.hasEnoughData = function() { - return this.addedValues >= this.values.length; - }; - WindowedMean.prototype.addValue = function(value) { - if (this.addedValues < this.values.length) this.addedValues++; - this.values[this.lastValue++] = value; - if (this.lastValue > this.values.length - 1) this.lastValue = 0; - this.dirty = true; - }; - WindowedMean.prototype.getMean = function() { - if (this.hasEnoughData()) { - if (this.dirty) { - var mean = 0; - for (var i = 0; i < this.values.length; i++) { - mean += this.values[i]; - } - this.mean = mean / this.values.length; - this.dirty = false; - } - return this.mean; - } else { - return 0; - } - }; - return WindowedMean; - })(); - core.WindowedMean = WindowedMean; - })((pixi_spine.core || (pixi_spine.core = {}))); - })(pixi_spine || (pixi_spine = {})); - var pixi_spine; - (function(pixi_spine) { - (function(core) { - var Attachment = (function() { - function Attachment(name) { - if (name == null) throw new Error('name cannot be null.'); - this.name = name; - } - return Attachment; - })(); - core.Attachment = Attachment; - var VertexAttachment = (function(_super) { - __extends(VertexAttachment, _super); - function VertexAttachment(name) { - var _this = _super.call(this, name) || this; - _this.id = (VertexAttachment.nextID++ & 65535) << 11; - _this.worldVerticesLength = 0; - return _this; - } - VertexAttachment.prototype.computeWorldVerticesOld = function( - slot, - worldVertices, - ) { - this.computeWorldVertices( - slot, - 0, - this.worldVerticesLength, - worldVertices, - 0, - 2, - ); - }; - VertexAttachment.prototype.computeWorldVertices = function( - slot, - start, - count, - worldVertices, - offset, - stride, - ) { - count = offset + (count >> 1) * stride; - var skeleton = slot.bone.skeleton; - var deformArray = slot.attachmentVertices; - var vertices = this.vertices; - var bones = this.bones; - if (bones == null) { - if (deformArray.length > 0) vertices = deformArray; - var mat = slot.bone.matrix; - var x = mat.tx; - var y = mat.ty; - var a = mat.a, - b = mat.c, - c = mat.b, - d = mat.d; - for (var v_1 = start, w = offset; w < count; v_1 += 2, w += stride) { - var vx = vertices[v_1], - vy = vertices[v_1 + 1]; - worldVertices[w] = vx * a + vy * b + x; - worldVertices[w + 1] = vx * c + vy * d + y; - } - return; - } - var v = 0, - skip = 0; - for (var i = 0; i < start; i += 2) { - var n = bones[v]; - v += n + 1; - skip += n; - } - var skeletonBones = skeleton.bones; - if (deformArray.length == 0) { - for (var w = offset, b = skip * 3; w < count; w += stride) { - var wx = 0, - wy = 0; - var n = bones[v++]; - n += v; - for (; v < n; v++, b += 3) { - var mat = skeletonBones[bones[v]].matrix; - var vx = vertices[b], - vy = vertices[b + 1], - weight = vertices[b + 2]; - wx += (vx * mat.a + vy * mat.c + mat.tx) * weight; - wy += (vx * mat.b + vy * mat.d + mat.ty) * weight; - } - worldVertices[w] = wx; - worldVertices[w + 1] = wy; - } - } else { - var deform = deformArray; - for ( - var w = offset, b = skip * 3, f = skip << 1; - w < count; - w += stride - ) { - var wx = 0, - wy = 0; - var n = bones[v++]; - n += v; - for (; v < n; v++, b += 3, f += 2) { - var mat = skeletonBones[bones[v]].matrix; - var vx = vertices[b] + deform[f], - vy = vertices[b + 1] + deform[f + 1], - weight = vertices[b + 2]; - wx += (vx * mat.a + vy * mat.c + mat.tx) * weight; - wy += (vx * mat.b + vy * mat.d + mat.ty) * weight; - } - worldVertices[w] = wx; - worldVertices[w + 1] = wy; - } - } - }; - VertexAttachment.prototype.applyDeform = function(sourceAttachment) { - return this == sourceAttachment; - }; - VertexAttachment.nextID = 0; - return VertexAttachment; - })(Attachment); - core.VertexAttachment = VertexAttachment; - })((pixi_spine.core || (pixi_spine.core = {}))); - })(pixi_spine || (pixi_spine = {})); - var pixi_spine; - (function(pixi_spine) { - (function(core) { - (function(AttachmentType) { - AttachmentType[(AttachmentType['Region'] = 0)] = 'Region'; - AttachmentType[(AttachmentType['BoundingBox'] = 1)] = 'BoundingBox'; - AttachmentType[(AttachmentType['Mesh'] = 2)] = 'Mesh'; - AttachmentType[(AttachmentType['LinkedMesh'] = 3)] = 'LinkedMesh'; - AttachmentType[(AttachmentType['Path'] = 4)] = 'Path'; - AttachmentType[(AttachmentType['Point'] = 5)] = 'Point'; - })((core.AttachmentType || (core.AttachmentType = {}))); - })((pixi_spine.core || (pixi_spine.core = {}))); - })(pixi_spine || (pixi_spine = {})); - var pixi_spine; - (function(pixi_spine) { - (function(core) { - var BoundingBoxAttachment = (function(_super) { - __extends(BoundingBoxAttachment, _super); - function BoundingBoxAttachment(name) { - var _this = _super.call(this, name) || this; - _this.color = new core.Color(1, 1, 1, 1); - return _this; - } - return BoundingBoxAttachment; - })(core.VertexAttachment); - core.BoundingBoxAttachment = BoundingBoxAttachment; - })((pixi_spine.core || (pixi_spine.core = {}))); - })(pixi_spine || (pixi_spine = {})); - var pixi_spine; - (function(pixi_spine) { - (function(core) { - var ClippingAttachment = (function(_super) { - __extends(ClippingAttachment, _super); - function ClippingAttachment(name) { - var _this = _super.call(this, name) || this; - _this.color = new core.Color(0.2275, 0.2275, 0.8078, 1); - return _this; - } - return ClippingAttachment; - })(core.VertexAttachment); - core.ClippingAttachment = ClippingAttachment; - })((pixi_spine.core || (pixi_spine.core = {}))); - })(pixi_spine || (pixi_spine = {})); - var pixi_spine; - (function(pixi_spine) { - (function(core) { - var MeshAttachment = (function(_super) { - __extends(MeshAttachment, _super); - function MeshAttachment(name) { - var _this = _super.call(this, name) || this; - _this.color = new core.Color(1, 1, 1, 1); - _this.inheritDeform = false; - _this.tempColor = new core.Color(0, 0, 0, 0); - return _this; - } - MeshAttachment.prototype.updateUVs = function(region, uvs) { - var regionUVs = this.regionUVs; - var n = regionUVs.length; - if (!uvs || uvs.length != n) { - uvs = core.Utils.newFloatArray(n); - } - if (region == null) { - return; - } - var texture = region.texture; - var r = texture._uvs; - var w1 = region.width, - h1 = region.height, - w2 = region.originalWidth, - h2 = region.originalHeight; - var x = region.offsetX, - y = region.pixiOffsetY; - for (var i = 0; i < n; i += 2) { - var u = this.regionUVs[i], - v = this.regionUVs[i + 1]; - u = (u * w2 - x) / w1; - v = (v * h2 - y) / h1; - uvs[i] = - (r.x0 * (1 - u) + r.x1 * u) * (1 - v) + - (r.x3 * (1 - u) + r.x2 * u) * v; - uvs[i + 1] = - (r.y0 * (1 - u) + r.y1 * u) * (1 - v) + - (r.y3 * (1 - u) + r.y2 * u) * v; - } - return uvs; - }; - MeshAttachment.prototype.applyDeform = function(sourceAttachment) { - return ( - this == sourceAttachment || - (this.inheritDeform && this.parentMesh == sourceAttachment) - ); - }; - MeshAttachment.prototype.getParentMesh = function() { - return this.parentMesh; - }; - MeshAttachment.prototype.setParentMesh = function(parentMesh) { - this.parentMesh = parentMesh; - if (parentMesh != null) { - this.bones = parentMesh.bones; - this.vertices = parentMesh.vertices; - this.worldVerticesLength = parentMesh.worldVerticesLength; - this.regionUVs = parentMesh.regionUVs; - this.triangles = parentMesh.triangles; - this.hullLength = parentMesh.hullLength; - this.worldVerticesLength = parentMesh.worldVerticesLength; - } - }; - return MeshAttachment; - })(core.VertexAttachment); - core.MeshAttachment = MeshAttachment; - })((pixi_spine.core || (pixi_spine.core = {}))); - })(pixi_spine || (pixi_spine = {})); - var pixi_spine; - (function(pixi_spine) { - (function(core) { - var PathAttachment = (function(_super) { - __extends(PathAttachment, _super); - function PathAttachment(name) { - var _this = _super.call(this, name) || this; - _this.closed = false; - _this.constantSpeed = false; - _this.color = new core.Color(1, 1, 1, 1); - return _this; - } - return PathAttachment; - })(core.VertexAttachment); - core.PathAttachment = PathAttachment; - })((pixi_spine.core || (pixi_spine.core = {}))); - })(pixi_spine || (pixi_spine = {})); - var pixi_spine; - (function(pixi_spine) { - (function(core) { - var PointAttachment = (function(_super) { - __extends(PointAttachment, _super); - function PointAttachment(name) { - var _this = _super.call(this, name) || this; - _this.color = new core.Color(0.38, 0.94, 0, 1); - return _this; - } - PointAttachment.prototype.computeWorldPosition = function(bone, point) { - var mat = bone.matrix; - point.x = this.x * mat.a + this.y * mat.c + bone.worldX; - point.y = this.x * mat.b + this.y * mat.d + bone.worldY; - return point; - }; - PointAttachment.prototype.computeWorldRotation = function(bone) { - var mat = bone.matrix; - var cos = core.MathUtils.cosDeg(this.rotation), - sin = core.MathUtils.sinDeg(this.rotation); - var x = cos * mat.a + sin * mat.c; - var y = cos * mat.b + sin * mat.d; - return Math.atan2(y, x) * core.MathUtils.radDeg; - }; - return PointAttachment; - })(core.VertexAttachment); - core.PointAttachment = PointAttachment; - })((pixi_spine.core || (pixi_spine.core = {}))); - })(pixi_spine || (pixi_spine = {})); - var pixi_spine; - (function(pixi_spine) { - (function(core) { - var RegionAttachment = (function(_super) { - __extends(RegionAttachment, _super); - function RegionAttachment(name) { - var _this = _super.call(this, name) || this; - _this.x = 0; - _this.y = 0; - _this.scaleX = 1; - _this.scaleY = 1; - _this.rotation = 0; - _this.width = 0; - _this.height = 0; - _this.color = new core.Color(1, 1, 1, 1); - _this.offset = core.Utils.newFloatArray(8); - _this.uvs = core.Utils.newFloatArray(8); - _this.tempColor = new core.Color(1, 1, 1, 1); - return _this; - } - RegionAttachment.prototype.updateOffset = function() { - var regionScaleX = - (this.width / this.region.originalWidth) * this.scaleX; - var regionScaleY = - (this.height / this.region.originalHeight) * this.scaleY; - var localX = - (-this.width / 2) * this.scaleX + this.region.offsetX * regionScaleX; - var localY = - (-this.height / 2) * this.scaleY + this.region.offsetY * regionScaleY; - var localX2 = localX + this.region.width * regionScaleX; - var localY2 = localY + this.region.height * regionScaleY; - var radians = (this.rotation * Math.PI) / 180; - var cos = Math.cos(radians); - var sin = Math.sin(radians); - var localXCos = localX * cos + this.x; - var localXSin = localX * sin; - var localYCos = localY * cos + this.y; - var localYSin = localY * sin; - var localX2Cos = localX2 * cos + this.x; - var localX2Sin = localX2 * sin; - var localY2Cos = localY2 * cos + this.y; - var localY2Sin = localY2 * sin; - var offset = this.offset; - offset[RegionAttachment.OX1] = localXCos - localYSin; - offset[RegionAttachment.OY1] = localYCos + localXSin; - offset[RegionAttachment.OX2] = localXCos - localY2Sin; - offset[RegionAttachment.OY2] = localY2Cos + localXSin; - offset[RegionAttachment.OX3] = localX2Cos - localY2Sin; - offset[RegionAttachment.OY3] = localY2Cos + localX2Sin; - offset[RegionAttachment.OX4] = localX2Cos - localYSin; - offset[RegionAttachment.OY4] = localYCos + localX2Sin; - }; - RegionAttachment.prototype.setRegion = function(region) { - this.region = region; - var uvs = this.uvs; - if (region.rotate) { - uvs[2] = region.u; - uvs[3] = region.v2; - uvs[4] = region.u; - uvs[5] = region.v; - uvs[6] = region.u2; - uvs[7] = region.v; - uvs[0] = region.u2; - uvs[1] = region.v2; - } else { - uvs[0] = region.u; - uvs[1] = region.v2; - uvs[2] = region.u; - uvs[3] = region.v; - uvs[4] = region.u2; - uvs[5] = region.v; - uvs[6] = region.u2; - uvs[7] = region.v2; - } - }; - RegionAttachment.prototype.computeWorldVertices = function( - bone, - worldVertices, - offset, - stride, - ) { - var vertexOffset = this.offset; - var mat = bone.matrix; - var x = mat.tx, - y = mat.ty; - var a = mat.a, - b = mat.c, - c = mat.b, - d = mat.d; - var offsetX = 0, - offsetY = 0; - offsetX = vertexOffset[RegionAttachment.OX1]; - offsetY = vertexOffset[RegionAttachment.OY1]; - worldVertices[offset] = offsetX * a + offsetY * b + x; - worldVertices[offset + 1] = offsetX * c + offsetY * d + y; - offset += stride; - offsetX = vertexOffset[RegionAttachment.OX2]; - offsetY = vertexOffset[RegionAttachment.OY2]; - worldVertices[offset] = offsetX * a + offsetY * b + x; - worldVertices[offset + 1] = offsetX * c + offsetY * d + y; - offset += stride; - offsetX = vertexOffset[RegionAttachment.OX3]; - offsetY = vertexOffset[RegionAttachment.OY3]; - worldVertices[offset] = offsetX * a + offsetY * b + x; - worldVertices[offset + 1] = offsetX * c + offsetY * d + y; - offset += stride; - offsetX = vertexOffset[RegionAttachment.OX4]; - offsetY = vertexOffset[RegionAttachment.OY4]; - worldVertices[offset] = offsetX * a + offsetY * b + x; - worldVertices[offset + 1] = offsetX * c + offsetY * d + y; - }; - RegionAttachment.OX1 = 0; - RegionAttachment.OY1 = 1; - RegionAttachment.OX2 = 2; - RegionAttachment.OY2 = 3; - RegionAttachment.OX3 = 4; - RegionAttachment.OY3 = 5; - RegionAttachment.OX4 = 6; - RegionAttachment.OY4 = 7; - RegionAttachment.X1 = 0; - RegionAttachment.Y1 = 1; - RegionAttachment.C1R = 2; - RegionAttachment.C1G = 3; - RegionAttachment.C1B = 4; - RegionAttachment.C1A = 5; - RegionAttachment.U1 = 6; - RegionAttachment.V1 = 7; - RegionAttachment.X2 = 8; - RegionAttachment.Y2 = 9; - RegionAttachment.C2R = 10; - RegionAttachment.C2G = 11; - RegionAttachment.C2B = 12; - RegionAttachment.C2A = 13; - RegionAttachment.U2 = 14; - RegionAttachment.V2 = 15; - RegionAttachment.X3 = 16; - RegionAttachment.Y3 = 17; - RegionAttachment.C3R = 18; - RegionAttachment.C3G = 19; - RegionAttachment.C3B = 20; - RegionAttachment.C3A = 21; - RegionAttachment.U3 = 22; - RegionAttachment.V3 = 23; - RegionAttachment.X4 = 24; - RegionAttachment.Y4 = 25; - RegionAttachment.C4R = 26; - RegionAttachment.C4G = 27; - RegionAttachment.C4B = 28; - RegionAttachment.C4A = 29; - RegionAttachment.U4 = 30; - RegionAttachment.V4 = 31; - return RegionAttachment; - })(core.Attachment); - core.RegionAttachment = RegionAttachment; - })((pixi_spine.core || (pixi_spine.core = {}))); - })(pixi_spine || (pixi_spine = {})); - var pixi_spine; - (function(pixi_spine) { - (function(core) { - var JitterEffect = (function() { - function JitterEffect(jitterX, jitterY) { - this.jitterX = 0; - this.jitterY = 0; - this.jitterX = jitterX; - this.jitterY = jitterY; - } - JitterEffect.prototype.begin = function(skeleton) {}; - JitterEffect.prototype.transform = function(position, uv, light, dark) { - position.x += core.MathUtils.randomTriangular( - -this.jitterX, - this.jitterY, - ); - position.y += core.MathUtils.randomTriangular( - -this.jitterX, - this.jitterY, - ); - }; - JitterEffect.prototype.end = function() {}; - return JitterEffect; - })(); - core.JitterEffect = JitterEffect; - })((pixi_spine.core || (pixi_spine.core = {}))); - })(pixi_spine || (pixi_spine = {})); - var pixi_spine; - (function(pixi_spine) { - (function(core) { - var SwirlEffect = (function() { - function SwirlEffect(radius) { - this.centerX = 0; - this.centerY = 0; - this.radius = 0; - this.angle = 0; - this.worldX = 0; - this.worldY = 0; - this.radius = radius; - } - SwirlEffect.prototype.begin = function(skeleton) { - this.worldX = skeleton.x + this.centerX; - this.worldY = skeleton.y + this.centerY; - }; - SwirlEffect.prototype.transform = function(position, uv, light, dark) { - var radAngle = this.angle * core.MathUtils.degreesToRadians; - var x = position.x - this.worldX; - var y = position.y - this.worldY; - var dist = Math.sqrt(x * x + y * y); - if (dist < this.radius) { - var theta = SwirlEffect.interpolation.apply( - 0, - radAngle, - (this.radius - dist) / this.radius, - ); - var cos = Math.cos(theta); - var sin = Math.sin(theta); - position.x = cos * x - sin * y + this.worldX; - position.y = sin * x + cos * y + this.worldY; - } - }; - SwirlEffect.prototype.end = function() {}; - SwirlEffect.interpolation = new core.PowOut(2); - return SwirlEffect; - })(); - core.SwirlEffect = SwirlEffect; - })((pixi_spine.core || (pixi_spine.core = {}))); - })(pixi_spine || (pixi_spine = {})); - (function() { - if (!Math.fround) { - Math.fround = Math.fround = (function(array) { - return function(x) { - return (array[0] = x), array[0]; - }; - })(new Float32Array(1)); - } - })(); - var pixi_spine; - (function(pixi_spine) { - pixi_spine.core.Bone.yDown = true; - var tempRgb = [0, 0, 0]; - var SpineSprite = (function(_super) { - __extends(SpineSprite, _super); - function SpineSprite() { - var _this = (_super !== null && _super.apply(this, arguments)) || this; - _this.region = null; - return _this; - } - return SpineSprite; - })(PIXI.Sprite); - pixi_spine.SpineSprite = SpineSprite; - var SpineMesh = (function(_super) { - __extends(SpineMesh, _super); - function SpineMesh(texture, vertices, uvs, indices, drawMode) { - return ( - _super.call(this, texture, vertices, uvs, indices, drawMode) || this - ); - } - return SpineMesh; - })(PIXI.mesh.Mesh); - pixi_spine.SpineMesh = SpineMesh; - var Spine = (function(_super) { - __extends(Spine, _super); - function Spine(spineData) { - var _this = _super.call(this) || this; - if (!spineData) { - throw new Error('The spineData param is required.'); - } - if (typeof spineData === 'string') { - throw new Error( - 'spineData param cant be string. Please use spine.Spine.fromAtlas("YOUR_RESOURCE_NAME") from now on.', - ); - } - _this.spineData = spineData; - _this.skeleton = new pixi_spine.core.Skeleton(spineData); - _this.skeleton.updateWorldTransform(); - _this.stateData = new pixi_spine.core.AnimationStateData(spineData); - _this.state = new pixi_spine.core.AnimationState(_this.stateData); - _this.slotContainers = []; - _this.tempClipContainers = []; - for (var i = 0, n = _this.skeleton.slots.length; i < n; i++) { - var slot = _this.skeleton.slots[i]; - var attachment = slot.attachment; - var slotContainer = _this.newContainer(); - _this.slotContainers.push(slotContainer); - _this.addChild(slotContainer); - _this.tempClipContainers.push(null); - if (attachment instanceof pixi_spine.core.RegionAttachment) { - var spriteName = attachment.region.name; - var sprite = _this.createSprite(slot, attachment, spriteName); - slot.currentSprite = sprite; - slot.currentSpriteName = spriteName; - slotContainer.addChild(sprite); - } else if (attachment instanceof pixi_spine.core.MeshAttachment) { - var mesh = _this.createMesh(slot, attachment); - slot.currentMesh = mesh; - slot.currentMeshName = attachment.name; - slotContainer.addChild(mesh); - } else if (attachment instanceof pixi_spine.core.ClippingAttachment) { - _this.createGraphics(slot, attachment); - slotContainer.addChild(slot.clippingContainer); - slotContainer.addChild(slot.currentGraphics); - } else { - continue; - } - } - _this.autoUpdate = true; - _this.tintRgb = new Float32Array([1, 1, 1]); - return _this; - } - Object.defineProperty(Spine.prototype, 'autoUpdate', { - get: function() { - return this.updateTransform === Spine.prototype.autoUpdateTransform; - }, - set: function(value) { - this.updateTransform = value - ? Spine.prototype.autoUpdateTransform - : PIXI.Container.prototype.updateTransform; - }, - enumerable: true, - configurable: true, - }); - Object.defineProperty(Spine.prototype, 'tint', { - get: function() { - return PIXI.utils.rgb2hex(this.tintRgb); - }, - set: function(value) { - this.tintRgb = PIXI.utils.hex2rgb(value, this.tintRgb); - }, - enumerable: true, - configurable: true, - }); - Object.defineProperty(Spine.prototype, 'delayLimit', { - get: function() { - var limit = - typeof this.localDelayLimit !== 'undefined' - ? this.localDelayLimit - : Spine.globalDelayLimit; - return limit || Number.MAX_VALUE; - }, - enumerable: true, - configurable: true, - }); - Spine.prototype.update = function(dt) { - var delayLimit = this.delayLimit; - if (dt > delayLimit) dt = delayLimit; - this.state.update(dt); - this.state.apply(this.skeleton); - if (!this.skeleton) return; - this.skeleton.updateWorldTransform(); - var slots = this.skeleton.slots; - var globalClr = this.color; - var light = null, - dark = null; - if (globalClr) { - light = globalClr.light; - dark = globalClr.dark; - } else { - light = this.tintRgb; - } - var thack = PIXI.TransformBase && this.transformHack() == 1; - for (var i = 0, n = slots.length; i < n; i++) { - var slot = slots[i]; - var attachment = slot.attachment; - var slotContainer = this.slotContainers[i]; - if (!attachment) { - slotContainer.visible = false; - continue; - } - var spriteColor = null; - var attColor = attachment.color; - if (attachment instanceof pixi_spine.core.RegionAttachment) { - var region = attachment.region; - if (region) { - if (slot.currentMesh) { - slot.currentMesh.visible = false; - slot.currentMesh = null; - slot.currentMeshName = undefined; - } - var ar = region; - if (!slot.currentSpriteName || slot.currentSpriteName !== ar.name) { - var spriteName = ar.name; - if (slot.currentSprite) { - slot.currentSprite.visible = false; - } - slot.sprites = slot.sprites || {}; - if (slot.sprites[spriteName] !== undefined) { - slot.sprites[spriteName].visible = true; - } else { - var sprite = this.createSprite(slot, attachment, spriteName); - slotContainer.addChild(sprite); - } - slot.currentSprite = slot.sprites[spriteName]; - slot.currentSpriteName = spriteName; - } - } - if (slotContainer.transform) { - var transform = slotContainer.transform; - var transAny = transform; - var lt = null; - if (transAny.matrix2d) { - lt = transAny.matrix2d; - transAny._dirtyVersion++; - transAny.version = transAny._dirtyVersion; - transAny.isStatic = true; - transAny.operMode = 0; - } else { - if (thack) { - if (transAny.position) { - transform = new PIXI.TransformBase(); - transform._parentID = -1; - transform._worldID = slotContainer.transform._worldID; - slotContainer.transform = transform; - } - lt = transform.localTransform; - } else { - transAny.setFromMatrix(slot.bone.matrix); - } - } - if (lt) { - slot.bone.matrix.copy(lt); - } - } else { - var lt = slotContainer.localTransform || new PIXI.Matrix(); - slot.bone.matrix.copy(lt); - slotContainer.localTransform = lt; - slotContainer.displayObjectUpdateTransform = SlotContainerUpdateTransformV3; - } - if (slot.currentSprite.color) { - spriteColor = slot.currentSprite.color; - } else { - tempRgb[0] = light[0] * slot.color.r * attColor.r; - tempRgb[1] = light[1] * slot.color.g * attColor.g; - tempRgb[2] = light[2] * slot.color.b * attColor.b; - slot.currentSprite.tint = PIXI.utils.rgb2hex(tempRgb); - } - slot.currentSprite.blendMode = slot.blendMode; - } else if (attachment instanceof pixi_spine.core.MeshAttachment) { - if (slot.currentSprite) { - slot.currentSprite.visible = false; - slot.currentSprite = null; - slot.currentSpriteName = undefined; - if (slotContainer.transform) { - var transform = new PIXI.TransformStatic(); - transform._parentID = -1; - transform._worldID = slotContainer.transform._worldID; - slotContainer.transform = transform; - } else { - slotContainer.localTransform = new PIXI.Matrix(); - slotContainer.displayObjectUpdateTransform = - PIXI.DisplayObject.prototype.updateTransform; - } - } - if ( - !slot.currentMeshName || - slot.currentMeshName !== attachment.name - ) { - var meshName = attachment.name; - if (slot.currentMesh) { - slot.currentMesh.visible = false; - } - slot.meshes = slot.meshes || {}; - if (slot.meshes[meshName] !== undefined) { - slot.meshes[meshName].visible = true; - } else { - var mesh = this.createMesh(slot, attachment); - slotContainer.addChild(mesh); - } - slot.currentMesh = slot.meshes[meshName]; - slot.currentMeshName = meshName; - } - attachment.computeWorldVerticesOld(slot, slot.currentMesh.vertices); - if (slot.currentMesh.color) { - spriteColor = slot.currentMesh.color; - } else if (PIXI.VERSION[0] !== '3') { - var tintRgb = slot.currentMesh.tintRgb; - tintRgb[0] = light[0] * slot.color.r * attColor.r; - tintRgb[1] = light[1] * slot.color.g * attColor.g; - tintRgb[2] = light[2] * slot.color.b * attColor.b; - } - slot.currentMesh.blendMode = slot.blendMode; - } else if (attachment instanceof pixi_spine.core.ClippingAttachment) { - if (!slot.currentGraphics) { - this.createGraphics(slot, attachment); - slotContainer.addChild(slot.clippingContainer); - slotContainer.addChild(slot.currentGraphics); - } - this.updateGraphics(slot, attachment); - } else { - slotContainer.visible = false; - continue; - } - slotContainer.visible = true; - if (spriteColor) { - var r0 = slot.color.r * attColor.r; - var g0 = slot.color.g * attColor.g; - var b0 = slot.color.b * attColor.b; - spriteColor.setLight( - light[0] * r0 + dark[0] * (1.0 - r0), - light[1] * g0 + dark[1] * (1.0 - g0), - light[2] * b0 + dark[2] * (1.0 - b0), - ); - if (slot.darkColor) { - r0 = slot.darkColor.r; - g0 = slot.darkColor.g; - b0 = slot.darkColor.b; - } else { - r0 = 0.0; - g0 = 0.0; - b0 = 0.0; - } - spriteColor.setDark( - light[0] * r0 + dark[0] * (1 - r0), - light[1] * g0 + dark[1] * (1 - g0), - light[2] * b0 + dark[2] * (1 - b0), - ); - } - slotContainer.alpha = slot.color.a; - } - var drawOrder = this.skeleton.drawOrder; - var clippingAttachment = null; - var clippingContainer = null; - for (var i = 0, n = drawOrder.length; i < n; i++) { - var slot = slots[drawOrder[i].data.index]; - var slotContainer = this.slotContainers[drawOrder[i].data.index]; - if (!clippingContainer) { - if (slotContainer.parent !== null && slotContainer.parent !== this) { - slotContainer.parent.removeChild(slotContainer); - slotContainer.parent = this; - } - } - if (slot.currentGraphics && slot.attachment) { - clippingContainer = slot.clippingContainer; - clippingAttachment = slot.attachment; - clippingContainer.children.length = 0; - this.children[i] = slotContainer; - if (clippingAttachment.endSlot == slot.data) { - clippingAttachment.endSlot = null; - } - } else { - if (clippingContainer) { - var c = this.tempClipContainers[i]; - if (!c) { - c = this.tempClipContainers[i] = this.newContainer(); - c.visible = false; - } - this.children[i] = c; - slotContainer.parent = null; - clippingContainer.addChild(slotContainer); - if (clippingAttachment.endSlot == slot.data) { - clippingContainer.renderable = true; - clippingContainer = null; - clippingAttachment = null; - } - } else { - this.children[i] = slotContainer; - } - } - } - }; - Spine.prototype.setSpriteRegion = function(attachment, sprite, region) { - sprite.region = region; - sprite.texture = region.texture; - if (!region.size) { - sprite.scale.x = - (attachment.scaleX * attachment.width) / region.originalWidth; - sprite.scale.y = - (-attachment.scaleY * attachment.height) / region.originalHeight; - } else { - sprite.scale.x = region.size.width / region.originalWidth; - sprite.scale.y = -region.size.height / region.originalHeight; - } - }; - Spine.prototype.setMeshRegion = function(attachment, mesh, region) { - mesh.region = region; - mesh.texture = region.texture; - region.texture._updateUvs(); - attachment.updateUVs(region, mesh.uvs); - mesh.dirty++; - }; - Spine.prototype.autoUpdateTransform = function() { - if (Spine.globalAutoUpdate) { - this.lastTime = this.lastTime || Date.now(); - var timeDelta = (Date.now() - this.lastTime) * 0.001; - this.lastTime = Date.now(); - this.update(timeDelta); - } else { - this.lastTime = 0; - } - PIXI.Container.prototype.updateTransform.call(this); - }; - Spine.prototype.createSprite = function(slot, attachment, defName) { - var region = attachment.region; - if (slot.tempAttachment === attachment) { - region = slot.tempRegion; - slot.tempAttachment = null; - slot.tempRegion = null; - } - var texture = region.texture; - var sprite = this.newSprite(texture); - sprite.rotation = attachment.rotation * pixi_spine.core.MathUtils.degRad; - sprite.anchor.x = 0.5; - sprite.anchor.y = 0.5; - sprite.position.x = attachment.x; - sprite.position.y = attachment.y; - sprite.alpha = attachment.color.a; - sprite.region = attachment.region; - this.setSpriteRegion(attachment, sprite, attachment.region); - slot.sprites = slot.sprites || {}; - slot.sprites[defName] = sprite; - return sprite; - }; - Spine.prototype.createMesh = function(slot, attachment) { - var region = attachment.region; - if (slot.tempAttachment === attachment) { - region = slot.tempRegion; - slot.tempAttachment = null; - slot.tempRegion = null; - } - var strip = this.newMesh( - region.texture, - new Float32Array(attachment.regionUVs.length), - new Float32Array(attachment.regionUVs.length), - new Uint16Array(attachment.triangles), - PIXI.mesh.Mesh.DRAW_MODES.TRIANGLES, - ); - strip.canvasPadding = 1.5; - strip.alpha = attachment.color.a; - strip.region = attachment.region; - this.setMeshRegion(attachment, strip, region); - slot.meshes = slot.meshes || {}; - slot.meshes[attachment.name] = strip; - return strip; - }; - Spine.prototype.createGraphics = function(slot, clip) { - var graphics = this.newGraphics(); - var poly = new PIXI.Polygon([]); - graphics.clear(); - graphics.beginFill(0xffffff, 1); - graphics.drawPolygon(poly); - graphics.renderable = false; - slot.currentGraphics = graphics; - slot.clippingContainer = this.newContainer(); - slot.clippingContainer.mask = slot.currentGraphics; - return graphics; - }; - Spine.prototype.updateGraphics = function(slot, clip) { - var vertices = slot.currentGraphics.graphicsData[0].shape.points; - var n = clip.worldVerticesLength; - vertices.length = n; - clip.computeWorldVertices(slot, 0, n, vertices, 0, 2); - slot.currentGraphics.dirty++; - slot.currentGraphics.clearDirty++; - }; - Spine.prototype.hackTextureBySlotIndex = function( - slotIndex, - texture, - size, - ) { - if (texture === void 0) { - texture = null; - } - if (size === void 0) { - size = null; - } - var slot = this.skeleton.slots[slotIndex]; - if (!slot) { - return false; - } - var attachment = slot.attachment; - var region = attachment.region; - if (texture) { - region = new pixi_spine.core.TextureRegion(); - region.texture = texture; - region.size = size; - } - if (slot.currentSprite && slot.currentSprite.region != region) { - this.setSpriteRegion(attachment, slot.currentSprite, region); - slot.currentSprite.region = region; - } else if (slot.currentMesh && slot.currentMesh.region != region) { - this.setMeshRegion(attachment, slot.currentMesh, region); - } else { - slot.tempRegion = region; - slot.tempAttachment = attachment; - } - return true; - }; - Spine.prototype.hackTextureBySlotName = function(slotName, texture, size) { - if (texture === void 0) { - texture = null; - } - if (size === void 0) { - size = null; - } - var index = this.skeleton.findSlotIndex(slotName); - if (index == -1) { - return false; - } - return this.hackTextureBySlotIndex(index, texture, size); - }; - Spine.prototype.newContainer = function() { - return new PIXI.Container(); - }; - Spine.prototype.newSprite = function(tex) { - return new SpineSprite(tex); - }; - Spine.prototype.newGraphics = function() { - return new PIXI.Graphics(); - }; - Spine.prototype.newMesh = function( - texture, - vertices, - uvs, - indices, - drawMode, - ) { - return new SpineMesh(texture, vertices, uvs, indices, drawMode); - }; - Spine.prototype.transformHack = function() { - return 1; - }; - Spine.prototype.hackAttachmentGroups = function( - nameSuffix, - group, - outGroup, - ) { - if (!nameSuffix) { - return; - } - var list_d = [], - list_n = []; - for (var i = 0, len = this.skeleton.slots.length; i < len; i++) { - var slot = this.skeleton.slots[i]; - var name_2 = slot.currentSpriteName || slot.currentMeshName || ''; - var target = slot.currentSprite || slot.currentMesh; - if (name_2.endsWith(nameSuffix)) { - target.parentGroup = group; - list_n.push(target); - } else if (outGroup && target) { - target.parentGroup = outGroup; - list_d.push(target); - } - } - return [list_d, list_n]; - }; - Spine.prototype.destroy = function(options) { - for (var i = 0, n = this.skeleton.slots.length; i < n; i++) { - var slot = this.skeleton.slots[i]; - for (var name_3 in slot.meshes) { - slot.meshes[name_3].destroy(options); - } - slot.meshes = null; - for (var name_4 in slot.sprites) { - slot.sprites[name_4].destroy(options); - } - slot.sprites = null; - } - for (var i = 0, n = this.slotContainers.length; i < n; i++) { - this.slotContainers[i].destroy(options); - } - this.spineData = null; - this.skeleton = null; - this.slotContainers = null; - this.stateData = null; - this.state = null; - this.tempClipContainers = null; - _super.prototype.destroy.call(this, options); - }; - Spine.globalAutoUpdate = true; - Spine.globalDelayLimit = 0; - Spine.clippingPolygon = []; - return Spine; - })(PIXI.Container); - pixi_spine.Spine = Spine; - function SlotContainerUpdateTransformV3() { - var pt = this.parent.worldTransform; - var wt = this.worldTransform; - var lt = this.localTransform; - wt.a = lt.a * pt.a + lt.b * pt.c; - wt.b = lt.a * pt.b + lt.b * pt.d; - wt.c = lt.c * pt.a + lt.d * pt.c; - wt.d = lt.c * pt.b + lt.d * pt.d; - wt.tx = lt.tx * pt.a + lt.ty * pt.c + pt.tx; - wt.ty = lt.tx * pt.b + lt.ty * pt.d + pt.ty; - this.worldAlpha = this.alpha * this.parent.worldAlpha; - this._currentBounds = null; - } - })(pixi_spine || (pixi_spine = {})); - var pixi_spine; - (function(pixi_spine) { - PIXI.spine = pixi_spine; - var TextureProto = PIXI.Texture.prototype; - if (!TextureProto._updateUvs) { - TextureProto._updateUvs = TextureProto.updateUvs; - } - })(pixi_spine || (pixi_spine = {})); - var pixi_spine; - (function(pixi_spine) { - function isJson(resource) { - return resource.type === PIXI.loaders.Resource.TYPE.JSON; - } - function atlasParser() { - return function atlasParser(resource, next) { - if (!resource.data || !isJson(resource) || !resource.data.bones) { - return next(); - } - var metadata = resource.metadata || {}; - var metadataSkeletonScale = metadata - ? resource.metadata.spineSkeletonScale - : null; - var metadataAtlas = metadata ? resource.metadata.spineAtlas : null; - if (metadataAtlas === false) { - return next(); - } - if (metadataAtlas && metadataAtlas.pages) { - var spineJsonParser = new pixi_spine.core.SkeletonJson( - new pixi_spine.core.AtlasAttachmentLoader(metadataAtlas), - ); - if (metadataSkeletonScale) { - spineJsonParser.scale = metadataSkeletonScale; - } - var skeletonData = spineJsonParser.readSkeletonData(resource.data); - resource.spineData = skeletonData; - resource.spineAtlas = metadataAtlas; - return next(); - } - var metadataAtlasSuffix = metadata.spineAtlasSuffix || '.atlas'; - var atlasPath = resource.url; - var queryStringPos = atlasPath.indexOf('?'); - if (queryStringPos > 0) { - atlasPath = atlasPath.substr(0, queryStringPos); - } - atlasPath = - atlasPath.substr(0, atlasPath.lastIndexOf('.')) + metadataAtlasSuffix; - if (resource.metadata && resource.metadata.spineAtlasFile) { - atlasPath = resource.metadata.spineAtlasFile; - } - atlasPath = atlasPath.replace(this.baseUrl, ''); - var atlasOptions = { - crossOrigin: resource.crossOrigin, - xhrType: PIXI.loaders.Resource.XHR_RESPONSE_TYPE.TEXT, - metadata: metadata.spineMetadata || null, - parentResource: resource, - }; - var imageOptions = { - crossOrigin: resource.crossOrigin, - metadata: metadata.imageMetadata || null, - parentResource: resource, - }; - var baseUrl = resource.url.substr(0, resource.url.lastIndexOf('/') + 1); - baseUrl = baseUrl.replace(this.baseUrl, ''); - var namePrefix = - metadata.imageNamePrefix || resource.name + '_atlas_page_'; - var adapter = metadata.images - ? staticImageLoader(metadata.images) - : metadata.image - ? staticImageLoader({default: metadata.image}) - : metadata.imageLoader - ? metadata.imageLoader(this, namePrefix, baseUrl, imageOptions) - : imageLoaderAdapter(this, namePrefix, baseUrl, imageOptions); - var createSkeletonWithRawAtlas = function(rawData) { - new pixi_spine.core.TextureAtlas(rawData, adapter, function( - spineAtlas, - ) { - if (spineAtlas) { - var spineJsonParser = new pixi_spine.core.SkeletonJson( - new pixi_spine.core.AtlasAttachmentLoader(spineAtlas), - ); - if (metadataSkeletonScale) { - spineJsonParser.scale = metadataSkeletonScale; - } - resource.spineData = spineJsonParser.readSkeletonData( - resource.data, - ); - resource.spineAtlas = spineAtlas; - } - next(); - }); - }; - if (resource.metadata && resource.metadata.atlasRawData) { - createSkeletonWithRawAtlas(resource.metadata.atlasRawData); - } else { - this.add(resource.name + '_atlas', atlasPath, atlasOptions, function( - atlasResource, - ) { - if (!atlasResource.error) { - createSkeletonWithRawAtlas(atlasResource.data); - } else { - next(); - } - }); - } - }; - } - pixi_spine.atlasParser = atlasParser; - function imageLoaderAdapter(loader, namePrefix, baseUrl, imageOptions) { - if (baseUrl && baseUrl.lastIndexOf('/') !== baseUrl.length - 1) { - baseUrl += '/'; - } - return function(line, callback) { - var name = namePrefix + line; - var url = baseUrl + line; - var cachedResource = loader.resources[name]; - if (cachedResource) { - function done() { - callback(cachedResource.texture.baseTexture); - } - if (cachedResource.texture) { - done(); - } else { - cachedResource.onAfterMiddleware.add(done); - } - } else { - loader.add(name, url, imageOptions, function(resource) { - if (!resource.error) { - callback(resource.texture.baseTexture); - } else { - callback(null); - } - }); - } - }; - } - pixi_spine.imageLoaderAdapter = imageLoaderAdapter; - function syncImageLoaderAdapter(baseUrl, crossOrigin) { - if (baseUrl && baseUrl.lastIndexOf('/') !== baseUrl.length - 1) { - baseUrl += '/'; - } - return function(line, callback) { - callback(PIXI.BaseTexture.fromImage(line, crossOrigin)); - }; - } - pixi_spine.syncImageLoaderAdapter = syncImageLoaderAdapter; - function staticImageLoader(pages) { - return function(line, callback) { - var page = pages[line] || pages['default']; - if (page && page.baseTexture) callback(page.baseTexture); - else callback(page); - }; - } - pixi_spine.staticImageLoader = staticImageLoader; - if (PIXI.loaders.Loader) { - PIXI.loaders.Loader.addPixiMiddleware(atlasParser); - PIXI.loader.use(atlasParser()); - } - })(pixi_spine || (pixi_spine = {})); - - var pixispine = pixi_spine; - - let texCache = {}; - function cacheImage(data) { - const oldImg = data.image; - const newImg = data.image.cloneNode(); - data.image = newImg; - return { - tex: pixi_js.Texture.from(oldImg), - count: 0, - }; - } - function retainTexture(name, data) { - let cache = texCache[name]; - if (!cache) { - cache = cacheImage(data); - texCache[name] = cache; - } - cache.count++; - return cache.tex; - } - function getTexture(name, data) { - let cache = texCache[name]; - if (!cache) { - cache = cacheImage(data); - texCache[name] = cache; - } - return cache.tex; - } - function releaseTexture(name) { - setTimeout(() => { - const cache = texCache[name]; - if (cache) { - cache.count--; - if (cache.count <= 0) { - if (cache.tex) { - cache.tex.destroy(true); - cache.tex = null; - } - delete texCache[name]; - } - } - }, 100); - } - - let dataMap = {}; - function createSpineData(name, imgName, data, scale) { - let spineData = null; - const img = getTexture(imgName, data); - new pixispine.core.TextureAtlas(data.atlas, (line, callback) => { - callback(img.baseTexture); - }, spineAtlas => { - if (spineAtlas) { - const attachmentLoader = new pixispine.core.AtlasAttachmentLoader(spineAtlas); - const spineJsonParser = new pixispine.core.SkeletonJson(attachmentLoader); - if (scale) { - spineJsonParser.scale = scale; - } - spineData = spineJsonParser.readSkeletonData(data.ske); - } - }); - const obj = { spineData, ref: 0, imgName: imgName }; - dataMap[name] = obj; - return obj; - } - eva_js.resource.registerInstance('SPINE', info => { - return createSpineData(info.name, info.name, info.data, info.scale); - }); - eva_js.resource.registerDestroy('SPINE', info => { - if (info.instance) { - releaseTexture(info.name); - info.instance = null; - } - }); - function getSpineData(name) { - return __awaiter(this, void 0, void 0, function* () { - const res = yield eva_js.resource.getResource(name); - let data = dataMap[name]; - if (!data) { - if (res.complete) { - data = createSpineData(name, res.name, res.data, res.scale); - } - else if (!data) { - return; - } - } - retainTexture(res.name, res.data); - data.ref++; - return data.spineData; - }); - } - function releaseSpineData(name) { - const data = dataMap[name]; - if (!data) { - return; - } - data.ref--; - if (data.ref <= 0) { - releaseTexture(data.imgName); - delete dataMap[name]; - eva_js.resource.destroy(name); - } - } - - const MaxRetryCount = 20; - let SpineSystem = class SpineSystem extends pluginRenderer.Renderer { - constructor() { - super(...arguments); - this.armatures = {}; - } - init() { - this.renderSystem = this.game.getSystem(pluginRenderer.RendererSystem); - this.renderSystem.rendererManager.register(this); - this.game.canvas.addEventListener('webglcontextrestored', () => { - const objs = this.game.gameObjects; - let toAdd = []; - for (let k in this.armatures) { - const id = +k; - for (let i = 0; i < objs.length; ++i) { - let obj = objs[i]; - if (obj.id === id) { - let sp = obj.getComponent(Spine); - if (sp) { - this.remove({ - type: eva_js.OBSERVER_TYPE.REMOVE, - gameObject: obj, - component: sp, - componentName: Spine.componentName, - }); - toAdd.push({ - type: eva_js.OBSERVER_TYPE.ADD, - gameObject: obj, - component: sp, - componentName: Spine.componentName, - }); - } - break; - } - } - } - setTimeout(() => { - toAdd.forEach(obj => { - this.add(obj); - }); - }, 1000); - }, false); - } - componentChanged(changed) { - return __awaiter(this, void 0, void 0, function* () { - if (changed.componentName === 'Spine') { - if (changed.type === eva_js.OBSERVER_TYPE.ADD) { - this.add(changed); - } - else if (changed.type === eva_js.OBSERVER_TYPE.CHANGE) { - switch (changed.prop.prop[0]) { - case 'resource': - this.change(changed); - break; - } - } - else if (changed.type === eva_js.OBSERVER_TYPE.REMOVE) { - this.remove(changed); - } - } - }); - } - add(changed, count) { - return __awaiter(this, void 0, void 0, function* () { - const component = changed.component; - clearTimeout(component.addHandler); - const spineData = yield getSpineData(component.resource); - if (!spineData) { - component.addHandler = setTimeout(() => { - if (!component.destroied) { - if (count === undefined) { - count = MaxRetryCount; - } - count--; - if (count > 0) { - this.add(changed, count); - } - else { - console.log('retry exceed max times', component.resource); - } - } - }, 1000); - return; - } - this.remove(changed); - const container = this.renderSystem.containerManager.getContainer(changed.gameObject.id); - if (!container) { - return; - } - const armature = new pixispine.Spine(spineData); - this.armatures[changed.gameObject.id] = armature; - if (changed.gameObject && changed.gameObject.transform) { - const tran = changed.gameObject.transform; - armature.x = tran.size.width * tran.origin.x; - armature.y = tran.size.height * tran.origin.y; - } - container.addChildAt(armature, 0); - component.usingResource = component.resource; - component.armature = armature; - if (component.autoPlay) { - try { - armature.state.setAnimation(0, component.animationName, true); - } - catch (e) { - console.log(e); - } - } - component.emit('loaded', { resource: component.resource }); - armature.state.addListener({ - start: (track, event) => { - component.emit('start', { track, name: track.animation.name }); - }, - complete: (track, event) => { - component.emit('complete', { track, name: track.animation.name }); - }, - interrupt: (track, event) => { - component.emit('interrupt', { track, name: track.animation.name }); - }, - end: (track, event) => { - component.emit('end', { track, name: track.animation.name }); - }, - event: (track, event) => { - component.emit('event', track, event); - }, - }); - }); - } - change(changed) { - this.remove(changed); - this.add(changed); - } - remove(changed) { - const component = changed.component; - clearTimeout(component.addHandler); - const armature = this.armatures[changed.gameObject.id]; - const container = this.renderSystem.containerManager.getContainer(changed.gameObject.id); - if (container && armature) { - container.removeChild(armature); - } - if (component.armature) { - component.armature.destroy({ children: true }); - if (component.usingResource) { - releaseSpineData(component.usingResource); - } - } - component.armature = null; - delete this.armatures[changed.gameObject.id]; - if (changed.type === eva_js.OBSERVER_TYPE.CHANGE) ; - } - }; - SpineSystem.systemName = 'SpineSystem'; - SpineSystem = __decorate([ - eva_js.decorators.componentObserver({ - Spine: ['resource'], - }) - ], SpineSystem); - var SpineSystem$1 = SpineSystem; - - exports.Spine = Spine; - exports.SpineSystem = SpineSystem$1; - - Object.defineProperty(exports, '__esModule', { value: true }); - -}))); diff --git a/dist/cdn/EVA.plugin.renderer.spine38.js b/dist/cdn/EVA.plugin.renderer.spine38.js deleted file mode 100644 index 8d443fa6..00000000 --- a/dist/cdn/EVA.plugin.renderer.spine38.js +++ /dev/null @@ -1,9287 +0,0 @@ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@eva/eva.js'), require('@eva/plugin-renderer'), require('pixi.js')) : - typeof define === 'function' && define.amd ? define(['exports', '@eva/eva.js', '@eva/plugin-renderer', 'pixi.js'], factory) : - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.EVA = global.EVA || {}, global.EVA.plugin = global.EVA.plugin || {}, global.EVA.plugin.renderer = global.EVA.plugin.renderer || {}, global.EVA.plugin.renderer.spine38 = {}), global.EVA, global.EVA.plugin.renderer, global.PIXI)); -}(this, (function (exports, eva_js, pluginRenderer, pixi_js) { 'use strict'; - - /*! ***************************************************************************** - Copyright (c) Microsoft Corporation. - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. - ***************************************************************************** */ - - function __decorate(decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; - } - - function __awaiter(thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - } - - class Spine extends eva_js.Component { - constructor() { - super(...arguments); - this.resource = ''; - this.animationName = ''; - this.autoPlay = true; - } - init(obj) { - if (!obj) - return; - Object.assign(this, obj); - if (this.autoPlay) { - this.play(this.animationName); - } - } - onDestroy() { - this.destroied = true; - } - play(name, loop, track) { - try { - if (name) - this.animationName = name; - if (!this.armature) { - } - else { - if (track === undefined) { - track = 0; - } - this.armature.state.setAnimation(track, this.animationName, loop); - } - } - catch (e) { - console.log(e); - } - } - stop(track) { - if (!this.armature) { - return; - } - if (track === undefined) { - track = 0; - } - this.armature.state.setEmptyAnimation(track, 0); - } - addAnimation(name, delay, loop, track) { - try { - if (!this.armature) { - } - else { - if (track === undefined) { - track = 0; - } - this.armature.state.addAnimation(track, name, loop, delay); - } - } - catch (e) { - console.log(e); - } - } - setMix(from, to, duration) { - if (!this.armature) ; - else { - this.armature.stateData.setMix(from, to, duration); - } - } - getAnim(track = 0) { - try { - if (!this.armature) { - } - else { - return this.armature.state.tracks[track].animation.name; - } - } - catch (e) { - console.log(e); - } - } - setDefaultMix(duration) { - if (!this.armature) ; - else { - this.armature.stateData.defaultMix = duration; - } - } - setAttachment(slotName, attachmentName) { - if (!this.armature) { - return; - } - this.armature.skeleton.setAttachment(slotName, attachmentName); - } - getBone(boneName) { - if (!this.armature) { - return; - } - return this.armature.skeleton.findBone(boneName); - } - } - Spine.componentName = 'Spine'; - __decorate([ - eva_js.decorators.IDEProp - ], Spine.prototype, "resource", void 0); - __decorate([ - eva_js.decorators.IDEProp - ], Spine.prototype, "animationName", void 0); - __decorate([ - eva_js.decorators.IDEProp - ], Spine.prototype, "autoPlay", void 0); - - const VERSION = '4.8.9'; - const loader = pixi_js.loaders.shared; - - const PIXI = { - Texture: pixi_js.Texture, - Rectangle: pixi_js.Rectangle, - Sprite: pixi_js.Sprite, - Graphics: pixi_js.Graphics, - mesh: pixi_js.mesh, - Matrix: pixi_js.Matrix, - Container: pixi_js.Container, - VERSION, - loaders: pixi_js.loaders, - loader, - SCALE_MODES: pixi_js.SCALE_MODES, - utils: pixi_js.utils, - TransformBase: pixi_js.TransformBase, - TransformStatic: pixi_js.TransformStatic, - DisplayObject: pixi_js.DisplayObject, - Polygon: pixi_js.Polygon, - BaseTexture: pixi_js.BaseTexture, - }; - - var __extends = (undefined && undefined.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - var pixi_spine; - (function (pixi_spine) { - (function (core) { - var Animation = (function () { - function Animation(name, timelines, duration) { - if (name == null) - throw new Error("name cannot be null."); - if (timelines == null) - throw new Error("timelines cannot be null."); - this.name = name; - this.timelines = timelines; - this.timelineIds = []; - for (var i = 0; i < timelines.length; i++) - this.timelineIds[timelines[i].getPropertyId()] = true; - this.duration = duration; - } - Animation.prototype.hasTimeline = function (id) { - return this.timelineIds[id] == true; - }; - Animation.prototype.apply = function (skeleton, lastTime, time, loop, events, alpha, blend, direction) { - if (skeleton == null) - throw new Error("skeleton cannot be null."); - if (loop && this.duration != 0) { - time %= this.duration; - if (lastTime > 0) - lastTime %= this.duration; - } - var timelines = this.timelines; - for (var i = 0, n = timelines.length; i < n; i++) - timelines[i].apply(skeleton, lastTime, time, events, alpha, blend, direction); - }; - Animation.binarySearch = function (values, target, step) { - if (step === void 0) { step = 1; } - var low = 0; - var high = values.length / step - 2; - if (high == 0) - return step; - var current = high >>> 1; - while (true) { - if (values[(current + 1) * step] <= target) - low = current + 1; - else - high = current; - if (low == high) - return (low + 1) * step; - current = (low + high) >>> 1; - } - }; - Animation.linearSearch = function (values, target, step) { - for (var i = 0, last = values.length - step; i <= last; i += step) - if (values[i] > target) - return i; - return -1; - }; - return Animation; - }()); - core.Animation = Animation; - var MixBlend; - (function (MixBlend) { - MixBlend[MixBlend["setup"] = 0] = "setup"; - MixBlend[MixBlend["first"] = 1] = "first"; - MixBlend[MixBlend["replace"] = 2] = "replace"; - MixBlend[MixBlend["add"] = 3] = "add"; - })(MixBlend = core.MixBlend || (core.MixBlend = {})); - var MixDirection; - (function (MixDirection) { - MixDirection[MixDirection["mixIn"] = 0] = "mixIn"; - MixDirection[MixDirection["mixOut"] = 1] = "mixOut"; - })(MixDirection = core.MixDirection || (core.MixDirection = {})); - var TimelineType; - (function (TimelineType) { - TimelineType[TimelineType["rotate"] = 0] = "rotate"; - TimelineType[TimelineType["translate"] = 1] = "translate"; - TimelineType[TimelineType["scale"] = 2] = "scale"; - TimelineType[TimelineType["shear"] = 3] = "shear"; - TimelineType[TimelineType["attachment"] = 4] = "attachment"; - TimelineType[TimelineType["color"] = 5] = "color"; - TimelineType[TimelineType["deform"] = 6] = "deform"; - TimelineType[TimelineType["event"] = 7] = "event"; - TimelineType[TimelineType["drawOrder"] = 8] = "drawOrder"; - TimelineType[TimelineType["ikConstraint"] = 9] = "ikConstraint"; - TimelineType[TimelineType["transformConstraint"] = 10] = "transformConstraint"; - TimelineType[TimelineType["pathConstraintPosition"] = 11] = "pathConstraintPosition"; - TimelineType[TimelineType["pathConstraintSpacing"] = 12] = "pathConstraintSpacing"; - TimelineType[TimelineType["pathConstraintMix"] = 13] = "pathConstraintMix"; - TimelineType[TimelineType["twoColor"] = 14] = "twoColor"; - })(TimelineType = core.TimelineType || (core.TimelineType = {})); - var CurveTimeline = (function () { - function CurveTimeline(frameCount) { - if (frameCount <= 0) - throw new Error("frameCount must be > 0: " + frameCount); - this.curves = core.Utils.newFloatArray((frameCount - 1) * CurveTimeline.BEZIER_SIZE); - } - CurveTimeline.prototype.getFrameCount = function () { - return this.curves.length / CurveTimeline.BEZIER_SIZE + 1; - }; - CurveTimeline.prototype.setLinear = function (frameIndex) { - this.curves[frameIndex * CurveTimeline.BEZIER_SIZE] = CurveTimeline.LINEAR; - }; - CurveTimeline.prototype.setStepped = function (frameIndex) { - this.curves[frameIndex * CurveTimeline.BEZIER_SIZE] = CurveTimeline.STEPPED; - }; - CurveTimeline.prototype.getCurveType = function (frameIndex) { - var index = frameIndex * CurveTimeline.BEZIER_SIZE; - if (index == this.curves.length) - return CurveTimeline.LINEAR; - var type = this.curves[index]; - if (type == CurveTimeline.LINEAR) - return CurveTimeline.LINEAR; - if (type == CurveTimeline.STEPPED) - return CurveTimeline.STEPPED; - return CurveTimeline.BEZIER; - }; - CurveTimeline.prototype.setCurve = function (frameIndex, cx1, cy1, cx2, cy2) { - var tmpx = (-cx1 * 2 + cx2) * 0.03, tmpy = (-cy1 * 2 + cy2) * 0.03; - var dddfx = ((cx1 - cx2) * 3 + 1) * 0.006, dddfy = ((cy1 - cy2) * 3 + 1) * 0.006; - var ddfx = tmpx * 2 + dddfx, ddfy = tmpy * 2 + dddfy; - var dfx = cx1 * 0.3 + tmpx + dddfx * 0.16666667, dfy = cy1 * 0.3 + tmpy + dddfy * 0.16666667; - var i = frameIndex * CurveTimeline.BEZIER_SIZE; - var curves = this.curves; - curves[i++] = CurveTimeline.BEZIER; - var x = dfx, y = dfy; - for (var n = i + CurveTimeline.BEZIER_SIZE - 1; i < n; i += 2) { - curves[i] = x; - curves[i + 1] = y; - dfx += ddfx; - dfy += ddfy; - ddfx += dddfx; - ddfy += dddfy; - x += dfx; - y += dfy; - } - }; - CurveTimeline.prototype.getCurvePercent = function (frameIndex, percent) { - percent = core.MathUtils.clamp(percent, 0, 1); - var curves = this.curves; - var i = frameIndex * CurveTimeline.BEZIER_SIZE; - var type = curves[i]; - if (type == CurveTimeline.LINEAR) - return percent; - if (type == CurveTimeline.STEPPED) - return 0; - i++; - var x = 0; - for (var start = i, n = i + CurveTimeline.BEZIER_SIZE - 1; i < n; i += 2) { - x = curves[i]; - if (x >= percent) { - var prevX = void 0, prevY = void 0; - if (i == start) { - prevX = 0; - prevY = 0; - } - else { - prevX = curves[i - 2]; - prevY = curves[i - 1]; - } - return prevY + (curves[i + 1] - prevY) * (percent - prevX) / (x - prevX); - } - } - var y = curves[i - 1]; - return y + (1 - y) * (percent - x) / (1 - x); - }; - CurveTimeline.LINEAR = 0; - CurveTimeline.STEPPED = 1; - CurveTimeline.BEZIER = 2; - CurveTimeline.BEZIER_SIZE = 10 * 2 - 1; - return CurveTimeline; - }()); - core.CurveTimeline = CurveTimeline; - var RotateTimeline = (function (_super) { - __extends(RotateTimeline, _super); - function RotateTimeline(frameCount) { - var _this = _super.call(this, frameCount) || this; - _this.frames = core.Utils.newFloatArray(frameCount << 1); - return _this; - } - RotateTimeline.prototype.getPropertyId = function () { - return (TimelineType.rotate << 24) + this.boneIndex; - }; - RotateTimeline.prototype.setFrame = function (frameIndex, time, degrees) { - frameIndex <<= 1; - this.frames[frameIndex] = time; - this.frames[frameIndex + RotateTimeline.ROTATION] = degrees; - }; - RotateTimeline.prototype.apply = function (skeleton, lastTime, time, events, alpha, blend, direction) { - var frames = this.frames; - var bone = skeleton.bones[this.boneIndex]; - if (!bone.active) - return; - if (time < frames[0]) { - switch (blend) { - case MixBlend.setup: - bone.rotation = bone.data.rotation; - return; - case MixBlend.first: - var r_1 = bone.data.rotation - bone.rotation; - bone.rotation += (r_1 - (16384 - ((16384.499999999996 - r_1 / 360) | 0)) * 360) * alpha; - } - return; - } - if (time >= frames[frames.length - RotateTimeline.ENTRIES]) { - var r_2 = frames[frames.length + RotateTimeline.PREV_ROTATION]; - switch (blend) { - case MixBlend.setup: - bone.rotation = bone.data.rotation + r_2 * alpha; - break; - case MixBlend.first: - case MixBlend.replace: - r_2 += bone.data.rotation - bone.rotation; - r_2 -= (16384 - ((16384.499999999996 - r_2 / 360) | 0)) * 360; - case MixBlend.add: - bone.rotation += r_2 * alpha; - } - return; - } - var frame = Animation.binarySearch(frames, time, RotateTimeline.ENTRIES); - var prevRotation = frames[frame + RotateTimeline.PREV_ROTATION]; - var frameTime = frames[frame]; - var percent = this.getCurvePercent((frame >> 1) - 1, 1 - (time - frameTime) / (frames[frame + RotateTimeline.PREV_TIME] - frameTime)); - var r = frames[frame + RotateTimeline.ROTATION] - prevRotation; - r = prevRotation + (r - (16384 - ((16384.499999999996 - r / 360) | 0)) * 360) * percent; - switch (blend) { - case MixBlend.setup: - bone.rotation = bone.data.rotation + (r - (16384 - ((16384.499999999996 - r / 360) | 0)) * 360) * alpha; - break; - case MixBlend.first: - case MixBlend.replace: - r += bone.data.rotation - bone.rotation; - case MixBlend.add: - bone.rotation += (r - (16384 - ((16384.499999999996 - r / 360) | 0)) * 360) * alpha; - } - }; - RotateTimeline.ENTRIES = 2; - RotateTimeline.PREV_TIME = -2; - RotateTimeline.PREV_ROTATION = -1; - RotateTimeline.ROTATION = 1; - return RotateTimeline; - }(CurveTimeline)); - core.RotateTimeline = RotateTimeline; - var TranslateTimeline = (function (_super) { - __extends(TranslateTimeline, _super); - function TranslateTimeline(frameCount) { - var _this = _super.call(this, frameCount) || this; - _this.frames = core.Utils.newFloatArray(frameCount * TranslateTimeline.ENTRIES); - return _this; - } - TranslateTimeline.prototype.getPropertyId = function () { - return (TimelineType.translate << 24) + this.boneIndex; - }; - TranslateTimeline.prototype.setFrame = function (frameIndex, time, x, y) { - frameIndex *= TranslateTimeline.ENTRIES; - this.frames[frameIndex] = time; - this.frames[frameIndex + TranslateTimeline.X] = x; - this.frames[frameIndex + TranslateTimeline.Y] = y; - }; - TranslateTimeline.prototype.apply = function (skeleton, lastTime, time, events, alpha, blend, direction) { - var frames = this.frames; - var bone = skeleton.bones[this.boneIndex]; - if (!bone.active) - return; - if (time < frames[0]) { - switch (blend) { - case MixBlend.setup: - bone.x = bone.data.x; - bone.y = bone.data.y; - return; - case MixBlend.first: - bone.x += (bone.data.x - bone.x) * alpha; - bone.y += (bone.data.y - bone.y) * alpha; - } - return; - } - var x = 0, y = 0; - if (time >= frames[frames.length - TranslateTimeline.ENTRIES]) { - x = frames[frames.length + TranslateTimeline.PREV_X]; - y = frames[frames.length + TranslateTimeline.PREV_Y]; - } - else { - var frame = Animation.binarySearch(frames, time, TranslateTimeline.ENTRIES); - x = frames[frame + TranslateTimeline.PREV_X]; - y = frames[frame + TranslateTimeline.PREV_Y]; - var frameTime = frames[frame]; - var percent = this.getCurvePercent(frame / TranslateTimeline.ENTRIES - 1, 1 - (time - frameTime) / (frames[frame + TranslateTimeline.PREV_TIME] - frameTime)); - x += (frames[frame + TranslateTimeline.X] - x) * percent; - y += (frames[frame + TranslateTimeline.Y] - y) * percent; - } - switch (blend) { - case MixBlend.setup: - bone.x = bone.data.x + x * alpha; - bone.y = bone.data.y + y * alpha; - break; - case MixBlend.first: - case MixBlend.replace: - bone.x += (bone.data.x + x - bone.x) * alpha; - bone.y += (bone.data.y + y - bone.y) * alpha; - break; - case MixBlend.add: - bone.x += x * alpha; - bone.y += y * alpha; - } - }; - TranslateTimeline.ENTRIES = 3; - TranslateTimeline.PREV_TIME = -3; - TranslateTimeline.PREV_X = -2; - TranslateTimeline.PREV_Y = -1; - TranslateTimeline.X = 1; - TranslateTimeline.Y = 2; - return TranslateTimeline; - }(CurveTimeline)); - core.TranslateTimeline = TranslateTimeline; - var ScaleTimeline = (function (_super) { - __extends(ScaleTimeline, _super); - function ScaleTimeline(frameCount) { - return _super.call(this, frameCount) || this; - } - ScaleTimeline.prototype.getPropertyId = function () { - return (TimelineType.scale << 24) + this.boneIndex; - }; - ScaleTimeline.prototype.apply = function (skeleton, lastTime, time, events, alpha, blend, direction) { - var frames = this.frames; - var bone = skeleton.bones[this.boneIndex]; - if (!bone.active) - return; - if (time < frames[0]) { - switch (blend) { - case MixBlend.setup: - bone.scaleX = bone.data.scaleX; - bone.scaleY = bone.data.scaleY; - return; - case MixBlend.first: - bone.scaleX += (bone.data.scaleX - bone.scaleX) * alpha; - bone.scaleY += (bone.data.scaleY - bone.scaleY) * alpha; - } - return; - } - var x = 0, y = 0; - if (time >= frames[frames.length - ScaleTimeline.ENTRIES]) { - x = frames[frames.length + ScaleTimeline.PREV_X] * bone.data.scaleX; - y = frames[frames.length + ScaleTimeline.PREV_Y] * bone.data.scaleY; - } - else { - var frame = Animation.binarySearch(frames, time, ScaleTimeline.ENTRIES); - x = frames[frame + ScaleTimeline.PREV_X]; - y = frames[frame + ScaleTimeline.PREV_Y]; - var frameTime = frames[frame]; - var percent = this.getCurvePercent(frame / ScaleTimeline.ENTRIES - 1, 1 - (time - frameTime) / (frames[frame + ScaleTimeline.PREV_TIME] - frameTime)); - x = (x + (frames[frame + ScaleTimeline.X] - x) * percent) * bone.data.scaleX; - y = (y + (frames[frame + ScaleTimeline.Y] - y) * percent) * bone.data.scaleY; - } - if (alpha == 1) { - if (blend == MixBlend.add) { - bone.scaleX += x - bone.data.scaleX; - bone.scaleY += y - bone.data.scaleY; - } - else { - bone.scaleX = x; - bone.scaleY = y; - } - } - else { - var bx = 0, by = 0; - if (direction == MixDirection.mixOut) { - switch (blend) { - case MixBlend.setup: - bx = bone.data.scaleX; - by = bone.data.scaleY; - bone.scaleX = bx + (Math.abs(x) * core.MathUtils.signum(bx) - bx) * alpha; - bone.scaleY = by + (Math.abs(y) * core.MathUtils.signum(by) - by) * alpha; - break; - case MixBlend.first: - case MixBlend.replace: - bx = bone.scaleX; - by = bone.scaleY; - bone.scaleX = bx + (Math.abs(x) * core.MathUtils.signum(bx) - bx) * alpha; - bone.scaleY = by + (Math.abs(y) * core.MathUtils.signum(by) - by) * alpha; - break; - case MixBlend.add: - bx = bone.scaleX; - by = bone.scaleY; - bone.scaleX = bx + (Math.abs(x) * core.MathUtils.signum(bx) - bone.data.scaleX) * alpha; - bone.scaleY = by + (Math.abs(y) * core.MathUtils.signum(by) - bone.data.scaleY) * alpha; - } - } - else { - switch (blend) { - case MixBlend.setup: - bx = Math.abs(bone.data.scaleX) * core.MathUtils.signum(x); - by = Math.abs(bone.data.scaleY) * core.MathUtils.signum(y); - bone.scaleX = bx + (x - bx) * alpha; - bone.scaleY = by + (y - by) * alpha; - break; - case MixBlend.first: - case MixBlend.replace: - bx = Math.abs(bone.scaleX) * core.MathUtils.signum(x); - by = Math.abs(bone.scaleY) * core.MathUtils.signum(y); - bone.scaleX = bx + (x - bx) * alpha; - bone.scaleY = by + (y - by) * alpha; - break; - case MixBlend.add: - bx = core.MathUtils.signum(x); - by = core.MathUtils.signum(y); - bone.scaleX = Math.abs(bone.scaleX) * bx + (x - Math.abs(bone.data.scaleX) * bx) * alpha; - bone.scaleY = Math.abs(bone.scaleY) * by + (y - Math.abs(bone.data.scaleY) * by) * alpha; - } - } - } - }; - return ScaleTimeline; - }(TranslateTimeline)); - core.ScaleTimeline = ScaleTimeline; - var ShearTimeline = (function (_super) { - __extends(ShearTimeline, _super); - function ShearTimeline(frameCount) { - return _super.call(this, frameCount) || this; - } - ShearTimeline.prototype.getPropertyId = function () { - return (TimelineType.shear << 24) + this.boneIndex; - }; - ShearTimeline.prototype.apply = function (skeleton, lastTime, time, events, alpha, blend, direction) { - var frames = this.frames; - var bone = skeleton.bones[this.boneIndex]; - if (!bone.active) - return; - if (time < frames[0]) { - switch (blend) { - case MixBlend.setup: - bone.shearX = bone.data.shearX; - bone.shearY = bone.data.shearY; - return; - case MixBlend.first: - bone.shearX += (bone.data.shearX - bone.shearX) * alpha; - bone.shearY += (bone.data.shearY - bone.shearY) * alpha; - } - return; - } - var x = 0, y = 0; - if (time >= frames[frames.length - ShearTimeline.ENTRIES]) { - x = frames[frames.length + ShearTimeline.PREV_X]; - y = frames[frames.length + ShearTimeline.PREV_Y]; - } - else { - var frame = Animation.binarySearch(frames, time, ShearTimeline.ENTRIES); - x = frames[frame + ShearTimeline.PREV_X]; - y = frames[frame + ShearTimeline.PREV_Y]; - var frameTime = frames[frame]; - var percent = this.getCurvePercent(frame / ShearTimeline.ENTRIES - 1, 1 - (time - frameTime) / (frames[frame + ShearTimeline.PREV_TIME] - frameTime)); - x = x + (frames[frame + ShearTimeline.X] - x) * percent; - y = y + (frames[frame + ShearTimeline.Y] - y) * percent; - } - switch (blend) { - case MixBlend.setup: - bone.shearX = bone.data.shearX + x * alpha; - bone.shearY = bone.data.shearY + y * alpha; - break; - case MixBlend.first: - case MixBlend.replace: - bone.shearX += (bone.data.shearX + x - bone.shearX) * alpha; - bone.shearY += (bone.data.shearY + y - bone.shearY) * alpha; - break; - case MixBlend.add: - bone.shearX += x * alpha; - bone.shearY += y * alpha; - } - }; - return ShearTimeline; - }(TranslateTimeline)); - core.ShearTimeline = ShearTimeline; - var ColorTimeline = (function (_super) { - __extends(ColorTimeline, _super); - function ColorTimeline(frameCount) { - var _this = _super.call(this, frameCount) || this; - _this.frames = core.Utils.newFloatArray(frameCount * ColorTimeline.ENTRIES); - return _this; - } - ColorTimeline.prototype.getPropertyId = function () { - return (TimelineType.color << 24) + this.slotIndex; - }; - ColorTimeline.prototype.setFrame = function (frameIndex, time, r, g, b, a) { - frameIndex *= ColorTimeline.ENTRIES; - this.frames[frameIndex] = time; - this.frames[frameIndex + ColorTimeline.R] = r; - this.frames[frameIndex + ColorTimeline.G] = g; - this.frames[frameIndex + ColorTimeline.B] = b; - this.frames[frameIndex + ColorTimeline.A] = a; - }; - ColorTimeline.prototype.apply = function (skeleton, lastTime, time, events, alpha, blend, direction) { - var slot = skeleton.slots[this.slotIndex]; - if (!slot.bone.active) - return; - var frames = this.frames; - if (time < frames[0]) { - switch (blend) { - case MixBlend.setup: - slot.color.setFromColor(slot.data.color); - return; - case MixBlend.first: - var color = slot.color, setup = slot.data.color; - color.add((setup.r - color.r) * alpha, (setup.g - color.g) * alpha, (setup.b - color.b) * alpha, (setup.a - color.a) * alpha); - } - return; - } - var r = 0, g = 0, b = 0, a = 0; - if (time >= frames[frames.length - ColorTimeline.ENTRIES]) { - var i = frames.length; - r = frames[i + ColorTimeline.PREV_R]; - g = frames[i + ColorTimeline.PREV_G]; - b = frames[i + ColorTimeline.PREV_B]; - a = frames[i + ColorTimeline.PREV_A]; - } - else { - var frame = Animation.binarySearch(frames, time, ColorTimeline.ENTRIES); - r = frames[frame + ColorTimeline.PREV_R]; - g = frames[frame + ColorTimeline.PREV_G]; - b = frames[frame + ColorTimeline.PREV_B]; - a = frames[frame + ColorTimeline.PREV_A]; - var frameTime = frames[frame]; - var percent = this.getCurvePercent(frame / ColorTimeline.ENTRIES - 1, 1 - (time - frameTime) / (frames[frame + ColorTimeline.PREV_TIME] - frameTime)); - r += (frames[frame + ColorTimeline.R] - r) * percent; - g += (frames[frame + ColorTimeline.G] - g) * percent; - b += (frames[frame + ColorTimeline.B] - b) * percent; - a += (frames[frame + ColorTimeline.A] - a) * percent; - } - if (alpha == 1) - slot.color.set(r, g, b, a); - else { - var color = slot.color; - if (blend == MixBlend.setup) - color.setFromColor(slot.data.color); - color.add((r - color.r) * alpha, (g - color.g) * alpha, (b - color.b) * alpha, (a - color.a) * alpha); - } - }; - ColorTimeline.ENTRIES = 5; - ColorTimeline.PREV_TIME = -5; - ColorTimeline.PREV_R = -4; - ColorTimeline.PREV_G = -3; - ColorTimeline.PREV_B = -2; - ColorTimeline.PREV_A = -1; - ColorTimeline.R = 1; - ColorTimeline.G = 2; - ColorTimeline.B = 3; - ColorTimeline.A = 4; - return ColorTimeline; - }(CurveTimeline)); - core.ColorTimeline = ColorTimeline; - var TwoColorTimeline = (function (_super) { - __extends(TwoColorTimeline, _super); - function TwoColorTimeline(frameCount) { - var _this = _super.call(this, frameCount) || this; - _this.frames = core.Utils.newFloatArray(frameCount * TwoColorTimeline.ENTRIES); - return _this; - } - TwoColorTimeline.prototype.getPropertyId = function () { - return (TimelineType.twoColor << 24) + this.slotIndex; - }; - TwoColorTimeline.prototype.setFrame = function (frameIndex, time, r, g, b, a, r2, g2, b2) { - frameIndex *= TwoColorTimeline.ENTRIES; - this.frames[frameIndex] = time; - this.frames[frameIndex + TwoColorTimeline.R] = r; - this.frames[frameIndex + TwoColorTimeline.G] = g; - this.frames[frameIndex + TwoColorTimeline.B] = b; - this.frames[frameIndex + TwoColorTimeline.A] = a; - this.frames[frameIndex + TwoColorTimeline.R2] = r2; - this.frames[frameIndex + TwoColorTimeline.G2] = g2; - this.frames[frameIndex + TwoColorTimeline.B2] = b2; - }; - TwoColorTimeline.prototype.apply = function (skeleton, lastTime, time, events, alpha, blend, direction) { - var slot = skeleton.slots[this.slotIndex]; - if (!slot.bone.active) - return; - var frames = this.frames; - if (time < frames[0]) { - switch (blend) { - case MixBlend.setup: - slot.color.setFromColor(slot.data.color); - slot.darkColor.setFromColor(slot.data.darkColor); - return; - case MixBlend.first: - var light = slot.color, dark = slot.darkColor, setupLight = slot.data.color, setupDark = slot.data.darkColor; - light.add((setupLight.r - light.r) * alpha, (setupLight.g - light.g) * alpha, (setupLight.b - light.b) * alpha, (setupLight.a - light.a) * alpha); - dark.add((setupDark.r - dark.r) * alpha, (setupDark.g - dark.g) * alpha, (setupDark.b - dark.b) * alpha, 0); - } - return; - } - var r = 0, g = 0, b = 0, a = 0, r2 = 0, g2 = 0, b2 = 0; - if (time >= frames[frames.length - TwoColorTimeline.ENTRIES]) { - var i = frames.length; - r = frames[i + TwoColorTimeline.PREV_R]; - g = frames[i + TwoColorTimeline.PREV_G]; - b = frames[i + TwoColorTimeline.PREV_B]; - a = frames[i + TwoColorTimeline.PREV_A]; - r2 = frames[i + TwoColorTimeline.PREV_R2]; - g2 = frames[i + TwoColorTimeline.PREV_G2]; - b2 = frames[i + TwoColorTimeline.PREV_B2]; - } - else { - var frame = Animation.binarySearch(frames, time, TwoColorTimeline.ENTRIES); - r = frames[frame + TwoColorTimeline.PREV_R]; - g = frames[frame + TwoColorTimeline.PREV_G]; - b = frames[frame + TwoColorTimeline.PREV_B]; - a = frames[frame + TwoColorTimeline.PREV_A]; - r2 = frames[frame + TwoColorTimeline.PREV_R2]; - g2 = frames[frame + TwoColorTimeline.PREV_G2]; - b2 = frames[frame + TwoColorTimeline.PREV_B2]; - var frameTime = frames[frame]; - var percent = this.getCurvePercent(frame / TwoColorTimeline.ENTRIES - 1, 1 - (time - frameTime) / (frames[frame + TwoColorTimeline.PREV_TIME] - frameTime)); - r += (frames[frame + TwoColorTimeline.R] - r) * percent; - g += (frames[frame + TwoColorTimeline.G] - g) * percent; - b += (frames[frame + TwoColorTimeline.B] - b) * percent; - a += (frames[frame + TwoColorTimeline.A] - a) * percent; - r2 += (frames[frame + TwoColorTimeline.R2] - r2) * percent; - g2 += (frames[frame + TwoColorTimeline.G2] - g2) * percent; - b2 += (frames[frame + TwoColorTimeline.B2] - b2) * percent; - } - if (alpha == 1) { - slot.color.set(r, g, b, a); - slot.darkColor.set(r2, g2, b2, 1); - } - else { - var light = slot.color, dark = slot.darkColor; - if (blend == MixBlend.setup) { - light.setFromColor(slot.data.color); - dark.setFromColor(slot.data.darkColor); - } - light.add((r - light.r) * alpha, (g - light.g) * alpha, (b - light.b) * alpha, (a - light.a) * alpha); - dark.add((r2 - dark.r) * alpha, (g2 - dark.g) * alpha, (b2 - dark.b) * alpha, 0); - } - }; - TwoColorTimeline.ENTRIES = 8; - TwoColorTimeline.PREV_TIME = -8; - TwoColorTimeline.PREV_R = -7; - TwoColorTimeline.PREV_G = -6; - TwoColorTimeline.PREV_B = -5; - TwoColorTimeline.PREV_A = -4; - TwoColorTimeline.PREV_R2 = -3; - TwoColorTimeline.PREV_G2 = -2; - TwoColorTimeline.PREV_B2 = -1; - TwoColorTimeline.R = 1; - TwoColorTimeline.G = 2; - TwoColorTimeline.B = 3; - TwoColorTimeline.A = 4; - TwoColorTimeline.R2 = 5; - TwoColorTimeline.G2 = 6; - TwoColorTimeline.B2 = 7; - return TwoColorTimeline; - }(CurveTimeline)); - core.TwoColorTimeline = TwoColorTimeline; - var AttachmentTimeline = (function () { - function AttachmentTimeline(frameCount) { - this.frames = core.Utils.newFloatArray(frameCount); - this.attachmentNames = new Array(frameCount); - } - AttachmentTimeline.prototype.getPropertyId = function () { - return (TimelineType.attachment << 24) + this.slotIndex; - }; - AttachmentTimeline.prototype.getFrameCount = function () { - return this.frames.length; - }; - AttachmentTimeline.prototype.setFrame = function (frameIndex, time, attachmentName) { - this.frames[frameIndex] = time; - this.attachmentNames[frameIndex] = attachmentName; - }; - AttachmentTimeline.prototype.apply = function (skeleton, lastTime, time, events, alpha, blend, direction) { - var slot = skeleton.slots[this.slotIndex]; - if (!slot.bone.active) - return; - if (direction == MixDirection.mixOut) { - if (blend == MixBlend.setup) - this.setAttachment(skeleton, slot, slot.data.attachmentName); - return; - } - var frames = this.frames; - if (time < frames[0]) { - if (blend == MixBlend.setup || blend == MixBlend.first) - this.setAttachment(skeleton, slot, slot.data.attachmentName); - return; - } - var frameIndex = 0; - if (time >= frames[frames.length - 1]) - frameIndex = frames.length - 1; - else - frameIndex = Animation.binarySearch(frames, time, 1) - 1; - var attachmentName = this.attachmentNames[frameIndex]; - skeleton.slots[this.slotIndex] - .setAttachment(attachmentName == null ? null : skeleton.getAttachment(this.slotIndex, attachmentName)); - }; - AttachmentTimeline.prototype.setAttachment = function (skeleton, slot, attachmentName) { - slot.attachment = attachmentName == null ? null : skeleton.getAttachment(this.slotIndex, attachmentName); - }; - return AttachmentTimeline; - }()); - core.AttachmentTimeline = AttachmentTimeline; - var zeros = null; - var DeformTimeline = (function (_super) { - __extends(DeformTimeline, _super); - function DeformTimeline(frameCount) { - var _this = _super.call(this, frameCount) || this; - _this.frames = core.Utils.newFloatArray(frameCount); - _this.frameVertices = new Array(frameCount); - if (zeros == null) - zeros = core.Utils.newFloatArray(64); - return _this; - } - DeformTimeline.prototype.getPropertyId = function () { - return (TimelineType.deform << 27) + +this.attachment.id + this.slotIndex; - }; - DeformTimeline.prototype.setFrame = function (frameIndex, time, vertices) { - this.frames[frameIndex] = time; - this.frameVertices[frameIndex] = vertices; - }; - DeformTimeline.prototype.apply = function (skeleton, lastTime, time, firedEvents, alpha, blend, direction) { - var slot = skeleton.slots[this.slotIndex]; - if (!slot.bone.active) - return; - var slotAttachment = slot.getAttachment(); - if (!(slotAttachment instanceof core.VertexAttachment) || !(slotAttachment.deformAttachment == this.attachment)) - return; - var deformArray = slot.deform; - if (deformArray.length == 0) - blend = MixBlend.setup; - var frameVertices = this.frameVertices; - var vertexCount = frameVertices[0].length; - var frames = this.frames; - if (time < frames[0]) { - var vertexAttachment = slotAttachment; - switch (blend) { - case MixBlend.setup: - deformArray.length = 0; - return; - case MixBlend.first: - if (alpha == 1) { - deformArray.length = 0; - break; - } - var deform_1 = core.Utils.setArraySize(deformArray, vertexCount); - if (vertexAttachment.bones == null) { - var setupVertices = vertexAttachment.vertices; - for (var i = 0; i < vertexCount; i++) - deform_1[i] += (setupVertices[i] - deform_1[i]) * alpha; - } - else { - alpha = 1 - alpha; - for (var i = 0; i < vertexCount; i++) - deform_1[i] *= alpha; - } - } - return; - } - var deform = core.Utils.setArraySize(deformArray, vertexCount); - if (time >= frames[frames.length - 1]) { - var lastVertices = frameVertices[frames.length - 1]; - if (alpha == 1) { - if (blend == MixBlend.add) { - var vertexAttachment = slotAttachment; - if (vertexAttachment.bones == null) { - var setupVertices = vertexAttachment.vertices; - for (var i_1 = 0; i_1 < vertexCount; i_1++) { - deform[i_1] += lastVertices[i_1] - setupVertices[i_1]; - } - } - else { - for (var i_2 = 0; i_2 < vertexCount; i_2++) - deform[i_2] += lastVertices[i_2]; - } - } - else { - core.Utils.arrayCopy(lastVertices, 0, deform, 0, vertexCount); - } - } - else { - switch (blend) { - case MixBlend.setup: { - var vertexAttachment_1 = slotAttachment; - if (vertexAttachment_1.bones == null) { - var setupVertices = vertexAttachment_1.vertices; - for (var i_3 = 0; i_3 < vertexCount; i_3++) { - var setup = setupVertices[i_3]; - deform[i_3] = setup + (lastVertices[i_3] - setup) * alpha; - } - } - else { - for (var i_4 = 0; i_4 < vertexCount; i_4++) - deform[i_4] = lastVertices[i_4] * alpha; - } - break; - } - case MixBlend.first: - case MixBlend.replace: - for (var i_5 = 0; i_5 < vertexCount; i_5++) - deform[i_5] += (lastVertices[i_5] - deform[i_5]) * alpha; - break; - case MixBlend.add: - var vertexAttachment = slotAttachment; - if (vertexAttachment.bones == null) { - var setupVertices = vertexAttachment.vertices; - for (var i_6 = 0; i_6 < vertexCount; i_6++) { - deform[i_6] += (lastVertices[i_6] - setupVertices[i_6]) * alpha; - } - } - else { - for (var i_7 = 0; i_7 < vertexCount; i_7++) - deform[i_7] += lastVertices[i_7] * alpha; - } - } - } - return; - } - var frame = Animation.binarySearch(frames, time); - var prevVertices = frameVertices[frame - 1]; - var nextVertices = frameVertices[frame]; - var frameTime = frames[frame]; - var percent = this.getCurvePercent(frame - 1, 1 - (time - frameTime) / (frames[frame - 1] - frameTime)); - if (alpha == 1) { - if (blend == MixBlend.add) { - var vertexAttachment = slotAttachment; - if (vertexAttachment.bones == null) { - var setupVertices = vertexAttachment.vertices; - for (var i_8 = 0; i_8 < vertexCount; i_8++) { - var prev = prevVertices[i_8]; - deform[i_8] += prev + (nextVertices[i_8] - prev) * percent - setupVertices[i_8]; - } - } - else { - for (var i_9 = 0; i_9 < vertexCount; i_9++) { - var prev = prevVertices[i_9]; - deform[i_9] += prev + (nextVertices[i_9] - prev) * percent; - } - } - } - else { - for (var i_10 = 0; i_10 < vertexCount; i_10++) { - var prev = prevVertices[i_10]; - deform[i_10] = prev + (nextVertices[i_10] - prev) * percent; - } - } - } - else { - switch (blend) { - case MixBlend.setup: { - var vertexAttachment_2 = slotAttachment; - if (vertexAttachment_2.bones == null) { - var setupVertices = vertexAttachment_2.vertices; - for (var i_11 = 0; i_11 < vertexCount; i_11++) { - var prev = prevVertices[i_11], setup = setupVertices[i_11]; - deform[i_11] = setup + (prev + (nextVertices[i_11] - prev) * percent - setup) * alpha; - } - } - else { - for (var i_12 = 0; i_12 < vertexCount; i_12++) { - var prev = prevVertices[i_12]; - deform[i_12] = (prev + (nextVertices[i_12] - prev) * percent) * alpha; - } - } - break; - } - case MixBlend.first: - case MixBlend.replace: - for (var i_13 = 0; i_13 < vertexCount; i_13++) { - var prev = prevVertices[i_13]; - deform[i_13] += (prev + (nextVertices[i_13] - prev) * percent - deform[i_13]) * alpha; - } - break; - case MixBlend.add: - var vertexAttachment = slotAttachment; - if (vertexAttachment.bones == null) { - var setupVertices = vertexAttachment.vertices; - for (var i_14 = 0; i_14 < vertexCount; i_14++) { - var prev = prevVertices[i_14]; - deform[i_14] += (prev + (nextVertices[i_14] - prev) * percent - setupVertices[i_14]) * alpha; - } - } - else { - for (var i_15 = 0; i_15 < vertexCount; i_15++) { - var prev = prevVertices[i_15]; - deform[i_15] += (prev + (nextVertices[i_15] - prev) * percent) * alpha; - } - } - } - } - }; - return DeformTimeline; - }(CurveTimeline)); - core.DeformTimeline = DeformTimeline; - var EventTimeline = (function () { - function EventTimeline(frameCount) { - this.frames = core.Utils.newFloatArray(frameCount); - this.events = new Array(frameCount); - } - EventTimeline.prototype.getPropertyId = function () { - return TimelineType.event << 24; - }; - EventTimeline.prototype.getFrameCount = function () { - return this.frames.length; - }; - EventTimeline.prototype.setFrame = function (frameIndex, event) { - this.frames[frameIndex] = event.time; - this.events[frameIndex] = event; - }; - EventTimeline.prototype.apply = function (skeleton, lastTime, time, firedEvents, alpha, blend, direction) { - if (firedEvents == null) - return; - var frames = this.frames; - var frameCount = this.frames.length; - if (lastTime > time) { - this.apply(skeleton, lastTime, Number.MAX_VALUE, firedEvents, alpha, blend, direction); - lastTime = -1; - } - else if (lastTime >= frames[frameCount - 1]) - return; - if (time < frames[0]) - return; - var frame = 0; - if (lastTime < frames[0]) - frame = 0; - else { - frame = Animation.binarySearch(frames, lastTime); - var frameTime = frames[frame]; - while (frame > 0) { - if (frames[frame - 1] != frameTime) - break; - frame--; - } - } - for (; frame < frameCount && time >= frames[frame]; frame++) - firedEvents.push(this.events[frame]); - }; - return EventTimeline; - }()); - core.EventTimeline = EventTimeline; - var DrawOrderTimeline = (function () { - function DrawOrderTimeline(frameCount) { - this.frames = core.Utils.newFloatArray(frameCount); - this.drawOrders = new Array(frameCount); - } - DrawOrderTimeline.prototype.getPropertyId = function () { - return TimelineType.drawOrder << 24; - }; - DrawOrderTimeline.prototype.getFrameCount = function () { - return this.frames.length; - }; - DrawOrderTimeline.prototype.setFrame = function (frameIndex, time, drawOrder) { - this.frames[frameIndex] = time; - this.drawOrders[frameIndex] = drawOrder; - }; - DrawOrderTimeline.prototype.apply = function (skeleton, lastTime, time, firedEvents, alpha, blend, direction) { - var drawOrder = skeleton.drawOrder; - var slots = skeleton.slots; - if (direction == MixDirection.mixOut && blend == MixBlend.setup) { - core.Utils.arrayCopy(skeleton.slots, 0, skeleton.drawOrder, 0, skeleton.slots.length); - return; - } - var frames = this.frames; - if (time < frames[0]) { - if (blend == MixBlend.setup || blend == MixBlend.first) - core.Utils.arrayCopy(skeleton.slots, 0, skeleton.drawOrder, 0, skeleton.slots.length); - return; - } - var frame = 0; - if (time >= frames[frames.length - 1]) - frame = frames.length - 1; - else - frame = Animation.binarySearch(frames, time) - 1; - var drawOrderToSetupIndex = this.drawOrders[frame]; - if (drawOrderToSetupIndex == null) - core.Utils.arrayCopy(slots, 0, drawOrder, 0, slots.length); - else { - for (var i = 0, n = drawOrderToSetupIndex.length; i < n; i++) - drawOrder[i] = slots[drawOrderToSetupIndex[i]]; - } - }; - return DrawOrderTimeline; - }()); - core.DrawOrderTimeline = DrawOrderTimeline; - var IkConstraintTimeline = (function (_super) { - __extends(IkConstraintTimeline, _super); - function IkConstraintTimeline(frameCount) { - var _this = _super.call(this, frameCount) || this; - _this.frames = core.Utils.newFloatArray(frameCount * IkConstraintTimeline.ENTRIES); - return _this; - } - IkConstraintTimeline.prototype.getPropertyId = function () { - return (TimelineType.ikConstraint << 24) + this.ikConstraintIndex; - }; - IkConstraintTimeline.prototype.setFrame = function (frameIndex, time, mix, softness, bendDirection, compress, stretch) { - frameIndex *= IkConstraintTimeline.ENTRIES; - this.frames[frameIndex] = time; - this.frames[frameIndex + IkConstraintTimeline.MIX] = mix; - this.frames[frameIndex + IkConstraintTimeline.SOFTNESS] = softness; - this.frames[frameIndex + IkConstraintTimeline.BEND_DIRECTION] = bendDirection; - this.frames[frameIndex + IkConstraintTimeline.COMPRESS] = compress ? 1 : 0; - this.frames[frameIndex + IkConstraintTimeline.STRETCH] = stretch ? 1 : 0; - }; - IkConstraintTimeline.prototype.apply = function (skeleton, lastTime, time, firedEvents, alpha, blend, direction) { - var frames = this.frames; - var constraint = skeleton.ikConstraints[this.ikConstraintIndex]; - if (!constraint.active) - return; - if (time < frames[0]) { - switch (blend) { - case MixBlend.setup: - constraint.mix = constraint.data.mix; - constraint.softness = constraint.data.softness; - constraint.bendDirection = constraint.data.bendDirection; - constraint.compress = constraint.data.compress; - constraint.stretch = constraint.data.stretch; - return; - case MixBlend.first: - constraint.mix += (constraint.data.mix - constraint.mix) * alpha; - constraint.softness += (constraint.data.softness - constraint.softness) * alpha; - constraint.bendDirection = constraint.data.bendDirection; - constraint.compress = constraint.data.compress; - constraint.stretch = constraint.data.stretch; - } - return; - } - if (time >= frames[frames.length - IkConstraintTimeline.ENTRIES]) { - if (blend == MixBlend.setup) { - constraint.mix = constraint.data.mix + (frames[frames.length + IkConstraintTimeline.PREV_MIX] - constraint.data.mix) * alpha; - constraint.softness = constraint.data.softness - + (frames[frames.length + IkConstraintTimeline.PREV_SOFTNESS] - constraint.data.softness) * alpha; - if (direction == MixDirection.mixOut) { - constraint.bendDirection = constraint.data.bendDirection; - constraint.compress = constraint.data.compress; - constraint.stretch = constraint.data.stretch; - } - else { - constraint.bendDirection = frames[frames.length + IkConstraintTimeline.PREV_BEND_DIRECTION]; - constraint.compress = frames[frames.length + IkConstraintTimeline.PREV_COMPRESS] != 0; - constraint.stretch = frames[frames.length + IkConstraintTimeline.PREV_STRETCH] != 0; - } - } - else { - constraint.mix += (frames[frames.length + IkConstraintTimeline.PREV_MIX] - constraint.mix) * alpha; - constraint.softness += (frames[frames.length + IkConstraintTimeline.PREV_SOFTNESS] - constraint.softness) * alpha; - if (direction == MixDirection.mixIn) { - constraint.bendDirection = frames[frames.length + IkConstraintTimeline.PREV_BEND_DIRECTION]; - constraint.compress = frames[frames.length + IkConstraintTimeline.PREV_COMPRESS] != 0; - constraint.stretch = frames[frames.length + IkConstraintTimeline.PREV_STRETCH] != 0; - } - } - return; - } - var frame = Animation.binarySearch(frames, time, IkConstraintTimeline.ENTRIES); - var mix = frames[frame + IkConstraintTimeline.PREV_MIX]; - var softness = frames[frame + IkConstraintTimeline.PREV_SOFTNESS]; - var frameTime = frames[frame]; - var percent = this.getCurvePercent(frame / IkConstraintTimeline.ENTRIES - 1, 1 - (time - frameTime) / (frames[frame + IkConstraintTimeline.PREV_TIME] - frameTime)); - if (blend == MixBlend.setup) { - constraint.mix = constraint.data.mix + (mix + (frames[frame + IkConstraintTimeline.MIX] - mix) * percent - constraint.data.mix) * alpha; - constraint.softness = constraint.data.softness - + (softness + (frames[frame + IkConstraintTimeline.SOFTNESS] - softness) * percent - constraint.data.softness) * alpha; - if (direction == MixDirection.mixOut) { - constraint.bendDirection = constraint.data.bendDirection; - constraint.compress = constraint.data.compress; - constraint.stretch = constraint.data.stretch; - } - else { - constraint.bendDirection = frames[frame + IkConstraintTimeline.PREV_BEND_DIRECTION]; - constraint.compress = frames[frame + IkConstraintTimeline.PREV_COMPRESS] != 0; - constraint.stretch = frames[frame + IkConstraintTimeline.PREV_STRETCH] != 0; - } - } - else { - constraint.mix += (mix + (frames[frame + IkConstraintTimeline.MIX] - mix) * percent - constraint.mix) * alpha; - constraint.softness += (softness + (frames[frame + IkConstraintTimeline.SOFTNESS] - softness) * percent - constraint.softness) * alpha; - if (direction == MixDirection.mixIn) { - constraint.bendDirection = frames[frame + IkConstraintTimeline.PREV_BEND_DIRECTION]; - constraint.compress = frames[frame + IkConstraintTimeline.PREV_COMPRESS] != 0; - constraint.stretch = frames[frame + IkConstraintTimeline.PREV_STRETCH] != 0; - } - } - }; - IkConstraintTimeline.ENTRIES = 6; - IkConstraintTimeline.PREV_TIME = -6; - IkConstraintTimeline.PREV_MIX = -5; - IkConstraintTimeline.PREV_SOFTNESS = -4; - IkConstraintTimeline.PREV_BEND_DIRECTION = -3; - IkConstraintTimeline.PREV_COMPRESS = -2; - IkConstraintTimeline.PREV_STRETCH = -1; - IkConstraintTimeline.MIX = 1; - IkConstraintTimeline.SOFTNESS = 2; - IkConstraintTimeline.BEND_DIRECTION = 3; - IkConstraintTimeline.COMPRESS = 4; - IkConstraintTimeline.STRETCH = 5; - return IkConstraintTimeline; - }(CurveTimeline)); - core.IkConstraintTimeline = IkConstraintTimeline; - var TransformConstraintTimeline = (function (_super) { - __extends(TransformConstraintTimeline, _super); - function TransformConstraintTimeline(frameCount) { - var _this = _super.call(this, frameCount) || this; - _this.frames = core.Utils.newFloatArray(frameCount * TransformConstraintTimeline.ENTRIES); - return _this; - } - TransformConstraintTimeline.prototype.getPropertyId = function () { - return (TimelineType.transformConstraint << 24) + this.transformConstraintIndex; - }; - TransformConstraintTimeline.prototype.setFrame = function (frameIndex, time, rotateMix, translateMix, scaleMix, shearMix) { - frameIndex *= TransformConstraintTimeline.ENTRIES; - this.frames[frameIndex] = time; - this.frames[frameIndex + TransformConstraintTimeline.ROTATE] = rotateMix; - this.frames[frameIndex + TransformConstraintTimeline.TRANSLATE] = translateMix; - this.frames[frameIndex + TransformConstraintTimeline.SCALE] = scaleMix; - this.frames[frameIndex + TransformConstraintTimeline.SHEAR] = shearMix; - }; - TransformConstraintTimeline.prototype.apply = function (skeleton, lastTime, time, firedEvents, alpha, blend, direction) { - var frames = this.frames; - var constraint = skeleton.transformConstraints[this.transformConstraintIndex]; - if (!constraint.active) - return; - if (time < frames[0]) { - var data = constraint.data; - switch (blend) { - case MixBlend.setup: - constraint.rotateMix = data.rotateMix; - constraint.translateMix = data.translateMix; - constraint.scaleMix = data.scaleMix; - constraint.shearMix = data.shearMix; - return; - case MixBlend.first: - constraint.rotateMix += (data.rotateMix - constraint.rotateMix) * alpha; - constraint.translateMix += (data.translateMix - constraint.translateMix) * alpha; - constraint.scaleMix += (data.scaleMix - constraint.scaleMix) * alpha; - constraint.shearMix += (data.shearMix - constraint.shearMix) * alpha; - } - return; - } - var rotate = 0, translate = 0, scale = 0, shear = 0; - if (time >= frames[frames.length - TransformConstraintTimeline.ENTRIES]) { - var i = frames.length; - rotate = frames[i + TransformConstraintTimeline.PREV_ROTATE]; - translate = frames[i + TransformConstraintTimeline.PREV_TRANSLATE]; - scale = frames[i + TransformConstraintTimeline.PREV_SCALE]; - shear = frames[i + TransformConstraintTimeline.PREV_SHEAR]; - } - else { - var frame = Animation.binarySearch(frames, time, TransformConstraintTimeline.ENTRIES); - rotate = frames[frame + TransformConstraintTimeline.PREV_ROTATE]; - translate = frames[frame + TransformConstraintTimeline.PREV_TRANSLATE]; - scale = frames[frame + TransformConstraintTimeline.PREV_SCALE]; - shear = frames[frame + TransformConstraintTimeline.PREV_SHEAR]; - var frameTime = frames[frame]; - var percent = this.getCurvePercent(frame / TransformConstraintTimeline.ENTRIES - 1, 1 - (time - frameTime) / (frames[frame + TransformConstraintTimeline.PREV_TIME] - frameTime)); - rotate += (frames[frame + TransformConstraintTimeline.ROTATE] - rotate) * percent; - translate += (frames[frame + TransformConstraintTimeline.TRANSLATE] - translate) * percent; - scale += (frames[frame + TransformConstraintTimeline.SCALE] - scale) * percent; - shear += (frames[frame + TransformConstraintTimeline.SHEAR] - shear) * percent; - } - if (blend == MixBlend.setup) { - var data = constraint.data; - constraint.rotateMix = data.rotateMix + (rotate - data.rotateMix) * alpha; - constraint.translateMix = data.translateMix + (translate - data.translateMix) * alpha; - constraint.scaleMix = data.scaleMix + (scale - data.scaleMix) * alpha; - constraint.shearMix = data.shearMix + (shear - data.shearMix) * alpha; - } - else { - constraint.rotateMix += (rotate - constraint.rotateMix) * alpha; - constraint.translateMix += (translate - constraint.translateMix) * alpha; - constraint.scaleMix += (scale - constraint.scaleMix) * alpha; - constraint.shearMix += (shear - constraint.shearMix) * alpha; - } - }; - TransformConstraintTimeline.ENTRIES = 5; - TransformConstraintTimeline.PREV_TIME = -5; - TransformConstraintTimeline.PREV_ROTATE = -4; - TransformConstraintTimeline.PREV_TRANSLATE = -3; - TransformConstraintTimeline.PREV_SCALE = -2; - TransformConstraintTimeline.PREV_SHEAR = -1; - TransformConstraintTimeline.ROTATE = 1; - TransformConstraintTimeline.TRANSLATE = 2; - TransformConstraintTimeline.SCALE = 3; - TransformConstraintTimeline.SHEAR = 4; - return TransformConstraintTimeline; - }(CurveTimeline)); - core.TransformConstraintTimeline = TransformConstraintTimeline; - var PathConstraintPositionTimeline = (function (_super) { - __extends(PathConstraintPositionTimeline, _super); - function PathConstraintPositionTimeline(frameCount) { - var _this = _super.call(this, frameCount) || this; - _this.frames = core.Utils.newFloatArray(frameCount * PathConstraintPositionTimeline.ENTRIES); - return _this; - } - PathConstraintPositionTimeline.prototype.getPropertyId = function () { - return (TimelineType.pathConstraintPosition << 24) + this.pathConstraintIndex; - }; - PathConstraintPositionTimeline.prototype.setFrame = function (frameIndex, time, value) { - frameIndex *= PathConstraintPositionTimeline.ENTRIES; - this.frames[frameIndex] = time; - this.frames[frameIndex + PathConstraintPositionTimeline.VALUE] = value; - }; - PathConstraintPositionTimeline.prototype.apply = function (skeleton, lastTime, time, firedEvents, alpha, blend, direction) { - var frames = this.frames; - var constraint = skeleton.pathConstraints[this.pathConstraintIndex]; - if (!constraint.active) - return; - if (time < frames[0]) { - switch (blend) { - case MixBlend.setup: - constraint.position = constraint.data.position; - return; - case MixBlend.first: - constraint.position += (constraint.data.position - constraint.position) * alpha; - } - return; - } - var position = 0; - if (time >= frames[frames.length - PathConstraintPositionTimeline.ENTRIES]) - position = frames[frames.length + PathConstraintPositionTimeline.PREV_VALUE]; - else { - var frame = Animation.binarySearch(frames, time, PathConstraintPositionTimeline.ENTRIES); - position = frames[frame + PathConstraintPositionTimeline.PREV_VALUE]; - var frameTime = frames[frame]; - var percent = this.getCurvePercent(frame / PathConstraintPositionTimeline.ENTRIES - 1, 1 - (time - frameTime) / (frames[frame + PathConstraintPositionTimeline.PREV_TIME] - frameTime)); - position += (frames[frame + PathConstraintPositionTimeline.VALUE] - position) * percent; - } - if (blend == MixBlend.setup) - constraint.position = constraint.data.position + (position - constraint.data.position) * alpha; - else - constraint.position += (position - constraint.position) * alpha; - }; - PathConstraintPositionTimeline.ENTRIES = 2; - PathConstraintPositionTimeline.PREV_TIME = -2; - PathConstraintPositionTimeline.PREV_VALUE = -1; - PathConstraintPositionTimeline.VALUE = 1; - return PathConstraintPositionTimeline; - }(CurveTimeline)); - core.PathConstraintPositionTimeline = PathConstraintPositionTimeline; - var PathConstraintSpacingTimeline = (function (_super) { - __extends(PathConstraintSpacingTimeline, _super); - function PathConstraintSpacingTimeline(frameCount) { - return _super.call(this, frameCount) || this; - } - PathConstraintSpacingTimeline.prototype.getPropertyId = function () { - return (TimelineType.pathConstraintSpacing << 24) + this.pathConstraintIndex; - }; - PathConstraintSpacingTimeline.prototype.apply = function (skeleton, lastTime, time, firedEvents, alpha, blend, direction) { - var frames = this.frames; - var constraint = skeleton.pathConstraints[this.pathConstraintIndex]; - if (!constraint.active) - return; - if (time < frames[0]) { - switch (blend) { - case MixBlend.setup: - constraint.spacing = constraint.data.spacing; - return; - case MixBlend.first: - constraint.spacing += (constraint.data.spacing - constraint.spacing) * alpha; - } - return; - } - var spacing = 0; - if (time >= frames[frames.length - PathConstraintSpacingTimeline.ENTRIES]) - spacing = frames[frames.length + PathConstraintSpacingTimeline.PREV_VALUE]; - else { - var frame = Animation.binarySearch(frames, time, PathConstraintSpacingTimeline.ENTRIES); - spacing = frames[frame + PathConstraintSpacingTimeline.PREV_VALUE]; - var frameTime = frames[frame]; - var percent = this.getCurvePercent(frame / PathConstraintSpacingTimeline.ENTRIES - 1, 1 - (time - frameTime) / (frames[frame + PathConstraintSpacingTimeline.PREV_TIME] - frameTime)); - spacing += (frames[frame + PathConstraintSpacingTimeline.VALUE] - spacing) * percent; - } - if (blend == MixBlend.setup) - constraint.spacing = constraint.data.spacing + (spacing - constraint.data.spacing) * alpha; - else - constraint.spacing += (spacing - constraint.spacing) * alpha; - }; - return PathConstraintSpacingTimeline; - }(PathConstraintPositionTimeline)); - core.PathConstraintSpacingTimeline = PathConstraintSpacingTimeline; - var PathConstraintMixTimeline = (function (_super) { - __extends(PathConstraintMixTimeline, _super); - function PathConstraintMixTimeline(frameCount) { - var _this = _super.call(this, frameCount) || this; - _this.frames = core.Utils.newFloatArray(frameCount * PathConstraintMixTimeline.ENTRIES); - return _this; - } - PathConstraintMixTimeline.prototype.getPropertyId = function () { - return (TimelineType.pathConstraintMix << 24) + this.pathConstraintIndex; - }; - PathConstraintMixTimeline.prototype.setFrame = function (frameIndex, time, rotateMix, translateMix) { - frameIndex *= PathConstraintMixTimeline.ENTRIES; - this.frames[frameIndex] = time; - this.frames[frameIndex + PathConstraintMixTimeline.ROTATE] = rotateMix; - this.frames[frameIndex + PathConstraintMixTimeline.TRANSLATE] = translateMix; - }; - PathConstraintMixTimeline.prototype.apply = function (skeleton, lastTime, time, firedEvents, alpha, blend, direction) { - var frames = this.frames; - var constraint = skeleton.pathConstraints[this.pathConstraintIndex]; - if (!constraint.active) - return; - if (time < frames[0]) { - switch (blend) { - case MixBlend.setup: - constraint.rotateMix = constraint.data.rotateMix; - constraint.translateMix = constraint.data.translateMix; - return; - case MixBlend.first: - constraint.rotateMix += (constraint.data.rotateMix - constraint.rotateMix) * alpha; - constraint.translateMix += (constraint.data.translateMix - constraint.translateMix) * alpha; - } - return; - } - var rotate = 0, translate = 0; - if (time >= frames[frames.length - PathConstraintMixTimeline.ENTRIES]) { - rotate = frames[frames.length + PathConstraintMixTimeline.PREV_ROTATE]; - translate = frames[frames.length + PathConstraintMixTimeline.PREV_TRANSLATE]; - } - else { - var frame = Animation.binarySearch(frames, time, PathConstraintMixTimeline.ENTRIES); - rotate = frames[frame + PathConstraintMixTimeline.PREV_ROTATE]; - translate = frames[frame + PathConstraintMixTimeline.PREV_TRANSLATE]; - var frameTime = frames[frame]; - var percent = this.getCurvePercent(frame / PathConstraintMixTimeline.ENTRIES - 1, 1 - (time - frameTime) / (frames[frame + PathConstraintMixTimeline.PREV_TIME] - frameTime)); - rotate += (frames[frame + PathConstraintMixTimeline.ROTATE] - rotate) * percent; - translate += (frames[frame + PathConstraintMixTimeline.TRANSLATE] - translate) * percent; - } - if (blend == MixBlend.setup) { - constraint.rotateMix = constraint.data.rotateMix + (rotate - constraint.data.rotateMix) * alpha; - constraint.translateMix = constraint.data.translateMix + (translate - constraint.data.translateMix) * alpha; - } - else { - constraint.rotateMix += (rotate - constraint.rotateMix) * alpha; - constraint.translateMix += (translate - constraint.translateMix) * alpha; - } - }; - PathConstraintMixTimeline.ENTRIES = 3; - PathConstraintMixTimeline.PREV_TIME = -3; - PathConstraintMixTimeline.PREV_ROTATE = -2; - PathConstraintMixTimeline.PREV_TRANSLATE = -1; - PathConstraintMixTimeline.ROTATE = 1; - PathConstraintMixTimeline.TRANSLATE = 2; - return PathConstraintMixTimeline; - }(CurveTimeline)); - core.PathConstraintMixTimeline = PathConstraintMixTimeline; - })(pixi_spine.core || (pixi_spine.core = {})); - })(pixi_spine || (pixi_spine = {})); - var pixi_spine; - (function (pixi_spine) { - (function (core) { - var AnimationState = (function () { - function AnimationState(data) { - this.tracks = new Array(); - this.timeScale = 1; - this.unkeyedState = 0; - this.events = new Array(); - this.listeners = new Array(); - this.queue = new EventQueue(this); - this.propertyIDs = new core.IntSet(); - this.animationsChanged = false; - this.trackEntryPool = new core.Pool(function () { return new TrackEntry(); }); - this.data = data; - } - AnimationState.prototype.update = function (delta) { - delta *= this.timeScale; - var tracks = this.tracks; - for (var i = 0, n = tracks.length; i < n; i++) { - var current = tracks[i]; - if (current == null) - continue; - current.animationLast = current.nextAnimationLast; - current.trackLast = current.nextTrackLast; - var currentDelta = delta * current.timeScale; - if (current.delay > 0) { - current.delay -= currentDelta; - if (current.delay > 0) - continue; - currentDelta = -current.delay; - current.delay = 0; - } - var next = current.next; - if (next != null) { - var nextTime = current.trackLast - next.delay; - if (nextTime >= 0) { - next.delay = 0; - next.trackTime += current.timeScale == 0 ? 0 : (nextTime / current.timeScale + delta) * next.timeScale; - current.trackTime += currentDelta; - this.setCurrent(i, next, true); - while (next.mixingFrom != null) { - next.mixTime += delta; - next = next.mixingFrom; - } - continue; - } - } - else if (current.trackLast >= current.trackEnd && current.mixingFrom == null) { - tracks[i] = null; - this.queue.end(current); - this.disposeNext(current); - continue; - } - if (current.mixingFrom != null && this.updateMixingFrom(current, delta)) { - var from = current.mixingFrom; - current.mixingFrom = null; - if (from != null) - from.mixingTo = null; - while (from != null) { - this.queue.end(from); - from = from.mixingFrom; - } - } - current.trackTime += currentDelta; - } - this.queue.drain(); - }; - AnimationState.prototype.updateMixingFrom = function (to, delta) { - var from = to.mixingFrom; - if (from == null) - return true; - var finished = this.updateMixingFrom(from, delta); - from.animationLast = from.nextAnimationLast; - from.trackLast = from.nextTrackLast; - if (to.mixTime > 0 && to.mixTime >= to.mixDuration) { - if (from.totalAlpha == 0 || to.mixDuration == 0) { - to.mixingFrom = from.mixingFrom; - if (from.mixingFrom != null) - from.mixingFrom.mixingTo = to; - to.interruptAlpha = from.interruptAlpha; - this.queue.end(from); - } - return finished; - } - from.trackTime += delta * from.timeScale; - to.mixTime += delta; - return false; - }; - AnimationState.prototype.apply = function (skeleton) { - if (skeleton == null) - throw new Error("skeleton cannot be null."); - if (this.animationsChanged) - this._animationsChanged(); - var events = this.events; - var tracks = this.tracks; - var applied = false; - for (var i_16 = 0, n_1 = tracks.length; i_16 < n_1; i_16++) { - var current = tracks[i_16]; - if (current == null || current.delay > 0) - continue; - applied = true; - var blend = i_16 == 0 ? core.MixBlend.first : current.mixBlend; - var mix = current.alpha; - if (current.mixingFrom != null) - mix *= this.applyMixingFrom(current, skeleton, blend); - else if (current.trackTime >= current.trackEnd && current.next == null) - mix = 0; - var animationLast = current.animationLast, animationTime = current.getAnimationTime(); - var timelineCount = current.animation.timelines.length; - var timelines = current.animation.timelines; - if ((i_16 == 0 && mix == 1) || blend == core.MixBlend.add) { - for (var ii = 0; ii < timelineCount; ii++) { - core.Utils.webkit602BugfixHelper(mix, blend); - var timeline = timelines[ii]; - if (timeline instanceof core.AttachmentTimeline) - this.applyAttachmentTimeline(timeline, skeleton, animationTime, blend, true); - else - timeline.apply(skeleton, animationLast, animationTime, events, mix, blend, core.MixDirection.mixIn); - } - } - else { - var timelineMode = current.timelineMode; - var firstFrame = current.timelinesRotation.length == 0; - if (firstFrame) - core.Utils.setArraySize(current.timelinesRotation, timelineCount << 1, null); - var timelinesRotation = current.timelinesRotation; - for (var ii = 0; ii < timelineCount; ii++) { - var timeline_1 = timelines[ii]; - var timelineBlend = timelineMode[ii] == AnimationState.SUBSEQUENT ? blend : core.MixBlend.setup; - if (timeline_1 instanceof core.RotateTimeline) { - this.applyRotateTimeline(timeline_1, skeleton, animationTime, mix, timelineBlend, timelinesRotation, ii << 1, firstFrame); - } - else if (timeline_1 instanceof core.AttachmentTimeline) { - this.applyAttachmentTimeline(timeline_1, skeleton, animationTime, blend, true); - } - else { - core.Utils.webkit602BugfixHelper(mix, blend); - timeline_1.apply(skeleton, animationLast, animationTime, events, mix, timelineBlend, core.MixDirection.mixIn); - } - } - } - this.queueEvents(current, animationTime); - events.length = 0; - current.nextAnimationLast = animationTime; - current.nextTrackLast = current.trackTime; - } - var setupState = this.unkeyedState + AnimationState.SETUP; - var slots = skeleton.slots; - for (var i = 0, n = skeleton.slots.length; i < n; i++) { - var slot = slots[i]; - if (slot.attachmentState == setupState) { - var attachmentName = slot.data.attachmentName; - slot.attachment = (attachmentName == null ? null : skeleton.getAttachment(slot.data.index, attachmentName)); - } - } - this.unkeyedState += 2; - this.queue.drain(); - return applied; - }; - AnimationState.prototype.applyMixingFrom = function (to, skeleton, blend) { - var from = to.mixingFrom; - if (from.mixingFrom != null) - this.applyMixingFrom(from, skeleton, blend); - var mix = 0; - if (to.mixDuration == 0) { - mix = 1; - if (blend == core.MixBlend.first) - blend = core.MixBlend.setup; - } - else { - mix = to.mixTime / to.mixDuration; - if (mix > 1) - mix = 1; - if (blend != core.MixBlend.first) - blend = from.mixBlend; - } - var events = mix < from.eventThreshold ? this.events : null; - var attachments = mix < from.attachmentThreshold, drawOrder = mix < from.drawOrderThreshold; - var animationLast = from.animationLast, animationTime = from.getAnimationTime(); - var timelineCount = from.animation.timelines.length; - var timelines = from.animation.timelines; - var alphaHold = from.alpha * to.interruptAlpha, alphaMix = alphaHold * (1 - mix); - if (blend == core.MixBlend.add) { - for (var i = 0; i < timelineCount; i++) - timelines[i].apply(skeleton, animationLast, animationTime, events, alphaMix, blend, core.MixDirection.mixOut); - } - else { - var timelineMode = from.timelineMode; - var timelineHoldMix = from.timelineHoldMix; - var firstFrame = from.timelinesRotation.length == 0; - if (firstFrame) - core.Utils.setArraySize(from.timelinesRotation, timelineCount << 1, null); - var timelinesRotation = from.timelinesRotation; - from.totalAlpha = 0; - for (var i = 0; i < timelineCount; i++) { - var timeline = timelines[i]; - var direction = core.MixDirection.mixOut; - var timelineBlend = void 0; - var alpha = 0; - switch (timelineMode[i]) { - case AnimationState.SUBSEQUENT: - if (!drawOrder && timeline instanceof core.DrawOrderTimeline) - continue; - timelineBlend = blend; - alpha = alphaMix; - break; - case AnimationState.FIRST: - timelineBlend = core.MixBlend.setup; - alpha = alphaMix; - break; - case AnimationState.HOLD_SUBSEQUENT: - timelineBlend = blend; - alpha = alphaHold; - break; - case AnimationState.HOLD_FIRST: - timelineBlend = core.MixBlend.setup; - alpha = alphaHold; - break; - default: - timelineBlend = core.MixBlend.setup; - var holdMix = timelineHoldMix[i]; - alpha = alphaHold * Math.max(0, 1 - holdMix.mixTime / holdMix.mixDuration); - break; - } - from.totalAlpha += alpha; - if (timeline instanceof core.RotateTimeline) - this.applyRotateTimeline(timeline, skeleton, animationTime, alpha, timelineBlend, timelinesRotation, i << 1, firstFrame); - else if (timeline instanceof core.AttachmentTimeline) - this.applyAttachmentTimeline(timeline, skeleton, animationTime, timelineBlend, attachments); - else { - core.Utils.webkit602BugfixHelper(alpha, blend); - if (drawOrder && timeline instanceof core.DrawOrderTimeline && timelineBlend == core.MixBlend.setup) - direction = core.MixDirection.mixIn; - timeline.apply(skeleton, animationLast, animationTime, events, alpha, timelineBlend, direction); - } - } - } - if (to.mixDuration > 0) - this.queueEvents(from, animationTime); - this.events.length = 0; - from.nextAnimationLast = animationTime; - from.nextTrackLast = from.trackTime; - return mix; - }; - AnimationState.prototype.applyAttachmentTimeline = function (timeline, skeleton, time, blend, attachments) { - var slot = skeleton.slots[timeline.slotIndex]; - if (!slot.bone.active) - return; - var frames = timeline.frames; - if (time < frames[0]) { - if (blend == core.MixBlend.setup || blend == core.MixBlend.first) - this.setAttachment(skeleton, slot, slot.data.attachmentName, attachments); - } - else { - var frameIndex; - if (time >= frames[frames.length - 1]) - frameIndex = frames.length - 1; - else - frameIndex = core.Animation.binarySearch(frames, time) - 1; - this.setAttachment(skeleton, slot, timeline.attachmentNames[frameIndex], attachments); - } - if (slot.attachmentState <= this.unkeyedState) - slot.attachmentState = this.unkeyedState + AnimationState.SETUP; - }; - AnimationState.prototype.setAttachment = function (skeleton, slot, attachmentName, attachments) { - slot.attachment = attachmentName == null ? null : skeleton.getAttachment(slot.data.index, attachmentName); - if (attachments) - slot.attachmentState = this.unkeyedState + AnimationState.CURRENT; - }; - AnimationState.prototype.applyRotateTimeline = function (timeline, skeleton, time, alpha, blend, timelinesRotation, i, firstFrame) { - if (firstFrame) - timelinesRotation[i] = 0; - if (alpha == 1) { - timeline.apply(skeleton, 0, time, null, 1, blend, core.MixDirection.mixIn); - return; - } - var rotateTimeline = timeline; - var frames = rotateTimeline.frames; - var bone = skeleton.bones[rotateTimeline.boneIndex]; - if (!bone.active) - return; - var r1 = 0, r2 = 0; - if (time < frames[0]) { - switch (blend) { - case core.MixBlend.setup: - bone.rotation = bone.data.rotation; - default: - return; - case core.MixBlend.first: - r1 = bone.rotation; - r2 = bone.data.rotation; - } - } - else { - r1 = blend == core.MixBlend.setup ? bone.data.rotation : bone.rotation; - if (time >= frames[frames.length - core.RotateTimeline.ENTRIES]) - r2 = bone.data.rotation + frames[frames.length + core.RotateTimeline.PREV_ROTATION]; - else { - var frame = core.Animation.binarySearch(frames, time, core.RotateTimeline.ENTRIES); - var prevRotation = frames[frame + core.RotateTimeline.PREV_ROTATION]; - var frameTime = frames[frame]; - var percent = rotateTimeline.getCurvePercent((frame >> 1) - 1, 1 - (time - frameTime) / (frames[frame + core.RotateTimeline.PREV_TIME] - frameTime)); - r2 = frames[frame + core.RotateTimeline.ROTATION] - prevRotation; - r2 -= (16384 - ((16384.499999999996 - r2 / 360) | 0)) * 360; - r2 = prevRotation + r2 * percent + bone.data.rotation; - r2 -= (16384 - ((16384.499999999996 - r2 / 360) | 0)) * 360; - } - } - var total = 0, diff = r2 - r1; - diff -= (16384 - ((16384.499999999996 - diff / 360) | 0)) * 360; - if (diff == 0) { - total = timelinesRotation[i]; - } - else { - var lastTotal = 0, lastDiff = 0; - if (firstFrame) { - lastTotal = 0; - lastDiff = diff; - } - else { - lastTotal = timelinesRotation[i]; - lastDiff = timelinesRotation[i + 1]; - } - var current = diff > 0, dir = lastTotal >= 0; - if (core.MathUtils.signum(lastDiff) != core.MathUtils.signum(diff) && Math.abs(lastDiff) <= 90) { - if (Math.abs(lastTotal) > 180) - lastTotal += 360 * core.MathUtils.signum(lastTotal); - dir = current; - } - total = diff + lastTotal - lastTotal % 360; - if (dir != current) - total += 360 * core.MathUtils.signum(lastTotal); - timelinesRotation[i] = total; - } - timelinesRotation[i + 1] = diff; - r1 += total * alpha; - bone.rotation = r1 - (16384 - ((16384.499999999996 - r1 / 360) | 0)) * 360; - }; - AnimationState.prototype.queueEvents = function (entry, animationTime) { - var animationStart = entry.animationStart, animationEnd = entry.animationEnd; - var duration = animationEnd - animationStart; - var trackLastWrapped = entry.trackLast % duration; - var events = this.events; - var i = 0, n = events.length; - for (; i < n; i++) { - var event_1 = events[i]; - if (event_1.time < trackLastWrapped) - break; - if (event_1.time > animationEnd) - continue; - this.queue.event(entry, event_1); - } - var complete = false; - if (entry.loop) - complete = duration == 0 || trackLastWrapped > entry.trackTime % duration; - else - complete = animationTime >= animationEnd && entry.animationLast < animationEnd; - if (complete) - this.queue.complete(entry); - for (; i < n; i++) { - var event_2 = events[i]; - if (event_2.time < animationStart) - continue; - this.queue.event(entry, events[i]); - } - }; - AnimationState.prototype.clearTracks = function () { - var oldDrainDisabled = this.queue.drainDisabled; - this.queue.drainDisabled = true; - for (var i = 0, n = this.tracks.length; i < n; i++) - this.clearTrack(i); - this.tracks.length = 0; - this.queue.drainDisabled = oldDrainDisabled; - this.queue.drain(); - }; - AnimationState.prototype.clearTrack = function (trackIndex) { - if (trackIndex >= this.tracks.length) - return; - var current = this.tracks[trackIndex]; - if (current == null) - return; - this.queue.end(current); - this.disposeNext(current); - var entry = current; - while (true) { - var from = entry.mixingFrom; - if (from == null) - break; - this.queue.end(from); - entry.mixingFrom = null; - entry.mixingTo = null; - entry = from; - } - this.tracks[current.trackIndex] = null; - this.queue.drain(); - }; - AnimationState.prototype.setCurrent = function (index, current, interrupt) { - var from = this.expandToIndex(index); - this.tracks[index] = current; - if (from != null) { - if (interrupt) - this.queue.interrupt(from); - current.mixingFrom = from; - from.mixingTo = current; - current.mixTime = 0; - if (from.mixingFrom != null && from.mixDuration > 0) - current.interruptAlpha *= Math.min(1, from.mixTime / from.mixDuration); - from.timelinesRotation.length = 0; - } - this.queue.start(current); - }; - AnimationState.prototype.setAnimation = function (trackIndex, animationName, loop) { - var animation = this.data.skeletonData.findAnimation(animationName); - if (animation == null) - throw new Error("Animation not found: " + animationName); - return this.setAnimationWith(trackIndex, animation, loop); - }; - AnimationState.prototype.setAnimationWith = function (trackIndex, animation, loop) { - if (animation == null) - throw new Error("animation cannot be null."); - var interrupt = true; - var current = this.expandToIndex(trackIndex); - if (current != null) { - if (current.nextTrackLast == -1) { - this.tracks[trackIndex] = current.mixingFrom; - this.queue.interrupt(current); - this.queue.end(current); - this.disposeNext(current); - current = current.mixingFrom; - interrupt = false; - } - else - this.disposeNext(current); - } - var entry = this.trackEntry(trackIndex, animation, loop, current); - this.setCurrent(trackIndex, entry, interrupt); - this.queue.drain(); - return entry; - }; - AnimationState.prototype.addAnimation = function (trackIndex, animationName, loop, delay) { - var animation = this.data.skeletonData.findAnimation(animationName); - if (animation == null) - throw new Error("Animation not found: " + animationName); - return this.addAnimationWith(trackIndex, animation, loop, delay); - }; - AnimationState.prototype.addAnimationWith = function (trackIndex, animation, loop, delay) { - if (animation == null) - throw new Error("animation cannot be null."); - var last = this.expandToIndex(trackIndex); - if (last != null) { - while (last.next != null) - last = last.next; - } - var entry = this.trackEntry(trackIndex, animation, loop, last); - if (last == null) { - this.setCurrent(trackIndex, entry, true); - this.queue.drain(); - } - else { - last.next = entry; - if (delay <= 0) { - var duration = last.animationEnd - last.animationStart; - if (duration != 0) { - if (last.loop) - delay += duration * (1 + ((last.trackTime / duration) | 0)); - else - delay += Math.max(duration, last.trackTime); - delay -= this.data.getMix(last.animation, animation); - } - else - delay = last.trackTime; - } - } - entry.delay = delay; - return entry; - }; - AnimationState.prototype.setEmptyAnimation = function (trackIndex, mixDuration) { - var entry = this.setAnimationWith(trackIndex, AnimationState.emptyAnimation, false); - entry.mixDuration = mixDuration; - entry.trackEnd = mixDuration; - return entry; - }; - AnimationState.prototype.addEmptyAnimation = function (trackIndex, mixDuration, delay) { - if (delay <= 0) - delay -= mixDuration; - var entry = this.addAnimationWith(trackIndex, AnimationState.emptyAnimation, false, delay); - entry.mixDuration = mixDuration; - entry.trackEnd = mixDuration; - return entry; - }; - AnimationState.prototype.setEmptyAnimations = function (mixDuration) { - var oldDrainDisabled = this.queue.drainDisabled; - this.queue.drainDisabled = true; - for (var i = 0, n = this.tracks.length; i < n; i++) { - var current = this.tracks[i]; - if (current != null) - this.setEmptyAnimation(current.trackIndex, mixDuration); - } - this.queue.drainDisabled = oldDrainDisabled; - this.queue.drain(); - }; - AnimationState.prototype.expandToIndex = function (index) { - if (index < this.tracks.length) - return this.tracks[index]; - core.Utils.ensureArrayCapacity(this.tracks, index + 1, null); - this.tracks.length = index + 1; - return null; - }; - AnimationState.prototype.trackEntry = function (trackIndex, animation, loop, last) { - var entry = this.trackEntryPool.obtain(); - entry.trackIndex = trackIndex; - entry.animation = animation; - entry.loop = loop; - entry.holdPrevious = false; - entry.eventThreshold = 0; - entry.attachmentThreshold = 0; - entry.drawOrderThreshold = 0; - entry.animationStart = 0; - entry.animationEnd = animation.duration; - entry.animationLast = -1; - entry.nextAnimationLast = -1; - entry.delay = 0; - entry.trackTime = 0; - entry.trackLast = -1; - entry.nextTrackLast = -1; - entry.trackEnd = Number.MAX_VALUE; - entry.timeScale = 1; - entry.alpha = 1; - entry.interruptAlpha = 1; - entry.mixTime = 0; - entry.mixDuration = last == null ? 0 : this.data.getMix(last.animation, animation); - entry.mixBlend = core.MixBlend.replace; - return entry; - }; - AnimationState.prototype.disposeNext = function (entry) { - var next = entry.next; - while (next != null) { - this.queue.dispose(next); - next = next.next; - } - entry.next = null; - }; - AnimationState.prototype._animationsChanged = function () { - this.animationsChanged = false; - this.propertyIDs.clear(); - for (var i = 0, n = this.tracks.length; i < n; i++) { - var entry = this.tracks[i]; - if (entry == null) - continue; - while (entry.mixingFrom != null) - entry = entry.mixingFrom; - do { - if (entry.mixingFrom == null || entry.mixBlend != core.MixBlend.add) - this.computeHold(entry); - entry = entry.mixingTo; - } while (entry != null); - } - }; - AnimationState.prototype.computeHold = function (entry) { - var to = entry.mixingTo; - var timelines = entry.animation.timelines; - var timelinesCount = entry.animation.timelines.length; - var timelineMode = core.Utils.setArraySize(entry.timelineMode, timelinesCount); - entry.timelineHoldMix.length = 0; - var timelineDipMix = core.Utils.setArraySize(entry.timelineHoldMix, timelinesCount); - var propertyIDs = this.propertyIDs; - if (to != null && to.holdPrevious) { - for (var i = 0; i < timelinesCount; i++) { - timelineMode[i] = propertyIDs.add(timelines[i].getPropertyId()) ? AnimationState.HOLD_FIRST : AnimationState.HOLD_SUBSEQUENT; - } - return; - } - outer: for (var i = 0; i < timelinesCount; i++) { - var timeline = timelines[i]; - var id = timeline.getPropertyId(); - if (!propertyIDs.add(id)) - timelineMode[i] = AnimationState.SUBSEQUENT; - else if (to == null || timeline instanceof core.AttachmentTimeline || timeline instanceof core.DrawOrderTimeline - || timeline instanceof core.EventTimeline || !to.animation.hasTimeline(id)) { - timelineMode[i] = AnimationState.FIRST; - } - else { - for (var next = to.mixingTo; next != null; next = next.mixingTo) { - if (next.animation.hasTimeline(id)) - continue; - if (entry.mixDuration > 0) { - timelineMode[i] = AnimationState.HOLD_MIX; - timelineDipMix[i] = next; - continue outer; - } - break; - } - timelineMode[i] = AnimationState.HOLD_FIRST; - } - } - }; - AnimationState.prototype.getCurrent = function (trackIndex) { - if (trackIndex >= this.tracks.length) - return null; - return this.tracks[trackIndex]; - }; - AnimationState.prototype.addListener = function (listener) { - if (listener == null) - throw new Error("listener cannot be null."); - this.listeners.push(listener); - }; - AnimationState.prototype.removeListener = function (listener) { - var index = this.listeners.indexOf(listener); - if (index >= 0) - this.listeners.splice(index, 1); - }; - AnimationState.prototype.clearListeners = function () { - this.listeners.length = 0; - }; - AnimationState.prototype.clearListenerNotifications = function () { - this.queue.clear(); - }; - AnimationState.prototype.setAnimationByName = function (trackIndex, animationName, loop) { - if (!AnimationState.deprecatedWarning1) { - AnimationState.deprecatedWarning1 = true; - console.warn("Spine Deprecation Warning: AnimationState.setAnimationByName is deprecated, please use setAnimation from now on."); - } - this.setAnimation(trackIndex, animationName, loop); - }; - AnimationState.prototype.addAnimationByName = function (trackIndex, animationName, loop, delay) { - if (!AnimationState.deprecatedWarning2) { - AnimationState.deprecatedWarning2 = true; - console.warn("Spine Deprecation Warning: AnimationState.addAnimationByName is deprecated, please use addAnimation from now on."); - } - this.addAnimation(trackIndex, animationName, loop, delay); - }; - AnimationState.prototype.hasAnimation = function (animationName) { - var animation = this.data.skeletonData.findAnimation(animationName); - return animation !== null; - }; - AnimationState.prototype.hasAnimationByName = function (animationName) { - if (!AnimationState.deprecatedWarning3) { - AnimationState.deprecatedWarning3 = true; - console.warn("Spine Deprecation Warning: AnimationState.hasAnimationByName is deprecated, please use hasAnimation from now on."); - } - return this.hasAnimation(animationName); - }; - AnimationState.emptyAnimation = new core.Animation("", [], 0); - AnimationState.SUBSEQUENT = 0; - AnimationState.FIRST = 1; - AnimationState.HOLD_SUBSEQUENT = 2; - AnimationState.HOLD_FIRST = 3; - AnimationState.HOLD_MIX = 4; - AnimationState.SETUP = 1; - AnimationState.CURRENT = 2; - AnimationState.deprecatedWarning1 = false; - AnimationState.deprecatedWarning2 = false; - AnimationState.deprecatedWarning3 = false; - return AnimationState; - }()); - core.AnimationState = AnimationState; - var TrackEntry = (function () { - function TrackEntry() { - this.mixBlend = core.MixBlend.replace; - this.timelineMode = new Array(); - this.timelineHoldMix = new Array(); - this.timelinesRotation = new Array(); - } - TrackEntry.prototype.reset = function () { - this.next = null; - this.mixingFrom = null; - this.mixingTo = null; - this.animation = null; - this.listener = null; - this.timelineMode.length = 0; - this.timelineHoldMix.length = 0; - this.timelinesRotation.length = 0; - }; - TrackEntry.prototype.getAnimationTime = function () { - if (this.loop) { - var duration = this.animationEnd - this.animationStart; - if (duration == 0) - return this.animationStart; - return (this.trackTime % duration) + this.animationStart; - } - return Math.min(this.trackTime + this.animationStart, this.animationEnd); - }; - TrackEntry.prototype.setAnimationLast = function (animationLast) { - this.animationLast = animationLast; - this.nextAnimationLast = animationLast; - }; - TrackEntry.prototype.isComplete = function () { - return this.trackTime >= this.animationEnd - this.animationStart; - }; - TrackEntry.prototype.resetRotationDirections = function () { - this.timelinesRotation.length = 0; - }; - Object.defineProperty(TrackEntry.prototype, "time", { - get: function () { - if (!TrackEntry.deprecatedWarning1) { - TrackEntry.deprecatedWarning1 = true; - console.warn("Spine Deprecation Warning: TrackEntry.time is deprecated, please use trackTime from now on."); - } - return this.trackTime; - }, - set: function (value) { - if (!TrackEntry.deprecatedWarning1) { - TrackEntry.deprecatedWarning1 = true; - console.warn("Spine Deprecation Warning: TrackEntry.time is deprecated, please use trackTime from now on."); - } - this.trackTime = value; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TrackEntry.prototype, "endTime", { - get: function () { - if (!TrackEntry.deprecatedWarning2) { - TrackEntry.deprecatedWarning2 = true; - console.warn("Spine Deprecation Warning: TrackEntry.endTime is deprecated, please use trackEnd from now on."); - } - return this.trackTime; - }, - set: function (value) { - if (!TrackEntry.deprecatedWarning2) { - TrackEntry.deprecatedWarning2 = true; - console.warn("Spine Deprecation Warning: TrackEntry.endTime is deprecated, please use trackEnd from now on."); - } - this.trackTime = value; - }, - enumerable: false, - configurable: true - }); - TrackEntry.prototype.loopsCount = function () { - return Math.floor(this.trackTime / this.trackEnd); - }; - TrackEntry.deprecatedWarning1 = false; - TrackEntry.deprecatedWarning2 = false; - return TrackEntry; - }()); - core.TrackEntry = TrackEntry; - var EventQueue = (function () { - function EventQueue(animState) { - this.objects = []; - this.drainDisabled = false; - this.animState = animState; - } - EventQueue.prototype.start = function (entry) { - this.objects.push(EventType.start); - this.objects.push(entry); - this.animState.animationsChanged = true; - }; - EventQueue.prototype.interrupt = function (entry) { - this.objects.push(EventType.interrupt); - this.objects.push(entry); - }; - EventQueue.prototype.end = function (entry) { - this.objects.push(EventType.end); - this.objects.push(entry); - this.animState.animationsChanged = true; - }; - EventQueue.prototype.dispose = function (entry) { - this.objects.push(EventType.dispose); - this.objects.push(entry); - }; - EventQueue.prototype.complete = function (entry) { - this.objects.push(EventType.complete); - this.objects.push(entry); - }; - EventQueue.prototype.event = function (entry, event) { - this.objects.push(EventType.event); - this.objects.push(entry); - this.objects.push(event); - }; - EventQueue.prototype.deprecateStuff = function () { - if (!EventQueue.deprecatedWarning1) { - EventQueue.deprecatedWarning1 = true; - console.warn("Spine Deprecation Warning: onComplete, onStart, onEnd, onEvent art deprecated, please use listeners from now on. 'state.addListener({ complete: function(track, event) { } })'"); - } - return true; - }; - EventQueue.prototype.drain = function () { - if (this.drainDisabled) - return; - this.drainDisabled = true; - var objects = this.objects; - var listeners = this.animState.listeners; - for (var i = 0; i < objects.length; i += 2) { - var type = objects[i]; - var entry = objects[i + 1]; - switch (type) { - case EventType.start: - if (entry.listener != null && entry.listener.start) - entry.listener.start(entry); - for (var ii = 0; ii < listeners.length; ii++) - if (listeners[ii].start) - listeners[ii].start(entry); - entry.onStart && this.deprecateStuff() && entry.onStart(entry.trackIndex); - this.animState.onStart && this.deprecateStuff() && this.deprecateStuff && this.animState.onStart(entry.trackIndex); - break; - case EventType.interrupt: - if (entry.listener != null && entry.listener.interrupt) - entry.listener.interrupt(entry); - for (var ii = 0; ii < listeners.length; ii++) - if (listeners[ii].interrupt) - listeners[ii].interrupt(entry); - break; - case EventType.end: - if (entry.listener != null && entry.listener.end) - entry.listener.end(entry); - for (var ii = 0; ii < listeners.length; ii++) - if (listeners[ii].end) - listeners[ii].end(entry); - entry.onEnd && this.deprecateStuff() && entry.onEnd(entry.trackIndex); - this.animState.onEnd && this.deprecateStuff() && this.animState.onEnd(entry.trackIndex); - case EventType.dispose: - if (entry.listener != null && entry.listener.dispose) - entry.listener.dispose(entry); - for (var ii = 0; ii < listeners.length; ii++) - if (listeners[ii].dispose) - listeners[ii].dispose(entry); - this.animState.trackEntryPool.free(entry); - break; - case EventType.complete: - if (entry.listener != null && entry.listener.complete) - entry.listener.complete(entry); - for (var ii = 0; ii < listeners.length; ii++) - if (listeners[ii].complete) - listeners[ii].complete(entry); - var count = core.MathUtils.toInt(entry.loopsCount()); - entry.onComplete && this.deprecateStuff() && entry.onComplete(entry.trackIndex, count); - this.animState.onComplete && this.deprecateStuff() && this.animState.onComplete(entry.trackIndex, count); - break; - case EventType.event: - var event_3 = objects[i++ + 2]; - if (entry.listener != null && entry.listener.event) - entry.listener.event(entry, event_3); - for (var ii = 0; ii < listeners.length; ii++) - if (listeners[ii].event) - listeners[ii].event(entry, event_3); - entry.onEvent && this.deprecateStuff() && entry.onEvent(entry.trackIndex, event_3); - this.animState.onEvent && this.deprecateStuff() && this.animState.onEvent(entry.trackIndex, event_3); - break; - } - } - this.clear(); - this.drainDisabled = false; - }; - EventQueue.prototype.clear = function () { - this.objects.length = 0; - }; - EventQueue.deprecatedWarning1 = false; - return EventQueue; - }()); - core.EventQueue = EventQueue; - var EventType; - (function (EventType) { - EventType[EventType["start"] = 0] = "start"; - EventType[EventType["interrupt"] = 1] = "interrupt"; - EventType[EventType["end"] = 2] = "end"; - EventType[EventType["dispose"] = 3] = "dispose"; - EventType[EventType["complete"] = 4] = "complete"; - EventType[EventType["event"] = 5] = "event"; - })(EventType = core.EventType || (core.EventType = {})); - var AnimationStateAdapter = (function () { - function AnimationStateAdapter() { - } - AnimationStateAdapter.prototype.start = function (entry) { - }; - AnimationStateAdapter.prototype.interrupt = function (entry) { - }; - AnimationStateAdapter.prototype.end = function (entry) { - }; - AnimationStateAdapter.prototype.dispose = function (entry) { - }; - AnimationStateAdapter.prototype.complete = function (entry) { - }; - AnimationStateAdapter.prototype.event = function (entry, event) { - }; - return AnimationStateAdapter; - }()); - core.AnimationStateAdapter = AnimationStateAdapter; - })(pixi_spine.core || (pixi_spine.core = {})); - })(pixi_spine || (pixi_spine = {})); - var pixi_spine; - (function (pixi_spine) { - (function (core) { - var AnimationStateData = (function () { - function AnimationStateData(skeletonData) { - this.animationToMixTime = {}; - this.defaultMix = 0; - if (skeletonData == null) - throw new Error("skeletonData cannot be null."); - this.skeletonData = skeletonData; - } - AnimationStateData.prototype.setMix = function (fromName, toName, duration) { - var from = this.skeletonData.findAnimation(fromName); - if (from == null) - throw new Error("Animation not found: " + fromName); - var to = this.skeletonData.findAnimation(toName); - if (to == null) - throw new Error("Animation not found: " + toName); - this.setMixWith(from, to, duration); - }; - AnimationStateData.prototype.setMixByName = function (fromName, toName, duration) { - if (!AnimationStateData.deprecatedWarning1) { - AnimationStateData.deprecatedWarning1 = true; - console.warn("Deprecation Warning: AnimationStateData.setMixByName is deprecated, please use setMix from now on."); - } - this.setMix(fromName, toName, duration); - }; - AnimationStateData.prototype.setMixWith = function (from, to, duration) { - if (from == null) - throw new Error("from cannot be null."); - if (to == null) - throw new Error("to cannot be null."); - var key = from.name + "." + to.name; - this.animationToMixTime[key] = duration; - }; - AnimationStateData.prototype.getMix = function (from, to) { - var key = from.name + "." + to.name; - var value = this.animationToMixTime[key]; - return value === undefined ? this.defaultMix : value; - }; - AnimationStateData.deprecatedWarning1 = false; - return AnimationStateData; - }()); - core.AnimationStateData = AnimationStateData; - })(pixi_spine.core || (pixi_spine.core = {})); - })(pixi_spine || (pixi_spine = {})); - var pixi_spine; - (function (pixi_spine) { - (function (core) { - var AtlasAttachmentLoader = (function () { - function AtlasAttachmentLoader(atlas) { - this.atlas = atlas; - } - AtlasAttachmentLoader.prototype.newRegionAttachment = function (skin, name, path) { - var region = this.atlas.findRegion(path); - if (region == null) - throw new Error("Region not found in atlas: " + path + " (region attachment: " + name + ")"); - var attachment = new core.RegionAttachment(name); - attachment.region = region; - return attachment; - }; - AtlasAttachmentLoader.prototype.newMeshAttachment = function (skin, name, path) { - var region = this.atlas.findRegion(path); - if (region == null) - throw new Error("Region not found in atlas: " + path + " (mesh attachment: " + name + ")"); - var attachment = new core.MeshAttachment(name); - attachment.region = region; - return attachment; - }; - AtlasAttachmentLoader.prototype.newBoundingBoxAttachment = function (skin, name) { - return new core.BoundingBoxAttachment(name); - }; - AtlasAttachmentLoader.prototype.newPathAttachment = function (skin, name) { - return new core.PathAttachment(name); - }; - AtlasAttachmentLoader.prototype.newPointAttachment = function (skin, name) { - return new core.PointAttachment(name); - }; - AtlasAttachmentLoader.prototype.newClippingAttachment = function (skin, name) { - return new core.ClippingAttachment(name); - }; - return AtlasAttachmentLoader; - }()); - core.AtlasAttachmentLoader = AtlasAttachmentLoader; - })(pixi_spine.core || (pixi_spine.core = {})); - })(pixi_spine || (pixi_spine = {})); - var pixi_spine; - (function (pixi_spine) { - (function (core) { - (function (BlendMode) { - BlendMode[BlendMode["Normal"] = 0] = "Normal"; - BlendMode[BlendMode["Additive"] = 1] = "Additive"; - BlendMode[BlendMode["Multiply"] = 2] = "Multiply"; - BlendMode[BlendMode["Screen"] = 3] = "Screen"; - })(core.BlendMode || (core.BlendMode = {})); - })(pixi_spine.core || (pixi_spine.core = {})); - })(pixi_spine || (pixi_spine = {})); - var pixi_spine; - (function (pixi_spine) { - (function (core) { - var Bone = (function () { - function Bone(data, skeleton, parent) { - this.matrix = new PIXI.Matrix(); - this.children = new Array(); - this.x = 0; - this.y = 0; - this.rotation = 0; - this.scaleX = 0; - this.scaleY = 0; - this.shearX = 0; - this.shearY = 0; - this.ax = 0; - this.ay = 0; - this.arotation = 0; - this.ascaleX = 0; - this.ascaleY = 0; - this.ashearX = 0; - this.ashearY = 0; - this.appliedValid = false; - this.sorted = false; - this.active = false; - if (data == null) - throw new Error("data cannot be null."); - if (skeleton == null) - throw new Error("skeleton cannot be null."); - this.data = data; - this.skeleton = skeleton; - this.parent = parent; - this.setToSetupPose(); - } - Object.defineProperty(Bone.prototype, "worldX", { - get: function () { - return this.matrix.tx; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Bone.prototype, "worldY", { - get: function () { - return this.matrix.ty; - }, - enumerable: false, - configurable: true - }); - Bone.prototype.isActive = function () { - return this.active; - }; - Bone.prototype.update = function () { - this.updateWorldTransformWith(this.x, this.y, this.rotation, this.scaleX, this.scaleY, this.shearX, this.shearY); - }; - Bone.prototype.updateWorldTransform = function () { - this.updateWorldTransformWith(this.x, this.y, this.rotation, this.scaleX, this.scaleY, this.shearX, this.shearY); - }; - Bone.prototype.updateWorldTransformWith = function (x, y, rotation, scaleX, scaleY, shearX, shearY) { - this.ax = x; - this.ay = y; - this.arotation = rotation; - this.ascaleX = scaleX; - this.ascaleY = scaleY; - this.ashearX = shearX; - this.ashearY = shearY; - this.appliedValid = true; - var parent = this.parent; - var m = this.matrix; - var sx = this.skeleton.scaleX; - var sy = Bone.yDown ? -this.skeleton.scaleY : this.skeleton.scaleY; - if (parent == null) { - var skeleton = this.skeleton; - var rotationY = rotation + 90 + shearY; - m.a = core.MathUtils.cosDeg(rotation + shearX) * scaleX * sx; - m.c = core.MathUtils.cosDeg(rotationY) * scaleY * sx; - m.b = core.MathUtils.sinDeg(rotation + shearX) * scaleX * sy; - m.d = core.MathUtils.sinDeg(rotationY) * scaleY * sy; - m.tx = x * sx + skeleton.x; - m.ty = y * sy + skeleton.y; - return; - } - var pa = parent.matrix.a, pb = parent.matrix.c, pc = parent.matrix.b, pd = parent.matrix.d; - m.tx = pa * x + pb * y + parent.matrix.tx; - m.ty = pc * x + pd * y + parent.matrix.ty; - switch (this.data.transformMode) { - case core.TransformMode.Normal: { - var rotationY = rotation + 90 + shearY; - var la = core.MathUtils.cosDeg(rotation + shearX) * scaleX; - var lb = core.MathUtils.cosDeg(rotationY) * scaleY; - var lc = core.MathUtils.sinDeg(rotation + shearX) * scaleX; - var ld = core.MathUtils.sinDeg(rotationY) * scaleY; - m.a = pa * la + pb * lc; - m.c = pa * lb + pb * ld; - m.b = pc * la + pd * lc; - m.d = pc * lb + pd * ld; - return; - } - case core.TransformMode.OnlyTranslation: { - var rotationY = rotation + 90 + shearY; - m.a = core.MathUtils.cosDeg(rotation + shearX) * scaleX; - m.c = core.MathUtils.cosDeg(rotationY) * scaleY; - m.b = core.MathUtils.sinDeg(rotation + shearX) * scaleX; - m.d = core.MathUtils.sinDeg(rotationY) * scaleY; - break; - } - case core.TransformMode.NoRotationOrReflection: { - var s = pa * pa + pc * pc; - var prx = 0; - if (s > 0.0001) { - s = Math.abs(pa * pd - pb * pc) / s; - pa /= this.skeleton.scaleX; - pc /= this.skeleton.scaleY; - pb = pc * s; - pd = pa * s; - prx = Math.atan2(pc, pa) * core.MathUtils.radDeg; - } - else { - pa = 0; - pc = 0; - prx = 90 - Math.atan2(pd, pb) * core.MathUtils.radDeg; - } - var rx = rotation + shearX - prx; - var ry = rotation + shearY - prx + 90; - var la = core.MathUtils.cosDeg(rx) * scaleX; - var lb = core.MathUtils.cosDeg(ry) * scaleY; - var lc = core.MathUtils.sinDeg(rx) * scaleX; - var ld = core.MathUtils.sinDeg(ry) * scaleY; - m.a = pa * la - pb * lc; - m.c = pa * lb - pb * ld; - m.b = pc * la + pd * lc; - m.d = pc * lb + pd * ld; - break; - } - case core.TransformMode.NoScale: - case core.TransformMode.NoScaleOrReflection: { - var cos = core.MathUtils.cosDeg(rotation); - var sin = core.MathUtils.sinDeg(rotation); - var za = (pa * cos + pb * sin) / sx; - var zc = (pc * cos + pd * sin) / sy; - var s = Math.sqrt(za * za + zc * zc); - if (s > 0.00001) - s = 1 / s; - za *= s; - zc *= s; - s = Math.sqrt(za * za + zc * zc); - if (this.data.transformMode == core.TransformMode.NoScale - && (pa * pd - pb * pc < 0) != (Bone.yDown ? - (this.skeleton.scaleX < 0 != this.skeleton.scaleY > 0) : - (this.skeleton.scaleX < 0 != this.skeleton.scaleY < 0))) - s = -s; - var r = Math.PI / 2 + Math.atan2(zc, za); - var zb = Math.cos(r) * s; - var zd = Math.sin(r) * s; - var la = core.MathUtils.cosDeg(shearX) * scaleX; - var lb = core.MathUtils.cosDeg(90 + shearY) * scaleY; - var lc = core.MathUtils.sinDeg(shearX) * scaleX; - var ld = core.MathUtils.sinDeg(90 + shearY) * scaleY; - m.a = za * la + zb * lc; - m.c = za * lb + zb * ld; - m.b = zc * la + zd * lc; - m.d = zc * lb + zd * ld; - break; - } - } - m.a *= sx; - m.c *= sx; - m.b *= sy; - m.d *= sy; - }; - Bone.prototype.setToSetupPose = function () { - var data = this.data; - this.x = data.x; - this.y = data.y; - this.rotation = data.rotation; - this.scaleX = data.scaleX; - this.scaleY = data.scaleY; - this.shearX = data.shearX; - this.shearY = data.shearY; - }; - Bone.prototype.getWorldRotationX = function () { - return Math.atan2(this.matrix.b, this.matrix.a) * core.MathUtils.radDeg; - }; - Bone.prototype.getWorldRotationY = function () { - return Math.atan2(this.matrix.d, this.matrix.c) * core.MathUtils.radDeg; - }; - Bone.prototype.getWorldScaleX = function () { - var m = this.matrix; - return Math.sqrt(m.a * m.a + m.c * m.c); - }; - Bone.prototype.getWorldScaleY = function () { - var m = this.matrix; - return Math.sqrt(m.b * m.b + m.d * m.d); - }; - Bone.prototype.updateAppliedTransform = function () { - this.appliedValid = true; - var parent = this.parent; - var m = this.matrix; - if (parent == null) { - this.ax = m.tx; - this.ay = m.ty; - this.arotation = Math.atan2(m.b, m.a) * core.MathUtils.radDeg; - this.ascaleX = Math.sqrt(m.a * m.a + m.b * m.b); - this.ascaleY = Math.sqrt(m.c * m.c + m.d * m.d); - this.ashearX = 0; - this.ashearY = Math.atan2(m.a * m.c + m.b * m.d, m.a * m.d - m.b * m.c) * core.MathUtils.radDeg; - return; - } - var pm = parent.matrix; - var pid = 1 / (pm.a * pm.d - pm.b * pm.c); - var dx = m.tx - pm.tx, dy = m.ty - pm.ty; - this.ax = (dx * pm.d * pid - dy * pm.c * pid); - this.ay = (dy * pm.a * pid - dx * pm.b * pid); - var ia = pid * pm.d; - var id = pid * pm.a; - var ib = pid * pm.c; - var ic = pid * pm.b; - var ra = ia * m.a - ib * m.b; - var rb = ia * m.c - ib * m.d; - var rc = id * m.b - ic * m.a; - var rd = id * m.d - ic * m.c; - this.ashearX = 0; - this.ascaleX = Math.sqrt(ra * ra + rc * rc); - if (this.ascaleX > 0.0001) { - var det = ra * rd - rb * rc; - this.ascaleY = det / this.ascaleX; - this.ashearY = Math.atan2(ra * rb + rc * rd, det) * core.MathUtils.radDeg; - this.arotation = Math.atan2(rc, ra) * core.MathUtils.radDeg; - } - else { - this.ascaleX = 0; - this.ascaleY = Math.sqrt(rb * rb + rd * rd); - this.ashearY = 0; - this.arotation = 90 - Math.atan2(rd, rb) * core.MathUtils.radDeg; - } - }; - Bone.prototype.worldToLocal = function (world) { - var m = this.matrix; - var a = m.a, b = m.c, c = m.b, d = m.d; - var invDet = 1 / (a * d - b * c); - var x = world.x - m.tx, y = world.y - m.ty; - world.x = (x * d * invDet - y * b * invDet); - world.y = (y * a * invDet - x * c * invDet); - return world; - }; - Bone.prototype.localToWorld = function (local) { - var m = this.matrix; - var x = local.x, y = local.y; - local.x = x * m.a + y * m.c + m.tx; - local.y = x * m.b + y * m.d + m.ty; - return local; - }; - Bone.prototype.worldToLocalRotation = function (worldRotation) { - var sin = core.MathUtils.sinDeg(worldRotation), cos = core.MathUtils.cosDeg(worldRotation); - var mat = this.matrix; - return Math.atan2(mat.a * sin - mat.b * cos, mat.d * cos - mat.c * sin) * core.MathUtils.radDeg; - }; - Bone.prototype.localToWorldRotation = function (localRotation) { - var sin = core.MathUtils.sinDeg(localRotation), cos = core.MathUtils.cosDeg(localRotation); - var mat = this.matrix; - return Math.atan2(cos * mat.b + sin * mat.d, cos * mat.a + sin * mat.c) * core.MathUtils.radDeg; - }; - Bone.prototype.rotateWorld = function (degrees) { - var mat = this.matrix; - var a = mat.a, b = mat.c, c = mat.b, d = mat.d; - var cos = core.MathUtils.cosDeg(degrees), sin = core.MathUtils.sinDeg(degrees); - mat.a = cos * a - sin * c; - mat.c = cos * b - sin * d; - mat.b = sin * a + cos * c; - mat.d = sin * b + cos * d; - this.appliedValid = false; - }; - Bone.yDown = false; - return Bone; - }()); - core.Bone = Bone; - })(pixi_spine.core || (pixi_spine.core = {})); - })(pixi_spine || (pixi_spine = {})); - var pixi_spine; - (function (pixi_spine) { - (function (core) { - var BoneData = (function () { - function BoneData(index, name, parent) { - this.x = 0; - this.y = 0; - this.rotation = 0; - this.scaleX = 1; - this.scaleY = 1; - this.shearX = 0; - this.shearY = 0; - this.transformMode = TransformMode.Normal; - this.skinRequired = false; - this.color = new core.Color(); - if (index < 0) - throw new Error("index must be >= 0."); - if (name == null) - throw new Error("name cannot be null."); - this.index = index; - this.name = name; - this.parent = parent; - } - return BoneData; - }()); - core.BoneData = BoneData; - var TransformMode; - (function (TransformMode) { - TransformMode[TransformMode["Normal"] = 0] = "Normal"; - TransformMode[TransformMode["OnlyTranslation"] = 1] = "OnlyTranslation"; - TransformMode[TransformMode["NoRotationOrReflection"] = 2] = "NoRotationOrReflection"; - TransformMode[TransformMode["NoScale"] = 3] = "NoScale"; - TransformMode[TransformMode["NoScaleOrReflection"] = 4] = "NoScaleOrReflection"; - })(TransformMode = core.TransformMode || (core.TransformMode = {})); - })(pixi_spine.core || (pixi_spine.core = {})); - })(pixi_spine || (pixi_spine = {})); - var pixi_spine; - (function (pixi_spine) { - (function (core) { - var ConstraintData = (function () { - function ConstraintData(name, order, skinRequired) { - this.name = name; - this.order = order; - this.skinRequired = skinRequired; - } - return ConstraintData; - }()); - core.ConstraintData = ConstraintData; - })(pixi_spine.core || (pixi_spine.core = {})); - })(pixi_spine || (pixi_spine = {})); - var pixi_spine; - (function (pixi_spine) { - (function (core) { - var Event = (function () { - function Event(time, data) { - if (data == null) - throw new Error("data cannot be null."); - this.time = time; - this.data = data; - } - return Event; - }()); - core.Event = Event; - })(pixi_spine.core || (pixi_spine.core = {})); - })(pixi_spine || (pixi_spine = {})); - var pixi_spine; - (function (pixi_spine) { - (function (core) { - var EventData = (function () { - function EventData(name) { - this.name = name; - } - return EventData; - }()); - core.EventData = EventData; - })(pixi_spine.core || (pixi_spine.core = {})); - })(pixi_spine || (pixi_spine = {})); - var pixi_spine; - (function (pixi_spine) { - (function (core) { - var IkConstraint = (function () { - function IkConstraint(data, skeleton) { - this.bendDirection = 0; - this.compress = false; - this.stretch = false; - this.mix = 1; - this.softness = 0; - this.active = false; - if (data == null) - throw new Error("data cannot be null."); - if (skeleton == null) - throw new Error("skeleton cannot be null."); - this.data = data; - this.mix = data.mix; - this.softness = data.softness; - this.bendDirection = data.bendDirection; - this.compress = data.compress; - this.stretch = data.stretch; - this.bones = new Array(); - for (var i = 0; i < data.bones.length; i++) - this.bones.push(skeleton.findBone(data.bones[i].name)); - this.target = skeleton.findBone(data.target.name); - } - IkConstraint.prototype.isActive = function () { - return this.active; - }; - IkConstraint.prototype.apply = function () { - this.update(); - }; - IkConstraint.prototype.update = function () { - var target = this.target; - var bones = this.bones; - switch (bones.length) { - case 1: - this.apply1(bones[0], target.worldX, target.worldY, this.compress, this.stretch, this.data.uniform, this.mix); - break; - case 2: - this.apply2(bones[0], bones[1], target.worldX, target.worldY, this.bendDirection, this.stretch, this.softness, this.mix); - break; - } - }; - IkConstraint.prototype.apply1 = function (bone, targetX, targetY, compress, stretch, uniform, alpha) { - if (!bone.appliedValid) - bone.updateAppliedTransform(); - var p = bone.parent.matrix; - var pa = p.a, pb = p.c, pc = p.b, pd = p.d; - var rotationIK = -bone.ashearX - bone.arotation, tx = 0, ty = 0; - switch (bone.data.transformMode) { - case core.TransformMode.OnlyTranslation: - tx = targetX - bone.worldX; - ty = targetY - bone.worldY; - break; - case core.TransformMode.NoRotationOrReflection: - var s = Math.abs(pa * pd - pb * pc) / (pa * pa + pc * pc); - var sa = pa / bone.skeleton.scaleX; - var sc = pc / bone.skeleton.scaleY; - pb = -sc * s * bone.skeleton.scaleX; - pd = sa * s * bone.skeleton.scaleY; - rotationIK += Math.atan2(sc, sa) * core.MathUtils.radDeg; - default: - var x = targetX - p.tx, y = targetY - p.ty; - var d = pa * pd - pb * pc; - tx = (x * pd - y * pb) / d - bone.ax; - ty = (y * pa - x * pc) / d - bone.ay; - } - rotationIK += Math.atan2(ty, tx) * core.MathUtils.radDeg; - if (bone.ascaleX < 0) - rotationIK += 180; - if (rotationIK > 180) - rotationIK -= 360; - else if (rotationIK < -180) - rotationIK += 360; - var sx = bone.ascaleX, sy = bone.ascaleY; - if (compress || stretch) { - switch (bone.data.transformMode) { - case core.TransformMode.NoScale: - case core.TransformMode.NoScaleOrReflection: - tx = targetX - bone.worldX; - ty = targetY - bone.worldY; - } - var b = bone.data.length * sx, dd = Math.sqrt(tx * tx + ty * ty); - if ((compress && dd < b) || (stretch && dd > b) && b > 0.0001) { - var s = (dd / b - 1) * alpha + 1; - sx *= s; - if (uniform) - sy *= s; - } - } - bone.updateWorldTransformWith(bone.ax, bone.ay, bone.arotation + rotationIK * alpha, sx, sy, bone.ashearX, bone.ashearY); - }; - IkConstraint.prototype.apply2 = function (parent, child, targetX, targetY, bendDir, stretch, softness, alpha) { - if (alpha == 0) { - child.updateWorldTransform(); - return; - } - if (!parent.appliedValid) - parent.updateAppliedTransform(); - if (!child.appliedValid) - child.updateAppliedTransform(); - var px = parent.ax, py = parent.ay, psx = parent.ascaleX, sx = psx, psy = parent.ascaleY, csx = child.ascaleX; - var pmat = parent.matrix; - var os1 = 0, os2 = 0, s2 = 0; - if (psx < 0) { - psx = -psx; - os1 = 180; - s2 = -1; - } - else { - os1 = 0; - s2 = 1; - } - if (psy < 0) { - psy = -psy; - s2 = -s2; - } - if (csx < 0) { - csx = -csx; - os2 = 180; - } - else - os2 = 0; - var cx = child.ax, cy = 0, cwx = 0, cwy = 0, a = pmat.a, b = pmat.c, c = pmat.b, d = pmat.d; - var u = Math.abs(psx - psy) <= 0.0001; - if (!u) { - cy = 0; - cwx = a * cx + pmat.tx; - cwy = c * cx + pmat.ty; - } - else { - cy = child.ay; - cwx = a * cx + b * cy + pmat.tx; - cwy = c * cx + d * cy + pmat.ty; - } - var pp = parent.parent.matrix; - a = pp.a; - b = pp.c; - c = pp.b; - d = pp.d; - var id = 1 / (a * d - b * c), x = cwx - pp.tx, y = cwy - pp.ty; - var dx = (x * d - y * b) * id - px, dy = (y * a - x * c) * id - py; - var l1 = Math.sqrt(dx * dx + dy * dy), l2 = child.data.length * csx, a1, a2; - if (l1 < 0.0001) { - this.apply1(parent, targetX, targetY, false, stretch, false, alpha); - child.updateWorldTransformWith(cx, cy, 0, child.ascaleX, child.ascaleY, child.ashearX, child.ashearY); - return; - } - x = targetX - pp.tx; - y = targetY - pp.ty; - var tx = (x * d - y * b) * id - px, ty = (y * a - x * c) * id - py; - var dd = tx * tx + ty * ty; - if (softness != 0) { - softness *= psx * (csx + 1) / 2; - var td = Math.sqrt(dd), sd = td - l1 - l2 * psx + softness; - if (sd > 0) { - var p = Math.min(1, sd / (softness * 2)) - 1; - p = (sd - softness * (1 - p * p)) / td; - tx -= p * tx; - ty -= p * ty; - dd = tx * tx + ty * ty; - } - } - outer: if (u) { - l2 *= psx; - var cos = (dd - l1 * l1 - l2 * l2) / (2 * l1 * l2); - if (cos < -1) - cos = -1; - else if (cos > 1) { - cos = 1; - if (stretch) - sx *= (Math.sqrt(dd) / (l1 + l2) - 1) * alpha + 1; - } - a2 = Math.acos(cos) * bendDir; - a = l1 + l2 * cos; - b = l2 * Math.sin(a2); - a1 = Math.atan2(ty * a - tx * b, tx * a + ty * b); - } - else { - a = psx * l2; - b = psy * l2; - var aa = a * a, bb = b * b, ta = Math.atan2(ty, tx); - c = bb * l1 * l1 + aa * dd - aa * bb; - var c1 = -2 * bb * l1, c2 = bb - aa; - d = c1 * c1 - 4 * c2 * c; - if (d >= 0) { - var q = Math.sqrt(d); - if (c1 < 0) - q = -q; - q = -(c1 + q) / 2; - var r0 = q / c2, r1 = c / q; - var r = Math.abs(r0) < Math.abs(r1) ? r0 : r1; - if (r * r <= dd) { - y = Math.sqrt(dd - r * r) * bendDir; - a1 = ta - Math.atan2(y, r); - a2 = Math.atan2(y / psy, (r - l1) / psx); - break outer; - } - } - var minAngle = core.MathUtils.PI, minX = l1 - a, minDist = minX * minX, minY = 0; - var maxAngle = 0, maxX = l1 + a, maxDist = maxX * maxX, maxY = 0; - c = -a * l1 / (aa - bb); - if (c >= -1 && c <= 1) { - c = Math.acos(c); - x = a * Math.cos(c) + l1; - y = b * Math.sin(c); - d = x * x + y * y; - if (d < minDist) { - minAngle = c; - minDist = d; - minX = x; - minY = y; - } - if (d > maxDist) { - maxAngle = c; - maxDist = d; - maxX = x; - maxY = y; - } - } - if (dd <= (minDist + maxDist) / 2) { - a1 = ta - Math.atan2(minY * bendDir, minX); - a2 = minAngle * bendDir; - } - else { - a1 = ta - Math.atan2(maxY * bendDir, maxX); - a2 = maxAngle * bendDir; - } - } - var os = Math.atan2(cy, cx) * s2; - var rotation = parent.arotation; - a1 = (a1 - os) * core.MathUtils.radDeg + os1 - rotation; - if (a1 > 180) - a1 -= 360; - else if (a1 < -180) - a1 += 360; - parent.updateWorldTransformWith(px, py, rotation + a1 * alpha, sx, parent.ascaleY, 0, 0); - rotation = child.arotation; - a2 = ((a2 + os) * core.MathUtils.radDeg - child.ashearX) * s2 + os2 - rotation; - if (a2 > 180) - a2 -= 360; - else if (a2 < -180) - a2 += 360; - child.updateWorldTransformWith(cx, cy, rotation + a2 * alpha, child.ascaleX, child.ascaleY, child.ashearX, child.ashearY); - }; - return IkConstraint; - }()); - core.IkConstraint = IkConstraint; - })(pixi_spine.core || (pixi_spine.core = {})); - })(pixi_spine || (pixi_spine = {})); - var pixi_spine; - (function (pixi_spine) { - (function (core) { - var IkConstraintData = (function (_super) { - __extends(IkConstraintData, _super); - function IkConstraintData(name) { - var _this = _super.call(this, name, 0, false) || this; - _this.bones = new Array(); - _this.bendDirection = 1; - _this.compress = false; - _this.stretch = false; - _this.uniform = false; - _this.mix = 1; - _this.softness = 0; - return _this; - } - return IkConstraintData; - }(core.ConstraintData)); - core.IkConstraintData = IkConstraintData; - })(pixi_spine.core || (pixi_spine.core = {})); - })(pixi_spine || (pixi_spine = {})); - var pixi_spine; - (function (pixi_spine) { - (function (core) { - var PathConstraint = (function () { - function PathConstraint(data, skeleton) { - this.position = 0; - this.spacing = 0; - this.rotateMix = 0; - this.translateMix = 0; - this.spaces = new Array(); - this.positions = new Array(); - this.world = new Array(); - this.curves = new Array(); - this.lengths = new Array(); - this.segments = new Array(); - this.active = false; - if (data == null) - throw new Error("data cannot be null."); - if (skeleton == null) - throw new Error("skeleton cannot be null."); - this.data = data; - this.bones = new Array(); - for (var i = 0, n = data.bones.length; i < n; i++) - this.bones.push(skeleton.findBone(data.bones[i].name)); - this.target = skeleton.findSlot(data.target.name); - this.position = data.position; - this.spacing = data.spacing; - this.rotateMix = data.rotateMix; - this.translateMix = data.translateMix; - } - PathConstraint.prototype.isActive = function () { - return this.active; - }; - PathConstraint.prototype.apply = function () { - this.update(); - }; - PathConstraint.prototype.update = function () { - var attachment = this.target.getAttachment(); - if (!(attachment instanceof core.PathAttachment)) - return; - var rotateMix = this.rotateMix, translateMix = this.translateMix; - var translate = translateMix > 0, rotate = rotateMix > 0; - if (!translate && !rotate) - return; - var data = this.data; - var spacingMode = data.spacingMode; - var lengthSpacing = spacingMode == core.SpacingMode.Length; - var rotateMode = data.rotateMode; - var tangents = rotateMode == core.RotateMode.Tangent, scale = rotateMode == core.RotateMode.ChainScale; - var boneCount = this.bones.length, spacesCount = tangents ? boneCount : boneCount + 1; - var bones = this.bones; - var spaces = core.Utils.setArraySize(this.spaces, spacesCount), lengths = null; - var spacing = this.spacing; - if (scale || lengthSpacing) { - if (scale) - lengths = core.Utils.setArraySize(this.lengths, boneCount); - for (var i = 0, n = spacesCount - 1; i < n;) { - var bone = bones[i]; - var setupLength = bone.data.length; - if (setupLength < PathConstraint.epsilon) { - if (scale) - lengths[i] = 0; - spaces[++i] = 0; - } - else { - var x = setupLength * bone.matrix.a, y = setupLength * bone.matrix.b; - var length_1 = Math.sqrt(x * x + y * y); - if (scale) - lengths[i] = length_1; - spaces[++i] = (lengthSpacing ? setupLength + spacing : spacing) * length_1 / setupLength; - } - } - } - else { - for (var i = 1; i < spacesCount; i++) - spaces[i] = spacing; - } - var positions = this.computeWorldPositions(attachment, spacesCount, tangents, data.positionMode == core.PositionMode.Percent, spacingMode == core.SpacingMode.Percent); - var boneX = positions[0], boneY = positions[1], offsetRotation = data.offsetRotation; - var tip = false; - if (offsetRotation == 0) - tip = rotateMode == core.RotateMode.Chain; - else { - tip = false; - var p = this.target.bone.matrix; - offsetRotation *= p.a * p.d - p.b * p.c > 0 ? core.MathUtils.degRad : -core.MathUtils.degRad; - } - for (var i = 0, p = 3; i < boneCount; i++, p += 3) { - var bone = bones[i]; - var mat = bone.matrix; - mat.tx += (boneX - mat.tx) * translateMix; - mat.ty += (boneY - mat.ty) * translateMix; - var x = positions[p], y = positions[p + 1], dx = x - boneX, dy = y - boneY; - if (scale) { - var length_2 = lengths[i]; - if (length_2 != 0) { - var s = (Math.sqrt(dx * dx + dy * dy) / length_2 - 1) * rotateMix + 1; - mat.a *= s; - mat.b *= s; - } - } - boneX = x; - boneY = y; - if (rotate) { - var a = mat.a, b = mat.c, c = mat.b, d = mat.d, r = 0, cos = 0, sin = 0; - if (tangents) - r = positions[p - 1]; - else if (spaces[i + 1] == 0) - r = positions[p + 2]; - else - r = Math.atan2(dy, dx); - r -= Math.atan2(c, a); - if (tip) { - cos = Math.cos(r); - sin = Math.sin(r); - var length_3 = bone.data.length; - boneX += (length_3 * (cos * a - sin * c) - dx) * rotateMix; - boneY += (length_3 * (sin * a + cos * c) - dy) * rotateMix; - } - else { - r += offsetRotation; - } - if (r > core.MathUtils.PI) - r -= core.MathUtils.PI2; - else if (r < -core.MathUtils.PI) - r += core.MathUtils.PI2; - r *= rotateMix; - cos = Math.cos(r); - sin = Math.sin(r); - mat.a = cos * a - sin * c; - mat.c = cos * b - sin * d; - mat.b = sin * a + cos * c; - mat.d = sin * b + cos * d; - } - bone.appliedValid = false; - } - }; - PathConstraint.prototype.computeWorldPositions = function (path, spacesCount, tangents, percentPosition, percentSpacing) { - var target = this.target; - var position = this.position; - var spaces = this.spaces, out = core.Utils.setArraySize(this.positions, spacesCount * 3 + 2), world = null; - var closed = path.closed; - var verticesLength = path.worldVerticesLength, curveCount = verticesLength / 6, prevCurve = PathConstraint.NONE; - if (!path.constantSpeed) { - var lengths = path.lengths; - curveCount -= closed ? 1 : 2; - var pathLength_1 = lengths[curveCount]; - if (percentPosition) - position *= pathLength_1; - if (percentSpacing) { - for (var i = 0; i < spacesCount; i++) - spaces[i] *= pathLength_1; - } - world = core.Utils.setArraySize(this.world, 8); - for (var i = 0, o = 0, curve = 0; i < spacesCount; i++, o += 3) { - var space = spaces[i]; - position += space; - var p = position; - if (closed) { - p %= pathLength_1; - if (p < 0) - p += pathLength_1; - curve = 0; - } - else if (p < 0) { - if (prevCurve != PathConstraint.BEFORE) { - prevCurve = PathConstraint.BEFORE; - path.computeWorldVertices(target, 2, 4, world, 0, 2); - } - this.addBeforePosition(p, world, 0, out, o); - continue; - } - else if (p > pathLength_1) { - if (prevCurve != PathConstraint.AFTER) { - prevCurve = PathConstraint.AFTER; - path.computeWorldVertices(target, verticesLength - 6, 4, world, 0, 2); - } - this.addAfterPosition(p - pathLength_1, world, 0, out, o); - continue; - } - for (;; curve++) { - var length_4 = lengths[curve]; - if (p > length_4) - continue; - if (curve == 0) - p /= length_4; - else { - var prev = lengths[curve - 1]; - p = (p - prev) / (length_4 - prev); - } - break; - } - if (curve != prevCurve) { - prevCurve = curve; - if (closed && curve == curveCount) { - path.computeWorldVertices(target, verticesLength - 4, 4, world, 0, 2); - path.computeWorldVertices(target, 0, 4, world, 4, 2); - } - else - path.computeWorldVertices(target, curve * 6 + 2, 8, world, 0, 2); - } - this.addCurvePosition(p, world[0], world[1], world[2], world[3], world[4], world[5], world[6], world[7], out, o, tangents || (i > 0 && space == 0)); - } - return out; - } - if (closed) { - verticesLength += 2; - world = core.Utils.setArraySize(this.world, verticesLength); - path.computeWorldVertices(target, 2, verticesLength - 4, world, 0, 2); - path.computeWorldVertices(target, 0, 2, world, verticesLength - 4, 2); - world[verticesLength - 2] = world[0]; - world[verticesLength - 1] = world[1]; - } - else { - curveCount--; - verticesLength -= 4; - world = core.Utils.setArraySize(this.world, verticesLength); - path.computeWorldVertices(target, 2, verticesLength, world, 0, 2); - } - var curves = core.Utils.setArraySize(this.curves, curveCount); - var pathLength = 0; - var x1 = world[0], y1 = world[1], cx1 = 0, cy1 = 0, cx2 = 0, cy2 = 0, x2 = 0, y2 = 0; - var tmpx = 0, tmpy = 0, dddfx = 0, dddfy = 0, ddfx = 0, ddfy = 0, dfx = 0, dfy = 0; - for (var i = 0, w = 2; i < curveCount; i++, w += 6) { - cx1 = world[w]; - cy1 = world[w + 1]; - cx2 = world[w + 2]; - cy2 = world[w + 3]; - x2 = world[w + 4]; - y2 = world[w + 5]; - tmpx = (x1 - cx1 * 2 + cx2) * 0.1875; - tmpy = (y1 - cy1 * 2 + cy2) * 0.1875; - dddfx = ((cx1 - cx2) * 3 - x1 + x2) * 0.09375; - dddfy = ((cy1 - cy2) * 3 - y1 + y2) * 0.09375; - ddfx = tmpx * 2 + dddfx; - ddfy = tmpy * 2 + dddfy; - dfx = (cx1 - x1) * 0.75 + tmpx + dddfx * 0.16666667; - dfy = (cy1 - y1) * 0.75 + tmpy + dddfy * 0.16666667; - pathLength += Math.sqrt(dfx * dfx + dfy * dfy); - dfx += ddfx; - dfy += ddfy; - ddfx += dddfx; - ddfy += dddfy; - pathLength += Math.sqrt(dfx * dfx + dfy * dfy); - dfx += ddfx; - dfy += ddfy; - pathLength += Math.sqrt(dfx * dfx + dfy * dfy); - dfx += ddfx + dddfx; - dfy += ddfy + dddfy; - pathLength += Math.sqrt(dfx * dfx + dfy * dfy); - curves[i] = pathLength; - x1 = x2; - y1 = y2; - } - if (percentPosition) - position *= pathLength; - if (percentSpacing) { - for (var i = 0; i < spacesCount; i++) - spaces[i] *= pathLength; - } - var segments = this.segments; - var curveLength = 0; - for (var i = 0, o = 0, curve = 0, segment = 0; i < spacesCount; i++, o += 3) { - var space = spaces[i]; - position += space; - var p = position; - if (closed) { - p %= pathLength; - if (p < 0) - p += pathLength; - curve = 0; - } - else if (p < 0) { - this.addBeforePosition(p, world, 0, out, o); - continue; - } - else if (p > pathLength) { - this.addAfterPosition(p - pathLength, world, verticesLength - 4, out, o); - continue; - } - for (;; curve++) { - var length_5 = curves[curve]; - if (p > length_5) - continue; - if (curve == 0) - p /= length_5; - else { - var prev = curves[curve - 1]; - p = (p - prev) / (length_5 - prev); - } - break; - } - if (curve != prevCurve) { - prevCurve = curve; - var ii = curve * 6; - x1 = world[ii]; - y1 = world[ii + 1]; - cx1 = world[ii + 2]; - cy1 = world[ii + 3]; - cx2 = world[ii + 4]; - cy2 = world[ii + 5]; - x2 = world[ii + 6]; - y2 = world[ii + 7]; - tmpx = (x1 - cx1 * 2 + cx2) * 0.03; - tmpy = (y1 - cy1 * 2 + cy2) * 0.03; - dddfx = ((cx1 - cx2) * 3 - x1 + x2) * 0.006; - dddfy = ((cy1 - cy2) * 3 - y1 + y2) * 0.006; - ddfx = tmpx * 2 + dddfx; - ddfy = tmpy * 2 + dddfy; - dfx = (cx1 - x1) * 0.3 + tmpx + dddfx * 0.16666667; - dfy = (cy1 - y1) * 0.3 + tmpy + dddfy * 0.16666667; - curveLength = Math.sqrt(dfx * dfx + dfy * dfy); - segments[0] = curveLength; - for (ii = 1; ii < 8; ii++) { - dfx += ddfx; - dfy += ddfy; - ddfx += dddfx; - ddfy += dddfy; - curveLength += Math.sqrt(dfx * dfx + dfy * dfy); - segments[ii] = curveLength; - } - dfx += ddfx; - dfy += ddfy; - curveLength += Math.sqrt(dfx * dfx + dfy * dfy); - segments[8] = curveLength; - dfx += ddfx + dddfx; - dfy += ddfy + dddfy; - curveLength += Math.sqrt(dfx * dfx + dfy * dfy); - segments[9] = curveLength; - segment = 0; - } - p *= curveLength; - for (;; segment++) { - var length_6 = segments[segment]; - if (p > length_6) - continue; - if (segment == 0) - p /= length_6; - else { - var prev = segments[segment - 1]; - p = segment + (p - prev) / (length_6 - prev); - } - break; - } - this.addCurvePosition(p * 0.1, x1, y1, cx1, cy1, cx2, cy2, x2, y2, out, o, tangents || (i > 0 && space == 0)); - } - return out; - }; - PathConstraint.prototype.addBeforePosition = function (p, temp, i, out, o) { - var x1 = temp[i], y1 = temp[i + 1], dx = temp[i + 2] - x1, dy = temp[i + 3] - y1, r = Math.atan2(dy, dx); - out[o] = x1 + p * Math.cos(r); - out[o + 1] = y1 + p * Math.sin(r); - out[o + 2] = r; - }; - PathConstraint.prototype.addAfterPosition = function (p, temp, i, out, o) { - var x1 = temp[i + 2], y1 = temp[i + 3], dx = x1 - temp[i], dy = y1 - temp[i + 1], r = Math.atan2(dy, dx); - out[o] = x1 + p * Math.cos(r); - out[o + 1] = y1 + p * Math.sin(r); - out[o + 2] = r; - }; - PathConstraint.prototype.addCurvePosition = function (p, x1, y1, cx1, cy1, cx2, cy2, x2, y2, out, o, tangents) { - if (p == 0 || isNaN(p)) - p = 0.0001; - var tt = p * p, ttt = tt * p, u = 1 - p, uu = u * u, uuu = uu * u; - var ut = u * p, ut3 = ut * 3, uut3 = u * ut3, utt3 = ut3 * p; - var x = x1 * uuu + cx1 * uut3 + cx2 * utt3 + x2 * ttt, y = y1 * uuu + cy1 * uut3 + cy2 * utt3 + y2 * ttt; - out[o] = x; - out[o + 1] = y; - if (tangents) - out[o + 2] = Math.atan2(y - (y1 * uu + cy1 * ut * 2 + cy2 * tt), x - (x1 * uu + cx1 * ut * 2 + cx2 * tt)); - }; - PathConstraint.NONE = -1; - PathConstraint.BEFORE = -2; - PathConstraint.AFTER = -3; - PathConstraint.epsilon = 0.00001; - return PathConstraint; - }()); - core.PathConstraint = PathConstraint; - })(pixi_spine.core || (pixi_spine.core = {})); - })(pixi_spine || (pixi_spine = {})); - var pixi_spine; - (function (pixi_spine) { - (function (core) { - var PathConstraintData = (function (_super) { - __extends(PathConstraintData, _super); - function PathConstraintData(name) { - var _this = _super.call(this, name, 0, false) || this; - _this.bones = new Array(); - return _this; - } - return PathConstraintData; - }(core.ConstraintData)); - core.PathConstraintData = PathConstraintData; - (function (PositionMode) { - PositionMode[PositionMode["Fixed"] = 0] = "Fixed"; - PositionMode[PositionMode["Percent"] = 1] = "Percent"; - })(core.PositionMode || (core.PositionMode = {})); - (function (SpacingMode) { - SpacingMode[SpacingMode["Length"] = 0] = "Length"; - SpacingMode[SpacingMode["Fixed"] = 1] = "Fixed"; - SpacingMode[SpacingMode["Percent"] = 2] = "Percent"; - })(core.SpacingMode || (core.SpacingMode = {})); - (function (RotateMode) { - RotateMode[RotateMode["Tangent"] = 0] = "Tangent"; - RotateMode[RotateMode["Chain"] = 1] = "Chain"; - RotateMode[RotateMode["ChainScale"] = 2] = "ChainScale"; - })(core.RotateMode || (core.RotateMode = {})); - })(pixi_spine.core || (pixi_spine.core = {})); - })(pixi_spine || (pixi_spine = {})); - var pixi_spine; - (function (pixi_spine) { - (function (core) { - var Skeleton = (function () { - function Skeleton(data) { - this._updateCache = new Array(); - this.updateCacheReset = new Array(); - this.time = 0; - this.scaleX = 1; - this.scaleY = 1; - this.x = 0; - this.y = 0; - if (data == null) - throw new Error("data cannot be null."); - this.data = data; - this.bones = new Array(); - for (var i = 0; i < data.bones.length; i++) { - var boneData = data.bones[i]; - var bone = void 0; - if (boneData.parent == null) - bone = new core.Bone(boneData, this, null); - else { - var parent_1 = this.bones[boneData.parent.index]; - bone = new core.Bone(boneData, this, parent_1); - parent_1.children.push(bone); - } - this.bones.push(bone); - } - this.slots = new Array(); - this.drawOrder = new Array(); - for (var i = 0; i < data.slots.length; i++) { - var slotData = data.slots[i]; - var bone = this.bones[slotData.boneData.index]; - var slot = new core.Slot(slotData, bone); - this.slots.push(slot); - this.drawOrder.push(slot); - } - this.ikConstraints = new Array(); - for (var i = 0; i < data.ikConstraints.length; i++) { - var ikConstraintData = data.ikConstraints[i]; - this.ikConstraints.push(new core.IkConstraint(ikConstraintData, this)); - } - this.transformConstraints = new Array(); - for (var i = 0; i < data.transformConstraints.length; i++) { - var transformConstraintData = data.transformConstraints[i]; - this.transformConstraints.push(new core.TransformConstraint(transformConstraintData, this)); - } - this.pathConstraints = new Array(); - for (var i = 0; i < data.pathConstraints.length; i++) { - var pathConstraintData = data.pathConstraints[i]; - this.pathConstraints.push(new core.PathConstraint(pathConstraintData, this)); - } - this.color = new core.Color(1, 1, 1, 1); - this.updateCache(); - } - Skeleton.prototype.updateCache = function () { - var updateCache = this._updateCache; - updateCache.length = 0; - this.updateCacheReset.length = 0; - var bones = this.bones; - for (var i = 0, n = bones.length; i < n; i++) { - var bone = bones[i]; - bone.sorted = bone.data.skinRequired; - bone.active = !bone.sorted; - } - if (this.skin != null) { - var skinBones = this.skin.bones; - for (var i = 0, n = this.skin.bones.length; i < n; i++) { - var bone = this.bones[skinBones[i].index]; - do { - bone.sorted = false; - bone.active = true; - bone = bone.parent; - } while (bone != null); - } - } - var ikConstraints = this.ikConstraints; - var transformConstraints = this.transformConstraints; - var pathConstraints = this.pathConstraints; - var ikCount = ikConstraints.length, transformCount = transformConstraints.length, pathCount = pathConstraints.length; - var constraintCount = ikCount + transformCount + pathCount; - outer: for (var i = 0; i < constraintCount; i++) { - for (var ii = 0; ii < ikCount; ii++) { - var constraint = ikConstraints[ii]; - if (constraint.data.order == i) { - this.sortIkConstraint(constraint); - continue outer; - } - } - for (var ii = 0; ii < transformCount; ii++) { - var constraint = transformConstraints[ii]; - if (constraint.data.order == i) { - this.sortTransformConstraint(constraint); - continue outer; - } - } - for (var ii = 0; ii < pathCount; ii++) { - var constraint = pathConstraints[ii]; - if (constraint.data.order == i) { - this.sortPathConstraint(constraint); - continue outer; - } - } - } - for (var i = 0, n = bones.length; i < n; i++) - this.sortBone(bones[i]); - }; - Skeleton.prototype.sortIkConstraint = function (constraint) { - constraint.active = constraint.target.isActive() && (!constraint.data.skinRequired || (this.skin != null && core.Utils.contains(this.skin.constraints, constraint.data, true))); - if (!constraint.active) - return; - var target = constraint.target; - this.sortBone(target); - var constrained = constraint.bones; - var parent = constrained[0]; - this.sortBone(parent); - if (constrained.length > 1) { - var child = constrained[constrained.length - 1]; - if (!(this._updateCache.indexOf(child) > -1)) - this.updateCacheReset.push(child); - } - this._updateCache.push(constraint); - this.sortReset(parent.children); - constrained[constrained.length - 1].sorted = true; - }; - Skeleton.prototype.sortPathConstraint = function (constraint) { - constraint.active = constraint.target.bone.isActive() && (!constraint.data.skinRequired || (this.skin != null && core.Utils.contains(this.skin.constraints, constraint.data, true))); - if (!constraint.active) - return; - var slot = constraint.target; - var slotIndex = slot.data.index; - var slotBone = slot.bone; - if (this.skin != null) - this.sortPathConstraintAttachment(this.skin, slotIndex, slotBone); - if (this.data.defaultSkin != null && this.data.defaultSkin != this.skin) - this.sortPathConstraintAttachment(this.data.defaultSkin, slotIndex, slotBone); - for (var i = 0, n = this.data.skins.length; i < n; i++) - this.sortPathConstraintAttachment(this.data.skins[i], slotIndex, slotBone); - var attachment = slot.getAttachment(); - if (attachment instanceof core.PathAttachment) - this.sortPathConstraintAttachmentWith(attachment, slotBone); - var constrained = constraint.bones; - var boneCount = constrained.length; - for (var i = 0; i < boneCount; i++) - this.sortBone(constrained[i]); - this._updateCache.push(constraint); - for (var i = 0; i < boneCount; i++) - this.sortReset(constrained[i].children); - for (var i = 0; i < boneCount; i++) - constrained[i].sorted = true; - }; - Skeleton.prototype.sortTransformConstraint = function (constraint) { - constraint.active = constraint.target.isActive() && (!constraint.data.skinRequired || (this.skin != null && core.Utils.contains(this.skin.constraints, constraint.data, true))); - if (!constraint.active) - return; - this.sortBone(constraint.target); - var constrained = constraint.bones; - var boneCount = constrained.length; - if (constraint.data.local) { - for (var i = 0; i < boneCount; i++) { - var child = constrained[i]; - this.sortBone(child.parent); - if (!(this._updateCache.indexOf(child) > -1)) - this.updateCacheReset.push(child); - } - } - else { - for (var i = 0; i < boneCount; i++) { - this.sortBone(constrained[i]); - } - } - this._updateCache.push(constraint); - for (var ii = 0; ii < boneCount; ii++) - this.sortReset(constrained[ii].children); - for (var ii = 0; ii < boneCount; ii++) - constrained[ii].sorted = true; - }; - Skeleton.prototype.sortPathConstraintAttachment = function (skin, slotIndex, slotBone) { - var attachments = skin.attachments[slotIndex]; - if (!attachments) - return; - for (var key in attachments) { - this.sortPathConstraintAttachmentWith(attachments[key], slotBone); - } - }; - Skeleton.prototype.sortPathConstraintAttachmentWith = function (attachment, slotBone) { - if (!(attachment instanceof core.PathAttachment)) - return; - var pathBones = attachment.bones; - if (pathBones == null) - this.sortBone(slotBone); - else { - var bones = this.bones; - var i = 0; - while (i < pathBones.length) { - var boneCount = pathBones[i++]; - for (var n = i + boneCount; i < n; i++) { - var boneIndex = pathBones[i]; - this.sortBone(bones[boneIndex]); - } - } - } - }; - Skeleton.prototype.sortBone = function (bone) { - if (bone.sorted) - return; - var parent = bone.parent; - if (parent != null) - this.sortBone(parent); - bone.sorted = true; - this._updateCache.push(bone); - }; - Skeleton.prototype.sortReset = function (bones) { - for (var i = 0, n = bones.length; i < n; i++) { - var bone = bones[i]; - if (!bone.active) - continue; - if (bone.sorted) - this.sortReset(bone.children); - bone.sorted = false; - } - }; - Skeleton.prototype.updateWorldTransform = function () { - var updateCacheReset = this.updateCacheReset; - for (var i = 0, n = updateCacheReset.length; i < n; i++) { - var bone = updateCacheReset[i]; - bone.ax = bone.x; - bone.ay = bone.y; - bone.arotation = bone.rotation; - bone.ascaleX = bone.scaleX; - bone.ascaleY = bone.scaleY; - bone.ashearX = bone.shearX; - bone.ashearY = bone.shearY; - bone.appliedValid = true; - } - var updateCache = this._updateCache; - for (var i = 0, n = updateCache.length; i < n; i++) - updateCache[i].update(); - }; - Skeleton.prototype.setToSetupPose = function () { - this.setBonesToSetupPose(); - this.setSlotsToSetupPose(); - }; - Skeleton.prototype.setBonesToSetupPose = function () { - var bones = this.bones; - for (var i = 0, n = bones.length; i < n; i++) - bones[i].setToSetupPose(); - var ikConstraints = this.ikConstraints; - for (var i = 0, n = ikConstraints.length; i < n; i++) { - var constraint = ikConstraints[i]; - constraint.mix = constraint.data.mix; - constraint.softness = constraint.data.softness; - constraint.bendDirection = constraint.data.bendDirection; - constraint.compress = constraint.data.compress; - constraint.stretch = constraint.data.stretch; - } - var transformConstraints = this.transformConstraints; - for (var i = 0, n = transformConstraints.length; i < n; i++) { - var constraint = transformConstraints[i]; - var data = constraint.data; - constraint.rotateMix = data.rotateMix; - constraint.translateMix = data.translateMix; - constraint.scaleMix = data.scaleMix; - constraint.shearMix = data.shearMix; - } - var pathConstraints = this.pathConstraints; - for (var i = 0, n = pathConstraints.length; i < n; i++) { - var constraint = pathConstraints[i]; - var data = constraint.data; - constraint.position = data.position; - constraint.spacing = data.spacing; - constraint.rotateMix = data.rotateMix; - constraint.translateMix = data.translateMix; - } - }; - Skeleton.prototype.setSlotsToSetupPose = function () { - var slots = this.slots; - core.Utils.arrayCopy(slots, 0, this.drawOrder, 0, slots.length); - for (var i = 0, n = slots.length; i < n; i++) - slots[i].setToSetupPose(); - }; - Skeleton.prototype.getRootBone = function () { - if (this.bones.length == 0) - return null; - return this.bones[0]; - }; - Skeleton.prototype.findBone = function (boneName) { - if (boneName == null) - throw new Error("boneName cannot be null."); - var bones = this.bones; - for (var i = 0, n = bones.length; i < n; i++) { - var bone = bones[i]; - if (bone.data.name == boneName) - return bone; - } - return null; - }; - Skeleton.prototype.findBoneIndex = function (boneName) { - if (boneName == null) - throw new Error("boneName cannot be null."); - var bones = this.bones; - for (var i = 0, n = bones.length; i < n; i++) - if (bones[i].data.name == boneName) - return i; - return -1; - }; - Skeleton.prototype.findSlot = function (slotName) { - if (slotName == null) - throw new Error("slotName cannot be null."); - var slots = this.slots; - for (var i = 0, n = slots.length; i < n; i++) { - var slot = slots[i]; - if (slot.data.name == slotName) - return slot; - } - return null; - }; - Skeleton.prototype.findSlotIndex = function (slotName) { - if (slotName == null) - throw new Error("slotName cannot be null."); - var slots = this.slots; - for (var i = 0, n = slots.length; i < n; i++) - if (slots[i].data.name == slotName) - return i; - return -1; - }; - Skeleton.prototype.setSkinByName = function (skinName) { - var skin = this.data.findSkin(skinName); - if (skin == null) - throw new Error("Skin not found: " + skinName); - this.setSkin(skin); - }; - Skeleton.prototype.setSkin = function (newSkin) { - if (newSkin == this.skin) - return; - if (newSkin != null) { - if (this.skin != null) - newSkin.attachAll(this, this.skin); - else { - var slots = this.slots; - for (var i = 0, n = slots.length; i < n; i++) { - var slot = slots[i]; - var name_1 = slot.data.attachmentName; - if (name_1 != null) { - var attachment = newSkin.getAttachment(i, name_1); - if (attachment != null) - slot.setAttachment(attachment); - } - } - } - } - this.skin = newSkin; - this.updateCache(); - }; - Skeleton.prototype.getAttachmentByName = function (slotName, attachmentName) { - return this.getAttachment(this.data.findSlotIndex(slotName), attachmentName); - }; - Skeleton.prototype.getAttachment = function (slotIndex, attachmentName) { - if (attachmentName == null) - throw new Error("attachmentName cannot be null."); - if (this.skin != null) { - var attachment = this.skin.getAttachment(slotIndex, attachmentName); - if (attachment != null) - return attachment; - } - if (this.data.defaultSkin != null) - return this.data.defaultSkin.getAttachment(slotIndex, attachmentName); - return null; - }; - Skeleton.prototype.setAttachment = function (slotName, attachmentName) { - if (slotName == null) - throw new Error("slotName cannot be null."); - var slots = this.slots; - for (var i = 0, n = slots.length; i < n; i++) { - var slot = slots[i]; - if (slot.data.name == slotName) { - var attachment = null; - if (attachmentName != null) { - attachment = this.getAttachment(i, attachmentName); - if (attachment == null) - throw new Error("Attachment not found: " + attachmentName + ", for slot: " + slotName); - } - slot.setAttachment(attachment); - return; - } - } - throw new Error("Slot not found: " + slotName); - }; - Skeleton.prototype.findIkConstraint = function (constraintName) { - if (constraintName == null) - throw new Error("constraintName cannot be null."); - var ikConstraints = this.ikConstraints; - for (var i = 0, n = ikConstraints.length; i < n; i++) { - var ikConstraint = ikConstraints[i]; - if (ikConstraint.data.name == constraintName) - return ikConstraint; - } - return null; - }; - Skeleton.prototype.findTransformConstraint = function (constraintName) { - if (constraintName == null) - throw new Error("constraintName cannot be null."); - var transformConstraints = this.transformConstraints; - for (var i = 0, n = transformConstraints.length; i < n; i++) { - var constraint = transformConstraints[i]; - if (constraint.data.name == constraintName) - return constraint; - } - return null; - }; - Skeleton.prototype.findPathConstraint = function (constraintName) { - if (constraintName == null) - throw new Error("constraintName cannot be null."); - var pathConstraints = this.pathConstraints; - for (var i = 0, n = pathConstraints.length; i < n; i++) { - var constraint = pathConstraints[i]; - if (constraint.data.name == constraintName) - return constraint; - } - return null; - }; - Skeleton.prototype.getBounds = function (offset, size, temp) { - if (temp === void 0) { temp = new Array(2); } - if (offset == null) - throw new Error("offset cannot be null."); - if (size == null) - throw new Error("size cannot be null."); - var drawOrder = this.drawOrder; - var minX = Number.POSITIVE_INFINITY, minY = Number.POSITIVE_INFINITY, maxX = Number.NEGATIVE_INFINITY, maxY = Number.NEGATIVE_INFINITY; - for (var i = 0, n = drawOrder.length; i < n; i++) { - var slot = drawOrder[i]; - if (!slot.bone.active) - continue; - var verticesLength = 0; - var vertices = null; - var attachment = slot.getAttachment(); - if (attachment instanceof core.RegionAttachment) { - verticesLength = 8; - vertices = core.Utils.setArraySize(temp, verticesLength, 0); - attachment.computeWorldVertices(slot.bone, vertices, 0, 2); - } - else if (attachment instanceof core.MeshAttachment) { - var mesh = attachment; - verticesLength = mesh.worldVerticesLength; - vertices = core.Utils.setArraySize(temp, verticesLength, 0); - mesh.computeWorldVertices(slot, 0, verticesLength, vertices, 0, 2); - } - if (vertices != null) { - for (var ii = 0, nn = vertices.length; ii < nn; ii += 2) { - var x = vertices[ii], y = vertices[ii + 1]; - minX = Math.min(minX, x); - minY = Math.min(minY, y); - maxX = Math.max(maxX, x); - maxY = Math.max(maxY, y); - } - } - } - offset.set(minX, minY); - size.set(maxX - minX, maxY - minY); - }; - Skeleton.prototype.update = function (delta) { - this.time += delta; - }; - Object.defineProperty(Skeleton.prototype, "flipX", { - get: function () { - return this.scaleX == -1; - }, - set: function (value) { - if (!Skeleton.deprecatedWarning1) { - Skeleton.deprecatedWarning1 = true; - console.warn("Spine Deprecation Warning: `Skeleton.flipX/flipY` was deprecated, please use scaleX/scaleY"); - } - this.scaleX = value ? 1.0 : -1.0; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Skeleton.prototype, "flipY", { - get: function () { - return this.scaleY == -1; - }, - set: function (value) { - if (!Skeleton.deprecatedWarning1) { - Skeleton.deprecatedWarning1 = true; - console.warn("Spine Deprecation Warning: `Skeleton.flipX/flipY` was deprecated, please use scaleX/scaleY"); - } - this.scaleY = value ? 1.0 : -1.0; - }, - enumerable: false, - configurable: true - }); - Skeleton.deprecatedWarning1 = false; - return Skeleton; - }()); - core.Skeleton = Skeleton; - })(pixi_spine.core || (pixi_spine.core = {})); - })(pixi_spine || (pixi_spine = {})); - var pixi_spine; - (function (pixi_spine) { - (function (core) { - var SkeletonBinary = (function () { - function SkeletonBinary(attachmentLoader) { - this.scale = 1; - this.linkedMeshes = new Array(); - this.attachmentLoader = attachmentLoader; - } - SkeletonBinary.prototype.readSkeletonData = function (binary) { - var scale = this.scale; - var skeletonData = new core.SkeletonData(); - skeletonData.name = ""; - var input = new BinaryInput(binary); - skeletonData.hash = input.readString(); - skeletonData.version = input.readString(); - if (skeletonData.version === '3.8.75') { - var error = "Unsupported skeleton data, 3.8.75 is deprecated, please export with a newer version of Spine."; - console.error(error); - } - skeletonData.x = input.readFloat(); - skeletonData.y = input.readFloat(); - skeletonData.width = input.readFloat(); - skeletonData.height = input.readFloat(); - var nonessential = input.readBoolean(); - if (nonessential) { - skeletonData.fps = input.readFloat(); - skeletonData.imagesPath = input.readString(); - skeletonData.audioPath = input.readString(); - } - var n = 0; - n = input.readInt(true); - for (var i = 0; i < n; i++) - input.strings.push(input.readString()); - n = input.readInt(true); - for (var i = 0; i < n; i++) { - var name_2 = input.readString(); - var parent_2 = i == 0 ? null : skeletonData.bones[input.readInt(true)]; - var data = new core.BoneData(i, name_2, parent_2); - data.rotation = input.readFloat(); - data.x = input.readFloat() * scale; - data.y = input.readFloat() * scale; - data.scaleX = input.readFloat(); - data.scaleY = input.readFloat(); - data.shearX = input.readFloat(); - data.shearY = input.readFloat(); - data.length = input.readFloat() * scale; - data.transformMode = SkeletonBinary.TransformModeValues[input.readInt(true)]; - data.skinRequired = input.readBoolean(); - if (nonessential) - core.Color.rgba8888ToColor(data.color, input.readInt32()); - skeletonData.bones.push(data); - } - n = input.readInt(true); - for (var i = 0; i < n; i++) { - var slotName = input.readString(); - var boneData = skeletonData.bones[input.readInt(true)]; - var data = new core.SlotData(i, slotName, boneData); - core.Color.rgba8888ToColor(data.color, input.readInt32()); - var darkColor = input.readInt32(); - if (darkColor != -1) - core.Color.rgb888ToColor(data.darkColor = new core.Color(), darkColor); - data.attachmentName = input.readStringRef(); - data.blendMode = SkeletonBinary.BlendModeValues[input.readInt(true)]; - skeletonData.slots.push(data); - } - n = input.readInt(true); - for (var i = 0, nn = void 0; i < n; i++) { - var data = new core.IkConstraintData(input.readString()); - data.order = input.readInt(true); - data.skinRequired = input.readBoolean(); - nn = input.readInt(true); - for (var ii = 0; ii < nn; ii++) - data.bones.push(skeletonData.bones[input.readInt(true)]); - data.target = skeletonData.bones[input.readInt(true)]; - data.mix = input.readFloat(); - data.softness = input.readFloat() * scale; - data.bendDirection = input.readByte(); - data.compress = input.readBoolean(); - data.stretch = input.readBoolean(); - data.uniform = input.readBoolean(); - skeletonData.ikConstraints.push(data); - } - n = input.readInt(true); - for (var i = 0, nn = void 0; i < n; i++) { - var data = new core.TransformConstraintData(input.readString()); - data.order = input.readInt(true); - data.skinRequired = input.readBoolean(); - nn = input.readInt(true); - for (var ii = 0; ii < nn; ii++) - data.bones.push(skeletonData.bones[input.readInt(true)]); - data.target = skeletonData.bones[input.readInt(true)]; - data.local = input.readBoolean(); - data.relative = input.readBoolean(); - data.offsetRotation = input.readFloat(); - data.offsetX = input.readFloat() * scale; - data.offsetY = input.readFloat() * scale; - data.offsetScaleX = input.readFloat(); - data.offsetScaleY = input.readFloat(); - data.offsetShearY = input.readFloat(); - data.rotateMix = input.readFloat(); - data.translateMix = input.readFloat(); - data.scaleMix = input.readFloat(); - data.shearMix = input.readFloat(); - skeletonData.transformConstraints.push(data); - } - n = input.readInt(true); - for (var i = 0, nn = void 0; i < n; i++) { - var data = new core.PathConstraintData(input.readString()); - data.order = input.readInt(true); - data.skinRequired = input.readBoolean(); - nn = input.readInt(true); - for (var ii = 0; ii < nn; ii++) - data.bones.push(skeletonData.bones[input.readInt(true)]); - data.target = skeletonData.slots[input.readInt(true)]; - data.positionMode = SkeletonBinary.PositionModeValues[input.readInt(true)]; - data.spacingMode = SkeletonBinary.SpacingModeValues[input.readInt(true)]; - data.rotateMode = SkeletonBinary.RotateModeValues[input.readInt(true)]; - data.offsetRotation = input.readFloat(); - data.position = input.readFloat(); - if (data.positionMode == core.PositionMode.Fixed) - data.position *= scale; - data.spacing = input.readFloat(); - if (data.spacingMode == core.SpacingMode.Length || data.spacingMode == core.SpacingMode.Fixed) - data.spacing *= scale; - data.rotateMix = input.readFloat(); - data.translateMix = input.readFloat(); - skeletonData.pathConstraints.push(data); - } - var defaultSkin = this.readSkin(input, skeletonData, true, nonessential); - if (defaultSkin != null) { - skeletonData.defaultSkin = defaultSkin; - skeletonData.skins.push(defaultSkin); - } - { - var i = skeletonData.skins.length; - core.Utils.setArraySize(skeletonData.skins, n = i + input.readInt(true)); - for (; i < n; i++) - skeletonData.skins[i] = this.readSkin(input, skeletonData, false, nonessential); - } - n = this.linkedMeshes.length; - for (var i = 0; i < n; i++) { - var linkedMesh = this.linkedMeshes[i]; - var skin = linkedMesh.skin == null ? skeletonData.defaultSkin : skeletonData.findSkin(linkedMesh.skin); - if (skin == null) - throw new Error("Skin not found: " + linkedMesh.skin); - var parent_3 = skin.getAttachment(linkedMesh.slotIndex, linkedMesh.parent); - if (parent_3 == null) - throw new Error("Parent mesh not found: " + linkedMesh.parent); - linkedMesh.mesh.deformAttachment = linkedMesh.inheritDeform ? parent_3 : linkedMesh.mesh; - linkedMesh.mesh.setParentMesh(parent_3); - } - this.linkedMeshes.length = 0; - n = input.readInt(true); - for (var i = 0; i < n; i++) { - var data = new core.EventData(input.readStringRef()); - data.intValue = input.readInt(false); - data.floatValue = input.readFloat(); - data.stringValue = input.readString(); - data.audioPath = input.readString(); - if (data.audioPath != null) { - data.volume = input.readFloat(); - data.balance = input.readFloat(); - } - skeletonData.events.push(data); - } - n = input.readInt(true); - for (var i = 0; i < n; i++) - skeletonData.animations.push(this.readAnimation(input, input.readString(), skeletonData)); - return skeletonData; - }; - SkeletonBinary.prototype.readSkin = function (input, skeletonData, defaultSkin, nonessential) { - var skin = null; - var slotCount = 0; - if (defaultSkin) { - slotCount = input.readInt(true); - if (slotCount == 0) - return null; - skin = new core.Skin("default"); - } - else { - skin = new core.Skin(input.readStringRef()); - skin.bones.length = input.readInt(true); - for (var i = 0, n = skin.bones.length; i < n; i++) - skin.bones[i] = skeletonData.bones[input.readInt(true)]; - for (var i = 0, n = input.readInt(true); i < n; i++) - skin.constraints.push(skeletonData.ikConstraints[input.readInt(true)]); - for (var i = 0, n = input.readInt(true); i < n; i++) - skin.constraints.push(skeletonData.transformConstraints[input.readInt(true)]); - for (var i = 0, n = input.readInt(true); i < n; i++) - skin.constraints.push(skeletonData.pathConstraints[input.readInt(true)]); - slotCount = input.readInt(true); - } - for (var i = 0; i < slotCount; i++) { - var slotIndex = input.readInt(true); - for (var ii = 0, nn = input.readInt(true); ii < nn; ii++) { - var name_3 = input.readStringRef(); - var attachment = this.readAttachment(input, skeletonData, skin, slotIndex, name_3, nonessential); - if (attachment != null) - skin.setAttachment(slotIndex, name_3, attachment); - } - } - return skin; - }; - SkeletonBinary.prototype.readAttachment = function (input, skeletonData, skin, slotIndex, attachmentName, nonessential) { - var scale = this.scale; - var name = input.readStringRef(); - if (name == null) - name = attachmentName; - var typeIndex = input.readByte(); - var type = SkeletonBinary.AttachmentTypeValues[typeIndex]; - switch (type) { - case core.AttachmentType.Region: { - var path = input.readStringRef(); - var rotation = input.readFloat(); - var x = input.readFloat(); - var y = input.readFloat(); - var scaleX = input.readFloat(); - var scaleY = input.readFloat(); - var width = input.readFloat(); - var height = input.readFloat(); - var color = input.readInt32(); - if (path == null) - path = name; - var region = this.attachmentLoader.newRegionAttachment(skin, name, path); - if (region == null) - return null; - region.path = path; - region.x = x * scale; - region.y = y * scale; - region.scaleX = scaleX; - region.scaleY = scaleY; - region.rotation = rotation; - region.width = width * scale; - region.height = height * scale; - core.Color.rgba8888ToColor(region.color, color); - return region; - } - case core.AttachmentType.BoundingBox: { - var vertexCount = input.readInt(true); - var vertices = this.readVertices(input, vertexCount); - var color = nonessential ? input.readInt32() : 0; - var box = this.attachmentLoader.newBoundingBoxAttachment(skin, name); - if (box == null) - return null; - box.worldVerticesLength = vertexCount << 1; - box.vertices = vertices.vertices; - box.bones = vertices.bones; - if (nonessential) - core.Color.rgba8888ToColor(box.color, color); - return box; - } - case core.AttachmentType.Mesh: { - var path = input.readStringRef(); - var color = input.readInt32(); - var vertexCount = input.readInt(true); - var uvs = this.readFloatArray(input, vertexCount << 1, 1); - var triangles = this.readShortArray(input); - var vertices = this.readVertices(input, vertexCount); - var hullLength = input.readInt(true); - var edges = null; - var width = 0, height = 0; - if (nonessential) { - edges = this.readShortArray(input); - width = input.readFloat(); - height = input.readFloat(); - } - if (path == null) - path = name; - var mesh = this.attachmentLoader.newMeshAttachment(skin, name, path); - if (mesh == null) - return null; - mesh.path = path; - core.Color.rgba8888ToColor(mesh.color, color); - mesh.bones = vertices.bones; - mesh.vertices = vertices.vertices; - mesh.worldVerticesLength = vertexCount << 1; - mesh.triangles = triangles; - mesh.regionUVs = new Float32Array(uvs); - mesh.hullLength = hullLength << 1; - if (nonessential) { - mesh.edges = edges; - mesh.width = width * scale; - mesh.height = height * scale; - } - return mesh; - } - case core.AttachmentType.LinkedMesh: { - var path = input.readStringRef(); - var color = input.readInt32(); - var skinName = input.readStringRef(); - var parent_4 = input.readStringRef(); - var inheritDeform = input.readBoolean(); - var width = 0, height = 0; - if (nonessential) { - width = input.readFloat(); - height = input.readFloat(); - } - if (path == null) - path = name; - var mesh = this.attachmentLoader.newMeshAttachment(skin, name, path); - if (mesh == null) - return null; - mesh.path = path; - core.Color.rgba8888ToColor(mesh.color, color); - if (nonessential) { - mesh.width = width * scale; - mesh.height = height * scale; - } - this.linkedMeshes.push(new LinkedMesh(mesh, skinName, slotIndex, parent_4, inheritDeform)); - return mesh; - } - case core.AttachmentType.Path: { - var closed_1 = input.readBoolean(); - var constantSpeed = input.readBoolean(); - var vertexCount = input.readInt(true); - var vertices = this.readVertices(input, vertexCount); - var lengths = core.Utils.newArray(vertexCount / 3, 0); - for (var i = 0, n = lengths.length; i < n; i++) - lengths[i] = input.readFloat() * scale; - var color = nonessential ? input.readInt32() : 0; - var path = this.attachmentLoader.newPathAttachment(skin, name); - if (path == null) - return null; - path.closed = closed_1; - path.constantSpeed = constantSpeed; - path.worldVerticesLength = vertexCount << 1; - path.vertices = vertices.vertices; - path.bones = vertices.bones; - path.lengths = lengths; - if (nonessential) - core.Color.rgba8888ToColor(path.color, color); - return path; - } - case core.AttachmentType.Point: { - var rotation = input.readFloat(); - var x = input.readFloat(); - var y = input.readFloat(); - var color = nonessential ? input.readInt32() : 0; - var point = this.attachmentLoader.newPointAttachment(skin, name); - if (point == null) - return null; - point.x = x * scale; - point.y = y * scale; - point.rotation = rotation; - if (nonessential) - core.Color.rgba8888ToColor(point.color, color); - return point; - } - case core.AttachmentType.Clipping: { - var endSlotIndex = input.readInt(true); - var vertexCount = input.readInt(true); - var vertices = this.readVertices(input, vertexCount); - var color = nonessential ? input.readInt32() : 0; - var clip = this.attachmentLoader.newClippingAttachment(skin, name); - if (clip == null) - return null; - clip.endSlot = skeletonData.slots[endSlotIndex]; - clip.worldVerticesLength = vertexCount << 1; - clip.vertices = vertices.vertices; - clip.bones = vertices.bones; - if (nonessential) - core.Color.rgba8888ToColor(clip.color, color); - return clip; - } - } - return null; - }; - SkeletonBinary.prototype.readVertices = function (input, vertexCount) { - var verticesLength = vertexCount << 1; - var vertices = new Vertices(); - var scale = this.scale; - if (!input.readBoolean()) { - vertices.vertices = this.readFloatArray(input, verticesLength, scale); - return vertices; - } - var weights = new Array(); - var bonesArray = new Array(); - for (var i = 0; i < vertexCount; i++) { - var boneCount = input.readInt(true); - bonesArray.push(boneCount); - for (var ii = 0; ii < boneCount; ii++) { - bonesArray.push(input.readInt(true)); - weights.push(input.readFloat() * scale); - weights.push(input.readFloat() * scale); - weights.push(input.readFloat()); - } - } - vertices.vertices = core.Utils.toFloatArray(weights); - vertices.bones = bonesArray; - return vertices; - }; - SkeletonBinary.prototype.readFloatArray = function (input, n, scale) { - var array = new Array(n); - if (scale == 1) { - for (var i = 0; i < n; i++) - array[i] = input.readFloat(); - } - else { - for (var i = 0; i < n; i++) - array[i] = input.readFloat() * scale; - } - return array; - }; - SkeletonBinary.prototype.readShortArray = function (input) { - var n = input.readInt(true); - var array = new Array(n); - for (var i = 0; i < n; i++) - array[i] = input.readShort(); - return array; - }; - SkeletonBinary.prototype.readAnimation = function (input, name, skeletonData) { - var timelines = new Array(); - var scale = this.scale; - var duration = 0; - var tempColor1 = new core.Color(); - var tempColor2 = new core.Color(); - for (var i = 0, n = input.readInt(true); i < n; i++) { - var slotIndex = input.readInt(true); - for (var ii = 0, nn = input.readInt(true); ii < nn; ii++) { - var timelineType = input.readByte(); - var frameCount = input.readInt(true); - switch (timelineType) { - case SkeletonBinary.SLOT_ATTACHMENT: { - var timeline = new core.AttachmentTimeline(frameCount); - timeline.slotIndex = slotIndex; - for (var frameIndex = 0; frameIndex < frameCount; frameIndex++) - timeline.setFrame(frameIndex, input.readFloat(), input.readStringRef()); - timelines.push(timeline); - duration = Math.max(duration, timeline.frames[frameCount - 1]); - break; - } - case SkeletonBinary.SLOT_COLOR: { - var timeline = new core.ColorTimeline(frameCount); - timeline.slotIndex = slotIndex; - for (var frameIndex = 0; frameIndex < frameCount; frameIndex++) { - var time = input.readFloat(); - core.Color.rgba8888ToColor(tempColor1, input.readInt32()); - timeline.setFrame(frameIndex, time, tempColor1.r, tempColor1.g, tempColor1.b, tempColor1.a); - if (frameIndex < frameCount - 1) - this.readCurve(input, frameIndex, timeline); - } - timelines.push(timeline); - duration = Math.max(duration, timeline.frames[(frameCount - 1) * core.ColorTimeline.ENTRIES]); - break; - } - case SkeletonBinary.SLOT_TWO_COLOR: { - var timeline = new core.TwoColorTimeline(frameCount); - timeline.slotIndex = slotIndex; - for (var frameIndex = 0; frameIndex < frameCount; frameIndex++) { - var time = input.readFloat(); - core.Color.rgba8888ToColor(tempColor1, input.readInt32()); - core.Color.rgb888ToColor(tempColor2, input.readInt32()); - timeline.setFrame(frameIndex, time, tempColor1.r, tempColor1.g, tempColor1.b, tempColor1.a, tempColor2.r, tempColor2.g, tempColor2.b); - if (frameIndex < frameCount - 1) - this.readCurve(input, frameIndex, timeline); - } - timelines.push(timeline); - duration = Math.max(duration, timeline.frames[(frameCount - 1) * core.TwoColorTimeline.ENTRIES]); - break; - } - } - } - } - for (var i = 0, n = input.readInt(true); i < n; i++) { - var boneIndex = input.readInt(true); - for (var ii = 0, nn = input.readInt(true); ii < nn; ii++) { - var timelineType = input.readByte(); - var frameCount = input.readInt(true); - switch (timelineType) { - case SkeletonBinary.BONE_ROTATE: { - var timeline = new core.RotateTimeline(frameCount); - timeline.boneIndex = boneIndex; - for (var frameIndex = 0; frameIndex < frameCount; frameIndex++) { - timeline.setFrame(frameIndex, input.readFloat(), input.readFloat()); - if (frameIndex < frameCount - 1) - this.readCurve(input, frameIndex, timeline); - } - timelines.push(timeline); - duration = Math.max(duration, timeline.frames[(frameCount - 1) * core.RotateTimeline.ENTRIES]); - break; - } - case SkeletonBinary.BONE_TRANSLATE: - case SkeletonBinary.BONE_SCALE: - case SkeletonBinary.BONE_SHEAR: { - var timeline = void 0; - var timelineScale = 1; - if (timelineType == SkeletonBinary.BONE_SCALE) - timeline = new core.ScaleTimeline(frameCount); - else if (timelineType == SkeletonBinary.BONE_SHEAR) - timeline = new core.ShearTimeline(frameCount); - else { - timeline = new core.TranslateTimeline(frameCount); - timelineScale = scale; - } - timeline.boneIndex = boneIndex; - for (var frameIndex = 0; frameIndex < frameCount; frameIndex++) { - timeline.setFrame(frameIndex, input.readFloat(), input.readFloat() * timelineScale, input.readFloat() * timelineScale); - if (frameIndex < frameCount - 1) - this.readCurve(input, frameIndex, timeline); - } - timelines.push(timeline); - duration = Math.max(duration, timeline.frames[(frameCount - 1) * core.TranslateTimeline.ENTRIES]); - break; - } - } - } - } - for (var i = 0, n = input.readInt(true); i < n; i++) { - var index = input.readInt(true); - var frameCount = input.readInt(true); - var timeline = new core.IkConstraintTimeline(frameCount); - timeline.ikConstraintIndex = index; - for (var frameIndex = 0; frameIndex < frameCount; frameIndex++) { - timeline.setFrame(frameIndex, input.readFloat(), input.readFloat(), input.readFloat() * scale, input.readByte(), input.readBoolean(), input.readBoolean()); - if (frameIndex < frameCount - 1) - this.readCurve(input, frameIndex, timeline); - } - timelines.push(timeline); - duration = Math.max(duration, timeline.frames[(frameCount - 1) * core.IkConstraintTimeline.ENTRIES]); - } - for (var i = 0, n = input.readInt(true); i < n; i++) { - var index = input.readInt(true); - var frameCount = input.readInt(true); - var timeline = new core.TransformConstraintTimeline(frameCount); - timeline.transformConstraintIndex = index; - for (var frameIndex = 0; frameIndex < frameCount; frameIndex++) { - timeline.setFrame(frameIndex, input.readFloat(), input.readFloat(), input.readFloat(), input.readFloat(), input.readFloat()); - if (frameIndex < frameCount - 1) - this.readCurve(input, frameIndex, timeline); - } - timelines.push(timeline); - duration = Math.max(duration, timeline.frames[(frameCount - 1) * core.TransformConstraintTimeline.ENTRIES]); - } - for (var i = 0, n = input.readInt(true); i < n; i++) { - var index = input.readInt(true); - var data = skeletonData.pathConstraints[index]; - for (var ii = 0, nn = input.readInt(true); ii < nn; ii++) { - var timelineType = input.readByte(); - var frameCount = input.readInt(true); - switch (timelineType) { - case SkeletonBinary.PATH_POSITION: - case SkeletonBinary.PATH_SPACING: { - var timeline = void 0; - var timelineScale = 1; - if (timelineType == SkeletonBinary.PATH_SPACING) { - timeline = new core.PathConstraintSpacingTimeline(frameCount); - if (data.spacingMode == core.SpacingMode.Length || data.spacingMode == core.SpacingMode.Fixed) - timelineScale = scale; - } - else { - timeline = new core.PathConstraintPositionTimeline(frameCount); - if (data.positionMode == core.PositionMode.Fixed) - timelineScale = scale; - } - timeline.pathConstraintIndex = index; - for (var frameIndex = 0; frameIndex < frameCount; frameIndex++) { - timeline.setFrame(frameIndex, input.readFloat(), input.readFloat() * timelineScale); - if (frameIndex < frameCount - 1) - this.readCurve(input, frameIndex, timeline); - } - timelines.push(timeline); - duration = Math.max(duration, timeline.frames[(frameCount - 1) * core.PathConstraintPositionTimeline.ENTRIES]); - break; - } - case SkeletonBinary.PATH_MIX: { - var timeline = new core.PathConstraintMixTimeline(frameCount); - timeline.pathConstraintIndex = index; - for (var frameIndex = 0; frameIndex < frameCount; frameIndex++) { - timeline.setFrame(frameIndex, input.readFloat(), input.readFloat(), input.readFloat()); - if (frameIndex < frameCount - 1) - this.readCurve(input, frameIndex, timeline); - } - timelines.push(timeline); - duration = Math.max(duration, timeline.frames[(frameCount - 1) * core.PathConstraintMixTimeline.ENTRIES]); - break; - } - } - } - } - for (var i = 0, n = input.readInt(true); i < n; i++) { - var skin = skeletonData.skins[input.readInt(true)]; - for (var ii = 0, nn = input.readInt(true); ii < nn; ii++) { - var slotIndex = input.readInt(true); - for (var iii = 0, nnn = input.readInt(true); iii < nnn; iii++) { - var attachment = skin.getAttachment(slotIndex, input.readStringRef()); - var weighted = attachment.bones != null; - var vertices = attachment.vertices; - var deformLength = weighted ? vertices.length / 3 * 2 : vertices.length; - var frameCount = input.readInt(true); - var timeline = new core.DeformTimeline(frameCount); - timeline.slotIndex = slotIndex; - timeline.attachment = attachment; - for (var frameIndex = 0; frameIndex < frameCount; frameIndex++) { - var time = input.readFloat(); - var deform = void 0; - var end = input.readInt(true); - if (end == 0) - deform = weighted ? core.Utils.newFloatArray(deformLength) : vertices; - else { - deform = core.Utils.newFloatArray(deformLength); - var start = input.readInt(true); - end += start; - if (scale == 1) { - for (var v = start; v < end; v++) - deform[v] = input.readFloat(); - } - else { - for (var v = start; v < end; v++) - deform[v] = input.readFloat() * scale; - } - if (!weighted) { - for (var v = 0, vn = deform.length; v < vn; v++) - deform[v] += vertices[v]; - } - } - timeline.setFrame(frameIndex, time, deform); - if (frameIndex < frameCount - 1) - this.readCurve(input, frameIndex, timeline); - } - timelines.push(timeline); - duration = Math.max(duration, timeline.frames[frameCount - 1]); - } - } - } - var drawOrderCount = input.readInt(true); - if (drawOrderCount > 0) { - var timeline = new core.DrawOrderTimeline(drawOrderCount); - var slotCount = skeletonData.slots.length; - for (var i = 0; i < drawOrderCount; i++) { - var time = input.readFloat(); - var offsetCount = input.readInt(true); - var drawOrder = core.Utils.newArray(slotCount, 0); - for (var ii = slotCount - 1; ii >= 0; ii--) - drawOrder[ii] = -1; - var unchanged = core.Utils.newArray(slotCount - offsetCount, 0); - var originalIndex = 0, unchangedIndex = 0; - for (var ii = 0; ii < offsetCount; ii++) { - var slotIndex = input.readInt(true); - while (originalIndex != slotIndex) - unchanged[unchangedIndex++] = originalIndex++; - drawOrder[originalIndex + input.readInt(true)] = originalIndex++; - } - while (originalIndex < slotCount) - unchanged[unchangedIndex++] = originalIndex++; - for (var ii = slotCount - 1; ii >= 0; ii--) - if (drawOrder[ii] == -1) - drawOrder[ii] = unchanged[--unchangedIndex]; - timeline.setFrame(i, time, drawOrder); - } - timelines.push(timeline); - duration = Math.max(duration, timeline.frames[drawOrderCount - 1]); - } - var eventCount = input.readInt(true); - if (eventCount > 0) { - var timeline = new core.EventTimeline(eventCount); - for (var i = 0; i < eventCount; i++) { - var time = input.readFloat(); - var eventData = skeletonData.events[input.readInt(true)]; - var event_4 = new core.Event(time, eventData); - event_4.intValue = input.readInt(false); - event_4.floatValue = input.readFloat(); - event_4.stringValue = input.readBoolean() ? input.readString() : eventData.stringValue; - if (event_4.data.audioPath != null) { - event_4.volume = input.readFloat(); - event_4.balance = input.readFloat(); - } - timeline.setFrame(i, event_4); - } - timelines.push(timeline); - duration = Math.max(duration, timeline.frames[eventCount - 1]); - } - return new core.Animation(name, timelines, duration); - }; - SkeletonBinary.prototype.readCurve = function (input, frameIndex, timeline) { - switch (input.readByte()) { - case SkeletonBinary.CURVE_STEPPED: - timeline.setStepped(frameIndex); - break; - case SkeletonBinary.CURVE_BEZIER: - this.setCurve(timeline, frameIndex, input.readFloat(), input.readFloat(), input.readFloat(), input.readFloat()); - break; - } - }; - SkeletonBinary.prototype.setCurve = function (timeline, frameIndex, cx1, cy1, cx2, cy2) { - timeline.setCurve(frameIndex, cx1, cy1, cx2, cy2); - }; - SkeletonBinary.AttachmentTypeValues = [0, 1, 2, 3, 4, 5, 6]; - SkeletonBinary.TransformModeValues = [core.TransformMode.Normal, core.TransformMode.OnlyTranslation, core.TransformMode.NoRotationOrReflection, core.TransformMode.NoScale, core.TransformMode.NoScaleOrReflection]; - SkeletonBinary.PositionModeValues = [core.PositionMode.Fixed, core.PositionMode.Percent]; - SkeletonBinary.SpacingModeValues = [core.SpacingMode.Length, core.SpacingMode.Fixed, core.SpacingMode.Percent]; - SkeletonBinary.RotateModeValues = [core.RotateMode.Tangent, core.RotateMode.Chain, core.RotateMode.ChainScale]; - SkeletonBinary.BlendModeValues = [core.BlendMode.Normal, core.BlendMode.Additive, core.BlendMode.Multiply, core.BlendMode.Screen]; - SkeletonBinary.BONE_ROTATE = 0; - SkeletonBinary.BONE_TRANSLATE = 1; - SkeletonBinary.BONE_SCALE = 2; - SkeletonBinary.BONE_SHEAR = 3; - SkeletonBinary.SLOT_ATTACHMENT = 0; - SkeletonBinary.SLOT_COLOR = 1; - SkeletonBinary.SLOT_TWO_COLOR = 2; - SkeletonBinary.PATH_POSITION = 0; - SkeletonBinary.PATH_SPACING = 1; - SkeletonBinary.PATH_MIX = 2; - SkeletonBinary.CURVE_LINEAR = 0; - SkeletonBinary.CURVE_STEPPED = 1; - SkeletonBinary.CURVE_BEZIER = 2; - return SkeletonBinary; - }()); - core.SkeletonBinary = SkeletonBinary; - var BinaryInput = (function () { - function BinaryInput(data, strings, index, buffer) { - if (strings === void 0) { strings = new Array(); } - if (index === void 0) { index = 0; } - if (buffer === void 0) { buffer = new DataView(data.buffer); } - this.strings = strings; - this.index = index; - this.buffer = buffer; - } - BinaryInput.prototype.readByte = function () { - return this.buffer.getInt8(this.index++); - }; - BinaryInput.prototype.readShort = function () { - var value = this.buffer.getInt16(this.index); - this.index += 2; - return value; - }; - BinaryInput.prototype.readInt32 = function () { - var value = this.buffer.getInt32(this.index); - this.index += 4; - return value; - }; - BinaryInput.prototype.readInt = function (optimizePositive) { - var b = this.readByte(); - var result = b & 0x7F; - if ((b & 0x80) != 0) { - b = this.readByte(); - result |= (b & 0x7F) << 7; - if ((b & 0x80) != 0) { - b = this.readByte(); - result |= (b & 0x7F) << 14; - if ((b & 0x80) != 0) { - b = this.readByte(); - result |= (b & 0x7F) << 21; - if ((b & 0x80) != 0) { - b = this.readByte(); - result |= (b & 0x7F) << 28; - } - } - } - } - return optimizePositive ? result : ((result >>> 1) ^ -(result & 1)); - }; - BinaryInput.prototype.readStringRef = function () { - var index = this.readInt(true); - return index == 0 ? null : this.strings[index - 1]; - }; - BinaryInput.prototype.readString = function () { - var byteCount = this.readInt(true); - switch (byteCount) { - case 0: - return null; - case 1: - return ""; - } - byteCount--; - var chars = ""; - for (var i = 0; i < byteCount;) { - var b = this.readByte(); - switch (b >> 4) { - case 12: - case 13: - chars += String.fromCharCode(((b & 0x1F) << 6 | this.readByte() & 0x3F)); - i += 2; - break; - case 14: - chars += String.fromCharCode(((b & 0x0F) << 12 | (this.readByte() & 0x3F) << 6 | this.readByte() & 0x3F)); - i += 3; - break; - default: - chars += String.fromCharCode(b); - i++; - } - } - return chars; - }; - BinaryInput.prototype.readFloat = function () { - var value = this.buffer.getFloat32(this.index); - this.index += 4; - return value; - }; - BinaryInput.prototype.readBoolean = function () { - return this.readByte() != 0; - }; - return BinaryInput; - }()); - var LinkedMesh = (function () { - function LinkedMesh(mesh, skin, slotIndex, parent, inheritDeform) { - this.mesh = mesh; - this.skin = skin; - this.slotIndex = slotIndex; - this.parent = parent; - this.inheritDeform = inheritDeform; - } - return LinkedMesh; - }()); - var Vertices = (function () { - function Vertices(bones, vertices) { - if (bones === void 0) { bones = null; } - if (vertices === void 0) { vertices = null; } - this.bones = bones; - this.vertices = vertices; - } - return Vertices; - }()); - })(pixi_spine.core || (pixi_spine.core = {})); - })(pixi_spine || (pixi_spine = {})); - var pixi_spine; - (function (pixi_spine) { - (function (core) { - var SkeletonBounds = (function () { - function SkeletonBounds() { - this.minX = 0; - this.minY = 0; - this.maxX = 0; - this.maxY = 0; - this.boundingBoxes = new Array(); - this.polygons = new Array(); - this.polygonPool = new core.Pool(function () { - return core.Utils.newFloatArray(16); - }); - } - SkeletonBounds.prototype.update = function (skeleton, updateAabb) { - if (skeleton == null) - throw new Error("skeleton cannot be null."); - var boundingBoxes = this.boundingBoxes; - var polygons = this.polygons; - var polygonPool = this.polygonPool; - var slots = skeleton.slots; - var slotCount = slots.length; - boundingBoxes.length = 0; - polygonPool.freeAll(polygons); - polygons.length = 0; - for (var i = 0; i < slotCount; i++) { - var slot = slots[i]; - if (!slot.bone.active) - continue; - var attachment = slot.getAttachment(); - if (attachment instanceof core.BoundingBoxAttachment) { - var boundingBox = attachment; - boundingBoxes.push(boundingBox); - var polygon = polygonPool.obtain(); - if (polygon.length != boundingBox.worldVerticesLength) { - polygon = core.Utils.newFloatArray(boundingBox.worldVerticesLength); - } - polygons.push(polygon); - boundingBox.computeWorldVertices(slot, 0, boundingBox.worldVerticesLength, polygon, 0, 2); - } - } - if (updateAabb) { - this.aabbCompute(); - } - else { - this.minX = Number.POSITIVE_INFINITY; - this.minY = Number.POSITIVE_INFINITY; - this.maxX = Number.NEGATIVE_INFINITY; - this.maxY = Number.NEGATIVE_INFINITY; - } - }; - SkeletonBounds.prototype.aabbCompute = function () { - var minX = Number.POSITIVE_INFINITY, minY = Number.POSITIVE_INFINITY, maxX = Number.NEGATIVE_INFINITY, maxY = Number.NEGATIVE_INFINITY; - var polygons = this.polygons; - for (var i = 0, n = polygons.length; i < n; i++) { - var polygon = polygons[i]; - var vertices = polygon; - for (var ii = 0, nn = polygon.length; ii < nn; ii += 2) { - var x = vertices[ii]; - var y = vertices[ii + 1]; - minX = Math.min(minX, x); - minY = Math.min(minY, y); - maxX = Math.max(maxX, x); - maxY = Math.max(maxY, y); - } - } - this.minX = minX; - this.minY = minY; - this.maxX = maxX; - this.maxY = maxY; - }; - SkeletonBounds.prototype.aabbContainsPoint = function (x, y) { - return x >= this.minX && x <= this.maxX && y >= this.minY && y <= this.maxY; - }; - SkeletonBounds.prototype.aabbIntersectsSegment = function (x1, y1, x2, y2) { - var minX = this.minX; - var minY = this.minY; - var maxX = this.maxX; - var maxY = this.maxY; - if ((x1 <= minX && x2 <= minX) || (y1 <= minY && y2 <= minY) || (x1 >= maxX && x2 >= maxX) || (y1 >= maxY && y2 >= maxY)) - return false; - var m = (y2 - y1) / (x2 - x1); - var y = m * (minX - x1) + y1; - if (y > minY && y < maxY) - return true; - y = m * (maxX - x1) + y1; - if (y > minY && y < maxY) - return true; - var x = (minY - y1) / m + x1; - if (x > minX && x < maxX) - return true; - x = (maxY - y1) / m + x1; - if (x > minX && x < maxX) - return true; - return false; - }; - SkeletonBounds.prototype.aabbIntersectsSkeleton = function (bounds) { - return this.minX < bounds.maxX && this.maxX > bounds.minX && this.minY < bounds.maxY && this.maxY > bounds.minY; - }; - SkeletonBounds.prototype.containsPoint = function (x, y) { - var polygons = this.polygons; - for (var i = 0, n = polygons.length; i < n; i++) - if (this.containsPointPolygon(polygons[i], x, y)) - return this.boundingBoxes[i]; - return null; - }; - SkeletonBounds.prototype.containsPointPolygon = function (polygon, x, y) { - var vertices = polygon; - var nn = polygon.length; - var prevIndex = nn - 2; - var inside = false; - for (var ii = 0; ii < nn; ii += 2) { - var vertexY = vertices[ii + 1]; - var prevY = vertices[prevIndex + 1]; - if ((vertexY < y && prevY >= y) || (prevY < y && vertexY >= y)) { - var vertexX = vertices[ii]; - if (vertexX + (y - vertexY) / (prevY - vertexY) * (vertices[prevIndex] - vertexX) < x) - inside = !inside; - } - prevIndex = ii; - } - return inside; - }; - SkeletonBounds.prototype.intersectsSegment = function (x1, y1, x2, y2) { - var polygons = this.polygons; - for (var i = 0, n = polygons.length; i < n; i++) - if (this.intersectsSegmentPolygon(polygons[i], x1, y1, x2, y2)) - return this.boundingBoxes[i]; - return null; - }; - SkeletonBounds.prototype.intersectsSegmentPolygon = function (polygon, x1, y1, x2, y2) { - var vertices = polygon; - var nn = polygon.length; - var width12 = x1 - x2, height12 = y1 - y2; - var det1 = x1 * y2 - y1 * x2; - var x3 = vertices[nn - 2], y3 = vertices[nn - 1]; - for (var ii = 0; ii < nn; ii += 2) { - var x4 = vertices[ii], y4 = vertices[ii + 1]; - var det2 = x3 * y4 - y3 * x4; - var width34 = x3 - x4, height34 = y3 - y4; - var det3 = width12 * height34 - height12 * width34; - var x = (det1 * width34 - width12 * det2) / det3; - if (((x >= x3 && x <= x4) || (x >= x4 && x <= x3)) && ((x >= x1 && x <= x2) || (x >= x2 && x <= x1))) { - var y = (det1 * height34 - height12 * det2) / det3; - if (((y >= y3 && y <= y4) || (y >= y4 && y <= y3)) && ((y >= y1 && y <= y2) || (y >= y2 && y <= y1))) - return true; - } - x3 = x4; - y3 = y4; - } - return false; - }; - SkeletonBounds.prototype.getPolygon = function (boundingBox) { - if (boundingBox == null) - throw new Error("boundingBox cannot be null."); - var index = this.boundingBoxes.indexOf(boundingBox); - return index == -1 ? null : this.polygons[index]; - }; - SkeletonBounds.prototype.getWidth = function () { - return this.maxX - this.minX; - }; - SkeletonBounds.prototype.getHeight = function () { - return this.maxY - this.minY; - }; - return SkeletonBounds; - }()); - core.SkeletonBounds = SkeletonBounds; - })(pixi_spine.core || (pixi_spine.core = {})); - })(pixi_spine || (pixi_spine = {})); - var pixi_spine; - (function (pixi_spine) { - (function (core) { - var SkeletonClipping = (function () { - function SkeletonClipping() { - this.triangulator = new core.Triangulator(); - this.clippingPolygon = new Array(); - this.clipOutput = new Array(); - this.clippedVertices = new Array(); - this.clippedTriangles = new Array(); - this.scratch = new Array(); - } - SkeletonClipping.prototype.clipStart = function (slot, clip) { - if (this.clipAttachment != null) - return 0; - this.clipAttachment = clip; - var n = clip.worldVerticesLength; - var vertices = core.Utils.setArraySize(this.clippingPolygon, n); - clip.computeWorldVertices(slot, 0, n, vertices, 0, 2); - var clippingPolygon = this.clippingPolygon; - SkeletonClipping.makeClockwise(clippingPolygon); - var clippingPolygons = this.clippingPolygons = this.triangulator.decompose(clippingPolygon, this.triangulator.triangulate(clippingPolygon)); - for (var i = 0, n_2 = clippingPolygons.length; i < n_2; i++) { - var polygon = clippingPolygons[i]; - SkeletonClipping.makeClockwise(polygon); - polygon.push(polygon[0]); - polygon.push(polygon[1]); - } - return clippingPolygons.length; - }; - SkeletonClipping.prototype.clipEndWithSlot = function (slot) { - if (this.clipAttachment != null && this.clipAttachment.endSlot == slot.data) - this.clipEnd(); - }; - SkeletonClipping.prototype.clipEnd = function () { - if (this.clipAttachment == null) - return; - this.clipAttachment = null; - this.clippingPolygons = null; - this.clippedVertices.length = 0; - this.clippedTriangles.length = 0; - this.clippingPolygon.length = 0; - }; - SkeletonClipping.prototype.isClipping = function () { - return this.clipAttachment != null; - }; - SkeletonClipping.prototype.clipTriangles = function (vertices, verticesLength, triangles, trianglesLength, uvs, light, dark, twoColor) { - var clipOutput = this.clipOutput, clippedVertices = this.clippedVertices; - var clippedTriangles = this.clippedTriangles; - var polygons = this.clippingPolygons; - var polygonsCount = this.clippingPolygons.length; - var vertexSize = twoColor ? 12 : 8; - var index = 0; - clippedVertices.length = 0; - clippedTriangles.length = 0; - outer: for (var i = 0; i < trianglesLength; i += 3) { - var vertexOffset = triangles[i] << 1; - var x1 = vertices[vertexOffset], y1 = vertices[vertexOffset + 1]; - var u1 = uvs[vertexOffset], v1 = uvs[vertexOffset + 1]; - vertexOffset = triangles[i + 1] << 1; - var x2 = vertices[vertexOffset], y2 = vertices[vertexOffset + 1]; - var u2 = uvs[vertexOffset], v2 = uvs[vertexOffset + 1]; - vertexOffset = triangles[i + 2] << 1; - var x3 = vertices[vertexOffset], y3 = vertices[vertexOffset + 1]; - var u3 = uvs[vertexOffset], v3 = uvs[vertexOffset + 1]; - for (var p = 0; p < polygonsCount; p++) { - var s = clippedVertices.length; - if (this.clip(x1, y1, x2, y2, x3, y3, polygons[p], clipOutput)) { - var clipOutputLength = clipOutput.length; - if (clipOutputLength == 0) - continue; - var d0 = y2 - y3, d1 = x3 - x2, d2 = x1 - x3, d4 = y3 - y1; - var d = 1 / (d0 * d2 + d1 * (y1 - y3)); - var clipOutputCount = clipOutputLength >> 1; - var clipOutputItems = this.clipOutput; - var clippedVerticesItems = core.Utils.setArraySize(clippedVertices, s + clipOutputCount * vertexSize); - for (var ii = 0; ii < clipOutputLength; ii += 2) { - var x = clipOutputItems[ii], y = clipOutputItems[ii + 1]; - clippedVerticesItems[s] = x; - clippedVerticesItems[s + 1] = y; - clippedVerticesItems[s + 2] = light.r; - clippedVerticesItems[s + 3] = light.g; - clippedVerticesItems[s + 4] = light.b; - clippedVerticesItems[s + 5] = light.a; - var c0 = x - x3, c1 = y - y3; - var a = (d0 * c0 + d1 * c1) * d; - var b = (d4 * c0 + d2 * c1) * d; - var c = 1 - a - b; - clippedVerticesItems[s + 6] = u1 * a + u2 * b + u3 * c; - clippedVerticesItems[s + 7] = v1 * a + v2 * b + v3 * c; - if (twoColor) { - clippedVerticesItems[s + 8] = dark.r; - clippedVerticesItems[s + 9] = dark.g; - clippedVerticesItems[s + 10] = dark.b; - clippedVerticesItems[s + 11] = dark.a; - } - s += vertexSize; - } - s = clippedTriangles.length; - var clippedTrianglesItems = core.Utils.setArraySize(clippedTriangles, s + 3 * (clipOutputCount - 2)); - clipOutputCount--; - for (var ii = 1; ii < clipOutputCount; ii++) { - clippedTrianglesItems[s] = index; - clippedTrianglesItems[s + 1] = (index + ii); - clippedTrianglesItems[s + 2] = (index + ii + 1); - s += 3; - } - index += clipOutputCount + 1; - } - else { - var clippedVerticesItems = core.Utils.setArraySize(clippedVertices, s + 3 * vertexSize); - clippedVerticesItems[s] = x1; - clippedVerticesItems[s + 1] = y1; - clippedVerticesItems[s + 2] = light.r; - clippedVerticesItems[s + 3] = light.g; - clippedVerticesItems[s + 4] = light.b; - clippedVerticesItems[s + 5] = light.a; - if (!twoColor) { - clippedVerticesItems[s + 6] = u1; - clippedVerticesItems[s + 7] = v1; - clippedVerticesItems[s + 8] = x2; - clippedVerticesItems[s + 9] = y2; - clippedVerticesItems[s + 10] = light.r; - clippedVerticesItems[s + 11] = light.g; - clippedVerticesItems[s + 12] = light.b; - clippedVerticesItems[s + 13] = light.a; - clippedVerticesItems[s + 14] = u2; - clippedVerticesItems[s + 15] = v2; - clippedVerticesItems[s + 16] = x3; - clippedVerticesItems[s + 17] = y3; - clippedVerticesItems[s + 18] = light.r; - clippedVerticesItems[s + 19] = light.g; - clippedVerticesItems[s + 20] = light.b; - clippedVerticesItems[s + 21] = light.a; - clippedVerticesItems[s + 22] = u3; - clippedVerticesItems[s + 23] = v3; - } - else { - clippedVerticesItems[s + 6] = u1; - clippedVerticesItems[s + 7] = v1; - clippedVerticesItems[s + 8] = dark.r; - clippedVerticesItems[s + 9] = dark.g; - clippedVerticesItems[s + 10] = dark.b; - clippedVerticesItems[s + 11] = dark.a; - clippedVerticesItems[s + 12] = x2; - clippedVerticesItems[s + 13] = y2; - clippedVerticesItems[s + 14] = light.r; - clippedVerticesItems[s + 15] = light.g; - clippedVerticesItems[s + 16] = light.b; - clippedVerticesItems[s + 17] = light.a; - clippedVerticesItems[s + 18] = u2; - clippedVerticesItems[s + 19] = v2; - clippedVerticesItems[s + 20] = dark.r; - clippedVerticesItems[s + 21] = dark.g; - clippedVerticesItems[s + 22] = dark.b; - clippedVerticesItems[s + 23] = dark.a; - clippedVerticesItems[s + 24] = x3; - clippedVerticesItems[s + 25] = y3; - clippedVerticesItems[s + 26] = light.r; - clippedVerticesItems[s + 27] = light.g; - clippedVerticesItems[s + 28] = light.b; - clippedVerticesItems[s + 29] = light.a; - clippedVerticesItems[s + 30] = u3; - clippedVerticesItems[s + 31] = v3; - clippedVerticesItems[s + 32] = dark.r; - clippedVerticesItems[s + 33] = dark.g; - clippedVerticesItems[s + 34] = dark.b; - clippedVerticesItems[s + 35] = dark.a; - } - s = clippedTriangles.length; - var clippedTrianglesItems = core.Utils.setArraySize(clippedTriangles, s + 3); - clippedTrianglesItems[s] = index; - clippedTrianglesItems[s + 1] = (index + 1); - clippedTrianglesItems[s + 2] = (index + 2); - index += 3; - continue outer; - } - } - } - }; - SkeletonClipping.prototype.clip = function (x1, y1, x2, y2, x3, y3, clippingArea, output) { - var originalOutput = output; - var clipped = false; - var input = null; - if (clippingArea.length % 4 >= 2) { - input = output; - output = this.scratch; - } - else - input = this.scratch; - input.length = 0; - input.push(x1); - input.push(y1); - input.push(x2); - input.push(y2); - input.push(x3); - input.push(y3); - input.push(x1); - input.push(y1); - output.length = 0; - var clippingVertices = clippingArea; - var clippingVerticesLast = clippingArea.length - 4; - for (var i = 0;; i += 2) { - var edgeX = clippingVertices[i], edgeY = clippingVertices[i + 1]; - var edgeX2 = clippingVertices[i + 2], edgeY2 = clippingVertices[i + 3]; - var deltaX = edgeX - edgeX2, deltaY = edgeY - edgeY2; - var inputVertices = input; - var inputVerticesLength = input.length - 2, outputStart = output.length; - for (var ii = 0; ii < inputVerticesLength; ii += 2) { - var inputX = inputVertices[ii], inputY = inputVertices[ii + 1]; - var inputX2 = inputVertices[ii + 2], inputY2 = inputVertices[ii + 3]; - var side2 = deltaX * (inputY2 - edgeY2) - deltaY * (inputX2 - edgeX2) > 0; - if (deltaX * (inputY - edgeY2) - deltaY * (inputX - edgeX2) > 0) { - if (side2) { - output.push(inputX2); - output.push(inputY2); - continue; - } - var c0 = inputY2 - inputY, c2 = inputX2 - inputX; - var ua = (c2 * (edgeY - inputY) - c0 * (edgeX - inputX)) / (c0 * (edgeX2 - edgeX) - c2 * (edgeY2 - edgeY)); - output.push(edgeX + (edgeX2 - edgeX) * ua); - output.push(edgeY + (edgeY2 - edgeY) * ua); - } - else if (side2) { - var c0 = inputY2 - inputY, c2 = inputX2 - inputX; - var ua = (c2 * (edgeY - inputY) - c0 * (edgeX - inputX)) / (c0 * (edgeX2 - edgeX) - c2 * (edgeY2 - edgeY)); - output.push(edgeX + (edgeX2 - edgeX) * ua); - output.push(edgeY + (edgeY2 - edgeY) * ua); - output.push(inputX2); - output.push(inputY2); - } - clipped = true; - } - if (outputStart == output.length) { - originalOutput.length = 0; - return true; - } - output.push(output[0]); - output.push(output[1]); - if (i == clippingVerticesLast) - break; - var temp = output; - output = input; - output.length = 0; - input = temp; - } - if (originalOutput != output) { - originalOutput.length = 0; - for (var i = 0, n = output.length - 2; i < n; i++) - originalOutput[i] = output[i]; - } - else - originalOutput.length = originalOutput.length - 2; - return clipped; - }; - SkeletonClipping.makeClockwise = function (polygon) { - var vertices = polygon; - var verticeslength = polygon.length; - var area = vertices[verticeslength - 2] * vertices[1] - vertices[0] * vertices[verticeslength - 1], p1x = 0, p1y = 0, p2x = 0, p2y = 0; - for (var i = 0, n = verticeslength - 3; i < n; i += 2) { - p1x = vertices[i]; - p1y = vertices[i + 1]; - p2x = vertices[i + 2]; - p2y = vertices[i + 3]; - area += p1x * p2y - p2x * p1y; - } - if (area < 0) - return; - for (var i = 0, lastX = verticeslength - 2, n = verticeslength >> 1; i < n; i += 2) { - var x = vertices[i], y = vertices[i + 1]; - var other = lastX - i; - vertices[i] = vertices[other]; - vertices[i + 1] = vertices[other + 1]; - vertices[other] = x; - vertices[other + 1] = y; - } - }; - return SkeletonClipping; - }()); - core.SkeletonClipping = SkeletonClipping; - })(pixi_spine.core || (pixi_spine.core = {})); - })(pixi_spine || (pixi_spine = {})); - var pixi_spine; - (function (pixi_spine) { - (function (core) { - var SkeletonData = (function () { - function SkeletonData() { - this.bones = new Array(); - this.slots = new Array(); - this.skins = new Array(); - this.events = new Array(); - this.animations = new Array(); - this.ikConstraints = new Array(); - this.transformConstraints = new Array(); - this.pathConstraints = new Array(); - this.fps = 0; - } - SkeletonData.prototype.findBone = function (boneName) { - if (boneName == null) - throw new Error("boneName cannot be null."); - var bones = this.bones; - for (var i = 0, n = bones.length; i < n; i++) { - var bone = bones[i]; - if (bone.name == boneName) - return bone; - } - return null; - }; - SkeletonData.prototype.findBoneIndex = function (boneName) { - if (boneName == null) - throw new Error("boneName cannot be null."); - var bones = this.bones; - for (var i = 0, n = bones.length; i < n; i++) - if (bones[i].name == boneName) - return i; - return -1; - }; - SkeletonData.prototype.findSlot = function (slotName) { - if (slotName == null) - throw new Error("slotName cannot be null."); - var slots = this.slots; - for (var i = 0, n = slots.length; i < n; i++) { - var slot = slots[i]; - if (slot.name == slotName) - return slot; - } - return null; - }; - SkeletonData.prototype.findSlotIndex = function (slotName) { - if (slotName == null) - throw new Error("slotName cannot be null."); - var slots = this.slots; - for (var i = 0, n = slots.length; i < n; i++) - if (slots[i].name == slotName) - return i; - return -1; - }; - SkeletonData.prototype.findSkin = function (skinName) { - if (skinName == null) - throw new Error("skinName cannot be null."); - var skins = this.skins; - for (var i = 0, n = skins.length; i < n; i++) { - var skin = skins[i]; - if (skin.name == skinName) - return skin; - } - return null; - }; - SkeletonData.prototype.findEvent = function (eventDataName) { - if (eventDataName == null) - throw new Error("eventDataName cannot be null."); - var events = this.events; - for (var i = 0, n = events.length; i < n; i++) { - var event_5 = events[i]; - if (event_5.name == eventDataName) - return event_5; - } - return null; - }; - SkeletonData.prototype.findAnimation = function (animationName) { - if (animationName == null) - throw new Error("animationName cannot be null."); - var animations = this.animations; - for (var i = 0, n = animations.length; i < n; i++) { - var animation = animations[i]; - if (animation.name == animationName) - return animation; - } - return null; - }; - SkeletonData.prototype.findIkConstraint = function (constraintName) { - if (constraintName == null) - throw new Error("constraintName cannot be null."); - var ikConstraints = this.ikConstraints; - for (var i = 0, n = ikConstraints.length; i < n; i++) { - var constraint = ikConstraints[i]; - if (constraint.name == constraintName) - return constraint; - } - return null; - }; - SkeletonData.prototype.findTransformConstraint = function (constraintName) { - if (constraintName == null) - throw new Error("constraintName cannot be null."); - var transformConstraints = this.transformConstraints; - for (var i = 0, n = transformConstraints.length; i < n; i++) { - var constraint = transformConstraints[i]; - if (constraint.name == constraintName) - return constraint; - } - return null; - }; - SkeletonData.prototype.findPathConstraint = function (constraintName) { - if (constraintName == null) - throw new Error("constraintName cannot be null."); - var pathConstraints = this.pathConstraints; - for (var i = 0, n = pathConstraints.length; i < n; i++) { - var constraint = pathConstraints[i]; - if (constraint.name == constraintName) - return constraint; - } - return null; - }; - SkeletonData.prototype.findPathConstraintIndex = function (pathConstraintName) { - if (pathConstraintName == null) - throw new Error("pathConstraintName cannot be null."); - var pathConstraints = this.pathConstraints; - for (var i = 0, n = pathConstraints.length; i < n; i++) - if (pathConstraints[i].name == pathConstraintName) - return i; - return -1; - }; - return SkeletonData; - }()); - core.SkeletonData = SkeletonData; - })(pixi_spine.core || (pixi_spine.core = {})); - })(pixi_spine || (pixi_spine = {})); - var pixi_spine; - (function (pixi_spine) { - (function (core) { - core.FAIL_ON_NON_EXISTING_SKIN = false; - var SkeletonJson = (function () { - function SkeletonJson(attachmentLoader) { - this.scale = 1; - this.linkedMeshes = new Array(); - this.attachmentLoader = attachmentLoader; - } - SkeletonJson.prototype.readSkeletonData = function (json) { - var scale = this.scale; - var skeletonData = new core.SkeletonData(); - var root = typeof (json) === "string" ? JSON.parse(json) : json; - var skeletonMap = root.skeleton; - if (skeletonMap != null) { - skeletonData.hash = skeletonMap.hash; - skeletonData.version = skeletonMap.spine; - if (skeletonData.version.substr(0, 3) !== '3.8') { - var error = "PixiJS Spine plugin supports only format for Spine 3.8. Your model has version " + skeletonMap.spine + ". Please look in pixi-spine repository README for another branch."; - console.error(error); - } - if (skeletonData.version === '3.8.75') { - var error = "Unsupported skeleton data, 3.8.75 is deprecated, please export with a newer version of Spine."; - console.error(error); - } - skeletonData.x = skeletonMap.x; - skeletonData.y = skeletonMap.y; - skeletonData.width = skeletonMap.width; - skeletonData.height = skeletonMap.height; - skeletonData.fps = skeletonMap.fps; - skeletonData.imagesPath = skeletonMap.images; - } - if (root.bones) { - for (var i = 0; i < root.bones.length; i++) { - var boneMap = root.bones[i]; - var parent_5 = null; - var parentName = this.getValue(boneMap, "parent", null); - if (parentName != null) { - parent_5 = skeletonData.findBone(parentName); - if (parent_5 == null) - throw new Error("Parent bone not found: " + parentName); - } - var data = new core.BoneData(skeletonData.bones.length, boneMap.name, parent_5); - data.length = this.getValue(boneMap, "length", 0) * scale; - data.x = this.getValue(boneMap, "x", 0) * scale; - data.y = this.getValue(boneMap, "y", 0) * scale; - data.rotation = this.getValue(boneMap, "rotation", 0); - data.scaleX = this.getValue(boneMap, "scaleX", 1); - data.scaleY = this.getValue(boneMap, "scaleY", 1); - data.shearX = this.getValue(boneMap, "shearX", 0); - data.shearY = this.getValue(boneMap, "shearY", 0); - data.transformMode = SkeletonJson.transformModeFromString(this.getValue(boneMap, "transform", "normal")); - data.skinRequired = this.getValue(boneMap, "skin", false); - skeletonData.bones.push(data); - } - } - if (root.slots) { - for (var i = 0; i < root.slots.length; i++) { - var slotMap = root.slots[i]; - var slotName = slotMap.name; - var boneName = slotMap.bone; - var boneData = skeletonData.findBone(boneName); - if (boneData == null) - throw new Error("Slot bone not found: " + boneName); - var data = new core.SlotData(skeletonData.slots.length, slotName, boneData); - var color = this.getValue(slotMap, "color", null); - if (color != null) - data.color.setFromString(color); - var dark = this.getValue(slotMap, "dark", null); - if (dark != null) { - data.darkColor = new core.Color(1, 1, 1, 1); - data.darkColor.setFromString(dark); - } - data.attachmentName = this.getValue(slotMap, "attachment", null); - data.blendMode = SkeletonJson.blendModeFromString(this.getValue(slotMap, "blend", "normal")); - skeletonData.slots.push(data); - } - } - if (root.ik) { - for (var i = 0; i < root.ik.length; i++) { - var constraintMap = root.ik[i]; - var data = new core.IkConstraintData(constraintMap.name); - data.order = this.getValue(constraintMap, "order", 0); - data.skinRequired = this.getValue(constraintMap, "skin", false); - for (var j = 0; j < constraintMap.bones.length; j++) { - var boneName = constraintMap.bones[j]; - var bone = skeletonData.findBone(boneName); - if (bone == null) - throw new Error("IK bone not found: " + boneName); - data.bones.push(bone); - } - var targetName = constraintMap.target; - data.target = skeletonData.findBone(targetName); - if (data.target == null) - throw new Error("IK target bone not found: " + targetName); - data.mix = this.getValue(constraintMap, "mix", 1); - data.softness = this.getValue(constraintMap, "softness", 0) * scale; - data.bendDirection = this.getValue(constraintMap, "bendPositive", true) ? 1 : -1; - data.compress = this.getValue(constraintMap, "compress", false); - data.stretch = this.getValue(constraintMap, "stretch", false); - data.uniform = this.getValue(constraintMap, "uniform", false); - skeletonData.ikConstraints.push(data); - } - } - if (root.transform) { - for (var i = 0; i < root.transform.length; i++) { - var constraintMap = root.transform[i]; - var data = new core.TransformConstraintData(constraintMap.name); - data.order = this.getValue(constraintMap, "order", 0); - data.skinRequired = this.getValue(constraintMap, "skin", false); - for (var j = 0; j < constraintMap.bones.length; j++) { - var boneName = constraintMap.bones[j]; - var bone = skeletonData.findBone(boneName); - if (bone == null) - throw new Error("Transform constraint bone not found: " + boneName); - data.bones.push(bone); - } - var targetName = constraintMap.target; - data.target = skeletonData.findBone(targetName); - if (data.target == null) - throw new Error("Transform constraint target bone not found: " + targetName); - data.local = this.getValue(constraintMap, "local", false); - data.relative = this.getValue(constraintMap, "relative", false); - data.offsetRotation = this.getValue(constraintMap, "rotation", 0); - data.offsetX = this.getValue(constraintMap, "x", 0) * scale; - data.offsetY = this.getValue(constraintMap, "y", 0) * scale; - data.offsetScaleX = this.getValue(constraintMap, "scaleX", 0); - data.offsetScaleY = this.getValue(constraintMap, "scaleY", 0); - data.offsetShearY = this.getValue(constraintMap, "shearY", 0); - data.rotateMix = this.getValue(constraintMap, "rotateMix", 1); - data.translateMix = this.getValue(constraintMap, "translateMix", 1); - data.scaleMix = this.getValue(constraintMap, "scaleMix", 1); - data.shearMix = this.getValue(constraintMap, "shearMix", 1); - skeletonData.transformConstraints.push(data); - } - } - if (root.path) { - for (var i = 0; i < root.path.length; i++) { - var constraintMap = root.path[i]; - var data = new core.PathConstraintData(constraintMap.name); - data.order = this.getValue(constraintMap, "order", 0); - data.skinRequired = this.getValue(constraintMap, "skin", false); - for (var j = 0; j < constraintMap.bones.length; j++) { - var boneName = constraintMap.bones[j]; - var bone = skeletonData.findBone(boneName); - if (bone == null) - throw new Error("Transform constraint bone not found: " + boneName); - data.bones.push(bone); - } - var targetName = constraintMap.target; - data.target = skeletonData.findSlot(targetName); - if (data.target == null) - throw new Error("Path target slot not found: " + targetName); - data.positionMode = SkeletonJson.positionModeFromString(this.getValue(constraintMap, "positionMode", "percent")); - data.spacingMode = SkeletonJson.spacingModeFromString(this.getValue(constraintMap, "spacingMode", "length")); - data.rotateMode = SkeletonJson.rotateModeFromString(this.getValue(constraintMap, "rotateMode", "tangent")); - data.offsetRotation = this.getValue(constraintMap, "rotation", 0); - data.position = this.getValue(constraintMap, "position", 0); - if (data.positionMode == core.PositionMode.Fixed) - data.position *= scale; - data.spacing = this.getValue(constraintMap, "spacing", 0); - if (data.spacingMode == core.SpacingMode.Length || data.spacingMode == core.SpacingMode.Fixed) - data.spacing *= scale; - data.rotateMix = this.getValue(constraintMap, "rotateMix", 1); - data.translateMix = this.getValue(constraintMap, "translateMix", 1); - skeletonData.pathConstraints.push(data); - } - } - if (root.skins) { - for (var i = 0; i < root.skins.length; i++) { - var skinMap = root.skins[i]; - var skin = new core.Skin(skinMap.name); - if (skinMap.bones) { - for (var ii = 0; ii < skinMap.bones.length; ii++) { - var bone = skeletonData.findBone(skinMap.bones[ii]); - if (bone == null) - throw new Error("Skin bone not found: " + skinMap.bones[i]); - skin.bones.push(bone); - } - } - if (skinMap.ik) { - for (var ii = 0; ii < skinMap.ik.length; ii++) { - var constraint = skeletonData.findIkConstraint(skinMap.ik[ii]); - if (constraint == null) - throw new Error("Skin IK constraint not found: " + skinMap.ik[i]); - skin.constraints.push(constraint); - } - } - if (skinMap.transform) { - for (var ii = 0; ii < skinMap.transform.length; ii++) { - var constraint = skeletonData.findTransformConstraint(skinMap.transform[ii]); - if (constraint == null) - throw new Error("Skin transform constraint not found: " + skinMap.transform[i]); - skin.constraints.push(constraint); - } - } - if (skinMap.path) { - for (var ii = 0; ii < skinMap.path.length; ii++) { - var constraint = skeletonData.findPathConstraint(skinMap.path[ii]); - if (constraint == null) - throw new Error("Skin path constraint not found: " + skinMap.path[i]); - skin.constraints.push(constraint); - } - } - for (var slotName in skinMap.attachments) { - var slot = skeletonData.findSlot(slotName); - if (slot == null) - throw new Error("Slot not found: " + slotName); - var slotMap = skinMap.attachments[slotName]; - for (var entryName in slotMap) { - var attachment = this.readAttachment(slotMap[entryName], skin, slot.index, entryName, skeletonData); - if (attachment != null) - skin.setAttachment(slot.index, entryName, attachment); - } - } - skeletonData.skins.push(skin); - if (skin.name == "default") - skeletonData.defaultSkin = skin; - } - } - for (var i = 0, n = this.linkedMeshes.length; i < n; i++) { - var linkedMesh = this.linkedMeshes[i]; - var skin = linkedMesh.skin == null ? skeletonData.defaultSkin : skeletonData.findSkin(linkedMesh.skin); - if (skin == null) - throw new Error("Skin not found: " + linkedMesh.skin); - var parent_6 = skin.getAttachment(linkedMesh.slotIndex, linkedMesh.parent); - if (parent_6 == null) - throw new Error("Parent mesh not found: " + linkedMesh.parent); - linkedMesh.mesh.deformAttachment = linkedMesh.inheritDeform ? parent_6 : linkedMesh.mesh; - linkedMesh.mesh.setParentMesh(parent_6); - } - this.linkedMeshes.length = 0; - if (root.events) { - for (var eventName in root.events) { - var eventMap = root.events[eventName]; - var data = new core.EventData(eventName); - data.intValue = this.getValue(eventMap, "int", 0); - data.floatValue = this.getValue(eventMap, "float", 0); - data.stringValue = this.getValue(eventMap, "string", ""); - data.audioPath = this.getValue(eventMap, "audio", null); - if (data.audioPath != null) { - data.volume = this.getValue(eventMap, "volume", 1); - data.balance = this.getValue(eventMap, "balance", 0); - } - skeletonData.events.push(data); - } - } - if (root.animations) { - for (var animationName in root.animations) { - var animationMap = root.animations[animationName]; - this.readAnimation(animationMap, animationName, skeletonData); - } - } - return skeletonData; - }; - SkeletonJson.prototype.readAttachment = function (map, skin, slotIndex, name, skeletonData) { - var scale = this.scale; - name = this.getValue(map, "name", name); - var type = this.getValue(map, "type", "region"); - switch (type) { - case "region": { - var path = this.getValue(map, "path", name); - var region = this.attachmentLoader.newRegionAttachment(skin, name, path); - if (region == null) - return null; - region.path = path; - region.x = this.getValue(map, "x", 0) * scale; - region.y = this.getValue(map, "y", 0) * scale; - region.scaleX = this.getValue(map, "scaleX", 1); - region.scaleY = this.getValue(map, "scaleY", 1); - region.rotation = this.getValue(map, "rotation", 0); - region.width = map.width * scale; - region.height = map.height * scale; - var color = this.getValue(map, "color", null); - if (color != null) - region.color.setFromString(color); - return region; - } - case "boundingbox": { - var box = this.attachmentLoader.newBoundingBoxAttachment(skin, name); - if (box == null) - return null; - this.readVertices(map, box, map.vertexCount << 1); - var color = this.getValue(map, "color", null); - if (color != null) - box.color.setFromString(color); - return box; - } - case "mesh": - case "linkedmesh": { - var path = this.getValue(map, "path", name); - var mesh = this.attachmentLoader.newMeshAttachment(skin, name, path); - if (mesh == null) - return null; - mesh.path = path; - var color = this.getValue(map, "color", null); - if (color != null) - mesh.color.setFromString(color); - mesh.width = this.getValue(map, "width", 0) * scale; - mesh.height = this.getValue(map, "height", 0) * scale; - var parent_7 = this.getValue(map, "parent", null); - if (parent_7 != null) { - this.linkedMeshes.push(new LinkedMesh(mesh, this.getValue(map, "skin", null), slotIndex, parent_7, this.getValue(map, "deform", true))); - return mesh; - } - var uvs = map.uvs; - this.readVertices(map, mesh, uvs.length); - mesh.triangles = map.triangles; - mesh.regionUVs = new Float32Array(uvs); - mesh.edges = this.getValue(map, "edges", null); - mesh.hullLength = this.getValue(map, "hull", 0) * 2; - return mesh; - } - case "path": { - var path = this.attachmentLoader.newPathAttachment(skin, name); - if (path == null) - return null; - path.closed = this.getValue(map, "closed", false); - path.constantSpeed = this.getValue(map, "constantSpeed", true); - var vertexCount = map.vertexCount; - this.readVertices(map, path, vertexCount << 1); - var lengths = core.Utils.newArray(vertexCount / 3, 0); - for (var i = 0; i < map.lengths.length; i++) - lengths[i] = map.lengths[i] * scale; - path.lengths = lengths; - var color = this.getValue(map, "color", null); - if (color != null) - path.color.setFromString(color); - return path; - } - case "point": { - var point = this.attachmentLoader.newPointAttachment(skin, name); - if (point == null) - return null; - point.x = this.getValue(map, "x", 0) * scale; - point.y = this.getValue(map, "y", 0) * scale; - point.rotation = this.getValue(map, "rotation", 0); - var color = this.getValue(map, "color", null); - if (color != null) - point.color.setFromString(color); - return point; - } - case "clipping": { - var clip = this.attachmentLoader.newClippingAttachment(skin, name); - if (clip == null) - return null; - var end = this.getValue(map, "end", null); - if (end != null) { - var slot = skeletonData.findSlot(end); - if (slot == null) - throw new Error("Clipping end slot not found: " + end); - clip.endSlot = slot; - } - var vertexCount = map.vertexCount; - this.readVertices(map, clip, vertexCount << 1); - var color = this.getValue(map, "color", null); - if (color != null) - clip.color.setFromString(color); - return clip; - } - } - return null; - }; - SkeletonJson.prototype.readVertices = function (map, attachment, verticesLength) { - var scale = this.scale; - attachment.worldVerticesLength = verticesLength; - var vertices = map.vertices; - if (verticesLength == vertices.length) { - var scaledVertices = core.Utils.toFloatArray(vertices); - if (scale != 1) { - for (var i = 0, n = vertices.length; i < n; i++) - scaledVertices[i] *= scale; - } - attachment.vertices = scaledVertices; - return; - } - var weights = new Array(); - var bones = new Array(); - for (var i = 0, n = vertices.length; i < n;) { - var boneCount = vertices[i++]; - bones.push(boneCount); - for (var nn = i + boneCount * 4; i < nn; i += 4) { - bones.push(vertices[i]); - weights.push(vertices[i + 1] * scale); - weights.push(vertices[i + 2] * scale); - weights.push(vertices[i + 3]); - } - } - attachment.bones = bones; - attachment.vertices = core.Utils.toFloatArray(weights); - }; - SkeletonJson.prototype.readAnimation = function (map, name, skeletonData) { - var scale = this.scale; - var timelines = new Array(); - var duration = 0; - if (map.slots) { - for (var slotName in map.slots) { - var slotMap = map.slots[slotName]; - var slotIndex = skeletonData.findSlotIndex(slotName); - if (slotIndex == -1) - throw new Error("Slot not found: " + slotName); - for (var timelineName in slotMap) { - var timelineMap = slotMap[timelineName]; - if (timelineName == "attachment") { - var timeline = new core.AttachmentTimeline(timelineMap.length); - timeline.slotIndex = slotIndex; - var frameIndex = 0; - for (var i = 0; i < timelineMap.length; i++) { - var valueMap = timelineMap[i]; - timeline.setFrame(frameIndex++, this.getValue(valueMap, "time", 0), valueMap.name); - } - timelines.push(timeline); - duration = Math.max(duration, timeline.frames[timeline.getFrameCount() - 1]); - } - else if (timelineName == "color") { - var timeline = new core.ColorTimeline(timelineMap.length); - timeline.slotIndex = slotIndex; - var frameIndex = 0; - for (var i = 0; i < timelineMap.length; i++) { - var valueMap = timelineMap[i]; - var color = new core.Color(); - color.setFromString(valueMap.color || "ffffffff"); - timeline.setFrame(frameIndex, this.getValue(valueMap, "time", 0), color.r, color.g, color.b, color.a); - this.readCurve(valueMap, timeline, frameIndex); - frameIndex++; - } - timelines.push(timeline); - duration = Math.max(duration, timeline.frames[(timeline.getFrameCount() - 1) * core.ColorTimeline.ENTRIES]); - } - else if (timelineName == "twoColor") { - var timeline = new core.TwoColorTimeline(timelineMap.length); - timeline.slotIndex = slotIndex; - var frameIndex = 0; - for (var i = 0; i < timelineMap.length; i++) { - var valueMap = timelineMap[i]; - var light = new core.Color(); - var dark = new core.Color(); - light.setFromString(valueMap.light); - dark.setFromString(valueMap.dark); - timeline.setFrame(frameIndex, this.getValue(valueMap, "time", 0), light.r, light.g, light.b, light.a, dark.r, dark.g, dark.b); - this.readCurve(valueMap, timeline, frameIndex); - frameIndex++; - } - timelines.push(timeline); - duration = Math.max(duration, timeline.frames[(timeline.getFrameCount() - 1) * core.TwoColorTimeline.ENTRIES]); - } - else - throw new Error("Invalid timeline type for a slot: " + timelineName + " (" + slotName + ")"); - } - } - } - if (map.bones) { - for (var boneName in map.bones) { - var boneMap = map.bones[boneName]; - var boneIndex = skeletonData.findBoneIndex(boneName); - if (boneIndex == -1) - throw new Error("Bone not found: " + boneName); - for (var timelineName in boneMap) { - var timelineMap = boneMap[timelineName]; - if (timelineName === "rotate") { - var timeline = new core.RotateTimeline(timelineMap.length); - timeline.boneIndex = boneIndex; - var frameIndex = 0; - for (var i = 0; i < timelineMap.length; i++) { - var valueMap = timelineMap[i]; - timeline.setFrame(frameIndex, this.getValue(valueMap, "time", 0), this.getValue(valueMap, "angle", 0)); - this.readCurve(valueMap, timeline, frameIndex); - frameIndex++; - } - timelines.push(timeline); - duration = Math.max(duration, timeline.frames[(timeline.getFrameCount() - 1) * core.RotateTimeline.ENTRIES]); - } - else if (timelineName === "translate" || timelineName === "scale" || timelineName === "shear") { - var timeline = null; - var timelineScale = 1, defaultValue = 0; - if (timelineName === "scale") { - timeline = new core.ScaleTimeline(timelineMap.length); - defaultValue = 1; - } - else if (timelineName === "shear") - timeline = new core.ShearTimeline(timelineMap.length); - else { - timeline = new core.TranslateTimeline(timelineMap.length); - timelineScale = scale; - } - timeline.boneIndex = boneIndex; - var frameIndex = 0; - for (var i = 0; i < timelineMap.length; i++) { - var valueMap = timelineMap[i]; - var x = this.getValue(valueMap, "x", defaultValue), y = this.getValue(valueMap, "y", defaultValue); - timeline.setFrame(frameIndex, this.getValue(valueMap, "time", 0), x * timelineScale, y * timelineScale); - this.readCurve(valueMap, timeline, frameIndex); - frameIndex++; - } - timelines.push(timeline); - duration = Math.max(duration, timeline.frames[(timeline.getFrameCount() - 1) * core.TranslateTimeline.ENTRIES]); - } - else - throw new Error("Invalid timeline type for a bone: " + timelineName + " (" + boneName + ")"); - } - } - } - if (map.ik) { - for (var constraintName in map.ik) { - var constraintMap = map.ik[constraintName]; - var constraint = skeletonData.findIkConstraint(constraintName); - var timeline = new core.IkConstraintTimeline(constraintMap.length); - timeline.ikConstraintIndex = skeletonData.ikConstraints.indexOf(constraint); - var frameIndex = 0; - for (var i = 0; i < constraintMap.length; i++) { - var valueMap = constraintMap[i]; - timeline.setFrame(frameIndex, this.getValue(valueMap, "time", 0), this.getValue(valueMap, "mix", 1), this.getValue(valueMap, "softness", 0) * scale, this.getValue(valueMap, "bendPositive", true) ? 1 : -1, this.getValue(valueMap, "compress", false), this.getValue(valueMap, "stretch", false)); - this.readCurve(valueMap, timeline, frameIndex); - frameIndex++; - } - timelines.push(timeline); - duration = Math.max(duration, timeline.frames[(timeline.getFrameCount() - 1) * core.IkConstraintTimeline.ENTRIES]); - } - } - if (map.transform) { - for (var constraintName in map.transform) { - var constraintMap = map.transform[constraintName]; - var constraint = skeletonData.findTransformConstraint(constraintName); - var timeline = new core.TransformConstraintTimeline(constraintMap.length); - timeline.transformConstraintIndex = skeletonData.transformConstraints.indexOf(constraint); - var frameIndex = 0; - for (var i = 0; i < constraintMap.length; i++) { - var valueMap = constraintMap[i]; - timeline.setFrame(frameIndex, this.getValue(valueMap, "time", 0), this.getValue(valueMap, "rotateMix", 1), this.getValue(valueMap, "translateMix", 1), this.getValue(valueMap, "scaleMix", 1), this.getValue(valueMap, "shearMix", 1)); - this.readCurve(valueMap, timeline, frameIndex); - frameIndex++; - } - timelines.push(timeline); - duration = Math.max(duration, timeline.frames[(timeline.getFrameCount() - 1) * core.TransformConstraintTimeline.ENTRIES]); - } - } - if (map.path) { - for (var constraintName in map.path) { - var constraintMap = map.path[constraintName]; - var index = skeletonData.findPathConstraintIndex(constraintName); - if (index == -1) - throw new Error("Path constraint not found: " + constraintName); - var data = skeletonData.pathConstraints[index]; - for (var timelineName in constraintMap) { - var timelineMap = constraintMap[timelineName]; - if (timelineName === "position" || timelineName === "spacing") { - var timeline = null; - var timelineScale = 1; - if (timelineName === "spacing") { - timeline = new core.PathConstraintSpacingTimeline(timelineMap.length); - if (data.spacingMode == core.SpacingMode.Length || data.spacingMode == core.SpacingMode.Fixed) - timelineScale = scale; - } - else { - timeline = new core.PathConstraintPositionTimeline(timelineMap.length); - if (data.positionMode == core.PositionMode.Fixed) - timelineScale = scale; - } - timeline.pathConstraintIndex = index; - var frameIndex = 0; - for (var i = 0; i < timelineMap.length; i++) { - var valueMap = timelineMap[i]; - timeline.setFrame(frameIndex, this.getValue(valueMap, "time", 0), this.getValue(valueMap, timelineName, 0) * timelineScale); - this.readCurve(valueMap, timeline, frameIndex); - frameIndex++; - } - timelines.push(timeline); - duration = Math.max(duration, timeline.frames[(timeline.getFrameCount() - 1) * core.PathConstraintPositionTimeline.ENTRIES]); - } - else if (timelineName === "mix") { - var timeline = new core.PathConstraintMixTimeline(timelineMap.length); - timeline.pathConstraintIndex = index; - var frameIndex = 0; - for (var i = 0; i < timelineMap.length; i++) { - var valueMap = timelineMap[i]; - timeline.setFrame(frameIndex, this.getValue(valueMap, "time", 0), this.getValue(valueMap, "rotateMix", 1), this.getValue(valueMap, "translateMix", 1)); - this.readCurve(valueMap, timeline, frameIndex); - frameIndex++; - } - timelines.push(timeline); - duration = Math.max(duration, timeline.frames[(timeline.getFrameCount() - 1) * core.PathConstraintMixTimeline.ENTRIES]); - } - } - } - } - if (map.deform) { - for (var deformName in map.deform) { - var deformMap = map.deform[deformName]; - var skin = skeletonData.findSkin(deformName); - if (skin == null) { - if (core.FAIL_ON_NON_EXISTING_SKIN) { - throw new Error("Skin not found: " + deformName); - } - else { - continue; - } - } - for (var slotName in deformMap) { - var slotMap = deformMap[slotName]; - var slotIndex = skeletonData.findSlotIndex(slotName); - if (slotIndex == -1) - throw new Error("Slot not found: " + slotMap.name); - for (var timelineName in slotMap) { - var timelineMap = slotMap[timelineName]; - var attachment = skin.getAttachment(slotIndex, timelineName); - if (attachment == null) - throw new Error("Deform attachment not found: " + timelineMap.name); - var weighted = attachment.bones != null; - var vertices = attachment.vertices; - var deformLength = weighted ? vertices.length / 3 * 2 : vertices.length; - var timeline = new core.DeformTimeline(timelineMap.length); - timeline.slotIndex = slotIndex; - timeline.attachment = attachment; - var frameIndex = 0; - for (var j = 0; j < timelineMap.length; j++) { - var valueMap = timelineMap[j]; - var deform = void 0; - var verticesValue = this.getValue(valueMap, "vertices", null); - if (verticesValue == null) - deform = weighted ? core.Utils.newFloatArray(deformLength) : vertices; - else { - deform = core.Utils.newFloatArray(deformLength); - var start = this.getValue(valueMap, "offset", 0); - core.Utils.arrayCopy(verticesValue, 0, deform, start, verticesValue.length); - if (scale != 1) { - for (var i = start, n = i + verticesValue.length; i < n; i++) - deform[i] *= scale; - } - if (!weighted) { - for (var i = 0; i < deformLength; i++) - deform[i] += vertices[i]; - } - } - timeline.setFrame(frameIndex, this.getValue(valueMap, "time", 0), deform); - this.readCurve(valueMap, timeline, frameIndex); - frameIndex++; - } - timelines.push(timeline); - duration = Math.max(duration, timeline.frames[timeline.getFrameCount() - 1]); - } - } - } - } - var drawOrderNode = map.drawOrder; - if (drawOrderNode == null) - drawOrderNode = map.draworder; - if (drawOrderNode != null) { - var timeline = new core.DrawOrderTimeline(drawOrderNode.length); - var slotCount = skeletonData.slots.length; - var frameIndex = 0; - for (var j = 0; j < drawOrderNode.length; j++) { - var drawOrderMap = drawOrderNode[j]; - var drawOrder = null; - var offsets = this.getValue(drawOrderMap, "offsets", null); - if (offsets != null) { - drawOrder = core.Utils.newArray(slotCount, -1); - var unchanged = core.Utils.newArray(slotCount - offsets.length, 0); - var originalIndex = 0, unchangedIndex = 0; - for (var i = 0; i < offsets.length; i++) { - var offsetMap = offsets[i]; - var slotIndex = skeletonData.findSlotIndex(offsetMap.slot); - if (slotIndex == -1) - throw new Error("Slot not found: " + offsetMap.slot); - while (originalIndex != slotIndex) - unchanged[unchangedIndex++] = originalIndex++; - drawOrder[originalIndex + offsetMap.offset] = originalIndex++; - } - while (originalIndex < slotCount) - unchanged[unchangedIndex++] = originalIndex++; - for (var i = slotCount - 1; i >= 0; i--) - if (drawOrder[i] == -1) - drawOrder[i] = unchanged[--unchangedIndex]; - } - timeline.setFrame(frameIndex++, this.getValue(drawOrderMap, "time", 0), drawOrder); - } - timelines.push(timeline); - duration = Math.max(duration, timeline.frames[timeline.getFrameCount() - 1]); - } - if (map.events) { - var timeline = new core.EventTimeline(map.events.length); - var frameIndex = 0; - for (var i = 0; i < map.events.length; i++) { - var eventMap = map.events[i]; - var eventData = skeletonData.findEvent(eventMap.name); - if (eventData == null) - throw new Error("Event not found: " + eventMap.name); - var event_6 = new core.Event(core.Utils.toSinglePrecision(this.getValue(eventMap, "time", 0)), eventData); - event_6.intValue = this.getValue(eventMap, "int", eventData.intValue); - event_6.floatValue = this.getValue(eventMap, "float", eventData.floatValue); - event_6.stringValue = this.getValue(eventMap, "string", eventData.stringValue); - if (event_6.data.audioPath != null) { - event_6.volume = this.getValue(eventMap, "volume", 1); - event_6.balance = this.getValue(eventMap, "balance", 0); - } - timeline.setFrame(frameIndex++, event_6); - } - timelines.push(timeline); - duration = Math.max(duration, timeline.frames[timeline.getFrameCount() - 1]); - } - if (isNaN(duration)) { - throw new Error("Error while parsing animation, duration is NaN"); - } - skeletonData.animations.push(new core.Animation(name, timelines, duration)); - }; - SkeletonJson.prototype.readCurve = function (map, timeline, frameIndex) { - if (!map.hasOwnProperty("curve")) - return; - if (map.curve === "stepped") - timeline.setStepped(frameIndex); - else { - var curve = map.curve; - timeline.setCurve(frameIndex, curve, this.getValue(map, "c2", 0), this.getValue(map, "c3", 1), this.getValue(map, "c4", 1)); - } - }; - SkeletonJson.prototype.getValue = function (map, prop, defaultValue) { - return map[prop] !== undefined ? map[prop] : defaultValue; - }; - SkeletonJson.blendModeFromString = function (str) { - str = str.toLowerCase(); - if (str == "normal") - return core.BlendMode.Normal; - if (str == "additive") - return core.BlendMode.Additive; - if (str == "multiply") - return core.BlendMode.Multiply; - if (str == "screen") - return core.BlendMode.Screen; - throw new Error("Unknown blend mode: " + str); - }; - SkeletonJson.positionModeFromString = function (str) { - str = str.toLowerCase(); - if (str == "fixed") - return core.PositionMode.Fixed; - if (str == "percent") - return core.PositionMode.Percent; - throw new Error("Unknown position mode: " + str); - }; - SkeletonJson.spacingModeFromString = function (str) { - str = str.toLowerCase(); - if (str == "length") - return core.SpacingMode.Length; - if (str == "fixed") - return core.SpacingMode.Fixed; - if (str == "percent") - return core.SpacingMode.Percent; - throw new Error("Unknown position mode: " + str); - }; - SkeletonJson.rotateModeFromString = function (str) { - str = str.toLowerCase(); - if (str == "tangent") - return core.RotateMode.Tangent; - if (str == "chain") - return core.RotateMode.Chain; - if (str == "chainscale") - return core.RotateMode.ChainScale; - throw new Error("Unknown rotate mode: " + str); - }; - SkeletonJson.transformModeFromString = function (str) { - str = str.toLowerCase(); - if (str == "normal") - return core.TransformMode.Normal; - if (str == "onlytranslation") - return core.TransformMode.OnlyTranslation; - if (str == "norotationorreflection") - return core.TransformMode.NoRotationOrReflection; - if (str == "noscale") - return core.TransformMode.NoScale; - if (str == "noscaleorreflection") - return core.TransformMode.NoScaleOrReflection; - throw new Error("Unknown transform mode: " + str); - }; - return SkeletonJson; - }()); - core.SkeletonJson = SkeletonJson; - var LinkedMesh = (function () { - function LinkedMesh(mesh, skin, slotIndex, parent, inheritDeform) { - this.mesh = mesh; - this.skin = skin; - this.slotIndex = slotIndex; - this.parent = parent; - this.inheritDeform = inheritDeform; - } - return LinkedMesh; - }()); - })(pixi_spine.core || (pixi_spine.core = {})); - })(pixi_spine || (pixi_spine = {})); - var pixi_spine; - (function (pixi_spine) { - (function (core) { - var SkinEntry = (function () { - function SkinEntry(slotIndex, name, attachment) { - this.slotIndex = slotIndex; - this.name = name; - this.attachment = attachment; - } - return SkinEntry; - }()); - core.SkinEntry = SkinEntry; - var Skin = (function () { - function Skin(name) { - this.attachments = new Array(); - this.bones = Array(); - this.constraints = new Array(); - if (name == null) - throw new Error("name cannot be null."); - this.name = name; - } - Skin.prototype.setAttachment = function (slotIndex, name, attachment) { - if (attachment == null) - throw new Error("attachment cannot be null."); - var attachments = this.attachments; - if (slotIndex >= attachments.length) - attachments.length = slotIndex + 1; - if (!attachments[slotIndex]) - attachments[slotIndex] = {}; - attachments[slotIndex][name] = attachment; - }; - Skin.prototype.addSkin = function (skin) { - for (var i = 0; i < skin.bones.length; i++) { - var bone = skin.bones[i]; - var contained = false; - for (var j = 0; j < this.bones.length; j++) { - if (this.bones[j] == bone) { - contained = true; - break; - } - } - if (!contained) - this.bones.push(bone); - } - for (var i = 0; i < skin.constraints.length; i++) { - var constraint = skin.constraints[i]; - var contained = false; - for (var j = 0; j < this.constraints.length; j++) { - if (this.constraints[j] == constraint) { - contained = true; - break; - } - } - if (!contained) - this.constraints.push(constraint); - } - var attachments = skin.getAttachments(); - for (var i = 0; i < attachments.length; i++) { - var attachment = attachments[i]; - this.setAttachment(attachment.slotIndex, attachment.name, attachment.attachment); - } - }; - Skin.prototype.copySkin = function (skin) { - for (var i = 0; i < skin.bones.length; i++) { - var bone = skin.bones[i]; - var contained = false; - for (var j = 0; j < this.bones.length; j++) { - if (this.bones[j] == bone) { - contained = true; - break; - } - } - if (!contained) - this.bones.push(bone); - } - for (var i = 0; i < skin.constraints.length; i++) { - var constraint = skin.constraints[i]; - var contained = false; - for (var j = 0; j < this.constraints.length; j++) { - if (this.constraints[j] == constraint) { - contained = true; - break; - } - } - if (!contained) - this.constraints.push(constraint); - } - var attachments = skin.getAttachments(); - for (var i = 0; i < attachments.length; i++) { - var attachment = attachments[i]; - if (attachment.attachment == null) - continue; - if (attachment.attachment instanceof core.MeshAttachment) { - attachment.attachment = attachment.attachment.newLinkedMesh(); - this.setAttachment(attachment.slotIndex, attachment.name, attachment.attachment); - } - else { - attachment.attachment = attachment.attachment.copy(); - this.setAttachment(attachment.slotIndex, attachment.name, attachment.attachment); - } - } - }; - Skin.prototype.getAttachment = function (slotIndex, name) { - var dictionary = this.attachments[slotIndex]; - return dictionary ? dictionary[name] : null; - }; - Skin.prototype.removeAttachment = function (slotIndex, name) { - var dictionary = this.attachments[slotIndex]; - if (dictionary) - dictionary[name] = null; - }; - Skin.prototype.getAttachments = function () { - var entries = new Array(); - for (var i = 0; i < this.attachments.length; i++) { - var slotAttachments = this.attachments[i]; - if (slotAttachments) { - for (var name_4 in slotAttachments) { - var attachment = slotAttachments[name_4]; - if (attachment) - entries.push(new SkinEntry(i, name_4, attachment)); - } - } - } - return entries; - }; - Skin.prototype.getAttachmentsForSlot = function (slotIndex, attachments) { - var slotAttachments = this.attachments[slotIndex]; - if (slotAttachments) { - for (var name_5 in slotAttachments) { - var attachment = slotAttachments[name_5]; - if (attachment) - attachments.push(new SkinEntry(slotIndex, name_5, attachment)); - } - } - }; - Skin.prototype.clear = function () { - this.attachments.length = 0; - this.bones.length = 0; - this.constraints.length = 0; - }; - Skin.prototype.attachAll = function (skeleton, oldSkin) { - var slotIndex = 0; - for (var i = 0; i < skeleton.slots.length; i++) { - var slot = skeleton.slots[i]; - var slotAttachment = slot.getAttachment(); - if (slotAttachment && slotIndex < oldSkin.attachments.length) { - var dictionary = oldSkin.attachments[slotIndex]; - for (var key in dictionary) { - var skinAttachment = dictionary[key]; - if (slotAttachment == skinAttachment) { - var attachment = this.getAttachment(slotIndex, key); - if (attachment != null) - slot.setAttachment(attachment); - break; - } - } - } - slotIndex++; - } - }; - return Skin; - }()); - core.Skin = Skin; - })(pixi_spine.core || (pixi_spine.core = {})); - })(pixi_spine || (pixi_spine = {})); - var pixi_spine; - (function (pixi_spine) { - (function (core) { - var Slot = (function () { - function Slot(data, bone) { - this.deform = new Array(); - if (data == null) - throw new Error("data cannot be null."); - if (bone == null) - throw new Error("bone cannot be null."); - this.data = data; - this.bone = bone; - this.color = new core.Color(); - this.darkColor = data.darkColor == null ? null : new core.Color(); - this.setToSetupPose(); - this.blendMode = this.data.blendMode; - } - Slot.prototype.getAttachment = function () { - return this.attachment; - }; - Slot.prototype.setAttachment = function (attachment) { - if (this.attachment == attachment) - return; - this.attachment = attachment; - this.attachmentTime = this.bone.skeleton.time; - this.deform.length = 0; - }; - Slot.prototype.setAttachmentTime = function (time) { - this.attachmentTime = this.bone.skeleton.time - time; - }; - Slot.prototype.getAttachmentTime = function () { - return this.bone.skeleton.time - this.attachmentTime; - }; - Slot.prototype.setToSetupPose = function () { - this.color.setFromColor(this.data.color); - if (this.darkColor != null) - this.darkColor.setFromColor(this.data.darkColor); - if (this.data.attachmentName == null) - this.attachment = null; - else { - this.attachment = null; - this.setAttachment(this.bone.skeleton.getAttachment(this.data.index, this.data.attachmentName)); - } - }; - return Slot; - }()); - core.Slot = Slot; - })(pixi_spine.core || (pixi_spine.core = {})); - })(pixi_spine || (pixi_spine = {})); - var pixi_spine; - (function (pixi_spine) { - (function (core) { - var SlotData = (function () { - function SlotData(index, name, boneData) { - this.color = new core.Color(1, 1, 1, 1); - if (index < 0) - throw new Error("index must be >= 0."); - if (name == null) - throw new Error("name cannot be null."); - if (boneData == null) - throw new Error("boneData cannot be null."); - this.index = index; - this.name = name; - this.boneData = boneData; - } - return SlotData; - }()); - core.SlotData = SlotData; - })(pixi_spine.core || (pixi_spine.core = {})); - })(pixi_spine || (pixi_spine = {})); - var pixi_spine; - (function (pixi_spine) { - (function (core) { - var Texture = (function () { - function Texture(image) { - this._image = image; - } - Texture.prototype.getImage = function () { - return this._image; - }; - Texture.filterFromString = function (text) { - switch (text.toLowerCase()) { - case "nearest": return TextureFilter.Nearest; - case "linear": return TextureFilter.Linear; - case "mipmap": return TextureFilter.MipMap; - case "mipmapnearestnearest": return TextureFilter.MipMapNearestNearest; - case "mipmaplinearnearest": return TextureFilter.MipMapLinearNearest; - case "mipmapnearestlinear": return TextureFilter.MipMapNearestLinear; - case "mipmaplinearlinear": return TextureFilter.MipMapLinearLinear; - default: throw new Error("Unknown texture filter " + text); - } - }; - Texture.wrapFromString = function (text) { - switch (text.toLowerCase()) { - case "mirroredtepeat": return TextureWrap.MirroredRepeat; - case "clamptoedge": return TextureWrap.ClampToEdge; - case "repeat": return TextureWrap.Repeat; - default: throw new Error("Unknown texture wrap " + text); - } - }; - return Texture; - }()); - core.Texture = Texture; - var TextureFilter; - (function (TextureFilter) { - TextureFilter[TextureFilter["Nearest"] = 9728] = "Nearest"; - TextureFilter[TextureFilter["Linear"] = 9729] = "Linear"; - TextureFilter[TextureFilter["MipMap"] = 9987] = "MipMap"; - TextureFilter[TextureFilter["MipMapNearestNearest"] = 9984] = "MipMapNearestNearest"; - TextureFilter[TextureFilter["MipMapLinearNearest"] = 9985] = "MipMapLinearNearest"; - TextureFilter[TextureFilter["MipMapNearestLinear"] = 9986] = "MipMapNearestLinear"; - TextureFilter[TextureFilter["MipMapLinearLinear"] = 9987] = "MipMapLinearLinear"; - })(TextureFilter = core.TextureFilter || (core.TextureFilter = {})); - var TextureWrap; - (function (TextureWrap) { - TextureWrap[TextureWrap["MirroredRepeat"] = 33648] = "MirroredRepeat"; - TextureWrap[TextureWrap["ClampToEdge"] = 33071] = "ClampToEdge"; - TextureWrap[TextureWrap["Repeat"] = 10497] = "Repeat"; - })(TextureWrap = core.TextureWrap || (core.TextureWrap = {})); - var TextureRegion = (function () { - function TextureRegion() { - this.size = null; - } - Object.defineProperty(TextureRegion.prototype, "width", { - get: function () { - var tex = this.texture; - if (PIXI.VERSION[0] == '3') { - return tex.crop.width; - } - if (tex.trim) { - return tex.trim.width; - } - return tex.orig.width; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TextureRegion.prototype, "height", { - get: function () { - var tex = this.texture; - if (PIXI.VERSION[0] == '3') { - return tex.crop.height; - } - if (tex.trim) { - return tex.trim.height; - } - return tex.orig.height; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TextureRegion.prototype, "u", { - get: function () { - return this.texture._uvs.x0; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TextureRegion.prototype, "v", { - get: function () { - return this.texture._uvs.y0; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TextureRegion.prototype, "u2", { - get: function () { - return this.texture._uvs.x2; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TextureRegion.prototype, "v2", { - get: function () { - return this.texture._uvs.y2; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TextureRegion.prototype, "offsetX", { - get: function () { - var tex = this.texture; - return tex.trim ? tex.trim.x : 0; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TextureRegion.prototype, "offsetY", { - get: function () { - console.warn("Deprecation Warning: @Hackerham: I guess, if you are using PIXI-SPINE ATLAS region.offsetY, you want a texture, right? Use region.texture from now on."); - return this.spineOffsetY; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TextureRegion.prototype, "pixiOffsetY", { - get: function () { - var tex = this.texture; - return tex.trim ? tex.trim.y : 0; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TextureRegion.prototype, "spineOffsetY", { - get: function () { - var tex = this.texture; - return this.originalHeight - this.height - (tex.trim ? tex.trim.y : 0); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TextureRegion.prototype, "originalWidth", { - get: function () { - var tex = this.texture; - if (PIXI.VERSION[0] == '3') { - if (tex.trim) { - return tex.trim.width; - } - return tex.crop.width; - } - return tex.orig.width; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TextureRegion.prototype, "originalHeight", { - get: function () { - var tex = this.texture; - if (PIXI.VERSION[0] == '3') { - if (tex.trim) { - return tex.trim.height; - } - return tex.crop.height; - } - return tex.orig.height; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TextureRegion.prototype, "x", { - get: function () { - return this.texture.frame.x; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TextureRegion.prototype, "y", { - get: function () { - return this.texture.frame.y; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TextureRegion.prototype, "rotate", { - get: function () { - return this.texture.rotate !== 0; - }, - enumerable: false, - configurable: true - }); - return TextureRegion; - }()); - core.TextureRegion = TextureRegion; - })(pixi_spine.core || (pixi_spine.core = {})); - })(pixi_spine || (pixi_spine = {})); - var pixi_spine; - (function (pixi_spine) { - (function (core) { - var TextureAtlas = (function () { - function TextureAtlas(atlasText, textureLoader, callback) { - this.pages = new Array(); - this.regions = new Array(); - if (atlasText) { - this.addSpineAtlas(atlasText, textureLoader, callback); - } - } - TextureAtlas.prototype.addTexture = function (name, texture) { - var pages = this.pages; - var page = null; - for (var i = 0; i < pages.length; i++) { - if (pages[i].baseTexture === texture.baseTexture) { - page = pages[i]; - break; - } - } - if (page === null) { - page = new TextureAtlasPage(); - page.name = 'texturePage'; - var baseTexture = texture.baseTexture; - page.width = baseTexture.realWidth; - page.height = baseTexture.realHeight; - page.baseTexture = baseTexture; - page.minFilter = page.magFilter = core.TextureFilter.Nearest; - page.uWrap = core.TextureWrap.ClampToEdge; - page.vWrap = core.TextureWrap.ClampToEdge; - pages.push(page); - } - var region = new TextureAtlasRegion(); - region.name = name; - region.page = page; - region.texture = texture; - region.index = -1; - this.regions.push(region); - return region; - }; - TextureAtlas.prototype.addTextureHash = function (textures, stripExtension) { - for (var key in textures) { - if (textures.hasOwnProperty(key)) { - this.addTexture(stripExtension && key.indexOf('.') !== -1 ? key.substr(0, key.lastIndexOf('.')) : key, textures[key]); - } - } - }; - TextureAtlas.prototype.addSpineAtlas = function (atlasText, textureLoader, callback) { - return this.load(atlasText, textureLoader, callback); - }; - TextureAtlas.prototype.load = function (atlasText, textureLoader, callback) { - var _this = this; - if (textureLoader == null) - throw new Error("textureLoader cannot be null."); - var reader = new TextureAtlasReader(atlasText); - var tuple = new Array(4); - var page = null; - var iterateParser = function () { - while (true) { - var line = reader.readLine(); - if (line == null) { - return callback && callback(_this); - } - line = line.trim(); - if (line.length == 0) - page = null; - else if (!page) { - page = new TextureAtlasPage(); - page.name = line; - if (reader.readTuple(tuple) == 2) { - page.width = parseInt(tuple[0]); - page.height = parseInt(tuple[1]); - reader.readTuple(tuple); - } - reader.readTuple(tuple); - page.minFilter = core.Texture.filterFromString(tuple[0]); - page.magFilter = core.Texture.filterFromString(tuple[1]); - var direction = reader.readValue(); - page.uWrap = core.TextureWrap.ClampToEdge; - page.vWrap = core.TextureWrap.ClampToEdge; - if (direction == "x") - page.uWrap = core.TextureWrap.Repeat; - else if (direction == "y") - page.vWrap = core.TextureWrap.Repeat; - else if (direction == "xy") - page.uWrap = page.vWrap = core.TextureWrap.Repeat; - textureLoader(line, function (texture) { - if (texture === null) { - _this.pages.splice(_this.pages.indexOf(page), 1); - return callback && callback(null); - } - page.baseTexture = texture; - if (!texture.hasLoaded) { - texture.width = page.width; - texture.height = page.height; - } - _this.pages.push(page); - page.setFilters(); - if (!page.width || !page.height) { - page.width = texture.realWidth; - page.height = texture.realHeight; - if (!page.width || !page.height) { - console.log("ERROR spine atlas page " + page.name + ": meshes wont work if you dont specify size in atlas (http://www.html5gamedevs.com/topic/18888-pixi-spines-and-meshes/?p=107121)"); - } - } - iterateParser(); - }); - _this.pages.push(page); - break; - } - else { - var region = new TextureAtlasRegion(); - region.name = line; - region.page = page; - var rotateValue = reader.readValue(); - var rotate = 0; - if (rotateValue.toLocaleLowerCase() == "true") { - rotate = 6; - } - else if (rotateValue.toLocaleLowerCase() == "false") { - rotate = 0; - } - else { - rotate = ((720 - parseFloat(rotateValue)) % 360) / 45; - } - reader.readTuple(tuple); - var x = parseInt(tuple[0]); - var y = parseInt(tuple[1]); - reader.readTuple(tuple); - var width = parseInt(tuple[0]); - var height = parseInt(tuple[1]); - var resolution = page.baseTexture.resolution; - x /= resolution; - y /= resolution; - width /= resolution; - height /= resolution; - var swapWH = rotate % 4 != 0; - var frame = new PIXI.Rectangle(x, y, swapWH ? height : width, swapWH ? width : height); - if (reader.readTuple(tuple) == 4) { - if (reader.readTuple(tuple) == 4) { - reader.readTuple(tuple); - } - } - var originalWidth = parseInt(tuple[0]) / resolution; - var originalHeight = parseInt(tuple[1]) / resolution; - reader.readTuple(tuple); - var offsetX = parseInt(tuple[0]) / resolution; - var offsetY = parseInt(tuple[1]) / resolution; - var orig = new PIXI.Rectangle(0, 0, originalWidth, originalHeight); - var trim = new PIXI.Rectangle(offsetX, originalHeight - height - offsetY, width, height); - if (PIXI.VERSION[0] != '3') { - region.texture = new PIXI.Texture(region.page.baseTexture, frame, orig, trim, rotate); - } - else { - var frame2 = new PIXI.Rectangle(x, y, width, height); - var crop = frame2.clone(); - trim.width = originalWidth; - trim.height = originalHeight; - region.texture = new PIXI.Texture(region.page.baseTexture, frame2, crop, trim, rotate); - } - region.index = parseInt(reader.readValue()); - region.texture._updateUvs(); - _this.regions.push(region); - } - } - }; - iterateParser(); - }; - TextureAtlas.prototype.findRegion = function (name) { - for (var i = 0; i < this.regions.length; i++) { - if (this.regions[i].name == name) { - return this.regions[i]; - } - } - return null; - }; - TextureAtlas.prototype.dispose = function () { - for (var i = 0; i < this.pages.length; i++) { - this.pages[i].baseTexture.dispose(); - } - }; - return TextureAtlas; - }()); - core.TextureAtlas = TextureAtlas; - var TextureAtlasReader = (function () { - function TextureAtlasReader(text) { - this.index = 0; - this.lines = text.split(/\r\n|\r|\n/); - } - TextureAtlasReader.prototype.readLine = function () { - if (this.index >= this.lines.length) - return null; - return this.lines[this.index++]; - }; - TextureAtlasReader.prototype.readValue = function () { - var line = this.readLine(); - var colon = line.indexOf(":"); - if (colon == -1) - throw new Error("Invalid line: " + line); - return line.substring(colon + 1).trim(); - }; - TextureAtlasReader.prototype.readTuple = function (tuple) { - var line = this.readLine(); - var colon = line.indexOf(":"); - if (colon == -1) - throw new Error("Invalid line: " + line); - var i = 0, lastMatch = colon + 1; - for (; i < 3; i++) { - var comma = line.indexOf(",", lastMatch); - if (comma == -1) - break; - tuple[i] = line.substr(lastMatch, comma - lastMatch).trim(); - lastMatch = comma + 1; - } - tuple[i] = line.substring(lastMatch).trim(); - return i + 1; - }; - return TextureAtlasReader; - }()); - var TextureAtlasPage = (function () { - function TextureAtlasPage() { - } - TextureAtlasPage.prototype.setFilters = function () { - var tex = this.baseTexture; - var filter = this.minFilter; - if (filter == core.TextureFilter.Linear) { - tex.scaleMode = PIXI.SCALE_MODES.LINEAR; - } - else if (this.minFilter == core.TextureFilter.Nearest) { - tex.scaleMode = PIXI.SCALE_MODES.NEAREST; - } - else { - tex.mipmap = true; - if (filter == core.TextureFilter.MipMapNearestNearest) { - tex.scaleMode = PIXI.SCALE_MODES.NEAREST; - } - else { - tex.scaleMode = PIXI.SCALE_MODES.LINEAR; - } - } - }; - return TextureAtlasPage; - }()); - core.TextureAtlasPage = TextureAtlasPage; - var TextureAtlasRegion = (function (_super) { - __extends(TextureAtlasRegion, _super); - function TextureAtlasRegion() { - return _super !== null && _super.apply(this, arguments) || this; - } - return TextureAtlasRegion; - }(core.TextureRegion)); - core.TextureAtlasRegion = TextureAtlasRegion; - })(pixi_spine.core || (pixi_spine.core = {})); - })(pixi_spine || (pixi_spine = {})); - var pixi_spine; - (function (pixi_spine) { - (function (core) { - var TransformConstraint = (function () { - function TransformConstraint(data, skeleton) { - this.rotateMix = 0; - this.translateMix = 0; - this.scaleMix = 0; - this.shearMix = 0; - this.temp = new core.Vector2(); - this.active = false; - if (data == null) - throw new Error("data cannot be null."); - if (skeleton == null) - throw new Error("skeleton cannot be null."); - this.data = data; - this.rotateMix = data.rotateMix; - this.translateMix = data.translateMix; - this.scaleMix = data.scaleMix; - this.shearMix = data.shearMix; - this.bones = new Array(); - for (var i = 0; i < data.bones.length; i++) - this.bones.push(skeleton.findBone(data.bones[i].name)); - this.target = skeleton.findBone(data.target.name); - } - TransformConstraint.prototype.isActive = function () { - return this.active; - }; - TransformConstraint.prototype.apply = function () { - this.update(); - }; - TransformConstraint.prototype.update = function () { - if (this.data.local) { - if (this.data.relative) - this.applyRelativeLocal(); - else - this.applyAbsoluteLocal(); - } - else { - if (this.data.relative) - this.applyRelativeWorld(); - else - this.applyAbsoluteWorld(); - } - }; - TransformConstraint.prototype.applyAbsoluteWorld = function () { - var rotateMix = this.rotateMix, translateMix = this.translateMix, scaleMix = this.scaleMix, shearMix = this.shearMix; - var target = this.target; - var targetMat = target.matrix; - var ta = targetMat.a, tb = targetMat.c, tc = targetMat.b, td = targetMat.d; - var degRadReflect = ta * td - tb * tc > 0 ? core.MathUtils.degRad : -core.MathUtils.degRad; - var offsetRotation = this.data.offsetRotation * degRadReflect; - var offsetShearY = this.data.offsetShearY * degRadReflect; - var bones = this.bones; - for (var i = 0, n = bones.length; i < n; i++) { - var bone = bones[i]; - var modified = false; - var mat = bone.matrix; - if (rotateMix != 0) { - var a = mat.a, b = mat.c, c = mat.b, d = mat.d; - var r = Math.atan2(tc, ta) - Math.atan2(c, a) + offsetRotation; - if (r > core.MathUtils.PI) - r -= core.MathUtils.PI2; - else if (r < -core.MathUtils.PI) - r += core.MathUtils.PI2; - r *= rotateMix; - var cos = Math.cos(r), sin = Math.sin(r); - mat.a = cos * a - sin * c; - mat.c = cos * b - sin * d; - mat.b = sin * a + cos * c; - mat.d = sin * b + cos * d; - modified = true; - } - if (translateMix != 0) { - var temp = this.temp; - target.localToWorld(temp.set(this.data.offsetX, this.data.offsetY)); - mat.tx += (temp.x - mat.tx) * translateMix; - mat.ty += (temp.y - mat.ty) * translateMix; - modified = true; - } - if (scaleMix > 0) { - var s = Math.sqrt(mat.a * mat.a + mat.b * mat.b); - var ts = Math.sqrt(ta * ta + tc * tc); - if (s > 0.00001) - s = (s + (ts - s + this.data.offsetScaleX) * scaleMix) / s; - mat.a *= s; - mat.b *= s; - s = Math.sqrt(mat.c * mat.c + mat.d * mat.d); - ts = Math.sqrt(tb * tb + td * td); - if (s > 0.00001) - s = (s + (ts - s + this.data.offsetScaleY) * scaleMix) / s; - mat.c *= s; - mat.d *= s; - modified = true; - } - if (shearMix > 0) { - var b = mat.c, d = mat.d; - var by = Math.atan2(d, b); - var r = Math.atan2(td, tb) - Math.atan2(tc, ta) - (by - Math.atan2(mat.b, mat.a)); - if (r > core.MathUtils.PI) - r -= core.MathUtils.PI2; - else if (r < -core.MathUtils.PI) - r += core.MathUtils.PI2; - r = by + (r + offsetShearY) * shearMix; - var s = Math.sqrt(b * b + d * d); - mat.c = Math.cos(r) * s; - mat.d = Math.sin(r) * s; - modified = true; - } - if (modified) - bone.appliedValid = false; - } - }; - TransformConstraint.prototype.applyRelativeWorld = function () { - var rotateMix = this.rotateMix, translateMix = this.translateMix, scaleMix = this.scaleMix, shearMix = this.shearMix; - var target = this.target; - var targetMat = target.matrix; - var ta = targetMat.a, tb = targetMat.c, tc = targetMat.b, td = targetMat.d; - var degRadReflect = ta * td - tb * tc > 0 ? core.MathUtils.degRad : -core.MathUtils.degRad; - var offsetRotation = this.data.offsetRotation * degRadReflect, offsetShearY = this.data.offsetShearY * degRadReflect; - var bones = this.bones; - for (var i = 0, n = bones.length; i < n; i++) { - var bone = bones[i]; - var modified = false; - var mat = bone.matrix; - if (rotateMix != 0) { - var a = mat.a, b = mat.c, c = mat.b, d = mat.d; - var r = Math.atan2(tc, ta) + offsetRotation; - if (r > core.MathUtils.PI) - r -= core.MathUtils.PI2; - else if (r < -core.MathUtils.PI) - r += core.MathUtils.PI2; - r *= rotateMix; - var cos = Math.cos(r), sin = Math.sin(r); - mat.a = cos * a - sin * c; - mat.c = cos * b - sin * d; - mat.b = sin * a + cos * c; - mat.d = sin * b + cos * d; - modified = true; - } - if (translateMix != 0) { - var temp = this.temp; - target.localToWorld(temp.set(this.data.offsetX, this.data.offsetY)); - mat.tx += temp.x * translateMix; - mat.ty += temp.y * translateMix; - modified = true; - } - if (scaleMix > 0) { - var s = (Math.sqrt(ta * ta + tc * tc) - 1 + this.data.offsetScaleX) * scaleMix + 1; - mat.a *= s; - mat.b *= s; - s = (Math.sqrt(tb * tb + td * td) - 1 + this.data.offsetScaleY) * scaleMix + 1; - mat.c *= s; - mat.d *= s; - modified = true; - } - if (shearMix > 0) { - var r = Math.atan2(td, tb) - Math.atan2(tc, ta); - if (r > core.MathUtils.PI) - r -= core.MathUtils.PI2; - else if (r < -core.MathUtils.PI) - r += core.MathUtils.PI2; - var b = mat.c, d = mat.d; - r = Math.atan2(d, b) + (r - core.MathUtils.PI / 2 + offsetShearY) * shearMix; - var s = Math.sqrt(b * b + d * d); - mat.c = Math.cos(r) * s; - mat.d = Math.sin(r) * s; - modified = true; - } - if (modified) - bone.appliedValid = false; - } - }; - TransformConstraint.prototype.applyAbsoluteLocal = function () { - var rotateMix = this.rotateMix, translateMix = this.translateMix, scaleMix = this.scaleMix, shearMix = this.shearMix; - var target = this.target; - if (!target.appliedValid) - target.updateAppliedTransform(); - var bones = this.bones; - for (var i = 0, n = bones.length; i < n; i++) { - var bone = bones[i]; - if (!bone.appliedValid) - bone.updateAppliedTransform(); - var rotation = bone.arotation; - if (rotateMix != 0) { - var r = target.arotation - rotation + this.data.offsetRotation; - r -= (16384 - ((16384.499999999996 - r / 360) | 0)) * 360; - rotation += r * rotateMix; - } - var x = bone.ax, y = bone.ay; - if (translateMix != 0) { - x += (target.ax - x + this.data.offsetX) * translateMix; - y += (target.ay - y + this.data.offsetY) * translateMix; - } - var scaleX = bone.ascaleX, scaleY = bone.ascaleY; - if (scaleMix > 0) { - if (scaleX > 0.00001) - scaleX = (scaleX + (target.ascaleX - scaleX + this.data.offsetScaleX) * scaleMix) / scaleX; - if (scaleY > 0.00001) - scaleY = (scaleY + (target.ascaleY - scaleY + this.data.offsetScaleY) * scaleMix) / scaleY; - } - var shearY = bone.ashearY; - if (shearMix > 0) { - var r = target.ashearY - shearY + this.data.offsetShearY; - r -= (16384 - ((16384.499999999996 - r / 360) | 0)) * 360; - bone.shearY += r * shearMix; - } - bone.updateWorldTransformWith(x, y, rotation, scaleX, scaleY, bone.ashearX, shearY); - } - }; - TransformConstraint.prototype.applyRelativeLocal = function () { - var rotateMix = this.rotateMix, translateMix = this.translateMix, scaleMix = this.scaleMix, shearMix = this.shearMix; - var target = this.target; - if (!target.appliedValid) - target.updateAppliedTransform(); - var bones = this.bones; - for (var i = 0, n = bones.length; i < n; i++) { - var bone = bones[i]; - if (!bone.appliedValid) - bone.updateAppliedTransform(); - var rotation = bone.arotation; - if (rotateMix != 0) - rotation += (target.arotation + this.data.offsetRotation) * rotateMix; - var x = bone.ax, y = bone.ay; - if (translateMix != 0) { - x += (target.ax + this.data.offsetX) * translateMix; - y += (target.ay + this.data.offsetY) * translateMix; - } - var scaleX = bone.ascaleX, scaleY = bone.ascaleY; - if (scaleMix > 0) { - if (scaleX > 0.00001) - scaleX *= ((target.ascaleX - 1 + this.data.offsetScaleX) * scaleMix) + 1; - if (scaleY > 0.00001) - scaleY *= ((target.ascaleY - 1 + this.data.offsetScaleY) * scaleMix) + 1; - } - var shearY = bone.ashearY; - if (shearMix > 0) - shearY += (target.ashearY + this.data.offsetShearY) * shearMix; - bone.updateWorldTransformWith(x, y, rotation, scaleX, scaleY, bone.ashearX, shearY); - } - }; - return TransformConstraint; - }()); - core.TransformConstraint = TransformConstraint; - })(pixi_spine.core || (pixi_spine.core = {})); - })(pixi_spine || (pixi_spine = {})); - var pixi_spine; - (function (pixi_spine) { - (function (core) { - var TransformConstraintData = (function (_super) { - __extends(TransformConstraintData, _super); - function TransformConstraintData(name) { - var _this = _super.call(this, name, 0, false) || this; - _this.bones = new Array(); - _this.rotateMix = 0; - _this.translateMix = 0; - _this.scaleMix = 0; - _this.shearMix = 0; - _this.offsetRotation = 0; - _this.offsetX = 0; - _this.offsetY = 0; - _this.offsetScaleX = 0; - _this.offsetScaleY = 0; - _this.offsetShearY = 0; - _this.relative = false; - _this.local = false; - return _this; - } - return TransformConstraintData; - }(core.ConstraintData)); - core.TransformConstraintData = TransformConstraintData; - })(pixi_spine.core || (pixi_spine.core = {})); - })(pixi_spine || (pixi_spine = {})); - var pixi_spine; - (function (pixi_spine) { - (function (core) { - var Triangulator = (function () { - function Triangulator() { - this.convexPolygons = new Array(); - this.convexPolygonsIndices = new Array(); - this.indicesArray = new Array(); - this.isConcaveArray = new Array(); - this.triangles = new Array(); - this.polygonPool = new core.Pool(function () { - return new Array(); - }); - this.polygonIndicesPool = new core.Pool(function () { - return new Array(); - }); - } - Triangulator.prototype.triangulate = function (verticesArray) { - var vertices = verticesArray; - var vertexCount = verticesArray.length >> 1; - var indices = this.indicesArray; - indices.length = 0; - for (var i = 0; i < vertexCount; i++) - indices[i] = i; - var isConcave = this.isConcaveArray; - isConcave.length = 0; - for (var i = 0, n = vertexCount; i < n; ++i) - isConcave[i] = Triangulator.isConcave(i, vertexCount, vertices, indices); - var triangles = this.triangles; - triangles.length = 0; - while (vertexCount > 3) { - var previous = vertexCount - 1, i = 0, next = 1; - while (true) { - outer: if (!isConcave[i]) { - var p1 = indices[previous] << 1, p2 = indices[i] << 1, p3 = indices[next] << 1; - var p1x = vertices[p1], p1y = vertices[p1 + 1]; - var p2x = vertices[p2], p2y = vertices[p2 + 1]; - var p3x = vertices[p3], p3y = vertices[p3 + 1]; - for (var ii = (next + 1) % vertexCount; ii != previous; ii = (ii + 1) % vertexCount) { - if (!isConcave[ii]) - continue; - var v = indices[ii] << 1; - var vx = vertices[v], vy = vertices[v + 1]; - if (Triangulator.positiveArea(p3x, p3y, p1x, p1y, vx, vy)) { - if (Triangulator.positiveArea(p1x, p1y, p2x, p2y, vx, vy)) { - if (Triangulator.positiveArea(p2x, p2y, p3x, p3y, vx, vy)) - break outer; - } - } - } - break; - } - if (next == 0) { - do { - if (!isConcave[i]) - break; - i--; - } while (i > 0); - break; - } - previous = i; - i = next; - next = (next + 1) % vertexCount; - } - triangles.push(indices[(vertexCount + i - 1) % vertexCount]); - triangles.push(indices[i]); - triangles.push(indices[(i + 1) % vertexCount]); - indices.splice(i, 1); - isConcave.splice(i, 1); - vertexCount--; - var previousIndex = (vertexCount + i - 1) % vertexCount; - var nextIndex = i == vertexCount ? 0 : i; - isConcave[previousIndex] = Triangulator.isConcave(previousIndex, vertexCount, vertices, indices); - isConcave[nextIndex] = Triangulator.isConcave(nextIndex, vertexCount, vertices, indices); - } - if (vertexCount == 3) { - triangles.push(indices[2]); - triangles.push(indices[0]); - triangles.push(indices[1]); - } - return triangles; - }; - Triangulator.prototype.decompose = function (verticesArray, triangles) { - var vertices = verticesArray; - var convexPolygons = this.convexPolygons; - this.polygonPool.freeAll(convexPolygons); - convexPolygons.length = 0; - var convexPolygonsIndices = this.convexPolygonsIndices; - this.polygonIndicesPool.freeAll(convexPolygonsIndices); - convexPolygonsIndices.length = 0; - var polygonIndices = this.polygonIndicesPool.obtain(); - polygonIndices.length = 0; - var polygon = this.polygonPool.obtain(); - polygon.length = 0; - var fanBaseIndex = -1, lastWinding = 0; - for (var i = 0, n = triangles.length; i < n; i += 3) { - var t1 = triangles[i] << 1, t2 = triangles[i + 1] << 1, t3 = triangles[i + 2] << 1; - var x1 = vertices[t1], y1 = vertices[t1 + 1]; - var x2 = vertices[t2], y2 = vertices[t2 + 1]; - var x3 = vertices[t3], y3 = vertices[t3 + 1]; - var merged = false; - if (fanBaseIndex == t1) { - var o = polygon.length - 4; - var winding1 = Triangulator.winding(polygon[o], polygon[o + 1], polygon[o + 2], polygon[o + 3], x3, y3); - var winding2 = Triangulator.winding(x3, y3, polygon[0], polygon[1], polygon[2], polygon[3]); - if (winding1 == lastWinding && winding2 == lastWinding) { - polygon.push(x3); - polygon.push(y3); - polygonIndices.push(t3); - merged = true; - } - } - if (!merged) { - if (polygon.length > 0) { - convexPolygons.push(polygon); - convexPolygonsIndices.push(polygonIndices); - } - else { - this.polygonPool.free(polygon); - this.polygonIndicesPool.free(polygonIndices); - } - polygon = this.polygonPool.obtain(); - polygon.length = 0; - polygon.push(x1); - polygon.push(y1); - polygon.push(x2); - polygon.push(y2); - polygon.push(x3); - polygon.push(y3); - polygonIndices = this.polygonIndicesPool.obtain(); - polygonIndices.length = 0; - polygonIndices.push(t1); - polygonIndices.push(t2); - polygonIndices.push(t3); - lastWinding = Triangulator.winding(x1, y1, x2, y2, x3, y3); - fanBaseIndex = t1; - } - } - if (polygon.length > 0) { - convexPolygons.push(polygon); - convexPolygonsIndices.push(polygonIndices); - } - for (var i = 0, n = convexPolygons.length; i < n; i++) { - polygonIndices = convexPolygonsIndices[i]; - if (polygonIndices.length == 0) - continue; - var firstIndex = polygonIndices[0]; - var lastIndex = polygonIndices[polygonIndices.length - 1]; - polygon = convexPolygons[i]; - var o = polygon.length - 4; - var prevPrevX = polygon[o], prevPrevY = polygon[o + 1]; - var prevX = polygon[o + 2], prevY = polygon[o + 3]; - var firstX = polygon[0], firstY = polygon[1]; - var secondX = polygon[2], secondY = polygon[3]; - var winding = Triangulator.winding(prevPrevX, prevPrevY, prevX, prevY, firstX, firstY); - for (var ii = 0; ii < n; ii++) { - if (ii == i) - continue; - var otherIndices = convexPolygonsIndices[ii]; - if (otherIndices.length != 3) - continue; - var otherFirstIndex = otherIndices[0]; - var otherSecondIndex = otherIndices[1]; - var otherLastIndex = otherIndices[2]; - var otherPoly = convexPolygons[ii]; - var x3 = otherPoly[otherPoly.length - 2], y3 = otherPoly[otherPoly.length - 1]; - if (otherFirstIndex != firstIndex || otherSecondIndex != lastIndex) - continue; - var winding1 = Triangulator.winding(prevPrevX, prevPrevY, prevX, prevY, x3, y3); - var winding2 = Triangulator.winding(x3, y3, firstX, firstY, secondX, secondY); - if (winding1 == winding && winding2 == winding) { - otherPoly.length = 0; - otherIndices.length = 0; - polygon.push(x3); - polygon.push(y3); - polygonIndices.push(otherLastIndex); - prevPrevX = prevX; - prevPrevY = prevY; - prevX = x3; - prevY = y3; - ii = 0; - } - } - } - for (var i = convexPolygons.length - 1; i >= 0; i--) { - polygon = convexPolygons[i]; - if (polygon.length == 0) { - convexPolygons.splice(i, 1); - this.polygonPool.free(polygon); - polygonIndices = convexPolygonsIndices[i]; - convexPolygonsIndices.splice(i, 1); - this.polygonIndicesPool.free(polygonIndices); - } - } - return convexPolygons; - }; - Triangulator.isConcave = function (index, vertexCount, vertices, indices) { - var previous = indices[(vertexCount + index - 1) % vertexCount] << 1; - var current = indices[index] << 1; - var next = indices[(index + 1) % vertexCount] << 1; - return !this.positiveArea(vertices[previous], vertices[previous + 1], vertices[current], vertices[current + 1], vertices[next], vertices[next + 1]); - }; - Triangulator.positiveArea = function (p1x, p1y, p2x, p2y, p3x, p3y) { - return p1x * (p3y - p2y) + p2x * (p1y - p3y) + p3x * (p2y - p1y) >= 0; - }; - Triangulator.winding = function (p1x, p1y, p2x, p2y, p3x, p3y) { - var px = p2x - p1x, py = p2y - p1y; - return p3x * py - p3y * px + px * p1y - p1x * py >= 0 ? 1 : -1; - }; - return Triangulator; - }()); - core.Triangulator = Triangulator; - })(pixi_spine.core || (pixi_spine.core = {})); - })(pixi_spine || (pixi_spine = {})); - var pixi_spine; - (function (pixi_spine) { - (function (core) { - var IntSet = (function () { - function IntSet() { - this.array = new Array(); - } - IntSet.prototype.add = function (value) { - var contains = this.contains(value); - this.array[value | 0] = value | 0; - return !contains; - }; - IntSet.prototype.contains = function (value) { - return this.array[value | 0] != undefined; - }; - IntSet.prototype.remove = function (value) { - this.array[value | 0] = undefined; - }; - IntSet.prototype.clear = function () { - this.array.length = 0; - }; - return IntSet; - }()); - core.IntSet = IntSet; - var Color = (function () { - function Color(r, g, b, a) { - if (r === void 0) { r = 0; } - if (g === void 0) { g = 0; } - if (b === void 0) { b = 0; } - if (a === void 0) { a = 0; } - this.r = r; - this.g = g; - this.b = b; - this.a = a; - } - Color.prototype.set = function (r, g, b, a) { - this.r = r; - this.g = g; - this.b = b; - this.a = a; - this.clamp(); - return this; - }; - Color.prototype.setFromColor = function (c) { - this.r = c.r; - this.g = c.g; - this.b = c.b; - this.a = c.a; - return this; - }; - Color.prototype.setFromString = function (hex) { - hex = hex.charAt(0) == '#' ? hex.substr(1) : hex; - this.r = parseInt(hex.substr(0, 2), 16) / 255.0; - this.g = parseInt(hex.substr(2, 2), 16) / 255.0; - this.b = parseInt(hex.substr(4, 2), 16) / 255.0; - this.a = (hex.length != 8 ? 255 : parseInt(hex.substr(6, 2), 16)) / 255.0; - return this; - }; - Color.prototype.add = function (r, g, b, a) { - this.r += r; - this.g += g; - this.b += b; - this.a += a; - this.clamp(); - return this; - }; - Color.prototype.clamp = function () { - if (this.r < 0) - this.r = 0; - else if (this.r > 1) - this.r = 1; - if (this.g < 0) - this.g = 0; - else if (this.g > 1) - this.g = 1; - if (this.b < 0) - this.b = 0; - else if (this.b > 1) - this.b = 1; - if (this.a < 0) - this.a = 0; - else if (this.a > 1) - this.a = 1; - return this; - }; - Color.rgba8888ToColor = function (color, value) { - color.r = ((value & 0xff000000) >>> 24) / 255; - color.g = ((value & 0x00ff0000) >>> 16) / 255; - color.b = ((value & 0x0000ff00) >>> 8) / 255; - color.a = ((value & 0x000000ff)) / 255; - }; - Color.rgb888ToColor = function (color, value) { - color.r = ((value & 0x00ff0000) >>> 16) / 255; - color.g = ((value & 0x0000ff00) >>> 8) / 255; - color.b = ((value & 0x000000ff)) / 255; - }; - Color.WHITE = new Color(1, 1, 1, 1); - Color.RED = new Color(1, 0, 0, 1); - Color.GREEN = new Color(0, 1, 0, 1); - Color.BLUE = new Color(0, 0, 1, 1); - Color.MAGENTA = new Color(1, 0, 1, 1); - return Color; - }()); - core.Color = Color; - var MathUtils = (function () { - function MathUtils() { - } - MathUtils.clamp = function (value, min, max) { - if (value < min) - return min; - if (value > max) - return max; - return value; - }; - MathUtils.cosDeg = function (degrees) { - return Math.cos(degrees * MathUtils.degRad); - }; - MathUtils.sinDeg = function (degrees) { - return Math.sin(degrees * MathUtils.degRad); - }; - MathUtils.signum = function (value) { - return value > 0 ? 1 : value < 0 ? -1 : 0; - }; - MathUtils.toInt = function (x) { - return x > 0 ? Math.floor(x) : Math.ceil(x); - }; - MathUtils.cbrt = function (x) { - var y = Math.pow(Math.abs(x), 1 / 3); - return x < 0 ? -y : y; - }; - MathUtils.randomTriangular = function (min, max) { - return MathUtils.randomTriangularWith(min, max, (min + max) * 0.5); - }; - MathUtils.randomTriangularWith = function (min, max, mode) { - var u = Math.random(); - var d = max - min; - if (u <= (mode - min) / d) - return min + Math.sqrt(u * d * (mode - min)); - return max - Math.sqrt((1 - u) * d * (max - mode)); - }; - MathUtils.PI = 3.1415927; - MathUtils.PI2 = MathUtils.PI * 2; - MathUtils.radiansToDegrees = 180 / MathUtils.PI; - MathUtils.radDeg = MathUtils.radiansToDegrees; - MathUtils.degreesToRadians = MathUtils.PI / 180; - MathUtils.degRad = MathUtils.degreesToRadians; - return MathUtils; - }()); - core.MathUtils = MathUtils; - var Interpolation = (function () { - function Interpolation() { - } - Interpolation.prototype.apply = function (start, end, a) { - return start + (end - start) * this.applyInternal(a); - }; - return Interpolation; - }()); - core.Interpolation = Interpolation; - var Pow = (function (_super) { - __extends(Pow, _super); - function Pow(power) { - var _this = _super.call(this) || this; - _this.power = 2; - _this.power = power; - return _this; - } - Pow.prototype.applyInternal = function (a) { - if (a <= 0.5) - return Math.pow(a * 2, this.power) / 2; - return Math.pow((a - 1) * 2, this.power) / (this.power % 2 == 0 ? -2 : 2) + 1; - }; - return Pow; - }(Interpolation)); - core.Pow = Pow; - var PowOut = (function (_super) { - __extends(PowOut, _super); - function PowOut(power) { - return _super.call(this, power) || this; - } - PowOut.prototype.applyInternal = function (a) { - return Math.pow(a - 1, this.power) * (this.power % 2 == 0 ? -1 : 1) + 1; - }; - return PowOut; - }(Pow)); - core.PowOut = PowOut; - var Utils = (function () { - function Utils() { - } - Utils.arrayCopy = function (source, sourceStart, dest, destStart, numElements) { - for (var i = sourceStart, j = destStart; i < sourceStart + numElements; i++, j++) { - dest[j] = source[i]; - } - }; - Utils.setArraySize = function (array, size, value) { - if (value === void 0) { value = 0; } - var oldSize = array.length; - if (oldSize == size) - return array; - array.length = size; - if (oldSize < size) { - for (var i = oldSize; i < size; i++) - array[i] = value; - } - return array; - }; - Utils.ensureArrayCapacity = function (array, size, value) { - if (value === void 0) { value = 0; } - if (array.length >= size) - return array; - return Utils.setArraySize(array, size, value); - }; - Utils.newArray = function (size, defaultValue) { - var array = new Array(size); - for (var i = 0; i < size; i++) - array[i] = defaultValue; - return array; - }; - Utils.newFloatArray = function (size) { - if (Utils.SUPPORTS_TYPED_ARRAYS) { - return new Float32Array(size); - } - else { - var array = new Array(size); - for (var i = 0; i < array.length; i++) - array[i] = 0; - return array; - } - }; - Utils.newShortArray = function (size) { - if (Utils.SUPPORTS_TYPED_ARRAYS) { - return new Int16Array(size); - } - else { - var array = new Array(size); - for (var i = 0; i < array.length; i++) - array[i] = 0; - return array; - } - }; - Utils.toFloatArray = function (array) { - return Utils.SUPPORTS_TYPED_ARRAYS ? new Float32Array(array) : array; - }; - Utils.toSinglePrecision = function (value) { - return Utils.SUPPORTS_TYPED_ARRAYS ? Math.fround(value) : value; - }; - Utils.webkit602BugfixHelper = function (alpha, blend) { - }; - Utils.contains = function (array, element, identity) { - for (var i = 0; i < array.length; i++) { - if (array[i] == element) - return true; - } - return false; - }; - Utils.SUPPORTS_TYPED_ARRAYS = typeof (Float32Array) !== "undefined"; - return Utils; - }()); - core.Utils = Utils; - var DebugUtils = (function () { - function DebugUtils() { - } - DebugUtils.logBones = function (skeleton) { - for (var i = 0; i < skeleton.bones.length; i++) { - var bone = skeleton.bones[i]; - var mat = bone.matrix; - console.log(bone.data.name + ", " + mat.a + ", " + mat.b + ", " + mat.c + ", " + mat.d + ", " + mat.tx + ", " + mat.ty); - } - }; - return DebugUtils; - }()); - core.DebugUtils = DebugUtils; - var Pool = (function () { - function Pool(instantiator) { - this.items = new Array(); - this.instantiator = instantiator; - } - Pool.prototype.obtain = function () { - return this.items.length > 0 ? this.items.pop() : this.instantiator(); - }; - Pool.prototype.free = function (item) { - if (item.reset) - item.reset(); - this.items.push(item); - }; - Pool.prototype.freeAll = function (items) { - for (var i = 0; i < items.length; i++) { - this.free(items[i]); - } - }; - Pool.prototype.clear = function () { - this.items.length = 0; - }; - return Pool; - }()); - core.Pool = Pool; - var Vector2 = (function () { - function Vector2(x, y) { - if (x === void 0) { x = 0; } - if (y === void 0) { y = 0; } - this.x = x; - this.y = y; - } - Vector2.prototype.set = function (x, y) { - this.x = x; - this.y = y; - return this; - }; - Vector2.prototype.length = function () { - var x = this.x; - var y = this.y; - return Math.sqrt(x * x + y * y); - }; - Vector2.prototype.normalize = function () { - var len = this.length(); - if (len != 0) { - this.x /= len; - this.y /= len; - } - return this; - }; - return Vector2; - }()); - core.Vector2 = Vector2; - var TimeKeeper = (function () { - function TimeKeeper() { - this.maxDelta = 0.064; - this.framesPerSecond = 0; - this.delta = 0; - this.totalTime = 0; - this.lastTime = Date.now() / 1000; - this.frameCount = 0; - this.frameTime = 0; - } - TimeKeeper.prototype.update = function () { - var now = Date.now() / 1000; - this.delta = now - this.lastTime; - this.frameTime += this.delta; - this.totalTime += this.delta; - if (this.delta > this.maxDelta) - this.delta = this.maxDelta; - this.lastTime = now; - this.frameCount++; - if (this.frameTime > 1) { - this.framesPerSecond = this.frameCount / this.frameTime; - this.frameTime = 0; - this.frameCount = 0; - } - }; - return TimeKeeper; - }()); - core.TimeKeeper = TimeKeeper; - var WindowedMean = (function () { - function WindowedMean(windowSize) { - if (windowSize === void 0) { windowSize = 32; } - this.addedValues = 0; - this.lastValue = 0; - this.mean = 0; - this.dirty = true; - this.values = new Array(windowSize); - } - WindowedMean.prototype.hasEnoughData = function () { - return this.addedValues >= this.values.length; - }; - WindowedMean.prototype.addValue = function (value) { - if (this.addedValues < this.values.length) - this.addedValues++; - this.values[this.lastValue++] = value; - if (this.lastValue > this.values.length - 1) - this.lastValue = 0; - this.dirty = true; - }; - WindowedMean.prototype.getMean = function () { - if (this.hasEnoughData()) { - if (this.dirty) { - var mean = 0; - for (var i = 0; i < this.values.length; i++) { - mean += this.values[i]; - } - this.mean = mean / this.values.length; - this.dirty = false; - } - return this.mean; - } - else { - return 0; - } - }; - return WindowedMean; - }()); - core.WindowedMean = WindowedMean; - })(pixi_spine.core || (pixi_spine.core = {})); - })(pixi_spine || (pixi_spine = {})); - var pixi_spine; - (function (pixi_spine) { - (function (core) { - var Attachment = (function () { - function Attachment(name) { - if (name == null) - throw new Error("name cannot be null."); - this.name = name; - } - return Attachment; - }()); - core.Attachment = Attachment; - var VertexAttachment = (function (_super) { - __extends(VertexAttachment, _super); - function VertexAttachment(name) { - var _this = _super.call(this, name) || this; - _this.id = (VertexAttachment.nextID++ & 65535) << 11; - _this.worldVerticesLength = 0; - _this.deformAttachment = _this; - return _this; - } - VertexAttachment.prototype.computeWorldVerticesOld = function (slot, worldVertices) { - this.computeWorldVertices(slot, 0, this.worldVerticesLength, worldVertices, 0, 2); - }; - VertexAttachment.prototype.computeWorldVertices = function (slot, start, count, worldVertices, offset, stride) { - count = offset + (count >> 1) * stride; - var skeleton = slot.bone.skeleton; - var deformArray = slot.deform; - var vertices = this.vertices; - var bones = this.bones; - if (bones == null) { - if (deformArray.length > 0) - vertices = deformArray; - var mat = slot.bone.matrix; - var x = mat.tx; - var y = mat.ty; - var a = mat.a, b = mat.c, c = mat.b, d = mat.d; - for (var v_1 = start, w = offset; w < count; v_1 += 2, w += stride) { - var vx = vertices[v_1], vy = vertices[v_1 + 1]; - worldVertices[w] = vx * a + vy * b + x; - worldVertices[w + 1] = vx * c + vy * d + y; - } - return; - } - var v = 0, skip = 0; - for (var i = 0; i < start; i += 2) { - var n = bones[v]; - v += n + 1; - skip += n; - } - var skeletonBones = skeleton.bones; - if (deformArray.length == 0) { - for (var w = offset, b = skip * 3; w < count; w += stride) { - var wx = 0, wy = 0; - var n = bones[v++]; - n += v; - for (; v < n; v++, b += 3) { - var mat = skeletonBones[bones[v]].matrix; - var vx = vertices[b], vy = vertices[b + 1], weight = vertices[b + 2]; - wx += (vx * mat.a + vy * mat.c + mat.tx) * weight; - wy += (vx * mat.b + vy * mat.d + mat.ty) * weight; - } - worldVertices[w] = wx; - worldVertices[w + 1] = wy; - } - } - else { - var deform = deformArray; - for (var w = offset, b = skip * 3, f = skip << 1; w < count; w += stride) { - var wx = 0, wy = 0; - var n = bones[v++]; - n += v; - for (; v < n; v++, b += 3, f += 2) { - var mat = skeletonBones[bones[v]].matrix; - var vx = vertices[b] + deform[f], vy = vertices[b + 1] + deform[f + 1], weight = vertices[b + 2]; - wx += (vx * mat.a + vy * mat.c + mat.tx) * weight; - wy += (vx * mat.b + vy * mat.d + mat.ty) * weight; - } - worldVertices[w] = wx; - worldVertices[w + 1] = wy; - } - } - }; - VertexAttachment.prototype.copyTo = function (attachment) { - if (this.bones != null) { - attachment.bones = new Array(this.bones.length); - core.Utils.arrayCopy(this.bones, 0, attachment.bones, 0, this.bones.length); - } - else - attachment.bones = null; - if (this.vertices != null) { - attachment.vertices = core.Utils.newFloatArray(this.vertices.length); - core.Utils.arrayCopy(this.vertices, 0, attachment.vertices, 0, this.vertices.length); - } - else - attachment.vertices = null; - attachment.worldVerticesLength = this.worldVerticesLength; - attachment.deformAttachment = this.deformAttachment; - }; - VertexAttachment.nextID = 0; - return VertexAttachment; - }(Attachment)); - core.VertexAttachment = VertexAttachment; - })(pixi_spine.core || (pixi_spine.core = {})); - })(pixi_spine || (pixi_spine = {})); - var pixi_spine; - (function (pixi_spine) { - (function (core) { - (function (AttachmentType) { - AttachmentType[AttachmentType["Region"] = 0] = "Region"; - AttachmentType[AttachmentType["BoundingBox"] = 1] = "BoundingBox"; - AttachmentType[AttachmentType["Mesh"] = 2] = "Mesh"; - AttachmentType[AttachmentType["LinkedMesh"] = 3] = "LinkedMesh"; - AttachmentType[AttachmentType["Path"] = 4] = "Path"; - AttachmentType[AttachmentType["Point"] = 5] = "Point"; - AttachmentType[AttachmentType["Clipping"] = 6] = "Clipping"; - })(core.AttachmentType || (core.AttachmentType = {})); - })(pixi_spine.core || (pixi_spine.core = {})); - })(pixi_spine || (pixi_spine = {})); - var pixi_spine; - (function (pixi_spine) { - (function (core) { - var BoundingBoxAttachment = (function (_super) { - __extends(BoundingBoxAttachment, _super); - function BoundingBoxAttachment(name) { - var _this = _super.call(this, name) || this; - _this.color = new core.Color(1, 1, 1, 1); - return _this; - } - BoundingBoxAttachment.prototype.copy = function () { - var copy = new BoundingBoxAttachment(this.name); - this.copyTo(copy); - copy.color.setFromColor(this.color); - return copy; - }; - return BoundingBoxAttachment; - }(core.VertexAttachment)); - core.BoundingBoxAttachment = BoundingBoxAttachment; - })(pixi_spine.core || (pixi_spine.core = {})); - })(pixi_spine || (pixi_spine = {})); - var pixi_spine; - (function (pixi_spine) { - (function (core) { - var ClippingAttachment = (function (_super) { - __extends(ClippingAttachment, _super); - function ClippingAttachment(name) { - var _this = _super.call(this, name) || this; - _this.color = new core.Color(0.2275, 0.2275, 0.8078, 1); - return _this; - } - ClippingAttachment.prototype.copy = function () { - var copy = new ClippingAttachment(this.name); - this.copyTo(copy); - copy.endSlot = this.endSlot; - copy.color.setFromColor(this.color); - return copy; - }; - return ClippingAttachment; - }(core.VertexAttachment)); - core.ClippingAttachment = ClippingAttachment; - })(pixi_spine.core || (pixi_spine.core = {})); - })(pixi_spine || (pixi_spine = {})); - var pixi_spine; - (function (pixi_spine) { - (function (core) { - var MeshAttachment = (function (_super) { - __extends(MeshAttachment, _super); - function MeshAttachment(name) { - var _this = _super.call(this, name) || this; - _this.color = new core.Color(1, 1, 1, 1); - _this.tempColor = new core.Color(0, 0, 0, 0); - return _this; - } - MeshAttachment.prototype.updateUVs = function (region, uvs) { - var regionUVs = this.regionUVs; - var n = regionUVs.length; - if (!uvs || uvs.length != n) { - uvs = core.Utils.newFloatArray(n); - } - if (region == null) { - return; - } - var texture = region.texture; - var r = texture._uvs; - var w1 = region.width, h1 = region.height, w2 = region.originalWidth, h2 = region.originalHeight; - var x = region.offsetX, y = region.pixiOffsetY; - for (var i = 0; i < n; i += 2) { - var u = this.regionUVs[i], v = this.regionUVs[i + 1]; - u = (u * w2 - x) / w1; - v = (v * h2 - y) / h1; - uvs[i] = (r.x0 * (1 - u) + r.x1 * u) * (1 - v) + (r.x3 * (1 - u) + r.x2 * u) * v; - uvs[i + 1] = (r.y0 * (1 - u) + r.y1 * u) * (1 - v) + (r.y3 * (1 - u) + r.y2 * u) * v; - } - return uvs; - }; - MeshAttachment.prototype.getParentMesh = function () { - return this.parentMesh; - }; - MeshAttachment.prototype.setParentMesh = function (parentMesh) { - this.parentMesh = parentMesh; - if (parentMesh != null) { - this.bones = parentMesh.bones; - this.vertices = parentMesh.vertices; - this.worldVerticesLength = parentMesh.worldVerticesLength; - this.regionUVs = parentMesh.regionUVs; - this.triangles = parentMesh.triangles; - this.hullLength = parentMesh.hullLength; - this.worldVerticesLength = parentMesh.worldVerticesLength; - } - }; - MeshAttachment.prototype.copy = function () { - if (this.parentMesh != null) - return this.newLinkedMesh(); - var copy = new MeshAttachment(this.name); - copy.region = this.region; - copy.path = this.path; - copy.color.setFromColor(this.color); - this.copyTo(copy); - copy.regionUVs = new Float32Array(this.regionUVs.length); - core.Utils.arrayCopy(this.regionUVs, 0, copy.regionUVs, 0, this.regionUVs.length); - copy.uvs = new Array(this.uvs.length); - core.Utils.arrayCopy(this.uvs, 0, copy.uvs, 0, this.uvs.length); - copy.triangles = new Array(this.triangles.length); - core.Utils.arrayCopy(this.triangles, 0, copy.triangles, 0, this.triangles.length); - copy.hullLength = this.hullLength; - if (this.edges != null) { - copy.edges = new Array(this.edges.length); - core.Utils.arrayCopy(this.edges, 0, copy.edges, 0, this.edges.length); - } - copy.width = this.width; - copy.height = this.height; - return copy; - }; - MeshAttachment.prototype.newLinkedMesh = function () { - var copy = new MeshAttachment(this.name); - copy.region = this.region; - copy.path = this.path; - copy.color.setFromColor(this.color); - copy.deformAttachment = this.deformAttachment; - copy.setParentMesh(this.parentMesh != null ? this.parentMesh : this); - return copy; - }; - return MeshAttachment; - }(core.VertexAttachment)); - core.MeshAttachment = MeshAttachment; - })(pixi_spine.core || (pixi_spine.core = {})); - })(pixi_spine || (pixi_spine = {})); - var pixi_spine; - (function (pixi_spine) { - (function (core) { - var PathAttachment = (function (_super) { - __extends(PathAttachment, _super); - function PathAttachment(name) { - var _this = _super.call(this, name) || this; - _this.closed = false; - _this.constantSpeed = false; - _this.color = new core.Color(1, 1, 1, 1); - return _this; - } - PathAttachment.prototype.copy = function () { - var copy = new PathAttachment(this.name); - this.copyTo(copy); - copy.lengths = new Array(this.lengths.length); - core.Utils.arrayCopy(this.lengths, 0, copy.lengths, 0, this.lengths.length); - copy.closed = closed; - copy.constantSpeed = this.constantSpeed; - copy.color.setFromColor(this.color); - return copy; - }; - return PathAttachment; - }(core.VertexAttachment)); - core.PathAttachment = PathAttachment; - })(pixi_spine.core || (pixi_spine.core = {})); - })(pixi_spine || (pixi_spine = {})); - var pixi_spine; - (function (pixi_spine) { - (function (core) { - var PointAttachment = (function (_super) { - __extends(PointAttachment, _super); - function PointAttachment(name) { - var _this = _super.call(this, name) || this; - _this.color = new core.Color(0.38, 0.94, 0, 1); - return _this; - } - PointAttachment.prototype.computeWorldPosition = function (bone, point) { - var mat = bone.matrix; - point.x = this.x * mat.a + this.y * mat.c + bone.worldX; - point.y = this.x * mat.b + this.y * mat.d + bone.worldY; - return point; - }; - PointAttachment.prototype.computeWorldRotation = function (bone) { - var mat = bone.matrix; - var cos = core.MathUtils.cosDeg(this.rotation), sin = core.MathUtils.sinDeg(this.rotation); - var x = cos * mat.a + sin * mat.c; - var y = cos * mat.b + sin * mat.d; - return Math.atan2(y, x) * core.MathUtils.radDeg; - }; - PointAttachment.prototype.copy = function () { - var copy = new PointAttachment(this.name); - copy.x = this.x; - copy.y = this.y; - copy.rotation = this.rotation; - copy.color.setFromColor(this.color); - return copy; - }; - return PointAttachment; - }(core.VertexAttachment)); - core.PointAttachment = PointAttachment; - })(pixi_spine.core || (pixi_spine.core = {})); - })(pixi_spine || (pixi_spine = {})); - var pixi_spine; - (function (pixi_spine) { - (function (core) { - var RegionAttachment = (function (_super) { - __extends(RegionAttachment, _super); - function RegionAttachment(name) { - var _this = _super.call(this, name) || this; - _this.x = 0; - _this.y = 0; - _this.scaleX = 1; - _this.scaleY = 1; - _this.rotation = 0; - _this.width = 0; - _this.height = 0; - _this.color = new core.Color(1, 1, 1, 1); - _this.offset = core.Utils.newFloatArray(8); - _this.uvs = core.Utils.newFloatArray(8); - _this.tempColor = new core.Color(1, 1, 1, 1); - return _this; - } - RegionAttachment.prototype.updateOffset = function () { - var regionScaleX = this.width / this.region.originalWidth * this.scaleX; - var regionScaleY = this.height / this.region.originalHeight * this.scaleY; - var localX = -this.width / 2 * this.scaleX + this.region.offsetX * regionScaleX; - var localY = -this.height / 2 * this.scaleY + this.region.offsetY * regionScaleY; - var localX2 = localX + this.region.width * regionScaleX; - var localY2 = localY + this.region.height * regionScaleY; - var radians = this.rotation * Math.PI / 180; - var cos = Math.cos(radians); - var sin = Math.sin(radians); - var localXCos = localX * cos + this.x; - var localXSin = localX * sin; - var localYCos = localY * cos + this.y; - var localYSin = localY * sin; - var localX2Cos = localX2 * cos + this.x; - var localX2Sin = localX2 * sin; - var localY2Cos = localY2 * cos + this.y; - var localY2Sin = localY2 * sin; - var offset = this.offset; - offset[RegionAttachment.OX1] = localXCos - localYSin; - offset[RegionAttachment.OY1] = localYCos + localXSin; - offset[RegionAttachment.OX2] = localXCos - localY2Sin; - offset[RegionAttachment.OY2] = localY2Cos + localXSin; - offset[RegionAttachment.OX3] = localX2Cos - localY2Sin; - offset[RegionAttachment.OY3] = localY2Cos + localX2Sin; - offset[RegionAttachment.OX4] = localX2Cos - localYSin; - offset[RegionAttachment.OY4] = localYCos + localX2Sin; - }; - RegionAttachment.prototype.setRegion = function (region) { - this.region = region; - var uvs = this.uvs; - if (region.rotate) { - uvs[2] = region.u; - uvs[3] = region.v2; - uvs[4] = region.u; - uvs[5] = region.v; - uvs[6] = region.u2; - uvs[7] = region.v; - uvs[0] = region.u2; - uvs[1] = region.v2; - } - else { - uvs[0] = region.u; - uvs[1] = region.v2; - uvs[2] = region.u; - uvs[3] = region.v; - uvs[4] = region.u2; - uvs[5] = region.v; - uvs[6] = region.u2; - uvs[7] = region.v2; - } - }; - RegionAttachment.prototype.computeWorldVertices = function (bone, worldVertices, offset, stride) { - var vertexOffset = this.offset; - var mat = bone.matrix; - var x = mat.tx, y = mat.ty; - var a = mat.a, b = mat.c, c = mat.b, d = mat.d; - var offsetX = 0, offsetY = 0; - offsetX = vertexOffset[RegionAttachment.OX1]; - offsetY = vertexOffset[RegionAttachment.OY1]; - worldVertices[offset] = offsetX * a + offsetY * b + x; - worldVertices[offset + 1] = offsetX * c + offsetY * d + y; - offset += stride; - offsetX = vertexOffset[RegionAttachment.OX2]; - offsetY = vertexOffset[RegionAttachment.OY2]; - worldVertices[offset] = offsetX * a + offsetY * b + x; - worldVertices[offset + 1] = offsetX * c + offsetY * d + y; - offset += stride; - offsetX = vertexOffset[RegionAttachment.OX3]; - offsetY = vertexOffset[RegionAttachment.OY3]; - worldVertices[offset] = offsetX * a + offsetY * b + x; - worldVertices[offset + 1] = offsetX * c + offsetY * d + y; - offset += stride; - offsetX = vertexOffset[RegionAttachment.OX4]; - offsetY = vertexOffset[RegionAttachment.OY4]; - worldVertices[offset] = offsetX * a + offsetY * b + x; - worldVertices[offset + 1] = offsetX * c + offsetY * d + y; - }; - RegionAttachment.prototype.copy = function () { - var copy = new RegionAttachment(this.name); - copy.region = this.region; - copy.rendererObject = this.rendererObject; - copy.path = this.path; - copy.x = this.x; - copy.y = this.y; - copy.scaleX = this.scaleX; - copy.scaleY = this.scaleY; - copy.rotation = this.rotation; - copy.width = this.width; - copy.height = this.height; - core.Utils.arrayCopy(this.uvs, 0, copy.uvs, 0, 8); - core.Utils.arrayCopy(this.offset, 0, copy.offset, 0, 8); - copy.color.setFromColor(this.color); - return copy; - }; - RegionAttachment.OX1 = 0; - RegionAttachment.OY1 = 1; - RegionAttachment.OX2 = 2; - RegionAttachment.OY2 = 3; - RegionAttachment.OX3 = 4; - RegionAttachment.OY3 = 5; - RegionAttachment.OX4 = 6; - RegionAttachment.OY4 = 7; - RegionAttachment.X1 = 0; - RegionAttachment.Y1 = 1; - RegionAttachment.C1R = 2; - RegionAttachment.C1G = 3; - RegionAttachment.C1B = 4; - RegionAttachment.C1A = 5; - RegionAttachment.U1 = 6; - RegionAttachment.V1 = 7; - RegionAttachment.X2 = 8; - RegionAttachment.Y2 = 9; - RegionAttachment.C2R = 10; - RegionAttachment.C2G = 11; - RegionAttachment.C2B = 12; - RegionAttachment.C2A = 13; - RegionAttachment.U2 = 14; - RegionAttachment.V2 = 15; - RegionAttachment.X3 = 16; - RegionAttachment.Y3 = 17; - RegionAttachment.C3R = 18; - RegionAttachment.C3G = 19; - RegionAttachment.C3B = 20; - RegionAttachment.C3A = 21; - RegionAttachment.U3 = 22; - RegionAttachment.V3 = 23; - RegionAttachment.X4 = 24; - RegionAttachment.Y4 = 25; - RegionAttachment.C4R = 26; - RegionAttachment.C4G = 27; - RegionAttachment.C4B = 28; - RegionAttachment.C4A = 29; - RegionAttachment.U4 = 30; - RegionAttachment.V4 = 31; - return RegionAttachment; - }(core.Attachment)); - core.RegionAttachment = RegionAttachment; - })(pixi_spine.core || (pixi_spine.core = {})); - })(pixi_spine || (pixi_spine = {})); - var pixi_spine; - (function (pixi_spine) { - (function (core) { - var JitterEffect = (function () { - function JitterEffect(jitterX, jitterY) { - this.jitterX = 0; - this.jitterY = 0; - this.jitterX = jitterX; - this.jitterY = jitterY; - } - JitterEffect.prototype.begin = function (skeleton) { - }; - JitterEffect.prototype.transform = function (position, uv, light, dark) { - position.x += core.MathUtils.randomTriangular(-this.jitterX, this.jitterY); - position.y += core.MathUtils.randomTriangular(-this.jitterX, this.jitterY); - }; - JitterEffect.prototype.end = function () { - }; - return JitterEffect; - }()); - core.JitterEffect = JitterEffect; - })(pixi_spine.core || (pixi_spine.core = {})); - })(pixi_spine || (pixi_spine = {})); - var pixi_spine; - (function (pixi_spine) { - (function (core) { - var SwirlEffect = (function () { - function SwirlEffect(radius) { - this.centerX = 0; - this.centerY = 0; - this.radius = 0; - this.angle = 0; - this.worldX = 0; - this.worldY = 0; - this.radius = radius; - } - SwirlEffect.prototype.begin = function (skeleton) { - this.worldX = skeleton.x + this.centerX; - this.worldY = skeleton.y + this.centerY; - }; - SwirlEffect.prototype.transform = function (position, uv, light, dark) { - var radAngle = this.angle * core.MathUtils.degreesToRadians; - var x = position.x - this.worldX; - var y = position.y - this.worldY; - var dist = Math.sqrt(x * x + y * y); - if (dist < this.radius) { - var theta = SwirlEffect.interpolation.apply(0, radAngle, (this.radius - dist) / this.radius); - var cos = Math.cos(theta); - var sin = Math.sin(theta); - position.x = cos * x - sin * y + this.worldX; - position.y = sin * x + cos * y + this.worldY; - } - }; - SwirlEffect.prototype.end = function () { - }; - SwirlEffect.interpolation = new core.PowOut(2); - return SwirlEffect; - }()); - core.SwirlEffect = SwirlEffect; - })(pixi_spine.core || (pixi_spine.core = {})); - })(pixi_spine || (pixi_spine = {})); - (function () { - if (!Math.fround) { - Math.fround = Math.fround = (function (array) { - return function (x) { - return array[0] = x, array[0]; - }; - })(new Float32Array(1)); - } - })(); - var pixi_spine; - (function (pixi_spine) { - pixi_spine.core.Bone.yDown = true; - var tempRgb = [0, 0, 0]; - var SpineSprite = (function (_super) { - __extends(SpineSprite, _super); - function SpineSprite() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this.region = null; - return _this; - } - return SpineSprite; - }(PIXI.Sprite)); - pixi_spine.SpineSprite = SpineSprite; - var SpineMesh = (function (_super) { - __extends(SpineMesh, _super); - function SpineMesh(texture, vertices, uvs, indices, drawMode) { - return _super.call(this, texture, vertices, uvs, indices, drawMode) || this; - } - return SpineMesh; - }(PIXI.mesh.Mesh)); - pixi_spine.SpineMesh = SpineMesh; - var Spine = (function (_super) { - __extends(Spine, _super); - function Spine(spineData) { - var _this = _super.call(this) || this; - if (!spineData) { - throw new Error('The spineData param is required.'); - } - if ((typeof spineData) === "string") { - throw new Error('spineData param cant be string. Please use spine.Spine.fromAtlas("YOUR_RESOURCE_NAME") from now on.'); - } - _this.spineData = spineData; - _this.skeleton = new pixi_spine.core.Skeleton(spineData); - _this.skeleton.updateWorldTransform(); - _this.stateData = new pixi_spine.core.AnimationStateData(spineData); - _this.state = new pixi_spine.core.AnimationState(_this.stateData); - _this.slotContainers = []; - _this.tempClipContainers = []; - for (var i = 0, n = _this.skeleton.slots.length; i < n; i++) { - var slot = _this.skeleton.slots[i]; - var attachment = slot.getAttachment(); - var slotContainer = _this.newContainer(); - _this.slotContainers.push(slotContainer); - _this.addChild(slotContainer); - _this.tempClipContainers.push(null); - if (attachment instanceof pixi_spine.core.RegionAttachment) { - var spriteName = attachment.region.name; - var sprite = _this.createSprite(slot, attachment, spriteName); - slot.currentSprite = sprite; - slot.currentSpriteName = spriteName; - slotContainer.addChild(sprite); - } - else if (attachment instanceof pixi_spine.core.MeshAttachment) { - var mesh = _this.createMesh(slot, attachment); - slot.currentMesh = mesh; - slot.currentMeshName = attachment.name; - slotContainer.addChild(mesh); - } - else if (attachment instanceof pixi_spine.core.ClippingAttachment) { - _this.createGraphics(slot, attachment); - slotContainer.addChild(slot.clippingContainer); - slotContainer.addChild(slot.currentGraphics); - } - else { - continue; - } - } - _this.autoUpdate = true; - _this.tintRgb = new Float32Array([1, 1, 1]); - return _this; - } - Object.defineProperty(Spine.prototype, "autoUpdate", { - get: function () { - return (this.updateTransform === Spine.prototype.autoUpdateTransform); - }, - set: function (value) { - this.updateTransform = value ? Spine.prototype.autoUpdateTransform : PIXI.Container.prototype.updateTransform; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Spine.prototype, "visible", { - get: function () { - return this._visible; - }, - set: function (value) { - if (value !== this._visible) { - this._visible = value; - if (value) { - this.lastTime = 0; - } - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Spine.prototype, "tint", { - get: function () { - return PIXI.utils.rgb2hex(this.tintRgb); - }, - set: function (value) { - this.tintRgb = PIXI.utils.hex2rgb(value, this.tintRgb); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Spine.prototype, "delayLimit", { - get: function () { - var limit = typeof this.localDelayLimit !== "undefined" ? - this.localDelayLimit : Spine.globalDelayLimit; - return limit || Number.MAX_VALUE; - }, - enumerable: false, - configurable: true - }); - Spine.prototype.update = function (dt) { - var delayLimit = this.delayLimit; - if (dt > delayLimit) - dt = delayLimit; - this.state.update(dt); - this.state.apply(this.skeleton); - if (!this.skeleton) - return; - this.skeleton.updateWorldTransform(); - var slots = this.skeleton.slots; - var globalClr = this.color; - var light = null, dark = null; - if (globalClr) { - light = globalClr.light; - dark = globalClr.dark; - } - else { - light = this.tintRgb; - } - var thack = PIXI.TransformBase && (this.transformHack() == 1); - for (var i = 0, n = slots.length; i < n; i++) { - var slot = slots[i]; - var attachment = slot.getAttachment(); - var slotContainer = this.slotContainers[i]; - if (!attachment) { - slotContainer.visible = false; - continue; - } - var spriteColor = null; - var attColor = attachment.color; - if (attachment instanceof pixi_spine.core.RegionAttachment) { - var region = attachment.region; - if (region) { - if (slot.currentMesh) { - slot.currentMesh.visible = false; - slot.currentMesh = null; - slot.currentMeshName = undefined; - } - var ar = region; - if (!slot.currentSpriteName || slot.currentSpriteName !== ar.name) { - var spriteName = ar.name; - if (slot.currentSprite) { - slot.currentSprite.visible = false; - } - slot.sprites = slot.sprites || {}; - if (slot.sprites[spriteName] !== undefined) { - slot.sprites[spriteName].visible = true; - } - else { - var sprite = this.createSprite(slot, attachment, spriteName); - slotContainer.addChild(sprite); - } - slot.currentSprite = slot.sprites[spriteName]; - slot.currentSpriteName = spriteName; - } - } - if (slotContainer.transform) { - var transform = slotContainer.transform; - var transAny = transform; - var lt = null; - if (transAny.matrix2d) { - lt = transAny.matrix2d; - transAny._dirtyVersion++; - transAny.version = transAny._dirtyVersion; - transAny.isStatic = true; - transAny.operMode = 0; - } - else { - if (thack) { - if (transAny.position) { - transform = new PIXI.TransformBase(); - transform._parentID = -1; - transform._worldID = slotContainer.transform._worldID; - slotContainer.transform = transform; - } - lt = transform.localTransform; - } - else { - transAny.setFromMatrix(slot.bone.matrix); - } - } - if (lt) { - slot.bone.matrix.copy(lt); - } - } - else { - var lt = slotContainer.localTransform || new PIXI.Matrix(); - slot.bone.matrix.copy(lt); - slotContainer.localTransform = lt; - slotContainer.displayObjectUpdateTransform = SlotContainerUpdateTransformV3; - } - if (slot.currentSprite.color) { - spriteColor = slot.currentSprite.color; - } - else { - tempRgb[0] = light[0] * slot.color.r * attColor.r; - tempRgb[1] = light[1] * slot.color.g * attColor.g; - tempRgb[2] = light[2] * slot.color.b * attColor.b; - slot.currentSprite.tint = PIXI.utils.rgb2hex(tempRgb); - } - slot.currentSprite.blendMode = slot.blendMode; - } - else if (attachment instanceof pixi_spine.core.MeshAttachment) { - if (slot.currentSprite) { - slot.currentSprite.visible = false; - slot.currentSprite = null; - slot.currentSpriteName = undefined; - if (slotContainer.transform) { - var transform = new PIXI.TransformStatic(); - transform._parentID = -1; - transform._worldID = slotContainer.transform._worldID; - slotContainer.transform = transform; - } - else { - slotContainer.localTransform = new PIXI.Matrix(); - slotContainer.displayObjectUpdateTransform = PIXI.DisplayObject.prototype.updateTransform; - } - } - if (!slot.currentMeshName || slot.currentMeshName !== attachment.name) { - var meshName = attachment.name; - if (slot.currentMesh) { - slot.currentMesh.visible = false; - } - slot.meshes = slot.meshes || {}; - if (slot.meshes[meshName] !== undefined) { - slot.meshes[meshName].visible = true; - } - else { - var mesh = this.createMesh(slot, attachment); - slotContainer.addChild(mesh); - } - slot.currentMesh = slot.meshes[meshName]; - slot.currentMeshName = meshName; - } - attachment.computeWorldVerticesOld(slot, slot.currentMesh.vertices); - if (slot.currentMesh.color) { - spriteColor = slot.currentMesh.color; - } - else if (PIXI.VERSION[0] !== '3') { - var tintRgb = slot.currentMesh.tintRgb; - tintRgb[0] = light[0] * slot.color.r * attColor.r; - tintRgb[1] = light[1] * slot.color.g * attColor.g; - tintRgb[2] = light[2] * slot.color.b * attColor.b; - } - slot.currentMesh.blendMode = slot.blendMode; - } - else if (attachment instanceof pixi_spine.core.ClippingAttachment) { - if (!slot.currentGraphics) { - this.createGraphics(slot, attachment); - slotContainer.addChild(slot.clippingContainer); - slotContainer.addChild(slot.currentGraphics); - } - this.updateGraphics(slot, attachment); - } - else { - slotContainer.visible = false; - continue; - } - slotContainer.visible = true; - if (spriteColor) { - var r0 = slot.color.r * attColor.r; - var g0 = slot.color.g * attColor.g; - var b0 = slot.color.b * attColor.b; - spriteColor.setLight(light[0] * r0 + dark[0] * (1.0 - r0), light[1] * g0 + dark[1] * (1.0 - g0), light[2] * b0 + dark[2] * (1.0 - b0)); - if (slot.darkColor) { - r0 = slot.darkColor.r; - g0 = slot.darkColor.g; - b0 = slot.darkColor.b; - } - else { - r0 = 0.0; - g0 = 0.0; - b0 = 0.0; - } - spriteColor.setDark(light[0] * r0 + dark[0] * (1 - r0), light[1] * g0 + dark[1] * (1 - g0), light[2] * b0 + dark[2] * (1 - b0)); - } - slotContainer.alpha = slot.color.a; - } - var drawOrder = this.skeleton.drawOrder; - var clippingAttachment = null; - var clippingContainer = null; - for (var i = 0, n = drawOrder.length; i < n; i++) { - var slot = slots[drawOrder[i].data.index]; - var slotContainer = this.slotContainers[drawOrder[i].data.index]; - if (!clippingContainer) { - if (slotContainer.parent !== null && slotContainer.parent !== this) { - slotContainer.parent.removeChild(slotContainer); - slotContainer.parent = this; - } - } - if (slot.currentGraphics && slot.getAttachment()) { - clippingContainer = slot.clippingContainer; - clippingAttachment = slot.getAttachment(); - clippingContainer.children.length = 0; - this.children[i] = slotContainer; - if (clippingAttachment.endSlot == slot.data) { - clippingAttachment.endSlot = null; - } - } - else { - if (clippingContainer) { - var c = this.tempClipContainers[i]; - if (!c) { - c = this.tempClipContainers[i] = this.newContainer(); - c.visible = false; - } - this.children[i] = c; - slotContainer.parent = null; - clippingContainer.addChild(slotContainer); - if (clippingAttachment.endSlot == slot.data) { - clippingContainer.renderable = true; - clippingContainer = null; - clippingAttachment = null; - } - } - else { - this.children[i] = slotContainer; - } - } - } - }; - Spine.prototype.setSpriteRegion = function (attachment, sprite, region) { - sprite.region = region; - sprite.texture = region.texture; - if (!region.size) { - sprite.scale.x = attachment.scaleX * attachment.width / region.originalWidth; - sprite.scale.y = -attachment.scaleY * attachment.height / region.originalHeight; - } - else { - sprite.scale.x = region.size.width / region.originalWidth; - sprite.scale.y = -region.size.height / region.originalHeight; - } - }; - Spine.prototype.setMeshRegion = function (attachment, mesh, region) { - mesh.region = region; - mesh.texture = region.texture; - region.texture._updateUvs(); - attachment.updateUVs(region, mesh.uvs); - mesh.dirty++; - }; - Spine.prototype.autoUpdateTransform = function () { - if (Spine.globalAutoUpdate) { - this.lastTime = this.lastTime || Date.now(); - var timeDelta = (Date.now() - this.lastTime) * 0.001; - this.lastTime = Date.now(); - this.update(timeDelta); - } - else { - this.lastTime = 0; - } - PIXI.Container.prototype.updateTransform.call(this); - }; - Spine.prototype.createSprite = function (slot, attachment, defName) { - var region = attachment.region; - if (slot.hackAttachment === attachment) { - region = slot.hackRegion; - } - var texture = region.texture; - var sprite = this.newSprite(texture); - sprite.rotation = attachment.rotation * pixi_spine.core.MathUtils.degRad; - sprite.anchor.x = 0.5; - sprite.anchor.y = 0.5; - sprite.position.x = attachment.x; - sprite.position.y = attachment.y; - sprite.alpha = attachment.color.a; - sprite.region = attachment.region; - this.setSpriteRegion(attachment, sprite, attachment.region); - slot.sprites = slot.sprites || {}; - slot.sprites[defName] = sprite; - return sprite; - }; - Spine.prototype.createMesh = function (slot, attachment) { - var region = attachment.region; - if (slot.hackAttachment === attachment) { - region = slot.hackRegion; - slot.hackAttachment = null; - slot.hackRegion = null; - } - var strip = this.newMesh(region.texture, new Float32Array(attachment.regionUVs.length), new Float32Array(attachment.regionUVs.length), new Uint16Array(attachment.triangles), PIXI.mesh.Mesh.DRAW_MODES.TRIANGLES); - strip.canvasPadding = 1.5; - strip.alpha = attachment.color.a; - strip.region = attachment.region; - this.setMeshRegion(attachment, strip, region); - slot.meshes = slot.meshes || {}; - slot.meshes[attachment.name] = strip; - return strip; - }; - Spine.prototype.createGraphics = function (slot, clip) { - var graphics = this.newGraphics(); - var poly = new PIXI.Polygon([]); - graphics.clear(); - graphics.beginFill(0xffffff, 1); - graphics.drawPolygon(poly); - graphics.renderable = false; - slot.currentGraphics = graphics; - slot.clippingContainer = this.newContainer(); - slot.clippingContainer.mask = slot.currentGraphics; - return graphics; - }; - Spine.prototype.updateGraphics = function (slot, clip) { - var vertices = slot.currentGraphics.graphicsData[0].shape.points; - var n = clip.worldVerticesLength; - vertices.length = n; - clip.computeWorldVertices(slot, 0, n, vertices, 0, 2); - slot.currentGraphics.dirty++; - slot.currentGraphics.clearDirty++; - }; - Spine.prototype.hackTextureBySlotIndex = function (slotIndex, texture, size) { - if (texture === void 0) { texture = null; } - if (size === void 0) { size = null; } - var slot = this.skeleton.slots[slotIndex]; - if (!slot) { - return false; - } - var attachment = slot.getAttachment(); - var region = attachment.region; - if (texture) { - region = new pixi_spine.core.TextureRegion(); - region.texture = texture; - region.size = size; - slot.hackRegion = region; - slot.hackAttachment = attachment; - } - else { - slot.hackRegion = null; - slot.hackAttachment = null; - } - if (slot.currentSprite && slot.currentSprite.region != region) { - this.setSpriteRegion(attachment, slot.currentSprite, region); - slot.currentSprite.region = region; - } - else if (slot.currentMesh && slot.currentMesh.region != region) { - this.setMeshRegion(attachment, slot.currentMesh, region); - } - return true; - }; - Spine.prototype.hackTextureBySlotName = function (slotName, texture, size) { - if (texture === void 0) { texture = null; } - if (size === void 0) { size = null; } - var index = this.skeleton.findSlotIndex(slotName); - if (index == -1) { - return false; - } - return this.hackTextureBySlotIndex(index, texture, size); - }; - Spine.prototype.newContainer = function () { - return new PIXI.Container(); - }; - Spine.prototype.newSprite = function (tex) { - return new SpineSprite(tex); - }; - Spine.prototype.newGraphics = function () { - return new PIXI.Graphics(); - }; - Spine.prototype.newMesh = function (texture, vertices, uvs, indices, drawMode) { - return new SpineMesh(texture, vertices, uvs, indices, drawMode); - }; - Spine.prototype.transformHack = function () { - return 1; - }; - Spine.prototype.hackAttachmentGroups = function (nameSuffix, group, outGroup) { - if (!nameSuffix) { - return; - } - var list_d = [], list_n = []; - for (var i = 0, len = this.skeleton.slots.length; i < len; i++) { - var slot = this.skeleton.slots[i]; - var name_6 = slot.currentSpriteName || slot.currentMeshName || ""; - var target = slot.currentSprite || slot.currentMesh; - if (name_6.endsWith(nameSuffix)) { - target.parentGroup = group; - list_n.push(target); - } - else if (outGroup && target) { - target.parentGroup = outGroup; - list_d.push(target); - } - } - return [list_d, list_n]; - }; - Spine.prototype.destroy = function (options) { - for (var i = 0, n = this.skeleton.slots.length; i < n; i++) { - var slot = this.skeleton.slots[i]; - for (var name_7 in slot.meshes) { - slot.meshes[name_7].destroy(options); - } - slot.meshes = null; - for (var name_8 in slot.sprites) { - slot.sprites[name_8].destroy(options); - } - slot.sprites = null; - } - for (var i = 0, n = this.slotContainers.length; i < n; i++) { - this.slotContainers[i].destroy(options); - } - this.spineData = null; - this.skeleton = null; - this.slotContainers = null; - this.stateData = null; - this.state = null; - this.tempClipContainers = null; - _super.prototype.destroy.call(this, options); - }; - Spine.globalAutoUpdate = true; - Spine.globalDelayLimit = 0; - Spine.clippingPolygon = []; - return Spine; - }(PIXI.Container)); - pixi_spine.Spine = Spine; - function SlotContainerUpdateTransformV3() { - var pt = this.parent.worldTransform; - var wt = this.worldTransform; - var lt = this.localTransform; - wt.a = lt.a * pt.a + lt.b * pt.c; - wt.b = lt.a * pt.b + lt.b * pt.d; - wt.c = lt.c * pt.a + lt.d * pt.c; - wt.d = lt.c * pt.b + lt.d * pt.d; - wt.tx = lt.tx * pt.a + lt.ty * pt.c + pt.tx; - wt.ty = lt.tx * pt.b + lt.ty * pt.d + pt.ty; - this.worldAlpha = this.alpha * this.parent.worldAlpha; - this._currentBounds = null; - } - })(pixi_spine || (pixi_spine = {})); - var pixi_spine; - (function (pixi_spine) { - PIXI.spine = pixi_spine; - var TextureProto = PIXI.Texture.prototype; - if (!TextureProto._updateUvs) { - TextureProto._updateUvs = TextureProto.updateUvs; - } - })(pixi_spine || (pixi_spine = {})); - var pixi_spine; - (function (pixi_spine) { - var Resource = PIXI.loaders.Resource; - function isJson(resource) { - return resource.type == Resource.TYPE.JSON; - } - function isBuffer(resource) { - return resource.xhrType == Resource.XHR_RESPONSE_TYPE.BUFFER; - } - Resource.setExtensionXhrType('skel', Resource.XHR_RESPONSE_TYPE.BUFFER); - function atlasParser() { - return function atlasParser(resource, next) { - if (!resource.data) { - return next(); - } - var isJsonSpineModel = isJson(resource) && resource.data.bones; - var isBinarySpineModel = isBuffer(resource) && (resource.extension === 'skel' || resource.metadata.spineMetadata); - if (!isJsonSpineModel && !isBinarySpineModel) { - return next(); - } - var parser = null; - var dataToParse = resource.data; - if (isJsonSpineModel) { - parser = new pixi_spine.core.SkeletonJson(null); - } - else { - parser = new pixi_spine.core.SkeletonBinary(null); - if (resource.data instanceof ArrayBuffer) { - dataToParse = new Uint8Array(resource.data); - } - } - var metadata = resource.metadata || {}; - var metadataSkeletonScale = metadata ? resource.metadata.spineSkeletonScale : null; - if (metadataSkeletonScale) { - parser.scale = metadataSkeletonScale; - } - var metadataAtlas = metadata ? resource.metadata.spineAtlas : null; - if (metadataAtlas === false) { - return next(); - } - if (metadataAtlas && metadataAtlas.pages) { - parser.attachmentLoader = new pixi_spine.core.AtlasAttachmentLoader(metadataAtlas); - resource.spineData = parser.readSkeletonData(dataToParse); - resource.spineAtlas = metadataAtlas; - return next(); - } - var metadataAtlasSuffix = metadata.spineAtlasSuffix || '.atlas'; - var atlasPath = resource.url; - var queryStringPos = atlasPath.indexOf('?'); - if (queryStringPos > 0) { - atlasPath = atlasPath.substr(0, queryStringPos); - } - atlasPath = atlasPath.substr(0, atlasPath.lastIndexOf('.')) + metadataAtlasSuffix; - if (resource.metadata && resource.metadata.spineAtlasFile) { - atlasPath = resource.metadata.spineAtlasFile; - } - atlasPath = atlasPath.replace(this.baseUrl, ''); - var atlasOptions = { - crossOrigin: resource.crossOrigin, - xhrType: Resource.XHR_RESPONSE_TYPE.TEXT, - metadata: metadata.spineMetadata || null, - parentResource: resource - }; - var imageOptions = { - crossOrigin: resource.crossOrigin, - metadata: metadata.imageMetadata || null, - parentResource: resource - }; - var baseUrl = resource.url.substr(0, resource.url.lastIndexOf('/') + 1); - baseUrl = baseUrl.replace(this.baseUrl, ''); - var namePrefix = metadata.imageNamePrefix || (resource.name + '_atlas_page_'); - var adapter = metadata.images ? staticImageLoader(metadata.images) - : metadata.image ? staticImageLoader({ 'default': metadata.image }) - : metadata.imageLoader ? metadata.imageLoader(this, namePrefix, baseUrl, imageOptions) - : imageLoaderAdapter(this, namePrefix, baseUrl, imageOptions); - var createSkeletonWithRawAtlas = function (rawData) { - new pixi_spine.core.TextureAtlas(rawData, adapter, function (spineAtlas) { - if (spineAtlas) { - parser.attachmentLoader = new pixi_spine.core.AtlasAttachmentLoader(spineAtlas); - resource.spineData = parser.readSkeletonData(dataToParse); - resource.spineAtlas = spineAtlas; - } - next(); - }); - }; - if (resource.metadata && resource.metadata.atlasRawData) { - createSkeletonWithRawAtlas(resource.metadata.atlasRawData); - } - else { - this.add(resource.name + '_atlas', atlasPath, atlasOptions, function (atlasResource) { - if (!atlasResource.error) { - createSkeletonWithRawAtlas(atlasResource.data); - } - else { - next(); - } - }); - } - }; - } - pixi_spine.atlasParser = atlasParser; - function imageLoaderAdapter(loader, namePrefix, baseUrl, imageOptions) { - if (baseUrl && baseUrl.lastIndexOf('/') !== (baseUrl.length - 1)) { - baseUrl += '/'; - } - return function (line, callback) { - var name = namePrefix + line; - var url = baseUrl + line; - var cachedResource = loader.resources[name]; - if (cachedResource) { - function done() { - callback(cachedResource.texture.baseTexture); - } - if (cachedResource.texture) { - done(); - } - else { - cachedResource.onAfterMiddleware.add(done); - } - } - else { - loader.add(name, url, imageOptions, function (resource) { - if (!resource.error) { - callback(resource.texture.baseTexture); - } - else { - callback(null); - } - }); - } - }; - } - pixi_spine.imageLoaderAdapter = imageLoaderAdapter; - function syncImageLoaderAdapter(baseUrl, crossOrigin) { - if (baseUrl && baseUrl.lastIndexOf('/') !== (baseUrl.length - 1)) { - baseUrl += '/'; - } - return function (line, callback) { - callback(PIXI.BaseTexture.fromImage(line, crossOrigin)); - }; - } - pixi_spine.syncImageLoaderAdapter = syncImageLoaderAdapter; - function staticImageLoader(pages) { - return function (line, callback) { - var page = pages[line] || pages['default']; - if (page && page.baseTexture) - callback(page.baseTexture); - else - callback(page); - }; - } - pixi_spine.staticImageLoader = staticImageLoader; - if (PIXI.loaders.Loader) { - PIXI.loaders.Loader.addPixiMiddleware(atlasParser); - PIXI.loader.use(atlasParser()); - } - })(pixi_spine || (pixi_spine = {})); - var pixispine = pixi_spine; - - let texCache = {}; - function cacheImage(data) { - const oldImg = data.image; - const newImg = data.image.cloneNode(); - data.image = newImg; - return { - tex: pixi_js.Texture.from(oldImg), - count: 0, - }; - } - function retainTexture(name, data) { - let cache = texCache[name]; - if (!cache) { - cache = cacheImage(data); - texCache[name] = cache; - } - cache.count++; - return cache.tex; - } - function getTexture(name, data) { - let cache = texCache[name]; - if (!cache) { - cache = cacheImage(data); - texCache[name] = cache; - } - return cache.tex; - } - function releaseTexture(name) { - setTimeout(() => { - const cache = texCache[name]; - if (cache) { - cache.count--; - if (cache.count <= 0) { - if (cache.tex) { - cache.tex.destroy(true); - cache.tex = null; - } - delete texCache[name]; - } - } - }, 100); - } - - let dataMap = {}; - function createSpineData(name, imgName, data, scale) { - let spineData = null; - const img = getTexture(imgName, data); - new pixispine.core.TextureAtlas(data.atlas, (line, callback) => { - callback(img.baseTexture); - }, spineAtlas => { - if (spineAtlas) { - const attachmentLoader = new pixispine.core.AtlasAttachmentLoader(spineAtlas); - const spineJsonParser = new pixispine.core.SkeletonJson(attachmentLoader); - if (scale) { - spineJsonParser.scale = scale; - } - spineData = spineJsonParser.readSkeletonData(data.ske); - } - }); - const obj = { spineData, ref: 0, imgName: imgName }; - dataMap[name] = obj; - return obj; - } - eva_js.resource.registerInstance('SPINE', info => { - return createSpineData(info.name, info.name, info.data, info.scale); - }); - eva_js.resource.registerDestroy('SPINE', info => { - if (info.instance) { - releaseTexture(info.name); - info.instance = null; - } - }); - function getSpineData(name) { - return __awaiter(this, void 0, void 0, function* () { - const res = yield eva_js.resource.getResource(name); - let data = dataMap[name]; - if (!data) { - if (res.complete) { - data = createSpineData(name, res.name, res.data, res.scale); - } - else if (!data) { - return; - } - } - retainTexture(res.name, res.data); - data.ref++; - return data.spineData; - }); - } - function releaseSpineData(name) { - const data = dataMap[name]; - if (!data) { - return; - } - data.ref--; - if (data.ref <= 0) { - releaseTexture(data.imgName); - delete dataMap[name]; - } - } - - const MaxRetryCount = 20; - let SpineSystem = class SpineSystem extends pluginRenderer.Renderer { - constructor() { - super(...arguments); - this.armatures = {}; - } - init() { - this.renderSystem = this.game.getSystem(pluginRenderer.RendererSystem); - this.renderSystem.rendererManager.register(this); - this.game.canvas.addEventListener('webglcontextrestored', () => { - const objs = this.game.gameObjects; - let toAdd = []; - for (let k in this.armatures) { - const id = +k; - for (let i = 0; i < objs.length; ++i) { - let obj = objs[i]; - if (obj.id === id) { - let sp = obj.getComponent(Spine); - if (sp) { - this.remove({ - type: eva_js.OBSERVER_TYPE.REMOVE, - gameObject: obj, - component: sp, - componentName: Spine.componentName, - }); - toAdd.push({ - type: eva_js.OBSERVER_TYPE.ADD, - gameObject: obj, - component: sp, - componentName: Spine.componentName, - }); - } - break; - } - } - } - setTimeout(() => { - toAdd.forEach(obj => { - this.add(obj); - }); - }, 1000); - }, false); - } - componentChanged(changed) { - return __awaiter(this, void 0, void 0, function* () { - if (changed.componentName === 'Spine') { - if (changed.type === eva_js.OBSERVER_TYPE.ADD) { - this.add(changed); - } - else if (changed.type === eva_js.OBSERVER_TYPE.CHANGE) { - switch (changed.prop.prop[0]) { - case 'resource': - this.change(changed); - break; - } - } - else if (changed.type === eva_js.OBSERVER_TYPE.REMOVE) { - this.remove(changed); - } - } - }); - } - add(changed, count) { - return __awaiter(this, void 0, void 0, function* () { - const component = changed.component; - clearTimeout(component.addHandler); - const spineData = yield getSpineData(component.resource); - if (!spineData) { - component.addHandler = setTimeout(() => { - if (!component.destroied) { - if (count === undefined) { - count = MaxRetryCount; - } - count--; - if (count > 0) { - this.add(changed, count); - } - else { - console.log('retry exceed max times', component.resource); - } - } - }, 1000); - return; - } - this.remove(changed); - const container = this.renderSystem.containerManager.getContainer(changed.gameObject.id); - if (!container) { - return; - } - const armature = new pixispine.Spine(spineData); - this.armatures[changed.gameObject.id] = armature; - if (changed.gameObject && changed.gameObject.transform) { - const tran = changed.gameObject.transform; - armature.x = tran.size.width * tran.origin.x; - armature.y = tran.size.height * tran.origin.y; - } - container.addChildAt(armature, 0); - component.usingResource = component.resource; - component.armature = armature; - if (component.autoPlay) { - try { - armature.state.setAnimation(0, component.animationName, true); - } - catch (e) { - console.log(e); - } - } - component.emit('loaded', { resource: component.resource }); - armature.state.addListener({ - start: (track, event) => { - component.emit('start', { track, name: track.animation.name }); - }, - complete: (track, event) => { - component.emit('complete', { track, name: track.animation.name }); - }, - interrupt: (track, event) => { - component.emit('interrupt', { track, name: track.animation.name }); - }, - end: (track, event) => { - component.emit('end', { track, name: track.animation.name }); - }, - event: (track, event) => { - component.emit('event', track, event); - }, - }); - }); - } - change(changed) { - this.remove(changed); - this.add(changed); - } - remove(changed) { - const component = changed.component; - clearTimeout(component.addHandler); - const armature = this.armatures[changed.gameObject.id]; - const container = this.renderSystem.containerManager.getContainer(changed.gameObject.id); - if (container && armature) { - container.removeChild(armature); - } - if (component.armature) { - component.armature.destroy({ children: true }); - if (component.usingResource) { - releaseSpineData(component.usingResource); - } - } - component.armature = null; - delete this.armatures[changed.gameObject.id]; - if (changed.type === eva_js.OBSERVER_TYPE.CHANGE) ; - } - }; - SpineSystem.systemName = 'SpineSystem'; - SpineSystem = __decorate([ - eva_js.decorators.componentObserver({ - Spine: ['resource'], - }) - ], SpineSystem); - var SpineSystem$1 = SpineSystem; - - exports.Spine = Spine; - exports.SpineSystem = SpineSystem$1; - - Object.defineProperty(exports, '__esModule', { value: true }); - -}))); diff --git a/dist/cdn/EVA.plugin.renderer.sprite.js b/dist/cdn/EVA.plugin.renderer.sprite.js deleted file mode 100644 index 68821ce8..00000000 --- a/dist/cdn/EVA.plugin.renderer.sprite.js +++ /dev/null @@ -1,199 +0,0 @@ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@eva/eva.js'), require('@eva/plugin-renderer'), require('pixi.js')) : - typeof define === 'function' && define.amd ? define(['exports', '@eva/eva.js', '@eva/plugin-renderer', 'pixi.js'], factory) : - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.EVA = global.EVA || {}, global.EVA.plugin = global.EVA.plugin || {}, global.EVA.plugin.renderer = global.EVA.plugin.renderer || {}, global.EVA.plugin.renderer.sprite = {}), global.EVA, global.EVA.plugin.renderer, global.PIXI)); -}(this, (function (exports, eva_js, pluginRenderer, pixi_js) { 'use strict'; - - /*! ***************************************************************************** - Copyright (c) Microsoft Corporation. - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. - ***************************************************************************** */ - - function __decorate(decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; - } - - function __awaiter(thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - } - - class Sprite$3 extends eva_js.Component { - constructor() { - super(...arguments); - this.resource = ''; - this.spriteName = ''; - } - init(obj) { - if (obj && obj.resource) { - this.resource = obj.resource; - this.spriteName = obj.spriteName; - } - } - } - Sprite$3.componentName = 'Sprite'; - __decorate([ - eva_js.decorators.IDEProp - ], Sprite$3.prototype, "resource", void 0); - __decorate([ - eva_js.decorators.IDEProp - ], Sprite$3.prototype, "spriteName", void 0); - - class Sprite$2 { - constructor(image) { - this._image = null; - this._image = image; - if (image) { - if (image instanceof HTMLImageElement) { - this.sprite = pixi_js.Sprite.from(image); - } - else if (image instanceof pixi_js.Texture) { - this.sprite = new pixi_js.Sprite(image); - } - } - else { - this.sprite = new pixi_js.Sprite(); - } - } - set image(val) { - if (this._image === val) { - return; - } - if (val instanceof HTMLImageElement) { - this.sprite.texture && this.sprite.texture.destroy(false); - this.sprite.texture = pixi_js.Texture.from(val); - } - else if (val instanceof pixi_js.Texture) { - this.sprite.texture = val; - } - this._image = val; - } - get image() { - return this._image; - } - } - - const resourceKeySplit = '_s|r|c_'; - eva_js.resource.registerInstance(eva_js.RESOURCE_TYPE.SPRITE, ({ name, data }) => { - return new Promise(r => { - const textureObj = data.json; - const texture = pixi_js.BaseTexture.from(data.image); - const frames = textureObj.frames || {}; - const animations = textureObj.animations || {}; - const newFrames = {}; - for (const key in frames) { - const newKey = name + resourceKeySplit + key; - newFrames[newKey] = frames[key]; - } - for (const key in animations) { - let spriteList = []; - if (animations[key] && animations[key].length >= 0) { - for (let spriteName of animations[key]) { - const newSpriteName = name + resourceKeySplit + spriteName; - spriteList.push(newSpriteName); - } - } - animations[key] = spriteList; - } - textureObj.frames = newFrames; - const spriteSheet = new pixi_js.Spritesheet(texture, textureObj); - spriteSheet.parse(() => { - const { textures } = spriteSheet; - r(textures); - }); - }); - }); - eva_js.resource.registerDestroy(eva_js.RESOURCE_TYPE.SPRITE, ({ instance }) => { - if (!instance) - return; - for (let key in instance) { - instance[key].destroy(true); - } - }); - let Sprite = class Sprite extends pluginRenderer.Renderer { - constructor() { - super(...arguments); - this.name = 'Sprite'; - this.sprites = {}; - } - init() { - this.renderSystem = this.game.getSystem(pluginRenderer.RendererSystem); - this.renderSystem.rendererManager.register(this); - } - rendererUpdate(gameObject) { - const { width, height } = gameObject.transform.size; - if (this.sprites[gameObject.id]) { - this.sprites[gameObject.id].sprite.width = width; - this.sprites[gameObject.id].sprite.height = height; - } - } - componentChanged(changed) { - return __awaiter(this, void 0, void 0, function* () { - if (changed.componentName === 'Sprite') { - const component = changed.component; - if (changed.type === eva_js.OBSERVER_TYPE.ADD) { - const sprite = new Sprite$2(null); - eva_js.resource.getResource(component.resource).then(({ instance }) => __awaiter(this, void 0, void 0, function* () { - if (!instance) { - throw new Error(`GameObject:${changed.gameObject.name}'s Sprite resource load error`); - } - sprite.image = - instance[component.resource + resourceKeySplit + component.spriteName]; - })); - this.sprites[changed.gameObject.id] = sprite; - this.containerManager - .getContainer(changed.gameObject.id) - .addChildAt(sprite.sprite, 0); - } - else if (changed.type === eva_js.OBSERVER_TYPE.CHANGE) { - const { instance } = yield eva_js.resource.getResource(component.resource); - if (!instance) { - throw new Error(`GameObject:${changed.gameObject.name}'s Sprite resource load error`); - } - this.sprites[changed.gameObject.id].image = - instance[component.resource + resourceKeySplit + component.spriteName]; - } - else if (changed.type === eva_js.OBSERVER_TYPE.REMOVE) { - const sprite = this.sprites[changed.gameObject.id]; - this.containerManager - .getContainer(changed.gameObject.id) - .removeChild(sprite.sprite); - sprite.sprite.destroy(true); - delete this.sprites[changed.gameObject.id]; - } - } - }); - } - }; - Sprite.systemName = 'Sprite'; - Sprite = __decorate([ - eva_js.decorators.componentObserver({ - Sprite: ['spriteName'], - }) - ], Sprite); - var Sprite$1 = Sprite; - - exports.Sprite = Sprite$3; - exports.SpriteSystem = Sprite$1; - - Object.defineProperty(exports, '__esModule', { value: true }); - -}))); diff --git a/dist/cdn/EVA.plugin.renderer.spriteAnimation.js b/dist/cdn/EVA.plugin.renderer.spriteAnimation.js deleted file mode 100644 index 73e32a3e..00000000 --- a/dist/cdn/EVA.plugin.renderer.spriteAnimation.js +++ /dev/null @@ -1,259 +0,0 @@ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@eva/eva.js'), require('@eva/plugin-renderer'), require('@eva/renderer-adapter'), require('pixi.js')) : - typeof define === 'function' && define.amd ? define(['exports', '@eva/eva.js', '@eva/plugin-renderer', '@eva/renderer-adapter', 'pixi.js'], factory) : - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.EVA = global.EVA || {}, global.EVA.plugin = global.EVA.plugin || {}, global.EVA.plugin.renderer = global.EVA.plugin.renderer || {}, global.EVA.plugin.renderer.spriteAnimation = {}), global.EVA, global.EVA.plugin.renderer, global.EVA.rendererAdapter, global.PIXI)); -}(this, (function (exports, eva_js, pluginRenderer, rendererAdapter, pixi_js) { 'use strict'; - - /*! ***************************************************************************** - Copyright (c) Microsoft Corporation. - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. - ***************************************************************************** */ - - function __decorate(decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; - } - - function __awaiter(thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - } - - class SpriteAnimation$2 extends eva_js.Component { - constructor() { - super(...arguments); - this.resource = ''; - this.autoPlay = true; - this.speed = 100; - this.waitPlay = false; - this.waitStop = false; - this.times = Infinity; - this.count = 0; - } - init(obj) { - obj && Object.assign(this, obj); - this.on('loop', () => { - if (++this.count >= this.times) { - this.animate.stop(); - this.emit('complete'); - } - }); - } - play(times = Infinity) { - if (times === 0) { - return; - } - this.times = times; - if (!this.animate) { - this.waitPlay = true; - } - else { - this.animate.play(); - this.count = 0; - } - } - stop() { - if (!this.animate) { - this.waitStop = true; - } - else { - this.animate.stop(); - } - } - set animate(val) { - this._animate = val; - if (this.waitPlay) { - this.waitPlay = false; - this.play(this.times); - } - if (this.waitStop) { - this.waitStop = false; - this.stop(); - } - } - get animate() { - return this._animate; - } - gotoAndPlay(frameNumber) { - this.animate.gotoAndPlay(frameNumber); - } - gotoAndStop(frameNumber) { - this.animate.gotoAndStop(frameNumber); - } - } - SpriteAnimation$2.componentName = 'SpriteAnimation'; - __decorate([ - eva_js.decorators.IDEProp - ], SpriteAnimation$2.prototype, "resource", void 0); - __decorate([ - eva_js.decorators.IDEProp - ], SpriteAnimation$2.prototype, "autoPlay", void 0); - __decorate([ - eva_js.decorators.IDEProp - ], SpriteAnimation$2.prototype, "speed", void 0); - - const resourceKeySplit = '_s|r|c_'; - eva_js.resource.registerInstance(eva_js.RESOURCE_TYPE.SPRITE_ANIMATION, ({ name, data }) => { - return new Promise(r => { - const textureObj = data.json; - const texture = pixi_js.BaseTexture.from(data.image); - const frames = textureObj.frames || {}; - const animations = textureObj.animations || {}; - const newFrames = {}; - for (const key in frames) { - const newKey = name + resourceKeySplit + key; - newFrames[newKey] = frames[key]; - } - for (const key in animations) { - const spriteList = []; - if (animations[key] && animations[key].length >= 0) { - for (const spriteName of animations[key]) { - const newSpriteName = name + resourceKeySplit + spriteName; - spriteList.push(newSpriteName); - } - } - animations[key] = spriteList; - } - textureObj.frames = newFrames; - const spriteSheet = new pixi_js.Spritesheet(texture, textureObj); - spriteSheet.parse(() => { - const { textures } = spriteSheet; - const spriteFrames = []; - for (const key in textures) { - spriteFrames.push(textures[key]); - } - r(spriteFrames); - }); - }); - }); - eva_js.resource.registerDestroy(eva_js.RESOURCE_TYPE.SPRITE_ANIMATION, ({ instance }) => { - if (!instance) - return; - for (const texture of instance) { - texture.destroy(true); - } - }); - let SpriteAnimation = class SpriteAnimation extends pluginRenderer.Renderer { - constructor() { - super(...arguments); - this.name = 'SpriteAnimation'; - this.animates = {}; - this.autoPlay = {}; - } - init() { - this.renderSystem = this.game.getSystem(pluginRenderer.RendererSystem); - this.renderSystem.rendererManager.register(this); - } - rendererUpdate(gameObject) { - const { width, height } = gameObject.transform.size; - if (this.animates[gameObject.id]) { - this.animates[gameObject.id].animatedSprite.width = width; - this.animates[gameObject.id].animatedSprite.height = height; - } - } - componentChanged(changed) { - return __awaiter(this, void 0, void 0, function* () { - if (changed.componentName === 'SpriteAnimation') { - const component = changed.component; - this.autoPlay[changed.gameObject.id] = component.autoPlay; - if (changed.type === eva_js.OBSERVER_TYPE.ADD) { - const { instance: frames } = yield eva_js.resource.getResource(component.resource); - if (!frames) { - console.error(`GameObject:${changed.gameObject.name}'s Img resource load error`); - } - this.add({ - frames: frames, - id: changed.gameObject.id, - component, - }); - } - else if (changed.type === eva_js.OBSERVER_TYPE.CHANGE) { - if (changed.prop && changed.prop.prop[0] === 'speed') { - this.animates[changed.gameObject.id].speed = - 1000 / 60 / component.speed; - } - else { - const { instance: frames } = yield eva_js.resource.getResource(component.resource); - if (!frames) { - console.error(`GameObject:${changed.gameObject.name}'s Img resource load error`); - } - this.change({ - frames: frames, - id: changed.gameObject.id, - component, - }); - } - } - else if (changed.type === eva_js.OBSERVER_TYPE.REMOVE) { - this.remove(changed.gameObject.id); - } - } - }); - } - add({ frames, id, component }) { - const animate = new rendererAdapter.SpriteAnimation({ frames }); - this.animates[id] = animate; - this.containerManager - .getContainer(id) - .addChildAt(animate.animatedSprite, 0); - animate.animatedSprite.onComplete = () => { - component.emit('complete'); - }; - animate.animatedSprite.onFrameChange = () => { - component.emit('frameChange'); - }; - animate.animatedSprite.onLoop = () => { - component.emit('loop'); - }; - component.animate = this.animates[id]; - this.animates[id].speed = 1000 / 60 / component.speed; - if (this.autoPlay[id]) { - animate.animatedSprite.play(); - } - } - change({ frames, id, component }) { - this.remove(id, true); - this.add({ frames, id, component }); - } - remove(id, isChange) { - const animate = this.animates[id]; - this.autoPlay[id] = animate.animatedSprite.playing; - this.containerManager.getContainer(id).removeChild(animate.animatedSprite); - animate.animatedSprite.destroy(true); - delete this.animates[id]; - if (!isChange) { - delete this.autoPlay[id]; - } - } - }; - SpriteAnimation.systemName = 'SpriteAnimation'; - SpriteAnimation = __decorate([ - eva_js.decorators.componentObserver({ - SpriteAnimation: ['speed', 'resource'], - }) - ], SpriteAnimation); - var SpriteAnimation$1 = SpriteAnimation; - - exports.SpriteAnimation = SpriteAnimation$2; - exports.SpriteAnimationSystem = SpriteAnimation$1; - - Object.defineProperty(exports, '__esModule', { value: true }); - -}))); diff --git a/dist/cdn/EVA.plugin.renderer.text.js b/dist/cdn/EVA.plugin.renderer.text.js deleted file mode 100644 index d66b643f..00000000 --- a/dist/cdn/EVA.plugin.renderer.text.js +++ /dev/null @@ -1,139 +0,0 @@ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('pixi.js'), require('@eva/eva.js'), require('@eva/plugin-renderer'), require('@eva/renderer-adapter')) : - typeof define === 'function' && define.amd ? define(['exports', 'pixi.js', '@eva/eva.js', '@eva/plugin-renderer', '@eva/renderer-adapter'], factory) : - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.EVA = global.EVA || {}, global.EVA.plugin = global.EVA.plugin || {}, global.EVA.plugin.renderer = global.EVA.plugin.renderer || {}, global.EVA.plugin.renderer.text = {}), global.PIXI, global.EVA, global.EVA.plugin.renderer, global.EVA.rendererAdapter)); -}(this, (function (exports, pixi_js, eva_js, pluginRenderer, rendererAdapter) { 'use strict'; - - /*! ***************************************************************************** - Copyright (c) Microsoft Corporation. - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. - ***************************************************************************** */ - - function __decorate(decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; - } - - function __awaiter(thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - } - - class Text$2 extends eva_js.Component { - constructor() { - super(...arguments); - this.text = ''; - this.style = {}; - } - init(obj) { - const style = new pixi_js.TextStyle({ - fontSize: 20, - }); - const newStyle = {}; - for (const key in style) { - if (key.indexOf('_') === 0) { - newStyle[key.substring(1)] = style[key]; - } - } - this.style = newStyle; - if (obj) { - this.text = obj.text; - Object.assign(this.style, obj.style); - } - } - } - Text$2.componentName = 'Text'; - __decorate([ - eva_js.decorators.IDEProp - ], Text$2.prototype, "text", void 0); - __decorate([ - eva_js.decorators.IDEProp - ], Text$2.prototype, "style", void 0); - - let Text = class Text extends pluginRenderer.Renderer { - constructor() { - super(...arguments); - this.name = 'Text'; - this.texts = {}; - } - init() { - this.renderSystem = this.game.getSystem(pluginRenderer.RendererSystem); - this.renderSystem.rendererManager.register(this); - } - componentChanged(changed) { - return __awaiter(this, void 0, void 0, function* () { - if (changed.componentName !== 'Text') - return; - if (changed.type === eva_js.OBSERVER_TYPE.ADD) { - const component = changed.component; - const text = new rendererAdapter.Text(component.text, component.style); - this.containerManager - .getContainer(changed.gameObject.id) - .addChildAt(text, 0); - this.texts[changed.gameObject.id] = { - text, - component: changed.component, - }; - this.setSize(changed); - } - else if (changed.type === eva_js.OBSERVER_TYPE.REMOVE) { - this.containerManager - .getContainer(changed.gameObject.id) - .removeChild(this.texts[changed.gameObject.id].text); - this.texts[changed.gameObject.id].text.destroy(true); - delete this.texts[changed.gameObject.id]; - } - else { - this.change(changed); - this.setSize(changed); - } - }); - } - change(changed) { - const { text, component } = this.texts[changed.gameObject.id]; - if (changed.prop.prop[0] === 'text') { - text.text = component.text; - } - else if (changed.prop.prop[0] === 'style') { - Object.assign(text.style, changed.component.style); - } - } - setSize(changed) { - const { transform } = changed.gameObject; - if (!transform) - return; - transform.size.width = this.texts[changed.gameObject.id].text.width; - transform.size.height = this.texts[changed.gameObject.id].text.height; - } - }; - Text.systemName = 'Text'; - Text = __decorate([ - eva_js.decorators.componentObserver({ - Text: ['text', { prop: ['style'], deep: true }], - }) - ], Text); - var Text$1 = Text; - - exports.Text = Text$2; - exports.TextSystem = Text$1; - - Object.defineProperty(exports, '__esModule', { value: true }); - -}))); diff --git a/dist/cdn/EVA.plugin.renderer.tilingSprite.js b/dist/cdn/EVA.plugin.renderer.tilingSprite.js deleted file mode 100644 index 1eda9998..00000000 --- a/dist/cdn/EVA.plugin.renderer.tilingSprite.js +++ /dev/null @@ -1,151 +0,0 @@ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@eva/eva.js'), require('@eva/plugin-renderer'), require('@eva/renderer-adapter')) : - typeof define === 'function' && define.amd ? define(['exports', '@eva/eva.js', '@eva/plugin-renderer', '@eva/renderer-adapter'], factory) : - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.EVA = global.EVA || {}, global.EVA.plugin = global.EVA.plugin || {}, global.EVA.plugin.renderer = global.EVA.plugin.renderer || {}, global.EVA.plugin.renderer.tilingSprite = {}), global.EVA, global.EVA.plugin.renderer, global.EVA.rendererAdapter)); -}(this, (function (exports, eva_js, pluginRenderer, rendererAdapter) { 'use strict'; - - /*! ***************************************************************************** - Copyright (c) Microsoft Corporation. - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. - ***************************************************************************** */ - - function __decorate(decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; - } - - function __awaiter(thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - } - - class TilingSprite$2 extends eva_js.Component { - constructor() { - super(...arguments); - this.resource = ''; - this.tileScale = { - x: 1, - y: 1, - }; - this.tilePosition = { - x: 0, - y: 0, - }; - } - init(obj) { - if (obj) { - this.resource = obj.resource; - this.tileScale = obj.tileScale; - this.tilePosition = obj.tilePosition; - } - } - } - TilingSprite$2.componentName = 'TilingSprite'; - __decorate([ - eva_js.decorators.IDEProp - ], TilingSprite$2.prototype, "resource", void 0); - __decorate([ - eva_js.decorators.IDEProp - ], TilingSprite$2.prototype, "tileScale", void 0); - __decorate([ - eva_js.decorators.IDEProp - ], TilingSprite$2.prototype, "tilePosition", void 0); - - let TilingSprite = class TilingSprite extends pluginRenderer.Renderer { - constructor() { - super(...arguments); - this.name = 'TilingSprite'; - this.imgs = {}; - } - init() { - this.renderSystem = this.game.getSystem(pluginRenderer.RendererSystem); - this.renderSystem.rendererManager.register(this); - } - rendererUpdate(gameObject) { - const { width, height } = gameObject.transform.size; - const img = this.imgs[gameObject.id]; - if (img) { - img.tilingSprite.width = width; - img.tilingSprite.height = height; - } - } - componentChanged(changed) { - return __awaiter(this, void 0, void 0, function* () { - if (changed.componentName === 'TilingSprite') { - const component = changed.component; - if (changed.type === eva_js.OBSERVER_TYPE.ADD) { - const sprite = new rendererAdapter.TilingSprite(null); - eva_js.resource.getResource(component.resource).then(({ data }) => { - if (!data) { - throw new Error(`GameObject:${changed.gameObject.name}'s TilingSprite resource load error`); - } - sprite.image = data.image; - }); - this.imgs[changed.gameObject.id] = sprite; - this.containerManager - .getContainer(changed.gameObject.id) - .addChildAt(sprite.tilingSprite, 0); - this.setProp(changed.gameObject.id, component); - } - else if (changed.type === eva_js.OBSERVER_TYPE.CHANGE) { - if (changed.prop.prop[0] === 'resource') { - const { data } = yield eva_js.resource.getResource(component.resource); - if (!data) { - throw new Error(`GameObject:${changed.gameObject.name}'s TilingSprite resource load error`); - } - this.imgs[changed.gameObject.id].image = data.image; - } - else { - this.setProp(changed.gameObject.id, component); - } - } - else if (changed.type === eva_js.OBSERVER_TYPE.REMOVE) { - const sprite = this.imgs[changed.gameObject.id]; - this.containerManager - .getContainer(changed.gameObject.id) - .removeChild(sprite.tilingSprite); - sprite.tilingSprite.destory(true); - delete this.imgs[changed.gameObject.id]; - } - } - }); - } - setProp(id, component) { - this.imgs[id].tilingSprite.tilePosition = component.tilePosition; - this.imgs[id].tilingSprite.tileScale = component.tileScale; - } - }; - TilingSprite = __decorate([ - eva_js.decorators.componentObserver({ - TilingSprite: [ - { prop: ['resource'], deep: false }, - { prop: ['tileScale'], deep: true }, - { prop: ['tilePosition'], deep: true }, - ], - }) - ], TilingSprite); - var TilingSprite$1 = TilingSprite; - - exports.TilingSprite = TilingSprite$2; - exports.TilingSpriteSystem = TilingSprite$1; - - Object.defineProperty(exports, '__esModule', { value: true }); - -}))); diff --git a/dist/cdn/EVA.plugin.sound.js b/dist/cdn/EVA.plugin.sound.js deleted file mode 100644 index 29961911..00000000 --- a/dist/cdn/EVA.plugin.sound.js +++ /dev/null @@ -1,403 +0,0 @@ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@eva/eva.js')) : - typeof define === 'function' && define.amd ? define(['exports', '@eva/eva.js'], factory) : - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.EVA = global.EVA || {}, global.EVA.plugin = global.EVA.plugin || {}, global.EVA.plugin.sound = {}), global.EVA)); -}(this, (function (exports, eva_js) { 'use strict'; - - /*! ***************************************************************************** - Copyright (c) Microsoft Corporation. - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. - ***************************************************************************** */ - - function __decorate(decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; - } - - function __awaiter(thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - } - - let SoundSystem = class SoundSystem extends eva_js.System { - constructor(obj) { - super(); - this.autoPauseAndStart = true; - this.components = []; - this.pausedComponents = []; - this.audioBufferCache = {}; - this.decodeAudioPromiseMap = {}; - Object.assign(this, obj); - } - get muted() { - return this.gainNode ? this.gainNode.gain.value === 0 : false; - } - set muted(v) { - if (!this.gainNode) { - return; - } - this.gainNode.gain.setValueAtTime(v ? 0 : 1, 0); - } - get volume() { - return this.gainNode ? this.gainNode.gain.value : 1; - } - set volume(v) { - if (!this.gainNode || typeof v !== 'number' || v < 0 || v > 1) { - return; - } - this.gainNode.gain.setValueAtTime(v, 0); - } - get audioLocked() { - if (!this.ctx) { - return true; - } - return this.ctx.state !== 'running'; - } - resumeAll() { - const handleResume = () => { - this.pausedComponents.forEach((component) => { - component.play(); - }); - this.pausedComponents = []; - }; - this.ctx.resume().then(handleResume, handleResume); - } - pauseAll() { - this.components.forEach((component) => { - if (component.playing) { - this.pausedComponents.push(component); - component.pause(); - } - }); - this.ctx.suspend().then(); - } - stopAll() { - this.components.forEach((component) => { - if (component.playing) { - component.stop(); - } - }); - this.pausedComponents = []; - this.ctx.suspend().then(); - } - init() { - this.setupAudioContext(); - } - update() { - const changes = this.componentObserver.clear(); - for (const changed of changes) { - this.componentChanged(changed); - } - } - onPlay() { - if (!this.autoPauseAndStart) { - return; - } - this.resumeAll(); - } - onPause() { - if (!this.autoPauseAndStart) { - return; - } - this.pauseAll(); - } - onDestroy() { - this.components.forEach((component) => { - component.onDestroy(); - }); - this.components = []; - if (this.ctx) { - this.gainNode.disconnect(); - this.gainNode = null; - this.ctx.close(); - this.ctx = null; - } - } - componentChanged(changed) { - return __awaiter(this, void 0, void 0, function* () { - if (changed.componentName !== 'Sound') { - return; - } - if (changed.type === eva_js.OBSERVER_TYPE.ADD) { - this.add(changed); - } - }); - } - setupAudioContext() { - try { - const AudioContext = window.AudioContext || window.webkitAudioContext; - this.ctx = new AudioContext(); - } - catch (error) { - console.error(error); - if (this.onError) { - this.onError(error); - } - } - if (!this.ctx) { - return; - } - this.gainNode = - typeof this.ctx.createGain === 'undefined' - ? this.ctx.createGainNode() - : this.ctx.createGain(); - this.gainNode.gain.setValueAtTime(this.muted ? 0 : this.volume, this.ctx.currentTime); - this.gainNode.connect(this.ctx.destination); - this.unlockAudio(); - } - unlockAudio() { - if (!this.ctx || !this.audioLocked) { - return; - } - const unlock = () => { - if (this.ctx) { - const removeListenerFn = () => { - document.body.removeEventListener('touchstart', unlock); - document.body.removeEventListener('touchend', unlock); - document.body.removeEventListener('click', unlock); - }; - this.ctx.resume().then(removeListenerFn, removeListenerFn); - } - }; - document.body.addEventListener('touchstart', unlock); - document.body.addEventListener('touchend', unlock); - document.body.addEventListener('click', unlock); - } - add(changed) { - return __awaiter(this, void 0, void 0, function* () { - const component = changed.component; - this.components.push(component); - try { - const { config } = component; - component.state = 'loading'; - const audio = yield eva_js.resource.getResource(config.resource); - if (!this.audioBufferCache[audio.name]) { - this.audioBufferCache[audio.name] = yield this.decodeAudioData(audio.data.audio, audio.name); - } - if (this.audioBufferCache[audio.name]) { - component.systemContext = this.ctx; - component.systemDestination = this.gainNode; - component.onload(this.audioBufferCache[audio.name]); - } - } - catch (error) { - console.error(error); - if (this.onError) { - this.onError(error); - } - } - }); - } - decodeAudioData(arraybuffer, name) { - if (this.decodeAudioPromiseMap[name]) { - return this.decodeAudioPromiseMap[name]; - } - const promise = new Promise((resolve, reject) => { - if (!this.ctx) { - reject(new Error('No audio support')); - } - const error = (err) => { - if (this.decodeAudioPromiseMap[name]) { - delete this.decodeAudioPromiseMap[name]; - } - reject(new Error(`${err}. arrayBuffer byteLength: ${arraybuffer ? arraybuffer.byteLength : 0}`)); - }; - const success = (decodedData) => { - if (this.decodeAudioPromiseMap[name]) { - delete this.decodeAudioPromiseMap[name]; - } - if (decodedData) { - resolve(decodedData); - } - else { - reject(new Error(`Error decoding audio ${name}`)); - } - }; - this.ctx.decodeAudioData(arraybuffer, success, error); - }); - this.decodeAudioPromiseMap[name] = promise; - return promise; - } - }; - SoundSystem.systemName = 'SoundSystem'; - SoundSystem = __decorate([ - eva_js.decorators.componentObserver({ - Sound: [], - }) - ], SoundSystem); - var SoundSystem$1 = SoundSystem; - - class Sound extends eva_js.Component { - constructor() { - super(...arguments); - this.state = 'unloaded'; - this.config = { - resource: '', - autoplay: false, - muted: false, - volume: 1, - loop: false, - seek: 0, - }; - this.playTime = 0; - this.startTime = 0; - this.duration = 0; - this.actionQueue = []; - } - get muted() { - return this.gainNode ? this.gainNode.gain.value === 0 : false; - } - set muted(v) { - if (!this.gainNode) { - return; - } - this.gainNode.gain.setValueAtTime(v ? 0 : this.config.volume, 0); - } - get volume() { - return this.gainNode ? this.gainNode.gain.value : 1; - } - set volume(v) { - if (typeof v !== 'number' || v < 0 || v > 1) { - return; - } - this.config.volume = v; - if (!this.gainNode) { - return; - } - this.gainNode.gain.setValueAtTime(v, 0); - } - init(obj) { - if (!obj) { - return; - } - Object.assign(this.config, obj); - if (this.config.autoplay) { - this.actionQueue.push(this.play.bind(this)); - } - } - play() { - if (this.state !== 'loaded') { - this.actionQueue.push(this.play.bind(this)); - } - this.destroySource(); - this.createSource(); - if (!this.sourceNode) { - return; - } - const when = this.systemContext.currentTime; - const offset = this.config.seek; - const duration = this.config.duration; - this.sourceNode.start(0, offset, duration); - this.startTime = when; - this.playTime = when - offset; - this.paused = false; - this.playing = true; - this.resetConfig(); - this.endedListener = () => { - if (!this.sourceNode) { - return; - } - if (this.config.onEnd) { - this.config.onEnd(); - } - if (this.playing) { - this.destroySource(); - } - }; - this.sourceNode.addEventListener('ended', this.endedListener); - } - pause() { - if (this.state !== 'loaded') { - this.actionQueue.push(this.pause.bind(this)); - } - if (this.paused || !this.playing) { - return; - } - this.paused = true; - this.playing = false; - this.config.seek = this.getCurrentTime(); - this.destroySource(); - } - stop() { - if (this.state !== 'loaded') { - this.actionQueue.push(this.stop.bind(this)); - } - if (!this.paused && !this.playing) { - return; - } - this.playing = false; - this.paused = false; - this.destroySource(); - this.resetConfig(); - } - onload(buffer) { - this.state = 'loaded'; - this.buffer = buffer; - this.duration = this.buffer.duration; - this.actionQueue.forEach((action) => action()); - this.actionQueue.length = 0; - } - onDestroy() { - this.actionQueue.length = 0; - this.destroySource(); - } - resetConfig() { - this.config.seek = 0; - } - getCurrentTime() { - if (this.config.loop && this.duration > 0) { - return (this.systemContext.currentTime - this.playTime) % this.duration; - } - return this.systemContext.currentTime - this.playTime; - } - createSource() { - if (!this.systemContext || this.state !== 'loaded') { - return; - } - this.sourceNode = this.systemContext.createBufferSource(); - this.sourceNode.buffer = this.buffer; - this.sourceNode.loop = this.config.loop; - if (!this.gainNode) { - this.gainNode = this.systemContext.createGain(); - this.gainNode.connect(this.systemDestination); - Object.assign(this, this.config); - } - this.sourceNode.connect(this.gainNode); - } - destroySource() { - if (!this.sourceNode) - return; - this.sourceNode.removeEventListener('ended', this.endedListener); - this.sourceNode.stop(); - this.sourceNode.disconnect(); - this.sourceNode = null; - this.startTime = 0; - this.playTime = 0; - this.playing = false; - } - } - Sound.componentName = 'Sound'; - - exports.Sound = Sound; - exports.SoundSystem = SoundSystem$1; - - Object.defineProperty(exports, '__esModule', { value: true }); - -}))); diff --git a/dist/cdn/EVA.plugin.stats.js b/dist/cdn/EVA.plugin.stats.js deleted file mode 100644 index df0cc7fe..00000000 --- a/dist/cdn/EVA.plugin.stats.js +++ /dev/null @@ -1,148 +0,0 @@ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@eva/eva.js')) : - typeof define === 'function' && define.amd ? define(['exports', '@eva/eva.js'], factory) : - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.EVA = global.EVA || {}, global.EVA.plugin = global.EVA.plugin || {}, global.EVA.plugin.stats = {}), global.EVA)); -}(this, (function (exports, eva_js) { 'use strict'; - - class StatsComponent extends eva_js.Component { - update() { - this.stats && this.stats.begin(); - } - } - StatsComponent.componentName = 'Stats'; - - const Stats = function (style) { - style = Object.assign({ width: 20, height: 12, x: 0, y: 0 }, style); - const { width, height, x, y } = style; - let mode = 0; - const container = document.createElement('div'); - container.style.cssText = `position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000;width: ${width}vw;height: ${height}vw;left: ${x}vw;top: ${y}vw;`; - container.addEventListener('click', function (event) { - event.preventDefault(); - showPanel(++mode % container.children.length); - }, false); - function addPanel(panel) { - container.appendChild(panel.dom); - return panel; - } - function showPanel(id) { - for (let i = 0; i < container.children.length; i++) { - container.children[i].style.display = i === id ? 'block' : 'none'; - } - mode = id; - } - let beginTime = (performance || Date).now(), prevTime = beginTime, frames = 0; - const fpsPanel = addPanel(Stats.Panel('FPS', '#0ff', '#002')); - const msPanel = addPanel(Stats.Panel('MS', '#0f0', '#020')); - let memPanel; - if (self.performance && self.performance.memory) { - memPanel = addPanel(Stats.Panel('MB', '#f08', '#201')); - } - showPanel(0); - return { - REVISION: 16, - dom: container, - addPanel: addPanel, - showPanel: showPanel, - begin: function (time) { - beginTime = time || (performance || Date).now(); - }, - end: function () { - frames++; - const time = (performance || Date).now(); - msPanel.update(time - beginTime, 200); - if (time >= prevTime + 1000) { - fpsPanel.update((frames * 1000) / (time - prevTime), 100); - prevTime = time; - frames = 0; - if (memPanel) { - const memory = performance.memory; - memPanel.update(memory.usedJSHeapSize / 1048576, memory.jsHeapSizeLimit / 1048576); - } - } - return time; - }, - update: function () { - beginTime = this.end(); - }, - domElement: container, - setMode: showPanel, - }; - }; - Stats.Panel = function (name, fg, bg) { - let min = Infinity, max = 0; - const round = Math.round; - const PR = round(window.devicePixelRatio || 1); - const WIDTH = 80 * PR, HEIGHT = 48 * PR, TEXT_X = 3 * PR, TEXT_Y = 2 * PR, GRAPH_X = 3 * PR, GRAPH_Y = 15 * PR, GRAPH_WIDTH = 74 * PR, GRAPH_HEIGHT = 30 * PR; - const canvas = document.createElement('canvas'); - canvas.width = WIDTH; - canvas.height = HEIGHT; - canvas.style.cssText = 'width:100%;height:100%'; - const context = canvas.getContext('2d'); - context.font = 'bold ' + 9 * PR + 'px Helvetica,Arial,sans-serif'; - context.textBaseline = 'top'; - context.fillStyle = bg; - context.fillRect(0, 0, WIDTH, HEIGHT); - context.fillStyle = fg; - context.fillText(name, TEXT_X, TEXT_Y); - context.fillRect(GRAPH_X, GRAPH_Y, GRAPH_WIDTH, GRAPH_HEIGHT); - context.fillStyle = bg; - context.globalAlpha = 0.9; - context.fillRect(GRAPH_X, GRAPH_Y, GRAPH_WIDTH, GRAPH_HEIGHT); - return { - dom: canvas, - update: function (value, maxValue) { - min = Math.min(min, value); - max = Math.max(max, value); - context.fillStyle = bg; - context.globalAlpha = 1; - context.fillRect(0, 0, WIDTH, GRAPH_Y); - context.fillStyle = fg; - context.fillText(round(value) + ' ' + name + ' (' + round(min) + '-' + round(max) + ')', TEXT_X, TEXT_Y); - context.drawImage(canvas, GRAPH_X + PR, GRAPH_Y, GRAPH_WIDTH - PR, GRAPH_HEIGHT, GRAPH_X, GRAPH_Y, GRAPH_WIDTH - PR, GRAPH_HEIGHT); - context.fillRect(GRAPH_X + GRAPH_WIDTH - PR, GRAPH_Y, PR, GRAPH_HEIGHT); - context.fillStyle = bg; - context.globalAlpha = 0.9; - context.fillRect(GRAPH_X + GRAPH_WIDTH - PR, GRAPH_Y, PR, round((1 - value / maxValue) * GRAPH_HEIGHT)); - }, - }; - }; - - class StatsSystem extends eva_js.System { - constructor() { - super(...arguments); - this.show = true; - } - init(param = { show: true }) { - this.show = param.show; - this.style = param.style; - } - start() { - if (!this.show) - return; - this.component = this.game.scene.addComponent(new StatsComponent()); - this.stats = Stats(this.style); - this.component.stats = this.stats; - this.stats.showPanel(0); - document.body.appendChild(this.stats.dom); - } - lateUpdate() { - if (!this.show) - return; - this.stats && this.stats.end(); - } - } - StatsSystem.systemName = 'Stats'; - - var index = { - Components: [StatsComponent], - Systems: [StatsSystem], - }; - - exports.Stats = StatsComponent; - exports.StatsSystem = StatsSystem; - exports.default = index; - - Object.defineProperty(exports, '__esModule', { value: true }); - -}))); diff --git a/dist/cdn/EVA.plugin.transition.js b/dist/cdn/EVA.plugin.transition.js deleted file mode 100644 index 37f75cf1..00000000 --- a/dist/cdn/EVA.plugin.transition.js +++ /dev/null @@ -1,988 +0,0 @@ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@eva/eva.js')) : - typeof define === 'function' && define.amd ? define(['exports', '@eva/eva.js'], factory) : - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.EVA = global.EVA || {}, global.EVA.plugin = global.EVA.plugin || {}, global.EVA.plugin.transition = {}), global.EVA)); -}(this, (function (exports, eva_js) { 'use strict'; - - /** - * The Ease class provides a collection of easing functions for use with tween.js. - */ - var Easing = { - Linear: { - None: function (amount) { - return amount; - }, - }, - Quadratic: { - In: function (amount) { - return amount * amount; - }, - Out: function (amount) { - return amount * (2 - amount); - }, - InOut: function (amount) { - if ((amount *= 2) < 1) { - return 0.5 * amount * amount; - } - return -0.5 * (--amount * (amount - 2) - 1); - }, - }, - Cubic: { - In: function (amount) { - return amount * amount * amount; - }, - Out: function (amount) { - return --amount * amount * amount + 1; - }, - InOut: function (amount) { - if ((amount *= 2) < 1) { - return 0.5 * amount * amount * amount; - } - return 0.5 * ((amount -= 2) * amount * amount + 2); - }, - }, - Quartic: { - In: function (amount) { - return amount * amount * amount * amount; - }, - Out: function (amount) { - return 1 - --amount * amount * amount * amount; - }, - InOut: function (amount) { - if ((amount *= 2) < 1) { - return 0.5 * amount * amount * amount * amount; - } - return -0.5 * ((amount -= 2) * amount * amount * amount - 2); - }, - }, - Quintic: { - In: function (amount) { - return amount * amount * amount * amount * amount; - }, - Out: function (amount) { - return --amount * amount * amount * amount * amount + 1; - }, - InOut: function (amount) { - if ((amount *= 2) < 1) { - return 0.5 * amount * amount * amount * amount * amount; - } - return 0.5 * ((amount -= 2) * amount * amount * amount * amount + 2); - }, - }, - Sinusoidal: { - In: function (amount) { - return 1 - Math.cos((amount * Math.PI) / 2); - }, - Out: function (amount) { - return Math.sin((amount * Math.PI) / 2); - }, - InOut: function (amount) { - return 0.5 * (1 - Math.cos(Math.PI * amount)); - }, - }, - Exponential: { - In: function (amount) { - return amount === 0 ? 0 : Math.pow(1024, amount - 1); - }, - Out: function (amount) { - return amount === 1 ? 1 : 1 - Math.pow(2, -10 * amount); - }, - InOut: function (amount) { - if (amount === 0) { - return 0; - } - if (amount === 1) { - return 1; - } - if ((amount *= 2) < 1) { - return 0.5 * Math.pow(1024, amount - 1); - } - return 0.5 * (-Math.pow(2, -10 * (amount - 1)) + 2); - }, - }, - Circular: { - In: function (amount) { - return 1 - Math.sqrt(1 - amount * amount); - }, - Out: function (amount) { - return Math.sqrt(1 - --amount * amount); - }, - InOut: function (amount) { - if ((amount *= 2) < 1) { - return -0.5 * (Math.sqrt(1 - amount * amount) - 1); - } - return 0.5 * (Math.sqrt(1 - (amount -= 2) * amount) + 1); - }, - }, - Elastic: { - In: function (amount) { - if (amount === 0) { - return 0; - } - if (amount === 1) { - return 1; - } - return -Math.pow(2, 10 * (amount - 1)) * Math.sin((amount - 1.1) * 5 * Math.PI); - }, - Out: function (amount) { - if (amount === 0) { - return 0; - } - if (amount === 1) { - return 1; - } - return Math.pow(2, -10 * amount) * Math.sin((amount - 0.1) * 5 * Math.PI) + 1; - }, - InOut: function (amount) { - if (amount === 0) { - return 0; - } - if (amount === 1) { - return 1; - } - amount *= 2; - if (amount < 1) { - return -0.5 * Math.pow(2, 10 * (amount - 1)) * Math.sin((amount - 1.1) * 5 * Math.PI); - } - return 0.5 * Math.pow(2, -10 * (amount - 1)) * Math.sin((amount - 1.1) * 5 * Math.PI) + 1; - }, - }, - Back: { - In: function (amount) { - var s = 1.70158; - return amount * amount * ((s + 1) * amount - s); - }, - Out: function (amount) { - var s = 1.70158; - return --amount * amount * ((s + 1) * amount + s) + 1; - }, - InOut: function (amount) { - var s = 1.70158 * 1.525; - if ((amount *= 2) < 1) { - return 0.5 * (amount * amount * ((s + 1) * amount - s)); - } - return 0.5 * ((amount -= 2) * amount * ((s + 1) * amount + s) + 2); - }, - }, - Bounce: { - In: function (amount) { - return 1 - Easing.Bounce.Out(1 - amount); - }, - Out: function (amount) { - if (amount < 1 / 2.75) { - return 7.5625 * amount * amount; - } - else if (amount < 2 / 2.75) { - return 7.5625 * (amount -= 1.5 / 2.75) * amount + 0.75; - } - else if (amount < 2.5 / 2.75) { - return 7.5625 * (amount -= 2.25 / 2.75) * amount + 0.9375; - } - else { - return 7.5625 * (amount -= 2.625 / 2.75) * amount + 0.984375; - } - }, - InOut: function (amount) { - if (amount < 0.5) { - return Easing.Bounce.In(amount * 2) * 0.5; - } - return Easing.Bounce.Out(amount * 2 - 1) * 0.5 + 0.5; - }, - }, - }; - - var now; - // Include a performance.now polyfill. - // In node.js, use process.hrtime. - // eslint-disable-next-line - // @ts-ignore - if (typeof self === 'undefined' && typeof process !== 'undefined' && process.hrtime) { - now = function () { - // eslint-disable-next-line - // @ts-ignore - var time = process.hrtime(); - // Convert [seconds, nanoseconds] to milliseconds. - return time[0] * 1000 + time[1] / 1000000; - }; - } - // In a browser, use self.performance.now if it is available. - else if (typeof self !== 'undefined' && self.performance !== undefined && self.performance.now !== undefined) { - // This must be bound, because directly assigning this function - // leads to an invocation exception in Chrome. - now = self.performance.now.bind(self.performance); - } - // Use Date.now if it is available. - else if (Date.now !== undefined) { - now = Date.now; - } - // Otherwise, use 'new Date().getTime()'. - else { - now = function () { - return new Date().getTime(); - }; - } - var now$1 = now; - - /** - * Controlling groups of tweens - * - * Using the TWEEN singleton to manage your tweens can cause issues in large apps with many components. - * In these cases, you may want to create your own smaller groups of tween - */ - var Group = /** @class */ (function () { - function Group() { - this._tweens = {}; - this._tweensAddedDuringUpdate = {}; - } - Group.prototype.getAll = function () { - var _this = this; - return Object.keys(this._tweens).map(function (tweenId) { - return _this._tweens[tweenId]; - }); - }; - Group.prototype.removeAll = function () { - this._tweens = {}; - }; - Group.prototype.add = function (tween) { - this._tweens[tween.getId()] = tween; - this._tweensAddedDuringUpdate[tween.getId()] = tween; - }; - Group.prototype.remove = function (tween) { - delete this._tweens[tween.getId()]; - delete this._tweensAddedDuringUpdate[tween.getId()]; - }; - Group.prototype.update = function (time, preserve) { - if (time === void 0) { time = now$1(); } - if (preserve === void 0) { preserve = false; } - var tweenIds = Object.keys(this._tweens); - if (tweenIds.length === 0) { - return false; - } - // Tweens are updated in "batches". If you add a new tween during an - // update, then the new tween will be updated in the next batch. - // If you remove a tween during an update, it may or may not be updated. - // However, if the removed tween was added during the current batch, - // then it will not be updated. - while (tweenIds.length > 0) { - this._tweensAddedDuringUpdate = {}; - for (var i = 0; i < tweenIds.length; i++) { - var tween = this._tweens[tweenIds[i]]; - var autoStart = !preserve; - if (tween && tween.update(time, autoStart) === false && !preserve) { - delete this._tweens[tweenIds[i]]; - } - } - tweenIds = Object.keys(this._tweensAddedDuringUpdate); - } - return true; - }; - return Group; - }()); - - /** - * - */ - var Interpolation = { - Linear: function (v, k) { - var m = v.length - 1; - var f = m * k; - var i = Math.floor(f); - var fn = Interpolation.Utils.Linear; - if (k < 0) { - return fn(v[0], v[1], f); - } - if (k > 1) { - return fn(v[m], v[m - 1], m - f); - } - return fn(v[i], v[i + 1 > m ? m : i + 1], f - i); - }, - Bezier: function (v, k) { - var b = 0; - var n = v.length - 1; - var pw = Math.pow; - var bn = Interpolation.Utils.Bernstein; - for (var i = 0; i <= n; i++) { - b += pw(1 - k, n - i) * pw(k, i) * v[i] * bn(n, i); - } - return b; - }, - CatmullRom: function (v, k) { - var m = v.length - 1; - var f = m * k; - var i = Math.floor(f); - var fn = Interpolation.Utils.CatmullRom; - if (v[0] === v[m]) { - if (k < 0) { - i = Math.floor((f = m * (1 + k))); - } - return fn(v[(i - 1 + m) % m], v[i], v[(i + 1) % m], v[(i + 2) % m], f - i); - } - else { - if (k < 0) { - return v[0] - (fn(v[0], v[0], v[1], v[1], -f) - v[0]); - } - if (k > 1) { - return v[m] - (fn(v[m], v[m], v[m - 1], v[m - 1], f - m) - v[m]); - } - return fn(v[i ? i - 1 : 0], v[i], v[m < i + 1 ? m : i + 1], v[m < i + 2 ? m : i + 2], f - i); - } - }, - Utils: { - Linear: function (p0, p1, t) { - return (p1 - p0) * t + p0; - }, - Bernstein: function (n, i) { - var fc = Interpolation.Utils.Factorial; - return fc(n) / fc(i) / fc(n - i); - }, - Factorial: (function () { - var a = [1]; - return function (n) { - var s = 1; - if (a[n]) { - return a[n]; - } - for (var i = n; i > 1; i--) { - s *= i; - } - a[n] = s; - return s; - }; - })(), - CatmullRom: function (p0, p1, p2, p3, t) { - var v0 = (p2 - p0) * 0.5; - var v1 = (p3 - p1) * 0.5; - var t2 = t * t; - var t3 = t * t2; - return (2 * p1 - 2 * p2 + v0 + v1) * t3 + (-3 * p1 + 3 * p2 - 2 * v0 - v1) * t2 + v0 * t + p1; - }, - }, - }; - - /** - * Utils - */ - var Sequence = /** @class */ (function () { - function Sequence() { - } - Sequence.nextId = function () { - return Sequence._nextId++; - }; - Sequence._nextId = 0; - return Sequence; - }()); - - var mainGroup = new Group(); - - /** - * Tween.js - Licensed under the MIT license - * https://github.com/tweenjs/tween.js - * ---------------------------------------------- - * - * See https://github.com/tweenjs/tween.js/graphs/contributors for the full list of contributors. - * Thank you all, you're awesome! - */ - var Tween = /** @class */ (function () { - function Tween(_object, _group) { - if (_group === void 0) { _group = mainGroup; } - this._object = _object; - this._group = _group; - this._isPaused = false; - this._pauseStart = 0; - this._valuesStart = {}; - this._valuesEnd = {}; - this._valuesStartRepeat = {}; - this._duration = 1000; - this._initialRepeat = 0; - this._repeat = 0; - this._yoyo = false; - this._isPlaying = false; - this._reversed = false; - this._delayTime = 0; - this._startTime = 0; - this._easingFunction = Easing.Linear.None; - this._interpolationFunction = Interpolation.Linear; - this._chainedTweens = []; - this._onStartCallbackFired = false; - this._id = Sequence.nextId(); - this._isChainStopped = false; - this._goToEnd = false; - } - Tween.prototype.getId = function () { - return this._id; - }; - Tween.prototype.isPlaying = function () { - return this._isPlaying; - }; - Tween.prototype.isPaused = function () { - return this._isPaused; - }; - Tween.prototype.to = function (properties, duration) { - // TODO? restore this, then update the 07_dynamic_to example to set fox - // tween's to on each update. That way the behavior is opt-in (there's - // currently no opt-out). - // for (const prop in properties) this._valuesEnd[prop] = properties[prop] - this._valuesEnd = Object.create(properties); - if (duration !== undefined) { - this._duration = duration; - } - return this; - }; - Tween.prototype.duration = function (d) { - this._duration = d; - return this; - }; - Tween.prototype.start = function (time) { - if (this._isPlaying) { - return this; - } - // eslint-disable-next-line - this._group && this._group.add(this); - this._repeat = this._initialRepeat; - if (this._reversed) { - // If we were reversed (f.e. using the yoyo feature) then we need to - // flip the tween direction back to forward. - this._reversed = false; - for (var property in this._valuesStartRepeat) { - this._swapEndStartRepeatValues(property); - this._valuesStart[property] = this._valuesStartRepeat[property]; - } - } - this._isPlaying = true; - this._isPaused = false; - this._onStartCallbackFired = false; - this._isChainStopped = false; - this._startTime = time !== undefined ? (typeof time === 'string' ? now$1() + parseFloat(time) : time) : now$1(); - this._startTime += this._delayTime; - this._setupProperties(this._object, this._valuesStart, this._valuesEnd, this._valuesStartRepeat); - return this; - }; - Tween.prototype._setupProperties = function (_object, _valuesStart, _valuesEnd, _valuesStartRepeat) { - for (var property in _valuesEnd) { - var startValue = _object[property]; - var startValueIsArray = Array.isArray(startValue); - var propType = startValueIsArray ? 'array' : typeof startValue; - var isInterpolationList = !startValueIsArray && Array.isArray(_valuesEnd[property]); - // If `to()` specifies a property that doesn't exist in the source object, - // we should not set that property in the object - if (propType === 'undefined' || propType === 'function') { - continue; - } - // Check if an Array was provided as property value - if (isInterpolationList) { - var endValues = _valuesEnd[property]; - if (endValues.length === 0) { - continue; - } - // handle an array of relative values - endValues = endValues.map(this._handleRelativeValue.bind(this, startValue)); - // Create a local copy of the Array with the start value at the front - _valuesEnd[property] = [startValue].concat(endValues); - } - // handle the deepness of the values - if ((propType === 'object' || startValueIsArray) && startValue && !isInterpolationList) { - _valuesStart[property] = startValueIsArray ? [] : {}; - // eslint-disable-next-line - for (var prop in startValue) { - // eslint-disable-next-line - // @ts-ignore FIXME? - _valuesStart[property][prop] = startValue[prop]; - } - _valuesStartRepeat[property] = startValueIsArray ? [] : {}; // TODO? repeat nested values? And yoyo? And array values? - // eslint-disable-next-line - // @ts-ignore FIXME? - this._setupProperties(startValue, _valuesStart[property], _valuesEnd[property], _valuesStartRepeat[property]); - } - else { - // Save the starting value, but only once. - if (typeof _valuesStart[property] === 'undefined') { - _valuesStart[property] = startValue; - } - if (!startValueIsArray) { - // eslint-disable-next-line - // @ts-ignore FIXME? - _valuesStart[property] *= 1.0; // Ensures we're using numbers, not strings - } - if (isInterpolationList) { - // eslint-disable-next-line - // @ts-ignore FIXME? - _valuesStartRepeat[property] = _valuesEnd[property].slice().reverse(); - } - else { - _valuesStartRepeat[property] = _valuesStart[property] || 0; - } - } - } - }; - Tween.prototype.stop = function () { - if (!this._isChainStopped) { - this._isChainStopped = true; - this.stopChainedTweens(); - } - if (!this._isPlaying) { - return this; - } - // eslint-disable-next-line - this._group && this._group.remove(this); - this._isPlaying = false; - this._isPaused = false; - if (this._onStopCallback) { - this._onStopCallback(this._object); - } - return this; - }; - Tween.prototype.end = function () { - this._goToEnd = true; - this.update(Infinity); - return this; - }; - Tween.prototype.pause = function (time) { - if (time === void 0) { time = now$1(); } - if (this._isPaused || !this._isPlaying) { - return this; - } - this._isPaused = true; - this._pauseStart = time; - // eslint-disable-next-line - this._group && this._group.remove(this); - return this; - }; - Tween.prototype.resume = function (time) { - if (time === void 0) { time = now$1(); } - if (!this._isPaused || !this._isPlaying) { - return this; - } - this._isPaused = false; - this._startTime += time - this._pauseStart; - this._pauseStart = 0; - // eslint-disable-next-line - this._group && this._group.add(this); - return this; - }; - Tween.prototype.stopChainedTweens = function () { - for (var i = 0, numChainedTweens = this._chainedTweens.length; i < numChainedTweens; i++) { - this._chainedTweens[i].stop(); - } - return this; - }; - Tween.prototype.group = function (group) { - this._group = group; - return this; - }; - Tween.prototype.delay = function (amount) { - this._delayTime = amount; - return this; - }; - Tween.prototype.repeat = function (times) { - this._initialRepeat = times; - this._repeat = times; - return this; - }; - Tween.prototype.repeatDelay = function (amount) { - this._repeatDelayTime = amount; - return this; - }; - Tween.prototype.yoyo = function (yoyo) { - this._yoyo = yoyo; - return this; - }; - Tween.prototype.easing = function (easingFunction) { - this._easingFunction = easingFunction; - return this; - }; - Tween.prototype.interpolation = function (interpolationFunction) { - this._interpolationFunction = interpolationFunction; - return this; - }; - Tween.prototype.chain = function () { - var tweens = []; - for (var _i = 0; _i < arguments.length; _i++) { - tweens[_i] = arguments[_i]; - } - this._chainedTweens = tweens; - return this; - }; - Tween.prototype.onStart = function (callback) { - this._onStartCallback = callback; - return this; - }; - Tween.prototype.onUpdate = function (callback) { - this._onUpdateCallback = callback; - return this; - }; - Tween.prototype.onRepeat = function (callback) { - this._onRepeatCallback = callback; - return this; - }; - Tween.prototype.onComplete = function (callback) { - this._onCompleteCallback = callback; - return this; - }; - Tween.prototype.onStop = function (callback) { - this._onStopCallback = callback; - return this; - }; - /** - * @returns true if the tween is still playing after the update, false - * otherwise (calling update on a paused tween still returns true because - * it is still playing, just paused). - */ - Tween.prototype.update = function (time, autoStart) { - if (time === void 0) { time = now$1(); } - if (autoStart === void 0) { autoStart = true; } - if (this._isPaused) - return true; - var property; - var elapsed; - var endTime = this._startTime + this._duration; - if (!this._goToEnd && !this._isPlaying) { - if (time > endTime) - return false; - if (autoStart) - this.start(time); - } - this._goToEnd = false; - if (time < this._startTime) { - return true; - } - if (this._onStartCallbackFired === false) { - if (this._onStartCallback) { - this._onStartCallback(this._object); - } - this._onStartCallbackFired = true; - } - elapsed = (time - this._startTime) / this._duration; - elapsed = this._duration === 0 || elapsed > 1 ? 1 : elapsed; - var value = this._easingFunction(elapsed); - // properties transformations - this._updateProperties(this._object, this._valuesStart, this._valuesEnd, value); - if (this._onUpdateCallback) { - this._onUpdateCallback(this._object, elapsed); - } - if (elapsed === 1) { - if (this._repeat > 0) { - if (isFinite(this._repeat)) { - this._repeat--; - } - // Reassign starting values, restart by making startTime = now - for (property in this._valuesStartRepeat) { - if (!this._yoyo && typeof this._valuesEnd[property] === 'string') { - this._valuesStartRepeat[property] = - // eslint-disable-next-line - // @ts-ignore FIXME? - this._valuesStartRepeat[property] + parseFloat(this._valuesEnd[property]); - } - if (this._yoyo) { - this._swapEndStartRepeatValues(property); - } - this._valuesStart[property] = this._valuesStartRepeat[property]; - } - if (this._yoyo) { - this._reversed = !this._reversed; - } - if (this._repeatDelayTime !== undefined) { - this._startTime = time + this._repeatDelayTime; - } - else { - this._startTime = time + this._delayTime; - } - if (this._onRepeatCallback) { - this._onRepeatCallback(this._object); - } - return true; - } - else { - if (this._onCompleteCallback) { - this._onCompleteCallback(this._object); - } - for (var i = 0, numChainedTweens = this._chainedTweens.length; i < numChainedTweens; i++) { - // Make the chained tweens start exactly at the time they should, - // even if the `update()` method was called way past the duration of the tween - this._chainedTweens[i].start(this._startTime + this._duration); - } - this._isPlaying = false; - return false; - } - } - return true; - }; - Tween.prototype._updateProperties = function (_object, _valuesStart, _valuesEnd, value) { - for (var property in _valuesEnd) { - // Don't update properties that do not exist in the source object - if (_valuesStart[property] === undefined) { - continue; - } - var start = _valuesStart[property] || 0; - var end = _valuesEnd[property]; - var startIsArray = Array.isArray(_object[property]); - var endIsArray = Array.isArray(end); - var isInterpolationList = !startIsArray && endIsArray; - if (isInterpolationList) { - _object[property] = this._interpolationFunction(end, value); - } - else if (typeof end === 'object' && end) { - // eslint-disable-next-line - // @ts-ignore FIXME? - this._updateProperties(_object[property], start, end, value); - } - else { - // Parses relative end values with start as base (e.g.: +10, -3) - end = this._handleRelativeValue(start, end); - // Protect against non numeric properties. - if (typeof end === 'number') { - // eslint-disable-next-line - // @ts-ignore FIXME? - _object[property] = start + (end - start) * value; - } - } - } - }; - Tween.prototype._handleRelativeValue = function (start, end) { - if (typeof end !== 'string') { - return end; - } - if (end.charAt(0) === '+' || end.charAt(0) === '-') { - return start + parseFloat(end); - } - else { - return parseFloat(end); - } - }; - Tween.prototype._swapEndStartRepeatValues = function (property) { - var tmp = this._valuesStartRepeat[property]; - var endValue = this._valuesEnd[property]; - if (typeof endValue === 'string') { - this._valuesStartRepeat[property] = this._valuesStartRepeat[property] + parseFloat(endValue); - } - else { - this._valuesStartRepeat[property] = this._valuesEnd[property]; - } - this._valuesEnd[property] = tmp; - }; - return Tween; - }()); - /** - * Controlling groups of tweens - * - * Using the TWEEN singleton to manage your tweens can cause issues in large apps with many components. - * In these cases, you may want to create your own smaller groups of tweens. - */ - var TWEEN = mainGroup; - // This is the best way to export things in a way that's compatible with both ES - // Modules and CommonJS, without build hacks, and so as not to break the - // existing API. - // https://github.com/rollup/rollup/issues/1961#issuecomment-423037881 - TWEEN.getAll.bind(TWEEN); - TWEEN.removeAll.bind(TWEEN); - TWEEN.add.bind(TWEEN); - TWEEN.remove.bind(TWEEN); - TWEEN.update.bind(TWEEN); - - const easingMap = { - linear: Easing.Linear.None, - 'ease-in': Easing.Quadratic.In, - 'ease-out': Easing.Quadratic.Out, - 'ease-in-out': Easing.Quadratic.InOut, - 'bounce-in': Easing.Bounce.In, - 'bounce-out': Easing.Bounce.Out, - 'bounce-in-out': Easing.Bounce.InOut, - none: p => ~~p, - }; - class Animation { - constructor(timelines, tweenGroup) { - this.tweens = []; - this.timelines = []; - this.finishCount = 0; - this.callbacks = new Map(); - this.objectCache = {}; - this.currIteration = 0; - this.timelines = timelines; - this.tweenGroup = tweenGroup; - } - on(eventName, callback) { - if (!this.callbacks[eventName]) { - this.callbacks.set(eventName, []); - } - this.callbacks.get(eventName).push(callback); - } - emit(eventName) { - const callbacks = this.callbacks.get(eventName); - if (!callbacks || !callbacks.length) - return; - callbacks.forEach(fn => fn()); - } - checkFinish() { - if (++this.finishCount == this.tweens.length) { - if (++this.currIteration == this.iteration) { - this.emit('finish'); - } - else { - if (this.stoped) - return; - this.start(); - } - } - } - getObjectCache(component, name) { - const key = `${component.gameObject.id}${component.name}`; - if (!this.objectCache[key]) { - this.objectCache[key] = {}; - } - if (this.objectCache[key][name]) { - return this.objectCache[key][name]; - } - const keys = name.split('.'); - const keyIndex = keys.length - 1; - let property = component; - for (let i = 0; i < keyIndex; i++) { - property = property[keys[i]]; - } - this.objectCache[key][name] = { property, key: keys[keyIndex] }; - return this.objectCache[key][name]; - } - doAnim({ component, name, value }) { - const { property, key } = this.getObjectCache(component, name); - property[key] = value; - } - init() { - this.checkFinishFunc = this.checkFinish.bind(this); - let lastTween; - this.timelines.forEach((timeline, i) => { - for (let j = 0; j < timeline.values.length - 1; j++) { - const frame = timeline.values[j]; - const nextFrame = timeline.values[j + 1]; - const tween = new Tween({ value: frame.value }, this.tweenGroup) - .to({ value: nextFrame.value }) - .duration(nextFrame.time - frame.time) - .easing(easingMap[frame.tween]) - .onUpdate(props => { - this.doAnim({ - component: timeline.component, - name: timeline.name, - value: props.value, - }); - }); - if (j === 0) { - this.tweens[i] = tween; - } - else { - lastTween.chain(tween); - } - lastTween = tween; - } - lastTween && lastTween.onComplete(() => this.checkFinishFunc()); - }); - } - play(iteration = 1) { - this.stoped = false; - this.start(); - this.currIteration = 0; - this.iteration = iteration; - } - start() { - this.finishCount = 0; - this.tweens.length = 0; - this.init(); - this.tweens.forEach((tween) => tween.start()); - } - pause() { - this.tweens.forEach((tween) => tween.pause()); - } - resume() { - this.tweens.forEach((tween) => tween.resume()); - } - stop() { - this.stoped = true; - this.tweens.forEach((tween) => tween.stop()); - } - destroy() { - this.stop(); - this.tweens = null; - this.timelines = null; - this.objectCache = null; - this.callbacks.clear(); - this.callbacks = null; - } - } - - class Transition extends eva_js.Component { - constructor() { - super(...arguments); - this.animations = {}; - this.group = {}; - } - init({ group } = { group: {} }) { - this.group = group; - this.tweenGroup = new Group(); - } - awake() { - for (const name in this.group) { - this.newAnimation(name); - } - } - play(name, iteration) { - if (!name) { - name = Object.keys(this.group)[0]; - } - if (name && !this.animations[name] && this.group[name]) { - this.newAnimation(name); - } - if (name && this.animations[name]) { - this.animations[name].play(iteration); - } - } - stop(name) { - if (!name) { - for (const key in this.animations) { - this.animations[key].stop(); - } - } - else { - this.animations[name].stop(); - } - } - onPause() { - for (const key in this.animations) { - this.animations[key].pause(); - } - } - onResume() { - for (const key in this.animations) { - this.animations[key].resume(); - } - } - onDestroy() { - for (const key in this.animations) { - this.animations[key].destroy(); - } - this.tweenGroup.removeAll(); - this.tweenGroup = null; - this.group = null; - this.animations = null; - this.removeAllListeners(); - } - update() { - this.tweenGroup.update(); - } - newAnimation(name) { - const animation = new Animation(this.group[name], this.tweenGroup); - animation.on('finish', () => this.emit('finish', name)); - this.animations[name] = animation; - } - } - Transition.componentName = 'Transition'; - - class TransitionSystem extends eva_js.System { - constructor() { - super(...arguments); - this.name = 'transition'; - } - } - TransitionSystem.systemName = 'transition'; - - exports.Transition = Transition; - exports.TransitionSystem = TransitionSystem; - - Object.defineProperty(exports, '__esModule', { value: true }); - -}))); diff --git a/dist/cdn/EVA.rendererAdapter.js b/dist/cdn/EVA.rendererAdapter.js deleted file mode 100644 index ce2a3bf6..00000000 --- a/dist/cdn/EVA.rendererAdapter.js +++ /dev/null @@ -1,142 +0,0 @@ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('pixi.js')) : - typeof define === 'function' && define.amd ? define(['exports', 'pixi.js'], factory) : - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.EVA = global.EVA || {}, global.EVA.rendererAdapter = {}), global.PIXI)); -}(this, (function (exports, pixi_js) { 'use strict'; - - class Application extends pixi_js.Application { - constructor(params) { - params.autoStart = false; - super(params); - } - } - - class Container extends pixi_js.Container { - } - - class Graphics extends pixi_js.Graphics { - } - - class NinePatch extends pixi_js.mesh.NineSlicePlane { - constructor(img, leftWidth, topHeight, rightWidth, bottomHeight) { - let texture; - if (img === 'string') { - texture = pixi_js.Texture.fromFrame(img); - } - else { - texture = pixi_js.Texture.from(img); - } - super(texture, leftWidth, topHeight, rightWidth, bottomHeight); - } - } - - class Sprite { - constructor(image) { - this._image = null; - this._image = image; - if (image) { - if (image instanceof HTMLImageElement) { - this.sprite = pixi_js.Sprite.from(image); - } - else if (image instanceof pixi_js.Texture) { - this.sprite = new pixi_js.Sprite(image); - } - } - else { - this.sprite = new pixi_js.Sprite(); - } - } - set image(val) { - if (this._image === val) { - return; - } - if (val instanceof HTMLImageElement) { - this.sprite.texture && this.sprite.texture.destroy(false); - this.sprite.texture = pixi_js.Texture.from(val); - } - else if (val instanceof pixi_js.Texture) { - this.sprite.texture = val; - } - this._image = val; - } - get image() { - return this._image; - } - } - - class SpriteAnimation { - constructor({ frames }) { - this.animatedSprite = new pixi_js.extras.AnimatedSprite(frames); - } - play() { - this.animatedSprite.play(); - } - stop() { - this.animatedSprite.stop(); - } - gotoAndPlay(frameNumber) { - this.animatedSprite.gotoAndPlay(frameNumber); - } - gotoAndStop(frameNumber) { - this.animatedSprite.gotoAndStop(frameNumber); - } - set speed(val) { - this.animatedSprite.animationSpeed = val; - } - get speed() { - return this.animatedSprite.animationSpeed; - } - } - - class Text extends pixi_js.Text { - constructor(text, style) { - super(text, style); - } - } - - const PIXITilingSprite = pixi_js.extras.TilingSprite; - class TilingSprite { - constructor(image) { - this._image = null; - this._image = image; - if (image) { - if (image instanceof HTMLImageElement) { - this.tilingSprite = new PIXITilingSprite(pixi_js.Texture.from(image)); - } - else if (image instanceof pixi_js.Texture) { - this.tilingSprite = new PIXITilingSprite(image); - } - } - else { - this.tilingSprite = new PIXITilingSprite(pixi_js.Texture.EMPTY); - } - } - set image(val) { - if (this._image === val) { - return; - } - if (val instanceof HTMLImageElement) { - this.tilingSprite.texture = pixi_js.Texture.from(val); - } - else if (val instanceof pixi_js.Texture) { - this.tilingSprite.texture = val; - } - this._image = val; - } - get image() { - return this._image; - } - } - - exports.Application = Application; - exports.Container = Container; - exports.Graphics = Graphics; - exports.NinePatch = NinePatch; - exports.Sprite = Sprite; - exports.SpriteAnimation = SpriteAnimation; - exports.Text = Text; - exports.TilingSprite = TilingSprite; - - Object.defineProperty(exports, '__esModule', { value: true }); - -}))); diff --git a/dist/cdn/min/EVA.min.js b/dist/cdn/min/EVA.min.js deleted file mode 100644 index e7faff9d..00000000 --- a/dist/cdn/min/EVA.min.js +++ /dev/null @@ -1 +0,0 @@ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).EVA={})}(this,(function(t){"use strict";var e=function(t){var e={exports:{}};return t(e,e.exports),e.exports}((function(t){var e=Object.prototype.hasOwnProperty,r="~";function n(){}function o(t,e,r){this.fn=t,this.context=e,this.once=r||!1}function s(t,e,n,s,i){if("function"!=typeof n)throw new TypeError("The listener must be a function");var a=new o(n,s||t,i),c=r?r+e:e;return t._events[c]?t._events[c].fn?t._events[c]=[t._events[c],a]:t._events[c].push(a):(t._events[c]=a,t._eventsCount++),t}function i(t,e){0==--t._eventsCount?t._events=new n:delete t._events[e]}function a(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(r=!1)),a.prototype.eventNames=function(){var t,n,o=[];if(0===this._eventsCount)return o;for(n in t=this._events)e.call(t,n)&&o.push(r?n.slice(1):n);return Object.getOwnPropertySymbols?o.concat(Object.getOwnPropertySymbols(t)):o},a.prototype.listeners=function(t){var e=r?r+t:t,n=this._events[e];if(!n)return[];if(n.fn)return[n.fn];for(var o=0,s=n.length,i=new Array(s);o-1&&t%1==0&&t-1&&t%1==0&&t<=9007199254740991}var I=Object.prototype;function N(t){return d(t)&&"[object Arguments]"==f(t)}var B=Object.prototype,q=B.hasOwnProperty,U=B.propertyIsEnumerable,$=N(function(){return arguments}())?N:function(t){return d(t)&&q.call(t,"callee")&&!U.call(t,"callee")};var V="object"==typeof t&&t&&!t.nodeType&&t,F=V&&"object"==typeof module&&module&&!module.nodeType&&module,z=F&&F.exports===V?s.Buffer:void 0,G=(z?z.isBuffer:void 0)||function(){return!1},X={};X["[object Float32Array]"]=X["[object Float64Array]"]=X["[object Int8Array]"]=X["[object Int16Array]"]=X["[object Int32Array]"]=X["[object Uint8Array]"]=X["[object Uint8ClampedArray]"]=X["[object Uint16Array]"]=X["[object Uint32Array]"]=!0,X["[object Arguments]"]=X["[object Array]"]=X["[object ArrayBuffer]"]=X["[object Boolean]"]=X["[object DataView]"]=X["[object Date]"]=X["[object Error]"]=X["[object Function]"]=X["[object Map]"]=X["[object Number]"]=X["[object Object]"]=X["[object RegExp]"]=X["[object Set]"]=X["[object String]"]=X["[object WeakMap]"]=!1;var J,Y="object"==typeof t&&t&&!t.nodeType&&t,H=Y&&"object"==typeof module&&module&&!module.nodeType&&module,Q=H&&H.exports===Y&&n.process,W=function(){try{var t=H&&H.require&&H.require("util").types;return t||Q&&Q.binding&&Q.binding("util")}catch(t){}}(),K=W&&W.isTypedArray,Z=K?(J=K,function(t){return J(t)}):function(t){return d(t)&&M(t.length)&&!!X[f(t)]},tt=Object.prototype.hasOwnProperty;function et(t,e){var r=m(t),n=!r&&$(t),o=!r&&!n&&G(t),s=!r&&!n&&!o&&Z(t),i=r||n||o||s,a=i?function(t,e){for(var r=-1,n=Array(t);++r-1},pt.prototype.set=function(t,e){var r=this.__data__,n=ht(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this};var ft=C(s,"Map");function dt(t,e){var r,n,o=t.__data__;return("string"==(n=typeof(r=e))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?o["string"==typeof e?"string":"hash"]:o.map}function mt(t){var e=-1,r=null==t?0:t.length;for(this.clear();++ea))return!1;var u=s.get(t),h=s.get(e);if(u&&h)return u==e&&h==t;var l=-1,p=!0,f=2&r?new Nt:void 0;for(s.set(t,e),s.set(e,t);++lKt(t,e)))>-1&&oe({systemName:o,componentName:n,component:r,prop:e,type:t.OBSERVER_TYPE.CHANGE}))}}({prop:n,component:o,componentName:s}))},get:()=>e[`_${r}`]})}else console.error(`prop ${r} not in component: ${s}, Can not observer`)}function ie(e,r=e.name){for(const n in ee){(ee[n]||{})[r]&&te[n].componentObserver.add({component:e,type:t.OBSERVER_TYPE.REMOVE,componentName:r})}!function(t){t.gameObject&&delete Zt[t.gameObject.id]}(e)}function ae(t,e,r,n){var o,s=arguments.length,i=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(i=(s<3?o(i):s>3?o(e,r,i):o(e,r))||i);return s>3&&i&&Object.defineProperty(e,r,i),i}function ce(t,e,r,n){return new(r||(r=Promise))((function(o,s){function i(t){try{c(n.next(t))}catch(t){s(t)}}function a(t){try{c(n.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(i,a)}c((n=n.apply(t,e||[])).next())}))}function ue(t,e){t.constructor.IDEProps||(t.constructor.IDEProps=[]),t.constructor.IDEProps.push(e)}class he extends r{constructor(){super(...arguments),this.name="Transform",this._parent=null,this.inScene=!1,this.children=[],this.position={x:0,y:0},this.size={width:0,height:0},this.origin={x:0,y:0},this.anchor={x:0,y:0},this.scale={x:1,y:1},this.skew={x:0,y:0},this.rotation=0}init(t={}){const e=["position","size","origin","anchor","scale","skew"];for(const r of e)Object.assign(this[r],t[r]);this.rotation=t.rotation||this.rotation}set parent(t){t?t.addChild(this):this.parent&&this.parent.removeChild(this)}get parent(){return this._parent}addChild(t){if(t.parent===this){const e=this.children.findIndex((e=>e===t));this.children.splice(e,1)}else t.parent&&t.parent.removeChild(t);t._parent=this,this.children.push(t)}removeChild(t){const e=this.children.findIndex((e=>e===t));e>-1&&(this.children.splice(e,1),t._parent=null)}clearChildren(){this.children.length=0}}he.componentName="Transform",ae([ue],he.prototype,"position",void 0),ae([ue],he.prototype,"size",void 0),ae([ue],he.prototype,"origin",void 0),ae([ue],he.prototype,"anchor",void 0),ae([ue],he.prototype,"scale",void 0),ae([ue],he.prototype,"skew",void 0),ae([ue],he.prototype,"rotation",void 0);let le=0;class pe{constructor(t,e){this._componentCache={},this.components=[],this._name=t,this.id=++le,this.addComponent(he,e)}get transform(){return this.getComponent(he)}get parent(){return this.transform&&this.transform.parent&&this.transform.parent.gameObject}get name(){return this._name}set scene(t){if(this._scene===t)return;const e=this._scene;if(this._scene=t,this.transform&&this.transform.children)for(const e of this.transform.children)e.gameObject.scene=t;t?t.addGameObject(this):e&&e.removeGameObject(this)}get scene(){return this._scene}addChild(t){if(t&&t.transform&&t!==this){if(!(t instanceof pe))throw new Error("addChild only receive GameObject");if(!this.transform)throw new Error(`gameObject '${this.name}' has been destroy`);t.transform.parent=this.transform,t.scene=this.scene}}removeChild(t){return t instanceof pe&&t.parent&&t.parent===this?(t.transform.parent=null,t.scene=null,t):t}addComponent(e,n){const o=function(t){return t instanceof r?t.name:t instanceof Function?t.componentName:void 0}(e);if(this._componentCache[o])return;let s;if(e instanceof Function)s=new e(n);else{if(!(e instanceof r))throw new Error("addComponent recieve Component and Component Constructor");s=e}if(s.gameObject)throw new Error(`component has been added on gameObject ${s.gameObject.name}`);return s.gameObject=this,s.init&&s.init(s.__componentDefaultParams),function(e,r=e.name){for(const n in ee)(ee[n]||{})[r]&&te[n].componentObserver.add({component:e,type:t.OBSERVER_TYPE.ADD,componentName:r})}(s,s.name),function(t,e=t.name){if(e&&re[e]){if(!(t&&(r=t,r&&r.constructor&&"componentName"in r.constructor)))throw new Error("component param must be an instance of Component");var r;if(!t.gameObject||!t.gameObject.id)throw new Error("component should be add to a gameObject");for(const r of re[e]){const{property:n,key:o}=ne(t,r.prop);se({obj:n,key:o,prop:r,component:t,componentName:e})}}}(s,s.name),this.components.push(s),this._componentCache[o]=s,s.awake&&s.awake(),s}removeComponent(t){let e;if("string"==typeof t?e=t:t instanceof r?e=t.name:t.componentName&&(e=t.componentName),"Transform"===e)throw new Error("Transform can't be removed");return this._removeComponent(e)}_removeComponent(t){const e=this.components.findIndex((({name:e})=>e===t));if(-1===e)return;const r=this.components.splice(e,1)[0];return delete this._componentCache[t],delete r.__componentDefaultParams,r.onDestroy&&r.onDestroy(),ie(r,t),r.gameObject=void 0,r}getComponent(t){let e;return"string"==typeof t?e=t:t instanceof r?e=t.name:t.componentName&&(e=t.componentName),void 0!==this._componentCache[e]?this._componentCache[e]:void 0}remove(){if(this.parent)return this.parent.removeChild(this)}destroy(){Array.from(this.transform.children).forEach((({gameObject:t})=>{t.destroy()})),this.remove(),this.transform.clearChildren();for(const t in this._componentCache)this._removeComponent(t);this.components.length=0}}class fe{constructor(){this.events=[]}add({component:e,prop:r,type:n,componentName:o}){n===t.OBSERVER_TYPE.REMOVE&&(this.events=this.events.filter((t=>t.component!==e)));const s=this.events.findIndex((t=>t.component===e&&Kt(t.prop,r)&&t.type===n));s>-1&&this.events.splice(s,1),this.events.push({gameObject:e.gameObject,component:e,prop:r,type:n,componentName:o})}getChanged(){return this.events}get changed(){return this.events}clear(){const t=this.events;return this.events=[],t}}class de{constructor(t){this.started=!1,this.componentObserver=new fe,this.__systemDefaultParams=t,this.name=this.constructor.systemName}destroy(){var t;this.componentObserver=null,this.__systemDefaultParams=null,null===(t=this.onDestroy)||void 0===t||t.call(this)}}const me=function(t=!0){let e=null;return e=Date.now?Date.now:()=>(new Date).getTime(),e}(),ye={originTime:0,playbackRate:1},_e=Symbol("timeMark"),ge=Symbol("playbackRate"),be=Symbol("timers"),ve=Symbol("originTime"),Ee=Symbol("setTimer"),Oe=Symbol("parent");class we{constructor(t,e){t instanceof we&&(e=t,t={}),t=Object.assign({},ye,t),e&&(this[Oe]=e);const r=t.nowtime||me;if(e)Object.defineProperty(this,"globalTime",{get:()=>e.currentTime});else{const t=r();Object.defineProperty(this,"globalTime",{get:()=>r()-t})}this[_e]=[{globalTime:this.globalTime,localTime:-t.originTime,entropy:-t.originTime,playbackRate:t.playbackRate,globalEntropy:0}],this[Oe]&&(this[_e][0].globalEntropy=this[Oe].entropy),this[ve]=t.originTime,this[ge]=t.playbackRate,this[be]=new Map}get parent(){return this[Oe]}get lastTimeMark(){return this[_e][this[_e].length-1]}markTime({time:t=this.currentTime,entropy:e=this.entropy,playbackRate:r=this.playbackRate}={}){const n={globalTime:this.globalTime,localTime:t,entropy:e,playbackRate:r,globalEntropy:this.globalEntropy};this[_e].push(n)}get currentTime(){const{localTime:t,globalTime:e}=this.lastTimeMark;return t+(this.globalTime-e)*this.playbackRate}set currentTime(t){const e=this.currentTime,r=t,n=this[be];this.markTime({time:t}),Array.from(Object.entries(n)).forEach((([t,o])=>{if(!n.has(t))return;const{isEntropy:s,delay:i,heading:a}=o.time,{handler:c,startTime:u}=o;if(s)0===i&&(c(),this.clearTimeout(t));else{const n=u+i;(0===i||!1!==a&&(r-e)*i<=0||e<=n&&n<=r||e>=n&&n>=r)&&(c(),this.clearTimeout(t))}})),this.updateTimers()}get entropy(){const{entropy:t,globalEntropy:e}=this.lastTimeMark;return t+Math.abs((this.globalEntropy-e)*this.playbackRate)}get globalEntropy(){return this[Oe]?this[Oe].entropy:this.globalTime}set entropy(t){if(this.entropy>t){const e=this.seekTimeMark(t);this[_e].length=e+1}this.markTime({entropy:t}),this.updateTimers()}fork(t){return new we(t,this)}seekGlobalTime(t){const e=this.seekTimeMark(t),r=this[_e][e],{entropy:n,playbackRate:o,globalTime:s}=r;return s+(t-n)/Math.abs(o)}seekLocalTime(t){const e=this.seekTimeMark(t),r=this[_e][e],{localTime:n,entropy:o,playbackRate:s}=r;return s>0?n+(t-o):n-(t-o)}seekTimeMark(t){const e=this[_e];let r=0,n=e.length-1;if(t<=e[r].entropy)return r;if(t>=e[n].entropy)return n;let o=Math.floor((r+n)/2);for(;o>r&&oe[o].entropy&&(r=o),o=Math.floor((r+n)/2)}return r}get playbackRate(){return this[ge]}set playbackRate(t){t!==this.playbackRate&&(this.markTime({playbackRate:t}),this[ge]=t,this.updateTimers())}get paused(){if(0===this.playbackRate)return!0;let t=this.parent;for(;t;){if(0===t.playbackRate)return!0;t=t.parent}return!1}updateTimers(){Array.from(this[be].entries()).forEach((([t,e])=>{this[Ee](e.handler,e.time,t)}))}clearTimeout(t){const e=this[be].get(t);e&&null!=e.timerID&&(this[Oe]?this[Oe].clearTimeout(e.timerID):clearTimeout(e.timerID)),this[be].delete(t)}clearInterval(t){return this.clearTimeout(t)}clear(){const t=this[be];Array.from(Object.keys(t)).forEach((t=>{this.clearTimeout(t)}))}setTimeout(t,e={delay:0}){return this[Ee](t,e)}setInterval(t,e={delay:0}){const r=this,n=this[Ee]((function o(){r[Ee](o,e,n),t()}),e);return n}[Ee](t,e,r=Symbol("timerID")){e=function(t){return"number"==typeof t?t={delay:t}:"entropy"in t&&(t={delay:t.entropy,isEntropy:!0}),t}(e);const n=this[be].get(r);let o,s,i,a=null;n?(this.clearTimeout(r),o=e.isEntropy?(e.delay-(this.entropy-n.startEntropy))/Math.abs(this.playbackRate):(e.delay-(this.currentTime-n.startTime))/this.playbackRate,s=n.startTime,i=n.startEntropy):(o=e.delay/(e.isEntropy?Math.abs(this.playbackRate):this.playbackRate),s=this.currentTime,i=this.entropy);const c=this[Oe],u=c?c.setTimeout.bind(c):setTimeout,h=e.heading;return!c&&!1===h&&o<0&&(o=1/0),(isFinite(o)||c)&&(o=Math.ceil(o),u!==setTimeout&&(o={delay:o,heading:h}),a=u((()=>{this[be].delete(r),t()}),o)),this[be].set(r,{timerID:a,handler:t,time:e,startTime:s,startEntropy:i}),r}}const Te={autoStart:!0,frameRate:60};class je{constructor(t){t=Object.assign({},Te,t),this._frameCount=0,this._frameDuration=1e3/t.frameRate,this.autoStart=t.autoStart,this.frameRate=t.frameRate,this.timeline=new we({originTime:0,playbackRate:1}),this._lastFrameTime=this.timeline.currentTime,this._tickers=new Set,this._requestId=null,this._ticker=()=>{this._started&&(this._requestId=requestAnimationFrame(this._ticker),this.update())},this.autoStart&&this.start()}update(){const t=this.timeline.currentTime,e=t-this._lastFrameTime;if(e>=this._frameDuration){const r=t-e%this._frameDuration,n=r-this._lastFrameTime;this._lastFrameTime=r;const o={deltaTime:n,time:t,currentTime:t,frameCount:++this._frameCount,fps:Math.round(1e3/n)};for(const t of this._tickers)"function"==typeof t&&t(o)}}add(t){this._tickers.add(t)}remove(t){this._tickers.delete(t)}start(){this._started||(this._started=!0,this.timeline.playbackRate=1,this._requestId=requestAnimationFrame(this._ticker))}pause(){this._started=!1,this.timeline.playbackRate=0}}class ke extends pe{constructor(t,e){super(t,e),this.gameObjects=[],this.scene=this}addGameObject(t){this.gameObjects.push(t),t.transform&&(t.transform.inScene=!0)}removeGameObject(t){const e=this.gameObjects.indexOf(t);-1!==e&&(t.transform&&(t.transform.inScene=!1),this.gameObjects.splice(e,1))}destroy(){this.scene=null,super.destroy(),this.gameObjects=null,this.canvas=null}}var xe;t.LOAD_SCENE_MODE=void 0,(xe=t.LOAD_SCENE_MODE||(t.LOAD_SCENE_MODE={})).SINGLE="SINGLE",xe.MULTI_CANVAS="MULTI_CANVAS";const Ae=t=>{if((t instanceof de||t instanceof r)&&!t.started){t.started=!0;try{t.start&&t.start()}catch(e){t instanceof r?console.error(`${t.constructor.componentName} start error`,e):console.error(`${t.constructor.systemName} start error`,e)}}};function Se(t={}){return function(e){if(!e.observerInfo){for(const e in t)for(const r in t[e]){let n;"string"==typeof t[e][r]&&(t[e][r]=[t[e][r]]),Array.isArray(t[e][r])&&(n={prop:t[e][r],deep:!1},t[e][r]=n),n=t[e][r],"string"==typeof n.prop&&(n.prop=[n.prop])}e.observerInfo=t}}}var Ce=function(){function t(t,e,r){void 0===e&&(e=!1),this.next=null,this.prev=null,this.owner=null,this.fn=t,this.once=e,this.thisArg=r}return t.prototype.detach=function(){return null!==this.owner&&(this.owner.detach(this),!0)},t.prototype.dispose=function(){this.detach()},t}(),Re=function(){function t(){this._head=null,this._tail=null,this._filter=null}return t.prototype.handlers=function(){for(var t=this._head,e=[];t;)e.push(t),t=t.next;return e},t.prototype.hasAny=function(){return!!this._head},t.prototype.has=function(t){return t.owner===this},t.prototype.dispatch=function(){for(var t=[],e=0;e-1?n:t.length,o>-1?o:t.length);e=(t=t.substring(0,s)).substring(t.lastIndexOf(".")+1)}return e.toLowerCase()}function Ue(t){throw new Error("Unexpected value. Should have been never.")}!function(t){t[t.Unknown=0]="Unknown",t[t.Buffer=1]="Buffer",t[t.Blob=2]="Blob",t[t.Json=3]="Json",t[t.Xml=4]="Xml",t[t.Image=5]="Image",t[t.Audio=6]="Audio",t[t.Video=7]="Video",t[t.Text=8]="Text"}(Le||(Le={})),function(t){t[t.NotStarted=0]="NotStarted",t[t.Loading=1]="Loading",t[t.Complete=2]="Complete"}(Pe||(Pe={}));var $e,Ve=function(t){function e(e,r){var n=t.call(this,e)||this;return n.elementType=r,n._boundOnLoad=n._onLoad.bind(n),n._boundOnError=n._onError.bind(n),n._boundOnTimeout=n._onTimeout.bind(n),n._element=n._createElement(),n._elementTimer=0,n}return Ne(e,t),e.prototype.load=function(){var t=this.config;t.crossOrigin&&(this._element.crossOrigin=t.crossOrigin);var e=t.sourceSet||[t.url];if(navigator.isCocoonJS)this._element.src=e[0];else for(var r=0;r0||t.responseType===$e.Buffer)?r=200:1223===r&&(r=204),200===100*Math.floor(r/100))switch(this._xhrType){case $e.Buffer:console.warn(Le.Buffer,t.response),this._complete(Le.Buffer,t.response);break;case $e.Blob:this._complete(Le.Blob,t.response);break;case $e.Document:this._parseDocument(e);break;case $e.Json:this._parseJson(e);break;case $e.Default:case $e.Text:this._complete(Le.Text,e);break;default:Ue(this._xhrType)}else this._error("["+t.status+"] "+t.statusText+": "+t.responseURL)},e.prototype._parseDocument=function(t){try{if(window.DOMParser){var e=(new DOMParser).parseFromString(t,"text/xml");this._complete(Le.Xml,e)}else{var r=document.createElement("div");r.innerHTML=t,this._complete(Le.Xml,r)}}catch(t){this._error("Error trying to parse loaded xml: "+t)}},e.prototype._parseJson=function(t){try{var e=JSON.parse(t);this._complete(Le.Json,e)}catch(t){this._error("Error trying to parse loaded json: "+t)}},e.prototype._onAbort=function(){var t=this._xhr;this._error(Je(t)+" Request was aborted by the user.")},e.prototype._onError=function(){var t=this._xhr;this._error(Je(t)+" Request failed. Status: "+t.status+', text: "'+t.statusText+'"')},e.prototype._onTimeout=function(){var t=this._xhr;this._error(Je(t)+" Request timed out.")},e.prototype._onProgress=function(t){t&&t.lengthComputable&&this.onProgress.dispatch(t.loaded/t.total)},e.setExtensionXhrType=function(t,r){t&&0===t.indexOf(".")&&(t=t.substring(1)),t&&(e._xhrTypeMap[t]=r)},e.ResponseType=$e,e._xhrTypeMap={xhtml:$e.Document,html:$e.Document,htm:$e.Document,xml:$e.Document,tmx:$e.Document,svg:$e.Document,tsx:$e.Document,gif:$e.Blob,png:$e.Blob,bmp:$e.Blob,jpg:$e.Blob,jpeg:$e.Blob,tif:$e.Blob,tiff:$e.Blob,webp:$e.Blob,tga:$e.Blob,json:$e.Json,text:$e.Text,txt:$e.Text,ttf:$e.Buffer,otf:$e.Buffer},e}(Me);function He(t){var e=t;return function(){for(var t=[],r=0;rt)).map((({name:t})=>t));this.progress=new rr({resource:this,resourceTotal:t.length}),this.loadResource({names:t,preload:!0})}getResource(t){return ce(this,void 0,void 0,(function*(){return this.loadResource({names:[t]}),this.promiseMap[t]||Promise.resolve({})}))}instance(t){return ce(this,void 0,void 0,(function*(){const e=this.resourcesMap[t];return this.makeInstanceFunctions[e.type]&&(yield this.makeInstanceFunctions[e.type](e))}))}destroy(t){return ce(this,void 0,void 0,(function*(){yield this._destroy(t)}))}_destroy(t,e=!1){return ce(this,void 0,void 0,(function*(){const r=this.resourcesMap[t];if(r){if(!e)try{this.destroyInstanceFunctions[r.type]&&(yield this.destroyInstanceFunctions[r.type](r))}catch(t){console.warn(`destroy resource ${r.name} error with '${t.message}'`)}delete this.promiseMap[t],r.data={},r.complete=!1,r.instance=void 0}}))}registerInstance(t,e){this.makeInstanceFunctions[t]=e}registerDestroy(t,e){this.destroyInstanceFunctions[t]=e}loadResource({names:t=[],preload:e=!1}){const r=t.filter((t=>!this.promiseMap[t]&&this.resourcesMap[t]));if(!r.length)return;const n={},o=this.getLoader(e);r.forEach((t=>{this.promiseMap[t]=new Promise((e=>n[t]=e));const r=this.resourcesMap[t];for(const s in r.src){const i=r.src[s].type;"data"===i?(r.data[s]=r.src[s].data,this.doComplete(t,n[t],e)):o.add({url:r.src[s].url,name:`${r.name}_${s}`,strategy:nr[i],metadata:{key:s,name:r.name,resolves:n}})}})),o.load()}doComplete(t,e,r=!1){return ce(this,void 0,void 0,(function*(){const n=this.resourcesMap[t],o={name:t,resource:this.resourcesMap[t],success:!0};if(this.checkAllLoaded(t))try{n.instance=yield this.instance(t),n.complete=!0,r&&this.progress.onProgress(o),e(n)}catch(t){n.complete=!1,r&&(o.errMsg=t.message,o.success=!1,this.progress.onProgress(o)),e({})}}))}checkAllLoaded(t){const e=this.resourcesMap[t];return Array.from(Object.keys(e.src)).every((t=>e.data[t]))}getLoader(t=!1){let e=this.loaders.find((({loading:t})=>!t));return e||(e=new er,this.loaders.push(e)),t&&e.onStart.once((()=>{this.progress.onStart()})),e.onLoad.add(((e,r)=>{this.onLoad({preload:t,resource:r})})),e.onError.add(((e,r,n)=>{this.onError({errMsg:e,resource:n,preload:t})})),e.onComplete.once((()=>{e.onLoad.detachAll(),e.onError.detachAll(),e.reset()})),e}onLoad({preload:t=!1,resource:e}){return ce(this,void 0,void 0,(function*(){const{metadata:{key:r,name:n,resolves:o},data:s}=e;this.resourcesMap[n].data[r]=s,this.doComplete(n,o[n],t)}))}onError({errMsg:t,preload:e=!1,resource:r}){return ce(this,void 0,void 0,(function*(){const{metadata:{name:n,resolves:o}}=r;if(this._destroy(n,!0),o[n]({}),e){const e={name:n,resource:this.resourcesMap[n],success:!1,errMsg:t};this.progress.onProgress(e)}}))}},sr={IDEProp:ue,componentObserver:Se};t.Component=r,t.Game=class extends e{constructor({systems:t,frameRate:e=60,autoStart:r=!0,needScene:n=!0}={}){if(super(),this.playing=!1,this.started=!1,this.multiScenes=[],this.systems=[],this.ticker=new je({autoStart:!1,frameRate:e}),this.initTicker(),t&&t.length)for(const e of t)this.addSystem(e);n&&this.loadScene(new ke("scene")),r&&this.start()}get scene(){return this._scene}set scene(t){this._scene=t}get gameObjects(){return(t=>{var e;const r=(null===(e=null==t?void 0:t.scene)||void 0===e?void 0:e.gameObjects)||[],n=null==t?void 0:t.multiScenes.map((({gameObjects:t})=>t));let o=[];for(const t of n)o=[...o,...t];return[...r,...o]})(this)}addSystem(t,e){let r;if(t instanceof Function)r=new t(e);else{if(!(t instanceof de))return void console.warn("can only add System");r=t}if(!this.systems.find((t=>t.constructor===r.constructor))){r.game=this,r.init&&r.init(r.__systemDefaultParams),function(t,e){ee[e.systemName]=e.observerInfo,te[e.systemName]=t}(r,r.constructor),function(t){const e=[];t instanceof Array?e.push(...t):e.push(t);for(const t of e)for(const e in t.observerInfo){re[e]=re[e]||[];const r=re[e];for(const n of t.observerInfo[e])-1===r.findIndex((t=>Kt(t,n)))&&re[e].push(n)}}(r.constructor);try{r.awake&&r.awake()}catch(t){console.error(`${r.constructor.systemName} awake error`,t)}return this.systems.push(r),r}console.warn(`${r.constructor.systemName} System has been added`)}removeSystem(t){if(!t)return;let e=-1;"string"==typeof t?e=this.systems.findIndex((e=>e.name===t)):t instanceof Function?e=this.systems.findIndex((e=>e.constructor===t)):t instanceof de&&(e=this.systems.findIndex((e=>e===t))),e>-1&&(this.systems[e].destroy&&this.systems[e].destroy(),this.systems.splice(e,1))}getSystem(t){return this.systems.find((e=>"string"==typeof t?e.name===t:e instanceof t))}pause(){this.playing&&(this.playing=!1,this.ticker.pause(),this.triggerPause())}start(){this.playing||(this.playing=!0,this.started=!0,this.ticker.start())}resume(){this.playing||(this.playing=!0,this.ticker.start(),this.triggerResume())}initTicker(){this.ticker.add((t=>{this.scene&&((t,e=[])=>{for(const r of e)for(const e of r.components)try{Ae(e),e.update&&e.update(t)}catch(t){console.error(`gameObject: ${r.name} ${e.name} update error`,t)}for(const r of e)for(const e of r.components)try{e.lateUpdate&&e.lateUpdate(t)}catch(t){console.error(`gameObject: ${r.name} ${e.name} lateUpdate error`,t)}})(t,this.gameObjects);for(const e of this.systems)try{Ae(e),e.update&&e.update(t)}catch(t){console.error(`${e.constructor.systemName} update error`,t)}for(const e of this.systems)try{e.lateUpdate&&e.lateUpdate(t)}catch(t){console.error(`${e.constructor.systemName} lateUpdate error`,t)}}))}triggerResume(){(t=>{for(const e of t)for(const t of e.components)try{t.onResume&&t.onResume()}catch(r){console.error(`gameObject: ${e.name}, ${t.name}, onResume error`,r)}})(this.gameObjects);for(const t of this.systems)try{t.onResume&&t.onResume()}catch(e){console.error(`${t.constructor.systemName}, onResume error`,e)}}triggerPause(){(t=>{for(const e of t)for(const t of e.components)try{t.onPause&&t.onPause()}catch(r){console.error(`gameObject: ${e.name}, ${t.name}, onResume error`,r)}})(this.gameObjects);for(const t of this.systems)try{t.onPause&&t.onPause()}catch(e){console.error(`${t.constructor.systemName}, onPause error`,e)}}destroySystems(){for(const t of[...this.systems])this.removeSystem(t);this.systems.length=0}destroy(){this.removeAllListeners(),this.pause(),this.scene.destroy(),this.destroySystems(),this.ticker=null,this.scene=null,this.canvas=null,this.multiScenes=null}loadScene({scene:e,mode:r=t.LOAD_SCENE_MODE.SINGLE,params:n={}}){if(e){switch(r){case t.LOAD_SCENE_MODE.SINGLE:this.scene=e;break;case t.LOAD_SCENE_MODE.MULTI_CANVAS:this.multiScenes.push(e)}this.emit("sceneChanged",{scene:e,mode:r,params:n})}}},t.GameObject=pe,t.IDEProp=ue,t.Scene=ke,t.System=de,t.Transform=he,t.componentObserver=Se,t.decorators=sr,t.resource=or,Object.defineProperty(t,"__esModule",{value:!0})})); diff --git a/dist/cdn/min/EVA.plugin.EVAX.min.js b/dist/cdn/min/EVA.plugin.EVAX.min.js deleted file mode 100644 index 551d6bbf..00000000 --- a/dist/cdn/min/EVA.plugin.EVAX.min.js +++ /dev/null @@ -1 +0,0 @@ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@eva/eva.js")):"function"==typeof define&&define.amd?define(["exports","@eva/eva.js"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).EVA=t.EVA||{},t.EVA.plugin=t.EVA.plugin||{},t.EVA.plugin.EVAX={}),t.EVA)}(this,(function(t,e){"use strict";function r(t,e,r,n){var o,c=arguments.length,i=c<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(i=(c<3?o(i):c>3?o(e,r,i):o(e,r))||i);return c>3&&i&&Object.defineProperty(e,r,i),i}class n extends e.Component{constructor(t){super(t),this.events={}}init(t={events:{}}){const{events:e}=t;this.events=e||{}}}n.componentName="EvaX",r([e.decorators.IDEProp],n.prototype,"events",void 0);var o=function(t){var e={exports:{}};return t(e,e.exports),e.exports}((function(t){var e=Object.prototype.hasOwnProperty,r="~";function n(){}function o(t,e,r){this.fn=t,this.context=e,this.once=r||!1}function c(t,e,n,c,i){if("function"!=typeof n)throw new TypeError("The listener must be a function");var a=new o(n,c||t,i),s=r?r+e:e;return t._events[s]?t._events[s].fn?t._events[s]=[t._events[s],a]:t._events[s].push(a):(t._events[s]=a,t._eventsCount++),t}function i(t,e){0==--t._eventsCount?t._events=new n:delete t._events[e]}function a(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(r=!1)),a.prototype.eventNames=function(){var t,n,o=[];if(0===this._eventsCount)return o;for(n in t=this._events)e.call(t,n)&&o.push(r?n.slice(1):n);return Object.getOwnPropertySymbols?o.concat(Object.getOwnPropertySymbols(t)):o},a.prototype.listeners=function(t){var e=r?r+t:t,n=this._events[e];if(!n)return[];if(n.fn)return[n.fn];for(var o=0,c=n.length,i=new Array(c);o-1},s.prototype.set=function(t,e){var r=this.__data__,n=i(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this};var u="object"==typeof global&&global&&global.Object===Object&&global,f="object"==typeof self&&self&&self.Object===Object&&self,l=u||f||Function("return this")(),p=l.Symbol,h=Object.prototype,v=h.hasOwnProperty,b=h.toString,y=p?p.toStringTag:void 0;var d=Object.prototype.toString;var j=p?p.toStringTag:void 0;function _(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":j&&j in Object(t)?function(t){var e=v.call(t,y),r=t[y];try{t[y]=void 0;var n=!0}catch(t){}var o=b.call(t);return n&&(e?t[y]=r:delete t[y]),o}(t):function(t){return d.call(t)}(t)}function g(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function O(t){if(!g(t))return!1;var e=_(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}var m,w=l["__core-js_shared__"],A=(m=/[^.]+$/.exec(w&&w.keys&&w.keys.IE_PROTO||""))?"Symbol(src)_1."+m:"";var x=Function.prototype.toString;function S(t){if(null!=t){try{return x.call(t)}catch(t){}try{return t+""}catch(t){}}return""}var E=/^\[object .+?Constructor\]$/,P=Function.prototype,z=Object.prototype,U=P.toString,F=z.hasOwnProperty,L=RegExp("^"+U.call(F).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function k(t){return!(!g(t)||(e=t,A&&A in e))&&(O(t)?L:E).test(S(t));var e}function T(t,e){var r=function(t,e){return null==t?void 0:t[e]}(t,e);return k(r)?r:void 0}var D=T(l,"Map"),I=T(Object,"create");var V=Object.prototype.hasOwnProperty;var C=Object.prototype.hasOwnProperty;function M(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e-1&&t%1==0&&t-1&&t%1==0&&t<=9007199254740991}var st={};function ut(t){return function(e){return t(e)}}st["[object Float32Array]"]=st["[object Float64Array]"]=st["[object Int8Array]"]=st["[object Int16Array]"]=st["[object Int32Array]"]=st["[object Uint8Array]"]=st["[object Uint8ClampedArray]"]=st["[object Uint16Array]"]=st["[object Uint32Array]"]=!0,st["[object Arguments]"]=st["[object Array]"]=st["[object ArrayBuffer]"]=st["[object Boolean]"]=st["[object DataView]"]=st["[object Date]"]=st["[object Error]"]=st["[object Function]"]=st["[object Map]"]=st["[object Number]"]=st["[object Object]"]=st["[object RegExp]"]=st["[object Set]"]=st["[object String]"]=st["[object WeakMap]"]=!1;var ft="object"==typeof t&&t&&!t.nodeType&&t,lt=ft&&"object"==typeof module&&module&&!module.nodeType&&module,pt=lt&<.exports===ft&&u.process,ht=function(){try{var t=lt&<.require&<.require("util").types;return t||pt&&pt.binding&&pt.binding("util")}catch(t){}}(),vt=ht&&ht.isTypedArray,bt=vt?ut(vt):function(t){return Y(t)&&at(t.length)&&!!st[_(t)]},yt=Object.prototype.hasOwnProperty;function dt(t,e){var r=tt(t),n=!r&&Z(t),o=!r&&!n&&ot(t),c=!r&&!n&&!o&&bt(t),i=r||n||o||c,a=i?function(t,e){for(var r=-1,n=Array(t);++r-1)return;me.get(r).push(t);const i=t.split(".");let a=r;const s=i.length;for(let t=0;ta[`_${i[s-1]}`]})}function Ae(t,e,r){for(const n in t)n in e&&("object"==typeof t[n]?Ae(t[n],e[n],r):(r||t[n]!==e[n])&&(t[n]=e[n]))}let xe=class extends e.System{constructor(){super(...arguments),this.changeList=[]}init({store:t={}}={store:{}}){this.ee=new o,this.store=t,this.bindDefaultListener()}bindDefaultListener(){this.ee.on("evax.updateStore",(t=>{this.updateStore(t)})),this.ee.on("evax.forceUpdateStore",(t=>{this.forceUpdateStore(t)}))}changeCallback(t,e){this.changeList.push({key:t,oldStore:e})}updateStore(t){Ae(this.store,t,!1)}forceUpdateStore(t){Ae(this.store,t,!0)}bindListener(t,e){if(-1===t.indexOf("store."))return;we(t.split(".").slice(1).join("."),e,this.store,t,this.store,((t,e)=>this.changeCallback(t,e)))}update(){const t=this.componentObserver.clear();for(const r of t)switch(r.type){case e.OBSERVER_TYPE.ADD:this.add(r);break;case e.OBSERVER_TYPE.REMOVE:this.remove(r)}}lateUpdate(){for(const t of this.changeList)this.ee.emit(t.key,this.store,t.oldStore);this.changeList=[]}add(t){const e=t.component;e.evax=this;for(const t in e.events)if(e.events[t]){let r;this.bindListener(t,!!e.events[t].deep),r=e.events[t]instanceof Function?e.events[t]:e.events[t].handler,this.ee.on(t,r.bind(e))}}remove(t){const e=t.component;for(const t in e.events)e.events[t]instanceof Function&&this.ee.off(t,e.events[t].bind(e))}on(t,e){return this.ee.on(t,e,this)}off(t,e){return this.ee.off(t,e)}emit(t,...e){return this.ee.emit(t,...e)}onDestroy(){}};xe.systemName="EvaX",xe=r([e.decorators.componentObserver({EvaX:[]})],xe);var Se=xe,Ee={Components:[n],Systems:[Se]};t.EvaX=n,t.EvaXSystem=Se,t.default=Ee,Object.defineProperty(t,"__esModule",{value:!0})})); diff --git a/dist/cdn/min/EVA.plugin.a11y.min.js b/dist/cdn/min/EVA.plugin.a11y.min.js deleted file mode 100644 index 1385f900..00000000 --- a/dist/cdn/min/EVA.plugin.a11y.min.js +++ /dev/null @@ -1 +0,0 @@ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@eva/eva.js"),require("pixi.js")):"function"==typeof define&&define.amd?define(["exports","@eva/eva.js","pixi.js"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).EVA=t.EVA||{},t.EVA.plugin=t.EVA.plugin||{},t.EVA.plugin.a11y={}),t.EVA,t.PIXI)}(this,(function(t,e,n){"use strict";function r(t,e,n,r){var o,i=arguments.length,a=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,n,a):o(e,n))||a);return i>3&&a&&Object.defineProperty(e,n,a),a}function o(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{c(r.next(t))}catch(t){i(t)}}function s(t){try{c(r.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}c((r=r.apply(t,e||[])).next())}))}const i=(t,e)=>{const{width:n,height:r,position:o,left:i=0,top:a=0,zIndex:s,pointerEvents:c,background:h}=e;t.style.width=`${n}px`,t.style.height=`${r}px`,t.style.position=o,t.style.left=`${i}`,t.style.top=`${a}`,t.style.zIndex=`${s}`,t.style.pointerEvents=c,t.style.background=h,t.style.border="none",t.style.overflow="hidden"};class a extends e.Component{constructor(t){super(),Object.assign(this,t);const{hint:e="",event:n,delay:r=0,attr:o={},role:i="",props:a={},state:s={}}=t;this.hint=e,this.event=n,this.delay=r,this.attr=o,this.role=i,this.props=a,this.state=s,this.a11yId=`_${function(t){let e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),n=[],r=e.length;for(let o=0;o-1},g.prototype.set=function(t,e){var n=this.__data__,r=v(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this};var m="object"==typeof global&&global&&global.Object===Object&&global,b="object"==typeof self&&self&&self.Object===Object&&self,_=m||b||Function("return this")(),j=_.Symbol,O=Object.prototype,E=O.hasOwnProperty,w=O.toString,A=j?j.toStringTag:void 0;var C=Object.prototype.toString;var S=j?j.toStringTag:void 0;function x(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":S&&S in Object(t)?function(t){var e=E.call(t,A),n=t[A];try{t[A]=void 0;var r=!0}catch(t){}var o=w.call(t);return r&&(e?t[A]=n:delete t[A]),o}(t):function(t){return C.call(t)}(t)}function P(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function N(t){if(!P(t))return!1;var e=x(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}var I,M=_["__core-js_shared__"],R=(I=/[^.]+$/.exec(M&&M.keys&&M.keys.IE_PROTO||""))?"Symbol(src)_1."+I:"";var T=Function.prototype.toString;function D(t){if(null!=t){try{return T.call(t)}catch(t){}try{return t+""}catch(t){}}return""}var k=/^\[object .+?Constructor\]$/,z=Function.prototype,B=Object.prototype,$=z.toString,L=B.hasOwnProperty,V=RegExp("^"+$.call(L).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Y(t){return!(!P(t)||(e=t,R&&R in e))&&(N(t)?V:k).test(D(t));var e}function U(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return Y(n)?n:void 0}var X=U(_,"Map"),F=U(Object,"create");var W=Object.prototype.hasOwnProperty;var G=Object.prototype.hasOwnProperty;function H(t){var e=-1,n=null==t?0:t.length;for(this.clear();++es))return!1;var h=i.get(t),u=i.get(e);if(h&&u)return h==e&&u==t;var p=-1,l=!0,f=2&n?new Q:void 0;for(i.set(t,e),i.set(e,t);++p-1&&t%1==0&&t-1&&t%1==0&&t<=9007199254740991}var Et={};Et["[object Float32Array]"]=Et["[object Float64Array]"]=Et["[object Int8Array]"]=Et["[object Int16Array]"]=Et["[object Int32Array]"]=Et["[object Uint8Array]"]=Et["[object Uint8ClampedArray]"]=Et["[object Uint16Array]"]=Et["[object Uint32Array]"]=!0,Et["[object Arguments]"]=Et["[object Array]"]=Et["[object ArrayBuffer]"]=Et["[object Boolean]"]=Et["[object DataView]"]=Et["[object Date]"]=Et["[object Error]"]=Et["[object Function]"]=Et["[object Map]"]=Et["[object Number]"]=Et["[object Object]"]=Et["[object RegExp]"]=Et["[object Set]"]=Et["[object String]"]=Et["[object WeakMap]"]=!1;var wt,At="object"==typeof t&&t&&!t.nodeType&&t,Ct=At&&"object"==typeof module&&module&&!module.nodeType&&module,St=Ct&&Ct.exports===At&&m.process,xt=function(){try{var t=Ct&&Ct.require&&Ct.require("util").types;return t||St&&St.binding&&St.binding("util")}catch(t){}}(),Pt=xt&&xt.isTypedArray,Nt=Pt?(wt=Pt,function(t){return wt(t)}):function(t){return ut(t)&&Ot(t.length)&&!!Et[x(t)]},It=Object.prototype.hasOwnProperty;function Mt(t,e){var n=at(t),r=!n&&vt(t),o=!n&&!r&&bt(t),i=!n&&!r&&!o&&Nt(t),a=n||r||o||i,s=a?function(t,e){for(var n=-1,r=Array(t);++n-1){try{t.componentChanged&&t.componentChanged(n)}catch(t){console.error(`gameObject: ${n.gameObject.name}, ${n.componentName} is error.`,n,t)}continue}if(r.findIndex((t=>{return e=t,r=n.prop,se(e,r);var e,r}))>-1)try{t.componentChanged&&t.componentChanged(n)}catch(t){console.error(`gameObject: ${n.gameObject&&n.gameObject.name}, ${n.componentName} is componentChanged error.`,n,t)}}}}update(t){for(const e of t.components)for(const n of this.renderers){const r=[];if(n.observerInfo[e.name]&&-1===r.indexOf(t)){r.push(t);try{n.rendererUpdate&&n.rendererUpdate(t)}catch(n){console.info(`gameObject: ${t.name}, ${e.name} is update error`,n)}}}}}class he{constructor(){this.containerMap={}}addContainer({name:t,container:e}){this.containerMap[t]=e}getContainer(t){return this.containerMap[t]}removeContainer(t){var e;null===(e=this.containerMap[t])||void 0===e||e.destroy(!0),delete this.containerMap[t]}updateTransform({name:t,transform:e}){const n=this.containerMap[t];if(!n)return;const{anchor:r,origin:o,position:i,rotation:a,scale:s,size:c,skew:h}=e;n.rotation=a,n.scale=s,n.pivot.x=c.width*o.x,n.pivot.y=c.height*o.y,n.skew=h;let u=i.x,p=i.y;if(e.parent){const t=e.parent;u+=t.size.width*r.x,p+=t.size.height*r.y}n.position={x:u,y:p}}}var ue=function(t){var e={exports:{}};return t(e,e.exports),e.exports}((function(t){var e=Object.prototype.hasOwnProperty,n="~";function r(){}function o(t,e,n){this.fn=t,this.context=e,this.once=n||!1}function i(t,e,r,i,a){if("function"!=typeof r)throw new TypeError("The listener must be a function");var s=new o(r,i||t,a),c=n?n+e:e;return t._events[c]?t._events[c].fn?t._events[c]=[t._events[c],s]:t._events[c].push(s):(t._events[c]=s,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new r:delete t._events[e]}function s(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(n=!1)),s.prototype.eventNames=function(){var t,r,o=[];if(0===this._eventsCount)return o;for(r in t=this._events)e.call(t,r)&&o.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?o.concat(Object.getOwnPropertySymbols(t)):o},s.prototype.listeners=function(t){var e=n?n+t:t,r=this._events[e];if(!r)return[];if(r.fn)return[r.fn];for(var o=0,i=r.length,a=new Array(i);o{this.waitChangeScenes.push({scene:t,mode:e,application:n})}))}update(){for(const t of this.waitRemoveIds)this.containerManager.removeContainer(t);this.waitRemoveIds=[];for(const t of this.waitChangeScenes){const e=this.containerManager.getContainer(t.scene.id);e&&(t.application.stage.removeChildren(),t.application.stage.addChild(e))}this.waitChangeScenes=[]}componentChanged(t){t.type===e.OBSERVER_TYPE.ADD?this.addContainer(t):t.type===e.OBSERVER_TYPE.CHANGE?this.change(t):t.type===e.OBSERVER_TYPE.REMOVE&&this.waitRemoveIds.push(t.gameObject.id)}addContainer(t){const e=new f;e.name=t.gameObject.name,this.containerManager.addContainer({name:t.gameObject.id,container:e});t.component.worldTransform=e.transform.worldTransform}change(t){const e=t.component;if(e.parent){this.containerManager.getContainer(e.parent.gameObject.id).addChild(this.containerManager.getContainer(t.gameObject.id));const n=t.gameObject.transform.parent&&t.gameObject.transform.parent.gameObject.getComponent("Render");n&&(n.sortDirty=!0)}else{const n=this.containerManager.getContainer(t.gameObject.id);delete e.worldTransform,n.parent&&n.parent.removeChild(n)}}destroy(){this.removeAllListeners(),this.waitRemoveIds=null,this.waitChangeScenes=null,this.system=null,this.containerManager=null}};pe=r([e.decorators.componentObserver({Transform:["_parent"]})],pe);var le,fe=pe;!function(t){t[t.UNKNOWN=0]="UNKNOWN",t[t.WEBGL=1]="WEBGL",t[t.CANVAS=2]="CANVAS"}(le||(le={}));const de=t=>{t.plugins.interaction.autoPreventDefault=!0,t.view.style.touchAction="none"},ve=t=>{t.plugins.interaction.autoPreventDefault=!1,t.view.style.touchAction="auto"};let ye=class extends e.System{constructor(){super(...arguments),this.multiApps=[]}init(t){this.params=t,this.application=this.createApplication(t),this.containerManager=new he,this.rendererManager=new ce({game:this.game,rendererSystem:this}),this.game.canvas=this.application.view,this.transform=new fe({system:this,containerManager:this.containerManager}),this.game.on("sceneChanged",(({scene:t,mode:n,params:r})=>{let o;switch(n){case e.LOAD_SCENE_MODE.SINGLE:o=this.application;break;case e.LOAD_SCENE_MODE.MULTI_CANVAS:o=this.createMultiApplication({params:r})}t.canvas=o.view,this.transform.emit("changeScene",{scene:t,mode:n,application:o})}))}registerObserver(t){const e=this.constructor.observerInfo;for(const n in t)e[n]||(e[n]=[]),e[n].push(...t[n])}createMultiApplication({params:t}){const e=this.createApplication(t);return this.multiApps.push(e),e}createApplication(t){t.view=t.canvas,t.renderType===le.CANVAS&&(t.forceCanvas=!0),n.ticker.shared.autoStart=!1,n.ticker.shared.stop();const e=new l(Object.assign({sharedTicker:!0},t));return void 0!==t.preventScroll&&(console.warn("PreventScroll property will deprecate at next major version, please use enableEnable instead. https://eva.js.org/#/tutorials/game"),t.preventScroll?ve(e.renderer):de(e.renderer)),void 0!==t.enableScroll&&(t.enableScroll?ve(e.renderer):de(e.renderer)),void 0===t.preventScroll&&void 0===t.enableScroll&&ve(e.renderer),e}update(){const t=this.componentObserver.clear();for(const e of t)this.transform.componentChanged(e);for(const t of this.game.gameObjects)this.containerManager.updateTransform({name:t.id,transform:t.transform}),this.rendererManager.update(t)}lateUpdate(t){this.transform.update(),this.application.ticker.update(t.time)}onDestroy(){this.application.destroy();for(const t of this.multiApps)t&&t.destroy();this.transform.destroy(),this.transform=null,this.params=null,this.rendererManager=null,this.containerManager=null,this.application=null,this.game=null,this.multiApps=null}resize(t,e){this.params.width=t,this.params.height=e,this.application.renderer.resize(t,e)}};ye.systemName="Renderer",ye=r([e.decorators.componentObserver({Transform:["_parent"]})],ye);var ge=ye;const me=["hint","event","delay","attr","role","props","state","a11yId","name"],be=function(t,e,n){["touchstart","touchend","tap"].forEach((r=>{t.emit(r,{stopPropagation:()=>n.stopPropagation(),data:{position:this.eventPosition},gameObject:e})}))};let _e=class extends e.System{constructor(t){super(t),this.cache=new Map,this.eventCache=new Map}get ratioX(){if(this._ratioX)return this._ratioX;return this.setRatio()?this._ratioX:0}get ratioY(){if(this._ratioY)return this._ratioY;return this.setRatio()?this._ratioY:0}init(e={}){return o(this,void 0,void 0,(function*(){const{activate:n=t.A11yActivate.CHECK,delay:r=100,checkA11yOpen:o=(()=>Promise.resolve(!1))}=e;switch(this.delay=r,n){case t.A11yActivate.CHECK:try{this.activate=yield o()}catch(t){this.activate=!1}break;case t.A11yActivate.DISABLE:this.activate=!1;break;case t.A11yActivate.ENABLE:this.activate=!0}if(this.debug=e.debug||!1,this.debug&&(this.activate=!0),!this.activate)return;const i=document.createElement("div");this.div=i,this.game.canvas.parentNode&&this.game.canvas.parentNode.appendChild(this.div)}))}setRatio(){const{width:t,height:e}=this.getCanvasBoundingClientRect(),{renderWidth:n,renderHeight:r}=this.getRenderRect();return this._ratioX=t/n,this._ratioY=e/r,!(!t&&!e)&&(this.initDiv(),!0)}getRenderRect(){const{params:t}=this.game.getSystem(ge)||{width:300,height:300},{height:e,width:n}=t;return{renderWidth:n,renderHeight:e}}getCanvasBoundingClientRect(){const{width:t,height:e,left:n,top:r}=this.game.canvas.getBoundingClientRect();return{width:t,height:e,left:n,top:r}}initDiv(){const{pageXOffset:t,pageYOffset:e}=window,{width:n,height:r,left:o,top:a}=this.getCanvasBoundingClientRect(),c={width:n,height:r,left:`${o+t}px`,top:`${a+e}px`,position:s,zIndex:3,pointerEvents:h.NONE,background:u.NONE};i(this.div,c),this.div.addEventListener("click",(t=>{const e=t.currentTarget,{left:n,top:r}=e.getBoundingClientRect(),o=(t.pageX-n)/this.ratioX,i=(t.pageY-r)/this.ratioY;this.eventPosition={x:o,y:i}}),!0)}update(){return o(this,void 0,void 0,(function*(){const t=this.componentObserver.clear();if(this.activate)for(const n of t)switch(n.type){case e.OBSERVER_TYPE.ADD:"Event"===n.componentName&&this.addEvent(n.gameObject),"A11y"===n.componentName&&this.add(n);break;case e.OBSERVER_TYPE.CHANGE:"Transform"===n.componentName&&this.transformChange(n);break;case e.OBSERVER_TYPE.REMOVE:"Event"===n.componentName&&this.removeEvent(n),"A11y"===n.componentName&&this.remove(n)}}))}remove(t){const e=t.component;if(!e)return;const{a11yId:n}=e,r=this.div.querySelector(`#${n}`);r&&this.div.removeChild(r),this.cache.delete(n)}add(t){if(!this.activate)return;const e=t.component,{gameObject:n}=t,{delay:r,a11yId:o}=e;let{event:i}=e;if(!n)return;const{transform:a}=n;if(!a)return;const s=document.createElement("div");this.cache.set(o,s),i||(i=n.getComponent("Event")),setTimeout((()=>{this.setPosition(s,a),this.setA11yAttr(s,e),i&&this.addEvent(n),n.scene&&this.div.appendChild(s)}),r||this.delay)}transformChange(t){const e=t.component,{gameObject:n}=t,r=n.getComponent(a);if(!r)return;const{a11yId:o}=r;if(e.inScene){if(this.cache.has(o)){const t=this.cache.get(o);t&&this.div.appendChild(t)}}else{const t=this.div.querySelector(`#${o}`);t&&this.div.removeChild(t)}}setEvent(t,e,n,r){if(!e)return;const o=be.bind(this,e,n);this.eventCache.set(r,o),t.addEventListener("click",o)}addEvent(t){const e=t.getComponent(a);if(!e)return;const n=t.getComponent("Event");if(!n)return;const r=this.cache.get(e.a11yId);r&&this.setEvent(r,n,t,e.a11yId)}removeEvent(t){const{gameObject:e}=t,n=e.getComponent(a);if(!n)return;if(!t.component)return;const{a11yId:r}=n,o=this.eventCache.get(r),i=this.cache.get(r);i&&i.removeEventListener("click",o)}setA11yAttr(t,e){const{hint:n,props:r={},state:o={},role:i,a11yId:a}=e,s=i||"text";t.setAttribute("role",s),t.setAttribute("aria-label",n),t.id=a;const c=Object.keys(r);for(const e of c)t.setAttribute(e,r[e]);const h=Object.keys(o);for(const e of h)t.setAttribute(e,o[e]);for(let n of Object.keys(e))"string"==typeof e[n]&&-1===me.indexOf(n)&&1!==n.indexOf("_")&&t.setAttribute(n,e[n])}setPosition(t,e){const{width:n,height:r}=e.size,o={width:0===n?1:n*this.ratioX,height:0===r?1:r*this.ratioY,position:s,zIndex:3,pointerEvents:h.AUTO,background:this.debug?u.DEBUG:u.NONE},a=Object.assign({},e);i(t,o),((t,e,n,r)=>{const{worldTransform:o}=e,{a:i,b:a,c:s,d:c,tx:h,ty:u}=o,p=`matrix(${i}, ${a}, ${s}, ${c}, ${h*n}, ${u*r})`;t.style.transform=`${p}`,t.style.webkitTransform=`${p}`,t.style.transformOrigin="left top",t.style.webkitTransformOrigin="left top"})(t,a,this.ratioX,this.ratioY)}onDestroy(){this.div.parentElement.removeChild(this.div),this.cache=null,this.eventCache=null}};_e.systemName="A11ySystem",_e=r([e.decorators.componentObserver({A11y:[],Transform:["inScene"],Event:[]})],_e);var je=_e;t.A11y=a,t.A11ySystem=je,Object.defineProperty(t,"__esModule",{value:!0})})); diff --git a/dist/cdn/min/EVA.plugin.matterjs.min.js b/dist/cdn/min/EVA.plugin.matterjs.min.js deleted file mode 100644 index 5996e6db..00000000 --- a/dist/cdn/min/EVA.plugin.matterjs.min.js +++ /dev/null @@ -1 +0,0 @@ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@eva/eva.js")):"function"==typeof define&&define.amd?define(["exports","@eva/eva.js"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).EVA=e.EVA||{},e.EVA.plugin=e.EVA.plugin||{},e.EVA.plugin.matterjs={}),e.EVA)}(this,(function(e,t){"use strict";var n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function i(e,t){function i(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}var o="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};function r(){try{return require("poly-decomp")}catch(e){}}var s,a=function(e){var t={};function n(i){if(t[i])return t[i].exports;var o=t[i]={i:i,l:!1,exports:{}};return e[i].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(i,o,function(t){return e[t]}.bind(null,o));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=24)}([function(e,t){var n={};e.exports=n,function(){n._nextId=0,n._seed=0,n._nowStartTime=+new Date,n.extend=function(e,t){var i,o;"boolean"==typeof t?(i=2,o=t):(i=1,o=!0);for(var r=i;r0;t--){var i=Math.floor(n.random()*(t+1)),o=e[t];e[t]=e[i],e[i]=o}return e},n.choose=function(e){return e[Math.floor(n.random()*e.length)]},n.isElement=function(e){return"undefined"!=typeof HTMLElement?e instanceof HTMLElement:!!(e&&e.nodeType&&e.nodeName)},n.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)},n.isFunction=function(e){return"function"==typeof e},n.isPlainObject=function(e){return"object"==typeof e&&e.constructor===Object},n.isString=function(e){return"[object String]"===toString.call(e)},n.clamp=function(e,t,n){return en?n:e},n.sign=function(e){return e<0?-1:1},n.now=function(){if("undefined"!=typeof window&&window.performance){if(window.performance.now)return window.performance.now();if(window.performance.webkitNow)return window.performance.webkitNow()}return new Date-n._nowStartTime},n.random=function(t,n){return n=void 0!==n?n:1,(t=void 0!==t?t:0)+e()*(n-t)};var e=function(){return n._seed=(9301*n._seed+49297)%233280,n._seed/233280};n.colorToNumber=function(e){return 3==(e=e.replace("#","")).length&&(e=e.charAt(0)+e.charAt(0)+e.charAt(1)+e.charAt(1)+e.charAt(2)+e.charAt(2)),parseInt(e,16)},n.logLevel=1,n.log=function(){console&&n.logLevel>0&&n.logLevel<=3&&console.log.apply(console,["matter-js:"].concat(Array.prototype.slice.call(arguments)))},n.info=function(){console&&n.logLevel>0&&n.logLevel<=2&&console.info.apply(console,["matter-js:"].concat(Array.prototype.slice.call(arguments)))},n.warn=function(){console&&n.logLevel>0&&n.logLevel<=3&&console.warn.apply(console,["matter-js:"].concat(Array.prototype.slice.call(arguments)))},n.nextId=function(){return n._nextId++},n.indexOf=function(e,t){if(e.indexOf)return e.indexOf(t);for(var n=0;ne.max.x&&(e.max.x=o.x),o.xe.max.y&&(e.max.y=o.y),o.y0?e.max.x+=n.x:e.min.x+=n.x,n.y>0?e.max.y+=n.y:e.min.y+=n.y)},n.contains=function(e,t){return t.x>=e.min.x&&t.x<=e.max.x&&t.y>=e.min.y&&t.y<=e.max.y},n.overlaps=function(e,t){return e.min.x<=t.max.x&&e.max.x>=t.min.x&&e.max.y>=t.min.y&&e.min.y<=t.max.y},n.translate=function(e,t){e.min.x+=t.x,e.max.x+=t.x,e.min.y+=t.y,e.max.y+=t.y},n.shift=function(e,t){var n=e.max.x-e.min.x,i=e.max.y-e.min.y;e.min.x=t.x,e.max.x=t.x+n,e.min.y=t.y,e.max.y=t.y+i}},function(e,t){var n={};e.exports=n,n.create=function(e,t){return{x:e||0,y:t||0}},n.clone=function(e){return{x:e.x,y:e.y}},n.magnitude=function(e){return Math.sqrt(e.x*e.x+e.y*e.y)},n.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y},n.rotate=function(e,t,n){var i=Math.cos(t),o=Math.sin(t);n||(n={});var r=e.x*i-e.y*o;return n.y=e.x*o+e.y*i,n.x=r,n},n.rotateAbout=function(e,t,n,i){var o=Math.cos(t),r=Math.sin(t);i||(i={});var s=n.x+((e.x-n.x)*o-(e.y-n.y)*r);return i.y=n.y+((e.x-n.x)*r+(e.y-n.y)*o),i.x=s,i},n.normalise=function(e){var t=n.magnitude(e);return 0===t?{x:0,y:0}:{x:e.x/t,y:e.y/t}},n.dot=function(e,t){return e.x*t.x+e.y*t.y},n.cross=function(e,t){return e.x*t.y-e.y*t.x},n.cross3=function(e,t,n){return(t.x-e.x)*(n.y-e.y)-(t.y-e.y)*(n.x-e.x)},n.add=function(e,t,n){return n||(n={}),n.x=e.x+t.x,n.y=e.y+t.y,n},n.sub=function(e,t,n){return n||(n={}),n.x=e.x-t.x,n.y=e.y-t.y,n},n.mult=function(e,t){return{x:e.x*t,y:e.y*t}},n.div=function(e,t){return{x:e.x/t,y:e.y/t}},n.perp=function(e,t){return{x:(t=!0===t?-1:1)*-e.y,y:t*e.x}},n.neg=function(e){return{x:-e.x,y:-e.y}},n.angle=function(e,t){return Math.atan2(t.y-e.y,t.x-e.x)},n._temp=[n.create(),n.create(),n.create(),n.create(),n.create(),n.create()]},function(e,t,n){var i={};e.exports=i;var o=n(2),r=n(0);i.create=function(e,t){for(var n=[],i=0;i0)return!1}return!0},i.scale=function(e,t,n,r){if(1===t&&1===n)return e;var s,a;r=r||i.centre(e);for(var l=0;l=0?l-1:e.length-1],d=e[l],u=e[(l+1)%e.length],p=t[l0&&(r|=2),3===r)return!1;return 0!==r||null},i.hull=function(e){var t,n,i=[],r=[];for((e=e.slice(0)).sort((function(e,t){var n=e.x-t.x;return 0!==n?n:e.y-t.y})),n=0;n=2&&o.cross3(r[r.length-2],r[r.length-1],t)<=0;)r.pop();r.push(t)}for(n=e.length-1;n>=0;n-=1){for(t=e[n];i.length>=2&&o.cross3(i[i.length-2],i[i.length-1],t)<=0;)i.pop();i.push(t)}return i.pop(),r.pop(),i.concat(r)}},function(e,t,n){var i={};e.exports=i;var o=n(0);i.on=function(e,t,n){for(var i,o=t.split(" "),r=0;r0){n||(n={}),i=t.split(" ");for(var c=0;c0&&r.rotateAbout(s.position,n,e.position,s.position)}},i.setVelocity=function(e,t){e.positionPrev.x=e.position.x-t.x,e.positionPrev.y=e.position.y-t.y,e.velocity.x=t.x,e.velocity.y=t.y,e.speed=r.magnitude(e.velocity)},i.setAngularVelocity=function(e,t){e.anglePrev=e.angle-t,e.angularVelocity=t,e.angularSpeed=Math.abs(e.angularVelocity)},i.translate=function(e,t){i.setPosition(e,r.add(e.position,t))},i.rotate=function(e,t,n){if(n){var o=Math.cos(t),r=Math.sin(t),s=e.position.x-n.x,a=e.position.y-n.y;i.setPosition(e,{x:n.x+(s*o-a*r),y:n.y+(s*r+a*o)}),i.setAngle(e,e.angle+t)}else i.setAngle(e,e.angle+t)},i.scale=function(e,t,n,r){var s=0,a=0;r=r||e.position;for(var d=0;d0&&(s+=u.area,a+=u.inertia),u.position.x=r.x+(u.position.x-r.x)*t,u.position.y=r.y+(u.position.y-r.y)*n,l.update(u.bounds,u.vertices,e.velocity)}e.parts.length>1&&(e.area=s,e.isStatic||(i.setMass(e,e.density*s),i.setInertia(e,a))),e.circleRadius&&(t===n?e.circleRadius*=t:e.circleRadius=null)},i.update=function(e,t,n,i){var s=Math.pow(t*n*e.timeScale,2),a=1-e.frictionAir*n*e.timeScale,d=e.position.x-e.positionPrev.x,u=e.position.y-e.positionPrev.y;e.velocity.x=d*a*i+e.force.x/e.mass*s,e.velocity.y=u*a*i+e.force.y/e.mass*s,e.positionPrev.x=e.position.x,e.positionPrev.y=e.position.y,e.position.x+=e.velocity.x,e.position.y+=e.velocity.y,e.angularVelocity=(e.angle-e.anglePrev)*a*i+e.torque/e.inertia*s,e.anglePrev=e.angle,e.angle+=e.angularVelocity,e.speed=r.magnitude(e.velocity),e.angularSpeed=Math.abs(e.angularVelocity);for(var p=0;p0&&(f.position.x+=e.velocity.x,f.position.y+=e.velocity.y),0!==e.angularVelocity&&(o.rotate(f.vertices,e.angularVelocity,e.position),c.rotate(f.axes,e.angularVelocity),p>0&&r.rotateAbout(f.position,e.angularVelocity,e.position,f.position)),l.update(f.bounds,f.vertices,e.velocity)}},i.applyForce=function(e,t,n){e.force.x+=n.x,e.force.y+=n.y;var i=t.x-e.position.x,o=t.y-e.position.y;e.torque+=i*n.y-o*n.x},i._totalProperties=function(e){for(var t={mass:0,area:0,inertia:0,centre:{x:0,y:0}},n=1===e.parts.length?0:1;n0&&r.motion=r.sleepThreshold&&i.set(r,!0)):r.sleepCounter>0&&(r.sleepCounter-=1)}else i.set(r,!1)}},i.afterCollisions=function(e,t){for(var n=t*t*t,o=0;oi._motionWakeThreshold*n&&i.set(c,!1)}}}},i.set=function(e,t){var n=e.isSleeping;t?(e.isSleeping=!0,e.sleepCounter=e.sleepThreshold,e.positionImpulse.x=0,e.positionImpulse.y=0,e.positionPrev.x=e.position.x,e.positionPrev.y=e.position.y,e.anglePrev=e.angle,e.speed=0,e.angularSpeed=0,e.motion=0,n||o.trigger(e,"sleepStart")):(e.isSleeping=!1,e.sleepCounter=0,n&&o.trigger(e,"sleepEnd"))}},function(e,t,n){var i={};e.exports=i;var o=n(3),r=n(2),s=n(7),a=n(1),l=n(15),c=n(0);i._warming=.4,i._torqueDampen=1,i._minLength=1e-6,i.create=function(e){var t=e;t.bodyA&&!t.pointA&&(t.pointA={x:0,y:0}),t.bodyB&&!t.pointB&&(t.pointB={x:0,y:0});var n=t.bodyA?r.add(t.bodyA.position,t.pointA):t.pointA,i=t.bodyB?r.add(t.bodyB.position,t.pointB):t.pointB,o=r.magnitude(r.sub(n,i));t.length=void 0!==t.length?t.length:o,t.id=t.id||c.nextId(),t.label=t.label||"Constraint",t.type="constraint",t.stiffness=t.stiffness||(t.length>0?1:.7),t.damping=t.damping||0,t.angularStiffness=t.angularStiffness||0,t.angleA=t.bodyA?t.bodyA.angle:t.angleA,t.angleB=t.bodyB?t.bodyB.angle:t.angleB,t.plugin={};var s={visible:!0,lineWidth:2,strokeStyle:"#ffffff",type:"line",anchors:!0};return 0===t.length&&t.stiffness>.1?(s.type="pin",s.anchors=!1):t.stiffness<.9&&(s.type="spring"),t.render=c.extend(s,t.render),t},i.preSolveAll=function(e){for(var t=0;t0&&(u.position.x+=c.x,u.position.y+=c.y),0!==c.angle&&(o.rotate(u.vertices,c.angle,n.position),l.rotate(u.axes,c.angle),d>0&&r.rotateAbout(u.position,c.angle,n.position,u.position)),a.update(u.bounds,u.vertices,n.velocity)}c.angle*=i._warming,c.x*=i._warming,c.y*=i._warming}}},i.pointAWorld=function(e){return{x:(e.bodyA?e.bodyA.position.x:0)+e.pointA.x,y:(e.bodyA?e.bodyA.position.y:0)+e.pointA.y}},i.pointBWorld=function(e){return{x:(e.bodyB?e.bodyB.position.x:0)+e.pointB.x,y:(e.bodyB?e.bodyB.position.y:0)+e.pointB.y}}},function(e,t,n){var i={};e.exports=i;var o=n(18);i.create=function(e,t){var n=e.bodyA,o=e.bodyB,r=e.parentA,s=e.parentB,a={id:i.id(n,o),bodyA:n,bodyB:o,contacts:{},activeContacts:[],separation:0,isActive:!0,confirmedActive:!0,isSensor:n.isSensor||o.isSensor,timeCreated:t,timeUpdated:t,inverseMass:r.inverseMass+s.inverseMass,friction:Math.min(r.friction,s.friction),frictionStatic:Math.max(r.frictionStatic,s.frictionStatic),restitution:Math.max(r.restitution,s.restitution),slop:Math.max(r.slop,s.slop)};return i.update(a,e,t),a},i.update=function(e,t,n){var r=e.contacts,s=t.supports,a=e.activeContacts,l=t.parentA,c=t.parentB;if(e.collision=t,e.inverseMass=l.inverseMass+c.inverseMass,e.friction=Math.min(l.friction,c.friction),e.frictionStatic=Math.max(l.frictionStatic,c.frictionStatic),e.restitution=Math.max(l.restitution,c.restitution),e.slop=Math.max(l.slop,c.slop),a.length=0,t.collided){for(var d=0;dr.max.x&&(r.max.x=c.x),l.yr.max.y&&(r.max.y=c.y))}var u=r.max.x-r.min.x+2*n.x,p=r.max.y-r.min.y+2*n.y,f=e.canvas.height,v=e.canvas.width/f,y=u/p,m=1,g=1;y>v?g=y/v:m=v/y,e.options.hasBounds=!0,e.bounds.min.x=r.min.x,e.bounds.max.x=r.min.x+u*m,e.bounds.min.y=r.min.y,e.bounds.max.y=r.min.y+p*g,i&&(e.bounds.min.x+=.5*u-u*m*.5,e.bounds.max.x+=.5*u-u*m*.5,e.bounds.min.y+=.5*p-p*g*.5,e.bounds.max.y+=.5*p-p*g*.5),e.bounds.min.x-=n.x,e.bounds.max.x-=n.x,e.bounds.min.y-=n.y,e.bounds.max.y-=n.y,e.mouse&&(d.setScale(e.mouse,{x:(e.bounds.max.x-e.bounds.min.x)/e.canvas.width,y:(e.bounds.max.y-e.bounds.min.y)/e.canvas.height}),d.setOffset(e.mouse,e.bounds.min))},i.startViewTransform=function(e){var t=e.bounds.max.x-e.bounds.min.x,n=e.bounds.max.y-e.bounds.min.y,i=t/e.options.width,o=n/e.options.height;e.context.setTransform(e.options.pixelRatio/i,0,0,e.options.pixelRatio/o,0,0),e.context.translate(-e.bounds.min.x,-e.bounds.min.y)},i.endViewTransform=function(e){e.context.setTransform(e.options.pixelRatio,0,0,e.options.pixelRatio,0,0)},i.world=function(e){var t,n=e.engine,o=n.world,u=e.canvas,p=e.context,v=e.options,y=r.allBodies(o),m=r.allConstraints(o),g=v.wireframes?v.wireframeBackground:v.background,h=[],x=[],b={timestamp:n.timing.timestamp};if(a.trigger(e,"beforeRender",b),e.currentBackground!==g&&f(e,g),p.globalCompositeOperation="source-in",p.fillStyle="transparent",p.fillRect(0,0,u.width,u.height),p.globalCompositeOperation="source-over",v.hasBounds){for(t=0;t=500){var u="";s.timing&&(u+="fps: "+Math.round(s.timing.fps)+d),s.extended&&(s.timing&&(u+="delta: "+s.timing.delta.toFixed(3)+d,u+="correction: "+s.timing.correction.toFixed(3)+d),u+="bodies: "+c.length+d,i.broadphase.controller===l&&(u+="buckets: "+s.buckets+d),u+="\n",u+="collisions: "+s.collisions+d,u+="pairs: "+i.pairs.list.length+d,u+="broad: "+s.broadEff+d,u+="mid: "+s.midEff+d,u+="narrow: "+s.narrowEff+d),e.debugString=u,e.debugTimestamp=i.timing.timestamp}if(e.debugString){n.font="12px Arial",a.wireframes?n.fillStyle="rgba(255,255,255,0.5)":n.fillStyle="rgba(0,0,0,0.5)";for(var p=e.debugString.split("\n"),f=0;f1?1:0;a1?1:0;a1?1:0;r1?1:0;a1?1:0;s1?1:0;s1?1:0;o0)){var d=i.activeContacts[0].vertex.x,u=i.activeContacts[0].vertex.y;2===i.activeContacts.length&&(d=(i.activeContacts[0].vertex.x+i.activeContacts[1].vertex.x)/2,u=(i.activeContacts[0].vertex.y+i.activeContacts[1].vertex.y)/2),o.bodyB===o.supports[0].body||!0===o.bodyA.isStatic?a.moveTo(d-8*o.normal.x,u-8*o.normal.y):a.moveTo(d+8*o.normal.x,u+8*o.normal.y),a.lineTo(d,u)}l.wireframes?a.strokeStyle="rgba(255,165,0,0.7)":a.strokeStyle="orange",a.lineWidth=1,a.stroke()},i.separations=function(e,t,n){var i,o,r,s,a,l=n,c=e.options;for(l.beginPath(),a=0;ad.bounds.max.x||v.bounds.max.yd.bounds.max.y)){var y=i._getRegion(e,v);if(!v.region||y.id!==v.region.id||o){f.broadphaseTests+=1,v.region&&!o||(v.region=y);var m=i._regionUnion(y,v.region);for(s=m.startCol;s<=m.endCol;s++)for(a=m.startRow;a<=m.endRow;a++){l=u[c=i._getBucketId(s,a)];var g=s>=y.startCol&&s<=y.endCol&&a>=y.startRow&&a<=y.endRow,h=s>=v.region.startCol&&s<=v.region.endCol&&a>=v.region.startRow&&a<=v.region.endRow;!g&&h&&h&&l&&i._bucketRemoveBody(e,l,v),(v.region===y||g&&!h||o)&&(l||(l=i._createBucket(u,c)),i._bucketAddBody(e,l,v))}v.region=y,p=!0}}}p&&(e.pairsList=i._createActivePairsList(e))},i.clear=function(e){e.buckets={},e.pairs={},e.pairsList=[]},i._regionUnion=function(e,t){var n=Math.min(e.startCol,t.startCol),o=Math.max(e.endCol,t.endCol),r=Math.min(e.startRow,t.startRow),s=Math.max(e.endRow,t.endRow);return i._createRegion(n,o,r,s)},i._getRegion=function(e,t){var n=t.bounds,o=Math.floor(n.min.x/e.bucketWidth),r=Math.floor(n.max.x/e.bucketWidth),s=Math.floor(n.min.y/e.bucketHeight),a=Math.floor(n.max.y/e.bucketHeight);return i._createRegion(o,r,s,a)},i._createRegion=function(e,t,n,i){return{id:e+","+t+","+n+","+i,startCol:e,endCol:t,startRow:n,endRow:i}},i._getBucketId=function(e,t){return"C"+e+"R"+t},i._createBucket=function(e,t){return e[t]=[]},i._bucketAddBody=function(e,t,n){for(var i=0;i0?i.push(n):delete e.pairs[t[o]];return i}},function(e,t,n){var i={};e.exports=i;var o=n(13),r=n(9),s=n(1);i.collisions=function(e,t){for(var n=[],a=t.pairs.table,l=t.metrics,c=0;c1?1:0;p1?1:0;v0:0!=(e.mask&t.category)&&0!=(t.mask&e.category)}},function(e,t,n){var i={};e.exports=i;var o=n(3),r=n(2);i.collides=function(e,t,n){var s,a,l,c,d=!1;if(n){var u=e.parent,p=t.parent,f=u.speed*u.speed+u.angularSpeed*u.angularSpeed+p.speed*p.speed+p.angularSpeed*p.angularSpeed;d=n&&n.collided&&f<.2,c=n}else c={collided:!1,bodyA:e,bodyB:t};if(n&&d){var v=c.axisBody,y=v===e?t:e,m=[v.axes[n.axisNumber]];if(l=i._overlapAxes(v.vertices,y.vertices,m),c.reused=!0,l.overlap<=0)return c.collided=!1,c}else{if((s=i._overlapAxes(e.vertices,t.vertices,e.axes)).overlap<=0)return c.collided=!1,c;if((a=i._overlapAxes(t.vertices,e.vertices,t.axes)).overlap<=0)return c.collided=!1,c;s.overlapo?o=a:a=0?s.index-1:d.length-1],c.x=o.x-u.x,c.y=o.y-u.y,l=-r.dot(n,c),a=o,o=d[(s.index+1)%d.length],c.x=o.x-u.x,c.y=o.y-u.y,(i=-r.dot(n,c))0&&r.area(M)1?(y=a.create(s.extend({parts:m.slice(0)},d)),a.setPosition(y,{x:e,y:t}),y):m[0]}},function(e,t,n){var i={};e.exports=i;var o=n(0);i._registry={},i.register=function(e){if(i.isPlugin(e)||o.warn("Plugin.register:",i.toString(e),"does not implement all required fields."),e.name in i._registry){var t=i._registry[e.name],n=i.versionParse(e.version).number,r=i.versionParse(t.version).number;n>r?(o.warn("Plugin.register:",i.toString(t),"was upgraded to",i.toString(e)),i._registry[e.name]=e):n-1},i.isFor=function(e,t){var n=e.for&&i.dependencyParse(e.for);return!e.for||t.name===n.name&&i.versionSatisfies(t.version,n.range)},i.use=function(e,t){if(e.uses=(e.uses||[]).concat(t||[]),0!==e.uses.length){for(var n=i.dependencies(e),r=o.topologicalSort(n),s=[],a=0;a0&&o.info(s.join(" "))}else o.warn("Plugin.use:",i.toString(e),"does not specify any dependencies to install.")},i.dependencies=function(e,t){var n=i.dependencyParse(e),r=n.name;if(!(r in(t=t||{}))){e=i.resolve(e)||e,t[r]=o.map(e.uses||[],(function(t){i.isPlugin(t)&&i.register(t);var r=i.dependencyParse(t),s=i.resolve(t);return s&&!i.versionSatisfies(s.version,r.range)?(o.warn("Plugin.dependencies:",i.toString(s),"does not satisfy",i.toString(r),"used by",i.toString(n)+"."),s._warned=!0,e._warned=!0):s||(o.warn("Plugin.dependencies:",i.toString(t),"used by",i.toString(n),"could not be resolved."),e._warned=!0),r.name}));for(var s=0;s=o[2];if("^"===n.operator)return o[0]>0?s[0]===o[0]&&r.number>=n.number:o[1]>0?s[1]===o[1]&&s[2]>=o[2]:s[2]===o[2]}return e===t||"*"===e}},function(e,t){var n={};e.exports=n,n.create=function(e){return{id:n.id(e),vertex:e,normalImpulse:0,tangentImpulse:0}},n.id=function(e){return e.body.id+"_"+e.index}},function(e,t,n){var i={};e.exports=i;var o=n(5);n(8);var r=n(0);i.create=function(e){var t=o.create(),n={label:"World",gravity:{x:0,y:1,scale:.001},bounds:{min:{x:-1/0,y:-1/0},max:{x:1/0,y:1/0}}};return r.extend(t,n,e)}},function(e,t,n){var i={};e.exports=i;var o=n(9),r=n(0);i._pairMaxIdleLife=1e3,i.create=function(e){return r.extend({table:{},list:[],collisionStart:[],collisionActive:[],collisionEnd:[]},e)},i.update=function(e,t,n){var i,r,s,a,l=e.list,c=e.table,d=e.collisionStart,u=e.collisionEnd,p=e.collisionActive;for(d.length=0,u.length=0,p.length=0,a=0;ai._pairMaxIdleLife&&c.push(s);for(s=0;sf.friction*f.frictionStatic*O*n&&(F=T,V=s.clamp(f.friction*R*n,-F,F));var L=r.cross(P,g),j=r.cross(C,g),W=b/(y.inverseMass+m.inverseMass+y.inverseInertia*L*L+m.inverseInertia*j*j);if(E*=W,V*=W,I<0&&I*I>i._restingThresh*n)S.normalImpulse=0;else{var q=S.normalImpulse;S.normalImpulse=Math.min(S.normalImpulse+E,0),E=S.normalImpulse-q}if(_*_>i._restingThreshTangent*n)S.tangentImpulse=0;else{var D=S.tangentImpulse;S.tangentImpulse=s.clamp(S.tangentImpulse+V,-F,F),V=S.tangentImpulse-D}o.x=g.x*E+h.x*V,o.y=g.y*E+h.y*V,y.isStatic||y.isSleeping||(y.positionPrev.x+=o.x*y.inverseMass,y.positionPrev.y+=o.y*y.inverseMass,y.anglePrev+=r.cross(P,o)*y.inverseInertia),m.isStatic||m.isSleeping||(m.positionPrev.x-=o.x*m.inverseMass,m.positionPrev.y-=o.y*m.inverseMass,m.anglePrev-=r.cross(C,o)*m.inverseInertia)}}}}},function(e,t,n){var i={};e.exports=i;var o=n(19),r=n(7),s=n(21),a=n(10),l=n(20),c=n(23),d=n(11),u=n(4),p=n(5),f=n(8),v=n(0),y=n(6);i.create=function(e,t){t=(t=v.isElement(e)?t:e)||{},((e=v.isElement(e)?e:null)||t.render)&&v.warn("Engine.create: engine.render is deprecated (see docs)");var n={positionIterations:6,velocityIterations:4,constraintIterations:2,enableSleeping:!1,events:[],plugin:{},timing:{timestamp:0,timeScale:1},broadphase:{controller:d}},i=v.extend(n,t);if(e||i.render){var r={element:e,controller:a};i.render=v.extend(r,i.render)}return i.render&&i.render.controller&&(i.render=i.render.controller.create(i.render)),i.render&&(i.render.engine=i),i.world=t.world||o.create(i.world),i.pairs=l.create(),i.broadphase=i.broadphase.controller.create(i.broadphase),i.metrics=i.metrics||{extended:!1},i.metrics=c.create(i.metrics),i},i.update=function(e,t,n){t=t||1e3/60,n=n||1;var o,a=e.world,d=e.timing,v=e.broadphase,y=[];d.timestamp+=t*d.timeScale;var m={timestamp:d.timestamp};u.trigger(e,"beforeUpdate",m);var g=p.allBodies(a),h=p.allConstraints(a);for(c.reset(e.metrics),e.enableSleeping&&r.update(g,d.timeScale),i._bodiesApplyGravity(g,a.gravity),i._bodiesUpdate(g,t,d.timeScale,n,a.bounds),f.preSolveAll(g),o=0;o0&&u.trigger(e,"collisionStart",{pairs:b.collisionStart}),s.preSolvePosition(b.list),o=0;o0&&u.trigger(e,"collisionActive",{pairs:b.collisionActive}),b.collisionEnd.length>0&&u.trigger(e,"collisionEnd",{pairs:b.collisionEnd}),c.update(e.metrics,e),i._bodiesClearForces(g),u.trigger(e,"afterUpdate",m),e},i.merge=function(e,t){if(v.extend(e,t),t.world){e.world=t.world,i.clear(e);for(var n=p.allBodies(e.world),o=0;o1?1:0;de.deltaMax?e.deltaMax:i)/e.delta,e.delta=i),0!==e.timeScalePrev&&(r*=o.timeScale/e.timeScalePrev),0===o.timeScale&&(r=0),e.timeScalePrev=o.timeScale,e.correction=r,e.frameCounter+=1,n-e.counterTimestamp>=1e3&&(e.fps=e.frameCounter*((n-e.counterTimestamp)/1e3),e.counterTimestamp=n,e.frameCounter=0),a.trigger(e,"tick",s),a.trigger(t,"tick",s),t.world.isModified&&t.render&&t.render.controller&&t.render.controller.clear&&t.render.controller.clear(t.render),a.trigger(e,"beforeUpdate",s),l.update(t,i,r),a.trigger(e,"afterUpdate",s),t.render&&t.render.controller&&(a.trigger(e,"beforeRender",s),a.trigger(t,"beforeRender",s),t.render.controller.world(t.render),a.trigger(e,"afterRender",s),a.trigger(t,"afterRender",s)),a.trigger(e,"afterTick",s),a.trigger(t,"afterTick",s)},i.stop=function(e){r(e.frameRequestId)},i.start=function(e,t){i.run(e,t)}},function(e,t,n){var i={};e.exports=i;var o=n(5),r=n(8),s=n(0),a=n(6),l=n(16);i.stack=function(e,t,n,i,r,s,l){for(var c,d=o.create({label:"Stack"}),u=e,p=t,f=0,v=0;vy&&(y=h),a.translate(g,{x:.5*x,y:.5*h}),u=g.bounds.max.x+r,o.addBody(d,g),c=g,f+=1}else u+=r}p+=y+s,u=e}return d},i.chain=function(e,t,n,i,a,l){for(var c=e.bodies,d=1;d0)for(c=0;c0&&(p=f[c-1+(l-1)*t],o.addConstraint(e,r.create(s.extend({bodyA:p,bodyB:u},a)))),i&&cp||s<(c=p-c)||s>n-1-c))return 1===u&&a.translate(d,{x:(s+(n%2==1?1:-1))*f,y:0}),l(e+(d?s*f:0)+s*r,i,s,c,d,u)}))},i.newtonsCradle=function(e,t,n,i,s){for(var a=o.create({label:"Newtons Cradle"}),c=0;c1;if(!p||e!=p.x||t!=p.y){p&&i?(f=p.x,v=p.y):(f=0,v=0);var o={x:f+e,y:v+t};!i&&p||(p=o),y.push(o),g=f+e,h=v+t}},b=function(e){var t=e.pathSegTypeAsLetter.toUpperCase();if("Z"!==t){switch(t){case"M":case"L":case"T":case"C":case"S":case"Q":g=e.x,h=e.y;break;case"H":g=e.x;break;case"V":h=e.y}x(g,h,e.pathSegType)}};for(i._svgPathToAbsolute(e),s=e.getTotalLength(),c=[],n=0;n1?1:0;p=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}(n),o=i.next();!o.done;o=i.next()){var r=o.value;r&&"Physics"===r.componentName&&this.componentChanged(r)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}this.engine.update()},n.prototype.componentChanged=function(e){switch(e.type){case t.OBSERVER_TYPE.ADD:this.engine.add(e.component);break;case t.OBSERVER_TYPE.CHANGE:case t.OBSERVER_TYPE.REMOVE:}},n.prototype.lateUpdate=function(){},n.prototype.onResume=function(){this.engine.enabled||this.engine.awake()},n.prototype.onPause=function(){this.engine.stop()},n.prototype.onDestroy=function(){},n.systemName="PhysicsSystem",n=function(e,t,n,i){var o,r=arguments.length,s=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(s=(r<3?o(s):r>3?o(t,n,s):o(t,n))||s);return r>3&&s&&Object.defineProperty(t,n,s),s}([t.decorators.componentObserver({Physics:[{prop:["bodyParams"],deep:!0}]})],n)}(t.System);e.Physics=l,e.PhysicsSystem=u,Object.defineProperty(e,"__esModule",{value:!0})})); diff --git a/dist/cdn/min/EVA.plugin.renderer.dragonbone.min.js b/dist/cdn/min/EVA.plugin.renderer.dragonbone.min.js deleted file mode 100644 index b989a27c..00000000 --- a/dist/cdn/min/EVA.plugin.renderer.dragonbone.min.js +++ /dev/null @@ -1 +0,0 @@ -var t,e;t=this,e=function(t,e,a,i){"use strict";function r(t,e,a,i){var r,n=arguments.length,s=n<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,a,i);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(s=(n<3?r(s):n>3?r(e,a,s):r(e,a))||s);return n>3&&s&&Object.defineProperty(e,a,s),s}function n(t,e,a,i){return new(a||(a=Promise))((function(r,n){function s(t){try{l(i.next(t))}catch(t){n(t)}}function o(t){try{l(i.throw(t))}catch(t){n(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof a?e:new a((function(t){t(e)}))).then(s,o)}l((i=i.apply(t,e||[])).next())}))}class s extends e.Component{constructor(){super(...arguments),this.waitPlay=!1,this.waitStop=!1,this.waitPlayInfo={animationName:null},this.resource="",this.armatureName="",this.animationName="",this.autoPlay=!0}init(t){if(t){if(!t.armatureName)throw new Error(`The dragonBone component on ${this.gameObject.name}, armatureName is required!`);Object.assign(this,t),this.autoPlay&&this.play(this.animationName)}}play(t,e){t&&(this.animationName=t),this.armature?this.armature.play(this.animationName,e):(this.waitPlayInfo={animationName:t,times:e},this.waitPlay=!0)}stop(t){this.armature?this.armature.stop(t):(this.waitPlayInfo={animationName:t},this.waitStop=!0),this.animationName=null}set armature(t){if(this._armature=t,!t)return;const{animationName:e,times:a}=this.waitPlayInfo;this.waitPlay&&this.play(e,a),this.waitStop&&this.stop(e),this.waitPlay=!1,this.waitStop=!1}get armature(){return this._armature}onDestroy(){this.removeAllListeners()}}s.componentName="DragonBone",r([e.decorators.IDEProp],s.prototype,"resource",void 0),r([e.decorators.IDEProp],s.prototype,"armatureName",void 0),r([e.decorators.IDEProp],s.prototype,"animationName",void 0),r([e.decorators.IDEProp],s.prototype,"autoPlay",void 0);const o={Texture:a.Texture,Rectangle:a.Rectangle,Sprite:a.Sprite,Graphics:a.Graphics,BLEND_MODES:a.BLEND_MODES,mesh:a.mesh,ticker:a.ticker};var l,h,u,_,f=(h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var a in e)e.hasOwnProperty(a)&&(t[a]=e[a])},function(t,e){function a(){this.constructor=t}h(t,e),t.prototype=null===e?Object.create(e):(a.prototype=e.prototype,new a)});!function(t){var e=function(){function e(a){this._clock=new t.WorldClock,this._events=[],this._objects=[],this._eventManager=null,this._eventManager=a,console.info("DragonBones: "+e.VERSION+"\nWebsite: http://dragonbones.com/\nSource and Demo: https://github.com/DragonBones/")}return e.prototype.advanceTime=function(e){if(this._objects.length>0){for(var a=0,i=this._objects;a0){for(var r=0;ra&&(r.length=a),t._maxCountMap[i]=a;else for(var i in t._defaultMaxCount=a,t._poolsMap){var r;(r=t._poolsMap[i]).length>a&&(r.length=a),i in t._maxCountMap&&(t._maxCountMap[i]=a)}},t.clearPool=function(e){if(void 0===e&&(e=null),null!==e){var a=String(e);null!==(r=a in t._poolsMap?t._poolsMap[a]:null)&&r.length>0&&(r.length=0)}else for(var i in t._poolsMap){var r;(r=t._poolsMap[i]).length=0}},t.borrowObject=function(e){var a=String(e),i=a in t._poolsMap?t._poolsMap[a]:null;if(null!==i&&i.length>0){var r=i.pop();return r._isInPool=!1,r}var n=new e;return n._onClear(),n},t.prototype.returnToPool=function(){this._onClear(),t._returnObject(this)},t._hashCode=0,t._defaultMaxCount=3e3,t._maxCountMap={},t._poolsMap={},t}();t.BaseObject=e}(l||(l={})),function(t){var e=function(){function t(t,e,a,i,r,n){void 0===t&&(t=1),void 0===e&&(e=0),void 0===a&&(a=0),void 0===i&&(i=1),void 0===r&&(r=0),void 0===n&&(n=0),this.a=t,this.b=e,this.c=a,this.d=i,this.tx=r,this.ty=n}return t.prototype.toString=function(){return"[object dragonBones.Matrix] a:"+this.a+" b:"+this.b+" c:"+this.c+" d:"+this.d+" tx:"+this.tx+" ty:"+this.ty},t.prototype.copyFrom=function(t){return this.a=t.a,this.b=t.b,this.c=t.c,this.d=t.d,this.tx=t.tx,this.ty=t.ty,this},t.prototype.copyFromArray=function(t,e){return void 0===e&&(e=0),this.a=t[e],this.b=t[e+1],this.c=t[e+2],this.d=t[e+3],this.tx=t[e+4],this.ty=t[e+5],this},t.prototype.identity=function(){return this.a=this.d=1,this.b=this.c=0,this.tx=this.ty=0,this},t.prototype.concat=function(t){var e=this.a*t.a,a=0,i=0,r=this.d*t.d,n=this.tx*t.a+t.tx,s=this.ty*t.d+t.ty;return 0===this.b&&0===this.c||(e+=this.b*t.c,a+=this.b*t.d,i+=this.c*t.a,r+=this.c*t.b),0===t.b&&0===t.c||(a+=this.a*t.b,i+=this.d*t.c,n+=this.ty*t.c,s+=this.tx*t.b),this.a=e,this.b=a,this.c=i,this.d=r,this.tx=n,this.ty=s,this},t.prototype.invert=function(){var t=this.a,e=this.b,a=this.c,i=this.d,r=this.tx,n=this.ty;if(0===e&&0===a)return this.b=this.c=0,0===t||0===i?this.a=this.b=this.tx=this.ty=0:(t=this.a=1/t,i=this.d=1/i,this.tx=-t*r,this.ty=-i*n),this;var s=t*i-e*a;if(0===s)return this.a=this.d=1,this.b=this.c=0,this.tx=this.ty=0,this;s=1/s;var o=this.a=i*s;return e=this.b=-e*s,a=this.c=-a*s,i=this.d=t*s,this.tx=-(o*r+a*n),this.ty=-(e*r+i*n),this},t.prototype.transformPoint=function(t,e,a,i){void 0===i&&(i=!1),a.x=this.a*t+this.c*e,a.y=this.b*t+this.d*e,i||(a.x+=this.tx,a.y+=this.ty)},t.prototype.transformRectangle=function(t,e){void 0===e&&(e=!1);var a=this.a,i=this.b,r=this.c,n=this.d,s=e?0:this.tx,o=e?0:this.ty,l=t.x,h=t.y,u=l+t.width,_=h+t.height,f=a*l+r*h+s,m=i*l+n*h+o,p=a*u+r*h+s,c=i*u+n*h+o,d=a*u+r*_+s,y=i*u+n*_+o,g=a*l+r*_+s,D=i*l+n*_+o,v=0;f>p&&(v=f,f=p,p=v),d>g&&(v=d,d=g,g=v),t.x=Math.floor(fg?p:g)-t.x),m>c&&(v=m,m=c,c=v),y>D&&(v=y,y=D,D=v),t.y=Math.floor(mD?c:D)-t.y)},t}();t.Matrix=e}(l||(l={})),function(t){var e=function(){function t(t,e,a,i,r,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===a&&(a=0),void 0===i&&(i=0),void 0===r&&(r=1),void 0===n&&(n=1),this.x=t,this.y=e,this.skew=a,this.rotation=i,this.scaleX=r,this.scaleY=n}return t.normalizeRadian=function(t){return t=(t+Math.PI)%(2*Math.PI),t+=t>0?-Math.PI:Math.PI},t.prototype.toString=function(){return"[object dragonBones.Transform] x:"+this.x+" y:"+this.y+" skewX:"+180*this.skew/Math.PI+" skewY:"+180*this.rotation/Math.PI+" scaleX:"+this.scaleX+" scaleY:"+this.scaleY},t.prototype.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.skew=t.skew,this.rotation=t.rotation,this.scaleX=t.scaleX,this.scaleY=t.scaleY,this},t.prototype.identity=function(){return this.x=this.y=0,this.skew=this.rotation=0,this.scaleX=this.scaleY=1,this},t.prototype.add=function(t){return this.x+=t.x,this.y+=t.y,this.skew+=t.skew,this.rotation+=t.rotation,this.scaleX*=t.scaleX,this.scaleY*=t.scaleY,this},t.prototype.minus=function(t){return this.x-=t.x,this.y-=t.y,this.skew-=t.skew,this.rotation-=t.rotation,this.scaleX/=t.scaleX,this.scaleY/=t.scaleY,this},t.prototype.fromMatrix=function(e){var a=this.scaleX,i=this.scaleY,r=t.PI_Q;this.x=e.tx,this.y=e.ty,this.rotation=Math.atan(e.b/e.a);var n=Math.atan(-e.c/e.d);return this.scaleX=this.rotation>-r&&this.rotation-r&&n=0&&this.scaleX<0&&(this.scaleX=-this.scaleX,this.rotation=this.rotation-Math.PI),i>=0&&this.scaleY<0&&(this.scaleY=-this.scaleY,n-=Math.PI),this.skew=n-this.rotation,this},t.prototype.toMatrix=function(t){return 0===this.rotation?(t.a=1,t.b=0):(t.a=Math.cos(this.rotation),t.b=Math.sin(this.rotation)),0===this.skew?(t.c=-t.b,t.d=t.a):(t.c=-Math.sin(this.skew+this.rotation),t.d=Math.cos(this.skew+this.rotation)),1!==this.scaleX&&(t.a*=this.scaleX,t.b*=this.scaleX),1!==this.scaleY&&(t.c*=this.scaleY,t.d*=this.scaleY),t.tx=this.x,t.ty=this.y,this},t.PI=Math.PI,t.PI_D=2*Math.PI,t.PI_H=Math.PI/2,t.PI_Q=Math.PI/4,t.RAD_DEG=180/Math.PI,t.DEG_RAD=Math.PI/180,t}();t.Transform=e}(l||(l={})),function(t){var e=function(){function t(t,e,a,i,r,n,s,o){void 0===t&&(t=1),void 0===e&&(e=1),void 0===a&&(a=1),void 0===i&&(i=1),void 0===r&&(r=0),void 0===n&&(n=0),void 0===s&&(s=0),void 0===o&&(o=0),this.alphaMultiplier=t,this.redMultiplier=e,this.greenMultiplier=a,this.blueMultiplier=i,this.alphaOffset=r,this.redOffset=n,this.greenOffset=s,this.blueOffset=o}return t.prototype.copyFrom=function(t){this.alphaMultiplier=t.alphaMultiplier,this.redMultiplier=t.redMultiplier,this.greenMultiplier=t.greenMultiplier,this.blueMultiplier=t.blueMultiplier,this.alphaOffset=t.alphaOffset,this.redOffset=t.redOffset,this.greenOffset=t.greenOffset,this.blueOffset=t.blueOffset},t.prototype.identity=function(){this.alphaMultiplier=this.redMultiplier=this.greenMultiplier=this.blueMultiplier=1,this.alphaOffset=this.redOffset=this.greenOffset=this.blueOffset=0},t}();t.ColorTransform=e}(l||(l={})),function(t){var e=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.x=t,this.y=e}return t.prototype.copyFrom=function(t){this.x=t.x,this.y=t.y},t.prototype.clear=function(){this.x=this.y=0},t}();t.Point=e}(l||(l={})),function(t){var e=function(){function t(t,e,a,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===a&&(a=0),void 0===i&&(i=0),this.x=t,this.y=e,this.width=a,this.height=i}return t.prototype.copyFrom=function(t){this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height},t.prototype.clear=function(){this.x=this.y=0,this.width=this.height=0},t}();t.Rectangle=e}(l||(l={})),function(t){var e=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.ints=[],e.floats=[],e.strings=[],e}return f(e,t),e.toString=function(){return"[class dragonBones.UserData]"},e.prototype._onClear=function(){this.ints.length=0,this.floats.length=0,this.strings.length=0},e.prototype.addInt=function(t){this.ints.push(t)},e.prototype.addFloat=function(t){this.floats.push(t)},e.prototype.addString=function(t){this.strings.push(t)},e.prototype.getInt=function(t){return void 0===t&&(t=0),t>=0&&t=0&&t=0&&t=t&&(a=0),!(this.sortedBones.indexOf(r)>=0)){var n=!1;for(var s in this.constraints){var o=this.constraints[s];if(o.root===r&&this.sortedBones.indexOf(o.target)<0){n=!0;break}}n||null!==r.parent&&this.sortedBones.indexOf(r.parent)<0||(this.sortedBones.push(r),i++)}}}},a.prototype.cacheFrames=function(t){if(!(this.cacheFrameRate>0))for(var e in this.cacheFrameRate=t,this.animations)this.animations[e].cacheFrames(this.cacheFrameRate)},a.prototype.setCacheFrame=function(t,e){var a=this.parent.cachedFrames,i=a.length;return a.length+=10,a[i]=t.a,a[i+1]=t.b,a[i+2]=t.c,a[i+3]=t.d,a[i+4]=t.tx,a[i+5]=t.ty,a[i+6]=e.rotation,a[i+7]=e.skew,a[i+8]=e.scaleX,a[i+9]=e.scaleY,i},a.prototype.getCacheFrame=function(t,e,a){var i=this.parent.cachedFrames;t.a=i[a],t.b=i[a+1],t.c=i[a+2],t.d=i[a+3],t.tx=i[a+4],t.ty=i[a+5],e.rotation=i[a+6],e.skew=i[a+7],e.scaleX=i[a+8],e.scaleY=i[a+9],e.x=t.tx,e.y=t.ty},a.prototype.addBone=function(t){t.name in this.bones?console.warn("Same bone: "+t.name):(this.bones[t.name]=t,this.sortedBones.push(t))},a.prototype.addSlot=function(t){t.name in this.slots?console.warn("Same slot: "+t.name):(this.slots[t.name]=t,this.sortedSlots.push(t))},a.prototype.addConstraint=function(t){t.name in this.constraints?console.warn("Same constraint: "+t.name):this.constraints[t.name]=t},a.prototype.addSkin=function(t){t.name in this.skins?console.warn("Same skin: "+t.name):(t.parent=this,this.skins[t.name]=t,null===this.defaultSkin&&(this.defaultSkin=t),"default"===t.name&&(this.defaultSkin=t))},a.prototype.addAnimation=function(t){t.name in this.animations?console.warn("Same animation: "+t.name):(t.parent=this,this.animations[t.name]=t,this.animationNames.push(t.name),null===this.defaultAnimation&&(this.defaultAnimation=t))},a.prototype.addAction=function(t,e){e?this.defaultActions.push(t):this.actions.push(t)},a.prototype.getBone=function(t){return t in this.bones?this.bones[t]:null},a.prototype.getSlot=function(t){return t in this.slots?this.slots[t]:null},a.prototype.getConstraint=function(t){return t in this.constraints?this.constraints[t]:null},a.prototype.getSkin=function(t){return t in this.skins?this.skins[t]:null},a.prototype.getMesh=function(t,e,a){var i=this.getSkin(t);return null===i?null:i.getDisplay(e,a)},a.prototype.getAnimation=function(t){return t in this.animations?this.animations[t]:null},a}(t.BaseObject);t.ArmatureData=e;var a=function(e){function a(){var a=null!==e&&e.apply(this,arguments)||this;return a.transform=new t.Transform,a.userData=null,a}return f(a,e),a.toString=function(){return"[class dragonBones.BoneData]"},a.prototype._onClear=function(){null!==this.userData&&this.userData.returnToPool(),this.inheritTranslation=!1,this.inheritRotation=!1,this.inheritScale=!1,this.inheritReflection=!1,this.type=0,this.length=0,this.alpha=1,this.name="",this.transform.identity(),this.userData=null,this.parent=null},a}(t.BaseObject);t.BoneData=a;var i=function(e){function a(){var a=null!==e&&e.apply(this,arguments)||this;return a.geometry=new t.GeometryData,a}return f(a,e),a.toString=function(){return"[class dragonBones.SurfaceData]"},a.prototype._onClear=function(){e.prototype._onClear.call(this),this.type=1,this.segmentX=0,this.segmentY=0,this.geometry.clear()},a}(a);t.SurfaceData=i;var r=function(e){function a(){var t=null!==e&&e.apply(this,arguments)||this;return t.color=null,t.userData=null,t}return f(a,e),a.createColor=function(){return new t.ColorTransform},a.toString=function(){return"[class dragonBones.SlotData]"},a.prototype._onClear=function(){null!==this.userData&&this.userData.returnToPool(),this.blendMode=0,this.displayIndex=0,this.zOrder=0,this.zIndex=0,this.alpha=1,this.name="",this.color=null,this.userData=null,this.parent=null},a.DEFAULT_COLOR=new t.ColorTransform,a}(t.BaseObject);t.SlotData=r}(l||(l={})),function(t){var e=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return f(e,t),e.prototype._onClear=function(){this.order=0,this.name="",this.type=0,this.target=null,this.root=null,this.bone=null},e}(t.BaseObject);t.ConstraintData=e;var a=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return f(e,t),e.toString=function(){return"[class dragonBones.IKConstraintData]"},e.prototype._onClear=function(){t.prototype._onClear.call(this),this.scaleEnabled=!1,this.bendPositive=!1,this.weight=1},e}(e);t.IKConstraintData=a;var i=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.bones=[],e}return f(e,t),e.toString=function(){return"[class dragonBones.PathConstraintData]"},e.prototype._onClear=function(){t.prototype._onClear.call(this),this.pathSlot=null,this.pathDisplayData=null,this.bones.length=0,this.positionMode=0,this.spacingMode=1,this.rotateMode=1,this.position=0,this.spacing=0,this.rotateOffset=0,this.rotateMix=0,this.translateMix=0},e.prototype.AddBone=function(t){this.bones.push(t)},e}(e);t.PathConstraintData=i}(l||(l={})),function(t){var e=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return f(e,t),e.toString=function(){return"[class dragonBones.CanvasData]"},e.prototype._onClear=function(){this.hasBackground=!1,this.color=0,this.x=0,this.y=0,this.width=0,this.height=0},e}(t.BaseObject);t.CanvasData=e}(l||(l={})),function(t){var e=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.displays={},e}return f(e,t),e.toString=function(){return"[class dragonBones.SkinData]"},e.prototype._onClear=function(){for(var t in this.displays){for(var e=0,a=this.displays[t];er&&(s|=2),en&&(s|=8),s},e.rectangleIntersectsSegment=function(t,a,i,r,n,s,o,l,h,u,_){void 0===h&&(h=null),void 0===u&&(u=null),void 0===_&&(_=null);var f=t>n&&ts&&an&&is&&r=-a&&t<=a){var i=.5*this.height;if(e>=-i&&e<=i)return!0}return!1},e.prototype.intersectsSegment=function(t,a,i,r,n,s,o){void 0===n&&(n=null),void 0===s&&(s=null),void 0===o&&(o=null);var l=.5*this.width,h=.5*this.height;return e.rectangleIntersectsSegment(t,a,i,r,-l,-h,l,h,n,s,o)},e}(e);t.RectangleBoundingBoxData=a;var i=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return f(e,t),e.toString=function(){return"[class dragonBones.EllipseData]"},e.ellipseIntersectsSegment=function(t,e,a,i,r,n,s,o,l,h,u){void 0===l&&(l=null),void 0===h&&(h=null),void 0===u&&(u=null);var _=s/o,f=_*_,m=a-t,p=(i*=_)-(e*=_),c=Math.sqrt(m*m+p*p),d=m/c,y=p/c,g=(r-t)*d+(n-e)*y,D=s*s,v=D-(t*t+e*e)+g*g,T=0;if(v>=0){var b=Math.sqrt(v),A=g-b,P=g+b,S=A<0?-1:A<=c?0:1,O=P<0?-1:P<=c?0:1,x=S*O;if(x<0)return-1;0===x&&(-1===S?(T=2,a=t+P*d,i=(e+P*y)/_,null!==l&&(l.x=a,l.y=i),null!==h&&(h.x=a,h.y=i),null!==u&&(u.x=Math.atan2(i/D*f,a/D),u.y=u.x+Math.PI)):1===O?(T=1,t+=A*d,e=(e+A*y)/_,null!==l&&(l.x=t,l.y=e),null!==h&&(h.x=t,h.y=e),null!==u&&(u.x=Math.atan2(e/D*f,t/D),u.y=u.x+Math.PI)):(T=3,null!==l&&(l.x=t+A*d,l.y=(e+A*y)/_,null!==u&&(u.x=Math.atan2(l.y/D*f,l.x/D))),null!==h&&(h.x=t+P*d,h.y=(e+P*y)/_,null!==u&&(u.y=Math.atan2(h.y/D*f,h.x/D)))))}return T},e.prototype._onClear=function(){t.prototype._onClear.call(this),this.type=1},e.prototype.containsPoint=function(t,e){var a=.5*this.width;if(t>=-a&&t<=a){var i=.5*this.height;if(e>=-i&&e<=i)return e*=a/i,Math.sqrt(t*t+e*e)<=a}return!1},e.prototype.intersectsSegment=function(t,a,i,r,n,s,o){return void 0===n&&(n=null),void 0===s&&(s=null),void 0===o&&(o=null),e.ellipseIntersectsSegment(t,a,i,r,0,0,.5*this.width,.5*this.height,n,s,o)},e}(e);t.EllipseBoundingBoxData=i;var r=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.vertices=[],e}return f(e,t),e.toString=function(){return"[class dragonBones.PolygonBoundingBoxData]"},e.polygonIntersectsSegment=function(t,e,a,i,r,n,s,o){void 0===n&&(n=null),void 0===s&&(s=null),void 0===o&&(o=null),t===a&&(t=a+1e-6),e===i&&(e=i+1e-6);for(var l=r.length,h=t-a,u=e-i,_=t*i-e*a,f=0,m=r[l-2],p=r[l-1],c=0,d=0,y=0,g=0,D=0,v=0,T=0;T=m&&E<=b||E>=b&&E<=m)&&(0===h||E>=t&&E<=a||E>=a&&E<=t)){var M=(_*S-u*O)/x;if((M>=p&&M<=A||M>=A&&M<=p)&&(0===u||M>=e&&M<=i||M>=i&&M<=e)){if(null===s){y=E,g=M,D=E,v=M,f++,null!==o&&(o.x=Math.atan2(A-p,b-m)-.5*Math.PI,o.y=o.x);break}var B=E-t;B<0&&(B=-B),0===f?(c=B,d=B,y=E,g=M,D=E,v=M,null!==o&&(o.x=Math.atan2(A-p,b-m)-.5*Math.PI,o.y=o.x)):(Bd&&(d=B,D=E,v=M,null!==o&&(o.y=Math.atan2(A-p,b-m)-.5*Math.PI))),f++}}m=b,p=A}return 1===f?(null!==n&&(n.x=y,n.y=g),null!==s&&(s.x=y,s.y=g),null!==o&&(o.y=o.x+Math.PI)):f>1&&(f++,null!==n&&(n.x=y,n.y=g),null!==s&&(s.x=D,s.y=v)),f},e.prototype._onClear=function(){t.prototype._onClear.call(this),this.type=2,this.x=0,this.y=0,this.vertices.length=0},e.prototype.containsPoint=function(t,e){var a=!1;if(t>=this.x&&t<=this.width&&e>=this.y&&e<=this.height)for(var i=0,r=this.vertices.length,n=r-2;i=e||s=e){var l=this.vertices[n],h=this.vertices[i];(e-o)*(l-h)/(s-o)+h0)){this.cacheFrameRate=Math.max(Math.ceil(t*this.scale),1);var e=Math.ceil(this.cacheFrameRate*this.duration)+1;this.cachedFrames.length=e;for(var a=0,i=this.cacheFrames.length;a1e3*e._zIndex+e._zOrder?1:-1},e.prototype._onClear=function(){null!==this._clock&&this._clock.remove(this);for(var t=0,e=this._bones;t=n)){var o=a[s],l=this.getSlot(o.name);null!==l&&l._setZOrder(r)}}this._slotsDirty=!0,this._zOrderDirty=!i}},e.prototype._addBone=function(t){this._bones.indexOf(t)<0&&this._bones.push(t)},e.prototype._addSlot=function(t){this._slots.indexOf(t)<0&&this._slots.push(t)},e.prototype._addConstraint=function(t){this._constraints.indexOf(t)<0&&this._constraints.push(t)},e.prototype._bufferAction=function(t,e){this._actions.indexOf(t)<0&&(e?this._actions.push(t):this._actions.unshift(t))},e.prototype.dispose=function(){null!==this._armatureData&&(this._lockUpdate=!0,this._dragonBones.bufferObject(this))},e.prototype.init=function(t,e,a,i){null===this._armatureData&&(this._armatureData=t,this._animation=u.BaseObject.borrowObject(u.Animation),this._proxy=e,this._display=a,this._dragonBones=i,this._proxy.dbInit(this),this._animation.init(this),this._animation.animations=this._armatureData.animations)},e.prototype.advanceTime=function(t){if(!this._lockUpdate)if(this._lockUpdate=!0,null!==this._armatureData)if(null!==this._armatureData.parent){var a=this._cacheFrameIndex;if(this._animation.advanceTime(t),this._slotsDirty||this._zIndexDirty){if(this._slots.sort(e._onSortSlots),this._zIndexDirty)for(var i=0,r=this._slots.length;i0){for(var h=0,u=this._actions;h0){if(null!==(s=this.getBone(t))&&(s.invalidUpdate(),e))for(var a=0,i=this._slots;a0){if(null===r&&null===n){d=v;break}var T;null!==r&&((T=o?r.y-e:r.x-t)<0&&(T=-T),(null===d||Th)&&(h=T,f=n.x,m=n.y,y=v,null!==s&&(c=s.y)))}}return null!==d&&null!==r&&(r.x=u,r.y=_,null!==s&&(s.x=p)),null!==y&&null!==n&&(n.x=f,n.y=m,null!==s&&(s.y=c)),d},e.prototype.getBone=function(t){for(var e=0,a=this._bones;e=0&&null!==this._cachedFrameIndices){var e=this._cachedFrameIndices[t];if(e>=0&&this._cachedFrameIndex===e)this._transformDirty=!1;else if(e>=0)this._transformDirty=!0,this._cachedFrameIndex=e;else{if(this._hasConstraint)for(var a=0,i=this._armature._constraints;a=0?(this._transformDirty=!1,this._cachedFrameIndices[t]=this._cachedFrameIndex):(this._transformDirty=!0,this._cachedFrameIndex=-1)}}else{if(this._hasConstraint)for(var r=0,n=this._armature._constraints;r=0;this._localDirty&&this._updateGlobalTransformMatrix(o),o&&null!==this._cachedFrameIndices&&(this._cachedFrameIndex=this._cachedFrameIndices[t]=this._armature._armatureData.setCacheFrame(this.globalTransformMatrix,this.global))}else this._armature._armatureData.getCacheFrame(this.globalTransformMatrix,this.global,this._cachedFrameIndex);else this._childrenTransformDirty&&(this._childrenTransformDirty=!1);this._localDirty=!0},a.prototype.updateByConstraint=function(){this._localDirty&&(this._localDirty=!1,(this._transformDirty||null!==this._parent&&this._parent._childrenTransformDirty)&&this._updateGlobalTransformMatrix(!0),this._transformDirty=!0)},a.prototype.invalidUpdate=function(){this._transformDirty=!0},a.prototype.contains=function(t){if(t===this)return!1;for(var e=t;e!==this&&null!==e;)e=e.parent;return e===this},Object.defineProperty(a.prototype,"boneData",{get:function(){return this._boneData},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"visible",{get:function(){return this._visible},set:function(t){if(this._visible!==t){this._visible=t;for(var e=0,a=this._armature.getSlots();e=i)return this.globalTransformMatrix;if(y[p=7*(2*(o*l+o+l+l+m)+((n=a>this._kX*(t+i)+d)?1:0))]>0)g.copyFromArray(y,p+1);else{var D=m*(h+2),v=this._hullCache[4],T=this._hullCache[5],b=this._hullCache[2]-(l-m)*v,A=this._hullCache[3]-(l-m)*T,P=this._vertices;n?this._getAffineTransform(-i,d+_,800,_,P[D+h+2],P[D+h+3],b+v,A+T,P[D],P[D+1],e._helpTransform,g,!0):this._getAffineTransform(-r,d,800,_,b,A,P[D],P[D+1],b+v,A+T,e._helpTransform,g,!1),y[p]=1,y[p+1]=g.a,y[p+2]=g.b,y[p+3]=g.c,y[p+4]=g.d,y[p+5]=g.tx,y[p+6]=g.ty}}else if(t>=i){if(a<-i||a>=i)return this.globalTransformMatrix;y[p=7*(2*(o*l+o+m)+((n=a>this._kX*(t-r)+d)?1:0))]>0?g.copyFromArray(y,p+1):(D=(m+1)*(h+2)-2,v=this._hullCache[4],T=this._hullCache[5],b=this._hullCache[0]+m*v,A=this._hullCache[1]+m*T,P=this._vertices,n?this._getAffineTransform(r,d+_,800,_,b+v,A+T,P[D+h+2],P[D+h+3],b,A,e._helpTransform,g,!0):this._getAffineTransform(i,d,800,_,P[D],P[D+1],b,A,P[D+h+2],P[D+h+3],e._helpTransform,g,!1),y[p]=1,y[p+1]=g.a,y[p+2]=g.b,y[p+3]=g.c,y[p+4]=g.d,y[p+5]=g.tx,y[p+6]=g.ty)}else if(a<-i){if(t<-i||t>=i)return this.globalTransformMatrix;y[p=7*(2*(o*l+f)+((n=a>this._kY*(t-c-u)-r)?1:0))]>0?g.copyFromArray(y,p+1):(D=2*f,v=this._hullCache[10],T=this._hullCache[11],b=this._hullCache[8]+f*v,A=this._hullCache[9]+f*T,P=this._vertices,n?this._getAffineTransform(c+u,-i,u,800,P[D+2],P[D+3],P[D],P[D+1],b+v,A+T,e._helpTransform,g,!0):this._getAffineTransform(c,-r,u,800,b,A,b+v,A+T,P[D],P[D+1],e._helpTransform,g,!1),y[p]=1,y[p+1]=g.a,y[p+2]=g.b,y[p+3]=g.c,y[p+4]=g.d,y[p+5]=g.tx,y[p+6]=g.ty)}else if(a>=i){if(t<-i||t>=i)return this.globalTransformMatrix;y[p=7*(2*(o*l+o+l+f)+((n=a>this._kY*(t-c-u)+i)?1:0))]>0?g.copyFromArray(y,p+1):(D=l*(h+2)+2*f,v=this._hullCache[10],T=this._hullCache[11],b=this._hullCache[6]-(o-f)*v,A=this._hullCache[7]-(o-f)*T,P=this._vertices,n?this._getAffineTransform(c+u,r,u,800,b+v,A+T,b,A,P[D+2],P[D+3],e._helpTransform,g,!0):this._getAffineTransform(c,i,u,800,P[D],P[D+1],P[D+2],P[D+3],b,A,e._helpTransform,g,!1),y[p]=1,y[p+1]=g.a,y[p+2]=g.b,y[p+3]=g.c,y[p+4]=g.d,y[p+5]=g.tx,y[p+6]=g.ty)}else y[p=7*(2*(o*m+f)+((n=a>this._k*(t-c-u)+d)?1:0))]>0?g.copyFromArray(y,p+1):(D=2*f+m*(h+2),P=this._vertices,n?this._getAffineTransform(c+u,d+_,u,_,P[D+h+4],P[D+h+5],P[D+h+2],P[D+h+3],P[D+2],P[D+3],e._helpTransform,g,!0):this._getAffineTransform(c,d,u,_,P[D],P[D+1],P[D+2],P[D+3],P[D+h+2],P[D+h+3],e._helpTransform,g,!1),y[p]=1,y[p+1]=g.a,y[p+2]=g.b,y[p+3]=g.c,y[p+4]=g.d,y[p+5]=g.tx,y[p+6]=g.ty);return g},e.prototype.init=function(e,a){if(null===this._boneData){t.prototype.init.call(this,e,a);var i=e.segmentX,r=e.segmentY,n=this._armature.armatureData.parent.intArray[e.geometry.offset+0];this._dX=400/i,this._dY=400/r,this._k=-this._dY/this._dX,this._kX=-this._dY/800,this._kY=-800/this._dX,this._vertices.length=2*n,this._deformVertices.length=2*n,this._matrixCahce.length=2*(i*r+2*i+2*r)*7,this._hullCache.length=10;for(var s=0;s<2*n;++s)this._deformVertices[s]=0;null!==this._parent&&(0===this._parent.boneData.type?this._bone=this._parent:this._bone=this._parent._bone)}},e.prototype.update=function(t){if(t>=0&&null!==this._cachedFrameIndices){var a=this._cachedFrameIndices[t];if(a>=0&&this._cachedFrameIndex===a)this._transformDirty=!1;else if(a>=0)this._transformDirty=!0,this._cachedFrameIndex=a;else{if(this._hasConstraint)for(var i=0,r=this._armature._constraints;i=0?(this._transformDirty=!1,this._cachedFrameIndices[t]=this._cachedFrameIndex):(this._transformDirty=!0,this._cachedFrameIndex=-1)}}else{if(this._hasConstraint)for(var n=0,s=this._armature._constraints;n=0;this._localDirty&&this._updateGlobalTransformMatrix(u),u&&null!==this._cachedFrameIndices&&(this._cachedFrameIndex=this._cachedFrameIndices[t]=this._armature._armatureData.setCacheFrame(this.globalTransformMatrix,this.global))}else this._armature._armatureData.getCacheFrame(this.globalTransformMatrix,this.global,this._cachedFrameIndex);var _=2*this.global.x,f=2*this.global.y,m=e._helpPoint;this.globalTransformMatrix.transformPoint(1e3,-200,m),this._hullCache[0]=m.x,this._hullCache[1]=m.y,this._hullCache[2]=_-m.x,this._hullCache[3]=f-m.y,this.globalTransformMatrix.transformPoint(0,this._dY,m,!0),this._hullCache[4]=m.x,this._hullCache[5]=m.y,this.globalTransformMatrix.transformPoint(200,1e3,m),this._hullCache[6]=m.x,this._hullCache[7]=m.y,this._hullCache[8]=_-m.x,this._hullCache[9]=f-m.y,this.globalTransformMatrix.transformPoint(this._dX,0,m,!0),this._hullCache[10]=m.x,this._hullCache[11]=m.y}else this._childrenTransformDirty&&(this._childrenTransformDirty=!1);this._localDirty=!0},e}(t.Bone);t.Surface=e}(l||(l={})),function(t){var e=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.deformVertices=[],e}return f(e,t),e.toString=function(){return"[class dragonBones.DisplayFrame]"},e.prototype._onClear=function(){this.rawDisplayData=null,this.displayData=null,this.textureData=null,this.display=null,this.deformVertices.length=0},e.prototype.updateDeformVertices=function(){if(null!==this.rawDisplayData&&0===this.deformVertices.length){var t;if(2===this.rawDisplayData.type)t=this.rawDisplayData.geometry;else{if(4!==this.rawDisplayData.type)return;t=this.rawDisplayData.geometry}var e=0;e=null!==t.weight?2*t.weight.count:2*t.data.intArray[t.offset+0],this.deformVertices.length=e;for(var a=0,i=this.deformVertices.length;a=0&&this._displayIndex0)for(var s=0,o=r;s=0&&null!==this._cachedFrameIndices){var i=this._cachedFrameIndices[t];i>=0&&this._cachedFrameIndex===i?this._transformDirty=!1:i>=0?(this._transformDirty=!0,this._cachedFrameIndex=i):this._transformDirty||this._parent._childrenTransformDirty?(this._transformDirty=!0,this._cachedFrameIndex=-1):this._cachedFrameIndex>=0?(this._transformDirty=!1,this._cachedFrameIndices[t]=this._cachedFrameIndex):(this._transformDirty=!0,this._cachedFrameIndex=-1)}else(this._transformDirty||this._parent._childrenTransformDirty)&&(t=-1,this._transformDirty=!0,this._cachedFrameIndex=-1);if(this._transformDirty){if(this._cachedFrameIndex<0){var r=t>=0;this._updateGlobalTransformMatrix(r),r&&null!==this._cachedFrameIndices&&(this._cachedFrameIndex=this._cachedFrameIndices[t]=this._armature._armatureData.setCacheFrame(this.globalTransformMatrix,this.global))}else this._armature._armatureData.getCacheFrame(this.globalTransformMatrix,this.global,this._cachedFrameIndex);this._updateTransform(),this._transformDirty=!1}}},i.prototype.invalidUpdate=function(){this._displayDataDirty=!0,this._displayDirty=!0,this._transformDirty=!0},i.prototype.updateTransformAndMatrix=function(){this._transformDirty&&(this._updateGlobalTransformMatrix(!1),this._transformDirty=!1)},i.prototype.replaceRawDisplayData=function(t,e){if(void 0===e&&(e=-1),e<0)e=this._displayIndex<0?0:this._displayIndex;else if(e>=this._displayFrames.length)return;var a=this._displayFrames[e];if(a.rawDisplayData!==t){if(a.deformVertices.length=0,a.rawDisplayData=t,null===a.rawDisplayData){var i=this._armature._armatureData.defaultSkin;if(null!==i){var r=i.getDisplays(this._slotData.name);null!==r&&e=this._displayFrames.length)return;var a=this._displayFrames[e];a.displayData!==t&&a.rawDisplayData!==t&&(a.displayData=t,e===this._displayIndex&&(this._displayDataDirty=!0))},i.prototype.replaceTextureData=function(t,e){if(void 0===e&&(e=-1),e<0)e=this._displayIndex<0?0:this._displayIndex;else if(e>=this._displayFrames.length)return;var a=this._displayFrames[e];a.textureData!==t&&(a.textureData=t,e===this._displayIndex&&(this._displayDataDirty=!0))},i.prototype.replaceDisplay=function(e,a){if(void 0===a&&(a=-1),a<0)a=this._displayIndex<0?0:this._displayIndex;else if(a>=this._displayFrames.length)return;var i=this._displayFrames[a];if(i.display!==e){var r=i.display;i.display=e,null===r||r===this._rawDisplay||r===this._meshDisplay||this._hasDisplay(r)||r instanceof t.Armature||this._disposeDisplay(r,!0),null===e||e===this._rawDisplay||e===this._meshDisplay||this._hasDisplay(r)||e instanceof t.Armature||this._initDisplay(e,!0),a===this._displayIndex&&(this._displayDirty=!0)}},i.prototype.containsPoint=function(t,e){return null!==this._boundingBoxData&&(this.updateTransformAndMatrix(),i._helpMatrix.copyFrom(this.globalTransformMatrix),i._helpMatrix.invert(),i._helpMatrix.transformPoint(t,e,i._helpPoint),this._boundingBoxData.containsPoint(i._helpPoint.x,i._helpPoint.y))},i.prototype.intersectsSegment=function(t,e,a,r,n,s,o){if(void 0===n&&(n=null),void 0===s&&(s=null),void 0===o&&(o=null),null===this._boundingBoxData)return 0;this.updateTransformAndMatrix(),i._helpMatrix.copyFrom(this.globalTransformMatrix),i._helpMatrix.invert(),i._helpMatrix.transformPoint(t,e,i._helpPoint),t=i._helpPoint.x,e=i._helpPoint.y,i._helpMatrix.transformPoint(a,r,i._helpPoint),a=i._helpPoint.x,r=i._helpPoint.y;var l=this._boundingBoxData.intersectsSegment(t,e,a,r,n,s,o);return l>0&&(1===l||2===l?null!==n?(this.globalTransformMatrix.transformPoint(n.x,n.y,n),null!==s&&(s.x=n.x,s.y=n.y)):null!==s&&this.globalTransformMatrix.transformPoint(s.x,s.y,s):(null!==n&&this.globalTransformMatrix.transformPoint(n.x,n.y,n),null!==s&&this.globalTransformMatrix.transformPoint(s.x,s.y,s)),null!==o&&(this.globalTransformMatrix.transformPoint(Math.cos(o.x),Math.sin(o.x),i._helpPoint,!0),o.x=Math.atan2(i._helpPoint.y,i._helpPoint.x),this.globalTransformMatrix.transformPoint(Math.cos(o.y),Math.sin(o.y),i._helpPoint,!0),o.y=Math.atan2(i._helpPoint.y,i._helpPoint.x))),l},i.prototype.getDisplayFrameAt=function(t){return this._displayFrames[t]},Object.defineProperty(i.prototype,"visible",{get:function(){return this._visible},set:function(t){this._visible!==t&&(this._visible=t,this._updateVisible())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"displayFrameCount",{get:function(){return this._displayFrames.length},set:function(a){var i=this._displayFrames.length;if(ia){for(r=i-1;rp)continue}for(;;G++){var j=c[G];if(!(R>j)){0===G?R/=j:R=(R-(V=c[G-1]))/(j-V);break}}if(G!==f){f=G;var k=6*G;for(P=h[k],S=h[k+1],O=h[k+2],x=h[k+3],E=h[k+4],M=h[k+5],v=2*(d=.03*(P-2*O+E))+(g=.006*(3*(O-E)-P+(B=h[k+6]))),T=2*(y=.03*(S-2*x+M))+(D=.006*(3*(x-M)-S+(I=h[k+7]))),b=.3*(O-P)+d+.16666667*g,A=.3*(x-S)+y+.16666667*D,w=Math.sqrt(b*b+A*A),C[0]=w,k=1;k<8;k++)b+=v,A+=T,v+=g,T+=D,w+=Math.sqrt(b*b+A*A),C[k]=w;b+=v,A+=T,w+=Math.sqrt(b*b+A*A),C[8]=w,b+=v+g,A+=T+D,w+=Math.sqrt(b*b+A*A),C[9]=w,N=0}for(R*=w;;N++){var L=C[N];if(!(R>L)){var V;0===N?R/=L:R=N+(R-(V=C[N-1]))/(L-V);break}}this.addCurvePosition(.1*R,P,S,O,x,E,M,B,I,s,X,a)}}else{var Y=t.curveLengths;if(p=Y[_-=l?1:2],i&&(m*=p),r)for(var U=0;Up)continue}for(var H=0;;G++){var z=Y[G];if(!(m>z)){if(0===G)H=m/z;else{var W=Y[G-1];H=(m-W)/(z-W)}break}}G!==f&&(f=G,l&&G===_?(this._computeVertices(u-4,4,0,h),this._computeVertices(0,4,4,h)):this._computeVertices(6*G+2,8,0,h)),this.addCurvePosition(H,h[0],h[1],h[2],h[3],h[4],h[5],h[6],h[7],s,X,a)}}},a.prototype.addCurvePosition=function(t,e,a,i,r,n,s,o,l,h,u,_){if(0===t)return h[u]=e,h[u+1]=a,void(h[u+2]=0);if(1===t)return h[u]=o,h[u+1]=l,void(h[u+2]=0);var f=1-t,m=f*f,p=t*t,c=m*f,d=m*t*3,y=f*p*3,g=t*p,D=c*e+d*i+y*n+g*o,v=c*a+d*r+y*s+g*l;h[u]=D,h[u+1]=v,h[u+2]=_?Math.atan2(v-(c*a+d*r+y*s),D-(c*e+d*i+y*n)):0},a.prototype.init=function(t,e){this._constraintData=t,this._armature=e;var a=t;this.pathOffset=a.pathDisplayData.geometry.offset,this.position=a.position,this.spacing=a.spacing,this.rotateOffset=a.rotateOffset,this.rotateMix=a.rotateMix,this.translateMix=a.translateMix,this._root=this._armature.getBone(a.root.name),this._target=this._armature.getBone(a.target.name),this._pathSlot=this._armature.getSlot(a.pathSlot.name);for(var i=0,r=a.bones.length;i0?t.Transform.DEG_RAD:-t.Transform.DEG_RAD));for(var O=this.rotateMix,x=this.translateMix,E=(c=0,3);c<_;c++,E+=3){var M,B;(M=o[c]).updateByConstraint(),(B=M.globalTransformMatrix).tx+=(P-B.tx)*x,B.ty+=(S-B.ty)*x;var I=(g=b[E])-P,F=(D=b[E+1])-S;if(h){var C=this._boneLengths[c],w=(Math.sqrt(I*I+F*F)/C-1)*O+1;B.a*=w,B.b*=w}if(P=g,S=D,O>0){var N=B.a,R=B.b,j=B.c,k=B.d,L=void 0,V=void 0,Y=void 0;if(L=u?b[E-1]:Math.atan2(F,I),L-=Math.atan2(R,N),T){V=Math.cos(L),Y=Math.sin(L);var U=M._boneData.length;P+=(U*(V*N-Y*R)-I)*O,S+=(U*(Y*N+V*R)-F)*O}else L+=A;L>t.Transform.PI?L-=t.Transform.PI_D:L<-t.Transform.PI&&(L+=t.Transform.PI_D),L*=O,V=Math.cos(L),Y=Math.sin(L),B.a=V*N-Y*R,B.b=Y*N+V*R,B.c=V*j-Y*k,B.d=Y*j+V*k}M.global.fromMatrix(B)}this.dirty=!1}}},a.prototype.invalidUpdate=function(){},a}(e);t.PathConstraint=i}(l||(l={})),function(t){var e=function(){function t(t){void 0===t&&(t=0),this.time=0,this.timeScale=1,this._systemTime=0,this._animatebles=[],this._clock=null,this.time=t,this._systemTime=.001*(new Date).getTime()}return t.prototype.advanceTime=function(t){t!=t&&(t=0);var e=.001*Date.now();if(t<0&&(t=e-this._systemTime),this._systemTime=e,1!==this.timeScale&&(t*=this.timeScale),0!==t){t<0?this.time-=t:this.time+=t;for(var a=0,i=0,r=this._animatebles.length;a0&&(this._animatebles[a-i]=n,this._animatebles[a]=null),n.advanceTime(t)):i++}if(i>0){for(r=this._animatebles.length;a=0&&(this._animatebles[e]=null,t.clock=null)},t.prototype.clear=function(){for(var t=0,e=this._animatebles;t0&&d._subFadeState>0)this._armature._dragonBones.bufferObject(d),this._animationStates.length=0,this._lastAnimationState=null;else{var n=d.animationData,s=n.cacheFrameRate;if(this._animationDirty&&s>0){this._animationDirty=!1;for(var o=0,l=this._armature.getBones();o0){var m=f.getDisplayFrameAt(0).rawDisplayData;if(null!==m&&m.parent===this._armature.armatureData.defaultSkin){f._cachedFrameIndices=n.getSlotCachedFrameIndices(f.name);continue}}f._cachedFrameIndices=null}}d.advanceTime(t,s)}else if(r>1){for(var p=0,c=0;p0&&d._subFadeState>0?(c++,this._armature._dragonBones.bufferObject(d),this._animationDirty=!0,this._lastAnimationState===d&&(this._lastAnimationState=null)):(c>0&&(this._animationStates[p-c]=d),d.advanceTime(t,0)),p===r-1&&c>0&&(this._animationStates.length-=c,null===this._lastAnimationState&&this._animationStates.length>0&&(this._lastAnimationState=this._animationStates[this._animationStates.length-1]))}this._armature._cacheFrameIndex=-1}else this._armature._cacheFrameIndex=-1},a.prototype.reset=function(){for(var t=0,e=this._animationStates;t0?(e.position<0?(e.position%=i.duration,e.position=i.duration-e.position):e.position===i.duration?e.position-=1e-6:e.position>i.duration&&(e.position%=i.duration),e.duration>0&&e.position+e.duration>i.duration&&(e.duration=i.duration-e.position),e.playTimes<0&&(e.playTimes=i.playTimes)):(e.playTimes=1,e.position=0,e.duration>0&&(e.duration=0)),0===e.duration&&(e.duration=-1),this._fadeOut(e);var o=t.BaseObject.borrowObject(t.AnimationState);if(o.init(this._armature,i,e),this._animationDirty=!0,this._armature._cacheFrameIndex=-1,this._animationStates.length>0){for(var l=!1,h=0,u=this._animationStates.length;hthis._animationStates[h].layer){l=!0,this._animationStates.splice(h,0,o);break}if(h!==u-1&&o.layer>this._animationStates[h+1].layer){l=!0,this._animationStates.splice(h+1,0,o);break}}l||this._animationStates.push(o)}else this._animationStates.push(o);for(var _=0,f=this._armature.getSlots();_0)this.playConfig(this._animationConfig);else if(null===this._lastAnimationState){var a=this._armature.armatureData.defaultAnimation;null!==a&&(this._animationConfig.animation=a.name,this.playConfig(this._animationConfig))}else this._lastAnimationState.isPlaying||this._lastAnimationState.isCompleted?(this._animationConfig.animation=this._lastAnimationState.name,this.playConfig(this._animationConfig)):this._lastAnimationState.play();return this._lastAnimationState},a.prototype.fadeIn=function(t,e,a,i,r,n){return void 0===e&&(e=-1),void 0===a&&(a=-1),void 0===i&&(i=0),void 0===r&&(r=null),void 0===n&&(n=3),this._animationConfig.clear(),this._animationConfig.fadeOutMode=n,this._animationConfig.playTimes=a,this._animationConfig.layer=i,this._animationConfig.fadeInTime=e,this._animationConfig.animation=t,this._animationConfig.group=null!==r?r:"",this.playConfig(this._animationConfig)},a.prototype.gotoAndPlayByTime=function(t,e,a){return void 0===e&&(e=0),void 0===a&&(a=-1),this._animationConfig.clear(),this._animationConfig.resetToPose=!0,this._animationConfig.playTimes=a,this._animationConfig.position=e,this._animationConfig.fadeInTime=0,this._animationConfig.animation=t,this.playConfig(this._animationConfig)},a.prototype.gotoAndPlayByFrame=function(t,e,a){void 0===e&&(e=0),void 0===a&&(a=-1),this._animationConfig.clear(),this._animationConfig.resetToPose=!0,this._animationConfig.playTimes=a,this._animationConfig.fadeInTime=0,this._animationConfig.animation=t;var i=t in this._animations?this._animations[t]:null;return null!==i&&(this._animationConfig.position=i.frameCount>0?i.duration*e/i.frameCount:0),this.playConfig(this._animationConfig)},a.prototype.gotoAndPlayByProgress=function(t,e,a){void 0===e&&(e=0),void 0===a&&(a=-1),this._animationConfig.clear(),this._animationConfig.resetToPose=!0,this._animationConfig.playTimes=a,this._animationConfig.fadeInTime=0,this._animationConfig.animation=t;var i=t in this._animations?this._animations[t]:null;return null!==i&&(this._animationConfig.position=i.duration*(e>0?e:0)),this.playConfig(this._animationConfig)},a.prototype.gotoAndStopByTime=function(t,e){void 0===e&&(e=0);var a=this.gotoAndPlayByTime(t,e,1);return null!==a&&a.stop(),a},a.prototype.gotoAndStopByFrame=function(t,e){void 0===e&&(e=0);var a=this.gotoAndPlayByFrame(t,e,1);return null!==a&&a.stop(),a},a.prototype.gotoAndStopByProgress=function(t,e){void 0===e&&(e=0);var a=this.gotoAndPlayByProgress(t,e,1);return null!==a&&a.stop(),a},a.prototype.getBlendState=function(e,a,i){e in this._blendStates||(this._blendStates[e]={});var r=this._blendStates[e];return a in r||((r[a]=t.BaseObject.borrowObject(t.BlendState)).target=i),r[a]},a.prototype.getState=function(t,e){void 0===e&&(e=-1);for(var a=this._animationStates.length;a--;){var i=this._animationStates[a];if(i.name===t&&(e<0||i.layer===e))return i}return null},a.prototype.hasAnimation=function(t){return t in this._animations},a.prototype.getStates=function(){return this._animationStates},Object.defineProperty(a.prototype,"isPlaying",{get:function(){for(var t=0,e=this._animationStates;t0},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"lastAnimationName",{get:function(){return null!==this._lastAnimationState?this._lastAnimationState.name:""},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"animationNames",{get:function(){return this._animationNames},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"animations",{get:function(){return this._animations},set:function(t){if(this._animations!==t){for(var e in this._animationNames.length=0,this._animations)delete this._animations[e];for(var e in t)this._animationNames.push(e),this._animations[e]=t[e]}},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"animationConfig",{get:function(){return this._animationConfig.clear(),this._animationConfig},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"lastAnimationState",{get:function(){return this._lastAnimationState},enumerable:!0,configurable:!0}),a}(t.BaseObject);t.Animation=e}(l||(l={})),function(t){var e=function(e){function i(){var t=null!==e&&e.apply(this,arguments)||this;return t._boneMask=[],t._boneTimelines=[],t._boneBlendTimelines=[],t._slotTimelines=[],t._slotBlendTimelines=[],t._constraintTimelines=[],t._animationTimelines=[],t._poseTimelines=[],t._actionTimeline=null,t._zOrderTimeline=null,t}return f(i,e),i.toString=function(){return"[class dragonBones.AnimationState]"},i.prototype._onClear=function(){for(var t=0,e=this._boneTimelines;t=0&&(this._boneTimelines.splice(V,1),g.returnToPool()),(V=this._boneBlendTimelines.indexOf(g))>=0&&(this._boneBlendTimelines.splice(V,1),g.returnToPool())}for(var D={},v=[],T=0,b=this._slotTimelines;T=0&&(this._slotTimelines.splice(V,1),g.returnToPool()),(V=this._slotBlendTimelines.indexOf(g))>=0&&(this._slotBlendTimelines.splice(V,1),g.returnToPool())}},i.prototype._advanceFadeTime=function(e){var a,i=this._fadeState>0;if(this._subFadeState<0&&(this._subFadeState=0,null===this._parent&&this.actionEnabled)){var r=i?t.EventObject.FADE_OUT:t.EventObject.FADE_IN;this._armature.eventDispatcher.hasDBEventListener(r)&&((a=t.BaseObject.borrowObject(t.EventObject)).type=r,a.armature=this._armature,a.animationState=this,this._armature._dragonBones.bufferEvent(a))}(e<0&&(e=-e),this._fadeTime+=e,this._fadeTime>=this.fadeTotalTime?(this._subFadeState=1,this._fadeProgress=i?0:1):this._fadeTime>0?this._fadeProgress=i?1-this._fadeTime/this.fadeTotalTime:this._fadeTime/this.fadeTotalTime:this._fadeProgress=i?1:0,this._subFadeState>0&&(i||(this._playheadState|=1,this._fadeState=0),null===this._parent&&this.actionEnabled))&&(r=i?t.EventObject.FADE_OUT_COMPLETE:t.EventObject.FADE_IN_COMPLETE,this._armature.eventDispatcher.hasDBEventListener(r)&&((a=t.BaseObject.borrowObject(t.EventObject)).type=r,a.armature=this._armature,a.animationState=this,this._armature._dragonBones.bufferEvent(a)))},i.prototype.init=function(e,a,i){if(null===this._armature){if(this._armature=e,this._animationData=a,this.resetToPose=i.resetToPose,this.additive=i.additive,this.displayControl=i.displayControl,this.actionEnabled=i.actionEnabled,this.blendType=a.blendType,this.layer=i.layer,this.playTimes=i.playTimes,this.timeScale=i.timeScale,this.fadeTotalTime=i.fadeInTime,this.autoFadeOutTime=i.autoFadeOutTime,this.name=i.name.length>0?i.name:i.animation,this.group=i.group,this._weight=i.weight,i.pauseFadeIn?this._playheadState=2:this._playheadState=3,i.duration<0?(this._position=0,this._duration=this._animationData.duration,0!==i.position?this.timeScale>=0?this._time=i.position:this._time=i.position-this._duration:this._time=0):(this._position=i.position,this._duration=i.duration,this._time=0),this.timeScale<0&&0===this._time&&(this._time=-1e-6),this.fadeTotalTime<=0&&(this._fadeProgress=.999999),i.boneMask.length>0){this._boneMask.length=i.boneMask.length;for(var r=0,n=this._boneMask.length;r0,r=!0,n=!0,s=this._time;if(this._weightResult=this._weight*this._fadeProgress,null!==this._parent&&(this._weightResult*=this._parent._weightResult),this._actionTimeline.playState<=0&&this._actionTimeline.update(s),0!==this._weight){if(i){var o=2*e;this._actionTimeline.currentTime=Math.floor(this._actionTimeline.currentTime*o)/o}if(null!==this._zOrderTimeline&&this._zOrderTimeline.playState<=0&&this._zOrderTimeline.update(s),i){var l=Math.floor(this._actionTimeline.currentTime*e);this._armature._cacheFrameIndex===l?(r=!1,n=!1):(this._armature._cacheFrameIndex=l,this._animationData.cachedFrames[l]?n=!1:this._animationData.cachedFrames[l]=!0)}if(r){var h=!1,u=null;if(n)for(var _=0,f=this._boneTimelines.length;_0){var d=100,y=100,g=null,D=null;for(_=0,f=this._animationTimelines.length;_=0?T0&&(this._subFadeState=0,this._poseTimelines.length>0)){for(var b=0,A=this._poseTimelines;b=0?(this._boneTimelines.splice(S,1),P.returnToPool()):(S=this._boneBlendTimelines.indexOf(P))>=0?(this._boneBlendTimelines.splice(S,1),P.returnToPool()):(S=this._slotTimelines.indexOf(P))>=0?(this._slotTimelines.splice(S,1),P.returnToPool()):(S=this._slotBlendTimelines.indexOf(P))>=0?(this._slotBlendTimelines.splice(S,1),P.returnToPool()):(S=this._constraintTimelines.indexOf(P))>=0&&(this._constraintTimelines.splice(S,1),P.returnToPool())}this._poseTimelines.length=0}this._actionTimeline.playState>0&&this.autoFadeOutTime>=0&&this.fadeOut(this.autoFadeOutTime)}}},i.prototype.play=function(){this._playheadState=3},i.prototype.stop=function(){this._playheadState&=1},i.prototype.fadeOut=function(t,e){if(void 0===e&&(e=!0),t<0&&(t=0),e&&(this._playheadState&=2),this._fadeState>0){if(t>this.fadeTotalTime-this._fadeTime)return}else{this._fadeState=1,this._subFadeState=-1,(t<=0||this._fadeProgress<=0)&&(this._fadeProgress=1e-6);for(var a=0,i=this._boneTimelines;a1e-6?t/this._fadeProgress:0,this._fadeTime=this.fadeTotalTime*(1-this._fadeProgress)},i.prototype.containsBoneMask=function(t){return 0===this._boneMask.length||this._boneMask.indexOf(t)>=0},i.prototype.addBoneMask=function(t,e){void 0===e&&(e=!0);var a=this._armature.getBone(t);if(null!==a){if(this._boneMask.indexOf(t)<0&&this._boneMask.push(t),e)for(var i=0,r=this._armature.getBones();i=0&&this._boneMask.splice(a,1),e){var i=this._armature.getBone(t);if(null!==i){var r=this._armature.getBones();if(this._boneMask.length>0)for(var n=0,s=r;n=0&&i.contains(o)&&this._boneMask.splice(l,1)}else for(var h=0,u=r;h0},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"isFadeComplete",{get:function(){return 0===this._fadeState},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"isPlaying",{get:function(){return 0!=(2&this._playheadState)&&this._actionTimeline.playState<=0},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"isCompleted",{get:function(){return this._actionTimeline.playState>0},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"currentPlayTimes",{get:function(){return this._actionTimeline.currentPlayTimes},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"totalTime",{get:function(){return this._duration},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"currentTime",{get:function(){return this._actionTimeline.currentTime},set:function(t){var e=this._actionTimeline.currentPlayTimes-(this._actionTimeline.playState>0?1:0);if((t<0||this._duration0&&e===this.playTimes-1&&t===this._duration&&null===this._parent&&(t=this._duration-1e-6),this._time!==t){this._time=t,this._actionTimeline.setCurrentTime(this._time),null!==this._zOrderTimeline&&(this._zOrderTimeline.playState=-1);for(var a=0,i=this._boneTimelines;a0){if(this.leftWeight>0){if(this.layer!==e){if(this.layerWeight>=this.leftWeight)return this.dirty++,this.layer=e,this.leftWeight=0,this.blendWeight=0,!1;this.layer=e,this.leftWeight-=this.layerWeight,this.layerWeight=0}return a*=this.leftWeight,this.dirty++,this.blendWeight=a,this.layerWeight+=this.blendWeight,!0}return!1}return this.dirty++,this.layer=e,this.leftWeight=1,this.blendWeight=a,this.layerWeight=a,!0},e.prototype.reset=function(){this.dirty=0,this.layer=0,this.leftWeight=0,this.layerWeight=0,this.blendWeight=0},e.BONE_TRANSFORM="boneTransform",e.BONE_ALPHA="boneAlpha",e.SURFACE="surface",e.SLOT_DEFORM="slotDeform",e.SLOT_ALPHA="slotAlpha",e.SLOT_Z_INDEX="slotZIndex",e}(t.BaseObject);t.BlendState=a}(l||(l={})),function(t){var e=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return f(e,t),e.prototype._onClear=function(){this.dirty=!1,this.playState=-1,this.currentPlayTimes=-1,this.currentTime=-1,this.target=null,this._isTween=!1,this._valueOffset=0,this._frameValueOffset=0,this._frameOffset=0,this._frameRate=0,this._frameCount=0,this._frameIndex=-1,this._frameRateR=0,this._position=0,this._duration=0,this._timeScale=1,this._timeOffset=0,this._animationData=null,this._timelineData=null,this._armature=null,this._animationState=null,this._actionTimeline=null,this._frameArray=null,this._valueArray=null,this._timelineArray=null,this._frameIndices=null},e.prototype._setCurrentTime=function(t){var e=this.playState,a=this.currentPlayTimes,i=this.currentTime;if(null!==this._actionTimeline&&this._frameCount<=1)this.playState=this._actionTimeline.playState>=0?1:-1,this.currentPlayTimes=1,this.currentTime=this._actionTimeline.currentTime;else if(null===this._actionTimeline||1!==this._timeScale||0!==this._timeOffset){var r=this._animationState.playTimes,n=r*this._duration;t*=this._timeScale,0!==this._timeOffset&&(t+=this._timeOffset*this._animationData.duration),r>0&&(t>=n||t<=-n)?(this.playState<=0&&3===this._animationState._playheadState&&(this.playState=1),this.currentPlayTimes=r,this.currentTime=t<0?0:this._duration+1e-6):(0!==this.playState&&3===this._animationState._playheadState&&(this.playState=0),t<0?(t=-t,this.currentPlayTimes=Math.floor(t/this._duration),this.currentTime=this._duration-t%this._duration):(this.currentPlayTimes=Math.floor(t/this._duration),this.currentTime=t%this._duration)),this.currentTime+=this._position}else this.playState=this._actionTimeline.playState,this.currentPlayTimes=this._actionTimeline.currentPlayTimes,this.currentTime=this._actionTimeline.currentTime;return(this.currentPlayTimes!==a||this.currentTime!==i)&&((e<0&&this.playState!==e||this.playState<=0&&this.currentPlayTimes!==a)&&(this._frameIndex=-1),!0)},e.prototype.init=function(t,e,a){if(this._armature=t,this._animationState=e,this._timelineData=a,this._actionTimeline=this._animationState._actionTimeline,this===this._actionTimeline&&(this._actionTimeline=null),this._animationData=this._animationState.animationData,this._frameRate=this._animationData.parent.frameRate,this._frameRateR=1/this._frameRate,this._position=this._animationState._position,this._duration=this._animationState._duration,null!==this._timelineData){var i=this._animationData.parent.parent;this._frameArray=i.frameArray,this._timelineArray=i.timelineArray,this._frameIndices=i.frameIndices,this._frameCount=this._timelineArray[this._timelineData.offset+2],this._frameValueOffset=this._timelineArray[this._timelineData.offset+4],this._timeScale=100/this._timelineArray[this._timelineData.offset+0],this._timeOffset=.01*this._timelineArray[this._timelineData.offset+1]}},e.prototype.fadeOut=function(){this.dirty=!1},e.prototype.update=function(t){if(this._setCurrentTime(t)){if(this._frameCount>1){var e=Math.floor(this.currentTime*this._frameRate),a=this._frameIndices[this._timelineData.frameIndicesOffset+e];this._frameIndex!==a&&(this._frameIndex=a,this._frameOffset=this._animationData.frameOffset+this._timelineArray[this._timelineData.offset+5+this._frameIndex],this._onArriveAtFrame())}else this._frameIndex<0&&(this._frameIndex=0,null!==this._timelineData&&(this._frameOffset=this._animationData.frameOffset+this._timelineArray[this._timelineData.offset+5]),this._onArriveAtFrame());(this._isTween||this.dirty)&&this._onUpdateFrame()}},e.prototype.blend=function(t){},e}(t.BaseObject);t.TimelineState=e;var a=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return f(e,t),e._getEasingValue=function(t,e,a){var i=e;switch(t){case 3:i=Math.pow(e,2);break;case 4:i=1-Math.pow(1-e,2);break;case 5:i=.5*(1-Math.cos(e*Math.PI))}return(i-e)*a+e},e._getEasingCurveValue=function(t,e,a,i){if(t<=0)return 0;if(t>=1)return 1;var r=a>0,n=a+1,s=Math.floor(t*n),o=0,l=0;return r?(o=0===s?0:e[i+s-1],l=s===n-1?1e4:e[i+s]):(o=e[i+s-1],l=e[i+s]),1e-4*(o+(l-o)*(t*n-s))},e.prototype._onClear=function(){t.prototype._onClear.call(this),this._tweenType=0,this._curveCount=0,this._framePosition=0,this._frameDurationR=0,this._tweenEasing=0,this._tweenProgress=0,this._valueScale=1},e.prototype._onArriveAtFrame=function(){if(this._frameCount>1&&(this._frameIndex!==this._frameCount-1||0===this._animationState.playTimes||this._animationState.currentPlayTimes0?1/e:0}else this.dirty=!0,this._isTween=!1},e.prototype._onUpdateFrame=function(){this._isTween&&(this.dirty=!0,this._tweenProgress=(this.currentTime-this._framePosition)*this._frameDurationR,2===this._tweenType?this._tweenProgress=e._getEasingCurveValue(this._tweenProgress,this._frameArray,this._curveCount,this._frameOffset+3):1!==this._tweenType&&(this._tweenProgress=e._getEasingValue(this._tweenType,this._tweenProgress,this._tweenEasing)))},e}(e);t.TweenTimelineState=a;var i=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return f(e,t),e.prototype._onClear=function(){t.prototype._onClear.call(this),this._current=0,this._difference=0,this._result=0},e.prototype._onArriveAtFrame=function(){if(t.prototype._onArriveAtFrame.call(this),null!==this._timelineData){var e=this._valueScale,a=this._valueArray,i=this._valueOffset+this._frameValueOffset+this._frameIndex;if(this._isTween){var r=this._frameIndex===this._frameCount-1?this._valueOffset+this._frameValueOffset:i+1;1===e?(this._current=a[i],this._difference=a[r]-this._current):(this._current=a[i]*e,this._difference=a[r]*e-this._current)}else this._result=a[i]*e}else this._result=0},e.prototype._onUpdateFrame=function(){t.prototype._onUpdateFrame.call(this),this._isTween&&(this._result=this._current+this._difference*this._tweenProgress)},e}(a);t.SingleValueTimelineState=i;var r=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return f(e,t),e.prototype._onClear=function(){t.prototype._onClear.call(this),this._currentA=0,this._currentB=0,this._differenceA=0,this._differenceB=0,this._resultA=0,this._resultB=0},e.prototype._onArriveAtFrame=function(){if(t.prototype._onArriveAtFrame.call(this),null!==this._timelineData){var e=this._valueScale,a=this._valueArray,i=this._valueOffset+this._frameValueOffset+2*this._frameIndex;if(this._isTween){var r=this._frameIndex===this._frameCount-1?this._valueOffset+this._frameValueOffset:i+2;1===e?(this._currentA=a[i],this._currentB=a[i+1],this._differenceA=a[r]-this._currentA,this._differenceB=a[r+1]-this._currentB):(this._currentA=a[i]*e,this._currentB=a[i+1]*e,this._differenceA=a[r]*e-this._currentA,this._differenceB=a[r+1]*e-this._currentB)}else this._resultA=a[i]*e,this._resultB=a[i+1]*e}else this._resultA=0,this._resultB=0},e.prototype._onUpdateFrame=function(){t.prototype._onUpdateFrame.call(this),this._isTween&&(this._resultA=this._currentA+this._differenceA*this._tweenProgress,this._resultB=this._currentB+this._differenceB*this._tweenProgress)},e}(a);t.DoubleValueTimelineState=r;var n=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._rd=[],e}return f(e,t),e.prototype._onClear=function(){t.prototype._onClear.call(this),this._valueCount=0,this._rd.length=0},e.prototype._onArriveAtFrame=function(){t.prototype._onArriveAtFrame.call(this);var e=this._valueCount,a=this._rd;if(null!==this._timelineData){var i=this._valueScale,r=this._valueArray,n=this._valueOffset+this._frameValueOffset+this._frameIndex*e;if(this._isTween){var s=this._frameIndex===this._frameCount-1?this._valueOffset+this._frameValueOffset:n+e;if(1===i)for(var o=0;o0&&s.hasDBEventListener(t.EventObject.COMPLETE)&&((u=t.BaseObject.borrowObject(t.EventObject)).type=t.EventObject.COMPLETE,u.armature=this._armature,u.animationState=this._animationState)),this._frameCount>1){var _=this._timelineData,f=Math.floor(this.currentTime*this._frameRate),m=this._frameIndices[_.frameIndicesOffset+f];if(this._frameIndex!==m){var p=this._frameIndex;if(this._frameIndex=m,null!==this._timelineArray)if(this._frameOffset=this._animationData.frameOffset+this._timelineArray[_.offset+5+this._frameIndex],l){if(p<0){var c=Math.floor(r*this._frameRate);p=this._frameIndices[_.frameIndicesOffset+c],this.currentPlayTimes===i&&p===m&&(p=-1)}for(;p>=0;){var d=this._animationData.frameOffset+this._timelineArray[_.offset+5+p],y=this._frameArray[d]/this._frameRate;if(this._position<=y&&y<=this._position+this._duration&&this._onCrossFrame(p),null!==h&&0===p&&(this._armature._dragonBones.bufferEvent(h),h=null),p>0?p--:p=this._frameCount-1,p===m)break}}else for(p<0&&(c=Math.floor(r*this._frameRate),p=this._frameIndices[_.frameIndicesOffset+c],d=this._animationData.frameOffset+this._timelineArray[_.offset+5+p],y=this._frameArray[d]/this._frameRate,this.currentPlayTimes===i&&(r<=y?p>0?p--:p=this._frameCount-1:p===m&&(p=-1)));p>=0&&(p=0&&(this._frameArray[this._frameOffset+1]>0?this._armature._sortZOrder(this._frameArray,this._frameOffset+2):this._armature._sortZOrder(null,0))},e.prototype._onUpdateFrame=function(){},e}(t.TimelineState);t.ZOrderTimelineState=a;var i=function(e){function a(){return null!==e&&e.apply(this,arguments)||this}return f(a,e),a.toString=function(){return"[class dragonBones.BoneAllTimelineState]"},a.prototype._onArriveAtFrame=function(){e.prototype._onArriveAtFrame.call(this),this._isTween&&this._frameIndex===this._frameCount-1&&(this._rd[2]=t.Transform.normalizeRadian(this._rd[2]),this._rd[3]=t.Transform.normalizeRadian(this._rd[3])),null===this._timelineData&&(this._rd[4]=1,this._rd[5]=1)},a.prototype.init=function(t,a,i){e.prototype.init.call(this,t,a,i),this._valueOffset=this._animationData.frameFloatOffset,this._valueCount=6,this._valueArray=this._animationData.parent.parent.frameFloatArray},a.prototype.fadeOut=function(){this.dirty=!1,this._rd[2]=t.Transform.normalizeRadian(this._rd[2]),this._rd[3]=t.Transform.normalizeRadian(this._rd[3])},a.prototype.blend=function(t){var e=this._armature.armatureData.scale,a=this._rd,i=this.target,r=i.target,n=i.blendWeight,s=r.animationPose;i.dirty>1?(s.x+=a[0]*n*e,s.y+=a[1]*n*e,s.rotation+=a[2]*n,s.skew+=a[3]*n,s.scaleX+=(a[4]-1)*n,s.scaleY+=(a[5]-1)*n):(s.x=a[0]*n*e,s.y=a[1]*n*e,s.rotation=a[2]*n,s.skew=a[3]*n,s.scaleX=(a[4]-1)*n+1,s.scaleY=(a[5]-1)*n+1),(t||this.dirty)&&(this.dirty=!1,r._transformDirty=!0)},a}(t.MutilpleValueTimelineState);t.BoneAllTimelineState=i;var r=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return f(e,t),e.toString=function(){return"[class dragonBones.BoneTranslateTimelineState]"},e.prototype.init=function(e,a,i){t.prototype.init.call(this,e,a,i),this._valueOffset=this._animationData.frameFloatOffset,this._valueScale=this._armature.armatureData.scale,this._valueArray=this._animationData.parent.parent.frameFloatArray},e.prototype.blend=function(t){var e=this.target,a=e.target,i=e.blendWeight,r=a.animationPose;e.dirty>1?(r.x+=this._resultA*i,r.y+=this._resultB*i):1!==i?(r.x=this._resultA*i,r.y=this._resultB*i):(r.x=this._resultA,r.y=this._resultB),(t||this.dirty)&&(this.dirty=!1,a._transformDirty=!0)},e}(t.DoubleValueTimelineState);t.BoneTranslateTimelineState=r;var n=function(e){function a(){return null!==e&&e.apply(this,arguments)||this}return f(a,e),a.toString=function(){return"[class dragonBones.BoneRotateTimelineState]"},a.prototype._onArriveAtFrame=function(){e.prototype._onArriveAtFrame.call(this),this._isTween&&this._frameIndex===this._frameCount-1&&(this._differenceA=t.Transform.normalizeRadian(this._differenceA),this._differenceB=t.Transform.normalizeRadian(this._differenceB))},a.prototype.init=function(t,a,i){e.prototype.init.call(this,t,a,i),this._valueOffset=this._animationData.frameFloatOffset,this._valueArray=this._animationData.parent.parent.frameFloatArray},a.prototype.fadeOut=function(){this.dirty=!1,this._resultA=t.Transform.normalizeRadian(this._resultA),this._resultB=t.Transform.normalizeRadian(this._resultB)},a.prototype.blend=function(t){var e=this.target,a=e.target,i=e.blendWeight,r=a.animationPose;e.dirty>1?(r.rotation+=this._resultA*i,r.skew+=this._resultB*i):1!==i?(r.rotation=this._resultA*i,r.skew=this._resultB*i):(r.rotation=this._resultA,r.skew=this._resultB),(t||this.dirty)&&(this.dirty=!1,a._transformDirty=!0)},a}(t.DoubleValueTimelineState);t.BoneRotateTimelineState=n;var s=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return f(e,t),e.toString=function(){return"[class dragonBones.BoneScaleTimelineState]"},e.prototype._onArriveAtFrame=function(){t.prototype._onArriveAtFrame.call(this),null===this._timelineData&&(this._resultA=1,this._resultB=1)},e.prototype.init=function(e,a,i){t.prototype.init.call(this,e,a,i),this._valueOffset=this._animationData.frameFloatOffset,this._valueArray=this._animationData.parent.parent.frameFloatArray},e.prototype.blend=function(t){var e=this.target,a=e.target,i=e.blendWeight,r=a.animationPose;e.dirty>1?(r.scaleX+=(this._resultA-1)*i,r.scaleY+=(this._resultB-1)*i):1!==i?(r.scaleX=(this._resultA-1)*i+1,r.scaleY=(this._resultB-1)*i+1):(r.scaleX=this._resultA,r.scaleY=this._resultB),(t||this.dirty)&&(this.dirty=!1,a._transformDirty=!0)},e}(t.DoubleValueTimelineState);t.BoneScaleTimelineState=s;var o=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return f(e,t),e.toString=function(){return"[class dragonBones.SurfaceTimelineState]"},e.prototype._onClear=function(){t.prototype._onClear.call(this),this._deformCount=0,this._deformOffset=0,this._sameValueOffset=0},e.prototype.init=function(e,a,i){if(t.prototype.init.call(this,e,a,i),null!==this._timelineData){var r=this._animationData.parent.parent,n=r.frameIntArray,s=this._animationData.frameIntOffset+this._timelineArray[this._timelineData.offset+3];this._valueOffset=this._animationData.frameFloatOffset,this._valueCount=n[s+2],this._deformCount=n[s+1],this._deformOffset=n[s+3],this._sameValueOffset=n[s+4]+this._animationData.frameFloatOffset,this._valueScale=this._armature.armatureData.scale,this._valueArray=r.frameFloatArray,this._rd.length=2*this._valueCount}else this._deformCount=this.target.target._deformVertices.length},e.prototype.blend=function(t){var e=this.target,a=e.target,i=e.blendWeight,r=a._deformVertices,n=this._valueArray;if(null!==n)for(var s=this._valueCount,o=this._deformOffset,l=this._sameValueOffset,h=this._rd,u=0;u1?r[u]+=_*i:r[u]=_*i}else if(1===e.dirty)for(u=0;u1?(a._alpha+=this._result*i,a._alpha>1&&(a._alpha=1)):a._alpha=this._result*i,(t||this.dirty)&&(this.dirty=!1,this._armature._alphaDirty=!0)},e}(t.SingleValueTimelineState);t.AlphaTimelineState=l;var h=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return f(e,t),e.toString=function(){return"[class dragonBones.SlotDislayTimelineState]"},e.prototype._onArriveAtFrame=function(){if(this.playState>=0){var t=this.target,e=null!==this._timelineData?this._frameArray[this._frameOffset+1]:t._slotData.displayIndex;t.displayIndex!==e&&t._setDisplayIndex(e,!0)}},e.prototype._onUpdateFrame=function(){},e}(t.TimelineState);t.SlotDislayTimelineState=h;var u=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._current=[0,0,0,0,0,0,0,0],e._difference=[0,0,0,0,0,0,0,0],e._result=[0,0,0,0,0,0,0,0],e}return f(e,t),e.toString=function(){return"[class dragonBones.SlotColorTimelineState]"},e.prototype._onArriveAtFrame=function(){if(t.prototype._onArriveAtFrame.call(this),null!==this._timelineData){var e=this._animationData.parent.parent,a=e.colorArray,i=e.frameIntArray,r=this._animationData.frameIntOffset+this._frameValueOffset+this._frameIndex,n=i[r];n<0&&(n+=65536),this._isTween?(this._current[0]=a[n++],this._current[1]=a[n++],this._current[2]=a[n++],this._current[3]=a[n++],this._current[4]=a[n++],this._current[5]=a[n++],this._current[6]=a[n++],this._current[7]=a[n++],(n=this._frameIndex===this._frameCount-1?i[this._animationData.frameIntOffset+this._frameValueOffset]:i[r+1])<0&&(n+=65536),this._difference[0]=a[n++]-this._current[0],this._difference[1]=a[n++]-this._current[1],this._difference[2]=a[n++]-this._current[2],this._difference[3]=a[n++]-this._current[3],this._difference[4]=a[n++]-this._current[4],this._difference[5]=a[n++]-this._current[5],this._difference[6]=a[n++]-this._current[6],this._difference[7]=a[n++]-this._current[7]):(this._result[0]=.01*a[n++],this._result[1]=.01*a[n++],this._result[2]=.01*a[n++],this._result[3]=.01*a[n++],this._result[4]=a[n++],this._result[5]=a[n++],this._result[6]=a[n++],this._result[7]=a[n++])}else{var s=this.target.slotData.color;this._result[0]=s.alphaMultiplier,this._result[1]=s.redMultiplier,this._result[2]=s.greenMultiplier,this._result[3]=s.blueMultiplier,this._result[4]=s.alphaOffset,this._result[5]=s.redOffset,this._result[6]=s.greenOffset,this._result[7]=s.blueOffset}},e.prototype._onUpdateFrame=function(){t.prototype._onUpdateFrame.call(this),this._isTween&&(this._result[0]=.01*(this._current[0]+this._difference[0]*this._tweenProgress),this._result[1]=.01*(this._current[1]+this._difference[1]*this._tweenProgress),this._result[2]=.01*(this._current[2]+this._difference[2]*this._tweenProgress),this._result[3]=.01*(this._current[3]+this._difference[3]*this._tweenProgress),this._result[4]=this._current[4]+this._difference[4]*this._tweenProgress,this._result[5]=this._current[5]+this._difference[5]*this._tweenProgress,this._result[6]=this._current[6]+this._difference[6]*this._tweenProgress,this._result[7]=this._current[7]+this._difference[7]*this._tweenProgress)},e.prototype.fadeOut=function(){this._isTween=!1},e.prototype.update=function(e){if(t.prototype.update.call(this,e),this._isTween||this.dirty){var a=this.target,i=a._colorTransform;if(0!==this._animationState._fadeState||0!==this._animationState._subFadeState){if(i.alphaMultiplier!==this._result[0]||i.redMultiplier!==this._result[1]||i.greenMultiplier!==this._result[2]||i.blueMultiplier!==this._result[3]||i.alphaOffset!==this._result[4]||i.redOffset!==this._result[5]||i.greenOffset!==this._result[6]||i.blueOffset!==this._result[7]){var r=Math.pow(this._animationState._fadeProgress,4);i.alphaMultiplier+=(this._result[0]-i.alphaMultiplier)*r,i.redMultiplier+=(this._result[1]-i.redMultiplier)*r,i.greenMultiplier+=(this._result[2]-i.greenMultiplier)*r,i.blueMultiplier+=(this._result[3]-i.blueMultiplier)*r,i.alphaOffset+=(this._result[4]-i.alphaOffset)*r,i.redOffset+=(this._result[5]-i.redOffset)*r,i.greenOffset+=(this._result[6]-i.greenOffset)*r,i.blueOffset+=(this._result[7]-i.blueOffset)*r,a._colorDirty=!0}}else this.dirty&&(this.dirty=!1,i.alphaMultiplier===this._result[0]&&i.redMultiplier===this._result[1]&&i.greenMultiplier===this._result[2]&&i.blueMultiplier===this._result[3]&&i.alphaOffset===this._result[4]&&i.redOffset===this._result[5]&&i.greenOffset===this._result[6]&&i.blueOffset===this._result[7]||(i.alphaMultiplier=this._result[0],i.redMultiplier=this._result[1],i.greenMultiplier=this._result[2],i.blueMultiplier=this._result[3],i.alphaOffset=this._result[4],i.redOffset=this._result[5],i.greenOffset=this._result[6],i.blueOffset=this._result[7],a._colorDirty=!0))}},e}(t.TweenTimelineState);t.SlotColorTimelineState=u;var _=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return f(e,t),e.toString=function(){return"[class dragonBones.SlotZIndexTimelineState]"},e.prototype._onArriveAtFrame=function(){if(t.prototype._onArriveAtFrame.call(this),null===this._timelineData){var e=this.target.target;this._result=e.slotData.zIndex}},e.prototype.init=function(e,a,i){t.prototype.init.call(this,e,a,i),this._valueOffset=this._animationData.frameIntOffset,this._valueArray=this._animationData.parent.parent.frameIntArray},e.prototype.blend=function(t){var e=this.target,a=e.target,i=e.blendWeight;e.dirty>1?a._zIndex+=this._result*i:a._zIndex=this._result*i,(t||this.dirty)&&(this.dirty=!1,this._armature._zIndexDirty=!0)},e}(t.SingleValueTimelineState);t.SlotZIndexTimelineState=_;var m=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return f(e,t),e.toString=function(){return"[class dragonBones.DeformTimelineState]"},e.prototype._onClear=function(){t.prototype._onClear.call(this),this.geometryOffset=0,this.displayFrame=null,this._deformCount=0,this._deformOffset=0,this._sameValueOffset=0},e.prototype.init=function(e,a,i){if(t.prototype.init.call(this,e,a,i),null!==this._timelineData){var r=this._animationData.frameIntOffset+this._timelineArray[this._timelineData.offset+3],n=this._animationData.parent.parent,s=n.frameIntArray,o=this.target.target;this.geometryOffset=s[r+0],this.geometryOffset<0&&(this.geometryOffset+=65536);for(var l=0,h=o.displayFrameCount;l1?r[u]+=_*i:r[u]=_*i}else if(1===e.dirty)for(u=0;u0,e._weight=this._currentB;else{var a=e._constraintData;e._bendPositive=a.bendPositive,e._weight=a.weight}e.invalidUpdate(),this.dirty=!1},e.prototype.init=function(e,a,i){t.prototype.init.call(this,e,a,i),this._valueOffset=this._animationData.frameIntOffset,this._valueScale=.01,this._valueArray=this._animationData.parent.parent.frameIntArray},e}(t.DoubleValueTimelineState);t.IKConstraintTimelineState=p;var c=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return f(e,t),e.toString=function(){return"[class dragonBones.AnimationProgressTimelineState]"},e.prototype._onUpdateFrame=function(){t.prototype._onUpdateFrame.call(this);var e=this.target;null!==e._parent&&(e.currentTime=this._result*e.totalTime),this.dirty=!1},e.prototype.init=function(e,a,i){t.prototype.init.call(this,e,a,i),this._valueOffset=this._animationData.frameIntOffset,this._valueScale=1e-4,this._valueArray=this._animationData.parent.parent.frameIntArray},e}(t.SingleValueTimelineState);t.AnimationProgressTimelineState=c;var d=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return f(e,t),e.toString=function(){return"[class dragonBones.AnimationWeightTimelineState]"},e.prototype._onUpdateFrame=function(){t.prototype._onUpdateFrame.call(this);var e=this.target;null!==e._parent&&(e.weight=this._result),this.dirty=!1},e.prototype.init=function(e,a,i){t.prototype.init.call(this,e,a,i),this._valueOffset=this._animationData.frameIntOffset,this._valueScale=1e-4,this._valueArray=this._animationData.parent.parent.frameIntArray},e}(t.SingleValueTimelineState);t.AnimationWeightTimelineState=d;var y=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return f(e,t),e.toString=function(){return"[class dragonBones.AnimationParametersTimelineState]"},e.prototype._onUpdateFrame=function(){t.prototype._onUpdateFrame.call(this);var e=this.target;null!==e._parent&&(e.parameterX=this._resultA,e.parameterY=this._resultB),this.dirty=!1},e.prototype.init=function(e,a,i){t.prototype.init.call(this,e,a,i),this._valueOffset=this._animationData.frameIntOffset,this._valueScale=1e-4,this._valueArray=this._animationData.parent.parent.frameIntArray},e}(t.DoubleValueTimelineState);t.AnimationParametersTimelineState=y}(l||(l={})),function(t){var e=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return f(e,t),e.actionDataToInstance=function(t,a,i){0===t.type?a.type=e.FRAME_EVENT:a.type=10===t.type?e.FRAME_EVENT:e.SOUND_EVENT,a.name=t.name,a.armature=i,a.actionData=t,a.data=t.data,null!==t.bone&&(a.bone=i.getBone(t.bone.name)),null!==t.slot&&(a.slot=i.getSlot(t.slot.name))},e.toString=function(){return"[class dragonBones.EventObject]"},e.prototype._onClear=function(){this.time=0,this.type="",this.name="",this.armature=null,this.bone=null,this.slot=null,this.animationState=null,this.actionData=null,this.data=null},e.START="start",e.LOOP_COMPLETE="loopComplete",e.COMPLETE="complete",e.FADE_IN="fadeIn",e.FADE_IN_COMPLETE="fadeInComplete",e.FADE_OUT="fadeOut",e.FADE_OUT_COMPLETE="fadeOutComplete",e.FRAME_EVENT="frameEvent",e.SOUND_EVENT="soundEvent",e}(t.BaseObject);t.EventObject=e}(l||(l={})),function(t){var e=function(){function t(){}return t._getArmatureType=function(t){switch(t.toLowerCase()){case"stage":return 2;case"armature":return 0;case"movieclip":return 1;default:return 0}},t._getBoneType=function(t){switch(t.toLowerCase()){case"bone":return 0;case"surface":return 1;default:return 0}},t._getPositionMode=function(t){switch(t.toLocaleLowerCase()){case"percent":return 1;case"fixed":return 0;default:return 1}},t._getSpacingMode=function(t){switch(t.toLocaleLowerCase()){case"length":return 0;case"percent":return 2;case"fixed":return 1;default:return 0}},t._getRotateMode=function(t){switch(t.toLocaleLowerCase()){case"tangent":return 0;case"chain":return 1;case"chainscale":return 2;default:return 0}},t._getDisplayType=function(t){switch(t.toLowerCase()){case"image":return 0;case"mesh":return 2;case"armature":return 1;case"boundingbox":return 3;case"path":return 4;default:return 0}},t._getBoundingBoxType=function(t){switch(t.toLowerCase()){case"rectangle":return 0;case"ellipse":return 1;case"polygon":return 2;default:return 0}},t._getBlendMode=function(t){switch(t.toLowerCase()){case"normal":return 0;case"add":return 1;case"alpha":return 2;case"darken":return 3;case"difference":return 4;case"erase":return 5;case"hardlight":return 6;case"invert":return 7;case"layer":return 8;case"lighten":return 9;case"multiply":return 10;case"overlay":return 11;case"screen":return 12;case"subtract":return 13;default:return 0}},t._getAnimationBlendType=function(t){switch(t.toLowerCase()){case"none":return 0;case"1d":return 1;default:return 0}},t._getActionType=function(t){switch(t.toLowerCase()){case"play":return 0;case"frame":return 10;case"sound":return 11;default:return 0}},t.DATA_VERSION_2_3="2.3",t.DATA_VERSION_3_0="3.0",t.DATA_VERSION_4_0="4.0",t.DATA_VERSION_4_5="4.5",t.DATA_VERSION_5_0="5.0",t.DATA_VERSION_5_5="5.5",t.DATA_VERSION_5_6="5.6",t.DATA_VERSION=t.DATA_VERSION_5_6,t.DATA_VERSIONS=[t.DATA_VERSION_4_0,t.DATA_VERSION_4_5,t.DATA_VERSION_5_0,t.DATA_VERSION_5_5,t.DATA_VERSION_5_6],t.TEXTURE_ATLAS="textureAtlas",t.SUB_TEXTURE="SubTexture",t.FORMAT="format",t.IMAGE_PATH="imagePath",t.WIDTH="width",t.HEIGHT="height",t.ROTATED="rotated",t.FRAME_X="frameX",t.FRAME_Y="frameY",t.FRAME_WIDTH="frameWidth",t.FRAME_HEIGHT="frameHeight",t.DRADON_BONES="dragonBones",t.USER_DATA="userData",t.ARMATURE="armature",t.CANVAS="canvas",t.BONE="bone",t.SURFACE="surface",t.SLOT="slot",t.CONSTRAINT="constraint",t.SKIN="skin",t.DISPLAY="display",t.FRAME="frame",t.IK="ik",t.PATH_CONSTRAINT="path",t.ANIMATION="animation",t.TIMELINE="timeline",t.FFD="ffd",t.TRANSLATE_FRAME="translateFrame",t.ROTATE_FRAME="rotateFrame",t.SCALE_FRAME="scaleFrame",t.DISPLAY_FRAME="displayFrame",t.COLOR_FRAME="colorFrame",t.DEFAULT_ACTIONS="defaultActions",t.ACTIONS="actions",t.EVENTS="events",t.INTS="ints",t.FLOATS="floats",t.STRINGS="strings",t.TRANSFORM="transform",t.PIVOT="pivot",t.AABB="aabb",t.COLOR="color",t.VERSION="version",t.COMPATIBLE_VERSION="compatibleVersion",t.FRAME_RATE="frameRate",t.TYPE="type",t.SUB_TYPE="subType",t.NAME="name",t.PARENT="parent",t.TARGET="target",t.STAGE="stage",t.SHARE="share",t.PATH="path",t.LENGTH="length",t.DISPLAY_INDEX="displayIndex",t.Z_ORDER="zOrder",t.Z_INDEX="zIndex",t.BLEND_MODE="blendMode",t.INHERIT_TRANSLATION="inheritTranslation",t.INHERIT_ROTATION="inheritRotation",t.INHERIT_SCALE="inheritScale",t.INHERIT_REFLECTION="inheritReflection",t.INHERIT_ANIMATION="inheritAnimation",t.INHERIT_DEFORM="inheritDeform",t.SEGMENT_X="segmentX",t.SEGMENT_Y="segmentY",t.BEND_POSITIVE="bendPositive",t.CHAIN="chain",t.WEIGHT="weight",t.BLEND_TYPE="blendType",t.FADE_IN_TIME="fadeInTime",t.PLAY_TIMES="playTimes",t.SCALE="scale",t.OFFSET="offset",t.POSITION="position",t.DURATION="duration",t.TWEEN_EASING="tweenEasing",t.TWEEN_ROTATE="tweenRotate",t.TWEEN_SCALE="tweenScale",t.CLOCK_WISE="clockwise",t.CURVE="curve",t.SOUND="sound",t.EVENT="event",t.ACTION="action",t.X="x",t.Y="y",t.SKEW_X="skX",t.SKEW_Y="skY",t.SCALE_X="scX",t.SCALE_Y="scY",t.VALUE="value",t.ROTATE="rotate",t.SKEW="skew",t.ALPHA="alpha",t.ALPHA_OFFSET="aO",t.RED_OFFSET="rO",t.GREEN_OFFSET="gO",t.BLUE_OFFSET="bO",t.ALPHA_MULTIPLIER="aM",t.RED_MULTIPLIER="rM",t.GREEN_MULTIPLIER="gM",t.BLUE_MULTIPLIER="bM",t.UVS="uvs",t.VERTICES="vertices",t.TRIANGLES="triangles",t.WEIGHTS="weights",t.SLOT_POSE="slotPose",t.BONE_POSE="bonePose",t.BONES="bones",t.POSITION_MODE="positionMode",t.SPACING_MODE="spacingMode",t.ROTATE_MODE="rotateMode",t.SPACING="spacing",t.ROTATE_OFFSET="rotateOffset",t.ROTATE_MIX="rotateMix",t.TRANSLATE_MIX="translateMix",t.TARGET_DISPLAY="targetDisplay",t.CLOSED="closed",t.CONSTANT_SPEED="constantSpeed",t.VERTEX_COUNT="vertexCount",t.LENGTHS="lengths",t.GOTO_AND_PLAY="gotoAndPlay",t.DEFAULT_NAME="default",t}();t.DataParser=e}(l||(l={})),function(t){var e=function(e){function i(){var a=null!==e&&e.apply(this,arguments)||this;return a._rawTextureAtlasIndex=0,a._rawBones=[],a._data=null,a._armature=null,a._bone=null,a._geometry=null,a._slot=null,a._skin=null,a._mesh=null,a._animation=null,a._timeline=null,a._rawTextureAtlases=null,a._frameValueType=0,a._defaultColorOffset=-1,a._prevClockwise=0,a._prevRotation=0,a._frameDefaultValue=0,a._frameValueScale=1,a._helpMatrixA=new t.Matrix,a._helpMatrixB=new t.Matrix,a._helpTransform=new t.Transform,a._helpColorTransform=new t.ColorTransform,a._helpPoint=new t.Point,a._helpArray=[],a._intArray=[],a._floatArray=[],a._frameIntArray=[],a._frameFloatArray=[],a._frameArray=[],a._timelineArray=[],a._colorArray=[],a._cacheRawMeshes=[],a._cacheMeshes=[],a._actionFrames=[],a._weightSlotPose={},a._weightBonePoses={},a._cacheBones={},a._slotChildActions={},a}return f(i,e),i._getBoolean=function(t,e,a){if(e in t){var i=t[e],r=typeof i;if("boolean"===r)return i;if("string"!==r)return!!i;switch(i){case"0":case"NaN":case"":case"false":case"null":case"undefined":return!1;default:return!0}}return a},i._getNumber=function(t,e,a){if(e in t){var i=t[e];return null===i||"NaN"===i?a:+i||0}return a},i._getString=function(t,e,a){if(e in t){var i=t[e];return"string"==typeof i?i:String(i)}return a},i.prototype._getCurvePoint=function(t,e,a,i,r,n,s,o,l,h){var u=1-l,_=u*u,f=l*l,m=u*_,p=3*l*_,c=3*u*f,d=l*f;h.x=m*t+p*a+c*r+d*s,h.y=m*e+p*i+c*n+d*o},i.prototype._samplingEasingCurve=function(t,e){var a=t.length;if(a%3==1){for(var i=-2,r=0,n=e.length;r=0&&i+61e-4;){var g=.5*(y+d);this._getCurvePoint(l,h,u,_,f,m,p,c,g,this._helpPoint),s-this._helpPoint.x>0?d=g:y=g}e[r]=this._helpPoint.y}return!0}for(i=0,r=0,n=e.length;r1e-4;)g=.5*(y+d),this._getCurvePoint(l,h,u,_,f,m,p,c,g,this._helpPoint),s-this._helpPoint.x>0?d=g:y=g;e[r]=this._helpPoint.y}return!1},i.prototype._parseActionDataInFrame=function(e,a,i,r){t.DataParser.EVENT in e&&this._mergeActionFrame(e[t.DataParser.EVENT],a,10,i,r),t.DataParser.SOUND in e&&this._mergeActionFrame(e[t.DataParser.SOUND],a,11,i,r),t.DataParser.ACTION in e&&this._mergeActionFrame(e[t.DataParser.ACTION],a,0,i,r),t.DataParser.EVENTS in e&&this._mergeActionFrame(e[t.DataParser.EVENTS],a,10,i,r),t.DataParser.ACTIONS in e&&this._mergeActionFrame(e[t.DataParser.ACTIONS],a,0,i,r)},i.prototype._mergeActionFrame=function(t,e,i,r,n){for(var s=this._armature.actions.length,o=this._parseActionData(t,i,r,n),l=0,h=null,u=0,_=o;u<_.length;u++){var f=_[u];this._armature.addAction(f,!1)}0===this._actionFrames.length&&((h=new a).frameStart=0,this._actionFrames.push(h),h=null);for(var m=0,p=this._actionFrames;me)break;l++}null===h&&((h=new a).frameStart=e,this._actionFrames.splice(l,0,h));for(var d=0;d0){var m=r.getBone(_);null!==m?f.parent=m:(_ in this._cacheBones||(this._cacheBones[_]=[]),this._cacheBones[_].push(f))}if(f.name in this._cacheBones){for(var p=0,c=this._cacheBones[f.name];p0&&null!==a.parent?(s.root=a.parent,s.bone=a):(s.root=a,s.bone=null),s},i.prototype._parsePathConstraint=function(e){var a=this._armature.getSlot(i._getString(e,t.DataParser.TARGET,""));if(null===a)return null;var r=this._armature.defaultSkin;if(null===r)return null;var n=r.getDisplay(a.name,i._getString(e,t.DataParser.TARGET_DISPLAY,a.name));if(null===n||!(n instanceof t.PathDisplayData))return null;var s=e[t.DataParser.BONES];if(null===s||0===s.length)return null;var o=t.BaseObject.borrowObject(t.PathConstraintData);o.name=i._getString(e,t.DataParser.NAME,""),o.type=1,o.pathSlot=a,o.pathDisplayData=n,o.target=a.parent,o.positionMode=t.DataParser._getPositionMode(i._getString(e,t.DataParser.POSITION_MODE,"")),o.spacingMode=t.DataParser._getSpacingMode(i._getString(e,t.DataParser.SPACING_MODE,"")),o.rotateMode=t.DataParser._getRotateMode(i._getString(e,t.DataParser.ROTATE_MODE,"")),o.position=i._getNumber(e,t.DataParser.POSITION,0),o.spacing=i._getNumber(e,t.DataParser.SPACING,0),o.rotateOffset=i._getNumber(e,t.DataParser.ROTATE_OFFSET,0),o.rotateMix=i._getNumber(e,t.DataParser.ROTATE_MIX,1),o.translateMix=i._getNumber(e,t.DataParser.TRANSLATE_MIX,1);for(var l=0,h=s;l0?r:a,this._parsePivot(e,o);break;case 1:var l=s=t.BaseObject.borrowObject(t.ArmatureDisplayData);if(l.name=a,l.path=r.length>0?r:a,l.inheritAnimation=!0,t.DataParser.ACTIONS in e)for(var h=0,u=this._parseActionData(e[t.DataParser.ACTIONS],0,null,null);h0?r:a,t.DataParser.SHARE in e?(c.geometry.data=this._data,this._cacheRawMeshes.push(e),this._cacheMeshes.push(c)):this._parseMesh(e,c);break;case 3:var d=this._parseBoundingBox(e);if(null!==d){var y=s=t.BaseObject.borrowObject(t.BoundingBoxDisplayData);y.name=a,y.path=r.length>0?r:a,y.boundingBox=d}break;case 4:var g=e[t.DataParser.LENGTHS],D=s=t.BaseObject.borrowObject(t.PathDisplayData);D.closed=i._getBoolean(e,t.DataParser.CLOSED,!1),D.constantSpeed=i._getBoolean(e,t.DataParser.CONSTANT_SPEED,!1),D.name=a,D.path=r.length>0?r:a,D.curveLengths.length=g.length;for(var v=0,T=g.length;va.width&&(a.width=l),ha.height&&(a.height=h))}a.width-=a.x,a.height-=a.y}else console.warn("Data error.\n Please reexport DragonBones Data to fixed the bug.");return a},i.prototype._parseAnimation=function(e){var a=t.BaseObject.borrowObject(t.AnimationData);if(a.blendType=t.DataParser._getAnimationBlendType(i._getString(e,t.DataParser.BLEND_TYPE,"")),a.frameCount=i._getNumber(e,t.DataParser.DURATION,0),a.playTimes=i._getNumber(e,t.DataParser.PLAY_TIMES,1),a.duration=a.frameCount/this._armature.frameRate,a.fadeInTime=i._getNumber(e,t.DataParser.FADE_IN_TIME,0),a.scale=i._getNumber(e,t.DataParser.SCALE,1),a.name=i._getString(e,t.DataParser.NAME,t.DataParser.DEFAULT_NAME),0===a.name.length&&(a.name=t.DataParser.DEFAULT_NAME),a.frameIntOffset=this._frameIntArray.length,a.frameFloatOffset=this._frameFloatArray.length,a.frameOffset=this._frameArray.length,this._animation=a,t.DataParser.FRAME in e){var r=e[t.DataParser.FRAME],n=r.length;if(n>0)for(var s=0,o=0;s0&&(this._animation.actionTimeline=this._parseTimeline(null,this._actionFrames,"",0,0,0,this._parseActionFrame),this._actionFrames.length=0),t.DataParser.TIMELINE in e)for(var b=0,A=e[t.DataParser.TIMELINE];b0&&n in e&&(r=e[n]),null===r)return null;var _=r.length;if(0===_)return null;var f=this._frameIntArray.length,m=this._frameFloatArray.length,p=this._timelineArray.length;switch(null===u&&(u=t.BaseObject.borrowObject(t.TimelineData)),u.type=s,u.offset=p,this._frameValueType=o,this._timeline=u,this._timelineArray.length+=5+_,null!==e?(this._timelineArray[p+0]=Math.round(100*i._getNumber(e,t.DataParser.SCALE,1)),this._timelineArray[p+1]=Math.round(100*i._getNumber(e,t.DataParser.OFFSET,0))):(this._timelineArray[p+0]=100,this._timelineArray[p+1]=0),this._timelineArray[p+2]=_,this._timelineArray[p+3]=l,this._frameValueType){case 0:this._timelineArray[p+4]=0;break;case 1:this._timelineArray[p+4]=f-this._animation.frameIntOffset;break;case 2:this._timelineArray[p+4]=m-this._animation.frameFloatOffset}if(1===_)u.frameIndicesOffset=-1,this._timelineArray[p+5+0]=h.call(this,r[0],0,0)-this._animation.frameOffset;else{var c=this._animation.frameCount+1,d=this._data.frameIndices,y=d.length;d.length+=c,u.frameIndicesOffset=y;for(var g=0,D=0,v=0,T=0;g0)if(t.DataParser.CURVE in e){var s=r+1;this._helpArray.length=s;var o=this._samplingEasingCurve(e[t.DataParser.CURVE],this._helpArray);this._frameArray.length+=2+this._helpArray.length,this._frameArray[n+1]=2,this._frameArray[n+2]=o?s:-s;for(var l=0;l0){for(var s=this._armature.sortedSlots.length,o=new Array(s-n.length/2),l=new Array(s),h=0;h0?n>=this._prevRotation:n<=this._prevRotation)&&(this._prevClockwise=this._prevClockwise>0?this._prevClockwise-1:this._prevClockwise+1),n=this._prevRotation+n-this._prevRotation+t.Transform.PI_D*this._prevClockwise)),this._prevClockwise=i._getNumber(e,t.DataParser.TWEEN_ROTATE,0),this._prevRotation=n;var s=this._parseTweenFrame(e,a,r),o=this._frameFloatArray.length;return this._frameFloatArray.length+=6,this._frameFloatArray[o++]=this._helpTransform.x,this._frameFloatArray[o++]=this._helpTransform.y,this._frameFloatArray[o++]=n,this._frameFloatArray[o++]=this._helpTransform.skew,this._frameFloatArray[o++]=this._helpTransform.scaleX,this._frameFloatArray[o++]=this._helpTransform.scaleY,this._parseActionDataInFrame(e,a,this._bone,this._slot),s},i.prototype._parseBoneTranslateFrame=function(e,a,r){var n=this._parseTweenFrame(e,a,r),s=this._frameFloatArray.length;return this._frameFloatArray.length+=2,this._frameFloatArray[s++]=i._getNumber(e,t.DataParser.X,0),this._frameFloatArray[s++]=i._getNumber(e,t.DataParser.Y,0),n},i.prototype._parseBoneRotateFrame=function(e,a,r){var n=i._getNumber(e,t.DataParser.ROTATE,0)*t.Transform.DEG_RAD;0!==a&&(0===this._prevClockwise?n=this._prevRotation+t.Transform.normalizeRadian(n-this._prevRotation):((this._prevClockwise>0?n>=this._prevRotation:n<=this._prevRotation)&&(this._prevClockwise=this._prevClockwise>0?this._prevClockwise-1:this._prevClockwise+1),n=this._prevRotation+n-this._prevRotation+t.Transform.PI_D*this._prevClockwise)),this._prevClockwise=i._getNumber(e,t.DataParser.CLOCK_WISE,0),this._prevRotation=n;var s=this._parseTweenFrame(e,a,r),o=this._frameFloatArray.length;return this._frameFloatArray.length+=2,this._frameFloatArray[o++]=n,this._frameFloatArray[o++]=i._getNumber(e,t.DataParser.SKEW,0)*t.Transform.DEG_RAD,s},i.prototype._parseBoneScaleFrame=function(e,a,r){var n=this._parseTweenFrame(e,a,r),s=this._frameFloatArray.length;return this._frameFloatArray.length+=2,this._frameFloatArray[s++]=i._getNumber(e,t.DataParser.X,1),this._frameFloatArray[s++]=i._getNumber(e,t.DataParser.Y,1),n},i.prototype._parseSlotDisplayFrame=function(e,a,r){var n=this._parseFrame(e,a,r);return this._frameArray.length+=1,t.DataParser.VALUE in e?this._frameArray[n+1]=i._getNumber(e,t.DataParser.VALUE,0):this._frameArray[n+1]=i._getNumber(e,t.DataParser.DISPLAY_INDEX,0),this._parseActionDataInFrame(e,a,this._slot.parent,this._slot),n},i.prototype._parseSlotColorFrame=function(e,a,i){var r=this._parseTweenFrame(e,a,i),n=-1;if(t.DataParser.VALUE in e||t.DataParser.COLOR in e){var s=t.DataParser.VALUE in e?e[t.DataParser.VALUE]:e[t.DataParser.COLOR];for(var o in s){this._parseColorTransform(s,this._helpColorTransform),n=this._colorArray.length,this._colorArray.length+=8,this._colorArray[n++]=Math.round(100*this._helpColorTransform.alphaMultiplier),this._colorArray[n++]=Math.round(100*this._helpColorTransform.redMultiplier),this._colorArray[n++]=Math.round(100*this._helpColorTransform.greenMultiplier),this._colorArray[n++]=Math.round(100*this._helpColorTransform.blueMultiplier),this._colorArray[n++]=Math.round(this._helpColorTransform.alphaOffset),this._colorArray[n++]=Math.round(this._helpColorTransform.redOffset),this._colorArray[n++]=Math.round(this._helpColorTransform.greenOffset),this._colorArray[n++]=Math.round(this._helpColorTransform.blueOffset),n-=8;break}}n<0&&(this._defaultColorOffset<0&&(this._defaultColorOffset=n=this._colorArray.length,this._colorArray.length+=8,this._colorArray[n++]=100,this._colorArray[n++]=100,this._colorArray[n++]=100,this._colorArray[n++]=100,this._colorArray[n++]=0,this._colorArray[n++]=0,this._colorArray[n++]=0,this._colorArray[n++]=0),n=this._defaultColorOffset);var l=this._frameIntArray.length;return this._frameIntArray.length+=1,this._frameIntArray[l]=n,r},i.prototype._parseSlotDeformFrame=function(e,a,r){var n=this._frameFloatArray.length,s=this._parseTweenFrame(e,a,r),o=t.DataParser.VERTICES in e?e[t.DataParser.VERTICES]:null,l=i._getNumber(e,t.DataParser.OFFSET,0),h=this._intArray[this._mesh.geometry.offset+0],u=this._mesh.parent.name+"_"+this._slot.name+"_"+this._mesh.name,_=this._mesh.geometry.weight,f=0,m=0,p=0,c=0;if(null!==_){var d=this._weightSlotPose[u];this._helpMatrixA.copyFromArray(d,0),this._frameFloatArray.length+=2*_.count,p=_.offset+2+_.bones.length}else this._frameFloatArray.length+=2*h;for(var y=0;y<2*h;y+=2)if(null===o?(f=0,m=0):(f=y=o.length?0:o[y-l],m=y+1=o.length?0:o[y+1-l]),null!==_){var g=this._weightBonePoses[u],D=this._intArray[p++];this._helpMatrixA.transformPoint(f,m,this._helpPoint,!0),f=this._helpPoint.x,m=this._helpPoint.y;for(var v=0;v=o.length?0:o[f-l],_=f+1=o.length?0:o[f+1-l]):(u=0,_=0),this._frameFloatArray[n+f]=u,this._frameFloatArray[n+f+1]=_}if(0===a){var m=this._frameIntArray.length;this._frameIntArray.length+=5,this._frameIntArray[m+0]=this._geometry.offset,this._frameIntArray[m+1]=this._frameFloatArray.length-n,this._frameIntArray[m+2]=this._frameFloatArray.length-n,this._frameIntArray[m+3]=0,this._frameIntArray[m+4]=n-this._animation.frameFloatOffset,this._timelineArray[this._timeline.offset+3]=m-this._animation.frameIntOffset}return s},i.prototype._parseTransform=function(e,a,r){a.x=i._getNumber(e,t.DataParser.X,0)*r,a.y=i._getNumber(e,t.DataParser.Y,0)*r,t.DataParser.ROTATE in e||t.DataParser.SKEW in e?(a.rotation=t.Transform.normalizeRadian(i._getNumber(e,t.DataParser.ROTATE,0)*t.Transform.DEG_RAD),a.skew=t.Transform.normalizeRadian(i._getNumber(e,t.DataParser.SKEW,0)*t.Transform.DEG_RAD)):(t.DataParser.SKEW_X in e||t.DataParser.SKEW_Y in e)&&(a.rotation=t.Transform.normalizeRadian(i._getNumber(e,t.DataParser.SKEW_Y,0)*t.Transform.DEG_RAD),a.skew=t.Transform.normalizeRadian(i._getNumber(e,t.DataParser.SKEW_X,0)*t.Transform.DEG_RAD)-a.rotation),a.scaleX=i._getNumber(e,t.DataParser.SCALE_X,1),a.scaleY=i._getNumber(e,t.DataParser.SCALE_Y,1)},i.prototype._parseColorTransform=function(e,a){a.alphaMultiplier=.01*i._getNumber(e,t.DataParser.ALPHA_MULTIPLIER,100),a.redMultiplier=.01*i._getNumber(e,t.DataParser.RED_MULTIPLIER,100),a.greenMultiplier=.01*i._getNumber(e,t.DataParser.GREEN_MULTIPLIER,100),a.blueMultiplier=.01*i._getNumber(e,t.DataParser.BLUE_MULTIPLIER,100),a.alphaOffset=i._getNumber(e,t.DataParser.ALPHA_OFFSET,0),a.redOffset=i._getNumber(e,t.DataParser.RED_OFFSET,0),a.greenOffset=i._getNumber(e,t.DataParser.GREEN_OFFSET,0),a.blueOffset=i._getNumber(e,t.DataParser.BLUE_OFFSET,0)},i.prototype._parseGeometry=function(e,a){var i=e[t.DataParser.VERTICES],r=Math.floor(i.length/2),n=0,s=this._intArray.length,o=this._floatArray.length;a.offset=s,a.data=this._data,this._intArray.length+=4,this._intArray[s+0]=r,this._intArray[s+2]=o,this._intArray[s+3]=-1,this._floatArray.length+=2*r;for(var l=0,h=2*r;l=0||t.DataParser.DATA_VERSIONS.indexOf(n)>=0){var s=t.BaseObject.borrowObject(t.DragonBonesData);if(s.version=r,s.name=i._getString(e,t.DataParser.NAME,""),s.frameRate=i._getNumber(e,t.DataParser.FRAME_RATE,24),0===s.frameRate&&(s.frameRate=24),t.DataParser.ARMATURE in e){this._data=s,this._parseArray(e);for(var o=0,l=e[t.DataParser.ARMATURE];o0&&(s.stage=s.getArmature(s.armatureNames[0])),this._data=null}return t.DataParser.TEXTURE_ATLAS in e&&(this._rawTextureAtlases=e[t.DataParser.TEXTURE_ATLAS]),s}return console.assert(!1,"Nonsupport data version: "+r+"\nPlease convert DragonBones data to support version.\nRead more: https://github.com/DragonBones/Tools/"),null},i.prototype.parseTextureAtlasData=function(e,a,r){if(void 0===r&&(r=1),console.assert(void 0!==e),null===e){if(null===this._rawTextureAtlases||0===this._rawTextureAtlases.length)return!1;var n=this._rawTextureAtlases[this._rawTextureAtlasIndex++];return this.parseTextureAtlasData(n,a,r),this._rawTextureAtlasIndex>=this._rawTextureAtlases.length&&(this._rawTextureAtlasIndex=0,this._rawTextureAtlases=null),!0}if(a.width=i._getNumber(e,t.DataParser.WIDTH,0),a.height=i._getNumber(e,t.DataParser.HEIGHT,0),a.scale=1===r?1/i._getNumber(e,t.DataParser.SCALE,1):r,a.name=i._getString(e,t.DataParser.NAME,""),a.imagePath=i._getString(e,t.DataParser.IMAGE_PATH,""),t.DataParser.SUB_TEXTURE in e)for(var s=e[t.DataParser.SUB_TEXTURE],o=0,l=s.length;o0&&_>0&&(f.frame=t.TextureData.createRectangle(),f.frame.x=i._getNumber(h,t.DataParser.FRAME_X,0),f.frame.y=i._getNumber(h,t.DataParser.FRAME_Y,0),f.frame.width=u,f.frame.height=_),a.addTexture(f)}return!0},i.getInstance=function(){return null===i._objectDataParserInstance&&(i._objectDataParserInstance=new i),i._objectDataParserInstance},i._objectDataParserInstance=null,i}(t.DataParser);t.ObjectDataParser=e;var a=function(){this.frameStart=0,this.actions=[]};t.ActionFrame=a}(l||(l={})),function(t){var e=function(e){function a(){return null!==e&&e.apply(this,arguments)||this}return f(a,e),a.prototype._inRange=function(t,e,a){return e<=t&&t<=a},a.prototype._decodeUTF8=function(t){for(var e,a=0,i="",r=0,n=0,s=0,o=0;t.length>a;){var l=t[a++];if(-1===l)e=0!==n?65533:-1;else if(0===n)this._inRange(l,0,127)?e=l:(this._inRange(l,194,223)?(n=1,o=128,r=l-192):this._inRange(l,224,239)?(n=2,o=2048,r=l-224):this._inRange(l,240,244)&&(n=3,o=65536,r=l-240),r*=Math.pow(64,n),e=null);else if(this._inRange(l,128,191))if(s+=1,r+=(l-128)*Math.pow(64,n-s),s!==n)e=null;else{var h=r,u=o;r=0,n=0,s=0,o=0,e=this._inRange(h,u,1114111)&&!this._inRange(h,55296,57343)?h:l}else r=0,n=0,s=0,o=0,a--,e=l;null!==e&&-1!==e&&(e<=65535?e>0&&(i+=String.fromCharCode(e)):(e-=65536,i+=String.fromCharCode(55296+(e>>10&1023)),i+=String.fromCharCode(56320+(1023&e))))}return i},a.prototype._parseBinaryTimeline=function(e,a,i){void 0===i&&(i=null);var r=null!==i?i:t.BaseObject.borrowObject(t.TimelineData);r.type=e,r.offset=a,this._timeline=r;var n=this._timelineArrayBuffer[r.offset+2];if(1===n)r.frameIndicesOffset=-1;else{var s,o=this._animation.frameCount+1,l=this._data.frameIndices;s=l.length,l.length+=o,r.frameIndicesOffset=s;for(var h=0,u=0,_=0,f=0;h=0){u=t.ObjectDataParser._getNumber(y,t.DataParser.TYPE,0);var g=t.ObjectDataParser._getString(y,t.DataParser.NAME,"");if(f=null,40===u&&0!==a.blendType){var D=f=t.BaseObject.borrowObject(t.AnimationTimelineData);D.x=t.ObjectDataParser._getNumber(y,t.DataParser.X,0),D.y=t.ObjectDataParser._getNumber(y,t.DataParser.Y,0)}switch(f=this._parseBinaryTimeline(u,_,f),u){case 0:case 1:break;case 11:case 12:case 13:case 50:case 60:this._animation.addBoneTimeline(g,f);break;case 20:case 21:case 22:case 23:case 24:this._animation.addSlotTimeline(g,f);break;case 30:this._animation.addConstraintTimeline(g,f);break;case 40:case 41:case 42:this._animation.addAnimationTimeline(g,f)}}}return this._animation=null,a},a.prototype._parseGeometry=function(e,a){a.offset=e[t.DataParser.OFFSET],a.data=this._data;var i=this._intArrayBuffer[a.offset+3];if(i>=0){var r=t.BaseObject.borrowObject(t.WeightData),n=this._intArrayBuffer[a.offset+0],s=this._intArrayBuffer[i+0];r.offset=i;for(var o=0;o12?a[13]:0,u=new Int16Array(this._binary,this._binaryOffset+a[0],i/Int16Array.BYTES_PER_ELEMENT),_=new Float32Array(this._binary,this._binaryOffset+a[2],r/Float32Array.BYTES_PER_ELEMENT),f=new Int16Array(this._binary,this._binaryOffset+a[4],n/Int16Array.BYTES_PER_ELEMENT),m=new Float32Array(this._binary,this._binaryOffset+a[6],s/Float32Array.BYTES_PER_ELEMENT),p=new Int16Array(this._binary,this._binaryOffset+a[8],o/Int16Array.BYTES_PER_ELEMENT),c=new Uint16Array(this._binary,this._binaryOffset+a[10],l/Uint16Array.BYTES_PER_ELEMENT),d=h>0?new Int16Array(this._binary,this._binaryOffset+a[12],h/Int16Array.BYTES_PER_ELEMENT):u;this._data.binary=this._binary,this._data.intArray=this._intArrayBuffer=u,this._data.floatArray=_,this._data.frameIntArray=f,this._data.frameFloatArray=m,this._data.frameArray=this._frameArrayBuffer=p,this._data.timelineArray=this._timelineArrayBuffer=c,this._data.colorArray=d},a.prototype.parseDragonBonesData=function(t,a){void 0===a&&(a=1),console.assert(null!=t&&t instanceof ArrayBuffer,"Data error.");var i=new Uint8Array(t,0,8);if(i[0]!=="D".charCodeAt(0)||i[1]!=="B".charCodeAt(0)||i[2]!=="D".charCodeAt(0)||i[3]!=="T".charCodeAt(0))return console.assert(!1,"Nonsupport data."),null;var r=new Uint32Array(t,8,1)[0],n=new Uint8Array(t,12,r),s=this._decodeUTF8(n),o=JSON.parse(s);return this._binaryOffset=12+r,this._binary=t,e.prototype.parseDragonBonesData.call(this,o,a)},a.getInstance=function(){return null===a._binaryDataParserInstance&&(a._binaryDataParserInstance=new a),a._binaryDataParserInstance},a._binaryDataParserInstance=null,a}(t.ObjectDataParser);t.BinaryDataParser=e}(l||(l={})),function(t){var e=function(){function e(a){void 0===a&&(a=null),this.autoSearch=!1,this._dragonBonesDataMap={},this._textureAtlasDataMap={},this._dragonBones=null,this._dataParser=null,null===e._objectParser&&(e._objectParser=new t.ObjectDataParser),null===e._binaryParser&&(e._binaryParser=new t.BinaryDataParser),this._dataParser=null!==a?a:e._objectParser}return e.prototype._isSupportMesh=function(){return!0},e.prototype._getTextureData=function(t,e){if(t in this._textureAtlasDataMap)for(var a=0,i=this._textureAtlasDataMap[t];a0&&e in this._dragonBonesDataMap&&(s=(n=this._dragonBonesDataMap[e]).getArmature(a)),null===s&&(0===e.length||this.autoSearch))for(var o in this._dragonBonesDataMap)if(n=this._dragonBonesDataMap[o],(0===e.length||n.autoSearch)&&null!==(s=n.getArmature(a))){e=o;break}if(null!==s){if(t.dataName=e,t.textureAtlasName=r,t.data=n,t.armature=s,t.skin=null,i.length>0&&(t.skin=s.getSkin(i),null===t.skin&&this.autoSearch))for(var o in this._dragonBonesDataMap){var l=this._dragonBonesDataMap[o].getArmature(i);if(null!==l){t.skin=l.defaultSkin;break}}return null===t.skin&&(t.skin=s.defaultSkin),!0}return!1},e.prototype._buildBones=function(e,a){for(var i=0,r=e.armature.sortedBones;i0){var c=this._getTextureData(t.textureAtlasName,p.path);_.replaceTextureData(c,f)}var d=this._getSlotDisplay(t,p,_);_.replaceDisplay(d,f)}else _.replaceDisplay(null)}}_._setDisplayIndex(h.displayIndex,!0)}}},e.prototype._buildConstraints=function(e,a){var i=e.armature.constraints;for(var r in i){var n=i[r];switch(n.type){case 0:var s=t.BaseObject.borrowObject(t.IKConstraint);s.init(n,a),a._addConstraint(s);break;case 1:var o=t.BaseObject.borrowObject(t.PathConstraint);o.init(n,a),a._addConstraint(o);break;default:var l=t.BaseObject.borrowObject(t.IKConstraint);l.init(n,a),a._addConstraint(l)}}},e.prototype._buildChildArmature=function(t,e,a){return this.buildArmature(a.path,null!==t?t.dataName:"","",null!==t?t.textureAtlasName:"")},e.prototype._getSlotDisplay=function(e,a,i){var r=null!==e?e.dataName:a.parent.parent.parent.name,n=null;switch(a.type){case 0:var s=a;null===s.texture&&(s.texture=this._getTextureData(r,a.path)),n=i.rawDisplay;break;case 2:var o=a;null===o.texture&&(o.texture=this._getTextureData(r,o.path)),n=this._isSupportMesh()?i.meshDisplay:i.rawDisplay;break;case 1:var l=a,h=this._buildChildArmature(e,i,l);if(null!==h){if(h.inheritAnimation=l.inheritAnimation,!h.inheritAnimation){var u=l.actions.length>0?l.actions:h.armatureData.defaultActions;if(u.length>0)for(var _=0,f=u;_=0)){var h=e.getDisplays(l.name);if(null!==h||(null!==n&&e!==n&&(h=n.getDisplays(l.name)),null!==h)){l.displayFrameCount=h.length;for(var u=0,_=l.displayFrameCount;u<_;++u){var f=h[u];l.replaceRawDisplayData(f,u),null!==f?l.replaceDisplay(this._getSlotDisplay(null,f,l),u):l.replaceDisplay(null,u)}r=!0}else a&&(l.displayFrameCount=0)}}return r},e.prototype.replaceAnimation=function(e,a,i){void 0===i&&(i=!0);var r=a.defaultSkin;if(null===r)return!1;if(i)e.animation.animations=a.animations;else{var n=e.animation.animations,s={};for(var o in n)s[o]=n[o];for(var o in a.animations)s[o]=a.animations[o];e.animation.animations=s}for(var l=0,h=e.getSlots();l=0&&null!==this._display&&null!==e){var a=e.parent;null!==this._armature.replacedTexture&&(null===this._armature._replaceTextureAtlasData?((a=t.BaseObject.borrowObject(t.PixiTextureAtlasData)).copyFrom(e.parent),a.renderTexture=this._armature.replacedTexture,this._armature._replaceTextureAtlasData=a):a=this._armature._replaceTextureAtlasData,e=a.getTexture(e.name));var i=e.renderTexture;if(null!==i){if(null!==this._geometryData){var r=this._geometryData.data,n=r.intArray,s=r.floatArray,o=n[this._geometryData.offset+0],l=n[this._geometryData.offset+1],h=n[this._geometryData.offset+2];h<0&&(h+=65536);var u=h+2*o,_=this._armature._armatureData.scale,f=this._renderDisplay,m=a.width>0?a.width:i.baseTexture.width,p=a.height>0?a.height:i.baseTexture.height,c=e.region;f.vertices=new Float32Array(2*o),f.uvs=new Float32Array(2*o),f.indices=new Uint16Array(3*l);for(var d=0,y=2*o;d0&&i.inheritDeform,s=this._renderDisplay;if(null!==r){var o=(S=i.data).intArray,l=S.floatArray,h=o[i.offset+0],u=o[r.offset+1];u<0&&(u+=65536);for(var _=0,f=0,m=r.offset+2+a.length,p=u,c=0;_{d.parseDragonBonesData(t.ske,e),d.parseTextureAtlasData(t.tex,a.Texture.from(t.image),e)})),e.resource.registerDestroy(e.RESOURCE_TYPE.DRAGONBONE,(({name:t})=>{d.removeDragonBonesData(t),d.removeTextureAtlasData(t)}));let y=class extends i.Renderer{constructor(){super(...arguments),this.name="DragonBone",this.armatures={},this.autoPlay={},this.isRemovedMap=new Map}init(){this.renderSystem=this.game.getSystem(i.RendererSystem),this.renderSystem.rendererManager.register(this),a.ticker.shared.add(m.PixiFactory._clockHandler,m.PixiFactory)}componentChanged(t){return n(this,void 0,void 0,(function*(){if(this.autoPlay[t.gameObject.id]=t.component.autoPlay,"DragonBone"===t.componentName)if(t.type===e.OBSERVER_TYPE.ADD)this.add(t);else if(t.type===e.OBSERVER_TYPE.CHANGE)switch(t.prop.prop[0]){case"armature":this.change(t)}else t.type===e.OBSERVER_TYPE.REMOVE&&this.remove(t)}))}add(t){return n(this,void 0,void 0,(function*(){const a=t.component;if(this.isRemovedMap.delete(a),yield e.resource.getResource(a.resource),this.isRemovedMap.get(a))return void this.isRemovedMap.delete(a);const i=new p({armatureName:a.armatureName});this.armatures[t.gameObject.id]=i,this.renderSystem.containerManager.getContainer(t.gameObject.id).addChildAt(i.armature,0),a.armature=i;for(const t in c)i.armature.on(c[t],(e=>{a.emit(c[t],e)}))}))}change(t){if(this.remove(t),this.add(t),this.autoPlay[t.gameObject.id]){const e=t.component;e.play(e.animationName)}}remove(t){const a=this.armatures[t.gameObject.id];if(!a)return void this.isRemovedMap.set(t.component,!0);this.autoPlay[t.gameObject.id]=a.armature.animation.isPlaying,this.renderSystem.containerManager.getContainer(t.gameObject.id).removeChild(a.armature),a.armature.removeAllListeners(),a.armature.destroy(!0);const i=t.component;i.armature=null,delete this.armatures[t.gameObject.id],t.type===e.OBSERVER_TYPE.CHANGE&&(delete this.autoPlay[t.gameObject.id],i.removeAllListeners())}};y.systemName="DragonBone",y=r([e.decorators.componentObserver({DragonBone:["armatureName"]})],y);var g=y;t.DragonBone=s,t.DragonBoneSystem=g,Object.defineProperty(t,"__esModule",{value:!0})},"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@eva/eva.js"),require("pixi.js"),require("@eva/plugin-renderer")):"function"==typeof define&&define.amd?define(["exports","@eva/eva.js","pixi.js","@eva/plugin-renderer"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).EVA=t.EVA||{},t.EVA.plugin=t.EVA.plugin||{},t.EVA.plugin.renderer=t.EVA.plugin.renderer||{},t.EVA.plugin.renderer.dragonbone={}),t.EVA,t.PIXI,t.EVA.plugin.renderer); diff --git a/dist/cdn/min/EVA.plugin.renderer.event.min.js b/dist/cdn/min/EVA.plugin.renderer.event.min.js deleted file mode 100644 index f85244a6..00000000 --- a/dist/cdn/min/EVA.plugin.renderer.event.min.js +++ /dev/null @@ -1 +0,0 @@ -var e,t;e=this,t=function(e,t,o,n){"use strict";var a;e.HIT_AREA_TYPE=void 0,(a=e.HIT_AREA_TYPE||(e.HIT_AREA_TYPE={})).Circle="Circle",a.Ellipse="Ellipse",a.Polygon="Polygon",a.Rect="Rect",a.RoundedRect="RoundedRect";class i extends t.Component{constructor(){super(...arguments),this.hitArea=void 0}init(e){e&&Object.assign(this,e)}}i.componentName="Event";const r={Circle:n.Circle,Ellipse:n.Ellipse,Polygon:n.Polygon,Rect:n.Rectangle,RoundedRect:n.RoundedRectangle},d={Circle:["x","y","radius"],Ellipse:["x","y","width","height"],Rect:["x","y","width","height"],RoundedRect:["x","y","width","height","radius"],Polygon:["paths"]};let s=class extends o.Renderer{constructor(){super(...arguments),this.name="Event"}init({moveWhenInside:e=!1}={}){this.renderSystem=this.game.getSystem(o.RendererSystem),this.renderSystem.rendererManager.register(this);try{this.renderSystem.application.renderer.plugins.interaction.moveWhenInside=e}catch(e){console.error("Setting moveWhenInside error.",e)}}componentChanged(e){switch(e.type){case t.OBSERVER_TYPE.ADD:this.add(e);break;case t.OBSERVER_TYPE.REMOVE:this.remove(e);break;case t.OBSERVER_TYPE.CHANGE:this.change(e)}}add(e){const t=this.containerManager.getContainer(e.gameObject.id);t.interactive=!0,t.interactiveChildren=!0;const o=e.component;o.hitArea&&this.addHitArea(e,t,o.hitArea),t.on("pointertap",(e=>{o.emit("tap",{stopPropagation:()=>e.stopPropagation(),data:{pointerId:e.data.pointerId,position:{x:e.data.global.x,y:e.data.global.y}},gameObject:o.gameObject})})),t.on("pointerdown",(e=>{o.emit("touchstart",{stopPropagation:()=>e.stopPropagation(),data:{pointerId:e.data.pointerId,position:{x:e.data.global.x,y:e.data.global.y}},gameObject:o.gameObject})})),t.on("pointermove",(e=>{o.emit("touchmove",{stopPropagation:()=>e.stopPropagation(),data:{pointerId:e.data.pointerId,position:{x:e.data.global.x,y:e.data.global.y}},gameObject:o.gameObject})})),t.on("pointerup",(e=>{o.emit("touchend",{stopPropagation:()=>e.stopPropagation(),data:{pointerId:e.data.pointerId,position:{x:e.data.global.x,y:e.data.global.y}},gameObject:o.gameObject})})),t.on("pointerupoutside",(e=>{o.emit("touchendoutside",{stopPropagation:()=>e.stopPropagation(),data:{pointerId:e.data.pointerId,position:{x:e.data.global.x,y:e.data.global.y}},gameObject:o.gameObject})})),t.on("pointercancel",(e=>{o.emit("touchcancel",{stopPropagation:()=>e.stopPropagation(),data:{pointerId:e.data.pointerId,position:{x:e.data.global.x,y:e.data.global.y}},gameObject:o.gameObject})}))}remove(e){const t=this.containerManager.getContainer(e.gameObject.id);t.interactive=!1,t.off("tap"),t.off("pointerdown"),t.off("pointermove"),t.off("pointerup"),t.off("pointerupoutside"),t.off("pointercancel"),e.component.removeAllListeners()}change(e){const t=this.containerManager.getContainer(e.gameObject.id);t.interactive=!0;const o=e.component;o.hitArea?this.addHitArea(e,t,o.hitArea):o.hitArea=null}addHitArea(e,t,o){const{type:n,style:a}=o;if(!r[n])return void console.error(`${e.gameObject.name}'s hitArea type is not defined`);const i=[];for(const e of d[n])i.push(a[e]);const s=new r[n](...i);t.hitArea=s}};s.systemName="Event",s=function(e,t,o,n){var a,i=arguments.length,r=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,o):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,o,n);else for(var d=e.length-1;d>=0;d--)(a=e[d])&&(r=(i<3?a(r):i>3?a(t,o,r):a(t,o))||r);return i>3&&r&&Object.defineProperty(t,o,r),r}([t.decorators.componentObserver({Event:[{prop:["hitArea"],deep:!0}]})],s);var p=s;e.Event=i,e.EventSystem=p,Object.defineProperty(e,"__esModule",{value:!0})},"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@eva/eva.js"),require("@eva/plugin-renderer"),require("pixi.js")):"function"==typeof define&&define.amd?define(["exports","@eva/eva.js","@eva/plugin-renderer","pixi.js"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).EVA=e.EVA||{},e.EVA.plugin=e.EVA.plugin||{},e.EVA.plugin.renderer=e.EVA.plugin.renderer||{},e.EVA.plugin.renderer.event={}),e.EVA,e.EVA.plugin.renderer,e.PIXI); diff --git a/dist/cdn/min/EVA.plugin.renderer.graphics.min.js b/dist/cdn/min/EVA.plugin.renderer.graphics.min.js deleted file mode 100644 index 310dcc65..00000000 --- a/dist/cdn/min/EVA.plugin.renderer.graphics.min.js +++ /dev/null @@ -1 +0,0 @@ -var e,n;e=this,n=function(e,n,r,t){"use strict";class i extends r.Graphics{}class s extends n.Component{constructor(){super(...arguments),this.graphics=null}init(){this.graphics=new i}}function o(e,n,r,t){return new(r||(r=Promise))((function(i,s){function o(e){try{a(t.next(e))}catch(e){s(e)}}function c(e){try{a(t.throw(e))}catch(e){s(e)}}function a(e){var n;e.done?i(e.value):(n=e.value,n instanceof r?n:new r((function(e){e(n)}))).then(o,c)}a((t=t.apply(e,n||[])).next())}))}s.componentName="Graphics";let c=class extends t.Renderer{constructor(){super(...arguments),this.name="Graphics"}init(){this.renderSystem=this.game.getSystem(t.RendererSystem),this.renderSystem.rendererManager.register(this)}componentChanged(e){return o(this,void 0,void 0,(function*(){e.type===n.OBSERVER_TYPE.ADD?this.containerManager.getContainer(e.gameObject.id).addChildAt(e.component.graphics,0):e.type===n.OBSERVER_TYPE.REMOVE&&(this.containerManager.getContainer(e.gameObject.id).removeChild(e.component.graphics),e.component.graphics.destroy(!0))}))}};c.systemName="Graphics",c=function(e,n,r,t){var i,s=arguments.length,o=s<3?n:null===t?t=Object.getOwnPropertyDescriptor(n,r):t;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,n,r,t);else for(var c=e.length-1;c>=0;c--)(i=e[c])&&(o=(s<3?i(o):s>3?i(n,r,o):i(n,r))||o);return s>3&&o&&Object.defineProperty(n,r,o),o}([n.decorators.componentObserver({Graphics:["graphics"]})],c);var a=c;e.Graphics=s,e.GraphicsSystem=a,Object.defineProperty(e,"__esModule",{value:!0})},"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("@eva/eva.js"),require("pixi.js"),require("@eva/plugin-renderer")):"function"==typeof define&&define.amd?define(["exports","@eva/eva.js","pixi.js","@eva/plugin-renderer"],n):n(((e="undefined"!=typeof globalThis?globalThis:e||self).EVA=e.EVA||{},e.EVA.plugin=e.EVA.plugin||{},e.EVA.plugin.renderer=e.EVA.plugin.renderer||{},e.EVA.plugin.renderer.graphics={}),e.EVA,e.PIXI,e.EVA.plugin.renderer); diff --git a/dist/cdn/min/EVA.plugin.renderer.img.min.js b/dist/cdn/min/EVA.plugin.renderer.img.min.js deleted file mode 100644 index 10579287..00000000 --- a/dist/cdn/min/EVA.plugin.renderer.img.min.js +++ /dev/null @@ -1 +0,0 @@ -var e,r;e=this,r=function(e,r,t,n,i){"use strict";function s(e,r,t,n){var i,s=arguments.length,o=s<3?r:null===n?n=Object.getOwnPropertyDescriptor(r,t):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,r,t,n);else for(var c=e.length-1;c>=0;c--)(i=e[c])&&(o=(s<3?i(o):s>3?i(r,t,o):i(r,t))||o);return s>3&&o&&Object.defineProperty(r,t,o),o}function o(e,r,t,n){return new(t||(t=Promise))((function(i,s){function o(e){try{a(n.next(e))}catch(e){s(e)}}function c(e){try{a(n.throw(e))}catch(e){s(e)}}function a(e){var r;e.done?i(e.value):(r=e.value,r instanceof t?r:new t((function(e){e(r)}))).then(o,c)}a((n=n.apply(e,r||[])).next())}))}class c extends r.Component{constructor(){super(...arguments),this.resource=""}init(e){e&&e.resource&&(this.resource=e.resource)}}c.componentName="Img",s([r.decorators.IDEProp],c.prototype,"resource",void 0),r.resource.registerInstance(r.RESOURCE_TYPE.IMAGE,(({data:e={}})=>{const{image:r}=e;if(r)return i.Texture.from(r)})),r.resource.registerDestroy(r.RESOURCE_TYPE.IMAGE,(({instance:e})=>{e&&e.destroy(!0)}));let a=class extends t.Renderer{constructor(){super(...arguments),this.name="Img",this.imgs={}}init(){this.renderSystem=this.game.getSystem(t.RendererSystem),this.renderSystem.rendererManager.register(this)}rendererUpdate(e){const{width:r,height:t}=e.transform.size;this.imgs[e.id]&&(this.imgs[e.id].sprite.width=r,this.imgs[e.id].sprite.height=t)}componentChanged(e){return o(this,void 0,void 0,(function*(){if("Img"===e.componentName){const t=e.component;if(e.type===r.OBSERVER_TYPE.ADD){const i=new n.Sprite(null);r.resource.getResource(t.resource).then((({instance:r})=>{r||console.error(`GameObject:${e.gameObject.name}'s Img resource load error`),i.image=r})),this.imgs[e.gameObject.id]=i,this.containerManager.getContainer(e.gameObject.id).addChildAt(i.sprite,0)}else if(e.type===r.OBSERVER_TYPE.CHANGE){const{instance:n}=yield r.resource.getResource(t.resource);n||console.error(`GameObject:${e.gameObject.name}'s Img resource load error`),this.imgs[e.gameObject.id].image=n}else if(e.type===r.OBSERVER_TYPE.REMOVE){const r=this.imgs[e.gameObject.id];this.containerManager.getContainer(e.gameObject.id).removeChild(r.sprite),r.sprite.destroy(!0),delete this.imgs[e.gameObject.id]}}}))}};a.systemName="Img",a=s([r.decorators.componentObserver({Img:[{prop:["resource"],deep:!1}]})],a);var d=a;e.Img=c,e.ImgSystem=d,Object.defineProperty(e,"__esModule",{value:!0})},"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("@eva/eva.js"),require("@eva/plugin-renderer"),require("@eva/renderer-adapter"),require("pixi.js")):"function"==typeof define&&define.amd?define(["exports","@eva/eva.js","@eva/plugin-renderer","@eva/renderer-adapter","pixi.js"],r):r(((e="undefined"!=typeof globalThis?globalThis:e||self).EVA=e.EVA||{},e.EVA.plugin=e.EVA.plugin||{},e.EVA.plugin.renderer=e.EVA.plugin.renderer||{},e.EVA.plugin.renderer.img={}),e.EVA,e.EVA.plugin.renderer,e.EVA.rendererAdapter,e.PIXI); diff --git a/dist/cdn/min/EVA.plugin.renderer.lottie.min.js b/dist/cdn/min/EVA.plugin.renderer.lottie.min.js deleted file mode 100644 index 98ce14ab..00000000 --- a/dist/cdn/min/EVA.plugin.renderer.lottie.min.js +++ /dev/null @@ -1 +0,0 @@ -var t,s;t=this,s=function(t,s,e,i){"use strict";function h(t,s,e,i){var h,r=arguments.length,n=r<3?s:null===i?i=Object.getOwnPropertyDescriptor(s,e):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,s,e,i);else for(var a=t.length-1;a>=0;a--)(h=t[a])&&(n=(r<3?h(n):r>3?h(s,e,n):h(s,e))||n);return r>3&&n&&Object.defineProperty(s,e,n),n}function r(t,s,e,i){return new(e||(e=Promise))((function(h,r){function n(t){try{o(i.next(t))}catch(t){r(t)}}function a(t){try{o(i.throw(t))}catch(t){r(t)}}function o(t){var s;t.done?h(t.value):(s=t.value,s instanceof e?s:new e((function(t){t(s)}))).then(n,a)}o((i=i.apply(t,s||[])).next())}))}function n(t){return Object.prototype.toString.call(t)}const a={copyJSON:function(t){return JSON.parse(JSON.stringify(t))},isArray:function(){let t=n([]);return function(s){return n(s)===t}}(),isString:function(){let t=n("s");return function(s){return n(s)===t}}(),isNumber:function(){let t=n(1);return function(s){return n(s)===t}}(),isFunction:function(){let t=n((function(){}));return function(s){return n(s)===t}}(),isUndefined:function(t){return void 0===t},isBoolean:function(){let t=n(!0);return function(s){return n(s)===t}}(),isObject:function(){let t=n({});return function(s){return n(s)===t}}(),random:function(t,s){return this.isArray(t)?t[~~(Math.random()*t.length)]:(this.isNumber(s)||(s=t||1,t=0),t+Math.random()*(s-t))},euclideanModulo:function(t,s){return(t%s+s)%s},codomainBounce:function(t,s,e){return te?2*e-t:t},clamp:function(t,s,e){return te?e:t},inRange:(t,s,e)=>t>=s&&t<=e,getAssets(t,s){for(let e=0;e(t[0]<<16)+(t[1]<<8)+(0|t[2])};class o{constructor(){this.listeners={},this.addEventListener=this.on,this.removeEventListener=this.off}on(t,s){return a.isFunction(s)?(a.isUndefined(this.listeners[t])&&(this.listeners[t]=[]),this.listeners[t].push(s),this):this}off(t,s){if(a.isUndefined(this.listeners[t]))return this;const e=this.listeners[t];let i=e.length;if(i>0)if(s)for(;i--;)e[i]===s&&e.splice(i,1);else e.length=0;return this}once(t,s){if(!a.isFunction(s))return this;const e=i=>{s(i),this.off(t,e)};return this.on(t,e),this}emit(t,...s){if(a.isUndefined(this.listeners[t]))return this;const e=(this.listeners[t]||[]).slice(0);for(let t=0;t=0;s-=1)if("sh"==t[s].ty)if(t[s].ks.k.i)g(t[s].ks.k);else for(i=t[s].ks.k.length,e=0;ee[0]||!(e[0]>t[0])&&(t[1]>e[1]||!(e[1]>t[1])&&(t[2]>e[2]||!(e[2]>t[2])&&void 0))}let v=function(){let t=[4,4,14];function s(t){let s=t.t.d;t.t.d={k:[{s:s,t:0}]}}function e(t){let e,i=t.length;for(e=0;e=0;e-=1)if("sh"==t[e].ty)if(t[e].ks.k.i)t[e].ks.k.c=t[e].closed;else for(h=t[e].ks.k.length,i=0;i=.001?function(t,s,e,i){for(let h=0;h<4;++h){let h=C(s,e,i);if(0===h)return s;s-=(D(s,e,i)-t)/h}return s}(t,i,this.mX1,this.mX2):0===h?i:function(t,s,e,i,h){let r,n,a=0;do{n=s+(e-s)/2,r=D(n,i,h)-t,r>0?e=n:s=n}while(Math.abs(r)>1e-7&&++a<10);return n}(t,s,s+.1,this.mX1,this.mX2)},L.prototype.get=function(t){return this.mX1===this.mY1&&this.mX2===this.mY2?t:0===t?0:1===t?1:D(this._getTForX(t),this.mY1,this.mY2)};const A={};var O=function(t,s,e,i,h){const r=h||("bez_"+t+"_"+s+"_"+e+"_"+i).replace(/\./g,"p");if(A[r])return A[r];const n=new L(t,s,e,i);return A[r]=n,n};let F;function I(t){return new Array(t)}F="function"==typeof Uint8ClampedArray&&"function"==typeof Float32Array?function(t,s){return"float32"===t?new Float32Array(s):"int16"===t?new Int16Array(s):"uint8c"===t?new Uint8ClampedArray(s):void 0}:function(t,s){let e=0;const i=[];let h;switch(t){case"int16":case"uint8c":h=1;break;default:h=1.1}for(e=0;e=this._maxLength&&this.doubleArrayLength(),e){case"v":r=this.v;break;case"i":r=this.i;break;case"o":r=this.o}(!r[i]||r[i]&&!h)&&(r[i]=N.newElement()),r[i][0]=t,r[i][1]=s}setTripleAt(t,s,e,i,h,r,n,a){this.setXYAt(t,s,"v",n,a),this.setXYAt(e,i,"o",n,a),this.setXYAt(h,r,"i",n,a)}reverse(){const t=new q;t.setPathData(this.c,this._length);const s=this.v,e=this.o,i=this.i;let h=0;this.c&&(t.setTripleAt(s[0][0],s[0][1],i[0][0],i[0][1],e[0][0],e[0][1],0,!1),h=1);let r=this._length-1;const n=this._length;for(let a=h;a-.001&&n<.001}function H(t,s,e,i){let h,r=0;const n=[],a=[],o=z.newElement(),l=e.length;for(let p=0;p<200;p+=1){const c=p/199;h=0;for(let r=0;rn?-1:1;let s=!0;for(;s;)if(i[r]<=n&&i[r+1]>n?(a=(n-i[r])/(i[r+1]-i[r]),s=!1):r+=t,r<0||r>=h-1){if(r===h-1)return e[r];s=!1}return e[r]+(e[r+1]-e[r])*a}}const tt=F("float32",8);var st={getSegmentsLength:function(t){const s=W.newElement(),e=t.c,i=t.v,h=t.o,r=t.i,n=t._length,a=s.lengths;let o=0,l=0;for(;l1?1:h,n),o=Q(r=r>1?1:r,n),l=t.length,p=1-a,c=1-o,u=p*p*p,d=a*p*p*3,f=a*a*p*3,m=a*a*a,g=p*p*c,y=a*p*c+p*a*c+p*p*o,v=a*a*c+p*a*o+a*p*o,_=a*a*o,k=p*c*c,x=a*c*c+p*o*c+p*c*o,S=a*o*c+p*o*o+a*c*o,M=a*o*o,T=c*c*c,w=o*c*c+c*o*c+c*c*o,P=o*o*c+c*o*o+o*c*o,b=o*o*o;for(let h=0;hp?l>c?l-p-c:c-p-l:c>p?c-p-l:p-l-c,u>-1e-4&&u<1e-4}};const et=Math.PI/180,it=[0,0],ht=/(loopIn|loopOut)\(([^)]+)/,rt=/["']\w+["']/;class nt{constructor(t,s,e){this.begin=s,this.end=e,this.total=this.end-this.begin,this.type=t}update(t){return"in"===this.type?t>=this.begin?t:this.end-a.euclideanModulo(this.begin-t,this.total):"out"===this.type?t<=this.end?t:this.begin+a.euclideanModulo(t-this.end,this.total):void 0}}class at{constructor(t,s,e){this.begin=s,this.end=e,this.total=this.end-this.begin,this.type=t}update(t){if("in"===this.type&&tthis.end){const s=t-this.end;return this.pingpong(s)}return t}pingpong(t){return Math.floor(t/this.total)%2?this.begin+a.euclideanModulo(t,this.total):this.end-a.euclideanModulo(t,this.total)}}const ot={loopIn(t,s,e){const i=t[0].t,h=t.length-1,r=t[Math.min(h,e)].t;switch(s){case"cycle":return new nt("in",i,r);case"pingpong":return new at("in",i,r)}return null},loopOut(t,s,e){const i=t.length-1,h=t[Math.max(0,i-e)].t,r=t[i].t;switch(s){case"cycle":return new nt("out",h,r);case"pingpong":return new at("out",h,r)}return null}};var lt=function(t){return t.x&&ht.test(t.x)},pt=function(t){const{name:s,mode:e,offset:i=0}=function(t){const s=t.match(ht),e=s[2].split(/\s*,\s*/).map((t=>rt.test(t)?t.replace(/"|'/g,""):parseInt(t)));return{name:s[1],mode:e[0],offset:e[1]}}(t.x),h=0===i?t.k.length-1:i;return ot[s]&&ot[s](t.k,e,h)};function ct(t){const s=t[0]*et,e=t[1]*et,i=t[2]*et,h=Math.cos(s/2),r=Math.cos(e/2),n=Math.cos(i/2),a=Math.sin(s/2),o=Math.sin(e/2),l=Math.sin(i/2);return[a*o*n+h*r*l,a*r*n+h*o*l,h*o*n-a*r*l,h*r*n-a*o*l]}class ut{interpolateValue(t,s){let e;"multidimensional"===this.propType&&(e=F("float32",this.pv.length));let i,h,r,n,a,o,l,p,c=s.lastIndex,u=c,d=this.keyframes.length-1,f=!0;for(;f;){if(i=this.keyframes[u],h=this.keyframes[u+1],u===d-1&&t>=h.t){i.h&&(i=h),c=0;break}if(h.t>t){c=u;break}u=g||t=g?c.points.length-1:0;for(n=c.points[s].point.length,r=0;r=m&&d=g?(e[0]=m[0],e[1]=m[1],e[2]=m[2]):t<=y?(e[0]=i.s[0],e[1]=i.s[1],e[2]=i.s[2]):function(t,s){const e=s[0],i=s[1],h=s[2],r=s[3],n=Math.atan2(2*i*r-2*e*h,1-2*i*i-2*h*h),a=Math.asin(2*e*i+2*h*r),o=Math.atan2(2*e*r-2*i*h,1-2*e*e-2*h*h);t[0]=n/et,t[1]=a/et,t[2]=o/et}(e,function(t,s,e){const i=[],h=t[0],r=t[1],n=t[2],a=t[3];let o,l,p,c,u,d=s[0],f=s[1],m=s[2],g=s[3];return l=h*d+r*f+n*m+a*g,l<0&&(l=-l,d=-d,f=-f,m=-m,g=-g),1-l>1e-6?(o=Math.acos(l),p=Math.sin(o),c=Math.sin((1-e)*o)/p,u=Math.sin(e*o)/p):(c=1-e,u=e),i[0]=c*h+u*d,i[1]=c*r+u*f,i[2]=c*n+u*m,i[3]=c*a+u*g,i}(ct(i.s),ct(m),(t-y)/(g-y)));else for(u=0;u=g?a=1:t=e&&t>=e||this._caching.lastFrame=t&&(this._caching._lastKeyframeIndex=-1,this._caching.lastIndex=0);let s=this.interpolateValue(t,this._caching);this.pv=s}return this._caching.lastFrame=t,this.pv}setVValue(t){let s;if("unidimensional"===this.propType)s=t*this.mult,Math.abs(this.v-s)>1e-5&&(this.v=s,this._mdf=!0);else{let e=0;const i=this.v.length;for(;e1e-5&&(this.v[e]=s,this._mdf=!0),e+=1}}processEffectsSequence(t){if(this.expression&&(t=this.expression.update(t)),t===this.frameId||!this.effectsSequence.length)return;if(this.lock)return void this.setVValue(this.pv);let s;this.lock=!0,this._mdf=this._isFirstFrame;let e=this.effectsSequence.length,i=this.kf?this.pv:this.data.k;for(s=0;s=d[d.length-1].t)i=d[d.length-1].s?d[d.length-1].s[0]:d[d.length-2].e[0],r=!0;else{let s,e,n=u,a=d.length-1,o=!0;for(;o&&(s=d[n],e=d[n+1],!(e.t>t));)n=e.t)p=1;else if(te&&t>e)||(this._caching.lastIndex=i0||t>-1e-6&&t<0?i(1e4*t)/1e4:t}function A(){var t=this.props;return"matrix("+L(t[0])+","+L(t[1])+","+L(t[4])+","+L(t[5])+","+L(t[12])+","+L(t[13])+")"}return function(){this.reset=h,this.rotate=r,this.rotateX=n,this.rotateY=a,this.rotateZ=o,this.skew=p,this.skewFromAxis=c,this.shear=l,this.scale=u,this.setTransform=d,this.translate=f,this.transform=m,this.applyToPoint=k,this.applyToX=x,this.applyToY=S,this.applyToZ=M,this.applyToPointArray=b,this.applyToTriplePoints=P,this.applyToPointStringified=D,this.toCSS=C,this.to2dCSS=A,this.clone=v,this.cloneFromProps=_,this.equals=y,this.inversePoints=w,this.inversePoint=T,this._t=this.transform,this.isIdentity=g,this._identity=!0,this._identityCalculated=!1,this.props=F("float32",16),this.reset()}}();class Dt{constructor(){this.sequences={},this.sequenceList=[],this.transform_key_count=0}addTransformSequence(t){const s=t.length;let e="_";for(let i=0;i=0;e-=1)s=t.transforms[e].transform.mProps.v.props,t.finalTransform.transform(s[0],s[1],s[2],s[3],s[4],s[5],s[6],s[7],s[8],s[9],s[10],s[11],s[12],s[13],s[14],s[15])}t._mdf=i}processSequences(t){const s=this.sequenceList.length;for(let e=0;e=this.p.keyframes[this.p.keyframes.length-1].t?(t=this.p.getValueAtTime(this.p.keyframes[this.p.keyframes.length-1].t/e,0),s=this.p.getValueAtTime((this.p.keyframes[this.p.keyframes.length-1].t-.05)/e,0)):(t=this.p.pv,s=this.p.getValueAtTime((this.p._caching.lastFrame+this.p.offsetTime-.01)/e,this.p.offsetTime));else if(this.px&&this.px.keyframes&&this.py.keyframes&&this.px.getValueAtTime&&this.py.getValueAtTime){t=[],s=[];let i=this.px,h=this.py;i._caching.lastFrame+i.offsetTime<=i.keyframes[0].t?(t[0]=i.getValueAtTime((i.keyframes[0].t+.01)/e,0),t[1]=h.getValueAtTime((h.keyframes[0].t+.01)/e,0),s[0]=i.getValueAtTime(i.keyframes[0].t/e,0),s[1]=h.getValueAtTime(h.keyframes[0].t/e,0)):i._caching.lastFrame+i.offsetTime>=i.keyframes[i.keyframes.length-1].t?(t[0]=i.getValueAtTime(i.keyframes[i.keyframes.length-1].t/e,0),t[1]=h.getValueAtTime(h.keyframes[h.keyframes.length-1].t/e,0),s[0]=i.getValueAtTime((i.keyframes[i.keyframes.length-1].t-.01)/e,0),s[1]=h.getValueAtTime((h.keyframes[h.keyframes.length-1].t-.01)/e,0)):(t=[i.pv,h.pv],s[0]=i.getValueAtTime((i._caching.lastFrame+i.offsetTime-.01)/e,i.offsetTime),s[1]=h.getValueAtTime((h._caching.lastFrame+h.offsetTime-.01)/e,h.offsetTime))}else t=s=it;this.v.rotate(-Math.atan2(t[1]-s[1],t[0]-s[0]))}this.data.p&&this.data.p.s?this.data.p.z?this.v.translate(this.px.v,this.py.v,-this.pz.v):this.v.translate(this.px.v,this.py.v,0):this.v.translate(this.p.v[0],this.p.v[1],-this.p.v[2])}this.frameId=t}}precalculateMatrix(){if(!this.a.k&&(this.pre.translate(-this.a.v[0],-this.a.v[1],this.a.v[2]),this.appliedTransformations=1,!this.s.effectsSequence.length)){if(this.pre.scale(this.s.v[0],this.s.v[1],this.s.v[2]),this.appliedTransformations=2,this.sk){if(this.sk.effectsSequence.length||this.sa.effectsSequence.length)return;this.pre.skewFromAxis(-this.sk.v,this.sa.v),this.appliedTransformations=3}if(this.r){if(this.r.effectsSequence.length)return;this.pre.rotate(-this.r.v),this.appliedTransformations=4}else this.rz.effectsSequence.length||this.ry.effectsSequence.length||this.rx.effectsSequence.length||this.or.effectsSequence.length||(this.pre.rotateZ(-this.rz.v).rotateY(this.ry.v).rotateX(this.rx.v).rotateZ(-this.or.v[2]).rotateY(this.or.v[1]).rotateX(this.or.v[0]),this.appliedTransformations=4)}}applyToMatrix(t){let s=this._mdf;this.iterateDynamicProperties(),this._mdf=this._mdf||s,this.a&&t.translate(-this.a.v[0],-this.a.v[1],this.a.v[2]),this.s&&t.scale(this.s.v[0],this.s.v[1],this.s.v[2]),this.sk&&t.skewFromAxis(-this.sk.v,this.sa.v),this.r?t.rotate(-this.r.v):t.rotateZ(-this.rz.v).rotateY(this.ry.v).rotateX(this.rx.v).rotateZ(-this.or.v[2]).rotateY(this.or.v[1]).rotateX(this.or.v[0]),this.data.p.s?this.data.p.z?t.translate(this.px.v,this.py.v,-this.pz.v):t.translate(this.px.v,this.py.v,0):t.translate(this.p.v[0],this.p.v[1],-this.p.v[2])}}function Nt(t,s,e){return new Vt(t,s,e)}class qt extends G{initModifierProperties(){}addShapeToModifier(){}addShape(t){if(!this.closed){t.sh.container.addDynamicProperty(t.sh);const s={shape:t.sh,data:t,localShapeCollection:U()};this.shapes.push(s),this.addShapeToModifier(s),this._isAnimated&&t.setAsAnimated()}}init(t,s){this.shapes=[],this.elem=t,this.initDynamicPropertyContainer(t),this.initModifierProperties(t,s),this.frameId=-999999,this.closed=!1,this.k=!1,this.dynamicProperties.length?this.k=!0:this.getValue(!0)}processKeys(t){t!==this.frameId&&(this.frameId=t,this.iterateDynamicProperties(t))}}const jt={};function Xt(t,s){jt[t]||(jt[t]=s)}Xt("tm",class extends qt{initModifierProperties(t,s){this.s=yt(t,s.s,0,.01,this),this.e=yt(t,s.e,0,.01,this),this.o=yt(t,s.o,0,0,this),this.sValue=0,this.eValue=0,this.getValue=this.processKeys,this.m=s.m,this._isAnimated=!!this.s.effectsSequence.length||!!this.e.effectsSequence.length||!!this.o.effectsSequence.length}addShapeToModifier(t){t.pathsData=[]}calculateShapeEdges(t,s,e,i,h){let r=[];s<=1?r.push({s:t,e:s}):t>=1?r.push({s:t-1,e:s-1}):(r.push({s:t,e:1}),r.push({s:0,e:s-1}));let n,a,o=[],l=r.length;for(n=0;ni+e);else{let t,s;t=a.s*h<=i?0:(a.s*h-i)/e,s=a.e*h>=i+e?1:(a.e*h-i)/e,o.push([t,s])}return o.length||o.push([0,0]),o}releasePathsData(t){const s=t.length;for(let e=0;e1?1:this.s.v<0?0:this.s.v)+t,e=(this.e.v>1?1:this.e.v<0?0:this.e.v)+t,s>e){let t=s;s=e,e=t}s=1e-4*Math.round(1e4*s),e=1e-4*Math.round(1e4*e),this.sValue=s,this.eValue=e}else s=this.sValue,e=this.eValue;let r,n,a,o,l,p=this.shapes.length,c=0;if(e===s)for(h=0;h=0;h-=1)if(u=this.shapes[h],u.shape._mdf){for(d=u.localShapeCollection,d.releaseShapes(),2===this.m&&p>1?(m=this.calculateShapeEdges(s,e,u.totalShapeLength,v,c),v+=u.totalShapeLength):m=[[g,y]],n=m.length,r=0;r=1?f.push({s:u.totalShapeLength*(g-1),e:u.totalShapeLength*(y-1)}):(f.push({s:u.totalShapeLength*g,e:u.totalShapeLength}),f.push({s:0,e:u.totalShapeLength*(y-1)}));let t=this.addShapes(u,f[0]);if(f[0].s!==f[0].e){if(f.length>1)if(u.shape.paths.shapes[u.shape.paths._length-1].c){let s=t.pop();this.addPaths(t,d),t=this.addShapes(u,f[1],s)}else this.addPaths(t,d),t=this.addShapes(u,f[1]);this.addPaths(t,d)}}u.shape.paths=d}}}addPaths(t,s){const e=t.length;for(let i=0;is.e){e.c=!1;break}s.s<=f&&s.e>=f+n.addedLength?(this.addSegment(u[i].v[h-1],u[i].o[h-1],u[i].i[h],u[i].v[h],e,a,g),g=!1):(l=st.getNewSegment(u[i].v[h-1],u[i].v[h],u[i].o[h-1],u[i].i[h],(s.s-f)/n.addedLength,(s.e-f)/n.addedLength,o[h-1]),this.addSegmentFromArray(l,e,a,g),g=!1,e.c=!1),f+=n.addedLength,a+=1}if(u[i].c&&o.length){if(n=o[h-1],f<=s.e){let t=o[h-1].addedLength;s.s<=f&&s.e>=f+t?(this.addSegment(u[i].v[h-1],u[i].o[h-1],u[i].i[0],u[i].v[0],e,a,g),g=!1):(l=st.getNewSegment(u[i].v[h-1],u[i].v[0],u[i].o[h-1],u[i].i[0],(s.s-f)/t,(s.e-f)/t,o[h-1]),this.addSegmentFromArray(l,e,a,g),g=!1,e.c=!1)}else e.c=!1;f+=n.addedLength,a+=1}if(e._length&&(e.setXYAt(e.v[p][0],e.v[p][1],"i",p),e.setXYAt(e.v[e._length-1][0],e.v[e._length-1][1],"o",e._length-1)),f>s.e)break;i0;)e-=1,this._elements.unshift(s[e]);this.dynamicProperties.length?this.k=!0:this.getValue(!0)}resetElements(t){const s=t.length;for(let e=0;e0?Math.floor(h):Math.ceil(h),a=this.pMatrix.props,o=this.rMatrix.props,l=this.sMatrix.props;this.pMatrix.reset(),this.rMatrix.reset(),this.sMatrix.reset(),this.tMatrix.reset(),this.matrix.reset();let p=0;if(h>0){for(;pn;)this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,1,!0),p-=1;r&&(this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,-r,!0),p-=r)}s=1===this.data.m?0:this._currentCopies-1;const c=1===this.data.m?1:-1;for(i=this._currentCopies;i;){const t=this.elemsData[s].it,e=t[t.length-1].transform.mProps.v.props,h=e.length;if(t[t.length-1].transform.mProps._mdf=!0,t[t.length-1].transform.op._mdf=!0,t[t.length-1].transform.op.v=this.so.v+(this.eo.v-this.so.v)*(s/(this._currentCopies-1)),0!==p){(0!==s&&1===c||s!==this._currentCopies-1&&-1===c)&&this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,1,!1),this.matrix.transform(o[0],o[1],o[2],o[3],o[4],o[5],o[6],o[7],o[8],o[9],o[10],o[11],o[12],o[13],o[14],o[15]),this.matrix.transform(l[0],l[1],l[2],l[3],l[4],l[5],l[6],l[7],l[8],l[9],l[10],l[11],l[12],l[13],l[14],l[15]),this.matrix.transform(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9],a[10],a[11],a[12],a[13],a[14],a[15]);for(let t=0;t.01)return!1;i+=1}return!0}checkCollapsable(){if(this.o.length/2!=this.c.length/4)return!1;if(this.data.k.k[0].s){let t=0,s=this.data.k.k.length;for(;t=0;s-=1)this.shapeModifiers[s].processShapes(t,this._isFirstFrame)}searchProcessedElement(t){let s=this.processedElements,e=0,i=s.length;for(;e=0;r-=1){if(o=this.searchProcessedElement(t[r]),o?s[r]=e[o-1]:t[r]._shouldRender=i,"fl"==t[r].ty||"st"==t[r].ty||"gf"==t[r].ty||"gs"==t[r].ty)o?s[r].style.closed=!1:s[r]=this.createStyleElement(t[r],f),u.push(s[r].style);else if("gr"==t[r].ty){if(o)for(a=s[r].it.length,n=0;n=0;h-=1)"tr"==s[h].ty?(i=e[h].transform,this.updateShapeTransform(t,i)):"sh"==s[h].ty||"el"==s[h].ty||"rc"==s[h].ty||"sr"==s[h].ty?this.updatePath(s[h],e[h]):"fl"==s[h].ty?this.updateFill(s[h],e[h],i):"st"==s[h].ty?this.updateStroke(s[h],e[h],i):"gf"==s[h].ty||"gs"==s[h].ty?this.updateGradientFill(s[h],e[h],i):"gr"==s[h].ty&&this.updateShape(i,s[h].it,e[h].it)}updateGrahpics(){const t=this.stylesList.length;for(let s=0;s=e.op-e.st,this.isOverlapMode=i.overlapMode,this.parseLayer(t,s)}outTypeExpressionMode(){this._hasOutTypeExpression=!0,this.isOverlapLayer&&(this.needUpdateOverlap=!0)}prepareProperties(t,s){let e,i=this.dynamicProperties.length;for(e=0;e=this.layer.ip:this.visible=s,this.prepareProperties(t,s)}updateDisplay(){const t=this.elem.display;this.elem._isRoot||(this.visible?t.show():t.hide(),(this._mdf||this.transform._mdf||this._isFirstFrame)&&t.updateLottieTransform(this.transform),this.masks&&(this.masks._mdf||this._isFirstFrame)&&t.updateLottieMasks(this.masks)),this._isFirstFrame=!1}}class Wt{constructor(t){this.data=t,void 0===this.data.sr&&(this.data.sr=1),this.offsetTime=t.st||0,this.fullname=t.nm||"",this.idname=t.ln||"",this.classnames=t.cl?t.cl.split(" "):[],this.bodymovin=new zt(this),this.displayType="",this.display=null,this.hierarchy=null,this.lottieTreeParent=null}initBodymovin(t,s){this.bodymovin.initFrame(t,s),this.display&&this.display.onSetupLottie&&this.display.onSetupLottie()}hasValidMasks(){return!(!this.bodymovin.masks||!this.bodymovin.masks.hasMasks)}setHierarchy(t){this.hierarchy=t,this.display.setHierarchy(t.display)}initDisplayInstance(t,s){return new(Ot(t))(this,s)}updateFrame(t){this.bodymovin.updateFrame(t),this.bodymovin.updateDisplay()}}class Jt extends Wt{constructor(t,s){super(t);const{global:e}=s;this.session=s;const i={layer:t,session:s};if(e.maskComp){i.maskComp=e.maskComp;const{w:s,h:h}=t;i.viewport={w:s,h:h}}this.config=i,this.childNodes=[],this.displayType=Ft.Component,this.innerDisplay=null,this.display=this.initDisplayInstance(this.displayType,i),this.initBodymovin(t,s)}updateFrame(t){if(this.bodymovin.updateFrame(t),this.bodymovin.updateDisplay(),t-=this.offsetTime,this.bodymovin.tm){let s=this.bodymovin.tm.v;s===this.data.op&&(s=this.data.op-1),t=s}else t/=this.data.sr;for(let s=0;s{this._setupDate(t)})),this.jsonLoader.once("error",(t=>{this.emit("error",t)}))}}_setupDate(t){this._sourceData=t,this._copyJSON&&(t=a.copyJSON(t)),M(t),this.keyframes=t;const{w:s,h:e,st:i=0,fr:h,ip:r,op:n,assets:o}=t;this.frameRate=h,this.frameMult=h/1e3,this._defaultSegment=[r,n];const c=this._segmentName&&this.segments[this._segmentName]||this._defaultSegment;this.beginFrame=c[0],this.endFrame=c[1],this._timePerFrame=1e3/h,this.duration=Math.floor(this.endFrame-this.beginFrame);let u=null;const d=o.filter((t=>t.u||t.p));d.length>0?(this.textureLoader=u=function(t,s){const e=l[p.Texture];return e||console.warn("must register an image loader, before you parse an animation some has image assets"),e(t,s)}(d,{prefix:this._prefix,autoLoad:this._autoLoad}),u.loaded?(this.isImagesLoaded=!0,this.isPaused=!this._autoStart,this.emit("ImageReady")):(u.once("complete",(()=>{this.isImagesLoaded=!0,this.emit("ImageReady")})),null!==this._pausedNeedSet&&(this._pausedNeedSet=!0,u.once("complete",(()=>{this._pausedNeedSet&&(this._pausedNeedSet=!1,this.isPaused=!this._autoStart)}))))):(this.isImagesLoaded=!0,this.isPaused=!this._autoStart);const f={global:{assets:o,textureLoader:u,frameRate:h,maskComp:this._maskComp,overlapMode:this.overlapMode},local:{w:s,h:e,ip:r,op:n,st:i}};this._buildElements(f),null!==this.textureLoader&&this._justDisplayOnImagesLoaded&&!this.textureLoader.loaded&&null!==this._justDisplayNeedSet&&(this.group.visible=!1,this._justDisplayNeedSet=!0,this.textureLoader.once("complete",(()=>{this._justDisplayNeedSet&&(this._justDisplayNeedSet=!1,this.group.visible=!0)}))),this.isDisplayLoaded=!0,this.update(0,!0)}_buildElements(t){this.root=this._extraCompositions(this.keyframes,t,!0),this.display=this.root.display,this.group.addChild(this.display),this.emit("DOMLoaded").emit("DisplayReady"),null===this.textureLoader||this.textureLoader.loaded?this.emit("success"):this.textureLoader.once("complete",(()=>this.emit("success")))}_extraCompositions(t,{global:s,local:e},i=!1){const{w:h,h:r,ip:n,op:o,st:l=0}=t,p=new Jt(t,{global:s,local:e});p._isRoot=i;const c=t.layers||a.getAssets(t.refId,s.assets).layers,u={global:s,local:{w:h,h:r,ip:n,op:o,st:l}},d=this._createElements(c,u);for(let t=c.length-1;t>=0;t--){const s=c[t],e=d[s.ind];if(e){if(!a.isUndefined(s.parent)){const t=d[s.parent];t._isParent=!0,e.setHierarchy(t)}p.addChild(e)}}return p}_createElements(t,s){const e={};for(let i=t.length-1;i>=0;i--){const h=t[i];let r=null;if(void 0===h.td){switch(h.ty){case 0:r=this._extraCompositions(h,s);break;case 1:r=new Ht(h,s);break;case 2:r=new Kt(h,s);break;case 3:r=new $t(h,s);break;case 4:r=new Zt(h,s);break;default:continue}r&&(void 0===h.ind&&(h.ind=i),e[h.ind]=r,r.name=h.nm||null)}}return e}getDisplayByQuerySelector(t){const s=this.querySelector(t);return s&&s.display?s.display:(console.warn("can not find display which query with ",t),null)}_queryMatch(t,s,e){const i=t.substr(0,1),h=t.substr(1,t.length);let r=!1;return r="#"===i?s.idname===h:"."===i?-1!==s.classnames.indexOf(h):s.fullname===t,r&&e.push(s),r}_searchNodes(t,s,e,i=!1){if(s.childNodes&&s.childNodes.length>0){const h=[];for(let r=0;r0&&h.push(n)}for(let s=0;s>0;this._lastFrame!==h&&(this._emitFrame(this.direction>0?h:this._lastFrame),this._lastFrame=h),!1===e?(this.emit("enterFrame",i),this.emit("update",this.frameNum/this.duration)):this.hadEnded!==e&&!0===e&&this.emit("complete"),this.hadEnded=e}_updateTime(t){const s=this.direction*this.timeScale*t;if(this._waitCut>0)return this._waitCut-=Math.abs(s),null;if(this.isPaused||this._delayCut>0)return this._delayCut>0&&(this._delayCut-=Math.abs(s)),null;this.frameNum+=s/this._timePerFrame;let e=!1;return this._spill()&&(this._repeatsCut>0||this.infinite?(this._repeatsCut>0&&--this._repeatsCut,this._delayCut=this.delay,this.alternate?(this.direction*=-1,this.frameNum=a.codomainBounce(this.frameNum,0,this.duration)):(this.direction=1,this.frameNum=a.euclideanModulo(this.frameNum,this.duration)),this.emit("loopComplete")):(this.overlapMode||(this.frameNum=a.clamp(this.frameNum,0,this.duration),this.living=!1),e=!0)),e}_spill(){const t=this.frameNum<=0&&-1===this.direction,s=this.frameNum>=this.duration&&1===this.direction;return t||s}frameToTime(t){return t*this._timePerFrame}setSpeed(t){this.timeScale=t}playSegment(t,s={}){if(!t)return;let e=null;a.isArray(t)?e=t:a.isString(t)&&(e=this.segments[t],a.isArray(e)&&(this._segmentName=t)),a.isArray(e)&&(this.beginFrame=a.isNumber(e[0])?e[0]:this._defaultSegment[0],this.endFrame=a.isNumber(e[1])?e[1]:this._defaultSegment[1],a.isNumber(s.repeats)&&(this.repeats=s.repeats),a.isBoolean(s.infinite)&&(this.infinite=s.infinite),a.isBoolean(s.alternate)&&(this.alternate=s.alternate),a.isNumber(s.wait)&&(this.wait=s.wait),a.isNumber(s.delay)&&(this.delay=s.delay),this.replay())}goToAndStop(t,s=!1){this.frameNum=s?t:t*this.frameMult,this.update(0,!0),this.pause()}goToAndPlay(t,s=!1){this.frameNum=s?t:t*this.frameMult,this.update(0,!0),this.resume()}getDuration(t){const s=this.endFrame-this.beginFrame;return t?s:s/this.frameRate}setDirection(t){return this.direction=t<0?-1:1,this}pause(){return this._pausedNeedSet?this._pausedNeedSet=!1:this._pausedNeedSet=null,this.isPaused=!0,this}resume(){return this._pausedNeedSet?this._pausedNeedSet=!1:this._pausedNeedSet=null,this.isPaused=!1,this}play(){return this.resume()}replay(){return this._pausedNeedSet?this._pausedNeedSet=!1:this._pausedNeedSet=null,this.isPaused=!1,this._repeatsCut=this.repeats,this._delayCut=this.delay,this.living=!0,this.frameNum=0,this.duration=Math.floor(this.endFrame-this.beginFrame),this.direction=1,this}show(){this._justDisplayNeedSet?this._justDisplayNeedSet=!1:this._justDisplayNeedSet=null,this.group.visible=!0}hide(){this._justDisplayNeedSet?this._justDisplayNeedSet=!1:this._justDisplayNeedSet=null,this.group.visible=!1}destroy(){this.parent&&this.parent.remove(this),this.group.parent&&this.group.parent.removeChild(this.group),this.pause(),this.root=null,this.group=null,this.display=null,this.textureLoader&&(this.textureLoader.off("complete"),this.textureLoader=null),this.jsonLoader&&(this.jsonLoader.off("success"),this.jsonLoader=null),this.keyframes=null,this.living=!1}}class ts extends o{constructor(t){super(),this._lastTime=0,this._snippet=0,this.timeScale=1,this.isPaused=!1,this.ticker=t.ticker?t.ticker:t,this.groups=[],this.update=this.update.bind(this),this.ticker&&this.start()}add(t){const s=arguments.length;if(s>1)for(let t=0;t1)for(let t=0;t200)&&(this._lastTime=Date.now(),t=Date.now()-this._lastTime),this._lastTime+=t,this._snippet=t}destroy(){for(let t=this.groups.length-1;t>=0;t--)this.groups[t].destroy()}}class ss extends i.Graphics{constructor(t){super(),this.parentCompBox=t,this.lineStyle(0)}updateLayerMask(t){for(let s=0;sthis.buffer.length){const s=new this.buffer.constructor(Math.max(this.length+t.length,Math.round(2*this.buffer.length)));s.set(this.buffer,0),this.buffer=s}for(let s=0;s=r&&(r+=2*Math.PI);let a=r-h,o=1;n&&(o=-1,a=2*Math.PI-a,0==a&&(a=2*Math.PI));const l=a*i;let p=Math.sqrt(l/1)>>0;p=p%2==0?p+1:p;const c=a/p;let u=h;for(let h=0;h=2,n=s.lineWidth/2;let a,o=[i[0],i[1]];for(let t=2;te[r];)h-=e[r],r++,n=n?0:1,r==e.length&&(r=0);let a=[t[0],t[1]],o=[n];for(let s=2;s=e[r];)p+=e[r]-h,h=0,n=n?0:1,r++,r==e.length&&(r=0),o.push(n),a.push(t[s-2]+p*i[0],t[s-1]+p*i[1]);l-p!=0&&(a.push(t[s],t[s+1]),o.push(n)),h+=l-p}return s&&(t.pop(),t.pop(),a.pop(),a.pop(),o.pop()),{newPoints:a,toDrawOrNotToDraw:o}}(o,h,s.lineDash,s.lineDashOffset);a=t.toDrawOrNotToDraw,o=t.newPoints}const l=e.length;let p=e.length;const c=[];if(h)o.push(o[2],o[3]);else{const t=[o[2]-o[0],o[3]-o[1]],i=os(t[0],t[1]);t[0]/=i,t[1]/=i;const h=[-t[1],t[0]],l=[o[0]+n*h[0],o[1]+n*h[1]],u=[o[0]-n*h[0],o[1]-n*h[1]];if("butt"==s.lineCap)e.push(l[0],l[1],u[0],u[1]);else if("square"==s.lineCap)e.push(l[0]-n*t[0],l[1]-n*t[1],u[0]-n*t[0],u[1]-n*t[1]);else{e.push(o[0],o[1],l[0],l[1]);const t=Math.atan2(l[1]-o[1],l[0]-o[0]),s=Math.atan2(u[1]-o[1],u[0]-o[0]);us(e,o[0],o[1],n,t,s),e.push(o[0],o[1],u[0],u[1]),e.push(l[0],l[1],u[0],u[1])}if(r){const t=a[0];for(let s=p;s0?(f[0]/=l,f[1]/=l,g=[-f[1],f[0]],m=g[0]*h[0]+g[1]*h[1],y=n/m):(y=0,g=[-f[1],f[0]]);const v=[o[t]+y*g[0],o[t+1]+y*g[1]],_=[o[t]-y*g[0],o[t+1]-y*g[1]];if("miter"==s.lineJoin&&1/m<=s.miterLimit)e.push(v[0],v[1],_[0],_[1]);else{const i=d[1]*u[0]-d[0]*u[1];if("round"==s.lineJoin)if(i<0){const s=[o[t]+d[1]*n,o[t+1]-d[0]*n],i=[o[t]+u[1]*n,o[t+1]-u[0]*n];e.push(v[0],v[1],s[0],s[1]);const h=Math.atan2(s[1]-o[t+1],s[0]-o[t]),r=Math.atan2(i[1]-o[t+1],i[0]-o[t]);us(e,o[t],o[t+1],n,h,r),e.push(v[0],v[1],i[0],i[1])}else{const s=[o[t]-d[1]*n,o[t+1]+d[0]*n],i=[o[t]-u[1]*n,o[t+1]+u[0]*n];e.push(s[0],s[1],_[0],_[1]);const h=Math.atan2(i[1]-o[t+1],i[0]-o[t]),r=Math.atan2(s[1]-o[t+1],s[0]-o[t]);us(e,o[t],o[t+1],n,h,r),e.push(i[0],i[1],_[0],_[1])}else if(i<0){const s=[o[t]+d[1]*n,o[t+1]-d[0]*n],i=[o[t]+u[1]*n,o[t+1]-u[0]*n];e.push(v[0],v[1],s[0],s[1],v[0],v[1],i[0],i[1])}else{const s=[o[t]-d[1]*n,o[t+1]+d[0]*n],i=[o[t]-u[1]*n,o[t+1]+u[0]*n];e.push(s[0],s[1],_[0],_[1],i[0],i[1],_[0],_[1])}}if(r){const s=a[t/2];for(let t=p;t=6){for(let t=0;t=2;for(let t=0;t1){const t=this.paths.length,s=function(t){const s=t.length;let e=0;for(let i=s-1,h=0;h0;this.currentPath.isClockWise=s,0===t&&(this.firstIsClockWise=s),t>0&&this.preClockWiseStatus===this.firstIsClockWise&&this.preClockWiseStatus!==s?(t>0?this.paths[t-1]:null).holes.push(this.currentPath):(this.paths.push(this.currentPath),this.preClockWiseStatus=s),this.currentPath=null,this.isDirty=!0}this._samplerPoints.length=0}closePath(){this.currentPath.closePath()}stroke(){this.endPath(),this.drawType="stroke"}fill(){null!==this.currentPath&&(this.closePath(),this.endPath(),this.drawType="fill")}_renderWebGL(t){t.setObjectRenderer(t.plugins.lottiegraphics),t.plugins.lottiegraphics.render(this)}_renderCanvas(t){t.plugins.lottiegraphics.render(this)}}class ys extends i.Graphics{constructor(t,s){super(),this.lottieElement=t,this.config=s;const e=parseInt(s.color.replace("#",""),16);this.beginFill(e),this.drawRect(0,0,s.rect.width,s.rect.height),this.endFill()}onSetupLottie(){if(this.lottieElement.hasValidMasks()){const t=this.config.session.local;this.graphicsMasks=new ss(t),this.mask=this.graphicsMasks,this.addChild(this.mask)}}setHierarchy(t){this.hierarchy=t}show(){this.visible=!0}hide(){this.visible=!1}updateLottieTransform(t){this.x=t.x,this.y=t.y,this.pivot.x=t.anchorX,this.pivot.y=t.anchorY,this.scale.x=t.scaleX,this.scale.y=t.scaleY,this.rotation=t.rotation,this.alpha=t.alpha}updateLottieMasks(t){this.graphicsMasks&&this.graphicsMasks.updateMasks(t)}}class vs extends i.Sprite{constructor(t,s){const{texture:e,asset:h}=s;super(e),e.baseTexture.hasLoaded?(e.orig=new i.Rectangle(0,0,h.w,h.h),e._updateUvs()):e.baseTexture.on("loaded",(()=>{e.orig=new i.Rectangle(0,0,h.w,h.h),e._updateUvs()})),this.lottieElement=t,this.config=s}onSetupLottie(){if(this.lottieElement.hasValidMasks()){const t=this.config.session.local;this.graphicsMasks=new ss(t),this.mask=this.graphicsMasks,this.addChild(this.mask)}}setHierarchy(t){this.hierarchy=t}show(){this.visible=!0}hide(){this.visible=!1}updateLottieTransform(t){this.x=t.x,this.y=t.y,this.pivot.x=t.anchorX,this.pivot.y=t.anchorY,this.scale.x=t.scaleX,this.scale.y=t.scaleY,this.rotation=t.rotation,this.alpha=t.alpha}updateLottieMasks(t){this.graphicsMasks&&this.graphicsMasks.updateMasks(t)}}const _s=/^(https?:)?\/\//;class ks extends o{constructor(t,{prefix:s,autoLoad:e=!0}){super(),this.assets=t,this.prefix=s||"",this.textures={},this._total=0,this._failed=0,this._received=0,this.loaded=!1,e&&this.load()}load(){this.assets.forEach((t=>{const s=t.id,e=function(t,s){if(1===t.e)return t.p;s&&(s=s.replace(/\/?$/,"/"));const e=t.u+t.p;let i="";return i=t.up?t.up:_s.test(e)?e:s+e,i}(t,this.prefix),h=i.Texture.fromImage(e,"*");this.textures[s]=h,this._total++,h.baseTexture.hasLoaded?(this._received++,this.emit("update"),this._received+this._failed>=this._total&&this._onComplete()):(h.baseTexture.once("loaded",(()=>{this._received++,this.emit("update"),this._received+this._failed>=this._total&&this._onComplete()})),h.baseTexture.once("error",(()=>{this._failed++,this.emit("update"),this._received+this._failed>=this._total&&this._onComplete()})))}))}_onComplete(){this.loaded=!0,this.emit("complete"),this._failed>0&&(this._failed>=this._total?this.emit("fail"):this.emit("partlyfail",this._failed))}getTextureById(t){return this.textures[t]}}function xs(t){return t.response&&"object"==typeof t.response?t.response:t.response&&"string"==typeof t.response?JSON.parse(t.response):t.responseText?JSON.parse(t.responseText):void 0}class Ss extends o{constructor(t){super(),this.path=t,this.onSuccess=this.onSuccess.bind(this),this.onFail=this.onFail.bind(this),function(t,s,e){let i,h=new XMLHttpRequest;h.open("GET",t,!0);try{h.responseType="json"}catch(t){console.error("lottie-pixi loadAjax:",t)}h.send(),h.onreadystatechange=function(){if(4==h.readyState)if(200==h.status)i=xs(h),s(i);else try{i=xs(h),s(i)}catch(t){e&&e(t)}}}(t,this.onSuccess,this.onFail)}onSuccess(t){this.emit("success",t),this.emit("complete",t)}onFail(t){this.emit("fail",t),this.emit("error",t)}}const Ms={Linear:{None:t=>t},Ease:{In:function(){const t=new L(.42,0,1,1);return function(s){return t.get(s)}}(),Out:function(){const t=new L(0,0,.58,1);return function(s){return t.get(s)}}(),InOut:function(){const t=new L(.42,0,.58,1);return function(s){return t.get(s)}}(),Bezier(t,s,e,i){const h=new L(t,s,e,i);return function(t){return h.get(t)}}},Elastic:{In:t=>0===t?0:1===t?1:-Math.pow(2,10*(t-1))*Math.sin(5*(t-1.1)*Math.PI),Out:t=>0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin(5*(t-.1)*Math.PI)+1,InOut:t=>0===t?0:1===t?1:(t*=2)<1?-.5*Math.pow(2,10*(t-1))*Math.sin(5*(t-1.1)*Math.PI):.5*Math.pow(2,-10*(t-1))*Math.sin(5*(t-1.1)*Math.PI)+1},Back:{In(t){const s=1.70158;return t*t*((s+1)*t-s)},Out(t){const s=1.70158;return--t*t*((s+1)*t+s)+1},InOut(t){const s=2.5949095;return(t*=2)<1?t*t*((s+1)*t-s)*.5:.5*((t-=2)*t*((s+1)*t+s)+2)}},Bounce:{In:t=>1-Ms.Bounce.Out(1-t),Out:t=>t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375,InOut:t=>t<.5?.5*Ms.Bounce.In(2*t):.5*Ms.Bounce.Out(2*t-1)+.5}};function Ts(t){o.call(this),this.element=t.element||{},this.duration=t.duration||300,this.living=!0,this.resident=t.resident||!1,this.infinite=t.infinite||!1,this.alternate=t.alternate||!1,this.repeats=t.repeats||0,this.delay=t.delay||0,this.wait=t.wait||0,this.timeScale=a.isNumber(t.timeScale)?t.timeScale:1,t.onComplete&&this.on("complete",t.onComplete.bind(this)),t.onUpdate&&this.on("update",t.onUpdate.bind(this)),this.init(),this.paused=!1}function ws(t){Ts.call(this,t),t.from=t.from||{};for(const s in t.to)a.isUndefined(t.from[s])&&(t.from[s]=this.element[s]);this.ease=t.ease||Ms.Ease.InOut,this.from=t.from,this.to=t.to}function Ps(t){Ts.call(this,t),this.dynamicProperties=[],this._mdf=!1,this.keyframes=a.copyJSON(t.keyframes),this.frameRate=t.frameRate||30,this.tpf=1e3/this.frameRate,this.ip=a.isUndefined(t.ip)?this.keyframes.ip:t.ip,this.op=a.isUndefined(t.ip)?this.keyframes.op:t.op,this.tfs=this.op-this.ip,this.duration=this.tfs*this.tpf,this.ignoreProps=a.isArray(t.ignoreProps)?t.ignoreProps:[],this.transform=new Gt(this,this.keyframes.ks)}function bs(t,s){Ts.call(this,s),this.runners=[],this.queues=[],this.cursor=0,this.total=0,this.alternate=!1,t&&this.then(t)}Ts.prototype=Object.create(o.prototype),Ts.prototype.update=function(t){const s=this.direction*this.timeScale*t;if(this.waitCut>0)return void(this.waitCut-=Math.abs(s));if(this.paused||!this.living||this.delayCut>0)return void(this.delayCut>0&&(this.delayCut-=Math.abs(s)));this.progress+=s;let e=!1;const i=this.progress;let h;return this.spill()&&(this.repeatsCut>0||this.infinite?(this.repeatsCut>0&&--this.repeatsCut,this.delayCut=this.delay,this.alternate?(this.direction*=-1,this.progress=a.codomainBounce(this.progress,0,this.duration)):(this.direction=1,this.progress=a.euclideanModulo(this.progress,this.duration))):e=!0),e?(this.resident||(this.living=!1),this.progress=a.clamp(i,0,this.duration),h=this.nextPose(),this.emit("complete",h,i-this.progress)):(h=this.nextPose(),this.emit("update",h,this.progress/this.duration)),h},Ts.prototype.spill=function(){const t=this.progress<=0&&-1===this.direction,s=this.progress>=this.duration&&1===this.direction;return t||s},Ts.prototype.init=function(){this.direction=1,this.progress=0,this.repeatsCut=this.repeats,this.delayCut=this.delay,this.waitCut=this.wait},Ts.prototype.nextPose=function(){console.warn("should be overwrite")},Ts.prototype.linear=function(t,s,e){return(s-t)*e+t},Ts.prototype.setSpeed=function(t){return this.timeScale=t,this},Ts.prototype.pause=function(){return this.paused=!0,this},Ts.prototype.resume=function(){return this.paused=!1,this},Ts.prototype.restart=Ts.prototype.resume,Ts.prototype.stop=function(){return this.repeats=0,this.infinite=!1,this.progress=this.duration,this},Ts.prototype.cancel=function(){return this.living=!1,this},ws.prototype=Object.create(Ts.prototype),ws.prototype.nextPose=function(){const t={},s=this.ease(this.progress/this.duration);for(const e in this.to)void 0!==this.element[e]&&(this.element[e]=t[e]=this.linear(this.from[e],this.to[e],s));return t},Ps.prototype=Object.create(Ts.prototype),Ps.prototype.prepareProperties=function(t){const s=this.dynamicProperties.length;let e;for(e=0;e0&&(t+=this._residueTime,this._residueTime=0),this.runners[this.cursor].update(t)},bs.prototype.update=function(t){if(this.wait>0)return void(this.wait-=Math.abs(t));if(this.paused||!this.living||this.delayCut>0)return void(this.delayCut>0&&(this.delayCut-=Math.abs(t)));const s=this.cursor,e=this.nextPose(this.timeScale*t);return this.emit("update",{index:s,pose:e},this.progress/this.duration),this.spill()&&(this.repeats>0||this.infinite?(this.repeats>0&&--this.repeats,this.delayCut=this.delay,this.cursor=0):(this.resident||(this.living=!1),this.emit("complete",e))),e},bs.prototype.spill=function(){return this.cursor>=this.total};const Ds={settings:i.settings,UPDATE_PRIORITY:i.UPDATE_PRIORITY,animationTicker:i.ticker.shared};function Cs(t){this.element=t,this.animates=[],this.timeScale=1,this.paused=!1,this.updateDeltaTime=this.updateDeltaTime.bind(this),Ds.animationTicker.add(this.updateDeltaTime,Ds.UPDATE_PRIORITY.HIGH)}Cs.prototype.clearAnimators=function(t){if(this.paused)return;const s=this.animates;for(let e=0;e0&&this.clearAnimators(s)},Cs.prototype.animate=function(t,s){return t.element=this.element,this._addMove(new ws(t),s)},Cs.prototype.queues=function(t,s,e){return s.element=this.element,this._addMove(new bs(t,s),e)},Cs.prototype.bodymovin=function(t,s){return t.element=this.element,this._addMove(new Ps(t),s)},Cs.prototype._addMove=function(t,s){return s&&this.clearAll(),this.animates.push(t),t},Cs.prototype.pause=function(){this.paused=!0},Cs.prototype.resume=function(){this.paused=!1},Cs.prototype.restart=Cs.prototype.resume,Cs.prototype.setSpeed=function(t){this.timeScale=t},Cs.prototype.clearAll=function(){this.animates.length=0},i.DisplayObject.prototype.setupAnimations=function(){this.animations||(this.animations=new Cs(this))},i.DisplayObject.prototype.animate=function(t,s){return this.animations||this.setupAnimations(),this.animations.animate(t,s)},i.DisplayObject.prototype.queues=function(t,s={},e){return this.animations||this.setupAnimations(),this.animations.queues(t,s,e)},i.DisplayObject.prototype.bodymovin=function(t,s){return this.animations||this.setupAnimations(),this.animations.bodymovin(t,s)},Object.defineProperties(i.DisplayObject.prototype,{scaleXY:{get(){return this.scale.x},set(t){this.scale.set(t)}},scaleX:{get(){return this.scale.x},set(t){this.scale.x=t}},scaleY:{get(){return this.scale.y},set(t){this.scale.y=t}},pivotX:{get(){return this.pivot.x},set(t){this.pivot.x=t}},pivotY:{get(){return this.pivot.y},set(t){this.pivot.y=t}}}),i.Container.prototype.updateTransform=function(){this.emit("pretransform"),this._boundsID++,this.hierarchy&&this.hierarchy.transform?(this.hierarchy.updateTransform(),this.transform.updateTransform(this.hierarchy.transform)):this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha;for(let t=0,s=this.children.length;tt.application)),this.app=this.renderSystem.application}componentChanged(t){return r(this,void 0,void 0,(function*(){"Lottie"===t.componentName&&(t.type===s.OBSERVER_TYPE.ADD?this.add(t):t.type===s.OBSERVER_TYPE.REMOVE&&this.remove(t))}))}add(t){return r(this,void 0,void 0,(function*(){this.manager=new ts(this.app);const e=t.component,i=this.renderSystem.containerManager.getContainer(t.gameObject.id);if(!i)return;const h=e.options,{resource:r}=h,n=function(t,s){var e={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&s.indexOf(i)<0&&(e[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var h=0;for(i=Object.getOwnPropertySymbols(t);h{var s;t.p&&(t.p=(s=t.p,Es<=8&&/^data:image\/png;base64/.test(s)?Vs(s):s))}));const l=this.manager.parseAnimation(Object.assign({keyframes:o},n));e.anim=l,i.addChildAt(l.group,0),this.managerLife.forEach((t=>{l.on(t,(s=>e.emit(t,s)))})),l.isImagesLoaded&&e.emit("success",{})}))}remove(t){const s=t.component,e=this.renderSystem.containerManager.getContainer(t.gameObject.id);e&&(e.removeChild(s.anim.group),s.anim.group.destory(!0)),s.anim=null}};Ns.systemName="LottieSystem",Ns=h([s.decorators.componentObserver({Lottie:[]})],Ns);var qs=Ns;class js extends s.Component{constructor(t){super(),this.loadStatus=!1,this.firstPlay=null,this.prevSlot={},this.currentSlot={},this.options=Object.assign({autoStart:!1},t),this.on("success",(()=>{this.loadStatus=!0;const{ip:t,op:s}=this.anim.keyframes;for(let e=t;e<=s;e++){const t=`@${e}`;this.anim.on(t,(s=>this.emit(t,s)))}this.firstPlay&&this.firstPlay()}))}play(t=[],s={repeats:0}){if(!this.loadStatus)return void(this.firstPlay=()=>{this.play(t,s)});const{slot:e=[]}=s;e.forEach((({name:t,type:s,value:e,style:h={}})=>{const{x:r,y:n,anchor:a={x:0,y:0},pivot:o={x:0,y:0},width:l,height:p}=h;"IMAGE"===s?this.currentSlot[t]=i.Sprite.from(e):"TEXT"===s&&(this.currentSlot[t]=new i.Text(e,new i.TextStyle(h))),r&&(this.currentSlot[t].x=r),n&&(this.currentSlot[t].y=n),l&&(this.currentSlot[t].width=l),p&&(this.currentSlot[t].height=p),this.currentSlot[t].anchor.set(a.x||0,a.y||0),this.currentSlot[t].pivot.set(this.currentSlot[t].width*(o.x||0),this.currentSlot[t].height*(o.y||0)),this.prevSlot[t]&&this.anim.unbindSlot(t,this.prevSlot[t]),this.anim.bindSlot(t,this.currentSlot[t]),this.prevSlot[t]=this.currentSlot[t]})),this.anim.playSegment(this.playParamsHandle(t),s)}playParamsHandle(t){let s=[].concat(t);const{keyframes:e}=this.anim;return!s.length||s.length>2?s=[e.ip,e.op]:1===s.length&&(s=[s[0]%e.op,e.op]),s}onTap(t,s){const e=new i.Graphics;this.on("success",(()=>{const i=this.anim.querySelector(t),h=i.display;e.beginFill(16777215),e.drawRect(0,0,100,100),e.endFill(),e.alpha=0,h.addChild(e),i.display.interactive=!0,i.display.on("pointertap",(()=>{s()}))}))}}js.componentName="Lottie",h([s.decorators.IDEProp],js.prototype,"slot",void 0),t.Lottie=js,t.LottieSystem=qs,Object.defineProperty(t,"__esModule",{value:!0})},"object"==typeof exports&&"undefined"!=typeof module?s(exports,require("@eva/eva.js"),require("@eva/plugin-renderer"),require("pixi.js")):"function"==typeof define&&define.amd?define(["exports","@eva/eva.js","@eva/plugin-renderer","pixi.js"],s):s(((t="undefined"!=typeof globalThis?globalThis:t||self).EVA=t.EVA||{},t.EVA.plugin=t.EVA.plugin||{},t.EVA.plugin.renderer=t.EVA.plugin.renderer||{},t.EVA.plugin.renderer.lottie={}),t.EVA,t.EVA.plugin.renderer,t.PIXI); diff --git a/dist/cdn/min/EVA.plugin.renderer.mask.min.js b/dist/cdn/min/EVA.plugin.renderer.mask.min.js deleted file mode 100644 index 4cb8e75a..00000000 --- a/dist/cdn/min/EVA.plugin.renderer.mask.min.js +++ /dev/null @@ -1 +0,0 @@ -var e,t;e=this,t=function(e,t,r,i){"use strict";function s(e,t,r,i){var s,n=arguments.length,o=n<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(n<3?s(o):n>3?s(t,r,o):s(t,r))||o);return n>3&&o&&Object.defineProperty(t,r,o),o}function n(e,t,r,i){return new(r||(r=Promise))((function(s,n){function o(e){try{c(i.next(e))}catch(e){n(e)}}function a(e){try{c(i.throw(e))}catch(e){n(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}c((i=i.apply(e,t||[])).next())}))}e.MASK_TYPE=void 0,function(e){e.Circle="Circle",e.Ellipse="Ellipse",e.Rect="Rect",e.RoundedRect="RoundedRect",e.Polygon="Polygon",e.Img="Img",e.Sprite="Sprite"}(e.MASK_TYPE||(e.MASK_TYPE={}));class o extends t.Component{constructor(){super(...arguments),this.style={},this.resource="",this.spriteName=""}init(e){Object.assign(this,e)}}o.componentName="Mask",s([t.decorators.IDEProp],o.prototype,"type",void 0),s([t.decorators.IDEProp],o.prototype,"style",void 0),s([t.decorators.IDEProp],o.prototype,"resource",void 0),s([t.decorators.IDEProp],o.prototype,"spriteName",void 0);const a={Circle:["x","y","radius"],Ellipse:["x","y","width","height"],Rect:["x","y","width","height"],RoundedRect:["x","y","width","height","radius"],Polygon:["paths"]},c={Circle:"drawCircle",Ellipse:"drawEllipse",Rect:"drawRect",RoundedRect:"drawRoundedRect",Polygon:"drawPolygon"};var p;!function(e){e.Circle="Circle",e.Ellipse="Ellipse",e.Rect="Rect",e.RoundedRect="RoundedRect",e.Polygon="Polygon",e.Img="Img",e.Sprite="Sprite"}(p||(p={}));let d=class extends r.Renderer{constructor(){super(...arguments),this.name="Mask",this.changedCache={},this.maskSpriteCache={}}init(){this.renderSystem=this.game.getSystem(r.RendererSystem),this.renderSystem.rendererManager.register(this)}rendererUpdate(){this.changedCache={}}componentChanged(e){if("Mask"===e.component.name)switch(e.type){case t.OBSERVER_TYPE.ADD:this.add(e);break;case t.OBSERVER_TYPE.REMOVE:this.remove(e);break;case t.OBSERVER_TYPE.CHANGE:this.change(e)}}add(e){const t=e.component;if(!(t.type in p))throw new Error("no have Mask type: "+t.type);if(!t.style)throw new Error("no have Mask style: "+t.type);let r;switch(t.type){case p.Circle:case p.Ellipse:case p.Rect:case p.RoundedRect:case p.Polygon:r=this.createGraphics(t);break;case p.Img:case p.Sprite:r=this.createSprite(t)}if(!r)throw new Error("no have mask instance, check your mask params: "+t.type);const i=this.containerManager.getContainer(e.gameObject.id);i.mask=r,i.addChild(r)}remove(e){const t=this.containerManager.getContainer(e.gameObject.id);t.removeChild(t.mask),t.mask.destroy(!0),t.mask=null,delete this.maskSpriteCache[e.component.gameObject.id]}change(e){if(this.changedCache[e.gameObject.id])return;const t=e.component;"type"===e.prop.prop[0]?(this.changedCache[e.gameObject.id]=!0,[p.Sprite,p.Img].indexOf(t.type)>-1?(this.remove(e),this.add(e)):this.redrawGraphics(e)):"style"===e.prop.prop[0]?[p.Sprite,p.Img].indexOf(t.type)>-1?this.changeSpriteStyle(t):this.redrawGraphics(e):("resource"===e.prop.prop[0]||"spriteName"===e.prop.prop[0])&&(this.changedCache[e.gameObject.id]=!0,this.changeSprite(t))}createGraphics(e){const t=new i.Graphics;return this.draw(t,e),t}redrawGraphics(e){const t=this.containerManager.getContainer(e.gameObject.id).mask;t.clear(),this.draw(t,e.component)}draw(e,t){const r=[];for(const e of a[t.type])r.push(t.style[e]);e.beginFill(0,1),e[c[t.type]](...r),e.endFill()}createSprite(e){const t=new i.Sprite(null);return this.maskSpriteCache[e.gameObject.id]=t,this.setSprite(e,t),t.sprite}changeSpriteStyle(e){const t=this.maskSpriteCache[e.gameObject.id];t.sprite.width=e.style.width,t.sprite.height=e.style.height,t.sprite.position.x=e.style.x,t.sprite.position.y=e.style.y}changeSprite(e){const t=this.maskSpriteCache[e.gameObject.id];this.setSprite(e,t)}setSprite(e,r){return n(this,void 0,void 0,(function*(){let i;try{i=yield t.resource.getResource(e.resource)}catch(e){throw new Error("mask resource load error")}if(e.type===p.Sprite){const t=e.resource+"_s|r|c_"+e.spriteName,s=i.instance[t];r.image=s}else r.image=i.data.image;r.sprite.width=e.style.width,r.sprite.height=e.style.height,r.sprite.position.x=e.style.x,r.sprite.position.y=e.style.y}))}};d.systemName="Mask",d=s([t.decorators.componentObserver({Mask:["type",{prop:["style"],deep:!0},"resource","spriteName"]})],d);var h=d;e.Mask=o,e.MaskSystem=h,Object.defineProperty(e,"__esModule",{value:!0})},"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@eva/eva.js"),require("@eva/plugin-renderer"),require("@eva/renderer-adapter")):"function"==typeof define&&define.amd?define(["exports","@eva/eva.js","@eva/plugin-renderer","@eva/renderer-adapter"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).EVA=e.EVA||{},e.EVA.plugin=e.EVA.plugin||{},e.EVA.plugin.renderer=e.EVA.plugin.renderer||{},e.EVA.plugin.renderer.mask={}),e.EVA,e.EVA.plugin.renderer,e.EVA.rendererAdapter); diff --git a/dist/cdn/min/EVA.plugin.renderer.matterjs.min.js b/dist/cdn/min/EVA.plugin.renderer.matterjs.min.js deleted file mode 100644 index ba816a23..00000000 --- a/dist/cdn/min/EVA.plugin.renderer.matterjs.min.js +++ /dev/null @@ -1 +0,0 @@ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@eva/eva.js")):"function"==typeof define&&define.amd?define(["exports","@eva/eva.js"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).EVA=e.EVA||{},e.EVA.plugin=e.EVA.plugin||{},e.EVA.plugin.renderer=e.EVA.plugin.renderer||{},e.EVA.plugin.renderer.matterjs={}),e.EVA)}(this,(function(e,t){"use strict";function n(){try{return require("poly-decomp")}catch(e){}}var i,o=function(e){var t={};function n(i){if(t[i])return t[i].exports;var o=t[i]={i:i,l:!1,exports:{}};return e[i].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(i,o,function(t){return e[t]}.bind(null,o));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=24)}([function(e,t){var n={};e.exports=n,function(){n._nextId=0,n._seed=0,n._nowStartTime=+new Date,n.extend=function(e,t){var i,o;"boolean"==typeof t?(i=2,o=t):(i=1,o=!0);for(var r=i;r0;t--){var i=Math.floor(n.random()*(t+1)),o=e[t];e[t]=e[i],e[i]=o}return e},n.choose=function(e){return e[Math.floor(n.random()*e.length)]},n.isElement=function(e){return"undefined"!=typeof HTMLElement?e instanceof HTMLElement:!!(e&&e.nodeType&&e.nodeName)},n.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)},n.isFunction=function(e){return"function"==typeof e},n.isPlainObject=function(e){return"object"==typeof e&&e.constructor===Object},n.isString=function(e){return"[object String]"===toString.call(e)},n.clamp=function(e,t,n){return en?n:e},n.sign=function(e){return e<0?-1:1},n.now=function(){if("undefined"!=typeof window&&window.performance){if(window.performance.now)return window.performance.now();if(window.performance.webkitNow)return window.performance.webkitNow()}return new Date-n._nowStartTime},n.random=function(t,n){return n=void 0!==n?n:1,(t=void 0!==t?t:0)+e()*(n-t)};var e=function(){return n._seed=(9301*n._seed+49297)%233280,n._seed/233280};n.colorToNumber=function(e){return 3==(e=e.replace("#","")).length&&(e=e.charAt(0)+e.charAt(0)+e.charAt(1)+e.charAt(1)+e.charAt(2)+e.charAt(2)),parseInt(e,16)},n.logLevel=1,n.log=function(){console&&n.logLevel>0&&n.logLevel<=3&&console.log.apply(console,["matter-js:"].concat(Array.prototype.slice.call(arguments)))},n.info=function(){console&&n.logLevel>0&&n.logLevel<=2&&console.info.apply(console,["matter-js:"].concat(Array.prototype.slice.call(arguments)))},n.warn=function(){console&&n.logLevel>0&&n.logLevel<=3&&console.warn.apply(console,["matter-js:"].concat(Array.prototype.slice.call(arguments)))},n.nextId=function(){return n._nextId++},n.indexOf=function(e,t){if(e.indexOf)return e.indexOf(t);for(var n=0;ne.max.x&&(e.max.x=o.x),o.xe.max.y&&(e.max.y=o.y),o.y0?e.max.x+=n.x:e.min.x+=n.x,n.y>0?e.max.y+=n.y:e.min.y+=n.y)},n.contains=function(e,t){return t.x>=e.min.x&&t.x<=e.max.x&&t.y>=e.min.y&&t.y<=e.max.y},n.overlaps=function(e,t){return e.min.x<=t.max.x&&e.max.x>=t.min.x&&e.max.y>=t.min.y&&e.min.y<=t.max.y},n.translate=function(e,t){e.min.x+=t.x,e.max.x+=t.x,e.min.y+=t.y,e.max.y+=t.y},n.shift=function(e,t){var n=e.max.x-e.min.x,i=e.max.y-e.min.y;e.min.x=t.x,e.max.x=t.x+n,e.min.y=t.y,e.max.y=t.y+i}},function(e,t){var n={};e.exports=n,n.create=function(e,t){return{x:e||0,y:t||0}},n.clone=function(e){return{x:e.x,y:e.y}},n.magnitude=function(e){return Math.sqrt(e.x*e.x+e.y*e.y)},n.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y},n.rotate=function(e,t,n){var i=Math.cos(t),o=Math.sin(t);n||(n={});var r=e.x*i-e.y*o;return n.y=e.x*o+e.y*i,n.x=r,n},n.rotateAbout=function(e,t,n,i){var o=Math.cos(t),r=Math.sin(t);i||(i={});var s=n.x+((e.x-n.x)*o-(e.y-n.y)*r);return i.y=n.y+((e.x-n.x)*r+(e.y-n.y)*o),i.x=s,i},n.normalise=function(e){var t=n.magnitude(e);return 0===t?{x:0,y:0}:{x:e.x/t,y:e.y/t}},n.dot=function(e,t){return e.x*t.x+e.y*t.y},n.cross=function(e,t){return e.x*t.y-e.y*t.x},n.cross3=function(e,t,n){return(t.x-e.x)*(n.y-e.y)-(t.y-e.y)*(n.x-e.x)},n.add=function(e,t,n){return n||(n={}),n.x=e.x+t.x,n.y=e.y+t.y,n},n.sub=function(e,t,n){return n||(n={}),n.x=e.x-t.x,n.y=e.y-t.y,n},n.mult=function(e,t){return{x:e.x*t,y:e.y*t}},n.div=function(e,t){return{x:e.x/t,y:e.y/t}},n.perp=function(e,t){return{x:(t=!0===t?-1:1)*-e.y,y:t*e.x}},n.neg=function(e){return{x:-e.x,y:-e.y}},n.angle=function(e,t){return Math.atan2(t.y-e.y,t.x-e.x)},n._temp=[n.create(),n.create(),n.create(),n.create(),n.create(),n.create()]},function(e,t,n){var i={};e.exports=i;var o=n(2),r=n(0);i.create=function(e,t){for(var n=[],i=0;i0)return!1}return!0},i.scale=function(e,t,n,r){if(1===t&&1===n)return e;var s,a;r=r||i.centre(e);for(var l=0;l=0?l-1:e.length-1],d=e[l],u=e[(l+1)%e.length],p=t[l0&&(r|=2),3===r)return!1;return 0!==r||null},i.hull=function(e){var t,n,i=[],r=[];for((e=e.slice(0)).sort((function(e,t){var n=e.x-t.x;return 0!==n?n:e.y-t.y})),n=0;n=2&&o.cross3(r[r.length-2],r[r.length-1],t)<=0;)r.pop();r.push(t)}for(n=e.length-1;n>=0;n-=1){for(t=e[n];i.length>=2&&o.cross3(i[i.length-2],i[i.length-1],t)<=0;)i.pop();i.push(t)}return i.pop(),r.pop(),i.concat(r)}},function(e,t,n){var i={};e.exports=i;var o=n(0);i.on=function(e,t,n){for(var i,o=t.split(" "),r=0;r0){n||(n={}),i=t.split(" ");for(var c=0;c0&&r.rotateAbout(s.position,n,e.position,s.position)}},i.setVelocity=function(e,t){e.positionPrev.x=e.position.x-t.x,e.positionPrev.y=e.position.y-t.y,e.velocity.x=t.x,e.velocity.y=t.y,e.speed=r.magnitude(e.velocity)},i.setAngularVelocity=function(e,t){e.anglePrev=e.angle-t,e.angularVelocity=t,e.angularSpeed=Math.abs(e.angularVelocity)},i.translate=function(e,t){i.setPosition(e,r.add(e.position,t))},i.rotate=function(e,t,n){if(n){var o=Math.cos(t),r=Math.sin(t),s=e.position.x-n.x,a=e.position.y-n.y;i.setPosition(e,{x:n.x+(s*o-a*r),y:n.y+(s*r+a*o)}),i.setAngle(e,e.angle+t)}else i.setAngle(e,e.angle+t)},i.scale=function(e,t,n,r){var s=0,a=0;r=r||e.position;for(var d=0;d0&&(s+=u.area,a+=u.inertia),u.position.x=r.x+(u.position.x-r.x)*t,u.position.y=r.y+(u.position.y-r.y)*n,l.update(u.bounds,u.vertices,e.velocity)}e.parts.length>1&&(e.area=s,e.isStatic||(i.setMass(e,e.density*s),i.setInertia(e,a))),e.circleRadius&&(t===n?e.circleRadius*=t:e.circleRadius=null)},i.update=function(e,t,n,i){var s=Math.pow(t*n*e.timeScale,2),a=1-e.frictionAir*n*e.timeScale,d=e.position.x-e.positionPrev.x,u=e.position.y-e.positionPrev.y;e.velocity.x=d*a*i+e.force.x/e.mass*s,e.velocity.y=u*a*i+e.force.y/e.mass*s,e.positionPrev.x=e.position.x,e.positionPrev.y=e.position.y,e.position.x+=e.velocity.x,e.position.y+=e.velocity.y,e.angularVelocity=(e.angle-e.anglePrev)*a*i+e.torque/e.inertia*s,e.anglePrev=e.angle,e.angle+=e.angularVelocity,e.speed=r.magnitude(e.velocity),e.angularSpeed=Math.abs(e.angularVelocity);for(var p=0;p0&&(f.position.x+=e.velocity.x,f.position.y+=e.velocity.y),0!==e.angularVelocity&&(o.rotate(f.vertices,e.angularVelocity,e.position),c.rotate(f.axes,e.angularVelocity),p>0&&r.rotateAbout(f.position,e.angularVelocity,e.position,f.position)),l.update(f.bounds,f.vertices,e.velocity)}},i.applyForce=function(e,t,n){e.force.x+=n.x,e.force.y+=n.y;var i=t.x-e.position.x,o=t.y-e.position.y;e.torque+=i*n.y-o*n.x},i._totalProperties=function(e){for(var t={mass:0,area:0,inertia:0,centre:{x:0,y:0}},n=1===e.parts.length?0:1;n0&&r.motion=r.sleepThreshold&&i.set(r,!0)):r.sleepCounter>0&&(r.sleepCounter-=1)}else i.set(r,!1)}},i.afterCollisions=function(e,t){for(var n=t*t*t,o=0;oi._motionWakeThreshold*n&&i.set(c,!1)}}}},i.set=function(e,t){var n=e.isSleeping;t?(e.isSleeping=!0,e.sleepCounter=e.sleepThreshold,e.positionImpulse.x=0,e.positionImpulse.y=0,e.positionPrev.x=e.position.x,e.positionPrev.y=e.position.y,e.anglePrev=e.angle,e.speed=0,e.angularSpeed=0,e.motion=0,n||o.trigger(e,"sleepStart")):(e.isSleeping=!1,e.sleepCounter=0,n&&o.trigger(e,"sleepEnd"))}},function(e,t,n){var i={};e.exports=i;var o=n(3),r=n(2),s=n(7),a=n(1),l=n(15),c=n(0);i._warming=.4,i._torqueDampen=1,i._minLength=1e-6,i.create=function(e){var t=e;t.bodyA&&!t.pointA&&(t.pointA={x:0,y:0}),t.bodyB&&!t.pointB&&(t.pointB={x:0,y:0});var n=t.bodyA?r.add(t.bodyA.position,t.pointA):t.pointA,i=t.bodyB?r.add(t.bodyB.position,t.pointB):t.pointB,o=r.magnitude(r.sub(n,i));t.length=void 0!==t.length?t.length:o,t.id=t.id||c.nextId(),t.label=t.label||"Constraint",t.type="constraint",t.stiffness=t.stiffness||(t.length>0?1:.7),t.damping=t.damping||0,t.angularStiffness=t.angularStiffness||0,t.angleA=t.bodyA?t.bodyA.angle:t.angleA,t.angleB=t.bodyB?t.bodyB.angle:t.angleB,t.plugin={};var s={visible:!0,lineWidth:2,strokeStyle:"#ffffff",type:"line",anchors:!0};return 0===t.length&&t.stiffness>.1?(s.type="pin",s.anchors=!1):t.stiffness<.9&&(s.type="spring"),t.render=c.extend(s,t.render),t},i.preSolveAll=function(e){for(var t=0;t0&&(u.position.x+=c.x,u.position.y+=c.y),0!==c.angle&&(o.rotate(u.vertices,c.angle,n.position),l.rotate(u.axes,c.angle),d>0&&r.rotateAbout(u.position,c.angle,n.position,u.position)),a.update(u.bounds,u.vertices,n.velocity)}c.angle*=i._warming,c.x*=i._warming,c.y*=i._warming}}},i.pointAWorld=function(e){return{x:(e.bodyA?e.bodyA.position.x:0)+e.pointA.x,y:(e.bodyA?e.bodyA.position.y:0)+e.pointA.y}},i.pointBWorld=function(e){return{x:(e.bodyB?e.bodyB.position.x:0)+e.pointB.x,y:(e.bodyB?e.bodyB.position.y:0)+e.pointB.y}}},function(e,t,n){var i={};e.exports=i;var o=n(18);i.create=function(e,t){var n=e.bodyA,o=e.bodyB,r=e.parentA,s=e.parentB,a={id:i.id(n,o),bodyA:n,bodyB:o,contacts:{},activeContacts:[],separation:0,isActive:!0,confirmedActive:!0,isSensor:n.isSensor||o.isSensor,timeCreated:t,timeUpdated:t,inverseMass:r.inverseMass+s.inverseMass,friction:Math.min(r.friction,s.friction),frictionStatic:Math.max(r.frictionStatic,s.frictionStatic),restitution:Math.max(r.restitution,s.restitution),slop:Math.max(r.slop,s.slop)};return i.update(a,e,t),a},i.update=function(e,t,n){var r=e.contacts,s=t.supports,a=e.activeContacts,l=t.parentA,c=t.parentB;if(e.collision=t,e.inverseMass=l.inverseMass+c.inverseMass,e.friction=Math.min(l.friction,c.friction),e.frictionStatic=Math.max(l.frictionStatic,c.frictionStatic),e.restitution=Math.max(l.restitution,c.restitution),e.slop=Math.max(l.slop,c.slop),a.length=0,t.collided){for(var d=0;dr.max.x&&(r.max.x=c.x),l.yr.max.y&&(r.max.y=c.y))}var u=r.max.x-r.min.x+2*n.x,p=r.max.y-r.min.y+2*n.y,f=e.canvas.height,v=e.canvas.width/f,m=u/p,y=1,g=1;m>v?g=m/v:y=v/m,e.options.hasBounds=!0,e.bounds.min.x=r.min.x,e.bounds.max.x=r.min.x+u*y,e.bounds.min.y=r.min.y,e.bounds.max.y=r.min.y+p*g,i&&(e.bounds.min.x+=.5*u-u*y*.5,e.bounds.max.x+=.5*u-u*y*.5,e.bounds.min.y+=.5*p-p*g*.5,e.bounds.max.y+=.5*p-p*g*.5),e.bounds.min.x-=n.x,e.bounds.max.x-=n.x,e.bounds.min.y-=n.y,e.bounds.max.y-=n.y,e.mouse&&(d.setScale(e.mouse,{x:(e.bounds.max.x-e.bounds.min.x)/e.canvas.width,y:(e.bounds.max.y-e.bounds.min.y)/e.canvas.height}),d.setOffset(e.mouse,e.bounds.min))},i.startViewTransform=function(e){var t=e.bounds.max.x-e.bounds.min.x,n=e.bounds.max.y-e.bounds.min.y,i=t/e.options.width,o=n/e.options.height;e.context.setTransform(e.options.pixelRatio/i,0,0,e.options.pixelRatio/o,0,0),e.context.translate(-e.bounds.min.x,-e.bounds.min.y)},i.endViewTransform=function(e){e.context.setTransform(e.options.pixelRatio,0,0,e.options.pixelRatio,0,0)},i.world=function(e){var t,n=e.engine,o=n.world,u=e.canvas,p=e.context,v=e.options,m=r.allBodies(o),y=r.allConstraints(o),g=v.wireframes?v.wireframeBackground:v.background,h=[],x=[],b={timestamp:n.timing.timestamp};if(a.trigger(e,"beforeRender",b),e.currentBackground!==g&&f(e,g),p.globalCompositeOperation="source-in",p.fillStyle="transparent",p.fillRect(0,0,u.width,u.height),p.globalCompositeOperation="source-over",v.hasBounds){for(t=0;t=500){var u="";s.timing&&(u+="fps: "+Math.round(s.timing.fps)+d),s.extended&&(s.timing&&(u+="delta: "+s.timing.delta.toFixed(3)+d,u+="correction: "+s.timing.correction.toFixed(3)+d),u+="bodies: "+c.length+d,i.broadphase.controller===l&&(u+="buckets: "+s.buckets+d),u+="\n",u+="collisions: "+s.collisions+d,u+="pairs: "+i.pairs.list.length+d,u+="broad: "+s.broadEff+d,u+="mid: "+s.midEff+d,u+="narrow: "+s.narrowEff+d),e.debugString=u,e.debugTimestamp=i.timing.timestamp}if(e.debugString){n.font="12px Arial",a.wireframes?n.fillStyle="rgba(255,255,255,0.5)":n.fillStyle="rgba(0,0,0,0.5)";for(var p=e.debugString.split("\n"),f=0;f1?1:0;a1?1:0;a1?1:0;r1?1:0;a1?1:0;s1?1:0;s1?1:0;o0)){var d=i.activeContacts[0].vertex.x,u=i.activeContacts[0].vertex.y;2===i.activeContacts.length&&(d=(i.activeContacts[0].vertex.x+i.activeContacts[1].vertex.x)/2,u=(i.activeContacts[0].vertex.y+i.activeContacts[1].vertex.y)/2),o.bodyB===o.supports[0].body||!0===o.bodyA.isStatic?a.moveTo(d-8*o.normal.x,u-8*o.normal.y):a.moveTo(d+8*o.normal.x,u+8*o.normal.y),a.lineTo(d,u)}l.wireframes?a.strokeStyle="rgba(255,165,0,0.7)":a.strokeStyle="orange",a.lineWidth=1,a.stroke()},i.separations=function(e,t,n){var i,o,r,s,a,l=n,c=e.options;for(l.beginPath(),a=0;ad.bounds.max.x||v.bounds.max.yd.bounds.max.y)){var m=i._getRegion(e,v);if(!v.region||m.id!==v.region.id||o){f.broadphaseTests+=1,v.region&&!o||(v.region=m);var y=i._regionUnion(m,v.region);for(s=y.startCol;s<=y.endCol;s++)for(a=y.startRow;a<=y.endRow;a++){l=u[c=i._getBucketId(s,a)];var g=s>=m.startCol&&s<=m.endCol&&a>=m.startRow&&a<=m.endRow,h=s>=v.region.startCol&&s<=v.region.endCol&&a>=v.region.startRow&&a<=v.region.endRow;!g&&h&&h&&l&&i._bucketRemoveBody(e,l,v),(v.region===m||g&&!h||o)&&(l||(l=i._createBucket(u,c)),i._bucketAddBody(e,l,v))}v.region=m,p=!0}}}p&&(e.pairsList=i._createActivePairsList(e))},i.clear=function(e){e.buckets={},e.pairs={},e.pairsList=[]},i._regionUnion=function(e,t){var n=Math.min(e.startCol,t.startCol),o=Math.max(e.endCol,t.endCol),r=Math.min(e.startRow,t.startRow),s=Math.max(e.endRow,t.endRow);return i._createRegion(n,o,r,s)},i._getRegion=function(e,t){var n=t.bounds,o=Math.floor(n.min.x/e.bucketWidth),r=Math.floor(n.max.x/e.bucketWidth),s=Math.floor(n.min.y/e.bucketHeight),a=Math.floor(n.max.y/e.bucketHeight);return i._createRegion(o,r,s,a)},i._createRegion=function(e,t,n,i){return{id:e+","+t+","+n+","+i,startCol:e,endCol:t,startRow:n,endRow:i}},i._getBucketId=function(e,t){return"C"+e+"R"+t},i._createBucket=function(e,t){return e[t]=[]},i._bucketAddBody=function(e,t,n){for(var i=0;i0?i.push(n):delete e.pairs[t[o]];return i}},function(e,t,n){var i={};e.exports=i;var o=n(13),r=n(9),s=n(1);i.collisions=function(e,t){for(var n=[],a=t.pairs.table,l=t.metrics,c=0;c1?1:0;p1?1:0;v0:0!=(e.mask&t.category)&&0!=(t.mask&e.category)}},function(e,t,n){var i={};e.exports=i;var o=n(3),r=n(2);i.collides=function(e,t,n){var s,a,l,c,d=!1;if(n){var u=e.parent,p=t.parent,f=u.speed*u.speed+u.angularSpeed*u.angularSpeed+p.speed*p.speed+p.angularSpeed*p.angularSpeed;d=n&&n.collided&&f<.2,c=n}else c={collided:!1,bodyA:e,bodyB:t};if(n&&d){var v=c.axisBody,m=v===e?t:e,y=[v.axes[n.axisNumber]];if(l=i._overlapAxes(v.vertices,m.vertices,y),c.reused=!0,l.overlap<=0)return c.collided=!1,c}else{if((s=i._overlapAxes(e.vertices,t.vertices,e.axes)).overlap<=0)return c.collided=!1,c;if((a=i._overlapAxes(t.vertices,e.vertices,t.axes)).overlap<=0)return c.collided=!1,c;s.overlapo?o=a:a=0?s.index-1:d.length-1],c.x=o.x-u.x,c.y=o.y-u.y,l=-r.dot(n,c),a=o,o=d[(s.index+1)%d.length],c.x=o.x-u.x,c.y=o.y-u.y,(i=-r.dot(n,c))0&&o.area(B)1?(v=s.create(r.extend({parts:m.slice(0)},c)),s.setPosition(v,{x:e,y:t}),v):m[0]}},function(e,t,n){var i={};e.exports=i;var o=n(0);i._registry={},i.register=function(e){if(i.isPlugin(e)||o.warn("Plugin.register:",i.toString(e),"does not implement all required fields."),e.name in i._registry){var t=i._registry[e.name],n=i.versionParse(e.version).number,r=i.versionParse(t.version).number;n>r?(o.warn("Plugin.register:",i.toString(t),"was upgraded to",i.toString(e)),i._registry[e.name]=e):n-1},i.isFor=function(e,t){var n=e.for&&i.dependencyParse(e.for);return!e.for||t.name===n.name&&i.versionSatisfies(t.version,n.range)},i.use=function(e,t){if(e.uses=(e.uses||[]).concat(t||[]),0!==e.uses.length){for(var n=i.dependencies(e),r=o.topologicalSort(n),s=[],a=0;a0&&o.info(s.join(" "))}else o.warn("Plugin.use:",i.toString(e),"does not specify any dependencies to install.")},i.dependencies=function(e,t){var n=i.dependencyParse(e),r=n.name;if(!(r in(t=t||{}))){e=i.resolve(e)||e,t[r]=o.map(e.uses||[],(function(t){i.isPlugin(t)&&i.register(t);var r=i.dependencyParse(t),s=i.resolve(t);return s&&!i.versionSatisfies(s.version,r.range)?(o.warn("Plugin.dependencies:",i.toString(s),"does not satisfy",i.toString(r),"used by",i.toString(n)+"."),s._warned=!0,e._warned=!0):s||(o.warn("Plugin.dependencies:",i.toString(t),"used by",i.toString(n),"could not be resolved."),e._warned=!0),r.name}));for(var s=0;s=o[2];if("^"===n.operator)return o[0]>0?s[0]===o[0]&&r.number>=n.number:o[1]>0?s[1]===o[1]&&s[2]>=o[2]:s[2]===o[2]}return e===t||"*"===e}},function(e,t){var n={};e.exports=n,n.create=function(e){return{id:n.id(e),vertex:e,normalImpulse:0,tangentImpulse:0}},n.id=function(e){return e.body.id+"_"+e.index}},function(e,t,n){var i={};e.exports=i;var o=n(5);n(8);var r=n(0);i.create=function(e){var t=o.create(),n={label:"World",gravity:{x:0,y:1,scale:.001},bounds:{min:{x:-1/0,y:-1/0},max:{x:1/0,y:1/0}}};return r.extend(t,n,e)}},function(e,t,n){var i={};e.exports=i;var o=n(9),r=n(0);i._pairMaxIdleLife=1e3,i.create=function(e){return r.extend({table:{},list:[],collisionStart:[],collisionActive:[],collisionEnd:[]},e)},i.update=function(e,t,n){var i,r,s,a,l=e.list,c=e.table,d=e.collisionStart,u=e.collisionEnd,p=e.collisionActive;for(d.length=0,u.length=0,p.length=0,a=0;ai._pairMaxIdleLife&&c.push(s);for(s=0;sf.friction*f.frictionStatic*O*n&&(L=T,V=s.clamp(f.friction*R*n,-L,L));var F=r.cross(P,g),j=r.cross(C,g),W=b/(m.inverseMass+y.inverseMass+m.inverseInertia*F*F+y.inverseInertia*j*j);if(E*=W,V*=W,I<0&&I*I>i._restingThresh*n)S.normalImpulse=0;else{var q=S.normalImpulse;S.normalImpulse=Math.min(S.normalImpulse+E,0),E=S.normalImpulse-q}if(_*_>i._restingThreshTangent*n)S.tangentImpulse=0;else{var N=S.tangentImpulse;S.tangentImpulse=s.clamp(S.tangentImpulse+V,-L,L),V=S.tangentImpulse-N}o.x=g.x*E+h.x*V,o.y=g.y*E+h.y*V,m.isStatic||m.isSleeping||(m.positionPrev.x+=o.x*m.inverseMass,m.positionPrev.y+=o.y*m.inverseMass,m.anglePrev+=r.cross(P,o)*m.inverseInertia),y.isStatic||y.isSleeping||(y.positionPrev.x-=o.x*y.inverseMass,y.positionPrev.y-=o.y*y.inverseMass,y.anglePrev-=r.cross(C,o)*y.inverseInertia)}}}}},function(e,t,n){var i={};e.exports=i;var o=n(19),r=n(7),s=n(21),a=n(10),l=n(20),c=n(23),d=n(11),u=n(4),p=n(5),f=n(8),v=n(0),m=n(6);i.create=function(e,t){t=(t=v.isElement(e)?t:e)||{},((e=v.isElement(e)?e:null)||t.render)&&v.warn("Engine.create: engine.render is deprecated (see docs)");var n={positionIterations:6,velocityIterations:4,constraintIterations:2,enableSleeping:!1,events:[],plugin:{},timing:{timestamp:0,timeScale:1},broadphase:{controller:d}},i=v.extend(n,t);if(e||i.render){var r={element:e,controller:a};i.render=v.extend(r,i.render)}return i.render&&i.render.controller&&(i.render=i.render.controller.create(i.render)),i.render&&(i.render.engine=i),i.world=t.world||o.create(i.world),i.pairs=l.create(),i.broadphase=i.broadphase.controller.create(i.broadphase),i.metrics=i.metrics||{extended:!1},i.metrics=c.create(i.metrics),i},i.update=function(e,t,n){t=t||1e3/60,n=n||1;var o,a=e.world,d=e.timing,v=e.broadphase,m=[];d.timestamp+=t*d.timeScale;var y={timestamp:d.timestamp};u.trigger(e,"beforeUpdate",y);var g=p.allBodies(a),h=p.allConstraints(a);for(c.reset(e.metrics),e.enableSleeping&&r.update(g,d.timeScale),i._bodiesApplyGravity(g,a.gravity),i._bodiesUpdate(g,t,d.timeScale,n,a.bounds),f.preSolveAll(g),o=0;o0&&u.trigger(e,"collisionStart",{pairs:b.collisionStart}),s.preSolvePosition(b.list),o=0;o0&&u.trigger(e,"collisionActive",{pairs:b.collisionActive}),b.collisionEnd.length>0&&u.trigger(e,"collisionEnd",{pairs:b.collisionEnd}),c.update(e.metrics,e),i._bodiesClearForces(g),u.trigger(e,"afterUpdate",y),e},i.merge=function(e,t){if(v.extend(e,t),t.world){e.world=t.world,i.clear(e);for(var n=p.allBodies(e.world),o=0;o1?1:0;de.deltaMax?e.deltaMax:i)/e.delta,e.delta=i),0!==e.timeScalePrev&&(r*=o.timeScale/e.timeScalePrev),0===o.timeScale&&(r=0),e.timeScalePrev=o.timeScale,e.correction=r,e.frameCounter+=1,n-e.counterTimestamp>=1e3&&(e.fps=e.frameCounter*((n-e.counterTimestamp)/1e3),e.counterTimestamp=n,e.frameCounter=0),a.trigger(e,"tick",s),a.trigger(t,"tick",s),t.world.isModified&&t.render&&t.render.controller&&t.render.controller.clear&&t.render.controller.clear(t.render),a.trigger(e,"beforeUpdate",s),l.update(t,i,r),a.trigger(e,"afterUpdate",s),t.render&&t.render.controller&&(a.trigger(e,"beforeRender",s),a.trigger(t,"beforeRender",s),t.render.controller.world(t.render),a.trigger(e,"afterRender",s),a.trigger(t,"afterRender",s)),a.trigger(e,"afterTick",s),a.trigger(t,"afterTick",s)},i.stop=function(e){r(e.frameRequestId)},i.start=function(e,t){i.run(e,t)}},function(e,t,n){var i={};e.exports=i;var o=n(5),r=n(8),s=n(0),a=n(6),l=n(16);i.stack=function(e,t,n,i,r,s,l){for(var c,d=o.create({label:"Stack"}),u=e,p=t,f=0,v=0;vm&&(m=h),a.translate(g,{x:.5*x,y:.5*h}),u=g.bounds.max.x+r,o.addBody(d,g),c=g,f+=1}else u+=r}p+=m+s,u=e}return d},i.chain=function(e,t,n,i,a,l){for(var c=e.bodies,d=1;d0)for(c=0;c0&&(p=f[c-1+(l-1)*t],o.addConstraint(e,r.create(s.extend({bodyA:p,bodyB:u},a)))),i&&cp||s<(c=p-c)||s>n-1-c))return 1===u&&a.translate(d,{x:(s+(n%2==1?1:-1))*f,y:0}),l(e+(d?s*f:0)+s*r,i,s,c,d,u)}))},i.newtonsCradle=function(e,t,n,i,s){for(var a=o.create({label:"Newtons Cradle"}),c=0;c1;if(!p||e!=p.x||t!=p.y){p&&i?(f=p.x,v=p.y):(f=0,v=0);var o={x:f+e,y:v+t};!i&&p||(p=o),m.push(o),g=f+e,h=v+t}},b=function(e){var t=e.pathSegTypeAsLetter.toUpperCase();if("Z"!==t){switch(t){case"M":case"L":case"T":case"C":case"S":case"Q":g=e.x,h=e.y;break;case"H":g=e.x;break;case"V":h=e.y}x(g,h,e.pathSegType)}};for(i._svgPathToAbsolute(e),s=e.getTotalLength(),c=[],n=0;n1?1:0;p{o.Events.on(this.engine,e,(t=>{const n=t.pairs||[];for(let t=0;t{o.Events.on(this.engine,e,(t=>{t.source.world.bodies.forEach((t=>{t.component.emit(e,t,t.component.gameObject)}))}))}))}}let l=class extends t.System{init(e){this.engine=new a(this.game,e),this.game.canvas.setAttribute("data-pixel-ratio",e.resolution||"1")}awake(){}start(){this.engine.start()}update(){const e=this.componentObserver.clear();for(const t of e)t&&"Physics"===t.componentName&&this.componentChanged(t);this.engine.update()}componentChanged(e){switch(e.type){case t.OBSERVER_TYPE.ADD:this.engine.add(e.component);break;case t.OBSERVER_TYPE.CHANGE:case t.OBSERVER_TYPE.REMOVE:}}lateUpdate(){}onResume(){this.engine.enabled||this.engine.awake()}onPause(){this.engine.stop()}onDestroy(){}};l.systemName="PhysicsSystem",l=function(e,t,n,i){var o,r=arguments.length,s=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(s=(r<3?o(s):r>3?o(t,n,s):o(t,n))||s);return r>3&&s&&Object.defineProperty(t,n,s),s}([t.decorators.componentObserver({Physics:[{prop:["bodyParams"],deep:!0}]})],l);var c=l;e.Physics=r,e.PhysicsSystem=c,Object.defineProperty(e,"__esModule",{value:!0})})); diff --git a/dist/cdn/min/EVA.plugin.renderer.min.js b/dist/cdn/min/EVA.plugin.renderer.min.js deleted file mode 100644 index 2d09e02c..00000000 --- a/dist/cdn/min/EVA.plugin.renderer.min.js +++ /dev/null @@ -1,975 +0,0 @@ -!(function (e, t) { - 'object' == typeof exports && 'undefined' != typeof module - ? t(exports, require('@eva/eva.js'), require('@eva/renderer-adapter'), require('pixi.js')) - : 'function' == typeof define && define.amd - ? define(['exports', '@eva/eva.js', '@eva/renderer-adapter', 'pixi.js'], t) - : t( - (((e = 'undefined' != typeof globalThis ? globalThis : e || self).EVA = e.EVA || {}), - (e.EVA.plugin = e.EVA.plugin || {}), - (e.EVA.plugin.renderer = {})), - e.EVA, - e.EVA.rendererAdapter, - e.PIXI, - ); -})(this, function (e, t, r, n) { - 'use strict'; - function o(e, t, r, n) { - var o, - a = arguments.length, - i = a < 3 ? t : null === n ? (n = Object.getOwnPropertyDescriptor(t, r)) : n; - if ('object' == typeof Reflect && 'function' == typeof Reflect.decorate) i = Reflect.decorate(e, t, r, n); - else for (var s = e.length - 1; s >= 0; s--) (o = e[s]) && (i = (a < 3 ? o(i) : a > 3 ? o(t, r, i) : o(t, r)) || i); - return a > 3 && i && Object.defineProperty(t, r, i), i; - } - function a(e, t) { - return e === t || (e != e && t != t); - } - function i(e, t) { - for (var r = e.length; r--; ) if (a(e[r][0], t)) return r; - return -1; - } - var s = Array.prototype.splice; - function c(e) { - var t = -1, - r = null == e ? 0 : e.length; - for (this.clear(); ++t < r; ) { - var n = e[t]; - this.set(n[0], n[1]); - } - } - (c.prototype.clear = function () { - (this.__data__ = []), (this.size = 0); - }), - (c.prototype.delete = function (e) { - var t = this.__data__, - r = i(t, e); - return !(r < 0) && (r == t.length - 1 ? t.pop() : s.call(t, r, 1), --this.size, !0); - }), - (c.prototype.get = function (e) { - var t = this.__data__, - r = i(t, e); - return r < 0 ? void 0 : t[r][1]; - }), - (c.prototype.has = function (e) { - return i(this.__data__, e) > -1; - }), - (c.prototype.set = function (e, t) { - var r = this.__data__, - n = i(r, e); - return n < 0 ? (++this.size, r.push([e, t])) : (r[n][1] = t), this; - }); - var u = 'object' == typeof global && global && global.Object === Object && global, - p = 'object' == typeof self && self && self.Object === Object && self, - l = u || p || Function('return this')(), - f = l.Symbol, - h = Object.prototype, - d = h.hasOwnProperty, - v = h.toString, - y = f ? f.toStringTag : void 0; - var _ = Object.prototype.toString; - var b = f ? f.toStringTag : void 0; - function g(e) { - return null == e - ? void 0 === e - ? '[object Undefined]' - : '[object Null]' - : b && b in Object(e) - ? (function (e) { - var t = d.call(e, y), - r = e[y]; - try { - e[y] = void 0; - var n = !0; - } catch (e) {} - var o = v.call(e); - return n && (t ? (e[y] = r) : delete e[y]), o; - })(e) - : (function (e) { - return _.call(e); - })(e); - } - function m(e) { - var t = typeof e; - return null != e && ('object' == t || 'function' == t); - } - function j(e) { - if (!m(e)) return !1; - var t = g(e); - return ( - '[object Function]' == t || '[object GeneratorFunction]' == t || '[object AsyncFunction]' == t || '[object Proxy]' == t - ); - } - var O, - w = l['__core-js_shared__'], - E = (O = /[^.]+$/.exec((w && w.keys && w.keys.IE_PROTO) || '')) ? 'Symbol(src)_1.' + O : ''; - var A = Function.prototype.toString; - function S(e) { - if (null != e) { - try { - return A.call(e); - } catch (e) {} - try { - return e + ''; - } catch (e) {} - } - return ''; - } - var C = /^\[object .+?Constructor\]$/, - x = Function.prototype, - M = Object.prototype, - R = x.toString, - P = M.hasOwnProperty, - T = RegExp( - '^' + - R.call(P) - .replace(/[\\^$.*+?()[\]{}|]/g, '\\$&') - .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + - '$', - ); - function z(e) { - return !(!m(e) || ((t = e), E && E in t)) && (j(e) ? T : C).test(S(e)); - var t; - } - function N(e, t) { - var r = (function (e, t) { - return null == e ? void 0 : e[t]; - })(e, t); - return z(r) ? r : void 0; - } - var D = N(l, 'Map'), - V = N(Object, 'create'); - var k = Object.prototype.hasOwnProperty; - var I = Object.prototype.hasOwnProperty; - function L(e) { - var t = -1, - r = null == e ? 0 : e.length; - for (this.clear(); ++t < r; ) { - var n = e[t]; - this.set(n[0], n[1]); - } - } - function B(e, t) { - var r, - n, - o = e.__data__; - return ('string' == (n = typeof (r = t)) || 'number' == n || 'symbol' == n || 'boolean' == n ? '__proto__' !== r : null === r) - ? o['string' == typeof t ? 'string' : 'hash'] - : o.map; - } - function U(e) { - var t = -1, - r = null == e ? 0 : e.length; - for (this.clear(); ++t < r; ) { - var n = e[t]; - this.set(n[0], n[1]); - } - } - (L.prototype.clear = function () { - (this.__data__ = V ? V(null) : {}), (this.size = 0); - }), - (L.prototype.delete = function (e) { - var t = this.has(e) && delete this.__data__[e]; - return (this.size -= t ? 1 : 0), t; - }), - (L.prototype.get = function (e) { - var t = this.__data__; - if (V) { - var r = t[e]; - return '__lodash_hash_undefined__' === r ? void 0 : r; - } - return k.call(t, e) ? t[e] : void 0; - }), - (L.prototype.has = function (e) { - var t = this.__data__; - return V ? void 0 !== t[e] : I.call(t, e); - }), - (L.prototype.set = function (e, t) { - var r = this.__data__; - return (this.size += this.has(e) ? 0 : 1), (r[e] = V && void 0 === t ? '__lodash_hash_undefined__' : t), this; - }), - (U.prototype.clear = function () { - (this.size = 0), (this.__data__ = {hash: new L(), map: new (D || c)(), string: new L()}); - }), - (U.prototype.delete = function (e) { - var t = B(this, e).delete(e); - return (this.size -= t ? 1 : 0), t; - }), - (U.prototype.get = function (e) { - return B(this, e).get(e); - }), - (U.prototype.has = function (e) { - return B(this, e).has(e); - }), - (U.prototype.set = function (e, t) { - var r = B(this, e), - n = r.size; - return r.set(e, t), (this.size += r.size == n ? 0 : 1), this; - }); - function $(e) { - var t = (this.__data__ = new c(e)); - this.size = t.size; - } - ($.prototype.clear = function () { - (this.__data__ = new c()), (this.size = 0); - }), - ($.prototype.delete = function (e) { - var t = this.__data__, - r = t.delete(e); - return (this.size = t.size), r; - }), - ($.prototype.get = function (e) { - return this.__data__.get(e); - }), - ($.prototype.has = function (e) { - return this.__data__.has(e); - }), - ($.prototype.set = function (e, t) { - var r = this.__data__; - if (r instanceof c) { - var n = r.__data__; - if (!D || n.length < 199) return n.push([e, t]), (this.size = ++r.size), this; - r = this.__data__ = new U(n); - } - return r.set(e, t), (this.size = r.size), this; - }); - function F(e) { - var t = -1, - r = null == e ? 0 : e.length; - for (this.__data__ = new U(); ++t < r; ) this.add(e[t]); - } - function Y(e, t) { - for (var r = -1, n = null == e ? 0 : e.length; ++r < n; ) if (t(e[r], r, e)) return !0; - return !1; - } - (F.prototype.add = F.prototype.push = function (e) { - return this.__data__.set(e, '__lodash_hash_undefined__'), this; - }), - (F.prototype.has = function (e) { - return this.__data__.has(e); - }); - function W(e, t, r, n, o, a) { - var i = 1 & r, - s = e.length, - c = t.length; - if (s != c && !(i && c > s)) return !1; - var u = a.get(e), - p = a.get(t); - if (u && p) return u == t && p == e; - var l = -1, - f = !0, - h = 2 & r ? new F() : void 0; - for (a.set(e, t), a.set(t, e); ++l < s; ) { - var d = e[l], - v = t[l]; - if (n) var y = i ? n(v, d, l, t, e, a) : n(d, v, l, e, t, a); - if (void 0 !== y) { - if (y) continue; - f = !1; - break; - } - if (h) { - if ( - !Y(t, function (e, t) { - if (((i = t), !h.has(i) && (d === e || o(d, e, r, n, a)))) return h.push(t); - var i; - }) - ) { - f = !1; - break; - } - } else if (d !== v && !o(d, v, r, n, a)) { - f = !1; - break; - } - } - return a.delete(e), a.delete(t), f; - } - var q = l.Uint8Array; - function G(e) { - var t = -1, - r = Array(e.size); - return ( - e.forEach(function (e, n) { - r[++t] = [n, e]; - }), - r - ); - } - function K(e) { - var t = -1, - r = Array(e.size); - return ( - e.forEach(function (e) { - r[++t] = e; - }), - r - ); - } - var H = f ? f.prototype : void 0, - X = H ? H.valueOf : void 0; - var J = Array.isArray; - var Q = Object.prototype.propertyIsEnumerable, - Z = Object.getOwnPropertySymbols, - ee = Z - ? function (e) { - return null == e - ? [] - : ((e = Object(e)), - (function (e, t) { - for (var r = -1, n = null == e ? 0 : e.length, o = 0, a = []; ++r < n; ) { - var i = e[r]; - t(i, r, e) && (a[o++] = i); - } - return a; - })(Z(e), function (t) { - return Q.call(e, t); - })); - } - : function () { - return []; - }; - function te(e) { - return null != e && 'object' == typeof e; - } - function re(e) { - return te(e) && '[object Arguments]' == g(e); - } - var ne = Object.prototype, - oe = ne.hasOwnProperty, - ae = ne.propertyIsEnumerable, - ie = re( - (function () { - return arguments; - })(), - ) - ? re - : function (e) { - return te(e) && oe.call(e, 'callee') && !ae.call(e, 'callee'); - }; - var se = 'object' == typeof e && e && !e.nodeType && e, - ce = se && 'object' == typeof module && module && !module.nodeType && module, - ue = ce && ce.exports === se ? l.Buffer : void 0, - pe = - (ue ? ue.isBuffer : void 0) || - function () { - return !1; - }, - le = /^(?:0|[1-9]\d*)$/; - function fe(e, t) { - var r = typeof e; - return ( - !!(t = null == t ? 9007199254740991 : t) && - ('number' == r || ('symbol' != r && le.test(e))) && - e > -1 && - e % 1 == 0 && - e < t - ); - } - function he(e) { - return 'number' == typeof e && e > -1 && e % 1 == 0 && e <= 9007199254740991; - } - var de = {}; - (de['[object Float32Array]'] = de['[object Float64Array]'] = de['[object Int8Array]'] = de['[object Int16Array]'] = de[ - '[object Int32Array]' - ] = de['[object Uint8Array]'] = de['[object Uint8ClampedArray]'] = de['[object Uint16Array]'] = de[ - '[object Uint32Array]' - ] = !0), - (de['[object Arguments]'] = de['[object Array]'] = de['[object ArrayBuffer]'] = de['[object Boolean]'] = de[ - '[object DataView]' - ] = de['[object Date]'] = de['[object Error]'] = de['[object Function]'] = de['[object Map]'] = de['[object Number]'] = de[ - '[object Object]' - ] = de['[object RegExp]'] = de['[object Set]'] = de['[object String]'] = de['[object WeakMap]'] = !1); - var ve, - ye = 'object' == typeof e && e && !e.nodeType && e, - _e = ye && 'object' == typeof module && module && !module.nodeType && module, - be = _e && _e.exports === ye && u.process, - ge = (function () { - try { - var e = _e && _e.require && _e.require('util').types; - return e || (be && be.binding && be.binding('util')); - } catch (e) {} - })(), - me = ge && ge.isTypedArray, - je = me - ? ((ve = me), - function (e) { - return ve(e); - }) - : function (e) { - return te(e) && he(e.length) && !!de[g(e)]; - }, - Oe = Object.prototype.hasOwnProperty; - function we(e, t) { - var r = J(e), - n = !r && ie(e), - o = !r && !n && pe(e), - a = !r && !n && !o && je(e), - i = r || n || o || a, - s = i - ? (function (e, t) { - for (var r = -1, n = Array(e); ++r < e; ) n[r] = t(r); - return n; - })(e.length, String) - : [], - c = s.length; - for (var u in e) - (!t && !Oe.call(e, u)) || - (i && - ('length' == u || - (o && ('offset' == u || 'parent' == u)) || - (a && ('buffer' == u || 'byteLength' == u || 'byteOffset' == u)) || - fe(u, c))) || - s.push(u); - return s; - } - var Ee = Object.prototype; - var Ae = (function (e, t) { - return function (r) { - return e(t(r)); - }; - })(Object.keys, Object), - Se = Object.prototype.hasOwnProperty; - function Ce(e) { - if (((r = (t = e) && t.constructor), t !== (('function' == typeof r && r.prototype) || Ee))) return Ae(e); - var t, - r, - n = []; - for (var o in Object(e)) Se.call(e, o) && 'constructor' != o && n.push(o); - return n; - } - function xe(e) { - return null != (t = e) && he(t.length) && !j(t) ? we(e) : Ce(e); - var t; - } - function Me(e) { - return (function (e, t, r) { - var n = t(e); - return J(e) - ? n - : (function (e, t) { - for (var r = -1, n = t.length, o = e.length; ++r < n; ) e[o + r] = t[r]; - return e; - })(n, r(e)); - })(e, xe, ee); - } - var Re = Object.prototype.hasOwnProperty; - var Pe = N(l, 'DataView'), - Te = N(l, 'Promise'), - ze = N(l, 'Set'), - Ne = N(l, 'WeakMap'), - De = '[object Map]', - Ve = '[object Promise]', - ke = '[object Set]', - Ie = '[object WeakMap]', - Le = '[object DataView]', - Be = S(Pe), - Ue = S(D), - $e = S(Te), - Fe = S(ze), - Ye = S(Ne), - We = g; - ((Pe && We(new Pe(new ArrayBuffer(1))) != Le) || - (D && We(new D()) != De) || - (Te && We(Te.resolve()) != Ve) || - (ze && We(new ze()) != ke) || - (Ne && We(new Ne()) != Ie)) && - (We = function (e) { - var t = g(e), - r = '[object Object]' == t ? e.constructor : void 0, - n = r ? S(r) : ''; - if (n) - switch (n) { - case Be: - return Le; - case Ue: - return De; - case $e: - return Ve; - case Fe: - return ke; - case Ye: - return Ie; - } - return t; - }); - var qe = We, - Ge = '[object Arguments]', - Ke = '[object Array]', - He = '[object Object]', - Xe = Object.prototype.hasOwnProperty; - function Je(e, t, r, n, o, i) { - var s = J(e), - c = J(t), - u = s ? Ke : qe(e), - p = c ? Ke : qe(t), - l = (u = u == Ge ? He : u) == He, - f = (p = p == Ge ? He : p) == He, - h = u == p; - if (h && pe(e)) { - if (!pe(t)) return !1; - (s = !0), (l = !1); - } - if (h && !l) - return ( - i || (i = new $()), - s || je(e) - ? W(e, t, r, n, o, i) - : (function (e, t, r, n, o, i, s) { - switch (r) { - case '[object DataView]': - if (e.byteLength != t.byteLength || e.byteOffset != t.byteOffset) return !1; - (e = e.buffer), (t = t.buffer); - case '[object ArrayBuffer]': - return !(e.byteLength != t.byteLength || !i(new q(e), new q(t))); - case '[object Boolean]': - case '[object Date]': - case '[object Number]': - return a(+e, +t); - case '[object Error]': - return e.name == t.name && e.message == t.message; - case '[object RegExp]': - case '[object String]': - return e == t + ''; - case '[object Map]': - var c = G; - case '[object Set]': - var u = 1 & n; - if ((c || (c = K), e.size != t.size && !u)) return !1; - var p = s.get(e); - if (p) return p == t; - (n |= 2), s.set(e, t); - var l = W(c(e), c(t), n, o, i, s); - return s.delete(e), l; - case '[object Symbol]': - if (X) return X.call(e) == X.call(t); - } - return !1; - })(e, t, u, r, n, o, i) - ); - if (!(1 & r)) { - var d = l && Xe.call(e, '__wrapped__'), - v = f && Xe.call(t, '__wrapped__'); - if (d || v) { - var y = d ? e.value() : e, - _ = v ? t.value() : t; - return i || (i = new $()), o(y, _, r, n, i); - } - } - return ( - !!h && - (i || (i = new $()), - (function (e, t, r, n, o, a) { - var i = 1 & r, - s = Me(e), - c = s.length; - if (c != Me(t).length && !i) return !1; - for (var u = c; u--; ) { - var p = s[u]; - if (!(i ? p in t : Re.call(t, p))) return !1; - } - var l = a.get(e), - f = a.get(t); - if (l && f) return l == t && f == e; - var h = !0; - a.set(e, t), a.set(t, e); - for (var d = i; ++u < c; ) { - var v = e[(p = s[u])], - y = t[p]; - if (n) var _ = i ? n(y, v, p, t, e, a) : n(v, y, p, e, t, a); - if (!(void 0 === _ ? v === y || o(v, y, r, n, a) : _)) { - h = !1; - break; - } - d || (d = 'constructor' == p); - } - if (h && !d) { - var b = e.constructor, - g = t.constructor; - b == g || - !('constructor' in e) || - !('constructor' in t) || - ('function' == typeof b && b instanceof b && 'function' == typeof g && g instanceof g) || - (h = !1); - } - return a.delete(e), a.delete(t), h; - })(e, t, r, n, o, i)) - ); - } - function Qe(e, t, r, n, o) { - return e === t || (null == e || null == t || (!te(e) && !te(t)) ? e != e && t != t : Je(e, t, r, n, Qe, o)); - } - class Ze { - constructor({game: e, rendererSystem: t}) { - (this.renderers = []), (this.game = e), (this.rendererSystem = t); - } - register(...e) { - for (const t of e) - (t.game = this.game), - (t.rendererManager = this.rendererSystem.rendererManager), - (t.containerManager = this.rendererSystem.containerManager), - this.renderers.push(t); - } - componentChanged(e) { - for (const r of e) - for (const e of this.renderers) { - const n = e.observerInfo[r.componentName]; - if (n) { - if ([t.OBSERVER_TYPE.ADD, t.OBSERVER_TYPE.REMOVE].indexOf(r.type) > -1) { - try { - e.componentChanged && e.componentChanged(r); - } catch (e) { - console.error(`gameObject: ${r.gameObject.name}, ${r.componentName} is error.`, r, e); - } - continue; - } - if ( - n.findIndex(e => { - return (t = e), (n = r.prop), Qe(t, n); - var t, n; - }) > -1 - ) - try { - e.componentChanged && e.componentChanged(r); - } catch (e) { - console.error( - `gameObject: ${r.gameObject && r.gameObject.name}, ${r.componentName} is componentChanged error.`, - r, - e, - ); - } - } - } - } - update(e) { - for (const t of e.components) - for (const r of this.renderers) { - const n = []; - if (r.observerInfo[t.name] && -1 === n.indexOf(e)) { - n.push(e); - try { - r.rendererUpdate && r.rendererUpdate(e); - } catch (r) { - console.info(`gameObject: ${e.name}, ${t.name} is update error`, r); - } - } - } - } - } - class et { - constructor() { - this.containerMap = {}; - } - addContainer({name: e, container: t}) { - this.containerMap[e] = t; - } - getContainer(e) { - return this.containerMap[e]; - } - removeContainer(e) { - var t; - null === (t = this.containerMap[e]) || void 0 === t || t.destroy(!0), delete this.containerMap[e]; - } - updateTransform({name: e, transform: t}) { - const r = this.containerMap[e]; - if (!r) return; - const {anchor: n, origin: o, position: a, rotation: i, scale: s, size: c, skew: u} = t; - (r.rotation = i), (r.scale = s), (r.pivot.x = c.width * o.x), (r.pivot.y = c.height * o.y), (r.skew = u); - let p = a.x, - l = a.y; - if (t.parent) { - const e = t.parent; - (p += e.size.width * n.x), (l += e.size.height * n.y); - } - r.position = {x: p, y: l}; - } - } - var tt = (function (e) { - var t = {exports: {}}; - return e(t, t.exports), t.exports; - })(function (e) { - var t = Object.prototype.hasOwnProperty, - r = '~'; - function n() {} - function o(e, t, r) { - (this.fn = e), (this.context = t), (this.once = r || !1); - } - function a(e, t, n, a, i) { - if ('function' != typeof n) throw new TypeError('The listener must be a function'); - var s = new o(n, a || e, i), - c = r ? r + t : t; - return ( - e._events[c] - ? e._events[c].fn - ? (e._events[c] = [e._events[c], s]) - : e._events[c].push(s) - : ((e._events[c] = s), e._eventsCount++), - e - ); - } - function i(e, t) { - 0 == --e._eventsCount ? (e._events = new n()) : delete e._events[t]; - } - function s() { - (this._events = new n()), (this._eventsCount = 0); - } - Object.create && ((n.prototype = Object.create(null)), new n().__proto__ || (r = !1)), - (s.prototype.eventNames = function () { - var e, - n, - o = []; - if (0 === this._eventsCount) return o; - for (n in (e = this._events)) t.call(e, n) && o.push(r ? n.slice(1) : n); - return Object.getOwnPropertySymbols ? o.concat(Object.getOwnPropertySymbols(e)) : o; - }), - (s.prototype.listeners = function (e) { - var t = r ? r + e : e, - n = this._events[t]; - if (!n) return []; - if (n.fn) return [n.fn]; - for (var o = 0, a = n.length, i = new Array(a); o < a; o++) i[o] = n[o].fn; - return i; - }), - (s.prototype.listenerCount = function (e) { - var t = r ? r + e : e, - n = this._events[t]; - return n ? (n.fn ? 1 : n.length) : 0; - }), - (s.prototype.emit = function (e, t, n, o, a, i) { - var s = r ? r + e : e; - if (!this._events[s]) return !1; - var c, - u, - p = this._events[s], - l = arguments.length; - if (p.fn) { - switch ((p.once && this.removeListener(e, p.fn, void 0, !0), l)) { - case 1: - return p.fn.call(p.context), !0; - case 2: - return p.fn.call(p.context, t), !0; - case 3: - return p.fn.call(p.context, t, n), !0; - case 4: - return p.fn.call(p.context, t, n, o), !0; - case 5: - return p.fn.call(p.context, t, n, o, a), !0; - case 6: - return p.fn.call(p.context, t, n, o, a, i), !0; - } - for (u = 1, c = new Array(l - 1); u < l; u++) c[u - 1] = arguments[u]; - p.fn.apply(p.context, c); - } else { - var f, - h = p.length; - for (u = 0; u < h; u++) - switch ((p[u].once && this.removeListener(e, p[u].fn, void 0, !0), l)) { - case 1: - p[u].fn.call(p[u].context); - break; - case 2: - p[u].fn.call(p[u].context, t); - break; - case 3: - p[u].fn.call(p[u].context, t, n); - break; - case 4: - p[u].fn.call(p[u].context, t, n, o); - break; - default: - if (!c) for (f = 1, c = new Array(l - 1); f < l; f++) c[f - 1] = arguments[f]; - p[u].fn.apply(p[u].context, c); - } - } - return !0; - }), - (s.prototype.on = function (e, t, r) { - return a(this, e, t, r, !1); - }), - (s.prototype.once = function (e, t, r) { - return a(this, e, t, r, !0); - }), - (s.prototype.removeListener = function (e, t, n, o) { - var a = r ? r + e : e; - if (!this._events[a]) return this; - if (!t) return i(this, a), this; - var s = this._events[a]; - if (s.fn) s.fn !== t || (o && !s.once) || (n && s.context !== n) || i(this, a); - else { - for (var c = 0, u = [], p = s.length; c < p; c++) - (s[c].fn !== t || (o && !s[c].once) || (n && s[c].context !== n)) && u.push(s[c]); - u.length ? (this._events[a] = 1 === u.length ? u[0] : u) : i(this, a); - } - return this; - }), - (s.prototype.removeAllListeners = function (e) { - var t; - return ( - e ? ((t = r ? r + e : e), this._events[t] && i(this, t)) : ((this._events = new n()), (this._eventsCount = 0)), this - ); - }), - (s.prototype.off = s.prototype.removeListener), - (s.prototype.addListener = s.prototype.on), - (s.prefixed = r), - (s.EventEmitter = s), - (e.exports = s); - }); - let rt = class extends tt { - constructor({system: e, containerManager: t}) { - super(), - (this.name = 'Transform'), - (this.waitRemoveIds = []), - (this.waitChangeScenes = []), - (this.containerManager = t), - this.init(e); - } - init(e) { - (this.system = e), - this.on('changeScene', ({scene: e, mode: t, application: r}) => { - this.waitChangeScenes.push({scene: e, mode: t, application: r}); - }); - } - update() { - for (const e of this.waitRemoveIds) this.containerManager.removeContainer(e); - this.waitRemoveIds = []; - for (const e of this.waitChangeScenes) { - const t = this.containerManager.getContainer(e.scene.id); - t && (e.application.stage.removeChildren(), e.application.stage.addChild(t)); - } - this.waitChangeScenes = []; - } - componentChanged(e) { - e.type === t.OBSERVER_TYPE.ADD - ? this.addContainer(e) - : e.type === t.OBSERVER_TYPE.CHANGE - ? this.change(e) - : e.type === t.OBSERVER_TYPE.REMOVE && this.waitRemoveIds.push(e.gameObject.id); - } - addContainer(e) { - const t = new r.Container(); - (t.name = e.gameObject.name), this.containerManager.addContainer({name: e.gameObject.id, container: t}); - e.component.worldTransform = t.transform.worldTransform; - } - change(e) { - const t = e.component; - if (t.parent) { - this.containerManager.getContainer(t.parent.gameObject.id).addChild(this.containerManager.getContainer(e.gameObject.id)); - const r = e.gameObject.transform.parent && e.gameObject.transform.parent.gameObject.getComponent('Render'); - r && (r.sortDirty = !0); - } else { - const r = this.containerManager.getContainer(e.gameObject.id); - delete t.worldTransform, r.parent && r.parent.removeChild(r); - } - } - destroy() { - this.removeAllListeners(), - (this.waitRemoveIds = null), - (this.waitChangeScenes = null), - (this.system = null), - (this.containerManager = null); - } - }; - rt = o([t.decorators.componentObserver({Transform: ['_parent']})], rt); - var nt, - ot = rt; - (e.RENDERER_TYPE = void 0), - ((nt = e.RENDERER_TYPE || (e.RENDERER_TYPE = {}))[(nt.UNKNOWN = 0)] = 'UNKNOWN'), - (nt[(nt.WEBGL = 1)] = 'WEBGL'), - (nt[(nt.CANVAS = 2)] = 'CANVAS'); - const at = e => { - (e.plugins.interaction.autoPreventDefault = !0), (e.view.style.touchAction = 'none'); - }, - it = e => { - (e.plugins.interaction.autoPreventDefault = !1), (e.view.style.touchAction = 'auto'); - }; - let st = class extends t.System { - constructor() { - super(...arguments), (this.multiApps = []); - } - init(e) { - (this.params = e), - (this.application = this.createApplication(e)), - (this.containerManager = new et()), - (this.rendererManager = new Ze({game: this.game, rendererSystem: this})), - (this.game.canvas = this.application.view), - (this.transform = new ot({system: this, containerManager: this.containerManager})), - this.game.on('sceneChanged', ({scene: e, mode: r, params: n}) => { - let o; - switch (r) { - case t.LOAD_SCENE_MODE.SINGLE: - o = this.application; - break; - case t.LOAD_SCENE_MODE.MULTI_CANVAS: - o = this.createMultiApplication({params: n}); - } - (e.canvas = o.view), this.transform.emit('changeScene', {scene: e, mode: r, application: o}); - }); - } - registerObserver(e) { - const t = this.constructor.observerInfo; - for (const r in e) t[r] || (t[r] = []), t[r].push(...e[r]); - } - createMultiApplication({params: e}) { - const t = this.createApplication(e); - return this.multiApps.push(t), t; - } - createApplication(t) { - (t.view = t.canvas), - t.renderType === e.RENDERER_TYPE.CANVAS && (t.forceCanvas = !0), - (n.ticker.shared.autoStart = !1), - n.ticker.shared.stop(); - const o = new r.Application(Object.assign({sharedTicker: !0}, t)); - return ( - void 0 !== t.preventScroll && - (console.warn( - 'PreventScroll property will deprecate at next major version, please use enableEnable instead. https://eva.js.org/#/tutorials/game', - ), - t.preventScroll ? it(o.renderer) : at(o.renderer)), - void 0 !== t.enableScroll && (t.enableScroll ? it(o.renderer) : at(o.renderer)), - void 0 === t.preventScroll && void 0 === t.enableScroll && it(o.renderer), - o - ); - } - update() { - const e = this.componentObserver.clear(); - for (const t of e) this.transform.componentChanged(t); - for (const e of this.game.gameObjects) - this.containerManager.updateTransform({name: e.id, transform: e.transform}), this.rendererManager.update(e); - } - lateUpdate(e) { - this.transform.update(), this.application.ticker.update(e.time); - } - onDestroy() { - this.application.destroy(); - for (const e of this.multiApps) e && e.destroy(); - this.transform.destroy(), - (this.transform = null), - (this.params = null), - (this.rendererManager = null), - (this.containerManager = null), - (this.application = null), - (this.game = null), - (this.multiApps = null); - } - resize(e, t) { - (this.params.width = e), (this.params.height = t), this.application.renderer.resize(e, t); - } - }; - (st.systemName = 'Renderer'), (st = o([t.decorators.componentObserver({Transform: ['_parent']})], st)); - var ct = st; - class ut extends t.System { - constructor(e) { - super(e), (this.observerInfo = this.constructor.observerInfo); - } - componentChanged(e) {} - rendererUpdate(e) {} - update() { - const e = this.componentObserver.clear(); - for (const t of e) this.componentChanged(t); - } - } - (e.ContainerManager = et), - (e.Renderer = ut), - (e.RendererManager = Ze), - (e.RendererSystem = ct), - Object.defineProperty(e, '__esModule', {value: !0}); -}); diff --git a/dist/cdn/min/EVA.plugin.renderer.ninePatch.min.js b/dist/cdn/min/EVA.plugin.renderer.ninePatch.min.js deleted file mode 100644 index 55388bc6..00000000 --- a/dist/cdn/min/EVA.plugin.renderer.ninePatch.min.js +++ /dev/null @@ -1 +0,0 @@ -var e,t;e=this,t=function(e,t,r,i){"use strict";function o(e,t,r,i){var o,n=arguments.length,h=n<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)h=Reflect.decorate(e,t,r,i);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(h=(n<3?o(h):n>3?o(t,r,h):o(t,r))||h);return n>3&&h&&Object.defineProperty(t,r,h),h}function n(e,t,r,i){return new(r||(r=Promise))((function(o,n){function h(e){try{a(i.next(e))}catch(e){n(e)}}function s(e){try{a(i.throw(e))}catch(e){n(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(h,s)}a((i=i.apply(e,t||[])).next())}))}class h extends t.Component{constructor(){super(...arguments),this.resource="",this.spriteName="",this.leftWidth=0,this.topHeight=0,this.rightWidth=0,this.bottomHeight=0}init(e){this.resource=e.resource,this.spriteName=e.spriteName,this.leftWidth=e.leftWidth,this.topHeight=e.topHeight,this.rightWidth=e.rightWidth,this.bottomHeight=e.bottomHeight}}h.componentName="NinePatch",o([t.decorators.IDEProp],h.prototype,"resource",void 0),o([t.decorators.IDEProp],h.prototype,"spriteName",void 0),o([t.decorators.IDEProp],h.prototype,"leftWidth",void 0),o([t.decorators.IDEProp],h.prototype,"topHeight",void 0),o([t.decorators.IDEProp],h.prototype,"rightWidth",void 0),o([t.decorators.IDEProp],h.prototype,"bottomHeight",void 0);let s=class extends r.Renderer{constructor(){super(...arguments),this.name="NinePatch",this.ninePatch={}}init(){this.renderSystem=this.game.getSystem(r.RendererSystem),this.renderSystem.rendererManager.register(this)}rendererUpdate(e){const{width:t,height:r}=e.transform.size;this.ninePatch[e.id]&&(this.ninePatch[e.id].width=t,this.ninePatch[e.id].height=r)}componentChanged(e){return n(this,void 0,void 0,(function*(){"NinePatch"===e.componentName&&(e.type===t.OBSERVER_TYPE.ADD?this.add(e):e.type===t.OBSERVER_TYPE.REMOVE?this.remove(e):(this.remove(e),this.add(e)))}))}add(e){return n(this,void 0,void 0,(function*(){const r=e.component,{type:o,data:n}=yield t.resource.getResource(r.resource);if(!n)throw new Error(`GameObject:${e.gameObject.name}'s NinePatch resource load error`);let h;h=o===t.RESOURCE_TYPE.SPRITE?r.resource+"_s|r|c_"+r.spriteName:n.image;const{leftWidth:s,topHeight:a,rightWidth:d,bottomHeight:c}=r,p=new i.NinePatch(h,s,a,d,c);this.ninePatch[e.gameObject.id]=p,r.ninePatch=p,this.containerManager.getContainer(e.gameObject.id).addChildAt(p,0)}))}remove(e){const t=this.ninePatch[e.gameObject.id];t&&(this.containerManager.getContainer(e.gameObject.id).removeChild(t),delete this.ninePatch[e.gameObject.id],t.destroy(!0))}};s.systemName="NinePatch",s=o([t.decorators.componentObserver({NinePatch:["resource","spriteName","leftWidth","topHeight","rightWidth","bottomHeight"]})],s);var a=s;e.NinePatch=h,e.NinePatchSystem=a,Object.defineProperty(e,"__esModule",{value:!0})},"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@eva/eva.js"),require("@eva/plugin-renderer"),require("@eva/renderer-adapter")):"function"==typeof define&&define.amd?define(["exports","@eva/eva.js","@eva/plugin-renderer","@eva/renderer-adapter"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).EVA=e.EVA||{},e.EVA.plugin=e.EVA.plugin||{},e.EVA.plugin.renderer=e.EVA.plugin.renderer||{},e.EVA.plugin.renderer.ninePatch={}),e.EVA,e.EVA.plugin.renderer,e.EVA.rendererAdapter); diff --git a/dist/cdn/min/EVA.plugin.renderer.render.min.js b/dist/cdn/min/EVA.plugin.renderer.render.min.js deleted file mode 100644 index a582f698..00000000 --- a/dist/cdn/min/EVA.plugin.renderer.render.min.js +++ /dev/null @@ -1 +0,0 @@ -var e,t;e=this,t=function(e,t,r){"use strict";function n(e,t,r,n){var o,i=arguments.length,s=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(s=(i<3?o(s):i>3?o(t,r,s):o(t,r))||s);return i>3&&s&&Object.defineProperty(t,r,s),s}class o extends t.Component{constructor(){super(...arguments),this.sortDirty=!1,this.visible=!0,this.alpha=1,this.zIndex=0,this.sortableChildren=!1}init(e){e&&Object.assign(this,e)}}o.componentName="Render",n([t.decorators.IDEProp],o.prototype,"visible",void 0),n([t.decorators.IDEProp],o.prototype,"alpha",void 0),n([t.decorators.IDEProp],o.prototype,"zIndex",void 0),n([t.decorators.IDEProp],o.prototype,"sortableChildren",void 0);let i=class extends r.Renderer{constructor(){super(...arguments),this.name="Render"}init(){this.renderSystem=this.game.getSystem(r.RendererSystem),this.renderSystem.rendererManager.register(this)}rendererUpdate(e){const t=e.getComponent("Render"),r=this.containerManager.getContainer(e.id);if(r.alpha=t.alpha,r.visible=t.visible,t.sortDirty&&t.sortableChildren){const r=e.transform.children.map((({gameObject:e})=>e)).sort(((e,t)=>{const r=e.getComponent("Render"),n=t.getComponent("Render");return r?n?r.zIndex-n.zIndex:1:-1})).map((e=>this.containerManager.getContainer(e.id))),n=this.containerManager.getContainer(t.gameObject.id).children,o=n.filter((e=>-1===r.indexOf(e)));n.length=0,n.push(...o,...r),t.sortDirty=!1}}componentChanged(e){e.type!==t.OBSERVER_TYPE.ADD&&e.type!==t.OBSERVER_TYPE.REMOVE||this.add(e),e.type===t.OBSERVER_TYPE.CHANGE&&this.change(e),e.type===t.OBSERVER_TYPE.REMOVE&&this.remove(e)}add(e){"Render"===e.component.name&&this.setDirty(e)}change(e){"Render"===e.component.name&&"zIndex"===e.prop.prop[0]&&this.setDirty(e)}remove(e){"Render"===e.component.name&&(this.containerManager.getContainer(e.gameObject.id).alpha=1)}setDirty(e){const t=e.gameObject.parent&&e.gameObject.parent.getComponent("Render");t&&(t.sortDirty=!0)}};i.systemName="Render",i=n([t.decorators.componentObserver({Render:["zIndex"]})],i);var s=i;e.Render=o,e.RenderSystem=s,Object.defineProperty(e,"__esModule",{value:!0})},"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@eva/eva.js"),require("@eva/plugin-renderer")):"function"==typeof define&&define.amd?define(["exports","@eva/eva.js","@eva/plugin-renderer"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).EVA=e.EVA||{},e.EVA.plugin=e.EVA.plugin||{},e.EVA.plugin.renderer=e.EVA.plugin.renderer||{},e.EVA.plugin.renderer.render={}),e.EVA,e.EVA.plugin.renderer); diff --git a/dist/cdn/min/EVA.plugin.renderer.spine.min.js b/dist/cdn/min/EVA.plugin.renderer.spine.min.js deleted file mode 100644 index cc3a93d1..00000000 --- a/dist/cdn/min/EVA.plugin.renderer.spine.min.js +++ /dev/null @@ -1 +0,0 @@ -var t,e;t=this,e=function(t,e,n,r){"use strict";function a(t,e,n,r){var a,i=arguments.length,o=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(a=t[s])&&(o=(i<3?a(o):i>3?a(e,n,o):a(e,n))||o);return i>3&&o&&Object.defineProperty(e,n,o),o}function i(t,e,n,r){return new(n||(n=Promise))((function(a,i){function o(t){try{l(r.next(t))}catch(t){i(t)}}function s(t){try{l(r.throw(t))}catch(t){i(t)}}function l(t){var e;t.done?a(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,s)}l((r=r.apply(t,e||[])).next())}))}class o extends e.Component{constructor(){super(...arguments),this.resource="",this.animationName="",this.autoPlay=!0}init(t){t&&(Object.assign(this,t),this.autoPlay&&this.play(this.animationName))}onDestroy(){this.destroied=!0}play(t,e,n){try{t&&(this.animationName=t),this.armature&&(void 0===n&&(n=0),this.armature.state.setAnimation(n,this.animationName,e))}catch(t){console.log(t)}}stop(t){this.armature&&(void 0===t&&(t=0),this.armature.state.setEmptyAnimation(t,0))}addAnimation(t,e,n,r){try{this.armature&&(void 0===r&&(r=0),this.armature.state.addAnimation(r,t,n,e))}catch(t){console.log(t)}}setMix(t,e,n){this.armature&&this.armature.stateData.setMix(t,e,n)}getAnim(t=0){try{if(this.armature)return this.armature.state.tracks[t].animation.name}catch(t){console.log(t)}}setDefaultMix(t){this.armature&&(this.armature.stateData.defaultMix=t)}setAttachment(t,e){this.armature&&this.armature.skeleton.setAttachment(t,e)}getBone(t){if(this.armature)return this.armature.skeleton.findBone(t)}}o.componentName="Spine",a([e.decorators.IDEProp],o.prototype,"resource",void 0),a([e.decorators.IDEProp],o.prototype,"animationName",void 0),a([e.decorators.IDEProp],o.prototype,"autoPlay",void 0);const s=r.loaders.shared,l={Texture:r.Texture,Rectangle:r.Rectangle,Sprite:r.Sprite,Graphics:r.Graphics,mesh:r.mesh,Matrix:r.Matrix,Container:r.Container,VERSION:"4.8.9",loaders:r.loaders,loader:s,SCALE_MODES:r.SCALE_MODES,utils:r.utils,TransformBase:r.TransformBase,TransformStatic:r.TransformStatic,DisplayObject:r.DisplayObject,Polygon:r.Polygon,BaseTexture:r.BaseTexture};var h,u,c,p=(h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},function(t,e){function n(){this.constructor=t}h(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});!function(t){!function(t){var e,n,r,a=function(){function t(t,e,n){if(null==t)throw new Error("name cannot be null.");if(null==e)throw new Error("timelines cannot be null.");this.name=t,this.timelines=e,this.duration=n}return t.prototype.apply=function(t,e,n,r,a,i,o,s){if(null==t)throw new Error("skeleton cannot be null.");r&&0!=this.duration&&(n%=this.duration,e>0&&(e%=this.duration));for(var l=this.timelines,h=0,u=l.length;h>>1;;){if(t[(i+1)*n]<=e?r=i+1:a=i,r==a)return(r+1)*n;i=r+a>>>1}},t.linearSearch=function(t,e,n){for(var r=0,a=t.length-n;r<=a;r+=n)if(t[r]>e)return r;return-1},t}();t.Animation=a,function(t){t[t.setup=0]="setup",t[t.first=1]="first",t[t.replace=2]="replace",t[t.add=3]="add"}(e=t.MixBlend||(t.MixBlend={})),function(t){t[t.in=0]="in",t[t.out=1]="out"}(n=t.MixDirection||(t.MixDirection={})),function(t){t[t.rotate=0]="rotate",t[t.translate=1]="translate",t[t.scale=2]="scale",t[t.shear=3]="shear",t[t.attachment=4]="attachment",t[t.color=5]="color",t[t.deform=6]="deform",t[t.event=7]="event",t[t.drawOrder=8]="drawOrder",t[t.ikConstraint=9]="ikConstraint",t[t.transformConstraint=10]="transformConstraint",t[t.pathConstraintPosition=11]="pathConstraintPosition",t[t.pathConstraintSpacing=12]="pathConstraintSpacing",t[t.pathConstraintMix=13]="pathConstraintMix",t[t.twoColor=14]="twoColor"}(r=t.TimelineType||(t.TimelineType={}));var i=function(){function e(n){if(n<=0)throw new Error("frameCount must be > 0: "+n);this.curves=t.Utils.newFloatArray((n-1)*e.BEZIER_SIZE)}return e.prototype.getFrameCount=function(){return this.curves.length/e.BEZIER_SIZE+1},e.prototype.setLinear=function(t){this.curves[t*e.BEZIER_SIZE]=e.LINEAR},e.prototype.setStepped=function(t){this.curves[t*e.BEZIER_SIZE]=e.STEPPED},e.prototype.getCurveType=function(t){var n=t*e.BEZIER_SIZE;if(n==this.curves.length)return e.LINEAR;var r=this.curves[n];return r==e.LINEAR?e.LINEAR:r==e.STEPPED?e.STEPPED:e.BEZIER},e.prototype.setCurve=function(t,n,r,a,i){var o=.03*(2*-n+a),s=.03*(2*-r+i),l=.006*(3*(n-a)+1),h=.006*(3*(r-i)+1),u=2*o+l,c=2*s+h,p=.3*n+o+.16666667*l,f=.3*r+s+.16666667*h,d=t*e.BEZIER_SIZE,m=this.curves;m[d++]=e.BEZIER;for(var g=p,v=f,y=d+e.BEZIER_SIZE-1;d=r){var u=void 0,c=void 0;return i==l?(u=0,c=0):(u=a[i-2],c=a[i-1]),c+(a[i+1]-c)*(r-u)/(s-u)}var p=a[i-1];return p+(1-p)*(r-s)/(1-s)},e.LINEAR=0,e.STEPPED=1,e.BEZIER=2,e.BEZIER_SIZE=19,e}();t.CurveTimeline=i;var o=function(n){function i(e){var r=n.call(this,e)||this;return r.frames=t.Utils.newFloatArray(e<<1),r}return p(i,n),i.prototype.getPropertyId=function(){return(r.rotate<<24)+this.boneIndex},i.prototype.setFrame=function(t,e,n){t<<=1,this.frames[t]=e,this.frames[t+i.ROTATION]=n},i.prototype.apply=function(t,n,r,o,s,l,h){var u=this.frames,c=t.bones[this.boneIndex];if(r=u[u.length-i.ENTRIES]){var f=u[u.length+i.PREV_ROTATION];switch(l){case e.setup:c.rotation=c.data.rotation+f*s;break;case e.first:case e.replace:f+=c.data.rotation-c.rotation,f-=360*(16384-(16384.499999999996-f/360|0));case e.add:c.rotation+=f*s}}else{var d=a.binarySearch(u,r,i.ENTRIES),m=u[d+i.PREV_ROTATION],g=u[d],v=this.getCurvePercent((d>>1)-1,1-(r-g)/(u[d+i.PREV_TIME]-g)),y=u[d+i.ROTATION]-m;switch(y=m+(y-360*(16384-(16384.499999999996-y/360|0)))*v,l){case e.setup:c.rotation=c.data.rotation+(y-360*(16384-(16384.499999999996-y/360|0)))*s;break;case e.first:case e.replace:y+=c.data.rotation-c.rotation;case e.add:c.rotation+=(y-360*(16384-(16384.499999999996-y/360|0)))*s}}},i.ENTRIES=2,i.PREV_TIME=-2,i.PREV_ROTATION=-1,i.ROTATION=1,i}(i);t.RotateTimeline=o;var s=function(n){function i(e){var r=n.call(this,e)||this;return r.frames=t.Utils.newFloatArray(e*i.ENTRIES),r}return p(i,n),i.prototype.getPropertyId=function(){return(r.translate<<24)+this.boneIndex},i.prototype.setFrame=function(t,e,n,r){t*=i.ENTRIES,this.frames[t]=e,this.frames[t+i.X]=n,this.frames[t+i.Y]=r},i.prototype.apply=function(t,n,r,o,s,l,h){var u=this.frames,c=t.bones[this.boneIndex];if(r=u[u.length-i.ENTRIES])p=u[u.length+i.PREV_X],f=u[u.length+i.PREV_Y];else{var d=a.binarySearch(u,r,i.ENTRIES);p=u[d+i.PREV_X],f=u[d+i.PREV_Y];var m=u[d],g=this.getCurvePercent(d/i.ENTRIES-1,1-(r-m)/(u[d+i.PREV_TIME]-m));p+=(u[d+i.X]-p)*g,f+=(u[d+i.Y]-f)*g}switch(l){case e.setup:c.x=c.data.x+p*s,c.y=c.data.y+f*s;break;case e.first:case e.replace:c.x+=(c.data.x+p-c.x)*s,c.y+=(c.data.y+f-c.y)*s;break;case e.add:c.x+=p*s,c.y+=f*s}}},i.ENTRIES=3,i.PREV_TIME=-3,i.PREV_X=-2,i.PREV_Y=-1,i.X=1,i.Y=2,i}(i);t.TranslateTimeline=s;var l=function(i){function o(t){return i.call(this,t)||this}return p(o,i),o.prototype.getPropertyId=function(){return(r.scale<<24)+this.boneIndex},o.prototype.apply=function(r,i,s,l,h,u,c){var p=this.frames,f=r.bones[this.boneIndex];if(s=p[p.length-o.ENTRIES])d=p[p.length+o.PREV_X]*f.data.scaleX,m=p[p.length+o.PREV_Y]*f.data.scaleY;else{var g=a.binarySearch(p,s,o.ENTRIES);d=p[g+o.PREV_X],m=p[g+o.PREV_Y];var v=p[g],y=this.getCurvePercent(g/o.ENTRIES-1,1-(s-v)/(p[g+o.PREV_TIME]-v));d=(d+(p[g+o.X]-d)*y)*f.data.scaleX,m=(m+(p[g+o.Y]-m)*y)*f.data.scaleY}if(1==h)u==e.add?(f.scaleX+=d-f.data.scaleX,f.scaleY+=m-f.data.scaleY):(f.scaleX=d,f.scaleY=m);else{var x=0,M=0;if(c==n.out)switch(u){case e.setup:x=f.data.scaleX,M=f.data.scaleY,f.scaleX=x+(Math.abs(d)*t.MathUtils.signum(x)-x)*h,f.scaleY=M+(Math.abs(m)*t.MathUtils.signum(M)-M)*h;break;case e.first:case e.replace:x=f.scaleX,M=f.scaleY,f.scaleX=x+(Math.abs(d)*t.MathUtils.signum(x)-x)*h,f.scaleY=M+(Math.abs(m)*t.MathUtils.signum(M)-M)*h;break;case e.add:x=f.scaleX,M=f.scaleY,f.scaleX=x+(Math.abs(d)*t.MathUtils.signum(x)-f.data.scaleX)*h,f.scaleY=M+(Math.abs(m)*t.MathUtils.signum(M)-f.data.scaleY)*h}else switch(u){case e.setup:x=Math.abs(f.data.scaleX)*t.MathUtils.signum(d),M=Math.abs(f.data.scaleY)*t.MathUtils.signum(m),f.scaleX=x+(d-x)*h,f.scaleY=M+(m-M)*h;break;case e.first:case e.replace:x=Math.abs(f.scaleX)*t.MathUtils.signum(d),M=Math.abs(f.scaleY)*t.MathUtils.signum(m),f.scaleX=x+(d-x)*h,f.scaleY=M+(m-M)*h;break;case e.add:x=t.MathUtils.signum(d),M=t.MathUtils.signum(m),f.scaleX=Math.abs(f.scaleX)*x+(d-Math.abs(f.data.scaleX)*x)*h,f.scaleY=Math.abs(f.scaleY)*M+(m-Math.abs(f.data.scaleY)*M)*h}}}},o}(s);t.ScaleTimeline=l;var h=function(t){function n(e){return t.call(this,e)||this}return p(n,t),n.prototype.getPropertyId=function(){return(r.shear<<24)+this.boneIndex},n.prototype.apply=function(t,r,i,o,s,l,h){var u=this.frames,c=t.bones[this.boneIndex];if(i=u[u.length-n.ENTRIES])p=u[u.length+n.PREV_X],f=u[u.length+n.PREV_Y];else{var d=a.binarySearch(u,i,n.ENTRIES);p=u[d+n.PREV_X],f=u[d+n.PREV_Y];var m=u[d],g=this.getCurvePercent(d/n.ENTRIES-1,1-(i-m)/(u[d+n.PREV_TIME]-m));p+=(u[d+n.X]-p)*g,f+=(u[d+n.Y]-f)*g}switch(l){case e.setup:c.shearX=c.data.shearX+p*s,c.shearY=c.data.shearY+f*s;break;case e.first:case e.replace:c.shearX+=(c.data.shearX+p-c.shearX)*s,c.shearY+=(c.data.shearY+f-c.shearY)*s;break;case e.add:c.shearX+=p*s,c.shearY+=f*s}}},n}(s);t.ShearTimeline=h;var u=function(n){function i(e){var r=n.call(this,e)||this;return r.frames=t.Utils.newFloatArray(e*i.ENTRIES),r}return p(i,n),i.prototype.getPropertyId=function(){return(r.color<<24)+this.slotIndex},i.prototype.setFrame=function(t,e,n,r,a,o){t*=i.ENTRIES,this.frames[t]=e,this.frames[t+i.R]=n,this.frames[t+i.G]=r,this.frames[t+i.B]=a,this.frames[t+i.A]=o},i.prototype.apply=function(t,n,r,o,s,l,h){var u=t.slots[this.slotIndex],c=this.frames;if(r=c[c.length-i.ENTRIES]){var y=c.length;d=c[y+i.PREV_R],m=c[y+i.PREV_G],g=c[y+i.PREV_B],v=c[y+i.PREV_A]}else{var x=a.binarySearch(c,r,i.ENTRIES);d=c[x+i.PREV_R],m=c[x+i.PREV_G],g=c[x+i.PREV_B],v=c[x+i.PREV_A];var M=c[x],E=this.getCurvePercent(x/i.ENTRIES-1,1-(r-M)/(c[x+i.PREV_TIME]-M));d+=(c[x+i.R]-d)*E,m+=(c[x+i.G]-m)*E,g+=(c[x+i.B]-g)*E,v+=(c[x+i.A]-v)*E}1==s?u.color.set(d,m,g,v):(p=u.color,l==e.setup&&p.setFromColor(u.data.color),p.add((d-p.r)*s,(m-p.g)*s,(g-p.b)*s,(v-p.a)*s))}},i.ENTRIES=5,i.PREV_TIME=-5,i.PREV_R=-4,i.PREV_G=-3,i.PREV_B=-2,i.PREV_A=-1,i.R=1,i.G=2,i.B=3,i.A=4,i}(i);t.ColorTimeline=u;var c=function(n){function i(e){var r=n.call(this,e)||this;return r.frames=t.Utils.newFloatArray(e*i.ENTRIES),r}return p(i,n),i.prototype.getPropertyId=function(){return(r.twoColor<<24)+this.slotIndex},i.prototype.setFrame=function(t,e,n,r,a,o,s,l,h){t*=i.ENTRIES,this.frames[t]=e,this.frames[t+i.R]=n,this.frames[t+i.G]=r,this.frames[t+i.B]=a,this.frames[t+i.A]=o,this.frames[t+i.R2]=s,this.frames[t+i.G2]=l,this.frames[t+i.B2]=h},i.prototype.apply=function(t,n,r,o,s,l,h){var u=t.slots[this.slotIndex],c=this.frames;if(r=c[c.length-i.ENTRIES]){var b=c.length;g=c[b+i.PREV_R],v=c[b+i.PREV_G],y=c[b+i.PREV_B],x=c[b+i.PREV_A],M=c[b+i.PREV_R2],E=c[b+i.PREV_G2],w=c[b+i.PREV_B2]}else{var T=a.binarySearch(c,r,i.ENTRIES);g=c[T+i.PREV_R],v=c[T+i.PREV_G],y=c[T+i.PREV_B],x=c[T+i.PREV_A],M=c[T+i.PREV_R2],E=c[T+i.PREV_G2],w=c[T+i.PREV_B2];var S=c[T],A=this.getCurvePercent(T/i.ENTRIES-1,1-(r-S)/(c[T+i.PREV_TIME]-S));g+=(c[T+i.R]-g)*A,v+=(c[T+i.G]-v)*A,y+=(c[T+i.B]-y)*A,x+=(c[T+i.A]-x)*A,M+=(c[T+i.R2]-M)*A,E+=(c[T+i.G2]-E)*A,w+=(c[T+i.B2]-w)*A}1==s?(u.color.set(g,v,y,x),u.darkColor.set(M,E,w,1)):(p=u.color,f=u.darkColor,l==e.setup&&(p.setFromColor(u.data.color),f.setFromColor(u.data.darkColor)),p.add((g-p.r)*s,(v-p.g)*s,(y-p.b)*s,(x-p.a)*s),f.add((M-f.r)*s,(E-f.g)*s,(w-f.b)*s,0))}},i.ENTRIES=8,i.PREV_TIME=-8,i.PREV_R=-7,i.PREV_G=-6,i.PREV_B=-5,i.PREV_A=-4,i.PREV_R2=-3,i.PREV_G2=-2,i.PREV_B2=-1,i.R=1,i.G=2,i.B=3,i.A=4,i.R2=5,i.G2=6,i.B2=7,i}(i);t.TwoColorTimeline=c;var f=function(){function i(e){this.frames=t.Utils.newFloatArray(e),this.attachmentNames=new Array(e)}return i.prototype.getPropertyId=function(){return(r.attachment<<24)+this.slotIndex},i.prototype.getFrameCount=function(){return this.frames.length},i.prototype.setFrame=function(t,e,n){this.frames[t]=e,this.attachmentNames[t]=n},i.prototype.apply=function(t,r,i,o,s,l,h){var u=t.slots[this.slotIndex];if(h!=n.out||l!=e.setup){var c=this.frames;if(i=c[c.length-1]?c.length-1:a.binarySearch(c,i,1)-1;var d=this.attachmentNames[f];t.slots[this.slotIndex].setAttachment(null==d?null:t.getAttachment(this.slotIndex,d))}}else{var m=u.data.attachmentName;u.setAttachment(null==m?null:t.getAttachment(this.slotIndex,m))}},i}();t.AttachmentTimeline=f;var d=null,m=function(n){function i(e){var r=n.call(this,e)||this;return r.frames=t.Utils.newFloatArray(e),r.frameVertices=new Array(e),null==d&&(d=t.Utils.newFloatArray(64)),r}return p(i,n),i.prototype.getPropertyId=function(){return(r.deform<<27)+ +this.attachment.id+this.slotIndex},i.prototype.setFrame=function(t,e,n){this.frames[t]=e,this.frameVertices[t]=n},i.prototype.apply=function(n,r,i,o,s,l,h){var u=n.slots[this.slotIndex],c=u.getAttachment();if(c instanceof t.VertexAttachment&&c.applyDeform(this.attachment)){var p=u.attachmentVertices;0==p.length&&(l=e.setup);var f=this.frameVertices,d=f[0].length,m=this.frames;if(i=m[m.length-1]){var E=f[m.length-1];if(1==s)if(l==e.add)if(null==(g=c).bones)for(y=g.vertices,x=0;xn)this.apply(t,e,Number.MAX_VALUE,r,i,o,s),e=-1;else if(e>=l[h-1])return;if(!(n0&&l[u-1]==c;)u--;for(;u=l[u];u++)r.push(this.events[u])}}},e}();t.EventTimeline=g;var v=function(){function i(e){this.frames=t.Utils.newFloatArray(e),this.drawOrders=new Array(e)}return i.prototype.getPropertyId=function(){return r.drawOrder<<24},i.prototype.getFrameCount=function(){return this.frames.length},i.prototype.setFrame=function(t,e,n){this.frames[t]=e,this.drawOrders[t]=n},i.prototype.apply=function(r,i,o,s,l,h,u){var c=r.drawOrder,p=r.slots;if(u!=n.out||h!=e.setup){var f=this.frames;if(o=f[f.length-1]?f.length-1:a.binarySearch(f,o)-1;var m=this.drawOrders[d];if(null==m)t.Utils.arrayCopy(p,0,c,0,p.length);else for(var g=0,v=m.length;g=c[c.length-o.ENTRIES])h==e.setup?(p.mix=p.data.mix+(c[c.length+o.PREV_MIX]-p.data.mix)*l,u==n.out?(p.bendDirection=p.data.bendDirection,p.compress=p.data.compress,p.stretch=p.data.stretch):(p.bendDirection=c[c.length+o.PREV_BEND_DIRECTION],p.compress=0!=c[c.length+o.PREV_COMPRESS],p.stretch=0!=c[c.length+o.PREV_STRETCH])):(p.mix+=(c[c.length+o.PREV_MIX]-p.mix)*l,u==n.in&&(p.bendDirection=c[c.length+o.PREV_BEND_DIRECTION],p.compress=0!=c[c.length+o.PREV_COMPRESS],p.stretch=0!=c[c.length+o.PREV_STRETCH]));else{var f=a.binarySearch(c,i,o.ENTRIES),d=c[f+o.PREV_MIX],m=c[f],g=this.getCurvePercent(f/o.ENTRIES-1,1-(i-m)/(c[f+o.PREV_TIME]-m));h==e.setup?(p.mix=p.data.mix+(d+(c[f+o.MIX]-d)*g-p.data.mix)*l,u==n.out?(p.bendDirection=p.data.bendDirection,p.compress=p.data.compress,p.stretch=p.data.stretch):(p.bendDirection=c[f+o.PREV_BEND_DIRECTION],p.compress=0!=c[f+o.PREV_COMPRESS],p.stretch=0!=c[f+o.PREV_STRETCH])):(p.mix+=(d+(c[f+o.MIX]-d)*g-p.mix)*l,u==n.in&&(p.bendDirection=c[f+o.PREV_BEND_DIRECTION],p.compress=0!=c[f+o.PREV_COMPRESS],p.stretch=0!=c[f+o.PREV_STRETCH]))}},o.ENTRIES=5,o.PREV_TIME=-5,o.PREV_MIX=-4,o.PREV_BEND_DIRECTION=-3,o.PREV_COMPRESS=-2,o.PREV_STRETCH=-1,o.MIX=1,o.BEND_DIRECTION=2,o.COMPRESS=3,o.STRETCH=4,o}(i);t.IkConstraintTimeline=y;var x=function(n){function i(e){var r=n.call(this,e)||this;return r.frames=t.Utils.newFloatArray(e*i.ENTRIES),r}return p(i,n),i.prototype.getPropertyId=function(){return(r.transformConstraint<<24)+this.transformConstraintIndex},i.prototype.setFrame=function(t,e,n,r,a,o){t*=i.ENTRIES,this.frames[t]=e,this.frames[t+i.ROTATE]=n,this.frames[t+i.TRANSLATE]=r,this.frames[t+i.SCALE]=a,this.frames[t+i.SHEAR]=o},i.prototype.apply=function(t,n,r,o,s,l,h){var u=this.frames,c=t.transformConstraints[this.transformConstraintIndex];if(r=u[u.length-i.ENTRIES]){var v=u.length;f=u[v+i.PREV_ROTATE],d=u[v+i.PREV_TRANSLATE],m=u[v+i.PREV_SCALE],g=u[v+i.PREV_SHEAR]}else{var y=a.binarySearch(u,r,i.ENTRIES);f=u[y+i.PREV_ROTATE],d=u[y+i.PREV_TRANSLATE],m=u[y+i.PREV_SCALE],g=u[y+i.PREV_SHEAR];var x=u[y],M=this.getCurvePercent(y/i.ENTRIES-1,1-(r-x)/(u[y+i.PREV_TIME]-x));f+=(u[y+i.ROTATE]-f)*M,d+=(u[y+i.TRANSLATE]-d)*M,m+=(u[y+i.SCALE]-m)*M,g+=(u[y+i.SHEAR]-g)*M}l==e.setup?(p=c.data,c.rotateMix=p.rotateMix+(f-p.rotateMix)*s,c.translateMix=p.translateMix+(d-p.translateMix)*s,c.scaleMix=p.scaleMix+(m-p.scaleMix)*s,c.shearMix=p.shearMix+(g-p.shearMix)*s):(c.rotateMix+=(f-c.rotateMix)*s,c.translateMix+=(d-c.translateMix)*s,c.scaleMix+=(m-c.scaleMix)*s,c.shearMix+=(g-c.shearMix)*s)}},i.ENTRIES=5,i.PREV_TIME=-5,i.PREV_ROTATE=-4,i.PREV_TRANSLATE=-3,i.PREV_SCALE=-2,i.PREV_SHEAR=-1,i.ROTATE=1,i.TRANSLATE=2,i.SCALE=3,i.SHEAR=4,i}(i);t.TransformConstraintTimeline=x;var M=function(n){function i(e){var r=n.call(this,e)||this;return r.frames=t.Utils.newFloatArray(e*i.ENTRIES),r}return p(i,n),i.prototype.getPropertyId=function(){return(r.pathConstraintPosition<<24)+this.pathConstraintIndex},i.prototype.setFrame=function(t,e,n){t*=i.ENTRIES,this.frames[t]=e,this.frames[t+i.VALUE]=n},i.prototype.apply=function(t,n,r,o,s,l,h){var u=this.frames,c=t.pathConstraints[this.pathConstraintIndex];if(r=u[u.length-i.ENTRIES])p=u[u.length+i.PREV_VALUE];else{var f=a.binarySearch(u,r,i.ENTRIES);p=u[f+i.PREV_VALUE];var d=u[f],m=this.getCurvePercent(f/i.ENTRIES-1,1-(r-d)/(u[f+i.PREV_TIME]-d));p+=(u[f+i.VALUE]-p)*m}l==e.setup?c.position=c.data.position+(p-c.data.position)*s:c.position+=(p-c.position)*s}},i.ENTRIES=2,i.PREV_TIME=-2,i.PREV_VALUE=-1,i.VALUE=1,i}(i);t.PathConstraintPositionTimeline=M;var E=function(t){function n(e){return t.call(this,e)||this}return p(n,t),n.prototype.getPropertyId=function(){return(r.pathConstraintSpacing<<24)+this.pathConstraintIndex},n.prototype.apply=function(t,r,i,o,s,l,h){var u=this.frames,c=t.pathConstraints[this.pathConstraintIndex];if(i=u[u.length-n.ENTRIES])p=u[u.length+n.PREV_VALUE];else{var f=a.binarySearch(u,i,n.ENTRIES);p=u[f+n.PREV_VALUE];var d=u[f],m=this.getCurvePercent(f/n.ENTRIES-1,1-(i-d)/(u[f+n.PREV_TIME]-d));p+=(u[f+n.VALUE]-p)*m}l==e.setup?c.spacing=c.data.spacing+(p-c.data.spacing)*s:c.spacing+=(p-c.spacing)*s}},n}(M);t.PathConstraintSpacingTimeline=E;var w=function(n){function i(e){var r=n.call(this,e)||this;return r.frames=t.Utils.newFloatArray(e*i.ENTRIES),r}return p(i,n),i.prototype.getPropertyId=function(){return(r.pathConstraintMix<<24)+this.pathConstraintIndex},i.prototype.setFrame=function(t,e,n,r){t*=i.ENTRIES,this.frames[t]=e,this.frames[t+i.ROTATE]=n,this.frames[t+i.TRANSLATE]=r},i.prototype.apply=function(t,n,r,o,s,l,h){var u=this.frames,c=t.pathConstraints[this.pathConstraintIndex];if(r=u[u.length-i.ENTRIES])p=u[u.length+i.PREV_ROTATE],f=u[u.length+i.PREV_TRANSLATE];else{var d=a.binarySearch(u,r,i.ENTRIES);p=u[d+i.PREV_ROTATE],f=u[d+i.PREV_TRANSLATE];var m=u[d],g=this.getCurvePercent(d/i.ENTRIES-1,1-(r-m)/(u[d+i.PREV_TIME]-m));p+=(u[d+i.ROTATE]-p)*g,f+=(u[d+i.TRANSLATE]-f)*g}l==e.setup?(c.rotateMix=c.data.rotateMix+(p-c.data.rotateMix)*s,c.translateMix=c.data.translateMix+(f-c.data.translateMix)*s):(c.rotateMix+=(p-c.rotateMix)*s,c.translateMix+=(f-c.translateMix)*s)}},i.ENTRIES=3,i.PREV_TIME=-3,i.PREV_ROTATE=-2,i.PREV_TRANSLATE=-1,i.ROTATE=1,i.TRANSLATE=2,i}(i);t.PathConstraintMixTimeline=w}(t.core||(t.core={}))}(c||(c={})),function(t){!function(t){var e=function(){function e(e){this.tracks=new Array,this.events=new Array,this.listeners=new Array,this.queue=new a(this),this.propertyIDs=new t.IntSet,this.animationsChanged=!1,this.timeScale=1,this.trackEntryPool=new t.Pool((function(){return new n})),this.data=e}return e.prototype.update=function(t){t*=this.timeScale;for(var e=this.tracks,n=0,r=e.length;n0){if(a.delay-=i,a.delay>0)continue;i=-a.delay,a.delay=0}var o=a.next;if(null!=o){var s=a.trackLast-o.delay;if(s>=0){for(o.delay=0,o.trackTime=0==a.timeScale?0:(s/a.timeScale+t)*o.timeScale,a.trackTime+=i,this.setCurrent(n,o,!0);null!=o.mixingFrom;)o.mixTime+=t,o=o.mixingFrom;continue}}else if(a.trackLast>=a.trackEnd&&null==a.mixingFrom){e[n]=null,this.queue.end(a),this.disposeNext(a);continue}if(null!=a.mixingFrom&&this.updateMixingFrom(a,t)){var l=a.mixingFrom;for(a.mixingFrom=null,null!=l&&(l.mixingTo=null);null!=l;)this.queue.end(l),l=l.mixingFrom}a.trackTime+=i}}this.queue.drain()},e.prototype.updateMixingFrom=function(t,e){var n=t.mixingFrom;if(null==n)return!0;var r=this.updateMixingFrom(n,e);return n.animationLast=n.nextAnimationLast,n.trackLast=n.nextTrackLast,t.mixTime>0&&t.mixTime>=t.mixDuration?(0!=n.totalAlpha&&0!=t.mixDuration||(t.mixingFrom=n.mixingFrom,null!=n.mixingFrom&&(n.mixingFrom.mixingTo=t),t.interruptAlpha=n.interruptAlpha,this.queue.end(n)),r):(n.trackTime+=e*n.timeScale,t.mixTime+=e,!1)},e.prototype.apply=function(n){if(null==n)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();for(var r=this.events,a=this.tracks,i=!1,o=0,s=a.length;o0)){i=!0;var h=0==o?t.MixBlend.first:l.mixBlend,u=l.alpha;null!=l.mixingFrom?u*=this.applyMixingFrom(l,n,h):l.trackTime>=l.trackEnd&&null==l.next&&(u=0);var c=l.animationLast,p=l.getAnimationTime(),f=l.animation.timelines.length,d=l.animation.timelines;if(0!=o||1!=u&&h!=t.MixBlend.add){var m=l.timelineMode,g=0==l.timelinesRotation.length;g&&t.Utils.setArraySize(l.timelinesRotation,f<<1,null);var v=l.timelinesRotation;for(M=0;M1&&(o=1),a!=t.MixBlend.first&&(a=i.mixBlend));var s=o0&&this.queueEvents(i,c),this.events.length=0,i.nextAnimationLast=c,i.nextTrackLast=i.trackTime,o},e.prototype.applyRotateTimeline=function(e,n,r,a,i,o,s,l){if(l&&(o[s]=0),1!=a){var h=e,u=h.frames,c=n.bones[h.boneIndex],p=0,f=0;if(r=u[u.length-t.RotateTimeline.ENTRIES])f=c.data.rotation+u[u.length+t.RotateTimeline.PREV_ROTATION];else{var d=t.Animation.binarySearch(u,r,t.RotateTimeline.ENTRIES),m=u[d+t.RotateTimeline.PREV_ROTATION],g=u[d],v=h.getCurvePercent((d>>1)-1,1-(r-g)/(u[d+t.RotateTimeline.PREV_TIME]-g));f=u[d+t.RotateTimeline.ROTATION]-m,f=m+(f-=360*(16384-(16384.499999999996-f/360|0)))*v+c.data.rotation,f-=360*(16384-(16384.499999999996-f/360|0))}var y=0,x=f-p;if(0==(x-=360*(16384-(16384.499999999996-x/360|0))))y=o[s];else{var M=0,E=0;l?(M=0,E=x):(M=o[s],E=o[s+1]);var w=x>0,b=M>=0;t.MathUtils.signum(E)!=t.MathUtils.signum(x)&&Math.abs(E)<=90&&(Math.abs(M)>180&&(M+=360*t.MathUtils.signum(M)),b=w),y=x+M-M%360,b!=w&&(y+=360*t.MathUtils.signum(M)),o[s]=y}o[s+1]=x,p+=y*a,c.rotation=p-360*(16384-(16384.499999999996-p/360|0))}else e.apply(n,0,r,null,1,i,t.MixDirection.in)},e.prototype.queueEvents=function(t,e){for(var n=t.animationStart,r=t.animationEnd,a=r-n,i=t.trackLast%a,o=this.events,s=0,l=o.length;sr||this.queue.event(t,h)}for((t.loop?0==a||i>t.trackTime%a:e>=r&&t.animationLast=this.tracks.length)){var e=this.tracks[t];if(null!=e){this.queue.end(e),this.disposeNext(e);for(var n=e;;){var r=n.mixingFrom;if(null==r)break;this.queue.end(r),n.mixingFrom=null,n.mixingTo=null,n=r}this.tracks[e.trackIndex]=null,this.queue.drain()}}},e.prototype.setCurrent=function(t,e,n){var r=this.expandToIndex(t);this.tracks[t]=e,null!=r&&(n&&this.queue.interrupt(r),e.mixingFrom=r,r.mixingTo=e,e.mixTime=0,null!=r.mixingFrom&&r.mixDuration>0&&(e.interruptAlpha*=Math.min(1,r.mixTime/r.mixDuration)),r.timelinesRotation.length=0),this.queue.start(e)},e.prototype.setAnimation=function(t,e,n){var r=this.data.skeletonData.findAnimation(e);if(null==r)throw new Error("Animation not found: "+e);return this.setAnimationWith(t,r,n)},e.prototype.setAnimationWith=function(t,e,n){if(null==e)throw new Error("animation cannot be null.");var r=!0,a=this.expandToIndex(t);null!=a&&(-1==a.nextTrackLast?(this.tracks[t]=a.mixingFrom,this.queue.interrupt(a),this.queue.end(a),this.disposeNext(a),a=a.mixingFrom,r=!1):this.disposeNext(a));var i=this.trackEntry(t,e,n,a);return this.setCurrent(t,i,r),this.queue.drain(),i},e.prototype.addAnimation=function(t,e,n,r){var a=this.data.skeletonData.findAnimation(e);if(null==a)throw new Error("Animation not found: "+e);return this.addAnimationWith(t,a,n,r)},e.prototype.addAnimationWith=function(t,e,n,r){if(null==e)throw new Error("animation cannot be null.");var a=this.expandToIndex(t);if(null!=a)for(;null!=a.next;)a=a.next;var i=this.trackEntry(t,e,n,a);if(null==a)this.setCurrent(t,i,!0),this.queue.drain();else if(a.next=i,r<=0){var o=a.animationEnd-a.animationStart;0!=o?(a.loop?r+=o*(1+(a.trackTime/o|0)):r+=Math.max(o,a.trackTime),r-=this.data.getMix(a.animation,e)):r=a.trackTime}return i.delay=r,i},e.prototype.setEmptyAnimation=function(t,n){var r=this.setAnimationWith(t,e.emptyAnimation,!1);return r.mixDuration=n,r.trackEnd=n,r},e.prototype.addEmptyAnimation=function(t,n,r){r<=0&&(r-=n);var a=this.addAnimationWith(t,e.emptyAnimation,!1,r);return a.mixDuration=n,a.trackEnd=n,a},e.prototype.setEmptyAnimations=function(t){var e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(var n=0,r=this.tracks.length;n0){o[h]=e.HOLD_MIX,s[h]=c;continue t}break}o[h]=e.HOLD}else o[h]=e.FIRST;else o[h]=e.SUBSEQUENT}},e.prototype.hasTimeline=function(t,e){for(var n=t.animation.timelines,r=0,a=n.length;r=this.tracks.length?null:this.tracks[t]},e.prototype.addListener=function(t){if(null==t)throw new Error("listener cannot be null.");this.listeners.push(t)},e.prototype.removeListener=function(t){var e=this.listeners.indexOf(t);e>=0&&this.listeners.splice(e,1)},e.prototype.clearListeners=function(){this.listeners.length=0},e.prototype.clearListenerNotifications=function(){this.queue.clear()},e.prototype.setAnimationByName=function(t,n,r){e.deprecatedWarning1||(e.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: AnimationState.setAnimationByName is deprecated, please use setAnimation from now on.")),this.setAnimation(t,n,r)},e.prototype.addAnimationByName=function(t,n,r,a){e.deprecatedWarning2||(e.deprecatedWarning2=!0,console.warn("Spine Deprecation Warning: AnimationState.addAnimationByName is deprecated, please use addAnimation from now on.")),this.addAnimation(t,n,r,a)},e.prototype.hasAnimation=function(t){return null!==this.data.skeletonData.findAnimation(t)},e.prototype.hasAnimationByName=function(t){return e.deprecatedWarning3||(e.deprecatedWarning3=!0,console.warn("Spine Deprecation Warning: AnimationState.hasAnimationByName is deprecated, please use hasAnimation from now on.")),this.hasAnimation(t)},e.emptyAnimation=new t.Animation("",[],0),e.SUBSEQUENT=0,e.FIRST=1,e.HOLD=2,e.HOLD_MIX=3,e.deprecatedWarning1=!1,e.deprecatedWarning2=!1,e.deprecatedWarning3=!1,e}();t.AnimationState=e;var n=function(){function e(){this.mixBlend=t.MixBlend.replace,this.timelineMode=new Array,this.timelineHoldMix=new Array,this.timelinesRotation=new Array}return e.prototype.reset=function(){this.next=null,this.mixingFrom=null,this.mixingTo=null,this.animation=null,this.listener=null,this.timelineMode.length=0,this.timelineHoldMix.length=0,this.timelinesRotation.length=0},e.prototype.getAnimationTime=function(){if(this.loop){var t=this.animationEnd-this.animationStart;return 0==t?this.animationStart:this.trackTime%t+this.animationStart}return Math.min(this.trackTime+this.animationStart,this.animationEnd)},e.prototype.setAnimationLast=function(t){this.animationLast=t,this.nextAnimationLast=t},e.prototype.isComplete=function(){return this.trackTime>=this.animationEnd-this.animationStart},e.prototype.resetRotationDirections=function(){this.timelinesRotation.length=0},Object.defineProperty(e.prototype,"time",{get:function(){return e.deprecatedWarning1||(e.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: TrackEntry.time is deprecated, please use trackTime from now on.")),this.trackTime},set:function(t){e.deprecatedWarning1||(e.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: TrackEntry.time is deprecated, please use trackTime from now on.")),this.trackTime=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"endTime",{get:function(){return e.deprecatedWarning2||(e.deprecatedWarning2=!0,console.warn("Spine Deprecation Warning: TrackEntry.endTime is deprecated, please use trackEnd from now on.")),this.trackTime},set:function(t){e.deprecatedWarning2||(e.deprecatedWarning2=!0,console.warn("Spine Deprecation Warning: TrackEntry.endTime is deprecated, please use trackEnd from now on.")),this.trackTime=t},enumerable:!0,configurable:!0}),e.prototype.loopsCount=function(){return Math.floor(this.trackTime/this.trackEnd)},e.deprecatedWarning1=!1,e.deprecatedWarning2=!1,e}();t.TrackEntry=n;var r,a=function(){function e(t){this.objects=[],this.drainDisabled=!1,this.animState=t}return e.prototype.start=function(t){this.objects.push(r.start),this.objects.push(t),this.animState.animationsChanged=!0},e.prototype.interrupt=function(t){this.objects.push(r.interrupt),this.objects.push(t)},e.prototype.end=function(t){this.objects.push(r.end),this.objects.push(t),this.animState.animationsChanged=!0},e.prototype.dispose=function(t){this.objects.push(r.dispose),this.objects.push(t)},e.prototype.complete=function(t){this.objects.push(r.complete),this.objects.push(t)},e.prototype.event=function(t,e){this.objects.push(r.event),this.objects.push(t),this.objects.push(e)},e.prototype.deprecateStuff=function(){return e.deprecatedWarning1||(e.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: onComplete, onStart, onEnd, onEvent art deprecated, please use listeners from now on. 'state.addListener({ complete: function(track, event) { } })'")),!0},e.prototype.drain=function(){if(!this.drainDisabled){this.drainDisabled=!0;for(var e=this.objects,n=this.animState.listeners,a=0;a1e-4?(g=v*(A=Math.abs(m*y-g*v)/A),y=m*A,b=Math.atan2(v,m)*e.MathUtils.radDeg):(m=0,v=0,b=90-Math.atan2(y,g)*e.MathUtils.radDeg);var T=a+s-b,S=a+l-b+90;x=e.MathUtils.cosDeg(T)*i,M=e.MathUtils.cosDeg(S)*o,E=e.MathUtils.sinDeg(T)*i,w=e.MathUtils.sinDeg(S)*o,u.a=m*x-g*E,u.c=m*M-g*w,u.b=v*x+y*E,u.d=v*M+y*w;break;case e.TransformMode.NoScale:case e.TransformMode.NoScaleOrReflection:var A,R=e.MathUtils.cosDeg(a),P=e.MathUtils.sinDeg(a),C=(m*R+g*P)/c,I=(v*R+y*P)/p;(A=Math.sqrt(C*C+I*I))>1e-5&&(A=1/A),C*=A,I*=A,A=Math.sqrt(C*C+I*I),this.data.transformMode==e.TransformMode.NoScale&&m*y-g*v<0!=(t.yDown?this.skeleton.scaleX<0!=this.skeleton.scaleY>0:this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(A=-A);var V=Math.PI/2+Math.atan2(I,C),k=Math.cos(V)*A,N=Math.sin(V)*A;x=e.MathUtils.cosDeg(s)*i,M=e.MathUtils.cosDeg(90+l)*o,E=e.MathUtils.sinDeg(s)*i,w=e.MathUtils.sinDeg(90+l)*o,u.a=C*x+k*E,u.c=C*M+k*w,u.b=I*x+N*E,u.d=I*M+N*w}u.a*=c,u.c*=c,u.b*=p,u.d*=p},t.prototype.setToSetupPose=function(){var t=this.data;this.x=t.x,this.y=t.y,this.rotation=t.rotation,this.scaleX=t.scaleX,this.scaleY=t.scaleY,this.shearX=t.shearX,this.shearY=t.shearY},t.prototype.getWorldRotationX=function(){return Math.atan2(this.matrix.b,this.matrix.a)*e.MathUtils.radDeg},t.prototype.getWorldRotationY=function(){return Math.atan2(this.matrix.d,this.matrix.c)*e.MathUtils.radDeg},t.prototype.getWorldScaleX=function(){var t=this.matrix;return Math.sqrt(t.a*t.a+t.c*t.c)},t.prototype.getWorldScaleY=function(){var t=this.matrix;return Math.sqrt(t.b*t.b+t.d*t.d)},t.prototype.updateAppliedTransform=function(){this.appliedValid=!0;var t=this.parent,n=this.matrix;if(null==t)return this.ax=n.tx,this.ay=n.ty,this.arotation=Math.atan2(n.b,n.a)*e.MathUtils.radDeg,this.ascaleX=Math.sqrt(n.a*n.a+n.b*n.b),this.ascaleY=Math.sqrt(n.c*n.c+n.d*n.d),this.ashearX=0,void(this.ashearY=Math.atan2(n.a*n.c+n.b*n.d,n.a*n.d-n.b*n.c)*e.MathUtils.radDeg);var r=t.matrix,a=1/(r.a*r.d-r.b*r.c),i=n.tx-r.tx,o=n.ty-r.ty;this.ax=i*r.d*a-o*r.c*a,this.ay=o*r.a*a-i*r.b*a;var s=a*r.d,l=a*r.a,h=a*r.c,u=a*r.b,c=s*n.a-h*n.b,p=s*n.c-h*n.d,f=l*n.b-u*n.a,d=l*n.d-u*n.c;if(this.ashearX=0,this.ascaleX=Math.sqrt(c*c+f*f),this.ascaleX>1e-4){var m=c*d-p*f;this.ascaleY=m/this.ascaleX,this.ashearY=Math.atan2(c*p+f*d,m)*e.MathUtils.radDeg,this.arotation=Math.atan2(f,c)*e.MathUtils.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(p*p+d*d),this.ashearY=0,this.arotation=90-Math.atan2(d,p)*e.MathUtils.radDeg},t.prototype.worldToLocal=function(t){var e=this.matrix,n=e.a,r=e.c,a=e.b,i=e.d,o=1/(n*i-r*a),s=t.x-e.tx,l=t.y-e.ty;return t.x=s*i*o-l*r*o,t.y=l*n*o-s*a*o,t},t.prototype.localToWorld=function(t){var e=this.matrix,n=t.x,r=t.y;return t.x=n*e.a+r*e.c+e.tx,t.y=n*e.b+r*e.d+e.ty,t},t.prototype.worldToLocalRotation=function(t){var n=e.MathUtils.sinDeg(t),r=e.MathUtils.cosDeg(t),a=this.matrix;return Math.atan2(a.a*n-a.b*r,a.d*r-a.c*n)*e.MathUtils.radDeg},t.prototype.localToWorldRotation=function(t){var n=e.MathUtils.sinDeg(t),r=e.MathUtils.cosDeg(t),a=this.matrix;return Math.atan2(r*a.b+n*a.d,r*a.a+n*a.c)*e.MathUtils.radDeg},t.prototype.rotateWorld=function(t){var n=this.matrix,r=n.a,a=n.c,i=n.b,o=n.d,s=e.MathUtils.cosDeg(t),l=e.MathUtils.sinDeg(t);n.a=s*r-l*i,n.c=s*a-l*o,n.b=l*r+s*i,n.d=l*a+s*o,this.appliedValid=!1},t.yDown=!1,t}(),e.Bone=n}(c||(c={})),function(t){var e,n,r;e=t.core||(t.core={}),r=function(t,e,r){if(this.x=0,this.y=0,this.rotation=0,this.scaleX=1,this.scaleY=1,this.shearX=0,this.shearY=0,this.transformMode=n.Normal,t<0)throw new Error("index must be >= 0.");if(null==e)throw new Error("name cannot be null.");this.index=t,this.name=e,this.parent=r},e.BoneData=r,function(t){t[t.Normal=0]="Normal",t[t.OnlyTranslation=1]="OnlyTranslation",t[t.NoRotationOrReflection=2]="NoRotationOrReflection",t[t.NoScale=3]="NoScale",t[t.NoScaleOrReflection=4]="NoScaleOrReflection"}(n=e.TransformMode||(e.TransformMode={}))}(c||(c={})),function(t){var e,n;e=t.core||(t.core={}),n=function(t,e){if(null==e)throw new Error("data cannot be null.");this.time=t,this.data=e},e.Event=n}(c||(c={})),function(t){var e,n;e=t.core||(t.core={}),n=function(t){this.name=t},e.EventData=n}(c||(c={})),function(t){var e,n;e=t.core||(t.core={}),n=function(){function t(t,e){if(this.bendDirection=0,this.compress=!1,this.stretch=!1,this.mix=1,null==t)throw new Error("data cannot be null.");if(null==e)throw new Error("skeleton cannot be null.");this.data=t,this.mix=t.mix,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch,this.bones=new Array;for(var n=0;n180?d-=360:d<-180&&(d+=360);var m=t.ascaleX,g=t.ascaleY;if(a||i){var v=t.data.length*m,y=Math.sqrt(p*p+f*f);if(a&&yv&&v>1e-4){var x=(y/v-1)*s+1;m*=x,o&&(g*=x)}}t.updateWorldTransformWith(t.ax,t.ay,t.arotation+d*s,m,g,t.ashearX,t.ashearY)},t.prototype.apply2=function(t,n,r,a,i,o,s){if(0!=s){t.appliedValid||t.updateAppliedTransform(),n.appliedValid||n.updateAppliedTransform();var l=t.ax,h=t.ay,u=t.ascaleX,c=u,p=t.ascaleY,f=n.ascaleX,d=t.matrix,m=0,g=0,v=0;u<0?(u=-u,m=180,v=-1):(m=0,v=1),p<0&&(p=-p,v=-v),f<0?(f=-f,g=180):g=0;var y=n.ax,x=0,M=0,E=0,w=d.a,b=d.c,T=d.b,S=d.d,A=Math.abs(u-p)<=1e-4;A?(M=w*y+b*(x=n.ay)+d.tx,E=T*y+S*x+d.ty):(x=0,M=w*y+d.tx,E=T*y+d.ty);var R=t.parent.matrix;w=R.a,b=R.c,T=R.b;var P=1/(w*(S=R.d)-b*T),C=r-R.tx,I=a-R.ty,V=(C*S-I*b)*P-l,k=(I*w-C*T)*P-h,N=V*V+k*k,D=((C=M-R.tx)*S-(I=E-R.ty)*b)*P-l,O=(I*w-C*T)*P-h,U=Math.sqrt(D*D+O*O),_=n.data.length*f,Y=0,X=0;t:if(A){var F=(N-U*U-(_*=u)*_)/(2*U*_);F<-1?F=-1:F>1&&(F=1,o&&U+_>1e-4&&(c*=(Math.sqrt(N)/(U+_)-1)*s+1)),X=Math.acos(F)*i,w=U+_*F,b=_*Math.sin(X),Y=Math.atan2(k*w-V*b,V*w+k*b)}else{var B=(w=u*_)*w,L=(b=p*_)*b,W=Math.atan2(k,V),j=-2*L*U,q=L-B;if((S=j*j-4*q*(T=L*U*U+B*N-B*L))>=0){var G=Math.sqrt(S);j<0&&(G=-G);var H=(G=-(j+G)/2)/q,z=T/G,Z=Math.abs(H)=-1&&T<=1&&(T=Math.acos(T),(S=(C=w*Math.cos(T)+U)*C+(I=b*Math.sin(T))*I)nt&&(tt=T,nt=S,et=C,rt=I)),N<=(K+nt)/2?(Y=W-Math.atan2($*i,Q),X=J*i):(Y=W-Math.atan2(rt*i,et),X=tt*i)}var at=Math.atan2(x,y)*v,it=t.arotation;(Y=(Y-at)*e.MathUtils.radDeg+m-it)>180?Y-=360:Y<-180&&(Y+=360),t.updateWorldTransformWith(l,h,it+Y*s,c,t.ascaleY,0,0),it=n.arotation,(X=((X+at)*e.MathUtils.radDeg-n.ashearX)*v+g-it)>180?X-=360:X<-180&&(X+=360),n.updateWorldTransformWith(y,x,it+X*s,n.ascaleX,n.ascaleY,n.ashearX,n.ashearY)}else n.updateWorldTransform()},t}(),e.IkConstraint=n}(c||(c={})),function(t){var e,n;e=t.core||(t.core={}),n=function(t){this.order=0,this.bones=new Array,this.bendDirection=1,this.compress=!1,this.stretch=!1,this.uniform=!1,this.mix=1,this.name=t},e.IkConstraintData=n}(c||(c={})),function(t){var e,n;e=t.core||(t.core={}),n=function(){function t(t,e){if(this.position=0,this.spacing=0,this.rotateMix=0,this.translateMix=0,this.spaces=new Array,this.positions=new Array,this.world=new Array,this.curves=new Array,this.lengths=new Array,this.segments=new Array,null==t)throw new Error("data cannot be null.");if(null==e)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(var n=0,r=t.bones.length;n0;if(a>0||i){var o=this.data,s=o.spacingMode,l=s==e.SpacingMode.Length,h=o.rotateMode,u=h==e.RotateMode.Tangent,c=h==e.RotateMode.ChainScale,p=this.bones.length,f=u?p:p+1,d=this.bones,m=e.Utils.setArraySize(this.spaces,f),g=null,v=this.spacing;if(c||l){c&&(g=e.Utils.setArraySize(this.lengths,p));for(var y=0,x=f-1;y0?e.MathUtils.degRad:-e.MathUtils.degRad),y=0;for(var C=3;ye.MathUtils.PI?F-=e.MathUtils.PI2:F<-e.MathUtils.PI&&(F+=e.MathUtils.PI2),F*=r,B=Math.cos(F),L=Math.sin(F),V.a=B*U-L*Y,V.c=B*_-L*X,V.b=L*U+B*Y,V.d=L*_+B*X}I.appliedValid=!1}}}},t.prototype.computeWorldPositions=function(n,r,a,i,o){var s=this.target,l=this.position,h=this.spaces,u=e.Utils.setArraySize(this.positions,3*r+2),c=null,p=n.closed,f=n.worldVerticesLength,d=f/6,m=t.NONE;if(!n.constantSpeed){var g=n.lengths,v=g[d-=p?1:2];if(i&&(l*=v),o)for(var y=0;yv){m!=t.AFTER&&(m=t.AFTER,n.computeWorldVertices(s,f-6,4,c,0,2)),this.addAfterPosition(E-v,c,0,u,x);continue}}for(;;M++){var w=g[M];if(!(E>w)){0==M?E/=w:E=(E-(Z=g[M-1]))/(w-Z);break}}M!=m&&(m=M,p&&M==d?(n.computeWorldVertices(s,f-4,4,c,0,2),n.computeWorldVertices(s,0,4,c,4,2)):n.computeWorldVertices(s,6*M+2,8,c,0,2)),this.addCurvePosition(E,c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],u,x,a||y>0&&0==q)}return u}p?(f+=2,c=e.Utils.setArraySize(this.world,f),n.computeWorldVertices(s,2,f-4,c,0,2),n.computeWorldVertices(s,0,2,c,f-4,2),c[f-2]=c[0],c[f-1]=c[1]):(d--,f-=4,c=e.Utils.setArraySize(this.world,f),n.computeWorldVertices(s,2,f,c,0,2));for(var b=e.Utils.setArraySize(this.curves,d),T=0,S=c[0],A=c[1],R=0,P=0,C=0,I=0,V=0,k=0,N=0,D=0,O=0,U=0,_=0,Y=0,X=0,F=0,B=(y=0,2);yT){this.addAfterPosition(E-T,c,f-4,u,x);continue}}for(;;M++){var G=b[M];if(!(E>G)){0==M?E/=G:E=(E-(Z=b[M-1]))/(G-Z);break}}if(M!=m){m=M;var H=6*M;for(S=c[H],A=c[H+1],R=c[H+2],P=c[H+3],C=c[H+4],I=c[H+5],_=2*(N=.03*(S-2*R+C))+(O=.006*(3*(R-C)-S+(V=c[H+6]))),Y=2*(D=.03*(A-2*P+I))+(U=.006*(3*(P-I)-A+(k=c[H+7]))),X=.3*(R-S)+N+.16666667*O,F=.3*(P-A)+D+.16666667*U,W=Math.sqrt(X*X+F*F),L[0]=W,H=1;H<8;H++)X+=_,F+=Y,_+=O,Y+=U,W+=Math.sqrt(X*X+F*F),L[H]=W;X+=_,F+=Y,W+=Math.sqrt(X*X+F*F),L[8]=W,X+=_+O,F+=Y+U,W+=Math.sqrt(X*X+F*F),L[9]=W,j=0}for(E*=W;;j++){var z=L[j];if(!(E>z)){var Z;0==j?E/=z:E=j+(E-(Z=L[j-1]))/(z-Z);break}}this.addCurvePosition(.1*E,S,A,R,P,C,I,V,k,u,x,a||y>0&&0==q)}return u},t.prototype.addBeforePosition=function(t,e,n,r,a){var i=e[n],o=e[n+1],s=e[n+2]-i,l=e[n+3]-o,h=Math.atan2(l,s);r[a]=i+t*Math.cos(h),r[a+1]=o+t*Math.sin(h),r[a+2]=h},t.prototype.addAfterPosition=function(t,e,n,r,a){var i=e[n+2],o=e[n+3],s=i-e[n],l=o-e[n+1],h=Math.atan2(l,s);r[a]=i+t*Math.cos(h),r[a+1]=o+t*Math.sin(h),r[a+2]=h},t.prototype.addCurvePosition=function(t,e,n,r,a,i,o,s,l,h,u,c){(0==t||isNaN(t))&&(t=1e-4);var p=t*t,f=p*t,d=1-t,m=d*d,g=m*d,v=d*t,y=3*v,x=d*y,M=y*t,E=e*g+r*x+i*M+s*f,w=n*g+a*x+o*M+l*f;h[u]=E,h[u+1]=w,c&&(h[u+2]=Math.atan2(w-(n*m+a*v*2+o*p),E-(e*m+r*v*2+i*p)))},t.prototype.getOrder=function(){return this.data.order},t.NONE=-1,t.BEFORE=-2,t.AFTER=-3,t.epsilon=1e-5,t}(),e.PathConstraint=n}(c||(c={})),function(t){var e,n,r,a,i;e=t.core||(t.core={}),i=function(t){this.order=0,this.bones=new Array,this.name=t},e.PathConstraintData=i,(n=e.PositionMode||(e.PositionMode={}))[n.Fixed=0]="Fixed",n[n.Percent=1]="Percent",(r=e.SpacingMode||(e.SpacingMode={}))[r.Length=0]="Length",r[r.Fixed=1]="Fixed",r[r.Percent=2]="Percent",(a=e.RotateMode||(e.RotateMode={}))[a.Tangent=0]="Tangent",a[a.Chain=1]="Chain",a[a.ChainScale=2]="ChainScale"}(c||(c={})),function(t){var e,n;e=t.core||(t.core={}),n=function(){function t(t){if(this._updateCache=new Array,this.updateCacheReset=new Array,this.time=0,this.scaleX=1,this.scaleY=1,this.x=0,this.y=0,null==t)throw new Error("data cannot be null.");this.data=t,this.bones=new Array;for(var n=0;n1){var a=n[n.length-1];this._updateCache.indexOf(a)>-1||this.updateCacheReset.push(a)}this._updateCache.push(t),this.sortReset(r.children),n[n.length-1].sorted=!0},t.prototype.sortPathConstraint=function(t){var n=t.target,r=n.data.index,a=n.bone;null!=this.skin&&this.sortPathConstraintAttachment(this.skin,r,a),null!=this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,r,a);for(var i=0,o=this.data.skins.length;i-1||this.updateCacheReset.push(a)}else for(r=0;r=this.minX&&t<=this.maxX&&e>=this.minY&&e<=this.maxY},t.prototype.aabbIntersectsSegment=function(t,e,n,r){var a=this.minX,i=this.minY,o=this.maxX,s=this.maxY;if(t<=a&&n<=a||e<=i&&r<=i||t>=o&&n>=o||e>=s&&r>=s)return!1;var l=(r-e)/(n-t),h=l*(a-t)+e;if(h>i&&hi&&ha&&ua&&ut.minX&&this.minYt.minY},t.prototype.containsPoint=function(t,e){for(var n=this.polygons,r=0,a=n.length;r=n||h=n){var u=r[s];u+(n-l)/(h-l)*(r[i]-u)=u&&x<=f||x>=f&&x<=u)&&(x>=e&&x<=r||x>=r&&x<=e)){var M=(h*v-l*m)/y;if((M>=c&&M<=d||M>=d&&M<=c)&&(M>=n&&M<=a||M>=a&&M<=n))return!0}u=f,c=d}return!1},t.prototype.getPolygon=function(t){if(null==t)throw new Error("boundingBox cannot be null.");var e=this.boundingBoxes.indexOf(t);return-1==e?null:this.polygons[e]},t.prototype.getWidth=function(){return this.maxX-this.minX},t.prototype.getHeight=function(){return this.maxY-this.minY},t}(),e.SkeletonBounds=n}(c||(c={})),function(t){var e,n;e=t.core||(t.core={}),n=function(){function t(){this.triangulator=new e.Triangulator,this.clippingPolygon=new Array,this.clipOutput=new Array,this.clippedVertices=new Array,this.clippedTriangles=new Array,this.scratch=new Array}return t.prototype.clipStart=function(n,r){if(null!=this.clipAttachment)return 0;this.clipAttachment=r;var a=r.worldVerticesLength,i=e.Utils.setArraySize(this.clippingPolygon,a);r.computeWorldVertices(n,0,a,i,0,2);var o=this.clippingPolygon;t.makeClockwise(o);for(var s=this.clippingPolygons=this.triangulator.decompose(o,this.triangulator.triangulate(o)),l=0,h=s.length;l>1,X=this.clipOutput,F=e.Utils.setArraySize(u,V+Y*d),B=0;B=2?(u=s,s=this.scratch):u=this.scratch,u.length=0,u.push(t),u.push(e),u.push(n),u.push(r),u.push(a),u.push(i),u.push(t),u.push(e),s.length=0;for(var c=o,p=o.length-4,f=0;;f+=2){for(var d=c[f],m=c[f+1],g=c[f+2],v=c[f+3],y=d-g,x=m-v,M=u,E=u.length-2,w=s.length,b=0;b0;if(y*(S-v)-x*(T-g)>0){if(P){s.push(A),s.push(R);continue}var C=((V=A-T)*(m-S)-(I=R-S)*(d-T))/(I*(g-d)-V*(v-m));s.push(d+(g-d)*C),s.push(m+(v-m)*C)}else if(P){var I,V;C=((V=A-T)*(m-S)-(I=R-S)*(d-T))/(I*(g-d)-V*(v-m)),s.push(d+(g-d)*C),s.push(m+(v-m)*C),s.push(A),s.push(R)}h=!0}if(w==s.length)return l.length=0,!0;if(s.push(s[0]),s.push(s[1]),f==p)break;var k=s;(s=u).length=0,u=k}if(l!=s){l.length=0,f=0;for(var N=s.length-2;f>1;s=0;p--)-1==j[p]&&(j[p]=G[--z])}M.setFrame(c++,W.time,j)}i.push(M),o=Math.max(o,M.frames[M.getFrameCount()-1])}if(e.events){for(M=new t.EventTimeline(e.events.length),c=0,p=0;p=r.length&&(r.length=t+1),r[t]||(r[t]={}),r[t][e]=n},t.prototype.getAttachment=function(t,e){var n=this.attachments[t];return n?n[e]:null},t.prototype.attachAll=function(t,e){for(var n=0,r=0;r= 0.");if(null==n)throw new Error("name cannot be null.");if(null==r)throw new Error("boneData cannot be null.");this.index=t,this.name=n,this.boneData=r},e.SlotData=n}(c||(c={})),function(t){!function(t){var e,n,r=function(){function t(t){this._image=t}return t.prototype.getImage=function(){return this._image},t.filterFromString=function(t){switch(t.toLowerCase()){case"nearest":return e.Nearest;case"linear":return e.Linear;case"mipmap":return e.MipMap;case"mipmapnearestnearest":return e.MipMapNearestNearest;case"mipmaplinearnearest":return e.MipMapLinearNearest;case"mipmapnearestlinear":return e.MipMapNearestLinear;case"mipmaplinearlinear":return e.MipMapLinearLinear;default:throw new Error("Unknown texture filter "+t)}},t.wrapFromString=function(t){switch(t.toLowerCase()){case"mirroredtepeat":return n.MirroredRepeat;case"clamptoedge":return n.ClampToEdge;case"repeat":return n.Repeat;default:throw new Error("Unknown texture wrap "+t)}},t}();t.Texture=r,function(t){t[t.Nearest=9728]="Nearest",t[t.Linear=9729]="Linear",t[t.MipMap=9987]="MipMap",t[t.MipMapNearestNearest=9984]="MipMapNearestNearest",t[t.MipMapLinearNearest=9985]="MipMapLinearNearest",t[t.MipMapNearestLinear=9986]="MipMapNearestLinear",t[t.MipMapLinearLinear=9987]="MipMapLinearLinear"}(e=t.TextureFilter||(t.TextureFilter={})),function(t){t[t.MirroredRepeat=33648]="MirroredRepeat",t[t.ClampToEdge=33071]="ClampToEdge",t[t.Repeat=10497]="Repeat"}(n=t.TextureWrap||(t.TextureWrap={}));var a=function(){function t(){this.size=null}return Object.defineProperty(t.prototype,"width",{get:function(){var t=this.texture;return"3"==l.VERSION[0]?t.crop.width:t.trim?t.trim.width:t.orig.width},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){var t=this.texture;return"3"==l.VERSION[0]?t.crop.height:t.trim?t.trim.height:t.orig.height},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"u",{get:function(){return this.texture._uvs.x0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"v",{get:function(){return this.texture._uvs.y0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"u2",{get:function(){return this.texture._uvs.x2},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"v2",{get:function(){return this.texture._uvs.y2},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"offsetX",{get:function(){var t=this.texture;return t.trim?t.trim.x:0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"offsetY",{get:function(){return console.warn("Deprecation Warning: @Hackerham: I guess, if you are using PIXI-SPINE ATLAS region.offsetY, you want a texture, right? Use region.texture from now on."),this.spineOffsetY},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"pixiOffsetY",{get:function(){var t=this.texture;return t.trim?t.trim.y:0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"spineOffsetY",{get:function(){var t=this.texture;return this.originalHeight-this.height-(t.trim?t.trim.y:0)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"originalWidth",{get:function(){var t=this.texture;return"3"==l.VERSION[0]?t.trim?t.trim.width:t.crop.width:t.orig.width},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"originalHeight",{get:function(){var t=this.texture;return"3"==l.VERSION[0]?t.trim?t.trim.height:t.crop.height:t.orig.height},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"x",{get:function(){return this.texture.frame.x},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"y",{get:function(){return this.texture.frame.y},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"rotate",{get:function(){return 0!==this.texture.rotate},enumerable:!0,configurable:!0}),t}();t.TextureRegion=a}(t.core||(t.core={}))}(c||(c={})),function(t){!function(t){var e=function(){function e(t,e,n){this.pages=new Array,this.regions=new Array,t&&this.addSpineAtlas(t,e,n)}return e.prototype.addTexture=function(e,n){for(var i=this.pages,o=null,s=0;s=this.lines.length?null:this.lines[this.index++]},t.prototype.readValue=function(){var t=this.readLine(),e=t.indexOf(":");if(-1==e)throw new Error("Invalid line: "+t);return t.substring(e+1).trim()},t.prototype.readTuple=function(t){var e=this.readLine(),n=e.indexOf(":");if(-1==n)throw new Error("Invalid line: "+e);for(var r=0,a=n+1;r<3;r++){var i=e.indexOf(",",a);if(-1==i)break;t[r]=e.substr(a,i-a).trim(),a=i+1}return t[r]=e.substring(a).trim(),r+1},t}(),r=function(){function e(){}return e.prototype.setFilters=function(){var e=this.baseTexture,n=this.minFilter;n==t.TextureFilter.Linear?e.scaleMode=l.SCALE_MODES.LINEAR:this.minFilter==t.TextureFilter.Nearest?e.scaleMode=l.SCALE_MODES.NEAREST:(e.mipmap=!0,n==t.TextureFilter.MipMapNearestNearest?e.scaleMode=l.SCALE_MODES.NEAREST:e.scaleMode=l.SCALE_MODES.LINEAR)},e}();t.TextureAtlasPage=r;var a=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return p(e,t),e}(t.TextureRegion);t.TextureAtlasRegion=a}(t.core||(t.core={}))}(c||(c={})),function(t){var e,n;e=t.core||(t.core={}),n=function(){function t(t,n){if(this.rotateMix=0,this.translateMix=0,this.scaleMix=0,this.shearMix=0,this.temp=new e.Vector2,null==t)throw new Error("data cannot be null.");if(null==n)throw new Error("skeleton cannot be null.");this.data=t,this.rotateMix=t.rotateMix,this.translateMix=t.translateMix,this.scaleMix=t.scaleMix,this.shearMix=t.shearMix,this.bones=new Array;for(var r=0;r0?e.MathUtils.degRad:-e.MathUtils.degRad,p=this.data.offsetRotation*c,f=this.data.offsetShearY*c,d=this.bones,m=0,g=d.length;me.MathUtils.PI?C-=e.MathUtils.PI2:C<-e.MathUtils.PI&&(C+=e.MathUtils.PI2),C*=t;var T=Math.cos(C),S=Math.sin(C);x.a=T*M-S*w,x.c=T*E-S*b,x.b=S*M+T*w,x.d=S*E+T*b,y=!0}if(0!=n){var A=this.temp;i.localToWorld(A.set(this.data.offsetX,this.data.offsetY)),x.tx+=(A.x-x.tx)*n,x.ty+=(A.y-x.ty)*n,y=!0}if(r>0){var R=Math.sqrt(x.a*x.a+x.b*x.b),P=Math.sqrt(s*s+h*h);R>1e-5&&(R=(R+(P-R+this.data.offsetScaleX)*r)/R),x.a*=R,x.b*=R,R=Math.sqrt(x.c*x.c+x.d*x.d),P=Math.sqrt(l*l+u*u),R>1e-5&&(R=(R+(P-R+this.data.offsetScaleY)*r)/R),x.c*=R,x.d*=R,y=!0}if(a>0){E=x.c,b=x.d;var C,I=Math.atan2(b,E);(C=Math.atan2(u,l)-Math.atan2(h,s)-(I-Math.atan2(x.b,x.a)))>e.MathUtils.PI?C-=e.MathUtils.PI2:C<-e.MathUtils.PI&&(C+=e.MathUtils.PI2),C=I+(C+f)*a,R=Math.sqrt(E*E+b*b),x.c=Math.cos(C)*R,x.d=Math.sin(C)*R,y=!0}y&&(v.appliedValid=!1)}},t.prototype.applyRelativeWorld=function(){for(var t=this.rotateMix,n=this.translateMix,r=this.scaleMix,a=this.shearMix,i=this.target,o=i.matrix,s=o.a,l=o.c,h=o.b,u=o.d,c=s*u-l*h>0?e.MathUtils.degRad:-e.MathUtils.degRad,p=this.data.offsetRotation*c,f=this.data.offsetShearY*c,d=this.bones,m=0,g=d.length;me.MathUtils.PI?v-=e.MathUtils.PI2:v<-e.MathUtils.PI&&(v+=e.MathUtils.PI2),v*=t;var S=Math.cos(v),A=Math.sin(v);M.a=S*E-A*b,M.c=S*w-A*T,M.b=A*E+S*b,M.d=A*w+S*T,x=!0}if(0!=n){var R=this.temp;i.localToWorld(R.set(this.data.offsetX,this.data.offsetY)),M.tx+=R.x*n,M.ty+=R.y*n,x=!0}if(r>0){var P=(Math.sqrt(s*s+h*h)-1+this.data.offsetScaleX)*r+1;M.a*=P,M.b*=P,P=(Math.sqrt(l*l+u*u)-1+this.data.offsetScaleY)*r+1,M.c*=P,M.d*=P,x=!0}a>0&&((v=Math.atan2(u,l)-Math.atan2(h,s))>e.MathUtils.PI?v-=e.MathUtils.PI2:v<-e.MathUtils.PI&&(v+=e.MathUtils.PI2),w=M.c,T=M.d,v=Math.atan2(T,w)+(v-e.MathUtils.PI/2+f)*a,P=Math.sqrt(w*w+T*T),M.c=Math.cos(v)*P,M.d=Math.sin(v)*P,x=!0),x&&(y.appliedValid=!1)}},t.prototype.applyAbsoluteLocal=function(){var t=this.rotateMix,e=this.translateMix,n=this.scaleMix,r=this.shearMix,a=this.target;a.appliedValid||a.updateAppliedTransform();for(var i=this.bones,o=0,s=i.length;o0&&(f>1e-5&&(f=(f+(a.ascaleX-f+this.data.offsetScaleX)*n)/f),d>1e-5&&(d=(d+(a.ascaleY-d+this.data.offsetScaleY)*n)/d));var m=l.ashearY;r>0&&(u=a.ashearY-m+this.data.offsetShearY,u-=360*(16384-(16384.499999999996-u/360|0)),l.shearY+=u*r),l.updateWorldTransformWith(c,p,h,f,d,l.ashearX,m)}},t.prototype.applyRelativeLocal=function(){var t=this.rotateMix,e=this.translateMix,n=this.scaleMix,r=this.shearMix,a=this.target;a.appliedValid||a.updateAppliedTransform();for(var i=this.bones,o=0,s=i.length;o0&&(p>1e-5&&(p*=(a.ascaleX-1+this.data.offsetScaleX)*n+1),f>1e-5&&(f*=(a.ascaleY-1+this.data.offsetScaleY)*n+1));var d=l.ashearY;r>0&&(d+=(a.ashearY+this.data.offsetShearY)*r),l.updateWorldTransformWith(u,c,h,p,f,l.ashearX,d)}},t.prototype.getOrder=function(){return this.data.order},t}(),e.TransformConstraint=n}(c||(c={})),function(t){var e,n;e=t.core||(t.core={}),n=function(t){if(this.order=0,this.bones=new Array,this.rotateMix=0,this.translateMix=0,this.scaleMix=0,this.shearMix=0,this.offsetRotation=0,this.offsetX=0,this.offsetY=0,this.offsetScaleX=0,this.offsetScaleY=0,this.offsetShearY=0,this.relative=!1,this.local=!1,null==t)throw new Error("name cannot be null.");this.name=t},e.TransformConstraintData=n}(c||(c={})),function(t){var e,n;e=t.core||(t.core={}),n=function(){function t(){this.convexPolygons=new Array,this.convexPolygonsIndices=new Array,this.indicesArray=new Array,this.isConcaveArray=new Array,this.triangles=new Array,this.polygonPool=new e.Pool((function(){return new Array})),this.polygonIndicesPool=new e.Pool((function(){return new Array}))}return t.prototype.triangulate=function(e){var n=e,r=e.length>>1,a=this.indicesArray;a.length=0;for(var i=0;i3;){for(var h=r-1,u=(i=0,1);;){t:if(!o[i]){for(var c=a[h]<<1,p=a[i]<<1,f=a[u]<<1,d=n[c],m=n[c+1],g=n[p],v=n[p+1],y=n[f],x=n[f+1],M=(u+1)%r;M!=h;M=(M+1)%r)if(o[M]){var E=a[M]<<1,w=n[E],b=n[E+1];if(t.positiveArea(y,x,d,m,w,b)&&t.positiveArea(d,m,g,v,w,b)&&t.positiveArea(g,v,y,x,w,b))break t}break}if(0==u){do{if(!o[i])break;i--}while(i>0);break}h=i,i=u,u=(u+1)%r}l.push(a[(r+i-1)%r]),l.push(a[i]),l.push(a[(i+1)%r]),a.splice(i,1),o.splice(i,1);var T=(--r+i-1)%r,S=i==r?0:i;o[T]=t.isConcave(T,r,n,a),o[S]=t.isConcave(S,r,n,a)}return 3==r&&(l.push(a[2]),l.push(a[0]),l.push(a[1])),l},t.prototype.decompose=function(e,n){var r=e,a=this.convexPolygons;this.polygonPool.freeAll(a),a.length=0;var i=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(i),i.length=0;var o=this.polygonIndicesPool.obtain();o.length=0;var s=this.polygonPool.obtain();s.length=0;for(var l=-1,h=0,u=0,c=n.length;u0?(a.push(s),i.push(o)):(this.polygonPool.free(s),this.polygonIndicesPool.free(o)),(s=this.polygonPool.obtain()).length=0,s.push(m),s.push(g),s.push(v),s.push(y),s.push(x),s.push(M),(o=this.polygonIndicesPool.obtain()).length=0,o.push(p),o.push(f),o.push(d),h=t.winding(m,g,v,y,x,M),l=p)}for(s.length>0&&(a.push(s),i.push(o)),u=0,c=a.length;u=0;u--)0==(s=a[u]).length&&(a.splice(u,1),this.polygonPool.free(s),o=i[u],i.splice(u,1),this.polygonIndicesPool.free(o));return a},t.isConcave=function(t,e,n,r){var a=r[(e+t-1)%e]<<1,i=r[t]<<1,o=r[(t+1)%e]<<1;return!this.positiveArea(n[a],n[a+1],n[i],n[i+1],n[o],n[o+1])},t.positiveArea=function(t,e,n,r,a,i){return t*(i-r)+n*(e-i)+a*(r-e)>=0},t.winding=function(t,e,n,r,a,i){var o=n-t,s=r-e;return a*s-i*o+o*e-t*s>=0?1:-1},t}(),e.Triangulator=n}(c||(c={})),function(t){!function(t){var e=function(){function t(){this.array=new Array}return t.prototype.add=function(t){var e=this.contains(t);return this.array[0|t]=0|t,!e},t.prototype.contains=function(t){return null!=this.array[0|t]},t.prototype.remove=function(t){this.array[0|t]=void 0},t.prototype.clear=function(){this.array.length=0},t}();t.IntSet=e;var n=function(){function t(t,e,n,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===n&&(n=0),void 0===r&&(r=0),this.r=t,this.g=e,this.b=n,this.a=r}return t.prototype.set=function(t,e,n,r){return this.r=t,this.g=e,this.b=n,this.a=r,this.clamp(),this},t.prototype.setFromColor=function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this},t.prototype.setFromString=function(t){return t="#"==t.charAt(0)?t.substr(1):t,this.r=parseInt(t.substr(0,2),16)/255,this.g=parseInt(t.substr(2,2),16)/255,this.b=parseInt(t.substr(4,2),16)/255,this.a=(8!=t.length?255:parseInt(t.substr(6,2),16))/255,this},t.prototype.add=function(t,e,n,r){return this.r+=t,this.g+=e,this.b+=n,this.a+=r,this.clamp(),this},t.prototype.clamp=function(){return this.r<0?this.r=0:this.r>1&&(this.r=1),this.g<0?this.g=0:this.g>1&&(this.g=1),this.b<0?this.b=0:this.b>1&&(this.b=1),this.a<0?this.a=0:this.a>1&&(this.a=1),this},t.WHITE=new t(1,1,1,1),t.RED=new t(1,0,0,1),t.GREEN=new t(0,1,0,1),t.BLUE=new t(0,0,1,1),t.MAGENTA=new t(1,0,1,1),t}();t.Color=n;var r=function(){function t(){}return t.clamp=function(t,e,n){return tn?n:t},t.cosDeg=function(e){return Math.cos(e*t.degRad)},t.sinDeg=function(e){return Math.sin(e*t.degRad)},t.signum=function(t){return t>0?1:t<0?-1:0},t.toInt=function(t){return t>0?Math.floor(t):Math.ceil(t)},t.cbrt=function(t){var e=Math.pow(Math.abs(t),1/3);return t<0?-e:e},t.randomTriangular=function(e,n){return t.randomTriangularWith(e,n,.5*(e+n))},t.randomTriangularWith=function(t,e,n){var r=Math.random(),a=e-t;return r<=(n-t)/a?t+Math.sqrt(r*a*(n-t)):e-Math.sqrt((1-r)*a*(e-n))},t.PI=3.1415927,t.PI2=2*t.PI,t.radiansToDegrees=180/t.PI,t.radDeg=t.radiansToDegrees,t.degreesToRadians=t.PI/180,t.degRad=t.degreesToRadians,t}();t.MathUtils=r;var a=function(){function t(){}return t.prototype.apply=function(t,e,n){return t+(e-t)*this.applyInternal(n)},t}();t.Interpolation=a;var i=function(t){function e(e){var n=t.call(this)||this;return n.power=2,n.power=e,n}return p(e,t),e.prototype.applyInternal=function(t){return t<=.5?Math.pow(2*t,this.power)/2:Math.pow(2*(t-1),this.power)/(this.power%2==0?-2:2)+1},e}(a);t.Pow=i;var o=function(t){function e(e){return t.call(this,e)||this}return p(e,t),e.prototype.applyInternal=function(t){return Math.pow(t-1,this.power)*(this.power%2==0?-1:1)+1},e}(i);t.PowOut=o;var s=function(){function t(){}return t.arrayCopy=function(t,e,n,r,a){for(var i=e,o=r;i=n?e:t.setArraySize(e,n,r)},t.newArray=function(t,e){for(var n=new Array(t),r=0;r0?this.items.pop():this.instantiator()},t.prototype.free=function(t){t.reset&&t.reset(),this.items.push(t)},t.prototype.freeAll=function(t){for(var e=0;ethis.maxDelta&&(this.delta=this.maxDelta),this.lastTime=t,this.frameCount++,this.frameTime>1&&(this.framesPerSecond=this.frameCount/this.frameTime,this.frameTime=0,this.frameCount=0)},t}();t.TimeKeeper=c;var f=function(){function t(t){void 0===t&&(t=32),this.addedValues=0,this.lastValue=0,this.mean=0,this.dirty=!0,this.values=new Array(t)}return t.prototype.hasEnoughData=function(){return this.addedValues>=this.values.length},t.prototype.addValue=function(t){this.addedValuesthis.values.length-1&&(this.lastValue=0),this.dirty=!0},t.prototype.getMean=function(){if(this.hasEnoughData()){if(this.dirty){for(var t=0,e=0;e>1)*i;var o=t.bone.skeleton,s=t.attachmentVertices,l=this.vertices,h=this.bones;if(null!=h){for(var u=0,c=0,p=0;p0&&(l=s);for(var M,E=(M=t.bone.matrix).tx,w=M.ty,b=M.a,T=M.c,S=M.b,A=M.d,R=e,P=a;Pr&&(n=r),this.state.update(n),this.state.apply(this.skeleton),this.skeleton){this.skeleton.updateWorldTransform();var a=this.skeleton.slots,o=this.color,s=null,h=null;o?(s=o.light,h=o.dark):s=this.tintRgb;for(var u=l.TransformBase&&1==this.transformHack(),c=0,p=a.length;c0&&(p=p.substr(0,f)),p=p.substr(0,p.lastIndexOf("."))+c,e.metadata&&e.metadata.spineAtlasFile&&(p=e.metadata.spineAtlasFile),p=p.replace(this.baseUrl,"");var d={crossOrigin:e.crossOrigin,xhrType:l.loaders.Resource.XHR_RESPONSE_TYPE.TEXT,metadata:i.spineMetadata||null,parentResource:e},m={crossOrigin:e.crossOrigin,metadata:i.imageMetadata||null,parentResource:e},g=e.url.substr(0,e.url.lastIndexOf("/")+1);g=g.replace(this.baseUrl,"");var v=i.imageNamePrefix||e.name+"_atlas_page_",y=i.images?r(i.images):i.image?r({default:i.image}):i.imageLoader?i.imageLoader(this,v,g,m):n(this,v,g,m),x=function(n){new t.core.TextureAtlas(n,y,(function(n){if(n){var r=new t.core.SkeletonJson(new t.core.AtlasAttachmentLoader(n));o&&(r.scale=o),e.spineData=r.readSkeletonData(e.data),e.spineAtlas=n}a()}))};e.metadata&&e.metadata.atlasRawData?x(e.metadata.atlasRawData):this.add(e.name+"_atlas",p,d,(function(t){t.error?a():x(t.data)}))}}function n(t,e,n,r){return n&&n.lastIndexOf("/")!==n.length-1&&(n+="/"),function(a,i){var o=e+a,s=n+a,l=t.resources[o];if(l){function h(){i(l.texture.baseTexture)}l.texture?h():l.onAfterMiddleware.add(h)}else t.add(o,s,r,(function(t){t.error?i(null):i(t.texture.baseTexture)}))}}function r(t){return function(e,n){var r=t[e]||t.default;r&&r.baseTexture?n(r.baseTexture):n(r)}}t.atlasParser=e,t.imageLoaderAdapter=n,t.syncImageLoaderAdapter=function(t,e){return t&&t.lastIndexOf("/")!==t.length-1&&(t+="/"),function(t,n){n(l.BaseTexture.fromImage(t,e))}},t.staticImageLoader=r,l.loaders.Loader&&(l.loaders.Loader.addPixiMiddleware(e),l.loader.use(e()))}(c||(c={}));var f=c;let d={};function m(t){const e=t.image,n=t.image.cloneNode();return t.image=n,{tex:r.Texture.from(e),count:0}}function g(t){setTimeout((()=>{const e=d[t];e&&(e.count--,e.count<=0&&(e.tex&&(e.tex.destroy(!0),e.tex=null),delete d[t]))}),100)}let v={};function y(t,e,n,r){let a=null;const i=function(t,e){let n=d[t];return n||(n=m(e),d[t]=n),n.tex}(e,n);new f.core.TextureAtlas(n.atlas,((t,e)=>{e(i.baseTexture)}),(t=>{if(t){const e=new f.core.AtlasAttachmentLoader(t),i=new f.core.SkeletonJson(e);r&&(i.scale=r),a=i.readSkeletonData(n.ske)}}));const o={spineData:a,ref:0,imgName:e};return v[t]=o,o}function x(t){return i(this,void 0,void 0,(function*(){const n=yield e.resource.getResource(t);let r=v[t];if(!r)if(n.complete)r=y(t,n.name,n.data,n.scale);else if(!r)return;return function(t,e){let n=d[t];n||(n=m(e),d[t]=n),n.count++,n.tex}(n.name,n.data),r.ref++,r.spineData}))}e.resource.registerInstance("SPINE",(t=>y(t.name,t.name,t.data,t.scale))),e.resource.registerDestroy("SPINE",(t=>{t.instance&&(g(t.name),t.instance=null)}));let M=class extends n.Renderer{constructor(){super(...arguments),this.armatures={}}init(){this.renderSystem=this.game.getSystem(n.RendererSystem),this.renderSystem.rendererManager.register(this),this.game.canvas.addEventListener("webglcontextrestored",(()=>{const t=this.game.gameObjects;let n=[];for(let r in this.armatures){const a=+r;for(let r=0;r{n.forEach((t=>{this.add(t)}))}),1e3)}),!1)}componentChanged(t){return i(this,void 0,void 0,(function*(){if("Spine"===t.componentName)if(t.type===e.OBSERVER_TYPE.ADD)this.add(t);else if(t.type===e.OBSERVER_TYPE.CHANGE)switch(t.prop.prop[0]){case"resource":this.change(t)}else t.type===e.OBSERVER_TYPE.REMOVE&&this.remove(t)}))}add(t,e){return i(this,void 0,void 0,(function*(){const n=t.component;clearTimeout(n.addHandler);const r=yield x(n.resource);if(!r)return void(n.addHandler=setTimeout((()=>{n.destroied||(void 0===e&&(e=20),--e>0?this.add(t,e):console.log("retry exceed max times",n.resource))}),1e3));this.remove(t);const a=this.renderSystem.containerManager.getContainer(t.gameObject.id);if(!a)return;const i=new f.Spine(r);if(this.armatures[t.gameObject.id]=i,t.gameObject&&t.gameObject.transform){const e=t.gameObject.transform;i.x=e.size.width*e.origin.x,i.y=e.size.height*e.origin.y}if(a.addChildAt(i,0),n.usingResource=n.resource,n.armature=i,n.autoPlay)try{i.state.setAnimation(0,n.animationName,!0)}catch(t){console.log(t)}n.emit("loaded",{resource:n.resource}),i.state.addListener({start:(t,e)=>{n.emit("start",{track:t,name:t.animation.name})},complete:(t,e)=>{n.emit("complete",{track:t,name:t.animation.name})},interrupt:(t,e)=>{n.emit("interrupt",{track:t,name:t.animation.name})},end:(t,e)=>{n.emit("end",{track:t,name:t.animation.name})},event:(t,e)=>{n.emit("event",t,e)}})}))}change(t){this.remove(t),this.add(t)}remove(t){const n=t.component;clearTimeout(n.addHandler);const r=this.armatures[t.gameObject.id],a=this.renderSystem.containerManager.getContainer(t.gameObject.id);a&&r&&a.removeChild(r),n.armature&&(n.armature.destroy({children:!0}),n.usingResource&&function(t){const n=v[t];n&&(n.ref--,n.ref<=0&&(g(n.imgName),delete v[t],e.resource.destroy(t)))}(n.usingResource)),n.armature=null,delete this.armatures[t.gameObject.id],t.type,e.OBSERVER_TYPE.CHANGE}};M.systemName="SpineSystem",M=a([e.decorators.componentObserver({Spine:["resource"]})],M);var E=M;t.Spine=o,t.SpineSystem=E,Object.defineProperty(t,"__esModule",{value:!0})},"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@eva/eva.js"),require("@eva/plugin-renderer"),require("pixi.js")):"function"==typeof define&&define.amd?define(["exports","@eva/eva.js","@eva/plugin-renderer","pixi.js"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).EVA=t.EVA||{},t.EVA.plugin=t.EVA.plugin||{},t.EVA.plugin.renderer=t.EVA.plugin.renderer||{},t.EVA.plugin.renderer.spine={}),t.EVA,t.EVA.plugin.renderer,t.PIXI); diff --git a/dist/cdn/min/EVA.plugin.renderer.spine38.min.js b/dist/cdn/min/EVA.plugin.renderer.spine38.min.js deleted file mode 100644 index 508a7df9..00000000 --- a/dist/cdn/min/EVA.plugin.renderer.spine38.min.js +++ /dev/null @@ -1 +0,0 @@ -var t,e;t=this,e=function(t,e,r,n){"use strict";function a(t,e,r,n){var a,i=arguments.length,o=i<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(a=t[s])&&(o=(i<3?a(o):i>3?a(e,r,o):a(e,r))||o);return i>3&&o&&Object.defineProperty(e,r,o),o}function i(t,e,r,n){return new(r||(r=Promise))((function(a,i){function o(t){try{l(n.next(t))}catch(t){i(t)}}function s(t){try{l(n.throw(t))}catch(t){i(t)}}function l(t){var e;t.done?a(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(o,s)}l((n=n.apply(t,e||[])).next())}))}class o extends e.Component{constructor(){super(...arguments),this.resource="",this.animationName="",this.autoPlay=!0}init(t){t&&(Object.assign(this,t),this.autoPlay&&this.play(this.animationName))}onDestroy(){this.destroied=!0}play(t,e,r){try{t&&(this.animationName=t),this.armature&&(void 0===r&&(r=0),this.armature.state.setAnimation(r,this.animationName,e))}catch(t){console.log(t)}}stop(t){this.armature&&(void 0===t&&(t=0),this.armature.state.setEmptyAnimation(t,0))}addAnimation(t,e,r,n){try{this.armature&&(void 0===n&&(n=0),this.armature.state.addAnimation(n,t,r,e))}catch(t){console.log(t)}}setMix(t,e,r){this.armature&&this.armature.stateData.setMix(t,e,r)}getAnim(t=0){try{if(this.armature)return this.armature.state.tracks[t].animation.name}catch(t){console.log(t)}}setDefaultMix(t){this.armature&&(this.armature.stateData.defaultMix=t)}setAttachment(t,e){this.armature&&this.armature.skeleton.setAttachment(t,e)}getBone(t){if(this.armature)return this.armature.skeleton.findBone(t)}}o.componentName="Spine",a([e.decorators.IDEProp],o.prototype,"resource",void 0),a([e.decorators.IDEProp],o.prototype,"animationName",void 0),a([e.decorators.IDEProp],o.prototype,"autoPlay",void 0);const s=n.loaders.shared,l={Texture:n.Texture,Rectangle:n.Rectangle,Sprite:n.Sprite,Graphics:n.Graphics,mesh:n.mesh,Matrix:n.Matrix,Container:n.Container,VERSION:"4.8.9",loaders:n.loaders,loader:s,SCALE_MODES:n.SCALE_MODES,utils:n.utils,TransformBase:n.TransformBase,TransformStatic:n.TransformStatic,DisplayObject:n.DisplayObject,Polygon:n.Polygon,BaseTexture:n.BaseTexture};var h,c,u,d=(h=function(t,e){return(h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}h(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});!function(t){!function(t){var e,r,n,a=function(){function t(t,e,r){if(null==t)throw new Error("name cannot be null.");if(null==e)throw new Error("timelines cannot be null.");this.name=t,this.timelines=e,this.timelineIds=[];for(var n=0;n0&&(e%=this.duration));for(var l=this.timelines,h=0,c=l.length;h>>1;;){if(t[(i+1)*r]<=e?n=i+1:a=i,n==a)return(n+1)*r;i=n+a>>>1}},t.linearSearch=function(t,e,r){for(var n=0,a=t.length-r;n<=a;n+=r)if(t[n]>e)return n;return-1},t}();t.Animation=a,function(t){t[t.setup=0]="setup",t[t.first=1]="first",t[t.replace=2]="replace",t[t.add=3]="add"}(e=t.MixBlend||(t.MixBlend={})),function(t){t[t.mixIn=0]="mixIn",t[t.mixOut=1]="mixOut"}(r=t.MixDirection||(t.MixDirection={})),function(t){t[t.rotate=0]="rotate",t[t.translate=1]="translate",t[t.scale=2]="scale",t[t.shear=3]="shear",t[t.attachment=4]="attachment",t[t.color=5]="color",t[t.deform=6]="deform",t[t.event=7]="event",t[t.drawOrder=8]="drawOrder",t[t.ikConstraint=9]="ikConstraint",t[t.transformConstraint=10]="transformConstraint",t[t.pathConstraintPosition=11]="pathConstraintPosition",t[t.pathConstraintSpacing=12]="pathConstraintSpacing",t[t.pathConstraintMix=13]="pathConstraintMix",t[t.twoColor=14]="twoColor"}(n=t.TimelineType||(t.TimelineType={}));var i=function(){function e(r){if(r<=0)throw new Error("frameCount must be > 0: "+r);this.curves=t.Utils.newFloatArray((r-1)*e.BEZIER_SIZE)}return e.prototype.getFrameCount=function(){return this.curves.length/e.BEZIER_SIZE+1},e.prototype.setLinear=function(t){this.curves[t*e.BEZIER_SIZE]=e.LINEAR},e.prototype.setStepped=function(t){this.curves[t*e.BEZIER_SIZE]=e.STEPPED},e.prototype.getCurveType=function(t){var r=t*e.BEZIER_SIZE;if(r==this.curves.length)return e.LINEAR;var n=this.curves[r];return n==e.LINEAR?e.LINEAR:n==e.STEPPED?e.STEPPED:e.BEZIER},e.prototype.setCurve=function(t,r,n,a,i){var o=.03*(2*-r+a),s=.03*(2*-n+i),l=.006*(3*(r-a)+1),h=.006*(3*(n-i)+1),c=2*o+l,u=2*s+h,d=.3*r+o+.16666667*l,f=.3*n+s+.16666667*h,p=t*e.BEZIER_SIZE,m=this.curves;m[p++]=e.BEZIER;for(var g=d,v=f,y=p+e.BEZIER_SIZE-1;p=n){var c=void 0,u=void 0;return i==l?(c=0,u=0):(c=a[i-2],u=a[i-1]),u+(a[i+1]-u)*(n-c)/(s-c)}var d=a[i-1];return d+(1-d)*(n-s)/(1-s)},e.LINEAR=0,e.STEPPED=1,e.BEZIER=2,e.BEZIER_SIZE=19,e}();t.CurveTimeline=i;var o=function(r){function i(e){var n=r.call(this,e)||this;return n.frames=t.Utils.newFloatArray(e<<1),n}return d(i,r),i.prototype.getPropertyId=function(){return(n.rotate<<24)+this.boneIndex},i.prototype.setFrame=function(t,e,r){t<<=1,this.frames[t]=e,this.frames[t+i.ROTATION]=r},i.prototype.apply=function(t,r,n,o,s,l,h){var c=this.frames,u=t.bones[this.boneIndex];if(u.active)if(n=c[c.length-i.ENTRIES]){var f=c[c.length+i.PREV_ROTATION];switch(l){case e.setup:u.rotation=u.data.rotation+f*s;break;case e.first:case e.replace:f+=u.data.rotation-u.rotation,f-=360*(16384-(16384.499999999996-f/360|0));case e.add:u.rotation+=f*s}}else{var p=a.binarySearch(c,n,i.ENTRIES),m=c[p+i.PREV_ROTATION],g=c[p],v=this.getCurvePercent((p>>1)-1,1-(n-g)/(c[p+i.PREV_TIME]-g)),y=c[p+i.ROTATION]-m;switch(y=m+(y-360*(16384-(16384.499999999996-y/360|0)))*v,l){case e.setup:u.rotation=u.data.rotation+(y-360*(16384-(16384.499999999996-y/360|0)))*s;break;case e.first:case e.replace:y+=u.data.rotation-u.rotation;case e.add:u.rotation+=(y-360*(16384-(16384.499999999996-y/360|0)))*s}}},i.ENTRIES=2,i.PREV_TIME=-2,i.PREV_ROTATION=-1,i.ROTATION=1,i}(i);t.RotateTimeline=o;var s=function(r){function i(e){var n=r.call(this,e)||this;return n.frames=t.Utils.newFloatArray(e*i.ENTRIES),n}return d(i,r),i.prototype.getPropertyId=function(){return(n.translate<<24)+this.boneIndex},i.prototype.setFrame=function(t,e,r,n){t*=i.ENTRIES,this.frames[t]=e,this.frames[t+i.X]=r,this.frames[t+i.Y]=n},i.prototype.apply=function(t,r,n,o,s,l,h){var c=this.frames,u=t.bones[this.boneIndex];if(u.active)if(n=c[c.length-i.ENTRIES])d=c[c.length+i.PREV_X],f=c[c.length+i.PREV_Y];else{var p=a.binarySearch(c,n,i.ENTRIES);d=c[p+i.PREV_X],f=c[p+i.PREV_Y];var m=c[p],g=this.getCurvePercent(p/i.ENTRIES-1,1-(n-m)/(c[p+i.PREV_TIME]-m));d+=(c[p+i.X]-d)*g,f+=(c[p+i.Y]-f)*g}switch(l){case e.setup:u.x=u.data.x+d*s,u.y=u.data.y+f*s;break;case e.first:case e.replace:u.x+=(u.data.x+d-u.x)*s,u.y+=(u.data.y+f-u.y)*s;break;case e.add:u.x+=d*s,u.y+=f*s}}},i.ENTRIES=3,i.PREV_TIME=-3,i.PREV_X=-2,i.PREV_Y=-1,i.X=1,i.Y=2,i}(i);t.TranslateTimeline=s;var l=function(i){function o(t){return i.call(this,t)||this}return d(o,i),o.prototype.getPropertyId=function(){return(n.scale<<24)+this.boneIndex},o.prototype.apply=function(n,i,s,l,h,c,u){var d=this.frames,f=n.bones[this.boneIndex];if(f.active)if(s=d[d.length-o.ENTRIES])p=d[d.length+o.PREV_X]*f.data.scaleX,m=d[d.length+o.PREV_Y]*f.data.scaleY;else{var g=a.binarySearch(d,s,o.ENTRIES);p=d[g+o.PREV_X],m=d[g+o.PREV_Y];var v=d[g],y=this.getCurvePercent(g/o.ENTRIES-1,1-(s-v)/(d[g+o.PREV_TIME]-v));p=(p+(d[g+o.X]-p)*y)*f.data.scaleX,m=(m+(d[g+o.Y]-m)*y)*f.data.scaleY}if(1==h)c==e.add?(f.scaleX+=p-f.data.scaleX,f.scaleY+=m-f.data.scaleY):(f.scaleX=p,f.scaleY=m);else{var x=0,M=0;if(u==r.mixOut)switch(c){case e.setup:x=f.data.scaleX,M=f.data.scaleY,f.scaleX=x+(Math.abs(p)*t.MathUtils.signum(x)-x)*h,f.scaleY=M+(Math.abs(m)*t.MathUtils.signum(M)-M)*h;break;case e.first:case e.replace:x=f.scaleX,M=f.scaleY,f.scaleX=x+(Math.abs(p)*t.MathUtils.signum(x)-x)*h,f.scaleY=M+(Math.abs(m)*t.MathUtils.signum(M)-M)*h;break;case e.add:x=f.scaleX,M=f.scaleY,f.scaleX=x+(Math.abs(p)*t.MathUtils.signum(x)-f.data.scaleX)*h,f.scaleY=M+(Math.abs(m)*t.MathUtils.signum(M)-f.data.scaleY)*h}else switch(c){case e.setup:x=Math.abs(f.data.scaleX)*t.MathUtils.signum(p),M=Math.abs(f.data.scaleY)*t.MathUtils.signum(m),f.scaleX=x+(p-x)*h,f.scaleY=M+(m-M)*h;break;case e.first:case e.replace:x=Math.abs(f.scaleX)*t.MathUtils.signum(p),M=Math.abs(f.scaleY)*t.MathUtils.signum(m),f.scaleX=x+(p-x)*h,f.scaleY=M+(m-M)*h;break;case e.add:x=t.MathUtils.signum(p),M=t.MathUtils.signum(m),f.scaleX=Math.abs(f.scaleX)*x+(p-Math.abs(f.data.scaleX)*x)*h,f.scaleY=Math.abs(f.scaleY)*M+(m-Math.abs(f.data.scaleY)*M)*h}}}},o}(s);t.ScaleTimeline=l;var h=function(t){function r(e){return t.call(this,e)||this}return d(r,t),r.prototype.getPropertyId=function(){return(n.shear<<24)+this.boneIndex},r.prototype.apply=function(t,n,i,o,s,l,h){var c=this.frames,u=t.bones[this.boneIndex];if(u.active)if(i=c[c.length-r.ENTRIES])d=c[c.length+r.PREV_X],f=c[c.length+r.PREV_Y];else{var p=a.binarySearch(c,i,r.ENTRIES);d=c[p+r.PREV_X],f=c[p+r.PREV_Y];var m=c[p],g=this.getCurvePercent(p/r.ENTRIES-1,1-(i-m)/(c[p+r.PREV_TIME]-m));d+=(c[p+r.X]-d)*g,f+=(c[p+r.Y]-f)*g}switch(l){case e.setup:u.shearX=u.data.shearX+d*s,u.shearY=u.data.shearY+f*s;break;case e.first:case e.replace:u.shearX+=(u.data.shearX+d-u.shearX)*s,u.shearY+=(u.data.shearY+f-u.shearY)*s;break;case e.add:u.shearX+=d*s,u.shearY+=f*s}}},r}(s);t.ShearTimeline=h;var c=function(r){function i(e){var n=r.call(this,e)||this;return n.frames=t.Utils.newFloatArray(e*i.ENTRIES),n}return d(i,r),i.prototype.getPropertyId=function(){return(n.color<<24)+this.slotIndex},i.prototype.setFrame=function(t,e,r,n,a,o){t*=i.ENTRIES,this.frames[t]=e,this.frames[t+i.R]=r,this.frames[t+i.G]=n,this.frames[t+i.B]=a,this.frames[t+i.A]=o},i.prototype.apply=function(t,r,n,o,s,l,h){var c=t.slots[this.slotIndex];if(c.bone.active){var u=this.frames;if(n=u[u.length-i.ENTRIES]){var y=u.length;p=u[y+i.PREV_R],m=u[y+i.PREV_G],g=u[y+i.PREV_B],v=u[y+i.PREV_A]}else{var x=a.binarySearch(u,n,i.ENTRIES);p=u[x+i.PREV_R],m=u[x+i.PREV_G],g=u[x+i.PREV_B],v=u[x+i.PREV_A];var M=u[x],w=this.getCurvePercent(x/i.ENTRIES-1,1-(n-M)/(u[x+i.PREV_TIME]-M));p+=(u[x+i.R]-p)*w,m+=(u[x+i.G]-m)*w,g+=(u[x+i.B]-g)*w,v+=(u[x+i.A]-v)*w}1==s?c.color.set(p,m,g,v):(d=c.color,l==e.setup&&d.setFromColor(c.data.color),d.add((p-d.r)*s,(m-d.g)*s,(g-d.b)*s,(v-d.a)*s))}}},i.ENTRIES=5,i.PREV_TIME=-5,i.PREV_R=-4,i.PREV_G=-3,i.PREV_B=-2,i.PREV_A=-1,i.R=1,i.G=2,i.B=3,i.A=4,i}(i);t.ColorTimeline=c;var u=function(r){function i(e){var n=r.call(this,e)||this;return n.frames=t.Utils.newFloatArray(e*i.ENTRIES),n}return d(i,r),i.prototype.getPropertyId=function(){return(n.twoColor<<24)+this.slotIndex},i.prototype.setFrame=function(t,e,r,n,a,o,s,l,h){t*=i.ENTRIES,this.frames[t]=e,this.frames[t+i.R]=r,this.frames[t+i.G]=n,this.frames[t+i.B]=a,this.frames[t+i.A]=o,this.frames[t+i.R2]=s,this.frames[t+i.G2]=l,this.frames[t+i.B2]=h},i.prototype.apply=function(t,r,n,o,s,l,h){var c=t.slots[this.slotIndex];if(c.bone.active){var u=this.frames;if(n=u[u.length-i.ENTRIES]){var T=u.length;g=u[T+i.PREV_R],v=u[T+i.PREV_G],y=u[T+i.PREV_B],x=u[T+i.PREV_A],M=u[T+i.PREV_R2],w=u[T+i.PREV_G2],E=u[T+i.PREV_B2]}else{var b=a.binarySearch(u,n,i.ENTRIES);g=u[b+i.PREV_R],v=u[b+i.PREV_G],y=u[b+i.PREV_B],x=u[b+i.PREV_A],M=u[b+i.PREV_R2],w=u[b+i.PREV_G2],E=u[b+i.PREV_B2];var S=u[b],A=this.getCurvePercent(b/i.ENTRIES-1,1-(n-S)/(u[b+i.PREV_TIME]-S));g+=(u[b+i.R]-g)*A,v+=(u[b+i.G]-v)*A,y+=(u[b+i.B]-y)*A,x+=(u[b+i.A]-x)*A,M+=(u[b+i.R2]-M)*A,w+=(u[b+i.G2]-w)*A,E+=(u[b+i.B2]-E)*A}1==s?(c.color.set(g,v,y,x),c.darkColor.set(M,w,E,1)):(d=c.color,f=c.darkColor,l==e.setup&&(d.setFromColor(c.data.color),f.setFromColor(c.data.darkColor)),d.add((g-d.r)*s,(v-d.g)*s,(y-d.b)*s,(x-d.a)*s),f.add((M-f.r)*s,(w-f.g)*s,(E-f.b)*s,0))}}},i.ENTRIES=8,i.PREV_TIME=-8,i.PREV_R=-7,i.PREV_G=-6,i.PREV_B=-5,i.PREV_A=-4,i.PREV_R2=-3,i.PREV_G2=-2,i.PREV_B2=-1,i.R=1,i.G=2,i.B=3,i.A=4,i.R2=5,i.G2=6,i.B2=7,i}(i);t.TwoColorTimeline=u;var f=function(){function i(e){this.frames=t.Utils.newFloatArray(e),this.attachmentNames=new Array(e)}return i.prototype.getPropertyId=function(){return(n.attachment<<24)+this.slotIndex},i.prototype.getFrameCount=function(){return this.frames.length},i.prototype.setFrame=function(t,e,r){this.frames[t]=e,this.attachmentNames[t]=r},i.prototype.apply=function(t,n,i,o,s,l,h){var c=t.slots[this.slotIndex];if(c.bone.active)if(h!=r.mixOut){var u=this.frames;if(i=u[u.length-1]?u.length-1:a.binarySearch(u,i,1)-1;var f=this.attachmentNames[d];t.slots[this.slotIndex].setAttachment(null==f?null:t.getAttachment(this.slotIndex,f))}}else l==e.setup&&this.setAttachment(t,c,c.data.attachmentName)},i.prototype.setAttachment=function(t,e,r){e.attachment=null==r?null:t.getAttachment(this.slotIndex,r)},i}();t.AttachmentTimeline=f;var p=null,m=function(r){function i(e){var n=r.call(this,e)||this;return n.frames=t.Utils.newFloatArray(e),n.frameVertices=new Array(e),null==p&&(p=t.Utils.newFloatArray(64)),n}return d(i,r),i.prototype.getPropertyId=function(){return(n.deform<<27)+ +this.attachment.id+this.slotIndex},i.prototype.setFrame=function(t,e,r){this.frames[t]=e,this.frameVertices[t]=r},i.prototype.apply=function(r,n,i,o,s,l,h){var c=r.slots[this.slotIndex];if(c.bone.active){var u=c.getAttachment();if(u instanceof t.VertexAttachment&&u.deformAttachment==this.attachment){var d=c.deform;0==d.length&&(l=e.setup);var f=this.frameVertices,p=f[0].length,m=this.frames;if(i=m[m.length-1]){var w=f[m.length-1];if(1==s)if(l==e.add)if(null==(g=u).bones){y=g.vertices;for(var E=0;Er)this.apply(t,e,Number.MAX_VALUE,n,i,o,s),e=-1;else if(e>=l[h-1])return;if(!(r0&&l[c-1]==u;)c--;for(;c=l[c];c++)n.push(this.events[c])}}},e}();t.EventTimeline=g;var v=function(){function i(e){this.frames=t.Utils.newFloatArray(e),this.drawOrders=new Array(e)}return i.prototype.getPropertyId=function(){return n.drawOrder<<24},i.prototype.getFrameCount=function(){return this.frames.length},i.prototype.setFrame=function(t,e,r){this.frames[t]=e,this.drawOrders[t]=r},i.prototype.apply=function(n,i,o,s,l,h,c){var u=n.drawOrder,d=n.slots;if(c!=r.mixOut||h!=e.setup){var f=this.frames;if(o=f[f.length-1]?f.length-1:a.binarySearch(f,o)-1;var m=this.drawOrders[p];if(null==m)t.Utils.arrayCopy(d,0,u,0,d.length);else for(var g=0,v=m.length;g=u[u.length-o.ENTRIES])h==e.setup?(d.mix=d.data.mix+(u[u.length+o.PREV_MIX]-d.data.mix)*l,d.softness=d.data.softness+(u[u.length+o.PREV_SOFTNESS]-d.data.softness)*l,c==r.mixOut?(d.bendDirection=d.data.bendDirection,d.compress=d.data.compress,d.stretch=d.data.stretch):(d.bendDirection=u[u.length+o.PREV_BEND_DIRECTION],d.compress=0!=u[u.length+o.PREV_COMPRESS],d.stretch=0!=u[u.length+o.PREV_STRETCH])):(d.mix+=(u[u.length+o.PREV_MIX]-d.mix)*l,d.softness+=(u[u.length+o.PREV_SOFTNESS]-d.softness)*l,c==r.mixIn&&(d.bendDirection=u[u.length+o.PREV_BEND_DIRECTION],d.compress=0!=u[u.length+o.PREV_COMPRESS],d.stretch=0!=u[u.length+o.PREV_STRETCH]));else{var f=a.binarySearch(u,i,o.ENTRIES),p=u[f+o.PREV_MIX],m=u[f+o.PREV_SOFTNESS],g=u[f],v=this.getCurvePercent(f/o.ENTRIES-1,1-(i-g)/(u[f+o.PREV_TIME]-g));h==e.setup?(d.mix=d.data.mix+(p+(u[f+o.MIX]-p)*v-d.data.mix)*l,d.softness=d.data.softness+(m+(u[f+o.SOFTNESS]-m)*v-d.data.softness)*l,c==r.mixOut?(d.bendDirection=d.data.bendDirection,d.compress=d.data.compress,d.stretch=d.data.stretch):(d.bendDirection=u[f+o.PREV_BEND_DIRECTION],d.compress=0!=u[f+o.PREV_COMPRESS],d.stretch=0!=u[f+o.PREV_STRETCH])):(d.mix+=(p+(u[f+o.MIX]-p)*v-d.mix)*l,d.softness+=(m+(u[f+o.SOFTNESS]-m)*v-d.softness)*l,c==r.mixIn&&(d.bendDirection=u[f+o.PREV_BEND_DIRECTION],d.compress=0!=u[f+o.PREV_COMPRESS],d.stretch=0!=u[f+o.PREV_STRETCH]))}},o.ENTRIES=6,o.PREV_TIME=-6,o.PREV_MIX=-5,o.PREV_SOFTNESS=-4,o.PREV_BEND_DIRECTION=-3,o.PREV_COMPRESS=-2,o.PREV_STRETCH=-1,o.MIX=1,o.SOFTNESS=2,o.BEND_DIRECTION=3,o.COMPRESS=4,o.STRETCH=5,o}(i);t.IkConstraintTimeline=y;var x=function(r){function i(e){var n=r.call(this,e)||this;return n.frames=t.Utils.newFloatArray(e*i.ENTRIES),n}return d(i,r),i.prototype.getPropertyId=function(){return(n.transformConstraint<<24)+this.transformConstraintIndex},i.prototype.setFrame=function(t,e,r,n,a,o){t*=i.ENTRIES,this.frames[t]=e,this.frames[t+i.ROTATE]=r,this.frames[t+i.TRANSLATE]=n,this.frames[t+i.SCALE]=a,this.frames[t+i.SHEAR]=o},i.prototype.apply=function(t,r,n,o,s,l,h){var c=this.frames,u=t.transformConstraints[this.transformConstraintIndex];if(u.active)if(n=c[c.length-i.ENTRIES]){var v=c.length;f=c[v+i.PREV_ROTATE],p=c[v+i.PREV_TRANSLATE],m=c[v+i.PREV_SCALE],g=c[v+i.PREV_SHEAR]}else{var y=a.binarySearch(c,n,i.ENTRIES);f=c[y+i.PREV_ROTATE],p=c[y+i.PREV_TRANSLATE],m=c[y+i.PREV_SCALE],g=c[y+i.PREV_SHEAR];var x=c[y],M=this.getCurvePercent(y/i.ENTRIES-1,1-(n-x)/(c[y+i.PREV_TIME]-x));f+=(c[y+i.ROTATE]-f)*M,p+=(c[y+i.TRANSLATE]-p)*M,m+=(c[y+i.SCALE]-m)*M,g+=(c[y+i.SHEAR]-g)*M}l==e.setup?(d=u.data,u.rotateMix=d.rotateMix+(f-d.rotateMix)*s,u.translateMix=d.translateMix+(p-d.translateMix)*s,u.scaleMix=d.scaleMix+(m-d.scaleMix)*s,u.shearMix=d.shearMix+(g-d.shearMix)*s):(u.rotateMix+=(f-u.rotateMix)*s,u.translateMix+=(p-u.translateMix)*s,u.scaleMix+=(m-u.scaleMix)*s,u.shearMix+=(g-u.shearMix)*s)}},i.ENTRIES=5,i.PREV_TIME=-5,i.PREV_ROTATE=-4,i.PREV_TRANSLATE=-3,i.PREV_SCALE=-2,i.PREV_SHEAR=-1,i.ROTATE=1,i.TRANSLATE=2,i.SCALE=3,i.SHEAR=4,i}(i);t.TransformConstraintTimeline=x;var M=function(r){function i(e){var n=r.call(this,e)||this;return n.frames=t.Utils.newFloatArray(e*i.ENTRIES),n}return d(i,r),i.prototype.getPropertyId=function(){return(n.pathConstraintPosition<<24)+this.pathConstraintIndex},i.prototype.setFrame=function(t,e,r){t*=i.ENTRIES,this.frames[t]=e,this.frames[t+i.VALUE]=r},i.prototype.apply=function(t,r,n,o,s,l,h){var c=this.frames,u=t.pathConstraints[this.pathConstraintIndex];if(u.active)if(n=c[c.length-i.ENTRIES])d=c[c.length+i.PREV_VALUE];else{var f=a.binarySearch(c,n,i.ENTRIES);d=c[f+i.PREV_VALUE];var p=c[f],m=this.getCurvePercent(f/i.ENTRIES-1,1-(n-p)/(c[f+i.PREV_TIME]-p));d+=(c[f+i.VALUE]-d)*m}l==e.setup?u.position=u.data.position+(d-u.data.position)*s:u.position+=(d-u.position)*s}},i.ENTRIES=2,i.PREV_TIME=-2,i.PREV_VALUE=-1,i.VALUE=1,i}(i);t.PathConstraintPositionTimeline=M;var w=function(t){function r(e){return t.call(this,e)||this}return d(r,t),r.prototype.getPropertyId=function(){return(n.pathConstraintSpacing<<24)+this.pathConstraintIndex},r.prototype.apply=function(t,n,i,o,s,l,h){var c=this.frames,u=t.pathConstraints[this.pathConstraintIndex];if(u.active)if(i=c[c.length-r.ENTRIES])d=c[c.length+r.PREV_VALUE];else{var f=a.binarySearch(c,i,r.ENTRIES);d=c[f+r.PREV_VALUE];var p=c[f],m=this.getCurvePercent(f/r.ENTRIES-1,1-(i-p)/(c[f+r.PREV_TIME]-p));d+=(c[f+r.VALUE]-d)*m}l==e.setup?u.spacing=u.data.spacing+(d-u.data.spacing)*s:u.spacing+=(d-u.spacing)*s}},r}(M);t.PathConstraintSpacingTimeline=w;var E=function(r){function i(e){var n=r.call(this,e)||this;return n.frames=t.Utils.newFloatArray(e*i.ENTRIES),n}return d(i,r),i.prototype.getPropertyId=function(){return(n.pathConstraintMix<<24)+this.pathConstraintIndex},i.prototype.setFrame=function(t,e,r,n){t*=i.ENTRIES,this.frames[t]=e,this.frames[t+i.ROTATE]=r,this.frames[t+i.TRANSLATE]=n},i.prototype.apply=function(t,r,n,o,s,l,h){var c=this.frames,u=t.pathConstraints[this.pathConstraintIndex];if(u.active)if(n=c[c.length-i.ENTRIES])d=c[c.length+i.PREV_ROTATE],f=c[c.length+i.PREV_TRANSLATE];else{var p=a.binarySearch(c,n,i.ENTRIES);d=c[p+i.PREV_ROTATE],f=c[p+i.PREV_TRANSLATE];var m=c[p],g=this.getCurvePercent(p/i.ENTRIES-1,1-(n-m)/(c[p+i.PREV_TIME]-m));d+=(c[p+i.ROTATE]-d)*g,f+=(c[p+i.TRANSLATE]-f)*g}l==e.setup?(u.rotateMix=u.data.rotateMix+(d-u.data.rotateMix)*s,u.translateMix=u.data.translateMix+(f-u.data.translateMix)*s):(u.rotateMix+=(d-u.rotateMix)*s,u.translateMix+=(f-u.translateMix)*s)}},i.ENTRIES=3,i.PREV_TIME=-3,i.PREV_ROTATE=-2,i.PREV_TRANSLATE=-1,i.ROTATE=1,i.TRANSLATE=2,i}(i);t.PathConstraintMixTimeline=E}(t.core||(t.core={}))}(u||(u={})),function(t){!function(t){var e=function(){function e(e){this.tracks=new Array,this.timeScale=1,this.unkeyedState=0,this.events=new Array,this.listeners=new Array,this.queue=new a(this),this.propertyIDs=new t.IntSet,this.animationsChanged=!1,this.trackEntryPool=new t.Pool((function(){return new r})),this.data=e}return e.prototype.update=function(t){t*=this.timeScale;for(var e=this.tracks,r=0,n=e.length;r0){if(a.delay-=i,a.delay>0)continue;i=-a.delay,a.delay=0}var o=a.next;if(null!=o){var s=a.trackLast-o.delay;if(s>=0){for(o.delay=0,o.trackTime+=0==a.timeScale?0:(s/a.timeScale+t)*o.timeScale,a.trackTime+=i,this.setCurrent(r,o,!0);null!=o.mixingFrom;)o.mixTime+=t,o=o.mixingFrom;continue}}else if(a.trackLast>=a.trackEnd&&null==a.mixingFrom){e[r]=null,this.queue.end(a),this.disposeNext(a);continue}if(null!=a.mixingFrom&&this.updateMixingFrom(a,t)){var l=a.mixingFrom;for(a.mixingFrom=null,null!=l&&(l.mixingTo=null);null!=l;)this.queue.end(l),l=l.mixingFrom}a.trackTime+=i}}this.queue.drain()},e.prototype.updateMixingFrom=function(t,e){var r=t.mixingFrom;if(null==r)return!0;var n=this.updateMixingFrom(r,e);return r.animationLast=r.nextAnimationLast,r.trackLast=r.nextTrackLast,t.mixTime>0&&t.mixTime>=t.mixDuration?(0!=r.totalAlpha&&0!=t.mixDuration||(t.mixingFrom=r.mixingFrom,null!=r.mixingFrom&&(r.mixingFrom.mixingTo=t),t.interruptAlpha=r.interruptAlpha,this.queue.end(r)),n):(r.trackTime+=e*r.timeScale,t.mixTime+=e,!1)},e.prototype.apply=function(r){if(null==r)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();for(var n=this.events,a=this.tracks,i=!1,o=0,s=a.length;o0)){i=!0;var h=0==o?t.MixBlend.first:l.mixBlend,c=l.alpha;null!=l.mixingFrom?c*=this.applyMixingFrom(l,r,h):l.trackTime>=l.trackEnd&&null==l.next&&(c=0);var u=l.animationLast,d=l.getAnimationTime(),f=l.animation.timelines.length,p=l.animation.timelines;if(0==o&&1==c||h==t.MixBlend.add)for(var m=0;m1&&(o=1),a!=t.MixBlend.first&&(a=i.mixBlend));var s=o0&&this.queueEvents(i,u),this.events.length=0,i.nextAnimationLast=u,i.nextTrackLast=i.trackTime,o},e.prototype.applyAttachmentTimeline=function(r,n,a,i,o){var s=n.slots[r.slotIndex];if(s.bone.active){var l,h=r.frames;a=h[h.length-1]?h.length-1:t.Animation.binarySearch(h,a)-1,this.setAttachment(n,s,r.attachmentNames[l],o)),s.attachmentState<=this.unkeyedState&&(s.attachmentState=this.unkeyedState+e.SETUP)}},e.prototype.setAttachment=function(t,r,n,a){r.attachment=null==n?null:t.getAttachment(r.data.index,n),a&&(r.attachmentState=this.unkeyedState+e.CURRENT)},e.prototype.applyRotateTimeline=function(e,r,n,a,i,o,s,l){if(l&&(o[s]=0),1!=a){var h=e,c=h.frames,u=r.bones[h.boneIndex];if(u.active){var d=0,f=0;if(n=c[c.length-t.RotateTimeline.ENTRIES])f=u.data.rotation+c[c.length+t.RotateTimeline.PREV_ROTATION];else{var p=t.Animation.binarySearch(c,n,t.RotateTimeline.ENTRIES),m=c[p+t.RotateTimeline.PREV_ROTATION],g=c[p],v=h.getCurvePercent((p>>1)-1,1-(n-g)/(c[p+t.RotateTimeline.PREV_TIME]-g));f=c[p+t.RotateTimeline.ROTATION]-m,f=m+(f-=360*(16384-(16384.499999999996-f/360|0)))*v+u.data.rotation,f-=360*(16384-(16384.499999999996-f/360|0))}var y=0,x=f-d;if(0==(x-=360*(16384-(16384.499999999996-x/360|0))))y=o[s];else{var M=0,w=0;l?(M=0,w=x):(M=o[s],w=o[s+1]);var E=x>0,T=M>=0;t.MathUtils.signum(w)!=t.MathUtils.signum(x)&&Math.abs(w)<=90&&(Math.abs(M)>180&&(M+=360*t.MathUtils.signum(M)),T=E),y=x+M-M%360,T!=E&&(y+=360*t.MathUtils.signum(M)),o[s]=y}o[s+1]=x,d+=y*a,u.rotation=d-360*(16384-(16384.499999999996-d/360|0))}}else e.apply(r,0,n,null,1,i,t.MixDirection.mixIn)},e.prototype.queueEvents=function(t,e){for(var r=t.animationStart,n=t.animationEnd,a=n-r,i=t.trackLast%a,o=this.events,s=0,l=o.length;sn||this.queue.event(t,h)}for((t.loop?0==a||i>t.trackTime%a:e>=n&&t.animationLast=this.tracks.length)){var e=this.tracks[t];if(null!=e){this.queue.end(e),this.disposeNext(e);for(var r=e;;){var n=r.mixingFrom;if(null==n)break;this.queue.end(n),r.mixingFrom=null,r.mixingTo=null,r=n}this.tracks[e.trackIndex]=null,this.queue.drain()}}},e.prototype.setCurrent=function(t,e,r){var n=this.expandToIndex(t);this.tracks[t]=e,null!=n&&(r&&this.queue.interrupt(n),e.mixingFrom=n,n.mixingTo=e,e.mixTime=0,null!=n.mixingFrom&&n.mixDuration>0&&(e.interruptAlpha*=Math.min(1,n.mixTime/n.mixDuration)),n.timelinesRotation.length=0),this.queue.start(e)},e.prototype.setAnimation=function(t,e,r){var n=this.data.skeletonData.findAnimation(e);if(null==n)throw new Error("Animation not found: "+e);return this.setAnimationWith(t,n,r)},e.prototype.setAnimationWith=function(t,e,r){if(null==e)throw new Error("animation cannot be null.");var n=!0,a=this.expandToIndex(t);null!=a&&(-1==a.nextTrackLast?(this.tracks[t]=a.mixingFrom,this.queue.interrupt(a),this.queue.end(a),this.disposeNext(a),a=a.mixingFrom,n=!1):this.disposeNext(a));var i=this.trackEntry(t,e,r,a);return this.setCurrent(t,i,n),this.queue.drain(),i},e.prototype.addAnimation=function(t,e,r,n){var a=this.data.skeletonData.findAnimation(e);if(null==a)throw new Error("Animation not found: "+e);return this.addAnimationWith(t,a,r,n)},e.prototype.addAnimationWith=function(t,e,r,n){if(null==e)throw new Error("animation cannot be null.");var a=this.expandToIndex(t);if(null!=a)for(;null!=a.next;)a=a.next;var i=this.trackEntry(t,e,r,a);if(null==a)this.setCurrent(t,i,!0),this.queue.drain();else if(a.next=i,n<=0){var o=a.animationEnd-a.animationStart;0!=o?(a.loop?n+=o*(1+(a.trackTime/o|0)):n+=Math.max(o,a.trackTime),n-=this.data.getMix(a.animation,e)):n=a.trackTime}return i.delay=n,i},e.prototype.setEmptyAnimation=function(t,r){var n=this.setAnimationWith(t,e.emptyAnimation,!1);return n.mixDuration=r,n.trackEnd=r,n},e.prototype.addEmptyAnimation=function(t,r,n){n<=0&&(n-=r);var a=this.addAnimationWith(t,e.emptyAnimation,!1,n);return a.mixDuration=r,a.trackEnd=r,a},e.prototype.setEmptyAnimations=function(t){var e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(var r=0,n=this.tracks.length;r0){o[h]=e.HOLD_MIX,s[h]=d;continue t}break}o[h]=e.HOLD_FIRST}else o[h]=e.SUBSEQUENT}},e.prototype.getCurrent=function(t){return t>=this.tracks.length?null:this.tracks[t]},e.prototype.addListener=function(t){if(null==t)throw new Error("listener cannot be null.");this.listeners.push(t)},e.prototype.removeListener=function(t){var e=this.listeners.indexOf(t);e>=0&&this.listeners.splice(e,1)},e.prototype.clearListeners=function(){this.listeners.length=0},e.prototype.clearListenerNotifications=function(){this.queue.clear()},e.prototype.setAnimationByName=function(t,r,n){e.deprecatedWarning1||(e.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: AnimationState.setAnimationByName is deprecated, please use setAnimation from now on.")),this.setAnimation(t,r,n)},e.prototype.addAnimationByName=function(t,r,n,a){e.deprecatedWarning2||(e.deprecatedWarning2=!0,console.warn("Spine Deprecation Warning: AnimationState.addAnimationByName is deprecated, please use addAnimation from now on.")),this.addAnimation(t,r,n,a)},e.prototype.hasAnimation=function(t){return null!==this.data.skeletonData.findAnimation(t)},e.prototype.hasAnimationByName=function(t){return e.deprecatedWarning3||(e.deprecatedWarning3=!0,console.warn("Spine Deprecation Warning: AnimationState.hasAnimationByName is deprecated, please use hasAnimation from now on.")),this.hasAnimation(t)},e.emptyAnimation=new t.Animation("",[],0),e.SUBSEQUENT=0,e.FIRST=1,e.HOLD_SUBSEQUENT=2,e.HOLD_FIRST=3,e.HOLD_MIX=4,e.SETUP=1,e.CURRENT=2,e.deprecatedWarning1=!1,e.deprecatedWarning2=!1,e.deprecatedWarning3=!1,e}();t.AnimationState=e;var r=function(){function e(){this.mixBlend=t.MixBlend.replace,this.timelineMode=new Array,this.timelineHoldMix=new Array,this.timelinesRotation=new Array}return e.prototype.reset=function(){this.next=null,this.mixingFrom=null,this.mixingTo=null,this.animation=null,this.listener=null,this.timelineMode.length=0,this.timelineHoldMix.length=0,this.timelinesRotation.length=0},e.prototype.getAnimationTime=function(){if(this.loop){var t=this.animationEnd-this.animationStart;return 0==t?this.animationStart:this.trackTime%t+this.animationStart}return Math.min(this.trackTime+this.animationStart,this.animationEnd)},e.prototype.setAnimationLast=function(t){this.animationLast=t,this.nextAnimationLast=t},e.prototype.isComplete=function(){return this.trackTime>=this.animationEnd-this.animationStart},e.prototype.resetRotationDirections=function(){this.timelinesRotation.length=0},Object.defineProperty(e.prototype,"time",{get:function(){return e.deprecatedWarning1||(e.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: TrackEntry.time is deprecated, please use trackTime from now on.")),this.trackTime},set:function(t){e.deprecatedWarning1||(e.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: TrackEntry.time is deprecated, please use trackTime from now on.")),this.trackTime=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"endTime",{get:function(){return e.deprecatedWarning2||(e.deprecatedWarning2=!0,console.warn("Spine Deprecation Warning: TrackEntry.endTime is deprecated, please use trackEnd from now on.")),this.trackTime},set:function(t){e.deprecatedWarning2||(e.deprecatedWarning2=!0,console.warn("Spine Deprecation Warning: TrackEntry.endTime is deprecated, please use trackEnd from now on.")),this.trackTime=t},enumerable:!1,configurable:!0}),e.prototype.loopsCount=function(){return Math.floor(this.trackTime/this.trackEnd)},e.deprecatedWarning1=!1,e.deprecatedWarning2=!1,e}();t.TrackEntry=r;var n,a=function(){function e(t){this.objects=[],this.drainDisabled=!1,this.animState=t}return e.prototype.start=function(t){this.objects.push(n.start),this.objects.push(t),this.animState.animationsChanged=!0},e.prototype.interrupt=function(t){this.objects.push(n.interrupt),this.objects.push(t)},e.prototype.end=function(t){this.objects.push(n.end),this.objects.push(t),this.animState.animationsChanged=!0},e.prototype.dispose=function(t){this.objects.push(n.dispose),this.objects.push(t)},e.prototype.complete=function(t){this.objects.push(n.complete),this.objects.push(t)},e.prototype.event=function(t,e){this.objects.push(n.event),this.objects.push(t),this.objects.push(e)},e.prototype.deprecateStuff=function(){return e.deprecatedWarning1||(e.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: onComplete, onStart, onEnd, onEvent art deprecated, please use listeners from now on. 'state.addListener({ complete: function(track, event) { } })'")),!0},e.prototype.drain=function(){if(!this.drainDisabled){this.drainDisabled=!0;for(var e=this.objects,r=this.animState.listeners,a=0;a1e-4?(A=Math.abs(m*y-g*v)/A,m/=this.skeleton.scaleX,g=(v/=this.skeleton.scaleY)*A,y=m*A,T=Math.atan2(v,m)*e.MathUtils.radDeg):(m=0,v=0,T=90-Math.atan2(y,g)*e.MathUtils.radDeg);var b=a+s-T,S=a+l-T+90;x=e.MathUtils.cosDeg(b)*i,M=e.MathUtils.cosDeg(S)*o,w=e.MathUtils.sinDeg(b)*i,E=e.MathUtils.sinDeg(S)*o,c.a=m*x-g*w,c.c=m*M-g*E,c.b=v*x+y*w,c.d=v*M+y*E;break;case e.TransformMode.NoScale:case e.TransformMode.NoScaleOrReflection:var A,I=e.MathUtils.cosDeg(a),R=e.MathUtils.sinDeg(a),C=(m*I+g*R)/u,P=(v*I+y*R)/d;(A=Math.sqrt(C*C+P*P))>1e-5&&(A=1/A),C*=A,P*=A,A=Math.sqrt(C*C+P*P),this.data.transformMode==e.TransformMode.NoScale&&m*y-g*v<0!=(t.yDown?this.skeleton.scaleX<0!=this.skeleton.scaleY>0:this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(A=-A);var k=Math.PI/2+Math.atan2(P,C),V=Math.cos(k)*A,N=Math.sin(k)*A;x=e.MathUtils.cosDeg(s)*i,M=e.MathUtils.cosDeg(90+l)*o,w=e.MathUtils.sinDeg(s)*i,E=e.MathUtils.sinDeg(90+l)*o,c.a=C*x+V*w,c.c=C*M+V*E,c.b=P*x+N*w,c.d=P*M+N*E}c.a*=u,c.c*=u,c.b*=d,c.d*=d},t.prototype.setToSetupPose=function(){var t=this.data;this.x=t.x,this.y=t.y,this.rotation=t.rotation,this.scaleX=t.scaleX,this.scaleY=t.scaleY,this.shearX=t.shearX,this.shearY=t.shearY},t.prototype.getWorldRotationX=function(){return Math.atan2(this.matrix.b,this.matrix.a)*e.MathUtils.radDeg},t.prototype.getWorldRotationY=function(){return Math.atan2(this.matrix.d,this.matrix.c)*e.MathUtils.radDeg},t.prototype.getWorldScaleX=function(){var t=this.matrix;return Math.sqrt(t.a*t.a+t.c*t.c)},t.prototype.getWorldScaleY=function(){var t=this.matrix;return Math.sqrt(t.b*t.b+t.d*t.d)},t.prototype.updateAppliedTransform=function(){this.appliedValid=!0;var t=this.parent,r=this.matrix;if(null==t)return this.ax=r.tx,this.ay=r.ty,this.arotation=Math.atan2(r.b,r.a)*e.MathUtils.radDeg,this.ascaleX=Math.sqrt(r.a*r.a+r.b*r.b),this.ascaleY=Math.sqrt(r.c*r.c+r.d*r.d),this.ashearX=0,void(this.ashearY=Math.atan2(r.a*r.c+r.b*r.d,r.a*r.d-r.b*r.c)*e.MathUtils.radDeg);var n=t.matrix,a=1/(n.a*n.d-n.b*n.c),i=r.tx-n.tx,o=r.ty-n.ty;this.ax=i*n.d*a-o*n.c*a,this.ay=o*n.a*a-i*n.b*a;var s=a*n.d,l=a*n.a,h=a*n.c,c=a*n.b,u=s*r.a-h*r.b,d=s*r.c-h*r.d,f=l*r.b-c*r.a,p=l*r.d-c*r.c;if(this.ashearX=0,this.ascaleX=Math.sqrt(u*u+f*f),this.ascaleX>1e-4){var m=u*p-d*f;this.ascaleY=m/this.ascaleX,this.ashearY=Math.atan2(u*d+f*p,m)*e.MathUtils.radDeg,this.arotation=Math.atan2(f,u)*e.MathUtils.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(d*d+p*p),this.ashearY=0,this.arotation=90-Math.atan2(p,d)*e.MathUtils.radDeg},t.prototype.worldToLocal=function(t){var e=this.matrix,r=e.a,n=e.c,a=e.b,i=e.d,o=1/(r*i-n*a),s=t.x-e.tx,l=t.y-e.ty;return t.x=s*i*o-l*n*o,t.y=l*r*o-s*a*o,t},t.prototype.localToWorld=function(t){var e=this.matrix,r=t.x,n=t.y;return t.x=r*e.a+n*e.c+e.tx,t.y=r*e.b+n*e.d+e.ty,t},t.prototype.worldToLocalRotation=function(t){var r=e.MathUtils.sinDeg(t),n=e.MathUtils.cosDeg(t),a=this.matrix;return Math.atan2(a.a*r-a.b*n,a.d*n-a.c*r)*e.MathUtils.radDeg},t.prototype.localToWorldRotation=function(t){var r=e.MathUtils.sinDeg(t),n=e.MathUtils.cosDeg(t),a=this.matrix;return Math.atan2(n*a.b+r*a.d,n*a.a+r*a.c)*e.MathUtils.radDeg},t.prototype.rotateWorld=function(t){var r=this.matrix,n=r.a,a=r.c,i=r.b,o=r.d,s=e.MathUtils.cosDeg(t),l=e.MathUtils.sinDeg(t);r.a=s*n-l*i,r.c=s*a-l*o,r.b=l*n+s*i,r.d=l*a+s*o,this.appliedValid=!1},t.yDown=!1,t}(),e.Bone=r}(u||(u={})),function(t){var e,r,n;e=t.core||(t.core={}),n=function(t,n,a){if(this.x=0,this.y=0,this.rotation=0,this.scaleX=1,this.scaleY=1,this.shearX=0,this.shearY=0,this.transformMode=r.Normal,this.skinRequired=!1,this.color=new e.Color,t<0)throw new Error("index must be >= 0.");if(null==n)throw new Error("name cannot be null.");this.index=t,this.name=n,this.parent=a},e.BoneData=n,function(t){t[t.Normal=0]="Normal",t[t.OnlyTranslation=1]="OnlyTranslation",t[t.NoRotationOrReflection=2]="NoRotationOrReflection",t[t.NoScale=3]="NoScale",t[t.NoScaleOrReflection=4]="NoScaleOrReflection"}(r=e.TransformMode||(e.TransformMode={}))}(u||(u={})),function(t){var e,r;e=t.core||(t.core={}),r=function(t,e,r){this.name=t,this.order=e,this.skinRequired=r},e.ConstraintData=r}(u||(u={})),function(t){var e,r;e=t.core||(t.core={}),r=function(t,e){if(null==e)throw new Error("data cannot be null.");this.time=t,this.data=e},e.Event=r}(u||(u={})),function(t){var e,r;e=t.core||(t.core={}),r=function(t){this.name=t},e.EventData=r}(u||(u={})),function(t){var e,r;e=t.core||(t.core={}),r=function(){function t(t,e){if(this.bendDirection=0,this.compress=!1,this.stretch=!1,this.mix=1,this.softness=0,this.active=!1,null==t)throw new Error("data cannot be null.");if(null==e)throw new Error("skeleton cannot be null.");this.data=t,this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch,this.bones=new Array;for(var r=0;r180?f-=360:f<-180&&(f+=360);var E=t.ascaleX,T=t.ascaleY;if(a||i){switch(t.data.transformMode){case e.TransformMode.NoScale:case e.TransformMode.NoScaleOrReflection:p=r-t.worldX,m=n-t.worldY}var b=t.data.length*E,S=Math.sqrt(p*p+m*m);(a&&Sb&&b>1e-4)&&(E*=g=(S/b-1)*s+1,o&&(T*=g))}t.updateWorldTransformWith(t.ax,t.ay,t.arotation+f*s,E,T,t.ashearX,t.ashearY)},t.prototype.apply2=function(t,r,n,a,i,o,s,l){if(0!=l){t.appliedValid||t.updateAppliedTransform(),r.appliedValid||r.updateAppliedTransform();var h=t.ax,c=t.ay,u=t.ascaleX,d=u,f=t.ascaleY,p=r.ascaleX,m=t.matrix,g=0,v=0,y=0;u<0?(u=-u,g=180,y=-1):(g=0,y=1),f<0&&(f=-f,y=-y),p<0?(p=-p,v=180):v=0;var x=r.ax,M=0,w=0,E=0,T=m.a,b=m.c,S=m.b,A=m.d,I=Math.abs(u-f)<=1e-4;I?(w=T*x+b*(M=r.ay)+m.tx,E=S*x+A*M+m.ty):(M=0,w=T*x+m.tx,E=S*x+m.ty);var R=t.parent.matrix;T=R.a,b=R.c,S=R.b;var C,P,k=1/(T*(A=R.d)-b*S),V=w-R.tx,N=E-R.ty,F=(V*A-N*b)*k-h,O=(N*T-V*S)*k-c,D=Math.sqrt(F*F+O*O),_=r.data.length*p;if(D<1e-4)return this.apply1(t,n,a,!1,o,!1,l),void r.updateWorldTransformWith(x,M,0,r.ascaleX,r.ascaleY,r.ashearX,r.ashearY);var U=((V=n-R.tx)*A-(N=a-R.ty)*b)*k-h,B=(N*T-V*S)*k-c,Y=U*U+B*B;if(0!=s){s*=u*(p+1)/2;var L=Math.sqrt(Y),X=L-D-_*u+s;if(X>0){var W=Math.min(1,X/(2*s))-1;Y=(U-=(W=(X-s*(1-W*W))/L)*U)*U+(B-=W*B)*B}}t:if(I){var q=(Y-D*D-(_*=u)*_)/(2*D*_);q<-1?q=-1:q>1&&(q=1,o&&(d*=(Math.sqrt(Y)/(D+_)-1)*l+1)),P=Math.acos(q)*i,T=D+_*q,b=_*Math.sin(P),C=Math.atan2(B*T-U*b,U*T+B*b)}else{var j=(T=u*_)*T,H=(b=f*_)*b,G=Math.atan2(B,U),z=-2*H*D,Z=H-j;if((A=z*z-4*Z*(S=H*D*D+j*Y-j*H))>=0){var Q=Math.sqrt(A);z<0&&(Q=-Q);var J=(Q=-(z+Q)/2)/Z,K=S/Q,$=Math.abs(J)=-1&&S<=1&&(S=Math.acos(S),(A=(V=T*Math.cos(S)+D)*V+(N=b*Math.sin(S))*N)ot&&(at=S,ot=A,it=V,st=N)),Y<=(rt+ot)/2?(C=G-Math.atan2(nt*i,et),P=tt*i):(C=G-Math.atan2(st*i,it),P=at*i)}var lt=Math.atan2(M,x)*y,ht=t.arotation;(C=(C-lt)*e.MathUtils.radDeg+g-ht)>180?C-=360:C<-180&&(C+=360),t.updateWorldTransformWith(h,c,ht+C*l,d,t.ascaleY,0,0),ht=r.arotation,(P=((P+lt)*e.MathUtils.radDeg-r.ashearX)*y+v-ht)>180?P-=360:P<-180&&(P+=360),r.updateWorldTransformWith(x,M,ht+P*l,r.ascaleX,r.ascaleY,r.ashearX,r.ashearY)}else r.updateWorldTransform()},t}(),e.IkConstraint=r}(u||(u={})),function(t){var e,r;e=t.core||(t.core={}),r=function(t){function e(e){var r=t.call(this,e,0,!1)||this;return r.bones=new Array,r.bendDirection=1,r.compress=!1,r.stretch=!1,r.uniform=!1,r.mix=1,r.softness=0,r}return d(e,t),e}(e.ConstraintData),e.IkConstraintData=r}(u||(u={})),function(t){var e,r;e=t.core||(t.core={}),r=function(){function t(t,e){if(this.position=0,this.spacing=0,this.rotateMix=0,this.translateMix=0,this.spaces=new Array,this.positions=new Array,this.world=new Array,this.curves=new Array,this.lengths=new Array,this.segments=new Array,this.active=!1,null==t)throw new Error("data cannot be null.");if(null==e)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(var r=0,n=t.bones.length;r0;if(a>0||i){var o=this.data,s=o.spacingMode,l=s==e.SpacingMode.Length,h=o.rotateMode,c=h==e.RotateMode.Tangent,u=h==e.RotateMode.ChainScale,d=this.bones.length,f=c?d:d+1,p=this.bones,m=e.Utils.setArraySize(this.spaces,f),g=null,v=this.spacing;if(u||l){u&&(g=e.Utils.setArraySize(this.lengths,d));for(var y=0,x=f-1;y0?e.MathUtils.degRad:-e.MathUtils.degRad),y=0;for(var C=3;ye.MathUtils.PI?Y-=e.MathUtils.PI2:Y<-e.MathUtils.PI&&(Y+=e.MathUtils.PI2),Y*=n,L=Math.cos(Y),X=Math.sin(Y),k.a=L*D-X*U,k.c=L*_-X*B,k.b=X*D+L*U,k.d=X*_+L*B}P.appliedValid=!1}}}},t.prototype.computeWorldPositions=function(r,n,a,i,o){var s=this.target,l=this.position,h=this.spaces,c=e.Utils.setArraySize(this.positions,3*n+2),u=null,d=r.closed,f=r.worldVerticesLength,p=f/6,m=t.NONE;if(!r.constantSpeed){var g=r.lengths,v=g[p-=d?1:2];if(i&&(l*=v),o)for(var y=0;yv){m!=t.AFTER&&(m=t.AFTER,r.computeWorldVertices(s,f-6,4,u,0,2)),this.addAfterPosition(w-v,u,0,c,x);continue}}for(;;M++){var E=g[M];if(!(w>E)){0==M?w/=E:w=(w-(Z=g[M-1]))/(E-Z);break}}M!=m&&(m=M,d&&M==p?(r.computeWorldVertices(s,f-4,4,u,0,2),r.computeWorldVertices(s,0,4,u,4,2)):r.computeWorldVertices(s,6*M+2,8,u,0,2)),this.addCurvePosition(w,u[0],u[1],u[2],u[3],u[4],u[5],u[6],u[7],c,x,a||y>0&&0==j)}return c}d?(f+=2,u=e.Utils.setArraySize(this.world,f),r.computeWorldVertices(s,2,f-4,u,0,2),r.computeWorldVertices(s,0,2,u,f-4,2),u[f-2]=u[0],u[f-1]=u[1]):(p--,f-=4,u=e.Utils.setArraySize(this.world,f),r.computeWorldVertices(s,2,f,u,0,2));for(var T=e.Utils.setArraySize(this.curves,p),b=0,S=u[0],A=u[1],I=0,R=0,C=0,P=0,k=0,V=0,N=0,F=0,O=0,D=0,_=0,U=0,B=0,Y=0,L=(y=0,2);yb){this.addAfterPosition(w-b,u,f-4,c,x);continue}}for(;;M++){var H=T[M];if(!(w>H)){0==M?w/=H:w=(w-(Z=T[M-1]))/(H-Z);break}}if(M!=m){m=M;var G=6*M;for(S=u[G],A=u[G+1],I=u[G+2],R=u[G+3],C=u[G+4],P=u[G+5],_=2*(N=.03*(S-2*I+C))+(O=.006*(3*(I-C)-S+(k=u[G+6]))),U=2*(F=.03*(A-2*R+P))+(D=.006*(3*(R-P)-A+(V=u[G+7]))),B=.3*(I-S)+N+.16666667*O,Y=.3*(R-A)+F+.16666667*D,W=Math.sqrt(B*B+Y*Y),X[0]=W,G=1;G<8;G++)B+=_,Y+=U,_+=O,U+=D,W+=Math.sqrt(B*B+Y*Y),X[G]=W;B+=_,Y+=U,W+=Math.sqrt(B*B+Y*Y),X[8]=W,B+=_+O,Y+=U+D,W+=Math.sqrt(B*B+Y*Y),X[9]=W,q=0}for(w*=W;;q++){var z=X[q];if(!(w>z)){var Z;0==q?w/=z:w=q+(w-(Z=X[q-1]))/(z-Z);break}}this.addCurvePosition(.1*w,S,A,I,R,C,P,k,V,c,x,a||y>0&&0==j)}return c},t.prototype.addBeforePosition=function(t,e,r,n,a){var i=e[r],o=e[r+1],s=e[r+2]-i,l=e[r+3]-o,h=Math.atan2(l,s);n[a]=i+t*Math.cos(h),n[a+1]=o+t*Math.sin(h),n[a+2]=h},t.prototype.addAfterPosition=function(t,e,r,n,a){var i=e[r+2],o=e[r+3],s=i-e[r],l=o-e[r+1],h=Math.atan2(l,s);n[a]=i+t*Math.cos(h),n[a+1]=o+t*Math.sin(h),n[a+2]=h},t.prototype.addCurvePosition=function(t,e,r,n,a,i,o,s,l,h,c,u){(0==t||isNaN(t))&&(t=1e-4);var d=t*t,f=d*t,p=1-t,m=p*p,g=m*p,v=p*t,y=3*v,x=p*y,M=y*t,w=e*g+n*x+i*M+s*f,E=r*g+a*x+o*M+l*f;h[c]=w,h[c+1]=E,u&&(h[c+2]=Math.atan2(E-(r*m+a*v*2+o*d),w-(e*m+n*v*2+i*d)))},t.NONE=-1,t.BEFORE=-2,t.AFTER=-3,t.epsilon=1e-5,t}(),e.PathConstraint=r}(u||(u={})),function(t){var e,r,n,a,i;e=t.core||(t.core={}),i=function(t){function e(e){var r=t.call(this,e,0,!1)||this;return r.bones=new Array,r}return d(e,t),e}(e.ConstraintData),e.PathConstraintData=i,(r=e.PositionMode||(e.PositionMode={}))[r.Fixed=0]="Fixed",r[r.Percent=1]="Percent",(n=e.SpacingMode||(e.SpacingMode={}))[n.Length=0]="Length",n[n.Fixed=1]="Fixed",n[n.Percent=2]="Percent",(a=e.RotateMode||(e.RotateMode={}))[a.Tangent=0]="Tangent",a[a.Chain=1]="Chain",a[a.ChainScale=2]="ChainScale"}(u||(u={})),function(t){var e,r;e=t.core||(t.core={}),r=function(){function t(t){if(this._updateCache=new Array,this.updateCacheReset=new Array,this.time=0,this.scaleX=1,this.scaleY=1,this.x=0,this.y=0,null==t)throw new Error("data cannot be null.");this.data=t,this.bones=new Array;for(var r=0;r1){var i=n[n.length-1];this._updateCache.indexOf(i)>-1||this.updateCacheReset.push(i)}this._updateCache.push(t),this.sortReset(a.children),n[n.length-1].sorted=!0}},t.prototype.sortPathConstraint=function(t){if(t.active=t.target.bone.isActive()&&(!t.data.skinRequired||null!=this.skin&&e.Utils.contains(this.skin.constraints,t.data,!0)),t.active){var r=t.target,n=r.data.index,a=r.bone;null!=this.skin&&this.sortPathConstraintAttachment(this.skin,n,a),null!=this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,n,a);for(var i=0,o=this.data.skins.length;i-1||this.updateCacheReset.push(i)}else for(a=0;a0){M=new t.DrawOrderTimeline(D);var _=a.slots.length;for(c=0;c=0;f--)B[f]=-1;var Y=t.Utils.newArray(_-U,0),L=0,X=0;for(f=0;f=0;f--)-1==B[f]&&(B[f]=Y[--X]);M.setFrame(c,y,B)}i.push(M),s=Math.max(s,M.frames[D-1])}var W=r.readInt(!0);if(W>0){for(M=new t.EventTimeline(W),c=0;c>>1^-(1&r)},t.prototype.readStringRef=function(){var t=this.readInt(!0);return 0==t?null:this.strings[t-1]},t.prototype.readString=function(){var t=this.readInt(!0);switch(t){case 0:return null;case 1:return""}t--;for(var e="",r=0;r>4){case 12:case 13:e+=String.fromCharCode((31&n)<<6|63&this.readByte()),r+=2;break;case 14:e+=String.fromCharCode((15&n)<<12|(63&this.readByte())<<6|63&this.readByte()),r+=3;break;default:e+=String.fromCharCode(n),r++}}return e},t.prototype.readFloat=function(){var t=this.buffer.getFloat32(this.index);return this.index+=4,t},t.prototype.readBoolean=function(){return 0!=this.readByte()},t}(),n=function(t,e,r,n,a){this.mesh=t,this.skin=e,this.slotIndex=r,this.parent=n,this.inheritDeform=a},a=function(t,e){void 0===t&&(t=null),void 0===e&&(e=null),this.bones=t,this.vertices=e}}(t.core||(t.core={}))}(u||(u={})),function(t){var e,r;e=t.core||(t.core={}),r=function(){function t(){this.minX=0,this.minY=0,this.maxX=0,this.maxY=0,this.boundingBoxes=new Array,this.polygons=new Array,this.polygonPool=new e.Pool((function(){return e.Utils.newFloatArray(16)}))}return t.prototype.update=function(t,r){if(null==t)throw new Error("skeleton cannot be null.");var n=this.boundingBoxes,a=this.polygons,i=this.polygonPool,o=t.slots,s=o.length;n.length=0,i.freeAll(a),a.length=0;for(var l=0;l=this.minX&&t<=this.maxX&&e>=this.minY&&e<=this.maxY},t.prototype.aabbIntersectsSegment=function(t,e,r,n){var a=this.minX,i=this.minY,o=this.maxX,s=this.maxY;if(t<=a&&r<=a||e<=i&&n<=i||t>=o&&r>=o||e>=s&&n>=s)return!1;var l=(n-e)/(r-t),h=l*(a-t)+e;if(h>i&&hi&&ha&&ca&&ct.minX&&this.minYt.minY},t.prototype.containsPoint=function(t,e){for(var r=this.polygons,n=0,a=r.length;n=r||h=r){var c=n[s];c+(r-l)/(h-l)*(n[i]-c)=c&&x<=f||x>=f&&x<=c)&&(x>=e&&x<=n||x>=n&&x<=e)){var M=(h*v-l*m)/y;if((M>=u&&M<=p||M>=p&&M<=u)&&(M>=r&&M<=a||M>=a&&M<=r))return!0}c=f,u=p}return!1},t.prototype.getPolygon=function(t){if(null==t)throw new Error("boundingBox cannot be null.");var e=this.boundingBoxes.indexOf(t);return-1==e?null:this.polygons[e]},t.prototype.getWidth=function(){return this.maxX-this.minX},t.prototype.getHeight=function(){return this.maxY-this.minY},t}(),e.SkeletonBounds=r}(u||(u={})),function(t){var e,r;e=t.core||(t.core={}),r=function(){function t(){this.triangulator=new e.Triangulator,this.clippingPolygon=new Array,this.clipOutput=new Array,this.clippedVertices=new Array,this.clippedTriangles=new Array,this.scratch=new Array}return t.prototype.clipStart=function(r,n){if(null!=this.clipAttachment)return 0;this.clipAttachment=n;var a=n.worldVerticesLength,i=e.Utils.setArraySize(this.clippingPolygon,a);n.computeWorldVertices(r,0,a,i,0,2);var o=this.clippingPolygon;t.makeClockwise(o);for(var s=this.clippingPolygons=this.triangulator.decompose(o,this.triangulator.triangulate(o)),l=0,h=s.length;l>1,B=this.clipOutput,Y=e.Utils.setArraySize(c,k+U*p),L=0;L=2?(c=s,s=this.scratch):c=this.scratch,c.length=0,c.push(t),c.push(e),c.push(r),c.push(n),c.push(a),c.push(i),c.push(t),c.push(e),s.length=0;for(var u=o,d=o.length-4,f=0;;f+=2){for(var p=u[f],m=u[f+1],g=u[f+2],v=u[f+3],y=p-g,x=m-v,M=c,w=c.length-2,E=s.length,T=0;T0;if(y*(S-v)-x*(b-g)>0){if(R){s.push(A),s.push(I);continue}var C=((k=A-b)*(m-S)-(P=I-S)*(p-b))/(P*(g-p)-k*(v-m));s.push(p+(g-p)*C),s.push(m+(v-m)*C)}else if(R){var P,k;C=((k=A-b)*(m-S)-(P=I-S)*(p-b))/(P*(g-p)-k*(v-m)),s.push(p+(g-p)*C),s.push(m+(v-m)*C),s.push(A),s.push(I)}h=!0}if(E==s.length)return l.length=0,!0;if(s.push(s[0]),s.push(s[1]),f==d)break;var V=s;(s=c).length=0,c=V}if(l!=s){l.length=0,f=0;for(var N=s.length-2;f>1;s=0;d--)-1==j[d]&&(j[d]=G[--Z])}M.setFrame(u++,this.getValue(q,"time",0),j)}i.push(M),o=Math.max(o,M.frames[M.getFrameCount()-1])}if(e.events){for(M=new t.EventTimeline(e.events.length),u=0,d=0;d=n.length&&(n.length=t+1),n[t]||(n[t]={}),n[t][e]=r},r.prototype.addSkin=function(t){for(var e=0;e= 0.");if(null==r)throw new Error("name cannot be null.");if(null==n)throw new Error("boneData cannot be null.");this.index=t,this.name=r,this.boneData=n},e.SlotData=r}(u||(u={})),function(t){!function(t){var e,r,n=function(){function t(t){this._image=t}return t.prototype.getImage=function(){return this._image},t.filterFromString=function(t){switch(t.toLowerCase()){case"nearest":return e.Nearest;case"linear":return e.Linear;case"mipmap":return e.MipMap;case"mipmapnearestnearest":return e.MipMapNearestNearest;case"mipmaplinearnearest":return e.MipMapLinearNearest;case"mipmapnearestlinear":return e.MipMapNearestLinear;case"mipmaplinearlinear":return e.MipMapLinearLinear;default:throw new Error("Unknown texture filter "+t)}},t.wrapFromString=function(t){switch(t.toLowerCase()){case"mirroredtepeat":return r.MirroredRepeat;case"clamptoedge":return r.ClampToEdge;case"repeat":return r.Repeat;default:throw new Error("Unknown texture wrap "+t)}},t}();t.Texture=n,function(t){t[t.Nearest=9728]="Nearest",t[t.Linear=9729]="Linear",t[t.MipMap=9987]="MipMap",t[t.MipMapNearestNearest=9984]="MipMapNearestNearest",t[t.MipMapLinearNearest=9985]="MipMapLinearNearest",t[t.MipMapNearestLinear=9986]="MipMapNearestLinear",t[t.MipMapLinearLinear=9987]="MipMapLinearLinear"}(e=t.TextureFilter||(t.TextureFilter={})),function(t){t[t.MirroredRepeat=33648]="MirroredRepeat",t[t.ClampToEdge=33071]="ClampToEdge",t[t.Repeat=10497]="Repeat"}(r=t.TextureWrap||(t.TextureWrap={}));var a=function(){function t(){this.size=null}return Object.defineProperty(t.prototype,"width",{get:function(){var t=this.texture;return"3"==l.VERSION[0]?t.crop.width:t.trim?t.trim.width:t.orig.width},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){var t=this.texture;return"3"==l.VERSION[0]?t.crop.height:t.trim?t.trim.height:t.orig.height},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"u",{get:function(){return this.texture._uvs.x0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"v",{get:function(){return this.texture._uvs.y0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"u2",{get:function(){return this.texture._uvs.x2},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"v2",{get:function(){return this.texture._uvs.y2},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"offsetX",{get:function(){var t=this.texture;return t.trim?t.trim.x:0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"offsetY",{get:function(){return console.warn("Deprecation Warning: @Hackerham: I guess, if you are using PIXI-SPINE ATLAS region.offsetY, you want a texture, right? Use region.texture from now on."),this.spineOffsetY},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pixiOffsetY",{get:function(){var t=this.texture;return t.trim?t.trim.y:0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"spineOffsetY",{get:function(){var t=this.texture;return this.originalHeight-this.height-(t.trim?t.trim.y:0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"originalWidth",{get:function(){var t=this.texture;return"3"==l.VERSION[0]?t.trim?t.trim.width:t.crop.width:t.orig.width},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"originalHeight",{get:function(){var t=this.texture;return"3"==l.VERSION[0]?t.trim?t.trim.height:t.crop.height:t.orig.height},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"x",{get:function(){return this.texture.frame.x},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"y",{get:function(){return this.texture.frame.y},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rotate",{get:function(){return 0!==this.texture.rotate},enumerable:!1,configurable:!0}),t}();t.TextureRegion=a}(t.core||(t.core={}))}(u||(u={})),function(t){!function(t){var e=function(){function e(t,e,r){this.pages=new Array,this.regions=new Array,t&&this.addSpineAtlas(t,e,r)}return e.prototype.addTexture=function(e,r){for(var i=this.pages,o=null,s=0;s=this.lines.length?null:this.lines[this.index++]},t.prototype.readValue=function(){var t=this.readLine(),e=t.indexOf(":");if(-1==e)throw new Error("Invalid line: "+t);return t.substring(e+1).trim()},t.prototype.readTuple=function(t){var e=this.readLine(),r=e.indexOf(":");if(-1==r)throw new Error("Invalid line: "+e);for(var n=0,a=r+1;n<3;n++){var i=e.indexOf(",",a);if(-1==i)break;t[n]=e.substr(a,i-a).trim(),a=i+1}return t[n]=e.substring(a).trim(),n+1},t}(),n=function(){function e(){}return e.prototype.setFilters=function(){var e=this.baseTexture,r=this.minFilter;r==t.TextureFilter.Linear?e.scaleMode=l.SCALE_MODES.LINEAR:this.minFilter==t.TextureFilter.Nearest?e.scaleMode=l.SCALE_MODES.NEAREST:(e.mipmap=!0,r==t.TextureFilter.MipMapNearestNearest?e.scaleMode=l.SCALE_MODES.NEAREST:e.scaleMode=l.SCALE_MODES.LINEAR)},e}();t.TextureAtlasPage=n;var a=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return d(e,t),e}(t.TextureRegion);t.TextureAtlasRegion=a}(t.core||(t.core={}))}(u||(u={})),function(t){var e,r;e=t.core||(t.core={}),r=function(){function t(t,r){if(this.rotateMix=0,this.translateMix=0,this.scaleMix=0,this.shearMix=0,this.temp=new e.Vector2,this.active=!1,null==t)throw new Error("data cannot be null.");if(null==r)throw new Error("skeleton cannot be null.");this.data=t,this.rotateMix=t.rotateMix,this.translateMix=t.translateMix,this.scaleMix=t.scaleMix,this.shearMix=t.shearMix,this.bones=new Array;for(var n=0;n0?e.MathUtils.degRad:-e.MathUtils.degRad,d=this.data.offsetRotation*u,f=this.data.offsetShearY*u,p=this.bones,m=0,g=p.length;me.MathUtils.PI?C-=e.MathUtils.PI2:C<-e.MathUtils.PI&&(C+=e.MathUtils.PI2),C*=t;var b=Math.cos(C),S=Math.sin(C);x.a=b*M-S*E,x.c=b*w-S*T,x.b=S*M+b*E,x.d=S*w+b*T,y=!0}if(0!=r){var A=this.temp;i.localToWorld(A.set(this.data.offsetX,this.data.offsetY)),x.tx+=(A.x-x.tx)*r,x.ty+=(A.y-x.ty)*r,y=!0}if(n>0){var I=Math.sqrt(x.a*x.a+x.b*x.b),R=Math.sqrt(s*s+h*h);I>1e-5&&(I=(I+(R-I+this.data.offsetScaleX)*n)/I),x.a*=I,x.b*=I,I=Math.sqrt(x.c*x.c+x.d*x.d),R=Math.sqrt(l*l+c*c),I>1e-5&&(I=(I+(R-I+this.data.offsetScaleY)*n)/I),x.c*=I,x.d*=I,y=!0}if(a>0){w=x.c,T=x.d;var C,P=Math.atan2(T,w);(C=Math.atan2(c,l)-Math.atan2(h,s)-(P-Math.atan2(x.b,x.a)))>e.MathUtils.PI?C-=e.MathUtils.PI2:C<-e.MathUtils.PI&&(C+=e.MathUtils.PI2),C=P+(C+f)*a,I=Math.sqrt(w*w+T*T),x.c=Math.cos(C)*I,x.d=Math.sin(C)*I,y=!0}y&&(v.appliedValid=!1)}},t.prototype.applyRelativeWorld=function(){for(var t=this.rotateMix,r=this.translateMix,n=this.scaleMix,a=this.shearMix,i=this.target,o=i.matrix,s=o.a,l=o.c,h=o.b,c=o.d,u=s*c-l*h>0?e.MathUtils.degRad:-e.MathUtils.degRad,d=this.data.offsetRotation*u,f=this.data.offsetShearY*u,p=this.bones,m=0,g=p.length;me.MathUtils.PI?v-=e.MathUtils.PI2:v<-e.MathUtils.PI&&(v+=e.MathUtils.PI2),v*=t;var S=Math.cos(v),A=Math.sin(v);M.a=S*w-A*T,M.c=S*E-A*b,M.b=A*w+S*T,M.d=A*E+S*b,x=!0}if(0!=r){var I=this.temp;i.localToWorld(I.set(this.data.offsetX,this.data.offsetY)),M.tx+=I.x*r,M.ty+=I.y*r,x=!0}if(n>0){var R=(Math.sqrt(s*s+h*h)-1+this.data.offsetScaleX)*n+1;M.a*=R,M.b*=R,R=(Math.sqrt(l*l+c*c)-1+this.data.offsetScaleY)*n+1,M.c*=R,M.d*=R,x=!0}a>0&&((v=Math.atan2(c,l)-Math.atan2(h,s))>e.MathUtils.PI?v-=e.MathUtils.PI2:v<-e.MathUtils.PI&&(v+=e.MathUtils.PI2),E=M.c,b=M.d,v=Math.atan2(b,E)+(v-e.MathUtils.PI/2+f)*a,R=Math.sqrt(E*E+b*b),M.c=Math.cos(v)*R,M.d=Math.sin(v)*R,x=!0),x&&(y.appliedValid=!1)}},t.prototype.applyAbsoluteLocal=function(){var t=this.rotateMix,e=this.translateMix,r=this.scaleMix,n=this.shearMix,a=this.target;a.appliedValid||a.updateAppliedTransform();for(var i=this.bones,o=0,s=i.length;o0&&(f>1e-5&&(f=(f+(a.ascaleX-f+this.data.offsetScaleX)*r)/f),p>1e-5&&(p=(p+(a.ascaleY-p+this.data.offsetScaleY)*r)/p));var m=l.ashearY;n>0&&(c=a.ashearY-m+this.data.offsetShearY,c-=360*(16384-(16384.499999999996-c/360|0)),l.shearY+=c*n),l.updateWorldTransformWith(u,d,h,f,p,l.ashearX,m)}},t.prototype.applyRelativeLocal=function(){var t=this.rotateMix,e=this.translateMix,r=this.scaleMix,n=this.shearMix,a=this.target;a.appliedValid||a.updateAppliedTransform();for(var i=this.bones,o=0,s=i.length;o0&&(d>1e-5&&(d*=(a.ascaleX-1+this.data.offsetScaleX)*r+1),f>1e-5&&(f*=(a.ascaleY-1+this.data.offsetScaleY)*r+1));var p=l.ashearY;n>0&&(p+=(a.ashearY+this.data.offsetShearY)*n),l.updateWorldTransformWith(c,u,h,d,f,l.ashearX,p)}},t}(),e.TransformConstraint=r}(u||(u={})),function(t){var e,r;e=t.core||(t.core={}),r=function(t){function e(e){var r=t.call(this,e,0,!1)||this;return r.bones=new Array,r.rotateMix=0,r.translateMix=0,r.scaleMix=0,r.shearMix=0,r.offsetRotation=0,r.offsetX=0,r.offsetY=0,r.offsetScaleX=0,r.offsetScaleY=0,r.offsetShearY=0,r.relative=!1,r.local=!1,r}return d(e,t),e}(e.ConstraintData),e.TransformConstraintData=r}(u||(u={})),function(t){var e,r;e=t.core||(t.core={}),r=function(){function t(){this.convexPolygons=new Array,this.convexPolygonsIndices=new Array,this.indicesArray=new Array,this.isConcaveArray=new Array,this.triangles=new Array,this.polygonPool=new e.Pool((function(){return new Array})),this.polygonIndicesPool=new e.Pool((function(){return new Array}))}return t.prototype.triangulate=function(e){var r=e,n=e.length>>1,a=this.indicesArray;a.length=0;for(var i=0;i3;){for(var h=n-1,c=(i=0,1);;){t:if(!o[i]){for(var u=a[h]<<1,d=a[i]<<1,f=a[c]<<1,p=r[u],m=r[u+1],g=r[d],v=r[d+1],y=r[f],x=r[f+1],M=(c+1)%n;M!=h;M=(M+1)%n)if(o[M]){var w=a[M]<<1,E=r[w],T=r[w+1];if(t.positiveArea(y,x,p,m,E,T)&&t.positiveArea(p,m,g,v,E,T)&&t.positiveArea(g,v,y,x,E,T))break t}break}if(0==c){do{if(!o[i])break;i--}while(i>0);break}h=i,i=c,c=(c+1)%n}l.push(a[(n+i-1)%n]),l.push(a[i]),l.push(a[(i+1)%n]),a.splice(i,1),o.splice(i,1);var b=(--n+i-1)%n,S=i==n?0:i;o[b]=t.isConcave(b,n,r,a),o[S]=t.isConcave(S,n,r,a)}return 3==n&&(l.push(a[2]),l.push(a[0]),l.push(a[1])),l},t.prototype.decompose=function(e,r){var n=e,a=this.convexPolygons;this.polygonPool.freeAll(a),a.length=0;var i=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(i),i.length=0;var o=this.polygonIndicesPool.obtain();o.length=0;var s=this.polygonPool.obtain();s.length=0;for(var l=-1,h=0,c=0,u=r.length;c0?(a.push(s),i.push(o)):(this.polygonPool.free(s),this.polygonIndicesPool.free(o)),(s=this.polygonPool.obtain()).length=0,s.push(m),s.push(g),s.push(v),s.push(y),s.push(x),s.push(M),(o=this.polygonIndicesPool.obtain()).length=0,o.push(d),o.push(f),o.push(p),h=t.winding(m,g,v,y,x,M),l=d)}for(s.length>0&&(a.push(s),i.push(o)),c=0,u=a.length;c=0;c--)0==(s=a[c]).length&&(a.splice(c,1),this.polygonPool.free(s),o=i[c],i.splice(c,1),this.polygonIndicesPool.free(o));return a},t.isConcave=function(t,e,r,n){var a=n[(e+t-1)%e]<<1,i=n[t]<<1,o=n[(t+1)%e]<<1;return!this.positiveArea(r[a],r[a+1],r[i],r[i+1],r[o],r[o+1])},t.positiveArea=function(t,e,r,n,a,i){return t*(i-n)+r*(e-i)+a*(n-e)>=0},t.winding=function(t,e,r,n,a,i){var o=r-t,s=n-e;return a*s-i*o+o*e-t*s>=0?1:-1},t}(),e.Triangulator=r}(u||(u={})),function(t){!function(t){var e=function(){function t(){this.array=new Array}return t.prototype.add=function(t){var e=this.contains(t);return this.array[0|t]=0|t,!e},t.prototype.contains=function(t){return null!=this.array[0|t]},t.prototype.remove=function(t){this.array[0|t]=void 0},t.prototype.clear=function(){this.array.length=0},t}();t.IntSet=e;var r=function(){function t(t,e,r,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===r&&(r=0),void 0===n&&(n=0),this.r=t,this.g=e,this.b=r,this.a=n}return t.prototype.set=function(t,e,r,n){return this.r=t,this.g=e,this.b=r,this.a=n,this.clamp(),this},t.prototype.setFromColor=function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this},t.prototype.setFromString=function(t){return t="#"==t.charAt(0)?t.substr(1):t,this.r=parseInt(t.substr(0,2),16)/255,this.g=parseInt(t.substr(2,2),16)/255,this.b=parseInt(t.substr(4,2),16)/255,this.a=(8!=t.length?255:parseInt(t.substr(6,2),16))/255,this},t.prototype.add=function(t,e,r,n){return this.r+=t,this.g+=e,this.b+=r,this.a+=n,this.clamp(),this},t.prototype.clamp=function(){return this.r<0?this.r=0:this.r>1&&(this.r=1),this.g<0?this.g=0:this.g>1&&(this.g=1),this.b<0?this.b=0:this.b>1&&(this.b=1),this.a<0?this.a=0:this.a>1&&(this.a=1),this},t.rgba8888ToColor=function(t,e){t.r=((4278190080&e)>>>24)/255,t.g=((16711680&e)>>>16)/255,t.b=((65280&e)>>>8)/255,t.a=(255&e)/255},t.rgb888ToColor=function(t,e){t.r=((16711680&e)>>>16)/255,t.g=((65280&e)>>>8)/255,t.b=(255&e)/255},t.WHITE=new t(1,1,1,1),t.RED=new t(1,0,0,1),t.GREEN=new t(0,1,0,1),t.BLUE=new t(0,0,1,1),t.MAGENTA=new t(1,0,1,1),t}();t.Color=r;var n=function(){function t(){}return t.clamp=function(t,e,r){return tr?r:t},t.cosDeg=function(e){return Math.cos(e*t.degRad)},t.sinDeg=function(e){return Math.sin(e*t.degRad)},t.signum=function(t){return t>0?1:t<0?-1:0},t.toInt=function(t){return t>0?Math.floor(t):Math.ceil(t)},t.cbrt=function(t){var e=Math.pow(Math.abs(t),1/3);return t<0?-e:e},t.randomTriangular=function(e,r){return t.randomTriangularWith(e,r,.5*(e+r))},t.randomTriangularWith=function(t,e,r){var n=Math.random(),a=e-t;return n<=(r-t)/a?t+Math.sqrt(n*a*(r-t)):e-Math.sqrt((1-n)*a*(e-r))},t.PI=3.1415927,t.PI2=2*t.PI,t.radiansToDegrees=180/t.PI,t.radDeg=t.radiansToDegrees,t.degreesToRadians=t.PI/180,t.degRad=t.degreesToRadians,t}();t.MathUtils=n;var a=function(){function t(){}return t.prototype.apply=function(t,e,r){return t+(e-t)*this.applyInternal(r)},t}();t.Interpolation=a;var i=function(t){function e(e){var r=t.call(this)||this;return r.power=2,r.power=e,r}return d(e,t),e.prototype.applyInternal=function(t){return t<=.5?Math.pow(2*t,this.power)/2:Math.pow(2*(t-1),this.power)/(this.power%2==0?-2:2)+1},e}(a);t.Pow=i;var o=function(t){function e(e){return t.call(this,e)||this}return d(e,t),e.prototype.applyInternal=function(t){return Math.pow(t-1,this.power)*(this.power%2==0?-1:1)+1},e}(i);t.PowOut=o;var s=function(){function t(){}return t.arrayCopy=function(t,e,r,n,a){for(var i=e,o=n;i=r?e:t.setArraySize(e,r,n)},t.newArray=function(t,e){for(var r=new Array(t),n=0;n0?this.items.pop():this.instantiator()},t.prototype.free=function(t){t.reset&&t.reset(),this.items.push(t)},t.prototype.freeAll=function(t){for(var e=0;ethis.maxDelta&&(this.delta=this.maxDelta),this.lastTime=t,this.frameCount++,this.frameTime>1&&(this.framesPerSecond=this.frameCount/this.frameTime,this.frameTime=0,this.frameCount=0)},t}();t.TimeKeeper=u;var f=function(){function t(t){void 0===t&&(t=32),this.addedValues=0,this.lastValue=0,this.mean=0,this.dirty=!0,this.values=new Array(t)}return t.prototype.hasEnoughData=function(){return this.addedValues>=this.values.length},t.prototype.addValue=function(t){this.addedValuesthis.values.length-1&&(this.lastValue=0),this.dirty=!0},t.prototype.getMean=function(){if(this.hasEnoughData()){if(this.dirty){for(var t=0,e=0;e>1)*i;var o=t.bone.skeleton,s=t.deform,l=this.vertices,h=this.bones;if(null!=h){for(var c=0,u=0,d=0;d0&&(l=s);for(var M,w=(M=t.bone.matrix).tx,E=M.ty,T=M.a,b=M.c,S=M.b,A=M.d,I=e,R=a;Rn&&(r=n),this.state.update(r),this.state.apply(this.skeleton),this.skeleton){this.skeleton.updateWorldTransform();var a=this.skeleton.slots,o=this.color,s=null,h=null;o?(s=o.light,h=o.dark):s=this.tintRgb;for(var c=l.TransformBase&&1==this.transformHack(),u=0,d=a.length;u0&&(p=p.substr(0,m)),p=p.substr(0,p.lastIndexOf("."))+f,r.metadata&&r.metadata.spineAtlasFile&&(p=r.metadata.spineAtlasFile),p=p.replace(this.baseUrl,"");var g={crossOrigin:r.crossOrigin,xhrType:e.XHR_RESPONSE_TYPE.TEXT,metadata:c.spineMetadata||null,parentResource:r},v={crossOrigin:r.crossOrigin,metadata:c.imageMetadata||null,parentResource:r},y=r.url.substr(0,r.url.lastIndexOf("/")+1);y=y.replace(this.baseUrl,"");var x=c.imageNamePrefix||r.name+"_atlas_page_",M=c.images?a(c.images):c.image?a({default:c.image}):c.imageLoader?c.imageLoader(this,x,y,v):n(this,x,y,v),w=function(e){new t.core.TextureAtlas(e,M,(function(e){e&&(l.attachmentLoader=new t.core.AtlasAttachmentLoader(e),r.spineData=l.readSkeletonData(h),r.spineAtlas=e),i()}))};r.metadata&&r.metadata.atlasRawData?w(r.metadata.atlasRawData):this.add(r.name+"_atlas",p,g,(function(t){t.error?i():w(t.data)}))}}function n(t,e,r,n){return r&&r.lastIndexOf("/")!==r.length-1&&(r+="/"),function(a,i){var o=e+a,s=r+a,l=t.resources[o];if(l){function h(){i(l.texture.baseTexture)}l.texture?h():l.onAfterMiddleware.add(h)}else t.add(o,s,n,(function(t){t.error?i(null):i(t.texture.baseTexture)}))}}function a(t){return function(e,r){var n=t[e]||t.default;n&&n.baseTexture?r(n.baseTexture):r(n)}}e.setExtensionXhrType("skel",e.XHR_RESPONSE_TYPE.BUFFER),t.atlasParser=r,t.imageLoaderAdapter=n,t.syncImageLoaderAdapter=function(t,e){return t&&t.lastIndexOf("/")!==t.length-1&&(t+="/"),function(t,r){r(l.BaseTexture.fromImage(t,e))}},t.staticImageLoader=a,l.loaders.Loader&&(l.loaders.Loader.addPixiMiddleware(r),l.loader.use(r()))}(u||(u={}));var f=u;let p={};function m(t){const e=t.image,r=t.image.cloneNode();return t.image=r,{tex:n.Texture.from(e),count:0}}function g(t){setTimeout((()=>{const e=p[t];e&&(e.count--,e.count<=0&&(e.tex&&(e.tex.destroy(!0),e.tex=null),delete p[t]))}),100)}let v={};function y(t,e,r,n){let a=null;const i=function(t,e){let r=p[t];return r||(r=m(e),p[t]=r),r.tex}(e,r);new f.core.TextureAtlas(r.atlas,((t,e)=>{e(i.baseTexture)}),(t=>{if(t){const e=new f.core.AtlasAttachmentLoader(t),i=new f.core.SkeletonJson(e);n&&(i.scale=n),a=i.readSkeletonData(r.ske)}}));const o={spineData:a,ref:0,imgName:e};return v[t]=o,o}function x(t){return i(this,void 0,void 0,(function*(){const r=yield e.resource.getResource(t);let n=v[t];if(!n)if(r.complete)n=y(t,r.name,r.data,r.scale);else if(!n)return;return function(t,e){let r=p[t];r||(r=m(e),p[t]=r),r.count++,r.tex}(r.name,r.data),n.ref++,n.spineData}))}e.resource.registerInstance("SPINE",(t=>y(t.name,t.name,t.data,t.scale))),e.resource.registerDestroy("SPINE",(t=>{t.instance&&(g(t.name),t.instance=null)}));let M=class extends r.Renderer{constructor(){super(...arguments),this.armatures={}}init(){this.renderSystem=this.game.getSystem(r.RendererSystem),this.renderSystem.rendererManager.register(this),this.game.canvas.addEventListener("webglcontextrestored",(()=>{const t=this.game.gameObjects;let r=[];for(let n in this.armatures){const a=+n;for(let n=0;n{r.forEach((t=>{this.add(t)}))}),1e3)}),!1)}componentChanged(t){return i(this,void 0,void 0,(function*(){if("Spine"===t.componentName)if(t.type===e.OBSERVER_TYPE.ADD)this.add(t);else if(t.type===e.OBSERVER_TYPE.CHANGE)switch(t.prop.prop[0]){case"resource":this.change(t)}else t.type===e.OBSERVER_TYPE.REMOVE&&this.remove(t)}))}add(t,e){return i(this,void 0,void 0,(function*(){const r=t.component;clearTimeout(r.addHandler);const n=yield x(r.resource);if(!n)return void(r.addHandler=setTimeout((()=>{r.destroied||(void 0===e&&(e=20),--e>0?this.add(t,e):console.log("retry exceed max times",r.resource))}),1e3));this.remove(t);const a=this.renderSystem.containerManager.getContainer(t.gameObject.id);if(!a)return;const i=new f.Spine(n);if(this.armatures[t.gameObject.id]=i,t.gameObject&&t.gameObject.transform){const e=t.gameObject.transform;i.x=e.size.width*e.origin.x,i.y=e.size.height*e.origin.y}if(a.addChildAt(i,0),r.usingResource=r.resource,r.armature=i,r.autoPlay)try{i.state.setAnimation(0,r.animationName,!0)}catch(t){console.log(t)}r.emit("loaded",{resource:r.resource}),i.state.addListener({start:(t,e)=>{r.emit("start",{track:t,name:t.animation.name})},complete:(t,e)=>{r.emit("complete",{track:t,name:t.animation.name})},interrupt:(t,e)=>{r.emit("interrupt",{track:t,name:t.animation.name})},end:(t,e)=>{r.emit("end",{track:t,name:t.animation.name})},event:(t,e)=>{r.emit("event",t,e)}})}))}change(t){this.remove(t),this.add(t)}remove(t){const r=t.component;clearTimeout(r.addHandler);const n=this.armatures[t.gameObject.id],a=this.renderSystem.containerManager.getContainer(t.gameObject.id);a&&n&&a.removeChild(n),r.armature&&(r.armature.destroy({children:!0}),r.usingResource&&function(t){const e=v[t];e&&(e.ref--,e.ref<=0&&(g(e.imgName),delete v[t]))}(r.usingResource)),r.armature=null,delete this.armatures[t.gameObject.id],t.type,e.OBSERVER_TYPE.CHANGE}};M.systemName="SpineSystem",M=a([e.decorators.componentObserver({Spine:["resource"]})],M);var w=M;t.Spine=o,t.SpineSystem=w,Object.defineProperty(t,"__esModule",{value:!0})},"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@eva/eva.js"),require("@eva/plugin-renderer"),require("pixi.js")):"function"==typeof define&&define.amd?define(["exports","@eva/eva.js","@eva/plugin-renderer","pixi.js"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).EVA=t.EVA||{},t.EVA.plugin=t.EVA.plugin||{},t.EVA.plugin.renderer=t.EVA.plugin.renderer||{},t.EVA.plugin.renderer.spine38={}),t.EVA,t.EVA.plugin.renderer,t.PIXI); diff --git a/dist/cdn/min/EVA.plugin.renderer.sprite.min.js b/dist/cdn/min/EVA.plugin.renderer.sprite.min.js deleted file mode 100644 index a2e08a6c..00000000 --- a/dist/cdn/min/EVA.plugin.renderer.sprite.min.js +++ /dev/null @@ -1 +0,0 @@ -var e,t;e=this,t=function(e,t,r,i){"use strict";function s(e,t,r,i){var s,n=arguments.length,o=n<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(n<3?s(o):n>3?s(t,r,o):s(t,r))||o);return n>3&&o&&Object.defineProperty(t,r,o),o}function n(e,t,r,i){return new(r||(r=Promise))((function(s,n){function o(e){try{c(i.next(e))}catch(e){n(e)}}function a(e){try{c(i.throw(e))}catch(e){n(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}c((i=i.apply(e,t||[])).next())}))}class o extends t.Component{constructor(){super(...arguments),this.resource="",this.spriteName=""}init(e){e&&e.resource&&(this.resource=e.resource,this.spriteName=e.spriteName)}}o.componentName="Sprite",s([t.decorators.IDEProp],o.prototype,"resource",void 0),s([t.decorators.IDEProp],o.prototype,"spriteName",void 0);class a{constructor(e){this._image=null,this._image=e,e?e instanceof HTMLImageElement?this.sprite=i.Sprite.from(e):e instanceof i.Texture&&(this.sprite=new i.Sprite(e)):this.sprite=new i.Sprite}set image(e){this._image!==e&&(e instanceof HTMLImageElement?(this.sprite.texture&&this.sprite.texture.destroy(!1),this.sprite.texture=i.Texture.from(e)):e instanceof i.Texture&&(this.sprite.texture=e),this._image=e)}get image(){return this._image}}const c="_s|r|c_";t.resource.registerInstance(t.RESOURCE_TYPE.SPRITE,(({name:e,data:t})=>new Promise((r=>{const s=t.json,n=i.BaseTexture.from(t.image),o=s.frames||{},a=s.animations||{},p={};for(const t in o)p[e+c+t]=o[t];for(const t in a){let r=[];if(a[t]&&a[t].length>=0)for(let i of a[t]){const t=e+c+i;r.push(t)}a[t]=r}s.frames=p;const u=new i.Spritesheet(n,s);u.parse((()=>{const{textures:e}=u;r(e)}))})))),t.resource.registerDestroy(t.RESOURCE_TYPE.SPRITE,(({instance:e})=>{if(e)for(let t in e)e[t].destroy(!0)}));let p=class extends r.Renderer{constructor(){super(...arguments),this.name="Sprite",this.sprites={}}init(){this.renderSystem=this.game.getSystem(r.RendererSystem),this.renderSystem.rendererManager.register(this)}rendererUpdate(e){const{width:t,height:r}=e.transform.size;this.sprites[e.id]&&(this.sprites[e.id].sprite.width=t,this.sprites[e.id].sprite.height=r)}componentChanged(e){return n(this,void 0,void 0,(function*(){if("Sprite"===e.componentName){const r=e.component;if(e.type===t.OBSERVER_TYPE.ADD){const i=new a(null);t.resource.getResource(r.resource).then((({instance:t})=>n(this,void 0,void 0,(function*(){if(!t)throw new Error(`GameObject:${e.gameObject.name}'s Sprite resource load error`);i.image=t[r.resource+c+r.spriteName]})))),this.sprites[e.gameObject.id]=i,this.containerManager.getContainer(e.gameObject.id).addChildAt(i.sprite,0)}else if(e.type===t.OBSERVER_TYPE.CHANGE){const{instance:i}=yield t.resource.getResource(r.resource);if(!i)throw new Error(`GameObject:${e.gameObject.name}'s Sprite resource load error`);this.sprites[e.gameObject.id].image=i[r.resource+c+r.spriteName]}else if(e.type===t.OBSERVER_TYPE.REMOVE){const t=this.sprites[e.gameObject.id];this.containerManager.getContainer(e.gameObject.id).removeChild(t.sprite),t.sprite.destroy(!0),delete this.sprites[e.gameObject.id]}}}))}};p.systemName="Sprite",p=s([t.decorators.componentObserver({Sprite:["spriteName"]})],p);var u=p;e.Sprite=o,e.SpriteSystem=u,Object.defineProperty(e,"__esModule",{value:!0})},"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@eva/eva.js"),require("@eva/plugin-renderer"),require("pixi.js")):"function"==typeof define&&define.amd?define(["exports","@eva/eva.js","@eva/plugin-renderer","pixi.js"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).EVA=e.EVA||{},e.EVA.plugin=e.EVA.plugin||{},e.EVA.plugin.renderer=e.EVA.plugin.renderer||{},e.EVA.plugin.renderer.sprite={}),e.EVA,e.EVA.plugin.renderer,e.PIXI); diff --git a/dist/cdn/min/EVA.plugin.renderer.spriteAnimation.min.js b/dist/cdn/min/EVA.plugin.renderer.spriteAnimation.min.js deleted file mode 100644 index 1ae7d1ea..00000000 --- a/dist/cdn/min/EVA.plugin.renderer.spriteAnimation.min.js +++ /dev/null @@ -1 +0,0 @@ -var e,t;e=this,t=function(e,t,i,n,r){"use strict";function a(e,t,i,n){var r,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,n);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(o=(a<3?r(o):a>3?r(t,i,o):r(t,i))||o);return a>3&&o&&Object.defineProperty(t,i,o),o}function o(e,t,i,n){return new(i||(i=Promise))((function(r,a){function o(e){try{p(n.next(e))}catch(e){a(e)}}function s(e){try{p(n.throw(e))}catch(e){a(e)}}function p(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,s)}p((n=n.apply(e,t||[])).next())}))}class s extends t.Component{constructor(){super(...arguments),this.resource="",this.autoPlay=!0,this.speed=100,this.waitPlay=!1,this.waitStop=!1,this.times=1/0,this.count=0}init(e){e&&Object.assign(this,e),this.on("loop",(()=>{++this.count>=this.times&&(this.animate.stop(),this.emit("complete"))}))}play(e=1/0){0!==e&&(this.times=e,this.animate?(this.animate.play(),this.count=0):this.waitPlay=!0)}stop(){this.animate?this.animate.stop():this.waitStop=!0}set animate(e){this._animate=e,this.waitPlay&&(this.waitPlay=!1,this.play(this.times)),this.waitStop&&(this.waitStop=!1,this.stop())}get animate(){return this._animate}gotoAndPlay(e){this.animate.gotoAndPlay(e)}gotoAndStop(e){this.animate.gotoAndStop(e)}}s.componentName="SpriteAnimation",a([t.decorators.IDEProp],s.prototype,"resource",void 0),a([t.decorators.IDEProp],s.prototype,"autoPlay",void 0),a([t.decorators.IDEProp],s.prototype,"speed",void 0);const p="_s|r|c_";t.resource.registerInstance(t.RESOURCE_TYPE.SPRITE_ANIMATION,(({name:e,data:t})=>new Promise((i=>{const n=t.json,a=r.BaseTexture.from(t.image),o=n.frames||{},s=n.animations||{},m={};for(const t in o)m[e+p+t]=o[t];for(const t in s){const i=[];if(s[t]&&s[t].length>=0)for(const n of s[t]){const t=e+p+n;i.push(t)}s[t]=i}n.frames=m;const c=new r.Spritesheet(a,n);c.parse((()=>{const{textures:e}=c,t=[];for(const i in e)t.push(e[i]);i(t)}))})))),t.resource.registerDestroy(t.RESOURCE_TYPE.SPRITE_ANIMATION,(({instance:e})=>{if(e)for(const t of e)t.destroy(!0)}));let m=class extends i.Renderer{constructor(){super(...arguments),this.name="SpriteAnimation",this.animates={},this.autoPlay={}}init(){this.renderSystem=this.game.getSystem(i.RendererSystem),this.renderSystem.rendererManager.register(this)}rendererUpdate(e){const{width:t,height:i}=e.transform.size;this.animates[e.id]&&(this.animates[e.id].animatedSprite.width=t,this.animates[e.id].animatedSprite.height=i)}componentChanged(e){return o(this,void 0,void 0,(function*(){if("SpriteAnimation"===e.componentName){const i=e.component;if(this.autoPlay[e.gameObject.id]=i.autoPlay,e.type===t.OBSERVER_TYPE.ADD){const{instance:n}=yield t.resource.getResource(i.resource);n||console.error(`GameObject:${e.gameObject.name}'s Img resource load error`),this.add({frames:n,id:e.gameObject.id,component:i})}else if(e.type===t.OBSERVER_TYPE.CHANGE)if(e.prop&&"speed"===e.prop.prop[0])this.animates[e.gameObject.id].speed=1e3/60/i.speed;else{const{instance:n}=yield t.resource.getResource(i.resource);n||console.error(`GameObject:${e.gameObject.name}'s Img resource load error`),this.change({frames:n,id:e.gameObject.id,component:i})}else e.type===t.OBSERVER_TYPE.REMOVE&&this.remove(e.gameObject.id)}}))}add({frames:e,id:t,component:i}){const r=new n.SpriteAnimation({frames:e});this.animates[t]=r,this.containerManager.getContainer(t).addChildAt(r.animatedSprite,0),r.animatedSprite.onComplete=()=>{i.emit("complete")},r.animatedSprite.onFrameChange=()=>{i.emit("frameChange")},r.animatedSprite.onLoop=()=>{i.emit("loop")},i.animate=this.animates[t],this.animates[t].speed=1e3/60/i.speed,this.autoPlay[t]&&r.animatedSprite.play()}change({frames:e,id:t,component:i}){this.remove(t,!0),this.add({frames:e,id:t,component:i})}remove(e,t){const i=this.animates[e];this.autoPlay[e]=i.animatedSprite.playing,this.containerManager.getContainer(e).removeChild(i.animatedSprite),i.animatedSprite.destroy(!0),delete this.animates[e],t||delete this.autoPlay[e]}};m.systemName="SpriteAnimation",m=a([t.decorators.componentObserver({SpriteAnimation:["speed","resource"]})],m);var c=m;e.SpriteAnimation=s,e.SpriteAnimationSystem=c,Object.defineProperty(e,"__esModule",{value:!0})},"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@eva/eva.js"),require("@eva/plugin-renderer"),require("@eva/renderer-adapter"),require("pixi.js")):"function"==typeof define&&define.amd?define(["exports","@eva/eva.js","@eva/plugin-renderer","@eva/renderer-adapter","pixi.js"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).EVA=e.EVA||{},e.EVA.plugin=e.EVA.plugin||{},e.EVA.plugin.renderer=e.EVA.plugin.renderer||{},e.EVA.plugin.renderer.spriteAnimation={}),e.EVA,e.EVA.plugin.renderer,e.EVA.rendererAdapter,e.PIXI); diff --git a/dist/cdn/min/EVA.plugin.renderer.text.min.js b/dist/cdn/min/EVA.plugin.renderer.text.min.js deleted file mode 100644 index 98bf4c4d..00000000 --- a/dist/cdn/min/EVA.plugin.renderer.text.min.js +++ /dev/null @@ -1 +0,0 @@ -var e,t;e=this,t=function(e,t,n,r,i){"use strict";function s(e,t,n,r){var i,s=arguments.length,o=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(o=(s<3?i(o):s>3?i(t,n,o):i(t,n))||o);return s>3&&o&&Object.defineProperty(t,n,o),o}function o(e,t,n,r){return new(n||(n=Promise))((function(i,s){function o(e){try{c(r.next(e))}catch(e){s(e)}}function a(e){try{c(r.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))}class a extends n.Component{constructor(){super(...arguments),this.text="",this.style={}}init(e){const n=new t.TextStyle({fontSize:20}),r={};for(const e in n)0===e.indexOf("_")&&(r[e.substring(1)]=n[e]);this.style=r,e&&(this.text=e.text,Object.assign(this.style,e.style))}}a.componentName="Text",s([n.decorators.IDEProp],a.prototype,"text",void 0),s([n.decorators.IDEProp],a.prototype,"style",void 0);let c=class extends r.Renderer{constructor(){super(...arguments),this.name="Text",this.texts={}}init(){this.renderSystem=this.game.getSystem(r.RendererSystem),this.renderSystem.rendererManager.register(this)}componentChanged(e){return o(this,void 0,void 0,(function*(){if("Text"===e.componentName)if(e.type===n.OBSERVER_TYPE.ADD){const t=e.component,n=new i.Text(t.text,t.style);this.containerManager.getContainer(e.gameObject.id).addChildAt(n,0),this.texts[e.gameObject.id]={text:n,component:e.component},this.setSize(e)}else e.type===n.OBSERVER_TYPE.REMOVE?(this.containerManager.getContainer(e.gameObject.id).removeChild(this.texts[e.gameObject.id].text),this.texts[e.gameObject.id].text.destroy(!0),delete this.texts[e.gameObject.id]):(this.change(e),this.setSize(e))}))}change(e){const{text:t,component:n}=this.texts[e.gameObject.id];"text"===e.prop.prop[0]?t.text=n.text:"style"===e.prop.prop[0]&&Object.assign(t.style,e.component.style)}setSize(e){const{transform:t}=e.gameObject;t&&(t.size.width=this.texts[e.gameObject.id].text.width,t.size.height=this.texts[e.gameObject.id].text.height)}};c.systemName="Text",c=s([n.decorators.componentObserver({Text:["text",{prop:["style"],deep:!0}]})],c);var d=c;e.Text=a,e.TextSystem=d,Object.defineProperty(e,"__esModule",{value:!0})},"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("pixi.js"),require("@eva/eva.js"),require("@eva/plugin-renderer"),require("@eva/renderer-adapter")):"function"==typeof define&&define.amd?define(["exports","pixi.js","@eva/eva.js","@eva/plugin-renderer","@eva/renderer-adapter"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).EVA=e.EVA||{},e.EVA.plugin=e.EVA.plugin||{},e.EVA.plugin.renderer=e.EVA.plugin.renderer||{},e.EVA.plugin.renderer.text={}),e.PIXI,e.EVA,e.EVA.plugin.renderer,e.EVA.rendererAdapter); diff --git a/dist/cdn/min/EVA.plugin.renderer.tilingSprite.min.js b/dist/cdn/min/EVA.plugin.renderer.tilingSprite.min.js deleted file mode 100644 index 3fd77a4f..00000000 --- a/dist/cdn/min/EVA.plugin.renderer.tilingSprite.min.js +++ /dev/null @@ -1 +0,0 @@ -var e,t;e=this,t=function(e,t,i,r){"use strict";function n(e,t,i,r){var n,o=arguments.length,s=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,r);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(s=(o<3?n(s):o>3?n(t,i,s):n(t,i))||s);return o>3&&s&&Object.defineProperty(t,i,s),s}function o(e,t,i,r){return new(i||(i=Promise))((function(n,o){function s(e){try{c(r.next(e))}catch(e){o(e)}}function a(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))}class s extends t.Component{constructor(){super(...arguments),this.resource="",this.tileScale={x:1,y:1},this.tilePosition={x:0,y:0}}init(e){e&&(this.resource=e.resource,this.tileScale=e.tileScale,this.tilePosition=e.tilePosition)}}s.componentName="TilingSprite",n([t.decorators.IDEProp],s.prototype,"resource",void 0),n([t.decorators.IDEProp],s.prototype,"tileScale",void 0),n([t.decorators.IDEProp],s.prototype,"tilePosition",void 0);let a=class extends i.Renderer{constructor(){super(...arguments),this.name="TilingSprite",this.imgs={}}init(){this.renderSystem=this.game.getSystem(i.RendererSystem),this.renderSystem.rendererManager.register(this)}rendererUpdate(e){const{width:t,height:i}=e.transform.size,r=this.imgs[e.id];r&&(r.tilingSprite.width=t,r.tilingSprite.height=i)}componentChanged(e){return o(this,void 0,void 0,(function*(){if("TilingSprite"===e.componentName){const i=e.component;if(e.type===t.OBSERVER_TYPE.ADD){const n=new r.TilingSprite(null);t.resource.getResource(i.resource).then((({data:t})=>{if(!t)throw new Error(`GameObject:${e.gameObject.name}'s TilingSprite resource load error`);n.image=t.image})),this.imgs[e.gameObject.id]=n,this.containerManager.getContainer(e.gameObject.id).addChildAt(n.tilingSprite,0),this.setProp(e.gameObject.id,i)}else if(e.type===t.OBSERVER_TYPE.CHANGE)if("resource"===e.prop.prop[0]){const{data:r}=yield t.resource.getResource(i.resource);if(!r)throw new Error(`GameObject:${e.gameObject.name}'s TilingSprite resource load error`);this.imgs[e.gameObject.id].image=r.image}else this.setProp(e.gameObject.id,i);else if(e.type===t.OBSERVER_TYPE.REMOVE){const t=this.imgs[e.gameObject.id];this.containerManager.getContainer(e.gameObject.id).removeChild(t.tilingSprite),t.tilingSprite.destory(!0),delete this.imgs[e.gameObject.id]}}}))}setProp(e,t){this.imgs[e].tilingSprite.tilePosition=t.tilePosition,this.imgs[e].tilingSprite.tileScale=t.tileScale}};a=n([t.decorators.componentObserver({TilingSprite:[{prop:["resource"],deep:!1},{prop:["tileScale"],deep:!0},{prop:["tilePosition"],deep:!0}]})],a);var c=a;e.TilingSprite=s,e.TilingSpriteSystem=c,Object.defineProperty(e,"__esModule",{value:!0})},"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@eva/eva.js"),require("@eva/plugin-renderer"),require("@eva/renderer-adapter")):"function"==typeof define&&define.amd?define(["exports","@eva/eva.js","@eva/plugin-renderer","@eva/renderer-adapter"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).EVA=e.EVA||{},e.EVA.plugin=e.EVA.plugin||{},e.EVA.plugin.renderer=e.EVA.plugin.renderer||{},e.EVA.plugin.renderer.tilingSprite={}),e.EVA,e.EVA.plugin.renderer,e.EVA.rendererAdapter); diff --git a/dist/cdn/min/EVA.plugin.sound.min.js b/dist/cdn/min/EVA.plugin.sound.min.js deleted file mode 100644 index 742223a3..00000000 --- a/dist/cdn/min/EVA.plugin.sound.min.js +++ /dev/null @@ -1 +0,0 @@ -var e,t;e=this,t=function(e,t){"use strict";function i(e,t,i,s){return new(i||(i=Promise))((function(o,n){function h(e){try{d(s.next(e))}catch(e){n(e)}}function a(e){try{d(s.throw(e))}catch(e){n(e)}}function d(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(h,a)}d((s=s.apply(e,t||[])).next())}))}let s=class extends t.System{constructor(e){super(),this.autoPauseAndStart=!0,this.components=[],this.pausedComponents=[],this.audioBufferCache={},this.decodeAudioPromiseMap={},Object.assign(this,e)}get muted(){return!!this.gainNode&&0===this.gainNode.gain.value}set muted(e){this.gainNode&&this.gainNode.gain.setValueAtTime(e?0:1,0)}get volume(){return this.gainNode?this.gainNode.gain.value:1}set volume(e){!this.gainNode||"number"!=typeof e||e<0||e>1||this.gainNode.gain.setValueAtTime(e,0)}get audioLocked(){return!this.ctx||"running"!==this.ctx.state}resumeAll(){const e=()=>{this.pausedComponents.forEach((e=>{e.play()})),this.pausedComponents=[]};this.ctx.resume().then(e,e)}pauseAll(){this.components.forEach((e=>{e.playing&&(this.pausedComponents.push(e),e.pause())})),this.ctx.suspend().then()}stopAll(){this.components.forEach((e=>{e.playing&&e.stop()})),this.pausedComponents=[],this.ctx.suspend().then()}init(){this.setupAudioContext()}update(){const e=this.componentObserver.clear();for(const t of e)this.componentChanged(t)}onPlay(){this.autoPauseAndStart&&this.resumeAll()}onPause(){this.autoPauseAndStart&&this.pauseAll()}onDestroy(){this.components.forEach((e=>{e.onDestroy()})),this.components=[],this.ctx&&(this.gainNode.disconnect(),this.gainNode=null,this.ctx.close(),this.ctx=null)}componentChanged(e){return i(this,void 0,void 0,(function*(){"Sound"===e.componentName&&e.type===t.OBSERVER_TYPE.ADD&&this.add(e)}))}setupAudioContext(){try{const e=window.AudioContext||window.webkitAudioContext;this.ctx=new e}catch(e){console.error(e),this.onError&&this.onError(e)}this.ctx&&(this.gainNode=void 0===this.ctx.createGain?this.ctx.createGainNode():this.ctx.createGain(),this.gainNode.gain.setValueAtTime(this.muted?0:this.volume,this.ctx.currentTime),this.gainNode.connect(this.ctx.destination),this.unlockAudio())}unlockAudio(){if(!this.ctx||!this.audioLocked)return;const e=()=>{if(this.ctx){const t=()=>{document.body.removeEventListener("touchstart",e),document.body.removeEventListener("touchend",e),document.body.removeEventListener("click",e)};this.ctx.resume().then(t,t)}};document.body.addEventListener("touchstart",e),document.body.addEventListener("touchend",e),document.body.addEventListener("click",e)}add(e){return i(this,void 0,void 0,(function*(){const i=e.component;this.components.push(i);try{const{config:e}=i;i.state="loading";const s=yield t.resource.getResource(e.resource);this.audioBufferCache[s.name]||(this.audioBufferCache[s.name]=yield this.decodeAudioData(s.data.audio,s.name)),this.audioBufferCache[s.name]&&(i.systemContext=this.ctx,i.systemDestination=this.gainNode,i.onload(this.audioBufferCache[s.name]))}catch(e){console.error(e),this.onError&&this.onError(e)}}))}decodeAudioData(e,t){if(this.decodeAudioPromiseMap[t])return this.decodeAudioPromiseMap[t];const i=new Promise(((i,s)=>{this.ctx||s(new Error("No audio support")),this.ctx.decodeAudioData(e,(e=>{this.decodeAudioPromiseMap[t]&&delete this.decodeAudioPromiseMap[t],e?i(e):s(new Error(`Error decoding audio ${t}`))}),(i=>{this.decodeAudioPromiseMap[t]&&delete this.decodeAudioPromiseMap[t],s(new Error(`${i}. arrayBuffer byteLength: ${e?e.byteLength:0}`))}))}));return this.decodeAudioPromiseMap[t]=i,i}};s.systemName="SoundSystem",s=function(e,t,i,s){var o,n=arguments.length,h=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)h=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(h=(n<3?o(h):n>3?o(t,i,h):o(t,i))||h);return n>3&&h&&Object.defineProperty(t,i,h),h}([t.decorators.componentObserver({Sound:[]})],s);var o=s;class n extends t.Component{constructor(){super(...arguments),this.state="unloaded",this.config={resource:"",autoplay:!1,muted:!1,volume:1,loop:!1,seek:0},this.playTime=0,this.startTime=0,this.duration=0,this.actionQueue=[]}get muted(){return!!this.gainNode&&0===this.gainNode.gain.value}set muted(e){this.gainNode&&this.gainNode.gain.setValueAtTime(e?0:this.config.volume,0)}get volume(){return this.gainNode?this.gainNode.gain.value:1}set volume(e){"number"!=typeof e||e<0||e>1||(this.config.volume=e,this.gainNode&&this.gainNode.gain.setValueAtTime(e,0))}init(e){e&&(Object.assign(this.config,e),this.config.autoplay&&this.actionQueue.push(this.play.bind(this)))}play(){if("loaded"!==this.state&&this.actionQueue.push(this.play.bind(this)),this.destroySource(),this.createSource(),!this.sourceNode)return;const e=this.systemContext.currentTime,t=this.config.seek,i=this.config.duration;this.sourceNode.start(0,t,i),this.startTime=e,this.playTime=e-t,this.paused=!1,this.playing=!0,this.resetConfig(),this.endedListener=()=>{this.sourceNode&&(this.config.onEnd&&this.config.onEnd(),this.playing&&this.destroySource())},this.sourceNode.addEventListener("ended",this.endedListener)}pause(){"loaded"!==this.state&&this.actionQueue.push(this.pause.bind(this)),!this.paused&&this.playing&&(this.paused=!0,this.playing=!1,this.config.seek=this.getCurrentTime(),this.destroySource())}stop(){"loaded"!==this.state&&this.actionQueue.push(this.stop.bind(this)),(this.paused||this.playing)&&(this.playing=!1,this.paused=!1,this.destroySource(),this.resetConfig())}onload(e){this.state="loaded",this.buffer=e,this.duration=this.buffer.duration,this.actionQueue.forEach((e=>e())),this.actionQueue.length=0}onDestroy(){this.actionQueue.length=0,this.destroySource()}resetConfig(){this.config.seek=0}getCurrentTime(){return this.config.loop&&this.duration>0?(this.systemContext.currentTime-this.playTime)%this.duration:this.systemContext.currentTime-this.playTime}createSource(){this.systemContext&&"loaded"===this.state&&(this.sourceNode=this.systemContext.createBufferSource(),this.sourceNode.buffer=this.buffer,this.sourceNode.loop=this.config.loop,this.gainNode||(this.gainNode=this.systemContext.createGain(),this.gainNode.connect(this.systemDestination),Object.assign(this,this.config)),this.sourceNode.connect(this.gainNode))}destroySource(){this.sourceNode&&(this.sourceNode.removeEventListener("ended",this.endedListener),this.sourceNode.stop(),this.sourceNode.disconnect(),this.sourceNode=null,this.startTime=0,this.playTime=0,this.playing=!1)}}n.componentName="Sound",e.Sound=n,e.SoundSystem=o,Object.defineProperty(e,"__esModule",{value:!0})},"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@eva/eva.js")):"function"==typeof define&&define.amd?define(["exports","@eva/eva.js"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).EVA=e.EVA||{},e.EVA.plugin=e.EVA.plugin||{},e.EVA.plugin.sound={}),e.EVA); diff --git a/dist/cdn/min/EVA.plugin.stats.min.js b/dist/cdn/min/EVA.plugin.stats.min.js deleted file mode 100644 index cab6ff3f..00000000 --- a/dist/cdn/min/EVA.plugin.stats.min.js +++ /dev/null @@ -1 +0,0 @@ -var e,t;e=this,t=function(e,t){"use strict";class n extends t.Component{update(){this.stats&&this.stats.begin()}}n.componentName="Stats";const s=function(e){e=Object.assign({width:20,height:12,x:0,y:0},e);const{width:t,height:n,x:i,y:l}=e;let o=0;const a=document.createElement("div");function d(e){return a.appendChild(e.dom),e}function c(e){for(let t=0;t=h+1e3&&(p.update(1e3*r/(e-h),100),h=e,r=0,m)){const e=performance.memory;m.update(e.usedJSHeapSize/1048576,e.jsHeapSizeLimit/1048576)}return e},update:function(){f=this.end()},domElement:a,setMode:c}};s.Panel=function(e,t,n){let s=1/0,i=0;const l=Math.round,o=l(window.devicePixelRatio||1),a=80*o,d=48*o,c=3*o,f=2*o,h=3*o,r=15*o,p=74*o,u=30*o,m=document.createElement("canvas");m.width=a,m.height=d,m.style.cssText="width:100%;height:100%";const y=m.getContext("2d");return y.font="bold "+9*o+"px Helvetica,Arial,sans-serif",y.textBaseline="top",y.fillStyle=n,y.fillRect(0,0,a,d),y.fillStyle=t,y.fillText(e,c,f),y.fillRect(h,r,p,u),y.fillStyle=n,y.globalAlpha=.9,y.fillRect(h,r,p,u),{dom:m,update:function(d,w){s=Math.min(s,d),i=Math.max(i,d),y.fillStyle=n,y.globalAlpha=1,y.fillRect(0,0,a,r),y.fillStyle=t,y.fillText(l(d)+" "+e+" ("+l(s)+"-"+l(i)+")",c,f),y.drawImage(m,h+o,r,p-o,u,h,r,p-o,u),y.fillRect(h+p-o,r,o,u),y.fillStyle=n,y.globalAlpha=.9,y.fillRect(h+p-o,r,o,l((1-d/w)*u))}}};class i extends t.System{constructor(){super(...arguments),this.show=!0}init(e={show:!0}){this.show=e.show,this.style=e.style}start(){this.show&&(this.component=this.game.scene.addComponent(new n),this.stats=s(this.style),this.component.stats=this.stats,this.stats.showPanel(0),document.body.appendChild(this.stats.dom))}lateUpdate(){this.show&&this.stats&&this.stats.end()}}i.systemName="Stats";var l={Components:[n],Systems:[i]};e.Stats=n,e.StatsSystem=i,e.default=l,Object.defineProperty(e,"__esModule",{value:!0})},"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@eva/eva.js")):"function"==typeof define&&define.amd?define(["exports","@eva/eva.js"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).EVA=e.EVA||{},e.EVA.plugin=e.EVA.plugin||{},e.EVA.plugin.stats={}),e.EVA); diff --git a/dist/cdn/min/EVA.plugin.transition.min.js b/dist/cdn/min/EVA.plugin.transition.min.js deleted file mode 100644 index 25c7c807..00000000 --- a/dist/cdn/min/EVA.plugin.transition.min.js +++ /dev/null @@ -1 +0,0 @@ -var t,e;t=this,e=function(t,e){"use strict";var i,n={Linear:{None:function(t){return t}},Quadratic:{In:function(t){return t*t},Out:function(t){return t*(2-t)},InOut:function(t){return(t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)}},Cubic:{In:function(t){return t*t*t},Out:function(t){return--t*t*t+1},InOut:function(t){return(t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)}},Quartic:{In:function(t){return t*t*t*t},Out:function(t){return 1- --t*t*t*t},InOut:function(t){return(t*=2)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)}},Quintic:{In:function(t){return t*t*t*t*t},Out:function(t){return--t*t*t*t*t+1},InOut:function(t){return(t*=2)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)}},Sinusoidal:{In:function(t){return 1-Math.cos(t*Math.PI/2)},Out:function(t){return Math.sin(t*Math.PI/2)},InOut:function(t){return.5*(1-Math.cos(Math.PI*t))}},Exponential:{In:function(t){return 0===t?0:Math.pow(1024,t-1)},Out:function(t){return 1===t?1:1-Math.pow(2,-10*t)},InOut:function(t){return 0===t?0:1===t?1:(t*=2)<1?.5*Math.pow(1024,t-1):.5*(2-Math.pow(2,-10*(t-1)))}},Circular:{In:function(t){return 1-Math.sqrt(1-t*t)},Out:function(t){return Math.sqrt(1- --t*t)},InOut:function(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}},Elastic:{In:function(t){return 0===t?0:1===t?1:-Math.pow(2,10*(t-1))*Math.sin(5*(t-1.1)*Math.PI)},Out:function(t){return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin(5*(t-.1)*Math.PI)+1},InOut:function(t){return 0===t?0:1===t?1:(t*=2)<1?-.5*Math.pow(2,10*(t-1))*Math.sin(5*(t-1.1)*Math.PI):.5*Math.pow(2,-10*(t-1))*Math.sin(5*(t-1.1)*Math.PI)+1}},Back:{In:function(t){var e=1.70158;return t*t*((e+1)*t-e)},Out:function(t){var e=1.70158;return--t*t*((e+1)*t+e)+1},InOut:function(t){var e=2.5949095;return(t*=2)<1?t*t*((e+1)*t-e)*.5:.5*((t-=2)*t*((e+1)*t+e)+2)}},Bounce:{In:function(t){return 1-n.Bounce.Out(1-t)},Out:function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},InOut:function(t){return t<.5?.5*n.Bounce.In(2*t):.5*n.Bounce.Out(2*t-1)+.5}}},s="undefined"==typeof self&&"undefined"!=typeof process&&process.hrtime?function(){var t=process.hrtime();return 1e3*t[0]+t[1]/1e6}:"undefined"!=typeof self&&void 0!==self.performance&&void 0!==self.performance.now?self.performance.now.bind(self.performance):void 0!==Date.now?Date.now:function(){return(new Date).getTime()},r=function(){function t(){this._tweens={},this._tweensAddedDuringUpdate={}}return t.prototype.getAll=function(){var t=this;return Object.keys(this._tweens).map((function(e){return t._tweens[e]}))},t.prototype.removeAll=function(){this._tweens={}},t.prototype.add=function(t){this._tweens[t.getId()]=t,this._tweensAddedDuringUpdate[t.getId()]=t},t.prototype.remove=function(t){delete this._tweens[t.getId()],delete this._tweensAddedDuringUpdate[t.getId()]},t.prototype.update=function(t,e){void 0===t&&(t=s()),void 0===e&&(e=!1);var i=Object.keys(this._tweens);if(0===i.length)return!1;for(;i.length>0;){this._tweensAddedDuringUpdate={};for(var n=0;n1?r(t[i],t[i-1],i-n):r(t[s],t[s+1>i?i:s+1],n-s)},Bezier:function(t,e){for(var i=0,n=t.length-1,s=Math.pow,r=o.Utils.Bernstein,a=0;a<=n;a++)i+=s(1-e,n-a)*s(e,a)*t[a]*r(n,a);return i},CatmullRom:function(t,e){var i=t.length-1,n=i*e,s=Math.floor(n),r=o.Utils.CatmullRom;return t[0]===t[i]?(e<0&&(s=Math.floor(n=i*(1+e))),r(t[(s-1+i)%i],t[s],t[(s+1)%i],t[(s+2)%i],n-s)):e<0?t[0]-(r(t[0],t[0],t[1],t[1],-n)-t[0]):e>1?t[i]-(r(t[i],t[i],t[i-1],t[i-1],n-i)-t[i]):r(t[s?s-1:0],t[s],t[i1;n--)e*=n;return i[t]=e,e}),CatmullRom:function(t,e,i,n,s){var r=.5*(i-t),o=.5*(n-e),a=s*s;return(2*e-2*i+r+o)*(s*a)+(-3*e+3*i-2*r-o)*a+r*s+e}}},a=function(){function t(){}return t.nextId=function(){return t._nextId++},t._nextId=0,t}(),h=new r,u=function(){function t(t,e){void 0===e&&(e=h),this._object=t,this._group=e,this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=n.Linear.None,this._interpolationFunction=o.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._id=a.nextId(),this._isChainStopped=!1,this._goToEnd=!1}return t.prototype.getId=function(){return this._id},t.prototype.isPlaying=function(){return this._isPlaying},t.prototype.isPaused=function(){return this._isPaused},t.prototype.to=function(t,e){return this._valuesEnd=Object.create(t),void 0!==e&&(this._duration=e),this},t.prototype.duration=function(t){return this._duration=t,this},t.prototype.start=function(t){if(this._isPlaying)return this;if(this._group&&this._group.add(this),this._repeat=this._initialRepeat,this._reversed)for(var e in this._reversed=!1,this._valuesStartRepeat)this._swapEndStartRepeatValues(e),this._valuesStart[e]=this._valuesStartRepeat[e];return this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=void 0!==t?"string"==typeof t?s()+parseFloat(t):t:s(),this._startTime+=this._delayTime,this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat),this},t.prototype._setupProperties=function(t,e,i,n){for(var s in i){var r=t[s],o=Array.isArray(r),a=o?"array":typeof r,h=!o&&Array.isArray(i[s]);if("undefined"!==a&&"function"!==a){if(h){var u=i[s];if(0===u.length)continue;u=u.map(this._handleRelativeValue.bind(this,r)),i[s]=[r].concat(u)}if("object"!==a&&!o||!r||h)void 0===e[s]&&(e[s]=r),o||(e[s]*=1),n[s]=h?i[s].slice().reverse():e[s]||0;else{for(var p in e[s]=o?[]:{},r)e[s][p]=r[p];n[s]=o?[]:{},this._setupProperties(r,e[s],i[s],n[s])}}}},t.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._group&&this._group.remove(this),this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},t.prototype.end=function(){return this._goToEnd=!0,this.update(1/0),this},t.prototype.pause=function(t){return void 0===t&&(t=s()),this._isPaused||!this._isPlaying||(this._isPaused=!0,this._pauseStart=t,this._group&&this._group.remove(this)),this},t.prototype.resume=function(t){return void 0===t&&(t=s()),this._isPaused&&this._isPlaying?(this._isPaused=!1,this._startTime+=t-this._pauseStart,this._pauseStart=0,this._group&&this._group.add(this),this):this},t.prototype.stopChainedTweens=function(){for(var t=0,e=this._chainedTweens.length;tr)return!1;e&&this.start(t)}if(this._goToEnd=!1,t1?1:n;var o=this._easingFunction(n);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,o),this._onUpdateCallback&&this._onUpdateCallback(this._object,n),1===n){if(this._repeat>0){for(i in isFinite(this._repeat)&&this._repeat--,this._valuesStartRepeat)this._yoyo||"string"!=typeof this._valuesEnd[i]||(this._valuesStartRepeat[i]=this._valuesStartRepeat[i]+parseFloat(this._valuesEnd[i])),this._yoyo&&this._swapEndStartRepeatValues(i),this._valuesStart[i]=this._valuesStartRepeat[i];return this._yoyo&&(this._reversed=!this._reversed),void 0!==this._repeatDelayTime?this._startTime=t+this._repeatDelayTime:this._startTime=t+this._delayTime,this._onRepeatCallback&&this._onRepeatCallback(this._object),!0}this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var a=0,h=this._chainedTweens.length;a~~t};class l{constructor(t,e){this.tweens=[],this.timelines=[],this.finishCount=0,this.callbacks=new Map,this.objectCache={},this.currIteration=0,this.timelines=t,this.tweenGroup=e}on(t,e){this.callbacks[t]||this.callbacks.set(t,[]),this.callbacks.get(t).push(e)}emit(t){const e=this.callbacks.get(t);e&&e.length&&e.forEach((t=>t()))}checkFinish(){if(++this.finishCount==this.tweens.length)if(++this.currIteration==this.iteration)this.emit("finish");else{if(this.stoped)return;this.start()}}getObjectCache(t,e){const i=`${t.gameObject.id}${t.name}`;if(this.objectCache[i]||(this.objectCache[i]={}),this.objectCache[i][e])return this.objectCache[i][e];const n=e.split("."),s=n.length-1;let r=t;for(let t=0;t{for(let n=0;n{this.doAnim({component:e.component,name:e.name,value:t.value})}));0===n?this.tweens[i]=o:t.chain(o),t=o}t&&t.onComplete((()=>this.checkFinishFunc()))}))}play(t=1){this.stoped=!1,this.start(),this.currIteration=0,this.iteration=t}start(){this.finishCount=0,this.tweens.length=0,this.init(),this.tweens.forEach((t=>t.start()))}pause(){this.tweens.forEach((t=>t.pause()))}resume(){this.tweens.forEach((t=>t.resume()))}stop(){this.stoped=!0,this.tweens.forEach((t=>t.stop()))}destroy(){this.stop(),this.tweens=null,this.timelines=null,this.objectCache=null,this.callbacks.clear(),this.callbacks=null}}class _ extends e.Component{constructor(){super(...arguments),this.animations={},this.group={}}init({group:t}={group:{}}){this.group=t,this.tweenGroup=new r}awake(){for(const t in this.group)this.newAnimation(t)}play(t,e){t||(t=Object.keys(this.group)[0]),t&&!this.animations[t]&&this.group[t]&&this.newAnimation(t),t&&this.animations[t]&&this.animations[t].play(e)}stop(t){if(t)this.animations[t].stop();else for(const t in this.animations)this.animations[t].stop()}onPause(){for(const t in this.animations)this.animations[t].pause()}onResume(){for(const t in this.animations)this.animations[t].resume()}onDestroy(){for(const t in this.animations)this.animations[t].destroy();this.tweenGroup.removeAll(),this.tweenGroup=null,this.group=null,this.animations=null,this.removeAllListeners()}update(){this.tweenGroup.update()}newAnimation(t){const e=new l(this.group[t],this.tweenGroup);e.on("finish",(()=>this.emit("finish",t))),this.animations[t]=e}}_.componentName="Transition";class d extends e.System{constructor(){super(...arguments),this.name="transition"}}d.systemName="transition",t.Transition=_,t.TransitionSystem=d,Object.defineProperty(t,"__esModule",{value:!0})},"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@eva/eva.js")):"function"==typeof define&&define.amd?define(["exports","@eva/eva.js"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).EVA=t.EVA||{},t.EVA.plugin=t.EVA.plugin||{},t.EVA.plugin.transition={}),t.EVA); diff --git a/dist/cdn/min/EVA.rendererAdapter.min.js b/dist/cdn/min/EVA.rendererAdapter.min.js deleted file mode 100644 index c52e9ed6..00000000 --- a/dist/cdn/min/EVA.rendererAdapter.min.js +++ /dev/null @@ -1 +0,0 @@ -var e,t;e=this,t=function(e,t){"use strict";class i extends t.Application{constructor(e){e.autoStart=!1,super(e)}}class s extends t.Container{}class r extends t.Graphics{}class n extends t.mesh.NineSlicePlane{constructor(e,i,s,r,n){let a;a="string"===e?t.Texture.fromFrame(e):t.Texture.from(e),super(a,i,s,r,n)}}class a extends t.Text{constructor(e,t){super(e,t)}}const o=t.extras.TilingSprite;e.Application=i,e.Container=s,e.Graphics=r,e.NinePatch=n,e.Sprite=class{constructor(e){this._image=null,this._image=e,e?e instanceof HTMLImageElement?this.sprite=t.Sprite.from(e):e instanceof t.Texture&&(this.sprite=new t.Sprite(e)):this.sprite=new t.Sprite}set image(e){this._image!==e&&(e instanceof HTMLImageElement?(this.sprite.texture&&this.sprite.texture.destroy(!1),this.sprite.texture=t.Texture.from(e)):e instanceof t.Texture&&(this.sprite.texture=e),this._image=e)}get image(){return this._image}},e.SpriteAnimation=class{constructor({frames:e}){this.animatedSprite=new t.extras.AnimatedSprite(e)}play(){this.animatedSprite.play()}stop(){this.animatedSprite.stop()}gotoAndPlay(e){this.animatedSprite.gotoAndPlay(e)}gotoAndStop(e){this.animatedSprite.gotoAndStop(e)}set speed(e){this.animatedSprite.animationSpeed=e}get speed(){return this.animatedSprite.animationSpeed}},e.Text=a,e.TilingSprite=class{constructor(e){this._image=null,this._image=e,e?e instanceof HTMLImageElement?this.tilingSprite=new o(t.Texture.from(e)):e instanceof t.Texture&&(this.tilingSprite=new o(e)):this.tilingSprite=new o(t.Texture.EMPTY)}set image(e){this._image!==e&&(e instanceof HTMLImageElement?this.tilingSprite.texture=t.Texture.from(e):e instanceof t.Texture&&(this.tilingSprite.texture=e),this._image=e)}get image(){return this._image}},Object.defineProperty(e,"__esModule",{value:!0})},"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("pixi.js")):"function"==typeof define&&define.amd?define(["exports","pixi.js"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).EVA=e.EVA||{},e.EVA.rendererAdapter={}),e.PIXI); diff --git a/dist/eva.js.d.ts b/dist/eva.js.d.ts deleted file mode 100644 index 797a6e4b..00000000 --- a/dist/eva.js.d.ts +++ /dev/null @@ -1,382 +0,0 @@ -import EE from 'eventemitter3'; -import EventEmitter from 'eventemitter3'; -import { Loader } from 'resource-loader'; - -export declare class Component extends EventEmitter { - static componentName: string; - readonly name: string; - started: boolean; - gameObject: GameObject; - __componentDefaultParams: T; - constructor(params?: T); - init?(params?: T): void; - awake?(): void; - start?(): void; - update?(frame: UpdateParams): void; - lateUpdate?(frame: UpdateParams): void; - onResume?(): void; - onPause?(): void; - onDestroy?(): void; -} - -export declare interface ComponentChanged extends ObserverEventParams { - gameObject?: GameObject; - systemName?: string; -} - -declare interface ComponentConstructor> { - componentName: string; - new (params?: ComponentParams): T; -} - -declare type ComponentName = string; - -declare class ComponentObserver { - private events; - add({ component, prop, type, componentName }: ObserverEventParams): void; - getChanged(): ComponentChanged[]; - get changed(): ComponentChanged[]; - clear(): ComponentChanged[]; -} - -export declare function componentObserver(observerInfo?: ObserverInfo): (constructor: any) => void; - -export declare interface ComponentParams { -} - -export declare const decorators: { - IDEProp: typeof IDEProp; - componentObserver: typeof componentObserver; -}; - -declare interface EventParam { - name: string; - resource: ResourceStruct; - success: boolean; - errMsg?: string; -} - -export declare class Game extends EventEmitter { - _scene: Scene; - canvas: HTMLCanvasElement; - playing: boolean; - started: boolean; - multiScenes: Scene[]; - ticker: Ticker; - systems: System[]; - constructor({ systems, frameRate, autoStart, needScene, }?: GameParams); - get scene(): Scene; - set scene(scene: Scene); - get gameObjects(): any[]; - addSystem(S: T): T; - addSystem(S: T, obj?: any): InstanceType; - removeSystem(system: System | SystemType | string): void; - getSystem(S: SystemType | string): System; - pause(): void; - start(): void; - resume(): void; - initTicker(): void; - triggerResume(): void; - triggerPause(): void; - destroySystems(): void; - destroy(): void; - loadScene({ scene, mode, params, }: LoadSceneParams): void; -} - -export declare class GameObject { - private _name; - private _scene; - private _componentCache; - id: number; - components: Component[]; - constructor(name: string, obj?: TransformParams); - get transform(): Transform; - get parent(): GameObject; - get name(): string; - set scene(val: Scene); - get scene(): Scene; - addChild(gameObject: GameObject): void; - removeChild(gameObject: GameObject): GameObject; - addComponent>(C: T): T; - addComponent>(C: ComponentConstructor, obj?: ComponentParams): T; - removeComponent>(c: string): T; - removeComponent>(c: T): T; - removeComponent>(c: ComponentConstructor): T; - private _removeComponent; - getComponent>(c: ComponentConstructor): T; - getComponent(c: string): T; - remove(): GameObject; - destroy(): void; -} - -declare interface GameParams { - autoStart?: boolean; - frameRate?: number; - systems?: System[]; - needScene?: boolean; -} - -export declare function IDEProp(target: any, propertyKey: any): void; - -export declare enum LOAD_EVENT { - 'START' = "start", - 'PROGRESS' = "progress", - 'LOADED' = "loaded", - 'COMPLETE' = "complete", - 'ERROR' = "error" -} - -export declare enum LOAD_SCENE_MODE { - SINGLE = "SINGLE", - MULTI_CANVAS = "MULTI_CANVAS" -} - -declare interface LoadSceneParams { - scene: Scene; - mode?: LOAD_SCENE_MODE; - params?: any; -} - -declare type observableKeys = string | string[]; - -export declare enum OBSERVER_TYPE { - ADD = "ADD", - REMOVE = "REMOVE", - CHANGE = "CHANGE" -} - -declare interface ObserverEventParams { - type: OBSERVER_TYPE; - component: Component; - componentName: string; - prop?: PureObserverProp; -} - -export declare type ObserverInfo = Record; - -declare interface ObserverProp { - deep: boolean; - prop: observableKeys; -} - -declare type ObserverValue = observableKeys | ObserverProp; - -export declare interface PluginStruct { - Components?: typeof Component[]; - Systems?: typeof System[]; -} - -declare class Progress extends EE { - progress: number; - resourceTotal: number; - resourceLoadedCount: number; - resource: Resource; - constructor({ resource, resourceTotal }: { - resource: any; - resourceTotal: any; - }); - onStart(): void; - onProgress(param: EventParam): void; -} - -export declare type PureObserverInfo = Record; - -declare interface PureObserverProp { - deep: boolean; - prop: string[]; -} - -declare class Resource extends EE { - timeout: number; - private resourcesMap; - private makeInstanceFunctions; - private destroyInstanceFunctions; - private promiseMap; - private loaders; - progress: Progress; - constructor(options?: { - timeout: number; - }); - loadConfig(resources: ResourceBase[]): void; - loadSingle(resource: ResourceBase): Promise; - addResource(resources: ResourceBase[]): void; - preload(): void; - getResource(name: string): Promise; - private instance; - destroy(name: string): Promise; - private _destroy; - registerInstance(type: RESOURCE_TYPE | string, callback: ResourceProcessFn): void; - registerDestroy(type: RESOURCE_TYPE | string, callback: ResourceProcessFn): void; - private loadResource; - doComplete(name: any, resolve: any, preload?: boolean): Promise; - checkAllLoaded(name: any): boolean; - getLoader(preload?: boolean): Loader; - private onLoad; - private onError; -} - -export declare const resource: Resource; - -export declare enum RESOURCE_TYPE { - 'IMAGE' = "IMAGE", - 'SPRITE' = "SPRITE", - 'SPRITE_ANIMATION' = "SPRITE_ANIMATION", - 'DRAGONBONE' = "DRAGONBONE", - 'SPINE' = "SPINE", - 'AUDIO' = "AUDIO", - 'VIDEO' = "VIDEO" -} - -declare interface ResourceBase { - name?: string; - type?: RESOURCE_TYPE; - src?: { - json?: SrcBase; - image?: SrcBase; - tex?: SrcBase; - ske?: SrcBase; - video?: SrcBase; - audio?: SrcBase; - [propName: string]: SrcBase; - }; - complete?: boolean; - preload?: boolean; -} - -declare type ResourceProcessFn = (resource: ResourceStruct) => any; - -declare interface ResourceStruct extends ResourceBase { - data?: { - json?: any; - image?: HTMLImageElement; - tex?: any; - ske?: any; - video?: HTMLVideoElement; - audio?: ArrayBuffer; - [propName: string]: any; - }; - instance?: any; -} - -export declare class Scene extends GameObject { - gameObjects: GameObject[]; - canvas: HTMLCanvasElement; - constructor(name: any, obj?: TransformParams); - addGameObject(gameObject: GameObject): void; - removeGameObject(gameObject: GameObject): void; - destroy(): void; -} - -declare interface Size2 { - width: number; - height: number; -} - -declare interface SrcBase { - type: string; - url?: string; - data?: any; -} - -export declare class System { - static systemName: string; - name: string; - static observerInfo: PureObserverInfo; - componentObserver: ComponentObserver; - game: Game; - started: boolean; - __systemDefaultParams: any; - constructor(params?: any); - init?(param?: any): void; - awake?(): void; - start?(): void; - update?(e: UpdateParams): void; - lateUpdate?(e: UpdateParams): void; - onResume?(): void; - onPause?(): void; - onDestroy?(): void; - destroy(): void; -} - -declare type SystemType = typeof System; - -declare class Ticker { - autoStart: boolean; - frameRate: number; - private timeline; - private _frameDuration; - private _tickers; - _requestId: number; - private _lastFrameTime; - private _frameCount; - private _ticker; - private _started; - constructor(options?: TickerOptions); - update(): void; - add(fn: any): void; - remove(fn: any): void; - start(): void; - pause(): void; -} - -declare interface TickerOptions { - autoStart?: boolean; - frameRate?: number; -} - -export declare class Transform extends Component { - static componentName: string; - readonly name: string; - private _parent; - inScene: boolean; - worldTransform: TransformMatrix; - children: Transform[]; - init(params?: TransformParams): void; - position: Vector2; - size: Size2; - origin: Vector2; - anchor: Vector2; - scale: Vector2; - skew: Vector2; - rotation: number; - set parent(val: Transform); - get parent(): Transform; - addChild(child: Transform): void; - removeChild(child: Transform): void; - clearChildren(): void; -} - -declare interface TransformMatrix { - a: number; - b: number; - c: number; - d: number; - tx: number; - ty: number; - array?: number[]; -} - -export declare interface TransformParams extends ComponentParams { - position?: Vector2; - size?: Size2; - origin?: Vector2; - anchor?: Vector2; - scale?: Vector2; - skew?: Vector2; - rotation?: number; -} - -export declare interface UpdateParams { - deltaTime: number; - frameCount: number; - time: number; - currentTime: number; - fps: number; -} - -declare interface Vector2 { - x: number; - y: number; -} - -export { } diff --git a/dist/miniprogram-adapter.d.ts b/dist/miniprogram-adapter.d.ts deleted file mode 100644 index 5c0250b7..00000000 --- a/dist/miniprogram-adapter.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { default as PIXI_2 } from '@eva/miniprogram-pixi'; - -declare const _default: typeof PIXI_2.miniprogram; -export default _default; - -export { } diff --git a/dist/miniprogram-pixi.d.ts b/dist/miniprogram-pixi.d.ts deleted file mode 100644 index 61f33d69..00000000 --- a/dist/miniprogram-pixi.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import * as PIXI_2 from '@tbminiapp/pixi-miniprogram-engine'; -export default PIXI_2; - -export { } diff --git a/dist/plugin-a11y.d.ts b/dist/plugin-a11y.d.ts deleted file mode 100644 index 7701179f..00000000 --- a/dist/plugin-a11y.d.ts +++ /dev/null @@ -1,91 +0,0 @@ -import { Component } from '@eva/eva.js'; -import { ComponentChanged } from '@eva/eva.js'; -import EE from 'eventemitter3'; -import { GameObject } from '@eva/eva.js'; -import { System } from '@eva/eva.js'; -import { Transform } from '@eva/eva.js'; - -export declare class A11y extends Component { - static componentName: string; - interactive: boolean; - hint: string; - event: Component; - delay: number; - role: string; - props: object; - state: object; - attr: object; - a11yId: string; - constructor(param: A11yParams); -} - -export declare enum A11yActivate { - ENABLE = 0, - DISABLE = 1, - CHECK = 2 -} - -declare interface A11yParams { - hint: string; - event?: Component; - delay?: number; - role?: string; - props?: object; - state?: object; - attr?: object; - a11yId?: string; - [propName: string]: string | object | number; -} - -export declare class A11ySystem extends System { - static systemName: string; - div: HTMLDivElement; - debug: boolean; - _ratioX: number; - _ratioY: number; - eventPosition: EventPosition; - activate: boolean; - delay: number; - cache: Map; - eventCache: Map; - constructor(opt?: SystemParam); - get ratioX(): number; - get ratioY(): number; - init(opt?: SystemParam): Promise; - setRatio(): boolean; - getRenderRect(): { - renderWidth: any; - renderHeight: any; - }; - getCanvasBoundingClientRect(): { - width: number; - height: number; - left: number; - top: number; - }; - initDiv(): void; - update(): Promise; - remove(changed: ComponentChanged): void; - add(changed: ComponentChanged): void; - transformChange(changed: ComponentChanged): void; - setEvent(element: HTMLElement, event: EE, gameObject: GameObject, id: any): void; - addEvent(gameObject: GameObject): void; - removeEvent(changed: ComponentChanged): void; - setA11yAttr(element: HTMLElement, component: A11y): void; - setPosition(element: HTMLElement, transform: Transform): void; - onDestroy(): void; -} - -declare interface EventPosition { - x: number; - y: number; -} - -declare interface SystemParam { - debug?: boolean; - activate?: A11yActivate; - delay?: number; - checkA11yOpen?: () => Promise; -} - -export { } diff --git a/dist/plugin-evax.d.ts b/dist/plugin-evax.d.ts deleted file mode 100644 index 1053ae85..00000000 --- a/dist/plugin-evax.d.ts +++ /dev/null @@ -1,57 +0,0 @@ -import { Component } from '@eva/eva.js'; -import { ComponentChanged } from '@eva/eva.js'; -import EventEmitter from 'eventemitter3'; -import { System } from '@eva/eva.js'; - -declare const _default: { - Components: (typeof EvaX)[]; - Systems: (typeof EvaXSystem)[]; -}; -export default _default; - -export declare class EvaX extends Component { - static componentName: string; - constructor(gameObject: any); - evax: EvaXSystem; - events: Events; - init(option?: EvaXParams): void; -} - -declare interface EvaXParams { - events: Events; -} - -export declare class EvaXSystem extends System { - static systemName: string; - store: any; - private ee; - changeList: { - key: string; - oldStore: any; - }[]; - init({ store }?: { - store?: {}; - }): void; - bindDefaultListener(): void; - changeCallback(key: any, oldStore: any): void; - updateStore(store: any): void; - forceUpdateStore(store: any): void; - bindListener(key: any, deep: any): void; - update(): void; - lateUpdate(): void; - add(changed: ComponentChanged): void; - remove(changed: ComponentChanged): void; - on(eventName: any, func: any): EventEmitter; - off(eventName: any, func: any): EventEmitter; - emit(eventName: any, ...args: any[]): boolean; - onDestroy(): void; -} - -declare interface Events { - [propName: string]: Function & { - deep: boolean; - handler: Function; - }; -} - -export { } diff --git a/dist/plugin-matterjs.d.ts b/dist/plugin-matterjs.d.ts deleted file mode 100644 index 429cb1c0..00000000 --- a/dist/plugin-matterjs.d.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { Component } from '@eva/eva.js'; -import { System } from '@eva/eva.js'; - -export declare class Physics extends Component { - static componentName: string; - private bodyParams; - body: any; - private PhysicsEngine; - constructor(params: any); - init(params: any): void; - update(): void; - onDestroy(): void; -} - -export declare class PhysicsSystem extends System { - static systemName: string; - private engine; - init(param?: any): void; - awake(): void; - start(): void; - update(): void; - componentChanged(changed: any): void; - lateUpdate(): void; - onResume(): void; - onPause(): void; - onDestroy(): void; -} - -export declare enum PhysicsType { - RECTANGLE = "rectangle", - CIRCLE = "circle", - POLYGON = "polygon" -} - -export { } diff --git a/dist/plugin-renderer-dragonbone.d.ts b/dist/plugin-renderer-dragonbone.d.ts deleted file mode 100644 index 6fed8364..00000000 --- a/dist/plugin-renderer-dragonbone.d.ts +++ /dev/null @@ -1,64 +0,0 @@ -import { Component } from '@eva/eva.js'; -import { ComponentChanged } from '@eva/eva.js'; -import { ComponentParams } from '@eva/eva.js'; -import { ContainerManager } from '@eva/plugin-renderer'; -import { Renderer } from '@eva/plugin-renderer'; -import { RendererManager } from '@eva/plugin-renderer'; -import { RendererSystem } from '@eva/plugin-renderer'; - -export declare class DragonBone extends Component { - static componentName: string; - private _armature; - private waitPlay; - private waitStop; - private waitPlayInfo; - resource: string; - armatureName: string; - animationName: string; - autoPlay: boolean; - init(obj?: DragonBoneParams): void; - play(name?: string, times?: number): void; - stop(name?: string): void; - set armature(val: DragonBone_2); - get armature(): DragonBone_2; - onDestroy(): void; -} - -declare class DragonBone_2 { - armature: any; - factory: any; - constructor({ armatureName }: { - armatureName: any; - }); - play(name: any, time: any): any; - stop(name: any): any; -} - -export declare interface DragonBoneParams extends ComponentParams { - resource: string; - armatureName: string; - animationName?: string; - autoPlay?: boolean; -} - -export declare class DragonBoneSystem extends Renderer { - static systemName: string; - name: string; - armatures: { - [propName: number]: DragonBone_2; - }; - autoPlay: { - [propName: number]: boolean; - }; - renderSystem: RendererSystem; - rendererManager: RendererManager; - containerManager: ContainerManager; - private isRemovedMap; - init(): void; - componentChanged(changed: ComponentChanged): Promise; - add(changed: ComponentChanged): Promise; - change(changed: ComponentChanged): void; - remove(changed: ComponentChanged): void; -} - -export { } diff --git a/dist/plugin-renderer-event.d.ts b/dist/plugin-renderer-event.d.ts deleted file mode 100644 index c464d83d..00000000 --- a/dist/plugin-renderer-event.d.ts +++ /dev/null @@ -1,55 +0,0 @@ -import { Component } from '@eva/eva.js'; -import { ComponentChanged } from '@eva/eva.js'; -import { ContainerManager } from '@eva/plugin-renderer'; -import { Renderer } from '@eva/plugin-renderer'; -import { RendererManager } from '@eva/plugin-renderer'; -import { RendererSystem } from '@eva/plugin-renderer'; - -declare class Event_2 extends Component { - static componentName: string; - hitArea: HitArea; - init(params?: EventParams): void; -} -export { Event_2 as Event } - -export declare interface EventParams { - hitArea: HitArea; -} - -export declare class EventSystem extends Renderer { - static systemName: string; - name: string; - renderSystem: RendererSystem; - rendererManager: RendererManager; - containerManager: ContainerManager; - init({ moveWhenInside }?: { - moveWhenInside?: boolean; - }): void; - componentChanged(changed: ComponentChanged): void; - add(changed: ComponentChanged): void; - remove(changed: ComponentChanged): void; - change(changed: ComponentChanged): void; - addHitArea(changed: ComponentChanged, container: any, hitArea: any): void; -} - -export declare enum HIT_AREA_TYPE { - Circle = "Circle", - Ellipse = "Ellipse", - Polygon = "Polygon", - Rect = "Rect", - RoundedRect = "RoundedRect" -} - -declare interface HitArea { - type: HIT_AREA_TYPE; - style?: { - x?: number; - y?: number; - radius?: number; - width?: number; - height?: number; - paths?: number[]; - }; -} - -export { } diff --git a/dist/plugin-renderer-graphics.d.ts b/dist/plugin-renderer-graphics.d.ts deleted file mode 100644 index 58e28a1a..00000000 --- a/dist/plugin-renderer-graphics.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { Component } from '@eva/eva.js'; -import { ComponentChanged } from '@eva/eva.js'; -import { ContainerManager } from '@eva/plugin-renderer'; -import { Graphics as Graphics_2 } from '@eva/renderer-adapter'; -import { Renderer } from '@eva/plugin-renderer'; -import { RendererManager } from '@eva/plugin-renderer'; -import { RendererSystem } from '@eva/plugin-renderer'; - -export declare class Graphics extends Component { - static componentName: string; - graphics: Graphics_2; - init(): void; -} - -export declare class GraphicsSystem extends Renderer { - static systemName: string; - name: string; - renderSystem: RendererSystem; - rendererManager: RendererManager; - containerManager: ContainerManager; - init(): void; - componentChanged(changed: ComponentChanged): Promise; -} - -export { } diff --git a/dist/plugin-renderer-img.d.ts b/dist/plugin-renderer-img.d.ts deleted file mode 100644 index 97dde0d2..00000000 --- a/dist/plugin-renderer-img.d.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { Component } from '@eva/eva.js'; -import { ComponentChanged } from '@eva/eva.js'; -import { ContainerManager } from '@eva/plugin-renderer'; -import { GameObject } from '@eva/eva.js'; -import { Renderer } from '@eva/plugin-renderer'; -import { RendererManager } from '@eva/plugin-renderer'; -import { RendererSystem } from '@eva/plugin-renderer'; -import { Sprite } from '@eva/renderer-adapter'; - -export declare class Img extends Component { - static componentName: string; - resource: string; - init(obj?: ImgParams): void; -} - -export declare interface ImgParams { - resource: string; -} - -export declare class ImgSystem extends Renderer { - static systemName: string; - name: string; - imgs: { - [propName: number]: Sprite; - }; - renderSystem: RendererSystem; - rendererManager: RendererManager; - containerManager: ContainerManager; - init(): void; - rendererUpdate(gameObject: GameObject): void; - componentChanged(changed: ComponentChanged): Promise; -} - -export { } diff --git a/dist/plugin-renderer-lottie.d.ts b/dist/plugin-renderer-lottie.d.ts deleted file mode 100644 index 65cbaced..00000000 --- a/dist/plugin-renderer-lottie.d.ts +++ /dev/null @@ -1,69 +0,0 @@ -import { Component } from '@eva/eva.js'; -import { ComponentChanged } from '@eva/eva.js'; -import { ContainerManager } from '@eva/plugin-renderer'; -import { Renderer } from '@eva/plugin-renderer'; -import { RendererManager } from '@eva/plugin-renderer'; - -declare interface ExtendOptions extends IOptions { - autoStart: boolean; -} - -declare interface IExpandOpts { - repeats?: number; - infinite?: boolean; - slot?: Array<{ - name: string; - type: 'TEXT' | 'IMAGE'; - value: string; - style: { - [key: string]: any; - }; - }>; -} - -declare interface IOptions { - resource: string; - width?: number; - height?: number; -} - -export declare class Lottie extends Component { - slot: { - [key: string]: string; - }; - static componentName: string; - static application: any; - anim: any; - options: ExtendOptions; - loadStatus: boolean; - firstPlay: () => void | null; - slotCache: { - [key: string]: any; - }; - prevSlot: { - [name: string]: any; - }; - currentSlot: { - [name: string]: any; - }; - constructor(options: IOptions); - play(params?: number[], expandOpts?: IExpandOpts): void; - playParamsHandle(params: any): any[]; - onTap(name: any, callback: any): void; -} - -export declare class LottieSystem extends Renderer { - static systemName: string; - manager: any; - app: any; - renderSystem: any; - rendererManager: RendererManager; - containerManager: ContainerManager; - managerLife: string[]; - init(): void; - componentChanged(changed: ComponentChanged): Promise; - add(changed: ComponentChanged): Promise; - remove(changed: ComponentChanged): void; -} - -export { } diff --git a/dist/plugin-renderer-mask.d.ts b/dist/plugin-renderer-mask.d.ts deleted file mode 100644 index 24dbd5c0..00000000 --- a/dist/plugin-renderer-mask.d.ts +++ /dev/null @@ -1,71 +0,0 @@ -/// -import { Component } from '@eva/eva.js'; -import { ComponentChanged } from '@eva/eva.js'; -import { ContainerManager } from '@eva/plugin-renderer'; -import { Graphics } from '@eva/renderer-adapter'; -import { Renderer } from '@eva/plugin-renderer'; -import { RendererManager } from '@eva/plugin-renderer'; -import { RendererSystem } from '@eva/plugin-renderer'; -import { Sprite } from '@eva/renderer-adapter'; - -export declare class Mask extends Component { - static componentName: string; - type: MaskParams['type']; - style?: MaskParams['style']; - resource?: string; - spriteName?: string; - init(obj?: MaskParams): void; -} - -export declare enum MASK_TYPE { - Circle = "Circle", - Ellipse = "Ellipse", - Rect = "Rect", - RoundedRect = "RoundedRect", - Polygon = "Polygon", - Img = "Img", - Sprite = "Sprite" -} - -export declare interface MaskParams { - type: MASK_TYPE; - style?: { - x?: number; - y?: number; - radius?: number; - width?: number; - height?: number; - paths?: number[]; - }; - resource?: string; - spriteName?: string; -} - -export declare class MaskSystem extends Renderer { - static systemName: string; - name: string; - changedCache: { - [propName: number]: boolean; - }; - maskSpriteCache: { - [propName: number]: Sprite; - }; - renderSystem: RendererSystem; - rendererManager: RendererManager; - containerManager: ContainerManager; - init(): void; - rendererUpdate(): void; - componentChanged(changed: ComponentChanged): void; - add(changed: ComponentChanged): void; - remove(changed: ComponentChanged): void; - change(changed: ComponentChanged): void; - createGraphics(component: Mask): Graphics; - redrawGraphics(changed: any): void; - draw(graphics: any, component: any): void; - createSprite(component: Mask): PIXI.Sprite; - changeSpriteStyle(component: Mask): void; - changeSprite(component: Mask): void; - setSprite(component: Mask, sprite: any): Promise; -} - -export { } diff --git a/dist/plugin-renderer-nine-patch.d.ts b/dist/plugin-renderer-nine-patch.d.ts deleted file mode 100644 index 6b9aa177..00000000 --- a/dist/plugin-renderer-nine-patch.d.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { Component } from '@eva/eva.js'; -import { ComponentChanged } from '@eva/eva.js'; -import { ContainerManager } from '@eva/plugin-renderer'; -import { GameObject } from '@eva/eva.js'; -import { Renderer } from '@eva/plugin-renderer'; -import { RendererManager } from '@eva/plugin-renderer'; -import { RendererSystem } from '@eva/plugin-renderer'; - -export declare class NinePatch extends Component { - static componentName: string; - ninePatch: any; - resource: string; - spriteName: string; - leftWidth: number; - topHeight: number; - rightWidth: number; - bottomHeight: number; - init(obj?: NinePatchParams): void; -} - -export declare interface NinePatchParams { - resource: string; - spriteName?: string; - leftWidth?: number; - topHeight?: number; - rightWidth?: number; - bottomHeight?: number; -} - -export declare class NinePatchSystem extends Renderer { - static systemName: string; - name: string; - ninePatch: { - [propName: number]: any; - }; - renderSystem: RendererSystem; - rendererManager: RendererManager; - containerManager: ContainerManager; - init(): void; - rendererUpdate(gameObject: GameObject): void; - componentChanged(changed: ComponentChanged): Promise; - add(changed: any): Promise; - remove(changed: any): void; -} - -export { } diff --git a/dist/plugin-renderer-render.d.ts b/dist/plugin-renderer-render.d.ts deleted file mode 100644 index 6729b2a1..00000000 --- a/dist/plugin-renderer-render.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { Component } from '@eva/eva.js'; -import { ComponentChanged } from '@eva/eva.js'; -import { ContainerManager } from '@eva/plugin-renderer'; -import { GameObject } from '@eva/eva.js'; -import { Renderer } from '@eva/plugin-renderer'; -import { RendererManager } from '@eva/plugin-renderer'; -import { RendererSystem } from '@eva/plugin-renderer'; - -export declare class Render extends Component { - static componentName: string; - sortDirty: boolean; - visible: boolean; - alpha: number; - zIndex: number; - sortableChildren: boolean; - init(obj?: RenderParams): void; -} - -export declare interface RenderParams { - alpha?: number; - zIndex?: number; - visible?: boolean; - sortableChildren?: boolean; -} - -export declare class RenderSystem extends Renderer { - static systemName: string; - name: string; - renderSystem: RendererSystem; - rendererManager: RendererManager; - containerManager: ContainerManager; - init(): void; - rendererUpdate(gameObject: GameObject): void; - componentChanged(changed: ComponentChanged): void; - add(changed: ComponentChanged): void; - change(changed: ComponentChanged): void; - remove(changed: ComponentChanged): void; - setDirty(changed: ComponentChanged): void; -} - -export { } diff --git a/dist/plugin-renderer-spine.d.ts b/dist/plugin-renderer-spine.d.ts deleted file mode 100644 index e42ad058..00000000 --- a/dist/plugin-renderer-spine.d.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { Component } from '@eva/eva.js'; -import { ComponentChanged } from '@eva/eva.js'; -import { ContainerManager } from '@eva/plugin-renderer'; -import { DisplayObject } from 'pixi.js'; -import { Renderer } from '@eva/plugin-renderer'; -import { RendererManager } from '@eva/plugin-renderer'; -import { RendererSystem } from '@eva/plugin-renderer'; - -export declare class Spine extends Component { - static componentName: string; - resource: string; - animationName: string; - autoPlay: boolean; - usingResource: string; - armature: any; - destroied: boolean; - addHandler: any; - init(obj?: SpineParams): void; - onDestroy(): void; - play(name?: string, loop?: boolean, track?: number): void; - stop(track?: number): void; - addAnimation(name?: string, delay?: number, loop?: boolean, track?: number): void; - setMix(from: string, to: string, duration: number): void; - getAnim(track?: number): any; - setDefaultMix(duration: number): void; - setAttachment(slotName: string, attachmentName: string): void; - getBone(boneName: string): any; -} - -export declare interface SpineParams { - resource: string; - animationName: string; - autoPlay: boolean; -} - -export declare class SpineSystem extends Renderer { - static systemName: string; - armatures: Record; - renderSystem: RendererSystem; - rendererManager: RendererManager; - containerManager: ContainerManager; - init(): void; - componentChanged(changed: ComponentChanged): Promise; - add(changed: ComponentChanged, count?: number): Promise; - change(changed: ComponentChanged): void; - remove(changed: ComponentChanged): void; -} - -export { } diff --git a/dist/plugin-renderer-spine38.d.ts b/dist/plugin-renderer-spine38.d.ts deleted file mode 100644 index e42ad058..00000000 --- a/dist/plugin-renderer-spine38.d.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { Component } from '@eva/eva.js'; -import { ComponentChanged } from '@eva/eva.js'; -import { ContainerManager } from '@eva/plugin-renderer'; -import { DisplayObject } from 'pixi.js'; -import { Renderer } from '@eva/plugin-renderer'; -import { RendererManager } from '@eva/plugin-renderer'; -import { RendererSystem } from '@eva/plugin-renderer'; - -export declare class Spine extends Component { - static componentName: string; - resource: string; - animationName: string; - autoPlay: boolean; - usingResource: string; - armature: any; - destroied: boolean; - addHandler: any; - init(obj?: SpineParams): void; - onDestroy(): void; - play(name?: string, loop?: boolean, track?: number): void; - stop(track?: number): void; - addAnimation(name?: string, delay?: number, loop?: boolean, track?: number): void; - setMix(from: string, to: string, duration: number): void; - getAnim(track?: number): any; - setDefaultMix(duration: number): void; - setAttachment(slotName: string, attachmentName: string): void; - getBone(boneName: string): any; -} - -export declare interface SpineParams { - resource: string; - animationName: string; - autoPlay: boolean; -} - -export declare class SpineSystem extends Renderer { - static systemName: string; - armatures: Record; - renderSystem: RendererSystem; - rendererManager: RendererManager; - containerManager: ContainerManager; - init(): void; - componentChanged(changed: ComponentChanged): Promise; - add(changed: ComponentChanged, count?: number): Promise; - change(changed: ComponentChanged): void; - remove(changed: ComponentChanged): void; -} - -export { } diff --git a/dist/plugin-renderer-sprite-animation.d.ts b/dist/plugin-renderer-sprite-animation.d.ts deleted file mode 100644 index f01facb4..00000000 --- a/dist/plugin-renderer-sprite-animation.d.ts +++ /dev/null @@ -1,63 +0,0 @@ -import { Component } from '@eva/eva.js'; -import { ComponentChanged } from '@eva/eva.js'; -import { ContainerManager } from '@eva/plugin-renderer'; -import { GameObject } from '@eva/eva.js'; -import { Renderer } from '@eva/plugin-renderer'; -import { RendererManager } from '@eva/plugin-renderer'; -import { RendererSystem } from '@eva/plugin-renderer'; -import { SpriteAnimation as SpriteAnimation_2 } from '@eva/renderer-adapter'; - -export declare class SpriteAnimation extends Component { - static componentName: string; - resource: string; - autoPlay: boolean; - speed: number; - _animate: SpriteAnimation_2; - private waitPlay; - private waitStop; - private times; - private count; - init(obj?: SpriteAnimationParams): void; - play(times?: number): void; - stop(): void; - set animate(val: SpriteAnimation_2); - get animate(): SpriteAnimation_2; - gotoAndPlay(frameNumber: any): void; - gotoAndStop(frameNumber: any): void; -} - -export declare interface SpriteAnimationParams { - resource: string; - autoPlay: boolean; - speed: number; -} - -export declare class SpriteAnimationSystem extends Renderer { - static systemName: string; - name: string; - animates: { - [propName: number]: SpriteAnimation_2; - }; - autoPlay: { - [propName: number]: boolean; - }; - renderSystem: RendererSystem; - rendererManager: RendererManager; - containerManager: ContainerManager; - init(): void; - rendererUpdate(gameObject: GameObject): void; - componentChanged(changed: ComponentChanged): Promise; - add({ frames, id, component }: { - frames: any; - id: any; - component: any; - }): void; - change({ frames, id, component }: { - frames: any; - id: any; - component: any; - }): void; - remove(id: any, isChange?: boolean): void; -} - -export { } diff --git a/dist/plugin-renderer-sprite.d.ts b/dist/plugin-renderer-sprite.d.ts deleted file mode 100644 index f221f437..00000000 --- a/dist/plugin-renderer-sprite.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { Component } from '@eva/eva.js'; -import { ComponentChanged } from '@eva/eva.js'; -import { ContainerManager } from '@eva/plugin-renderer'; -import { GameObject } from '@eva/eva.js'; -import { Renderer } from '@eva/plugin-renderer'; -import { RendererManager } from '@eva/plugin-renderer'; -import { RendererSystem } from '@eva/plugin-renderer'; -import { Sprite as Sprite_2 } from '@eva/renderer-adapter'; - -export declare class Sprite extends Component { - static componentName: string; - resource: string; - spriteName: string; - init(obj?: SpriteParams): void; -} - -export declare interface SpriteParams { - resource: string; - spriteName: string; -} - -export declare class SpriteSystem extends Renderer { - static systemName: string; - name: string; - sprites: { - [propName: number]: Sprite_2; - }; - renderSystem: RendererSystem; - rendererManager: RendererManager; - containerManager: ContainerManager; - init(): void; - rendererUpdate(gameObject: GameObject): void; - componentChanged(changed: ComponentChanged): Promise; -} - -export { } diff --git a/dist/plugin-renderer-text.d.ts b/dist/plugin-renderer-text.d.ts deleted file mode 100644 index 9ba6a09b..00000000 --- a/dist/plugin-renderer-text.d.ts +++ /dev/null @@ -1,70 +0,0 @@ -import { Component } from '@eva/eva.js'; -import { ComponentChanged } from '@eva/eva.js'; -import { ContainerManager } from '@eva/plugin-renderer'; -import { Renderer } from '@eva/plugin-renderer'; -import { RendererManager } from '@eva/plugin-renderer'; -import { RendererSystem } from '@eva/plugin-renderer'; -import { Text as Text_3 } from '@eva/renderer-adapter'; - -declare class Text_2 extends Component { - static componentName: string; - text: string; - style: TextParams['style']; - init(obj?: TextParams): void; -} -export { Text_2 as Text } - -export declare interface TextParams { - text: string; - style: { - align?: string; - breakWords?: boolean; - dropShadow?: boolean; - dropShadowAlpha?: number; - dropShadowAngle?: number; - dropShadowBlur?: number; - dropShadowColor?: string | number; - dropShadowDistance?: number; - fill?: string | string[] | number | number[] | CanvasGradient | CanvasPattern; - fillGradientType?: number; - fillGradientStops?: number[]; - fontFamily?: string | string[]; - fontSize?: number | string; - fontStyle?: string; - fontVariant?: string; - fontWeight?: string; - letterSpacing?: number; - lineHeight?: number; - lineJoin?: string; - miterLimit?: number; - padding?: number; - stroke?: string | number; - strokeThickness?: number; - textBaseline?: string; - trim?: boolean; - whiteSpace?: string; - wordWrap?: boolean; - wordWrapWidth?: number; - leading?: number; - }; -} - -export declare class TextSystem extends Renderer { - static systemName: string; - name: string; - texts: { - [propName: number]: { - text: Text_3; - component: Text_2; - }; - }; - renderSystem: RendererSystem; - rendererManager: RendererManager; - containerManager: ContainerManager; - init(): void; - componentChanged(changed: ComponentChanged): Promise; - change(changed: ComponentChanged): void; - setSize(changed: ComponentChanged): void; -} - -export { } diff --git a/dist/plugin-renderer-tiling-sprite.d.ts b/dist/plugin-renderer-tiling-sprite.d.ts deleted file mode 100644 index 4b6ddf96..00000000 --- a/dist/plugin-renderer-tiling-sprite.d.ts +++ /dev/null @@ -1,44 +0,0 @@ -import { Component } from '@eva/eva.js'; -import { ComponentChanged } from '@eva/eva.js'; -import { ContainerManager } from '@eva/plugin-renderer'; -import { GameObject } from '@eva/eva.js'; -import { Renderer } from '@eva/plugin-renderer'; -import { RendererManager } from '@eva/plugin-renderer'; -import { RendererSystem } from '@eva/plugin-renderer'; -import { TilingSprite as TilingSprite_2 } from '@eva/renderer-adapter'; - -export declare class TilingSprite extends Component { - static componentName: string; - resource: string; - tileScale: TilingSpriteParams['tileScale']; - tilePosition: TilingSpriteParams['tilePosition']; - init(obj?: TilingSpriteParams): void; -} - -export declare interface TilingSpriteParams { - resource: string; - tileScale: { - x: number; - y: number; - }; - tilePosition: { - x: number; - y: number; - }; -} - -export declare class TilingSpriteSystem extends Renderer { - name: string; - imgs: { - [propName: number]: TilingSprite_2; - }; - renderSystem: RendererSystem; - rendererManager: RendererManager; - containerManager: ContainerManager; - init(): void; - rendererUpdate(gameObject: GameObject): void; - componentChanged(changed: ComponentChanged): Promise; - setProp(id: number, component: TilingSprite): void; -} - -export { } diff --git a/dist/plugin-renderer.d.ts b/dist/plugin-renderer.d.ts deleted file mode 100644 index 65c42244..00000000 --- a/dist/plugin-renderer.d.ts +++ /dev/null @@ -1,105 +0,0 @@ -import { Application } from '@eva/renderer-adapter'; -import { ComponentChanged } from '@eva/eva.js'; -import { Container } from '@eva/renderer-adapter'; -import EventEmitter from 'eventemitter3'; -import { Game } from '@eva/eva.js'; -import { GameObject } from '@eva/eva.js'; -import { LOAD_SCENE_MODE } from '@eva/eva.js'; -import { PureObserverInfo } from '@eva/eva.js'; -import { Scene } from '@eva/eva.js'; -import { System } from '@eva/eva.js'; -import { Transform } from '@eva/eva.js'; - -export declare class ContainerManager { - containerMap: { - [propName: number]: Container; - }; - addContainer({ name, container }: { - name: number; - container: Container; - }): void; - getContainer(name: number): Container; - removeContainer(name: number): void; - updateTransform({ name, transform }: { - name: number; - transform: Transform; - }): void; -} - -export declare class Renderer extends System { - name: string; - game: Game; - static observerInfo: PureObserverInfo; - observerInfo: PureObserverInfo; - containerManager: ContainerManager; - rendererManager: RendererManager; - constructor(params?: any); - componentChanged(_changed: ComponentChanged): void; - rendererUpdate(_gameObject: GameObject): void; - update(): void; -} - -export declare enum RENDERER_TYPE { - UNKNOWN = 0, - WEBGL = 1, - CANVAS = 2 -} - -export declare class RendererManager { - game: Game; - rendererSystem: RendererSystem; - constructor({ game, rendererSystem }: { - game: any; - rendererSystem: any; - }); - renderers: Renderer[]; - register(...renderers: Renderer[]): void; - componentChanged(changes: ComponentChanged[]): void; - update(gameObject: GameObject): void; -} - -export declare class RendererSystem extends System { - static systemName: string; - params: any; - rendererManager: RendererManager; - containerManager: ContainerManager; - application: Application; - game: Game; - transform: Transform_2; - multiApps: Application[]; - init(params: any): void; - registerObserver(observerInfo: any): void; - createMultiApplication({ params }: { - params: any; - }): Application; - createApplication(params: any): Application; - update(): void; - lateUpdate(e: any): void; - onDestroy(): void; - resize(width: any, height: any): void; -} - -declare class Transform_2 extends EventEmitter { - name: string; - waitRemoveIds: number[]; - waitSceneId: number; - system: RendererSystem; - containerManager: ContainerManager; - waitChangeScenes: { - scene: Scene; - mode: LOAD_SCENE_MODE; - application: Application; - }[]; - constructor({ system, containerManager }: { - system: any; - containerManager: any; - }); - init(system: RendererSystem): void; - update(): void; - componentChanged(changed: ComponentChanged): void; - addContainer(changed: ComponentChanged): void; - change(changed: ComponentChanged): void; - destroy(): void; -} - -export { } diff --git a/dist/plugin-sound.d.ts b/dist/plugin-sound.d.ts deleted file mode 100644 index 53481c67..00000000 --- a/dist/plugin-sound.d.ts +++ /dev/null @@ -1,84 +0,0 @@ -import { Component } from '@eva/eva.js'; -import { ComponentChanged } from '@eva/eva.js'; -import { System } from '@eva/eva.js'; - -export declare class Sound extends Component { - static componentName: string; - systemContext: AudioContext; - systemDestination: GainNode; - playing: boolean; - state: 'unloaded' | 'loading' | 'loaded'; - config: SoundParams; - private buffer; - private sourceNode; - private gainNode; - private paused; - private playTime; - private startTime; - private duration; - private actionQueue; - private endedListener; - get muted(): boolean; - set muted(v: boolean); - get volume(): number; - set volume(v: number); - init(obj?: SoundParams): void; - play(): void; - pause(): void; - stop(): void; - onload(buffer: AudioBuffer): void; - onDestroy(): void; - private resetConfig; - private getCurrentTime; - private createSource; - private destroySource; -} - -declare interface SoundParams { - resource: string; - autoplay?: boolean; - muted?: boolean; - volume?: number; - loop?: boolean; - seek?: number; - duration?: number; - onEnd?: () => void; -} - -export declare class SoundSystem extends System { - static systemName: string; - private ctx; - private gainNode; - private autoPauseAndStart; - private onError; - private components; - private pausedComponents; - private audioBufferCache; - private decodeAudioPromiseMap; - get muted(): boolean; - set muted(v: boolean); - get volume(): number; - set volume(v: number); - get audioLocked(): boolean; - constructor(obj?: SoundSystemParams); - resumeAll(): void; - pauseAll(): void; - stopAll(): void; - init(): void; - update(): void; - onPlay(): void; - onPause(): void; - onDestroy(): void; - componentChanged(changed: ComponentChanged): Promise; - private setupAudioContext; - private unlockAudio; - private add; - private decodeAudioData; -} - -declare interface SoundSystemParams { - autoPauseAndStart?: boolean; - onError: (error: any) => void; -} - -export { } diff --git a/dist/plugin-stats.d.ts b/dist/plugin-stats.d.ts deleted file mode 100644 index 2944f63c..00000000 --- a/dist/plugin-stats.d.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { Component } from '@eva/eva.js'; -import { System } from '@eva/eva.js'; - -declare const _default: { - Components: (typeof Stats)[]; - Systems: (typeof StatsSystem)[]; -}; -export default _default; - -export declare class Stats extends Component { - static componentName: string; - stats: any; - update(): void; -} - -declare interface StatsParams { - show?: boolean; - style?: { - width: number; - height: number; - x: number; - y: number; - }; -} - -export declare class StatsSystem extends System { - static systemName: string; - show: boolean; - stats: any; - style: any; - component: Stats; - init(param?: StatsParams): void; - start(): void; - lateUpdate(): void; -} - -export { } diff --git a/dist/plugin-transition.d.ts b/dist/plugin-transition.d.ts deleted file mode 100644 index f7044cba..00000000 --- a/dist/plugin-transition.d.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { Component } from '@eva/eva.js'; -import { Group } from '@tweenjs/tween.js'; -import { System } from '@eva/eva.js'; - -declare interface AnimationStruct { - name: string; - component: Component; - values: { - time: number; - value: number; - tween?: string; - }[]; -} - -export declare class Transition extends Component { - static componentName: string; - private animations; - tweenGroup: Group; - group: Record; - init({ group }?: { - group: {}; - }): void; - awake(): void; - play(name: string, iteration: number): void; - stop(name: any): void; - onPause(): void; - onResume(): void; - onDestroy(): void; - update(): void; - newAnimation(name: any): void; -} - -declare interface TransitionParams { - group: Record; -} - -export declare class TransitionSystem extends System { - static systemName: string; - readonly name = "transition"; -} - -export { } diff --git a/dist/renderer-adapter.d.ts b/dist/renderer-adapter.d.ts deleted file mode 100644 index 283305d9..00000000 --- a/dist/renderer-adapter.d.ts +++ /dev/null @@ -1,65 +0,0 @@ -import { Application as Application_2 } from 'pixi.js'; -import { Container as Container_2 } from 'pixi.js'; -import { extras } from 'pixi.js'; -import { Graphics as Graphics_2 } from 'pixi.js'; -import { mesh } from 'pixi.js'; -import { Sprite as Sprite_2 } from 'pixi.js'; -import { Text as Text_3 } from 'pixi.js'; -import { Texture } from 'pixi.js'; - -export declare class Application extends Application_2 { - constructor(params?: any); - [propName: string]: any; -} - -export declare class Container extends Container_2 { - [propName: string]: any; -} - -export declare class Graphics extends Graphics_2 { - [propName: string]: any; -} - -export declare class NinePatch extends mesh.NineSlicePlane { - constructor(img: any, leftWidth: any, topHeight: any, rightWidth: any, bottomHeight: any); -} - -export declare class Sprite { - _image: HTMLImageElement | Texture; - sprite: Sprite_2; - constructor(image: HTMLImageElement | Texture); - set image(val: HTMLImageElement | Texture); - get image(): HTMLImageElement | Texture; -} - -export declare class SpriteAnimation { - animatedSprite: extras.AnimatedSprite; - constructor({ frames }: { - frames: any; - }); - play(): void; - stop(): void; - gotoAndPlay(frameNumber: any): void; - gotoAndStop(frameNumber: any): void; - set speed(val: number); - get speed(): number; -} - -declare class Text_2 extends Text_3 { - text: string; - style: any; - width: number; - height: number; - constructor(text: any, style: any); -} -export { Text_2 as Text } - -export declare class TilingSprite { - _image: HTMLImageElement | Texture; - tilingSprite: any; - constructor(image: HTMLImageElement | Texture); - set image(val: HTMLImageElement | Texture); - get image(): HTMLImageElement | Texture; -} - -export { } diff --git a/vite-test/README.MD b/examples/README.md similarity index 70% rename from vite-test/README.MD rename to examples/README.md index c9120025..3662da52 100644 --- a/vite-test/README.MD +++ b/examples/README.md @@ -1,6 +1,6 @@ # How to use vite to develop Eva.js -For an development example, You just need create an ts module file in dir ./vite-test/ts. This module must export a function named 'init' which accepts an param whose type is HTMLCanvasElement. By the way, this module also export an string named 'name' as new page's title. +For an development example, You just need create an ts module file in dir ./examples/ts. This module must export a function named 'init' which accepts an param whose type is HTMLCanvasElement. By the way, this module also export an string named 'name' as new page's title. Example: diff --git a/examples/a11y/index.html b/examples/a11y/index.html deleted file mode 100644 index 633d7525..00000000 --- a/examples/a11y/index.html +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - eva-plugin-a11y - - - - - - - - - - - - - - - - - - - - - diff --git a/examples/a11y/index.js b/examples/a11y/index.js deleted file mode 100644 index d507f2e3..00000000 --- a/examples/a11y/index.js +++ /dev/null @@ -1,106 +0,0 @@ -resource.addResource([ - { - name: 'tree', - type: RESOURCE_TYPE.DRAGONBONE, - src: { - ske: '//gw.alicdn.com/bao/uploaded/TB1SFUHVAzoK1RjSZFlXXai4VXa.json', - tex: '//gw.alicdn.com/bao/uploaded/TB17n.IVrrpK1RjSZTEXXcWAVXa.json', - image: - '//gw.alicdn.com/bao/uploaded/TB11W7FVyrpK1RjSZFhXXXSdXXa-489-886.png', - }, - }, - { - name: 'image', - type: RESOURCE_TYPE.IMAGE, - src: { - image: { - type: 'png', - url: - 'https://gw.alicdn.com/tfs/TB1DNzoOvb2gK0jSZK9XXaEgFXa-658-1152.webp', - }, - }, - preload: true, - }, - { - name: 'spriteName', - type: RESOURCE_TYPE.SPRITE, - src: { - image: { - type: 'png', - url: - 'https://gw.alicdn.com/tfs/TB1ONLxOAL0gK0jSZFAXXcA9pXa-900-730.png', - }, - json: { - type: 'json', - url: - 'https://pages.tmall.com/wow/eva/ad317f6aea149d9a8b34a517e5df2caf.json', - }, - }, - preload: true, - }, - { - name: 'heart', - type: RESOURCE_TYPE.IMAGE, - src: { - image: - '//gw.alicdn.com/bao/uploaded/TB1lVHuaET1gK0jSZFhXXaAtVXa-200-200.png', - }, - preload: false, - }, - { - name: 'anim', - // @ts-ignore - type: 'SPINE', - src: { - ske: { - type: 'json', - url: - 'https://pages.tmall.com/wow/eva/b5fdf74313d5ff2609ab82f6b6fd83e6.json', - }, - // @ts-ignore - atlas: { - type: 'atlas', - url: - 'https://pages.tmall.com/wow/eva/b8597f298a5d6fe47095d43ef03210d4.atlas', - }, - image: { - type: 'png', - url: - 'https://gw.alicdn.com/tfs/TB1YHC8Vxz1gK0jSZSgXXavwpXa-711-711.png', - }, - }, - }, -]); - -const game = new Game({ - systems: [ - new RendererSystem({ - canvas: document.querySelector('canvas'), - width: 750, - height: 1000, - }), - new TextSystem(), - new ImgSystem(), - new SpriteSystem(), - new EventSystem(), - new SpineSystem(), - new A11ySystem({ - debug: true, - activate: A11yActivate.CHECK, - }), - ], - autoStart: true, - frameRate: 60, -}); - -game.scene.transform.size = { - width: 750, - height: 1000, -}; -// @ts-ignore -window.game = game; -loadText(game); -loadImage(game); -loadSprite(game); -loadEvent(game); -loadSpine(game); diff --git a/examples/a11y/loadResource.js b/examples/a11y/loadResource.js deleted file mode 100644 index a6ac47d5..00000000 --- a/examples/a11y/loadResource.js +++ /dev/null @@ -1,278 +0,0 @@ -const loadText = game => { - const text = new GameObject('text', { - position: { - x: 0, - y: 0, - }, - origin: { - x: 0, - y: 0, - }, - anchor: { - x: 0, - y: 0, - }, - }); - text.addComponent( - new Text({ - text: '欢迎试用EVA互动游戏开发体系!', - style: { - fontFamily: 'Arial', - fontSize: 36, - fontStyle: 'italic', - fontWeight: 'bold', - fill: ['#b35d9e', '#84c35f', '#ebe44f'], // gradient - fillGradientType: 1, - fillGradientStops: [0.1, 0.4], - stroke: '#4a1850', - strokeThickness: 5, - dropShadow: true, - dropShadowColor: '#000000', - dropShadowBlur: 4, - dropShadowAngle: Math.PI / 6, - dropShadowDistance: 6, - wordWrap: true, - wordWrapWidth: 1000, - breakWords: true, - }, - }), - ); - setTimeout(() => { - game.scene.addChild(text); - }, 1000); - setTimeout(() => { - text.addComponent(new A11y({hint: 'aaaa'})); - }, 2000); - // setTimeout(() => { - // text.addComponent(new A11y({ hint: 'aaaa' })) - // }, 3000); - setTimeout(() => { - game.scene.removeChild(text); - }, 4000); - - // text.removeComponent('A11y') -}; -const loadImage = game => { - const image = new GameObject('image', { - size: {width: 600, height: 400}, - origin: {x: 0.5, y: 0.5}, - scale: {x: 0.8, y: 0.8}, - anchor: { - x: 0.5, - y: 0.5, - }, - position: { - x: 0, - y: 0, - }, - }); - - image.addComponent( - new Img({ - resource: 'image', - }), - ); - image.addComponent( - new A11y({hint: '这是一张图片', 'aria-aaa': '123', delay: 100}), - ); - // @ts-ignore - window.image = image; - game.scene.addChild(image); - setTimeout(() => { - // game.scene.removeChild(image); - }, 2000); -}; -const loadSprite = game => { - const gameObj1 = new GameObject('symbol_1', { - size: {width: 20, height: 20}, - position: { - x: 120, - y: 500, - }, - }); - - const spriteCom1 = new Sprite({ - resource: 'spriteName', - spriteName: 'symbol_1', - }); - - gameObj1.addComponent(spriteCom1); - - const gameObj2 = new GameObject('symbol_2', { - size: {width: 20, height: 20}, - position: { - x: 0, - y: 500, - }, - }); - - const spriteCom2 = new Sprite({ - resource: 'spriteName', - spriteName: 'symbol_2', - }); - - gameObj2.addComponent(spriteCom2); - - const gameObj3 = new GameObject('symbol_3', { - size: {width: 20, height: 20}, - position: { - x: 30, - y: 500, - }, - }); - - const spriteCom3 = new Sprite({ - resource: 'spriteName', - spriteName: 'symbol_3', - }); - - gameObj3.addComponent(spriteCom3); - - const gameObj4 = new GameObject('symbol_4', { - size: {width: 20, height: 20}, - position: { - x: 60, - y: 500, - }, - }); - - const spriteCom4 = new Sprite({ - resource: 'spriteName', - spriteName: 'symbol_4', - }); - - gameObj4.addComponent(spriteCom4); - - const gameObj5 = new GameObject('symbol_5', { - size: {width: 20, height: 20}, - position: { - x: 90, - y: 500, - }, - }); - - const spriteCom5 = new Sprite({ - resource: 'spriteName', - spriteName: 'symbol_5', - }); - - gameObj5.addComponent(spriteCom5); - gameObj1.addComponent( - new A11y({ - hint: 'sprite 1', - attr: { - 'tab-index': '0', - }, - }), - ); - gameObj2.addComponent( - new A11y({ - hint: 'sprite 2', - }), - ); - gameObj3.addComponent( - new A11y({ - hint: 'sprite 3', - }), - ); - gameObj4.addComponent( - new A11y({ - hint: 'sprite 4', - }), - ); - gameObj5.addComponent( - new A11y({ - hint: 'sprite 5', - }), - ); - - gameObj5.removeComponent('A11y'); - - game.scene.addChild(gameObj1); - game.scene.addChild(gameObj2); - game.scene.addChild(gameObj3); - game.scene.addChild(gameObj4); - game.scene.addChild(gameObj5); -}; - -const loadEvent = game => { - const image = new GameObject('image', { - size: {width: 200, height: 200}, - origin: {x: 0, y: 1}, - position: { - x: 0, - y: 0, - }, - anchor: {x: 0, y: 1}, - }); - const img = image.addComponent( - new Img({ - resource: 'heart', - }), - ); - - const evt = image.addComponent( - new Event({ - // 使用这个属性设置交互事件可以触发的区域,骨骼动画有所变差,可以临时在当前游戏对象下添加一个同类型同属性的Graphic查看具体点击位置。 - hitArea: { - type: HIT_AREA_TYPE.Polygon, - style: { - paths: [ - 109, - 48, - 161, - 21, - 194, - 63, - 193, - 104, - 65, - 176, - 8, - 86, - 38, - 40, - 90, - 33, - ], - }, - }, - }), - ); - //@ts-ignore - evt.on('touchstart', e => { - // alert('弹窗') - console.log(e); - console.log('touchstart'); - }); - image.addComponent(new A11y({hint: '双击触发弹窗'})); - - game.scene.addChild(image); -}; -const loadSpine = game => { - const gameObject = new GameObject('spine', { - position: { - x: 500, - y: 500, - }, - scale: { - x: 0.5, - y: 0.5, - }, - }); - const spine = new Spine({resource: 'anim', animationName: 'idle'}); - gameObject.addComponent(spine); - spine.on('complete', e => { - console.log('动画播放结束', e.name); - }); - spine.play('idle'); - - gameObject.addComponent( - new A11y({ - hint: 'hint', - // delay: 100 - }), - ); - - game.scene.addChild(gameObject); -}; diff --git a/examples/bench/.gitkeep b/examples/bench/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/examples/component.html b/examples/component.html deleted file mode 100644 index 8e45e5c4..00000000 --- a/examples/component.html +++ /dev/null @@ -1,171 +0,0 @@ - - - - - - Component - - - - - - - - - - - - - diff --git a/examples/dragonbone.html b/examples/dragonbone.html deleted file mode 100644 index 993f40b3..00000000 --- a/examples/dragonbone.html +++ /dev/null @@ -1,83 +0,0 @@ - - - - - - DragonBone - - - - - - - - - - - - - - diff --git a/examples/event.html b/examples/event.html deleted file mode 100644 index 299d912f..00000000 --- a/examples/event.html +++ /dev/null @@ -1,101 +0,0 @@ - - - - - - Event - - - - - - - - - - - - - - diff --git a/examples/graphics.html b/examples/graphics.html deleted file mode 100644 index e8ce352c..00000000 --- a/examples/graphics.html +++ /dev/null @@ -1,76 +0,0 @@ - - - - - - Graphics - - - - - - - - - - - - - diff --git a/examples/image.html b/examples/image.html deleted file mode 100644 index ed804f28..00000000 --- a/examples/image.html +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - Image - - - - - - - - - - - - - diff --git a/examples/index.html b/examples/index.html index 5cddf8cc..7e73edc5 100644 --- a/examples/index.html +++ b/examples/index.html @@ -4,31 +4,26 @@ - Index + Eva.js Examples + + - + diff --git a/examples/index.ts b/examples/index.ts new file mode 100644 index 00000000..95a56739 --- /dev/null +++ b/examples/index.ts @@ -0,0 +1,40 @@ +import VConsole from 'vconsole'; + +type ExampleModule = () => Promise<{ + name: string; + init: (canvas: HTMLCanvasElement) => void; +}>; +// @ts-ignore +const modules: Record = import.meta.glob('./src/*.ts'); + +window.addEventListener('hashchange', () => { + location.reload(); +}) + +const path = location.hash.replace('#', ''); +if (modules[path]) { + (async () => { + const canvas = document.createElement('canvas'); + canvas.id = 'canvas'; + document.body.appendChild(canvas); + const module = await modules[path](); + document.title = module.name; + module.init(canvas); + })(); + if (/android|phone|mobile|ipad/i.test(navigator.userAgent) && location.search.length < 1) { + new VConsole(); + } +} else { + const ul = document.createElement('ul'); + Object.keys(modules).forEach(url => { + const li = document.createElement('li'); + ul.appendChild(li); + const link = document.createElement('a'); + li.appendChild(link); + const pathname = url.split('/').pop().split('.ts')[0]; + link.href = `#${url}` + link.innerText = pathname; + link.addEventListener('click', () => location.hash = url); + }) + document.body.appendChild(ul); +} diff --git a/examples/lottie.html b/examples/lottie.html deleted file mode 100644 index c2cbe716..00000000 --- a/examples/lottie.html +++ /dev/null @@ -1,159 +0,0 @@ - - - - - - Lottie - - - - -
- - - - - - - - - - diff --git a/examples/mars.html b/examples/mars.html deleted file mode 100644 index 8cf11e23..00000000 --- a/examples/mars.html +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - Mars - - - - - - - - - - - - - diff --git a/examples/mask.html b/examples/mask.html deleted file mode 100644 index f6747c23..00000000 --- a/examples/mask.html +++ /dev/null @@ -1,141 +0,0 @@ - - - - - - Mask - - - - - - - - - - - - - - - diff --git a/examples/matterjs.html b/examples/matterjs.html deleted file mode 100644 index 419e5737..00000000 --- a/examples/matterjs.html +++ /dev/null @@ -1,475 +0,0 @@ - - - - - - MatterJS - - - - -
- -
- - - - - - - - - - - - - diff --git a/examples/multi-canvas.html b/examples/multi-canvas.html deleted file mode 100644 index b03fb577..00000000 --- a/examples/multi-canvas.html +++ /dev/null @@ -1,104 +0,0 @@ - - - - - - Mutli Canvas - - - - - - - - - - - - - - diff --git a/examples/ninePatch.html b/examples/ninePatch.html deleted file mode 100644 index d4dd5bed..00000000 --- a/examples/ninePatch.html +++ /dev/null @@ -1,97 +0,0 @@ - - - - - - NinePatch - - - - - - - - - - - - - diff --git a/vite-test/public/person.astc.ktx b/examples/public/person.astc.ktx similarity index 100% rename from vite-test/public/person.astc.ktx rename to examples/public/person.astc.ktx diff --git a/vite-test/public/person.etc.ktx b/examples/public/person.etc.ktx similarity index 100% rename from vite-test/public/person.etc.ktx rename to examples/public/person.etc.ktx diff --git a/vite-test/public/person.pvrtc.ktx b/examples/public/person.pvrtc.ktx similarity index 100% rename from vite-test/public/person.pvrtc.ktx rename to examples/public/person.pvrtc.ktx diff --git a/vite-test/public/person.s3tc.ktx b/examples/public/person.s3tc.ktx similarity index 100% rename from vite-test/public/person.s3tc.ktx rename to examples/public/person.s3tc.ktx diff --git a/vite-test/public/shannon.astc.ktx b/examples/public/shannon.astc.ktx similarity index 100% rename from vite-test/public/shannon.astc.ktx rename to examples/public/shannon.astc.ktx diff --git a/vite-test/public/shannon.etc.ktx b/examples/public/shannon.etc.ktx similarity index 100% rename from vite-test/public/shannon.etc.ktx rename to examples/public/shannon.etc.ktx diff --git a/vite-test/public/shannon.png b/examples/public/shannon.png similarity index 100% rename from vite-test/public/shannon.png rename to examples/public/shannon.png diff --git a/vite-test/public/shannon.pvrtc.ktx b/examples/public/shannon.pvrtc.ktx similarity index 100% rename from vite-test/public/shannon.pvrtc.ktx rename to examples/public/shannon.pvrtc.ktx diff --git a/vite-test/public/shannon.s3tc.ktx b/examples/public/shannon.s3tc.ktx similarity index 100% rename from vite-test/public/shannon.s3tc.ktx rename to examples/public/shannon.s3tc.ktx diff --git a/vite-test/public/yanhua.astc.ktx b/examples/public/yanhua.astc.ktx similarity index 100% rename from vite-test/public/yanhua.astc.ktx rename to examples/public/yanhua.astc.ktx diff --git a/vite-test/public/yanhua.etc.ktx b/examples/public/yanhua.etc.ktx similarity index 100% rename from vite-test/public/yanhua.etc.ktx rename to examples/public/yanhua.etc.ktx diff --git a/vite-test/public/yanhua.png b/examples/public/yanhua.png similarity index 100% rename from vite-test/public/yanhua.png rename to examples/public/yanhua.png diff --git a/vite-test/public/yanhua.pvrtc.ktx b/examples/public/yanhua.pvrtc.ktx similarity index 100% rename from vite-test/public/yanhua.pvrtc.ktx rename to examples/public/yanhua.pvrtc.ktx diff --git a/vite-test/public/yanhua.s3tc.ktx b/examples/public/yanhua.s3tc.ktx similarity index 100% rename from vite-test/public/yanhua.s3tc.ktx rename to examples/public/yanhua.s3tc.ktx diff --git a/examples/sound.html b/examples/sound.html deleted file mode 100644 index 1342c46b..00000000 --- a/examples/sound.html +++ /dev/null @@ -1,251 +0,0 @@ - - - - - - - eva-plugin-sound - - - - - - - - - - - - - - - diff --git a/examples/spine.html b/examples/spine.html deleted file mode 100644 index 4928736f..00000000 --- a/examples/spine.html +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - Spine - - - - - - - - - - - - - diff --git a/examples/sprite.html b/examples/sprite.html deleted file mode 100644 index 19ddd81f..00000000 --- a/examples/sprite.html +++ /dev/null @@ -1,134 +0,0 @@ - - - - - - Sprite - - - - - - - - - - - - - diff --git a/examples/spriteAnimation.html b/examples/spriteAnimation.html deleted file mode 100644 index 3456666d..00000000 --- a/examples/spriteAnimation.html +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - Sprite Animation - - - - - - - - - - - - - diff --git a/vite-test/ts/a11y.ts b/examples/src/a11y.ts similarity index 100% rename from vite-test/ts/a11y.ts rename to examples/src/a11y.ts diff --git a/vite-test/ts/component.ts b/examples/src/component.ts similarity index 100% rename from vite-test/ts/component.ts rename to examples/src/component.ts diff --git a/examples/src/compressed-texture.ts b/examples/src/compressed-texture.ts new file mode 100644 index 00000000..cb6fa382 --- /dev/null +++ b/examples/src/compressed-texture.ts @@ -0,0 +1,71 @@ +// import { Game, GameObject, resource, RESOURCE_TYPE } from "../../packages/eva.js/lib"; +// import { INTERNAL_FORMATS, RendererSystem } from "../../packages/plugin-renderer/lib"; +// import { Img, ImgSystem } from "../../packages/plugin-renderer-img/lib"; +// import { useCompressedTexture } from "../../packages/plugin-renderer/lib"; + +// export const name = 'compressed-textures'; + +// export async function init(canvas: HTMLCanvasElement) { +// useCompressedTexture(resource); +// resource.addResource([ +// { +// name: 'imageName', +// type: RESOURCE_TYPE.IMAGE, +// src: { +// image: { +// type: 'png', +// url: './person.png', +// texture: [{ +// type: 'etc', +// internalFormat: INTERNAL_FORMATS.COMPRESSED_RGBA_ASTC_4x4_KHR, +// url: './person.etc.ktx' +// }, { +// type: 'astc', +// internalFormat: INTERNAL_FORMATS.COMPRESSED_RGBA_ASTC_4x4_KHR, +// url: './person.astc.ktx' +// }, { +// type: 's3tc', +// internalFormat: INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT5_EXT, +// url: './person.s3tc.ktx' +// },] +// }, +// }, +// preload: false, +// }, +// ]); +// const game = new Game({ +// systems: [ +// new RendererSystem({ +// canvas, +// width: window.innerWidth, +// height: window.innerHeight, +// backgroundColor: '0xff0000', +// useCompressedTexture: true +// }), +// new ImgSystem(), +// ], +// }); +// // const res = await resource.getResource('imageName'); +// const image = new GameObject('image', { +// size: { width: window.innerWidth, height: window.innerWidth }, +// origin: { x: 0, y: 0 }, +// position: { +// x: 0, +// y: 0, +// }, +// anchor: { +// x: 0, +// y: 0, +// }, +// }); +// //@ts-ignore +// const img = new Img({ +// resource: 'imageName', +// }); +// image.addComponent( +// ///@ts-ignore +// img, +// ); + +// game.scene.addChild(image); +// } \ No newline at end of file diff --git a/vite-test/ts/dragonbone.ts b/examples/src/dragonbone.ts similarity index 100% rename from vite-test/ts/dragonbone.ts rename to examples/src/dragonbone.ts diff --git a/vite-test/ts/event.ts b/examples/src/event.ts similarity index 100% rename from vite-test/ts/event.ts rename to examples/src/event.ts diff --git a/vite-test/ts/graphics.ts b/examples/src/graphics.ts similarity index 100% rename from vite-test/ts/graphics.ts rename to examples/src/graphics.ts diff --git a/vite-test/ts/image.ts b/examples/src/image.ts similarity index 100% rename from vite-test/ts/image.ts rename to examples/src/image.ts diff --git a/vite-test/ts/loader.ts b/examples/src/loader.ts similarity index 100% rename from vite-test/ts/loader.ts rename to examples/src/loader.ts diff --git a/vite-test/ts/lottie.ts b/examples/src/lottie.ts similarity index 100% rename from vite-test/ts/lottie.ts rename to examples/src/lottie.ts diff --git a/vite-test/ts/mask.ts b/examples/src/mask.ts similarity index 100% rename from vite-test/ts/mask.ts rename to examples/src/mask.ts diff --git a/vite-test/ts/matter.ts b/examples/src/matter.ts similarity index 100% rename from vite-test/ts/matter.ts rename to examples/src/matter.ts diff --git a/vite-test/ts/multi-canvas.ts b/examples/src/multi-canvas.ts similarity index 100% rename from vite-test/ts/multi-canvas.ts rename to examples/src/multi-canvas.ts diff --git a/vite-test/ts/ninePatch.ts b/examples/src/ninePatch.ts similarity index 100% rename from vite-test/ts/ninePatch.ts rename to examples/src/ninePatch.ts diff --git a/vite-test/ts/sound.ts b/examples/src/sound.ts similarity index 100% rename from vite-test/ts/sound.ts rename to examples/src/sound.ts diff --git a/vite-test/ts/spine.ts b/examples/src/spine.ts similarity index 100% rename from vite-test/ts/spine.ts rename to examples/src/spine.ts diff --git a/vite-test/ts/sprite.ts b/examples/src/sprite.ts similarity index 100% rename from vite-test/ts/sprite.ts rename to examples/src/sprite.ts diff --git a/vite-test/ts/spriteAnimation.ts b/examples/src/spriteAnimation.ts similarity index 61% rename from vite-test/ts/spriteAnimation.ts rename to examples/src/spriteAnimation.ts index 77b55fea..67230d91 100644 --- a/vite-test/ts/spriteAnimation.ts +++ b/examples/src/spriteAnimation.ts @@ -1,10 +1,9 @@ -import { Game, GameObject, resource, RESOURCE_TYPE } from "@eva/eva.js"; -import { RendererSystem } from "@eva/plugin-renderer"; -import { SpriteAnimationSystem, SpriteAnimation } from "@eva/plugin-renderer-sprite-animation"; +import { Game, GameObject, resource, RESOURCE_TYPE } from '@eva/eva.js'; +import { RendererSystem } from '@eva/plugin-renderer'; +import { SpriteAnimationSystem, SpriteAnimation } from '@eva/plugin-renderer-sprite-animation'; export const name = 'spriteAnimation'; export async function init(canvas) { - resource.addResource([ { name: 'fruit', @@ -35,30 +34,29 @@ export async function init(canvas) { }); const cut = new GameObject('cut', { - position: {x: 225, y: 400}, - size: {width: 300, height: 200}, - origin: {x: 0, y: 0}, + position: { x: 225, y: 400 }, + size: { width: 300, height: 200 }, + origin: { x: 0, y: 0 }, }); const frame = cut.addComponent( new SpriteAnimation({ resource: 'fruit', speed: 100, - autoPlay:true, + autoPlay: true, }), ); frame.play(4); - frame.on('onComplete', () =>{ - console.log('onComplete') - }) - frame.on('onLoop', () =>{ - console.log('onLoop') - }) - frame.on('onFrameChange', () =>{ - console.log('onFrameChange') - }) - + frame.on('onComplete', () => { + console.log('onComplete'); + }); + frame.on('onLoop', () => { + console.log('onLoop'); + }); + frame.on('onFrameChange', () => { + console.log('onFrameChange'); + }); game.scene.addChild(cut); -} \ No newline at end of file +} diff --git a/vite-test/ts/text.ts b/examples/src/text.ts similarity index 100% rename from vite-test/ts/text.ts rename to examples/src/text.ts diff --git a/vite-test/ts/tilingSprite.ts b/examples/src/tilingSprite.ts similarity index 100% rename from vite-test/ts/tilingSprite.ts rename to examples/src/tilingSprite.ts diff --git a/vite-test/ts/transition.ts b/examples/src/transition.ts similarity index 100% rename from vite-test/ts/transition.ts rename to examples/src/transition.ts diff --git a/examples/text.html b/examples/text.html deleted file mode 100644 index d311539b..00000000 --- a/examples/text.html +++ /dev/null @@ -1,82 +0,0 @@ - - - - - - Image - - - - - - - - - - - - - diff --git a/examples/tilingSprite.html b/examples/tilingSprite.html deleted file mode 100644 index a597b057..00000000 --- a/examples/tilingSprite.html +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - Tiling Sprite - - - - - - - - - - - - - diff --git a/examples/transition.html b/examples/transition.html deleted file mode 100644 index c98bdd87..00000000 --- a/examples/transition.html +++ /dev/null @@ -1,157 +0,0 @@ - - - - - - Transition - - - - - - - - - - - - - - - diff --git a/examples/vite-env.d.ts b/examples/vite-env.d.ts new file mode 100644 index 00000000..11f02fe2 --- /dev/null +++ b/examples/vite-env.d.ts @@ -0,0 +1 @@ +/// diff --git a/jest.config.js b/jest.config.js index 32e079cc..5a2ef5a9 100644 --- a/jest.config.js +++ b/jest.config.js @@ -18,10 +18,7 @@ module.exports = { coverageDirectory: 'coverage', coverageReporters: ['html', 'json', 'lcov'], collectCoverageFrom: ['packages/eva.js/lib/**/*.ts', '!packages/eva.js/lib/loader/resource-loader'], - moduleNameMapper: { - ...moduleNameMapper, - '^sprite-timline/src/index$': 'node_modules/sprite-timeline/src/index.js', - }, + moduleNameMapper, transform: { '^.+\\.(ts|js)?$': 'ts-jest', }, diff --git a/package-lock.json b/package-lock.json deleted file mode 100644 index d24ca016..00000000 --- a/package-lock.json +++ /dev/null @@ -1,28550 +0,0 @@ -{ - "name": "eva.js", - "version": "1.0.12-alpha.1", - "lockfileVersion": 2, - "requires": true, - "packages": { - "": { - "version": "1.0.12-alpha.1", - "dependencies": { - "@tweenjs/tween.js": "^18.6.4", - "core-js": "^3.16.0", - "eventemitter3": "^4.0.7", - "ios-version": "^1.0.1", - "lodash": "^4.17.21", - "pixi.js": "^4.8.7", - "resource-loader": "^4.0.0-rc4" - }, - "devDependencies": { - "@microsoft/api-documenter": "^7.5.4", - "@microsoft/api-extractor": "^7.11.2", - "@rollup/plugin-alias": "^3.1.1", - "@rollup/plugin-commonjs": "^17.1.0", - "@rollup/plugin-json": "^4.1.0", - "@rollup/plugin-node-resolve": "^13.0.2", - "@types/jest": "^24.9.1", - "@types/lodash-es": "^4.17.4", - "@types/node": "^10.17.13", - "@types/pixi.js": "^4.8.7", - "@typescript-eslint/eslint-plugin": "^1.13.0", - "@typescript-eslint/parser": "^1.13.0", - "brotli": "^1.3.2", - "chalk": "^4.1.0", - "enquirer": "^2.3.6", - "eslint": "^6.2.2", - "eslint-config-prettier": "^6.1.0", - "eslint-plugin-prettier": "^3.1.0", - "execa": "^4.1.0", - "fs-extra": "^9.0.1", - "glob": "^7.1.3", - "http-server": "^0.11.1", - "jest": "^24.9.0", - "lerna": "^3.22.1", - "minimist": "^1.2.5", - "prettier": "^2.2.1", - "rollup": "^2.40.0", - "rollup-plugin-analyzer": "^3.2.1", - "rollup-plugin-copy": "^3.4.0", - "rollup-plugin-import-alias": "^1.0.10", - "rollup-plugin-inject": "^3.0.2", - "rollup-plugin-livereload": "^1.3.0", - "rollup-plugin-modify": "^3.0.0", - "rollup-plugin-node-resolve": "^5.2.0", - "rollup-plugin-polyfill-node": "^0.6.2", - "rollup-plugin-replace": "^2.2.0", - "rollup-plugin-serve": "^1.1.0", - "rollup-plugin-sourcemaps": "^0.4.2", - "rollup-plugin-terser": "^7.0.2", - "rollup-plugin-typescript2": "^0.24.3", - "rollup-plugin-visualizer": "^4.2.0", - "rollup-watch": "^4.3.1", - "selenium-server": "^3.141.59", - "semver": "^7.3.2", - "sinon": "^7.5.0", - "terser": "^4.2.1", - "ts-jest": "^24.3.0", - "tslib": "^1.9.3", - "typedoc": "^0.15.0", - "typescript": "^3.6.4", - "zlib": "^1.0.5" - }, - "engines": { - "node": ">=14.14.0" - } - }, - "node_modules/@babel/code-frame": { - "version": "7.12.13", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/highlight": "^7.12.13" - } - }, - "node_modules/@babel/compat-data": { - "version": "7.13.8", - "dev": true, - "license": "MIT" - }, - "node_modules/@babel/core": { - "version": "7.13.10", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/code-frame": "^7.12.13", - "@babel/generator": "^7.13.9", - "@babel/helper-compilation-targets": "^7.13.10", - "@babel/helper-module-transforms": "^7.13.0", - "@babel/helpers": "^7.13.10", - "@babel/parser": "^7.13.10", - "@babel/template": "^7.12.13", - "@babel/traverse": "^7.13.0", - "@babel/types": "^7.13.0", - "convert-source-map": "^1.7.0", - "debug": "^4.1.0", - "gensync": "^1.0.0-beta.2", - "json5": "^2.1.2", - "lodash": "^4.17.19", - "semver": "^6.3.0", - "source-map": "^0.5.0" - }, - "engines": { - "node": ">=6.9.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/babel" - } - }, - "node_modules/@babel/core/node_modules/semver": { - "version": "6.3.0", - "dev": true, - "license": "ISC", - "bin": { - "semver": "bin/semver.js" - } - }, - "node_modules/@babel/core/node_modules/source-map": { - "version": "0.5.7", - "dev": true, - "license": "BSD-3-Clause", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/@babel/generator": { - "version": "7.13.9", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/types": "^7.13.0", - "jsesc": "^2.5.1", - "source-map": "^0.5.0" - } - }, - "node_modules/@babel/generator/node_modules/source-map": { - "version": "0.5.7", - "dev": true, - "license": "BSD-3-Clause", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/@babel/helper-compilation-targets": { - "version": "7.13.10", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/compat-data": "^7.13.8", - "@babel/helper-validator-option": "^7.12.17", - "browserslist": "^4.14.5", - "semver": "^6.3.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0" - } - }, - "node_modules/@babel/helper-compilation-targets/node_modules/semver": { - "version": "6.3.0", - "dev": true, - "license": "ISC", - "bin": { - "semver": "bin/semver.js" - } - }, - "node_modules/@babel/helper-function-name": { - "version": "7.12.13", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-get-function-arity": "^7.12.13", - "@babel/template": "^7.12.13", - "@babel/types": "^7.12.13" - } - }, - "node_modules/@babel/helper-get-function-arity": { - "version": "7.12.13", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/types": "^7.12.13" - } - }, - "node_modules/@babel/helper-member-expression-to-functions": { - "version": "7.13.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/types": "^7.13.0" - } - }, - "node_modules/@babel/helper-module-imports": { - "version": "7.12.13", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/types": "^7.12.13" - } - }, - "node_modules/@babel/helper-module-transforms": { - "version": "7.13.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-module-imports": "^7.12.13", - "@babel/helper-replace-supers": "^7.13.0", - "@babel/helper-simple-access": "^7.12.13", - "@babel/helper-split-export-declaration": "^7.12.13", - "@babel/helper-validator-identifier": "^7.12.11", - "@babel/template": "^7.12.13", - "@babel/traverse": "^7.13.0", - "@babel/types": "^7.13.0", - "lodash": "^4.17.19" - } - }, - "node_modules/@babel/helper-optimise-call-expression": { - "version": "7.12.13", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/types": "^7.12.13" - } - }, - "node_modules/@babel/helper-plugin-utils": { - "version": "7.13.0", - "dev": true, - "license": "MIT" - }, - "node_modules/@babel/helper-replace-supers": { - "version": "7.13.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-member-expression-to-functions": "^7.13.0", - "@babel/helper-optimise-call-expression": "^7.12.13", - "@babel/traverse": "^7.13.0", - "@babel/types": "^7.13.0" - } - }, - "node_modules/@babel/helper-simple-access": { - "version": "7.12.13", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/types": "^7.12.13" - } - }, - "node_modules/@babel/helper-split-export-declaration": { - "version": "7.12.13", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/types": "^7.12.13" - } - }, - "node_modules/@babel/helper-validator-identifier": { - "version": "7.12.11", - "dev": true, - "license": "MIT" - }, - "node_modules/@babel/helper-validator-option": { - "version": "7.12.17", - "dev": true, - "license": "MIT" - }, - "node_modules/@babel/helpers": { - "version": "7.13.10", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/template": "^7.12.13", - "@babel/traverse": "^7.13.0", - "@babel/types": "^7.13.0" - } - }, - "node_modules/@babel/highlight": { - "version": "7.13.10", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-validator-identifier": "^7.12.11", - "chalk": "^2.0.0", - "js-tokens": "^4.0.0" - } - }, - "node_modules/@babel/highlight/node_modules/ansi-styles": { - "version": "3.2.1", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@babel/highlight/node_modules/chalk": { - "version": "2.4.2", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@babel/highlight/node_modules/color-convert": { - "version": "1.9.3", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "1.1.3" - } - }, - "node_modules/@babel/highlight/node_modules/color-name": { - "version": "1.1.3", - "dev": true, - "license": "MIT" - }, - "node_modules/@babel/highlight/node_modules/has-flag": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/@babel/highlight/node_modules/supports-color": { - "version": "5.5.0", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@babel/parser": { - "version": "7.13.10", - "dev": true, - "license": "MIT", - "bin": { - "parser": "bin/babel-parser.js" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@babel/plugin-syntax-object-rest-spread": { - "version": "7.8.3", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.8.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/template": { - "version": "7.12.13", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/code-frame": "^7.12.13", - "@babel/parser": "^7.12.13", - "@babel/types": "^7.12.13" - } - }, - "node_modules/@babel/traverse": { - "version": "7.13.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/code-frame": "^7.12.13", - "@babel/generator": "^7.13.0", - "@babel/helper-function-name": "^7.12.13", - "@babel/helper-split-export-declaration": "^7.12.13", - "@babel/parser": "^7.13.0", - "@babel/types": "^7.13.0", - "debug": "^4.1.0", - "globals": "^11.1.0", - "lodash": "^4.17.19" - } - }, - "node_modules/@babel/traverse/node_modules/globals": { - "version": "11.12.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/@babel/types": { - "version": "7.13.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-validator-identifier": "^7.12.11", - "lodash": "^4.17.19", - "to-fast-properties": "^2.0.0" - } - }, - "node_modules/@cnakazawa/watch": { - "version": "1.0.4", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "exec-sh": "^0.3.2", - "minimist": "^1.2.0" - }, - "bin": { - "watch": "cli.js" - }, - "engines": { - "node": ">=0.1.95" - } - }, - "node_modules/@evocateur/libnpmaccess": { - "version": "3.1.2", - "dev": true, - "license": "ISC", - "dependencies": { - "@evocateur/npm-registry-fetch": "^4.0.0", - "aproba": "^2.0.0", - "figgy-pudding": "^3.5.1", - "get-stream": "^4.0.0", - "npm-package-arg": "^6.1.0" - } - }, - "node_modules/@evocateur/libnpmaccess/node_modules/get-stream": { - "version": "4.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "pump": "^3.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/@evocateur/libnpmpublish": { - "version": "1.2.2", - "dev": true, - "license": "ISC", - "dependencies": { - "@evocateur/npm-registry-fetch": "^4.0.0", - "aproba": "^2.0.0", - "figgy-pudding": "^3.5.1", - "get-stream": "^4.0.0", - "lodash.clonedeep": "^4.5.0", - "normalize-package-data": "^2.4.0", - "npm-package-arg": "^6.1.0", - "semver": "^5.5.1", - "ssri": "^6.0.1" - } - }, - "node_modules/@evocateur/libnpmpublish/node_modules/get-stream": { - "version": "4.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "pump": "^3.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/@evocateur/libnpmpublish/node_modules/semver": { - "version": "5.7.1", - "dev": true, - "license": "ISC", - "bin": { - "semver": "bin/semver" - } - }, - "node_modules/@evocateur/npm-registry-fetch": { - "version": "4.0.0", - "dev": true, - "license": "ISC", - "dependencies": { - "bluebird": "^3.5.1", - "figgy-pudding": "^3.4.1", - "JSONStream": "^1.3.4", - "lru-cache": "^5.1.1", - "make-fetch-happen": "^5.0.0", - "npm-package-arg": "^6.1.0", - "safe-buffer": "^5.1.2" - } - }, - "node_modules/@evocateur/pacote": { - "version": "9.6.5", - "dev": true, - "license": "MIT", - "dependencies": { - "@evocateur/npm-registry-fetch": "^4.0.0", - "bluebird": "^3.5.3", - "cacache": "^12.0.3", - "chownr": "^1.1.2", - "figgy-pudding": "^3.5.1", - "get-stream": "^4.1.0", - "glob": "^7.1.4", - "infer-owner": "^1.0.4", - "lru-cache": "^5.1.1", - "make-fetch-happen": "^5.0.0", - "minimatch": "^3.0.4", - "minipass": "^2.3.5", - "mississippi": "^3.0.0", - "mkdirp": "^0.5.1", - "normalize-package-data": "^2.5.0", - "npm-package-arg": "^6.1.0", - "npm-packlist": "^1.4.4", - "npm-pick-manifest": "^3.0.0", - "osenv": "^0.1.5", - "promise-inflight": "^1.0.1", - "promise-retry": "^1.1.1", - "protoduck": "^5.0.1", - "rimraf": "^2.6.3", - "safe-buffer": "^5.2.0", - "semver": "^5.7.0", - "ssri": "^6.0.1", - "tar": "^4.4.10", - "unique-filename": "^1.1.1", - "which": "^1.3.1" - } - }, - "node_modules/@evocateur/pacote/node_modules/get-stream": { - "version": "4.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "pump": "^3.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/@evocateur/pacote/node_modules/safe-buffer": { - "version": "5.2.1", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT" - }, - "node_modules/@evocateur/pacote/node_modules/semver": { - "version": "5.7.1", - "dev": true, - "license": "ISC", - "bin": { - "semver": "bin/semver" - } - }, - "node_modules/@jest/console": { - "version": "24.9.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/source-map": "^24.9.0", - "chalk": "^2.0.1", - "slash": "^2.0.0" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/@jest/console/node_modules/ansi-styles": { - "version": "3.2.1", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@jest/console/node_modules/chalk": { - "version": "2.4.2", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@jest/console/node_modules/color-convert": { - "version": "1.9.3", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "1.1.3" - } - }, - "node_modules/@jest/console/node_modules/color-name": { - "version": "1.1.3", - "dev": true, - "license": "MIT" - }, - "node_modules/@jest/console/node_modules/has-flag": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/@jest/console/node_modules/slash": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/@jest/console/node_modules/supports-color": { - "version": "5.5.0", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@jest/core": { - "version": "24.9.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/console": "^24.7.1", - "@jest/reporters": "^24.9.0", - "@jest/test-result": "^24.9.0", - "@jest/transform": "^24.9.0", - "@jest/types": "^24.9.0", - "ansi-escapes": "^3.0.0", - "chalk": "^2.0.1", - "exit": "^0.1.2", - "graceful-fs": "^4.1.15", - "jest-changed-files": "^24.9.0", - "jest-config": "^24.9.0", - "jest-haste-map": "^24.9.0", - "jest-message-util": "^24.9.0", - "jest-regex-util": "^24.3.0", - "jest-resolve": "^24.9.0", - "jest-resolve-dependencies": "^24.9.0", - "jest-runner": "^24.9.0", - "jest-runtime": "^24.9.0", - "jest-snapshot": "^24.9.0", - "jest-util": "^24.9.0", - "jest-validate": "^24.9.0", - "jest-watcher": "^24.9.0", - "micromatch": "^3.1.10", - "p-each-series": "^1.0.0", - "realpath-native": "^1.1.0", - "rimraf": "^2.5.4", - "slash": "^2.0.0", - "strip-ansi": "^5.0.0" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/@jest/core/node_modules/ansi-escapes": { - "version": "3.2.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/@jest/core/node_modules/ansi-styles": { - "version": "3.2.1", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@jest/core/node_modules/chalk": { - "version": "2.4.2", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@jest/core/node_modules/color-convert": { - "version": "1.9.3", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "1.1.3" - } - }, - "node_modules/@jest/core/node_modules/color-name": { - "version": "1.1.3", - "dev": true, - "license": "MIT" - }, - "node_modules/@jest/core/node_modules/has-flag": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/@jest/core/node_modules/slash": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/@jest/core/node_modules/supports-color": { - "version": "5.5.0", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@jest/environment": { - "version": "24.9.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/fake-timers": "^24.9.0", - "@jest/transform": "^24.9.0", - "@jest/types": "^24.9.0", - "jest-mock": "^24.9.0" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/@jest/fake-timers": { - "version": "24.9.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/types": "^24.9.0", - "jest-message-util": "^24.9.0", - "jest-mock": "^24.9.0" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/@jest/reporters": { - "version": "24.9.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/environment": "^24.9.0", - "@jest/test-result": "^24.9.0", - "@jest/transform": "^24.9.0", - "@jest/types": "^24.9.0", - "chalk": "^2.0.1", - "exit": "^0.1.2", - "glob": "^7.1.2", - "istanbul-lib-coverage": "^2.0.2", - "istanbul-lib-instrument": "^3.0.1", - "istanbul-lib-report": "^2.0.4", - "istanbul-lib-source-maps": "^3.0.1", - "istanbul-reports": "^2.2.6", - "jest-haste-map": "^24.9.0", - "jest-resolve": "^24.9.0", - "jest-runtime": "^24.9.0", - "jest-util": "^24.9.0", - "jest-worker": "^24.6.0", - "node-notifier": "^5.4.2", - "slash": "^2.0.0", - "source-map": "^0.6.0", - "string-length": "^2.0.0" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/@jest/reporters/node_modules/ansi-styles": { - "version": "3.2.1", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@jest/reporters/node_modules/chalk": { - "version": "2.4.2", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@jest/reporters/node_modules/color-convert": { - "version": "1.9.3", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "1.1.3" - } - }, - "node_modules/@jest/reporters/node_modules/color-name": { - "version": "1.1.3", - "dev": true, - "license": "MIT" - }, - "node_modules/@jest/reporters/node_modules/has-flag": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/@jest/reporters/node_modules/slash": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/@jest/reporters/node_modules/supports-color": { - "version": "5.5.0", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@jest/source-map": { - "version": "24.9.0", - "dev": true, - "license": "MIT", - "dependencies": { - "callsites": "^3.0.0", - "graceful-fs": "^4.1.15", - "source-map": "^0.6.0" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/@jest/test-result": { - "version": "24.9.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/console": "^24.9.0", - "@jest/types": "^24.9.0", - "@types/istanbul-lib-coverage": "^2.0.0" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/@jest/test-sequencer": { - "version": "24.9.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/test-result": "^24.9.0", - "jest-haste-map": "^24.9.0", - "jest-runner": "^24.9.0", - "jest-runtime": "^24.9.0" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/@jest/transform": { - "version": "24.9.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/core": "^7.1.0", - "@jest/types": "^24.9.0", - "babel-plugin-istanbul": "^5.1.0", - "chalk": "^2.0.1", - "convert-source-map": "^1.4.0", - "fast-json-stable-stringify": "^2.0.0", - "graceful-fs": "^4.1.15", - "jest-haste-map": "^24.9.0", - "jest-regex-util": "^24.9.0", - "jest-util": "^24.9.0", - "micromatch": "^3.1.10", - "pirates": "^4.0.1", - "realpath-native": "^1.1.0", - "slash": "^2.0.0", - "source-map": "^0.6.1", - "write-file-atomic": "2.4.1" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/@jest/transform/node_modules/ansi-styles": { - "version": "3.2.1", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@jest/transform/node_modules/chalk": { - "version": "2.4.2", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@jest/transform/node_modules/color-convert": { - "version": "1.9.3", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "1.1.3" - } - }, - "node_modules/@jest/transform/node_modules/color-name": { - "version": "1.1.3", - "dev": true, - "license": "MIT" - }, - "node_modules/@jest/transform/node_modules/has-flag": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/@jest/transform/node_modules/slash": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/@jest/transform/node_modules/supports-color": { - "version": "5.5.0", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@jest/types": { - "version": "24.9.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/istanbul-lib-coverage": "^2.0.0", - "@types/istanbul-reports": "^1.1.1", - "@types/yargs": "^13.0.0" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/@lerna/add": { - "version": "3.21.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@evocateur/pacote": "^9.6.3", - "@lerna/bootstrap": "3.21.0", - "@lerna/command": "3.21.0", - "@lerna/filter-options": "3.20.0", - "@lerna/npm-conf": "3.16.0", - "@lerna/validation-error": "3.13.0", - "dedent": "^0.7.0", - "npm-package-arg": "^6.1.0", - "p-map": "^2.1.0", - "semver": "^6.2.0" - }, - "engines": { - "node": ">= 6.9.0" - } - }, - "node_modules/@lerna/add/node_modules/semver": { - "version": "6.3.0", - "dev": true, - "license": "ISC", - "bin": { - "semver": "bin/semver.js" - } - }, - "node_modules/@lerna/bootstrap": { - "version": "3.21.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@lerna/command": "3.21.0", - "@lerna/filter-options": "3.20.0", - "@lerna/has-npm-version": "3.16.5", - "@lerna/npm-install": "3.16.5", - "@lerna/package-graph": "3.18.5", - "@lerna/pulse-till-done": "3.13.0", - "@lerna/rimraf-dir": "3.16.5", - "@lerna/run-lifecycle": "3.16.2", - "@lerna/run-topologically": "3.18.5", - "@lerna/symlink-binary": "3.17.0", - "@lerna/symlink-dependencies": "3.17.0", - "@lerna/validation-error": "3.13.0", - "dedent": "^0.7.0", - "get-port": "^4.2.0", - "multimatch": "^3.0.0", - "npm-package-arg": "^6.1.0", - "npmlog": "^4.1.2", - "p-finally": "^1.0.0", - "p-map": "^2.1.0", - "p-map-series": "^1.0.0", - "p-waterfall": "^1.0.0", - "read-package-tree": "^5.1.6", - "semver": "^6.2.0" - }, - "engines": { - "node": ">= 6.9.0" - } - }, - "node_modules/@lerna/bootstrap/node_modules/semver": { - "version": "6.3.0", - "dev": true, - "license": "ISC", - "bin": { - "semver": "bin/semver.js" - } - }, - "node_modules/@lerna/changed": { - "version": "3.21.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@lerna/collect-updates": "3.20.0", - "@lerna/command": "3.21.0", - "@lerna/listable": "3.18.5", - "@lerna/output": "3.13.0" - }, - "engines": { - "node": ">= 6.9.0" - } - }, - "node_modules/@lerna/check-working-tree": { - "version": "3.16.5", - "dev": true, - "license": "MIT", - "dependencies": { - "@lerna/collect-uncommitted": "3.16.5", - "@lerna/describe-ref": "3.16.5", - "@lerna/validation-error": "3.13.0" - }, - "engines": { - "node": ">= 6.9.0" - } - }, - "node_modules/@lerna/child-process": { - "version": "3.16.5", - "dev": true, - "license": "MIT", - "dependencies": { - "chalk": "^2.3.1", - "execa": "^1.0.0", - "strong-log-transformer": "^2.0.0" - }, - "engines": { - "node": ">= 6.9.0" - } - }, - "node_modules/@lerna/child-process/node_modules/ansi-styles": { - "version": "3.2.1", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@lerna/child-process/node_modules/chalk": { - "version": "2.4.2", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@lerna/child-process/node_modules/color-convert": { - "version": "1.9.3", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "1.1.3" - } - }, - "node_modules/@lerna/child-process/node_modules/color-name": { - "version": "1.1.3", - "dev": true, - "license": "MIT" - }, - "node_modules/@lerna/child-process/node_modules/execa": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "cross-spawn": "^6.0.0", - "get-stream": "^4.0.0", - "is-stream": "^1.1.0", - "npm-run-path": "^2.0.0", - "p-finally": "^1.0.0", - "signal-exit": "^3.0.0", - "strip-eof": "^1.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/@lerna/child-process/node_modules/get-stream": { - "version": "4.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "pump": "^3.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/@lerna/child-process/node_modules/has-flag": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/@lerna/child-process/node_modules/is-stream": { - "version": "1.1.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/@lerna/child-process/node_modules/npm-run-path": { - "version": "2.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "path-key": "^2.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@lerna/child-process/node_modules/supports-color": { - "version": "5.5.0", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@lerna/clean": { - "version": "3.21.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@lerna/command": "3.21.0", - "@lerna/filter-options": "3.20.0", - "@lerna/prompt": "3.18.5", - "@lerna/pulse-till-done": "3.13.0", - "@lerna/rimraf-dir": "3.16.5", - "p-map": "^2.1.0", - "p-map-series": "^1.0.0", - "p-waterfall": "^1.0.0" - }, - "engines": { - "node": ">= 6.9.0" - } - }, - "node_modules/@lerna/cli": { - "version": "3.18.5", - "dev": true, - "license": "MIT", - "dependencies": { - "@lerna/global-options": "3.13.0", - "dedent": "^0.7.0", - "npmlog": "^4.1.2", - "yargs": "^14.2.2" - }, - "engines": { - "node": ">= 6.9.0" - } - }, - "node_modules/@lerna/cli/node_modules/emoji-regex": { - "version": "7.0.3", - "dev": true, - "license": "MIT" - }, - "node_modules/@lerna/cli/node_modules/is-fullwidth-code-point": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/@lerna/cli/node_modules/string-width": { - "version": "3.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "emoji-regex": "^7.0.1", - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.1.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/@lerna/cli/node_modules/yargs": { - "version": "14.2.3", - "dev": true, - "license": "MIT", - "dependencies": { - "cliui": "^5.0.0", - "decamelize": "^1.2.0", - "find-up": "^3.0.0", - "get-caller-file": "^2.0.1", - "require-directory": "^2.1.1", - "require-main-filename": "^2.0.0", - "set-blocking": "^2.0.0", - "string-width": "^3.0.0", - "which-module": "^2.0.0", - "y18n": "^4.0.0", - "yargs-parser": "^15.0.1" - } - }, - "node_modules/@lerna/cli/node_modules/yargs-parser": { - "version": "15.0.1", - "dev": true, - "license": "ISC", - "dependencies": { - "camelcase": "^5.0.0", - "decamelize": "^1.2.0" - } - }, - "node_modules/@lerna/collect-uncommitted": { - "version": "3.16.5", - "dev": true, - "license": "MIT", - "dependencies": { - "@lerna/child-process": "3.16.5", - "chalk": "^2.3.1", - "figgy-pudding": "^3.5.1", - "npmlog": "^4.1.2" - }, - "engines": { - "node": ">= 6.9.0" - } - }, - "node_modules/@lerna/collect-uncommitted/node_modules/ansi-styles": { - "version": "3.2.1", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@lerna/collect-uncommitted/node_modules/chalk": { - "version": "2.4.2", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@lerna/collect-uncommitted/node_modules/color-convert": { - "version": "1.9.3", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "1.1.3" - } - }, - "node_modules/@lerna/collect-uncommitted/node_modules/color-name": { - "version": "1.1.3", - "dev": true, - "license": "MIT" - }, - "node_modules/@lerna/collect-uncommitted/node_modules/has-flag": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/@lerna/collect-uncommitted/node_modules/supports-color": { - "version": "5.5.0", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@lerna/collect-updates": { - "version": "3.20.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@lerna/child-process": "3.16.5", - "@lerna/describe-ref": "3.16.5", - "minimatch": "^3.0.4", - "npmlog": "^4.1.2", - "slash": "^2.0.0" - }, - "engines": { - "node": ">= 6.9.0" - } - }, - "node_modules/@lerna/collect-updates/node_modules/slash": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/@lerna/command": { - "version": "3.21.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@lerna/child-process": "3.16.5", - "@lerna/package-graph": "3.18.5", - "@lerna/project": "3.21.0", - "@lerna/validation-error": "3.13.0", - "@lerna/write-log-file": "3.13.0", - "clone-deep": "^4.0.1", - "dedent": "^0.7.0", - "execa": "^1.0.0", - "is-ci": "^2.0.0", - "npmlog": "^4.1.2" - }, - "engines": { - "node": ">= 6.9.0" - } - }, - "node_modules/@lerna/command/node_modules/execa": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "cross-spawn": "^6.0.0", - "get-stream": "^4.0.0", - "is-stream": "^1.1.0", - "npm-run-path": "^2.0.0", - "p-finally": "^1.0.0", - "signal-exit": "^3.0.0", - "strip-eof": "^1.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/@lerna/command/node_modules/get-stream": { - "version": "4.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "pump": "^3.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/@lerna/command/node_modules/is-stream": { - "version": "1.1.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/@lerna/command/node_modules/npm-run-path": { - "version": "2.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "path-key": "^2.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@lerna/conventional-commits": { - "version": "3.22.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@lerna/validation-error": "3.13.0", - "conventional-changelog-angular": "^5.0.3", - "conventional-changelog-core": "^3.1.6", - "conventional-recommended-bump": "^5.0.0", - "fs-extra": "^8.1.0", - "get-stream": "^4.0.0", - "lodash.template": "^4.5.0", - "npm-package-arg": "^6.1.0", - "npmlog": "^4.1.2", - "pify": "^4.0.1", - "semver": "^6.2.0" - }, - "engines": { - "node": ">= 6.9.0" - } - }, - "node_modules/@lerna/conventional-commits/node_modules/fs-extra": { - "version": "8.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "graceful-fs": "^4.2.0", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - }, - "engines": { - "node": ">=6 <7 || >=8" - } - }, - "node_modules/@lerna/conventional-commits/node_modules/get-stream": { - "version": "4.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "pump": "^3.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/@lerna/conventional-commits/node_modules/jsonfile": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "optionalDependencies": { - "graceful-fs": "^4.1.6" - } - }, - "node_modules/@lerna/conventional-commits/node_modules/semver": { - "version": "6.3.0", - "dev": true, - "license": "ISC", - "bin": { - "semver": "bin/semver.js" - } - }, - "node_modules/@lerna/conventional-commits/node_modules/universalify": { - "version": "0.1.2", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 4.0.0" - } - }, - "node_modules/@lerna/create": { - "version": "3.22.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@evocateur/pacote": "^9.6.3", - "@lerna/child-process": "3.16.5", - "@lerna/command": "3.21.0", - "@lerna/npm-conf": "3.16.0", - "@lerna/validation-error": "3.13.0", - "camelcase": "^5.0.0", - "dedent": "^0.7.0", - "fs-extra": "^8.1.0", - "globby": "^9.2.0", - "init-package-json": "^1.10.3", - "npm-package-arg": "^6.1.0", - "p-reduce": "^1.0.0", - "pify": "^4.0.1", - "semver": "^6.2.0", - "slash": "^2.0.0", - "validate-npm-package-license": "^3.0.3", - "validate-npm-package-name": "^3.0.0", - "whatwg-url": "^7.0.0" - }, - "engines": { - "node": ">= 6.9.0" - } - }, - "node_modules/@lerna/create-symlink": { - "version": "3.16.2", - "dev": true, - "license": "MIT", - "dependencies": { - "@zkochan/cmd-shim": "^3.1.0", - "fs-extra": "^8.1.0", - "npmlog": "^4.1.2" - }, - "engines": { - "node": ">= 6.9.0" - } - }, - "node_modules/@lerna/create-symlink/node_modules/fs-extra": { - "version": "8.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "graceful-fs": "^4.2.0", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - }, - "engines": { - "node": ">=6 <7 || >=8" - } - }, - "node_modules/@lerna/create-symlink/node_modules/jsonfile": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "optionalDependencies": { - "graceful-fs": "^4.1.6" - } - }, - "node_modules/@lerna/create-symlink/node_modules/universalify": { - "version": "0.1.2", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 4.0.0" - } - }, - "node_modules/@lerna/create/node_modules/fs-extra": { - "version": "8.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "graceful-fs": "^4.2.0", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - }, - "engines": { - "node": ">=6 <7 || >=8" - } - }, - "node_modules/@lerna/create/node_modules/jsonfile": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "optionalDependencies": { - "graceful-fs": "^4.1.6" - } - }, - "node_modules/@lerna/create/node_modules/semver": { - "version": "6.3.0", - "dev": true, - "license": "ISC", - "bin": { - "semver": "bin/semver.js" - } - }, - "node_modules/@lerna/create/node_modules/slash": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/@lerna/create/node_modules/universalify": { - "version": "0.1.2", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 4.0.0" - } - }, - "node_modules/@lerna/create/node_modules/whatwg-url": { - "version": "7.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "lodash.sortby": "^4.7.0", - "tr46": "^1.0.1", - "webidl-conversions": "^4.0.2" - } - }, - "node_modules/@lerna/describe-ref": { - "version": "3.16.5", - "dev": true, - "license": "MIT", - "dependencies": { - "@lerna/child-process": "3.16.5", - "npmlog": "^4.1.2" - }, - "engines": { - "node": ">= 6.9.0" - } - }, - "node_modules/@lerna/diff": { - "version": "3.21.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@lerna/child-process": "3.16.5", - "@lerna/command": "3.21.0", - "@lerna/validation-error": "3.13.0", - "npmlog": "^4.1.2" - }, - "engines": { - "node": ">= 6.9.0" - } - }, - "node_modules/@lerna/exec": { - "version": "3.21.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@lerna/child-process": "3.16.5", - "@lerna/command": "3.21.0", - "@lerna/filter-options": "3.20.0", - "@lerna/profiler": "3.20.0", - "@lerna/run-topologically": "3.18.5", - "@lerna/validation-error": "3.13.0", - "p-map": "^2.1.0" - }, - "engines": { - "node": ">= 6.9.0" - } - }, - "node_modules/@lerna/filter-options": { - "version": "3.20.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@lerna/collect-updates": "3.20.0", - "@lerna/filter-packages": "3.18.0", - "dedent": "^0.7.0", - "figgy-pudding": "^3.5.1", - "npmlog": "^4.1.2" - }, - "engines": { - "node": ">= 6.9.0" - } - }, - "node_modules/@lerna/filter-packages": { - "version": "3.18.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@lerna/validation-error": "3.13.0", - "multimatch": "^3.0.0", - "npmlog": "^4.1.2" - }, - "engines": { - "node": ">= 6.9.0" - } - }, - "node_modules/@lerna/get-npm-exec-opts": { - "version": "3.13.0", - "dev": true, - "license": "MIT", - "dependencies": { - "npmlog": "^4.1.2" - }, - "engines": { - "node": ">= 6.9.0" - } - }, - "node_modules/@lerna/get-packed": { - "version": "3.16.0", - "dev": true, - "license": "MIT", - "dependencies": { - "fs-extra": "^8.1.0", - "ssri": "^6.0.1", - "tar": "^4.4.8" - } - }, - "node_modules/@lerna/get-packed/node_modules/fs-extra": { - "version": "8.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "graceful-fs": "^4.2.0", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - }, - "engines": { - "node": ">=6 <7 || >=8" - } - }, - "node_modules/@lerna/get-packed/node_modules/jsonfile": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "optionalDependencies": { - "graceful-fs": "^4.1.6" - } - }, - "node_modules/@lerna/get-packed/node_modules/universalify": { - "version": "0.1.2", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 4.0.0" - } - }, - "node_modules/@lerna/github-client": { - "version": "3.22.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@lerna/child-process": "3.16.5", - "@octokit/plugin-enterprise-rest": "^6.0.1", - "@octokit/rest": "^16.28.4", - "git-url-parse": "^11.1.2", - "npmlog": "^4.1.2" - }, - "engines": { - "node": ">= 6.9.0" - } - }, - "node_modules/@lerna/gitlab-client": { - "version": "3.15.0", - "dev": true, - "license": "MIT", - "dependencies": { - "node-fetch": "^2.5.0", - "npmlog": "^4.1.2", - "whatwg-url": "^7.0.0" - }, - "engines": { - "node": ">= 6.9.0" - } - }, - "node_modules/@lerna/gitlab-client/node_modules/whatwg-url": { - "version": "7.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "lodash.sortby": "^4.7.0", - "tr46": "^1.0.1", - "webidl-conversions": "^4.0.2" - } - }, - "node_modules/@lerna/global-options": { - "version": "3.13.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 6.9.0" - } - }, - "node_modules/@lerna/has-npm-version": { - "version": "3.16.5", - "dev": true, - "license": "MIT", - "dependencies": { - "@lerna/child-process": "3.16.5", - "semver": "^6.2.0" - }, - "engines": { - "node": ">= 6.9.0" - } - }, - "node_modules/@lerna/has-npm-version/node_modules/semver": { - "version": "6.3.0", - "dev": true, - "license": "ISC", - "bin": { - "semver": "bin/semver.js" - } - }, - "node_modules/@lerna/import": { - "version": "3.22.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@lerna/child-process": "3.16.5", - "@lerna/command": "3.21.0", - "@lerna/prompt": "3.18.5", - "@lerna/pulse-till-done": "3.13.0", - "@lerna/validation-error": "3.13.0", - "dedent": "^0.7.0", - "fs-extra": "^8.1.0", - "p-map-series": "^1.0.0" - }, - "engines": { - "node": ">= 6.9.0" - } - }, - "node_modules/@lerna/import/node_modules/fs-extra": { - "version": "8.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "graceful-fs": "^4.2.0", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - }, - "engines": { - "node": ">=6 <7 || >=8" - } - }, - "node_modules/@lerna/import/node_modules/jsonfile": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "optionalDependencies": { - "graceful-fs": "^4.1.6" - } - }, - "node_modules/@lerna/import/node_modules/universalify": { - "version": "0.1.2", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 4.0.0" - } - }, - "node_modules/@lerna/info": { - "version": "3.21.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@lerna/command": "3.21.0", - "@lerna/output": "3.13.0", - "envinfo": "^7.3.1" - }, - "engines": { - "node": ">= 6.9.0" - } - }, - "node_modules/@lerna/init": { - "version": "3.21.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@lerna/child-process": "3.16.5", - "@lerna/command": "3.21.0", - "fs-extra": "^8.1.0", - "p-map": "^2.1.0", - "write-json-file": "^3.2.0" - }, - "engines": { - "node": ">= 6.9.0" - } - }, - "node_modules/@lerna/init/node_modules/fs-extra": { - "version": "8.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "graceful-fs": "^4.2.0", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - }, - "engines": { - "node": ">=6 <7 || >=8" - } - }, - "node_modules/@lerna/init/node_modules/jsonfile": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "optionalDependencies": { - "graceful-fs": "^4.1.6" - } - }, - "node_modules/@lerna/init/node_modules/universalify": { - "version": "0.1.2", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 4.0.0" - } - }, - "node_modules/@lerna/link": { - "version": "3.21.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@lerna/command": "3.21.0", - "@lerna/package-graph": "3.18.5", - "@lerna/symlink-dependencies": "3.17.0", - "p-map": "^2.1.0", - "slash": "^2.0.0" - }, - "engines": { - "node": ">= 6.9.0" - } - }, - "node_modules/@lerna/link/node_modules/slash": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/@lerna/list": { - "version": "3.21.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@lerna/command": "3.21.0", - "@lerna/filter-options": "3.20.0", - "@lerna/listable": "3.18.5", - "@lerna/output": "3.13.0" - }, - "engines": { - "node": ">= 6.9.0" - } - }, - "node_modules/@lerna/listable": { - "version": "3.18.5", - "dev": true, - "license": "MIT", - "dependencies": { - "@lerna/query-graph": "3.18.5", - "chalk": "^2.3.1", - "columnify": "^1.5.4" - }, - "engines": { - "node": ">= 6.9.0" - } - }, - "node_modules/@lerna/listable/node_modules/ansi-styles": { - "version": "3.2.1", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@lerna/listable/node_modules/chalk": { - "version": "2.4.2", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@lerna/listable/node_modules/color-convert": { - "version": "1.9.3", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "1.1.3" - } - }, - "node_modules/@lerna/listable/node_modules/color-name": { - "version": "1.1.3", - "dev": true, - "license": "MIT" - }, - "node_modules/@lerna/listable/node_modules/has-flag": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/@lerna/listable/node_modules/supports-color": { - "version": "5.5.0", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@lerna/log-packed": { - "version": "3.16.0", - "dev": true, - "license": "MIT", - "dependencies": { - "byte-size": "^5.0.1", - "columnify": "^1.5.4", - "has-unicode": "^2.0.1", - "npmlog": "^4.1.2" - }, - "engines": { - "node": ">= 6.9.0" - } - }, - "node_modules/@lerna/npm-conf": { - "version": "3.16.0", - "dev": true, - "license": "MIT", - "dependencies": { - "config-chain": "^1.1.11", - "pify": "^4.0.1" - }, - "engines": { - "node": ">= 6.9.0" - } - }, - "node_modules/@lerna/npm-dist-tag": { - "version": "3.18.5", - "dev": true, - "license": "MIT", - "dependencies": { - "@evocateur/npm-registry-fetch": "^4.0.0", - "@lerna/otplease": "3.18.5", - "figgy-pudding": "^3.5.1", - "npm-package-arg": "^6.1.0", - "npmlog": "^4.1.2" - }, - "engines": { - "node": ">= 6.9.0" - } - }, - "node_modules/@lerna/npm-install": { - "version": "3.16.5", - "dev": true, - "license": "MIT", - "dependencies": { - "@lerna/child-process": "3.16.5", - "@lerna/get-npm-exec-opts": "3.13.0", - "fs-extra": "^8.1.0", - "npm-package-arg": "^6.1.0", - "npmlog": "^4.1.2", - "signal-exit": "^3.0.2", - "write-pkg": "^3.1.0" - }, - "engines": { - "node": ">= 6.9.0" - } - }, - "node_modules/@lerna/npm-install/node_modules/fs-extra": { - "version": "8.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "graceful-fs": "^4.2.0", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - }, - "engines": { - "node": ">=6 <7 || >=8" - } - }, - "node_modules/@lerna/npm-install/node_modules/jsonfile": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "optionalDependencies": { - "graceful-fs": "^4.1.6" - } - }, - "node_modules/@lerna/npm-install/node_modules/universalify": { - "version": "0.1.2", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 4.0.0" - } - }, - "node_modules/@lerna/npm-publish": { - "version": "3.18.5", - "dev": true, - "license": "MIT", - "dependencies": { - "@evocateur/libnpmpublish": "^1.2.2", - "@lerna/otplease": "3.18.5", - "@lerna/run-lifecycle": "3.16.2", - "figgy-pudding": "^3.5.1", - "fs-extra": "^8.1.0", - "npm-package-arg": "^6.1.0", - "npmlog": "^4.1.2", - "pify": "^4.0.1", - "read-package-json": "^2.0.13" - }, - "engines": { - "node": ">= 6.9.0" - } - }, - "node_modules/@lerna/npm-publish/node_modules/fs-extra": { - "version": "8.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "graceful-fs": "^4.2.0", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - }, - "engines": { - "node": ">=6 <7 || >=8" - } - }, - "node_modules/@lerna/npm-publish/node_modules/jsonfile": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "optionalDependencies": { - "graceful-fs": "^4.1.6" - } - }, - "node_modules/@lerna/npm-publish/node_modules/universalify": { - "version": "0.1.2", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 4.0.0" - } - }, - "node_modules/@lerna/npm-run-script": { - "version": "3.16.5", - "dev": true, - "license": "MIT", - "dependencies": { - "@lerna/child-process": "3.16.5", - "@lerna/get-npm-exec-opts": "3.13.0", - "npmlog": "^4.1.2" - }, - "engines": { - "node": ">= 6.9.0" - } - }, - "node_modules/@lerna/otplease": { - "version": "3.18.5", - "dev": true, - "license": "MIT", - "dependencies": { - "@lerna/prompt": "3.18.5", - "figgy-pudding": "^3.5.1" - }, - "engines": { - "node": ">= 6.9.0" - } - }, - "node_modules/@lerna/output": { - "version": "3.13.0", - "dev": true, - "license": "MIT", - "dependencies": { - "npmlog": "^4.1.2" - }, - "engines": { - "node": ">= 6.9.0" - } - }, - "node_modules/@lerna/pack-directory": { - "version": "3.16.4", - "dev": true, - "license": "MIT", - "dependencies": { - "@lerna/get-packed": "3.16.0", - "@lerna/package": "3.16.0", - "@lerna/run-lifecycle": "3.16.2", - "figgy-pudding": "^3.5.1", - "npm-packlist": "^1.4.4", - "npmlog": "^4.1.2", - "tar": "^4.4.10", - "temp-write": "^3.4.0" - } - }, - "node_modules/@lerna/package": { - "version": "3.16.0", - "dev": true, - "license": "MIT", - "dependencies": { - "load-json-file": "^5.3.0", - "npm-package-arg": "^6.1.0", - "write-pkg": "^3.1.0" - }, - "engines": { - "node": ">= 6.9.0" - } - }, - "node_modules/@lerna/package-graph": { - "version": "3.18.5", - "dev": true, - "license": "MIT", - "dependencies": { - "@lerna/prerelease-id-from-version": "3.16.0", - "@lerna/validation-error": "3.13.0", - "npm-package-arg": "^6.1.0", - "npmlog": "^4.1.2", - "semver": "^6.2.0" - }, - "engines": { - "node": ">= 6.9.0" - } - }, - "node_modules/@lerna/package-graph/node_modules/semver": { - "version": "6.3.0", - "dev": true, - "license": "ISC", - "bin": { - "semver": "bin/semver.js" - } - }, - "node_modules/@lerna/prerelease-id-from-version": { - "version": "3.16.0", - "dev": true, - "license": "MIT", - "dependencies": { - "semver": "^6.2.0" - }, - "engines": { - "node": ">= 6.9.0" - } - }, - "node_modules/@lerna/prerelease-id-from-version/node_modules/semver": { - "version": "6.3.0", - "dev": true, - "license": "ISC", - "bin": { - "semver": "bin/semver.js" - } - }, - "node_modules/@lerna/profiler": { - "version": "3.20.0", - "dev": true, - "license": "MIT", - "dependencies": { - "figgy-pudding": "^3.5.1", - "fs-extra": "^8.1.0", - "npmlog": "^4.1.2", - "upath": "^1.2.0" - }, - "engines": { - "node": ">= 6.9.0" - } - }, - "node_modules/@lerna/profiler/node_modules/fs-extra": { - "version": "8.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "graceful-fs": "^4.2.0", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - }, - "engines": { - "node": ">=6 <7 || >=8" - } - }, - "node_modules/@lerna/profiler/node_modules/jsonfile": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "optionalDependencies": { - "graceful-fs": "^4.1.6" - } - }, - "node_modules/@lerna/profiler/node_modules/universalify": { - "version": "0.1.2", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 4.0.0" - } - }, - "node_modules/@lerna/project": { - "version": "3.21.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@lerna/package": "3.16.0", - "@lerna/validation-error": "3.13.0", - "cosmiconfig": "^5.1.0", - "dedent": "^0.7.0", - "dot-prop": "^4.2.0", - "glob-parent": "^5.0.0", - "globby": "^9.2.0", - "load-json-file": "^5.3.0", - "npmlog": "^4.1.2", - "p-map": "^2.1.0", - "resolve-from": "^4.0.0", - "write-json-file": "^3.2.0" - }, - "engines": { - "node": ">= 6.9.0" - } - }, - "node_modules/@lerna/prompt": { - "version": "3.18.5", - "dev": true, - "license": "MIT", - "dependencies": { - "inquirer": "^6.2.0", - "npmlog": "^4.1.2" - }, - "engines": { - "node": ">= 6.9.0" - } - }, - "node_modules/@lerna/prompt/node_modules/ansi-escapes": { - "version": "3.2.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/@lerna/prompt/node_modules/ansi-regex": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/@lerna/prompt/node_modules/ansi-styles": { - "version": "3.2.1", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@lerna/prompt/node_modules/chalk": { - "version": "2.4.2", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@lerna/prompt/node_modules/cli-cursor": { - "version": "2.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "restore-cursor": "^2.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@lerna/prompt/node_modules/cli-width": { - "version": "2.2.1", - "dev": true, - "license": "ISC" - }, - "node_modules/@lerna/prompt/node_modules/color-convert": { - "version": "1.9.3", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "1.1.3" - } - }, - "node_modules/@lerna/prompt/node_modules/color-name": { - "version": "1.1.3", - "dev": true, - "license": "MIT" - }, - "node_modules/@lerna/prompt/node_modules/figures": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "escape-string-regexp": "^1.0.5" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@lerna/prompt/node_modules/has-flag": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/@lerna/prompt/node_modules/inquirer": { - "version": "6.5.2", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-escapes": "^3.2.0", - "chalk": "^2.4.2", - "cli-cursor": "^2.1.0", - "cli-width": "^2.0.0", - "external-editor": "^3.0.3", - "figures": "^2.0.0", - "lodash": "^4.17.12", - "mute-stream": "0.0.7", - "run-async": "^2.2.0", - "rxjs": "^6.4.0", - "string-width": "^2.1.0", - "strip-ansi": "^5.1.0", - "through": "^2.3.6" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@lerna/prompt/node_modules/is-fullwidth-code-point": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/@lerna/prompt/node_modules/mimic-fn": { - "version": "1.2.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/@lerna/prompt/node_modules/mute-stream": { - "version": "0.0.7", - "dev": true, - "license": "ISC" - }, - "node_modules/@lerna/prompt/node_modules/onetime": { - "version": "2.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "mimic-fn": "^1.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@lerna/prompt/node_modules/restore-cursor": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "onetime": "^2.0.0", - "signal-exit": "^3.0.2" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@lerna/prompt/node_modules/string-width": { - "version": "2.1.1", - "dev": true, - "license": "MIT", - "dependencies": { - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^4.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@lerna/prompt/node_modules/string-width/node_modules/strip-ansi": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-regex": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@lerna/prompt/node_modules/supports-color": { - "version": "5.5.0", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@lerna/publish": { - "version": "3.22.1", - "dev": true, - "license": "MIT", - "dependencies": { - "@evocateur/libnpmaccess": "^3.1.2", - "@evocateur/npm-registry-fetch": "^4.0.0", - "@evocateur/pacote": "^9.6.3", - "@lerna/check-working-tree": "3.16.5", - "@lerna/child-process": "3.16.5", - "@lerna/collect-updates": "3.20.0", - "@lerna/command": "3.21.0", - "@lerna/describe-ref": "3.16.5", - "@lerna/log-packed": "3.16.0", - "@lerna/npm-conf": "3.16.0", - "@lerna/npm-dist-tag": "3.18.5", - "@lerna/npm-publish": "3.18.5", - "@lerna/otplease": "3.18.5", - "@lerna/output": "3.13.0", - "@lerna/pack-directory": "3.16.4", - "@lerna/prerelease-id-from-version": "3.16.0", - "@lerna/prompt": "3.18.5", - "@lerna/pulse-till-done": "3.13.0", - "@lerna/run-lifecycle": "3.16.2", - "@lerna/run-topologically": "3.18.5", - "@lerna/validation-error": "3.13.0", - "@lerna/version": "3.22.1", - "figgy-pudding": "^3.5.1", - "fs-extra": "^8.1.0", - "npm-package-arg": "^6.1.0", - "npmlog": "^4.1.2", - "p-finally": "^1.0.0", - "p-map": "^2.1.0", - "p-pipe": "^1.2.0", - "semver": "^6.2.0" - }, - "engines": { - "node": ">= 6.9.0" - } - }, - "node_modules/@lerna/publish/node_modules/fs-extra": { - "version": "8.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "graceful-fs": "^4.2.0", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - }, - "engines": { - "node": ">=6 <7 || >=8" - } - }, - "node_modules/@lerna/publish/node_modules/jsonfile": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "optionalDependencies": { - "graceful-fs": "^4.1.6" - } - }, - "node_modules/@lerna/publish/node_modules/semver": { - "version": "6.3.0", - "dev": true, - "license": "ISC", - "bin": { - "semver": "bin/semver.js" - } - }, - "node_modules/@lerna/publish/node_modules/universalify": { - "version": "0.1.2", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 4.0.0" - } - }, - "node_modules/@lerna/pulse-till-done": { - "version": "3.13.0", - "dev": true, - "license": "MIT", - "dependencies": { - "npmlog": "^4.1.2" - }, - "engines": { - "node": ">= 6.9.0" - } - }, - "node_modules/@lerna/query-graph": { - "version": "3.18.5", - "dev": true, - "license": "MIT", - "dependencies": { - "@lerna/package-graph": "3.18.5", - "figgy-pudding": "^3.5.1" - }, - "engines": { - "node": ">= 6.9.0" - } - }, - "node_modules/@lerna/resolve-symlink": { - "version": "3.16.0", - "dev": true, - "license": "MIT", - "dependencies": { - "fs-extra": "^8.1.0", - "npmlog": "^4.1.2", - "read-cmd-shim": "^1.0.1" - }, - "engines": { - "node": ">= 6.9.0" - } - }, - "node_modules/@lerna/resolve-symlink/node_modules/fs-extra": { - "version": "8.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "graceful-fs": "^4.2.0", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - }, - "engines": { - "node": ">=6 <7 || >=8" - } - }, - "node_modules/@lerna/resolve-symlink/node_modules/jsonfile": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "optionalDependencies": { - "graceful-fs": "^4.1.6" - } - }, - "node_modules/@lerna/resolve-symlink/node_modules/universalify": { - "version": "0.1.2", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 4.0.0" - } - }, - "node_modules/@lerna/rimraf-dir": { - "version": "3.16.5", - "dev": true, - "license": "MIT", - "dependencies": { - "@lerna/child-process": "3.16.5", - "npmlog": "^4.1.2", - "path-exists": "^3.0.0", - "rimraf": "^2.6.2" - }, - "engines": { - "node": ">= 6.9.0" - } - }, - "node_modules/@lerna/run": { - "version": "3.21.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@lerna/command": "3.21.0", - "@lerna/filter-options": "3.20.0", - "@lerna/npm-run-script": "3.16.5", - "@lerna/output": "3.13.0", - "@lerna/profiler": "3.20.0", - "@lerna/run-topologically": "3.18.5", - "@lerna/timer": "3.13.0", - "@lerna/validation-error": "3.13.0", - "p-map": "^2.1.0" - }, - "engines": { - "node": ">= 6.9.0" - } - }, - "node_modules/@lerna/run-lifecycle": { - "version": "3.16.2", - "dev": true, - "license": "MIT", - "dependencies": { - "@lerna/npm-conf": "3.16.0", - "figgy-pudding": "^3.5.1", - "npm-lifecycle": "^3.1.2", - "npmlog": "^4.1.2" - }, - "engines": { - "node": ">= 6.9.0" - } - }, - "node_modules/@lerna/run-topologically": { - "version": "3.18.5", - "dev": true, - "license": "MIT", - "dependencies": { - "@lerna/query-graph": "3.18.5", - "figgy-pudding": "^3.5.1", - "p-queue": "^4.0.0" - }, - "engines": { - "node": ">= 6.9.0" - } - }, - "node_modules/@lerna/symlink-binary": { - "version": "3.17.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@lerna/create-symlink": "3.16.2", - "@lerna/package": "3.16.0", - "fs-extra": "^8.1.0", - "p-map": "^2.1.0" - }, - "engines": { - "node": ">= 6.9.0" - } - }, - "node_modules/@lerna/symlink-binary/node_modules/fs-extra": { - "version": "8.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "graceful-fs": "^4.2.0", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - }, - "engines": { - "node": ">=6 <7 || >=8" - } - }, - "node_modules/@lerna/symlink-binary/node_modules/jsonfile": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "optionalDependencies": { - "graceful-fs": "^4.1.6" - } - }, - "node_modules/@lerna/symlink-binary/node_modules/universalify": { - "version": "0.1.2", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 4.0.0" - } - }, - "node_modules/@lerna/symlink-dependencies": { - "version": "3.17.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@lerna/create-symlink": "3.16.2", - "@lerna/resolve-symlink": "3.16.0", - "@lerna/symlink-binary": "3.17.0", - "fs-extra": "^8.1.0", - "p-finally": "^1.0.0", - "p-map": "^2.1.0", - "p-map-series": "^1.0.0" - }, - "engines": { - "node": ">= 6.9.0" - } - }, - "node_modules/@lerna/symlink-dependencies/node_modules/fs-extra": { - "version": "8.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "graceful-fs": "^4.2.0", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - }, - "engines": { - "node": ">=6 <7 || >=8" - } - }, - "node_modules/@lerna/symlink-dependencies/node_modules/jsonfile": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "optionalDependencies": { - "graceful-fs": "^4.1.6" - } - }, - "node_modules/@lerna/symlink-dependencies/node_modules/universalify": { - "version": "0.1.2", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 4.0.0" - } - }, - "node_modules/@lerna/timer": { - "version": "3.13.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 6.9.0" - } - }, - "node_modules/@lerna/validation-error": { - "version": "3.13.0", - "dev": true, - "license": "MIT", - "dependencies": { - "npmlog": "^4.1.2" - }, - "engines": { - "node": ">= 6.9.0" - } - }, - "node_modules/@lerna/version": { - "version": "3.22.1", - "dev": true, - "license": "MIT", - "dependencies": { - "@lerna/check-working-tree": "3.16.5", - "@lerna/child-process": "3.16.5", - "@lerna/collect-updates": "3.20.0", - "@lerna/command": "3.21.0", - "@lerna/conventional-commits": "3.22.0", - "@lerna/github-client": "3.22.0", - "@lerna/gitlab-client": "3.15.0", - "@lerna/output": "3.13.0", - "@lerna/prerelease-id-from-version": "3.16.0", - "@lerna/prompt": "3.18.5", - "@lerna/run-lifecycle": "3.16.2", - "@lerna/run-topologically": "3.18.5", - "@lerna/validation-error": "3.13.0", - "chalk": "^2.3.1", - "dedent": "^0.7.0", - "load-json-file": "^5.3.0", - "minimatch": "^3.0.4", - "npmlog": "^4.1.2", - "p-map": "^2.1.0", - "p-pipe": "^1.2.0", - "p-reduce": "^1.0.0", - "p-waterfall": "^1.0.0", - "semver": "^6.2.0", - "slash": "^2.0.0", - "temp-write": "^3.4.0", - "write-json-file": "^3.2.0" - }, - "engines": { - "node": ">= 6.9.0" - } - }, - "node_modules/@lerna/version/node_modules/ansi-styles": { - "version": "3.2.1", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@lerna/version/node_modules/chalk": { - "version": "2.4.2", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@lerna/version/node_modules/color-convert": { - "version": "1.9.3", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "1.1.3" - } - }, - "node_modules/@lerna/version/node_modules/color-name": { - "version": "1.1.3", - "dev": true, - "license": "MIT" - }, - "node_modules/@lerna/version/node_modules/has-flag": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/@lerna/version/node_modules/semver": { - "version": "6.3.0", - "dev": true, - "license": "ISC", - "bin": { - "semver": "bin/semver.js" - } - }, - "node_modules/@lerna/version/node_modules/slash": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/@lerna/version/node_modules/supports-color": { - "version": "5.5.0", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@lerna/write-log-file": { - "version": "3.13.0", - "dev": true, - "license": "MIT", - "dependencies": { - "npmlog": "^4.1.2", - "write-file-atomic": "^2.3.0" - }, - "engines": { - "node": ">= 6.9.0" - } - }, - "node_modules/@microsoft/api-documenter": { - "version": "7.12.12", - "dev": true, - "license": "MIT", - "dependencies": { - "@microsoft/api-extractor-model": "7.12.2", - "@microsoft/tsdoc": "0.12.24", - "@rushstack/node-core-library": "3.36.0", - "@rushstack/ts-command-line": "4.7.8", - "colors": "~1.2.1", - "js-yaml": "~3.13.1", - "resolve": "~1.17.0" - }, - "bin": { - "api-documenter": "bin/api-documenter" - } - }, - "node_modules/@microsoft/api-extractor": { - "version": "7.13.2", - "dev": true, - "license": "MIT", - "dependencies": { - "@microsoft/api-extractor-model": "7.12.2", - "@microsoft/tsdoc": "0.12.24", - "@rushstack/node-core-library": "3.36.0", - "@rushstack/rig-package": "0.2.10", - "@rushstack/ts-command-line": "4.7.8", - "colors": "~1.2.1", - "lodash": "~4.17.15", - "resolve": "~1.17.0", - "semver": "~7.3.0", - "source-map": "~0.6.1", - "typescript": "~4.1.3" - }, - "bin": { - "api-extractor": "bin/api-extractor" - } - }, - "node_modules/@microsoft/api-extractor-model": { - "version": "7.12.2", - "dev": true, - "license": "MIT", - "dependencies": { - "@microsoft/tsdoc": "0.12.24", - "@rushstack/node-core-library": "3.36.0" - } - }, - "node_modules/@microsoft/api-extractor/node_modules/typescript": { - "version": "4.1.5", - "dev": true, - "license": "Apache-2.0", - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=4.2.0" - } - }, - "node_modules/@microsoft/tsdoc": { - "version": "0.12.24", - "dev": true, - "license": "MIT" - }, - "node_modules/@mrmlnc/readdir-enhanced": { - "version": "2.2.1", - "dev": true, - "license": "MIT", - "dependencies": { - "call-me-maybe": "^1.0.1", - "glob-to-regexp": "^0.3.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@nodelib/fs.scandir": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.4.tgz", - "integrity": "sha512-33g3pMJk3bg5nXbL/+CY6I2eJDzZAni49PfJnL5fghPTggPvBd/pFNSgJsdAgWptuFu7qq/ERvOYFlhvsLTCKA==", - "dev": true, - "dependencies": { - "@nodelib/fs.stat": "2.0.4", - "run-parallel": "^1.1.9" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/@nodelib/fs.scandir/node_modules/@nodelib/fs.stat": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.4.tgz", - "integrity": "sha512-IYlHJA0clt2+Vg7bccq+TzRdJvv19c2INqBSsoOLp1je7xjtr7J26+WXR72MCdvU9q1qTzIWDfhMf+DRvQJK4Q==", - "dev": true, - "engines": { - "node": ">= 8" - } - }, - "node_modules/@nodelib/fs.stat": { - "version": "1.1.3", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 6" - } - }, - "node_modules/@nodelib/fs.walk": { - "version": "1.2.6", - "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.6.tgz", - "integrity": "sha512-8Broas6vTtW4GIXTAHDoE32hnN2M5ykgCpWGbuXHQ15vEMqr23pB76e/GZcYsZCHALv50ktd24qhEyKr6wBtow==", - "dev": true, - "dependencies": { - "@nodelib/fs.scandir": "2.1.4", - "fastq": "^1.6.0" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/@octokit/auth-token": { - "version": "2.4.5", - "dev": true, - "license": "MIT", - "dependencies": { - "@octokit/types": "^6.0.3" - } - }, - "node_modules/@octokit/core": { - "version": "3.3.0", - "dev": true, - "license": "MIT", - "peer": true, - "dependencies": { - "@octokit/auth-token": "^2.4.4", - "@octokit/graphql": "^4.5.8", - "@octokit/request": "^5.4.12", - "@octokit/request-error": "^2.0.5", - "@octokit/types": "^6.0.3", - "before-after-hook": "^2.2.0", - "universal-user-agent": "^6.0.0" - } - }, - "node_modules/@octokit/core/node_modules/@octokit/request-error": { - "version": "2.0.5", - "dev": true, - "license": "MIT", - "peer": true, - "dependencies": { - "@octokit/types": "^6.0.3", - "deprecation": "^2.0.0", - "once": "^1.4.0" - } - }, - "node_modules/@octokit/core/node_modules/universal-user-agent": { - "version": "6.0.0", - "dev": true, - "license": "ISC", - "peer": true - }, - "node_modules/@octokit/endpoint": { - "version": "6.0.11", - "dev": true, - "license": "MIT", - "dependencies": { - "@octokit/types": "^6.0.3", - "is-plain-object": "^5.0.0", - "universal-user-agent": "^6.0.0" - } - }, - "node_modules/@octokit/endpoint/node_modules/universal-user-agent": { - "version": "6.0.0", - "dev": true, - "license": "ISC" - }, - "node_modules/@octokit/graphql": { - "version": "4.6.1", - "dev": true, - "license": "MIT", - "peer": true, - "dependencies": { - "@octokit/request": "^5.3.0", - "@octokit/types": "^6.0.3", - "universal-user-agent": "^6.0.0" - } - }, - "node_modules/@octokit/graphql/node_modules/universal-user-agent": { - "version": "6.0.0", - "dev": true, - "license": "ISC", - "peer": true - }, - "node_modules/@octokit/openapi-types": { - "version": "5.3.2", - "dev": true, - "license": "MIT" - }, - "node_modules/@octokit/plugin-enterprise-rest": { - "version": "6.0.1", - "dev": true, - "license": "MIT" - }, - "node_modules/@octokit/plugin-paginate-rest": { - "version": "1.1.2", - "dev": true, - "license": "MIT", - "dependencies": { - "@octokit/types": "^2.0.1" - } - }, - "node_modules/@octokit/plugin-paginate-rest/node_modules/@octokit/types": { - "version": "2.16.2", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/node": ">= 8" - } - }, - "node_modules/@octokit/plugin-request-log": { - "version": "1.0.3", - "dev": true, - "license": "MIT", - "peerDependencies": { - "@octokit/core": ">=3" - } - }, - "node_modules/@octokit/plugin-rest-endpoint-methods": { - "version": "2.4.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@octokit/types": "^2.0.1", - "deprecation": "^2.3.1" - } - }, - "node_modules/@octokit/plugin-rest-endpoint-methods/node_modules/@octokit/types": { - "version": "2.16.2", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/node": ">= 8" - } - }, - "node_modules/@octokit/request": { - "version": "5.4.14", - "dev": true, - "license": "MIT", - "dependencies": { - "@octokit/endpoint": "^6.0.1", - "@octokit/request-error": "^2.0.0", - "@octokit/types": "^6.7.1", - "deprecation": "^2.0.0", - "is-plain-object": "^5.0.0", - "node-fetch": "^2.6.1", - "once": "^1.4.0", - "universal-user-agent": "^6.0.0" - } - }, - "node_modules/@octokit/request-error": { - "version": "1.2.1", - "dev": true, - "license": "MIT", - "dependencies": { - "@octokit/types": "^2.0.0", - "deprecation": "^2.0.0", - "once": "^1.4.0" - } - }, - "node_modules/@octokit/request-error/node_modules/@octokit/types": { - "version": "2.16.2", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/node": ">= 8" - } - }, - "node_modules/@octokit/request/node_modules/@octokit/request-error": { - "version": "2.0.5", - "dev": true, - "license": "MIT", - "dependencies": { - "@octokit/types": "^6.0.3", - "deprecation": "^2.0.0", - "once": "^1.4.0" - } - }, - "node_modules/@octokit/request/node_modules/universal-user-agent": { - "version": "6.0.0", - "dev": true, - "license": "ISC" - }, - "node_modules/@octokit/rest": { - "version": "16.43.2", - "dev": true, - "license": "MIT", - "dependencies": { - "@octokit/auth-token": "^2.4.0", - "@octokit/plugin-paginate-rest": "^1.1.1", - "@octokit/plugin-request-log": "^1.0.0", - "@octokit/plugin-rest-endpoint-methods": "2.4.0", - "@octokit/request": "^5.2.0", - "@octokit/request-error": "^1.0.2", - "atob-lite": "^2.0.0", - "before-after-hook": "^2.0.0", - "btoa-lite": "^1.0.0", - "deprecation": "^2.0.0", - "lodash.get": "^4.4.2", - "lodash.set": "^4.3.2", - "lodash.uniq": "^4.5.0", - "octokit-pagination-methods": "^1.1.0", - "once": "^1.4.0", - "universal-user-agent": "^4.0.0" - } - }, - "node_modules/@octokit/types": { - "version": "6.12.2", - "dev": true, - "license": "MIT", - "dependencies": { - "@octokit/openapi-types": "^5.3.2" - } - }, - "node_modules/@rollup/plugin-alias": { - "version": "3.1.2", - "dev": true, - "license": "MIT", - "dependencies": { - "slash": "^3.0.0" - }, - "engines": { - "node": ">=8.0.0" - }, - "peerDependencies": { - "rollup": "^1.20.0||^2.0.0" - } - }, - "node_modules/@rollup/plugin-commonjs": { - "version": "17.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@rollup/pluginutils": "^3.1.0", - "commondir": "^1.0.1", - "estree-walker": "^2.0.1", - "glob": "^7.1.6", - "is-reference": "^1.2.1", - "magic-string": "^0.25.7", - "resolve": "^1.17.0" - }, - "engines": { - "node": ">= 8.0.0" - }, - "peerDependencies": { - "rollup": "^2.30.0" - } - }, - "node_modules/@rollup/plugin-inject": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/@rollup/plugin-inject/-/plugin-inject-4.0.2.tgz", - "integrity": "sha512-TSLMA8waJ7Dmgmoc8JfPnwUwVZgLjjIAM6MqeIFqPO2ODK36JqE0Cf2F54UTgCUuW8da93Mvoj75a6KAVWgylw==", - "dev": true, - "dependencies": { - "@rollup/pluginutils": "^3.0.4", - "estree-walker": "^1.0.1", - "magic-string": "^0.25.5" - }, - "peerDependencies": { - "rollup": "^1.20.0 || ^2.0.0" - } - }, - "node_modules/@rollup/plugin-inject/node_modules/estree-walker": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-1.0.1.tgz", - "integrity": "sha512-1fMXF3YP4pZZVozF8j/ZLfvnR8NSIljt56UhbZ5PeeDmmGHpgpdwQt7ITlGvYaQukCvuBRMLEiKiYC+oeIg4cg==", - "dev": true - }, - "node_modules/@rollup/plugin-json": { - "version": "4.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@rollup/pluginutils": "^3.0.8" - }, - "peerDependencies": { - "rollup": "^1.20.0 || ^2.0.0" - } - }, - "node_modules/@rollup/plugin-node-resolve": { - "version": "13.0.2", - "resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-13.0.2.tgz", - "integrity": "sha512-hv+eAMcA2hQ7qvPVcXbtIyc0dtue4jMyA2sCW4IMkrmh+SeDDEHg1MXTv65VPpKdtjvWzN3+4mHAEl4rT+zgzQ==", - "dev": true, - "dependencies": { - "@rollup/pluginutils": "^3.1.0", - "@types/resolve": "1.17.1", - "builtin-modules": "^3.1.0", - "deepmerge": "^4.2.2", - "is-module": "^1.0.0", - "resolve": "^1.19.0" - }, - "engines": { - "node": ">= 10.0.0" - }, - "peerDependencies": { - "rollup": "^2.42.0" - } - }, - "node_modules/@rollup/plugin-node-resolve/node_modules/@types/resolve": { - "version": "1.17.1", - "resolved": "https://registry.npmjs.org/@types/resolve/-/resolve-1.17.1.tgz", - "integrity": "sha512-yy7HuzQhj0dhGpD8RLXSZWEkLsV9ibvxvi6EiJ3bkqLAO1RGo0WbkWQiwpRlSFymTJRz0d3k5LM3kkx8ArDbLw==", - "dev": true, - "dependencies": { - "@types/node": "*" - } - }, - "node_modules/@rollup/plugin-node-resolve/node_modules/resolve": { - "version": "1.20.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz", - "integrity": "sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A==", - "dev": true, - "dependencies": { - "is-core-module": "^2.2.0", - "path-parse": "^1.0.6" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/@rollup/pluginutils": { - "version": "3.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/estree": "0.0.39", - "estree-walker": "^1.0.1", - "picomatch": "^2.2.2" - }, - "engines": { - "node": ">= 8.0.0" - }, - "peerDependencies": { - "rollup": "^1.20.0||^2.0.0" - } - }, - "node_modules/@rollup/pluginutils/node_modules/estree-walker": { - "version": "1.0.1", - "dev": true, - "license": "MIT" - }, - "node_modules/@rushstack/node-core-library": { - "version": "3.36.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/node": "10.17.13", - "colors": "~1.2.1", - "fs-extra": "~7.0.1", - "import-lazy": "~4.0.0", - "jju": "~1.4.0", - "resolve": "~1.17.0", - "semver": "~7.3.0", - "timsort": "~0.3.0", - "z-schema": "~3.18.3" - } - }, - "node_modules/@rushstack/node-core-library/node_modules/fs-extra": { - "version": "7.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "graceful-fs": "^4.1.2", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - }, - "engines": { - "node": ">=6 <7 || >=8" - } - }, - "node_modules/@rushstack/node-core-library/node_modules/jsonfile": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "optionalDependencies": { - "graceful-fs": "^4.1.6" - } - }, - "node_modules/@rushstack/node-core-library/node_modules/universalify": { - "version": "0.1.2", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 4.0.0" - } - }, - "node_modules/@rushstack/rig-package": { - "version": "0.2.10", - "dev": true, - "license": "MIT", - "dependencies": { - "resolve": "~1.17.0", - "strip-json-comments": "~3.1.1" - } - }, - "node_modules/@rushstack/ts-command-line": { - "version": "4.7.8", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/argparse": "1.0.38", - "argparse": "~1.0.9", - "colors": "~1.2.1", - "string-argv": "~0.3.1" - } - }, - "node_modules/@sinonjs/commons": { - "version": "1.8.2", - "dev": true, - "license": "BSD-3-Clause", - "dependencies": { - "type-detect": "4.0.8" - } - }, - "node_modules/@sinonjs/formatio": { - "version": "3.2.2", - "dev": true, - "license": "BSD-3-Clause", - "dependencies": { - "@sinonjs/commons": "^1", - "@sinonjs/samsam": "^3.1.0" - } - }, - "node_modules/@sinonjs/samsam": { - "version": "3.3.3", - "dev": true, - "license": "BSD-3-Clause", - "dependencies": { - "@sinonjs/commons": "^1.3.0", - "array-from": "^2.1.1", - "lodash": "^4.17.15" - } - }, - "node_modules/@sinonjs/text-encoding": { - "version": "0.7.1", - "dev": true, - "license": "(Unlicense OR Apache-2.0)" - }, - "node_modules/@tweenjs/tween.js": { - "version": "18.6.4", - "license": "MIT" - }, - "node_modules/@types/argparse": { - "version": "1.0.38", - "dev": true, - "license": "MIT" - }, - "node_modules/@types/babel__core": { - "version": "7.1.12", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/parser": "^7.1.0", - "@babel/types": "^7.0.0", - "@types/babel__generator": "*", - "@types/babel__template": "*", - "@types/babel__traverse": "*" - } - }, - "node_modules/@types/babel__generator": { - "version": "7.6.2", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/types": "^7.0.0" - } - }, - "node_modules/@types/babel__template": { - "version": "7.4.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/parser": "^7.1.0", - "@babel/types": "^7.0.0" - } - }, - "node_modules/@types/babel__traverse": { - "version": "7.11.1", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/types": "^7.3.0" - } - }, - "node_modules/@types/eslint-visitor-keys": { - "version": "1.0.0", - "dev": true, - "license": "MIT" - }, - "node_modules/@types/estree": { - "version": "0.0.39", - "dev": true, - "license": "MIT" - }, - "node_modules/@types/fs-extra": { - "version": "8.1.1", - "resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-8.1.1.tgz", - "integrity": "sha512-TcUlBem321DFQzBNuz8p0CLLKp0VvF/XH9E4KHNmgwyp4E3AfgI5cjiIVZWlbfThBop2qxFIh4+LeY6hVWWZ2w==", - "dev": true, - "dependencies": { - "@types/node": "*" - } - }, - "node_modules/@types/glob": { - "version": "7.1.3", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/minimatch": "*", - "@types/node": "*" - } - }, - "node_modules/@types/istanbul-lib-coverage": { - "version": "2.0.3", - "dev": true, - "license": "MIT" - }, - "node_modules/@types/istanbul-lib-report": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/istanbul-lib-coverage": "*" - } - }, - "node_modules/@types/istanbul-reports": { - "version": "1.1.2", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/istanbul-lib-coverage": "*", - "@types/istanbul-lib-report": "*" - } - }, - "node_modules/@types/jest": { - "version": "24.9.1", - "dev": true, - "license": "MIT", - "dependencies": { - "jest-diff": "^24.3.0" - } - }, - "node_modules/@types/json-schema": { - "version": "7.0.7", - "dev": true, - "license": "MIT" - }, - "node_modules/@types/lodash": { - "version": "4.14.168", - "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.168.tgz", - "integrity": "sha512-oVfRvqHV/V6D1yifJbVRU3TMp8OT6o6BG+U9MkwuJ3U8/CsDHvalRpsxBqivn71ztOFZBTfJMvETbqHiaNSj7Q==", - "dev": true - }, - "node_modules/@types/lodash-es": { - "version": "4.17.4", - "resolved": "https://registry.npmjs.org/@types/lodash-es/-/lodash-es-4.17.4.tgz", - "integrity": "sha512-BBz79DCJbD2CVYZH67MBeHZRX++HF+5p8Mo5MzjZi64Wac39S3diedJYHZtScbRVf4DjZyN6LzA0SB0zy+HSSQ==", - "dev": true, - "dependencies": { - "@types/lodash": "*" - } - }, - "node_modules/@types/minimatch": { - "version": "3.0.3", - "dev": true, - "license": "MIT" - }, - "node_modules/@types/minimist": { - "version": "1.2.1", - "dev": true, - "license": "MIT" - }, - "node_modules/@types/node": { - "version": "10.17.13", - "dev": true, - "license": "MIT" - }, - "node_modules/@types/normalize-package-data": { - "version": "2.4.0", - "dev": true, - "license": "MIT" - }, - "node_modules/@types/pixi.js": { - "version": "4.8.9", - "dev": true, - "license": "MIT" - }, - "node_modules/@types/resolve": { - "version": "0.0.8", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/node": "*" - } - }, - "node_modules/@types/stack-utils": { - "version": "1.0.1", - "dev": true, - "license": "MIT" - }, - "node_modules/@types/yargs": { - "version": "13.0.11", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/yargs-parser": "*" - } - }, - "node_modules/@types/yargs-parser": { - "version": "20.2.0", - "dev": true, - "license": "MIT" - }, - "node_modules/@typescript-eslint/eslint-plugin": { - "version": "1.13.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@typescript-eslint/experimental-utils": "1.13.0", - "eslint-utils": "^1.3.1", - "functional-red-black-tree": "^1.0.1", - "regexpp": "^2.0.1", - "tsutils": "^3.7.0" - }, - "engines": { - "node": "^6.14.0 || ^8.10.0 || >=9.10.0" - }, - "peerDependencies": { - "@typescript-eslint/parser": "^1.9.0", - "eslint": "^5.0.0" - } - }, - "node_modules/@typescript-eslint/experimental-utils": { - "version": "1.13.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/json-schema": "^7.0.3", - "@typescript-eslint/typescript-estree": "1.13.0", - "eslint-scope": "^4.0.0" - }, - "engines": { - "node": "^6.14.0 || ^8.10.0 || >=9.10.0" - }, - "peerDependencies": { - "eslint": "*" - } - }, - "node_modules/@typescript-eslint/parser": { - "version": "1.13.0", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "@types/eslint-visitor-keys": "^1.0.0", - "@typescript-eslint/experimental-utils": "1.13.0", - "@typescript-eslint/typescript-estree": "1.13.0", - "eslint-visitor-keys": "^1.0.0" - }, - "engines": { - "node": "^6.14.0 || ^8.10.0 || >=9.10.0" - }, - "peerDependencies": { - "eslint": "^5.0.0" - } - }, - "node_modules/@typescript-eslint/typescript-estree": { - "version": "1.13.0", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "lodash.unescape": "4.0.1", - "semver": "5.5.0" - }, - "engines": { - "node": ">=6.14.0" - } - }, - "node_modules/@typescript-eslint/typescript-estree/node_modules/semver": { - "version": "5.5.0", - "dev": true, - "license": "ISC", - "bin": { - "semver": "bin/semver" - } - }, - "node_modules/@zkochan/cmd-shim": { - "version": "3.1.0", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "is-windows": "^1.0.0", - "mkdirp-promise": "^5.0.1", - "mz": "^2.5.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/abab": { - "version": "2.0.5", - "dev": true, - "license": "BSD-3-Clause" - }, - "node_modules/abbrev": { - "version": "1.1.1", - "dev": true, - "license": "ISC" - }, - "node_modules/acorn": { - "version": "7.4.1", - "dev": true, - "license": "MIT", - "bin": { - "acorn": "bin/acorn" - }, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/acorn-globals": { - "version": "4.3.4", - "dev": true, - "license": "MIT", - "dependencies": { - "acorn": "^6.0.1", - "acorn-walk": "^6.0.1" - } - }, - "node_modules/acorn-globals/node_modules/acorn": { - "version": "6.4.2", - "dev": true, - "license": "MIT", - "bin": { - "acorn": "bin/acorn" - }, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/acorn-jsx": { - "version": "5.3.1", - "dev": true, - "license": "MIT", - "peerDependencies": { - "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" - } - }, - "node_modules/acorn-walk": { - "version": "6.2.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/agent-base": { - "version": "4.3.0", - "dev": true, - "license": "MIT", - "dependencies": { - "es6-promisify": "^5.0.0" - }, - "engines": { - "node": ">= 4.0.0" - } - }, - "node_modules/agentkeepalive": { - "version": "3.5.2", - "dev": true, - "license": "MIT", - "dependencies": { - "humanize-ms": "^1.2.1" - }, - "engines": { - "node": ">= 4.0.0" - } - }, - "node_modules/ajv": { - "version": "6.12.6", - "dev": true, - "license": "MIT", - "dependencies": { - "fast-deep-equal": "^3.1.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" - } - }, - "node_modules/ansi-colors": { - "version": "4.1.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/ansi-escapes": { - "version": "4.3.1", - "dev": true, - "license": "MIT", - "dependencies": { - "type-fest": "^0.11.0" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/ansi-escapes/node_modules/type-fest": { - "version": "0.11.0", - "dev": true, - "license": "(MIT OR CC0-1.0)", - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/ansi-regex": { - "version": "4.1.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/ansi-styles": { - "version": "4.3.0", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/any-promise": { - "version": "1.3.0", - "dev": true, - "license": "MIT" - }, - "node_modules/anymatch": { - "version": "2.0.0", - "dev": true, - "license": "ISC", - "dependencies": { - "micromatch": "^3.1.4", - "normalize-path": "^2.1.1" - } - }, - "node_modules/aproba": { - "version": "2.0.0", - "dev": true, - "license": "ISC" - }, - "node_modules/are-we-there-yet": { - "version": "1.1.5", - "dev": true, - "license": "ISC", - "dependencies": { - "delegates": "^1.0.0", - "readable-stream": "^2.0.6" - } - }, - "node_modules/are-we-there-yet/node_modules/isarray": { - "version": "1.0.0", - "dev": true, - "license": "MIT" - }, - "node_modules/are-we-there-yet/node_modules/readable-stream": { - "version": "2.3.7", - "dev": true, - "license": "MIT", - "dependencies": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "node_modules/are-we-there-yet/node_modules/string_decoder": { - "version": "1.1.1", - "dev": true, - "license": "MIT", - "dependencies": { - "safe-buffer": "~5.1.0" - } - }, - "node_modules/argparse": { - "version": "1.0.10", - "dev": true, - "license": "MIT", - "dependencies": { - "sprintf-js": "~1.0.2" - } - }, - "node_modules/arr-diff": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/arr-flatten": { - "version": "1.1.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/arr-union": { - "version": "3.1.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/array-differ": { - "version": "2.1.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/array-equal": { - "version": "1.0.0", - "dev": true, - "license": "MIT" - }, - "node_modules/array-find-index": { - "version": "1.0.2", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/array-from": { - "version": "2.1.1", - "dev": true, - "license": "MIT" - }, - "node_modules/array-ify": { - "version": "1.0.0", - "dev": true, - "license": "MIT" - }, - "node_modules/array-union": { - "version": "1.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "array-uniq": "^1.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/array-uniq": { - "version": "1.0.3", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/array-unique": { - "version": "0.3.2", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/arrify": { - "version": "1.0.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/asap": { - "version": "2.0.6", - "dev": true, - "license": "MIT" - }, - "node_modules/asn1": { - "version": "0.2.4", - "dev": true, - "license": "MIT", - "dependencies": { - "safer-buffer": "~2.1.0" - } - }, - "node_modules/assert-plus": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.8" - } - }, - "node_modules/assign-symbols": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/astral-regex": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/async": { - "version": "2.6.3", - "dev": true, - "license": "MIT", - "dependencies": { - "lodash": "^4.17.14" - } - }, - "node_modules/async-each": { - "version": "1.0.3", - "dev": true, - "license": "MIT" - }, - "node_modules/async-limiter": { - "version": "1.0.1", - "dev": true, - "license": "MIT" - }, - "node_modules/asynckit": { - "version": "0.4.0", - "dev": true, - "license": "MIT" - }, - "node_modules/at-least-node": { - "version": "1.0.0", - "dev": true, - "license": "ISC", - "engines": { - "node": ">= 4.0.0" - } - }, - "node_modules/atob": { - "version": "2.1.2", - "dev": true, - "license": "(MIT OR Apache-2.0)", - "bin": { - "atob": "bin/atob.js" - }, - "engines": { - "node": ">= 4.5.0" - } - }, - "node_modules/atob-lite": { - "version": "2.0.0", - "dev": true, - "license": "MIT" - }, - "node_modules/aws-sign2": { - "version": "0.7.0", - "dev": true, - "license": "Apache-2.0", - "engines": { - "node": "*" - } - }, - "node_modules/aws4": { - "version": "1.11.0", - "dev": true, - "license": "MIT" - }, - "node_modules/babel-jest": { - "version": "24.9.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/transform": "^24.9.0", - "@jest/types": "^24.9.0", - "@types/babel__core": "^7.1.0", - "babel-plugin-istanbul": "^5.1.0", - "babel-preset-jest": "^24.9.0", - "chalk": "^2.4.2", - "slash": "^2.0.0" - }, - "engines": { - "node": ">= 6" - }, - "peerDependencies": { - "@babel/core": "^7.0.0" - } - }, - "node_modules/babel-jest/node_modules/ansi-styles": { - "version": "3.2.1", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/babel-jest/node_modules/chalk": { - "version": "2.4.2", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/babel-jest/node_modules/color-convert": { - "version": "1.9.3", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "1.1.3" - } - }, - "node_modules/babel-jest/node_modules/color-name": { - "version": "1.1.3", - "dev": true, - "license": "MIT" - }, - "node_modules/babel-jest/node_modules/has-flag": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/babel-jest/node_modules/slash": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/babel-jest/node_modules/supports-color": { - "version": "5.5.0", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/babel-plugin-istanbul": { - "version": "5.2.0", - "dev": true, - "license": "BSD-3-Clause", - "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0", - "find-up": "^3.0.0", - "istanbul-lib-instrument": "^3.3.0", - "test-exclude": "^5.2.3" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/babel-plugin-jest-hoist": { - "version": "24.9.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/babel__traverse": "^7.0.6" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/babel-preset-jest": { - "version": "24.9.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/plugin-syntax-object-rest-spread": "^7.0.0", - "babel-plugin-jest-hoist": "^24.9.0" - }, - "engines": { - "node": ">= 6" - }, - "peerDependencies": { - "@babel/core": "^7.0.0" - } - }, - "node_modules/backbone": { - "version": "1.4.0", - "dev": true, - "license": "MIT", - "dependencies": { - "underscore": ">=1.8.3" - } - }, - "node_modules/balanced-match": { - "version": "1.0.0", - "dev": true, - "license": "MIT" - }, - "node_modules/base": { - "version": "0.11.2", - "dev": true, - "license": "MIT", - "dependencies": { - "cache-base": "^1.0.1", - "class-utils": "^0.3.5", - "component-emitter": "^1.2.1", - "define-property": "^1.0.0", - "isobject": "^3.0.1", - "mixin-deep": "^1.2.0", - "pascalcase": "^0.1.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/base/node_modules/define-property": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "is-descriptor": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/base64-js": { - "version": "1.5.1", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT" - }, - "node_modules/bcrypt-pbkdf": { - "version": "1.0.2", - "dev": true, - "license": "BSD-3-Clause", - "dependencies": { - "tweetnacl": "^0.14.3" - } - }, - "node_modules/before-after-hook": { - "version": "2.2.0", - "dev": true, - "license": "Apache-2.0" - }, - "node_modules/binary-extensions": { - "version": "2.2.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/bindings": { - "version": "1.5.0", - "dev": true, - "license": "MIT", - "optional": true, - "dependencies": { - "file-uri-to-path": "1.0.0" - } - }, - "node_modules/bit-twiddle": { - "version": "1.0.2", - "license": "MIT" - }, - "node_modules/bluebird": { - "version": "3.7.2", - "dev": true, - "license": "MIT" - }, - "node_modules/brace-expansion": { - "version": "1.1.11", - "dev": true, - "license": "MIT", - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "node_modules/braces": { - "version": "2.3.2", - "dev": true, - "license": "MIT", - "dependencies": { - "arr-flatten": "^1.1.0", - "array-unique": "^0.3.2", - "extend-shallow": "^2.0.1", - "fill-range": "^4.0.0", - "isobject": "^3.0.1", - "repeat-element": "^1.1.2", - "snapdragon": "^0.8.1", - "snapdragon-node": "^2.0.1", - "split-string": "^3.0.2", - "to-regex": "^3.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/braces/node_modules/extend-shallow": { - "version": "2.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "is-extendable": "^0.1.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/braces/node_modules/is-extendable": { - "version": "0.1.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/brotli": { - "version": "1.3.2", - "dev": true, - "license": "MIT", - "dependencies": { - "base64-js": "^1.1.2" - } - }, - "node_modules/browser-process-hrtime": { - "version": "1.0.0", - "dev": true, - "license": "BSD-2-Clause" - }, - "node_modules/browser-resolve": { - "version": "1.11.3", - "dev": true, - "license": "MIT", - "dependencies": { - "resolve": "1.1.7" - } - }, - "node_modules/browser-resolve/node_modules/resolve": { - "version": "1.1.7", - "dev": true, - "license": "MIT" - }, - "node_modules/browserslist": { - "version": "4.16.3", - "dev": true, - "license": "MIT", - "dependencies": { - "caniuse-lite": "^1.0.30001181", - "colorette": "^1.2.1", - "electron-to-chromium": "^1.3.649", - "escalade": "^3.1.1", - "node-releases": "^1.1.70" - }, - "bin": { - "browserslist": "cli.js" - }, - "engines": { - "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" - } - }, - "node_modules/bs-logger": { - "version": "0.2.6", - "dev": true, - "license": "MIT", - "dependencies": { - "fast-json-stable-stringify": "2.x" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/bser": { - "version": "2.1.1", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "node-int64": "^0.4.0" - } - }, - "node_modules/btoa-lite": { - "version": "1.0.0", - "dev": true, - "license": "MIT" - }, - "node_modules/buffer-from": { - "version": "1.1.1", - "dev": true, - "license": "MIT" - }, - "node_modules/builtin-modules": { - "version": "3.2.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/builtins": { - "version": "1.0.3", - "dev": true, - "license": "MIT" - }, - "node_modules/byline": { - "version": "5.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/byte-size": { - "version": "5.0.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/cacache": { - "version": "12.0.4", - "dev": true, - "license": "ISC", - "dependencies": { - "bluebird": "^3.5.5", - "chownr": "^1.1.1", - "figgy-pudding": "^3.5.1", - "glob": "^7.1.4", - "graceful-fs": "^4.1.15", - "infer-owner": "^1.0.3", - "lru-cache": "^5.1.1", - "mississippi": "^3.0.0", - "mkdirp": "^0.5.1", - "move-concurrently": "^1.0.1", - "promise-inflight": "^1.0.1", - "rimraf": "^2.6.3", - "ssri": "^6.0.1", - "unique-filename": "^1.1.1", - "y18n": "^4.0.0" - } - }, - "node_modules/cache-base": { - "version": "1.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "collection-visit": "^1.0.0", - "component-emitter": "^1.2.1", - "get-value": "^2.0.6", - "has-value": "^1.0.0", - "isobject": "^3.0.1", - "set-value": "^2.0.0", - "to-object-path": "^0.3.0", - "union-value": "^1.0.0", - "unset-value": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/call-bind": { - "version": "1.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "function-bind": "^1.1.1", - "get-intrinsic": "^1.0.2" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/call-me-maybe": { - "version": "1.0.1", - "dev": true, - "license": "MIT" - }, - "node_modules/caller-callsite": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "callsites": "^2.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/caller-callsite/node_modules/callsites": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/caller-path": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "caller-callsite": "^2.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/callsites": { - "version": "3.1.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/camelcase": { - "version": "5.3.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/camelcase-keys": { - "version": "6.2.2", - "dev": true, - "license": "MIT", - "dependencies": { - "camelcase": "^5.3.1", - "map-obj": "^4.0.0", - "quick-lru": "^4.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/caniuse-lite": { - "version": "1.0.30001200", - "dev": true, - "license": "CC-BY-4.0" - }, - "node_modules/capture-exit": { - "version": "2.0.0", - "dev": true, - "license": "ISC", - "dependencies": { - "rsvp": "^4.8.4" - }, - "engines": { - "node": "6.* || 8.* || >= 10.*" - } - }, - "node_modules/caseless": { - "version": "0.12.0", - "dev": true, - "license": "Apache-2.0" - }, - "node_modules/chalk": { - "version": "4.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/chardet": { - "version": "0.7.0", - "dev": true, - "license": "MIT" - }, - "node_modules/chokidar": { - "version": "3.5.1", - "dev": true, - "license": "MIT", - "dependencies": { - "anymatch": "~3.1.1", - "braces": "~3.0.2", - "glob-parent": "~5.1.0", - "is-binary-path": "~2.1.0", - "is-glob": "~4.0.1", - "normalize-path": "~3.0.0", - "readdirp": "~3.5.0" - }, - "engines": { - "node": ">= 8.10.0" - }, - "optionalDependencies": { - "fsevents": "~2.3.1" - } - }, - "node_modules/chokidar/node_modules/anymatch": { - "version": "3.1.1", - "dev": true, - "license": "ISC", - "dependencies": { - "normalize-path": "^3.0.0", - "picomatch": "^2.0.4" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/chokidar/node_modules/braces": { - "version": "3.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "fill-range": "^7.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/chokidar/node_modules/fill-range": { - "version": "7.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "to-regex-range": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/chokidar/node_modules/fsevents": { - "version": "2.3.2", - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" - } - }, - "node_modules/chokidar/node_modules/is-number": { - "version": "7.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.12.0" - } - }, - "node_modules/chokidar/node_modules/normalize-path": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/chokidar/node_modules/to-regex-range": { - "version": "5.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "is-number": "^7.0.0" - }, - "engines": { - "node": ">=8.0" - } - }, - "node_modules/chownr": { - "version": "1.1.4", - "dev": true, - "license": "ISC" - }, - "node_modules/ci-info": { - "version": "2.0.0", - "dev": true, - "license": "MIT" - }, - "node_modules/class-utils": { - "version": "0.3.6", - "dev": true, - "license": "MIT", - "dependencies": { - "arr-union": "^3.1.0", - "define-property": "^0.2.5", - "isobject": "^3.0.0", - "static-extend": "^0.1.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/class-utils/node_modules/define-property": { - "version": "0.2.5", - "dev": true, - "license": "MIT", - "dependencies": { - "is-descriptor": "^0.1.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/class-utils/node_modules/is-accessor-descriptor": { - "version": "0.1.6", - "dev": true, - "license": "MIT", - "dependencies": { - "kind-of": "^3.0.2" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/class-utils/node_modules/is-accessor-descriptor/node_modules/kind-of": { - "version": "3.2.2", - "dev": true, - "license": "MIT", - "dependencies": { - "is-buffer": "^1.1.5" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/class-utils/node_modules/is-data-descriptor": { - "version": "0.1.4", - "dev": true, - "license": "MIT", - "dependencies": { - "kind-of": "^3.0.2" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/class-utils/node_modules/is-data-descriptor/node_modules/kind-of": { - "version": "3.2.2", - "dev": true, - "license": "MIT", - "dependencies": { - "is-buffer": "^1.1.5" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/class-utils/node_modules/is-descriptor": { - "version": "0.1.6", - "dev": true, - "license": "MIT", - "dependencies": { - "is-accessor-descriptor": "^0.1.6", - "is-data-descriptor": "^0.1.4", - "kind-of": "^5.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/class-utils/node_modules/kind-of": { - "version": "5.1.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/cli-cursor": { - "version": "3.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "restore-cursor": "^3.1.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/cli-width": { - "version": "3.0.0", - "dev": true, - "license": "ISC", - "engines": { - "node": ">= 10" - } - }, - "node_modules/cliui": { - "version": "5.0.0", - "dev": true, - "license": "ISC", - "dependencies": { - "string-width": "^3.1.0", - "strip-ansi": "^5.2.0", - "wrap-ansi": "^5.1.0" - } - }, - "node_modules/cliui/node_modules/emoji-regex": { - "version": "7.0.3", - "dev": true, - "license": "MIT" - }, - "node_modules/cliui/node_modules/is-fullwidth-code-point": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/cliui/node_modules/string-width": { - "version": "3.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "emoji-regex": "^7.0.1", - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.1.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/clone": { - "version": "1.0.4", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.8" - } - }, - "node_modules/clone-deep": { - "version": "4.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "is-plain-object": "^2.0.4", - "kind-of": "^6.0.2", - "shallow-clone": "^3.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/clone-deep/node_modules/is-plain-object": { - "version": "2.0.4", - "dev": true, - "license": "MIT", - "dependencies": { - "isobject": "^3.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/co": { - "version": "4.6.0", - "dev": true, - "license": "MIT", - "engines": { - "iojs": ">= 1.0.0", - "node": ">= 0.12.0" - } - }, - "node_modules/code-point-at": { - "version": "1.1.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/collection-visit": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "map-visit": "^1.0.0", - "object-visit": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/color-convert": { - "version": "2.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/color-name": { - "version": "1.1.4", - "dev": true, - "license": "MIT" - }, - "node_modules/colorette": { - "version": "1.2.2", - "dev": true, - "license": "MIT" - }, - "node_modules/colors": { - "version": "1.2.5", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.1.90" - } - }, - "node_modules/columnify": { - "version": "1.5.4", - "dev": true, - "license": "MIT", - "dependencies": { - "strip-ansi": "^3.0.0", - "wcwidth": "^1.0.0" - } - }, - "node_modules/columnify/node_modules/ansi-regex": { - "version": "2.1.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/columnify/node_modules/strip-ansi": { - "version": "3.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-regex": "^2.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/combined-stream": { - "version": "1.0.8", - "dev": true, - "license": "MIT", - "dependencies": { - "delayed-stream": "~1.0.0" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/commander": { - "version": "2.20.3", - "dev": true, - "license": "MIT" - }, - "node_modules/commondir": { - "version": "1.0.1", - "dev": true, - "license": "MIT" - }, - "node_modules/compare-func": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "array-ify": "^1.0.0", - "dot-prop": "^5.1.0" - } - }, - "node_modules/compare-func/node_modules/dot-prop": { - "version": "5.3.0", - "dev": true, - "license": "MIT", - "dependencies": { - "is-obj": "^2.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/compare-func/node_modules/is-obj": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/component-emitter": { - "version": "1.3.0", - "dev": true, - "license": "MIT" - }, - "node_modules/concat-map": { - "version": "0.0.1", - "dev": true, - "license": "MIT" - }, - "node_modules/concat-stream": { - "version": "2.0.0", - "dev": true, - "engines": [ - "node >= 6.0" - ], - "license": "MIT", - "dependencies": { - "buffer-from": "^1.0.0", - "inherits": "^2.0.3", - "readable-stream": "^3.0.2", - "typedarray": "^0.0.6" - } - }, - "node_modules/config-chain": { - "version": "1.1.12", - "dev": true, - "dependencies": { - "ini": "^1.3.4", - "proto-list": "~1.2.1" - } - }, - "node_modules/console-control-strings": { - "version": "1.1.0", - "dev": true, - "license": "ISC" - }, - "node_modules/conventional-changelog-angular": { - "version": "5.0.12", - "dev": true, - "license": "ISC", - "dependencies": { - "compare-func": "^2.0.0", - "q": "^1.5.1" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/conventional-changelog-core": { - "version": "3.2.3", - "dev": true, - "license": "MIT", - "dependencies": { - "conventional-changelog-writer": "^4.0.6", - "conventional-commits-parser": "^3.0.3", - "dateformat": "^3.0.0", - "get-pkg-repo": "^1.0.0", - "git-raw-commits": "2.0.0", - "git-remote-origin-url": "^2.0.0", - "git-semver-tags": "^2.0.3", - "lodash": "^4.2.1", - "normalize-package-data": "^2.3.5", - "q": "^1.5.1", - "read-pkg": "^3.0.0", - "read-pkg-up": "^3.0.0", - "through2": "^3.0.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/conventional-changelog-preset-loader": { - "version": "2.3.4", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=10" - } - }, - "node_modules/conventional-changelog-writer": { - "version": "4.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "compare-func": "^2.0.0", - "conventional-commits-filter": "^2.0.7", - "dateformat": "^3.0.0", - "handlebars": "^4.7.6", - "json-stringify-safe": "^5.0.1", - "lodash": "^4.17.15", - "meow": "^8.0.0", - "semver": "^6.0.0", - "split": "^1.0.0", - "through2": "^4.0.0" - }, - "bin": { - "conventional-changelog-writer": "cli.js" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/conventional-changelog-writer/node_modules/semver": { - "version": "6.3.0", - "dev": true, - "license": "ISC", - "bin": { - "semver": "bin/semver.js" - } - }, - "node_modules/conventional-changelog-writer/node_modules/through2": { - "version": "4.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "readable-stream": "3" - } - }, - "node_modules/conventional-commits-filter": { - "version": "2.0.7", - "dev": true, - "license": "MIT", - "dependencies": { - "lodash.ismatch": "^4.4.0", - "modify-values": "^1.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/conventional-commits-parser": { - "version": "3.2.1", - "dev": true, - "license": "MIT", - "dependencies": { - "is-text-path": "^1.0.1", - "JSONStream": "^1.0.4", - "lodash": "^4.17.15", - "meow": "^8.0.0", - "split2": "^3.0.0", - "through2": "^4.0.0", - "trim-off-newlines": "^1.0.0" - }, - "bin": { - "conventional-commits-parser": "cli.js" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/conventional-commits-parser/node_modules/through2": { - "version": "4.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "readable-stream": "3" - } - }, - "node_modules/conventional-recommended-bump": { - "version": "5.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "concat-stream": "^2.0.0", - "conventional-changelog-preset-loader": "^2.1.1", - "conventional-commits-filter": "^2.0.2", - "conventional-commits-parser": "^3.0.3", - "git-raw-commits": "2.0.0", - "git-semver-tags": "^2.0.3", - "meow": "^4.0.0", - "q": "^1.5.1" - }, - "bin": { - "conventional-recommended-bump": "cli.js" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/conventional-recommended-bump/node_modules/camelcase": { - "version": "4.1.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/conventional-recommended-bump/node_modules/camelcase-keys": { - "version": "4.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "camelcase": "^4.1.0", - "map-obj": "^2.0.0", - "quick-lru": "^1.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/conventional-recommended-bump/node_modules/indent-string": { - "version": "3.2.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/conventional-recommended-bump/node_modules/map-obj": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/conventional-recommended-bump/node_modules/meow": { - "version": "4.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "camelcase-keys": "^4.0.0", - "decamelize-keys": "^1.0.0", - "loud-rejection": "^1.0.0", - "minimist": "^1.1.3", - "minimist-options": "^3.0.1", - "normalize-package-data": "^2.3.4", - "read-pkg-up": "^3.0.0", - "redent": "^2.0.0", - "trim-newlines": "^2.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/conventional-recommended-bump/node_modules/minimist-options": { - "version": "3.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "arrify": "^1.0.1", - "is-plain-obj": "^1.1.0" - }, - "engines": { - "node": ">= 4" - } - }, - "node_modules/conventional-recommended-bump/node_modules/quick-lru": { - "version": "1.1.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/conventional-recommended-bump/node_modules/redent": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "indent-string": "^3.0.0", - "strip-indent": "^2.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/conventional-recommended-bump/node_modules/strip-indent": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/conventional-recommended-bump/node_modules/trim-newlines": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/convert-source-map": { - "version": "1.7.0", - "dev": true, - "license": "MIT", - "dependencies": { - "safe-buffer": "~5.1.1" - } - }, - "node_modules/copy-concurrently": { - "version": "1.0.5", - "dev": true, - "license": "ISC", - "dependencies": { - "aproba": "^1.1.1", - "fs-write-stream-atomic": "^1.0.8", - "iferr": "^0.1.5", - "mkdirp": "^0.5.1", - "rimraf": "^2.5.4", - "run-queue": "^1.0.0" - } - }, - "node_modules/copy-concurrently/node_modules/aproba": { - "version": "1.2.0", - "dev": true, - "license": "ISC" - }, - "node_modules/copy-descriptor": { - "version": "0.1.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/core-js": { - "version": "3.16.0", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.16.0.tgz", - "integrity": "sha512-5+5VxRFmSf97nM8Jr2wzOwLqRo6zphH2aX+7KsAUONObyzakDNq2G/bgbhinxB4PoV9L3aXQYhiDKyIKWd2c8g==", - "hasInstallScript": true, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/core-js" - } - }, - "node_modules/core-util-is": { - "version": "1.0.2", - "dev": true, - "license": "MIT" - }, - "node_modules/corser": { - "version": "2.0.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.4.0" - } - }, - "node_modules/cosmiconfig": { - "version": "5.2.1", - "dev": true, - "license": "MIT", - "dependencies": { - "import-fresh": "^2.0.0", - "is-directory": "^0.3.1", - "js-yaml": "^3.13.1", - "parse-json": "^4.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/cosmiconfig/node_modules/import-fresh": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "caller-path": "^2.0.0", - "resolve-from": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/cosmiconfig/node_modules/resolve-from": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/cross-spawn": { - "version": "6.0.5", - "dev": true, - "license": "MIT", - "dependencies": { - "nice-try": "^1.0.4", - "path-key": "^2.0.1", - "semver": "^5.5.0", - "shebang-command": "^1.2.0", - "which": "^1.2.9" - }, - "engines": { - "node": ">=4.8" - } - }, - "node_modules/cross-spawn/node_modules/semver": { - "version": "5.7.1", - "dev": true, - "license": "ISC", - "bin": { - "semver": "bin/semver" - } - }, - "node_modules/cssom": { - "version": "0.3.8", - "dev": true, - "license": "MIT" - }, - "node_modules/cssstyle": { - "version": "1.4.0", - "dev": true, - "license": "MIT", - "dependencies": { - "cssom": "0.3.x" - } - }, - "node_modules/currently-unhandled": { - "version": "0.4.1", - "dev": true, - "license": "MIT", - "dependencies": { - "array-find-index": "^1.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/cyclist": { - "version": "1.0.1", - "dev": true, - "license": "MIT" - }, - "node_modules/dargs": { - "version": "4.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "number-is-nan": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/dashdash": { - "version": "1.14.1", - "dev": true, - "license": "MIT", - "dependencies": { - "assert-plus": "^1.0.0" - }, - "engines": { - "node": ">=0.10" - } - }, - "node_modules/data-urls": { - "version": "1.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "abab": "^2.0.0", - "whatwg-mimetype": "^2.2.0", - "whatwg-url": "^7.0.0" - } - }, - "node_modules/data-urls/node_modules/whatwg-url": { - "version": "7.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "lodash.sortby": "^4.7.0", - "tr46": "^1.0.1", - "webidl-conversions": "^4.0.2" - } - }, - "node_modules/dateformat": { - "version": "3.0.3", - "dev": true, - "license": "MIT", - "engines": { - "node": "*" - } - }, - "node_modules/debug": { - "version": "4.3.1", - "dev": true, - "license": "MIT", - "dependencies": { - "ms": "2.1.2" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/debuglog": { - "version": "1.0.1", - "dev": true, - "license": "MIT", - "engines": { - "node": "*" - } - }, - "node_modules/decamelize": { - "version": "1.2.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/decamelize-keys": { - "version": "1.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "decamelize": "^1.1.0", - "map-obj": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/decamelize-keys/node_modules/map-obj": { - "version": "1.0.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/decode-uri-component": { - "version": "0.2.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10" - } - }, - "node_modules/dedent": { - "version": "0.7.0", - "dev": true, - "license": "MIT" - }, - "node_modules/deep-is": { - "version": "0.1.3", - "dev": true, - "license": "MIT" - }, - "node_modules/deepmerge": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.2.2.tgz", - "integrity": "sha512-FJ3UgI4gIl+PHZm53knsuSFpE+nESMr7M4v9QcgB7S63Kj/6WqMiFQJpBBYz1Pt+66bZpP3Q7Lye0Oo9MPKEdg==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/defaults": { - "version": "1.0.3", - "dev": true, - "license": "MIT", - "dependencies": { - "clone": "^1.0.2" - } - }, - "node_modules/define-properties": { - "version": "1.1.3", - "dev": true, - "license": "MIT", - "dependencies": { - "object-keys": "^1.0.12" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/define-property": { - "version": "2.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "is-descriptor": "^1.0.2", - "isobject": "^3.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/delayed-stream": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/delegates": { - "version": "1.0.0", - "dev": true, - "license": "MIT" - }, - "node_modules/deprecation": { - "version": "2.3.1", - "dev": true, - "license": "ISC" - }, - "node_modules/detect-indent": { - "version": "5.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/detect-newline": { - "version": "2.1.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/dezalgo": { - "version": "1.0.3", - "dev": true, - "license": "ISC", - "dependencies": { - "asap": "^2.0.0", - "wrappy": "1" - } - }, - "node_modules/diff": { - "version": "3.5.0", - "dev": true, - "license": "BSD-3-Clause", - "engines": { - "node": ">=0.3.1" - } - }, - "node_modules/diff-sequences": { - "version": "24.9.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 6" - } - }, - "node_modules/dir-glob": { - "version": "2.2.2", - "dev": true, - "license": "MIT", - "dependencies": { - "path-type": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/doctrine": { - "version": "3.0.0", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "esutils": "^2.0.2" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/dom-walk": { - "version": "0.1.2" - }, - "node_modules/domexception": { - "version": "1.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "webidl-conversions": "^4.0.2" - } - }, - "node_modules/dot-prop": { - "version": "4.2.1", - "dev": true, - "license": "MIT", - "dependencies": { - "is-obj": "^1.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/duplexer": { - "version": "0.1.2", - "dev": true, - "license": "MIT" - }, - "node_modules/duplexify": { - "version": "3.7.1", - "dev": true, - "license": "MIT", - "dependencies": { - "end-of-stream": "^1.0.0", - "inherits": "^2.0.1", - "readable-stream": "^2.0.0", - "stream-shift": "^1.0.0" - } - }, - "node_modules/duplexify/node_modules/isarray": { - "version": "1.0.0", - "dev": true, - "license": "MIT" - }, - "node_modules/duplexify/node_modules/readable-stream": { - "version": "2.3.7", - "dev": true, - "license": "MIT", - "dependencies": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "node_modules/duplexify/node_modules/string_decoder": { - "version": "1.1.1", - "dev": true, - "license": "MIT", - "dependencies": { - "safe-buffer": "~5.1.0" - } - }, - "node_modules/earcut": { - "version": "2.2.2", - "license": "ISC" - }, - "node_modules/ecc-jsbn": { - "version": "0.1.2", - "dev": true, - "license": "MIT", - "dependencies": { - "jsbn": "~0.1.0", - "safer-buffer": "^2.1.0" - } - }, - "node_modules/ecstatic": { - "version": "3.3.2", - "dev": true, - "license": "MIT", - "dependencies": { - "he": "^1.1.1", - "mime": "^1.6.0", - "minimist": "^1.1.0", - "url-join": "^2.0.5" - }, - "bin": { - "ecstatic": "lib/ecstatic.js" - } - }, - "node_modules/electron-to-chromium": { - "version": "1.3.687", - "dev": true, - "license": "ISC" - }, - "node_modules/emoji-regex": { - "version": "8.0.0", - "dev": true, - "license": "MIT" - }, - "node_modules/encoding": { - "version": "0.1.13", - "dev": true, - "license": "MIT", - "dependencies": { - "iconv-lite": "^0.6.2" - } - }, - "node_modules/encoding/node_modules/iconv-lite": { - "version": "0.6.2", - "dev": true, - "license": "MIT", - "dependencies": { - "safer-buffer": ">= 2.1.2 < 3.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/end-of-stream": { - "version": "1.4.4", - "dev": true, - "license": "MIT", - "dependencies": { - "once": "^1.4.0" - } - }, - "node_modules/enquirer": { - "version": "2.3.6", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-colors": "^4.1.1" - }, - "engines": { - "node": ">=8.6" - } - }, - "node_modules/env-paths": { - "version": "2.2.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/envinfo": { - "version": "7.7.4", - "dev": true, - "license": "MIT", - "bin": { - "envinfo": "dist/cli.js" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/err-code": { - "version": "1.1.2", - "dev": true, - "license": "MIT" - }, - "node_modules/error-ex": { - "version": "1.3.2", - "dev": true, - "license": "MIT", - "dependencies": { - "is-arrayish": "^0.2.1" - } - }, - "node_modules/es-abstract": { - "version": "1.18.0", - "dev": true, - "license": "MIT", - "dependencies": { - "call-bind": "^1.0.2", - "es-to-primitive": "^1.2.1", - "function-bind": "^1.1.1", - "get-intrinsic": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.2", - "is-callable": "^1.2.3", - "is-negative-zero": "^2.0.1", - "is-regex": "^1.1.2", - "is-string": "^1.0.5", - "object-inspect": "^1.9.0", - "object-keys": "^1.1.1", - "object.assign": "^4.1.2", - "string.prototype.trimend": "^1.0.4", - "string.prototype.trimstart": "^1.0.4", - "unbox-primitive": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/es-to-primitive": { - "version": "1.2.1", - "dev": true, - "license": "MIT", - "dependencies": { - "is-callable": "^1.1.4", - "is-date-object": "^1.0.1", - "is-symbol": "^1.0.2" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/es6-promise": { - "version": "4.2.8", - "dev": true, - "license": "MIT" - }, - "node_modules/es6-promisify": { - "version": "5.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "es6-promise": "^4.0.3" - } - }, - "node_modules/escalade": { - "version": "3.1.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/escape-string-regexp": { - "version": "1.0.5", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/escodegen": { - "version": "1.14.3", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "esprima": "^4.0.1", - "estraverse": "^4.2.0", - "esutils": "^2.0.2", - "optionator": "^0.8.1" - }, - "bin": { - "escodegen": "bin/escodegen.js", - "esgenerate": "bin/esgenerate.js" - }, - "engines": { - "node": ">=4.0" - }, - "optionalDependencies": { - "source-map": "~0.6.1" - } - }, - "node_modules/eslint": { - "version": "6.8.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/code-frame": "^7.0.0", - "ajv": "^6.10.0", - "chalk": "^2.1.0", - "cross-spawn": "^6.0.5", - "debug": "^4.0.1", - "doctrine": "^3.0.0", - "eslint-scope": "^5.0.0", - "eslint-utils": "^1.4.3", - "eslint-visitor-keys": "^1.1.0", - "espree": "^6.1.2", - "esquery": "^1.0.1", - "esutils": "^2.0.2", - "file-entry-cache": "^5.0.1", - "functional-red-black-tree": "^1.0.1", - "glob-parent": "^5.0.0", - "globals": "^12.1.0", - "ignore": "^4.0.6", - "import-fresh": "^3.0.0", - "imurmurhash": "^0.1.4", - "inquirer": "^7.0.0", - "is-glob": "^4.0.0", - "js-yaml": "^3.13.1", - "json-stable-stringify-without-jsonify": "^1.0.1", - "levn": "^0.3.0", - "lodash": "^4.17.14", - "minimatch": "^3.0.4", - "mkdirp": "^0.5.1", - "natural-compare": "^1.4.0", - "optionator": "^0.8.3", - "progress": "^2.0.0", - "regexpp": "^2.0.1", - "semver": "^6.1.2", - "strip-ansi": "^5.2.0", - "strip-json-comments": "^3.0.1", - "table": "^5.2.3", - "text-table": "^0.2.0", - "v8-compile-cache": "^2.0.3" - }, - "bin": { - "eslint": "bin/eslint.js" - }, - "engines": { - "node": "^8.10.0 || ^10.13.0 || >=11.10.1" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/eslint-config-prettier": { - "version": "6.15.0", - "dev": true, - "license": "MIT", - "dependencies": { - "get-stdin": "^6.0.0" - }, - "bin": { - "eslint-config-prettier-check": "bin/cli.js" - }, - "peerDependencies": { - "eslint": ">=3.14.1" - } - }, - "node_modules/eslint-plugin-prettier": { - "version": "3.3.1", - "dev": true, - "license": "MIT", - "dependencies": { - "prettier-linter-helpers": "^1.0.0" - }, - "engines": { - "node": ">=6.0.0" - }, - "peerDependencies": { - "eslint": ">=5.0.0", - "prettier": ">=1.13.0" - }, - "peerDependenciesMeta": { - "eslint-config-prettier": { - "optional": true - } - } - }, - "node_modules/eslint-scope": { - "version": "4.0.3", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "esrecurse": "^4.1.0", - "estraverse": "^4.1.1" - }, - "engines": { - "node": ">=4.0.0" - } - }, - "node_modules/eslint-utils": { - "version": "1.4.3", - "dev": true, - "license": "MIT", - "dependencies": { - "eslint-visitor-keys": "^1.1.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/eslint-visitor-keys": { - "version": "1.3.0", - "dev": true, - "license": "Apache-2.0", - "engines": { - "node": ">=4" - } - }, - "node_modules/eslint/node_modules/ansi-styles": { - "version": "3.2.1", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/eslint/node_modules/chalk": { - "version": "2.4.2", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/eslint/node_modules/color-convert": { - "version": "1.9.3", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "1.1.3" - } - }, - "node_modules/eslint/node_modules/color-name": { - "version": "1.1.3", - "dev": true, - "license": "MIT" - }, - "node_modules/eslint/node_modules/eslint-scope": { - "version": "5.1.1", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "esrecurse": "^4.3.0", - "estraverse": "^4.1.1" - }, - "engines": { - "node": ">=8.0.0" - } - }, - "node_modules/eslint/node_modules/has-flag": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/eslint/node_modules/semver": { - "version": "6.3.0", - "dev": true, - "license": "ISC", - "bin": { - "semver": "bin/semver.js" - } - }, - "node_modules/eslint/node_modules/supports-color": { - "version": "5.5.0", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/espree": { - "version": "6.2.1", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "acorn": "^7.1.1", - "acorn-jsx": "^5.2.0", - "eslint-visitor-keys": "^1.1.0" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/esprima": { - "version": "4.0.1", - "dev": true, - "license": "BSD-2-Clause", - "bin": { - "esparse": "bin/esparse.js", - "esvalidate": "bin/esvalidate.js" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/esquery": { - "version": "1.4.0", - "dev": true, - "license": "BSD-3-Clause", - "dependencies": { - "estraverse": "^5.1.0" - }, - "engines": { - "node": ">=0.10" - } - }, - "node_modules/esquery/node_modules/estraverse": { - "version": "5.2.0", - "dev": true, - "license": "BSD-2-Clause", - "engines": { - "node": ">=4.0" - } - }, - "node_modules/esrecurse": { - "version": "4.3.0", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "estraverse": "^5.2.0" - }, - "engines": { - "node": ">=4.0" - } - }, - "node_modules/esrecurse/node_modules/estraverse": { - "version": "5.2.0", - "dev": true, - "license": "BSD-2-Clause", - "engines": { - "node": ">=4.0" - } - }, - "node_modules/estraverse": { - "version": "4.3.0", - "dev": true, - "license": "BSD-2-Clause", - "engines": { - "node": ">=4.0" - } - }, - "node_modules/estree-walker": { - "version": "2.0.2", - "dev": true, - "license": "MIT" - }, - "node_modules/esutils": { - "version": "2.0.3", - "dev": true, - "license": "BSD-2-Clause", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/eventemitter3": { - "version": "4.0.7", - "license": "MIT" - }, - "node_modules/exec-sh": { - "version": "0.3.4", - "dev": true, - "license": "MIT" - }, - "node_modules/execa": { - "version": "4.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "cross-spawn": "^7.0.0", - "get-stream": "^5.0.0", - "human-signals": "^1.1.1", - "is-stream": "^2.0.0", - "merge-stream": "^2.0.0", - "npm-run-path": "^4.0.0", - "onetime": "^5.1.0", - "signal-exit": "^3.0.2", - "strip-final-newline": "^2.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sindresorhus/execa?sponsor=1" - } - }, - "node_modules/execa/node_modules/cross-spawn": { - "version": "7.0.3", - "dev": true, - "license": "MIT", - "dependencies": { - "path-key": "^3.1.0", - "shebang-command": "^2.0.0", - "which": "^2.0.1" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/execa/node_modules/path-key": { - "version": "3.1.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/execa/node_modules/shebang-command": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "shebang-regex": "^3.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/execa/node_modules/shebang-regex": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/execa/node_modules/which": { - "version": "2.0.2", - "dev": true, - "license": "ISC", - "dependencies": { - "isexe": "^2.0.0" - }, - "bin": { - "node-which": "bin/node-which" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/exit": { - "version": "0.1.2", - "dev": true, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/expand-brackets": { - "version": "2.1.4", - "dev": true, - "license": "MIT", - "dependencies": { - "debug": "^2.3.3", - "define-property": "^0.2.5", - "extend-shallow": "^2.0.1", - "posix-character-classes": "^0.1.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/expand-brackets/node_modules/debug": { - "version": "2.6.9", - "dev": true, - "license": "MIT", - "dependencies": { - "ms": "2.0.0" - } - }, - "node_modules/expand-brackets/node_modules/define-property": { - "version": "0.2.5", - "dev": true, - "license": "MIT", - "dependencies": { - "is-descriptor": "^0.1.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/expand-brackets/node_modules/extend-shallow": { - "version": "2.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "is-extendable": "^0.1.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/expand-brackets/node_modules/is-accessor-descriptor": { - "version": "0.1.6", - "dev": true, - "license": "MIT", - "dependencies": { - "kind-of": "^3.0.2" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/expand-brackets/node_modules/is-accessor-descriptor/node_modules/kind-of": { - "version": "3.2.2", - "dev": true, - "license": "MIT", - "dependencies": { - "is-buffer": "^1.1.5" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/expand-brackets/node_modules/is-data-descriptor": { - "version": "0.1.4", - "dev": true, - "license": "MIT", - "dependencies": { - "kind-of": "^3.0.2" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/expand-brackets/node_modules/is-data-descriptor/node_modules/kind-of": { - "version": "3.2.2", - "dev": true, - "license": "MIT", - "dependencies": { - "is-buffer": "^1.1.5" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/expand-brackets/node_modules/is-descriptor": { - "version": "0.1.6", - "dev": true, - "license": "MIT", - "dependencies": { - "is-accessor-descriptor": "^0.1.6", - "is-data-descriptor": "^0.1.4", - "kind-of": "^5.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/expand-brackets/node_modules/is-extendable": { - "version": "0.1.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/expand-brackets/node_modules/kind-of": { - "version": "5.1.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/expand-brackets/node_modules/ms": { - "version": "2.0.0", - "dev": true, - "license": "MIT" - }, - "node_modules/expand-range": { - "version": "1.8.2", - "dev": true, - "license": "MIT", - "dependencies": { - "fill-range": "^2.1.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/expand-range/node_modules/fill-range": { - "version": "2.2.4", - "dev": true, - "license": "MIT", - "dependencies": { - "is-number": "^2.1.0", - "isobject": "^2.0.0", - "randomatic": "^3.0.0", - "repeat-element": "^1.1.2", - "repeat-string": "^1.5.2" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/expand-range/node_modules/is-number": { - "version": "2.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "kind-of": "^3.0.2" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/expand-range/node_modules/isarray": { - "version": "1.0.0", - "dev": true, - "license": "MIT" - }, - "node_modules/expand-range/node_modules/isobject": { - "version": "2.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "isarray": "1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/expand-range/node_modules/kind-of": { - "version": "3.2.2", - "dev": true, - "license": "MIT", - "dependencies": { - "is-buffer": "^1.1.5" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/expect": { - "version": "24.9.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/types": "^24.9.0", - "ansi-styles": "^3.2.0", - "jest-get-type": "^24.9.0", - "jest-matcher-utils": "^24.9.0", - "jest-message-util": "^24.9.0", - "jest-regex-util": "^24.9.0" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/expect/node_modules/ansi-styles": { - "version": "3.2.1", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/expect/node_modules/color-convert": { - "version": "1.9.3", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "1.1.3" - } - }, - "node_modules/expect/node_modules/color-name": { - "version": "1.1.3", - "dev": true, - "license": "MIT" - }, - "node_modules/extend": { - "version": "3.0.2", - "dev": true, - "license": "MIT" - }, - "node_modules/extend-shallow": { - "version": "3.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "assign-symbols": "^1.0.0", - "is-extendable": "^1.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/external-editor": { - "version": "3.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "chardet": "^0.7.0", - "iconv-lite": "^0.4.24", - "tmp": "^0.0.33" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/extglob": { - "version": "2.0.4", - "dev": true, - "license": "MIT", - "dependencies": { - "array-unique": "^0.3.2", - "define-property": "^1.0.0", - "expand-brackets": "^2.1.4", - "extend-shallow": "^2.0.1", - "fragment-cache": "^0.2.1", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/extglob/node_modules/define-property": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "is-descriptor": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/extglob/node_modules/extend-shallow": { - "version": "2.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "is-extendable": "^0.1.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/extglob/node_modules/is-extendable": { - "version": "0.1.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/extsprintf": { - "version": "1.3.0", - "dev": true, - "engines": [ - "node >=0.6.0" - ], - "license": "MIT" - }, - "node_modules/fast-deep-equal": { - "version": "3.1.3", - "dev": true, - "license": "MIT" - }, - "node_modules/fast-diff": { - "version": "1.2.0", - "dev": true, - "license": "Apache-2.0" - }, - "node_modules/fast-glob": { - "version": "2.2.7", - "dev": true, - "license": "MIT", - "dependencies": { - "@mrmlnc/readdir-enhanced": "^2.2.1", - "@nodelib/fs.stat": "^1.1.2", - "glob-parent": "^3.1.0", - "is-glob": "^4.0.0", - "merge2": "^1.2.3", - "micromatch": "^3.1.10" - }, - "engines": { - "node": ">=4.0.0" - } - }, - "node_modules/fast-glob/node_modules/glob-parent": { - "version": "3.1.0", - "dev": true, - "license": "ISC", - "dependencies": { - "is-glob": "^3.1.0", - "path-dirname": "^1.0.0" - } - }, - "node_modules/fast-glob/node_modules/glob-parent/node_modules/is-glob": { - "version": "3.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "is-extglob": "^2.1.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/fast-json-stable-stringify": { - "version": "2.1.0", - "dev": true, - "license": "MIT" - }, - "node_modules/fast-levenshtein": { - "version": "2.0.6", - "dev": true, - "license": "MIT" - }, - "node_modules/fastq": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.11.0.tgz", - "integrity": "sha512-7Eczs8gIPDrVzT+EksYBcupqMyxSHXXrHOLRRxU2/DicV8789MRBRR8+Hc2uWzUupOs4YS4JzBmBxjjCVBxD/g==", - "dev": true, - "dependencies": { - "reusify": "^1.0.4" - } - }, - "node_modules/fb-watchman": { - "version": "2.0.1", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "bser": "2.1.1" - } - }, - "node_modules/figgy-pudding": { - "version": "3.5.2", - "dev": true, - "license": "ISC" - }, - "node_modules/figures": { - "version": "3.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "escape-string-regexp": "^1.0.5" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/file-entry-cache": { - "version": "5.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "flat-cache": "^2.0.1" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/file-uri-to-path": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "optional": true - }, - "node_modules/filename-regex": { - "version": "2.0.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/fill-range": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "extend-shallow": "^2.0.1", - "is-number": "^3.0.0", - "repeat-string": "^1.6.1", - "to-regex-range": "^2.1.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/fill-range/node_modules/extend-shallow": { - "version": "2.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "is-extendable": "^0.1.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/fill-range/node_modules/is-extendable": { - "version": "0.1.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/filter-obj": { - "version": "1.1.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/find-cache-dir": { - "version": "3.3.1", - "dev": true, - "license": "MIT", - "dependencies": { - "commondir": "^1.0.1", - "make-dir": "^3.0.2", - "pkg-dir": "^4.1.0" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/avajs/find-cache-dir?sponsor=1" - } - }, - "node_modules/find-cache-dir/node_modules/find-up": { - "version": "4.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/find-cache-dir/node_modules/locate-path": { - "version": "5.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "p-locate": "^4.1.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/find-cache-dir/node_modules/make-dir": { - "version": "3.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "semver": "^6.0.0" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/find-cache-dir/node_modules/p-locate": { - "version": "4.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "p-limit": "^2.2.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/find-cache-dir/node_modules/path-exists": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/find-cache-dir/node_modules/pkg-dir": { - "version": "4.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "find-up": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/find-cache-dir/node_modules/semver": { - "version": "6.3.0", - "dev": true, - "license": "ISC", - "bin": { - "semver": "bin/semver.js" - } - }, - "node_modules/find-up": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "locate-path": "^3.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/flat-cache": { - "version": "2.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "flatted": "^2.0.0", - "rimraf": "2.6.3", - "write": "1.0.3" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/flatted": { - "version": "2.0.2", - "dev": true, - "license": "ISC" - }, - "node_modules/flush-write-stream": { - "version": "1.1.1", - "dev": true, - "license": "MIT", - "dependencies": { - "inherits": "^2.0.3", - "readable-stream": "^2.3.6" - } - }, - "node_modules/flush-write-stream/node_modules/isarray": { - "version": "1.0.0", - "dev": true, - "license": "MIT" - }, - "node_modules/flush-write-stream/node_modules/readable-stream": { - "version": "2.3.7", - "dev": true, - "license": "MIT", - "dependencies": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "node_modules/flush-write-stream/node_modules/string_decoder": { - "version": "1.1.1", - "dev": true, - "license": "MIT", - "dependencies": { - "safe-buffer": "~5.1.0" - } - }, - "node_modules/follow-redirects": { - "version": "1.13.3", - "dev": true, - "funding": [ - { - "type": "individual", - "url": "https://github.com/sponsors/RubenVerborgh" - } - ], - "license": "MIT", - "engines": { - "node": ">=4.0" - }, - "peerDependenciesMeta": { - "debug": { - "optional": true - } - } - }, - "node_modules/for-each": { - "version": "0.3.3", - "dev": true, - "license": "MIT", - "dependencies": { - "is-callable": "^1.1.3" - } - }, - "node_modules/for-in": { - "version": "1.0.2", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/for-own": { - "version": "0.1.5", - "dev": true, - "license": "MIT", - "dependencies": { - "for-in": "^1.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/forever-agent": { - "version": "0.6.1", - "dev": true, - "license": "Apache-2.0", - "engines": { - "node": "*" - } - }, - "node_modules/form-data": { - "version": "2.3.3", - "dev": true, - "license": "MIT", - "dependencies": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.6", - "mime-types": "^2.1.12" - }, - "engines": { - "node": ">= 0.12" - } - }, - "node_modules/fragment-cache": { - "version": "0.2.1", - "dev": true, - "license": "MIT", - "dependencies": { - "map-cache": "^0.2.2" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/from2": { - "version": "2.3.0", - "dev": true, - "license": "MIT", - "dependencies": { - "inherits": "^2.0.1", - "readable-stream": "^2.0.0" - } - }, - "node_modules/from2/node_modules/isarray": { - "version": "1.0.0", - "dev": true, - "license": "MIT" - }, - "node_modules/from2/node_modules/readable-stream": { - "version": "2.3.7", - "dev": true, - "license": "MIT", - "dependencies": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "node_modules/from2/node_modules/string_decoder": { - "version": "1.1.1", - "dev": true, - "license": "MIT", - "dependencies": { - "safe-buffer": "~5.1.0" - } - }, - "node_modules/fs-extra": { - "version": "9.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "at-least-node": "^1.0.0", - "graceful-fs": "^4.2.0", - "jsonfile": "^6.0.1", - "universalify": "^2.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/fs-minipass": { - "version": "1.2.7", - "dev": true, - "license": "ISC", - "dependencies": { - "minipass": "^2.6.0" - } - }, - "node_modules/fs-write-stream-atomic": { - "version": "1.0.10", - "dev": true, - "license": "ISC", - "dependencies": { - "graceful-fs": "^4.1.2", - "iferr": "^0.1.5", - "imurmurhash": "^0.1.4", - "readable-stream": "1 || 2" - } - }, - "node_modules/fs-write-stream-atomic/node_modules/isarray": { - "version": "1.0.0", - "dev": true, - "license": "MIT" - }, - "node_modules/fs-write-stream-atomic/node_modules/readable-stream": { - "version": "2.3.7", - "dev": true, - "license": "MIT", - "dependencies": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "node_modules/fs-write-stream-atomic/node_modules/string_decoder": { - "version": "1.1.1", - "dev": true, - "license": "MIT", - "dependencies": { - "safe-buffer": "~5.1.0" - } - }, - "node_modules/fs.realpath": { - "version": "1.0.0", - "dev": true, - "license": "ISC" - }, - "node_modules/fsevents": { - "version": "1.2.13", - "dev": true, - "hasInstallScript": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "dependencies": { - "bindings": "^1.5.0", - "nan": "^2.12.1" - }, - "engines": { - "node": ">= 4.0" - } - }, - "node_modules/function-bind": { - "version": "1.1.1", - "dev": true, - "license": "MIT" - }, - "node_modules/functional-red-black-tree": { - "version": "1.0.1", - "dev": true, - "license": "MIT" - }, - "node_modules/gauge": { - "version": "2.7.4", - "dev": true, - "license": "ISC", - "dependencies": { - "aproba": "^1.0.3", - "console-control-strings": "^1.0.0", - "has-unicode": "^2.0.0", - "object-assign": "^4.1.0", - "signal-exit": "^3.0.0", - "string-width": "^1.0.1", - "strip-ansi": "^3.0.1", - "wide-align": "^1.1.0" - } - }, - "node_modules/gauge/node_modules/ansi-regex": { - "version": "2.1.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/gauge/node_modules/aproba": { - "version": "1.2.0", - "dev": true, - "license": "ISC" - }, - "node_modules/gauge/node_modules/is-fullwidth-code-point": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "number-is-nan": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/gauge/node_modules/string-width": { - "version": "1.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "code-point-at": "^1.0.0", - "is-fullwidth-code-point": "^1.0.0", - "strip-ansi": "^3.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/gauge/node_modules/strip-ansi": { - "version": "3.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-regex": "^2.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/genfun": { - "version": "5.0.0", - "dev": true, - "license": "MIT" - }, - "node_modules/gensync": { - "version": "1.0.0-beta.2", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/get-caller-file": { - "version": "2.0.5", - "dev": true, - "license": "ISC", - "engines": { - "node": "6.* || 8.* || >= 10.*" - } - }, - "node_modules/get-intrinsic": { - "version": "1.1.1", - "dev": true, - "license": "MIT", - "dependencies": { - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.1" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/get-pkg-repo": { - "version": "1.4.0", - "dev": true, - "license": "MIT", - "dependencies": { - "hosted-git-info": "^2.1.4", - "meow": "^3.3.0", - "normalize-package-data": "^2.3.0", - "parse-github-repo-url": "^1.3.0", - "through2": "^2.0.0" - }, - "bin": { - "get-pkg-repo": "cli.js" - } - }, - "node_modules/get-pkg-repo/node_modules/camelcase": { - "version": "2.1.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/get-pkg-repo/node_modules/camelcase-keys": { - "version": "2.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "camelcase": "^2.0.0", - "map-obj": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/get-pkg-repo/node_modules/find-up": { - "version": "1.1.2", - "dev": true, - "license": "MIT", - "dependencies": { - "path-exists": "^2.0.0", - "pinkie-promise": "^2.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/get-pkg-repo/node_modules/get-stdin": { - "version": "4.0.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/get-pkg-repo/node_modules/indent-string": { - "version": "2.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "repeating": "^2.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/get-pkg-repo/node_modules/isarray": { - "version": "1.0.0", - "dev": true, - "license": "MIT" - }, - "node_modules/get-pkg-repo/node_modules/load-json-file": { - "version": "1.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "graceful-fs": "^4.1.2", - "parse-json": "^2.2.0", - "pify": "^2.0.0", - "pinkie-promise": "^2.0.0", - "strip-bom": "^2.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/get-pkg-repo/node_modules/map-obj": { - "version": "1.0.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/get-pkg-repo/node_modules/meow": { - "version": "3.7.0", - "dev": true, - "license": "MIT", - "dependencies": { - "camelcase-keys": "^2.0.0", - "decamelize": "^1.1.2", - "loud-rejection": "^1.0.0", - "map-obj": "^1.0.1", - "minimist": "^1.1.3", - "normalize-package-data": "^2.3.4", - "object-assign": "^4.0.1", - "read-pkg-up": "^1.0.1", - "redent": "^1.0.0", - "trim-newlines": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/get-pkg-repo/node_modules/parse-json": { - "version": "2.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "error-ex": "^1.2.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/get-pkg-repo/node_modules/path-exists": { - "version": "2.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "pinkie-promise": "^2.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/get-pkg-repo/node_modules/path-type": { - "version": "1.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "graceful-fs": "^4.1.2", - "pify": "^2.0.0", - "pinkie-promise": "^2.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/get-pkg-repo/node_modules/pify": { - "version": "2.3.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/get-pkg-repo/node_modules/read-pkg": { - "version": "1.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "load-json-file": "^1.0.0", - "normalize-package-data": "^2.3.2", - "path-type": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/get-pkg-repo/node_modules/read-pkg-up": { - "version": "1.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "find-up": "^1.0.0", - "read-pkg": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/get-pkg-repo/node_modules/readable-stream": { - "version": "2.3.7", - "dev": true, - "license": "MIT", - "dependencies": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "node_modules/get-pkg-repo/node_modules/redent": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "indent-string": "^2.1.0", - "strip-indent": "^1.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/get-pkg-repo/node_modules/string_decoder": { - "version": "1.1.1", - "dev": true, - "license": "MIT", - "dependencies": { - "safe-buffer": "~5.1.0" - } - }, - "node_modules/get-pkg-repo/node_modules/strip-bom": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "is-utf8": "^0.2.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/get-pkg-repo/node_modules/strip-indent": { - "version": "1.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "get-stdin": "^4.0.1" - }, - "bin": { - "strip-indent": "cli.js" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/get-pkg-repo/node_modules/through2": { - "version": "2.0.5", - "dev": true, - "license": "MIT", - "dependencies": { - "readable-stream": "~2.3.6", - "xtend": "~4.0.1" - } - }, - "node_modules/get-pkg-repo/node_modules/trim-newlines": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/get-pkg-repo/node_modules/xtend": { - "version": "4.0.2", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.4" - } - }, - "node_modules/get-port": { - "version": "4.2.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/get-stdin": { - "version": "6.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/get-stream": { - "version": "5.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "pump": "^3.0.0" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/get-value": { - "version": "2.0.6", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/getpass": { - "version": "0.1.7", - "dev": true, - "license": "MIT", - "dependencies": { - "assert-plus": "^1.0.0" - } - }, - "node_modules/git-raw-commits": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "dargs": "^4.0.1", - "lodash.template": "^4.0.2", - "meow": "^4.0.0", - "split2": "^2.0.0", - "through2": "^2.0.0" - }, - "bin": { - "git-raw-commits": "cli.js" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/git-raw-commits/node_modules/camelcase": { - "version": "4.1.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/git-raw-commits/node_modules/camelcase-keys": { - "version": "4.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "camelcase": "^4.1.0", - "map-obj": "^2.0.0", - "quick-lru": "^1.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/git-raw-commits/node_modules/indent-string": { - "version": "3.2.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/git-raw-commits/node_modules/isarray": { - "version": "1.0.0", - "dev": true, - "license": "MIT" - }, - "node_modules/git-raw-commits/node_modules/map-obj": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/git-raw-commits/node_modules/meow": { - "version": "4.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "camelcase-keys": "^4.0.0", - "decamelize-keys": "^1.0.0", - "loud-rejection": "^1.0.0", - "minimist": "^1.1.3", - "minimist-options": "^3.0.1", - "normalize-package-data": "^2.3.4", - "read-pkg-up": "^3.0.0", - "redent": "^2.0.0", - "trim-newlines": "^2.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/git-raw-commits/node_modules/minimist-options": { - "version": "3.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "arrify": "^1.0.1", - "is-plain-obj": "^1.1.0" - }, - "engines": { - "node": ">= 4" - } - }, - "node_modules/git-raw-commits/node_modules/quick-lru": { - "version": "1.1.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/git-raw-commits/node_modules/readable-stream": { - "version": "2.3.7", - "dev": true, - "license": "MIT", - "dependencies": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "node_modules/git-raw-commits/node_modules/redent": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "indent-string": "^3.0.0", - "strip-indent": "^2.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/git-raw-commits/node_modules/split2": { - "version": "2.2.0", - "dev": true, - "license": "ISC", - "dependencies": { - "through2": "^2.0.2" - } - }, - "node_modules/git-raw-commits/node_modules/string_decoder": { - "version": "1.1.1", - "dev": true, - "license": "MIT", - "dependencies": { - "safe-buffer": "~5.1.0" - } - }, - "node_modules/git-raw-commits/node_modules/strip-indent": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/git-raw-commits/node_modules/through2": { - "version": "2.0.5", - "dev": true, - "license": "MIT", - "dependencies": { - "readable-stream": "~2.3.6", - "xtend": "~4.0.1" - } - }, - "node_modules/git-raw-commits/node_modules/trim-newlines": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/git-raw-commits/node_modules/xtend": { - "version": "4.0.2", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.4" - } - }, - "node_modules/git-remote-origin-url": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "gitconfiglocal": "^1.0.0", - "pify": "^2.3.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/git-remote-origin-url/node_modules/pify": { - "version": "2.3.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/git-semver-tags": { - "version": "2.0.3", - "dev": true, - "license": "MIT", - "dependencies": { - "meow": "^4.0.0", - "semver": "^6.0.0" - }, - "bin": { - "git-semver-tags": "cli.js" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/git-semver-tags/node_modules/camelcase": { - "version": "4.1.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/git-semver-tags/node_modules/camelcase-keys": { - "version": "4.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "camelcase": "^4.1.0", - "map-obj": "^2.0.0", - "quick-lru": "^1.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/git-semver-tags/node_modules/indent-string": { - "version": "3.2.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/git-semver-tags/node_modules/map-obj": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/git-semver-tags/node_modules/meow": { - "version": "4.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "camelcase-keys": "^4.0.0", - "decamelize-keys": "^1.0.0", - "loud-rejection": "^1.0.0", - "minimist": "^1.1.3", - "minimist-options": "^3.0.1", - "normalize-package-data": "^2.3.4", - "read-pkg-up": "^3.0.0", - "redent": "^2.0.0", - "trim-newlines": "^2.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/git-semver-tags/node_modules/minimist-options": { - "version": "3.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "arrify": "^1.0.1", - "is-plain-obj": "^1.1.0" - }, - "engines": { - "node": ">= 4" - } - }, - "node_modules/git-semver-tags/node_modules/quick-lru": { - "version": "1.1.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/git-semver-tags/node_modules/redent": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "indent-string": "^3.0.0", - "strip-indent": "^2.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/git-semver-tags/node_modules/semver": { - "version": "6.3.0", - "dev": true, - "license": "ISC", - "bin": { - "semver": "bin/semver.js" - } - }, - "node_modules/git-semver-tags/node_modules/strip-indent": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/git-semver-tags/node_modules/trim-newlines": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/git-up": { - "version": "4.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "is-ssh": "^1.3.0", - "parse-url": "^5.0.0" - } - }, - "node_modules/git-url-parse": { - "version": "11.4.4", - "dev": true, - "license": "MIT", - "dependencies": { - "git-up": "^4.0.0" - } - }, - "node_modules/gitconfiglocal": { - "version": "1.0.0", - "dev": true, - "license": "BSD", - "dependencies": { - "ini": "^1.3.2" - } - }, - "node_modules/glob": { - "version": "7.1.6", - "dev": true, - "license": "ISC", - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/glob-base": { - "version": "0.3.0", - "dev": true, - "license": "MIT", - "dependencies": { - "glob-parent": "^2.0.0", - "is-glob": "^2.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/glob-base/node_modules/glob-parent": { - "version": "2.0.0", - "dev": true, - "license": "ISC", - "dependencies": { - "is-glob": "^2.0.0" - } - }, - "node_modules/glob-base/node_modules/is-extglob": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/glob-base/node_modules/is-glob": { - "version": "2.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "is-extglob": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/glob-parent": { - "version": "5.1.2", - "dev": true, - "license": "ISC", - "dependencies": { - "is-glob": "^4.0.1" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/glob-to-regexp": { - "version": "0.3.0", - "dev": true, - "license": "BSD" - }, - "node_modules/global": { - "version": "4.3.2", - "license": "MIT", - "dependencies": { - "min-document": "^2.19.0", - "process": "~0.5.1" - } - }, - "node_modules/globals": { - "version": "12.4.0", - "dev": true, - "license": "MIT", - "dependencies": { - "type-fest": "^0.8.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/globby": { - "version": "9.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/glob": "^7.1.1", - "array-union": "^1.0.2", - "dir-glob": "^2.2.2", - "fast-glob": "^2.2.6", - "glob": "^7.1.3", - "ignore": "^4.0.3", - "pify": "^4.0.1", - "slash": "^2.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/globby/node_modules/slash": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/graceful-fs": { - "version": "4.2.6", - "dev": true, - "license": "ISC" - }, - "node_modules/growly": { - "version": "1.3.0", - "dev": true, - "license": "MIT" - }, - "node_modules/handlebars": { - "version": "4.7.7", - "dev": true, - "license": "MIT", - "dependencies": { - "minimist": "^1.2.5", - "neo-async": "^2.6.0", - "source-map": "^0.6.1", - "wordwrap": "^1.0.0" - }, - "bin": { - "handlebars": "bin/handlebars" - }, - "engines": { - "node": ">=0.4.7" - }, - "optionalDependencies": { - "uglify-js": "^3.1.4" - } - }, - "node_modules/har-schema": { - "version": "2.0.0", - "dev": true, - "license": "ISC", - "engines": { - "node": ">=4" - } - }, - "node_modules/har-validator": { - "version": "5.1.5", - "dev": true, - "license": "MIT", - "dependencies": { - "ajv": "^6.12.3", - "har-schema": "^2.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/hard-rejection": { - "version": "2.1.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/has": { - "version": "1.0.3", - "dev": true, - "license": "MIT", - "dependencies": { - "function-bind": "^1.1.1" - }, - "engines": { - "node": ">= 0.4.0" - } - }, - "node_modules/has-bigints": { - "version": "1.0.1", - "dev": true, - "license": "MIT", - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/has-flag": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/has-symbols": { - "version": "1.0.2", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/has-unicode": { - "version": "2.0.1", - "dev": true, - "license": "ISC" - }, - "node_modules/has-value": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "get-value": "^2.0.6", - "has-values": "^1.0.0", - "isobject": "^3.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/has-values": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "is-number": "^3.0.0", - "kind-of": "^4.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/has-values/node_modules/kind-of": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "is-buffer": "^1.1.5" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/he": { - "version": "1.2.0", - "dev": true, - "license": "MIT", - "bin": { - "he": "bin/he" - } - }, - "node_modules/highlight.js": { - "version": "9.18.5", - "dev": true, - "hasInstallScript": true, - "license": "BSD-3-Clause", - "engines": { - "node": "*" - } - }, - "node_modules/hosted-git-info": { - "version": "2.8.8", - "dev": true, - "license": "ISC" - }, - "node_modules/html-encoding-sniffer": { - "version": "1.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "whatwg-encoding": "^1.0.1" - } - }, - "node_modules/html-escaper": { - "version": "2.0.2", - "dev": true, - "license": "MIT" - }, - "node_modules/http-cache-semantics": { - "version": "3.8.1", - "dev": true, - "license": "BSD-2-Clause" - }, - "node_modules/http-proxy": { - "version": "1.18.1", - "dev": true, - "license": "MIT", - "dependencies": { - "eventemitter3": "^4.0.0", - "follow-redirects": "^1.0.0", - "requires-port": "^1.0.0" - }, - "engines": { - "node": ">=8.0.0" - } - }, - "node_modules/http-proxy-agent": { - "version": "2.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "agent-base": "4", - "debug": "3.1.0" - }, - "engines": { - "node": ">= 4.5.0" - } - }, - "node_modules/http-proxy-agent/node_modules/debug": { - "version": "3.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "ms": "2.0.0" - } - }, - "node_modules/http-proxy-agent/node_modules/ms": { - "version": "2.0.0", - "dev": true, - "license": "MIT" - }, - "node_modules/http-server": { - "version": "0.11.1", - "dev": true, - "license": "MIT", - "dependencies": { - "colors": "1.0.3", - "corser": "~2.0.0", - "ecstatic": "^3.0.0", - "http-proxy": "^1.8.1", - "opener": "~1.4.0", - "optimist": "0.6.x", - "portfinder": "^1.0.13", - "union": "~0.4.3" - }, - "bin": { - "hs": "bin/http-server", - "http-server": "bin/http-server" - } - }, - "node_modules/http-server/node_modules/colors": { - "version": "1.0.3", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.1.90" - } - }, - "node_modules/http-signature": { - "version": "1.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "assert-plus": "^1.0.0", - "jsprim": "^1.2.2", - "sshpk": "^1.7.0" - }, - "engines": { - "node": ">=0.8", - "npm": ">=1.3.7" - } - }, - "node_modules/https-proxy-agent": { - "version": "2.2.4", - "dev": true, - "license": "MIT", - "dependencies": { - "agent-base": "^4.3.0", - "debug": "^3.1.0" - }, - "engines": { - "node": ">= 4.5.0" - } - }, - "node_modules/https-proxy-agent/node_modules/debug": { - "version": "3.2.7", - "dev": true, - "license": "MIT", - "dependencies": { - "ms": "^2.1.1" - } - }, - "node_modules/human-signals": { - "version": "1.1.1", - "dev": true, - "license": "Apache-2.0", - "engines": { - "node": ">=8.12.0" - } - }, - "node_modules/humanize-ms": { - "version": "1.2.1", - "dev": true, - "license": "MIT", - "dependencies": { - "ms": "^2.0.0" - } - }, - "node_modules/iconv-lite": { - "version": "0.4.24", - "dev": true, - "license": "MIT", - "dependencies": { - "safer-buffer": ">= 2.1.2 < 3" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/iferr": { - "version": "0.1.5", - "dev": true, - "license": "MIT" - }, - "node_modules/ignore": { - "version": "4.0.6", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 4" - } - }, - "node_modules/ignore-walk": { - "version": "3.0.3", - "dev": true, - "license": "ISC", - "dependencies": { - "minimatch": "^3.0.4" - } - }, - "node_modules/import-fresh": { - "version": "3.3.0", - "dev": true, - "license": "MIT", - "dependencies": { - "parent-module": "^1.0.0", - "resolve-from": "^4.0.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/import-lazy": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/import-local": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "pkg-dir": "^3.0.0", - "resolve-cwd": "^2.0.0" - }, - "bin": { - "import-local-fixture": "fixtures/cli.js" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/imurmurhash": { - "version": "0.1.4", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.8.19" - } - }, - "node_modules/indent-string": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/infer-owner": { - "version": "1.0.4", - "dev": true, - "license": "ISC" - }, - "node_modules/inflight": { - "version": "1.0.6", - "dev": true, - "license": "ISC", - "dependencies": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "node_modules/inherits": { - "version": "2.0.4", - "dev": true, - "license": "ISC" - }, - "node_modules/ini": { - "version": "1.3.8", - "dev": true, - "license": "ISC" - }, - "node_modules/init-package-json": { - "version": "1.10.3", - "dev": true, - "license": "ISC", - "dependencies": { - "glob": "^7.1.1", - "npm-package-arg": "^4.0.0 || ^5.0.0 || ^6.0.0", - "promzard": "^0.3.0", - "read": "~1.0.1", - "read-package-json": "1 || 2", - "semver": "2.x || 3.x || 4 || 5", - "validate-npm-package-license": "^3.0.1", - "validate-npm-package-name": "^3.0.0" - } - }, - "node_modules/init-package-json/node_modules/semver": { - "version": "5.7.1", - "dev": true, - "license": "ISC", - "bin": { - "semver": "bin/semver" - } - }, - "node_modules/inquirer": { - "version": "7.3.3", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-escapes": "^4.2.1", - "chalk": "^4.1.0", - "cli-cursor": "^3.1.0", - "cli-width": "^3.0.0", - "external-editor": "^3.0.3", - "figures": "^3.0.0", - "lodash": "^4.17.19", - "mute-stream": "0.0.8", - "run-async": "^2.4.0", - "rxjs": "^6.6.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0", - "through": "^2.3.6" - }, - "engines": { - "node": ">=8.0.0" - } - }, - "node_modules/inquirer/node_modules/ansi-regex": { - "version": "5.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/inquirer/node_modules/strip-ansi": { - "version": "6.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-regex": "^5.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/interpret": { - "version": "1.4.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/invariant": { - "version": "2.2.4", - "dev": true, - "license": "MIT", - "dependencies": { - "loose-envify": "^1.0.0" - } - }, - "node_modules/ios-version": { - "version": "1.0.1", - "license": "MIT", - "dependencies": { - "global": "~4.3.0", - "parse-int": "~1.0.0" - } - }, - "node_modules/ip": { - "version": "1.1.5", - "dev": true, - "license": "MIT" - }, - "node_modules/is-accessor-descriptor": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "kind-of": "^6.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-arrayish": { - "version": "0.2.1", - "dev": true, - "license": "MIT" - }, - "node_modules/is-bigint": { - "version": "1.0.1", - "dev": true, - "license": "MIT", - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-binary-path": { - "version": "2.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "binary-extensions": "^2.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/is-boolean-object": { - "version": "1.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "call-bind": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-buffer": { - "version": "1.1.6", - "dev": true, - "license": "MIT" - }, - "node_modules/is-callable": { - "version": "1.2.3", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-ci": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "ci-info": "^2.0.0" - }, - "bin": { - "is-ci": "bin.js" - } - }, - "node_modules/is-core-module": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.5.0.tgz", - "integrity": "sha512-TXCMSDsEHMEEZ6eCA8rwRDbLu55MRGmrctljsBX/2v1d9/GzqHOxW5c5oPSgrUt2vBFXebu9rGqckXGPWOlYpg==", - "dev": true, - "dependencies": { - "has": "^1.0.3" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-data-descriptor": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "kind-of": "^6.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-date-object": { - "version": "1.0.2", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-descriptor": { - "version": "1.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-directory": { - "version": "0.3.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-docker": { - "version": "2.1.1", - "dev": true, - "license": "MIT", - "bin": { - "is-docker": "cli.js" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/is-dotfile": { - "version": "1.0.3", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-equal-shallow": { - "version": "0.1.3", - "dev": true, - "license": "MIT", - "dependencies": { - "is-primitive": "^2.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-extendable": { - "version": "1.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "is-plain-object": "^2.0.4" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-extendable/node_modules/is-plain-object": { - "version": "2.0.4", - "dev": true, - "license": "MIT", - "dependencies": { - "isobject": "^3.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-extglob": { - "version": "2.1.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-finite": { - "version": "1.1.0", - "license": "MIT", - "engines": { - "node": ">=0.10.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/is-fullwidth-code-point": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/is-generator-fn": { - "version": "2.1.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/is-glob": { - "version": "4.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "is-extglob": "^2.1.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-integer": { - "version": "1.0.7", - "license": "WTFPL OR ISC", - "dependencies": { - "is-finite": "^1.0.0" - } - }, - "node_modules/is-module": { - "version": "1.0.0", - "dev": true, - "license": "MIT" - }, - "node_modules/is-negative-zero": { - "version": "2.0.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-number": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "kind-of": "^3.0.2" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-number-object": { - "version": "1.0.4", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-number/node_modules/kind-of": { - "version": "3.2.2", - "dev": true, - "license": "MIT", - "dependencies": { - "is-buffer": "^1.1.5" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-obj": { - "version": "1.0.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-plain-obj": { - "version": "1.1.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-plain-object": { - "version": "5.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-posix-bracket": { - "version": "0.1.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-primitive": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-reference": { - "version": "1.2.1", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/estree": "*" - } - }, - "node_modules/is-regex": { - "version": "1.1.2", - "dev": true, - "license": "MIT", - "dependencies": { - "call-bind": "^1.0.2", - "has-symbols": "^1.0.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-ssh": { - "version": "1.3.2", - "dev": true, - "license": "MIT", - "dependencies": { - "protocols": "^1.1.0" - } - }, - "node_modules/is-stream": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/is-string": { - "version": "1.0.5", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-symbol": { - "version": "1.0.3", - "dev": true, - "license": "MIT", - "dependencies": { - "has-symbols": "^1.0.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-text-path": { - "version": "1.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "text-extensions": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-typedarray": { - "version": "1.0.0", - "dev": true, - "license": "MIT" - }, - "node_modules/is-utf8": { - "version": "0.2.1", - "dev": true, - "license": "MIT" - }, - "node_modules/is-windows": { - "version": "1.0.2", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-wsl": { - "version": "1.1.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/isarray": { - "version": "0.0.1", - "dev": true, - "license": "MIT" - }, - "node_modules/isexe": { - "version": "2.0.0", - "dev": true, - "license": "ISC" - }, - "node_modules/ismobilejs": { - "version": "0.5.2", - "license": "MIT" - }, - "node_modules/isobject": { - "version": "3.0.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/isstream": { - "version": "0.1.2", - "dev": true, - "license": "MIT" - }, - "node_modules/istanbul-lib-coverage": { - "version": "2.0.5", - "dev": true, - "license": "BSD-3-Clause", - "engines": { - "node": ">=6" - } - }, - "node_modules/istanbul-lib-instrument": { - "version": "3.3.0", - "dev": true, - "license": "BSD-3-Clause", - "dependencies": { - "@babel/generator": "^7.4.0", - "@babel/parser": "^7.4.3", - "@babel/template": "^7.4.0", - "@babel/traverse": "^7.4.3", - "@babel/types": "^7.4.0", - "istanbul-lib-coverage": "^2.0.5", - "semver": "^6.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/istanbul-lib-instrument/node_modules/semver": { - "version": "6.3.0", - "dev": true, - "license": "ISC", - "bin": { - "semver": "bin/semver.js" - } - }, - "node_modules/istanbul-lib-report": { - "version": "2.0.8", - "dev": true, - "license": "BSD-3-Clause", - "dependencies": { - "istanbul-lib-coverage": "^2.0.5", - "make-dir": "^2.1.0", - "supports-color": "^6.1.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/istanbul-lib-report/node_modules/has-flag": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/istanbul-lib-report/node_modules/supports-color": { - "version": "6.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/istanbul-lib-source-maps": { - "version": "3.0.6", - "dev": true, - "license": "BSD-3-Clause", - "dependencies": { - "debug": "^4.1.1", - "istanbul-lib-coverage": "^2.0.5", - "make-dir": "^2.1.0", - "rimraf": "^2.6.3", - "source-map": "^0.6.1" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/istanbul-reports": { - "version": "2.2.7", - "dev": true, - "license": "BSD-3-Clause", - "dependencies": { - "html-escaper": "^2.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/jest": { - "version": "24.9.0", - "dev": true, - "license": "MIT", - "dependencies": { - "import-local": "^2.0.0", - "jest-cli": "^24.9.0" - }, - "bin": { - "jest": "bin/jest.js" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/jest-changed-files": { - "version": "24.9.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/types": "^24.9.0", - "execa": "^1.0.0", - "throat": "^4.0.0" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/jest-changed-files/node_modules/execa": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "cross-spawn": "^6.0.0", - "get-stream": "^4.0.0", - "is-stream": "^1.1.0", - "npm-run-path": "^2.0.0", - "p-finally": "^1.0.0", - "signal-exit": "^3.0.0", - "strip-eof": "^1.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/jest-changed-files/node_modules/get-stream": { - "version": "4.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "pump": "^3.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/jest-changed-files/node_modules/is-stream": { - "version": "1.1.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/jest-changed-files/node_modules/npm-run-path": { - "version": "2.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "path-key": "^2.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/jest-cli": { - "version": "24.9.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/core": "^24.9.0", - "@jest/test-result": "^24.9.0", - "@jest/types": "^24.9.0", - "chalk": "^2.0.1", - "exit": "^0.1.2", - "import-local": "^2.0.0", - "is-ci": "^2.0.0", - "jest-config": "^24.9.0", - "jest-util": "^24.9.0", - "jest-validate": "^24.9.0", - "prompts": "^2.0.1", - "realpath-native": "^1.1.0", - "yargs": "^13.3.0" - }, - "bin": { - "jest": "bin/jest.js" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/jest-cli/node_modules/ansi-styles": { - "version": "3.2.1", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/jest-cli/node_modules/chalk": { - "version": "2.4.2", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/jest-cli/node_modules/color-convert": { - "version": "1.9.3", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "1.1.3" - } - }, - "node_modules/jest-cli/node_modules/color-name": { - "version": "1.1.3", - "dev": true, - "license": "MIT" - }, - "node_modules/jest-cli/node_modules/has-flag": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/jest-cli/node_modules/supports-color": { - "version": "5.5.0", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/jest-config": { - "version": "24.9.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/core": "^7.1.0", - "@jest/test-sequencer": "^24.9.0", - "@jest/types": "^24.9.0", - "babel-jest": "^24.9.0", - "chalk": "^2.0.1", - "glob": "^7.1.1", - "jest-environment-jsdom": "^24.9.0", - "jest-environment-node": "^24.9.0", - "jest-get-type": "^24.9.0", - "jest-jasmine2": "^24.9.0", - "jest-regex-util": "^24.3.0", - "jest-resolve": "^24.9.0", - "jest-util": "^24.9.0", - "jest-validate": "^24.9.0", - "micromatch": "^3.1.10", - "pretty-format": "^24.9.0", - "realpath-native": "^1.1.0" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/jest-config/node_modules/ansi-styles": { - "version": "3.2.1", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/jest-config/node_modules/chalk": { - "version": "2.4.2", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/jest-config/node_modules/color-convert": { - "version": "1.9.3", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "1.1.3" - } - }, - "node_modules/jest-config/node_modules/color-name": { - "version": "1.1.3", - "dev": true, - "license": "MIT" - }, - "node_modules/jest-config/node_modules/has-flag": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/jest-config/node_modules/supports-color": { - "version": "5.5.0", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/jest-diff": { - "version": "24.9.0", - "dev": true, - "license": "MIT", - "dependencies": { - "chalk": "^2.0.1", - "diff-sequences": "^24.9.0", - "jest-get-type": "^24.9.0", - "pretty-format": "^24.9.0" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/jest-diff/node_modules/ansi-styles": { - "version": "3.2.1", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/jest-diff/node_modules/chalk": { - "version": "2.4.2", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/jest-diff/node_modules/color-convert": { - "version": "1.9.3", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "1.1.3" - } - }, - "node_modules/jest-diff/node_modules/color-name": { - "version": "1.1.3", - "dev": true, - "license": "MIT" - }, - "node_modules/jest-diff/node_modules/has-flag": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/jest-diff/node_modules/supports-color": { - "version": "5.5.0", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/jest-docblock": { - "version": "24.9.0", - "dev": true, - "license": "MIT", - "dependencies": { - "detect-newline": "^2.1.0" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/jest-each": { - "version": "24.9.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/types": "^24.9.0", - "chalk": "^2.0.1", - "jest-get-type": "^24.9.0", - "jest-util": "^24.9.0", - "pretty-format": "^24.9.0" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/jest-each/node_modules/ansi-styles": { - "version": "3.2.1", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/jest-each/node_modules/chalk": { - "version": "2.4.2", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/jest-each/node_modules/color-convert": { - "version": "1.9.3", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "1.1.3" - } - }, - "node_modules/jest-each/node_modules/color-name": { - "version": "1.1.3", - "dev": true, - "license": "MIT" - }, - "node_modules/jest-each/node_modules/has-flag": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/jest-each/node_modules/supports-color": { - "version": "5.5.0", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/jest-environment-jsdom": { - "version": "24.9.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/environment": "^24.9.0", - "@jest/fake-timers": "^24.9.0", - "@jest/types": "^24.9.0", - "jest-mock": "^24.9.0", - "jest-util": "^24.9.0", - "jsdom": "^11.5.1" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/jest-environment-node": { - "version": "24.9.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/environment": "^24.9.0", - "@jest/fake-timers": "^24.9.0", - "@jest/types": "^24.9.0", - "jest-mock": "^24.9.0", - "jest-util": "^24.9.0" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/jest-get-type": { - "version": "24.9.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 6" - } - }, - "node_modules/jest-haste-map": { - "version": "24.9.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/types": "^24.9.0", - "anymatch": "^2.0.0", - "fb-watchman": "^2.0.0", - "graceful-fs": "^4.1.15", - "invariant": "^2.2.4", - "jest-serializer": "^24.9.0", - "jest-util": "^24.9.0", - "jest-worker": "^24.9.0", - "micromatch": "^3.1.10", - "sane": "^4.0.3", - "walker": "^1.0.7" - }, - "engines": { - "node": ">= 6" - }, - "optionalDependencies": { - "fsevents": "^1.2.7" - } - }, - "node_modules/jest-jasmine2": { - "version": "24.9.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/traverse": "^7.1.0", - "@jest/environment": "^24.9.0", - "@jest/test-result": "^24.9.0", - "@jest/types": "^24.9.0", - "chalk": "^2.0.1", - "co": "^4.6.0", - "expect": "^24.9.0", - "is-generator-fn": "^2.0.0", - "jest-each": "^24.9.0", - "jest-matcher-utils": "^24.9.0", - "jest-message-util": "^24.9.0", - "jest-runtime": "^24.9.0", - "jest-snapshot": "^24.9.0", - "jest-util": "^24.9.0", - "pretty-format": "^24.9.0", - "throat": "^4.0.0" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/jest-jasmine2/node_modules/ansi-styles": { - "version": "3.2.1", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/jest-jasmine2/node_modules/chalk": { - "version": "2.4.2", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/jest-jasmine2/node_modules/color-convert": { - "version": "1.9.3", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "1.1.3" - } - }, - "node_modules/jest-jasmine2/node_modules/color-name": { - "version": "1.1.3", - "dev": true, - "license": "MIT" - }, - "node_modules/jest-jasmine2/node_modules/has-flag": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/jest-jasmine2/node_modules/supports-color": { - "version": "5.5.0", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/jest-leak-detector": { - "version": "24.9.0", - "dev": true, - "license": "MIT", - "dependencies": { - "jest-get-type": "^24.9.0", - "pretty-format": "^24.9.0" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/jest-matcher-utils": { - "version": "24.9.0", - "dev": true, - "license": "MIT", - "dependencies": { - "chalk": "^2.0.1", - "jest-diff": "^24.9.0", - "jest-get-type": "^24.9.0", - "pretty-format": "^24.9.0" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/jest-matcher-utils/node_modules/ansi-styles": { - "version": "3.2.1", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/jest-matcher-utils/node_modules/chalk": { - "version": "2.4.2", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/jest-matcher-utils/node_modules/color-convert": { - "version": "1.9.3", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "1.1.3" - } - }, - "node_modules/jest-matcher-utils/node_modules/color-name": { - "version": "1.1.3", - "dev": true, - "license": "MIT" - }, - "node_modules/jest-matcher-utils/node_modules/has-flag": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/jest-matcher-utils/node_modules/supports-color": { - "version": "5.5.0", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/jest-message-util": { - "version": "24.9.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/code-frame": "^7.0.0", - "@jest/test-result": "^24.9.0", - "@jest/types": "^24.9.0", - "@types/stack-utils": "^1.0.1", - "chalk": "^2.0.1", - "micromatch": "^3.1.10", - "slash": "^2.0.0", - "stack-utils": "^1.0.1" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/jest-message-util/node_modules/ansi-styles": { - "version": "3.2.1", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/jest-message-util/node_modules/chalk": { - "version": "2.4.2", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/jest-message-util/node_modules/color-convert": { - "version": "1.9.3", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "1.1.3" - } - }, - "node_modules/jest-message-util/node_modules/color-name": { - "version": "1.1.3", - "dev": true, - "license": "MIT" - }, - "node_modules/jest-message-util/node_modules/has-flag": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/jest-message-util/node_modules/slash": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/jest-message-util/node_modules/supports-color": { - "version": "5.5.0", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/jest-mock": { - "version": "24.9.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/types": "^24.9.0" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/jest-pnp-resolver": { - "version": "1.2.2", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - }, - "peerDependencies": { - "jest-resolve": "*" - }, - "peerDependenciesMeta": { - "jest-resolve": { - "optional": true - } - } - }, - "node_modules/jest-regex-util": { - "version": "24.9.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 6" - } - }, - "node_modules/jest-resolve": { - "version": "24.9.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/types": "^24.9.0", - "browser-resolve": "^1.11.3", - "chalk": "^2.0.1", - "jest-pnp-resolver": "^1.2.1", - "realpath-native": "^1.1.0" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/jest-resolve-dependencies": { - "version": "24.9.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/types": "^24.9.0", - "jest-regex-util": "^24.3.0", - "jest-snapshot": "^24.9.0" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/jest-resolve/node_modules/ansi-styles": { - "version": "3.2.1", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/jest-resolve/node_modules/chalk": { - "version": "2.4.2", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/jest-resolve/node_modules/color-convert": { - "version": "1.9.3", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "1.1.3" - } - }, - "node_modules/jest-resolve/node_modules/color-name": { - "version": "1.1.3", - "dev": true, - "license": "MIT" - }, - "node_modules/jest-resolve/node_modules/has-flag": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/jest-resolve/node_modules/supports-color": { - "version": "5.5.0", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/jest-runner": { - "version": "24.9.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/console": "^24.7.1", - "@jest/environment": "^24.9.0", - "@jest/test-result": "^24.9.0", - "@jest/types": "^24.9.0", - "chalk": "^2.4.2", - "exit": "^0.1.2", - "graceful-fs": "^4.1.15", - "jest-config": "^24.9.0", - "jest-docblock": "^24.3.0", - "jest-haste-map": "^24.9.0", - "jest-jasmine2": "^24.9.0", - "jest-leak-detector": "^24.9.0", - "jest-message-util": "^24.9.0", - "jest-resolve": "^24.9.0", - "jest-runtime": "^24.9.0", - "jest-util": "^24.9.0", - "jest-worker": "^24.6.0", - "source-map-support": "^0.5.6", - "throat": "^4.0.0" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/jest-runner/node_modules/ansi-styles": { - "version": "3.2.1", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/jest-runner/node_modules/chalk": { - "version": "2.4.2", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/jest-runner/node_modules/color-convert": { - "version": "1.9.3", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "1.1.3" - } - }, - "node_modules/jest-runner/node_modules/color-name": { - "version": "1.1.3", - "dev": true, - "license": "MIT" - }, - "node_modules/jest-runner/node_modules/has-flag": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/jest-runner/node_modules/supports-color": { - "version": "5.5.0", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/jest-runtime": { - "version": "24.9.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/console": "^24.7.1", - "@jest/environment": "^24.9.0", - "@jest/source-map": "^24.3.0", - "@jest/transform": "^24.9.0", - "@jest/types": "^24.9.0", - "@types/yargs": "^13.0.0", - "chalk": "^2.0.1", - "exit": "^0.1.2", - "glob": "^7.1.3", - "graceful-fs": "^4.1.15", - "jest-config": "^24.9.0", - "jest-haste-map": "^24.9.0", - "jest-message-util": "^24.9.0", - "jest-mock": "^24.9.0", - "jest-regex-util": "^24.3.0", - "jest-resolve": "^24.9.0", - "jest-snapshot": "^24.9.0", - "jest-util": "^24.9.0", - "jest-validate": "^24.9.0", - "realpath-native": "^1.1.0", - "slash": "^2.0.0", - "strip-bom": "^3.0.0", - "yargs": "^13.3.0" - }, - "bin": { - "jest-runtime": "bin/jest-runtime.js" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/jest-runtime/node_modules/ansi-styles": { - "version": "3.2.1", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/jest-runtime/node_modules/chalk": { - "version": "2.4.2", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/jest-runtime/node_modules/color-convert": { - "version": "1.9.3", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "1.1.3" - } - }, - "node_modules/jest-runtime/node_modules/color-name": { - "version": "1.1.3", - "dev": true, - "license": "MIT" - }, - "node_modules/jest-runtime/node_modules/has-flag": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/jest-runtime/node_modules/slash": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/jest-runtime/node_modules/supports-color": { - "version": "5.5.0", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/jest-serializer": { - "version": "24.9.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 6" - } - }, - "node_modules/jest-snapshot": { - "version": "24.9.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/types": "^7.0.0", - "@jest/types": "^24.9.0", - "chalk": "^2.0.1", - "expect": "^24.9.0", - "jest-diff": "^24.9.0", - "jest-get-type": "^24.9.0", - "jest-matcher-utils": "^24.9.0", - "jest-message-util": "^24.9.0", - "jest-resolve": "^24.9.0", - "mkdirp": "^0.5.1", - "natural-compare": "^1.4.0", - "pretty-format": "^24.9.0", - "semver": "^6.2.0" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/jest-snapshot/node_modules/ansi-styles": { - "version": "3.2.1", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/jest-snapshot/node_modules/chalk": { - "version": "2.4.2", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/jest-snapshot/node_modules/color-convert": { - "version": "1.9.3", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "1.1.3" - } - }, - "node_modules/jest-snapshot/node_modules/color-name": { - "version": "1.1.3", - "dev": true, - "license": "MIT" - }, - "node_modules/jest-snapshot/node_modules/has-flag": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/jest-snapshot/node_modules/semver": { - "version": "6.3.0", - "dev": true, - "license": "ISC", - "bin": { - "semver": "bin/semver.js" - } - }, - "node_modules/jest-snapshot/node_modules/supports-color": { - "version": "5.5.0", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/jest-util": { - "version": "24.9.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/console": "^24.9.0", - "@jest/fake-timers": "^24.9.0", - "@jest/source-map": "^24.9.0", - "@jest/test-result": "^24.9.0", - "@jest/types": "^24.9.0", - "callsites": "^3.0.0", - "chalk": "^2.0.1", - "graceful-fs": "^4.1.15", - "is-ci": "^2.0.0", - "mkdirp": "^0.5.1", - "slash": "^2.0.0", - "source-map": "^0.6.0" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/jest-util/node_modules/ansi-styles": { - "version": "3.2.1", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/jest-util/node_modules/chalk": { - "version": "2.4.2", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/jest-util/node_modules/color-convert": { - "version": "1.9.3", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "1.1.3" - } - }, - "node_modules/jest-util/node_modules/color-name": { - "version": "1.1.3", - "dev": true, - "license": "MIT" - }, - "node_modules/jest-util/node_modules/has-flag": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/jest-util/node_modules/slash": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/jest-util/node_modules/supports-color": { - "version": "5.5.0", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/jest-validate": { - "version": "24.9.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/types": "^24.9.0", - "camelcase": "^5.3.1", - "chalk": "^2.0.1", - "jest-get-type": "^24.9.0", - "leven": "^3.1.0", - "pretty-format": "^24.9.0" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/jest-validate/node_modules/ansi-styles": { - "version": "3.2.1", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/jest-validate/node_modules/chalk": { - "version": "2.4.2", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/jest-validate/node_modules/color-convert": { - "version": "1.9.3", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "1.1.3" - } - }, - "node_modules/jest-validate/node_modules/color-name": { - "version": "1.1.3", - "dev": true, - "license": "MIT" - }, - "node_modules/jest-validate/node_modules/has-flag": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/jest-validate/node_modules/supports-color": { - "version": "5.5.0", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/jest-watcher": { - "version": "24.9.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/test-result": "^24.9.0", - "@jest/types": "^24.9.0", - "@types/yargs": "^13.0.0", - "ansi-escapes": "^3.0.0", - "chalk": "^2.0.1", - "jest-util": "^24.9.0", - "string-length": "^2.0.0" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/jest-watcher/node_modules/ansi-escapes": { - "version": "3.2.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/jest-watcher/node_modules/ansi-styles": { - "version": "3.2.1", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/jest-watcher/node_modules/chalk": { - "version": "2.4.2", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/jest-watcher/node_modules/color-convert": { - "version": "1.9.3", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "1.1.3" - } - }, - "node_modules/jest-watcher/node_modules/color-name": { - "version": "1.1.3", - "dev": true, - "license": "MIT" - }, - "node_modules/jest-watcher/node_modules/has-flag": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/jest-watcher/node_modules/supports-color": { - "version": "5.5.0", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/jest-worker": { - "version": "24.9.0", - "dev": true, - "license": "MIT", - "dependencies": { - "merge-stream": "^2.0.0", - "supports-color": "^6.1.0" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/jest-worker/node_modules/has-flag": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/jest-worker/node_modules/supports-color": { - "version": "6.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/jju": { - "version": "1.4.0", - "dev": true, - "license": "MIT" - }, - "node_modules/jquery": { - "version": "3.6.0", - "dev": true, - "license": "MIT" - }, - "node_modules/js-tokens": { - "version": "4.0.0", - "dev": true, - "license": "MIT" - }, - "node_modules/js-yaml": { - "version": "3.13.1", - "dev": true, - "license": "MIT", - "dependencies": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" - }, - "bin": { - "js-yaml": "bin/js-yaml.js" - } - }, - "node_modules/jsbn": { - "version": "0.1.1", - "dev": true, - "license": "MIT" - }, - "node_modules/jsdom": { - "version": "11.12.0", - "dev": true, - "license": "MIT", - "dependencies": { - "abab": "^2.0.0", - "acorn": "^5.5.3", - "acorn-globals": "^4.1.0", - "array-equal": "^1.0.0", - "cssom": ">= 0.3.2 < 0.4.0", - "cssstyle": "^1.0.0", - "data-urls": "^1.0.0", - "domexception": "^1.0.1", - "escodegen": "^1.9.1", - "html-encoding-sniffer": "^1.0.2", - "left-pad": "^1.3.0", - "nwsapi": "^2.0.7", - "parse5": "4.0.0", - "pn": "^1.1.0", - "request": "^2.87.0", - "request-promise-native": "^1.0.5", - "sax": "^1.2.4", - "symbol-tree": "^3.2.2", - "tough-cookie": "^2.3.4", - "w3c-hr-time": "^1.0.1", - "webidl-conversions": "^4.0.2", - "whatwg-encoding": "^1.0.3", - "whatwg-mimetype": "^2.1.0", - "whatwg-url": "^6.4.1", - "ws": "^5.2.0", - "xml-name-validator": "^3.0.0" - } - }, - "node_modules/jsdom/node_modules/acorn": { - "version": "5.7.4", - "dev": true, - "license": "MIT", - "bin": { - "acorn": "bin/acorn" - }, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/jsesc": { - "version": "2.5.2", - "dev": true, - "license": "MIT", - "bin": { - "jsesc": "bin/jsesc" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/json-parse-better-errors": { - "version": "1.0.2", - "dev": true, - "license": "MIT" - }, - "node_modules/json-parse-even-better-errors": { - "version": "2.3.1", - "dev": true, - "license": "MIT" - }, - "node_modules/json-schema": { - "version": "0.2.3", - "dev": true - }, - "node_modules/json-schema-traverse": { - "version": "0.4.1", - "dev": true, - "license": "MIT" - }, - "node_modules/json-stable-stringify-without-jsonify": { - "version": "1.0.1", - "dev": true, - "license": "MIT" - }, - "node_modules/json-stringify-safe": { - "version": "5.0.1", - "dev": true, - "license": "ISC" - }, - "node_modules/json5": { - "version": "2.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "minimist": "^1.2.5" - }, - "bin": { - "json5": "lib/cli.js" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/jsonfile": { - "version": "6.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "universalify": "^2.0.0" - }, - "optionalDependencies": { - "graceful-fs": "^4.1.6" - } - }, - "node_modules/jsonparse": { - "version": "1.3.1", - "dev": true, - "engines": [ - "node >= 0.2.0" - ], - "license": "MIT" - }, - "node_modules/JSONStream": { - "version": "1.3.5", - "dev": true, - "license": "(MIT OR Apache-2.0)", - "dependencies": { - "jsonparse": "^1.2.0", - "through": ">=2.2.7 <3" - }, - "bin": { - "JSONStream": "bin.js" - }, - "engines": { - "node": "*" - } - }, - "node_modules/jsprim": { - "version": "1.4.1", - "dev": true, - "engines": [ - "node >=0.6.0" - ], - "license": "MIT", - "dependencies": { - "assert-plus": "1.0.0", - "extsprintf": "1.3.0", - "json-schema": "0.2.3", - "verror": "1.10.0" - } - }, - "node_modules/just-extend": { - "version": "4.1.1", - "dev": true, - "license": "MIT" - }, - "node_modules/kind-of": { - "version": "6.0.3", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/kleur": { - "version": "3.0.3", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/left-pad": { - "version": "1.3.0", - "dev": true, - "license": "WTFPL" - }, - "node_modules/lerna": { - "version": "3.22.1", - "dev": true, - "license": "MIT", - "dependencies": { - "@lerna/add": "3.21.0", - "@lerna/bootstrap": "3.21.0", - "@lerna/changed": "3.21.0", - "@lerna/clean": "3.21.0", - "@lerna/cli": "3.18.5", - "@lerna/create": "3.22.0", - "@lerna/diff": "3.21.0", - "@lerna/exec": "3.21.0", - "@lerna/import": "3.22.0", - "@lerna/info": "3.21.0", - "@lerna/init": "3.21.0", - "@lerna/link": "3.21.0", - "@lerna/list": "3.21.0", - "@lerna/publish": "3.22.1", - "@lerna/run": "3.21.0", - "@lerna/version": "3.22.1", - "import-local": "^2.0.0", - "npmlog": "^4.1.2" - }, - "bin": { - "lerna": "cli.js" - }, - "engines": { - "node": ">= 6.9.0" - } - }, - "node_modules/leven": { - "version": "3.1.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/levn": { - "version": "0.3.0", - "dev": true, - "license": "MIT", - "dependencies": { - "prelude-ls": "~1.1.2", - "type-check": "~0.3.2" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/lines-and-columns": { - "version": "1.1.6", - "dev": true, - "license": "MIT" - }, - "node_modules/livereload": { - "version": "0.9.2", - "dev": true, - "license": "MIT", - "dependencies": { - "chokidar": "^3.5.0", - "livereload-js": "^3.3.1", - "opts": ">= 1.2.0", - "ws": "^7.4.3" - }, - "bin": { - "livereload": "bin/livereload.js" - }, - "engines": { - "node": ">=8.0.0" - } - }, - "node_modules/livereload-js": { - "version": "3.3.2", - "dev": true, - "license": "MIT" - }, - "node_modules/livereload/node_modules/ws": { - "version": "7.4.4", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8.3.0" - }, - "peerDependencies": { - "bufferutil": "^4.0.1", - "utf-8-validate": "^5.0.2" - }, - "peerDependenciesMeta": { - "bufferutil": { - "optional": true - }, - "utf-8-validate": { - "optional": true - } - } - }, - "node_modules/load-json-file": { - "version": "5.3.0", - "dev": true, - "license": "MIT", - "dependencies": { - "graceful-fs": "^4.1.15", - "parse-json": "^4.0.0", - "pify": "^4.0.1", - "strip-bom": "^3.0.0", - "type-fest": "^0.3.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/load-json-file/node_modules/type-fest": { - "version": "0.3.1", - "dev": true, - "license": "(MIT OR CC0-1.0)", - "engines": { - "node": ">=6" - } - }, - "node_modules/locate-path": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "p-locate": "^3.0.0", - "path-exists": "^3.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/lodash": { - "version": "4.17.21", - "license": "MIT" - }, - "node_modules/lodash._reinterpolate": { - "version": "3.0.0", - "dev": true, - "license": "MIT" - }, - "node_modules/lodash.clonedeep": { - "version": "4.5.0", - "dev": true, - "license": "MIT" - }, - "node_modules/lodash.get": { - "version": "4.4.2", - "dev": true, - "license": "MIT" - }, - "node_modules/lodash.isequal": { - "version": "4.5.0", - "dev": true, - "license": "MIT" - }, - "node_modules/lodash.ismatch": { - "version": "4.4.0", - "dev": true, - "license": "MIT" - }, - "node_modules/lodash.memoize": { - "version": "4.1.2", - "dev": true, - "license": "MIT" - }, - "node_modules/lodash.set": { - "version": "4.3.2", - "dev": true, - "license": "MIT" - }, - "node_modules/lodash.sortby": { - "version": "4.7.0", - "dev": true, - "license": "MIT" - }, - "node_modules/lodash.template": { - "version": "4.5.0", - "dev": true, - "license": "MIT", - "dependencies": { - "lodash._reinterpolate": "^3.0.0", - "lodash.templatesettings": "^4.0.0" - } - }, - "node_modules/lodash.templatesettings": { - "version": "4.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "lodash._reinterpolate": "^3.0.0" - } - }, - "node_modules/lodash.unescape": { - "version": "4.0.1", - "dev": true, - "license": "MIT" - }, - "node_modules/lodash.uniq": { - "version": "4.5.0", - "dev": true, - "license": "MIT" - }, - "node_modules/lolex": { - "version": "4.2.0", - "dev": true, - "license": "BSD-3-Clause" - }, - "node_modules/loose-envify": { - "version": "1.4.0", - "dev": true, - "license": "MIT", - "dependencies": { - "js-tokens": "^3.0.0 || ^4.0.0" - }, - "bin": { - "loose-envify": "cli.js" - } - }, - "node_modules/loud-rejection": { - "version": "1.6.0", - "dev": true, - "license": "MIT", - "dependencies": { - "currently-unhandled": "^0.4.1", - "signal-exit": "^3.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/lru-cache": { - "version": "5.1.1", - "dev": true, - "license": "ISC", - "dependencies": { - "yallist": "^3.0.2" - } - }, - "node_modules/lunr": { - "version": "2.3.9", - "dev": true, - "license": "MIT" - }, - "node_modules/macos-release": { - "version": "2.4.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/magic-string": { - "version": "0.25.7", - "dev": true, - "license": "MIT", - "dependencies": { - "sourcemap-codec": "^1.4.4" - } - }, - "node_modules/make-dir": { - "version": "2.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "pify": "^4.0.1", - "semver": "^5.6.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/make-dir/node_modules/semver": { - "version": "5.7.1", - "dev": true, - "license": "ISC", - "bin": { - "semver": "bin/semver" - } - }, - "node_modules/make-error": { - "version": "1.3.6", - "dev": true, - "license": "ISC" - }, - "node_modules/make-fetch-happen": { - "version": "5.0.2", - "dev": true, - "license": "ISC", - "dependencies": { - "agentkeepalive": "^3.4.1", - "cacache": "^12.0.0", - "http-cache-semantics": "^3.8.1", - "http-proxy-agent": "^2.1.0", - "https-proxy-agent": "^2.2.3", - "lru-cache": "^5.1.1", - "mississippi": "^3.0.0", - "node-fetch-npm": "^2.0.2", - "promise-retry": "^1.1.1", - "socks-proxy-agent": "^4.0.0", - "ssri": "^6.0.0" - } - }, - "node_modules/makeerror": { - "version": "1.0.11", - "dev": true, - "license": "BSD-3-Clause", - "dependencies": { - "tmpl": "1.0.x" - } - }, - "node_modules/map-cache": { - "version": "0.2.2", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/map-obj": { - "version": "4.2.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/map-visit": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "object-visit": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/marked": { - "version": "0.8.2", - "dev": true, - "license": "MIT", - "bin": { - "marked": "bin/marked" - }, - "engines": { - "node": ">= 8.16.2" - } - }, - "node_modules/math-random": { - "version": "1.0.4", - "dev": true, - "license": "MIT" - }, - "node_modules/meow": { - "version": "8.1.2", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/minimist": "^1.2.0", - "camelcase-keys": "^6.2.2", - "decamelize-keys": "^1.1.0", - "hard-rejection": "^2.1.0", - "minimist-options": "4.1.0", - "normalize-package-data": "^3.0.0", - "read-pkg-up": "^7.0.1", - "redent": "^3.0.0", - "trim-newlines": "^3.0.0", - "type-fest": "^0.18.0", - "yargs-parser": "^20.2.3" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/meow/node_modules/find-up": { - "version": "4.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/meow/node_modules/hosted-git-info": { - "version": "4.0.0", - "dev": true, - "license": "ISC", - "dependencies": { - "lru-cache": "^6.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/meow/node_modules/locate-path": { - "version": "5.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "p-locate": "^4.1.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/meow/node_modules/lru-cache": { - "version": "6.0.0", - "dev": true, - "license": "ISC", - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/meow/node_modules/normalize-package-data": { - "version": "3.0.1", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "hosted-git-info": "^4.0.0", - "resolve": "^1.17.0", - "semver": "^7.3.2", - "validate-npm-package-license": "^3.0.1" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/meow/node_modules/p-locate": { - "version": "4.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "p-limit": "^2.2.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/meow/node_modules/parse-json": { - "version": "5.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/code-frame": "^7.0.0", - "error-ex": "^1.3.1", - "json-parse-even-better-errors": "^2.3.0", - "lines-and-columns": "^1.1.6" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/meow/node_modules/path-exists": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/meow/node_modules/read-pkg": { - "version": "5.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/normalize-package-data": "^2.4.0", - "normalize-package-data": "^2.5.0", - "parse-json": "^5.0.0", - "type-fest": "^0.6.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/meow/node_modules/read-pkg-up": { - "version": "7.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "find-up": "^4.1.0", - "read-pkg": "^5.2.0", - "type-fest": "^0.8.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/meow/node_modules/read-pkg-up/node_modules/type-fest": { - "version": "0.8.1", - "dev": true, - "license": "(MIT OR CC0-1.0)", - "engines": { - "node": ">=8" - } - }, - "node_modules/meow/node_modules/read-pkg/node_modules/hosted-git-info": { - "version": "2.8.8", - "dev": true, - "license": "ISC" - }, - "node_modules/meow/node_modules/read-pkg/node_modules/normalize-package-data": { - "version": "2.5.0", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "hosted-git-info": "^2.1.4", - "resolve": "^1.10.0", - "semver": "2 || 3 || 4 || 5", - "validate-npm-package-license": "^3.0.1" - } - }, - "node_modules/meow/node_modules/read-pkg/node_modules/semver": { - "version": "5.7.1", - "dev": true, - "license": "ISC", - "bin": { - "semver": "bin/semver" - } - }, - "node_modules/meow/node_modules/read-pkg/node_modules/type-fest": { - "version": "0.6.0", - "dev": true, - "license": "(MIT OR CC0-1.0)", - "engines": { - "node": ">=8" - } - }, - "node_modules/meow/node_modules/type-fest": { - "version": "0.18.1", - "dev": true, - "license": "(MIT OR CC0-1.0)", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/meow/node_modules/yallist": { - "version": "4.0.0", - "dev": true, - "license": "ISC" - }, - "node_modules/merge-stream": { - "version": "2.0.0", - "dev": true, - "license": "MIT" - }, - "node_modules/merge2": { - "version": "1.4.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 8" - } - }, - "node_modules/micromatch": { - "version": "3.1.10", - "dev": true, - "license": "MIT", - "dependencies": { - "arr-diff": "^4.0.0", - "array-unique": "^0.3.2", - "braces": "^2.3.1", - "define-property": "^2.0.2", - "extend-shallow": "^3.0.2", - "extglob": "^2.0.4", - "fragment-cache": "^0.2.1", - "kind-of": "^6.0.2", - "nanomatch": "^1.2.9", - "object.pick": "^1.3.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.2" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/mime": { - "version": "1.6.0", - "dev": true, - "license": "MIT", - "bin": { - "mime": "cli.js" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/mime-db": { - "version": "1.46.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/mime-types": { - "version": "2.1.29", - "dev": true, - "license": "MIT", - "dependencies": { - "mime-db": "1.46.0" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/mimic-fn": { - "version": "2.1.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/min-document": { - "version": "2.19.0", - "dependencies": { - "dom-walk": "^0.1.0" - } - }, - "node_modules/min-indent": { - "version": "1.0.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/mini-signals": { - "version": "1.2.0", - "license": "MIT" - }, - "node_modules/minimatch": { - "version": "3.0.4", - "dev": true, - "license": "ISC", - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, - "node_modules/minimist": { - "version": "1.2.5", - "dev": true, - "license": "MIT" - }, - "node_modules/minimist-options": { - "version": "4.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "arrify": "^1.0.1", - "is-plain-obj": "^1.1.0", - "kind-of": "^6.0.3" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/minipass": { - "version": "2.9.0", - "dev": true, - "license": "ISC", - "dependencies": { - "safe-buffer": "^5.1.2", - "yallist": "^3.0.0" - } - }, - "node_modules/minizlib": { - "version": "1.3.3", - "dev": true, - "license": "MIT", - "dependencies": { - "minipass": "^2.9.0" - } - }, - "node_modules/mississippi": { - "version": "3.0.0", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "concat-stream": "^1.5.0", - "duplexify": "^3.4.2", - "end-of-stream": "^1.1.0", - "flush-write-stream": "^1.0.0", - "from2": "^2.1.0", - "parallel-transform": "^1.1.0", - "pump": "^3.0.0", - "pumpify": "^1.3.3", - "stream-each": "^1.1.0", - "through2": "^2.0.0" - }, - "engines": { - "node": ">=4.0.0" - } - }, - "node_modules/mississippi/node_modules/concat-stream": { - "version": "1.6.2", - "dev": true, - "engines": [ - "node >= 0.8" - ], - "license": "MIT", - "dependencies": { - "buffer-from": "^1.0.0", - "inherits": "^2.0.3", - "readable-stream": "^2.2.2", - "typedarray": "^0.0.6" - } - }, - "node_modules/mississippi/node_modules/isarray": { - "version": "1.0.0", - "dev": true, - "license": "MIT" - }, - "node_modules/mississippi/node_modules/readable-stream": { - "version": "2.3.7", - "dev": true, - "license": "MIT", - "dependencies": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "node_modules/mississippi/node_modules/string_decoder": { - "version": "1.1.1", - "dev": true, - "license": "MIT", - "dependencies": { - "safe-buffer": "~5.1.0" - } - }, - "node_modules/mississippi/node_modules/through2": { - "version": "2.0.5", - "dev": true, - "license": "MIT", - "dependencies": { - "readable-stream": "~2.3.6", - "xtend": "~4.0.1" - } - }, - "node_modules/mississippi/node_modules/xtend": { - "version": "4.0.2", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.4" - } - }, - "node_modules/mixin-deep": { - "version": "1.3.2", - "dev": true, - "license": "MIT", - "dependencies": { - "for-in": "^1.0.2", - "is-extendable": "^1.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/mkdirp": { - "version": "0.5.5", - "dev": true, - "license": "MIT", - "dependencies": { - "minimist": "^1.2.5" - }, - "bin": { - "mkdirp": "bin/cmd.js" - } - }, - "node_modules/mkdirp-promise": { - "version": "5.0.1", - "dev": true, - "license": "ISC", - "dependencies": { - "mkdirp": "*" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/modify-values": { - "version": "1.0.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/move-concurrently": { - "version": "1.0.1", - "dev": true, - "license": "ISC", - "dependencies": { - "aproba": "^1.1.1", - "copy-concurrently": "^1.0.0", - "fs-write-stream-atomic": "^1.0.8", - "mkdirp": "^0.5.1", - "rimraf": "^2.5.4", - "run-queue": "^1.0.3" - } - }, - "node_modules/move-concurrently/node_modules/aproba": { - "version": "1.2.0", - "dev": true, - "license": "ISC" - }, - "node_modules/ms": { - "version": "2.1.2", - "dev": true, - "license": "MIT" - }, - "node_modules/multimatch": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "array-differ": "^2.0.3", - "array-union": "^1.0.2", - "arrify": "^1.0.1", - "minimatch": "^3.0.4" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/mute-stream": { - "version": "0.0.8", - "dev": true, - "license": "ISC" - }, - "node_modules/mz": { - "version": "2.7.0", - "dev": true, - "license": "MIT", - "dependencies": { - "any-promise": "^1.0.0", - "object-assign": "^4.0.1", - "thenify-all": "^1.0.0" - } - }, - "node_modules/nan": { - "version": "2.14.2", - "dev": true, - "license": "MIT", - "optional": true - }, - "node_modules/nanoid": { - "version": "3.1.21", - "dev": true, - "license": "MIT", - "bin": { - "nanoid": "bin/nanoid.cjs" - }, - "engines": { - "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" - } - }, - "node_modules/nanomatch": { - "version": "1.2.13", - "dev": true, - "license": "MIT", - "dependencies": { - "arr-diff": "^4.0.0", - "array-unique": "^0.3.2", - "define-property": "^2.0.2", - "extend-shallow": "^3.0.2", - "fragment-cache": "^0.2.1", - "is-windows": "^1.0.2", - "kind-of": "^6.0.2", - "object.pick": "^1.3.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/natural-compare": { - "version": "1.4.0", - "dev": true, - "license": "MIT" - }, - "node_modules/neo-async": { - "version": "2.6.2", - "dev": true, - "license": "MIT" - }, - "node_modules/nice-try": { - "version": "1.0.5", - "dev": true, - "license": "MIT" - }, - "node_modules/nise": { - "version": "1.5.3", - "dev": true, - "license": "BSD-3-Clause", - "dependencies": { - "@sinonjs/formatio": "^3.2.1", - "@sinonjs/text-encoding": "^0.7.1", - "just-extend": "^4.0.2", - "lolex": "^5.0.1", - "path-to-regexp": "^1.7.0" - } - }, - "node_modules/nise/node_modules/lolex": { - "version": "5.1.2", - "dev": true, - "license": "BSD-3-Clause", - "dependencies": { - "@sinonjs/commons": "^1.7.0" - } - }, - "node_modules/node-fetch": { - "version": "2.6.1", - "dev": true, - "license": "MIT", - "engines": { - "node": "4.x || >=6.0.0" - } - }, - "node_modules/node-fetch-npm": { - "version": "2.0.4", - "dev": true, - "license": "MIT", - "dependencies": { - "encoding": "^0.1.11", - "json-parse-better-errors": "^1.0.0", - "safe-buffer": "^5.1.1" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/node-gyp": { - "version": "5.1.1", - "dev": true, - "license": "MIT", - "dependencies": { - "env-paths": "^2.2.0", - "glob": "^7.1.4", - "graceful-fs": "^4.2.2", - "mkdirp": "^0.5.1", - "nopt": "^4.0.1", - "npmlog": "^4.1.2", - "request": "^2.88.0", - "rimraf": "^2.6.3", - "semver": "^5.7.1", - "tar": "^4.4.12", - "which": "^1.3.1" - }, - "bin": { - "node-gyp": "bin/node-gyp.js" - }, - "engines": { - "node": ">= 6.0.0" - } - }, - "node_modules/node-gyp/node_modules/semver": { - "version": "5.7.1", - "dev": true, - "license": "ISC", - "bin": { - "semver": "bin/semver" - } - }, - "node_modules/node-int64": { - "version": "0.4.0", - "dev": true, - "license": "MIT" - }, - "node_modules/node-modules-regexp": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/node-notifier": { - "version": "5.4.5", - "dev": true, - "license": "MIT", - "dependencies": { - "growly": "^1.3.0", - "is-wsl": "^1.1.0", - "semver": "^5.5.0", - "shellwords": "^0.1.1", - "which": "^1.3.0" - } - }, - "node_modules/node-notifier/node_modules/semver": { - "version": "5.7.1", - "dev": true, - "license": "ISC", - "bin": { - "semver": "bin/semver" - } - }, - "node_modules/node-releases": { - "version": "1.1.71", - "dev": true, - "license": "MIT" - }, - "node_modules/nopt": { - "version": "4.0.3", - "dev": true, - "license": "ISC", - "dependencies": { - "abbrev": "1", - "osenv": "^0.1.4" - }, - "bin": { - "nopt": "bin/nopt.js" - } - }, - "node_modules/normalize-package-data": { - "version": "2.5.0", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "hosted-git-info": "^2.1.4", - "resolve": "^1.10.0", - "semver": "2 || 3 || 4 || 5", - "validate-npm-package-license": "^3.0.1" - } - }, - "node_modules/normalize-package-data/node_modules/semver": { - "version": "5.7.1", - "dev": true, - "license": "ISC", - "bin": { - "semver": "bin/semver" - } - }, - "node_modules/normalize-path": { - "version": "2.1.1", - "dev": true, - "license": "MIT", - "dependencies": { - "remove-trailing-separator": "^1.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/normalize-url": { - "version": "3.3.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/npm-bundled": { - "version": "1.1.1", - "dev": true, - "license": "ISC", - "dependencies": { - "npm-normalize-package-bin": "^1.0.1" - } - }, - "node_modules/npm-lifecycle": { - "version": "3.1.5", - "dev": true, - "license": "Artistic-2.0", - "dependencies": { - "byline": "^5.0.0", - "graceful-fs": "^4.1.15", - "node-gyp": "^5.0.2", - "resolve-from": "^4.0.0", - "slide": "^1.1.6", - "uid-number": "0.0.6", - "umask": "^1.1.0", - "which": "^1.3.1" - } - }, - "node_modules/npm-normalize-package-bin": { - "version": "1.0.1", - "dev": true, - "license": "ISC" - }, - "node_modules/npm-package-arg": { - "version": "6.1.1", - "dev": true, - "license": "ISC", - "dependencies": { - "hosted-git-info": "^2.7.1", - "osenv": "^0.1.5", - "semver": "^5.6.0", - "validate-npm-package-name": "^3.0.0" - } - }, - "node_modules/npm-package-arg/node_modules/semver": { - "version": "5.7.1", - "dev": true, - "license": "ISC", - "bin": { - "semver": "bin/semver" - } - }, - "node_modules/npm-packlist": { - "version": "1.4.8", - "dev": true, - "license": "ISC", - "dependencies": { - "ignore-walk": "^3.0.1", - "npm-bundled": "^1.0.1", - "npm-normalize-package-bin": "^1.0.1" - } - }, - "node_modules/npm-pick-manifest": { - "version": "3.0.2", - "dev": true, - "license": "ISC", - "dependencies": { - "figgy-pudding": "^3.5.1", - "npm-package-arg": "^6.0.0", - "semver": "^5.4.1" - } - }, - "node_modules/npm-pick-manifest/node_modules/semver": { - "version": "5.7.1", - "dev": true, - "license": "ISC", - "bin": { - "semver": "bin/semver" - } - }, - "node_modules/npm-run-path": { - "version": "4.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "path-key": "^3.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/npm-run-path/node_modules/path-key": { - "version": "3.1.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/npmlog": { - "version": "4.1.2", - "dev": true, - "license": "ISC", - "dependencies": { - "are-we-there-yet": "~1.1.2", - "console-control-strings": "~1.1.0", - "gauge": "~2.7.3", - "set-blocking": "~2.0.0" - } - }, - "node_modules/number-is-nan": { - "version": "1.0.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/nwsapi": { - "version": "2.2.0", - "dev": true, - "license": "MIT" - }, - "node_modules/oauth-sign": { - "version": "0.9.0", - "dev": true, - "license": "Apache-2.0", - "engines": { - "node": "*" - } - }, - "node_modules/object-assign": { - "version": "4.1.1", - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/object-copy": { - "version": "0.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "copy-descriptor": "^0.1.0", - "define-property": "^0.2.5", - "kind-of": "^3.0.3" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/object-copy/node_modules/define-property": { - "version": "0.2.5", - "dev": true, - "license": "MIT", - "dependencies": { - "is-descriptor": "^0.1.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/object-copy/node_modules/is-accessor-descriptor": { - "version": "0.1.6", - "dev": true, - "license": "MIT", - "dependencies": { - "kind-of": "^3.0.2" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/object-copy/node_modules/is-data-descriptor": { - "version": "0.1.4", - "dev": true, - "license": "MIT", - "dependencies": { - "kind-of": "^3.0.2" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/object-copy/node_modules/is-descriptor": { - "version": "0.1.6", - "dev": true, - "license": "MIT", - "dependencies": { - "is-accessor-descriptor": "^0.1.6", - "is-data-descriptor": "^0.1.4", - "kind-of": "^5.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/object-copy/node_modules/is-descriptor/node_modules/kind-of": { - "version": "5.1.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/object-copy/node_modules/kind-of": { - "version": "3.2.2", - "dev": true, - "license": "MIT", - "dependencies": { - "is-buffer": "^1.1.5" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/object-inspect": { - "version": "1.9.0", - "dev": true, - "license": "MIT", - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/object-keys": { - "version": "1.1.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/object-visit": { - "version": "1.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "isobject": "^3.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/object.assign": { - "version": "4.1.2", - "dev": true, - "license": "MIT", - "dependencies": { - "call-bind": "^1.0.0", - "define-properties": "^1.1.3", - "has-symbols": "^1.0.1", - "object-keys": "^1.1.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/object.getownpropertydescriptors": { - "version": "2.1.2", - "dev": true, - "license": "MIT", - "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3", - "es-abstract": "^1.18.0-next.2" - }, - "engines": { - "node": ">= 0.8" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/object.omit": { - "version": "2.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "for-own": "^0.1.4", - "is-extendable": "^0.1.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/object.omit/node_modules/is-extendable": { - "version": "0.1.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/object.pick": { - "version": "1.3.0", - "dev": true, - "license": "MIT", - "dependencies": { - "isobject": "^3.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/octokit-pagination-methods": { - "version": "1.1.0", - "dev": true, - "license": "MIT" - }, - "node_modules/once": { - "version": "1.4.0", - "dev": true, - "license": "ISC", - "dependencies": { - "wrappy": "1" - } - }, - "node_modules/onetime": { - "version": "5.1.2", - "dev": true, - "license": "MIT", - "dependencies": { - "mimic-fn": "^2.1.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/open": { - "version": "7.4.2", - "dev": true, - "license": "MIT", - "dependencies": { - "is-docker": "^2.0.0", - "is-wsl": "^2.1.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/open/node_modules/is-wsl": { - "version": "2.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "is-docker": "^2.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/opener": { - "version": "1.4.3", - "dev": true, - "license": "(WTFPL OR MIT)", - "bin": { - "opener": "opener.js" - } - }, - "node_modules/optimist": { - "version": "0.6.1", - "dev": true, - "license": "MIT/X11", - "dependencies": { - "minimist": "~0.0.1", - "wordwrap": "~0.0.2" - } - }, - "node_modules/optimist/node_modules/minimist": { - "version": "0.0.10", - "dev": true, - "license": "MIT" - }, - "node_modules/optimist/node_modules/wordwrap": { - "version": "0.0.3", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/optionator": { - "version": "0.8.3", - "dev": true, - "license": "MIT", - "dependencies": { - "deep-is": "~0.1.3", - "fast-levenshtein": "~2.0.6", - "levn": "~0.3.0", - "prelude-ls": "~1.1.2", - "type-check": "~0.3.2", - "word-wrap": "~1.2.3" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/opts": { - "version": "2.0.2", - "dev": true, - "license": "BSD-2-Clause" - }, - "node_modules/os-homedir": { - "version": "1.0.2", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/os-name": { - "version": "3.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "macos-release": "^2.2.0", - "windows-release": "^3.1.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/os-tmpdir": { - "version": "1.0.2", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/osenv": { - "version": "0.1.5", - "dev": true, - "license": "ISC", - "dependencies": { - "os-homedir": "^1.0.0", - "os-tmpdir": "^1.0.0" - } - }, - "node_modules/ospec": { - "version": "3.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "glob": "^7.1.3" - }, - "bin": { - "ospec": "bin/ospec" - } - }, - "node_modules/p-each-series": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "p-reduce": "^1.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/p-finally": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/p-limit": { - "version": "2.3.0", - "dev": true, - "license": "MIT", - "dependencies": { - "p-try": "^2.0.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/p-locate": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "p-limit": "^2.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/p-map": { - "version": "2.1.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/p-map-series": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "p-reduce": "^1.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/p-pipe": { - "version": "1.2.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/p-queue": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "eventemitter3": "^3.1.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/p-queue/node_modules/eventemitter3": { - "version": "3.1.2", - "dev": true, - "license": "MIT" - }, - "node_modules/p-reduce": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/p-try": { - "version": "2.2.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/p-waterfall": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "p-reduce": "^1.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/parallel-transform": { - "version": "1.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "cyclist": "^1.0.1", - "inherits": "^2.0.3", - "readable-stream": "^2.1.5" - } - }, - "node_modules/parallel-transform/node_modules/isarray": { - "version": "1.0.0", - "dev": true, - "license": "MIT" - }, - "node_modules/parallel-transform/node_modules/readable-stream": { - "version": "2.3.7", - "dev": true, - "license": "MIT", - "dependencies": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "node_modules/parallel-transform/node_modules/string_decoder": { - "version": "1.1.1", - "dev": true, - "license": "MIT", - "dependencies": { - "safe-buffer": "~5.1.0" - } - }, - "node_modules/parent-module": { - "version": "1.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "callsites": "^3.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/parse-github-repo-url": { - "version": "1.4.1", - "dev": true, - "license": "MIT" - }, - "node_modules/parse-glob": { - "version": "3.0.4", - "dev": true, - "license": "MIT", - "dependencies": { - "glob-base": "^0.3.0", - "is-dotfile": "^1.0.0", - "is-extglob": "^1.0.0", - "is-glob": "^2.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/parse-glob/node_modules/is-extglob": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/parse-glob/node_modules/is-glob": { - "version": "2.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "is-extglob": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/parse-int": { - "version": "1.0.3", - "license": "MIT", - "dependencies": { - "is-integer": "^1.0.4" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/parse-json": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "error-ex": "^1.3.1", - "json-parse-better-errors": "^1.0.1" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/parse-path": { - "version": "4.0.3", - "dev": true, - "license": "MIT", - "dependencies": { - "is-ssh": "^1.3.0", - "protocols": "^1.4.0", - "qs": "^6.9.4", - "query-string": "^6.13.8" - } - }, - "node_modules/parse-uri": { - "version": "1.0.3", - "license": "MIT", - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/parse-url": { - "version": "5.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "is-ssh": "^1.3.0", - "normalize-url": "^3.3.0", - "parse-path": "^4.0.0", - "protocols": "^1.4.0" - } - }, - "node_modules/parse5": { - "version": "4.0.0", - "dev": true, - "license": "MIT" - }, - "node_modules/pascalcase": { - "version": "0.1.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/path-dirname": { - "version": "1.0.2", - "dev": true, - "license": "MIT" - }, - "node_modules/path-exists": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/path-is-absolute": { - "version": "1.0.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/path-key": { - "version": "2.0.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/path-parse": { - "version": "1.0.6", - "dev": true, - "license": "MIT" - }, - "node_modules/path-to-regexp": { - "version": "1.8.0", - "dev": true, - "license": "MIT", - "dependencies": { - "isarray": "0.0.1" - } - }, - "node_modules/path-type": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "pify": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/path-type/node_modules/pify": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/performance-now": { - "version": "2.1.0", - "dev": true, - "license": "MIT" - }, - "node_modules/picomatch": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.3.tgz", - "integrity": "sha512-KpELjfwcCDUb9PeigTs2mBJzXUPzAuP2oPcA989He8Rte0+YUAjw1JVedDhuTKPkHjSYzMN3npC9luThGYEKdg==", - "dev": true, - "engines": { - "node": ">=8.6" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" - } - }, - "node_modules/pify": { - "version": "4.0.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/pinkie": { - "version": "2.0.4", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/pinkie-promise": { - "version": "2.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "pinkie": "^2.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/pirates": { - "version": "4.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "node-modules-regexp": "^1.0.0" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/pixi-gl-core": { - "version": "1.1.4", - "license": "MIT" - }, - "node_modules/pixi.js": { - "version": "4.8.9", - "license": "MIT", - "dependencies": { - "bit-twiddle": "^1.0.2", - "earcut": "^2.1.4", - "eventemitter3": "^2.0.0", - "ismobilejs": "^0.5.1", - "object-assign": "^4.0.1", - "pixi-gl-core": "^1.1.4", - "remove-array-items": "^1.0.0", - "resource-loader": "^2.2.3" - } - }, - "node_modules/pixi.js/node_modules/eventemitter3": { - "version": "2.0.3", - "license": "MIT" - }, - "node_modules/pixi.js/node_modules/resource-loader": { - "version": "2.2.4", - "license": "MIT", - "dependencies": { - "mini-signals": "^1.1.1", - "parse-uri": "^1.0.0" - } - }, - "node_modules/pkg-dir": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "find-up": "^3.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/pn": { - "version": "1.1.0", - "dev": true, - "license": "MIT" - }, - "node_modules/portfinder": { - "version": "1.0.28", - "dev": true, - "license": "MIT", - "dependencies": { - "async": "^2.6.2", - "debug": "^3.1.1", - "mkdirp": "^0.5.5" - }, - "engines": { - "node": ">= 0.12.0" - } - }, - "node_modules/portfinder/node_modules/debug": { - "version": "3.2.7", - "dev": true, - "license": "MIT", - "dependencies": { - "ms": "^2.1.1" - } - }, - "node_modules/posix-character-classes": { - "version": "0.1.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/prelude-ls": { - "version": "1.1.2", - "dev": true, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/preserve": { - "version": "0.2.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/prettier": { - "version": "2.2.1", - "dev": true, - "license": "MIT", - "bin": { - "prettier": "bin-prettier.js" - }, - "engines": { - "node": ">=10.13.0" - } - }, - "node_modules/prettier-linter-helpers": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "fast-diff": "^1.1.2" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/pretty-format": { - "version": "24.9.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/types": "^24.9.0", - "ansi-regex": "^4.0.0", - "ansi-styles": "^3.2.0", - "react-is": "^16.8.4" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/pretty-format/node_modules/ansi-styles": { - "version": "3.2.1", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/pretty-format/node_modules/color-convert": { - "version": "1.9.3", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "1.1.3" - } - }, - "node_modules/pretty-format/node_modules/color-name": { - "version": "1.1.3", - "dev": true, - "license": "MIT" - }, - "node_modules/process": { - "version": "0.5.2", - "engines": { - "node": ">= 0.6.0" - } - }, - "node_modules/process-nextick-args": { - "version": "2.0.1", - "dev": true, - "license": "MIT" - }, - "node_modules/progress": { - "version": "2.0.3", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/promise-inflight": { - "version": "1.0.1", - "dev": true, - "license": "ISC" - }, - "node_modules/promise-retry": { - "version": "1.1.1", - "dev": true, - "license": "MIT", - "dependencies": { - "err-code": "^1.0.0", - "retry": "^0.10.0" - }, - "engines": { - "node": ">=0.12" - } - }, - "node_modules/prompts": { - "version": "2.4.0", - "dev": true, - "license": "MIT", - "dependencies": { - "kleur": "^3.0.3", - "sisteransi": "^1.0.5" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/promzard": { - "version": "0.3.0", - "dev": true, - "license": "ISC", - "dependencies": { - "read": "1" - } - }, - "node_modules/proto-list": { - "version": "1.2.4", - "dev": true, - "license": "ISC" - }, - "node_modules/protocols": { - "version": "1.4.8", - "dev": true, - "license": "MIT" - }, - "node_modules/protoduck": { - "version": "5.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "genfun": "^5.0.0" - } - }, - "node_modules/psl": { - "version": "1.8.0", - "dev": true, - "license": "MIT" - }, - "node_modules/pump": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "end-of-stream": "^1.1.0", - "once": "^1.3.1" - } - }, - "node_modules/pumpify": { - "version": "1.5.1", - "dev": true, - "license": "MIT", - "dependencies": { - "duplexify": "^3.6.0", - "inherits": "^2.0.3", - "pump": "^2.0.0" - } - }, - "node_modules/pumpify/node_modules/pump": { - "version": "2.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "end-of-stream": "^1.1.0", - "once": "^1.3.1" - } - }, - "node_modules/punycode": { - "version": "2.1.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/q": { - "version": "1.5.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.6.0", - "teleport": ">=0.2.0" - } - }, - "node_modules/qs": { - "version": "6.9.6", - "dev": true, - "license": "BSD-3-Clause", - "engines": { - "node": ">=0.6" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/query-string": { - "version": "6.14.1", - "dev": true, - "license": "MIT", - "dependencies": { - "decode-uri-component": "^0.2.0", - "filter-obj": "^1.1.0", - "split-on-first": "^1.0.0", - "strict-uri-encode": "^2.0.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/queue-microtask": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", - "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, - "node_modules/quick-lru": { - "version": "4.0.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/randomatic": { - "version": "3.1.1", - "dev": true, - "license": "MIT", - "dependencies": { - "is-number": "^4.0.0", - "kind-of": "^6.0.0", - "math-random": "^1.0.1" - }, - "engines": { - "node": ">= 0.10.0" - } - }, - "node_modules/randomatic/node_modules/is-number": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/randombytes": { - "version": "2.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "safe-buffer": "^5.1.0" - } - }, - "node_modules/react-is": { - "version": "16.13.1", - "dev": true, - "license": "MIT" - }, - "node_modules/read": { - "version": "1.0.7", - "dev": true, - "license": "ISC", - "dependencies": { - "mute-stream": "~0.0.4" - }, - "engines": { - "node": ">=0.8" - } - }, - "node_modules/read-cmd-shim": { - "version": "1.0.5", - "dev": true, - "license": "ISC", - "dependencies": { - "graceful-fs": "^4.1.2" - } - }, - "node_modules/read-package-json": { - "version": "2.1.2", - "dev": true, - "license": "ISC", - "dependencies": { - "glob": "^7.1.1", - "json-parse-even-better-errors": "^2.3.0", - "normalize-package-data": "^2.0.0", - "npm-normalize-package-bin": "^1.0.0" - } - }, - "node_modules/read-package-tree": { - "version": "5.3.1", - "dev": true, - "license": "ISC", - "dependencies": { - "read-package-json": "^2.0.0", - "readdir-scoped-modules": "^1.0.0", - "util-promisify": "^2.1.0" - } - }, - "node_modules/read-pkg": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "load-json-file": "^4.0.0", - "normalize-package-data": "^2.3.2", - "path-type": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/read-pkg-up": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "find-up": "^2.0.0", - "read-pkg": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/read-pkg-up/node_modules/find-up": { - "version": "2.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "locate-path": "^2.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/read-pkg-up/node_modules/locate-path": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "p-locate": "^2.0.0", - "path-exists": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/read-pkg-up/node_modules/p-limit": { - "version": "1.3.0", - "dev": true, - "license": "MIT", - "dependencies": { - "p-try": "^1.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/read-pkg-up/node_modules/p-locate": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "p-limit": "^1.1.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/read-pkg-up/node_modules/p-try": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/read-pkg/node_modules/load-json-file": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "graceful-fs": "^4.1.2", - "parse-json": "^4.0.0", - "pify": "^3.0.0", - "strip-bom": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/read-pkg/node_modules/pify": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/readable-stream": { - "version": "3.6.0", - "dev": true, - "license": "MIT", - "dependencies": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/readdir-scoped-modules": { - "version": "1.1.0", - "dev": true, - "license": "ISC", - "dependencies": { - "debuglog": "^1.0.1", - "dezalgo": "^1.0.0", - "graceful-fs": "^4.1.2", - "once": "^1.3.0" - } - }, - "node_modules/readdirp": { - "version": "3.5.0", - "dev": true, - "license": "MIT", - "dependencies": { - "picomatch": "^2.2.1" - }, - "engines": { - "node": ">=8.10.0" - } - }, - "node_modules/realpath-native": { - "version": "1.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "util.promisify": "^1.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/rechoir": { - "version": "0.6.2", - "dev": true, - "dependencies": { - "resolve": "^1.1.6" - }, - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/redent": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "indent-string": "^4.0.0", - "strip-indent": "^3.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/regex-cache": { - "version": "0.4.4", - "dev": true, - "license": "MIT", - "dependencies": { - "is-equal-shallow": "^0.1.3" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/regex-not": { - "version": "1.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "extend-shallow": "^3.0.2", - "safe-regex": "^1.1.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/regexpp": { - "version": "2.0.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.5.0" - } - }, - "node_modules/remove-array-items": { - "version": "1.1.1", - "license": "MIT" - }, - "node_modules/remove-trailing-separator": { - "version": "1.1.0", - "dev": true, - "license": "ISC" - }, - "node_modules/repeat-element": { - "version": "1.1.3", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/repeat-string": { - "version": "1.6.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10" - } - }, - "node_modules/repeating": { - "version": "2.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "is-finite": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/request": { - "version": "2.88.2", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "aws-sign2": "~0.7.0", - "aws4": "^1.8.0", - "caseless": "~0.12.0", - "combined-stream": "~1.0.6", - "extend": "~3.0.2", - "forever-agent": "~0.6.1", - "form-data": "~2.3.2", - "har-validator": "~5.1.3", - "http-signature": "~1.2.0", - "is-typedarray": "~1.0.0", - "isstream": "~0.1.2", - "json-stringify-safe": "~5.0.1", - "mime-types": "~2.1.19", - "oauth-sign": "~0.9.0", - "performance-now": "^2.1.0", - "qs": "~6.5.2", - "safe-buffer": "^5.1.2", - "tough-cookie": "~2.5.0", - "tunnel-agent": "^0.6.0", - "uuid": "^3.3.2" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/request-promise-core": { - "version": "1.1.4", - "dev": true, - "license": "ISC", - "dependencies": { - "lodash": "^4.17.19" - }, - "engines": { - "node": ">=0.10.0" - }, - "peerDependencies": { - "request": "^2.34" - } - }, - "node_modules/request-promise-native": { - "version": "1.0.9", - "dev": true, - "license": "ISC", - "dependencies": { - "request-promise-core": "1.1.4", - "stealthy-require": "^1.1.1", - "tough-cookie": "^2.3.3" - }, - "engines": { - "node": ">=0.12.0" - }, - "peerDependencies": { - "request": "^2.34" - } - }, - "node_modules/request/node_modules/qs": { - "version": "6.5.2", - "dev": true, - "license": "BSD-3-Clause", - "engines": { - "node": ">=0.6" - } - }, - "node_modules/require-directory": { - "version": "2.1.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/require-main-filename": { - "version": "2.0.0", - "dev": true, - "license": "ISC" - }, - "node_modules/require-relative": { - "version": "0.8.7", - "dev": true, - "license": "MIT" - }, - "node_modules/requires-port": { - "version": "1.0.0", - "dev": true, - "license": "MIT" - }, - "node_modules/resolve": { - "version": "1.17.0", - "dev": true, - "license": "MIT", - "dependencies": { - "path-parse": "^1.0.6" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/resolve-cwd": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "resolve-from": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/resolve-cwd/node_modules/resolve-from": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/resolve-from": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/resolve-url": { - "version": "0.2.1", - "dev": true, - "license": "MIT" - }, - "node_modules/resource-loader": { - "version": "4.0.0-rc4", - "license": "MIT", - "dependencies": { - "parse-uri": "^1.0.0", - "type-signals": "^1.0.3" - } - }, - "node_modules/restore-cursor": { - "version": "3.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "onetime": "^5.1.0", - "signal-exit": "^3.0.2" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/ret": { - "version": "0.1.15", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.12" - } - }, - "node_modules/retry": { - "version": "0.10.1", - "dev": true, - "license": "MIT", - "engines": { - "node": "*" - } - }, - "node_modules/reusify": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", - "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", - "dev": true, - "engines": { - "iojs": ">=1.0.0", - "node": ">=0.10.0" - } - }, - "node_modules/rimraf": { - "version": "2.6.3", - "dev": true, - "license": "ISC", - "dependencies": { - "glob": "^7.1.3" - }, - "bin": { - "rimraf": "bin.js" - } - }, - "node_modules/rollup": { - "version": "2.53.2", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.53.2.tgz", - "integrity": "sha512-1CtEYuS5CRCzFZ7SNW5528SlDlk4VDXIRGwbm/2POQxA/G4+7/crIqJwkmnj8Q/74hGx4oVlNvh4E1CJQ5hZ6w==", - "dev": true, - "bin": { - "rollup": "dist/bin/rollup" - }, - "engines": { - "node": ">=10.0.0" - }, - "optionalDependencies": { - "fsevents": "~2.3.2" - } - }, - "node_modules/rollup-plugin-analyzer": { - "version": "3.3.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8.0.0" - } - }, - "node_modules/rollup-plugin-copy": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/rollup-plugin-copy/-/rollup-plugin-copy-3.4.0.tgz", - "integrity": "sha512-rGUmYYsYsceRJRqLVlE9FivJMxJ7X6jDlP79fmFkL8sJs7VVMSVyA2yfyL+PGyO/vJs4A87hwhgVfz61njI+uQ==", - "dev": true, - "dependencies": { - "@types/fs-extra": "^8.0.1", - "colorette": "^1.1.0", - "fs-extra": "^8.1.0", - "globby": "10.0.1", - "is-plain-object": "^3.0.0" - }, - "engines": { - "node": ">=8.3" - } - }, - "node_modules/rollup-plugin-copy/node_modules/@nodelib/fs.stat": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.4.tgz", - "integrity": "sha512-IYlHJA0clt2+Vg7bccq+TzRdJvv19c2INqBSsoOLp1je7xjtr7J26+WXR72MCdvU9q1qTzIWDfhMf+DRvQJK4Q==", - "dev": true, - "engines": { - "node": ">= 8" - } - }, - "node_modules/rollup-plugin-copy/node_modules/array-union": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", - "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/rollup-plugin-copy/node_modules/braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", - "dev": true, - "dependencies": { - "fill-range": "^7.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/rollup-plugin-copy/node_modules/dir-glob": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", - "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", - "dev": true, - "dependencies": { - "path-type": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/rollup-plugin-copy/node_modules/fast-glob": { - "version": "3.2.5", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.5.tgz", - "integrity": "sha512-2DtFcgT68wiTTiwZ2hNdJfcHNke9XOfnwmBRWXhmeKM8rF0TGwmC/Qto3S7RoZKp5cilZbxzO5iTNTQsJ+EeDg==", - "dev": true, - "dependencies": { - "@nodelib/fs.stat": "^2.0.2", - "@nodelib/fs.walk": "^1.2.3", - "glob-parent": "^5.1.0", - "merge2": "^1.3.0", - "micromatch": "^4.0.2", - "picomatch": "^2.2.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/rollup-plugin-copy/node_modules/fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", - "dev": true, - "dependencies": { - "to-regex-range": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/rollup-plugin-copy/node_modules/fs-extra": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", - "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==", - "dev": true, - "dependencies": { - "graceful-fs": "^4.2.0", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - }, - "engines": { - "node": ">=6 <7 || >=8" - } - }, - "node_modules/rollup-plugin-copy/node_modules/globby": { - "version": "10.0.1", - "resolved": "https://registry.npmjs.org/globby/-/globby-10.0.1.tgz", - "integrity": "sha512-sSs4inE1FB2YQiymcmTv6NWENryABjUNPeWhOvmn4SjtKybglsyPZxFB3U1/+L1bYi0rNZDqCLlHyLYDl1Pq5A==", - "dev": true, - "dependencies": { - "@types/glob": "^7.1.1", - "array-union": "^2.1.0", - "dir-glob": "^3.0.1", - "fast-glob": "^3.0.3", - "glob": "^7.1.3", - "ignore": "^5.1.1", - "merge2": "^1.2.3", - "slash": "^3.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/rollup-plugin-copy/node_modules/ignore": { - "version": "5.1.8", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.8.tgz", - "integrity": "sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw==", - "dev": true, - "engines": { - "node": ">= 4" - } - }, - "node_modules/rollup-plugin-copy/node_modules/is-number": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", - "dev": true, - "engines": { - "node": ">=0.12.0" - } - }, - "node_modules/rollup-plugin-copy/node_modules/is-plain-object": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-3.0.1.tgz", - "integrity": "sha512-Xnpx182SBMrr/aBik8y+GuR4U1L9FqMSojwDQwPMmxyC6bvEqly9UBCxhauBF5vNh2gwWJNX6oDV7O+OM4z34g==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/rollup-plugin-copy/node_modules/jsonfile": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", - "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", - "dev": true, - "optionalDependencies": { - "graceful-fs": "^4.1.6" - } - }, - "node_modules/rollup-plugin-copy/node_modules/micromatch": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.4.tgz", - "integrity": "sha512-pRmzw/XUcwXGpD9aI9q/0XOwLNygjETJ8y0ao0wdqprrzDa4YnxLcz7fQRZr8voh8V10kGhABbNcHVk5wHgWwg==", - "dev": true, - "dependencies": { - "braces": "^3.0.1", - "picomatch": "^2.2.3" - }, - "engines": { - "node": ">=8.6" - } - }, - "node_modules/rollup-plugin-copy/node_modules/path-type": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", - "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/rollup-plugin-copy/node_modules/to-regex-range": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", - "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", - "dev": true, - "dependencies": { - "is-number": "^7.0.0" - }, - "engines": { - "node": ">=8.0" - } - }, - "node_modules/rollup-plugin-copy/node_modules/universalify": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", - "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", - "dev": true, - "engines": { - "node": ">= 4.0.0" - } - }, - "node_modules/rollup-plugin-import-alias": { - "version": "1.0.10", - "dev": true, - "license": "MIT" - }, - "node_modules/rollup-plugin-inject": { - "version": "3.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "estree-walker": "^0.6.1", - "magic-string": "^0.25.3", - "rollup-pluginutils": "^2.8.1" - } - }, - "node_modules/rollup-plugin-inject/node_modules/estree-walker": { - "version": "0.6.1", - "dev": true, - "license": "MIT" - }, - "node_modules/rollup-plugin-livereload": { - "version": "1.3.0", - "dev": true, - "license": "MIT", - "dependencies": { - "livereload": "^0.9.1" - } - }, - "node_modules/rollup-plugin-modify": { - "version": "3.0.0", - "dev": true, - "license": "WTFPL", - "dependencies": { - "magic-string": "0.25.2", - "ospec": "3.1.0" - } - }, - "node_modules/rollup-plugin-modify/node_modules/magic-string": { - "version": "0.25.2", - "dev": true, - "license": "MIT", - "dependencies": { - "sourcemap-codec": "^1.4.4" - } - }, - "node_modules/rollup-plugin-node-resolve": { - "version": "5.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/resolve": "0.0.8", - "builtin-modules": "^3.1.0", - "is-module": "^1.0.0", - "resolve": "^1.11.1", - "rollup-pluginutils": "^2.8.1" - }, - "peerDependencies": { - "rollup": ">=1.11.0" - } - }, - "node_modules/rollup-plugin-polyfill-node": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/rollup-plugin-polyfill-node/-/rollup-plugin-polyfill-node-0.6.2.tgz", - "integrity": "sha512-gMCVuR0zsKq0jdBn8pSXN1Ejsc458k2QsFFvQdbHoM0Pot5hEnck+pBP/FDwFS6uAi77pD3rDTytsaUStsOMlA==", - "dev": true, - "dependencies": { - "@rollup/plugin-inject": "^4.0.0" - } - }, - "node_modules/rollup-plugin-replace": { - "version": "2.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "magic-string": "^0.25.2", - "rollup-pluginutils": "^2.6.0" - } - }, - "node_modules/rollup-plugin-serve": { - "version": "1.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "mime": ">=2.4.6", - "opener": "1" - } - }, - "node_modules/rollup-plugin-serve/node_modules/mime": { - "version": "2.5.2", - "dev": true, - "license": "MIT", - "bin": { - "mime": "cli.js" - }, - "engines": { - "node": ">=4.0.0" - } - }, - "node_modules/rollup-plugin-sourcemaps": { - "version": "0.4.2", - "dev": true, - "license": "MIT", - "dependencies": { - "rollup-pluginutils": "^2.0.1", - "source-map-resolve": "^0.5.0" - }, - "engines": { - "node": ">=4.5.0", - "npm": ">=2.15.9" - }, - "peerDependencies": { - "rollup": ">=0.31.2" - } - }, - "node_modules/rollup-plugin-terser": { - "version": "7.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/code-frame": "^7.10.4", - "jest-worker": "^26.2.1", - "serialize-javascript": "^4.0.0", - "terser": "^5.0.0" - }, - "peerDependencies": { - "rollup": "^2.0.0" - } - }, - "node_modules/rollup-plugin-terser/node_modules/jest-worker": { - "version": "26.6.2", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/node": "*", - "merge-stream": "^2.0.0", - "supports-color": "^7.0.0" - }, - "engines": { - "node": ">= 10.13.0" - } - }, - "node_modules/rollup-plugin-terser/node_modules/source-map": { - "version": "0.7.3", - "dev": true, - "license": "BSD-3-Clause", - "engines": { - "node": ">= 8" - } - }, - "node_modules/rollup-plugin-terser/node_modules/terser": { - "version": "5.6.0", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "commander": "^2.20.0", - "source-map": "~0.7.2", - "source-map-support": "~0.5.19" - }, - "bin": { - "terser": "bin/terser" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/rollup-plugin-typescript2": { - "version": "0.24.3", - "dev": true, - "license": "MIT", - "dependencies": { - "find-cache-dir": "^3.0.0", - "fs-extra": "8.1.0", - "resolve": "1.12.0", - "rollup-pluginutils": "2.8.1", - "tslib": "1.10.0" - }, - "peerDependencies": { - "rollup": ">=0.68.0", - "typescript": ">=2.4.0" - } - }, - "node_modules/rollup-plugin-typescript2/node_modules/estree-walker": { - "version": "0.6.1", - "dev": true, - "license": "MIT" - }, - "node_modules/rollup-plugin-typescript2/node_modules/fs-extra": { - "version": "8.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "graceful-fs": "^4.2.0", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - }, - "engines": { - "node": ">=6 <7 || >=8" - } - }, - "node_modules/rollup-plugin-typescript2/node_modules/jsonfile": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "optionalDependencies": { - "graceful-fs": "^4.1.6" - } - }, - "node_modules/rollup-plugin-typescript2/node_modules/resolve": { - "version": "1.12.0", - "dev": true, - "license": "MIT", - "dependencies": { - "path-parse": "^1.0.6" - } - }, - "node_modules/rollup-plugin-typescript2/node_modules/rollup-pluginutils": { - "version": "2.8.1", - "dev": true, - "license": "MIT", - "dependencies": { - "estree-walker": "^0.6.1" - } - }, - "node_modules/rollup-plugin-typescript2/node_modules/tslib": { - "version": "1.10.0", - "dev": true, - "license": "Apache-2.0" - }, - "node_modules/rollup-plugin-typescript2/node_modules/universalify": { - "version": "0.1.2", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 4.0.0" - } - }, - "node_modules/rollup-plugin-visualizer": { - "version": "4.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "nanoid": "^3.0.1", - "open": "^7.0.3", - "source-map": "^0.7.3", - "yargs": "^16.0.3" - }, - "bin": { - "rollup-plugin-visualizer": "bin/cli.js" - }, - "engines": { - "node": ">=10" - }, - "peerDependencies": { - "rollup": ">=1.20.0" - } - }, - "node_modules/rollup-plugin-visualizer/node_modules/ansi-regex": { - "version": "5.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/rollup-plugin-visualizer/node_modules/cliui": { - "version": "7.0.4", - "dev": true, - "license": "ISC", - "dependencies": { - "string-width": "^4.2.0", - "strip-ansi": "^6.0.0", - "wrap-ansi": "^7.0.0" - } - }, - "node_modules/rollup-plugin-visualizer/node_modules/source-map": { - "version": "0.7.3", - "dev": true, - "license": "BSD-3-Clause", - "engines": { - "node": ">= 8" - } - }, - "node_modules/rollup-plugin-visualizer/node_modules/strip-ansi": { - "version": "6.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-regex": "^5.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/rollup-plugin-visualizer/node_modules/wrap-ansi": { - "version": "7.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" - } - }, - "node_modules/rollup-plugin-visualizer/node_modules/y18n": { - "version": "5.0.5", - "dev": true, - "license": "ISC", - "engines": { - "node": ">=10" - } - }, - "node_modules/rollup-plugin-visualizer/node_modules/yargs": { - "version": "16.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "cliui": "^7.0.2", - "escalade": "^3.1.1", - "get-caller-file": "^2.0.5", - "require-directory": "^2.1.1", - "string-width": "^4.2.0", - "y18n": "^5.0.5", - "yargs-parser": "^20.2.2" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/rollup-pluginutils": { - "version": "2.8.2", - "dev": true, - "license": "MIT", - "dependencies": { - "estree-walker": "^0.6.1" - } - }, - "node_modules/rollup-pluginutils/node_modules/estree-walker": { - "version": "0.6.1", - "dev": true, - "license": "MIT" - }, - "node_modules/rollup-watch": { - "version": "4.3.1", - "dev": true, - "license": "MIT", - "dependencies": { - "chokidar": "^1.7.0", - "require-relative": "0.8.7", - "rollup-pluginutils": "^2.0.1" - } - }, - "node_modules/rollup-watch/node_modules/anymatch": { - "version": "1.3.2", - "dev": true, - "license": "ISC", - "dependencies": { - "micromatch": "^2.1.5", - "normalize-path": "^2.0.0" - } - }, - "node_modules/rollup-watch/node_modules/anymatch/node_modules/micromatch": { - "version": "2.3.11", - "dev": true, - "license": "MIT", - "dependencies": { - "arr-diff": "^2.0.0", - "array-unique": "^0.2.1", - "braces": "^1.8.2", - "expand-brackets": "^0.1.4", - "extglob": "^0.3.1", - "filename-regex": "^2.0.0", - "is-extglob": "^1.0.0", - "is-glob": "^2.0.1", - "kind-of": "^3.0.2", - "normalize-path": "^2.0.1", - "object.omit": "^2.0.0", - "parse-glob": "^3.0.4", - "regex-cache": "^0.4.2" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/rollup-watch/node_modules/arr-diff": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "arr-flatten": "^1.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/rollup-watch/node_modules/array-unique": { - "version": "0.2.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/rollup-watch/node_modules/binary-extensions": { - "version": "1.13.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/rollup-watch/node_modules/braces": { - "version": "1.8.5", - "dev": true, - "license": "MIT", - "dependencies": { - "expand-range": "^1.8.1", - "preserve": "^0.2.0", - "repeat-element": "^1.1.2" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/rollup-watch/node_modules/chokidar": { - "version": "1.7.0", - "dev": true, - "license": "MIT", - "dependencies": { - "anymatch": "^1.3.0", - "async-each": "^1.0.0", - "glob-parent": "^2.0.0", - "inherits": "^2.0.1", - "is-binary-path": "^1.0.0", - "is-glob": "^2.0.0", - "path-is-absolute": "^1.0.0", - "readdirp": "^2.0.0" - }, - "optionalDependencies": { - "fsevents": "^1.0.0" - } - }, - "node_modules/rollup-watch/node_modules/expand-brackets": { - "version": "0.1.5", - "dev": true, - "license": "MIT", - "dependencies": { - "is-posix-bracket": "^0.1.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/rollup-watch/node_modules/extglob": { - "version": "0.3.2", - "dev": true, - "license": "MIT", - "dependencies": { - "is-extglob": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/rollup-watch/node_modules/glob-parent": { - "version": "2.0.0", - "dev": true, - "license": "ISC", - "dependencies": { - "is-glob": "^2.0.0" - } - }, - "node_modules/rollup-watch/node_modules/is-binary-path": { - "version": "1.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "binary-extensions": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/rollup-watch/node_modules/is-extglob": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/rollup-watch/node_modules/is-glob": { - "version": "2.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "is-extglob": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/rollup-watch/node_modules/isarray": { - "version": "1.0.0", - "dev": true, - "license": "MIT" - }, - "node_modules/rollup-watch/node_modules/kind-of": { - "version": "3.2.2", - "dev": true, - "license": "MIT", - "dependencies": { - "is-buffer": "^1.1.5" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/rollup-watch/node_modules/readable-stream": { - "version": "2.3.7", - "dev": true, - "license": "MIT", - "dependencies": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "node_modules/rollup-watch/node_modules/readdirp": { - "version": "2.2.1", - "dev": true, - "license": "MIT", - "dependencies": { - "graceful-fs": "^4.1.11", - "micromatch": "^3.1.10", - "readable-stream": "^2.0.2" - }, - "engines": { - "node": ">=0.10" - } - }, - "node_modules/rollup-watch/node_modules/string_decoder": { - "version": "1.1.1", - "dev": true, - "license": "MIT", - "dependencies": { - "safe-buffer": "~5.1.0" - } - }, - "node_modules/rollup/node_modules/fsevents": { - "version": "2.3.2", - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" - } - }, - "node_modules/rsvp": { - "version": "4.8.5", - "dev": true, - "license": "MIT", - "engines": { - "node": "6.* || >= 7.*" - } - }, - "node_modules/run-async": { - "version": "2.4.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.12.0" - } - }, - "node_modules/run-parallel": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", - "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "dependencies": { - "queue-microtask": "^1.2.2" - } - }, - "node_modules/run-queue": { - "version": "1.0.3", - "dev": true, - "license": "ISC", - "dependencies": { - "aproba": "^1.1.1" - } - }, - "node_modules/run-queue/node_modules/aproba": { - "version": "1.2.0", - "dev": true, - "license": "ISC" - }, - "node_modules/rxjs": { - "version": "6.6.6", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "tslib": "^1.9.0" - }, - "engines": { - "npm": ">=2.0.0" - } - }, - "node_modules/safe-buffer": { - "version": "5.1.2", - "dev": true, - "license": "MIT" - }, - "node_modules/safe-regex": { - "version": "1.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "ret": "~0.1.10" - } - }, - "node_modules/safer-buffer": { - "version": "2.1.2", - "dev": true, - "license": "MIT" - }, - "node_modules/sane": { - "version": "4.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@cnakazawa/watch": "^1.0.3", - "anymatch": "^2.0.0", - "capture-exit": "^2.0.0", - "exec-sh": "^0.3.2", - "execa": "^1.0.0", - "fb-watchman": "^2.0.0", - "micromatch": "^3.1.4", - "minimist": "^1.1.1", - "walker": "~1.0.5" - }, - "bin": { - "sane": "src/cli.js" - }, - "engines": { - "node": "6.* || 8.* || >= 10.*" - } - }, - "node_modules/sane/node_modules/execa": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "cross-spawn": "^6.0.0", - "get-stream": "^4.0.0", - "is-stream": "^1.1.0", - "npm-run-path": "^2.0.0", - "p-finally": "^1.0.0", - "signal-exit": "^3.0.0", - "strip-eof": "^1.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/sane/node_modules/get-stream": { - "version": "4.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "pump": "^3.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/sane/node_modules/is-stream": { - "version": "1.1.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/sane/node_modules/npm-run-path": { - "version": "2.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "path-key": "^2.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/sax": { - "version": "1.2.4", - "dev": true, - "license": "ISC" - }, - "node_modules/selenium-server": { - "version": "3.141.59", - "dev": true, - "license": "BSD-3-Clause", - "bin": { - "selenium": "bin/selenium" - } - }, - "node_modules/semver": { - "version": "7.3.4", - "dev": true, - "license": "ISC", - "dependencies": { - "lru-cache": "^6.0.0" - }, - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/semver/node_modules/lru-cache": { - "version": "6.0.0", - "dev": true, - "license": "ISC", - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/semver/node_modules/yallist": { - "version": "4.0.0", - "dev": true, - "license": "ISC" - }, - "node_modules/serialize-javascript": { - "version": "4.0.0", - "dev": true, - "license": "BSD-3-Clause", - "dependencies": { - "randombytes": "^2.1.0" - } - }, - "node_modules/set-blocking": { - "version": "2.0.0", - "dev": true, - "license": "ISC" - }, - "node_modules/set-value": { - "version": "2.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "extend-shallow": "^2.0.1", - "is-extendable": "^0.1.1", - "is-plain-object": "^2.0.3", - "split-string": "^3.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/set-value/node_modules/extend-shallow": { - "version": "2.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "is-extendable": "^0.1.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/set-value/node_modules/is-extendable": { - "version": "0.1.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/set-value/node_modules/is-plain-object": { - "version": "2.0.4", - "dev": true, - "license": "MIT", - "dependencies": { - "isobject": "^3.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/shallow-clone": { - "version": "3.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "kind-of": "^6.0.2" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/shebang-command": { - "version": "1.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "shebang-regex": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/shebang-regex": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/shelljs": { - "version": "0.8.4", - "dev": true, - "license": "BSD-3-Clause", - "dependencies": { - "glob": "^7.0.0", - "interpret": "^1.0.0", - "rechoir": "^0.6.2" - }, - "bin": { - "shjs": "bin/shjs" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/shellwords": { - "version": "0.1.1", - "dev": true, - "license": "MIT" - }, - "node_modules/signal-exit": { - "version": "3.0.3", - "dev": true, - "license": "ISC" - }, - "node_modules/sinon": { - "version": "7.5.0", - "dev": true, - "license": "BSD-3-Clause", - "dependencies": { - "@sinonjs/commons": "^1.4.0", - "@sinonjs/formatio": "^3.2.1", - "@sinonjs/samsam": "^3.3.3", - "diff": "^3.5.0", - "lolex": "^4.2.0", - "nise": "^1.5.2", - "supports-color": "^5.5.0" - } - }, - "node_modules/sinon/node_modules/has-flag": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/sinon/node_modules/supports-color": { - "version": "5.5.0", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/sisteransi": { - "version": "1.0.5", - "dev": true, - "license": "MIT" - }, - "node_modules/slash": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/slice-ansi": { - "version": "2.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^3.2.0", - "astral-regex": "^1.0.0", - "is-fullwidth-code-point": "^2.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/slice-ansi/node_modules/ansi-styles": { - "version": "3.2.1", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/slice-ansi/node_modules/color-convert": { - "version": "1.9.3", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "1.1.3" - } - }, - "node_modules/slice-ansi/node_modules/color-name": { - "version": "1.1.3", - "dev": true, - "license": "MIT" - }, - "node_modules/slice-ansi/node_modules/is-fullwidth-code-point": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/slide": { - "version": "1.1.6", - "dev": true, - "license": "ISC", - "engines": { - "node": "*" - } - }, - "node_modules/smart-buffer": { - "version": "4.1.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 6.0.0", - "npm": ">= 3.0.0" - } - }, - "node_modules/snapdragon": { - "version": "0.8.2", - "dev": true, - "license": "MIT", - "dependencies": { - "base": "^0.11.1", - "debug": "^2.2.0", - "define-property": "^0.2.5", - "extend-shallow": "^2.0.1", - "map-cache": "^0.2.2", - "source-map": "^0.5.6", - "source-map-resolve": "^0.5.0", - "use": "^3.1.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/snapdragon-node": { - "version": "2.1.1", - "dev": true, - "license": "MIT", - "dependencies": { - "define-property": "^1.0.0", - "isobject": "^3.0.0", - "snapdragon-util": "^3.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/snapdragon-node/node_modules/define-property": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "is-descriptor": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/snapdragon-util": { - "version": "3.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "kind-of": "^3.2.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/snapdragon-util/node_modules/kind-of": { - "version": "3.2.2", - "dev": true, - "license": "MIT", - "dependencies": { - "is-buffer": "^1.1.5" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/snapdragon/node_modules/debug": { - "version": "2.6.9", - "dev": true, - "license": "MIT", - "dependencies": { - "ms": "2.0.0" - } - }, - "node_modules/snapdragon/node_modules/define-property": { - "version": "0.2.5", - "dev": true, - "license": "MIT", - "dependencies": { - "is-descriptor": "^0.1.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/snapdragon/node_modules/extend-shallow": { - "version": "2.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "is-extendable": "^0.1.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/snapdragon/node_modules/is-accessor-descriptor": { - "version": "0.1.6", - "dev": true, - "license": "MIT", - "dependencies": { - "kind-of": "^3.0.2" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/snapdragon/node_modules/is-accessor-descriptor/node_modules/kind-of": { - "version": "3.2.2", - "dev": true, - "license": "MIT", - "dependencies": { - "is-buffer": "^1.1.5" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/snapdragon/node_modules/is-data-descriptor": { - "version": "0.1.4", - "dev": true, - "license": "MIT", - "dependencies": { - "kind-of": "^3.0.2" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/snapdragon/node_modules/is-data-descriptor/node_modules/kind-of": { - "version": "3.2.2", - "dev": true, - "license": "MIT", - "dependencies": { - "is-buffer": "^1.1.5" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/snapdragon/node_modules/is-descriptor": { - "version": "0.1.6", - "dev": true, - "license": "MIT", - "dependencies": { - "is-accessor-descriptor": "^0.1.6", - "is-data-descriptor": "^0.1.4", - "kind-of": "^5.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/snapdragon/node_modules/is-extendable": { - "version": "0.1.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/snapdragon/node_modules/kind-of": { - "version": "5.1.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/snapdragon/node_modules/ms": { - "version": "2.0.0", - "dev": true, - "license": "MIT" - }, - "node_modules/snapdragon/node_modules/source-map": { - "version": "0.5.7", - "dev": true, - "license": "BSD-3-Clause", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/socks": { - "version": "2.3.3", - "dev": true, - "license": "MIT", - "dependencies": { - "ip": "1.1.5", - "smart-buffer": "^4.1.0" - }, - "engines": { - "node": ">= 6.0.0", - "npm": ">= 3.0.0" - } - }, - "node_modules/socks-proxy-agent": { - "version": "4.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "agent-base": "~4.2.1", - "socks": "~2.3.2" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/socks-proxy-agent/node_modules/agent-base": { - "version": "4.2.1", - "dev": true, - "license": "MIT", - "dependencies": { - "es6-promisify": "^5.0.0" - }, - "engines": { - "node": ">= 4.0.0" - } - }, - "node_modules/sort-keys": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "is-plain-obj": "^1.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/source-map": { - "version": "0.6.1", - "dev": true, - "license": "BSD-3-Clause", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/source-map-resolve": { - "version": "0.5.3", - "dev": true, - "license": "MIT", - "dependencies": { - "atob": "^2.1.2", - "decode-uri-component": "^0.2.0", - "resolve-url": "^0.2.1", - "source-map-url": "^0.4.0", - "urix": "^0.1.0" - } - }, - "node_modules/source-map-support": { - "version": "0.5.19", - "dev": true, - "license": "MIT", - "dependencies": { - "buffer-from": "^1.0.0", - "source-map": "^0.6.0" - } - }, - "node_modules/source-map-url": { - "version": "0.4.1", - "dev": true, - "license": "MIT" - }, - "node_modules/sourcemap-codec": { - "version": "1.4.8", - "dev": true, - "license": "MIT" - }, - "node_modules/spdx-correct": { - "version": "3.1.1", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "spdx-expression-parse": "^3.0.0", - "spdx-license-ids": "^3.0.0" - } - }, - "node_modules/spdx-exceptions": { - "version": "2.3.0", - "dev": true, - "license": "CC-BY-3.0" - }, - "node_modules/spdx-expression-parse": { - "version": "3.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "spdx-exceptions": "^2.1.0", - "spdx-license-ids": "^3.0.0" - } - }, - "node_modules/spdx-license-ids": { - "version": "3.0.7", - "dev": true, - "license": "CC0-1.0" - }, - "node_modules/split": { - "version": "1.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "through": "2" - }, - "engines": { - "node": "*" - } - }, - "node_modules/split-on-first": { - "version": "1.1.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/split-string": { - "version": "3.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "extend-shallow": "^3.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/split2": { - "version": "3.2.2", - "dev": true, - "license": "ISC", - "dependencies": { - "readable-stream": "^3.0.0" - } - }, - "node_modules/sprintf-js": { - "version": "1.0.3", - "dev": true, - "license": "BSD-3-Clause" - }, - "node_modules/sshpk": { - "version": "1.16.1", - "dev": true, - "license": "MIT", - "dependencies": { - "asn1": "~0.2.3", - "assert-plus": "^1.0.0", - "bcrypt-pbkdf": "^1.0.0", - "dashdash": "^1.12.0", - "ecc-jsbn": "~0.1.1", - "getpass": "^0.1.1", - "jsbn": "~0.1.0", - "safer-buffer": "^2.0.2", - "tweetnacl": "~0.14.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/ssri": { - "version": "6.0.1", - "dev": true, - "license": "ISC", - "dependencies": { - "figgy-pudding": "^3.5.1" - } - }, - "node_modules/stack-utils": { - "version": "1.0.4", - "dev": true, - "license": "MIT", - "dependencies": { - "escape-string-regexp": "^2.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/stack-utils/node_modules/escape-string-regexp": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/static-extend": { - "version": "0.1.2", - "dev": true, - "license": "MIT", - "dependencies": { - "define-property": "^0.2.5", - "object-copy": "^0.1.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/static-extend/node_modules/define-property": { - "version": "0.2.5", - "dev": true, - "license": "MIT", - "dependencies": { - "is-descriptor": "^0.1.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/static-extend/node_modules/is-accessor-descriptor": { - "version": "0.1.6", - "dev": true, - "license": "MIT", - "dependencies": { - "kind-of": "^3.0.2" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/static-extend/node_modules/is-accessor-descriptor/node_modules/kind-of": { - "version": "3.2.2", - "dev": true, - "license": "MIT", - "dependencies": { - "is-buffer": "^1.1.5" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/static-extend/node_modules/is-data-descriptor": { - "version": "0.1.4", - "dev": true, - "license": "MIT", - "dependencies": { - "kind-of": "^3.0.2" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/static-extend/node_modules/is-data-descriptor/node_modules/kind-of": { - "version": "3.2.2", - "dev": true, - "license": "MIT", - "dependencies": { - "is-buffer": "^1.1.5" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/static-extend/node_modules/is-descriptor": { - "version": "0.1.6", - "dev": true, - "license": "MIT", - "dependencies": { - "is-accessor-descriptor": "^0.1.6", - "is-data-descriptor": "^0.1.4", - "kind-of": "^5.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/static-extend/node_modules/kind-of": { - "version": "5.1.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/stealthy-require": { - "version": "1.1.1", - "dev": true, - "license": "ISC", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/stream-each": { - "version": "1.2.3", - "dev": true, - "license": "MIT", - "dependencies": { - "end-of-stream": "^1.1.0", - "stream-shift": "^1.0.0" - } - }, - "node_modules/stream-shift": { - "version": "1.0.1", - "dev": true, - "license": "MIT" - }, - "node_modules/strict-uri-encode": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/string_decoder": { - "version": "1.3.0", - "dev": true, - "license": "MIT", - "dependencies": { - "safe-buffer": "~5.2.0" - } - }, - "node_modules/string_decoder/node_modules/safe-buffer": { - "version": "5.2.1", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT" - }, - "node_modules/string-argv": { - "version": "0.3.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.6.19" - } - }, - "node_modules/string-length": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "astral-regex": "^1.0.0", - "strip-ansi": "^4.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/string-length/node_modules/ansi-regex": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/string-length/node_modules/strip-ansi": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-regex": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/string-width": { - "version": "4.2.2", - "dev": true, - "license": "MIT", - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/string-width/node_modules/ansi-regex": { - "version": "5.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/string-width/node_modules/strip-ansi": { - "version": "6.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-regex": "^5.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/string.prototype.trimend": { - "version": "1.0.4", - "dev": true, - "license": "MIT", - "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/string.prototype.trimstart": { - "version": "1.0.4", - "dev": true, - "license": "MIT", - "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/strip-ansi": { - "version": "5.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-regex": "^4.1.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/strip-bom": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/strip-eof": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/strip-final-newline": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/strip-indent": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "min-indent": "^1.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/strip-json-comments": { - "version": "3.1.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/strong-log-transformer": { - "version": "2.1.0", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "duplexer": "^0.1.1", - "minimist": "^1.2.0", - "through": "^2.3.4" - }, - "bin": { - "sl-log-transformer": "bin/sl-log-transformer.js" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/supports-color": { - "version": "7.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/symbol-tree": { - "version": "3.2.4", - "dev": true, - "license": "MIT" - }, - "node_modules/table": { - "version": "5.4.6", - "dev": true, - "license": "BSD-3-Clause", - "dependencies": { - "ajv": "^6.10.2", - "lodash": "^4.17.14", - "slice-ansi": "^2.1.0", - "string-width": "^3.0.0" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/table/node_modules/emoji-regex": { - "version": "7.0.3", - "dev": true, - "license": "MIT" - }, - "node_modules/table/node_modules/is-fullwidth-code-point": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/table/node_modules/string-width": { - "version": "3.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "emoji-regex": "^7.0.1", - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.1.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/tar": { - "version": "4.4.13", - "dev": true, - "license": "ISC", - "dependencies": { - "chownr": "^1.1.1", - "fs-minipass": "^1.2.5", - "minipass": "^2.8.6", - "minizlib": "^1.2.1", - "mkdirp": "^0.5.0", - "safe-buffer": "^5.1.2", - "yallist": "^3.0.3" - }, - "engines": { - "node": ">=4.5" - } - }, - "node_modules/temp-dir": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/temp-write": { - "version": "3.4.0", - "dev": true, - "license": "MIT", - "dependencies": { - "graceful-fs": "^4.1.2", - "is-stream": "^1.1.0", - "make-dir": "^1.0.0", - "pify": "^3.0.0", - "temp-dir": "^1.0.0", - "uuid": "^3.0.1" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/temp-write/node_modules/is-stream": { - "version": "1.1.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/temp-write/node_modules/make-dir": { - "version": "1.3.0", - "dev": true, - "license": "MIT", - "dependencies": { - "pify": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/temp-write/node_modules/pify": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/terser": { - "version": "4.8.0", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "commander": "^2.20.0", - "source-map": "~0.6.1", - "source-map-support": "~0.5.12" - }, - "bin": { - "terser": "bin/terser" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/test-exclude": { - "version": "5.2.3", - "dev": true, - "license": "ISC", - "dependencies": { - "glob": "^7.1.3", - "minimatch": "^3.0.4", - "read-pkg-up": "^4.0.0", - "require-main-filename": "^2.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/test-exclude/node_modules/read-pkg-up": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "find-up": "^3.0.0", - "read-pkg": "^3.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/text-extensions": { - "version": "1.9.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10" - } - }, - "node_modules/text-table": { - "version": "0.2.0", - "dev": true, - "license": "MIT" - }, - "node_modules/thenify": { - "version": "3.3.1", - "dev": true, - "license": "MIT", - "dependencies": { - "any-promise": "^1.0.0" - } - }, - "node_modules/thenify-all": { - "version": "1.6.0", - "dev": true, - "license": "MIT", - "dependencies": { - "thenify": ">= 3.1.0 < 4" - }, - "engines": { - "node": ">=0.8" - } - }, - "node_modules/throat": { - "version": "4.1.0", - "dev": true, - "license": "MIT" - }, - "node_modules/through": { - "version": "2.3.8", - "dev": true, - "license": "MIT" - }, - "node_modules/through2": { - "version": "3.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "inherits": "^2.0.4", - "readable-stream": "2 || 3" - } - }, - "node_modules/timsort": { - "version": "0.3.0", - "dev": true, - "license": "MIT" - }, - "node_modules/tmp": { - "version": "0.0.33", - "dev": true, - "license": "MIT", - "dependencies": { - "os-tmpdir": "~1.0.2" - }, - "engines": { - "node": ">=0.6.0" - } - }, - "node_modules/tmpl": { - "version": "1.0.4", - "dev": true, - "license": "BSD-3-Clause" - }, - "node_modules/to-fast-properties": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/to-object-path": { - "version": "0.3.0", - "dev": true, - "license": "MIT", - "dependencies": { - "kind-of": "^3.0.2" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/to-object-path/node_modules/kind-of": { - "version": "3.2.2", - "dev": true, - "license": "MIT", - "dependencies": { - "is-buffer": "^1.1.5" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/to-regex": { - "version": "3.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "define-property": "^2.0.2", - "extend-shallow": "^3.0.2", - "regex-not": "^1.0.2", - "safe-regex": "^1.1.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/to-regex-range": { - "version": "2.1.1", - "dev": true, - "license": "MIT", - "dependencies": { - "is-number": "^3.0.0", - "repeat-string": "^1.6.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/tough-cookie": { - "version": "2.5.0", - "dev": true, - "license": "BSD-3-Clause", - "dependencies": { - "psl": "^1.1.28", - "punycode": "^2.1.1" - }, - "engines": { - "node": ">=0.8" - } - }, - "node_modules/tr46": { - "version": "1.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "punycode": "^2.1.0" - } - }, - "node_modules/trim-newlines": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/trim-off-newlines": { - "version": "1.0.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/ts-jest": { - "version": "24.3.0", - "dev": true, - "license": "MIT", - "dependencies": { - "bs-logger": "0.x", - "buffer-from": "1.x", - "fast-json-stable-stringify": "2.x", - "json5": "2.x", - "lodash.memoize": "4.x", - "make-error": "1.x", - "mkdirp": "0.x", - "resolve": "1.x", - "semver": "^5.5", - "yargs-parser": "10.x" - }, - "bin": { - "ts-jest": "cli.js" - }, - "engines": { - "node": ">= 6" - }, - "peerDependencies": { - "jest": ">=24 <25" - } - }, - "node_modules/ts-jest/node_modules/camelcase": { - "version": "4.1.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/ts-jest/node_modules/semver": { - "version": "5.7.1", - "dev": true, - "license": "ISC", - "bin": { - "semver": "bin/semver" - } - }, - "node_modules/ts-jest/node_modules/yargs-parser": { - "version": "10.1.0", - "dev": true, - "license": "ISC", - "dependencies": { - "camelcase": "^4.1.0" - } - }, - "node_modules/tslib": { - "version": "1.14.1", - "dev": true, - "license": "0BSD" - }, - "node_modules/tsutils": { - "version": "3.21.0", - "dev": true, - "license": "MIT", - "dependencies": { - "tslib": "^1.8.1" - }, - "engines": { - "node": ">= 6" - }, - "peerDependencies": { - "typescript": ">=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta" - } - }, - "node_modules/tunnel-agent": { - "version": "0.6.0", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "safe-buffer": "^5.0.1" - }, - "engines": { - "node": "*" - } - }, - "node_modules/tweetnacl": { - "version": "0.14.5", - "dev": true, - "license": "Unlicense" - }, - "node_modules/type-check": { - "version": "0.3.2", - "dev": true, - "license": "MIT", - "dependencies": { - "prelude-ls": "~1.1.2" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/type-detect": { - "version": "4.0.8", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/type-fest": { - "version": "0.8.1", - "dev": true, - "license": "(MIT OR CC0-1.0)", - "engines": { - "node": ">=8" - } - }, - "node_modules/type-signals": { - "version": "1.1.0", - "license": "MIT" - }, - "node_modules/typedarray": { - "version": "0.0.6", - "dev": true, - "license": "MIT" - }, - "node_modules/typedoc": { - "version": "0.15.8", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "@types/minimatch": "3.0.3", - "fs-extra": "^8.1.0", - "handlebars": "^4.7.0", - "highlight.js": "^9.17.1", - "lodash": "^4.17.15", - "marked": "^0.8.0", - "minimatch": "^3.0.0", - "progress": "^2.0.3", - "shelljs": "^0.8.3", - "typedoc-default-themes": "^0.6.3", - "typescript": "3.7.x" - }, - "bin": { - "typedoc": "bin/typedoc" - }, - "engines": { - "node": ">= 6.0.0" - } - }, - "node_modules/typedoc-default-themes": { - "version": "0.6.3", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "backbone": "^1.4.0", - "jquery": "^3.4.1", - "lunr": "^2.3.8", - "underscore": "^1.9.1" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/typedoc/node_modules/fs-extra": { - "version": "8.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "graceful-fs": "^4.2.0", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - }, - "engines": { - "node": ">=6 <7 || >=8" - } - }, - "node_modules/typedoc/node_modules/jsonfile": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "optionalDependencies": { - "graceful-fs": "^4.1.6" - } - }, - "node_modules/typedoc/node_modules/typescript": { - "version": "3.7.7", - "dev": true, - "license": "Apache-2.0", - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=4.2.0" - } - }, - "node_modules/typedoc/node_modules/universalify": { - "version": "0.1.2", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 4.0.0" - } - }, - "node_modules/typescript": { - "version": "3.9.9", - "dev": true, - "license": "Apache-2.0", - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=4.2.0" - } - }, - "node_modules/uglify-js": { - "version": "3.13.1", - "dev": true, - "license": "BSD-2-Clause", - "optional": true, - "bin": { - "uglifyjs": "bin/uglifyjs" - }, - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/uid-number": { - "version": "0.0.6", - "dev": true, - "license": "ISC", - "engines": { - "node": "*" - } - }, - "node_modules/umask": { - "version": "1.1.0", - "dev": true, - "license": "MIT" - }, - "node_modules/unbox-primitive": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "function-bind": "^1.1.1", - "has-bigints": "^1.0.0", - "has-symbols": "^1.0.0", - "which-boxed-primitive": "^1.0.1" - } - }, - "node_modules/underscore": { - "version": "1.12.0", - "dev": true, - "license": "MIT" - }, - "node_modules/union": { - "version": "0.4.6", - "dev": true, - "dependencies": { - "qs": "~2.3.3" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/union-value": { - "version": "1.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "arr-union": "^3.1.0", - "get-value": "^2.0.6", - "is-extendable": "^0.1.1", - "set-value": "^2.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/union-value/node_modules/is-extendable": { - "version": "0.1.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/union/node_modules/qs": { - "version": "2.3.3", - "dev": true - }, - "node_modules/unique-filename": { - "version": "1.1.1", - "dev": true, - "license": "ISC", - "dependencies": { - "unique-slug": "^2.0.0" - } - }, - "node_modules/unique-slug": { - "version": "2.0.2", - "dev": true, - "license": "ISC", - "dependencies": { - "imurmurhash": "^0.1.4" - } - }, - "node_modules/universal-user-agent": { - "version": "4.0.1", - "dev": true, - "license": "ISC", - "dependencies": { - "os-name": "^3.1.0" - } - }, - "node_modules/universalify": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 10.0.0" - } - }, - "node_modules/unset-value": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "has-value": "^0.3.1", - "isobject": "^3.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/unset-value/node_modules/has-value": { - "version": "0.3.1", - "dev": true, - "license": "MIT", - "dependencies": { - "get-value": "^2.0.3", - "has-values": "^0.1.4", - "isobject": "^2.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/unset-value/node_modules/has-value/node_modules/isobject": { - "version": "2.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "isarray": "1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/unset-value/node_modules/has-values": { - "version": "0.1.4", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/unset-value/node_modules/isarray": { - "version": "1.0.0", - "dev": true, - "license": "MIT" - }, - "node_modules/upath": { - "version": "1.2.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4", - "yarn": "*" - } - }, - "node_modules/uri-js": { - "version": "4.4.1", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "punycode": "^2.1.0" - } - }, - "node_modules/urix": { - "version": "0.1.0", - "dev": true, - "license": "MIT" - }, - "node_modules/url-join": { - "version": "2.0.5", - "dev": true, - "license": "MIT" - }, - "node_modules/use": { - "version": "3.1.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/util-deprecate": { - "version": "1.0.2", - "dev": true, - "license": "MIT" - }, - "node_modules/util-promisify": { - "version": "2.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "object.getownpropertydescriptors": "^2.0.3" - } - }, - "node_modules/util.promisify": { - "version": "1.1.1", - "dev": true, - "license": "MIT", - "dependencies": { - "call-bind": "^1.0.0", - "define-properties": "^1.1.3", - "for-each": "^0.3.3", - "has-symbols": "^1.0.1", - "object.getownpropertydescriptors": "^2.1.1" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/uuid": { - "version": "3.4.0", - "dev": true, - "license": "MIT", - "bin": { - "uuid": "bin/uuid" - } - }, - "node_modules/v8-compile-cache": { - "version": "2.3.0", - "dev": true, - "license": "MIT" - }, - "node_modules/validate-npm-package-license": { - "version": "3.0.4", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "spdx-correct": "^3.0.0", - "spdx-expression-parse": "^3.0.0" - } - }, - "node_modules/validate-npm-package-name": { - "version": "3.0.0", - "dev": true, - "license": "ISC", - "dependencies": { - "builtins": "^1.0.3" - } - }, - "node_modules/validator": { - "version": "8.2.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/verror": { - "version": "1.10.0", - "dev": true, - "engines": [ - "node >=0.6.0" - ], - "license": "MIT", - "dependencies": { - "assert-plus": "^1.0.0", - "core-util-is": "1.0.2", - "extsprintf": "^1.2.0" - } - }, - "node_modules/w3c-hr-time": { - "version": "1.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "browser-process-hrtime": "^1.0.0" - } - }, - "node_modules/walker": { - "version": "1.0.7", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "makeerror": "1.0.x" - } - }, - "node_modules/wcwidth": { - "version": "1.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "defaults": "^1.0.3" - } - }, - "node_modules/webidl-conversions": { - "version": "4.0.2", - "dev": true, - "license": "BSD-2-Clause" - }, - "node_modules/whatwg-encoding": { - "version": "1.0.5", - "dev": true, - "license": "MIT", - "dependencies": { - "iconv-lite": "0.4.24" - } - }, - "node_modules/whatwg-mimetype": { - "version": "2.3.0", - "dev": true, - "license": "MIT" - }, - "node_modules/whatwg-url": { - "version": "6.5.0", - "dev": true, - "license": "MIT", - "dependencies": { - "lodash.sortby": "^4.7.0", - "tr46": "^1.0.1", - "webidl-conversions": "^4.0.2" - } - }, - "node_modules/which": { - "version": "1.3.1", - "dev": true, - "license": "ISC", - "dependencies": { - "isexe": "^2.0.0" - }, - "bin": { - "which": "bin/which" - } - }, - "node_modules/which-boxed-primitive": { - "version": "1.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "is-bigint": "^1.0.1", - "is-boolean-object": "^1.1.0", - "is-number-object": "^1.0.4", - "is-string": "^1.0.5", - "is-symbol": "^1.0.3" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/which-module": { - "version": "2.0.0", - "dev": true, - "license": "ISC" - }, - "node_modules/wide-align": { - "version": "1.1.3", - "dev": true, - "license": "ISC", - "dependencies": { - "string-width": "^1.0.2 || 2" - } - }, - "node_modules/wide-align/node_modules/ansi-regex": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/wide-align/node_modules/is-fullwidth-code-point": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/wide-align/node_modules/string-width": { - "version": "2.1.1", - "dev": true, - "license": "MIT", - "dependencies": { - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^4.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/wide-align/node_modules/strip-ansi": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-regex": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/windows-release": { - "version": "3.3.3", - "dev": true, - "license": "MIT", - "dependencies": { - "execa": "^1.0.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/windows-release/node_modules/execa": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "cross-spawn": "^6.0.0", - "get-stream": "^4.0.0", - "is-stream": "^1.1.0", - "npm-run-path": "^2.0.0", - "p-finally": "^1.0.0", - "signal-exit": "^3.0.0", - "strip-eof": "^1.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/windows-release/node_modules/get-stream": { - "version": "4.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "pump": "^3.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/windows-release/node_modules/is-stream": { - "version": "1.1.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/windows-release/node_modules/npm-run-path": { - "version": "2.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "path-key": "^2.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/word-wrap": { - "version": "1.2.3", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/wordwrap": { - "version": "1.0.0", - "dev": true, - "license": "MIT" - }, - "node_modules/wrap-ansi": { - "version": "5.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^3.2.0", - "string-width": "^3.0.0", - "strip-ansi": "^5.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/wrap-ansi/node_modules/ansi-styles": { - "version": "3.2.1", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/wrap-ansi/node_modules/color-convert": { - "version": "1.9.3", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "1.1.3" - } - }, - "node_modules/wrap-ansi/node_modules/color-name": { - "version": "1.1.3", - "dev": true, - "license": "MIT" - }, - "node_modules/wrap-ansi/node_modules/emoji-regex": { - "version": "7.0.3", - "dev": true, - "license": "MIT" - }, - "node_modules/wrap-ansi/node_modules/is-fullwidth-code-point": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/wrap-ansi/node_modules/string-width": { - "version": "3.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "emoji-regex": "^7.0.1", - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.1.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/wrappy": { - "version": "1.0.2", - "dev": true, - "license": "ISC" - }, - "node_modules/write": { - "version": "1.0.3", - "dev": true, - "license": "MIT", - "dependencies": { - "mkdirp": "^0.5.1" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/write-file-atomic": { - "version": "2.4.1", - "dev": true, - "license": "ISC", - "dependencies": { - "graceful-fs": "^4.1.11", - "imurmurhash": "^0.1.4", - "signal-exit": "^3.0.2" - } - }, - "node_modules/write-json-file": { - "version": "3.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "detect-indent": "^5.0.0", - "graceful-fs": "^4.1.15", - "make-dir": "^2.1.0", - "pify": "^4.0.1", - "sort-keys": "^2.0.0", - "write-file-atomic": "^2.4.2" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/write-json-file/node_modules/write-file-atomic": { - "version": "2.4.3", - "dev": true, - "license": "ISC", - "dependencies": { - "graceful-fs": "^4.1.11", - "imurmurhash": "^0.1.4", - "signal-exit": "^3.0.2" - } - }, - "node_modules/write-pkg": { - "version": "3.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "sort-keys": "^2.0.0", - "write-json-file": "^2.2.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/write-pkg/node_modules/make-dir": { - "version": "1.3.0", - "dev": true, - "license": "MIT", - "dependencies": { - "pify": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/write-pkg/node_modules/pify": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/write-pkg/node_modules/write-json-file": { - "version": "2.3.0", - "dev": true, - "license": "MIT", - "dependencies": { - "detect-indent": "^5.0.0", - "graceful-fs": "^4.1.2", - "make-dir": "^1.0.0", - "pify": "^3.0.0", - "sort-keys": "^2.0.0", - "write-file-atomic": "^2.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/ws": { - "version": "5.2.2", - "dev": true, - "license": "MIT", - "dependencies": { - "async-limiter": "~1.0.0" - } - }, - "node_modules/xml-name-validator": { - "version": "3.0.0", - "dev": true, - "license": "Apache-2.0" - }, - "node_modules/y18n": { - "version": "4.0.1", - "dev": true, - "license": "ISC" - }, - "node_modules/yallist": { - "version": "3.1.1", - "dev": true, - "license": "ISC" - }, - "node_modules/yargs": { - "version": "13.3.2", - "dev": true, - "license": "MIT", - "dependencies": { - "cliui": "^5.0.0", - "find-up": "^3.0.0", - "get-caller-file": "^2.0.1", - "require-directory": "^2.1.1", - "require-main-filename": "^2.0.0", - "set-blocking": "^2.0.0", - "string-width": "^3.0.0", - "which-module": "^2.0.0", - "y18n": "^4.0.0", - "yargs-parser": "^13.1.2" - } - }, - "node_modules/yargs-parser": { - "version": "20.2.7", - "dev": true, - "license": "ISC", - "engines": { - "node": ">=10" - } - }, - "node_modules/yargs/node_modules/emoji-regex": { - "version": "7.0.3", - "dev": true, - "license": "MIT" - }, - "node_modules/yargs/node_modules/is-fullwidth-code-point": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/yargs/node_modules/string-width": { - "version": "3.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "emoji-regex": "^7.0.1", - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.1.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/yargs/node_modules/yargs-parser": { - "version": "13.1.2", - "dev": true, - "license": "ISC", - "dependencies": { - "camelcase": "^5.0.0", - "decamelize": "^1.2.0" - } - }, - "node_modules/z-schema": { - "version": "3.18.4", - "dev": true, - "license": "MIT", - "dependencies": { - "lodash.get": "^4.0.0", - "lodash.isequal": "^4.0.0", - "validator": "^8.0.0" - }, - "bin": { - "z-schema": "bin/z-schema" - }, - "optionalDependencies": { - "commander": "^2.7.1" - } - }, - "node_modules/zlib": { - "version": "1.0.5", - "dev": true, - "engines": { - "node": ">=0.2.0" - } - } - }, - "dependencies": { - "@babel/code-frame": { - "version": "7.12.13", - "dev": true, - "requires": { - "@babel/highlight": "^7.12.13" - } - }, - "@babel/compat-data": { - "version": "7.13.8", - "dev": true - }, - "@babel/core": { - "version": "7.13.10", - "dev": true, - "requires": { - "@babel/code-frame": "^7.12.13", - "@babel/generator": "^7.13.9", - "@babel/helper-compilation-targets": "^7.13.10", - "@babel/helper-module-transforms": "^7.13.0", - "@babel/helpers": "^7.13.10", - "@babel/parser": "^7.13.10", - "@babel/template": "^7.12.13", - "@babel/traverse": "^7.13.0", - "@babel/types": "^7.13.0", - "convert-source-map": "^1.7.0", - "debug": "^4.1.0", - "gensync": "^1.0.0-beta.2", - "json5": "^2.1.2", - "lodash": "^4.17.19", - "semver": "^6.3.0", - "source-map": "^0.5.0" - }, - "dependencies": { - "semver": { - "version": "6.3.0", - "dev": true - }, - "source-map": { - "version": "0.5.7", - "dev": true - } - } - }, - "@babel/generator": { - "version": "7.13.9", - "dev": true, - "requires": { - "@babel/types": "^7.13.0", - "jsesc": "^2.5.1", - "source-map": "^0.5.0" - }, - "dependencies": { - "source-map": { - "version": "0.5.7", - "dev": true - } - } - }, - "@babel/helper-compilation-targets": { - "version": "7.13.10", - "dev": true, - "requires": { - "@babel/compat-data": "^7.13.8", - "@babel/helper-validator-option": "^7.12.17", - "browserslist": "^4.14.5", - "semver": "^6.3.0" - }, - "dependencies": { - "semver": { - "version": "6.3.0", - "dev": true - } - } - }, - "@babel/helper-function-name": { - "version": "7.12.13", - "dev": true, - "requires": { - "@babel/helper-get-function-arity": "^7.12.13", - "@babel/template": "^7.12.13", - "@babel/types": "^7.12.13" - } - }, - "@babel/helper-get-function-arity": { - "version": "7.12.13", - "dev": true, - "requires": { - "@babel/types": "^7.12.13" - } - }, - "@babel/helper-member-expression-to-functions": { - "version": "7.13.0", - "dev": true, - "requires": { - "@babel/types": "^7.13.0" - } - }, - "@babel/helper-module-imports": { - "version": "7.12.13", - "dev": true, - "requires": { - "@babel/types": "^7.12.13" - } - }, - "@babel/helper-module-transforms": { - "version": "7.13.0", - "dev": true, - "requires": { - "@babel/helper-module-imports": "^7.12.13", - "@babel/helper-replace-supers": "^7.13.0", - "@babel/helper-simple-access": "^7.12.13", - "@babel/helper-split-export-declaration": "^7.12.13", - "@babel/helper-validator-identifier": "^7.12.11", - "@babel/template": "^7.12.13", - "@babel/traverse": "^7.13.0", - "@babel/types": "^7.13.0", - "lodash": "^4.17.19" - } - }, - "@babel/helper-optimise-call-expression": { - "version": "7.12.13", - "dev": true, - "requires": { - "@babel/types": "^7.12.13" - } - }, - "@babel/helper-plugin-utils": { - "version": "7.13.0", - "dev": true - }, - "@babel/helper-replace-supers": { - "version": "7.13.0", - "dev": true, - "requires": { - "@babel/helper-member-expression-to-functions": "^7.13.0", - "@babel/helper-optimise-call-expression": "^7.12.13", - "@babel/traverse": "^7.13.0", - "@babel/types": "^7.13.0" - } - }, - "@babel/helper-simple-access": { - "version": "7.12.13", - "dev": true, - "requires": { - "@babel/types": "^7.12.13" - } - }, - "@babel/helper-split-export-declaration": { - "version": "7.12.13", - "dev": true, - "requires": { - "@babel/types": "^7.12.13" - } - }, - "@babel/helper-validator-identifier": { - "version": "7.12.11", - "dev": true - }, - "@babel/helper-validator-option": { - "version": "7.12.17", - "dev": true - }, - "@babel/helpers": { - "version": "7.13.10", - "dev": true, - "requires": { - "@babel/template": "^7.12.13", - "@babel/traverse": "^7.13.0", - "@babel/types": "^7.13.0" - } - }, - "@babel/highlight": { - "version": "7.13.10", - "dev": true, - "requires": { - "@babel/helper-validator-identifier": "^7.12.11", - "chalk": "^2.0.0", - "js-tokens": "^4.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "3.2.1", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "chalk": { - "version": "2.4.2", - "dev": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "color-convert": { - "version": "1.9.3", - "dev": true, - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "dev": true - }, - "has-flag": { - "version": "3.0.0", - "dev": true - }, - "supports-color": { - "version": "5.5.0", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - } - } - }, - "@babel/parser": { - "version": "7.13.10", - "dev": true - }, - "@babel/plugin-syntax-object-rest-spread": { - "version": "7.8.3", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.8.0" - } - }, - "@babel/template": { - "version": "7.12.13", - "dev": true, - "requires": { - "@babel/code-frame": "^7.12.13", - "@babel/parser": "^7.12.13", - "@babel/types": "^7.12.13" - } - }, - "@babel/traverse": { - "version": "7.13.0", - "dev": true, - "requires": { - "@babel/code-frame": "^7.12.13", - "@babel/generator": "^7.13.0", - "@babel/helper-function-name": "^7.12.13", - "@babel/helper-split-export-declaration": "^7.12.13", - "@babel/parser": "^7.13.0", - "@babel/types": "^7.13.0", - "debug": "^4.1.0", - "globals": "^11.1.0", - "lodash": "^4.17.19" - }, - "dependencies": { - "globals": { - "version": "11.12.0", - "dev": true - } - } - }, - "@babel/types": { - "version": "7.13.0", - "dev": true, - "requires": { - "@babel/helper-validator-identifier": "^7.12.11", - "lodash": "^4.17.19", - "to-fast-properties": "^2.0.0" - } - }, - "@cnakazawa/watch": { - "version": "1.0.4", - "dev": true, - "requires": { - "exec-sh": "^0.3.2", - "minimist": "^1.2.0" - } - }, - "@evocateur/libnpmaccess": { - "version": "3.1.2", - "dev": true, - "requires": { - "@evocateur/npm-registry-fetch": "^4.0.0", - "aproba": "^2.0.0", - "figgy-pudding": "^3.5.1", - "get-stream": "^4.0.0", - "npm-package-arg": "^6.1.0" - }, - "dependencies": { - "get-stream": { - "version": "4.1.0", - "dev": true, - "requires": { - "pump": "^3.0.0" - } - } - } - }, - "@evocateur/libnpmpublish": { - "version": "1.2.2", - "dev": true, - "requires": { - "@evocateur/npm-registry-fetch": "^4.0.0", - "aproba": "^2.0.0", - "figgy-pudding": "^3.5.1", - "get-stream": "^4.0.0", - "lodash.clonedeep": "^4.5.0", - "normalize-package-data": "^2.4.0", - "npm-package-arg": "^6.1.0", - "semver": "^5.5.1", - "ssri": "^6.0.1" - }, - "dependencies": { - "get-stream": { - "version": "4.1.0", - "dev": true, - "requires": { - "pump": "^3.0.0" - } - }, - "semver": { - "version": "5.7.1", - "dev": true - } - } - }, - "@evocateur/npm-registry-fetch": { - "version": "4.0.0", - "dev": true, - "requires": { - "bluebird": "^3.5.1", - "figgy-pudding": "^3.4.1", - "JSONStream": "^1.3.4", - "lru-cache": "^5.1.1", - "make-fetch-happen": "^5.0.0", - "npm-package-arg": "^6.1.0", - "safe-buffer": "^5.1.2" - } - }, - "@evocateur/pacote": { - "version": "9.6.5", - "dev": true, - "requires": { - "@evocateur/npm-registry-fetch": "^4.0.0", - "bluebird": "^3.5.3", - "cacache": "^12.0.3", - "chownr": "^1.1.2", - "figgy-pudding": "^3.5.1", - "get-stream": "^4.1.0", - "glob": "^7.1.4", - "infer-owner": "^1.0.4", - "lru-cache": "^5.1.1", - "make-fetch-happen": "^5.0.0", - "minimatch": "^3.0.4", - "minipass": "^2.3.5", - "mississippi": "^3.0.0", - "mkdirp": "^0.5.1", - "normalize-package-data": "^2.5.0", - "npm-package-arg": "^6.1.0", - "npm-packlist": "^1.4.4", - "npm-pick-manifest": "^3.0.0", - "osenv": "^0.1.5", - "promise-inflight": "^1.0.1", - "promise-retry": "^1.1.1", - "protoduck": "^5.0.1", - "rimraf": "^2.6.3", - "safe-buffer": "^5.2.0", - "semver": "^5.7.0", - "ssri": "^6.0.1", - "tar": "^4.4.10", - "unique-filename": "^1.1.1", - "which": "^1.3.1" - }, - "dependencies": { - "get-stream": { - "version": "4.1.0", - "dev": true, - "requires": { - "pump": "^3.0.0" - } - }, - "safe-buffer": { - "version": "5.2.1", - "dev": true - }, - "semver": { - "version": "5.7.1", - "dev": true - } - } - }, - "@jest/console": { - "version": "24.9.0", - "dev": true, - "requires": { - "@jest/source-map": "^24.9.0", - "chalk": "^2.0.1", - "slash": "^2.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "3.2.1", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "chalk": { - "version": "2.4.2", - "dev": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "color-convert": { - "version": "1.9.3", - "dev": true, - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "dev": true - }, - "has-flag": { - "version": "3.0.0", - "dev": true - }, - "slash": { - "version": "2.0.0", - "dev": true - }, - "supports-color": { - "version": "5.5.0", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - } - } - }, - "@jest/core": { - "version": "24.9.0", - "dev": true, - "requires": { - "@jest/console": "^24.7.1", - "@jest/reporters": "^24.9.0", - "@jest/test-result": "^24.9.0", - "@jest/transform": "^24.9.0", - "@jest/types": "^24.9.0", - "ansi-escapes": "^3.0.0", - "chalk": "^2.0.1", - "exit": "^0.1.2", - "graceful-fs": "^4.1.15", - "jest-changed-files": "^24.9.0", - "jest-config": "^24.9.0", - "jest-haste-map": "^24.9.0", - "jest-message-util": "^24.9.0", - "jest-regex-util": "^24.3.0", - "jest-resolve": "^24.9.0", - "jest-resolve-dependencies": "^24.9.0", - "jest-runner": "^24.9.0", - "jest-runtime": "^24.9.0", - "jest-snapshot": "^24.9.0", - "jest-util": "^24.9.0", - "jest-validate": "^24.9.0", - "jest-watcher": "^24.9.0", - "micromatch": "^3.1.10", - "p-each-series": "^1.0.0", - "realpath-native": "^1.1.0", - "rimraf": "^2.5.4", - "slash": "^2.0.0", - "strip-ansi": "^5.0.0" - }, - "dependencies": { - "ansi-escapes": { - "version": "3.2.0", - "dev": true - }, - "ansi-styles": { - "version": "3.2.1", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "chalk": { - "version": "2.4.2", - "dev": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "color-convert": { - "version": "1.9.3", - "dev": true, - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "dev": true - }, - "has-flag": { - "version": "3.0.0", - "dev": true - }, - "slash": { - "version": "2.0.0", - "dev": true - }, - "supports-color": { - "version": "5.5.0", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - } - } - }, - "@jest/environment": { - "version": "24.9.0", - "dev": true, - "requires": { - "@jest/fake-timers": "^24.9.0", - "@jest/transform": "^24.9.0", - "@jest/types": "^24.9.0", - "jest-mock": "^24.9.0" - } - }, - "@jest/fake-timers": { - "version": "24.9.0", - "dev": true, - "requires": { - "@jest/types": "^24.9.0", - "jest-message-util": "^24.9.0", - "jest-mock": "^24.9.0" - } - }, - "@jest/reporters": { - "version": "24.9.0", - "dev": true, - "requires": { - "@jest/environment": "^24.9.0", - "@jest/test-result": "^24.9.0", - "@jest/transform": "^24.9.0", - "@jest/types": "^24.9.0", - "chalk": "^2.0.1", - "exit": "^0.1.2", - "glob": "^7.1.2", - "istanbul-lib-coverage": "^2.0.2", - "istanbul-lib-instrument": "^3.0.1", - "istanbul-lib-report": "^2.0.4", - "istanbul-lib-source-maps": "^3.0.1", - "istanbul-reports": "^2.2.6", - "jest-haste-map": "^24.9.0", - "jest-resolve": "^24.9.0", - "jest-runtime": "^24.9.0", - "jest-util": "^24.9.0", - "jest-worker": "^24.6.0", - "node-notifier": "^5.4.2", - "slash": "^2.0.0", - "source-map": "^0.6.0", - "string-length": "^2.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "3.2.1", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "chalk": { - "version": "2.4.2", - "dev": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "color-convert": { - "version": "1.9.3", - "dev": true, - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "dev": true - }, - "has-flag": { - "version": "3.0.0", - "dev": true - }, - "slash": { - "version": "2.0.0", - "dev": true - }, - "supports-color": { - "version": "5.5.0", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - } - } - }, - "@jest/source-map": { - "version": "24.9.0", - "dev": true, - "requires": { - "callsites": "^3.0.0", - "graceful-fs": "^4.1.15", - "source-map": "^0.6.0" - } - }, - "@jest/test-result": { - "version": "24.9.0", - "dev": true, - "requires": { - "@jest/console": "^24.9.0", - "@jest/types": "^24.9.0", - "@types/istanbul-lib-coverage": "^2.0.0" - } - }, - "@jest/test-sequencer": { - "version": "24.9.0", - "dev": true, - "requires": { - "@jest/test-result": "^24.9.0", - "jest-haste-map": "^24.9.0", - "jest-runner": "^24.9.0", - "jest-runtime": "^24.9.0" - } - }, - "@jest/transform": { - "version": "24.9.0", - "dev": true, - "requires": { - "@babel/core": "^7.1.0", - "@jest/types": "^24.9.0", - "babel-plugin-istanbul": "^5.1.0", - "chalk": "^2.0.1", - "convert-source-map": "^1.4.0", - "fast-json-stable-stringify": "^2.0.0", - "graceful-fs": "^4.1.15", - "jest-haste-map": "^24.9.0", - "jest-regex-util": "^24.9.0", - "jest-util": "^24.9.0", - "micromatch": "^3.1.10", - "pirates": "^4.0.1", - "realpath-native": "^1.1.0", - "slash": "^2.0.0", - "source-map": "^0.6.1", - "write-file-atomic": "2.4.1" - }, - "dependencies": { - "ansi-styles": { - "version": "3.2.1", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "chalk": { - "version": "2.4.2", - "dev": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "color-convert": { - "version": "1.9.3", - "dev": true, - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "dev": true - }, - "has-flag": { - "version": "3.0.0", - "dev": true - }, - "slash": { - "version": "2.0.0", - "dev": true - }, - "supports-color": { - "version": "5.5.0", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - } - } - }, - "@jest/types": { - "version": "24.9.0", - "dev": true, - "requires": { - "@types/istanbul-lib-coverage": "^2.0.0", - "@types/istanbul-reports": "^1.1.1", - "@types/yargs": "^13.0.0" - } - }, - "@lerna/add": { - "version": "3.21.0", - "dev": true, - "requires": { - "@evocateur/pacote": "^9.6.3", - "@lerna/bootstrap": "3.21.0", - "@lerna/command": "3.21.0", - "@lerna/filter-options": "3.20.0", - "@lerna/npm-conf": "3.16.0", - "@lerna/validation-error": "3.13.0", - "dedent": "^0.7.0", - "npm-package-arg": "^6.1.0", - "p-map": "^2.1.0", - "semver": "^6.2.0" - }, - "dependencies": { - "semver": { - "version": "6.3.0", - "dev": true - } - } - }, - "@lerna/bootstrap": { - "version": "3.21.0", - "dev": true, - "requires": { - "@lerna/command": "3.21.0", - "@lerna/filter-options": "3.20.0", - "@lerna/has-npm-version": "3.16.5", - "@lerna/npm-install": "3.16.5", - "@lerna/package-graph": "3.18.5", - "@lerna/pulse-till-done": "3.13.0", - "@lerna/rimraf-dir": "3.16.5", - "@lerna/run-lifecycle": "3.16.2", - "@lerna/run-topologically": "3.18.5", - "@lerna/symlink-binary": "3.17.0", - "@lerna/symlink-dependencies": "3.17.0", - "@lerna/validation-error": "3.13.0", - "dedent": "^0.7.0", - "get-port": "^4.2.0", - "multimatch": "^3.0.0", - "npm-package-arg": "^6.1.0", - "npmlog": "^4.1.2", - "p-finally": "^1.0.0", - "p-map": "^2.1.0", - "p-map-series": "^1.0.0", - "p-waterfall": "^1.0.0", - "read-package-tree": "^5.1.6", - "semver": "^6.2.0" - }, - "dependencies": { - "semver": { - "version": "6.3.0", - "dev": true - } - } - }, - "@lerna/changed": { - "version": "3.21.0", - "dev": true, - "requires": { - "@lerna/collect-updates": "3.20.0", - "@lerna/command": "3.21.0", - "@lerna/listable": "3.18.5", - "@lerna/output": "3.13.0" - } - }, - "@lerna/check-working-tree": { - "version": "3.16.5", - "dev": true, - "requires": { - "@lerna/collect-uncommitted": "3.16.5", - "@lerna/describe-ref": "3.16.5", - "@lerna/validation-error": "3.13.0" - } - }, - "@lerna/child-process": { - "version": "3.16.5", - "dev": true, - "requires": { - "chalk": "^2.3.1", - "execa": "^1.0.0", - "strong-log-transformer": "^2.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "3.2.1", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "chalk": { - "version": "2.4.2", - "dev": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "color-convert": { - "version": "1.9.3", - "dev": true, - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "dev": true - }, - "execa": { - "version": "1.0.0", - "dev": true, - "requires": { - "cross-spawn": "^6.0.0", - "get-stream": "^4.0.0", - "is-stream": "^1.1.0", - "npm-run-path": "^2.0.0", - "p-finally": "^1.0.0", - "signal-exit": "^3.0.0", - "strip-eof": "^1.0.0" - } - }, - "get-stream": { - "version": "4.1.0", - "dev": true, - "requires": { - "pump": "^3.0.0" - } - }, - "has-flag": { - "version": "3.0.0", - "dev": true - }, - "is-stream": { - "version": "1.1.0", - "dev": true - }, - "npm-run-path": { - "version": "2.0.2", - "dev": true, - "requires": { - "path-key": "^2.0.0" - } - }, - "supports-color": { - "version": "5.5.0", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - } - } - }, - "@lerna/clean": { - "version": "3.21.0", - "dev": true, - "requires": { - "@lerna/command": "3.21.0", - "@lerna/filter-options": "3.20.0", - "@lerna/prompt": "3.18.5", - "@lerna/pulse-till-done": "3.13.0", - "@lerna/rimraf-dir": "3.16.5", - "p-map": "^2.1.0", - "p-map-series": "^1.0.0", - "p-waterfall": "^1.0.0" - } - }, - "@lerna/cli": { - "version": "3.18.5", - "dev": true, - "requires": { - "@lerna/global-options": "3.13.0", - "dedent": "^0.7.0", - "npmlog": "^4.1.2", - "yargs": "^14.2.2" - }, - "dependencies": { - "emoji-regex": { - "version": "7.0.3", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "dev": true - }, - "string-width": { - "version": "3.1.0", - "dev": true, - "requires": { - "emoji-regex": "^7.0.1", - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.1.0" - } - }, - "yargs": { - "version": "14.2.3", - "dev": true, - "requires": { - "cliui": "^5.0.0", - "decamelize": "^1.2.0", - "find-up": "^3.0.0", - "get-caller-file": "^2.0.1", - "require-directory": "^2.1.1", - "require-main-filename": "^2.0.0", - "set-blocking": "^2.0.0", - "string-width": "^3.0.0", - "which-module": "^2.0.0", - "y18n": "^4.0.0", - "yargs-parser": "^15.0.1" - } - }, - "yargs-parser": { - "version": "15.0.1", - "dev": true, - "requires": { - "camelcase": "^5.0.0", - "decamelize": "^1.2.0" - } - } - } - }, - "@lerna/collect-uncommitted": { - "version": "3.16.5", - "dev": true, - "requires": { - "@lerna/child-process": "3.16.5", - "chalk": "^2.3.1", - "figgy-pudding": "^3.5.1", - "npmlog": "^4.1.2" - }, - "dependencies": { - "ansi-styles": { - "version": "3.2.1", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "chalk": { - "version": "2.4.2", - "dev": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "color-convert": { - "version": "1.9.3", - "dev": true, - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "dev": true - }, - "has-flag": { - "version": "3.0.0", - "dev": true - }, - "supports-color": { - "version": "5.5.0", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - } - } - }, - "@lerna/collect-updates": { - "version": "3.20.0", - "dev": true, - "requires": { - "@lerna/child-process": "3.16.5", - "@lerna/describe-ref": "3.16.5", - "minimatch": "^3.0.4", - "npmlog": "^4.1.2", - "slash": "^2.0.0" - }, - "dependencies": { - "slash": { - "version": "2.0.0", - "dev": true - } - } - }, - "@lerna/command": { - "version": "3.21.0", - "dev": true, - "requires": { - "@lerna/child-process": "3.16.5", - "@lerna/package-graph": "3.18.5", - "@lerna/project": "3.21.0", - "@lerna/validation-error": "3.13.0", - "@lerna/write-log-file": "3.13.0", - "clone-deep": "^4.0.1", - "dedent": "^0.7.0", - "execa": "^1.0.0", - "is-ci": "^2.0.0", - "npmlog": "^4.1.2" - }, - "dependencies": { - "execa": { - "version": "1.0.0", - "dev": true, - "requires": { - "cross-spawn": "^6.0.0", - "get-stream": "^4.0.0", - "is-stream": "^1.1.0", - "npm-run-path": "^2.0.0", - "p-finally": "^1.0.0", - "signal-exit": "^3.0.0", - "strip-eof": "^1.0.0" - } - }, - "get-stream": { - "version": "4.1.0", - "dev": true, - "requires": { - "pump": "^3.0.0" - } - }, - "is-stream": { - "version": "1.1.0", - "dev": true - }, - "npm-run-path": { - "version": "2.0.2", - "dev": true, - "requires": { - "path-key": "^2.0.0" - } - } - } - }, - "@lerna/conventional-commits": { - "version": "3.22.0", - "dev": true, - "requires": { - "@lerna/validation-error": "3.13.0", - "conventional-changelog-angular": "^5.0.3", - "conventional-changelog-core": "^3.1.6", - "conventional-recommended-bump": "^5.0.0", - "fs-extra": "^8.1.0", - "get-stream": "^4.0.0", - "lodash.template": "^4.5.0", - "npm-package-arg": "^6.1.0", - "npmlog": "^4.1.2", - "pify": "^4.0.1", - "semver": "^6.2.0" - }, - "dependencies": { - "fs-extra": { - "version": "8.1.0", - "dev": true, - "requires": { - "graceful-fs": "^4.2.0", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - } - }, - "get-stream": { - "version": "4.1.0", - "dev": true, - "requires": { - "pump": "^3.0.0" - } - }, - "jsonfile": { - "version": "4.0.0", - "dev": true, - "requires": { - "graceful-fs": "^4.1.6" - } - }, - "semver": { - "version": "6.3.0", - "dev": true - }, - "universalify": { - "version": "0.1.2", - "dev": true - } - } - }, - "@lerna/create": { - "version": "3.22.0", - "dev": true, - "requires": { - "@evocateur/pacote": "^9.6.3", - "@lerna/child-process": "3.16.5", - "@lerna/command": "3.21.0", - "@lerna/npm-conf": "3.16.0", - "@lerna/validation-error": "3.13.0", - "camelcase": "^5.0.0", - "dedent": "^0.7.0", - "fs-extra": "^8.1.0", - "globby": "^9.2.0", - "init-package-json": "^1.10.3", - "npm-package-arg": "^6.1.0", - "p-reduce": "^1.0.0", - "pify": "^4.0.1", - "semver": "^6.2.0", - "slash": "^2.0.0", - "validate-npm-package-license": "^3.0.3", - "validate-npm-package-name": "^3.0.0", - "whatwg-url": "^7.0.0" - }, - "dependencies": { - "fs-extra": { - "version": "8.1.0", - "dev": true, - "requires": { - "graceful-fs": "^4.2.0", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - } - }, - "jsonfile": { - "version": "4.0.0", - "dev": true, - "requires": { - "graceful-fs": "^4.1.6" - } - }, - "semver": { - "version": "6.3.0", - "dev": true - }, - "slash": { - "version": "2.0.0", - "dev": true - }, - "universalify": { - "version": "0.1.2", - "dev": true - }, - "whatwg-url": { - "version": "7.1.0", - "dev": true, - "requires": { - "lodash.sortby": "^4.7.0", - "tr46": "^1.0.1", - "webidl-conversions": "^4.0.2" - } - } - } - }, - "@lerna/create-symlink": { - "version": "3.16.2", - "dev": true, - "requires": { - "@zkochan/cmd-shim": "^3.1.0", - "fs-extra": "^8.1.0", - "npmlog": "^4.1.2" - }, - "dependencies": { - "fs-extra": { - "version": "8.1.0", - "dev": true, - "requires": { - "graceful-fs": "^4.2.0", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - } - }, - "jsonfile": { - "version": "4.0.0", - "dev": true, - "requires": { - "graceful-fs": "^4.1.6" - } - }, - "universalify": { - "version": "0.1.2", - "dev": true - } - } - }, - "@lerna/describe-ref": { - "version": "3.16.5", - "dev": true, - "requires": { - "@lerna/child-process": "3.16.5", - "npmlog": "^4.1.2" - } - }, - "@lerna/diff": { - "version": "3.21.0", - "dev": true, - "requires": { - "@lerna/child-process": "3.16.5", - "@lerna/command": "3.21.0", - "@lerna/validation-error": "3.13.0", - "npmlog": "^4.1.2" - } - }, - "@lerna/exec": { - "version": "3.21.0", - "dev": true, - "requires": { - "@lerna/child-process": "3.16.5", - "@lerna/command": "3.21.0", - "@lerna/filter-options": "3.20.0", - "@lerna/profiler": "3.20.0", - "@lerna/run-topologically": "3.18.5", - "@lerna/validation-error": "3.13.0", - "p-map": "^2.1.0" - } - }, - "@lerna/filter-options": { - "version": "3.20.0", - "dev": true, - "requires": { - "@lerna/collect-updates": "3.20.0", - "@lerna/filter-packages": "3.18.0", - "dedent": "^0.7.0", - "figgy-pudding": "^3.5.1", - "npmlog": "^4.1.2" - } - }, - "@lerna/filter-packages": { - "version": "3.18.0", - "dev": true, - "requires": { - "@lerna/validation-error": "3.13.0", - "multimatch": "^3.0.0", - "npmlog": "^4.1.2" - } - }, - "@lerna/get-npm-exec-opts": { - "version": "3.13.0", - "dev": true, - "requires": { - "npmlog": "^4.1.2" - } - }, - "@lerna/get-packed": { - "version": "3.16.0", - "dev": true, - "requires": { - "fs-extra": "^8.1.0", - "ssri": "^6.0.1", - "tar": "^4.4.8" - }, - "dependencies": { - "fs-extra": { - "version": "8.1.0", - "dev": true, - "requires": { - "graceful-fs": "^4.2.0", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - } - }, - "jsonfile": { - "version": "4.0.0", - "dev": true, - "requires": { - "graceful-fs": "^4.1.6" - } - }, - "universalify": { - "version": "0.1.2", - "dev": true - } - } - }, - "@lerna/github-client": { - "version": "3.22.0", - "dev": true, - "requires": { - "@lerna/child-process": "3.16.5", - "@octokit/plugin-enterprise-rest": "^6.0.1", - "@octokit/rest": "^16.28.4", - "git-url-parse": "^11.1.2", - "npmlog": "^4.1.2" - } - }, - "@lerna/gitlab-client": { - "version": "3.15.0", - "dev": true, - "requires": { - "node-fetch": "^2.5.0", - "npmlog": "^4.1.2", - "whatwg-url": "^7.0.0" - }, - "dependencies": { - "whatwg-url": { - "version": "7.1.0", - "dev": true, - "requires": { - "lodash.sortby": "^4.7.0", - "tr46": "^1.0.1", - "webidl-conversions": "^4.0.2" - } - } - } - }, - "@lerna/global-options": { - "version": "3.13.0", - "dev": true - }, - "@lerna/has-npm-version": { - "version": "3.16.5", - "dev": true, - "requires": { - "@lerna/child-process": "3.16.5", - "semver": "^6.2.0" - }, - "dependencies": { - "semver": { - "version": "6.3.0", - "dev": true - } - } - }, - "@lerna/import": { - "version": "3.22.0", - "dev": true, - "requires": { - "@lerna/child-process": "3.16.5", - "@lerna/command": "3.21.0", - "@lerna/prompt": "3.18.5", - "@lerna/pulse-till-done": "3.13.0", - "@lerna/validation-error": "3.13.0", - "dedent": "^0.7.0", - "fs-extra": "^8.1.0", - "p-map-series": "^1.0.0" - }, - "dependencies": { - "fs-extra": { - "version": "8.1.0", - "dev": true, - "requires": { - "graceful-fs": "^4.2.0", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - } - }, - "jsonfile": { - "version": "4.0.0", - "dev": true, - "requires": { - "graceful-fs": "^4.1.6" - } - }, - "universalify": { - "version": "0.1.2", - "dev": true - } - } - }, - "@lerna/info": { - "version": "3.21.0", - "dev": true, - "requires": { - "@lerna/command": "3.21.0", - "@lerna/output": "3.13.0", - "envinfo": "^7.3.1" - } - }, - "@lerna/init": { - "version": "3.21.0", - "dev": true, - "requires": { - "@lerna/child-process": "3.16.5", - "@lerna/command": "3.21.0", - "fs-extra": "^8.1.0", - "p-map": "^2.1.0", - "write-json-file": "^3.2.0" - }, - "dependencies": { - "fs-extra": { - "version": "8.1.0", - "dev": true, - "requires": { - "graceful-fs": "^4.2.0", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - } - }, - "jsonfile": { - "version": "4.0.0", - "dev": true, - "requires": { - "graceful-fs": "^4.1.6" - } - }, - "universalify": { - "version": "0.1.2", - "dev": true - } - } - }, - "@lerna/link": { - "version": "3.21.0", - "dev": true, - "requires": { - "@lerna/command": "3.21.0", - "@lerna/package-graph": "3.18.5", - "@lerna/symlink-dependencies": "3.17.0", - "p-map": "^2.1.0", - "slash": "^2.0.0" - }, - "dependencies": { - "slash": { - "version": "2.0.0", - "dev": true - } - } - }, - "@lerna/list": { - "version": "3.21.0", - "dev": true, - "requires": { - "@lerna/command": "3.21.0", - "@lerna/filter-options": "3.20.0", - "@lerna/listable": "3.18.5", - "@lerna/output": "3.13.0" - } - }, - "@lerna/listable": { - "version": "3.18.5", - "dev": true, - "requires": { - "@lerna/query-graph": "3.18.5", - "chalk": "^2.3.1", - "columnify": "^1.5.4" - }, - "dependencies": { - "ansi-styles": { - "version": "3.2.1", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "chalk": { - "version": "2.4.2", - "dev": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "color-convert": { - "version": "1.9.3", - "dev": true, - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "dev": true - }, - "has-flag": { - "version": "3.0.0", - "dev": true - }, - "supports-color": { - "version": "5.5.0", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - } - } - }, - "@lerna/log-packed": { - "version": "3.16.0", - "dev": true, - "requires": { - "byte-size": "^5.0.1", - "columnify": "^1.5.4", - "has-unicode": "^2.0.1", - "npmlog": "^4.1.2" - } - }, - "@lerna/npm-conf": { - "version": "3.16.0", - "dev": true, - "requires": { - "config-chain": "^1.1.11", - "pify": "^4.0.1" - } - }, - "@lerna/npm-dist-tag": { - "version": "3.18.5", - "dev": true, - "requires": { - "@evocateur/npm-registry-fetch": "^4.0.0", - "@lerna/otplease": "3.18.5", - "figgy-pudding": "^3.5.1", - "npm-package-arg": "^6.1.0", - "npmlog": "^4.1.2" - } - }, - "@lerna/npm-install": { - "version": "3.16.5", - "dev": true, - "requires": { - "@lerna/child-process": "3.16.5", - "@lerna/get-npm-exec-opts": "3.13.0", - "fs-extra": "^8.1.0", - "npm-package-arg": "^6.1.0", - "npmlog": "^4.1.2", - "signal-exit": "^3.0.2", - "write-pkg": "^3.1.0" - }, - "dependencies": { - "fs-extra": { - "version": "8.1.0", - "dev": true, - "requires": { - "graceful-fs": "^4.2.0", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - } - }, - "jsonfile": { - "version": "4.0.0", - "dev": true, - "requires": { - "graceful-fs": "^4.1.6" - } - }, - "universalify": { - "version": "0.1.2", - "dev": true - } - } - }, - "@lerna/npm-publish": { - "version": "3.18.5", - "dev": true, - "requires": { - "@evocateur/libnpmpublish": "^1.2.2", - "@lerna/otplease": "3.18.5", - "@lerna/run-lifecycle": "3.16.2", - "figgy-pudding": "^3.5.1", - "fs-extra": "^8.1.0", - "npm-package-arg": "^6.1.0", - "npmlog": "^4.1.2", - "pify": "^4.0.1", - "read-package-json": "^2.0.13" - }, - "dependencies": { - "fs-extra": { - "version": "8.1.0", - "dev": true, - "requires": { - "graceful-fs": "^4.2.0", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - } - }, - "jsonfile": { - "version": "4.0.0", - "dev": true, - "requires": { - "graceful-fs": "^4.1.6" - } - }, - "universalify": { - "version": "0.1.2", - "dev": true - } - } - }, - "@lerna/npm-run-script": { - "version": "3.16.5", - "dev": true, - "requires": { - "@lerna/child-process": "3.16.5", - "@lerna/get-npm-exec-opts": "3.13.0", - "npmlog": "^4.1.2" - } - }, - "@lerna/otplease": { - "version": "3.18.5", - "dev": true, - "requires": { - "@lerna/prompt": "3.18.5", - "figgy-pudding": "^3.5.1" - } - }, - "@lerna/output": { - "version": "3.13.0", - "dev": true, - "requires": { - "npmlog": "^4.1.2" - } - }, - "@lerna/pack-directory": { - "version": "3.16.4", - "dev": true, - "requires": { - "@lerna/get-packed": "3.16.0", - "@lerna/package": "3.16.0", - "@lerna/run-lifecycle": "3.16.2", - "figgy-pudding": "^3.5.1", - "npm-packlist": "^1.4.4", - "npmlog": "^4.1.2", - "tar": "^4.4.10", - "temp-write": "^3.4.0" - } - }, - "@lerna/package": { - "version": "3.16.0", - "dev": true, - "requires": { - "load-json-file": "^5.3.0", - "npm-package-arg": "^6.1.0", - "write-pkg": "^3.1.0" - } - }, - "@lerna/package-graph": { - "version": "3.18.5", - "dev": true, - "requires": { - "@lerna/prerelease-id-from-version": "3.16.0", - "@lerna/validation-error": "3.13.0", - "npm-package-arg": "^6.1.0", - "npmlog": "^4.1.2", - "semver": "^6.2.0" - }, - "dependencies": { - "semver": { - "version": "6.3.0", - "dev": true - } - } - }, - "@lerna/prerelease-id-from-version": { - "version": "3.16.0", - "dev": true, - "requires": { - "semver": "^6.2.0" - }, - "dependencies": { - "semver": { - "version": "6.3.0", - "dev": true - } - } - }, - "@lerna/profiler": { - "version": "3.20.0", - "dev": true, - "requires": { - "figgy-pudding": "^3.5.1", - "fs-extra": "^8.1.0", - "npmlog": "^4.1.2", - "upath": "^1.2.0" - }, - "dependencies": { - "fs-extra": { - "version": "8.1.0", - "dev": true, - "requires": { - "graceful-fs": "^4.2.0", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - } - }, - "jsonfile": { - "version": "4.0.0", - "dev": true, - "requires": { - "graceful-fs": "^4.1.6" - } - }, - "universalify": { - "version": "0.1.2", - "dev": true - } - } - }, - "@lerna/project": { - "version": "3.21.0", - "dev": true, - "requires": { - "@lerna/package": "3.16.0", - "@lerna/validation-error": "3.13.0", - "cosmiconfig": "^5.1.0", - "dedent": "^0.7.0", - "dot-prop": "^4.2.0", - "glob-parent": "^5.0.0", - "globby": "^9.2.0", - "load-json-file": "^5.3.0", - "npmlog": "^4.1.2", - "p-map": "^2.1.0", - "resolve-from": "^4.0.0", - "write-json-file": "^3.2.0" - } - }, - "@lerna/prompt": { - "version": "3.18.5", - "dev": true, - "requires": { - "inquirer": "^6.2.0", - "npmlog": "^4.1.2" - }, - "dependencies": { - "ansi-escapes": { - "version": "3.2.0", - "dev": true - }, - "ansi-regex": { - "version": "3.0.0", - "dev": true - }, - "ansi-styles": { - "version": "3.2.1", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "chalk": { - "version": "2.4.2", - "dev": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "cli-cursor": { - "version": "2.1.0", - "dev": true, - "requires": { - "restore-cursor": "^2.0.0" - } - }, - "cli-width": { - "version": "2.2.1", - "dev": true - }, - "color-convert": { - "version": "1.9.3", - "dev": true, - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "dev": true - }, - "figures": { - "version": "2.0.0", - "dev": true, - "requires": { - "escape-string-regexp": "^1.0.5" - } - }, - "has-flag": { - "version": "3.0.0", - "dev": true - }, - "inquirer": { - "version": "6.5.2", - "dev": true, - "requires": { - "ansi-escapes": "^3.2.0", - "chalk": "^2.4.2", - "cli-cursor": "^2.1.0", - "cli-width": "^2.0.0", - "external-editor": "^3.0.3", - "figures": "^2.0.0", - "lodash": "^4.17.12", - "mute-stream": "0.0.7", - "run-async": "^2.2.0", - "rxjs": "^6.4.0", - "string-width": "^2.1.0", - "strip-ansi": "^5.1.0", - "through": "^2.3.6" - } - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "dev": true - }, - "mimic-fn": { - "version": "1.2.0", - "dev": true - }, - "mute-stream": { - "version": "0.0.7", - "dev": true - }, - "onetime": { - "version": "2.0.1", - "dev": true, - "requires": { - "mimic-fn": "^1.0.0" - } - }, - "restore-cursor": { - "version": "2.0.0", - "dev": true, - "requires": { - "onetime": "^2.0.0", - "signal-exit": "^3.0.2" - } - }, - "string-width": { - "version": "2.1.1", - "dev": true, - "requires": { - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^4.0.0" - }, - "dependencies": { - "strip-ansi": { - "version": "4.0.0", - "dev": true, - "requires": { - "ansi-regex": "^3.0.0" - } - } - } - }, - "supports-color": { - "version": "5.5.0", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - } - } - }, - "@lerna/publish": { - "version": "3.22.1", - "dev": true, - "requires": { - "@evocateur/libnpmaccess": "^3.1.2", - "@evocateur/npm-registry-fetch": "^4.0.0", - "@evocateur/pacote": "^9.6.3", - "@lerna/check-working-tree": "3.16.5", - "@lerna/child-process": "3.16.5", - "@lerna/collect-updates": "3.20.0", - "@lerna/command": "3.21.0", - "@lerna/describe-ref": "3.16.5", - "@lerna/log-packed": "3.16.0", - "@lerna/npm-conf": "3.16.0", - "@lerna/npm-dist-tag": "3.18.5", - "@lerna/npm-publish": "3.18.5", - "@lerna/otplease": "3.18.5", - "@lerna/output": "3.13.0", - "@lerna/pack-directory": "3.16.4", - "@lerna/prerelease-id-from-version": "3.16.0", - "@lerna/prompt": "3.18.5", - "@lerna/pulse-till-done": "3.13.0", - "@lerna/run-lifecycle": "3.16.2", - "@lerna/run-topologically": "3.18.5", - "@lerna/validation-error": "3.13.0", - "@lerna/version": "3.22.1", - "figgy-pudding": "^3.5.1", - "fs-extra": "^8.1.0", - "npm-package-arg": "^6.1.0", - "npmlog": "^4.1.2", - "p-finally": "^1.0.0", - "p-map": "^2.1.0", - "p-pipe": "^1.2.0", - "semver": "^6.2.0" - }, - "dependencies": { - "fs-extra": { - "version": "8.1.0", - "dev": true, - "requires": { - "graceful-fs": "^4.2.0", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - } - }, - "jsonfile": { - "version": "4.0.0", - "dev": true, - "requires": { - "graceful-fs": "^4.1.6" - } - }, - "semver": { - "version": "6.3.0", - "dev": true - }, - "universalify": { - "version": "0.1.2", - "dev": true - } - } - }, - "@lerna/pulse-till-done": { - "version": "3.13.0", - "dev": true, - "requires": { - "npmlog": "^4.1.2" - } - }, - "@lerna/query-graph": { - "version": "3.18.5", - "dev": true, - "requires": { - "@lerna/package-graph": "3.18.5", - "figgy-pudding": "^3.5.1" - } - }, - "@lerna/resolve-symlink": { - "version": "3.16.0", - "dev": true, - "requires": { - "fs-extra": "^8.1.0", - "npmlog": "^4.1.2", - "read-cmd-shim": "^1.0.1" - }, - "dependencies": { - "fs-extra": { - "version": "8.1.0", - "dev": true, - "requires": { - "graceful-fs": "^4.2.0", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - } - }, - "jsonfile": { - "version": "4.0.0", - "dev": true, - "requires": { - "graceful-fs": "^4.1.6" - } - }, - "universalify": { - "version": "0.1.2", - "dev": true - } - } - }, - "@lerna/rimraf-dir": { - "version": "3.16.5", - "dev": true, - "requires": { - "@lerna/child-process": "3.16.5", - "npmlog": "^4.1.2", - "path-exists": "^3.0.0", - "rimraf": "^2.6.2" - } - }, - "@lerna/run": { - "version": "3.21.0", - "dev": true, - "requires": { - "@lerna/command": "3.21.0", - "@lerna/filter-options": "3.20.0", - "@lerna/npm-run-script": "3.16.5", - "@lerna/output": "3.13.0", - "@lerna/profiler": "3.20.0", - "@lerna/run-topologically": "3.18.5", - "@lerna/timer": "3.13.0", - "@lerna/validation-error": "3.13.0", - "p-map": "^2.1.0" - } - }, - "@lerna/run-lifecycle": { - "version": "3.16.2", - "dev": true, - "requires": { - "@lerna/npm-conf": "3.16.0", - "figgy-pudding": "^3.5.1", - "npm-lifecycle": "^3.1.2", - "npmlog": "^4.1.2" - } - }, - "@lerna/run-topologically": { - "version": "3.18.5", - "dev": true, - "requires": { - "@lerna/query-graph": "3.18.5", - "figgy-pudding": "^3.5.1", - "p-queue": "^4.0.0" - } - }, - "@lerna/symlink-binary": { - "version": "3.17.0", - "dev": true, - "requires": { - "@lerna/create-symlink": "3.16.2", - "@lerna/package": "3.16.0", - "fs-extra": "^8.1.0", - "p-map": "^2.1.0" - }, - "dependencies": { - "fs-extra": { - "version": "8.1.0", - "dev": true, - "requires": { - "graceful-fs": "^4.2.0", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - } - }, - "jsonfile": { - "version": "4.0.0", - "dev": true, - "requires": { - "graceful-fs": "^4.1.6" - } - }, - "universalify": { - "version": "0.1.2", - "dev": true - } - } - }, - "@lerna/symlink-dependencies": { - "version": "3.17.0", - "dev": true, - "requires": { - "@lerna/create-symlink": "3.16.2", - "@lerna/resolve-symlink": "3.16.0", - "@lerna/symlink-binary": "3.17.0", - "fs-extra": "^8.1.0", - "p-finally": "^1.0.0", - "p-map": "^2.1.0", - "p-map-series": "^1.0.0" - }, - "dependencies": { - "fs-extra": { - "version": "8.1.0", - "dev": true, - "requires": { - "graceful-fs": "^4.2.0", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - } - }, - "jsonfile": { - "version": "4.0.0", - "dev": true, - "requires": { - "graceful-fs": "^4.1.6" - } - }, - "universalify": { - "version": "0.1.2", - "dev": true - } - } - }, - "@lerna/timer": { - "version": "3.13.0", - "dev": true - }, - "@lerna/validation-error": { - "version": "3.13.0", - "dev": true, - "requires": { - "npmlog": "^4.1.2" - } - }, - "@lerna/version": { - "version": "3.22.1", - "dev": true, - "requires": { - "@lerna/check-working-tree": "3.16.5", - "@lerna/child-process": "3.16.5", - "@lerna/collect-updates": "3.20.0", - "@lerna/command": "3.21.0", - "@lerna/conventional-commits": "3.22.0", - "@lerna/github-client": "3.22.0", - "@lerna/gitlab-client": "3.15.0", - "@lerna/output": "3.13.0", - "@lerna/prerelease-id-from-version": "3.16.0", - "@lerna/prompt": "3.18.5", - "@lerna/run-lifecycle": "3.16.2", - "@lerna/run-topologically": "3.18.5", - "@lerna/validation-error": "3.13.0", - "chalk": "^2.3.1", - "dedent": "^0.7.0", - "load-json-file": "^5.3.0", - "minimatch": "^3.0.4", - "npmlog": "^4.1.2", - "p-map": "^2.1.0", - "p-pipe": "^1.2.0", - "p-reduce": "^1.0.0", - "p-waterfall": "^1.0.0", - "semver": "^6.2.0", - "slash": "^2.0.0", - "temp-write": "^3.4.0", - "write-json-file": "^3.2.0" - }, - "dependencies": { - "ansi-styles": { - "version": "3.2.1", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "chalk": { - "version": "2.4.2", - "dev": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "color-convert": { - "version": "1.9.3", - "dev": true, - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "dev": true - }, - "has-flag": { - "version": "3.0.0", - "dev": true - }, - "semver": { - "version": "6.3.0", - "dev": true - }, - "slash": { - "version": "2.0.0", - "dev": true - }, - "supports-color": { - "version": "5.5.0", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - } - } - }, - "@lerna/write-log-file": { - "version": "3.13.0", - "dev": true, - "requires": { - "npmlog": "^4.1.2", - "write-file-atomic": "^2.3.0" - } - }, - "@microsoft/api-documenter": { - "version": "7.12.12", - "dev": true, - "requires": { - "@microsoft/api-extractor-model": "7.12.2", - "@microsoft/tsdoc": "0.12.24", - "@rushstack/node-core-library": "3.36.0", - "@rushstack/ts-command-line": "4.7.8", - "colors": "~1.2.1", - "js-yaml": "~3.13.1", - "resolve": "~1.17.0" - } - }, - "@microsoft/api-extractor": { - "version": "7.13.2", - "dev": true, - "requires": { - "@microsoft/api-extractor-model": "7.12.2", - "@microsoft/tsdoc": "0.12.24", - "@rushstack/node-core-library": "3.36.0", - "@rushstack/rig-package": "0.2.10", - "@rushstack/ts-command-line": "4.7.8", - "colors": "~1.2.1", - "lodash": "~4.17.15", - "resolve": "~1.17.0", - "semver": "~7.3.0", - "source-map": "~0.6.1", - "typescript": "~4.1.3" - }, - "dependencies": { - "typescript": { - "version": "4.1.5", - "dev": true - } - } - }, - "@microsoft/api-extractor-model": { - "version": "7.12.2", - "dev": true, - "requires": { - "@microsoft/tsdoc": "0.12.24", - "@rushstack/node-core-library": "3.36.0" - } - }, - "@microsoft/tsdoc": { - "version": "0.12.24", - "dev": true - }, - "@mrmlnc/readdir-enhanced": { - "version": "2.2.1", - "dev": true, - "requires": { - "call-me-maybe": "^1.0.1", - "glob-to-regexp": "^0.3.0" - } - }, - "@nodelib/fs.scandir": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.4.tgz", - "integrity": "sha512-33g3pMJk3bg5nXbL/+CY6I2eJDzZAni49PfJnL5fghPTggPvBd/pFNSgJsdAgWptuFu7qq/ERvOYFlhvsLTCKA==", - "dev": true, - "requires": { - "@nodelib/fs.stat": "2.0.4", - "run-parallel": "^1.1.9" - }, - "dependencies": { - "@nodelib/fs.stat": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.4.tgz", - "integrity": "sha512-IYlHJA0clt2+Vg7bccq+TzRdJvv19c2INqBSsoOLp1je7xjtr7J26+WXR72MCdvU9q1qTzIWDfhMf+DRvQJK4Q==", - "dev": true - } - } - }, - "@nodelib/fs.stat": { - "version": "1.1.3", - "dev": true - }, - "@nodelib/fs.walk": { - "version": "1.2.6", - "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.6.tgz", - "integrity": "sha512-8Broas6vTtW4GIXTAHDoE32hnN2M5ykgCpWGbuXHQ15vEMqr23pB76e/GZcYsZCHALv50ktd24qhEyKr6wBtow==", - "dev": true, - "requires": { - "@nodelib/fs.scandir": "2.1.4", - "fastq": "^1.6.0" - } - }, - "@octokit/auth-token": { - "version": "2.4.5", - "dev": true, - "requires": { - "@octokit/types": "^6.0.3" - } - }, - "@octokit/core": { - "version": "3.3.0", - "dev": true, - "peer": true, - "requires": { - "@octokit/auth-token": "^2.4.4", - "@octokit/graphql": "^4.5.8", - "@octokit/request": "^5.4.12", - "@octokit/request-error": "^2.0.5", - "@octokit/types": "^6.0.3", - "before-after-hook": "^2.2.0", - "universal-user-agent": "^6.0.0" - }, - "dependencies": { - "@octokit/request-error": { - "version": "2.0.5", - "dev": true, - "peer": true, - "requires": { - "@octokit/types": "^6.0.3", - "deprecation": "^2.0.0", - "once": "^1.4.0" - } - }, - "universal-user-agent": { - "version": "6.0.0", - "dev": true, - "peer": true - } - } - }, - "@octokit/endpoint": { - "version": "6.0.11", - "dev": true, - "requires": { - "@octokit/types": "^6.0.3", - "is-plain-object": "^5.0.0", - "universal-user-agent": "^6.0.0" - }, - "dependencies": { - "universal-user-agent": { - "version": "6.0.0", - "dev": true - } - } - }, - "@octokit/graphql": { - "version": "4.6.1", - "dev": true, - "peer": true, - "requires": { - "@octokit/request": "^5.3.0", - "@octokit/types": "^6.0.3", - "universal-user-agent": "^6.0.0" - }, - "dependencies": { - "universal-user-agent": { - "version": "6.0.0", - "dev": true, - "peer": true - } - } - }, - "@octokit/openapi-types": { - "version": "5.3.2", - "dev": true - }, - "@octokit/plugin-enterprise-rest": { - "version": "6.0.1", - "dev": true - }, - "@octokit/plugin-paginate-rest": { - "version": "1.1.2", - "dev": true, - "requires": { - "@octokit/types": "^2.0.1" - }, - "dependencies": { - "@octokit/types": { - "version": "2.16.2", - "dev": true, - "requires": { - "@types/node": ">= 8" - } - } - } - }, - "@octokit/plugin-request-log": { - "version": "1.0.3", - "dev": true, - "requires": {} - }, - "@octokit/plugin-rest-endpoint-methods": { - "version": "2.4.0", - "dev": true, - "requires": { - "@octokit/types": "^2.0.1", - "deprecation": "^2.3.1" - }, - "dependencies": { - "@octokit/types": { - "version": "2.16.2", - "dev": true, - "requires": { - "@types/node": ">= 8" - } - } - } - }, - "@octokit/request": { - "version": "5.4.14", - "dev": true, - "requires": { - "@octokit/endpoint": "^6.0.1", - "@octokit/request-error": "^2.0.0", - "@octokit/types": "^6.7.1", - "deprecation": "^2.0.0", - "is-plain-object": "^5.0.0", - "node-fetch": "^2.6.1", - "once": "^1.4.0", - "universal-user-agent": "^6.0.0" - }, - "dependencies": { - "@octokit/request-error": { - "version": "2.0.5", - "dev": true, - "requires": { - "@octokit/types": "^6.0.3", - "deprecation": "^2.0.0", - "once": "^1.4.0" - } - }, - "universal-user-agent": { - "version": "6.0.0", - "dev": true - } - } - }, - "@octokit/request-error": { - "version": "1.2.1", - "dev": true, - "requires": { - "@octokit/types": "^2.0.0", - "deprecation": "^2.0.0", - "once": "^1.4.0" - }, - "dependencies": { - "@octokit/types": { - "version": "2.16.2", - "dev": true, - "requires": { - "@types/node": ">= 8" - } - } - } - }, - "@octokit/rest": { - "version": "16.43.2", - "dev": true, - "requires": { - "@octokit/auth-token": "^2.4.0", - "@octokit/plugin-paginate-rest": "^1.1.1", - "@octokit/plugin-request-log": "^1.0.0", - "@octokit/plugin-rest-endpoint-methods": "2.4.0", - "@octokit/request": "^5.2.0", - "@octokit/request-error": "^1.0.2", - "atob-lite": "^2.0.0", - "before-after-hook": "^2.0.0", - "btoa-lite": "^1.0.0", - "deprecation": "^2.0.0", - "lodash.get": "^4.4.2", - "lodash.set": "^4.3.2", - "lodash.uniq": "^4.5.0", - "octokit-pagination-methods": "^1.1.0", - "once": "^1.4.0", - "universal-user-agent": "^4.0.0" - } - }, - "@octokit/types": { - "version": "6.12.2", - "dev": true, - "requires": { - "@octokit/openapi-types": "^5.3.2" - } - }, - "@rollup/plugin-alias": { - "version": "3.1.2", - "dev": true, - "requires": { - "slash": "^3.0.0" - } - }, - "@rollup/plugin-commonjs": { - "version": "17.1.0", - "dev": true, - "requires": { - "@rollup/pluginutils": "^3.1.0", - "commondir": "^1.0.1", - "estree-walker": "^2.0.1", - "glob": "^7.1.6", - "is-reference": "^1.2.1", - "magic-string": "^0.25.7", - "resolve": "^1.17.0" - } - }, - "@rollup/plugin-inject": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/@rollup/plugin-inject/-/plugin-inject-4.0.2.tgz", - "integrity": "sha512-TSLMA8waJ7Dmgmoc8JfPnwUwVZgLjjIAM6MqeIFqPO2ODK36JqE0Cf2F54UTgCUuW8da93Mvoj75a6KAVWgylw==", - "dev": true, - "requires": { - "@rollup/pluginutils": "^3.0.4", - "estree-walker": "^1.0.1", - "magic-string": "^0.25.5" - }, - "dependencies": { - "estree-walker": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-1.0.1.tgz", - "integrity": "sha512-1fMXF3YP4pZZVozF8j/ZLfvnR8NSIljt56UhbZ5PeeDmmGHpgpdwQt7ITlGvYaQukCvuBRMLEiKiYC+oeIg4cg==", - "dev": true - } - } - }, - "@rollup/plugin-json": { - "version": "4.1.0", - "dev": true, - "requires": { - "@rollup/pluginutils": "^3.0.8" - } - }, - "@rollup/plugin-node-resolve": { - "version": "13.0.2", - "resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-13.0.2.tgz", - "integrity": "sha512-hv+eAMcA2hQ7qvPVcXbtIyc0dtue4jMyA2sCW4IMkrmh+SeDDEHg1MXTv65VPpKdtjvWzN3+4mHAEl4rT+zgzQ==", - "dev": true, - "requires": { - "@rollup/pluginutils": "^3.1.0", - "@types/resolve": "1.17.1", - "builtin-modules": "^3.1.0", - "deepmerge": "^4.2.2", - "is-module": "^1.0.0", - "resolve": "^1.19.0" - }, - "dependencies": { - "@types/resolve": { - "version": "1.17.1", - "resolved": "https://registry.npmjs.org/@types/resolve/-/resolve-1.17.1.tgz", - "integrity": "sha512-yy7HuzQhj0dhGpD8RLXSZWEkLsV9ibvxvi6EiJ3bkqLAO1RGo0WbkWQiwpRlSFymTJRz0d3k5LM3kkx8ArDbLw==", - "dev": true, - "requires": { - "@types/node": "*" - } - }, - "resolve": { - "version": "1.20.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz", - "integrity": "sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A==", - "dev": true, - "requires": { - "is-core-module": "^2.2.0", - "path-parse": "^1.0.6" - } - } - } - }, - "@rollup/pluginutils": { - "version": "3.1.0", - "dev": true, - "requires": { - "@types/estree": "0.0.39", - "estree-walker": "^1.0.1", - "picomatch": "^2.2.2" - }, - "dependencies": { - "estree-walker": { - "version": "1.0.1", - "dev": true - } - } - }, - "@rushstack/node-core-library": { - "version": "3.36.0", - "dev": true, - "requires": { - "@types/node": "10.17.13", - "colors": "~1.2.1", - "fs-extra": "~7.0.1", - "import-lazy": "~4.0.0", - "jju": "~1.4.0", - "resolve": "~1.17.0", - "semver": "~7.3.0", - "timsort": "~0.3.0", - "z-schema": "~3.18.3" - }, - "dependencies": { - "fs-extra": { - "version": "7.0.1", - "dev": true, - "requires": { - "graceful-fs": "^4.1.2", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - } - }, - "jsonfile": { - "version": "4.0.0", - "dev": true, - "requires": { - "graceful-fs": "^4.1.6" - } - }, - "universalify": { - "version": "0.1.2", - "dev": true - } - } - }, - "@rushstack/rig-package": { - "version": "0.2.10", - "dev": true, - "requires": { - "resolve": "~1.17.0", - "strip-json-comments": "~3.1.1" - } - }, - "@rushstack/ts-command-line": { - "version": "4.7.8", - "dev": true, - "requires": { - "@types/argparse": "1.0.38", - "argparse": "~1.0.9", - "colors": "~1.2.1", - "string-argv": "~0.3.1" - } - }, - "@sinonjs/commons": { - "version": "1.8.2", - "dev": true, - "requires": { - "type-detect": "4.0.8" - } - }, - "@sinonjs/formatio": { - "version": "3.2.2", - "dev": true, - "requires": { - "@sinonjs/commons": "^1", - "@sinonjs/samsam": "^3.1.0" - } - }, - "@sinonjs/samsam": { - "version": "3.3.3", - "dev": true, - "requires": { - "@sinonjs/commons": "^1.3.0", - "array-from": "^2.1.1", - "lodash": "^4.17.15" - } - }, - "@sinonjs/text-encoding": { - "version": "0.7.1", - "dev": true - }, - "@tweenjs/tween.js": { - "version": "18.6.4" - }, - "@types/argparse": { - "version": "1.0.38", - "dev": true - }, - "@types/babel__core": { - "version": "7.1.12", - "dev": true, - "requires": { - "@babel/parser": "^7.1.0", - "@babel/types": "^7.0.0", - "@types/babel__generator": "*", - "@types/babel__template": "*", - "@types/babel__traverse": "*" - } - }, - "@types/babel__generator": { - "version": "7.6.2", - "dev": true, - "requires": { - "@babel/types": "^7.0.0" - } - }, - "@types/babel__template": { - "version": "7.4.0", - "dev": true, - "requires": { - "@babel/parser": "^7.1.0", - "@babel/types": "^7.0.0" - } - }, - "@types/babel__traverse": { - "version": "7.11.1", - "dev": true, - "requires": { - "@babel/types": "^7.3.0" - } - }, - "@types/eslint-visitor-keys": { - "version": "1.0.0", - "dev": true - }, - "@types/estree": { - "version": "0.0.39", - "dev": true - }, - "@types/fs-extra": { - "version": "8.1.1", - "resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-8.1.1.tgz", - "integrity": "sha512-TcUlBem321DFQzBNuz8p0CLLKp0VvF/XH9E4KHNmgwyp4E3AfgI5cjiIVZWlbfThBop2qxFIh4+LeY6hVWWZ2w==", - "dev": true, - "requires": { - "@types/node": "*" - } - }, - "@types/glob": { - "version": "7.1.3", - "dev": true, - "requires": { - "@types/minimatch": "*", - "@types/node": "*" - } - }, - "@types/istanbul-lib-coverage": { - "version": "2.0.3", - "dev": true - }, - "@types/istanbul-lib-report": { - "version": "3.0.0", - "dev": true, - "requires": { - "@types/istanbul-lib-coverage": "*" - } - }, - "@types/istanbul-reports": { - "version": "1.1.2", - "dev": true, - "requires": { - "@types/istanbul-lib-coverage": "*", - "@types/istanbul-lib-report": "*" - } - }, - "@types/jest": { - "version": "24.9.1", - "dev": true, - "requires": { - "jest-diff": "^24.3.0" - } - }, - "@types/json-schema": { - "version": "7.0.7", - "dev": true - }, - "@types/lodash": { - "version": "4.14.168", - "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.168.tgz", - "integrity": "sha512-oVfRvqHV/V6D1yifJbVRU3TMp8OT6o6BG+U9MkwuJ3U8/CsDHvalRpsxBqivn71ztOFZBTfJMvETbqHiaNSj7Q==", - "dev": true - }, - "@types/lodash-es": { - "version": "4.17.4", - "resolved": "https://registry.npmjs.org/@types/lodash-es/-/lodash-es-4.17.4.tgz", - "integrity": "sha512-BBz79DCJbD2CVYZH67MBeHZRX++HF+5p8Mo5MzjZi64Wac39S3diedJYHZtScbRVf4DjZyN6LzA0SB0zy+HSSQ==", - "dev": true, - "requires": { - "@types/lodash": "*" - } - }, - "@types/minimatch": { - "version": "3.0.3", - "dev": true - }, - "@types/minimist": { - "version": "1.2.1", - "dev": true - }, - "@types/node": { - "version": "10.17.13", - "dev": true - }, - "@types/normalize-package-data": { - "version": "2.4.0", - "dev": true - }, - "@types/pixi.js": { - "version": "4.8.9", - "dev": true - }, - "@types/resolve": { - "version": "0.0.8", - "dev": true, - "requires": { - "@types/node": "*" - } - }, - "@types/stack-utils": { - "version": "1.0.1", - "dev": true - }, - "@types/yargs": { - "version": "13.0.11", - "dev": true, - "requires": { - "@types/yargs-parser": "*" - } - }, - "@types/yargs-parser": { - "version": "20.2.0", - "dev": true - }, - "@typescript-eslint/eslint-plugin": { - "version": "1.13.0", - "dev": true, - "requires": { - "@typescript-eslint/experimental-utils": "1.13.0", - "eslint-utils": "^1.3.1", - "functional-red-black-tree": "^1.0.1", - "regexpp": "^2.0.1", - "tsutils": "^3.7.0" - } - }, - "@typescript-eslint/experimental-utils": { - "version": "1.13.0", - "dev": true, - "requires": { - "@types/json-schema": "^7.0.3", - "@typescript-eslint/typescript-estree": "1.13.0", - "eslint-scope": "^4.0.0" - } - }, - "@typescript-eslint/parser": { - "version": "1.13.0", - "dev": true, - "requires": { - "@types/eslint-visitor-keys": "^1.0.0", - "@typescript-eslint/experimental-utils": "1.13.0", - "@typescript-eslint/typescript-estree": "1.13.0", - "eslint-visitor-keys": "^1.0.0" - } - }, - "@typescript-eslint/typescript-estree": { - "version": "1.13.0", - "dev": true, - "requires": { - "lodash.unescape": "4.0.1", - "semver": "5.5.0" - }, - "dependencies": { - "semver": { - "version": "5.5.0", - "dev": true - } - } - }, - "@zkochan/cmd-shim": { - "version": "3.1.0", - "dev": true, - "requires": { - "is-windows": "^1.0.0", - "mkdirp-promise": "^5.0.1", - "mz": "^2.5.0" - } - }, - "abab": { - "version": "2.0.5", - "dev": true - }, - "abbrev": { - "version": "1.1.1", - "dev": true - }, - "acorn": { - "version": "7.4.1", - "dev": true - }, - "acorn-globals": { - "version": "4.3.4", - "dev": true, - "requires": { - "acorn": "^6.0.1", - "acorn-walk": "^6.0.1" - }, - "dependencies": { - "acorn": { - "version": "6.4.2", - "dev": true - } - } - }, - "acorn-jsx": { - "version": "5.3.1", - "dev": true, - "requires": {} - }, - "acorn-walk": { - "version": "6.2.0", - "dev": true - }, - "agent-base": { - "version": "4.3.0", - "dev": true, - "requires": { - "es6-promisify": "^5.0.0" - } - }, - "agentkeepalive": { - "version": "3.5.2", - "dev": true, - "requires": { - "humanize-ms": "^1.2.1" - } - }, - "ajv": { - "version": "6.12.6", - "dev": true, - "requires": { - "fast-deep-equal": "^3.1.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" - } - }, - "ansi-colors": { - "version": "4.1.1", - "dev": true - }, - "ansi-escapes": { - "version": "4.3.1", - "dev": true, - "requires": { - "type-fest": "^0.11.0" - }, - "dependencies": { - "type-fest": { - "version": "0.11.0", - "dev": true - } - } - }, - "ansi-regex": { - "version": "4.1.0", - "dev": true - }, - "ansi-styles": { - "version": "4.3.0", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "any-promise": { - "version": "1.3.0", - "dev": true - }, - "anymatch": { - "version": "2.0.0", - "dev": true, - "requires": { - "micromatch": "^3.1.4", - "normalize-path": "^2.1.1" - } - }, - "aproba": { - "version": "2.0.0", - "dev": true - }, - "are-we-there-yet": { - "version": "1.1.5", - "dev": true, - "requires": { - "delegates": "^1.0.0", - "readable-stream": "^2.0.6" - }, - "dependencies": { - "isarray": { - "version": "1.0.0", - "dev": true - }, - "readable-stream": { - "version": "2.3.7", - "dev": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "string_decoder": { - "version": "1.1.1", - "dev": true, - "requires": { - "safe-buffer": "~5.1.0" - } - } - } - }, - "argparse": { - "version": "1.0.10", - "dev": true, - "requires": { - "sprintf-js": "~1.0.2" - } - }, - "arr-diff": { - "version": "4.0.0", - "dev": true - }, - "arr-flatten": { - "version": "1.1.0", - "dev": true - }, - "arr-union": { - "version": "3.1.0", - "dev": true - }, - "array-differ": { - "version": "2.1.0", - "dev": true - }, - "array-equal": { - "version": "1.0.0", - "dev": true - }, - "array-find-index": { - "version": "1.0.2", - "dev": true - }, - "array-from": { - "version": "2.1.1", - "dev": true - }, - "array-ify": { - "version": "1.0.0", - "dev": true - }, - "array-union": { - "version": "1.0.2", - "dev": true, - "requires": { - "array-uniq": "^1.0.1" - } - }, - "array-uniq": { - "version": "1.0.3", - "dev": true - }, - "array-unique": { - "version": "0.3.2", - "dev": true - }, - "arrify": { - "version": "1.0.1", - "dev": true - }, - "asap": { - "version": "2.0.6", - "dev": true - }, - "asn1": { - "version": "0.2.4", - "dev": true, - "requires": { - "safer-buffer": "~2.1.0" - } - }, - "assert-plus": { - "version": "1.0.0", - "dev": true - }, - "assign-symbols": { - "version": "1.0.0", - "dev": true - }, - "astral-regex": { - "version": "1.0.0", - "dev": true - }, - "async": { - "version": "2.6.3", - "dev": true, - "requires": { - "lodash": "^4.17.14" - } - }, - "async-each": { - "version": "1.0.3", - "dev": true - }, - "async-limiter": { - "version": "1.0.1", - "dev": true - }, - "asynckit": { - "version": "0.4.0", - "dev": true - }, - "at-least-node": { - "version": "1.0.0", - "dev": true - }, - "atob": { - "version": "2.1.2", - "dev": true - }, - "atob-lite": { - "version": "2.0.0", - "dev": true - }, - "aws-sign2": { - "version": "0.7.0", - "dev": true - }, - "aws4": { - "version": "1.11.0", - "dev": true - }, - "babel-jest": { - "version": "24.9.0", - "dev": true, - "requires": { - "@jest/transform": "^24.9.0", - "@jest/types": "^24.9.0", - "@types/babel__core": "^7.1.0", - "babel-plugin-istanbul": "^5.1.0", - "babel-preset-jest": "^24.9.0", - "chalk": "^2.4.2", - "slash": "^2.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "3.2.1", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "chalk": { - "version": "2.4.2", - "dev": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "color-convert": { - "version": "1.9.3", - "dev": true, - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "dev": true - }, - "has-flag": { - "version": "3.0.0", - "dev": true - }, - "slash": { - "version": "2.0.0", - "dev": true - }, - "supports-color": { - "version": "5.5.0", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - } - } - }, - "babel-plugin-istanbul": { - "version": "5.2.0", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.0.0", - "find-up": "^3.0.0", - "istanbul-lib-instrument": "^3.3.0", - "test-exclude": "^5.2.3" - } - }, - "babel-plugin-jest-hoist": { - "version": "24.9.0", - "dev": true, - "requires": { - "@types/babel__traverse": "^7.0.6" - } - }, - "babel-preset-jest": { - "version": "24.9.0", - "dev": true, - "requires": { - "@babel/plugin-syntax-object-rest-spread": "^7.0.0", - "babel-plugin-jest-hoist": "^24.9.0" - } - }, - "backbone": { - "version": "1.4.0", - "dev": true, - "requires": { - "underscore": ">=1.8.3" - } - }, - "balanced-match": { - "version": "1.0.0", - "dev": true - }, - "base": { - "version": "0.11.2", - "dev": true, - "requires": { - "cache-base": "^1.0.1", - "class-utils": "^0.3.5", - "component-emitter": "^1.2.1", - "define-property": "^1.0.0", - "isobject": "^3.0.1", - "mixin-deep": "^1.2.0", - "pascalcase": "^0.1.1" - }, - "dependencies": { - "define-property": { - "version": "1.0.0", - "dev": true, - "requires": { - "is-descriptor": "^1.0.0" - } - } - } - }, - "base64-js": { - "version": "1.5.1", - "dev": true - }, - "bcrypt-pbkdf": { - "version": "1.0.2", - "dev": true, - "requires": { - "tweetnacl": "^0.14.3" - } - }, - "before-after-hook": { - "version": "2.2.0", - "dev": true - }, - "binary-extensions": { - "version": "2.2.0", - "dev": true - }, - "bindings": { - "version": "1.5.0", - "dev": true, - "optional": true, - "requires": { - "file-uri-to-path": "1.0.0" - } - }, - "bit-twiddle": { - "version": "1.0.2" - }, - "bluebird": { - "version": "3.7.2", - "dev": true - }, - "brace-expansion": { - "version": "1.1.11", - "dev": true, - "requires": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "braces": { - "version": "2.3.2", - "dev": true, - "requires": { - "arr-flatten": "^1.1.0", - "array-unique": "^0.3.2", - "extend-shallow": "^2.0.1", - "fill-range": "^4.0.0", - "isobject": "^3.0.1", - "repeat-element": "^1.1.2", - "snapdragon": "^0.8.1", - "snapdragon-node": "^2.0.1", - "split-string": "^3.0.2", - "to-regex": "^3.0.1" - }, - "dependencies": { - "extend-shallow": { - "version": "2.0.1", - "dev": true, - "requires": { - "is-extendable": "^0.1.0" - } - }, - "is-extendable": { - "version": "0.1.1", - "dev": true - } - } - }, - "brotli": { - "version": "1.3.2", - "dev": true, - "requires": { - "base64-js": "^1.1.2" - } - }, - "browser-process-hrtime": { - "version": "1.0.0", - "dev": true - }, - "browser-resolve": { - "version": "1.11.3", - "dev": true, - "requires": { - "resolve": "1.1.7" - }, - "dependencies": { - "resolve": { - "version": "1.1.7", - "dev": true - } - } - }, - "browserslist": { - "version": "4.16.3", - "dev": true, - "requires": { - "caniuse-lite": "^1.0.30001181", - "colorette": "^1.2.1", - "electron-to-chromium": "^1.3.649", - "escalade": "^3.1.1", - "node-releases": "^1.1.70" - } - }, - "bs-logger": { - "version": "0.2.6", - "dev": true, - "requires": { - "fast-json-stable-stringify": "2.x" - } - }, - "bser": { - "version": "2.1.1", - "dev": true, - "requires": { - "node-int64": "^0.4.0" - } - }, - "btoa-lite": { - "version": "1.0.0", - "dev": true - }, - "buffer-from": { - "version": "1.1.1", - "dev": true - }, - "builtin-modules": { - "version": "3.2.0", - "dev": true - }, - "builtins": { - "version": "1.0.3", - "dev": true - }, - "byline": { - "version": "5.0.0", - "dev": true - }, - "byte-size": { - "version": "5.0.1", - "dev": true - }, - "cacache": { - "version": "12.0.4", - "dev": true, - "requires": { - "bluebird": "^3.5.5", - "chownr": "^1.1.1", - "figgy-pudding": "^3.5.1", - "glob": "^7.1.4", - "graceful-fs": "^4.1.15", - "infer-owner": "^1.0.3", - "lru-cache": "^5.1.1", - "mississippi": "^3.0.0", - "mkdirp": "^0.5.1", - "move-concurrently": "^1.0.1", - "promise-inflight": "^1.0.1", - "rimraf": "^2.6.3", - "ssri": "^6.0.1", - "unique-filename": "^1.1.1", - "y18n": "^4.0.0" - } - }, - "cache-base": { - "version": "1.0.1", - "dev": true, - "requires": { - "collection-visit": "^1.0.0", - "component-emitter": "^1.2.1", - "get-value": "^2.0.6", - "has-value": "^1.0.0", - "isobject": "^3.0.1", - "set-value": "^2.0.0", - "to-object-path": "^0.3.0", - "union-value": "^1.0.0", - "unset-value": "^1.0.0" - } - }, - "call-bind": { - "version": "1.0.2", - "dev": true, - "requires": { - "function-bind": "^1.1.1", - "get-intrinsic": "^1.0.2" - } - }, - "call-me-maybe": { - "version": "1.0.1", - "dev": true - }, - "caller-callsite": { - "version": "2.0.0", - "dev": true, - "requires": { - "callsites": "^2.0.0" - }, - "dependencies": { - "callsites": { - "version": "2.0.0", - "dev": true - } - } - }, - "caller-path": { - "version": "2.0.0", - "dev": true, - "requires": { - "caller-callsite": "^2.0.0" - } - }, - "callsites": { - "version": "3.1.0", - "dev": true - }, - "camelcase": { - "version": "5.3.1", - "dev": true - }, - "camelcase-keys": { - "version": "6.2.2", - "dev": true, - "requires": { - "camelcase": "^5.3.1", - "map-obj": "^4.0.0", - "quick-lru": "^4.0.1" - } - }, - "caniuse-lite": { - "version": "1.0.30001200", - "dev": true - }, - "capture-exit": { - "version": "2.0.0", - "dev": true, - "requires": { - "rsvp": "^4.8.4" - } - }, - "caseless": { - "version": "0.12.0", - "dev": true - }, - "chalk": { - "version": "4.1.0", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "chardet": { - "version": "0.7.0", - "dev": true - }, - "chokidar": { - "version": "3.5.1", - "dev": true, - "requires": { - "anymatch": "~3.1.1", - "braces": "~3.0.2", - "fsevents": "~2.3.1", - "glob-parent": "~5.1.0", - "is-binary-path": "~2.1.0", - "is-glob": "~4.0.1", - "normalize-path": "~3.0.0", - "readdirp": "~3.5.0" - }, - "dependencies": { - "anymatch": { - "version": "3.1.1", - "dev": true, - "requires": { - "normalize-path": "^3.0.0", - "picomatch": "^2.0.4" - } - }, - "braces": { - "version": "3.0.2", - "dev": true, - "requires": { - "fill-range": "^7.0.1" - } - }, - "fill-range": { - "version": "7.0.1", - "dev": true, - "requires": { - "to-regex-range": "^5.0.1" - } - }, - "fsevents": { - "version": "2.3.2", - "dev": true, - "optional": true - }, - "is-number": { - "version": "7.0.0", - "dev": true - }, - "normalize-path": { - "version": "3.0.0", - "dev": true - }, - "to-regex-range": { - "version": "5.0.1", - "dev": true, - "requires": { - "is-number": "^7.0.0" - } - } - } - }, - "chownr": { - "version": "1.1.4", - "dev": true - }, - "ci-info": { - "version": "2.0.0", - "dev": true - }, - "class-utils": { - "version": "0.3.6", - "dev": true, - "requires": { - "arr-union": "^3.1.0", - "define-property": "^0.2.5", - "isobject": "^3.0.0", - "static-extend": "^0.1.1" - }, - "dependencies": { - "define-property": { - "version": "0.2.5", - "dev": true, - "requires": { - "is-descriptor": "^0.1.0" - } - }, - "is-accessor-descriptor": { - "version": "0.1.6", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "is-data-descriptor": { - "version": "0.1.4", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "is-descriptor": { - "version": "0.1.6", - "dev": true, - "requires": { - "is-accessor-descriptor": "^0.1.6", - "is-data-descriptor": "^0.1.4", - "kind-of": "^5.0.0" - } - }, - "kind-of": { - "version": "5.1.0", - "dev": true - } - } - }, - "cli-cursor": { - "version": "3.1.0", - "dev": true, - "requires": { - "restore-cursor": "^3.1.0" - } - }, - "cli-width": { - "version": "3.0.0", - "dev": true - }, - "cliui": { - "version": "5.0.0", - "dev": true, - "requires": { - "string-width": "^3.1.0", - "strip-ansi": "^5.2.0", - "wrap-ansi": "^5.1.0" - }, - "dependencies": { - "emoji-regex": { - "version": "7.0.3", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "dev": true - }, - "string-width": { - "version": "3.1.0", - "dev": true, - "requires": { - "emoji-regex": "^7.0.1", - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.1.0" - } - } - } - }, - "clone": { - "version": "1.0.4", - "dev": true - }, - "clone-deep": { - "version": "4.0.1", - "dev": true, - "requires": { - "is-plain-object": "^2.0.4", - "kind-of": "^6.0.2", - "shallow-clone": "^3.0.0" - }, - "dependencies": { - "is-plain-object": { - "version": "2.0.4", - "dev": true, - "requires": { - "isobject": "^3.0.1" - } - } - } - }, - "co": { - "version": "4.6.0", - "dev": true - }, - "code-point-at": { - "version": "1.1.0", - "dev": true - }, - "collection-visit": { - "version": "1.0.0", - "dev": true, - "requires": { - "map-visit": "^1.0.0", - "object-visit": "^1.0.0" - } - }, - "color-convert": { - "version": "2.0.1", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "dev": true - }, - "colorette": { - "version": "1.2.2", - "dev": true - }, - "colors": { - "version": "1.2.5", - "dev": true - }, - "columnify": { - "version": "1.5.4", - "dev": true, - "requires": { - "strip-ansi": "^3.0.0", - "wcwidth": "^1.0.0" - }, - "dependencies": { - "ansi-regex": { - "version": "2.1.1", - "dev": true - }, - "strip-ansi": { - "version": "3.0.1", - "dev": true, - "requires": { - "ansi-regex": "^2.0.0" - } - } - } - }, - "combined-stream": { - "version": "1.0.8", - "dev": true, - "requires": { - "delayed-stream": "~1.0.0" - } - }, - "commander": { - "version": "2.20.3", - "dev": true - }, - "commondir": { - "version": "1.0.1", - "dev": true - }, - "compare-func": { - "version": "2.0.0", - "dev": true, - "requires": { - "array-ify": "^1.0.0", - "dot-prop": "^5.1.0" - }, - "dependencies": { - "dot-prop": { - "version": "5.3.0", - "dev": true, - "requires": { - "is-obj": "^2.0.0" - } - }, - "is-obj": { - "version": "2.0.0", - "dev": true - } - } - }, - "component-emitter": { - "version": "1.3.0", - "dev": true - }, - "concat-map": { - "version": "0.0.1", - "dev": true - }, - "concat-stream": { - "version": "2.0.0", - "dev": true, - "requires": { - "buffer-from": "^1.0.0", - "inherits": "^2.0.3", - "readable-stream": "^3.0.2", - "typedarray": "^0.0.6" - } - }, - "config-chain": { - "version": "1.1.12", - "dev": true, - "requires": { - "ini": "^1.3.4", - "proto-list": "~1.2.1" - } - }, - "console-control-strings": { - "version": "1.1.0", - "dev": true - }, - "conventional-changelog-angular": { - "version": "5.0.12", - "dev": true, - "requires": { - "compare-func": "^2.0.0", - "q": "^1.5.1" - } - }, - "conventional-changelog-core": { - "version": "3.2.3", - "dev": true, - "requires": { - "conventional-changelog-writer": "^4.0.6", - "conventional-commits-parser": "^3.0.3", - "dateformat": "^3.0.0", - "get-pkg-repo": "^1.0.0", - "git-raw-commits": "2.0.0", - "git-remote-origin-url": "^2.0.0", - "git-semver-tags": "^2.0.3", - "lodash": "^4.2.1", - "normalize-package-data": "^2.3.5", - "q": "^1.5.1", - "read-pkg": "^3.0.0", - "read-pkg-up": "^3.0.0", - "through2": "^3.0.0" - } - }, - "conventional-changelog-preset-loader": { - "version": "2.3.4", - "dev": true - }, - "conventional-changelog-writer": { - "version": "4.1.0", - "dev": true, - "requires": { - "compare-func": "^2.0.0", - "conventional-commits-filter": "^2.0.7", - "dateformat": "^3.0.0", - "handlebars": "^4.7.6", - "json-stringify-safe": "^5.0.1", - "lodash": "^4.17.15", - "meow": "^8.0.0", - "semver": "^6.0.0", - "split": "^1.0.0", - "through2": "^4.0.0" - }, - "dependencies": { - "semver": { - "version": "6.3.0", - "dev": true - }, - "through2": { - "version": "4.0.2", - "dev": true, - "requires": { - "readable-stream": "3" - } - } - } - }, - "conventional-commits-filter": { - "version": "2.0.7", - "dev": true, - "requires": { - "lodash.ismatch": "^4.4.0", - "modify-values": "^1.0.0" - } - }, - "conventional-commits-parser": { - "version": "3.2.1", - "dev": true, - "requires": { - "is-text-path": "^1.0.1", - "JSONStream": "^1.0.4", - "lodash": "^4.17.15", - "meow": "^8.0.0", - "split2": "^3.0.0", - "through2": "^4.0.0", - "trim-off-newlines": "^1.0.0" - }, - "dependencies": { - "through2": { - "version": "4.0.2", - "dev": true, - "requires": { - "readable-stream": "3" - } - } - } - }, - "conventional-recommended-bump": { - "version": "5.0.1", - "dev": true, - "requires": { - "concat-stream": "^2.0.0", - "conventional-changelog-preset-loader": "^2.1.1", - "conventional-commits-filter": "^2.0.2", - "conventional-commits-parser": "^3.0.3", - "git-raw-commits": "2.0.0", - "git-semver-tags": "^2.0.3", - "meow": "^4.0.0", - "q": "^1.5.1" - }, - "dependencies": { - "camelcase": { - "version": "4.1.0", - "dev": true - }, - "camelcase-keys": { - "version": "4.2.0", - "dev": true, - "requires": { - "camelcase": "^4.1.0", - "map-obj": "^2.0.0", - "quick-lru": "^1.0.0" - } - }, - "indent-string": { - "version": "3.2.0", - "dev": true - }, - "map-obj": { - "version": "2.0.0", - "dev": true - }, - "meow": { - "version": "4.0.1", - "dev": true, - "requires": { - "camelcase-keys": "^4.0.0", - "decamelize-keys": "^1.0.0", - "loud-rejection": "^1.0.0", - "minimist": "^1.1.3", - "minimist-options": "^3.0.1", - "normalize-package-data": "^2.3.4", - "read-pkg-up": "^3.0.0", - "redent": "^2.0.0", - "trim-newlines": "^2.0.0" - } - }, - "minimist-options": { - "version": "3.0.2", - "dev": true, - "requires": { - "arrify": "^1.0.1", - "is-plain-obj": "^1.1.0" - } - }, - "quick-lru": { - "version": "1.1.0", - "dev": true - }, - "redent": { - "version": "2.0.0", - "dev": true, - "requires": { - "indent-string": "^3.0.0", - "strip-indent": "^2.0.0" - } - }, - "strip-indent": { - "version": "2.0.0", - "dev": true - }, - "trim-newlines": { - "version": "2.0.0", - "dev": true - } - } - }, - "convert-source-map": { - "version": "1.7.0", - "dev": true, - "requires": { - "safe-buffer": "~5.1.1" - } - }, - "copy-concurrently": { - "version": "1.0.5", - "dev": true, - "requires": { - "aproba": "^1.1.1", - "fs-write-stream-atomic": "^1.0.8", - "iferr": "^0.1.5", - "mkdirp": "^0.5.1", - "rimraf": "^2.5.4", - "run-queue": "^1.0.0" - }, - "dependencies": { - "aproba": { - "version": "1.2.0", - "dev": true - } - } - }, - "copy-descriptor": { - "version": "0.1.1", - "dev": true - }, - "core-js": { - "version": "3.16.0", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.16.0.tgz", - "integrity": "sha512-5+5VxRFmSf97nM8Jr2wzOwLqRo6zphH2aX+7KsAUONObyzakDNq2G/bgbhinxB4PoV9L3aXQYhiDKyIKWd2c8g==" - }, - "core-util-is": { - "version": "1.0.2", - "dev": true - }, - "corser": { - "version": "2.0.1", - "dev": true - }, - "cosmiconfig": { - "version": "5.2.1", - "dev": true, - "requires": { - "import-fresh": "^2.0.0", - "is-directory": "^0.3.1", - "js-yaml": "^3.13.1", - "parse-json": "^4.0.0" - }, - "dependencies": { - "import-fresh": { - "version": "2.0.0", - "dev": true, - "requires": { - "caller-path": "^2.0.0", - "resolve-from": "^3.0.0" - } - }, - "resolve-from": { - "version": "3.0.0", - "dev": true - } - } - }, - "cross-spawn": { - "version": "6.0.5", - "dev": true, - "requires": { - "nice-try": "^1.0.4", - "path-key": "^2.0.1", - "semver": "^5.5.0", - "shebang-command": "^1.2.0", - "which": "^1.2.9" - }, - "dependencies": { - "semver": { - "version": "5.7.1", - "dev": true - } - } - }, - "cssom": { - "version": "0.3.8", - "dev": true - }, - "cssstyle": { - "version": "1.4.0", - "dev": true, - "requires": { - "cssom": "0.3.x" - } - }, - "currently-unhandled": { - "version": "0.4.1", - "dev": true, - "requires": { - "array-find-index": "^1.0.1" - } - }, - "cyclist": { - "version": "1.0.1", - "dev": true - }, - "dargs": { - "version": "4.1.0", - "dev": true, - "requires": { - "number-is-nan": "^1.0.0" - } - }, - "dashdash": { - "version": "1.14.1", - "dev": true, - "requires": { - "assert-plus": "^1.0.0" - } - }, - "data-urls": { - "version": "1.1.0", - "dev": true, - "requires": { - "abab": "^2.0.0", - "whatwg-mimetype": "^2.2.0", - "whatwg-url": "^7.0.0" - }, - "dependencies": { - "whatwg-url": { - "version": "7.1.0", - "dev": true, - "requires": { - "lodash.sortby": "^4.7.0", - "tr46": "^1.0.1", - "webidl-conversions": "^4.0.2" - } - } - } - }, - "dateformat": { - "version": "3.0.3", - "dev": true - }, - "debug": { - "version": "4.3.1", - "dev": true, - "requires": { - "ms": "2.1.2" - } - }, - "debuglog": { - "version": "1.0.1", - "dev": true - }, - "decamelize": { - "version": "1.2.0", - "dev": true - }, - "decamelize-keys": { - "version": "1.1.0", - "dev": true, - "requires": { - "decamelize": "^1.1.0", - "map-obj": "^1.0.0" - }, - "dependencies": { - "map-obj": { - "version": "1.0.1", - "dev": true - } - } - }, - "decode-uri-component": { - "version": "0.2.0", - "dev": true - }, - "dedent": { - "version": "0.7.0", - "dev": true - }, - "deep-is": { - "version": "0.1.3", - "dev": true - }, - "deepmerge": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.2.2.tgz", - "integrity": "sha512-FJ3UgI4gIl+PHZm53knsuSFpE+nESMr7M4v9QcgB7S63Kj/6WqMiFQJpBBYz1Pt+66bZpP3Q7Lye0Oo9MPKEdg==", - "dev": true - }, - "defaults": { - "version": "1.0.3", - "dev": true, - "requires": { - "clone": "^1.0.2" - } - }, - "define-properties": { - "version": "1.1.3", - "dev": true, - "requires": { - "object-keys": "^1.0.12" - } - }, - "define-property": { - "version": "2.0.2", - "dev": true, - "requires": { - "is-descriptor": "^1.0.2", - "isobject": "^3.0.1" - } - }, - "delayed-stream": { - "version": "1.0.0", - "dev": true - }, - "delegates": { - "version": "1.0.0", - "dev": true - }, - "deprecation": { - "version": "2.3.1", - "dev": true - }, - "detect-indent": { - "version": "5.0.0", - "dev": true - }, - "detect-newline": { - "version": "2.1.0", - "dev": true - }, - "dezalgo": { - "version": "1.0.3", - "dev": true, - "requires": { - "asap": "^2.0.0", - "wrappy": "1" - } - }, - "diff": { - "version": "3.5.0", - "dev": true - }, - "diff-sequences": { - "version": "24.9.0", - "dev": true - }, - "dir-glob": { - "version": "2.2.2", - "dev": true, - "requires": { - "path-type": "^3.0.0" - } - }, - "doctrine": { - "version": "3.0.0", - "dev": true, - "requires": { - "esutils": "^2.0.2" - } - }, - "dom-walk": { - "version": "0.1.2" - }, - "domexception": { - "version": "1.0.1", - "dev": true, - "requires": { - "webidl-conversions": "^4.0.2" - } - }, - "dot-prop": { - "version": "4.2.1", - "dev": true, - "requires": { - "is-obj": "^1.0.0" - } - }, - "duplexer": { - "version": "0.1.2", - "dev": true - }, - "duplexify": { - "version": "3.7.1", - "dev": true, - "requires": { - "end-of-stream": "^1.0.0", - "inherits": "^2.0.1", - "readable-stream": "^2.0.0", - "stream-shift": "^1.0.0" - }, - "dependencies": { - "isarray": { - "version": "1.0.0", - "dev": true - }, - "readable-stream": { - "version": "2.3.7", - "dev": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "string_decoder": { - "version": "1.1.1", - "dev": true, - "requires": { - "safe-buffer": "~5.1.0" - } - } - } - }, - "earcut": { - "version": "2.2.2" - }, - "ecc-jsbn": { - "version": "0.1.2", - "dev": true, - "requires": { - "jsbn": "~0.1.0", - "safer-buffer": "^2.1.0" - } - }, - "ecstatic": { - "version": "3.3.2", - "dev": true, - "requires": { - "he": "^1.1.1", - "mime": "^1.6.0", - "minimist": "^1.1.0", - "url-join": "^2.0.5" - } - }, - "electron-to-chromium": { - "version": "1.3.687", - "dev": true - }, - "emoji-regex": { - "version": "8.0.0", - "dev": true - }, - "encoding": { - "version": "0.1.13", - "dev": true, - "requires": { - "iconv-lite": "^0.6.2" - }, - "dependencies": { - "iconv-lite": { - "version": "0.6.2", - "dev": true, - "requires": { - "safer-buffer": ">= 2.1.2 < 3.0.0" - } - } - } - }, - "end-of-stream": { - "version": "1.4.4", - "dev": true, - "requires": { - "once": "^1.4.0" - } - }, - "enquirer": { - "version": "2.3.6", - "dev": true, - "requires": { - "ansi-colors": "^4.1.1" - } - }, - "env-paths": { - "version": "2.2.1", - "dev": true - }, - "envinfo": { - "version": "7.7.4", - "dev": true - }, - "err-code": { - "version": "1.1.2", - "dev": true - }, - "error-ex": { - "version": "1.3.2", - "dev": true, - "requires": { - "is-arrayish": "^0.2.1" - } - }, - "es-abstract": { - "version": "1.18.0", - "dev": true, - "requires": { - "call-bind": "^1.0.2", - "es-to-primitive": "^1.2.1", - "function-bind": "^1.1.1", - "get-intrinsic": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.2", - "is-callable": "^1.2.3", - "is-negative-zero": "^2.0.1", - "is-regex": "^1.1.2", - "is-string": "^1.0.5", - "object-inspect": "^1.9.0", - "object-keys": "^1.1.1", - "object.assign": "^4.1.2", - "string.prototype.trimend": "^1.0.4", - "string.prototype.trimstart": "^1.0.4", - "unbox-primitive": "^1.0.0" - } - }, - "es-to-primitive": { - "version": "1.2.1", - "dev": true, - "requires": { - "is-callable": "^1.1.4", - "is-date-object": "^1.0.1", - "is-symbol": "^1.0.2" - } - }, - "es6-promise": { - "version": "4.2.8", - "dev": true - }, - "es6-promisify": { - "version": "5.0.0", - "dev": true, - "requires": { - "es6-promise": "^4.0.3" - } - }, - "escalade": { - "version": "3.1.1", - "dev": true - }, - "escape-string-regexp": { - "version": "1.0.5", - "dev": true - }, - "escodegen": { - "version": "1.14.3", - "dev": true, - "requires": { - "esprima": "^4.0.1", - "estraverse": "^4.2.0", - "esutils": "^2.0.2", - "optionator": "^0.8.1", - "source-map": "~0.6.1" - } - }, - "eslint": { - "version": "6.8.0", - "dev": true, - "requires": { - "@babel/code-frame": "^7.0.0", - "ajv": "^6.10.0", - "chalk": "^2.1.0", - "cross-spawn": "^6.0.5", - "debug": "^4.0.1", - "doctrine": "^3.0.0", - "eslint-scope": "^5.0.0", - "eslint-utils": "^1.4.3", - "eslint-visitor-keys": "^1.1.0", - "espree": "^6.1.2", - "esquery": "^1.0.1", - "esutils": "^2.0.2", - "file-entry-cache": "^5.0.1", - "functional-red-black-tree": "^1.0.1", - "glob-parent": "^5.0.0", - "globals": "^12.1.0", - "ignore": "^4.0.6", - "import-fresh": "^3.0.0", - "imurmurhash": "^0.1.4", - "inquirer": "^7.0.0", - "is-glob": "^4.0.0", - "js-yaml": "^3.13.1", - "json-stable-stringify-without-jsonify": "^1.0.1", - "levn": "^0.3.0", - "lodash": "^4.17.14", - "minimatch": "^3.0.4", - "mkdirp": "^0.5.1", - "natural-compare": "^1.4.0", - "optionator": "^0.8.3", - "progress": "^2.0.0", - "regexpp": "^2.0.1", - "semver": "^6.1.2", - "strip-ansi": "^5.2.0", - "strip-json-comments": "^3.0.1", - "table": "^5.2.3", - "text-table": "^0.2.0", - "v8-compile-cache": "^2.0.3" - }, - "dependencies": { - "ansi-styles": { - "version": "3.2.1", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "chalk": { - "version": "2.4.2", - "dev": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "color-convert": { - "version": "1.9.3", - "dev": true, - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "dev": true - }, - "eslint-scope": { - "version": "5.1.1", - "dev": true, - "requires": { - "esrecurse": "^4.3.0", - "estraverse": "^4.1.1" - } - }, - "has-flag": { - "version": "3.0.0", - "dev": true - }, - "semver": { - "version": "6.3.0", - "dev": true - }, - "supports-color": { - "version": "5.5.0", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - } - } - }, - "eslint-config-prettier": { - "version": "6.15.0", - "dev": true, - "requires": { - "get-stdin": "^6.0.0" - } - }, - "eslint-plugin-prettier": { - "version": "3.3.1", - "dev": true, - "requires": { - "prettier-linter-helpers": "^1.0.0" - } - }, - "eslint-scope": { - "version": "4.0.3", - "dev": true, - "requires": { - "esrecurse": "^4.1.0", - "estraverse": "^4.1.1" - } - }, - "eslint-utils": { - "version": "1.4.3", - "dev": true, - "requires": { - "eslint-visitor-keys": "^1.1.0" - } - }, - "eslint-visitor-keys": { - "version": "1.3.0", - "dev": true - }, - "espree": { - "version": "6.2.1", - "dev": true, - "requires": { - "acorn": "^7.1.1", - "acorn-jsx": "^5.2.0", - "eslint-visitor-keys": "^1.1.0" - } - }, - "esprima": { - "version": "4.0.1", - "dev": true - }, - "esquery": { - "version": "1.4.0", - "dev": true, - "requires": { - "estraverse": "^5.1.0" - }, - "dependencies": { - "estraverse": { - "version": "5.2.0", - "dev": true - } - } - }, - "esrecurse": { - "version": "4.3.0", - "dev": true, - "requires": { - "estraverse": "^5.2.0" - }, - "dependencies": { - "estraverse": { - "version": "5.2.0", - "dev": true - } - } - }, - "estraverse": { - "version": "4.3.0", - "dev": true - }, - "estree-walker": { - "version": "2.0.2", - "dev": true - }, - "esutils": { - "version": "2.0.3", - "dev": true - }, - "eventemitter3": { - "version": "4.0.7" - }, - "exec-sh": { - "version": "0.3.4", - "dev": true - }, - "execa": { - "version": "4.1.0", - "dev": true, - "requires": { - "cross-spawn": "^7.0.0", - "get-stream": "^5.0.0", - "human-signals": "^1.1.1", - "is-stream": "^2.0.0", - "merge-stream": "^2.0.0", - "npm-run-path": "^4.0.0", - "onetime": "^5.1.0", - "signal-exit": "^3.0.2", - "strip-final-newline": "^2.0.0" - }, - "dependencies": { - "cross-spawn": { - "version": "7.0.3", - "dev": true, - "requires": { - "path-key": "^3.1.0", - "shebang-command": "^2.0.0", - "which": "^2.0.1" - } - }, - "path-key": { - "version": "3.1.1", - "dev": true - }, - "shebang-command": { - "version": "2.0.0", - "dev": true, - "requires": { - "shebang-regex": "^3.0.0" - } - }, - "shebang-regex": { - "version": "3.0.0", - "dev": true - }, - "which": { - "version": "2.0.2", - "dev": true, - "requires": { - "isexe": "^2.0.0" - } - } - } - }, - "exit": { - "version": "0.1.2", - "dev": true - }, - "expand-brackets": { - "version": "2.1.4", - "dev": true, - "requires": { - "debug": "^2.3.3", - "define-property": "^0.2.5", - "extend-shallow": "^2.0.1", - "posix-character-classes": "^0.1.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.1" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "define-property": { - "version": "0.2.5", - "dev": true, - "requires": { - "is-descriptor": "^0.1.0" - } - }, - "extend-shallow": { - "version": "2.0.1", - "dev": true, - "requires": { - "is-extendable": "^0.1.0" - } - }, - "is-accessor-descriptor": { - "version": "0.1.6", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "is-data-descriptor": { - "version": "0.1.4", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "is-descriptor": { - "version": "0.1.6", - "dev": true, - "requires": { - "is-accessor-descriptor": "^0.1.6", - "is-data-descriptor": "^0.1.4", - "kind-of": "^5.0.0" - } - }, - "is-extendable": { - "version": "0.1.1", - "dev": true - }, - "kind-of": { - "version": "5.1.0", - "dev": true - }, - "ms": { - "version": "2.0.0", - "dev": true - } - } - }, - "expand-range": { - "version": "1.8.2", - "dev": true, - "requires": { - "fill-range": "^2.1.0" - }, - "dependencies": { - "fill-range": { - "version": "2.2.4", - "dev": true, - "requires": { - "is-number": "^2.1.0", - "isobject": "^2.0.0", - "randomatic": "^3.0.0", - "repeat-element": "^1.1.2", - "repeat-string": "^1.5.2" - } - }, - "is-number": { - "version": "2.1.0", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - } - }, - "isarray": { - "version": "1.0.0", - "dev": true - }, - "isobject": { - "version": "2.1.0", - "dev": true, - "requires": { - "isarray": "1.0.0" - } - }, - "kind-of": { - "version": "3.2.2", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "expect": { - "version": "24.9.0", - "dev": true, - "requires": { - "@jest/types": "^24.9.0", - "ansi-styles": "^3.2.0", - "jest-get-type": "^24.9.0", - "jest-matcher-utils": "^24.9.0", - "jest-message-util": "^24.9.0", - "jest-regex-util": "^24.9.0" - }, - "dependencies": { - "ansi-styles": { - "version": "3.2.1", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "color-convert": { - "version": "1.9.3", - "dev": true, - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "dev": true - } - } - }, - "extend": { - "version": "3.0.2", - "dev": true - }, - "extend-shallow": { - "version": "3.0.2", - "dev": true, - "requires": { - "assign-symbols": "^1.0.0", - "is-extendable": "^1.0.1" - } - }, - "external-editor": { - "version": "3.1.0", - "dev": true, - "requires": { - "chardet": "^0.7.0", - "iconv-lite": "^0.4.24", - "tmp": "^0.0.33" - } - }, - "extglob": { - "version": "2.0.4", - "dev": true, - "requires": { - "array-unique": "^0.3.2", - "define-property": "^1.0.0", - "expand-brackets": "^2.1.4", - "extend-shallow": "^2.0.1", - "fragment-cache": "^0.2.1", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.1" - }, - "dependencies": { - "define-property": { - "version": "1.0.0", - "dev": true, - "requires": { - "is-descriptor": "^1.0.0" - } - }, - "extend-shallow": { - "version": "2.0.1", - "dev": true, - "requires": { - "is-extendable": "^0.1.0" - } - }, - "is-extendable": { - "version": "0.1.1", - "dev": true - } - } - }, - "extsprintf": { - "version": "1.3.0", - "dev": true - }, - "fast-deep-equal": { - "version": "3.1.3", - "dev": true - }, - "fast-diff": { - "version": "1.2.0", - "dev": true - }, - "fast-glob": { - "version": "2.2.7", - "dev": true, - "requires": { - "@mrmlnc/readdir-enhanced": "^2.2.1", - "@nodelib/fs.stat": "^1.1.2", - "glob-parent": "^3.1.0", - "is-glob": "^4.0.0", - "merge2": "^1.2.3", - "micromatch": "^3.1.10" - }, - "dependencies": { - "glob-parent": { - "version": "3.1.0", - "dev": true, - "requires": { - "is-glob": "^3.1.0", - "path-dirname": "^1.0.0" - }, - "dependencies": { - "is-glob": { - "version": "3.1.0", - "dev": true, - "requires": { - "is-extglob": "^2.1.0" - } - } - } - } - } - }, - "fast-json-stable-stringify": { - "version": "2.1.0", - "dev": true - }, - "fast-levenshtein": { - "version": "2.0.6", - "dev": true - }, - "fastq": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.11.0.tgz", - "integrity": "sha512-7Eczs8gIPDrVzT+EksYBcupqMyxSHXXrHOLRRxU2/DicV8789MRBRR8+Hc2uWzUupOs4YS4JzBmBxjjCVBxD/g==", - "dev": true, - "requires": { - "reusify": "^1.0.4" - } - }, - "fb-watchman": { - "version": "2.0.1", - "dev": true, - "requires": { - "bser": "2.1.1" - } - }, - "figgy-pudding": { - "version": "3.5.2", - "dev": true - }, - "figures": { - "version": "3.2.0", - "dev": true, - "requires": { - "escape-string-regexp": "^1.0.5" - } - }, - "file-entry-cache": { - "version": "5.0.1", - "dev": true, - "requires": { - "flat-cache": "^2.0.1" - } - }, - "file-uri-to-path": { - "version": "1.0.0", - "dev": true, - "optional": true - }, - "filename-regex": { - "version": "2.0.1", - "dev": true - }, - "fill-range": { - "version": "4.0.0", - "dev": true, - "requires": { - "extend-shallow": "^2.0.1", - "is-number": "^3.0.0", - "repeat-string": "^1.6.1", - "to-regex-range": "^2.1.0" - }, - "dependencies": { - "extend-shallow": { - "version": "2.0.1", - "dev": true, - "requires": { - "is-extendable": "^0.1.0" - } - }, - "is-extendable": { - "version": "0.1.1", - "dev": true - } - } - }, - "filter-obj": { - "version": "1.1.0", - "dev": true - }, - "find-cache-dir": { - "version": "3.3.1", - "dev": true, - "requires": { - "commondir": "^1.0.1", - "make-dir": "^3.0.2", - "pkg-dir": "^4.1.0" - }, - "dependencies": { - "find-up": { - "version": "4.1.0", - "dev": true, - "requires": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" - } - }, - "locate-path": { - "version": "5.0.0", - "dev": true, - "requires": { - "p-locate": "^4.1.0" - } - }, - "make-dir": { - "version": "3.1.0", - "dev": true, - "requires": { - "semver": "^6.0.0" - } - }, - "p-locate": { - "version": "4.1.0", - "dev": true, - "requires": { - "p-limit": "^2.2.0" - } - }, - "path-exists": { - "version": "4.0.0", - "dev": true - }, - "pkg-dir": { - "version": "4.2.0", - "dev": true, - "requires": { - "find-up": "^4.0.0" - } - }, - "semver": { - "version": "6.3.0", - "dev": true - } - } - }, - "find-up": { - "version": "3.0.0", - "dev": true, - "requires": { - "locate-path": "^3.0.0" - } - }, - "flat-cache": { - "version": "2.0.1", - "dev": true, - "requires": { - "flatted": "^2.0.0", - "rimraf": "2.6.3", - "write": "1.0.3" - } - }, - "flatted": { - "version": "2.0.2", - "dev": true - }, - "flush-write-stream": { - "version": "1.1.1", - "dev": true, - "requires": { - "inherits": "^2.0.3", - "readable-stream": "^2.3.6" - }, - "dependencies": { - "isarray": { - "version": "1.0.0", - "dev": true - }, - "readable-stream": { - "version": "2.3.7", - "dev": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "string_decoder": { - "version": "1.1.1", - "dev": true, - "requires": { - "safe-buffer": "~5.1.0" - } - } - } - }, - "follow-redirects": { - "version": "1.13.3", - "dev": true - }, - "for-each": { - "version": "0.3.3", - "dev": true, - "requires": { - "is-callable": "^1.1.3" - } - }, - "for-in": { - "version": "1.0.2", - "dev": true - }, - "for-own": { - "version": "0.1.5", - "dev": true, - "requires": { - "for-in": "^1.0.1" - } - }, - "forever-agent": { - "version": "0.6.1", - "dev": true - }, - "form-data": { - "version": "2.3.3", - "dev": true, - "requires": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.6", - "mime-types": "^2.1.12" - } - }, - "fragment-cache": { - "version": "0.2.1", - "dev": true, - "requires": { - "map-cache": "^0.2.2" - } - }, - "from2": { - "version": "2.3.0", - "dev": true, - "requires": { - "inherits": "^2.0.1", - "readable-stream": "^2.0.0" - }, - "dependencies": { - "isarray": { - "version": "1.0.0", - "dev": true - }, - "readable-stream": { - "version": "2.3.7", - "dev": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "string_decoder": { - "version": "1.1.1", - "dev": true, - "requires": { - "safe-buffer": "~5.1.0" - } - } - } - }, - "fs-extra": { - "version": "9.1.0", - "dev": true, - "requires": { - "at-least-node": "^1.0.0", - "graceful-fs": "^4.2.0", - "jsonfile": "^6.0.1", - "universalify": "^2.0.0" - } - }, - "fs-minipass": { - "version": "1.2.7", - "dev": true, - "requires": { - "minipass": "^2.6.0" - } - }, - "fs-write-stream-atomic": { - "version": "1.0.10", - "dev": true, - "requires": { - "graceful-fs": "^4.1.2", - "iferr": "^0.1.5", - "imurmurhash": "^0.1.4", - "readable-stream": "1 || 2" - }, - "dependencies": { - "isarray": { - "version": "1.0.0", - "dev": true - }, - "readable-stream": { - "version": "2.3.7", - "dev": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "string_decoder": { - "version": "1.1.1", - "dev": true, - "requires": { - "safe-buffer": "~5.1.0" - } - } - } - }, - "fs.realpath": { - "version": "1.0.0", - "dev": true - }, - "fsevents": { - "version": "1.2.13", - "dev": true, - "optional": true, - "requires": { - "bindings": "^1.5.0", - "nan": "^2.12.1" - } - }, - "function-bind": { - "version": "1.1.1", - "dev": true - }, - "functional-red-black-tree": { - "version": "1.0.1", - "dev": true - }, - "gauge": { - "version": "2.7.4", - "dev": true, - "requires": { - "aproba": "^1.0.3", - "console-control-strings": "^1.0.0", - "has-unicode": "^2.0.0", - "object-assign": "^4.1.0", - "signal-exit": "^3.0.0", - "string-width": "^1.0.1", - "strip-ansi": "^3.0.1", - "wide-align": "^1.1.0" - }, - "dependencies": { - "ansi-regex": { - "version": "2.1.1", - "dev": true - }, - "aproba": { - "version": "1.2.0", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "1.0.0", - "dev": true, - "requires": { - "number-is-nan": "^1.0.0" - } - }, - "string-width": { - "version": "1.0.2", - "dev": true, - "requires": { - "code-point-at": "^1.0.0", - "is-fullwidth-code-point": "^1.0.0", - "strip-ansi": "^3.0.0" - } - }, - "strip-ansi": { - "version": "3.0.1", - "dev": true, - "requires": { - "ansi-regex": "^2.0.0" - } - } - } - }, - "genfun": { - "version": "5.0.0", - "dev": true - }, - "gensync": { - "version": "1.0.0-beta.2", - "dev": true - }, - "get-caller-file": { - "version": "2.0.5", - "dev": true - }, - "get-intrinsic": { - "version": "1.1.1", - "dev": true, - "requires": { - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.1" - } - }, - "get-pkg-repo": { - "version": "1.4.0", - "dev": true, - "requires": { - "hosted-git-info": "^2.1.4", - "meow": "^3.3.0", - "normalize-package-data": "^2.3.0", - "parse-github-repo-url": "^1.3.0", - "through2": "^2.0.0" - }, - "dependencies": { - "camelcase": { - "version": "2.1.1", - "dev": true - }, - "camelcase-keys": { - "version": "2.1.0", - "dev": true, - "requires": { - "camelcase": "^2.0.0", - "map-obj": "^1.0.0" - } - }, - "find-up": { - "version": "1.1.2", - "dev": true, - "requires": { - "path-exists": "^2.0.0", - "pinkie-promise": "^2.0.0" - } - }, - "get-stdin": { - "version": "4.0.1", - "dev": true - }, - "indent-string": { - "version": "2.1.0", - "dev": true, - "requires": { - "repeating": "^2.0.0" - } - }, - "isarray": { - "version": "1.0.0", - "dev": true - }, - "load-json-file": { - "version": "1.1.0", - "dev": true, - "requires": { - "graceful-fs": "^4.1.2", - "parse-json": "^2.2.0", - "pify": "^2.0.0", - "pinkie-promise": "^2.0.0", - "strip-bom": "^2.0.0" - } - }, - "map-obj": { - "version": "1.0.1", - "dev": true - }, - "meow": { - "version": "3.7.0", - "dev": true, - "requires": { - "camelcase-keys": "^2.0.0", - "decamelize": "^1.1.2", - "loud-rejection": "^1.0.0", - "map-obj": "^1.0.1", - "minimist": "^1.1.3", - "normalize-package-data": "^2.3.4", - "object-assign": "^4.0.1", - "read-pkg-up": "^1.0.1", - "redent": "^1.0.0", - "trim-newlines": "^1.0.0" - } - }, - "parse-json": { - "version": "2.2.0", - "dev": true, - "requires": { - "error-ex": "^1.2.0" - } - }, - "path-exists": { - "version": "2.1.0", - "dev": true, - "requires": { - "pinkie-promise": "^2.0.0" - } - }, - "path-type": { - "version": "1.1.0", - "dev": true, - "requires": { - "graceful-fs": "^4.1.2", - "pify": "^2.0.0", - "pinkie-promise": "^2.0.0" - } - }, - "pify": { - "version": "2.3.0", - "dev": true - }, - "read-pkg": { - "version": "1.1.0", - "dev": true, - "requires": { - "load-json-file": "^1.0.0", - "normalize-package-data": "^2.3.2", - "path-type": "^1.0.0" - } - }, - "read-pkg-up": { - "version": "1.0.1", - "dev": true, - "requires": { - "find-up": "^1.0.0", - "read-pkg": "^1.0.0" - } - }, - "readable-stream": { - "version": "2.3.7", - "dev": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "redent": { - "version": "1.0.0", - "dev": true, - "requires": { - "indent-string": "^2.1.0", - "strip-indent": "^1.0.1" - } - }, - "string_decoder": { - "version": "1.1.1", - "dev": true, - "requires": { - "safe-buffer": "~5.1.0" - } - }, - "strip-bom": { - "version": "2.0.0", - "dev": true, - "requires": { - "is-utf8": "^0.2.0" - } - }, - "strip-indent": { - "version": "1.0.1", - "dev": true, - "requires": { - "get-stdin": "^4.0.1" - } - }, - "through2": { - "version": "2.0.5", - "dev": true, - "requires": { - "readable-stream": "~2.3.6", - "xtend": "~4.0.1" - } - }, - "trim-newlines": { - "version": "1.0.0", - "dev": true - }, - "xtend": { - "version": "4.0.2", - "dev": true - } - } - }, - "get-port": { - "version": "4.2.0", - "dev": true - }, - "get-stdin": { - "version": "6.0.0", - "dev": true - }, - "get-stream": { - "version": "5.2.0", - "dev": true, - "requires": { - "pump": "^3.0.0" - } - }, - "get-value": { - "version": "2.0.6", - "dev": true - }, - "getpass": { - "version": "0.1.7", - "dev": true, - "requires": { - "assert-plus": "^1.0.0" - } - }, - "git-raw-commits": { - "version": "2.0.0", - "dev": true, - "requires": { - "dargs": "^4.0.1", - "lodash.template": "^4.0.2", - "meow": "^4.0.0", - "split2": "^2.0.0", - "through2": "^2.0.0" - }, - "dependencies": { - "camelcase": { - "version": "4.1.0", - "dev": true - }, - "camelcase-keys": { - "version": "4.2.0", - "dev": true, - "requires": { - "camelcase": "^4.1.0", - "map-obj": "^2.0.0", - "quick-lru": "^1.0.0" - } - }, - "indent-string": { - "version": "3.2.0", - "dev": true - }, - "isarray": { - "version": "1.0.0", - "dev": true - }, - "map-obj": { - "version": "2.0.0", - "dev": true - }, - "meow": { - "version": "4.0.1", - "dev": true, - "requires": { - "camelcase-keys": "^4.0.0", - "decamelize-keys": "^1.0.0", - "loud-rejection": "^1.0.0", - "minimist": "^1.1.3", - "minimist-options": "^3.0.1", - "normalize-package-data": "^2.3.4", - "read-pkg-up": "^3.0.0", - "redent": "^2.0.0", - "trim-newlines": "^2.0.0" - } - }, - "minimist-options": { - "version": "3.0.2", - "dev": true, - "requires": { - "arrify": "^1.0.1", - "is-plain-obj": "^1.1.0" - } - }, - "quick-lru": { - "version": "1.1.0", - "dev": true - }, - "readable-stream": { - "version": "2.3.7", - "dev": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "redent": { - "version": "2.0.0", - "dev": true, - "requires": { - "indent-string": "^3.0.0", - "strip-indent": "^2.0.0" - } - }, - "split2": { - "version": "2.2.0", - "dev": true, - "requires": { - "through2": "^2.0.2" - } - }, - "string_decoder": { - "version": "1.1.1", - "dev": true, - "requires": { - "safe-buffer": "~5.1.0" - } - }, - "strip-indent": { - "version": "2.0.0", - "dev": true - }, - "through2": { - "version": "2.0.5", - "dev": true, - "requires": { - "readable-stream": "~2.3.6", - "xtend": "~4.0.1" - } - }, - "trim-newlines": { - "version": "2.0.0", - "dev": true - }, - "xtend": { - "version": "4.0.2", - "dev": true - } - } - }, - "git-remote-origin-url": { - "version": "2.0.0", - "dev": true, - "requires": { - "gitconfiglocal": "^1.0.0", - "pify": "^2.3.0" - }, - "dependencies": { - "pify": { - "version": "2.3.0", - "dev": true - } - } - }, - "git-semver-tags": { - "version": "2.0.3", - "dev": true, - "requires": { - "meow": "^4.0.0", - "semver": "^6.0.0" - }, - "dependencies": { - "camelcase": { - "version": "4.1.0", - "dev": true - }, - "camelcase-keys": { - "version": "4.2.0", - "dev": true, - "requires": { - "camelcase": "^4.1.0", - "map-obj": "^2.0.0", - "quick-lru": "^1.0.0" - } - }, - "indent-string": { - "version": "3.2.0", - "dev": true - }, - "map-obj": { - "version": "2.0.0", - "dev": true - }, - "meow": { - "version": "4.0.1", - "dev": true, - "requires": { - "camelcase-keys": "^4.0.0", - "decamelize-keys": "^1.0.0", - "loud-rejection": "^1.0.0", - "minimist": "^1.1.3", - "minimist-options": "^3.0.1", - "normalize-package-data": "^2.3.4", - "read-pkg-up": "^3.0.0", - "redent": "^2.0.0", - "trim-newlines": "^2.0.0" - } - }, - "minimist-options": { - "version": "3.0.2", - "dev": true, - "requires": { - "arrify": "^1.0.1", - "is-plain-obj": "^1.1.0" - } - }, - "quick-lru": { - "version": "1.1.0", - "dev": true - }, - "redent": { - "version": "2.0.0", - "dev": true, - "requires": { - "indent-string": "^3.0.0", - "strip-indent": "^2.0.0" - } - }, - "semver": { - "version": "6.3.0", - "dev": true - }, - "strip-indent": { - "version": "2.0.0", - "dev": true - }, - "trim-newlines": { - "version": "2.0.0", - "dev": true - } - } - }, - "git-up": { - "version": "4.0.2", - "dev": true, - "requires": { - "is-ssh": "^1.3.0", - "parse-url": "^5.0.0" - } - }, - "git-url-parse": { - "version": "11.4.4", - "dev": true, - "requires": { - "git-up": "^4.0.0" - } - }, - "gitconfiglocal": { - "version": "1.0.0", - "dev": true, - "requires": { - "ini": "^1.3.2" - } - }, - "glob": { - "version": "7.1.6", - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "glob-base": { - "version": "0.3.0", - "dev": true, - "requires": { - "glob-parent": "^2.0.0", - "is-glob": "^2.0.0" - }, - "dependencies": { - "glob-parent": { - "version": "2.0.0", - "dev": true, - "requires": { - "is-glob": "^2.0.0" - } - }, - "is-extglob": { - "version": "1.0.0", - "dev": true - }, - "is-glob": { - "version": "2.0.1", - "dev": true, - "requires": { - "is-extglob": "^1.0.0" - } - } - } - }, - "glob-parent": { - "version": "5.1.2", - "dev": true, - "requires": { - "is-glob": "^4.0.1" - } - }, - "glob-to-regexp": { - "version": "0.3.0", - "dev": true - }, - "global": { - "version": "4.3.2", - "requires": { - "min-document": "^2.19.0", - "process": "~0.5.1" - } - }, - "globals": { - "version": "12.4.0", - "dev": true, - "requires": { - "type-fest": "^0.8.1" - } - }, - "globby": { - "version": "9.2.0", - "dev": true, - "requires": { - "@types/glob": "^7.1.1", - "array-union": "^1.0.2", - "dir-glob": "^2.2.2", - "fast-glob": "^2.2.6", - "glob": "^7.1.3", - "ignore": "^4.0.3", - "pify": "^4.0.1", - "slash": "^2.0.0" - }, - "dependencies": { - "slash": { - "version": "2.0.0", - "dev": true - } - } - }, - "graceful-fs": { - "version": "4.2.6", - "dev": true - }, - "growly": { - "version": "1.3.0", - "dev": true - }, - "handlebars": { - "version": "4.7.7", - "dev": true, - "requires": { - "minimist": "^1.2.5", - "neo-async": "^2.6.0", - "source-map": "^0.6.1", - "uglify-js": "^3.1.4", - "wordwrap": "^1.0.0" - } - }, - "har-schema": { - "version": "2.0.0", - "dev": true - }, - "har-validator": { - "version": "5.1.5", - "dev": true, - "requires": { - "ajv": "^6.12.3", - "har-schema": "^2.0.0" - } - }, - "hard-rejection": { - "version": "2.1.0", - "dev": true - }, - "has": { - "version": "1.0.3", - "dev": true, - "requires": { - "function-bind": "^1.1.1" - } - }, - "has-bigints": { - "version": "1.0.1", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "dev": true - }, - "has-symbols": { - "version": "1.0.2", - "dev": true - }, - "has-unicode": { - "version": "2.0.1", - "dev": true - }, - "has-value": { - "version": "1.0.0", - "dev": true, - "requires": { - "get-value": "^2.0.6", - "has-values": "^1.0.0", - "isobject": "^3.0.0" - } - }, - "has-values": { - "version": "1.0.0", - "dev": true, - "requires": { - "is-number": "^3.0.0", - "kind-of": "^4.0.0" - }, - "dependencies": { - "kind-of": { - "version": "4.0.0", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "he": { - "version": "1.2.0", - "dev": true - }, - "highlight.js": { - "version": "9.18.5", - "dev": true - }, - "hosted-git-info": { - "version": "2.8.8", - "dev": true - }, - "html-encoding-sniffer": { - "version": "1.0.2", - "dev": true, - "requires": { - "whatwg-encoding": "^1.0.1" - } - }, - "html-escaper": { - "version": "2.0.2", - "dev": true - }, - "http-cache-semantics": { - "version": "3.8.1", - "dev": true - }, - "http-proxy": { - "version": "1.18.1", - "dev": true, - "requires": { - "eventemitter3": "^4.0.0", - "follow-redirects": "^1.0.0", - "requires-port": "^1.0.0" - } - }, - "http-proxy-agent": { - "version": "2.1.0", - "dev": true, - "requires": { - "agent-base": "4", - "debug": "3.1.0" - }, - "dependencies": { - "debug": { - "version": "3.1.0", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "ms": { - "version": "2.0.0", - "dev": true - } - } - }, - "http-server": { - "version": "0.11.1", - "dev": true, - "requires": { - "colors": "1.0.3", - "corser": "~2.0.0", - "ecstatic": "^3.0.0", - "http-proxy": "^1.8.1", - "opener": "~1.4.0", - "optimist": "0.6.x", - "portfinder": "^1.0.13", - "union": "~0.4.3" - }, - "dependencies": { - "colors": { - "version": "1.0.3", - "dev": true - } - } - }, - "http-signature": { - "version": "1.2.0", - "dev": true, - "requires": { - "assert-plus": "^1.0.0", - "jsprim": "^1.2.2", - "sshpk": "^1.7.0" - } - }, - "https-proxy-agent": { - "version": "2.2.4", - "dev": true, - "requires": { - "agent-base": "^4.3.0", - "debug": "^3.1.0" - }, - "dependencies": { - "debug": { - "version": "3.2.7", - "dev": true, - "requires": { - "ms": "^2.1.1" - } - } - } - }, - "human-signals": { - "version": "1.1.1", - "dev": true - }, - "humanize-ms": { - "version": "1.2.1", - "dev": true, - "requires": { - "ms": "^2.0.0" - } - }, - "iconv-lite": { - "version": "0.4.24", - "dev": true, - "requires": { - "safer-buffer": ">= 2.1.2 < 3" - } - }, - "iferr": { - "version": "0.1.5", - "dev": true - }, - "ignore": { - "version": "4.0.6", - "dev": true - }, - "ignore-walk": { - "version": "3.0.3", - "dev": true, - "requires": { - "minimatch": "^3.0.4" - } - }, - "import-fresh": { - "version": "3.3.0", - "dev": true, - "requires": { - "parent-module": "^1.0.0", - "resolve-from": "^4.0.0" - } - }, - "import-lazy": { - "version": "4.0.0", - "dev": true - }, - "import-local": { - "version": "2.0.0", - "dev": true, - "requires": { - "pkg-dir": "^3.0.0", - "resolve-cwd": "^2.0.0" - } - }, - "imurmurhash": { - "version": "0.1.4", - "dev": true - }, - "indent-string": { - "version": "4.0.0", - "dev": true - }, - "infer-owner": { - "version": "1.0.4", - "dev": true - }, - "inflight": { - "version": "1.0.6", - "dev": true, - "requires": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "inherits": { - "version": "2.0.4", - "dev": true - }, - "ini": { - "version": "1.3.8", - "dev": true - }, - "init-package-json": { - "version": "1.10.3", - "dev": true, - "requires": { - "glob": "^7.1.1", - "npm-package-arg": "^4.0.0 || ^5.0.0 || ^6.0.0", - "promzard": "^0.3.0", - "read": "~1.0.1", - "read-package-json": "1 || 2", - "semver": "2.x || 3.x || 4 || 5", - "validate-npm-package-license": "^3.0.1", - "validate-npm-package-name": "^3.0.0" - }, - "dependencies": { - "semver": { - "version": "5.7.1", - "dev": true - } - } - }, - "inquirer": { - "version": "7.3.3", - "dev": true, - "requires": { - "ansi-escapes": "^4.2.1", - "chalk": "^4.1.0", - "cli-cursor": "^3.1.0", - "cli-width": "^3.0.0", - "external-editor": "^3.0.3", - "figures": "^3.0.0", - "lodash": "^4.17.19", - "mute-stream": "0.0.8", - "run-async": "^2.4.0", - "rxjs": "^6.6.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0", - "through": "^2.3.6" - }, - "dependencies": { - "ansi-regex": { - "version": "5.0.0", - "dev": true - }, - "strip-ansi": { - "version": "6.0.0", - "dev": true, - "requires": { - "ansi-regex": "^5.0.0" - } - } - } - }, - "interpret": { - "version": "1.4.0", - "dev": true - }, - "invariant": { - "version": "2.2.4", - "dev": true, - "requires": { - "loose-envify": "^1.0.0" - } - }, - "ios-version": { - "version": "1.0.1", - "requires": { - "global": "~4.3.0", - "parse-int": "~1.0.0" - } - }, - "ip": { - "version": "1.1.5", - "dev": true - }, - "is-accessor-descriptor": { - "version": "1.0.0", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-arrayish": { - "version": "0.2.1", - "dev": true - }, - "is-bigint": { - "version": "1.0.1", - "dev": true - }, - "is-binary-path": { - "version": "2.1.0", - "dev": true, - "requires": { - "binary-extensions": "^2.0.0" - } - }, - "is-boolean-object": { - "version": "1.1.0", - "dev": true, - "requires": { - "call-bind": "^1.0.0" - } - }, - "is-buffer": { - "version": "1.1.6", - "dev": true - }, - "is-callable": { - "version": "1.2.3", - "dev": true - }, - "is-ci": { - "version": "2.0.0", - "dev": true, - "requires": { - "ci-info": "^2.0.0" - } - }, - "is-core-module": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.5.0.tgz", - "integrity": "sha512-TXCMSDsEHMEEZ6eCA8rwRDbLu55MRGmrctljsBX/2v1d9/GzqHOxW5c5oPSgrUt2vBFXebu9rGqckXGPWOlYpg==", - "dev": true, - "requires": { - "has": "^1.0.3" - } - }, - "is-data-descriptor": { - "version": "1.0.0", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-date-object": { - "version": "1.0.2", - "dev": true - }, - "is-descriptor": { - "version": "1.0.2", - "dev": true, - "requires": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" - } - }, - "is-directory": { - "version": "0.3.1", - "dev": true - }, - "is-docker": { - "version": "2.1.1", - "dev": true - }, - "is-dotfile": { - "version": "1.0.3", - "dev": true - }, - "is-equal-shallow": { - "version": "0.1.3", - "dev": true, - "requires": { - "is-primitive": "^2.0.0" - } - }, - "is-extendable": { - "version": "1.0.1", - "dev": true, - "requires": { - "is-plain-object": "^2.0.4" - }, - "dependencies": { - "is-plain-object": { - "version": "2.0.4", - "dev": true, - "requires": { - "isobject": "^3.0.1" - } - } - } - }, - "is-extglob": { - "version": "2.1.1", - "dev": true - }, - "is-finite": { - "version": "1.1.0" - }, - "is-fullwidth-code-point": { - "version": "3.0.0", - "dev": true - }, - "is-generator-fn": { - "version": "2.1.0", - "dev": true - }, - "is-glob": { - "version": "4.0.1", - "dev": true, - "requires": { - "is-extglob": "^2.1.1" - } - }, - "is-integer": { - "version": "1.0.7", - "requires": { - "is-finite": "^1.0.0" - } - }, - "is-module": { - "version": "1.0.0", - "dev": true - }, - "is-negative-zero": { - "version": "2.0.1", - "dev": true - }, - "is-number": { - "version": "3.0.0", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "is-number-object": { - "version": "1.0.4", - "dev": true - }, - "is-obj": { - "version": "1.0.1", - "dev": true - }, - "is-plain-obj": { - "version": "1.1.0", - "dev": true - }, - "is-plain-object": { - "version": "5.0.0", - "dev": true - }, - "is-posix-bracket": { - "version": "0.1.1", - "dev": true - }, - "is-primitive": { - "version": "2.0.0", - "dev": true - }, - "is-reference": { - "version": "1.2.1", - "dev": true, - "requires": { - "@types/estree": "*" - } - }, - "is-regex": { - "version": "1.1.2", - "dev": true, - "requires": { - "call-bind": "^1.0.2", - "has-symbols": "^1.0.1" - } - }, - "is-ssh": { - "version": "1.3.2", - "dev": true, - "requires": { - "protocols": "^1.1.0" - } - }, - "is-stream": { - "version": "2.0.0", - "dev": true - }, - "is-string": { - "version": "1.0.5", - "dev": true - }, - "is-symbol": { - "version": "1.0.3", - "dev": true, - "requires": { - "has-symbols": "^1.0.1" - } - }, - "is-text-path": { - "version": "1.0.1", - "dev": true, - "requires": { - "text-extensions": "^1.0.0" - } - }, - "is-typedarray": { - "version": "1.0.0", - "dev": true - }, - "is-utf8": { - "version": "0.2.1", - "dev": true - }, - "is-windows": { - "version": "1.0.2", - "dev": true - }, - "is-wsl": { - "version": "1.1.0", - "dev": true - }, - "isarray": { - "version": "0.0.1", - "dev": true - }, - "isexe": { - "version": "2.0.0", - "dev": true - }, - "ismobilejs": { - "version": "0.5.2" - }, - "isobject": { - "version": "3.0.1", - "dev": true - }, - "isstream": { - "version": "0.1.2", - "dev": true - }, - "istanbul-lib-coverage": { - "version": "2.0.5", - "dev": true - }, - "istanbul-lib-instrument": { - "version": "3.3.0", - "dev": true, - "requires": { - "@babel/generator": "^7.4.0", - "@babel/parser": "^7.4.3", - "@babel/template": "^7.4.0", - "@babel/traverse": "^7.4.3", - "@babel/types": "^7.4.0", - "istanbul-lib-coverage": "^2.0.5", - "semver": "^6.0.0" - }, - "dependencies": { - "semver": { - "version": "6.3.0", - "dev": true - } - } - }, - "istanbul-lib-report": { - "version": "2.0.8", - "dev": true, - "requires": { - "istanbul-lib-coverage": "^2.0.5", - "make-dir": "^2.1.0", - "supports-color": "^6.1.0" - }, - "dependencies": { - "has-flag": { - "version": "3.0.0", - "dev": true - }, - "supports-color": { - "version": "6.1.0", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - } - } - }, - "istanbul-lib-source-maps": { - "version": "3.0.6", - "dev": true, - "requires": { - "debug": "^4.1.1", - "istanbul-lib-coverage": "^2.0.5", - "make-dir": "^2.1.0", - "rimraf": "^2.6.3", - "source-map": "^0.6.1" - } - }, - "istanbul-reports": { - "version": "2.2.7", - "dev": true, - "requires": { - "html-escaper": "^2.0.0" - } - }, - "jest": { - "version": "24.9.0", - "dev": true, - "requires": { - "import-local": "^2.0.0", - "jest-cli": "^24.9.0" - } - }, - "jest-changed-files": { - "version": "24.9.0", - "dev": true, - "requires": { - "@jest/types": "^24.9.0", - "execa": "^1.0.0", - "throat": "^4.0.0" - }, - "dependencies": { - "execa": { - "version": "1.0.0", - "dev": true, - "requires": { - "cross-spawn": "^6.0.0", - "get-stream": "^4.0.0", - "is-stream": "^1.1.0", - "npm-run-path": "^2.0.0", - "p-finally": "^1.0.0", - "signal-exit": "^3.0.0", - "strip-eof": "^1.0.0" - } - }, - "get-stream": { - "version": "4.1.0", - "dev": true, - "requires": { - "pump": "^3.0.0" - } - }, - "is-stream": { - "version": "1.1.0", - "dev": true - }, - "npm-run-path": { - "version": "2.0.2", - "dev": true, - "requires": { - "path-key": "^2.0.0" - } - } - } - }, - "jest-cli": { - "version": "24.9.0", - "dev": true, - "requires": { - "@jest/core": "^24.9.0", - "@jest/test-result": "^24.9.0", - "@jest/types": "^24.9.0", - "chalk": "^2.0.1", - "exit": "^0.1.2", - "import-local": "^2.0.0", - "is-ci": "^2.0.0", - "jest-config": "^24.9.0", - "jest-util": "^24.9.0", - "jest-validate": "^24.9.0", - "prompts": "^2.0.1", - "realpath-native": "^1.1.0", - "yargs": "^13.3.0" - }, - "dependencies": { - "ansi-styles": { - "version": "3.2.1", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "chalk": { - "version": "2.4.2", - "dev": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "color-convert": { - "version": "1.9.3", - "dev": true, - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "dev": true - }, - "has-flag": { - "version": "3.0.0", - "dev": true - }, - "supports-color": { - "version": "5.5.0", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - } - } - }, - "jest-config": { - "version": "24.9.0", - "dev": true, - "requires": { - "@babel/core": "^7.1.0", - "@jest/test-sequencer": "^24.9.0", - "@jest/types": "^24.9.0", - "babel-jest": "^24.9.0", - "chalk": "^2.0.1", - "glob": "^7.1.1", - "jest-environment-jsdom": "^24.9.0", - "jest-environment-node": "^24.9.0", - "jest-get-type": "^24.9.0", - "jest-jasmine2": "^24.9.0", - "jest-regex-util": "^24.3.0", - "jest-resolve": "^24.9.0", - "jest-util": "^24.9.0", - "jest-validate": "^24.9.0", - "micromatch": "^3.1.10", - "pretty-format": "^24.9.0", - "realpath-native": "^1.1.0" - }, - "dependencies": { - "ansi-styles": { - "version": "3.2.1", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "chalk": { - "version": "2.4.2", - "dev": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "color-convert": { - "version": "1.9.3", - "dev": true, - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "dev": true - }, - "has-flag": { - "version": "3.0.0", - "dev": true - }, - "supports-color": { - "version": "5.5.0", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - } - } - }, - "jest-diff": { - "version": "24.9.0", - "dev": true, - "requires": { - "chalk": "^2.0.1", - "diff-sequences": "^24.9.0", - "jest-get-type": "^24.9.0", - "pretty-format": "^24.9.0" - }, - "dependencies": { - "ansi-styles": { - "version": "3.2.1", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "chalk": { - "version": "2.4.2", - "dev": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "color-convert": { - "version": "1.9.3", - "dev": true, - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "dev": true - }, - "has-flag": { - "version": "3.0.0", - "dev": true - }, - "supports-color": { - "version": "5.5.0", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - } - } - }, - "jest-docblock": { - "version": "24.9.0", - "dev": true, - "requires": { - "detect-newline": "^2.1.0" - } - }, - "jest-each": { - "version": "24.9.0", - "dev": true, - "requires": { - "@jest/types": "^24.9.0", - "chalk": "^2.0.1", - "jest-get-type": "^24.9.0", - "jest-util": "^24.9.0", - "pretty-format": "^24.9.0" - }, - "dependencies": { - "ansi-styles": { - "version": "3.2.1", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "chalk": { - "version": "2.4.2", - "dev": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "color-convert": { - "version": "1.9.3", - "dev": true, - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "dev": true - }, - "has-flag": { - "version": "3.0.0", - "dev": true - }, - "supports-color": { - "version": "5.5.0", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - } - } - }, - "jest-environment-jsdom": { - "version": "24.9.0", - "dev": true, - "requires": { - "@jest/environment": "^24.9.0", - "@jest/fake-timers": "^24.9.0", - "@jest/types": "^24.9.0", - "jest-mock": "^24.9.0", - "jest-util": "^24.9.0", - "jsdom": "^11.5.1" - } - }, - "jest-environment-node": { - "version": "24.9.0", - "dev": true, - "requires": { - "@jest/environment": "^24.9.0", - "@jest/fake-timers": "^24.9.0", - "@jest/types": "^24.9.0", - "jest-mock": "^24.9.0", - "jest-util": "^24.9.0" - } - }, - "jest-get-type": { - "version": "24.9.0", - "dev": true - }, - "jest-haste-map": { - "version": "24.9.0", - "dev": true, - "requires": { - "@jest/types": "^24.9.0", - "anymatch": "^2.0.0", - "fb-watchman": "^2.0.0", - "fsevents": "^1.2.7", - "graceful-fs": "^4.1.15", - "invariant": "^2.2.4", - "jest-serializer": "^24.9.0", - "jest-util": "^24.9.0", - "jest-worker": "^24.9.0", - "micromatch": "^3.1.10", - "sane": "^4.0.3", - "walker": "^1.0.7" - } - }, - "jest-jasmine2": { - "version": "24.9.0", - "dev": true, - "requires": { - "@babel/traverse": "^7.1.0", - "@jest/environment": "^24.9.0", - "@jest/test-result": "^24.9.0", - "@jest/types": "^24.9.0", - "chalk": "^2.0.1", - "co": "^4.6.0", - "expect": "^24.9.0", - "is-generator-fn": "^2.0.0", - "jest-each": "^24.9.0", - "jest-matcher-utils": "^24.9.0", - "jest-message-util": "^24.9.0", - "jest-runtime": "^24.9.0", - "jest-snapshot": "^24.9.0", - "jest-util": "^24.9.0", - "pretty-format": "^24.9.0", - "throat": "^4.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "3.2.1", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "chalk": { - "version": "2.4.2", - "dev": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "color-convert": { - "version": "1.9.3", - "dev": true, - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "dev": true - }, - "has-flag": { - "version": "3.0.0", - "dev": true - }, - "supports-color": { - "version": "5.5.0", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - } - } - }, - "jest-leak-detector": { - "version": "24.9.0", - "dev": true, - "requires": { - "jest-get-type": "^24.9.0", - "pretty-format": "^24.9.0" - } - }, - "jest-matcher-utils": { - "version": "24.9.0", - "dev": true, - "requires": { - "chalk": "^2.0.1", - "jest-diff": "^24.9.0", - "jest-get-type": "^24.9.0", - "pretty-format": "^24.9.0" - }, - "dependencies": { - "ansi-styles": { - "version": "3.2.1", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "chalk": { - "version": "2.4.2", - "dev": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "color-convert": { - "version": "1.9.3", - "dev": true, - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "dev": true - }, - "has-flag": { - "version": "3.0.0", - "dev": true - }, - "supports-color": { - "version": "5.5.0", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - } - } - }, - "jest-message-util": { - "version": "24.9.0", - "dev": true, - "requires": { - "@babel/code-frame": "^7.0.0", - "@jest/test-result": "^24.9.0", - "@jest/types": "^24.9.0", - "@types/stack-utils": "^1.0.1", - "chalk": "^2.0.1", - "micromatch": "^3.1.10", - "slash": "^2.0.0", - "stack-utils": "^1.0.1" - }, - "dependencies": { - "ansi-styles": { - "version": "3.2.1", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "chalk": { - "version": "2.4.2", - "dev": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "color-convert": { - "version": "1.9.3", - "dev": true, - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "dev": true - }, - "has-flag": { - "version": "3.0.0", - "dev": true - }, - "slash": { - "version": "2.0.0", - "dev": true - }, - "supports-color": { - "version": "5.5.0", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - } - } - }, - "jest-mock": { - "version": "24.9.0", - "dev": true, - "requires": { - "@jest/types": "^24.9.0" - } - }, - "jest-pnp-resolver": { - "version": "1.2.2", - "dev": true, - "requires": {} - }, - "jest-regex-util": { - "version": "24.9.0", - "dev": true - }, - "jest-resolve": { - "version": "24.9.0", - "dev": true, - "requires": { - "@jest/types": "^24.9.0", - "browser-resolve": "^1.11.3", - "chalk": "^2.0.1", - "jest-pnp-resolver": "^1.2.1", - "realpath-native": "^1.1.0" - }, - "dependencies": { - "ansi-styles": { - "version": "3.2.1", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "chalk": { - "version": "2.4.2", - "dev": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "color-convert": { - "version": "1.9.3", - "dev": true, - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "dev": true - }, - "has-flag": { - "version": "3.0.0", - "dev": true - }, - "supports-color": { - "version": "5.5.0", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - } - } - }, - "jest-resolve-dependencies": { - "version": "24.9.0", - "dev": true, - "requires": { - "@jest/types": "^24.9.0", - "jest-regex-util": "^24.3.0", - "jest-snapshot": "^24.9.0" - } - }, - "jest-runner": { - "version": "24.9.0", - "dev": true, - "requires": { - "@jest/console": "^24.7.1", - "@jest/environment": "^24.9.0", - "@jest/test-result": "^24.9.0", - "@jest/types": "^24.9.0", - "chalk": "^2.4.2", - "exit": "^0.1.2", - "graceful-fs": "^4.1.15", - "jest-config": "^24.9.0", - "jest-docblock": "^24.3.0", - "jest-haste-map": "^24.9.0", - "jest-jasmine2": "^24.9.0", - "jest-leak-detector": "^24.9.0", - "jest-message-util": "^24.9.0", - "jest-resolve": "^24.9.0", - "jest-runtime": "^24.9.0", - "jest-util": "^24.9.0", - "jest-worker": "^24.6.0", - "source-map-support": "^0.5.6", - "throat": "^4.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "3.2.1", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "chalk": { - "version": "2.4.2", - "dev": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "color-convert": { - "version": "1.9.3", - "dev": true, - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "dev": true - }, - "has-flag": { - "version": "3.0.0", - "dev": true - }, - "supports-color": { - "version": "5.5.0", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - } - } - }, - "jest-runtime": { - "version": "24.9.0", - "dev": true, - "requires": { - "@jest/console": "^24.7.1", - "@jest/environment": "^24.9.0", - "@jest/source-map": "^24.3.0", - "@jest/transform": "^24.9.0", - "@jest/types": "^24.9.0", - "@types/yargs": "^13.0.0", - "chalk": "^2.0.1", - "exit": "^0.1.2", - "glob": "^7.1.3", - "graceful-fs": "^4.1.15", - "jest-config": "^24.9.0", - "jest-haste-map": "^24.9.0", - "jest-message-util": "^24.9.0", - "jest-mock": "^24.9.0", - "jest-regex-util": "^24.3.0", - "jest-resolve": "^24.9.0", - "jest-snapshot": "^24.9.0", - "jest-util": "^24.9.0", - "jest-validate": "^24.9.0", - "realpath-native": "^1.1.0", - "slash": "^2.0.0", - "strip-bom": "^3.0.0", - "yargs": "^13.3.0" - }, - "dependencies": { - "ansi-styles": { - "version": "3.2.1", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "chalk": { - "version": "2.4.2", - "dev": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "color-convert": { - "version": "1.9.3", - "dev": true, - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "dev": true - }, - "has-flag": { - "version": "3.0.0", - "dev": true - }, - "slash": { - "version": "2.0.0", - "dev": true - }, - "supports-color": { - "version": "5.5.0", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - } - } - }, - "jest-serializer": { - "version": "24.9.0", - "dev": true - }, - "jest-snapshot": { - "version": "24.9.0", - "dev": true, - "requires": { - "@babel/types": "^7.0.0", - "@jest/types": "^24.9.0", - "chalk": "^2.0.1", - "expect": "^24.9.0", - "jest-diff": "^24.9.0", - "jest-get-type": "^24.9.0", - "jest-matcher-utils": "^24.9.0", - "jest-message-util": "^24.9.0", - "jest-resolve": "^24.9.0", - "mkdirp": "^0.5.1", - "natural-compare": "^1.4.0", - "pretty-format": "^24.9.0", - "semver": "^6.2.0" - }, - "dependencies": { - "ansi-styles": { - "version": "3.2.1", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "chalk": { - "version": "2.4.2", - "dev": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "color-convert": { - "version": "1.9.3", - "dev": true, - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "dev": true - }, - "has-flag": { - "version": "3.0.0", - "dev": true - }, - "semver": { - "version": "6.3.0", - "dev": true - }, - "supports-color": { - "version": "5.5.0", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - } - } - }, - "jest-util": { - "version": "24.9.0", - "dev": true, - "requires": { - "@jest/console": "^24.9.0", - "@jest/fake-timers": "^24.9.0", - "@jest/source-map": "^24.9.0", - "@jest/test-result": "^24.9.0", - "@jest/types": "^24.9.0", - "callsites": "^3.0.0", - "chalk": "^2.0.1", - "graceful-fs": "^4.1.15", - "is-ci": "^2.0.0", - "mkdirp": "^0.5.1", - "slash": "^2.0.0", - "source-map": "^0.6.0" - }, - "dependencies": { - "ansi-styles": { - "version": "3.2.1", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "chalk": { - "version": "2.4.2", - "dev": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "color-convert": { - "version": "1.9.3", - "dev": true, - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "dev": true - }, - "has-flag": { - "version": "3.0.0", - "dev": true - }, - "slash": { - "version": "2.0.0", - "dev": true - }, - "supports-color": { - "version": "5.5.0", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - } - } - }, - "jest-validate": { - "version": "24.9.0", - "dev": true, - "requires": { - "@jest/types": "^24.9.0", - "camelcase": "^5.3.1", - "chalk": "^2.0.1", - "jest-get-type": "^24.9.0", - "leven": "^3.1.0", - "pretty-format": "^24.9.0" - }, - "dependencies": { - "ansi-styles": { - "version": "3.2.1", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "chalk": { - "version": "2.4.2", - "dev": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "color-convert": { - "version": "1.9.3", - "dev": true, - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "dev": true - }, - "has-flag": { - "version": "3.0.0", - "dev": true - }, - "supports-color": { - "version": "5.5.0", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - } - } - }, - "jest-watcher": { - "version": "24.9.0", - "dev": true, - "requires": { - "@jest/test-result": "^24.9.0", - "@jest/types": "^24.9.0", - "@types/yargs": "^13.0.0", - "ansi-escapes": "^3.0.0", - "chalk": "^2.0.1", - "jest-util": "^24.9.0", - "string-length": "^2.0.0" - }, - "dependencies": { - "ansi-escapes": { - "version": "3.2.0", - "dev": true - }, - "ansi-styles": { - "version": "3.2.1", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "chalk": { - "version": "2.4.2", - "dev": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "color-convert": { - "version": "1.9.3", - "dev": true, - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "dev": true - }, - "has-flag": { - "version": "3.0.0", - "dev": true - }, - "supports-color": { - "version": "5.5.0", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - } - } - }, - "jest-worker": { - "version": "24.9.0", - "dev": true, - "requires": { - "merge-stream": "^2.0.0", - "supports-color": "^6.1.0" - }, - "dependencies": { - "has-flag": { - "version": "3.0.0", - "dev": true - }, - "supports-color": { - "version": "6.1.0", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - } - } - }, - "jju": { - "version": "1.4.0", - "dev": true - }, - "jquery": { - "version": "3.6.0", - "dev": true - }, - "js-tokens": { - "version": "4.0.0", - "dev": true - }, - "js-yaml": { - "version": "3.13.1", - "dev": true, - "requires": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" - } - }, - "jsbn": { - "version": "0.1.1", - "dev": true - }, - "jsdom": { - "version": "11.12.0", - "dev": true, - "requires": { - "abab": "^2.0.0", - "acorn": "^5.5.3", - "acorn-globals": "^4.1.0", - "array-equal": "^1.0.0", - "cssom": ">= 0.3.2 < 0.4.0", - "cssstyle": "^1.0.0", - "data-urls": "^1.0.0", - "domexception": "^1.0.1", - "escodegen": "^1.9.1", - "html-encoding-sniffer": "^1.0.2", - "left-pad": "^1.3.0", - "nwsapi": "^2.0.7", - "parse5": "4.0.0", - "pn": "^1.1.0", - "request": "^2.87.0", - "request-promise-native": "^1.0.5", - "sax": "^1.2.4", - "symbol-tree": "^3.2.2", - "tough-cookie": "^2.3.4", - "w3c-hr-time": "^1.0.1", - "webidl-conversions": "^4.0.2", - "whatwg-encoding": "^1.0.3", - "whatwg-mimetype": "^2.1.0", - "whatwg-url": "^6.4.1", - "ws": "^5.2.0", - "xml-name-validator": "^3.0.0" - }, - "dependencies": { - "acorn": { - "version": "5.7.4", - "dev": true - } - } - }, - "jsesc": { - "version": "2.5.2", - "dev": true - }, - "json-parse-better-errors": { - "version": "1.0.2", - "dev": true - }, - "json-parse-even-better-errors": { - "version": "2.3.1", - "dev": true - }, - "json-schema": { - "version": "0.2.3", - "dev": true - }, - "json-schema-traverse": { - "version": "0.4.1", - "dev": true - }, - "json-stable-stringify-without-jsonify": { - "version": "1.0.1", - "dev": true - }, - "json-stringify-safe": { - "version": "5.0.1", - "dev": true - }, - "json5": { - "version": "2.2.0", - "dev": true, - "requires": { - "minimist": "^1.2.5" - } - }, - "jsonfile": { - "version": "6.1.0", - "dev": true, - "requires": { - "graceful-fs": "^4.1.6", - "universalify": "^2.0.0" - } - }, - "jsonparse": { - "version": "1.3.1", - "dev": true - }, - "JSONStream": { - "version": "1.3.5", - "dev": true, - "requires": { - "jsonparse": "^1.2.0", - "through": ">=2.2.7 <3" - } - }, - "jsprim": { - "version": "1.4.1", - "dev": true, - "requires": { - "assert-plus": "1.0.0", - "extsprintf": "1.3.0", - "json-schema": "0.2.3", - "verror": "1.10.0" - } - }, - "just-extend": { - "version": "4.1.1", - "dev": true - }, - "kind-of": { - "version": "6.0.3", - "dev": true - }, - "kleur": { - "version": "3.0.3", - "dev": true - }, - "left-pad": { - "version": "1.3.0", - "dev": true - }, - "lerna": { - "version": "3.22.1", - "dev": true, - "requires": { - "@lerna/add": "3.21.0", - "@lerna/bootstrap": "3.21.0", - "@lerna/changed": "3.21.0", - "@lerna/clean": "3.21.0", - "@lerna/cli": "3.18.5", - "@lerna/create": "3.22.0", - "@lerna/diff": "3.21.0", - "@lerna/exec": "3.21.0", - "@lerna/import": "3.22.0", - "@lerna/info": "3.21.0", - "@lerna/init": "3.21.0", - "@lerna/link": "3.21.0", - "@lerna/list": "3.21.0", - "@lerna/publish": "3.22.1", - "@lerna/run": "3.21.0", - "@lerna/version": "3.22.1", - "import-local": "^2.0.0", - "npmlog": "^4.1.2" - } - }, - "leven": { - "version": "3.1.0", - "dev": true - }, - "levn": { - "version": "0.3.0", - "dev": true, - "requires": { - "prelude-ls": "~1.1.2", - "type-check": "~0.3.2" - } - }, - "lines-and-columns": { - "version": "1.1.6", - "dev": true - }, - "livereload": { - "version": "0.9.2", - "dev": true, - "requires": { - "chokidar": "^3.5.0", - "livereload-js": "^3.3.1", - "opts": ">= 1.2.0", - "ws": "^7.4.3" - }, - "dependencies": { - "ws": { - "version": "7.4.4", - "dev": true, - "requires": {} - } - } - }, - "livereload-js": { - "version": "3.3.2", - "dev": true - }, - "load-json-file": { - "version": "5.3.0", - "dev": true, - "requires": { - "graceful-fs": "^4.1.15", - "parse-json": "^4.0.0", - "pify": "^4.0.1", - "strip-bom": "^3.0.0", - "type-fest": "^0.3.0" - }, - "dependencies": { - "type-fest": { - "version": "0.3.1", - "dev": true - } - } - }, - "locate-path": { - "version": "3.0.0", - "dev": true, - "requires": { - "p-locate": "^3.0.0", - "path-exists": "^3.0.0" - } - }, - "lodash": { - "version": "4.17.21" - }, - "lodash._reinterpolate": { - "version": "3.0.0", - "dev": true - }, - "lodash.clonedeep": { - "version": "4.5.0", - "dev": true - }, - "lodash.get": { - "version": "4.4.2", - "dev": true - }, - "lodash.isequal": { - "version": "4.5.0", - "dev": true - }, - "lodash.ismatch": { - "version": "4.4.0", - "dev": true - }, - "lodash.memoize": { - "version": "4.1.2", - "dev": true - }, - "lodash.set": { - "version": "4.3.2", - "dev": true - }, - "lodash.sortby": { - "version": "4.7.0", - "dev": true - }, - "lodash.template": { - "version": "4.5.0", - "dev": true, - "requires": { - "lodash._reinterpolate": "^3.0.0", - "lodash.templatesettings": "^4.0.0" - } - }, - "lodash.templatesettings": { - "version": "4.2.0", - "dev": true, - "requires": { - "lodash._reinterpolate": "^3.0.0" - } - }, - "lodash.unescape": { - "version": "4.0.1", - "dev": true - }, - "lodash.uniq": { - "version": "4.5.0", - "dev": true - }, - "lolex": { - "version": "4.2.0", - "dev": true - }, - "loose-envify": { - "version": "1.4.0", - "dev": true, - "requires": { - "js-tokens": "^3.0.0 || ^4.0.0" - } - }, - "loud-rejection": { - "version": "1.6.0", - "dev": true, - "requires": { - "currently-unhandled": "^0.4.1", - "signal-exit": "^3.0.0" - } - }, - "lru-cache": { - "version": "5.1.1", - "dev": true, - "requires": { - "yallist": "^3.0.2" - } - }, - "lunr": { - "version": "2.3.9", - "dev": true - }, - "macos-release": { - "version": "2.4.1", - "dev": true - }, - "magic-string": { - "version": "0.25.7", - "dev": true, - "requires": { - "sourcemap-codec": "^1.4.4" - } - }, - "make-dir": { - "version": "2.1.0", - "dev": true, - "requires": { - "pify": "^4.0.1", - "semver": "^5.6.0" - }, - "dependencies": { - "semver": { - "version": "5.7.1", - "dev": true - } - } - }, - "make-error": { - "version": "1.3.6", - "dev": true - }, - "make-fetch-happen": { - "version": "5.0.2", - "dev": true, - "requires": { - "agentkeepalive": "^3.4.1", - "cacache": "^12.0.0", - "http-cache-semantics": "^3.8.1", - "http-proxy-agent": "^2.1.0", - "https-proxy-agent": "^2.2.3", - "lru-cache": "^5.1.1", - "mississippi": "^3.0.0", - "node-fetch-npm": "^2.0.2", - "promise-retry": "^1.1.1", - "socks-proxy-agent": "^4.0.0", - "ssri": "^6.0.0" - } - }, - "makeerror": { - "version": "1.0.11", - "dev": true, - "requires": { - "tmpl": "1.0.x" - } - }, - "map-cache": { - "version": "0.2.2", - "dev": true - }, - "map-obj": { - "version": "4.2.0", - "dev": true - }, - "map-visit": { - "version": "1.0.0", - "dev": true, - "requires": { - "object-visit": "^1.0.0" - } - }, - "marked": { - "version": "0.8.2", - "dev": true - }, - "math-random": { - "version": "1.0.4", - "dev": true - }, - "meow": { - "version": "8.1.2", - "dev": true, - "requires": { - "@types/minimist": "^1.2.0", - "camelcase-keys": "^6.2.2", - "decamelize-keys": "^1.1.0", - "hard-rejection": "^2.1.0", - "minimist-options": "4.1.0", - "normalize-package-data": "^3.0.0", - "read-pkg-up": "^7.0.1", - "redent": "^3.0.0", - "trim-newlines": "^3.0.0", - "type-fest": "^0.18.0", - "yargs-parser": "^20.2.3" - }, - "dependencies": { - "find-up": { - "version": "4.1.0", - "dev": true, - "requires": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" - } - }, - "hosted-git-info": { - "version": "4.0.0", - "dev": true, - "requires": { - "lru-cache": "^6.0.0" - } - }, - "locate-path": { - "version": "5.0.0", - "dev": true, - "requires": { - "p-locate": "^4.1.0" - } - }, - "lru-cache": { - "version": "6.0.0", - "dev": true, - "requires": { - "yallist": "^4.0.0" - } - }, - "normalize-package-data": { - "version": "3.0.1", - "dev": true, - "requires": { - "hosted-git-info": "^4.0.0", - "resolve": "^1.17.0", - "semver": "^7.3.2", - "validate-npm-package-license": "^3.0.1" - } - }, - "p-locate": { - "version": "4.1.0", - "dev": true, - "requires": { - "p-limit": "^2.2.0" - } - }, - "parse-json": { - "version": "5.2.0", - "dev": true, - "requires": { - "@babel/code-frame": "^7.0.0", - "error-ex": "^1.3.1", - "json-parse-even-better-errors": "^2.3.0", - "lines-and-columns": "^1.1.6" - } - }, - "path-exists": { - "version": "4.0.0", - "dev": true - }, - "read-pkg": { - "version": "5.2.0", - "dev": true, - "requires": { - "@types/normalize-package-data": "^2.4.0", - "normalize-package-data": "^2.5.0", - "parse-json": "^5.0.0", - "type-fest": "^0.6.0" - }, - "dependencies": { - "hosted-git-info": { - "version": "2.8.8", - "dev": true - }, - "normalize-package-data": { - "version": "2.5.0", - "dev": true, - "requires": { - "hosted-git-info": "^2.1.4", - "resolve": "^1.10.0", - "semver": "2 || 3 || 4 || 5", - "validate-npm-package-license": "^3.0.1" - } - }, - "semver": { - "version": "5.7.1", - "dev": true - }, - "type-fest": { - "version": "0.6.0", - "dev": true - } - } - }, - "read-pkg-up": { - "version": "7.0.1", - "dev": true, - "requires": { - "find-up": "^4.1.0", - "read-pkg": "^5.2.0", - "type-fest": "^0.8.1" - }, - "dependencies": { - "type-fest": { - "version": "0.8.1", - "dev": true - } - } - }, - "type-fest": { - "version": "0.18.1", - "dev": true - }, - "yallist": { - "version": "4.0.0", - "dev": true - } - } - }, - "merge-stream": { - "version": "2.0.0", - "dev": true - }, - "merge2": { - "version": "1.4.1", - "dev": true - }, - "micromatch": { - "version": "3.1.10", - "dev": true, - "requires": { - "arr-diff": "^4.0.0", - "array-unique": "^0.3.2", - "braces": "^2.3.1", - "define-property": "^2.0.2", - "extend-shallow": "^3.0.2", - "extglob": "^2.0.4", - "fragment-cache": "^0.2.1", - "kind-of": "^6.0.2", - "nanomatch": "^1.2.9", - "object.pick": "^1.3.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.2" - } - }, - "mime": { - "version": "1.6.0", - "dev": true - }, - "mime-db": { - "version": "1.46.0", - "dev": true - }, - "mime-types": { - "version": "2.1.29", - "dev": true, - "requires": { - "mime-db": "1.46.0" - } - }, - "mimic-fn": { - "version": "2.1.0", - "dev": true - }, - "min-document": { - "version": "2.19.0", - "requires": { - "dom-walk": "^0.1.0" - } - }, - "min-indent": { - "version": "1.0.1", - "dev": true - }, - "mini-signals": { - "version": "1.2.0" - }, - "minimatch": { - "version": "3.0.4", - "dev": true, - "requires": { - "brace-expansion": "^1.1.7" - } - }, - "minimist": { - "version": "1.2.5", - "dev": true - }, - "minimist-options": { - "version": "4.1.0", - "dev": true, - "requires": { - "arrify": "^1.0.1", - "is-plain-obj": "^1.1.0", - "kind-of": "^6.0.3" - } - }, - "minipass": { - "version": "2.9.0", - "dev": true, - "requires": { - "safe-buffer": "^5.1.2", - "yallist": "^3.0.0" - } - }, - "minizlib": { - "version": "1.3.3", - "dev": true, - "requires": { - "minipass": "^2.9.0" - } - }, - "mississippi": { - "version": "3.0.0", - "dev": true, - "requires": { - "concat-stream": "^1.5.0", - "duplexify": "^3.4.2", - "end-of-stream": "^1.1.0", - "flush-write-stream": "^1.0.0", - "from2": "^2.1.0", - "parallel-transform": "^1.1.0", - "pump": "^3.0.0", - "pumpify": "^1.3.3", - "stream-each": "^1.1.0", - "through2": "^2.0.0" - }, - "dependencies": { - "concat-stream": { - "version": "1.6.2", - "dev": true, - "requires": { - "buffer-from": "^1.0.0", - "inherits": "^2.0.3", - "readable-stream": "^2.2.2", - "typedarray": "^0.0.6" - } - }, - "isarray": { - "version": "1.0.0", - "dev": true - }, - "readable-stream": { - "version": "2.3.7", - "dev": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "string_decoder": { - "version": "1.1.1", - "dev": true, - "requires": { - "safe-buffer": "~5.1.0" - } - }, - "through2": { - "version": "2.0.5", - "dev": true, - "requires": { - "readable-stream": "~2.3.6", - "xtend": "~4.0.1" - } - }, - "xtend": { - "version": "4.0.2", - "dev": true - } - } - }, - "mixin-deep": { - "version": "1.3.2", - "dev": true, - "requires": { - "for-in": "^1.0.2", - "is-extendable": "^1.0.1" - } - }, - "mkdirp": { - "version": "0.5.5", - "dev": true, - "requires": { - "minimist": "^1.2.5" - } - }, - "mkdirp-promise": { - "version": "5.0.1", - "dev": true, - "requires": { - "mkdirp": "*" - } - }, - "modify-values": { - "version": "1.0.1", - "dev": true - }, - "move-concurrently": { - "version": "1.0.1", - "dev": true, - "requires": { - "aproba": "^1.1.1", - "copy-concurrently": "^1.0.0", - "fs-write-stream-atomic": "^1.0.8", - "mkdirp": "^0.5.1", - "rimraf": "^2.5.4", - "run-queue": "^1.0.3" - }, - "dependencies": { - "aproba": { - "version": "1.2.0", - "dev": true - } - } - }, - "ms": { - "version": "2.1.2", - "dev": true - }, - "multimatch": { - "version": "3.0.0", - "dev": true, - "requires": { - "array-differ": "^2.0.3", - "array-union": "^1.0.2", - "arrify": "^1.0.1", - "minimatch": "^3.0.4" - } - }, - "mute-stream": { - "version": "0.0.8", - "dev": true - }, - "mz": { - "version": "2.7.0", - "dev": true, - "requires": { - "any-promise": "^1.0.0", - "object-assign": "^4.0.1", - "thenify-all": "^1.0.0" - } - }, - "nan": { - "version": "2.14.2", - "dev": true, - "optional": true - }, - "nanoid": { - "version": "3.1.21", - "dev": true - }, - "nanomatch": { - "version": "1.2.13", - "dev": true, - "requires": { - "arr-diff": "^4.0.0", - "array-unique": "^0.3.2", - "define-property": "^2.0.2", - "extend-shallow": "^3.0.2", - "fragment-cache": "^0.2.1", - "is-windows": "^1.0.2", - "kind-of": "^6.0.2", - "object.pick": "^1.3.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.1" - } - }, - "natural-compare": { - "version": "1.4.0", - "dev": true - }, - "neo-async": { - "version": "2.6.2", - "dev": true - }, - "nice-try": { - "version": "1.0.5", - "dev": true - }, - "nise": { - "version": "1.5.3", - "dev": true, - "requires": { - "@sinonjs/formatio": "^3.2.1", - "@sinonjs/text-encoding": "^0.7.1", - "just-extend": "^4.0.2", - "lolex": "^5.0.1", - "path-to-regexp": "^1.7.0" - }, - "dependencies": { - "lolex": { - "version": "5.1.2", - "dev": true, - "requires": { - "@sinonjs/commons": "^1.7.0" - } - } - } - }, - "node-fetch": { - "version": "2.6.1", - "dev": true - }, - "node-fetch-npm": { - "version": "2.0.4", - "dev": true, - "requires": { - "encoding": "^0.1.11", - "json-parse-better-errors": "^1.0.0", - "safe-buffer": "^5.1.1" - } - }, - "node-gyp": { - "version": "5.1.1", - "dev": true, - "requires": { - "env-paths": "^2.2.0", - "glob": "^7.1.4", - "graceful-fs": "^4.2.2", - "mkdirp": "^0.5.1", - "nopt": "^4.0.1", - "npmlog": "^4.1.2", - "request": "^2.88.0", - "rimraf": "^2.6.3", - "semver": "^5.7.1", - "tar": "^4.4.12", - "which": "^1.3.1" - }, - "dependencies": { - "semver": { - "version": "5.7.1", - "dev": true - } - } - }, - "node-int64": { - "version": "0.4.0", - "dev": true - }, - "node-modules-regexp": { - "version": "1.0.0", - "dev": true - }, - "node-notifier": { - "version": "5.4.5", - "dev": true, - "requires": { - "growly": "^1.3.0", - "is-wsl": "^1.1.0", - "semver": "^5.5.0", - "shellwords": "^0.1.1", - "which": "^1.3.0" - }, - "dependencies": { - "semver": { - "version": "5.7.1", - "dev": true - } - } - }, - "node-releases": { - "version": "1.1.71", - "dev": true - }, - "nopt": { - "version": "4.0.3", - "dev": true, - "requires": { - "abbrev": "1", - "osenv": "^0.1.4" - } - }, - "normalize-package-data": { - "version": "2.5.0", - "dev": true, - "requires": { - "hosted-git-info": "^2.1.4", - "resolve": "^1.10.0", - "semver": "2 || 3 || 4 || 5", - "validate-npm-package-license": "^3.0.1" - }, - "dependencies": { - "semver": { - "version": "5.7.1", - "dev": true - } - } - }, - "normalize-path": { - "version": "2.1.1", - "dev": true, - "requires": { - "remove-trailing-separator": "^1.0.1" - } - }, - "normalize-url": { - "version": "3.3.0", - "dev": true - }, - "npm-bundled": { - "version": "1.1.1", - "dev": true, - "requires": { - "npm-normalize-package-bin": "^1.0.1" - } - }, - "npm-lifecycle": { - "version": "3.1.5", - "dev": true, - "requires": { - "byline": "^5.0.0", - "graceful-fs": "^4.1.15", - "node-gyp": "^5.0.2", - "resolve-from": "^4.0.0", - "slide": "^1.1.6", - "uid-number": "0.0.6", - "umask": "^1.1.0", - "which": "^1.3.1" - } - }, - "npm-normalize-package-bin": { - "version": "1.0.1", - "dev": true - }, - "npm-package-arg": { - "version": "6.1.1", - "dev": true, - "requires": { - "hosted-git-info": "^2.7.1", - "osenv": "^0.1.5", - "semver": "^5.6.0", - "validate-npm-package-name": "^3.0.0" - }, - "dependencies": { - "semver": { - "version": "5.7.1", - "dev": true - } - } - }, - "npm-packlist": { - "version": "1.4.8", - "dev": true, - "requires": { - "ignore-walk": "^3.0.1", - "npm-bundled": "^1.0.1", - "npm-normalize-package-bin": "^1.0.1" - } - }, - "npm-pick-manifest": { - "version": "3.0.2", - "dev": true, - "requires": { - "figgy-pudding": "^3.5.1", - "npm-package-arg": "^6.0.0", - "semver": "^5.4.1" - }, - "dependencies": { - "semver": { - "version": "5.7.1", - "dev": true - } - } - }, - "npm-run-path": { - "version": "4.0.1", - "dev": true, - "requires": { - "path-key": "^3.0.0" - }, - "dependencies": { - "path-key": { - "version": "3.1.1", - "dev": true - } - } - }, - "npmlog": { - "version": "4.1.2", - "dev": true, - "requires": { - "are-we-there-yet": "~1.1.2", - "console-control-strings": "~1.1.0", - "gauge": "~2.7.3", - "set-blocking": "~2.0.0" - } - }, - "number-is-nan": { - "version": "1.0.1", - "dev": true - }, - "nwsapi": { - "version": "2.2.0", - "dev": true - }, - "oauth-sign": { - "version": "0.9.0", - "dev": true - }, - "object-assign": { - "version": "4.1.1" - }, - "object-copy": { - "version": "0.1.0", - "dev": true, - "requires": { - "copy-descriptor": "^0.1.0", - "define-property": "^0.2.5", - "kind-of": "^3.0.3" - }, - "dependencies": { - "define-property": { - "version": "0.2.5", - "dev": true, - "requires": { - "is-descriptor": "^0.1.0" - } - }, - "is-accessor-descriptor": { - "version": "0.1.6", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - } - }, - "is-data-descriptor": { - "version": "0.1.4", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - } - }, - "is-descriptor": { - "version": "0.1.6", - "dev": true, - "requires": { - "is-accessor-descriptor": "^0.1.6", - "is-data-descriptor": "^0.1.4", - "kind-of": "^5.0.0" - }, - "dependencies": { - "kind-of": { - "version": "5.1.0", - "dev": true - } - } - }, - "kind-of": { - "version": "3.2.2", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "object-inspect": { - "version": "1.9.0", - "dev": true - }, - "object-keys": { - "version": "1.1.1", - "dev": true - }, - "object-visit": { - "version": "1.0.1", - "dev": true, - "requires": { - "isobject": "^3.0.0" - } - }, - "object.assign": { - "version": "4.1.2", - "dev": true, - "requires": { - "call-bind": "^1.0.0", - "define-properties": "^1.1.3", - "has-symbols": "^1.0.1", - "object-keys": "^1.1.1" - } - }, - "object.getownpropertydescriptors": { - "version": "2.1.2", - "dev": true, - "requires": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3", - "es-abstract": "^1.18.0-next.2" - } - }, - "object.omit": { - "version": "2.0.1", - "dev": true, - "requires": { - "for-own": "^0.1.4", - "is-extendable": "^0.1.1" - }, - "dependencies": { - "is-extendable": { - "version": "0.1.1", - "dev": true - } - } - }, - "object.pick": { - "version": "1.3.0", - "dev": true, - "requires": { - "isobject": "^3.0.1" - } - }, - "octokit-pagination-methods": { - "version": "1.1.0", - "dev": true - }, - "once": { - "version": "1.4.0", - "dev": true, - "requires": { - "wrappy": "1" - } - }, - "onetime": { - "version": "5.1.2", - "dev": true, - "requires": { - "mimic-fn": "^2.1.0" - } - }, - "open": { - "version": "7.4.2", - "dev": true, - "requires": { - "is-docker": "^2.0.0", - "is-wsl": "^2.1.1" - }, - "dependencies": { - "is-wsl": { - "version": "2.2.0", - "dev": true, - "requires": { - "is-docker": "^2.0.0" - } - } - } - }, - "opener": { - "version": "1.4.3", - "dev": true - }, - "optimist": { - "version": "0.6.1", - "dev": true, - "requires": { - "minimist": "~0.0.1", - "wordwrap": "~0.0.2" - }, - "dependencies": { - "minimist": { - "version": "0.0.10", - "dev": true - }, - "wordwrap": { - "version": "0.0.3", - "dev": true - } - } - }, - "optionator": { - "version": "0.8.3", - "dev": true, - "requires": { - "deep-is": "~0.1.3", - "fast-levenshtein": "~2.0.6", - "levn": "~0.3.0", - "prelude-ls": "~1.1.2", - "type-check": "~0.3.2", - "word-wrap": "~1.2.3" - } - }, - "opts": { - "version": "2.0.2", - "dev": true - }, - "os-homedir": { - "version": "1.0.2", - "dev": true - }, - "os-name": { - "version": "3.1.0", - "dev": true, - "requires": { - "macos-release": "^2.2.0", - "windows-release": "^3.1.0" - } - }, - "os-tmpdir": { - "version": "1.0.2", - "dev": true - }, - "osenv": { - "version": "0.1.5", - "dev": true, - "requires": { - "os-homedir": "^1.0.0", - "os-tmpdir": "^1.0.0" - } - }, - "ospec": { - "version": "3.1.0", - "dev": true, - "requires": { - "glob": "^7.1.3" - } - }, - "p-each-series": { - "version": "1.0.0", - "dev": true, - "requires": { - "p-reduce": "^1.0.0" - } - }, - "p-finally": { - "version": "1.0.0", - "dev": true - }, - "p-limit": { - "version": "2.3.0", - "dev": true, - "requires": { - "p-try": "^2.0.0" - } - }, - "p-locate": { - "version": "3.0.0", - "dev": true, - "requires": { - "p-limit": "^2.0.0" - } - }, - "p-map": { - "version": "2.1.0", - "dev": true - }, - "p-map-series": { - "version": "1.0.0", - "dev": true, - "requires": { - "p-reduce": "^1.0.0" - } - }, - "p-pipe": { - "version": "1.2.0", - "dev": true - }, - "p-queue": { - "version": "4.0.0", - "dev": true, - "requires": { - "eventemitter3": "^3.1.0" - }, - "dependencies": { - "eventemitter3": { - "version": "3.1.2", - "dev": true - } - } - }, - "p-reduce": { - "version": "1.0.0", - "dev": true - }, - "p-try": { - "version": "2.2.0", - "dev": true - }, - "p-waterfall": { - "version": "1.0.0", - "dev": true, - "requires": { - "p-reduce": "^1.0.0" - } - }, - "parallel-transform": { - "version": "1.2.0", - "dev": true, - "requires": { - "cyclist": "^1.0.1", - "inherits": "^2.0.3", - "readable-stream": "^2.1.5" - }, - "dependencies": { - "isarray": { - "version": "1.0.0", - "dev": true - }, - "readable-stream": { - "version": "2.3.7", - "dev": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "string_decoder": { - "version": "1.1.1", - "dev": true, - "requires": { - "safe-buffer": "~5.1.0" - } - } - } - }, - "parent-module": { - "version": "1.0.1", - "dev": true, - "requires": { - "callsites": "^3.0.0" - } - }, - "parse-github-repo-url": { - "version": "1.4.1", - "dev": true - }, - "parse-glob": { - "version": "3.0.4", - "dev": true, - "requires": { - "glob-base": "^0.3.0", - "is-dotfile": "^1.0.0", - "is-extglob": "^1.0.0", - "is-glob": "^2.0.0" - }, - "dependencies": { - "is-extglob": { - "version": "1.0.0", - "dev": true - }, - "is-glob": { - "version": "2.0.1", - "dev": true, - "requires": { - "is-extglob": "^1.0.0" - } - } - } - }, - "parse-int": { - "version": "1.0.3", - "requires": { - "is-integer": "^1.0.4" - } - }, - "parse-json": { - "version": "4.0.0", - "dev": true, - "requires": { - "error-ex": "^1.3.1", - "json-parse-better-errors": "^1.0.1" - } - }, - "parse-path": { - "version": "4.0.3", - "dev": true, - "requires": { - "is-ssh": "^1.3.0", - "protocols": "^1.4.0", - "qs": "^6.9.4", - "query-string": "^6.13.8" - } - }, - "parse-uri": { - "version": "1.0.3" - }, - "parse-url": { - "version": "5.0.2", - "dev": true, - "requires": { - "is-ssh": "^1.3.0", - "normalize-url": "^3.3.0", - "parse-path": "^4.0.0", - "protocols": "^1.4.0" - } - }, - "parse5": { - "version": "4.0.0", - "dev": true - }, - "pascalcase": { - "version": "0.1.1", - "dev": true - }, - "path-dirname": { - "version": "1.0.2", - "dev": true - }, - "path-exists": { - "version": "3.0.0", - "dev": true - }, - "path-is-absolute": { - "version": "1.0.1", - "dev": true - }, - "path-key": { - "version": "2.0.1", - "dev": true - }, - "path-parse": { - "version": "1.0.6", - "dev": true - }, - "path-to-regexp": { - "version": "1.8.0", - "dev": true, - "requires": { - "isarray": "0.0.1" - } - }, - "path-type": { - "version": "3.0.0", - "dev": true, - "requires": { - "pify": "^3.0.0" - }, - "dependencies": { - "pify": { - "version": "3.0.0", - "dev": true - } - } - }, - "performance-now": { - "version": "2.1.0", - "dev": true - }, - "picomatch": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.3.tgz", - "integrity": "sha512-KpELjfwcCDUb9PeigTs2mBJzXUPzAuP2oPcA989He8Rte0+YUAjw1JVedDhuTKPkHjSYzMN3npC9luThGYEKdg==", - "dev": true - }, - "pify": { - "version": "4.0.1", - "dev": true - }, - "pinkie": { - "version": "2.0.4", - "dev": true - }, - "pinkie-promise": { - "version": "2.0.1", - "dev": true, - "requires": { - "pinkie": "^2.0.0" - } - }, - "pirates": { - "version": "4.0.1", - "dev": true, - "requires": { - "node-modules-regexp": "^1.0.0" - } - }, - "pixi-gl-core": { - "version": "1.1.4" - }, - "pixi.js": { - "version": "4.8.9", - "requires": { - "bit-twiddle": "^1.0.2", - "earcut": "^2.1.4", - "eventemitter3": "^2.0.0", - "ismobilejs": "^0.5.1", - "object-assign": "^4.0.1", - "pixi-gl-core": "^1.1.4", - "remove-array-items": "^1.0.0", - "resource-loader": "^2.2.3" - }, - "dependencies": { - "eventemitter3": { - "version": "2.0.3" - }, - "resource-loader": { - "version": "2.2.4", - "requires": { - "mini-signals": "^1.1.1", - "parse-uri": "^1.0.0" - } - } - } - }, - "pkg-dir": { - "version": "3.0.0", - "dev": true, - "requires": { - "find-up": "^3.0.0" - } - }, - "pn": { - "version": "1.1.0", - "dev": true - }, - "portfinder": { - "version": "1.0.28", - "dev": true, - "requires": { - "async": "^2.6.2", - "debug": "^3.1.1", - "mkdirp": "^0.5.5" - }, - "dependencies": { - "debug": { - "version": "3.2.7", - "dev": true, - "requires": { - "ms": "^2.1.1" - } - } - } - }, - "posix-character-classes": { - "version": "0.1.1", - "dev": true - }, - "prelude-ls": { - "version": "1.1.2", - "dev": true - }, - "preserve": { - "version": "0.2.0", - "dev": true - }, - "prettier": { - "version": "2.2.1", - "dev": true - }, - "prettier-linter-helpers": { - "version": "1.0.0", - "dev": true, - "requires": { - "fast-diff": "^1.1.2" - } - }, - "pretty-format": { - "version": "24.9.0", - "dev": true, - "requires": { - "@jest/types": "^24.9.0", - "ansi-regex": "^4.0.0", - "ansi-styles": "^3.2.0", - "react-is": "^16.8.4" - }, - "dependencies": { - "ansi-styles": { - "version": "3.2.1", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "color-convert": { - "version": "1.9.3", - "dev": true, - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "dev": true - } - } - }, - "process": { - "version": "0.5.2" - }, - "process-nextick-args": { - "version": "2.0.1", - "dev": true - }, - "progress": { - "version": "2.0.3", - "dev": true - }, - "promise-inflight": { - "version": "1.0.1", - "dev": true - }, - "promise-retry": { - "version": "1.1.1", - "dev": true, - "requires": { - "err-code": "^1.0.0", - "retry": "^0.10.0" - } - }, - "prompts": { - "version": "2.4.0", - "dev": true, - "requires": { - "kleur": "^3.0.3", - "sisteransi": "^1.0.5" - } - }, - "promzard": { - "version": "0.3.0", - "dev": true, - "requires": { - "read": "1" - } - }, - "proto-list": { - "version": "1.2.4", - "dev": true - }, - "protocols": { - "version": "1.4.8", - "dev": true - }, - "protoduck": { - "version": "5.0.1", - "dev": true, - "requires": { - "genfun": "^5.0.0" - } - }, - "psl": { - "version": "1.8.0", - "dev": true - }, - "pump": { - "version": "3.0.0", - "dev": true, - "requires": { - "end-of-stream": "^1.1.0", - "once": "^1.3.1" - } - }, - "pumpify": { - "version": "1.5.1", - "dev": true, - "requires": { - "duplexify": "^3.6.0", - "inherits": "^2.0.3", - "pump": "^2.0.0" - }, - "dependencies": { - "pump": { - "version": "2.0.1", - "dev": true, - "requires": { - "end-of-stream": "^1.1.0", - "once": "^1.3.1" - } - } - } - }, - "punycode": { - "version": "2.1.1", - "dev": true - }, - "q": { - "version": "1.5.1", - "dev": true - }, - "qs": { - "version": "6.9.6", - "dev": true - }, - "query-string": { - "version": "6.14.1", - "dev": true, - "requires": { - "decode-uri-component": "^0.2.0", - "filter-obj": "^1.1.0", - "split-on-first": "^1.0.0", - "strict-uri-encode": "^2.0.0" - } - }, - "queue-microtask": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", - "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", - "dev": true - }, - "quick-lru": { - "version": "4.0.1", - "dev": true - }, - "randomatic": { - "version": "3.1.1", - "dev": true, - "requires": { - "is-number": "^4.0.0", - "kind-of": "^6.0.0", - "math-random": "^1.0.1" - }, - "dependencies": { - "is-number": { - "version": "4.0.0", - "dev": true - } - } - }, - "randombytes": { - "version": "2.1.0", - "dev": true, - "requires": { - "safe-buffer": "^5.1.0" - } - }, - "react-is": { - "version": "16.13.1", - "dev": true - }, - "read": { - "version": "1.0.7", - "dev": true, - "requires": { - "mute-stream": "~0.0.4" - } - }, - "read-cmd-shim": { - "version": "1.0.5", - "dev": true, - "requires": { - "graceful-fs": "^4.1.2" - } - }, - "read-package-json": { - "version": "2.1.2", - "dev": true, - "requires": { - "glob": "^7.1.1", - "json-parse-even-better-errors": "^2.3.0", - "normalize-package-data": "^2.0.0", - "npm-normalize-package-bin": "^1.0.0" - } - }, - "read-package-tree": { - "version": "5.3.1", - "dev": true, - "requires": { - "read-package-json": "^2.0.0", - "readdir-scoped-modules": "^1.0.0", - "util-promisify": "^2.1.0" - } - }, - "read-pkg": { - "version": "3.0.0", - "dev": true, - "requires": { - "load-json-file": "^4.0.0", - "normalize-package-data": "^2.3.2", - "path-type": "^3.0.0" - }, - "dependencies": { - "load-json-file": { - "version": "4.0.0", - "dev": true, - "requires": { - "graceful-fs": "^4.1.2", - "parse-json": "^4.0.0", - "pify": "^3.0.0", - "strip-bom": "^3.0.0" - } - }, - "pify": { - "version": "3.0.0", - "dev": true - } - } - }, - "read-pkg-up": { - "version": "3.0.0", - "dev": true, - "requires": { - "find-up": "^2.0.0", - "read-pkg": "^3.0.0" - }, - "dependencies": { - "find-up": { - "version": "2.1.0", - "dev": true, - "requires": { - "locate-path": "^2.0.0" - } - }, - "locate-path": { - "version": "2.0.0", - "dev": true, - "requires": { - "p-locate": "^2.0.0", - "path-exists": "^3.0.0" - } - }, - "p-limit": { - "version": "1.3.0", - "dev": true, - "requires": { - "p-try": "^1.0.0" - } - }, - "p-locate": { - "version": "2.0.0", - "dev": true, - "requires": { - "p-limit": "^1.1.0" - } - }, - "p-try": { - "version": "1.0.0", - "dev": true - } - } - }, - "readable-stream": { - "version": "3.6.0", - "dev": true, - "requires": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - } - }, - "readdir-scoped-modules": { - "version": "1.1.0", - "dev": true, - "requires": { - "debuglog": "^1.0.1", - "dezalgo": "^1.0.0", - "graceful-fs": "^4.1.2", - "once": "^1.3.0" - } - }, - "readdirp": { - "version": "3.5.0", - "dev": true, - "requires": { - "picomatch": "^2.2.1" - } - }, - "realpath-native": { - "version": "1.1.0", - "dev": true, - "requires": { - "util.promisify": "^1.0.0" - } - }, - "rechoir": { - "version": "0.6.2", - "dev": true, - "requires": { - "resolve": "^1.1.6" - } - }, - "redent": { - "version": "3.0.0", - "dev": true, - "requires": { - "indent-string": "^4.0.0", - "strip-indent": "^3.0.0" - } - }, - "regex-cache": { - "version": "0.4.4", - "dev": true, - "requires": { - "is-equal-shallow": "^0.1.3" - } - }, - "regex-not": { - "version": "1.0.2", - "dev": true, - "requires": { - "extend-shallow": "^3.0.2", - "safe-regex": "^1.1.0" - } - }, - "regexpp": { - "version": "2.0.1", - "dev": true - }, - "remove-array-items": { - "version": "1.1.1" - }, - "remove-trailing-separator": { - "version": "1.1.0", - "dev": true - }, - "repeat-element": { - "version": "1.1.3", - "dev": true - }, - "repeat-string": { - "version": "1.6.1", - "dev": true - }, - "repeating": { - "version": "2.0.1", - "dev": true, - "requires": { - "is-finite": "^1.0.0" - } - }, - "request": { - "version": "2.88.2", - "dev": true, - "requires": { - "aws-sign2": "~0.7.0", - "aws4": "^1.8.0", - "caseless": "~0.12.0", - "combined-stream": "~1.0.6", - "extend": "~3.0.2", - "forever-agent": "~0.6.1", - "form-data": "~2.3.2", - "har-validator": "~5.1.3", - "http-signature": "~1.2.0", - "is-typedarray": "~1.0.0", - "isstream": "~0.1.2", - "json-stringify-safe": "~5.0.1", - "mime-types": "~2.1.19", - "oauth-sign": "~0.9.0", - "performance-now": "^2.1.0", - "qs": "~6.5.2", - "safe-buffer": "^5.1.2", - "tough-cookie": "~2.5.0", - "tunnel-agent": "^0.6.0", - "uuid": "^3.3.2" - }, - "dependencies": { - "qs": { - "version": "6.5.2", - "dev": true - } - } - }, - "request-promise-core": { - "version": "1.1.4", - "dev": true, - "requires": { - "lodash": "^4.17.19" - } - }, - "request-promise-native": { - "version": "1.0.9", - "dev": true, - "requires": { - "request-promise-core": "1.1.4", - "stealthy-require": "^1.1.1", - "tough-cookie": "^2.3.3" - } - }, - "require-directory": { - "version": "2.1.1", - "dev": true - }, - "require-main-filename": { - "version": "2.0.0", - "dev": true - }, - "require-relative": { - "version": "0.8.7", - "dev": true - }, - "requires-port": { - "version": "1.0.0", - "dev": true - }, - "resolve": { - "version": "1.17.0", - "dev": true, - "requires": { - "path-parse": "^1.0.6" - } - }, - "resolve-cwd": { - "version": "2.0.0", - "dev": true, - "requires": { - "resolve-from": "^3.0.0" - }, - "dependencies": { - "resolve-from": { - "version": "3.0.0", - "dev": true - } - } - }, - "resolve-from": { - "version": "4.0.0", - "dev": true - }, - "resolve-url": { - "version": "0.2.1", - "dev": true - }, - "resource-loader": { - "version": "4.0.0-rc4", - "requires": { - "parse-uri": "^1.0.0", - "type-signals": "^1.0.3" - } - }, - "restore-cursor": { - "version": "3.1.0", - "dev": true, - "requires": { - "onetime": "^5.1.0", - "signal-exit": "^3.0.2" - } - }, - "ret": { - "version": "0.1.15", - "dev": true - }, - "retry": { - "version": "0.10.1", - "dev": true - }, - "reusify": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", - "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", - "dev": true - }, - "rimraf": { - "version": "2.6.3", - "dev": true, - "requires": { - "glob": "^7.1.3" - } - }, - "rollup": { - "version": "2.53.2", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.53.2.tgz", - "integrity": "sha512-1CtEYuS5CRCzFZ7SNW5528SlDlk4VDXIRGwbm/2POQxA/G4+7/crIqJwkmnj8Q/74hGx4oVlNvh4E1CJQ5hZ6w==", - "dev": true, - "requires": { - "fsevents": "~2.3.2" - }, - "dependencies": { - "fsevents": { - "version": "2.3.2", - "dev": true, - "optional": true - } - } - }, - "rollup-plugin-analyzer": { - "version": "3.3.0", - "dev": true - }, - "rollup-plugin-copy": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/rollup-plugin-copy/-/rollup-plugin-copy-3.4.0.tgz", - "integrity": "sha512-rGUmYYsYsceRJRqLVlE9FivJMxJ7X6jDlP79fmFkL8sJs7VVMSVyA2yfyL+PGyO/vJs4A87hwhgVfz61njI+uQ==", - "dev": true, - "requires": { - "@types/fs-extra": "^8.0.1", - "colorette": "^1.1.0", - "fs-extra": "^8.1.0", - "globby": "10.0.1", - "is-plain-object": "^3.0.0" - }, - "dependencies": { - "@nodelib/fs.stat": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.4.tgz", - "integrity": "sha512-IYlHJA0clt2+Vg7bccq+TzRdJvv19c2INqBSsoOLp1je7xjtr7J26+WXR72MCdvU9q1qTzIWDfhMf+DRvQJK4Q==", - "dev": true - }, - "array-union": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", - "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", - "dev": true - }, - "braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", - "dev": true, - "requires": { - "fill-range": "^7.0.1" - } - }, - "dir-glob": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", - "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", - "dev": true, - "requires": { - "path-type": "^4.0.0" - } - }, - "fast-glob": { - "version": "3.2.5", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.5.tgz", - "integrity": "sha512-2DtFcgT68wiTTiwZ2hNdJfcHNke9XOfnwmBRWXhmeKM8rF0TGwmC/Qto3S7RoZKp5cilZbxzO5iTNTQsJ+EeDg==", - "dev": true, - "requires": { - "@nodelib/fs.stat": "^2.0.2", - "@nodelib/fs.walk": "^1.2.3", - "glob-parent": "^5.1.0", - "merge2": "^1.3.0", - "micromatch": "^4.0.2", - "picomatch": "^2.2.1" - } - }, - "fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", - "dev": true, - "requires": { - "to-regex-range": "^5.0.1" - } - }, - "fs-extra": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", - "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==", - "dev": true, - "requires": { - "graceful-fs": "^4.2.0", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - } - }, - "globby": { - "version": "10.0.1", - "resolved": "https://registry.npmjs.org/globby/-/globby-10.0.1.tgz", - "integrity": "sha512-sSs4inE1FB2YQiymcmTv6NWENryABjUNPeWhOvmn4SjtKybglsyPZxFB3U1/+L1bYi0rNZDqCLlHyLYDl1Pq5A==", - "dev": true, - "requires": { - "@types/glob": "^7.1.1", - "array-union": "^2.1.0", - "dir-glob": "^3.0.1", - "fast-glob": "^3.0.3", - "glob": "^7.1.3", - "ignore": "^5.1.1", - "merge2": "^1.2.3", - "slash": "^3.0.0" - } - }, - "ignore": { - "version": "5.1.8", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.8.tgz", - "integrity": "sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw==", - "dev": true - }, - "is-number": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", - "dev": true - }, - "is-plain-object": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-3.0.1.tgz", - "integrity": "sha512-Xnpx182SBMrr/aBik8y+GuR4U1L9FqMSojwDQwPMmxyC6bvEqly9UBCxhauBF5vNh2gwWJNX6oDV7O+OM4z34g==", - "dev": true - }, - "jsonfile": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", - "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", - "dev": true, - "requires": { - "graceful-fs": "^4.1.6" - } - }, - "micromatch": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.4.tgz", - "integrity": "sha512-pRmzw/XUcwXGpD9aI9q/0XOwLNygjETJ8y0ao0wdqprrzDa4YnxLcz7fQRZr8voh8V10kGhABbNcHVk5wHgWwg==", - "dev": true, - "requires": { - "braces": "^3.0.1", - "picomatch": "^2.2.3" - } - }, - "path-type": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", - "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", - "dev": true - }, - "to-regex-range": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", - "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", - "dev": true, - "requires": { - "is-number": "^7.0.0" - } - }, - "universalify": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", - "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", - "dev": true - } - } - }, - "rollup-plugin-import-alias": { - "version": "1.0.10", - "dev": true - }, - "rollup-plugin-inject": { - "version": "3.0.2", - "dev": true, - "requires": { - "estree-walker": "^0.6.1", - "magic-string": "^0.25.3", - "rollup-pluginutils": "^2.8.1" - }, - "dependencies": { - "estree-walker": { - "version": "0.6.1", - "dev": true - } - } - }, - "rollup-plugin-livereload": { - "version": "1.3.0", - "dev": true, - "requires": { - "livereload": "^0.9.1" - } - }, - "rollup-plugin-modify": { - "version": "3.0.0", - "dev": true, - "requires": { - "magic-string": "0.25.2", - "ospec": "3.1.0" - }, - "dependencies": { - "magic-string": { - "version": "0.25.2", - "dev": true, - "requires": { - "sourcemap-codec": "^1.4.4" - } - } - } - }, - "rollup-plugin-node-resolve": { - "version": "5.2.0", - "dev": true, - "requires": { - "@types/resolve": "0.0.8", - "builtin-modules": "^3.1.0", - "is-module": "^1.0.0", - "resolve": "^1.11.1", - "rollup-pluginutils": "^2.8.1" - } - }, - "rollup-plugin-polyfill-node": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/rollup-plugin-polyfill-node/-/rollup-plugin-polyfill-node-0.6.2.tgz", - "integrity": "sha512-gMCVuR0zsKq0jdBn8pSXN1Ejsc458k2QsFFvQdbHoM0Pot5hEnck+pBP/FDwFS6uAi77pD3rDTytsaUStsOMlA==", - "dev": true, - "requires": { - "@rollup/plugin-inject": "^4.0.0" - } - }, - "rollup-plugin-replace": { - "version": "2.2.0", - "dev": true, - "requires": { - "magic-string": "^0.25.2", - "rollup-pluginutils": "^2.6.0" - } - }, - "rollup-plugin-serve": { - "version": "1.1.0", - "dev": true, - "requires": { - "mime": ">=2.4.6", - "opener": "1" - }, - "dependencies": { - "mime": { - "version": "2.5.2", - "dev": true - } - } - }, - "rollup-plugin-sourcemaps": { - "version": "0.4.2", - "dev": true, - "requires": { - "rollup-pluginutils": "^2.0.1", - "source-map-resolve": "^0.5.0" - } - }, - "rollup-plugin-terser": { - "version": "7.0.2", - "dev": true, - "requires": { - "@babel/code-frame": "^7.10.4", - "jest-worker": "^26.2.1", - "serialize-javascript": "^4.0.0", - "terser": "^5.0.0" - }, - "dependencies": { - "jest-worker": { - "version": "26.6.2", - "dev": true, - "requires": { - "@types/node": "*", - "merge-stream": "^2.0.0", - "supports-color": "^7.0.0" - } - }, - "source-map": { - "version": "0.7.3", - "dev": true - }, - "terser": { - "version": "5.6.0", - "dev": true, - "requires": { - "commander": "^2.20.0", - "source-map": "~0.7.2", - "source-map-support": "~0.5.19" - } - } - } - }, - "rollup-plugin-typescript2": { - "version": "0.24.3", - "dev": true, - "requires": { - "find-cache-dir": "^3.0.0", - "fs-extra": "8.1.0", - "resolve": "1.12.0", - "rollup-pluginutils": "2.8.1", - "tslib": "1.10.0" - }, - "dependencies": { - "estree-walker": { - "version": "0.6.1", - "dev": true - }, - "fs-extra": { - "version": "8.1.0", - "dev": true, - "requires": { - "graceful-fs": "^4.2.0", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - } - }, - "jsonfile": { - "version": "4.0.0", - "dev": true, - "requires": { - "graceful-fs": "^4.1.6" - } - }, - "resolve": { - "version": "1.12.0", - "dev": true, - "requires": { - "path-parse": "^1.0.6" - } - }, - "rollup-pluginutils": { - "version": "2.8.1", - "dev": true, - "requires": { - "estree-walker": "^0.6.1" - } - }, - "tslib": { - "version": "1.10.0", - "dev": true - }, - "universalify": { - "version": "0.1.2", - "dev": true - } - } - }, - "rollup-plugin-visualizer": { - "version": "4.2.0", - "dev": true, - "requires": { - "nanoid": "^3.0.1", - "open": "^7.0.3", - "source-map": "^0.7.3", - "yargs": "^16.0.3" - }, - "dependencies": { - "ansi-regex": { - "version": "5.0.0", - "dev": true - }, - "cliui": { - "version": "7.0.4", - "dev": true, - "requires": { - "string-width": "^4.2.0", - "strip-ansi": "^6.0.0", - "wrap-ansi": "^7.0.0" - } - }, - "source-map": { - "version": "0.7.3", - "dev": true - }, - "strip-ansi": { - "version": "6.0.0", - "dev": true, - "requires": { - "ansi-regex": "^5.0.0" - } - }, - "wrap-ansi": { - "version": "7.0.0", - "dev": true, - "requires": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - } - }, - "y18n": { - "version": "5.0.5", - "dev": true - }, - "yargs": { - "version": "16.2.0", - "dev": true, - "requires": { - "cliui": "^7.0.2", - "escalade": "^3.1.1", - "get-caller-file": "^2.0.5", - "require-directory": "^2.1.1", - "string-width": "^4.2.0", - "y18n": "^5.0.5", - "yargs-parser": "^20.2.2" - } - } - } - }, - "rollup-pluginutils": { - "version": "2.8.2", - "dev": true, - "requires": { - "estree-walker": "^0.6.1" - }, - "dependencies": { - "estree-walker": { - "version": "0.6.1", - "dev": true - } - } - }, - "rollup-watch": { - "version": "4.3.1", - "dev": true, - "requires": { - "chokidar": "^1.7.0", - "require-relative": "0.8.7", - "rollup-pluginutils": "^2.0.1" - }, - "dependencies": { - "anymatch": { - "version": "1.3.2", - "dev": true, - "requires": { - "micromatch": "^2.1.5", - "normalize-path": "^2.0.0" - }, - "dependencies": { - "micromatch": { - "version": "2.3.11", - "dev": true, - "requires": { - "arr-diff": "^2.0.0", - "array-unique": "^0.2.1", - "braces": "^1.8.2", - "expand-brackets": "^0.1.4", - "extglob": "^0.3.1", - "filename-regex": "^2.0.0", - "is-extglob": "^1.0.0", - "is-glob": "^2.0.1", - "kind-of": "^3.0.2", - "normalize-path": "^2.0.1", - "object.omit": "^2.0.0", - "parse-glob": "^3.0.4", - "regex-cache": "^0.4.2" - } - } - } - }, - "arr-diff": { - "version": "2.0.0", - "dev": true, - "requires": { - "arr-flatten": "^1.0.1" - } - }, - "array-unique": { - "version": "0.2.1", - "dev": true - }, - "binary-extensions": { - "version": "1.13.1", - "dev": true - }, - "braces": { - "version": "1.8.5", - "dev": true, - "requires": { - "expand-range": "^1.8.1", - "preserve": "^0.2.0", - "repeat-element": "^1.1.2" - } - }, - "chokidar": { - "version": "1.7.0", - "dev": true, - "requires": { - "anymatch": "^1.3.0", - "async-each": "^1.0.0", - "fsevents": "^1.0.0", - "glob-parent": "^2.0.0", - "inherits": "^2.0.1", - "is-binary-path": "^1.0.0", - "is-glob": "^2.0.0", - "path-is-absolute": "^1.0.0", - "readdirp": "^2.0.0" - } - }, - "expand-brackets": { - "version": "0.1.5", - "dev": true, - "requires": { - "is-posix-bracket": "^0.1.0" - } - }, - "extglob": { - "version": "0.3.2", - "dev": true, - "requires": { - "is-extglob": "^1.0.0" - } - }, - "glob-parent": { - "version": "2.0.0", - "dev": true, - "requires": { - "is-glob": "^2.0.0" - } - }, - "is-binary-path": { - "version": "1.0.1", - "dev": true, - "requires": { - "binary-extensions": "^1.0.0" - } - }, - "is-extglob": { - "version": "1.0.0", - "dev": true - }, - "is-glob": { - "version": "2.0.1", - "dev": true, - "requires": { - "is-extglob": "^1.0.0" - } - }, - "isarray": { - "version": "1.0.0", - "dev": true - }, - "kind-of": { - "version": "3.2.2", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - }, - "readable-stream": { - "version": "2.3.7", - "dev": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "readdirp": { - "version": "2.2.1", - "dev": true, - "requires": { - "graceful-fs": "^4.1.11", - "micromatch": "^3.1.10", - "readable-stream": "^2.0.2" - } - }, - "string_decoder": { - "version": "1.1.1", - "dev": true, - "requires": { - "safe-buffer": "~5.1.0" - } - } - } - }, - "rsvp": { - "version": "4.8.5", - "dev": true - }, - "run-async": { - "version": "2.4.1", - "dev": true - }, - "run-parallel": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", - "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", - "dev": true, - "requires": { - "queue-microtask": "^1.2.2" - } - }, - "run-queue": { - "version": "1.0.3", - "dev": true, - "requires": { - "aproba": "^1.1.1" - }, - "dependencies": { - "aproba": { - "version": "1.2.0", - "dev": true - } - } - }, - "rxjs": { - "version": "6.6.6", - "dev": true, - "requires": { - "tslib": "^1.9.0" - } - }, - "safe-buffer": { - "version": "5.1.2", - "dev": true - }, - "safe-regex": { - "version": "1.1.0", - "dev": true, - "requires": { - "ret": "~0.1.10" - } - }, - "safer-buffer": { - "version": "2.1.2", - "dev": true - }, - "sane": { - "version": "4.1.0", - "dev": true, - "requires": { - "@cnakazawa/watch": "^1.0.3", - "anymatch": "^2.0.0", - "capture-exit": "^2.0.0", - "exec-sh": "^0.3.2", - "execa": "^1.0.0", - "fb-watchman": "^2.0.0", - "micromatch": "^3.1.4", - "minimist": "^1.1.1", - "walker": "~1.0.5" - }, - "dependencies": { - "execa": { - "version": "1.0.0", - "dev": true, - "requires": { - "cross-spawn": "^6.0.0", - "get-stream": "^4.0.0", - "is-stream": "^1.1.0", - "npm-run-path": "^2.0.0", - "p-finally": "^1.0.0", - "signal-exit": "^3.0.0", - "strip-eof": "^1.0.0" - } - }, - "get-stream": { - "version": "4.1.0", - "dev": true, - "requires": { - "pump": "^3.0.0" - } - }, - "is-stream": { - "version": "1.1.0", - "dev": true - }, - "npm-run-path": { - "version": "2.0.2", - "dev": true, - "requires": { - "path-key": "^2.0.0" - } - } - } - }, - "sax": { - "version": "1.2.4", - "dev": true - }, - "selenium-server": { - "version": "3.141.59", - "dev": true - }, - "semver": { - "version": "7.3.4", - "dev": true, - "requires": { - "lru-cache": "^6.0.0" - }, - "dependencies": { - "lru-cache": { - "version": "6.0.0", - "dev": true, - "requires": { - "yallist": "^4.0.0" - } - }, - "yallist": { - "version": "4.0.0", - "dev": true - } - } - }, - "serialize-javascript": { - "version": "4.0.0", - "dev": true, - "requires": { - "randombytes": "^2.1.0" - } - }, - "set-blocking": { - "version": "2.0.0", - "dev": true - }, - "set-value": { - "version": "2.0.1", - "dev": true, - "requires": { - "extend-shallow": "^2.0.1", - "is-extendable": "^0.1.1", - "is-plain-object": "^2.0.3", - "split-string": "^3.0.1" - }, - "dependencies": { - "extend-shallow": { - "version": "2.0.1", - "dev": true, - "requires": { - "is-extendable": "^0.1.0" - } - }, - "is-extendable": { - "version": "0.1.1", - "dev": true - }, - "is-plain-object": { - "version": "2.0.4", - "dev": true, - "requires": { - "isobject": "^3.0.1" - } - } - } - }, - "shallow-clone": { - "version": "3.0.1", - "dev": true, - "requires": { - "kind-of": "^6.0.2" - } - }, - "shebang-command": { - "version": "1.2.0", - "dev": true, - "requires": { - "shebang-regex": "^1.0.0" - } - }, - "shebang-regex": { - "version": "1.0.0", - "dev": true - }, - "shelljs": { - "version": "0.8.4", - "dev": true, - "requires": { - "glob": "^7.0.0", - "interpret": "^1.0.0", - "rechoir": "^0.6.2" - } - }, - "shellwords": { - "version": "0.1.1", - "dev": true - }, - "signal-exit": { - "version": "3.0.3", - "dev": true - }, - "sinon": { - "version": "7.5.0", - "dev": true, - "requires": { - "@sinonjs/commons": "^1.4.0", - "@sinonjs/formatio": "^3.2.1", - "@sinonjs/samsam": "^3.3.3", - "diff": "^3.5.0", - "lolex": "^4.2.0", - "nise": "^1.5.2", - "supports-color": "^5.5.0" - }, - "dependencies": { - "has-flag": { - "version": "3.0.0", - "dev": true - }, - "supports-color": { - "version": "5.5.0", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - } - } - }, - "sisteransi": { - "version": "1.0.5", - "dev": true - }, - "slash": { - "version": "3.0.0", - "dev": true - }, - "slice-ansi": { - "version": "2.1.0", - "dev": true, - "requires": { - "ansi-styles": "^3.2.0", - "astral-regex": "^1.0.0", - "is-fullwidth-code-point": "^2.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "3.2.1", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "color-convert": { - "version": "1.9.3", - "dev": true, - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "dev": true - } - } - }, - "slide": { - "version": "1.1.6", - "dev": true - }, - "smart-buffer": { - "version": "4.1.0", - "dev": true - }, - "snapdragon": { - "version": "0.8.2", - "dev": true, - "requires": { - "base": "^0.11.1", - "debug": "^2.2.0", - "define-property": "^0.2.5", - "extend-shallow": "^2.0.1", - "map-cache": "^0.2.2", - "source-map": "^0.5.6", - "source-map-resolve": "^0.5.0", - "use": "^3.1.0" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "define-property": { - "version": "0.2.5", - "dev": true, - "requires": { - "is-descriptor": "^0.1.0" - } - }, - "extend-shallow": { - "version": "2.0.1", - "dev": true, - "requires": { - "is-extendable": "^0.1.0" - } - }, - "is-accessor-descriptor": { - "version": "0.1.6", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "is-data-descriptor": { - "version": "0.1.4", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "is-descriptor": { - "version": "0.1.6", - "dev": true, - "requires": { - "is-accessor-descriptor": "^0.1.6", - "is-data-descriptor": "^0.1.4", - "kind-of": "^5.0.0" - } - }, - "is-extendable": { - "version": "0.1.1", - "dev": true - }, - "kind-of": { - "version": "5.1.0", - "dev": true - }, - "ms": { - "version": "2.0.0", - "dev": true - }, - "source-map": { - "version": "0.5.7", - "dev": true - } - } - }, - "snapdragon-node": { - "version": "2.1.1", - "dev": true, - "requires": { - "define-property": "^1.0.0", - "isobject": "^3.0.0", - "snapdragon-util": "^3.0.1" - }, - "dependencies": { - "define-property": { - "version": "1.0.0", - "dev": true, - "requires": { - "is-descriptor": "^1.0.0" - } - } - } - }, - "snapdragon-util": { - "version": "3.0.1", - "dev": true, - "requires": { - "kind-of": "^3.2.0" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "socks": { - "version": "2.3.3", - "dev": true, - "requires": { - "ip": "1.1.5", - "smart-buffer": "^4.1.0" - } - }, - "socks-proxy-agent": { - "version": "4.0.2", - "dev": true, - "requires": { - "agent-base": "~4.2.1", - "socks": "~2.3.2" - }, - "dependencies": { - "agent-base": { - "version": "4.2.1", - "dev": true, - "requires": { - "es6-promisify": "^5.0.0" - } - } - } - }, - "sort-keys": { - "version": "2.0.0", - "dev": true, - "requires": { - "is-plain-obj": "^1.0.0" - } - }, - "source-map": { - "version": "0.6.1", - "dev": true - }, - "source-map-resolve": { - "version": "0.5.3", - "dev": true, - "requires": { - "atob": "^2.1.2", - "decode-uri-component": "^0.2.0", - "resolve-url": "^0.2.1", - "source-map-url": "^0.4.0", - "urix": "^0.1.0" - } - }, - "source-map-support": { - "version": "0.5.19", - "dev": true, - "requires": { - "buffer-from": "^1.0.0", - "source-map": "^0.6.0" - } - }, - "source-map-url": { - "version": "0.4.1", - "dev": true - }, - "sourcemap-codec": { - "version": "1.4.8", - "dev": true - }, - "spdx-correct": { - "version": "3.1.1", - "dev": true, - "requires": { - "spdx-expression-parse": "^3.0.0", - "spdx-license-ids": "^3.0.0" - } - }, - "spdx-exceptions": { - "version": "2.3.0", - "dev": true - }, - "spdx-expression-parse": { - "version": "3.0.1", - "dev": true, - "requires": { - "spdx-exceptions": "^2.1.0", - "spdx-license-ids": "^3.0.0" - } - }, - "spdx-license-ids": { - "version": "3.0.7", - "dev": true - }, - "split": { - "version": "1.0.1", - "dev": true, - "requires": { - "through": "2" - } - }, - "split-on-first": { - "version": "1.1.0", - "dev": true - }, - "split-string": { - "version": "3.1.0", - "dev": true, - "requires": { - "extend-shallow": "^3.0.0" - } - }, - "split2": { - "version": "3.2.2", - "dev": true, - "requires": { - "readable-stream": "^3.0.0" - } - }, - "sprintf-js": { - "version": "1.0.3", - "dev": true - }, - "sshpk": { - "version": "1.16.1", - "dev": true, - "requires": { - "asn1": "~0.2.3", - "assert-plus": "^1.0.0", - "bcrypt-pbkdf": "^1.0.0", - "dashdash": "^1.12.0", - "ecc-jsbn": "~0.1.1", - "getpass": "^0.1.1", - "jsbn": "~0.1.0", - "safer-buffer": "^2.0.2", - "tweetnacl": "~0.14.0" - } - }, - "ssri": { - "version": "6.0.1", - "dev": true, - "requires": { - "figgy-pudding": "^3.5.1" - } - }, - "stack-utils": { - "version": "1.0.4", - "dev": true, - "requires": { - "escape-string-regexp": "^2.0.0" - }, - "dependencies": { - "escape-string-regexp": { - "version": "2.0.0", - "dev": true - } - } - }, - "static-extend": { - "version": "0.1.2", - "dev": true, - "requires": { - "define-property": "^0.2.5", - "object-copy": "^0.1.0" - }, - "dependencies": { - "define-property": { - "version": "0.2.5", - "dev": true, - "requires": { - "is-descriptor": "^0.1.0" - } - }, - "is-accessor-descriptor": { - "version": "0.1.6", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "is-data-descriptor": { - "version": "0.1.4", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "is-descriptor": { - "version": "0.1.6", - "dev": true, - "requires": { - "is-accessor-descriptor": "^0.1.6", - "is-data-descriptor": "^0.1.4", - "kind-of": "^5.0.0" - } - }, - "kind-of": { - "version": "5.1.0", - "dev": true - } - } - }, - "stealthy-require": { - "version": "1.1.1", - "dev": true - }, - "stream-each": { - "version": "1.2.3", - "dev": true, - "requires": { - "end-of-stream": "^1.1.0", - "stream-shift": "^1.0.0" - } - }, - "stream-shift": { - "version": "1.0.1", - "dev": true - }, - "strict-uri-encode": { - "version": "2.0.0", - "dev": true - }, - "string_decoder": { - "version": "1.3.0", - "dev": true, - "requires": { - "safe-buffer": "~5.2.0" - }, - "dependencies": { - "safe-buffer": { - "version": "5.2.1", - "dev": true - } - } - }, - "string-argv": { - "version": "0.3.1", - "dev": true - }, - "string-length": { - "version": "2.0.0", - "dev": true, - "requires": { - "astral-regex": "^1.0.0", - "strip-ansi": "^4.0.0" - }, - "dependencies": { - "ansi-regex": { - "version": "3.0.0", - "dev": true - }, - "strip-ansi": { - "version": "4.0.0", - "dev": true, - "requires": { - "ansi-regex": "^3.0.0" - } - } - } - }, - "string-width": { - "version": "4.2.2", - "dev": true, - "requires": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.0" - }, - "dependencies": { - "ansi-regex": { - "version": "5.0.0", - "dev": true - }, - "strip-ansi": { - "version": "6.0.0", - "dev": true, - "requires": { - "ansi-regex": "^5.0.0" - } - } - } - }, - "string.prototype.trimend": { - "version": "1.0.4", - "dev": true, - "requires": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3" - } - }, - "string.prototype.trimstart": { - "version": "1.0.4", - "dev": true, - "requires": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3" - } - }, - "strip-ansi": { - "version": "5.2.0", - "dev": true, - "requires": { - "ansi-regex": "^4.1.0" - } - }, - "strip-bom": { - "version": "3.0.0", - "dev": true - }, - "strip-eof": { - "version": "1.0.0", - "dev": true - }, - "strip-final-newline": { - "version": "2.0.0", - "dev": true - }, - "strip-indent": { - "version": "3.0.0", - "dev": true, - "requires": { - "min-indent": "^1.0.0" - } - }, - "strip-json-comments": { - "version": "3.1.1", - "dev": true - }, - "strong-log-transformer": { - "version": "2.1.0", - "dev": true, - "requires": { - "duplexer": "^0.1.1", - "minimist": "^1.2.0", - "through": "^2.3.4" - } - }, - "supports-color": { - "version": "7.2.0", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - }, - "symbol-tree": { - "version": "3.2.4", - "dev": true - }, - "table": { - "version": "5.4.6", - "dev": true, - "requires": { - "ajv": "^6.10.2", - "lodash": "^4.17.14", - "slice-ansi": "^2.1.0", - "string-width": "^3.0.0" - }, - "dependencies": { - "emoji-regex": { - "version": "7.0.3", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "dev": true - }, - "string-width": { - "version": "3.1.0", - "dev": true, - "requires": { - "emoji-regex": "^7.0.1", - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.1.0" - } - } - } - }, - "tar": { - "version": "4.4.13", - "dev": true, - "requires": { - "chownr": "^1.1.1", - "fs-minipass": "^1.2.5", - "minipass": "^2.8.6", - "minizlib": "^1.2.1", - "mkdirp": "^0.5.0", - "safe-buffer": "^5.1.2", - "yallist": "^3.0.3" - } - }, - "temp-dir": { - "version": "1.0.0", - "dev": true - }, - "temp-write": { - "version": "3.4.0", - "dev": true, - "requires": { - "graceful-fs": "^4.1.2", - "is-stream": "^1.1.0", - "make-dir": "^1.0.0", - "pify": "^3.0.0", - "temp-dir": "^1.0.0", - "uuid": "^3.0.1" - }, - "dependencies": { - "is-stream": { - "version": "1.1.0", - "dev": true - }, - "make-dir": { - "version": "1.3.0", - "dev": true, - "requires": { - "pify": "^3.0.0" - } - }, - "pify": { - "version": "3.0.0", - "dev": true - } - } - }, - "terser": { - "version": "4.8.0", - "dev": true, - "requires": { - "commander": "^2.20.0", - "source-map": "~0.6.1", - "source-map-support": "~0.5.12" - } - }, - "test-exclude": { - "version": "5.2.3", - "dev": true, - "requires": { - "glob": "^7.1.3", - "minimatch": "^3.0.4", - "read-pkg-up": "^4.0.0", - "require-main-filename": "^2.0.0" - }, - "dependencies": { - "read-pkg-up": { - "version": "4.0.0", - "dev": true, - "requires": { - "find-up": "^3.0.0", - "read-pkg": "^3.0.0" - } - } - } - }, - "text-extensions": { - "version": "1.9.0", - "dev": true - }, - "text-table": { - "version": "0.2.0", - "dev": true - }, - "thenify": { - "version": "3.3.1", - "dev": true, - "requires": { - "any-promise": "^1.0.0" - } - }, - "thenify-all": { - "version": "1.6.0", - "dev": true, - "requires": { - "thenify": ">= 3.1.0 < 4" - } - }, - "throat": { - "version": "4.1.0", - "dev": true - }, - "through": { - "version": "2.3.8", - "dev": true - }, - "through2": { - "version": "3.0.2", - "dev": true, - "requires": { - "inherits": "^2.0.4", - "readable-stream": "2 || 3" - } - }, - "timsort": { - "version": "0.3.0", - "dev": true - }, - "tmp": { - "version": "0.0.33", - "dev": true, - "requires": { - "os-tmpdir": "~1.0.2" - } - }, - "tmpl": { - "version": "1.0.4", - "dev": true - }, - "to-fast-properties": { - "version": "2.0.0", - "dev": true - }, - "to-object-path": { - "version": "0.3.0", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "to-regex": { - "version": "3.0.2", - "dev": true, - "requires": { - "define-property": "^2.0.2", - "extend-shallow": "^3.0.2", - "regex-not": "^1.0.2", - "safe-regex": "^1.1.0" - } - }, - "to-regex-range": { - "version": "2.1.1", - "dev": true, - "requires": { - "is-number": "^3.0.0", - "repeat-string": "^1.6.1" - } - }, - "tough-cookie": { - "version": "2.5.0", - "dev": true, - "requires": { - "psl": "^1.1.28", - "punycode": "^2.1.1" - } - }, - "tr46": { - "version": "1.0.1", - "dev": true, - "requires": { - "punycode": "^2.1.0" - } - }, - "trim-newlines": { - "version": "3.0.0", - "dev": true - }, - "trim-off-newlines": { - "version": "1.0.1", - "dev": true - }, - "ts-jest": { - "version": "24.3.0", - "dev": true, - "requires": { - "bs-logger": "0.x", - "buffer-from": "1.x", - "fast-json-stable-stringify": "2.x", - "json5": "2.x", - "lodash.memoize": "4.x", - "make-error": "1.x", - "mkdirp": "0.x", - "resolve": "1.x", - "semver": "^5.5", - "yargs-parser": "10.x" - }, - "dependencies": { - "camelcase": { - "version": "4.1.0", - "dev": true - }, - "semver": { - "version": "5.7.1", - "dev": true - }, - "yargs-parser": { - "version": "10.1.0", - "dev": true, - "requires": { - "camelcase": "^4.1.0" - } - } - } - }, - "tslib": { - "version": "1.14.1", - "dev": true - }, - "tsutils": { - "version": "3.21.0", - "dev": true, - "requires": { - "tslib": "^1.8.1" - } - }, - "tunnel-agent": { - "version": "0.6.0", - "dev": true, - "requires": { - "safe-buffer": "^5.0.1" - } - }, - "tweetnacl": { - "version": "0.14.5", - "dev": true - }, - "type-check": { - "version": "0.3.2", - "dev": true, - "requires": { - "prelude-ls": "~1.1.2" - } - }, - "type-detect": { - "version": "4.0.8", - "dev": true - }, - "type-fest": { - "version": "0.8.1", - "dev": true - }, - "type-signals": { - "version": "1.1.0" - }, - "typedarray": { - "version": "0.0.6", - "dev": true - }, - "typedoc": { - "version": "0.15.8", - "dev": true, - "requires": { - "@types/minimatch": "3.0.3", - "fs-extra": "^8.1.0", - "handlebars": "^4.7.0", - "highlight.js": "^9.17.1", - "lodash": "^4.17.15", - "marked": "^0.8.0", - "minimatch": "^3.0.0", - "progress": "^2.0.3", - "shelljs": "^0.8.3", - "typedoc-default-themes": "^0.6.3", - "typescript": "3.7.x" - }, - "dependencies": { - "fs-extra": { - "version": "8.1.0", - "dev": true, - "requires": { - "graceful-fs": "^4.2.0", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - } - }, - "jsonfile": { - "version": "4.0.0", - "dev": true, - "requires": { - "graceful-fs": "^4.1.6" - } - }, - "typescript": { - "version": "3.7.7", - "dev": true - }, - "universalify": { - "version": "0.1.2", - "dev": true - } - } - }, - "typedoc-default-themes": { - "version": "0.6.3", - "dev": true, - "requires": { - "backbone": "^1.4.0", - "jquery": "^3.4.1", - "lunr": "^2.3.8", - "underscore": "^1.9.1" - } - }, - "typescript": { - "version": "3.9.9", - "dev": true - }, - "uglify-js": { - "version": "3.13.1", - "dev": true, - "optional": true - }, - "uid-number": { - "version": "0.0.6", - "dev": true - }, - "umask": { - "version": "1.1.0", - "dev": true - }, - "unbox-primitive": { - "version": "1.0.0", - "dev": true, - "requires": { - "function-bind": "^1.1.1", - "has-bigints": "^1.0.0", - "has-symbols": "^1.0.0", - "which-boxed-primitive": "^1.0.1" - } - }, - "underscore": { - "version": "1.12.0", - "dev": true - }, - "union": { - "version": "0.4.6", - "dev": true, - "requires": { - "qs": "~2.3.3" - }, - "dependencies": { - "qs": { - "version": "2.3.3", - "dev": true - } - } - }, - "union-value": { - "version": "1.0.1", - "dev": true, - "requires": { - "arr-union": "^3.1.0", - "get-value": "^2.0.6", - "is-extendable": "^0.1.1", - "set-value": "^2.0.1" - }, - "dependencies": { - "is-extendable": { - "version": "0.1.1", - "dev": true - } - } - }, - "unique-filename": { - "version": "1.1.1", - "dev": true, - "requires": { - "unique-slug": "^2.0.0" - } - }, - "unique-slug": { - "version": "2.0.2", - "dev": true, - "requires": { - "imurmurhash": "^0.1.4" - } - }, - "universal-user-agent": { - "version": "4.0.1", - "dev": true, - "requires": { - "os-name": "^3.1.0" - } - }, - "universalify": { - "version": "2.0.0", - "dev": true - }, - "unset-value": { - "version": "1.0.0", - "dev": true, - "requires": { - "has-value": "^0.3.1", - "isobject": "^3.0.0" - }, - "dependencies": { - "has-value": { - "version": "0.3.1", - "dev": true, - "requires": { - "get-value": "^2.0.3", - "has-values": "^0.1.4", - "isobject": "^2.0.0" - }, - "dependencies": { - "isobject": { - "version": "2.1.0", - "dev": true, - "requires": { - "isarray": "1.0.0" - } - } - } - }, - "has-values": { - "version": "0.1.4", - "dev": true - }, - "isarray": { - "version": "1.0.0", - "dev": true - } - } - }, - "upath": { - "version": "1.2.0", - "dev": true - }, - "uri-js": { - "version": "4.4.1", - "dev": true, - "requires": { - "punycode": "^2.1.0" - } - }, - "urix": { - "version": "0.1.0", - "dev": true - }, - "url-join": { - "version": "2.0.5", - "dev": true - }, - "use": { - "version": "3.1.1", - "dev": true - }, - "util-deprecate": { - "version": "1.0.2", - "dev": true - }, - "util-promisify": { - "version": "2.1.0", - "dev": true, - "requires": { - "object.getownpropertydescriptors": "^2.0.3" - } - }, - "util.promisify": { - "version": "1.1.1", - "dev": true, - "requires": { - "call-bind": "^1.0.0", - "define-properties": "^1.1.3", - "for-each": "^0.3.3", - "has-symbols": "^1.0.1", - "object.getownpropertydescriptors": "^2.1.1" - } - }, - "uuid": { - "version": "3.4.0", - "dev": true - }, - "v8-compile-cache": { - "version": "2.3.0", - "dev": true - }, - "validate-npm-package-license": { - "version": "3.0.4", - "dev": true, - "requires": { - "spdx-correct": "^3.0.0", - "spdx-expression-parse": "^3.0.0" - } - }, - "validate-npm-package-name": { - "version": "3.0.0", - "dev": true, - "requires": { - "builtins": "^1.0.3" - } - }, - "validator": { - "version": "8.2.0", - "dev": true - }, - "verror": { - "version": "1.10.0", - "dev": true, - "requires": { - "assert-plus": "^1.0.0", - "core-util-is": "1.0.2", - "extsprintf": "^1.2.0" - } - }, - "w3c-hr-time": { - "version": "1.0.2", - "dev": true, - "requires": { - "browser-process-hrtime": "^1.0.0" - } - }, - "walker": { - "version": "1.0.7", - "dev": true, - "requires": { - "makeerror": "1.0.x" - } - }, - "wcwidth": { - "version": "1.0.1", - "dev": true, - "requires": { - "defaults": "^1.0.3" - } - }, - "webidl-conversions": { - "version": "4.0.2", - "dev": true - }, - "whatwg-encoding": { - "version": "1.0.5", - "dev": true, - "requires": { - "iconv-lite": "0.4.24" - } - }, - "whatwg-mimetype": { - "version": "2.3.0", - "dev": true - }, - "whatwg-url": { - "version": "6.5.0", - "dev": true, - "requires": { - "lodash.sortby": "^4.7.0", - "tr46": "^1.0.1", - "webidl-conversions": "^4.0.2" - } - }, - "which": { - "version": "1.3.1", - "dev": true, - "requires": { - "isexe": "^2.0.0" - } - }, - "which-boxed-primitive": { - "version": "1.0.2", - "dev": true, - "requires": { - "is-bigint": "^1.0.1", - "is-boolean-object": "^1.1.0", - "is-number-object": "^1.0.4", - "is-string": "^1.0.5", - "is-symbol": "^1.0.3" - } - }, - "which-module": { - "version": "2.0.0", - "dev": true - }, - "wide-align": { - "version": "1.1.3", - "dev": true, - "requires": { - "string-width": "^1.0.2 || 2" - }, - "dependencies": { - "ansi-regex": { - "version": "3.0.0", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "dev": true - }, - "string-width": { - "version": "2.1.1", - "dev": true, - "requires": { - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^4.0.0" - } - }, - "strip-ansi": { - "version": "4.0.0", - "dev": true, - "requires": { - "ansi-regex": "^3.0.0" - } - } - } - }, - "windows-release": { - "version": "3.3.3", - "dev": true, - "requires": { - "execa": "^1.0.0" - }, - "dependencies": { - "execa": { - "version": "1.0.0", - "dev": true, - "requires": { - "cross-spawn": "^6.0.0", - "get-stream": "^4.0.0", - "is-stream": "^1.1.0", - "npm-run-path": "^2.0.0", - "p-finally": "^1.0.0", - "signal-exit": "^3.0.0", - "strip-eof": "^1.0.0" - } - }, - "get-stream": { - "version": "4.1.0", - "dev": true, - "requires": { - "pump": "^3.0.0" - } - }, - "is-stream": { - "version": "1.1.0", - "dev": true - }, - "npm-run-path": { - "version": "2.0.2", - "dev": true, - "requires": { - "path-key": "^2.0.0" - } - } - } - }, - "word-wrap": { - "version": "1.2.3", - "dev": true - }, - "wordwrap": { - "version": "1.0.0", - "dev": true - }, - "wrap-ansi": { - "version": "5.1.0", - "dev": true, - "requires": { - "ansi-styles": "^3.2.0", - "string-width": "^3.0.0", - "strip-ansi": "^5.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "3.2.1", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "color-convert": { - "version": "1.9.3", - "dev": true, - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "dev": true - }, - "emoji-regex": { - "version": "7.0.3", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "dev": true - }, - "string-width": { - "version": "3.1.0", - "dev": true, - "requires": { - "emoji-regex": "^7.0.1", - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.1.0" - } - } - } - }, - "wrappy": { - "version": "1.0.2", - "dev": true - }, - "write": { - "version": "1.0.3", - "dev": true, - "requires": { - "mkdirp": "^0.5.1" - } - }, - "write-file-atomic": { - "version": "2.4.1", - "dev": true, - "requires": { - "graceful-fs": "^4.1.11", - "imurmurhash": "^0.1.4", - "signal-exit": "^3.0.2" - } - }, - "write-json-file": { - "version": "3.2.0", - "dev": true, - "requires": { - "detect-indent": "^5.0.0", - "graceful-fs": "^4.1.15", - "make-dir": "^2.1.0", - "pify": "^4.0.1", - "sort-keys": "^2.0.0", - "write-file-atomic": "^2.4.2" - }, - "dependencies": { - "write-file-atomic": { - "version": "2.4.3", - "dev": true, - "requires": { - "graceful-fs": "^4.1.11", - "imurmurhash": "^0.1.4", - "signal-exit": "^3.0.2" - } - } - } - }, - "write-pkg": { - "version": "3.2.0", - "dev": true, - "requires": { - "sort-keys": "^2.0.0", - "write-json-file": "^2.2.0" - }, - "dependencies": { - "make-dir": { - "version": "1.3.0", - "dev": true, - "requires": { - "pify": "^3.0.0" - } - }, - "pify": { - "version": "3.0.0", - "dev": true - }, - "write-json-file": { - "version": "2.3.0", - "dev": true, - "requires": { - "detect-indent": "^5.0.0", - "graceful-fs": "^4.1.2", - "make-dir": "^1.0.0", - "pify": "^3.0.0", - "sort-keys": "^2.0.0", - "write-file-atomic": "^2.0.0" - } - } - } - }, - "ws": { - "version": "5.2.2", - "dev": true, - "requires": { - "async-limiter": "~1.0.0" - } - }, - "xml-name-validator": { - "version": "3.0.0", - "dev": true - }, - "y18n": { - "version": "4.0.1", - "dev": true - }, - "yallist": { - "version": "3.1.1", - "dev": true - }, - "yargs": { - "version": "13.3.2", - "dev": true, - "requires": { - "cliui": "^5.0.0", - "find-up": "^3.0.0", - "get-caller-file": "^2.0.1", - "require-directory": "^2.1.1", - "require-main-filename": "^2.0.0", - "set-blocking": "^2.0.0", - "string-width": "^3.0.0", - "which-module": "^2.0.0", - "y18n": "^4.0.0", - "yargs-parser": "^13.1.2" - }, - "dependencies": { - "emoji-regex": { - "version": "7.0.3", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "dev": true - }, - "string-width": { - "version": "3.1.0", - "dev": true, - "requires": { - "emoji-regex": "^7.0.1", - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.1.0" - } - }, - "yargs-parser": { - "version": "13.1.2", - "dev": true, - "requires": { - "camelcase": "^5.0.0", - "decamelize": "^1.2.0" - } - } - } - }, - "yargs-parser": { - "version": "20.2.7", - "dev": true - }, - "z-schema": { - "version": "3.18.4", - "dev": true, - "requires": { - "commander": "^2.7.1", - "lodash.get": "^4.0.0", - "lodash.isequal": "^4.0.0", - "validator": "^8.0.0" - } - }, - "zlib": { - "version": "1.0.5", - "dev": true - } - } -} diff --git a/package.json b/package.json index fa5478f9..72b73637 100644 --- a/package.json +++ b/package.json @@ -4,19 +4,17 @@ "workspace": "packages", "name": "eva.js", "scripts": { - "dev": "node ./scripts/dev.js", + "dev": "vite ./examples -c ./vite.config.ts", "build": "node ./scripts/build.js", "buildDev": "npm run build -- -a -d -f umd", "buildProd": "npm run build -- -a -p -f cjs-esm-umd", "release": "node ./scripts/release.js", "bootstrap": "node ./scripts/bootstrap.js", - "server": "npx http-server -o /examples/ -c-1", "test": "jest --runInBand", "test-cov": "jest --coverage", "ci": "lerna bootstrap && npm run cov", "cov": "jest --json > node_modules/.tap.json", - "api": "api-documenter markdown -i temp -o docs/api", - "vite": "npx vite ./vite-test -c ./vite.config.ts" + "api": "api-documenter markdown -i temp -o docs/api" }, "keywords": [ "game", @@ -52,28 +50,23 @@ "execa": "^4.1.0", "fs-extra": "^9.0.1", "glob": "^7.1.3", - "http-server": "^0.11.1", "jest": "^24.9.0", "lerna": "^3.22.1", "minimist": "^1.2.5", "prettier": "^2.2.1", + "reset.css": "^2.0.2", "rollup": "^2.40.0", "rollup-plugin-analyzer": "^3.2.1", - "rollup-plugin-copy": "^3.4.0", "rollup-plugin-import-alias": "^1.0.10", "rollup-plugin-inject": "^3.0.2", - "rollup-plugin-livereload": "^1.3.0", "rollup-plugin-modify": "^3.0.0", "rollup-plugin-node-resolve": "^5.2.0", "rollup-plugin-polyfill-node": "^0.6.2", "rollup-plugin-replace": "^2.2.0", - "rollup-plugin-serve": "^1.1.0", "rollup-plugin-sourcemaps": "^0.4.2", "rollup-plugin-terser": "^7.0.2", "rollup-plugin-typescript2": "^0.24.3", "rollup-plugin-visualizer": "^4.2.0", - "rollup-watch": "^4.3.1", - "selenium-server": "^3.141.59", "semver": "^7.3.2", "sinon": "^7.5.0", "terser": "^4.2.1", @@ -81,26 +74,11 @@ "tslib": "^1.9.3", "typedoc": "^0.15.0", "typescript": "^3.6.4", + "vconsole": "^3.9.1", "vite": "2.4.3", "zlib": "^1.0.5" }, "engines": { "node": ">=14.14.0" - }, - "ci": { - "type": "aoneci", - "version": "14.14.0", - "docker": false, - "autoBadges": true, - "coverage": true - }, - "dependencies": { - "@tweenjs/tween.js": "^18.6.4", - "core-js": "^3.16.0", - "eventemitter3": "^4.0.7", - "ios-version": "^1.0.1", - "lodash": "^4.17.21", - "pixi.js": "^4.8.7", - "resource-loader": "^4.0.0-rc4" } } diff --git a/packages/eva.js/__tests__/componentObserver.spec.ts b/packages/eva.js/__tests__/componentObserver.spec.ts index 626ca817..ae406add 100644 --- a/packages/eva.js/__tests__/componentObserver.spec.ts +++ b/packages/eva.js/__tests__/componentObserver.spec.ts @@ -1,12 +1,13 @@ -import {Transform} from '../lib'; +import { Transform } from '../lib'; import ComponentObserver from '../lib/core/ComponentObserver'; -import {ObserverType} from '../lib/core/observer'; +import { ObserverType } from '../lib/core/observer'; describe('componentObserver', () => { let co: ComponentObserver; beforeEach(() => { co = new ComponentObserver(); }); + it('make componentObserver', () => { expect(co.getChanged().length).toBe(0); }); @@ -14,7 +15,7 @@ describe('componentObserver', () => { it('add change event', () => { co.add({ component: new Transform(), - prop: {prop: ['size'], deep: false}, + prop: { prop: ['size'], deep: false }, type: ObserverType.ADD, componentName: Transform.componentName, }); @@ -23,7 +24,7 @@ describe('componentObserver', () => { it('add same change event twice', () => { const transform1 = new Transform(); - const prop = {prop: ['size'], deep: false}; + const prop = { prop: ['size'], deep: false }; co.add({ prop, component: transform1, @@ -48,7 +49,7 @@ describe('componentObserver', () => { it('should remove change event', () => { const transform1 = new Transform(); - const prop = {prop: ['size'], deep: false}; + const prop = { prop: ['size'], deep: false }; co.add({ prop, component: transform1, @@ -84,7 +85,7 @@ describe('componentObserver', () => { it('should clear change events', () => { const transform1 = new Transform(); - const prop = {prop: ['size'], deep: false}; + const prop = { prop: ['size'], deep: false }; co.add({ prop, component: transform1, diff --git a/packages/eva.js/lib/loader/Resource.ts b/packages/eva.js/lib/loader/Resource.ts index b3abbcf9..b99bce05 100644 --- a/packages/eva.js/lib/loader/Resource.ts +++ b/packages/eva.js/lib/loader/Resource.ts @@ -30,7 +30,7 @@ interface SrcBase { } /** Eva resource base */ -interface ResourceBase { +export interface ResourceBase { name?: string; type?: RESOURCE_TYPE; src?: { diff --git a/packages/plugin-a11y/lib/A11ySystem.ts b/packages/plugin-a11y/lib/A11ySystem.ts index d5e4b302..a1700acd 100644 --- a/packages/plugin-a11y/lib/A11ySystem.ts +++ b/packages/plugin-a11y/lib/A11ySystem.ts @@ -1,24 +1,10 @@ -import { - System, - decorators, - ComponentChanged, - Transform, - GameObject, - OBSERVER_TYPE, -} from '@eva/eva.js'; +import { System, decorators, ComponentChanged, Transform, GameObject, OBSERVER_TYPE } from '@eva/eva.js'; +import { RendererSystem } from '@eva/plugin-renderer'; import EE from 'eventemitter3'; + import A11y from './A11y'; -import {setStyle, setTransform} from './utils'; -import { - POSITION, - ZINDEX, - PointerEvents, - MaskBackground, - EventPosition, - A11yMaskStyle, - A11yActivate, -} from './constant'; -import {RendererSystem} from '@eva/plugin-renderer'; +import { setStyle, setTransform } from './utils'; +import { POSITION, ZINDEX, PointerEvents, MaskBackground, EventPosition, A11yMaskStyle, A11yActivate } from './constant'; interface SystemParam { debug?: boolean; @@ -27,17 +13,7 @@ interface SystemParam { checkA11yOpen?: () => Promise; } -const notAttr = [ - 'hint', - 'event', - 'delay', - 'attr', - 'role', - 'props', - 'state', - 'a11yId', - 'name', -]; +const notAttr = ['hint', 'event', 'delay', 'attr', 'role', 'props', 'state', 'a11yId', 'name']; const getEventFunc = function (event, gameObject, e) { ['touchstart', 'touchend', 'tap'].forEach(name => { @@ -87,8 +63,8 @@ export default class A11ySystem extends System { * dom 延迟放置 */ delay: number; - cache: Map = new Map(); - eventCache: Map = new Map(); + cache: Map = new Map(); + eventCache: Map = new Map(); /** * * @param opt @@ -134,11 +110,7 @@ export default class A11ySystem extends System { } async init(opt: SystemParam = {}) { - const { - activate = A11yActivate.CHECK, - delay = 100, - checkA11yOpen = () => Promise.resolve(false), - } = opt; + const { activate = A11yActivate.CHECK, delay = 100, checkA11yOpen = () => Promise.resolve(false) } = opt; this.delay = delay; switch (activate) { case A11yActivate.CHECK: @@ -170,8 +142,8 @@ export default class A11ySystem extends System { } } setRatio() { - const {width, height} = this.getCanvasBoundingClientRect(); - const {renderWidth, renderHeight} = this.getRenderRect(); + const { width, height } = this.getCanvasBoundingClientRect(); + const { renderWidth, renderHeight } = this.getRenderRect(); this._ratioX = width / renderWidth; this._ratioY = height / renderHeight; if (width || height) { @@ -183,20 +155,19 @@ export default class A11ySystem extends System { } getRenderRect() { // @ts-ignore - const {params} = - this.game.getSystem(RendererSystem) || ({width: 300, height: 300} as any); - const {height: renderHeight, width: renderWidth} = params; - return {renderWidth, renderHeight}; + const { params } = this.game.getSystem(RendererSystem) || ({ width: 300, height: 300 } as any); + const { height: renderHeight, width: renderWidth } = params; + return { renderWidth, renderHeight }; } getCanvasBoundingClientRect() { // 渲染画布相对于视口的实际宽高以及位置,实际的像素 - const {width, height, left, top} = this.game.canvas.getBoundingClientRect(); - return {width, height, left, top}; + const { width, height, left, top } = this.game.canvas.getBoundingClientRect(); + return { width, height, left, top }; } initDiv() { - const {pageXOffset, pageYOffset} = window; + const { pageXOffset, pageYOffset } = window; - const {width, height, left, top} = this.getCanvasBoundingClientRect(); + const { width, height, left, top } = this.getCanvasBoundingClientRect(); // 父容器位置 const style: A11yMaskStyle = { width, @@ -214,10 +185,10 @@ export default class A11ySystem extends System { 'click', e => { const currentTarget = e.currentTarget as HTMLDivElement; - const {left, top} = currentTarget.getBoundingClientRect(); + const { left, top } = currentTarget.getBoundingClientRect(); const x = (e.pageX - left) / this.ratioX; const y = (e.pageY - top) / this.ratioY; - this.eventPosition = {x, y}; + this.eventPosition = { x, y }; }, true, ); @@ -234,13 +205,11 @@ export default class A11ySystem extends System { for (const changed of changes) { switch (changed.type) { case OBSERVER_TYPE.ADD: - changed.componentName === 'Event' && - this.addEvent(changed.gameObject); + changed.componentName === 'Event' && this.addEvent(changed.gameObject); changed.componentName === 'A11y' && this.add(changed); break; case OBSERVER_TYPE.CHANGE: - changed.componentName === 'Transform' && - this.transformChange(changed); + changed.componentName === 'Transform' && this.transformChange(changed); break; case OBSERVER_TYPE.REMOVE: changed.componentName === 'Event' && this.removeEvent(changed); @@ -252,7 +221,7 @@ export default class A11ySystem extends System { remove(changed: ComponentChanged) { const component = changed.component as A11y; if (!component) return; - const {a11yId} = component; + const { a11yId } = component; const element = this.div.querySelector(`#${a11yId}`); element && this.div.removeChild(element); this.cache.delete(a11yId); @@ -265,11 +234,11 @@ export default class A11ySystem extends System { add(changed: ComponentChanged) { if (!this.activate) return; const component = changed.component as A11y; - const {gameObject} = changed; - const {delay, a11yId: id} = component; - let {event} = component; + const { gameObject } = changed; + const { delay, a11yId: id } = component; + let { event } = component; if (!gameObject) return; - const {transform} = gameObject; + const { transform } = gameObject; if (!transform) return; const element = document.createElement('div'); this.cache.set(id, element); @@ -291,10 +260,10 @@ export default class A11ySystem extends System { // 监听 scene 改变 transformChange(changed: ComponentChanged) { const component = changed.component as Transform; - const {gameObject} = changed; + const { gameObject } = changed; const a11yComponent = gameObject.getComponent(A11y) as A11y; if (!a11yComponent) return; - const {a11yId} = a11yComponent; + const { a11yId } = a11yComponent; if (!component.inScene) { // 监听 scene 删除游戏对象 const dom = this.div.querySelector(`#${a11yId}`); @@ -335,12 +304,12 @@ export default class A11ySystem extends System { } removeEvent(changed: ComponentChanged) { - const {gameObject} = changed; + const { gameObject } = changed; const a11y = gameObject.getComponent(A11y) as A11y; if (!a11y) return; const event = changed.component; if (!event) return; - const {a11yId} = a11y; + const { a11yId } = a11y; const func = this.eventCache.get(a11yId) as any; const element = this.cache.get(a11yId); element && element.removeEventListener('click', func); @@ -353,7 +322,7 @@ export default class A11ySystem extends System { * @param interactive 是否可交互 */ setA11yAttr(element: HTMLElement, component: A11y) { - const {hint, props = {}, state = {}, role, a11yId: id} = component; + const { hint, props = {}, state = {}, role, a11yId: id } = component; const realRole = role || 'text'; element.setAttribute('role', realRole); element.setAttribute('aria-label', hint); @@ -369,12 +338,8 @@ export default class A11ySystem extends System { element.setAttribute(key, state[key]); } - for (let key of Object.keys(component)) { - if ( - typeof component[key] === 'string' && - notAttr.indexOf(key) === -1 && - key.indexOf('_') !== 1 - ) { + for (const key of Object.keys(component)) { + if (typeof component[key] === 'string' && notAttr.indexOf(key) === -1 && key.indexOf('_') !== 1) { element.setAttribute(key, component[key]); } } @@ -389,7 +354,7 @@ export default class A11ySystem extends System { // 相对画布定位 // const { x: anchorX, y: anchorY } = transform.anchor // 游戏对象的宽高 - const {width, height} = transform.size; + const { width, height } = transform.size; // position // const { x: positionX, y: positionY } = transform.position // 设置无障碍 DOM 的样式,龙骨动画默认 2px diff --git a/packages/plugin-a11y/lib/constant.ts b/packages/plugin-a11y/lib/constant.ts index 606e32aa..3fd7c863 100644 --- a/packages/plugin-a11y/lib/constant.ts +++ b/packages/plugin-a11y/lib/constant.ts @@ -1,7 +1,7 @@ -const POSITION = 'absolute'; -const ZINDEX = 3; +export const POSITION = 'absolute'; +export const ZINDEX = 3; -enum A11yActivate { +export enum A11yActivate { ENABLE = 0, DISABLE = 1, CHECK = 2, @@ -10,7 +10,7 @@ enum A11yActivate { /** * 无障碍 DOM 的指针事件 */ -enum PointerEvents { +export enum PointerEvents { NONE = 'none', // 元素不会成为鼠标事件的target,会被穿透 AUTO = 'auto', // 默认值正常 } @@ -18,7 +18,7 @@ enum PointerEvents { /** * 无障碍 DOM 层的样式 */ -enum MaskBackground { +export enum MaskBackground { DEBUG = 'rgba(255,0,0,0.5)', NONE = 'transparent', } @@ -26,7 +26,7 @@ enum MaskBackground { /** * 无障碍 DOM 的类型 */ -enum ElementType { +export enum ElementType { BUTTON = 'button', DIV = 'div', } @@ -34,7 +34,7 @@ enum ElementType { /** * 无障碍遮罩层样式 */ -interface A11yMaskStyle { +export interface A11yMaskStyle { width: number; height: number; background: string; @@ -48,18 +48,7 @@ interface A11yMaskStyle { /** * 点击事件位置 */ -interface EventPosition { +export interface EventPosition { x: number; y: number; -} - -export { - POSITION, - ZINDEX, - A11yActivate, - PointerEvents, - MaskBackground, - ElementType, - EventPosition, - A11yMaskStyle, -}; +} \ No newline at end of file diff --git a/packages/plugin-matterjs/package-lock.json b/packages/plugin-matterjs/package-lock.json new file mode 100644 index 00000000..57d39847 --- /dev/null +++ b/packages/plugin-matterjs/package-lock.json @@ -0,0 +1,158 @@ +{ + "name": "@eva/plugin-matterjs", + "version": "1.1.0-alpha.1", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "name": "@eva/plugin-matterjs", + "version": "1.1.0-alpha.1", + "license": "MIT", + "dependencies": { + "@eva/eva.js": "1.1.0-alpha.1", + "poly-decomp": "^0.3.0" + } + }, + "../eva.js": { + "name": "@eva/eva.js", + "version": "1.1.0-alpha.1", + "license": "MIT", + "dependencies": { + "eventemitter3": "^3.1.2", + "lodash-es": "^4.17.21", + "mini-signals": "^1.2.0", + "parse-uri": "^1.0.3", + "resource-loader": "^4.0.0-rc4", + "sprite-timeline": "^1.10.2" + } + }, + "../eva.js/node_modules/babel-runtime": { + "version": "6.26.0", + "license": "MIT", + "dependencies": { + "core-js": "^2.4.0", + "regenerator-runtime": "^0.11.0" + } + }, + "../eva.js/node_modules/core-js": { + "version": "2.6.12", + "hasInstallScript": true, + "license": "MIT" + }, + "../eva.js/node_modules/eventemitter3": { + "version": "3.1.2", + "license": "MIT" + }, + "../eva.js/node_modules/lodash-es": { + "version": "4.17.21", + "license": "MIT" + }, + "../eva.js/node_modules/mini-signals": { + "version": "1.2.0", + "license": "MIT" + }, + "../eva.js/node_modules/parse-uri": { + "version": "1.0.3", + "license": "MIT", + "engines": { + "node": ">= 0.10" + } + }, + "../eva.js/node_modules/regenerator-runtime": { + "version": "0.11.1", + "license": "MIT" + }, + "../eva.js/node_modules/resource-loader": { + "version": "4.0.0-rc4", + "license": "MIT", + "dependencies": { + "parse-uri": "^1.0.0", + "type-signals": "^1.0.3" + } + }, + "../eva.js/node_modules/sprite-timeline": { + "version": "1.10.2", + "license": "MIT", + "dependencies": { + "babel-runtime": "^6.26.0" + } + }, + "../eva.js/node_modules/type-signals": { + "version": "1.1.0", + "license": "MIT" + }, + "node_modules/@eva/eva.js": { + "resolved": "../eva.js", + "link": true + }, + "node_modules/poly-decomp": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/poly-decomp/-/poly-decomp-0.3.0.tgz", + "integrity": "sha512-hWeBxGzPYiybmI4548Fca7Up/0k1qS5+79cVHI9+H33dKya5YNb9hxl0ZnDaDgvrZSuYFBhkCK/HOnqN7gefkQ==", + "engines": { + "node": "*" + } + } + }, + "dependencies": { + "@eva/eva.js": { + "version": "file:../eva.js", + "requires": { + "eventemitter3": "^3.1.2", + "lodash-es": "^4.17.21", + "mini-signals": "^1.2.0", + "parse-uri": "^1.0.3", + "resource-loader": "^4.0.0-rc4", + "sprite-timeline": "^1.10.2" + }, + "dependencies": { + "babel-runtime": { + "version": "6.26.0", + "requires": { + "core-js": "^2.4.0", + "regenerator-runtime": "^0.11.0" + } + }, + "core-js": { + "version": "2.6.12" + }, + "eventemitter3": { + "version": "3.1.2" + }, + "lodash-es": { + "version": "4.17.21" + }, + "mini-signals": { + "version": "1.2.0" + }, + "parse-uri": { + "version": "1.0.3" + }, + "regenerator-runtime": { + "version": "0.11.1" + }, + "resource-loader": { + "version": "4.0.0-rc4", + "requires": { + "parse-uri": "^1.0.0", + "type-signals": "^1.0.3" + } + }, + "sprite-timeline": { + "version": "1.10.2", + "requires": { + "babel-runtime": "^6.26.0" + } + }, + "type-signals": { + "version": "1.1.0" + } + } + }, + "poly-decomp": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/poly-decomp/-/poly-decomp-0.3.0.tgz", + "integrity": "sha512-hWeBxGzPYiybmI4548Fca7Up/0k1qS5+79cVHI9+H33dKya5YNb9hxl0ZnDaDgvrZSuYFBhkCK/HOnqN7gefkQ==" + } + } +} diff --git a/packages/plugin-matterjs/package.json b/packages/plugin-matterjs/package.json index fa390c57..ade9f5d7 100644 --- a/packages/plugin-matterjs/package.json +++ b/packages/plugin-matterjs/package.json @@ -18,6 +18,7 @@ "license": "MIT", "homepage": "https://eva.js.org", "dependencies": { - "@eva/eva.js": "1.1.0-alpha.1" + "@eva/eva.js": "1.1.0-alpha.1", + "poly-decomp": "^0.3.0" } } diff --git a/packages/plugin-renderer-dragonbone/lib/index.ts b/packages/plugin-renderer-dragonbone/lib/index.ts index 522944f0..d5a1dde7 100644 --- a/packages/plugin-renderer-dragonbone/lib/index.ts +++ b/packages/plugin-renderer-dragonbone/lib/index.ts @@ -1,4 +1,3 @@ -import DragonBone from './component'; -import type { DragonBoneParams } from './component'; -import DragonBoneSystem from './system'; -export { DragonBone, DragonBoneSystem, DragonBoneParams }; +export { default as DragonBone } from './component'; +export { default as DragonBoneSystem } from './system'; +export type { DragonBoneParams } from './component'; diff --git a/packages/plugin-renderer-event/lib/index.ts b/packages/plugin-renderer-event/lib/index.ts index 37487461..d554e44d 100644 --- a/packages/plugin-renderer-event/lib/index.ts +++ b/packages/plugin-renderer-event/lib/index.ts @@ -1,4 +1,3 @@ -import Event, { HIT_AREA_TYPE } from './component'; -import type { EventParams } from "./component"; -import EventSystem from './system'; -export { Event, EventSystem, HIT_AREA_TYPE, EventParams }; +export { default as EventSystem } from './system'; +export { default as Event, HIT_AREA_TYPE } from './component'; +export type { EventParams } from './component'; diff --git a/packages/plugin-renderer-img/lib/index.ts b/packages/plugin-renderer-img/lib/index.ts index eec8edb9..485d108a 100644 --- a/packages/plugin-renderer-img/lib/index.ts +++ b/packages/plugin-renderer-img/lib/index.ts @@ -1,4 +1,3 @@ -import type {ImgParams} from './component'; -import Img from './component'; -import ImgSystem from './system'; -export {Img, ImgSystem, ImgParams}; +export type { ImgParams } from './component'; +export { default as Img } from './component'; +export { default as ImgSystem } from './system'; diff --git a/packages/plugin-renderer-lottie/lib/index.ts b/packages/plugin-renderer-lottie/lib/index.ts index fe10980c..39657a7c 100644 --- a/packages/plugin-renderer-lottie/lib/index.ts +++ b/packages/plugin-renderer-lottie/lib/index.ts @@ -1,8 +1,2 @@ -import LottieSystem from "./LottieSystem"; -import Lottie from './Lottie' - - -export { - Lottie, - LottieSystem -} +export { default as LottieSystem } from './LottieSystem'; +export { default as Lottie } from './Lottie'; diff --git a/packages/plugin-renderer-mask/lib/index.ts b/packages/plugin-renderer-mask/lib/index.ts index 7e75873d..770660e9 100644 --- a/packages/plugin-renderer-mask/lib/index.ts +++ b/packages/plugin-renderer-mask/lib/index.ts @@ -1,4 +1,3 @@ -import Mask, { MASK_TYPE } from './component'; -import type { MaskParams } from './component'; -import MaskSystem from './system'; -export { Mask, MaskSystem, MASK_TYPE, MaskParams }; +export { default as Mask, MASK_TYPE } from './component'; +export { default as MaskSystem } from './system'; +export type { MaskParams } from './component'; diff --git a/packages/plugin-renderer-nine-patch/lib/index.ts b/packages/plugin-renderer-nine-patch/lib/index.ts index 26e3e2ab..b9448456 100644 --- a/packages/plugin-renderer-nine-patch/lib/index.ts +++ b/packages/plugin-renderer-nine-patch/lib/index.ts @@ -1,4 +1,3 @@ -import NinePatch from './component'; -import type { NinePatchParams } from './component'; -import NinePatchSystem from './system'; -export { NinePatch, NinePatchSystem, NinePatchParams }; +export { default as NinePatch } from './component'; +export { default as NinePatchSystem } from './system'; +export type { NinePatchParams } from './component'; diff --git a/packages/plugin-renderer-render/lib/index.ts b/packages/plugin-renderer-render/lib/index.ts index 111ebd27..ea921dad 100644 --- a/packages/plugin-renderer-render/lib/index.ts +++ b/packages/plugin-renderer-render/lib/index.ts @@ -1,4 +1,3 @@ -import Render from './component'; -import type { RenderParams } from './component'; -import RenderSystem from './system'; -export { Render, RenderSystem, RenderParams }; +export { default as Render } from './component'; +export { default as RenderSystem } from './system'; +export type { RenderParams } from './component'; diff --git a/packages/plugin-renderer-spine/lib/index.ts b/packages/plugin-renderer-spine/lib/index.ts index cd088d10..db7b873d 100644 --- a/packages/plugin-renderer-spine/lib/index.ts +++ b/packages/plugin-renderer-spine/lib/index.ts @@ -1,4 +1,3 @@ -import SpineSystem from './SpineSystem'; -import type { SpineParams } from './Spine'; -import Spine from './Spine'; -export { Spine, SpineSystem, SpineParams }; +export { default as SpineSystem } from './SpineSystem'; +export { default as Spine } from './Spine'; +export type { SpineParams } from './Spine'; \ No newline at end of file diff --git a/packages/plugin-renderer-spine38/lib/index.ts b/packages/plugin-renderer-spine38/lib/index.ts index 50829377..838937cc 100644 --- a/packages/plugin-renderer-spine38/lib/index.ts +++ b/packages/plugin-renderer-spine38/lib/index.ts @@ -1,3 +1,3 @@ -import SpineSystem from './SpineSystem'; -import Spine, {SpineParams} from './Spine'; -export {Spine, SpineSystem, SpineParams}; +export { default as SpineSystem } from './SpineSystem'; +export { default as Spine } from './Spine'; +export type { SpineParams } from './Spine'; diff --git a/packages/plugin-renderer-spine38/package-lock.json b/packages/plugin-renderer-spine38/package-lock.json new file mode 100644 index 00000000..b519234c --- /dev/null +++ b/packages/plugin-renderer-spine38/package-lock.json @@ -0,0 +1,162 @@ +{ + "name": "@eva/plugin-renderer-spine38", + "version": "1.1.0-alpha.1", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "name": "@eva/plugin-renderer-spine38", + "version": "1.1.0-alpha.1", + "license": "MIT", + "dependencies": { + "pixi.js": "^4.8.7" + } + }, + "node_modules/bit-twiddle": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/bit-twiddle/-/bit-twiddle-1.0.2.tgz", + "integrity": "sha1-DGwfq+KyPRcXPZpht7cJPrnhdp4=" + }, + "node_modules/earcut": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/earcut/-/earcut-2.2.3.tgz", + "integrity": "sha512-iRDI1QeCQIhMCZk48DRDMVgQSSBDmbzzNhnxIo+pwx3swkfjMh6vh0nWLq1NdvGHLKH6wIrAM3vQWeTj6qeoug==" + }, + "node_modules/eventemitter3": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-2.0.3.tgz", + "integrity": "sha1-teEHm1n7XhuidxwKmTvgYKWMmbo=" + }, + "node_modules/ismobilejs": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/ismobilejs/-/ismobilejs-0.5.2.tgz", + "integrity": "sha512-ta9UdV60xVZk/ZafFtSFslQaE76SvNkcs1r73d2PVR21zVzx9xuYv9tNe4MxA1NN7WoeCc2RjGot3Bz1eHDx3Q==" + }, + "node_modules/mini-signals": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/mini-signals/-/mini-signals-1.2.0.tgz", + "integrity": "sha1-RbCAE8X65RokqhqTXNMXye1yHXQ=" + }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/parse-uri": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/parse-uri/-/parse-uri-1.0.3.tgz", + "integrity": "sha512-upMnGxNcm+45So85HoguwZTVZI9u11i36DdxJfGF2HYWS2eh3TIx7+/tTi7qrEq15qzGkVhsKjesau+kCk48pA==", + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/pixi-gl-core": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/pixi-gl-core/-/pixi-gl-core-1.1.4.tgz", + "integrity": "sha1-i0tcQzsx5Bm8N53FZc4bg1qRs3I=" + }, + "node_modules/pixi.js": { + "version": "4.8.9", + "resolved": "https://registry.npmjs.org/pixi.js/-/pixi.js-4.8.9.tgz", + "integrity": "sha512-YcepG5/bXLAVTSTXaMIU9NeSzwyPq/oMu2oQi6L6iE5giwng02ixVCKgc6/eMv3zl2Ho+teSOLC8R5Wp3jBvLA==", + "dependencies": { + "bit-twiddle": "^1.0.2", + "earcut": "^2.1.4", + "eventemitter3": "^2.0.0", + "ismobilejs": "^0.5.1", + "object-assign": "^4.0.1", + "pixi-gl-core": "^1.1.4", + "remove-array-items": "^1.0.0", + "resource-loader": "^2.2.3" + } + }, + "node_modules/remove-array-items": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/remove-array-items/-/remove-array-items-1.1.1.tgz", + "integrity": "sha512-MXW/jtHyl5F1PZI7NbpS8SOtympdLuF20aoWJT5lELR1p/HJDd5nqW8Eu9uLh/hCRY3FgvrIT5AwDCgBODklcA==" + }, + "node_modules/resource-loader": { + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/resource-loader/-/resource-loader-2.2.4.tgz", + "integrity": "sha512-MrY0bEJN26us3h4bzJUSP0n4tFEb79lCpYBavtLjSezWCcXZMgxhSgvC9LxueuqpcxG+qPjhwFu5SQAcUNacdA==", + "dependencies": { + "mini-signals": "^1.1.1", + "parse-uri": "^1.0.0" + } + } + }, + "dependencies": { + "bit-twiddle": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/bit-twiddle/-/bit-twiddle-1.0.2.tgz", + "integrity": "sha1-DGwfq+KyPRcXPZpht7cJPrnhdp4=" + }, + "earcut": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/earcut/-/earcut-2.2.3.tgz", + "integrity": "sha512-iRDI1QeCQIhMCZk48DRDMVgQSSBDmbzzNhnxIo+pwx3swkfjMh6vh0nWLq1NdvGHLKH6wIrAM3vQWeTj6qeoug==" + }, + "eventemitter3": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-2.0.3.tgz", + "integrity": "sha1-teEHm1n7XhuidxwKmTvgYKWMmbo=" + }, + "ismobilejs": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/ismobilejs/-/ismobilejs-0.5.2.tgz", + "integrity": "sha512-ta9UdV60xVZk/ZafFtSFslQaE76SvNkcs1r73d2PVR21zVzx9xuYv9tNe4MxA1NN7WoeCc2RjGot3Bz1eHDx3Q==" + }, + "mini-signals": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/mini-signals/-/mini-signals-1.2.0.tgz", + "integrity": "sha1-RbCAE8X65RokqhqTXNMXye1yHXQ=" + }, + "object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" + }, + "parse-uri": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/parse-uri/-/parse-uri-1.0.3.tgz", + "integrity": "sha512-upMnGxNcm+45So85HoguwZTVZI9u11i36DdxJfGF2HYWS2eh3TIx7+/tTi7qrEq15qzGkVhsKjesau+kCk48pA==" + }, + "pixi-gl-core": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/pixi-gl-core/-/pixi-gl-core-1.1.4.tgz", + "integrity": "sha1-i0tcQzsx5Bm8N53FZc4bg1qRs3I=" + }, + "pixi.js": { + "version": "4.8.9", + "resolved": "https://registry.npmjs.org/pixi.js/-/pixi.js-4.8.9.tgz", + "integrity": "sha512-YcepG5/bXLAVTSTXaMIU9NeSzwyPq/oMu2oQi6L6iE5giwng02ixVCKgc6/eMv3zl2Ho+teSOLC8R5Wp3jBvLA==", + "requires": { + "bit-twiddle": "^1.0.2", + "earcut": "^2.1.4", + "eventemitter3": "^2.0.0", + "ismobilejs": "^0.5.1", + "object-assign": "^4.0.1", + "pixi-gl-core": "^1.1.4", + "remove-array-items": "^1.0.0", + "resource-loader": "^2.2.3" + } + }, + "remove-array-items": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/remove-array-items/-/remove-array-items-1.1.1.tgz", + "integrity": "sha512-MXW/jtHyl5F1PZI7NbpS8SOtympdLuF20aoWJT5lELR1p/HJDd5nqW8Eu9uLh/hCRY3FgvrIT5AwDCgBODklcA==" + }, + "resource-loader": { + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/resource-loader/-/resource-loader-2.2.4.tgz", + "integrity": "sha512-MrY0bEJN26us3h4bzJUSP0n4tFEb79lCpYBavtLjSezWCcXZMgxhSgvC9LxueuqpcxG+qPjhwFu5SQAcUNacdA==", + "requires": { + "mini-signals": "^1.1.1", + "parse-uri": "^1.0.0" + } + } + } +} diff --git a/packages/plugin-renderer-sprite-animation/lib/index.ts b/packages/plugin-renderer-sprite-animation/lib/index.ts index 3c5c7821..ea7b4120 100644 --- a/packages/plugin-renderer-sprite-animation/lib/index.ts +++ b/packages/plugin-renderer-sprite-animation/lib/index.ts @@ -1,4 +1,3 @@ -import SpriteAnimation from './component'; -import type { SpriteAnimationParams } from './component'; -import SpriteAnimationSystem from './system'; -export { SpriteAnimation, SpriteAnimationSystem, SpriteAnimationParams }; +export { default as SpriteAnimation } from './component'; +export { default as SpriteAnimationSystem } from './system'; +export type { SpriteAnimationParams } from './component'; diff --git a/packages/plugin-renderer-sprite/lib/index.ts b/packages/plugin-renderer-sprite/lib/index.ts index 23f65dfd..5b107a40 100644 --- a/packages/plugin-renderer-sprite/lib/index.ts +++ b/packages/plugin-renderer-sprite/lib/index.ts @@ -1,4 +1,3 @@ -import Sprite from './component'; -import type { SpriteParams } from "./component"; -import SpriteSystem from './system'; -export { Sprite, SpriteSystem, SpriteParams }; \ No newline at end of file +export { default as Sprite } from './component'; +export { default as SpriteSystem } from './system'; +export type { SpriteParams } from './component'; diff --git a/packages/plugin-renderer-test/lib/index.ts b/packages/plugin-renderer-test/lib/index.ts index 7a5e6a59..fe369696 100644 --- a/packages/plugin-renderer-test/lib/index.ts +++ b/packages/plugin-renderer-test/lib/index.ts @@ -1,5 +1,3 @@ -import TestSystem from './system'; -import Test2System from './system2'; -import TestComponent from './component'; - -export { TestComponent, TestSystem, Test2System }; +export { default as TestSystem } from './system'; +export { default as Test2System } from './system2'; +export { default as TestComponent } from './component'; \ No newline at end of file diff --git a/packages/plugin-renderer-text/lib/index.ts b/packages/plugin-renderer-text/lib/index.ts index c056c88b..3e1136dd 100644 --- a/packages/plugin-renderer-text/lib/index.ts +++ b/packages/plugin-renderer-text/lib/index.ts @@ -1,4 +1,3 @@ -import Text from './component'; -import type {TextParams} from './component'; -import TextSystem from './system'; -export {Text, TextSystem, TextParams}; +export { default as Text } from './component'; +export { default as TextSystem } from './system'; +export type { TextParams } from './component'; diff --git a/packages/plugin-renderer-tiling-sprite/lib/index.ts b/packages/plugin-renderer-tiling-sprite/lib/index.ts index 53a1c961..68eddc1a 100644 --- a/packages/plugin-renderer-tiling-sprite/lib/index.ts +++ b/packages/plugin-renderer-tiling-sprite/lib/index.ts @@ -1,4 +1,3 @@ -import TilingSprite from './component'; -import type { TilingSpriteParams } from './component'; -import TilingSpriteSystem from './system'; -export { TilingSprite, TilingSpriteSystem, TilingSpriteParams }; +export { default as TilingSprite } from './component'; +export { default as TilingSpriteSystem } from './system'; +export type { TilingSpriteParams } from './component'; diff --git a/packages/plugin-sound/lib/index.ts b/packages/plugin-sound/lib/index.ts index 7d0a0fa8..f64a9d88 100644 --- a/packages/plugin-sound/lib/index.ts +++ b/packages/plugin-sound/lib/index.ts @@ -1,4 +1,2 @@ -import SoundSystem from './SoundSystem'; -import Sound from './Sound'; - -export { Sound, SoundSystem }; +export { default as SoundSystem } from './SoundSystem'; +export { default as Sound } from './Sound'; diff --git a/packages/plugin-stats/lib/index.ts b/packages/plugin-stats/lib/index.ts index 8b431024..f4ec43e7 100644 --- a/packages/plugin-stats/lib/index.ts +++ b/packages/plugin-stats/lib/index.ts @@ -1,7 +1,9 @@ +import Stats from './StatsComponent'; import StatsSystem from './StatsSystem'; -import StatsComponent from './StatsComponent'; + export default { - Components: [StatsComponent], + Components: [Stats], Systems: [StatsSystem], }; -export {StatsComponent as Stats, StatsSystem}; + +export { Stats, StatsSystem }; diff --git a/packages/plugin-transition/lib/index.ts b/packages/plugin-transition/lib/index.ts index c6253db2..cce2402b 100644 --- a/packages/plugin-transition/lib/index.ts +++ b/packages/plugin-transition/lib/index.ts @@ -1,3 +1,2 @@ -import Transition from './component'; -import TransitionSystem from './system'; -export {Transition, TransitionSystem}; +export { default as Transition } from './component'; +export { default as TransitionSystem } from './system'; diff --git a/packages/renderer-adapter/lib/index.ts b/packages/renderer-adapter/lib/index.ts index 4ae6f889..c448fe72 100644 --- a/packages/renderer-adapter/lib/index.ts +++ b/packages/renderer-adapter/lib/index.ts @@ -1,19 +1,8 @@ -import Application from './Application'; -import Container from './Container'; -import Graphics from './Graphics'; -import NinePatch from './NinePatch'; -import Sprite from './Sprite'; -import SpriteAnimation from './SpriteAnimation'; -import Text from './Text'; -import TilingSprite from './TilingSprite'; - -export { - Application, - Container, - Graphics, - NinePatch, - Sprite, - SpriteAnimation, - Text, - TilingSprite, -}; +export { default as Application } from './Application'; +export { default as Container } from './Container'; +export { default as Graphics } from './Graphics'; +export { default as NinePatch } from './NinePatch'; +export { default as Sprite } from './Sprite'; +export { default as SpriteAnimation } from './SpriteAnimation'; +export { default as Text } from './Text'; +export { default as TilingSprite } from './TilingSprite'; diff --git a/rollup.config.dev.js b/rollup.config.dev.js deleted file mode 100644 index 047a12c7..00000000 --- a/rollup.config.dev.js +++ /dev/null @@ -1,16 +0,0 @@ -const path = require('path'); -const rollup = require('rollup'); -const loadConfigFile = require('rollup/dist/loadConfigFile'); - -loadConfigFile(path.resolve(__dirname, 'rollup.config.js')).then(async ({options, warnings}) => { - console.log(`We currently have ${warnings.count} warnings`); - - warnings.flush(); - - for (const optionsObj of options) { - const bundle = await rollup.rollup(optionsObj); - await Promise.all(optionsObj.output.map(bundle.write)); - } - - rollup.watch(options); -}); diff --git a/rollup.config.js b/rollup.config.js index 906142e7..cf16d2bc 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -3,9 +3,6 @@ import replace from 'rollup-plugin-replace'; import json from '@rollup/plugin-json'; import typescript from 'rollup-plugin-typescript2'; import {terser} from 'rollup-plugin-terser'; -import serve from 'rollup-plugin-serve'; -import livereload from 'rollup-plugin-livereload'; -import copy from 'rollup-plugin-copy'; import miniProgramPlugin from './rollup.miniprogram.plugin'; if (!process.env.TARGET) { @@ -36,7 +33,7 @@ const outputConfigs = { }, umd: { name: pkg.bundle, - file: path.resolve(evajsCDNDir, `${pkg.bundle}.js`), + file: resolve(`dist/${pkg.bundle}.js`), format: 'umd', }, miniprogram: { @@ -58,16 +55,8 @@ if (!process.env.PROD_ONLY) { packageFormats.forEach(format => { if (!outputConfigs[format]) return; - if (format === 'esm') { - packageConfigs.push(createEsmDevelopConfig(format)); - } - - if (format === 'cjs') { - packageConfigs.push(createCjsDevelopConfig(format)); - } - - if (format === 'umd' && pkg.bundle) { - packageConfigs.push(createUmdDevelopConfig(format)); + if (format === 'esm' || format === 'cjs' || (format === 'umd' && pkg.bundle)) { + packageConfigs.push(createConfig(format, outputConfigs[format])); } }); } @@ -169,13 +158,6 @@ function createConfig(format, output, plugins = []) { }; } -function createCjsDevelopConfig(format) { - return createConfig(format, { - file: outputConfigs[format].file, - format: outputConfigs[format].format, - }); -} - function createCjsProductionConfig(format) { return createConfig( format, @@ -193,42 +175,9 @@ function createCjsProductionConfig(format) { ); } -function createEsmDevelopConfig(format) { - return createConfig(format, { - file: outputConfigs[format].file, - format: outputConfigs[format].format, - }); -} - -function createUmdDevelopConfig(format) { - let plugins = [ - copy({ - targets: [{src: outputConfigs[format].file, dest: resolve(`dist`)}], - hook: 'writeBundle', - copyOnce: true, - }), - ]; - - if (process.env.ROLLUP_WATCH) { - plugins.push( - ...[ - serve({ - open: true, - contentBase: [exampleDir, rootDir], - host: 'localhost', - port: 8080, - }), - livereload(evajsCDNDir), - ], - ); - } - - return createConfig(format, outputConfigs[format], plugins); -} - function createMinifiedConfig(format) { const {file, name} = outputConfigs[format]; - const destFilename = file.replace('dist/cdn', 'dist/cdn/min').replace(/\.js$/, '.min.js'); + const destFilename = file.replace(/\.js$/, '.min.js'); return createConfig( format, { @@ -243,11 +192,6 @@ function createMinifiedConfig(format) { output: {comments: false}, compress: true, }), - copy({ - targets: [{src: destFilename, dest: resolve(`dist`)}], - hook: 'writeBundle', - copyOnce: true, - }), ], ); } diff --git a/scripts/build.js b/scripts/build.js index fe302830..ef056edc 100644 --- a/scripts/build.js +++ b/scripts/build.js @@ -151,7 +151,7 @@ function checkAllSizes(targets) { function checkSize(target) { const pkgDir = path.resolve(`packages/${target}`); const pkg = require(`${pkgDir}/package.json`); - checkFileSize(`packages/dist/cdn/${pkg.bundle}.js`); + checkFileSize(`${pkgDir}/dist/${pkg.bundle}.js`); } function checkFileSize(filePath) { diff --git a/scripts/dev.js b/scripts/dev.js deleted file mode 100644 index 90e0e687..00000000 --- a/scripts/dev.js +++ /dev/null @@ -1,27 +0,0 @@ -/** - * 开发时使用,可以watch代码变化rebuild - * - * USAGE: - * - * $tnpm run dev eva.js - */ -const path = require('path'); -const execa = require('execa'); -const {fuzzyMatchTarget} = require('./utils'); -const args = require('minimist')(process.argv.slice(2)); - -const target = args._.length ? fuzzyMatchTarget(args._)[0] : 'eva.js'; -// const formats = args.formats || args.f; -const commit = execa.sync('git', ['rev-parse', 'HEAD']).stdout.slice(0, 7); - -const rollupDevConfigFilePath = path.resolve(__dirname, '../rollup.config.dev.js'); - -execa('node', [rollupDevConfigFilePath], { - stdio: 'inherit', - env: { - COMMIT: commit, - TARGET: target, - FORMATS: 'umd', - ROLLUP_WATCH: true, - }, -}); diff --git a/scripts/setupJestEnv.ts b/scripts/setupJestEnv.ts index cccca10d..72761ca7 100644 --- a/scripts/setupJestEnv.ts +++ b/scripts/setupJestEnv.ts @@ -15,7 +15,7 @@ expect.extend({ `expected "${received}" to have been warned` + (msgs.length ? `.\n\nActual messages:\n\n - ${msgs}` - : ` but no warning was recorded.`) + : 'but no warning was recorded.') } } }, @@ -69,7 +69,7 @@ const asserted: Set = new Set() beforeEach(() => { asserted.clear() warn = jest.spyOn(console, 'warn') - warn.mockImplementation(() => {}) + warn.mockImplementation(() => { }) }) afterEach(() => { @@ -90,3 +90,7 @@ afterEach(() => { ) } }) + +// dont remove this line, cause of typescript TS1208 error. +// https://github.com/Microsoft/TypeScript/blob/main/src/compiler/diagnosticMessages.json#L662 +export { }; diff --git a/test/.gitkeep b/test/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/tsconfig.json b/tsconfig.json index 4a63c017..3bdc02be 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -22,7 +22,7 @@ "isolatedModules": true, "lib": [ "esnext", - "dom", + "dom" ], "types": [ "jest", @@ -32,81 +32,18 @@ "@eva/miniprogram-*": [ "packages/eva-miniprogram-*/lib" ], - "@eva/eva.js": [ - "packages/eva.js/lib" - ], "@eva/miniprogram-pixi": [ "packages/miniprogram-pixi/lib" ], - "@eva/plugin-a11y": [ - "packages/plugin-a11y/lib" - ], - "@eva/plugin-evax": [ - "packages/plugin-evax/lib" - ], - "@eva/plugin-matterjs": [ - "packages/plugin-matterjs/lib" - ], - "@eva/plugin-renderer": [ - "packages/plugin-renderer/lib" - ], - "@eva/plugin-renderer-dragonbone": [ - "packages/plugin-renderer-dragonbone/lib" - ], - "@eva/plugin-renderer-event": [ - "packages/plugin-renderer-event/lib" - ], - "@eva/plugin-renderer-graphics": [ - "packages/plugin-renderer-graphics/lib" - ], - "@eva/plugin-renderer-img": [ - "packages/plugin-renderer-img/lib" - ], - "@eva/plugin-renderer-lottie": [ - "packages/plugin-renderer-lottie/lib" - ], - "@eva/plugin-renderer-mask": [ - "packages/plugin-renderer-mask/lib" - ], - "@eva/plugin-renderer-nine-patch": [ - "packages/plugin-renderer-nine-patch/lib" - ], - "@eva/plugin-renderer-render": [ - "packages/plugin-renderer-render/lib" - ], - "@eva/plugin-renderer-spine": [ - "packages/plugin-renderer-spine/lib" - ], - "@eva/plugin-renderer-sprite": [ - "packages/plugin-renderer-sprite/lib" - ], - "@eva/plugin-renderer-sprite-animation": [ - "packages/plugin-renderer-sprite-animation/lib" - ], - "@eva/plugin-renderer-text": [ - "packages/plugin-renderer-text/lib" - ], - "@eva/plugin-renderer-tiling-sprite": [ - "packages/plugin-renderer-tiling-sprite/lib" - ], - "@eva/plugin-sound": [ - "packages/plugin-sound/lib" - ], - "@eva/plugin-stats": [ - "packages/plugin-stats/lib" - ], - "@eva/plugin-transition": [ - "packages/plugin-transition/lib" - ], "@eva/*": [ "packages/*/lib" - ], + ] } }, "include": [ "packages/global.d.ts", "packages/*/lib", "packages/*/__tests__", - "vite-test" - ], + "examples" + ] } \ No newline at end of file diff --git a/vite-test/index.html b/vite-test/index.html deleted file mode 100644 index 406ee87b..00000000 --- a/vite-test/index.html +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - 测试 - - - - - - - - \ No newline at end of file diff --git a/vite-test/index.ts b/vite-test/index.ts deleted file mode 100644 index 11fae232..00000000 --- a/vite-test/index.ts +++ /dev/null @@ -1,39 +0,0 @@ -type ExampleModule = () => Promise<{ - name: string, - init: (canvas: HTMLCanvasElement) => void -}> -//@ts-ignore -const modules: { [key: string]: ExampleModule } = import.meta.glob('./ts/*.ts'); -const moduleEntries = Object.entries(modules); -declare const canvas: HTMLCanvasElement; -const path = location.hash.replace('#', ''); -import VConsole from "vconsole"; -if (/android|phone|mobile|ipad/i.test(navigator.userAgent) && location.search.length < 1) { - try { - new VConsole(); - } catch (e) { - alert(e.message) - } -} -window.onhashchange = e => { - location.reload(); -} -if (modules[path]) { - (async () => { - const module = await modules[path](); - document.title = module.name; - module.init(canvas); - })() -} else { - canvas.remove(); - Object.keys(modules).forEach(url => { - let btn = document.createElement('div'); - btn.className = 'link'; - btn.innerText = url.split('/').pop().split('.ts')[0]; - btn.onclick = () => { - location.hash = url; - }; - document.body.appendChild(btn); - document.body.appendChild(document.createElement('br')); - }); -} \ No newline at end of file diff --git a/vite-test/ts/compressed-texture.ts b/vite-test/ts/compressed-texture.ts deleted file mode 100644 index 2cddc904..00000000 --- a/vite-test/ts/compressed-texture.ts +++ /dev/null @@ -1,75 +0,0 @@ -import { Game, GameObject, resource, RESOURCE_TYPE } from "../../packages/eva.js/lib"; -import { INTERNAL_FORMATS, RendererSystem } from "../../packages/plugin-renderer/lib"; -import { Img, ImgSystem } from "../../packages/plugin-renderer-img/lib"; -import { useCompressedTexture } from "../../packages/plugin-renderer/lib"; - -export const name = 'compressed-textures'; -export async function init(canvas: HTMLCanvasElement) { - useCompressedTexture(resource); - resource.addResource([ - { - name: 'imageName', - type: RESOURCE_TYPE.IMAGE, - src: { - image: { - type: 'png', - url: './person.png', - texture: [{ - type: 'etc', - internalFormat: INTERNAL_FORMATS.COMPRESSED_RGBA_ASTC_4x4_KHR, - url: './person.etc.ktx' - }, { - type: 'astc', - internalFormat: INTERNAL_FORMATS.COMPRESSED_RGBA_ASTC_4x4_KHR, - url: './person.astc.ktx' - }, { - type: 's3tc', - internalFormat: INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT5_EXT, - url: './person.s3tc.ktx' - },] - }, - }, - preload: false, - }, - ]); - const game = new Game({ - systems: [ - //@ts-ignore - new RendererSystem({ - canvas, - width: window.innerWidth, - height: window.innerHeight, - backgroundColor: '0xff0000', - useCompressedTexture: true - }), - //@ts-ignore - new ImgSystem(), - ], - }); - const res = await resource.getResource('imageName'); - console.log('load finish ', res); - console.log('load target ', res.data.image); - - const image = new GameObject('image', { - size: { width: window.innerWidth, height: window.innerWidth }, - origin: { x: 0, y: 0 }, - position: { - x: 0, - y: 0, - }, - anchor: { - x: 0, - y: 0, - }, - }); - //@ts-ignore - const img = new Img({ - resource: 'imageName', - }); - image.addComponent( - ///@ts-ignore - img, - ); - - game.scene.addChild(image); -} \ No newline at end of file diff --git a/vite.config.ts b/vite.config.ts index dd1746f9..44324fa8 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,5 +1,5 @@ -import { resolve } from "path"; -import { defineConfig } from "vite"; +import { resolve } from 'path'; +import { defineConfig } from 'vite'; export default defineConfig({ server: { @@ -7,15 +7,17 @@ export default defineConfig({ port: 8083, host: '0.0.0.0', }, - publicDir:'./public/', + publicDir: './public/', base: './', - root:'./vite-test', + root: './examples', resolve: { alias: [ { - find:/@eva\/(.*)/, - replacement: (()=>{console.log('?');return resolve(__dirname, './packages/$1/lib')})() - } - ] - } -}) \ No newline at end of file + find: /@eva\/(.*)/, + replacement: (() => { + return resolve(__dirname, './packages/$1/lib'); + })(), + }, + ], + }, +});